This commit is contained in:
weipengfei 2024-05-07 15:12:40 +08:00
parent b53fefd79f
commit 810944474d
5 changed files with 17 additions and 46 deletions

View File

@ -20,20 +20,20 @@
<view>小计</view> <view>小计</view>
<view style="color: #F55726;">¥ {{subtotal}}</view> <view style="color: #F55726;">¥ {{subtotal}}</view>
</view> </view>
<view v-if="datas.is_bulk" class="row"> <view v-if="datas.is_bulk" class="row" style="margin-bottom: 60rpx;">
<view>商品重量<text style="color: #F55726;">*</text></view> <view>商品重量<text style="color: #F55726;">*</text></view>
<view><up-input v-model="datas.cart_num" border="none" placeholder="请输入重量" inputAlign="right"></up-input></view> <view><up-input v-model="datas.cart_num" border="none" placeholder="请输入重量" inputAlign="right"></up-input></view>
</view> </view>
<view v-else class="row"> <view v-else class="row" style="margin-bottom: 60rpx;">
<view>商品数量<text style="color: #F55726;">*</text></view> <view>商品数量<text style="color: #F55726;">*</text></view>
<view><up-input v-model="datas.cart_num" border="none" placeholder="请输入数量" inputAlign="right"></up-input></view> <view><up-input v-model="datas.cart_num" border="none" placeholder="请输入数量" inputAlign="right"></up-input></view>
</view> </view>
<view class="row"> <view class="row">
<view style="width: 30%;margin-right: 30rpx;"> <view style="width: 30%;margin-right: 30rpx;">
<up-button @click="close" color="#f7f7f7"><text style="color: #333;">取消</text></up-button> <up-button @click="close" type="number" color="#f7f7f7"><text style="color: #333;">取消</text></up-button>
</view> </view>
<view style="flex: 1;"> <view style="flex: 1;">
<up-button @click="change" color="#20b128">确定</up-button> <up-button @click="change" type="number" color="#20b128">确定</up-button>
</view> </view>
</view> </view>
</view> </view>

View File

@ -96,8 +96,8 @@
</view> </view>
</viewPopup> </viewPopup>
<scroll-view class="list" scroll-y @scrolltolower="loadMoreGood" @scroll='hideHeadView'> <scroll-view class="list" scroll-y @scrolltolower="loadMoreGood" @scroll='hideHeadView'>
<view class="shop-item" v-for="(item, index) in goodList" :key="item.id"> <view class="shop-item" v-for="(item, index) in goodList" :key="item.id" @click="openGoodPopup(item)">
<view class="shop-img" @tap="navTo(`/pageQuota/goodDetail/index`)"> <view class="shop-img">
<up-image width="160rpx" height="160rpx" :src="item.imgs"></up-image> <up-image width="160rpx" height="160rpx" :src="item.imgs"></up-image>
</view> </view>
<view class="shop-content"> <view class="shop-content">
@ -111,7 +111,7 @@
</view> </view>
<view class="price-btn"> <view class="price-btn">
<view class="price">{{item.sell}}</view> <view class="price">{{item.sell}}</view>
<view class="btn" @click="openGoodPopup(item)"> <view class="btn">
<u--icon name="plus-circle-fill" size="20" color="#20b128"></u--icon> <u--icon name="plus-circle-fill" size="20" color="#20b128"></u--icon>
</view> </view>
</view> </view>
@ -215,28 +215,16 @@
getGoodList(); getGoodList();
} }
const cartList = reactive(new Map());
const addCart = (id, cart_num) => { // const addCart = (id, cart_num) => { //
cartCreateApi({ cartCreateApi({
cart_num: cart_num, cart_num: cart_num,
is_new: 0, // 01 is_new: 0, // 01
goods_id: id goods_id: id
}).then(res => { }).then(res => {
console.log(res);
let now = cartList.get(id) || 0;
cartList.set(id, now + 1);
getCartList(); getCartList();
}) }).catch(err=>{
} console.log(err);
const removeCart = (id) => { uni.$u.toast('添加失败')
let num = cartList.get(id) || 0;
if (num == 0) return;
cartChangeApi({
goods_id: id,
cart_num: num--
}).then(res => {
console.log(res);
cartList.set(id, num)
}) })
} }

View File

