jiuyiUniapp/jiuyi2/pages/index/seedLog.vue

121 lines
2.2 KiB
Vue

<script setup>
/**
* 种子变动明细
*/
import {
ref,
reactive,
computed,
} from 'vue'
import {
onLoad,
onReachBottom,
onPullDownRefresh
} from '@dcloudio/uni-app'
import {
useStore
} from 'vuex'
// 顶部
import apex from '/components/header/apex'
import api from '@/api/index.js';
// 工具库
import util from '@/common/js/util.js'
const store = useStore()
//积分变动记录
const list = reactive({
data: [],
pageNum: 1,
pageSize: 20,
total: 0,
})
// 榴莲树id
const id = ref('')
// 用户信息
const userinfo = computed(() => {
let result = store.state.userinfo
return result
})
onLoad((option) => {
if (option.id) id.value = option.id
// 获取列表
getList()
})
onPullDownRefresh(() => {
// 刷新列表
refreshList()
})
onReachBottom(() => {
// 获取更多列表
getMoreList()
})
// 刷新列表
function refreshList() {
list.homePageSize = 1
getList()
}
// 获取更多列表
function getMoreList() {
if (list.total <= list.data.length) return
list.pageNum++
getList()
}
// 积分变动明细
function getList() {
api.mine.getWalletBillList({
query: {
pageSize: list.pageSize,
pageNum: list.pageNum,
type: 'seed',
}
}).then(rs => {
if (rs.code == 200) {
if (list.pageNum == 1) list.data.length = 0
list.data.push(...rs.rows)
list.total = rs.total
return
}
util.alert({
content: rs.msg,
showCancel: false,
})
}).finally(() => {
// 停止下拉刷新
uni.stopPullDownRefresh()
})
}
</script>
<template>
<view class="app">
<view class="list">
<view class="li" v-for="(item,index) in list.data" :key="index">
<view class="item rows ptb30 plr20 bfff">
<view class="col oh f1">
<view class="c333 f36">{{item.reason}}</view>
<view class="mt20 c666 f28">{{item.createTime}}</view>
</view>
<view class="change fs0 c333 f36">
<text>{{item.amount}}</text>
</view>
</view>
</view>
<!-- 暂无更多 -->
<view class="nomore mtb50" v-if="!list.data[0]">暂无明细~</view>
</view>
<!-- 填充 -->
<view class="fill"></view>
</view>
</template>
<style lang="scss">
//
</style>