优化代客下单逻辑

This commit is contained in:
gyq
2025-11-18 09:06:47 +08:00
parent 7c7fc3ef0f
commit 4478cc01fe
11 changed files with 193 additions and 259 deletions

View File

@@ -2,13 +2,13 @@
ENV = test ENV = test
# 测试ws # 测试ws
# VITE_API_WSS = 'ws://192.168.1.42:2348' VITE_API_WSS = 'ws://192.168.1.42:2348'
# 测试ws # 测试ws
# VITE_API_WSS = 'wss://sockets.sxczgkj.com/wss' # VITE_API_WSS = 'wss://sockets.sxczgkj.com/wss'
# 正式ws # 正式ws
VITE_API_WSS = 'wss://czgeatws.sxczgkj.com/wss' # VITE_API_WSS = 'wss://czgeatws.sxczgkj.com/wss'
# 正式 php # 正式 php
VITE_API_PHP_URL = 'https://newblockwlx.sxczgkj.cn/index.php/api' VITE_API_PHP_URL = 'https://newblockwlx.sxczgkj.cn/index.php/api'
@@ -23,7 +23,7 @@ VITE_API_KP_URL = 'https://invoice.sxczgkj.cn/api'
# VITE_API_URL = 'https://fv901fw8033.vicp.fun/' # VITE_API_URL = 'https://fv901fw8033.vicp.fun/'
# 正式Java # 正式Java
VITE_API_URL = 'https://cashier.sxczgkj.com/' # VITE_API_URL = 'https://cashier.sxczgkj.com/'
# 本地调试连接 # 本地调试连接
# VITE_API_URL = 'http://192.168.1.42/' VITE_API_URL = 'http://192.168.1.42/'

File diff suppressed because one or more lines are too long

8
package-lock.json generated
View File

