修复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,35 +82,36 @@
</swiper-item>
</swiper>
<up-transition :show="tabsActive==0">
<view class="fiexd-btn-box cart-btn">
<view class="cart-check" @click="changeAll(checkAll===cartInfo.count)">
<image v-if="checkAll!=cartInfo.count" src="@/static/icon/n-check.png"></image>
<image v-else src="@/static/icon/check.png"></image>
<text style="font-size: 24rpx;">全选</text>
<text style="font-size: 24rpx;" v-if="checkAll">({{checkAll}})</text>
</view>
<view v-if="!isAdmin" class="btn-boxs">
<view class="all-price">
<view style="width: 80rpx;">合计:</view>
<view class="price">
<text style="font-size: 24rpx;">¥</text>
<text style="font-size: 34rpx;">{{c_price0}}</text>
<text style="font-size: 24rpx;">.{{c_price1}}</text>
</view>
</view>
<view style="width: 200rpx;">
<up-button color="#20b128" shape="circle" :disabled="!checkAll" @click="settleAccounts">去结算<text v-if="checkAll">({{checkAll}})</text></up-button>
</view>
<up-transition :show="tabsActive==0">
<view class="fiexd-btn-box cart-btn">
<view class="cart-check" @click="changeAll(checkAll===cartInfo.count)">
<image v-if="checkAll!=cartInfo.count" src="@/static/icon/n-check.png"></image>
<image v-else src="@/static/icon/check.png"></image>
<text style="font-size: 24rpx;">全选</text>
<text style="font-size: 24rpx;" v-if="checkAll">({{checkAll}})</text>
</view>
<view v-if="!isAdmin" class="btn-boxs">
<view class="all-price">
<view style="width: 80rpx;">合计:</view>
<view class="price">
<text style="font-size: 24rpx;">¥</text>
<text style="font-size: 34rpx;">{{c_price0}}</text>
<text style="font-size: 24rpx;">.{{c_price1}}</text>
</view>
</view>
<view v-else class="btn-boxs">
<!-- <view style="width: 100px;margin-right: 20rpx;"><up-button size="small" plain color="#989898" shape="circle">移入收藏夹</up-button></view> -->
<view style="width: 100px;"><up-button @click="deleteCartList()" size="small" plain color="#989898" shape="circle">删除</up-button></view>
<view style="width: 200rpx;">
<up-button color="#20b128" shape="circle" :disabled="!checkAll" @click="settleAccounts">去结算<text v-if="checkAll">({{checkAll}})</text></up-button>
</view>
</view>
</up-transition>
<goodPopup ref="goodRef" :show="showGoodPopup" @close="showGoodPopup=false" @change="changeGood" />
</view>
<view v-else class="btn-boxs">
<!-- <view style="width: 100px;margin-right: 20rpx;"><up-button size="small" plain color="#989898" shape="circle">移入收藏夹</up-button></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>
<script setup>
@ -273,17 +274,19 @@
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%;
}
}
.swiper-item {
height: 100%;
}
.page-box1 {

View File

@ -1,9 +1,9 @@
<template>
<view>
<up-navbar placeholder style="z-index: 10080;" @leftClick="navBack">
<template #center>
<view>订单</view>
</template>
<view class="wrap">
<up-navbar placeholder style="z-index: 100800;" @leftClick="navBack">
<template #center>
<view>订单</view>
</template>
</up-navbar>
<up-sticky bgColor="#fff">
<view style="padding: 10rpx 20rpx 0 20rpx;">
@ -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>
@ -93,7 +94,7 @@
cancelId = e.id;
showCancel.value = true;
}
//
const showTake = ref(false);
let takeId = "";
@ -101,21 +102,21 @@
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();
})
}
//
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,21 +216,21 @@
}
let back = 0;
const navBack = ()=>{
const navBack = () => {
uni.navigateBack({
delta: back ? +back : 0
})
}
const reloadAll = () => { //
where.value.forEach(item=>{
item.page_no = 1;
item.loadend = false;
});
getOrderList(1, '', 0);
getOrderList(0);
getOrderList(2, 1);
}
where.value.forEach(item => {
item.page_no = 1;
item.loadend = false;
});
getOrderList(1, '', 0);
getOrderList(0);
getOrderList(2, 1);
}
onLoad((options) => {
if (options.type) {
@ -237,33 +238,33 @@
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);
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;
}
.swiper-item {
height: 100%;
}
.page-box {