@ -24,14 +24,9 @@
<view class="badge" v-if="orderCount.no_pay">{{orderCount.no_pay}}</view> <view class="badge" v-if="orderCount.no_pay">{{orderCount.no_pay}}</view>
</view> </view>
<view class="list-item" @click="navTo(2)"> <view class="list-item" @click="navTo(2)">
<image src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/53747202405061509465296.png"></image>
<view class="">待发货</view>
<view class="badge" v-if="orderCount.waiting">{{orderCount.waiting}}</view>
</view>
<view class="list-item" @click="navTo(3)">
<image src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/45241202404261403353935.png"></image> <image src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/45241202404261403353935.png"></image>
<view class="">待收货</view> <view class="">待收货</view>
<view class="badge" v-if="orderCount.receiving">{{orderCount.receiving}}</view> <view class="badge" v-if="orderCount.waiting">{{orderCount.waiting}}</view>
</view> </view>
<!-- <view class="list-item"> <!-- <view class="list-item">
<image src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/96915202404261403582769.png"></image> <image src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/96915202404261403582769.png"></image>

View File

@ -54,7 +54,6 @@
const tablist = ref([ const tablist = ref([
{ name: '全部' }, { name: '全部' },
{ name: '待付款' }, { name: '待付款' },
{ name: '待发货' },
{ name: '待收货' }, { name: '待收货' },
// { name: '退/' }, // { name: '退/' },
]); ]);
@ -66,7 +65,6 @@
if (swiperCurrent.value == 0 && orderList.value[0].length == 0) getOrderList(0); if (swiperCurrent.value == 0 && orderList.value[0].length == 0) getOrderList(0);
if (swiperCurrent.value == 1 && orderList.value[1].length == 0) getOrderList(1, '', 0); if (swiperCurrent.value == 1 && orderList.value[1].length == 0) getOrderList(1, '', 0);
if (swiperCurrent.value == 2 && orderList.value[2].length == 0) getOrderList(2, 0); if (swiperCurrent.value == 2 && orderList.value[2].length == 0) getOrderList(2, 0);
if (swiperCurrent.value == 3 && orderList.value[3].length == 0) getOrderList(3, 1);
} }
const showCancel = ref(false); const showCancel = ref(false);
@ -132,12 +130,6 @@
loading: false, loading: false,
loadend: false loadend: false
}, },
{
page_no: 1,
page_size: 25,
loading: false,
loadend: false
},
{ {
page_no: 1, page_no: 1,
page_size: 25, page_size: 25,
@ -150,13 +142,13 @@
[], [],
[], [],
[], [],
[],
]) ])
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({
...where.value[type], page_no: where.value[type].page_no,
page_size: where.value[type].page_size,
keyword: keyword.value, keyword: keyword.value,
status: status, status: status,
paid: paid paid: paid
@ -175,7 +167,6 @@
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, 0); if (swiperCurrent.value == 2) getOrderList(2, 0);
if (swiperCurrent.value == 3) getOrderList(3, 1);
} }
// //
@ -185,7 +176,6 @@
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, 0); if (swiperCurrent.value == 2) getOrderList(2, 0);
if (swiperCurrent.value == 3) getOrderList(3, 1);
} }
onLoad((options) => { onLoad((options) => {
@ -197,14 +187,12 @@
// getOrderList(0); // getOrderList(0);
// getOrderList(1, '', 0); // getOrderList(1, '', 0);
// getOrderList(2, 0); // getOrderList(2, 0);
// getOrderList(3, 1);
uni.$on('reLoadOrderList', () => { // uni.$on('reLoadOrderList', () => { //
where.value.forEach(item=>item.page_no=1); where.value.forEach(item=>item.page_no=1);
getOrderList(1, '', 0); getOrderList(1, '', 0);
getOrderList(0); getOrderList(0);
getOrderList(2, 0); getOrderList(2, 0);
getOrderList(3, 1);
}); });
}) })
</script> </script>

View File

@ -20,7 +20,7 @@ const useUserStore = defineStore("user", () => {
} }
// #ifdef H5 // #ifdef H5
token.value = "f9421a985006bf3f73bbaff6193da353" token.value = "fe46d0ca2dd4dcabcbd3b4777aa35c22"
userInfo.value = { userInfo.value = {
avatar: "https://lihaiim.oss-cn-chengdu.aliyuncs.com/image/admin/default_avatar.png", avatar: "https://lihaiim.oss-cn-chengdu.aliyuncs.com/image/admin/default_avatar.png",
id: 9, id: 9,
@ -29,7 +29,7 @@ const useUserStore = defineStore("user", () => {
mobile: "19330904744", mobile: "19330904744",
nickname: "用户1714964250", nickname: "用户1714964250",
supplier: null, supplier: null,
token: "f9421a985006bf3f73bbaff6193da353" token: "fe46d0ca2dd4dcabcbd3b4777aa35c22"
} }
// #endif // #endif