增加确认订单页面菜品折叠,修改商品购物车数量显示
This commit is contained in:
@@ -7,33 +7,7 @@ export default async (params) => {
|
|||||||
let token = uni.cache.get("token") || "";
|
let token = uni.cache.get("token") || "";
|
||||||
const shopId = uni.cache.get("shopId") * 1;
|
const shopId = uni.cache.get("shopId") * 1;
|
||||||
const userInfo = uni.cache.get("userInfo") || {};
|
const userInfo = uni.cache.get("userInfo") || {};
|
||||||
// #ifdef H5
|
|
||||||
token = "1b5e8baf0cc1492a858a208f113d0971";
|
|
||||||
uni.cache.set('userInfo', {
|
|
||||||
"acQrcodeValidTime": "2026-01-13 13:35:59",
|
|
||||||
"alipayOpenId": "",
|
|
||||||
"birthDay": "",
|
|
||||||
"createTime": "2024-03-13 10:56:40",
|
|
||||||
"distributionAmount": 0,
|
|
||||||
"headImg": "https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132",
|
|
||||||
"id": "36689",
|
|
||||||
"idCard": "",
|
|
||||||
"isAc": 0,
|
|
||||||
"lastLoginTime": "2025-12-24 11:24:12",
|
|
||||||
"nickName": "微信用户",
|
|
||||||
"password": "",
|
|
||||||
"payPwd": "e10adc3949ba59abbe56e057f20f883e",
|
|
||||||
"phone": "",
|
|
||||||
"realName": "",
|
|
||||||
"sex": null,
|
|
||||||
"status": 1,
|
|
||||||
"updateTime": "2025-12-24 11:22:47",
|
|
||||||
"usePayPwd": 0,
|
|
||||||
"wechatAcOpenId": "",
|
|
||||||
"wechatAcQrcode": "http://weixin.qq.com/q/029s5JtP1xfmJ1g_HDxFco",
|
|
||||||
"wechatOpenId": "or1l86yipGvwyfPhrKIAcQuSfAV8"
|
|
||||||
})
|
|
||||||
// #endif
|
|
||||||
let header = {
|
let header = {
|
||||||
version: uni.conf.version,
|
version: uni.conf.version,
|
||||||
type: uni.getSystemInfoSync().platform,
|
type: uni.getSystemInfoSync().platform,
|
||||||
|
|||||||
@@ -1,8 +1,35 @@
|
|||||||
// const debug = process.env.NODE_ENV == 'development' ? true : false;
|
// const debug = process.env.NODE_ENV == 'development' ? true : false;
|
||||||
const debug = false; // false线上 true本地
|
const debug = true; // false线上 true本地
|
||||||
let baseUrl = ''
|
let baseUrl = ''
|
||||||
let baseUrlwws = ''
|
let baseUrlwws = ''
|
||||||
|
|
||||||
|
// #ifdef H5
|
||||||
|
uni.cache.set('token', 'b61c8b0f1c9d47ad924e33c48b496ce6')
|
||||||
|
uni.cache.set('userInfo', {
|
||||||
|
"acQrcodeValidTime": "2025-11-17 17:57:16",
|
||||||
|
"alipayOpenId": "",
|
||||||
|
"birthDay": "2025-10-17",
|
||||||
|
"createTime": "2024-07-06 11:30:16",
|
||||||
|
"distributionAmount": 0,
|
||||||
|
"headImg": "https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132",
|
||||||
|
"id": "36434",
|
||||||
|
"idCard": "612401199810058031",
|
||||||
|
"isAc": 0,
|
||||||
|
"lastLoginTime": "2025-12-24 14:30:51",
|
||||||
|
"nickName": "微信用户",
|
||||||
|
"password": "",
|
||||||
|
"payPwd": "e10adc3949ba59abbe56e057f20f883e",
|
||||||
|
"phone": "18049104914",
|
||||||
|
"realName": "叶明飞",
|
||||||
|
"sex": 1,
|
||||||
|
"status": 1,
|
||||||
|
"updateTime": "2025-12-24 14:29:51",
|
||||||
|
"usePayPwd": 0,
|
||||||
|
"wechatAcOpenId": "1111",
|
||||||
|
"wechatAcQrcode": "",
|
||||||
|
"wechatOpenId": "or1l86yipGvwyfPhrKIAcQuSfAV8"
|
||||||
|
})
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
const version = "100";
|
const version = "100";
|
||||||
|
|||||||
@@ -40,10 +40,20 @@
|
|||||||
:nowCarts="nowCarts"
|
:nowCarts="nowCarts"
|
||||||
:limitDiscount="cartStore.limitTimeDiscount"
|
:limitDiscount="cartStore.limitTimeDiscount"
|
||||||
></orderItemVue> -->
|
></orderItemVue> -->
|
||||||
<orderItemVue :useVipPrice="useVipPrice" v-if="cartStore.allGoods.length" :nowCarts="cartStore.allGoods"
|
<orderItemVue :useVipPrice="useVipPrice" v-if="nowCarts" :nowCarts="nowCarts"
|
||||||
:shopInfo="cartStore.shopInfo" :shopUserInfo="cartStore.shopUserInfo"
|
:shopInfo="cartStore.shopInfo" :shopUserInfo="cartStore.shopUserInfo"
|
||||||
:limitDiscount="cartStore.limitTimeDiscount"></orderItemVue>
|
:limitDiscount="cartStore.limitTimeDiscount"></orderItemVue>
|
||||||
|
|
||||||
|
<view class="u-flex u-row-center u-m-t-16 u-font-28">
|
||||||
|
<view class="u-flex u-col-baseline" @click="showAllGoods=!showAllGoods">
|
||||||
|
<text>{{showAllGoods?'收起':'展开'}}</text>
|
||||||
|
<view class="guodu u-m-l-10 u-m-t-2" :class="{rotate:!showAllGoods}">
|
||||||
|
<up-icon name="arrow-down" size="14"></up-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
|
||||||
<template v-if="listinfo.id&&listinfo.status=='done'">
|
<template v-if="listinfo.id&&listinfo.status=='done'">
|
||||||
<view class="cell-item" v-if="is_type != 0">
|
<view class="cell-item" v-if="is_type != 0">
|
||||||
<view class="label">打包费</view>
|
<view class="label">打包费</view>
|
||||||
@@ -329,6 +339,8 @@
|
|||||||
BigNumber
|
BigNumber
|
||||||
} from "bignumber.js";
|
} from "bignumber.js";
|
||||||
|
|
||||||
|
|
||||||
|
const showAllGoods=ref(false)
|
||||||
let hasCouponCanUse = ref(false);
|
let hasCouponCanUse = ref(false);
|
||||||
|
|
||||||
const usePoints = ref(false);
|
const usePoints = ref(false);
|
||||||
@@ -852,6 +864,16 @@
|
|||||||
await getConsumeDiscount();
|
await getConsumeDiscount();
|
||||||
getDiscountActivity();
|
getDiscountActivity();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const nowCarts=computed(()=>{
|
||||||
|
if(cartStore.allGoods.length<=0){
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
if(showAllGoods.value){
|
||||||
|
return cartStore.allGoods
|
||||||
|
}
|
||||||
|
return cartStore.allGoods.slice(0,4)
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@@ -1587,4 +1609,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.guodu{
|
||||||
|
transition:all .3s linear;
|
||||||
|
padding-top: 2rpx;
|
||||||
|
}
|
||||||
|
.rotate{
|
||||||
|
transform: rotate(-90deg);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -148,8 +148,10 @@
|
|||||||
@click.stop="clickspecifications(item, index, index1)">
|
@click.stop="clickspecifications(item, index, index1)">
|
||||||
<text class="t no-wrap" v-if="item.groupType == '1'">选择套餐</text>
|
<text class="t no-wrap" v-if="item.groupType == '1'">选择套餐</text>
|
||||||
<text class="t" v-else>选规格</text>
|
<text class="t" v-else>选规格</text>
|
||||||
|
<!-- <text class="dot num"
|
||||||
|
v-if="item.cartNumber > 0">{{ ifcartNumber(item) < 99 ? ifcartNumber(item) : '99+' }}</text> -->
|
||||||
<text class="dot num"
|
<text class="dot num"
|
||||||
v-if="item.cartNumber > 0">{{ ifcartNumber(item) < 99 ? ifcartNumber(item) : '99+' }}</text>
|
v-if="returnGoodsImCartNum(item)">{{ returnGoodsImCartNum(item) < 99 ? returnGoodsImCartNum(item) : '99+' }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="Controls" v-else>
|
<view class="Controls" v-else>
|
||||||
<view class="btn" v-if="item.cartNumber != '0'">
|
<view class="btn" v-if="item.cartNumber != '0'">
|
||||||
@@ -288,8 +290,11 @@
|
|||||||
@click.stop="clickspecifications(item1, index, index1)">
|
@click.stop="clickspecifications(item1, index, index1)">
|
||||||
<text class="t no-wrap" v-if="item1.groupType == '1'">选择套餐</text>
|
<text class="t no-wrap" v-if="item1.groupType == '1'">选择套餐</text>
|
||||||
<text class="t" v-else>选规格</text>
|
<text class="t" v-else>选规格</text>
|
||||||
|
<!-- <text class="dot num"
|
||||||
|
v-if="item1.cartNumber > 0">{{ ifcartNumber(item1) < 99 ? ifcartNumber(item1) : '99+' }}</text> -->
|
||||||
|
|
||||||
<text class="dot num"
|
<text class="dot num"
|
||||||
v-if="item1.cartNumber > 0">{{ ifcartNumber(item1) < 99 ? ifcartNumber(item1) : '99+' }}</text>
|
v-if="returnGoodsImCartNum(item1)">{{ returnGoodsImCartNum(item1) < 99 ? returnGoodsImCartNum(item1) : '99+' }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="Controls" v-else>
|
<view class="Controls" v-else>
|
||||||
@@ -700,6 +705,7 @@
|
|||||||
import {
|
import {
|
||||||
useCartStore
|
useCartStore
|
||||||
} from '@/stores/order.js';
|
} from '@/stores/order.js';
|
||||||
|
import { computed } from 'vue';
|
||||||
const cartStore = useCartStore();
|
const cartStore = useCartStore();
|
||||||
/**
|
/**
|
||||||
* store本地存储 end
|
* store本地存储 end
|
||||||
@@ -804,6 +810,32 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 购物车对应的商品数
|
||||||
|
const GoodsIDInCartNumMap=computed(()=>{
|
||||||
|
const map={}
|
||||||
|
for(let cart in cartStore.carts){
|
||||||
|
if(map[cart.product_id]){
|
||||||
|
map[cart.product_id]+=cart.number*1
|
||||||
|
}else{
|
||||||
|
map[cart.product_id]=cart.number*1
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return map
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回购物车对应的商品数量
|
||||||
|
*/
|
||||||
|
function returnGoodsImCartNum(goods){
|
||||||
|
if(GoodsIDInCartNumMap.value.hasOwnProperty([goods.id]) ){
|
||||||
|
GoodsIDInCartNumMap.value[goods.id]
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 获取商品数据
|
// 获取商品数据
|
||||||
const shopProductList = reactive({
|
const shopProductList = reactive({
|
||||||
hots: [],
|
hots: [],
|
||||||
@@ -2106,7 +2138,6 @@
|
|||||||
//第一步:将所有商品的 cartNumber 初始化为 0
|
//第一步:将所有商品的 cartNumber 初始化为 0
|
||||||
shopProductList.productInfo.forEach((group) => {
|
shopProductList.productInfo.forEach((group) => {
|
||||||
group.productList.forEach(async (product) => {
|
group.productList.forEach(async (product) => {
|
||||||
product.cartNumber = 0;
|
|
||||||
product.isSaleTimeshow = await isProductAvailable(product.days, product
|
product.isSaleTimeshow = await isProductAvailable(product.days, product
|
||||||
.startTime, product.endTime);
|
.startTime, product.endTime);
|
||||||
|
|
||||||
@@ -2116,7 +2147,6 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
shopProductList.hots.forEach(async (i) => {
|
shopProductList.hots.forEach(async (i) => {
|
||||||
i.cartNumber = 0;
|
|
||||||
i.isSaleTimeshow = await isProductAvailable(i.days, i.startTime, i.endTime);
|
i.isSaleTimeshow = await isProductAvailable(i.days, i.startTime, i.endTime);
|
||||||
allGoodsArr.push(i)
|
allGoodsArr.push(i)
|
||||||
cartStore.setGoodsMap(i.id, i);
|
cartStore.setGoodsMap(i.id, i);
|
||||||
|
|||||||
Reference in New Issue
Block a user