@@ -27,7 +27,7 @@
"uuid": "^10.0.0", "uuid": "^10.0.0",
"vue": "^3.3.8", "vue": "^3.3.8",
"vue-router": "^4.2.5", "vue-router": "^4.2.5",
"ysk-utils": "^1.0.69" "ysk-utils": "^1.0.74"
}, },
"devDependencies": { "devDependencies": {
"@vitejs/plugin-vue": "^4.5.0", "@vitejs/plugin-vue": "^4.5.0",
@@ -7642,9 +7642,9 @@
} }
}, },
"node_modules/ysk-utils": { "node_modules/ysk-utils": {
"version": "1.0.69", "version": "1.0.74",
"resolved": "https://registry.npmmirror.com/ysk-utils/-/ysk-utils-1.0.69.tgz", "resolved": "https://registry.npmmirror.com/ysk-utils/-/ysk-utils-1.0.74.tgz",
"integrity": "sha512-HP/m/QeGfDI30JD7q3FXP0ChCc1a+cJ5qxNSTQaCA0wI9gpt6MxnqkumqY+aCBugPhFRq0S+MHUPwA7UWWs1DQ==", "integrity": "sha512-VyMlYimhjpM62yHuzUYOxeZVAwA8aabOMIHn2A7S2ShTBglmlZgLygrIn/0SetMUDVRb3iDprHtXs2JpG7/EDg==",
"dependencies": { "dependencies": {
"bignumber.js": "^9.3.1", "bignumber.js": "^9.3.1",
"loadsh": "^0.0.4", "loadsh": "^0.0.4",

View File

@@ -30,7 +30,7 @@
"uuid": "^10.0.0", "uuid": "^10.0.0",
"vue": "^3.3.8", "vue": "^3.3.8",
"vue-router": "^4.2.5", "vue-router": "^4.2.5",
"ysk-utils": "^1.0.69" "ysk-utils": "^1.0.74"
}, },
"devDependencies": { "devDependencies": {
"@vitejs/plugin-vue": "^4.5.0", "@vitejs/plugin-vue": "^4.5.0",

View File

@@ -675,8 +675,7 @@ function clearCouponUser() {
couponFormUser.value = '' couponFormUser.value = ''
couponFormUserList.value = [] couponFormUserList.value = []
goodsStore.showVipPrice = 0 goodsStore.clearVipUserInfo()
goodsStore.vipUserInfo = ''
couponForm.value.pointsNum = '' couponForm.value.pointsNum = ''
couponForm.value.discountRatio = '' couponForm.value.discountRatio = ''
@@ -846,7 +845,7 @@ function resetCouponFormHandle() {
async function selectUserHandle(row) { async function selectUserHandle(row) {
try { try {
console.log('selectUserHandle===', row); console.log('selectUserHandle===', row);
goodsStore.vipUserInfo = { ...row } goodsStore.selectUser(row)
// 选择会员后重新计算会员价 // 选择会员后重新计算会员价
if (store.shopInfo.isMemberPrice && row.isVip) { if (store.shopInfo.isMemberPrice && row.isVip) {
console.log('选择会员后重新计算会员价===', row); console.log('选择会员后重新计算会员价===', row);

View File

@@ -1,7 +1,7 @@
import _ from "lodash"; import _ from "lodash";
import dayjs from "dayjs"; import dayjs from "dayjs";
import { defineStore } from "pinia"; import { defineStore } from "pinia";
import { ref, computed } from "vue"; import { ref, computed, nextTick } from "vue";
import { productPage, categoryList } from "@/api/product_new.js"; import { productPage, categoryList } from "@/api/product_new.js";
import { historyOrder, cancelOrder, rmPlaceOrder } from "@/api/order.js"; import { historyOrder, cancelOrder, rmPlaceOrder } from "@/api/order.js";
import { getLimitTimeDiscount, getDiscountActivity, getDiscountByUserId } from '@/api/market' import { getLimitTimeDiscount, getDiscountActivity, getDiscountByUserId } from '@/api/market'
@@ -86,6 +86,30 @@ export const useGoods = defineStore("goods", {
newCustomerDiscount: '' // 新客立减 newCustomerDiscount: '' // 新客立减
}), }),
actions: { actions: {
// 选择会员
async selectUser(user) {
const store = useUser()
this.vipUserInfo = { ...user, isMemberPrice: store.shopInfo.isMemberPrice }
if (store.shopInfo.isMemberPrice && this.vipUserInfo.isVip) {
this.showVipPrice = 1
}
await this.updateGoodsList()
this.calcCartInfo()
},
// 清除会员信息
async clearVipUserInfo() {
console.log('清除会员信息');
this.vipUserInfo = {};
this.showVipPrice = 0;
await this.updateGoodsList()
this.calcCartInfo()
},
// 清除历史订单 // 清除历史订单
async clearHistoryOrder() { async clearHistoryOrder() {
try { try {
@@ -135,11 +159,6 @@ export const useGoods = defineStore("goods", {
useStorage.del("updateFlag"); useStorage.del("updateFlag");
useStorage.del("tableCode"); useStorage.del("tableCode");
}, },
// 清除会员信息
clearVipUserInfo() {
this.vipUserInfo = {};
this.showVipPrice = 0;
},
// 恢复挂单 // 恢复挂单
async recoverPending(item) { async recoverPending(item) {
let socket = useSocket(); let socket = useSocket();
@@ -265,7 +284,7 @@ export const useGoods = defineStore("goods", {
this.showVipPrice = 1; this.showVipPrice = 1;
} }
await updateGoodsList() await this.updateGoodsList()
} }
} }
@@ -392,15 +411,6 @@ export const useGoods = defineStore("goods", {
}) })
} }
this.originGoodsList.forEach(item => {
item.showMore = false;
item.orderCount = 0;
item.is_time_discount = limitUtils.canUseLimitTimeDiscount(item,
this.limitDiscountRes,
store.shopInfo,
this.vipUserInfo) ? 1 : 0
});
if (socket.ws == null) { if (socket.ws == null) {
await socket.init(); await socket.init();
if (this.limitDiscountRes !== null) { if (this.limitDiscountRes !== null) {
@@ -408,20 +418,22 @@ export const useGoods = defineStore("goods", {
} }
} }
const chunkNum = 12
// 将数组分割成每页12个 // 将数组分割成每页12个
this.goodsList = _.chunk(res, 12); this.goodsList = _.chunk(res, chunkNum);
let index = useStorage.get("categoryIndex") || 0; let index = useStorage.get("categoryIndex") || 0;
if (index == 0) { if (index == 0) {
this.goodsList = _.chunk( this.goodsList = _.chunk(
this.originGoodsList.filter((item) => item.isSale), this.originGoodsList.filter((item) => item.isSale),
12 chunkNum
); );
} else if (this.categoryList[index].id == "off_sale") { } else if (this.categoryList[index].id == "off_sale") {
// 筛选已下架的商品 // 筛选已下架的商品
this.goodsList = _.chunk( this.goodsList = _.chunk(
this.originGoodsList.filter((item) => item.isSale == 0), this.originGoodsList.filter((item) => item.isSale == 0),
12 chunkNum
); );
} else { } else {
// 除了全部,其他只做本地筛选 // 除了全部,其他只做本地筛选
@@ -431,15 +443,46 @@ export const useGoods = defineStore("goods", {
item.categoryId == this.categoryList[this.categoryIndex].id && item.categoryId == this.categoryList[this.categoryIndex].id &&
item.isSale item.isSale
), ),
12 chunkNum
); );
} }
this.goodsList.forEach(val => {
val.forEach((item, index) => {
console.log('this.goodsList.index', index);
console.log('this.goodsList.item', item);
console.log('this.goodsList.limitDiscountRes', this.limitDiscountRes);
console.log('this.goodsList.store.shopInfo', store.shopInfo);
console.log('this.goodsList.this.vipUserInfo', this.vipUserInfo);
// console.log('this.goodsList.this.vipUserInfo', JSON.stringify(this.vipUserInfo));
console.log('this.goodsList.this.canUseLimitTimeDiscount', limitUtils.canUseLimitTimeDiscount(item,
this.limitDiscountRes,
store.shopInfo,
this.vipUserInfo, 'id'));
item.showMore = false;
item.orderCount = 0;
item.memberPrice = item.lowMemberPrice
item.salePrice = item.lowPrice
item.time_dicount_mode = this.limitDiscountRes.discountPriority
item.is_time_discount = limitUtils.canUseLimitTimeDiscount(item,
this.limitDiscountRes,
store.shopInfo,
this.vipUserInfo, 'id') ? 1 : 0
item.time_discount_price = limitUtils.returnPrice({
goods: { ...item },
shopInfo: store.shopInfo,
limitTimeDiscountRes: this.limitDiscountRes,
shopUserInfo: this.vipUserInfo,
idKey: 'id'
})
})
})
// console.log('this.goodsList===', this.goodsList);
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }
console.log('this.goodsList===', this.goodsList);
setTimeout(() => { setTimeout(() => {
this.goodsListLoading = false; this.goodsListLoading = false;
}, 500); }, 500);
@@ -566,8 +609,6 @@ export const useGoods = defineStore("goods", {
}; };
console.log('sendData', sendData); console.log('sendData', sendData);
this.operateCart(sendData); this.operateCart(sendData);
}, },
// 购物添加成功 // 购物添加成功
@@ -649,6 +690,12 @@ export const useGoods = defineStore("goods", {
item.stockNumber = val.stockNumber; item.stockNumber = val.stockNumber;
item.isStock = val.isStock; item.isStock = val.isStock;
item.is_time_discount = limitUtils.canUseLimitTimeDiscount(val, this.limitDiscountRes, store.shopInfo, this.vipUserInfo) ? 1 : 0 item.is_time_discount = limitUtils.canUseLimitTimeDiscount(val, this.limitDiscountRes, store.shopInfo, this.vipUserInfo) ? 1 : 0
item.time_discount_price = limitUtils.returnPrice({
goods: { ...item },
shopInfo: store.shopInfo,
limitTimeDiscountRes: this.limitDiscountRes,
shopUserInfo: this.vipUserInfo,
})
} }
}); });
@@ -659,9 +706,10 @@ export const useGoods = defineStore("goods", {
return item; return item;
} }
}, },
// 补全订单列表商品信息 // 补全历史订单列表商品信息
comleteOrderInfo(item) { comleteOrderInfo(item) {
console.log('补全订单列表商品信息'); console.log('补全订单列表商品信息');
const store = useUser()
this.originGoodsList.map((val) => { this.originGoodsList.map((val) => {
if (val.id == item.productId) { if (val.id == item.productId) {
@@ -693,7 +741,14 @@ export const useGoods = defineStore("goods", {
item.is_temporary = item.isTemporary; item.is_temporary = item.isTemporary;
item.discount_sale_amount = item.discountSaleAmount item.discount_sale_amount = item.discountSaleAmount
item.is_gift = item.isGift item.is_gift = item.isGift
item.is_time_discount = item.isTimeDiscount item.is_time_discount = limitUtils.canUseLimitTimeDiscount(item, this.limitDiscountRes, store.shopInfo, this.vipUserInfo, 'productId') ? 1 : 0
item.isTimeDiscount = limitUtils.canUseLimitTimeDiscount(item, this.limitDiscountRes, store.shopInfo, this.vipUserInfo, 'productId') ? 1 : 0
item.time_discount_price = limitUtils.returnPrice({
goods: { ...item },
shopInfo: store.shopInfo,
limitTimeDiscountRes: this.limitDiscountRes,
shopUserInfo: this.vipUserInfo,
})
}); });
return item; return item;
}, },
@@ -752,7 +807,7 @@ export const useGoods = defineStore("goods", {
cart: this.cartList.map(item => { cart: this.cartList.map(item => {
return { return {
id: item.id, id: item.id,
is_time_discount: limitUtils.canUseLimitTimeDiscount(item, this.limitDiscountRes, store.shopId, this.vipUserInfo, 'product_id') ? 1 : 0 is_time_discount: limitUtils.canUseLimitTimeDiscount(item, this.limitDiscountRes, store.shopInfo, this.vipUserInfo, 'product_id') ? 1 : 0
} }
}), }),
history: this.orderList history: this.orderList
@@ -760,14 +815,13 @@ export const useGoods = defineStore("goods", {
.flat().map(item => { .flat().map(item => {
return { return {
id: item.id, id: item.id,
is_time_discount: limitUtils.canUseLimitTimeDiscount(item, this.limitDiscountRes, store.shopId, this.vipUserInfo, 'productId') ? 1 : 0 is_time_discount: limitUtils.canUseLimitTimeDiscount(item, this.limitDiscountRes, store.shopInfo, this.vipUserInfo, 'productId') ? 1 : 0
} }
}) })
} }
this.operateCart({ data }, 'bulk_edit') this.operateCart({ data }, 'bulk_edit')
} }
// await socket.cartInit();
await socket.cartInit();
}, },
// 清空购物车回执操作 // 清空购物车回执操作
async successClearCart() { async successClearCart() {
@@ -789,6 +843,8 @@ export const useGoods = defineStore("goods", {
if (!this.cartList.length && !this.orderList.length) { if (!this.cartList.length && !this.orderList.length) {
this.updateGoodsNumber(); this.updateGoodsNumber();
} }
this.updateGoodsList()
}, },
// 下单成功清除购物车,重新加载订单 // 下单成功清除购物车,重新加载订单
async updateOrderList() { async updateOrderList() {
@@ -797,151 +853,6 @@ export const useGoods = defineStore("goods", {
this.calcCartInfo(); this.calcCartInfo();
}, },
// 计算购物车信息 // 计算购物车信息
// calcCartInfo() {
// console.log("yskUtils===", yskUtils);
// this.updateGoodsNumber();
// const store = useUser();
// let total = 0; // 总数量
// let totalAmount = 0; // 总金额
// let gifNumber = 0; // 赠送总数量
// let gifNumberAmount = 0; // 赠送总金额
// let saleNumber = 0; // 打折总数量
// let saleNumberAmount = 0; // 打折总金额
// let packFee = 0; // 打包费
// let packFeeNumber = 0; // 打包数量
// let tableFee = 0; // 客座费
// let arr = [
// ...this.cartList,
// ...this.orderList
// .map((item) => item.goods)
// .flat()
// .map((item) => {
// item.discount_sale_amount = item.discountSaleAmount;
// item.discount_sale_note = item.discountSaleNote;
// item.is_print = item.isPrint;
// item.is_gift = item.isGift;
// item.is_temporary = item.isTemporary;
// return item;
// }),
// ];
// console.log("arr===11111", arr);
// arr.map((val, index) => {
// let lowPrice = 0;
// let number = val.number - (val.returnNum || 0);
// if (this.vipUserInfo.id && store.shopInfo.isMemberPrice) {
// if (!+val.memberPrice) {
// lowPrice = val.lowPrice;
// } else {
// lowPrice = +val.memberPrice;
// }
// } else {
// lowPrice = val.lowPrice;
// }
// total += number;
// if (+val.pack_number && !val.is_temporary) {
// packFeeNumber += +val.pack_number;
// if (+val.pack_number > number) {
// packFee += number * +val.packFee;
// } else {
// packFee += +val.pack_number * +val.packFee;
// }
// }
// if (val.is_temporary) {
// if (val.is_gift) {
// gifNumber += +number;
// gifNumberAmount += +number * +val.discount_sale_amount;
// } else {
// // 临时菜使用discount_sale_amount计算价格
// totalAmount += number * val.discount_sale_amount;
// }
// } else {
// if (val.is_gift) {
// // 赠送
// if (+val.discount_sale_amount) {
// // 且有折扣
// gifNumber += +number;
// gifNumberAmount += +number * val.discount_sale_amount;
// saleNumber += +number;
// saleNumberAmount +=
// number * (lowPrice - val.discount_sale_amount);
// } else {
// gifNumber += +number;
// gifNumberAmount += +number * +lowPrice;
// }
// } else {
// if (+val.discount_sale_amount) {
// // 代表打过折
// saleNumber += +number;
// saleNumberAmount +=
// number * (lowPrice - val.discount_sale_amount);
// // 使用正常价减去折扣价格计算
// totalAmount += number * val.discount_sale_amount;
// } else {
// // 使用正常价格计算
// totalAmount += number * lowPrice;
// }
// }
// }
// });
// this.cartInfo.gifNumber = +gifNumber;
// this.cartInfo.gifNumberAmount = gifNumberAmount;
// this.cartInfo.saleNumber = saleNumber;
// this.cartInfo.saleNumberAmount = saleNumberAmount;
// this.cartInfo.packFee = packFee;
// this.cartInfo.packFeeNumber = packFeeNumber;
// this.cartInfo.total = total;
// if (this.tableInfo.name && !store.shopInfo.isTableFee) {
// tableFee = this.tableInfo.num * store.shopInfo.tableFee;
// this.tableInfo.tableFee = tableFee;
// }
// console.log("this.tableInfo.tableFee===", tableFee);
// this.cartInfo.totalAmount = totalAmount + packFee + tableFee;
// console.log("this.cartInfo===", this.cartInfo);
// const discountInfo = [];
// if (this.cartInfo.gifNumberAmount) {
// discountInfo.push(
// `赠送:${formatDecimal(this.cartInfo.gifNumberAmount, 2, true)}元`
// );
// }
// if (this.cartInfo.saleNumberAmount) {
// discountInfo.push(
// `改价优惠:${formatDecimal(
// this.cartInfo.saleNumberAmount,
// 2,
// true
// )}元`
// );
// }
// if (this.cartInfo.packFee) {
// discountInfo.push(
// `打包费:${formatDecimal(this.cartInfo.packFee, 2, true)}元`
// );
// }
// this.cartInfo.discountInfo = discountInfo.join("");
// },
// 计算购物车信息
calcCartInfo(opts = {}) { calcCartInfo(opts = {}) {
const defaultOptions = { const defaultOptions = {
pointsPerYuan: 0, // 积分换算规律 pointsPerYuan: 0, // 积分换算规律
@@ -1031,7 +942,7 @@ export const useGoods = defineStore("goods", {
userPoints: userPoints.value, userPoints: userPoints.value,
isMember: this.showVipPrice, isMember: this.showVipPrice,
memberDiscountRate: 1, memberDiscountRate: 1,
fullReductionActivities: [this.fullReductionActivities], fullReductionActivities: this.fullReductionActivities !== null ? [this.fullReductionActivities] : [],
currentDinnerType: dinnerType.value, currentDinnerType: dinnerType.value,
limitTimeDiscount: this.limitDiscountRes, limitTimeDiscount: this.limitDiscountRes,
shopUserInfo: this.vipUserInfo, shopUserInfo: this.vipUserInfo,
@@ -1074,8 +985,6 @@ export const useGoods = defineStore("goods", {
const socket = useSocket(); const socket = useSocket();
const store = useUser(); const store = useUser();
// data.is_time_discount = limitUtils.canUseLimitTimeDiscount(data, this.limitDiscountRes, store.shopInfo, this.vipUserInfo) ? 1 : 0
console.log(`购物车操作${operate_type}===`, data); console.log(`购物车操作${operate_type}===`, data);
if (socket.online) { if (socket.online) {
socket.ws.send( socket.ws.send(
@@ -1119,13 +1028,4 @@ export const useGoods = defineStore("goods", {
}); });
}, },
}, },
}); });
// // 在store外部或初始化时订阅
// const goodsStore = useGoods()
// goodsStore.$subscribe((mutation, state) => {
// // mutation包含变化的信息
// console.log(`状态变化:`, mutation, state)
// // 可以根据变化执行逻辑
// })

View File

@@ -150,6 +150,10 @@ export const useSocket = defineStore("socket", {
// 清空订单或删除订单 // 清空订单或删除订单
goodsStore.historyOrderAjax(data.data.table_code); goodsStore.historyOrderAjax(data.data.table_code);
break; break;
case "bulk_edit":
// 限时折扣更新
// goodsStore.updateGoodsList();
break;
default: default:
break; break;
} }

View File

@@ -19,37 +19,49 @@
</div> </div>
</template> </template>
<template v-else> <template v-else>
<div class="price" v-if="props.item.is_temporary"> <div class="price" v-if="item.is_time_discount == 1">
<span class="dis">
{{ formatDecimal(+item.salePrice, 2, true) }}
</span>
<span> <span>
{{ formatDecimal(+props.item.discount_sale_amount, 2, true) }} {{ formatDecimal(+item.time_discount_price, 2, true) }}
</span> </span>
</div> </div>
<div class="price" v-else> <template v-else>
<template v-if="+props.item.discount_sale_amount"> <div class="price" v-if="props.item.is_temporary">
<span class="dis">
{{ formatDecimal(goodsStore.showVipPrice ? +props.item.memberPrice || +props.item.lowPrice
: +props.item.lowPrice,
2, true) }}
</span>
<span> <span>
{{ formatDecimal(+props.item.discount_sale_amount, 2, true) }} {{ formatDecimal(+props.item.discount_sale_amount, 2, true) }}
</span> </span>
</template> </div>
<div class="flex" v-else> <div class="price" v-else>
<template v-if="goodsStore.showVipPrice"> <template v-if="+props.item.discount_sale_amount">
<span class="dis"> <span class="dis">
{{ formatDecimal(+props.item.lowPrice, 2, true) }} {{ formatDecimal(goodsStore.showVipPrice ? +props.item.memberPrice ||
+props.item.lowPrice
: +props.item.lowPrice,
2, true) }}
</span>
<span>
{{ formatDecimal(+props.item.discount_sale_amount, 2, true) }}
</span> </span>
</template> </template>
<span> <div class="flex" v-else>
{{ formatDecimal(goodsStore.showVipPrice ? +props.item.memberPrice || +props.item.lowPrice <template v-if="goodsStore.showVipPrice">
: <span class="dis">
+props.item.lowPrice, {{ formatDecimal(+props.item.lowPrice, 2, true) }}
2, </span>
true) }} </template>
</span> <span>
{{ formatDecimal(goodsStore.showVipPrice ? +props.item.memberPrice ||
+props.item.lowPrice
:
+props.item.lowPrice,
2,
true) }}
</span>
</div>
</div> </div>
</div> </template>
</template> </template>
</div> </div>
<div class="remark_wrap" @click="showRemark(props.item)"> <div class="remark_wrap" @click="showRemark(props.item)">

View File

@@ -104,13 +104,22 @@
<div class="item_empty" v-if="shopListType == 'text'"></div> <div class="item_empty" v-if="shopListType == 'text'"></div>
<div class="price"> <div class="price">
<div class="price_warp"> <div class="price_warp">
<template v-if="!goodsStore.showVipPrice"> <template v-if="item.is_time_discount == 1">
<el-text>{{ item.skuList[0].salePrice }}</el-text> <el-text tag="del" class="del" size="small">{{ item.lowPrice }}</el-text>
<el-text>{{ +item.time_discount_price }}</el-text>
</template> </template>
<template v-else> <template v-else>
<el-text tag="del" class="del" size="small">{{ item.skuList[0].salePrice <template v-if="!goodsStore.showVipPrice">
}}</el-text> <el-text>{{ item.skuList[0].salePrice }}</el-text>
<el-text>{{ +item.skuList[0].memberPrice || item.skuList[0].salePrice }}</el-text> </template>
<template v-else>
<el-text tag="del" class="del" size="small">
{{ item.skuList[0].salePrice }}
</el-text>
<el-text>
{{ +item.skuList[0].memberPrice || item.skuList[0].salePrice }}
</el-text>
</template>
</template> </template>
</div> </div>
<div class="show_more_btn" v-if="showEditor"> <div class="show_more_btn" v-if="showEditor">

View File

@@ -6,7 +6,8 @@
{{ item.product_name }} {{ item.product_name }}
</div> </div>
<div class="n">x{{ formatDecimal(+item.number, 2, true) }}</div> <div class="n">x{{ formatDecimal(+item.number, 2, true) }}</div>
<div class="p" :class="{ undeline: goodsStore.showVipPrice && item.memberPrice }"> <div class="p"
:class="{ undeline: (goodsStore.showVipPrice && item.memberPrice) || item.is_time_discount }">
<template v-if="item.is_temporary"> <template v-if="item.is_temporary">
<template v-if="item.is_gift"> <template v-if="item.is_gift">
<span class="t_line">{{ formatDecimal(+item.discount_sale_amount) }}</span> <span class="t_line">{{ formatDecimal(+item.discount_sale_amount) }}</span>
@@ -98,7 +99,7 @@
</span> </span>
</div> </div>
</div> </div>
<div class="gift_wrap" v-if="goodsStore.showVipPrice && item.memberPrice"> <div class="gift_wrap" v-if="goodsStore.showVipPrice && item.memberPrice && !item.is_time_discount">
<div class="name"> <div class="name">
<span>[会员价]</span> <span>[会员价]</span>
</div> </div>
@@ -109,6 +110,30 @@
</span> </span>
</div> </div>
</div> </div>
<div class="gift_wrap" v-if="item.is_time_discount">
<template v-if="item.time_dicount_mode == 'vip-price'">
<div class="name">
<span>[会员价]</span>
</div>
<div class="n"></div>
<div class="p">
<span>
{{ formatDecimal(+item.memberPrice) }}
</span>
</div>
</template>
<template v-else>
<div class="name">
<span>[限时折扣]</span>
</div>
<div class="n"></div>
<div class="p">
<span>
{{ formatDecimal(+item.time_discount_price) }}
</span>
</div>
</template>
</div>
</div> </div>
</template> </template>

View File

@@ -17,7 +17,7 @@
<span class="t">选择会员</span> <span class="t">选择会员</span>
</template> </template>
<template v-else> <template v-else>
<div class="user_info" @click="goodsStore.vipUserInfo = ''"> <div class="user_info" @click="goodsStore.clearVipUserInfo()">
<!-- <el-text class="n">{{ goodsStore.vipUserInfo.nickName }}</el-text> --> <!-- <el-text class="n">{{ goodsStore.vipUserInfo.nickName }}</el-text> -->
<el-text class="p">{{ formatPhoneNumber(goodsStore.vipUserInfo.phone) }}</el-text> <el-text class="p">{{ formatPhoneNumber(goodsStore.vipUserInfo.phone) }}</el-text>
</div> </div>
@@ -29,7 +29,7 @@
<ArrowRight /> <ArrowRight />
</el-icon> </el-icon>
</div> </div>
<div class="u_icon" v-else @click.stop="clearVipUserHandle"> <div class="u_icon" v-else @click.stop="goodsStore.clearVipUserInfo()">
<el-icon class="i"> <el-icon class="i">
<Close /> <Close />
</el-icon> </el-icon>
@@ -267,15 +267,7 @@ function printReloadHandle() {
// 选择会员 // 选择会员
async function selectUser(row) { async function selectUser(row) {
console.log('selectUser===', row); console.log('selectUser===', row);
goodsStore.selectUser(row)
goodsStore.vipUserInfo = { ...row }
if (store.shopInfo.isMemberPrice && row.isVip) {
goodsStore.showVipPrice = 1
}
await goodsStore.updateGoodsList()
goodsStore.calcCartInfo()
} }
// 挂单量 // 挂单量
@@ -411,13 +403,6 @@ function showTableMerging() {
let data = cartList.value.filter(item => item.placeNum) let data = cartList.value.filter(item => item.placeNum)
tableMergingRef.value.show(data) tableMergingRef.value.show(data)
} }
// 清除会员与会员价
function clearVipUserHandle() {
goodsStore.vipUserInfo = ''
goodsStore.showVipPrice = 0
goodsStore.calcCartInfo()
}
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">