修复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> <template>
<view> <view class="wrap">
<up-navbar placeholder :autoBack="true"> <up-navbar placeholder :autoBack="true">
<template #center> <template #center>
<view style="display: flex;align-items: center;width: 100%;justify-content: flex-start;margin-left: 100rpx;"> <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 class="swiper-box" :current="swiperCurrent" @animationfinish="animationfinish">
<swiper-item class="swiper-item"> <swiper-item class="swiper-item">
<scroll-view scroll-y style="height: 100%;width: 100%;"> <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 class="total">
<view>共计<text style="color: #20B128;">{{cartList.length}}</text></view> <view>共计<text style="color: #20B128;">{{cartList.length}}</text></view>
<view v-if="!isAdmin" @click="isAdmin=true;">管理</view> <view v-if="!isAdmin" @click="isAdmin=true;">管理</view>
<view v-else @click="isAdmin=false;">完成</view> <view v-else @click="isAdmin=false;">完成</view>
</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-item" v-for="(item, index) in cartList" :key="index" @click="openGoodPopup(item)">
<view class="shop-check" @click.stop="checkItem(item, !item.check)"> <view class="shop-check" @click.stop="checkItem(item, !item.check)">
<image v-if="!item.check" src="@/static/icon/n-check.png"></image> <image v-if="!item.check" src="@/static/icon/n-check.png"></image>
@ -82,35 +82,36 @@
</swiper-item> </swiper-item>
</swiper> </swiper>
<up-transition :show="tabsActive==0">
<view class="fiexd-btn-box cart-btn"> </view>
<view class="cart-check" @click="changeAll(checkAll===cartInfo.count)"> <up-transition :show="tabsActive==0">
<image v-if="checkAll!=cartInfo.count" src="@/static/icon/n-check.png"></image> <view class="fiexd-btn-box cart-btn">
<image v-else src="@/static/icon/check.png"></image> <view class="cart-check" @click="changeAll(checkAll===cartInfo.count)">
<text style="font-size: 24rpx;">全选</text> <image v-if="checkAll!=cartInfo.count" src="@/static/icon/n-check.png"></image>
<text style="font-size: 24rpx;" v-if="checkAll">({{checkAll}})</text> <image v-else src="@/static/icon/check.png"></image>
</view> <text style="font-size: 24rpx;">全选</text>
<view v-if="!isAdmin" class="btn-boxs"> <text style="font-size: 24rpx;" v-if="checkAll">({{checkAll}})</text>
<view class="all-price"> </view>
<view style="width: 80rpx;">合计:</view> <view v-if="!isAdmin" class="btn-boxs">
<view class="price"> <view class="all-price">
<text style="font-size: 24rpx;">¥</text> <view style="width: 80rpx;">合计:</view>
<text style="font-size: 34rpx;">{{c_price0}}</text> <view class="price">
<text style="font-size: 24rpx;">.{{c_price1}}</text> <text style="font-size: 24rpx;">¥</text>
</view> <text style="font-size: 34rpx;">{{c_price0}}</text>
</view> <text style="font-size: 24rpx;">.{{c_price1}}</text>
<view style="width: 200rpx;">
<up-button color="#20b128" shape="circle" :disabled="!checkAll" @click="settleAccounts">去结算<text v-if="checkAll">({{checkAll}})</text></up-button>
</view> </view>
</view> </view>
<view v-else class="btn-boxs"> <view style="width: 200rpx;">
<!-- <view style="width: 100px;margin-right: 20rpx;"><up-button size="small" plain color="#989898" shape="circle">移入收藏夹</up-button></view> --> <up-button color="#20b128" shape="circle" :disabled="!checkAll" @click="settleAccounts">去结算<text v-if="checkAll">({{checkAll}})</text></up-button>
<view style="width: 100px;"><up-button @click="deleteCartList()" size="small" plain color="#989898" shape="circle">删除</up-button></view>
</view> </view>
</view> </view>
</up-transition> <view v-else class="btn-boxs">
<goodPopup ref="goodRef" :show="showGoodPopup" @close="showGoodPopup=false" @change="changeGood" /> <!-- <view style="width: 100px;margin-right: 20rpx;"><up-button size="small" plain color="#989898" shape="circle">移入收藏夹</up-button></view> -->
</view> <view style="width: 100px;"><up-button @click="deleteCartList()" size="small" plain color="#989898" shape="circle">删除</up-button></view>
</view>
</view>
</up-transition>
<goodPopup ref="goodRef" :show="showGoodPopup" @close="showGoodPopup=false" @change="changeGood" />
</template> </template>
<script setup> <script setup>
@ -273,17 +274,19 @@
transition: 300ms; transition: 300ms;
} }
.wrap {
display: flex;
flex-direction: column;
height: calc(100vh - var(--window-top));
width: 100%;
}
.swiper-box { .swiper-box {
flex: 1; flex: 1;
height: calc(100vh - var(--window-top)); }
/* #ifdef H5 */
height: calc(100vh - 44px);
/* #endif */
width: 100%;
.swiper-item { .swiper-item {
height: 100%; height: 100%;
}
} }
.page-box1 { .page-box1 {

View File

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