优化切换店铺没有清除代客下单历史订单干的问题
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
<el-dropdown trigger="click" @command="handleCommand">
|
||||
<div class="el-dropdown-link" style="display: flex;">
|
||||
<div v-if="!collapse" class="title">{{ state.shopName }}</div>
|
||||
<el-icon class="el-icon--right" v-if="loginType == 0">
|
||||
<el-icon class="el-icon--right" v-if="loginType == 0">
|
||||
<arrow-down />
|
||||
</el-icon>
|
||||
</div>
|
||||
@@ -58,6 +58,7 @@ async function handleCommand(command) {
|
||||
return
|
||||
}
|
||||
await ShopApi.getBranchChange(res.shopId)
|
||||
localStorage.setItem("Instead_olold_order", {})
|
||||
// localStorage.setItem("branch_shopId", res.shopId)
|
||||
localStorage.setItem("shopName", res.shopName)
|
||||
state.shopName = res.shopName
|
||||
|
||||
@@ -146,6 +146,7 @@ export const useCartsStore = defineStore("carts", () => {
|
||||
};
|
||||
|
||||
console.log('changeUser', vipUser.value);
|
||||
await getConsumeDiscountAjax()
|
||||
await getGoods({})
|
||||
|
||||
// 选择用户后重新刷新历史订单限时折扣信息
|
||||
@@ -157,6 +158,24 @@ export const useCartsStore = defineStore("carts", () => {
|
||||
payParamsInit()
|
||||
}
|
||||
|
||||
// 根据用户id获取新客立减金额,返回null代表不可用
|
||||
async function getConsumeDiscountAjax() {
|
||||
try {
|
||||
if (vipUser.value.id) {
|
||||
const res = await limitTimeDiscountApi.getConsumeDiscount({
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
shopUserId: vipUser.value.id,
|
||||
orderId: oldOrder.value.id,
|
||||
});
|
||||
console.log("根据用户id获取新客立减金额,返回null代表不可用", res);
|
||||
if (res !== null) {
|
||||
newUserDiscount.value = res;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
// 给长连接发送更新购物车限时折扣信息
|
||||
const sendWsTimeDiscount = _.throttle(function () {
|
||||
@@ -406,8 +425,8 @@ export const useCartsStore = defineStore("carts", () => {
|
||||
//使用积分数量
|
||||
const userPoints = ref(0);
|
||||
|
||||
// 新客立减金额
|
||||
const newUserDiscount = ref(0)
|
||||
// 新客立减配置
|
||||
const newUserDiscount = ref(null)
|
||||
|
||||
// 订单额外配置(现在依赖响应式的 merchantReduction)
|
||||
const orderExtraConfig = computed<OrderExtraConfig>(() => ({
|
||||
@@ -424,7 +443,7 @@ export const useCartsStore = defineStore("carts", () => {
|
||||
currentDinnerType: dinnerType.value,
|
||||
limitTimeDiscount: limitDiscountRes.value,
|
||||
shopUserInfo: vipUser.value,
|
||||
newUserDiscount: newUserDiscount.value
|
||||
newUserDiscount: newUserDiscount.value !== null ? newUserDiscount.value.amount : 0
|
||||
}) as OrderExtraConfig);
|
||||
|
||||
// 营销活动列表
|
||||
@@ -1001,6 +1020,7 @@ export const useCartsStore = defineStore("carts", () => {
|
||||
// 支付成功后清楚订单/用户信息
|
||||
function clearHistory() {
|
||||
vipUser.value = {}
|
||||
newUserDiscount.value = {}
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -174,7 +174,7 @@
|
||||
<el-checkbox value="周四" label="周四" />
|
||||
<el-checkbox value="周五" label="周五" />
|
||||
<el-checkbox value="周六" label="周六" />
|
||||
<el-checkbox value="周七" label="周日" />
|
||||
<el-checkbox value="周日" label="周日" />
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="指定时间段">
|
||||
@@ -435,7 +435,7 @@ const form = ref({
|
||||
validStartTime: "", // 有效期开始时间
|
||||
validEndTime: "", // 有效期结束时间
|
||||
daysToTakeEffect: 0, // 隔天生效
|
||||
useDays: ["周一", "周二", "周三", "周四", "周五", "周六", "周七"], // 可用周期,如:'周一','周二','周三' , '周四' , '周五', '周六' , '周七'
|
||||
useDays: ["周一", "周二", "周三", "周四", "周五", "周六", "周日"], // 可用周期,如:'周一','周二','周三' , '周四' , '周五', '周六' , '周七'
|
||||
useTimeType: "all", // 可用时间段类型:all-全时段,custom-指定时段
|
||||
useStartTime: "", // 可用开始时间
|
||||
useEndTime: "", // 可用结束时间
|
||||
|
||||
@@ -26,10 +26,10 @@
|
||||
<div class="title">指定设置</div>
|
||||
<el-form-item label="可使用类型" prop="useType">
|
||||
<el-checkbox-group v-model="form.useType">
|
||||
<el-checkbox value="dine" label="堂食" />
|
||||
<el-checkbox value="pickup" label="自取" />
|
||||
<el-checkbox value="deliv" label="配送" />
|
||||
<el-checkbox value="express" label="快递" />
|
||||
<el-checkbox value="dine-in" label="堂食" />
|
||||
<el-checkbox value="take-out" label="外带" />
|
||||
<el-checkbox value="take-away" label="外卖" />
|
||||
<el-checkbox value="post" label="配送" />
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
<div class="title">发放设置</div>
|
||||
@@ -159,7 +159,7 @@ const form = ref({
|
||||
couponType: 1, // 1-满减券,2-商品兑换券,3-折扣券,4-第二件半价券,5-消费送券,6-买一送一券,7-固定价格券,8-免配送费券
|
||||
fullAmount: "", // 使用门槛:满多少金额
|
||||
couponGiftList: [], // 优惠券,目前单选
|
||||
useType: ["dine"], // 可使用类型:dine堂食/pickup自取/deliv配送/express快递
|
||||
useType: ["dine-in"], // 堂食 dine-in 外带 take-out 外卖 take-away 配送 post
|
||||
giveNum: "", // 总发放数量,-10086为不限量
|
||||
getLimit: "", // 每人领取限量,-10086为不限量
|
||||
status: 1, // 状态:0-禁用,1-启用
|
||||
|
||||
@@ -50,10 +50,7 @@
|
||||
<div class="center">
|
||||
<el-text>{{ scope.row.giftNum }}</el-text>
|
||||
<el-text>|</el-text>
|
||||
<el-link
|
||||
type="primary"
|
||||
@click="GetDetailDialogRef.show(scope.row)"
|
||||
>
|
||||
<el-link type="primary" @click="GetDetailDialogRef.show(scope.row)">
|
||||
详情
|
||||
</el-link>
|
||||
</div>
|
||||
@@ -61,34 +58,23 @@
|
||||
</el-table-column>
|
||||
<el-table-column prop="leftNum" label="剩余" width="180">
|
||||
<template #default="scope">
|
||||
<div v-if="scope.row.getLimit == -10086">无限</div>
|
||||
<div v-if="scope.row.leftNum == -10086">无限</div>
|
||||
<div v-else>{{ scope.row.leftNum }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="status" label="状态">
|
||||
<template #default="scope">
|
||||
<el-switch
|
||||
v-model="scope.row.status"
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
@change="statusChange($event, scope.row)"
|
||||
/>
|
||||
<el-switch v-model="scope.row.status" :active-value="1" :inactive-value="0"
|
||||
@change="statusChange($event, scope.row)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createTime" label="创建时间" width="180" />
|
||||
<el-table-column prop="actions" label="操作" width="120" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
type="primary"
|
||||
link
|
||||
@click="DialogFormRef.show(couponType, scope.row)"
|
||||
>
|
||||
<el-button type="primary" link @click="DialogFormRef.show(couponType, scope.row)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-popconfirm
|
||||
title="确认要删除吗?"
|
||||
@confirm="deleteHandle(scope.row)"
|
||||
>
|
||||
<el-popconfirm title="确认要删除吗?" @confirm="deleteHandle(scope.row)">
|
||||
<template #reference>
|
||||
<el-button type="danger" link>删除</el-button>
|
||||
</template>
|
||||
@@ -213,6 +199,7 @@ onMounted(() => {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
@@ -138,6 +138,8 @@ async function freeDingGetAjax() {
|
||||
form.value = { ...res }
|
||||
form.value.enable = res.enable ? 1 : 0
|
||||
form.value.useShopType = res.useShopType || 'all'
|
||||
form.value.useType = res.useType || ['dine-in']
|
||||
form.value.shopIdList = res.shopIdList || []
|
||||
|
||||
if (res.enable == true) {
|
||||
if (shopInfo.value.shopType == 'only') {
|
||||
|
||||
@@ -78,23 +78,24 @@
|
||||
<div>打包费:{{ detail.packFee || "-" }}</div>
|
||||
<div>餐位费:{{ detail.seatAmount || "-" }}</div>
|
||||
<div>商品券抵扣:¥{{ detail.productCouponDiscountAmount }}</div>
|
||||
<div>满减券抵扣:¥{{ detail.fullCouponDiscountAmount }}</div>
|
||||
<div>优惠券抵扣:¥{{ detail.fullCouponDiscountAmount }}</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div>满减活动:¥0.00</div>
|
||||
<div>新客立减:¥0.00</div>
|
||||
<div>限时折扣:¥0.00</div>
|
||||
<div>会员折扣:¥0.00</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div>退单金额:¥{{ detail.refundAmount }}</div>
|
||||
<div>折扣金额:¥{{ detail.discountAmount }}</div>
|
||||
<div>整单改价:¥{{ detail.discountAmount }}</div>
|
||||
<div>积分抵扣:¥{{ detail.pointsDiscountAmount }}</div>
|
||||
<div>抹零:¥{{ detail.roundAmount }}</div>
|
||||
<div>
|
||||
实收金额:
|
||||
<span style="color: red">¥{{ detail.payAmount }}</span>
|
||||
<el-button
|
||||
v-if="detail.status != 'unpaid' && detail.refundAmount < detail.payAmount"
|
||||
size="small"
|
||||
type="danger"
|
||||
class="u-m-l-10"
|
||||
@click="tuikuan()"
|
||||
>
|
||||
<el-button v-if="detail.status != 'unpaid' && detail.refundAmount < detail.payAmount" size="small"
|
||||
type="danger" class="u-m-l-10" @click="tuikuan()">
|
||||
<span>退款</span>
|
||||
</el-button>
|
||||
</div>
|
||||
@@ -121,35 +122,22 @@
|
||||
<div style="margin-bottom: 16px; font-size: 16px">商品信息</div>
|
||||
<template v-for="(item, index) in detail.detailMap" :key="index">
|
||||
<h4>第{{ index }}次下单</h4>
|
||||
<el-table
|
||||
:data="item"
|
||||
:ref="'refTable' + index"
|
||||
@select-all="tableSelectAll($event, index)"
|
||||
>
|
||||
<el-table :data="item" :ref="'refTable' + index" @select-all="tableSelectAll($event, index)">
|
||||
<!-- <el-table-column type="selection" width="55" /> -->
|
||||
<el-table-column label="数量" type="selection">
|
||||
<template v-slot="scope">
|
||||
<div v-if="detail.status == 'unpaid'">
|
||||
<el-checkbox
|
||||
v-if="scope.row.num - scope.row.returnNum > 0"
|
||||
v-model="scope.row.checked"
|
||||
/>
|
||||
<el-checkbox v-if="scope.row.num - scope.row.returnNum > 0" v-model="scope.row.checked" />
|
||||
</div>
|
||||
<div v-else>
|
||||
<el-checkbox
|
||||
v-if="scope.row.num - scope.row.refundNum > 0"
|
||||
v-model="scope.row.checked"
|
||||
/>
|
||||
<el-checkbox v-if="scope.row.num - scope.row.refundNum > 0" v-model="scope.row.checked" />
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品">
|
||||
<template v-slot="scope">
|
||||
<div class="shop_info">
|
||||
<el-image
|
||||
:src="scope.row.productImg"
|
||||
style="width: 40px; height: 40px"
|
||||
></el-image>
|
||||
<el-image :src="scope.row.productImg" style="width: 40px; height: 40px"></el-image>
|
||||
<div class="info">
|
||||
<span :class="[scope.row.isVip == 1 ? 'colorStyle' : '']">
|
||||
{{ scope.row.productName }}
|
||||
@@ -175,32 +163,17 @@
|
||||
<template v-slot="scope">¥{{ scope.row.payAmount }}</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
v-if="detail.status == 'unpaid'"
|
||||
label="可退菜数量"
|
||||
align="center"
|
||||
width="130px"
|
||||
>
|
||||
<el-table-column v-if="detail.status == 'unpaid'" label="可退菜数量" align="center" width="130px">
|
||||
<template v-slot="scope">
|
||||
<el-input-number
|
||||
v-if="scope.row.checked"
|
||||
:min="0"
|
||||
style="width: 100px"
|
||||
v-model="scope.row.selNumber"
|
||||
:max="scope.row.num - scope.row.returnNum"
|
||||
></el-input-number>
|
||||
<el-input-number v-if="scope.row.checked" :min="0" style="width: 100px" v-model="scope.row.selNumber"
|
||||
:max="scope.row.num - scope.row.returnNum"></el-input-number>
|
||||
<span class="" v-else>{{ scope.row.num - scope.row.returnNum }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-else label="可退款数量" align="center" width="130px">
|
||||
<template v-slot="scope">
|
||||
<el-input-number
|
||||
v-if="scope.row.checked"
|
||||
:min="0"
|
||||
style="width: 100px"
|
||||
v-model="scope.row.selNumber"
|
||||
:max="scope.row.num - scope.row.refundNum - scope.row.returnNum"
|
||||
></el-input-number>
|
||||
<el-input-number v-if="scope.row.checked" :min="0" style="width: 100px" v-model="scope.row.selNumber"
|
||||
:max="scope.row.num - scope.row.refundNum - scope.row.returnNum"></el-input-number>
|
||||
<span class="" v-else>
|
||||
{{ scope.row.num - scope.row.refundNum - scope.row.returnNum }}
|
||||
</span>
|
||||
@@ -215,23 +188,13 @@
|
||||
<el-table-column label="操作">
|
||||
<template v-slot="scope">
|
||||
<template v-if="detail.status != 'unpaid'">
|
||||
<el-button
|
||||
v-if="canTuikuan(scope.row)"
|
||||
link
|
||||
size="small"
|
||||
@click="tuikuan(scope.row)"
|
||||
>
|
||||
<el-button v-if="canTuikuan(scope.row)" link size="small" @click="tuikuan(scope.row)">
|
||||
<span>退款</span>
|
||||
</el-button>
|
||||
<span class="color-999" v-if="scope.row.status == 'refund'">已退款</span>
|
||||
</template>
|
||||
<template v-if="detail.status == 'unpaid'">
|
||||
<el-button
|
||||
v-if="canTuicai(scope.row)"
|
||||
link
|
||||
size="small"
|
||||
@click="tuicai(scope.row)"
|
||||
>
|
||||
<el-button v-if="canTuicai(scope.row)" link size="small" @click="tuicai(scope.row)">
|
||||
<span>退菜</span>
|
||||
</el-button>
|
||||
<span class="color-999" v-else>已退菜</span>
|
||||
@@ -241,41 +204,25 @@
|
||||
</el-table>
|
||||
</template>
|
||||
<!-- 退款 -->
|
||||
<div
|
||||
class="u-p-20 u-flex u-row-right"
|
||||
v-if="
|
||||
detail.status !== 'refund' &&
|
||||
detail.status !== 'unpaid' &&
|
||||
detail.status !== 'cancelled'
|
||||
"
|
||||
>
|
||||
<el-checkbox
|
||||
v-model="allSelected"
|
||||
@change="allSelectedChange"
|
||||
label="全选"
|
||||
></el-checkbox>
|
||||
<div class="u-p-20 u-flex u-row-right" v-if="
|
||||
detail.status !== 'refund' &&
|
||||
detail.status !== 'unpaid' &&
|
||||
detail.status !== 'cancelled'
|
||||
">
|
||||
<el-checkbox v-model="allSelected" @change="allSelectedChange" label="全选"></el-checkbox>
|
||||
<el-button type="danger" class="u-m-l-20" @click.stop="tuikuan('all')">退款</el-button>
|
||||
</div>
|
||||
<!-- 退菜 -->
|
||||
<div class="u-p-20 u-flex u-row-right" v-if="detail.status == 'unpaid'">
|
||||
<el-checkbox
|
||||
v-model="allSelected"
|
||||
@change="allSelectedChange"
|
||||
label="全选"
|
||||
></el-checkbox>
|
||||
<el-checkbox v-model="allSelected" @change="allSelectedChange" label="全选"></el-checkbox>
|
||||
<el-button type="danger" class="u-m-l-20" @click.stop="tuicai('all')">退菜</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-drawer>
|
||||
<!-- 退款 -->
|
||||
<return-money
|
||||
:modal="false"
|
||||
ref="refReturnMoney"
|
||||
:max="selGoods.num"
|
||||
:goods="selGoods"
|
||||
@confirm="refReturnMoneyConfirm"
|
||||
></return-money>
|
||||
<return-money :modal="false" ref="refReturnMoney" :max="selGoods.num" :goods="selGoods"
|
||||
@confirm="refReturnMoneyConfirm"></return-money>
|
||||
<!-- 退菜 -->
|
||||
<order-return-cart ref="refReturnCart" @confirm="refReturnCartConfirm"></order-return-cart>
|
||||
</div>
|
||||
@@ -538,6 +485,7 @@ export default {
|
||||
align-items: center;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.shop_info {
|
||||
display: flex;
|
||||
|
||||
@@ -575,9 +523,11 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.line-th {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
.container {
|
||||
padding: 0 20px;
|
||||
font-size: 14px;
|
||||
|
||||
@@ -44,22 +44,11 @@
|
||||
<span class="u-font-14">部分抵扣</span>
|
||||
</el-radio> -->
|
||||
</el-radio-group>
|
||||
<el-input-number
|
||||
class="u-m-l-10"
|
||||
v-if="score.sel != -1"
|
||||
v-model="usePointsNumber"
|
||||
step-strictly
|
||||
:step="pointsRes.equivalentPoints"
|
||||
placeholder="请输入积分抵扣数量"
|
||||
:min="pointsRes.minDeductionPoints"
|
||||
:max="pointsRes.maxUsablePoints"
|
||||
@change="pointsToMoney"
|
||||
></el-input-number>
|
||||
<el-input-number class="u-m-l-10" v-if="score.sel != -1" v-model="usePointsNumber" step-strictly
|
||||
:step="pointsRes.equivalentPoints" placeholder="请输入积分抵扣数量" :min="pointsRes.minDeductionPoints"
|
||||
:max="pointsRes.maxUsablePoints" @change="pointsToMoney"></el-input-number>
|
||||
</div>
|
||||
<p
|
||||
class="u-font-14 color-666 u-m-t-10"
|
||||
v-if="pointsRes.unusableReason && !pointsRes.usable"
|
||||
>
|
||||
<p class="u-font-14 color-666 u-m-t-10" v-if="pointsRes.unusableReason && !pointsRes.usable">
|
||||
<span class="color-red">*</span>
|
||||
<span>{{ pointsRes.unusableReason }}</span>
|
||||
</p>
|
||||
@@ -80,13 +69,10 @@
|
||||
</div>
|
||||
<div class="u-flex u-col-center u-m-t-20 no-wrap">
|
||||
<span class="u-font-14 font-bold u-m-r-20">优惠券</span>
|
||||
<div
|
||||
v-if="
|
||||
carts.orderCostSummary.fullReduction !== undefined &&
|
||||
carts.orderCostSummary.fullReduction.actualAmount > 0
|
||||
"
|
||||
style="font-size: 14px; color: #555"
|
||||
>
|
||||
<div v-if="
|
||||
carts.orderCostSummary.fullReduction !== undefined &&
|
||||
carts.orderCostSummary.fullReduction.actualAmount > 0
|
||||
" style="font-size: 14px; color: #555">
|
||||
参与满减活动不可用优惠券!
|
||||
</div>
|
||||
<div class="u-flex my-select" @click="openCoupon" v-else>
|
||||
@@ -137,14 +123,9 @@
|
||||
<p class="u-font-16 font-bold u-m-r-20 font-bold u-flex">选择支付方式</p>
|
||||
<div class="u-m-t-20">
|
||||
<div>
|
||||
<el-button
|
||||
v-for="(item, index) in payTypes.list"
|
||||
:key="index"
|
||||
size="large"
|
||||
:type="index == payTypes.sel ? 'primary' : ''"
|
||||
:disabled="canUsePayType(item)"
|
||||
@click="changePayType(index)"
|
||||
>
|
||||
<el-button v-for="(item, index) in payTypes.list" :key="index" size="large"
|
||||
:type="index == payTypes.sel ? 'primary' : ''" :disabled="canUsePayType(item)"
|
||||
@click="changePayType(index)">
|
||||
{{ item.payName }}
|
||||
</el-button>
|
||||
</div>
|
||||
@@ -231,22 +212,13 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- 扫码 -->
|
||||
<scanPay
|
||||
ref="refScanPay"
|
||||
:order="orderInfo"
|
||||
@confirm="refScanPayConfirm"
|
||||
@paysuccess="paysuccess"
|
||||
></scanPay>
|
||||
<scanPay ref="refScanPay" :order="orderInfo" @confirm="refScanPayConfirm" @paysuccess="paysuccess"></scanPay>
|
||||
<!-- 打折 -->
|
||||
<discount ref="refDiscount" @confirm="discountConfirm"></discount>
|
||||
<!-- 优惠券 -->
|
||||
<popup-coupon ref="refCoupon" :user="carts.vipUser" @confirm="refCouponConfirm"></popup-coupon>
|
||||
<!-- 挂账 -->
|
||||
<chooseGuaZahng
|
||||
ref="refGuaZhang"
|
||||
:payMoney="currentpayMoney"
|
||||
@confirm="refGuaZhangConfirm"
|
||||
></chooseGuaZahng>
|
||||
<chooseGuaZahng ref="refGuaZhang" :payMoney="currentpayMoney" @confirm="refGuaZhangConfirm"></chooseGuaZahng>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -384,7 +356,7 @@ function discountShow(e) {
|
||||
const props = defineProps({
|
||||
table: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
default: () => { },
|
||||
},
|
||||
user: {
|
||||
type: Object,
|
||||
@@ -398,7 +370,7 @@ const props = defineProps({
|
||||
},
|
||||
orderInfo: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
default: () => { },
|
||||
},
|
||||
});
|
||||
|
||||
@@ -515,26 +487,6 @@ function changePayType(i) {
|
||||
refScanPayOpen(payType);
|
||||
}
|
||||
|
||||
// 根据用户id获取新客立减金额,返回null代表不可用
|
||||
const newCustomerDiscount = ref(null);
|
||||
async function getConsumeDiscountAjax() {
|
||||
try {
|
||||
if (carts.vipUser.id) {
|
||||
newCustomerDiscount.value = await limitTimeDiscountApi.getConsumeDiscount({
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
shopUserId: carts.vipUser.id,
|
||||
orderId: props.orderInfo.id,
|
||||
});
|
||||
console.log("根据用户id获取新客立减金额,返回null代表不可用", newCustomerDiscount.value);
|
||||
if (newCustomerDiscount.value !== null) {
|
||||
carts.newUserDiscount = newCustomerDiscount.value.amount;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
function returnPayParams() {
|
||||
console.log("carts.orderCostSummary", carts.orderCostSummary);
|
||||
return {
|
||||
@@ -564,9 +516,9 @@ function returnPayParams() {
|
||||
userId: carts.vipUser.userId || "",
|
||||
allPack: carts.dinnerType == "take-out" ? 1 : 0,
|
||||
limitRate: carts.limitDiscountRes,
|
||||
newCustomerDiscountId: newCustomerDiscount.value !== null ? newCustomerDiscount.value.id : "", // 新客立减Id
|
||||
newCustomerDiscountId: carts.newUserDiscount !== null ? carts.newUserDiscount.id : "", // 新客立减Id
|
||||
newCustomerDiscountAmount:
|
||||
newCustomerDiscount.value !== null ? newCustomerDiscount.value.amount : 0, // 新客立减金额
|
||||
carts.newUserDiscount !== null ? carts.newUserDiscount.amount : 0, // 新客立减金额
|
||||
vipDiscountAmount: carts.orderCostSummary.vipDiscountAmount, // 超级会员折扣
|
||||
},
|
||||
};
|
||||
@@ -607,7 +559,7 @@ function nowPayClick(payType) {
|
||||
.then(() => {
|
||||
payOrder("cash");
|
||||
})
|
||||
.catch(() => {});
|
||||
.catch(() => { });
|
||||
return;
|
||||
}
|
||||
if (payType == "member-account") {
|
||||
@@ -738,24 +690,9 @@ watch(
|
||||
}
|
||||
);
|
||||
|
||||
// 获取当前店铺可用的限时折扣
|
||||
async function getlimitTimeDiscount() {
|
||||
try {
|
||||
const res = await limitTimeDiscountApi.getLimitTimeDiscount({
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
});
|
||||
|
||||
console.log("获取当前店铺可用的限时折扣===", res);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
carts.payParamsInit();
|
||||
getPaytype();
|
||||
getlimitTimeDiscount();
|
||||
getConsumeDiscountAjax();
|
||||
});
|
||||
defineExpose({
|
||||
nowPayClick,
|
||||
@@ -801,11 +738,9 @@ defineExpose({
|
||||
.order-info {
|
||||
font-size: 14px;
|
||||
|
||||
.title {
|
||||
}
|
||||
.title {}
|
||||
|
||||
.value {
|
||||
}
|
||||
.value {}
|
||||
|
||||
.price {
|
||||
color: #fa5555;
|
||||
|
||||
Reference in New Issue
Block a user