订单结算修改,增加限时折扣
This commit is contained in:
@@ -157,6 +157,8 @@ export const useCartsStore = defineStore("cart", () => {
|
||||
const isFreeDine = ref(false);
|
||||
// 商家霸王餐配置
|
||||
const freeDineConfig = ref(null);
|
||||
//限时折扣
|
||||
const limitTimeDiscount = ref(null);
|
||||
// 订单额外配置
|
||||
const orderExtraConfig = computed(() => ({
|
||||
// 引用扩展后的商家减免配置
|
||||
@@ -173,6 +175,7 @@ export const useCartsStore = defineStore("cart", () => {
|
||||
currentDinnerType: dinnerType.value,
|
||||
isFreeDine: isFreeDine.value,
|
||||
freeDineConfig: freeDineConfig.value,
|
||||
limitTimeDiscount: limitTimeDiscount.value,
|
||||
}));
|
||||
|
||||
// 营销活动列表
|
||||
@@ -191,6 +194,7 @@ export const useCartsStore = defineStore("cart", () => {
|
||||
// 订单费用汇总
|
||||
const orderCostSummary = computed(() => {
|
||||
allGoods.value = getAllGoodsList();
|
||||
console.log("allGoods.value", allGoods.value);
|
||||
console.log("orderExtraConfig.value", orderExtraConfig.value);
|
||||
const costSummary = OrderPriceCalculator.calculateOrderCostSummary(
|
||||
allGoods.value,
|
||||
@@ -209,6 +213,11 @@ export const useCartsStore = defineStore("cart", () => {
|
||||
|
||||
//商品数据Map
|
||||
const goodsMap = reactive({});
|
||||
|
||||
function returnGoods(product_id){
|
||||
return goodsMap[product_id*1]
|
||||
}
|
||||
|
||||
//获取商品数据
|
||||
async function goodsInit() {
|
||||
goodsIsloading.value = true;
|
||||
@@ -232,10 +241,6 @@ export const useCartsStore = defineStore("cart", () => {
|
||||
goodsMap[product_id] = data;
|
||||
}
|
||||
|
||||
//websocket回执
|
||||
const websocketsendMessage = (data) => {
|
||||
uni.$u.debounce(sendMessage(data), 500);
|
||||
};
|
||||
|
||||
const isLoading = ref(true);
|
||||
|
||||
@@ -348,6 +353,11 @@ export const useCartsStore = defineStore("cart", () => {
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
//获取限时折扣
|
||||
// if(Message.operate_type == "time_discount_get"){
|
||||
// console.log("time_discount_get", Message.data);
|
||||
// limitTimeDiscount.value = Message.data;
|
||||
// }
|
||||
|
||||
if (Message.type == "no_suit_num") {
|
||||
uni.showModal({
|
||||
@@ -394,6 +404,9 @@ export const useCartsStore = defineStore("cart", () => {
|
||||
|
||||
//是否使用会员价
|
||||
const useVipPrice = computed(() => {
|
||||
if (!orderVIP.value) {
|
||||
return false;
|
||||
}
|
||||
const isUse =
|
||||
orderVIP.value.isVip && shopInfo.value.isMemberPrice ? true : false;
|
||||
return isUse;
|
||||
@@ -606,6 +619,10 @@ export const useCartsStore = defineStore("cart", () => {
|
||||
userPoints.value = 0;
|
||||
fullReductionActivities.value = [];
|
||||
isFreeDine.value = false;
|
||||
oldOrder.value = {
|
||||
detailMap: {},
|
||||
originAmount: 0,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -616,7 +633,7 @@ export const useCartsStore = defineStore("cart", () => {
|
||||
carts,
|
||||
isEmpty,
|
||||
setGoodsMap,
|
||||
goodsMap,
|
||||
goodsMap:goodsMap,
|
||||
goodsIsloading,
|
||||
goodsInit,
|
||||
onMessage,
|
||||
@@ -631,6 +648,8 @@ export const useCartsStore = defineStore("cart", () => {
|
||||
setUserPoints,
|
||||
setPointDeductionRule,
|
||||
setOldOrder,
|
||||
//返回商品信息
|
||||
returnGoods,
|
||||
//优惠券列表
|
||||
backendCoupons,
|
||||
allGoods,
|
||||
@@ -652,5 +671,7 @@ export const useCartsStore = defineStore("cart", () => {
|
||||
isFreeDine, //是否使用霸王餐
|
||||
// 商家霸王餐配置
|
||||
freeDineConfig,
|
||||
//限时折扣
|
||||
limitTimeDiscount,
|
||||
};
|
||||
});
|
||||
|
||||
@@ -228,8 +228,10 @@ export const Memberpay = defineStore('memberpay', {
|
||||
|
||||
// 生成订单
|
||||
actionscreateOrder(data) {
|
||||
console.log('actionscreateOrder:生成订单',data);
|
||||
return new Promise(async (resolve, reject) => {
|
||||
let res = await APIcreateOrder({
|
||||
...data,
|
||||
orderId: data.orderId, //多次下单时使用
|
||||
shopId: uni.cache.get('shopId'), //店铺Id
|
||||
userId: uni.cache.get('userInfo').id || '', //
|
||||
|
||||
Reference in New Issue
Block a user