确认订单更新
This commit is contained in:
@@ -7,6 +7,6 @@
|
||||
"lodash": "^4.17.21",
|
||||
"pinia": "^2.3.1",
|
||||
"pinia-plugin-unistorage": "^0.1.2",
|
||||
"ysk-utils": "^1.0.28"
|
||||
"ysk-utils": "^1.0.35"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,6 @@
|
||||
isShow.value = res.isOrder
|
||||
list.value = res.rechargeDetailList.filter(v=>v.amount>cartStore.orderCostSummary.finalPayAmount)
|
||||
if(list.value.length){
|
||||
sel.value=0
|
||||
updateSel()
|
||||
}
|
||||
}
|
||||
@@ -80,7 +79,6 @@
|
||||
watch(()=>cartStore.orderCostSummary.finalPayAmount,(newval)=>{
|
||||
list.value=$riginList.filter(v=>v.amount>newval)
|
||||
if(list.value.length){
|
||||
sel.value=0
|
||||
updateSel()
|
||||
}
|
||||
})
|
||||
|
||||
@@ -365,6 +365,7 @@
|
||||
cartStore.setDinnerType(item.val)
|
||||
// this.getchoseEatModel('tabClick', index, item);
|
||||
}
|
||||
cartStore.setDinnerType(tebtypeList[is_type.value].val)
|
||||
|
||||
// 操作优惠卷
|
||||
const dataprocessing = (data) => {
|
||||
|
||||
@@ -169,7 +169,7 @@
|
||||
|
||||
|
||||
//充值相关
|
||||
const rechargeItem=ref(null)
|
||||
const rechargeItem=ref({id:''})
|
||||
const rechargeId=ref(null)
|
||||
|
||||
function updateRechargeId(e){
|
||||
@@ -192,6 +192,11 @@
|
||||
let res = await APIgetOrderById({
|
||||
orderId: listinfo.id
|
||||
})
|
||||
console.log('onMessage:APIgetOrderById',res);
|
||||
if(res){
|
||||
// cartStore.carts=[];
|
||||
// cartStore.setOldOrder(res)
|
||||
}
|
||||
if (noPayStatus[res.status]) {
|
||||
uni.showToast({
|
||||
title: noPayStatus[res.status],
|
||||
@@ -582,7 +587,10 @@
|
||||
// 清空购物车
|
||||
if (res) {
|
||||
Object.assign(listinfo, res)
|
||||
// cartStore.carts=[];
|
||||
// cartStore.setOldOrder(res)
|
||||
getOrderInfoAfterCalcInit(res)
|
||||
|
||||
cartsSocket.sendMessage({
|
||||
type: 'shopping',
|
||||
table_code: uni.cache.get('tableCode'),
|
||||
@@ -638,7 +646,13 @@
|
||||
// 购物车有数据
|
||||
if (!cartStore.isEmpty) {
|
||||
const res = await createOrder()
|
||||
//历史订单数据
|
||||
const res1= await APIgetOrderById({
|
||||
orderId: res.id
|
||||
})
|
||||
cartStore.setOldOrder(res1)
|
||||
}
|
||||
|
||||
goToPay()
|
||||
|
||||
} else {
|
||||
@@ -794,6 +808,7 @@
|
||||
})
|
||||
pay(payRes)
|
||||
}else{
|
||||
console.log('微信支付');
|
||||
await storeMemberpay.actionsltPayOrder({
|
||||
checkOrderPay,
|
||||
payType: paymentmethod.payType,
|
||||
@@ -803,6 +818,7 @@
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.log('error',error);
|
||||
pay_unlock()
|
||||
//TODO handle the exception
|
||||
}
|
||||
@@ -918,10 +934,13 @@
|
||||
url: '/pages/product/index'
|
||||
})
|
||||
}
|
||||
const packfee=computed(()=>{
|
||||
return cartStore.orderCostSummary.packFee
|
||||
})
|
||||
//不计算各种折扣前的实付金额
|
||||
const shifu = computed(() => {
|
||||
const payAmount = listinfo.payAmount ? listinfo.payAmount * 1 : 0
|
||||
return payAmount + cartStore.totalPrice * 1 + 0;
|
||||
return payAmount + cartStore.totalPrice * 1 + packfee.value * 1
|
||||
})
|
||||
//减去各种折扣后的金额
|
||||
const lastPayMoney = computed(() => {
|
||||
@@ -963,6 +982,7 @@
|
||||
if (shopInfoRes) {
|
||||
cartStore.shopInfo = shopInfoRes.shopInfo;
|
||||
}
|
||||
await cartStore.goodsInit()
|
||||
// * 获取会员信息
|
||||
await storeuser.actionsproductqueryProduct()
|
||||
await nextTick()
|
||||
|
||||
10
pnpm-lock.yaml
generated
10
pnpm-lock.yaml
generated
@@ -30,8 +30,8 @@ importers:
|
||||
specifier: ^0.1.2
|
||||
version: 0.1.2
|
||||
ysk-utils:
|
||||
specifier: ^1.0.28
|
||||
version: 1.0.28
|
||||
specifier: ^1.0.35
|
||||
version: 1.0.35
|
||||
|
||||
packages:
|
||||
|
||||
@@ -173,8 +173,8 @@ packages:
|
||||
typescript:
|
||||
optional: true
|
||||
|
||||
ysk-utils@1.0.28:
|
||||
resolution: {integrity: sha512-VpEYjK5ldWgZXY+rxcwef8DB9/K9K13BPZEL3l3NXybofLsh1089sMJF4B4rVpqYszcTF13ZLL6WJWCkhCPOkg==}
|
||||
ysk-utils@1.0.35:
|
||||
resolution: {integrity: sha512-kxPtEk5zs0HjdazbH2l2x1Tm5BUpmj1MBiOnb9Xquuj2hW2NtICtq+JB6RWFO7tzAAnOC5MRw366VOKceyeK5Q==}
|
||||
|
||||
snapshots:
|
||||
|
||||
@@ -314,6 +314,6 @@ snapshots:
|
||||
'@vue/server-renderer': 3.5.22(vue@3.5.22)
|
||||
'@vue/shared': 3.5.22
|
||||
|
||||
ysk-utils@1.0.28:
|
||||
ysk-utils@1.0.35:
|
||||
dependencies:
|
||||
bignumber.js: 9.3.1
|
||||
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
productminiApphotsquery,
|
||||
APIgroupquery,
|
||||
} from "@/common/api/product/product.js";
|
||||
|
||||
export const useCartsStore = defineStore('cart',
|
||||
() => {
|
||||
|
||||
@@ -42,11 +43,15 @@ export const useCartsStore = defineStore('cart',
|
||||
} :
|
||||
undefined;
|
||||
|
||||
|
||||
|
||||
const goods = getProductDetails({
|
||||
...item,
|
||||
product_id: item.product_id || item.productId,
|
||||
sku_id:item.skuId||item.sku_id
|
||||
})
|
||||
return {
|
||||
...item,
|
||||
id: item.id,
|
||||
sku_id:item.skuId||item.sku_id,
|
||||
product_id: item.product_id || item.productId,
|
||||
salePrice: item.salePrice || item.price,
|
||||
number: item.number || item.num || 0,
|
||||
@@ -56,7 +61,7 @@ export const useCartsStore = defineStore('cart',
|
||||
returnNum: item.returnNum || 0,
|
||||
memberPrice: item.memberPrice || 0,
|
||||
discountSaleAmount: item.discount_sale_amount || item.discountSaleAmount || 0,
|
||||
packFee: item.packFee || 0,
|
||||
packFee: item.packFee || (goods?goods.packFee:0) || 0,
|
||||
packNumber: item.pack_number || item.packNumber || 0,
|
||||
activityInfo: item.activityInfo ? {
|
||||
type: item.activityInfo.type,
|
||||
@@ -68,7 +73,9 @@ export const useCartsStore = defineStore('cart',
|
||||
};
|
||||
|
||||
// 合并所有商品列表
|
||||
const allGoods = computed(() => {
|
||||
const allGoods = ref([])
|
||||
|
||||
function getAllGoodsList() {
|
||||
const currentGoods = (carts.value).map(convertToBaseCartItem);
|
||||
const giftGoods = [].map(convertToBaseCartItem);
|
||||
// 扁平化历史订单商品
|
||||
@@ -76,7 +83,7 @@ export const useCartsStore = defineStore('cart',
|
||||
.flat()
|
||||
.map(convertToBaseCartItem);
|
||||
return [...currentGoods, ...giftGoods, ...oldOrderGoods];
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 就餐类型 'dine-in' | 'take-out'
|
||||
@@ -162,6 +169,8 @@ export const useCartsStore = defineStore('cart',
|
||||
const cartOrder = ref({});
|
||||
// 订单费用汇总
|
||||
const orderCostSummary = computed(() => {
|
||||
allGoods.value = getAllGoodsList()
|
||||
console.log('orderCostSummary:allGoods.value',allGoods.value );
|
||||
const costSummary = OrderPriceCalculator.calculateOrderCostSummary(
|
||||
allGoods.value,
|
||||
dinnerType.value,
|
||||
@@ -193,6 +202,8 @@ export const useCartsStore = defineStore('cart',
|
||||
setGoodsMap(product.id, product)
|
||||
}
|
||||
}
|
||||
allGoods.value = getAllGoodsList()
|
||||
console.log('allGoods.value ',allGoods.value );
|
||||
goodsIsloading.value = false
|
||||
}
|
||||
|
||||
@@ -214,9 +225,7 @@ export const useCartsStore = defineStore('cart',
|
||||
}
|
||||
let skuData = undefined;
|
||||
skuData = goods?.skuList.find((sku) => sku.id == v.sku_id);
|
||||
|
||||
skuData = goods?.skuList.find((sku) => sku.id == v.sku_id);
|
||||
|
||||
|
||||
if (skuData) {
|
||||
return {
|
||||
...v,
|
||||
@@ -576,7 +585,8 @@ export const useCartsStore = defineStore('cart',
|
||||
seatFeeConfig,
|
||||
shopInfo,
|
||||
//新客立减金额
|
||||
newUserDiscount
|
||||
newUserDiscount,
|
||||
getAllGoodsList
|
||||
};
|
||||
}
|
||||
);
|
||||
@@ -4,7 +4,7 @@
|
||||
<view class="top" style=" background-image: url(/static/czzx_header_bg.png);">
|
||||
<view>
|
||||
<view class="u-flex">
|
||||
<up-avatar size="136rpx" shape="square" round="20rpx" :src="shopInfo.coverImg"></up-avatar>
|
||||
<up-avatar size="136rpx" shape="square" round="20rpx" :src="shopInfo.logo"></up-avatar>
|
||||
<view class="u-p-l-20">
|
||||
<view class="shop-name u-line-1">{{shopInfo.shopName||'店铺名称' }}</view>
|
||||
<view class="u-flex">
|
||||
|
||||
Reference in New Issue
Block a user