整理订单状态显示及功能按钮

This commit is contained in:
geng.tang@qq.com
2024-01-26 15:31:43 +08:00
parent e954472f26
commit 3b5615eeef
10 changed files with 346 additions and 165 deletions

View File

@@ -4,38 +4,37 @@
<u-icon class="icon" size="22" name="calendar"></u-icon>
<text v-if="createTimeStart && createTimeEnd">{{ createTimeStart }} ~ {{ createTimeEnd }}</text>
</view> -->
<mescroll-uni @init="mescrollInit" @down="downCallback" :up="upOption" @up="upCallback" @emptyclick="emptyClick">
<view class="order" v-for="(item,index) in datas" :key="index">
<view class="fenqi">
<block>
<view class="item">
<view class="goods-info">
<view class="goods-name">
<text class="name">{{item.applyStatusDis}}</text>
<text v-if="item.rejectReason" class="selling-point">拒绝理由{{ item.rejectReason }}</text>
<image v-if="item.image" :src="item.image" mode="widthFix" style="width: 100px;" @click="proView(item.image)"></image>
<text class="selling-point">申请时间{{ item.createTime }}</text>
</view>
<view class="goods-price">
<!-- <text class="add-price"
v-if="item.scene == 10 || item.scene == 40">+{{ item.money }}</text>
<text class="sub-price" v-if="item.scene == 20">-{{ item.money }}</text>
<block v-if="item.scene == 30">
<text class="add-price" v-if="item.money > 0">+{{ item.money }}</text>
<text class="sub-price" v-else>-{{ Math.abs(item.money) }}</text>
</block> -->
<text class="num">{{ item.money }}</text>
</view>
<view class="order" v-for="(item,index) in pageData" :key="index">
<view class="fenqi">
<block>
<view class="item">
<view class="goods-info">
<view class="goods-name">
<text class="name">{{item.applyStatusDis}}</text>
<text v-if="item.rejectReason" class="selling-point">拒绝理由{{ item.rejectReason }}</text>
<image v-if="item.image" :src="item.image" mode="widthFix" style="width: 100px;" @click="proView(item.image)"></image>
<text class="selling-point">申请时间{{ item.createTime }}</text>
</view>
<view class="goods-price">
<!-- <text class="add-price"
v-if="item.scene == 10 || item.scene == 40">+{{ item.money }}</text>
<text class="sub-price" v-if="item.scene == 20">-{{ item.money }}</text>
<block v-if="item.scene == 30">
<text class="add-price" v-if="item.money > 0">+{{ item.money }}</text>
<text class="sub-price" v-else>-{{ Math.abs(item.money) }}</text>
</block> -->
<text class="num">{{ item.money }}</text>
</view>
</view>
</block>
</view>
</view>
</block>
</view>
</mescroll-uni>
</view>
<!-- <uni-pagination @change="handlePageChange"></uni-pagination> -->
<!-- <u-empty mode="order" icon="http://cdn.uviewui.com/uview/empty/car.png" text="暂无提现记录" v-if="list.length == 0">
<!-- <u-empty mode="order" icon="http://cdn.uviewui.com/uview/empty/car.png" text="暂无提现记录" v-if="pageData.length == 0">
</u-empty> -->
<!-- <mescroll-empty v-if="dataList.length==0"></mescroll-empty> -->
<u-loadmore :status="status" v-if="pageData.length > 0" line icon-color="#028BF7" marginBottom="20" @loadmore="onLoadMoreData()"/>
</view>
</template>
@@ -45,27 +44,17 @@
} from '@/utils/util.js'
import store from '@/store';
import { ref } from 'vue';
import MescrollMixin from '@/components/mescroll-uni/mescroll-mixins';
import { withdrawPage } from '@/websoft/api/merchant.js'
import { withdrawPage } from '@/websoft/api/merchant.js';
export default {
mixins: [MescrollMixin], // 使用mixin
data() {
return {
upOption:{
// page: {
// size: 5 // 每页数据的数量
// },
noMoreSize: 4, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
empty:{
tip: '~ 搜索无数据 ~', // 提示
btnText: '去看看'
}
},
datas: [], //列表数据
// tabs: [{name:'全部',type:'xx'}, {name:'奶粉',type:'xx'}, {name:'面膜',type:'xx'}, {name:'图书',type:'xx'}],
// tabIndex: 0 // tab下标
}
pageNo:1,//当前页数
pageSize:10,//页数大小
totalPage:"",//总页数
pageData:[],//列表数据
status: 'loadmore',//状态
};
},
// onLoad(option) {
// const app = this
@@ -74,28 +63,6 @@
// onShow() {
// },
methods: {
upCallback(page) {
console.log(page)
const app = this
page.size = 5
withdrawPage({page:page.num,limit:page.size}).then(res=>{
//联网成功的回调,隐藏下拉刷新和上拉加载的状态;
// this.mescroll.endSuccess(res.data.count);
// app.mescroll.endBySize(page.size, res.data.count);
//设置列表数据
if(page.num == 1) app.datas = []; //如果是第一页需手动制空列表
app.datas=app.datas.concat(res.data.list); //追加新数据
// app.mescroll.endBySize(res.data.list.length, res.data.count);
let totalPage = res.data.count / page.size + (res.data.count % page.size == 0 ? 0 : 1);
let hasNext = (totalPage - page.num > 0);
app.mescroll.endSuccess(res.data.count, true);
}).catch(()=>{
//联网失败, 结束加载
this.mescroll.endErr();
})
},
openCalendar() {
this.show = true
},
@@ -112,7 +79,40 @@
uni.showToast({
title:'点击了按钮,具体逻辑自行实现'
})
},
loadData() {
const app = this
withdrawPage({page:app.pageNo,limit:app.pageSize}).then(res=>{
if(app.pageNo == 1) app.pageData = []
app.pageData = app.pageData.concat(res.data.list)
app.totalPage = Math.ceil(res.data.count / app.pageSize)
})
},
onLoadMoreData() {
if (this.pageNo < this.totalPage) {
this.pageNo++
this.loadData()
} else {
this.status = ''
uni.showToast({ title: '没有更多数据', icon: 'none' })
}
},
onReachBottom() {
console.log('上拉刷新')
this.onLoadMoreData();//修改页数后,重新获取数据
},
onPullDownRefresh() {
console.log('下拉刷新')
// 调用加载更多数据的方法
this.onLoadMoreData();
setTimeout(function () {
uni.stopPullDownRefresh();
}, 500);
}
},
mounted() {
this.loadData(); // 初次加载数据
}
}
</script>