修复bug

This commit is contained in:
weipengfei 2024-05-10 09:09:20 +08:00
parent 63af2aa701
commit 25cd71c10d
2 changed files with 85 additions and 81 deletions

View File

@ -1,5 +1,5 @@
<template>
<view>
<view class="wrap">
<up-navbar placeholder :autoBack="true">
<template #center>
<view style="display: flex;align-items: center;width: 100%;justify-content: flex-start;margin-left: 100rpx;">
@ -14,13 +14,13 @@
<swiper class="swiper-box" :current="swiperCurrent" @animationfinish="animationfinish">
<swiper-item class="swiper-item">
<scroll-view scroll-y style="height: 100%;width: 100%;">
<view class="page-box1">
<view class="page-box1" style="padding-top: 60rpx;">
<view class="total">
<view>共计<text style="color: #20B128;">{{cartList.length}}</text></view>
<view v-if="!isAdmin" @click="isAdmin=true;">管理</view>
<view v-else @click="isAdmin=false;">完成</view>
</view>
<view v-if="cartList.length>0" class="list" style="margin-top: 80rpx;">
<view v-if="cartList.length>0" class="list">
<view class="shop-item" v-for="(item, index) in cartList" :key="index" @click="openGoodPopup(item)">
<view class="shop-check" @click.stop="checkItem(item, !item.check)">
<image v-if="!item.check" src="@/static/icon/n-check.png"></image>
@ -82,6 +82,8 @@
</swiper-item>
</swiper>
</view>
<up-transition :show="tabsActive==0">
<view class="fiexd-btn-box cart-btn">
<view class="cart-check" @click="changeAll(checkAll===cartInfo.count)">
@ -110,7 +112,6 @@
</view>
</up-transition>
<goodPopup ref="goodRef" :show="showGoodPopup" @close="showGoodPopup=false" @change="changeGood" />
</view>
</template>
<script setup>
@ -273,18 +274,20 @@
transition: 300ms;
}
.wrap {
display: flex;
flex-direction: column;
height: calc(100vh - var(--window-top));
width: 100%;
}
.swiper-box {
flex: 1;
height: calc(100vh - var(--window-top));
/* #ifdef H5 */
height: calc(100vh - 44px);
/* #endif */
width: 100%;
}
.swiper-item {
height: 100%;
}
}
.page-box1 {
position: relative;

View File

@ -1,6 +1,6 @@
<template>
<view>
<up-navbar placeholder style="z-index: 10080;" @leftClick="navBack">
<view class="wrap">
<up-navbar placeholder style="z-index: 100800;" @leftClick="navBack">
<template #center>
<view>订单</view>
</template>
@ -19,8 +19,8 @@
<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="loadMoreGood">
<view class="page-box">
<view v-if="list.length>0" class="list">
<good v-for="(item, index) in list" :datas="item" :key="index" :type="k" @cancleOrder="cancleOrder" @takeOrder="takeOrder"
@rePay="rePay" @purchaseAgain="purchaseAgain"></good>
<good v-for="(item, index) in list" :datas="item" :key="index" :type="k" @cancleOrder="cancleOrder"
@takeOrder="takeOrder" @rePay="rePay" @purchaseAgain="purchaseAgain"></good>
</view>
<view v-if="!where[k].loading&&list.length==0" style="padding-top: 100rpx;">
<up-empty text="订单空空如也"
@ -30,11 +30,12 @@
<view v-else-if="where[k].loadend" style="padding-top: 100rpx;">
<view style="text-align: center;color: #999;">没有更多了</view>
</view>
<view v-if="where[k].loading" style="padding-top: 100rpx;display: flex;flex-direction: column;align-items: center;">
<view v-if="where[k].loading"
style="padding-top: 100rpx;display: flex;flex-direction: column;align-items: center;">
<up-loading-icon mode="circle"></up-loading-icon>
<view style="margin-top: 20rpx;color: #999;">加载中</view>
</view>
<view style="width: 100%;height: 200rpx;"></view>
<view style="width: 100%;height: 300rpx;"></view>
</view>
</scroll-view>
</swiper-item>
@ -101,10 +102,10 @@
takeId = e.id;
showTake.value = true;
}
const confirmReceipt = ()=>{
const confirmReceipt = () => {
confirmReceiptApi({
order_id: takeId
}).then(res=>{
}).then(res => {
showTake.value = false;
uni.$u.toast('确认收货成功');
reloadAll();
@ -112,10 +113,10 @@
}
//
const purchaseAgain = (e)=>{
const purchaseAgain = (e) => {
purchaseAgainApi({
order_id: e.id
}).then(res=>{
}).then(res => {
uni.$u.toast('已加入购物车');
})
}
@ -179,7 +180,7 @@
[],
])
const getOrderList = (type = 0, status = '', paid = 1) => {
if(where.value[type].loadend) return ;
if (where.value[type].loadend) return;
where.value[type].loading = true;
orderListApi({
page_no: where.value[type].page_no,
@ -188,17 +189,17 @@
status: status,
paid: paid
}).then(res => {
if(where.value[type].page_no==1) orderList.value[type] = [];
if (where.value[type].page_no == 1) orderList.value[type] = [];
orderList.value[type] = [...orderList.value[type], ...res.data.lists];
if(res.data.lists.length<where.value[type].page_size)where.value[type].loadend = true;
if (res.data.lists.length < where.value[type].page_size) where.value[type].loadend = true;
where.value[type].page_no++;
where.value[type].loading = false;
}).catch(err=>{
}).catch(err => {
where.value[type].loading = false;
})
}
const loadMoreGood = ()=>{
const loadMoreGood = () => {
if (swiperCurrent.value == 0) getOrderList(0);
if (swiperCurrent.value == 1) getOrderList(1, '', 0);
if (swiperCurrent.value == 2) getOrderList(2, 1);
@ -215,14 +216,14 @@
}
let back = 0;
const navBack = ()=>{
const navBack = () => {
uni.navigateBack({
delta: back ? +back : 0
})
}
const reloadAll = () => { //
where.value.forEach(item=>{
where.value.forEach(item => {
item.page_no = 1;
item.loadend = false;
});
@ -237,7 +238,7 @@
swiperCurrent.value = +options.type;
searchOn();
}
if(options.back) back = options.back;
if (options.back) back = options.back;
// getOrderList(0);
// getOrderList(1, '', 0);
// getOrderList(2, 1);
@ -245,25 +246,25 @@
uni.$on('reLoadOrderList', reloadAll);
})
onUnload(()=>{
onUnload(() => {
uni.$off('reLoadOrderList', reloadAll)
})
</script>
<style lang="scss">
.wrap {
display: flex;
flex-direction: column;
height: calc(100vh - var(--window-top));
width: 100%;
}
.swiper-box {
flex: 1;
height: calc(100vh - var(--window-top) - 140rpx);
/* #ifdef H5 */
height: calc(100vh - 210rpx);
/* #endif */
width: 100%;
}
.swiper-item {
height: 100%;
// background-color: pink;
}
}
.page-box {