修改订单结算积分
This commit is contained in:
@@ -3,13 +3,12 @@
|
||||
<template #desc>
|
||||
<view class="u-text-left u-p-30 color-666 u-font-28">
|
||||
<view class="u-m-t-32 u-flex">
|
||||
<view class="" v-if="accountPoints.calcRes.usable">
|
||||
<view class="" v-if="pointDeductionRule.enableRewards">
|
||||
<text class="color-red">*</text>
|
||||
<text class="" v-if="accountPoints.calcRes.equivalentPoints"
|
||||
>{{ accountPoints.calcRes.equivalentPoints }}积分等于1元,</text
|
||||
>
|
||||
<text class=""
|
||||
v-if="pointDeductionRule.equivalentPoints">{{ pointDeductionRule.equivalentPoints }}积分等于1元,</text>
|
||||
<text>
|
||||
最大抵扣积分{{ accountPoints.calcRes.maxUsablePoints }}
|
||||
最大抵扣积分{{ maxCanUsePoints }}
|
||||
</text>
|
||||
<text>, 最小抵扣积分0 </text>
|
||||
</view>
|
||||
@@ -17,15 +16,8 @@
|
||||
<view class="u-m-t-40 u-flex">
|
||||
<view>积分</view>
|
||||
<view class="u-m-l-32 border u-p-l-10 u-p-r-10 u-flex-1">
|
||||
<uni-easyinput
|
||||
type="number"
|
||||
@input="pointsInput"
|
||||
@change="pointsChange"
|
||||
paddingNone
|
||||
:inputBorder="false"
|
||||
v-model="form.points"
|
||||
placeholder="输入积分抵扣数量"
|
||||
></uni-easyinput>
|
||||
<uni-easyinput type="number" @input="pointsInput" @change="pointsChange" paddingNone
|
||||
:inputBorder="false" v-model="form.points" placeholder="输入积分抵扣数量"></uni-easyinput>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -33,13 +25,9 @@
|
||||
<template #btn>
|
||||
<view class="u-p-30">
|
||||
<view class="u-m-t-10">
|
||||
<my-button @tap="confirm" shape="circle" fontWeight="700"
|
||||
>修改</my-button
|
||||
>
|
||||
<my-button @tap="confirm" shape="circle" fontWeight="700">修改</my-button>
|
||||
<view class="">
|
||||
<my-button @tap="close" type="cancel" bgColor="#fff"
|
||||
>取消</my-button
|
||||
>
|
||||
<my-button @tap="close" type="cancel" bgColor="#fff">取消</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -48,7 +36,12 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, nextTick, ref, watch } from "vue";
|
||||
import {
|
||||
reactive,
|
||||
nextTick,
|
||||
ref,
|
||||
watch
|
||||
} from "vue";
|
||||
import myModel from "@/components/my-components/my-model.vue";
|
||||
import myButton from "@/components/my-components/my-button.vue";
|
||||
import myTabs from "@/components/my-components/my-tabs.vue";
|
||||
@@ -58,16 +51,18 @@ const props = defineProps({
|
||||
type: String,
|
||||
default: "积分抵扣",
|
||||
},
|
||||
accountPoints: {
|
||||
maxCanUsePoints: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
pointDeductionRule: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
calcRes: {
|
||||
usable: false,
|
||||
enableRewards: false,
|
||||
unusableReason: "",
|
||||
minDeductionPoints: 0,
|
||||
maxUsablePoints: 0,
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
@@ -96,10 +91,10 @@ function pointsChange(newval) {
|
||||
form.points = 0;
|
||||
return infoBox.showToast("积分抵扣不能小于0");
|
||||
}
|
||||
if (newval > props.accountPoints.calcRes.maxUsablePoints) {
|
||||
if (newval > props.maxCanUsePoints) {
|
||||
form.points = props.price;
|
||||
return infoBox.showToast(
|
||||
"积分抵扣不能大于" + props.accountPoints.calcRes.maxUsablePoints
|
||||
"积分抵扣不能大于" + props.maxCanUsePoints
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,10 +7,7 @@
|
||||
orderCostSummary.finalPayAmount
|
||||
}}</text>
|
||||
</view>
|
||||
<view
|
||||
class="u-m-t-10 color-999 old-price"
|
||||
v-if="orderCostSummary.merchantReduction.actualAmount"
|
||||
>
|
||||
<view class="u-m-t-10 color-999 old-price" v-if="orderCostSummary.merchantReduction.actualAmount">
|
||||
<text class="">¥</text>
|
||||
<text class=" ">{{ returnMerchantReductionBeforeMoney }}</text>
|
||||
</view>
|
||||
@@ -23,10 +20,7 @@
|
||||
</view>
|
||||
<view class="content bg-fff border-r-12">
|
||||
<view class="u-p-l-26 u-p-r-26 card top u-m-t-30">
|
||||
<view
|
||||
class="border-bottom-dashed u-p-b-30 u-p-t-30"
|
||||
v-if="orderCostSummary.newUserDiscount"
|
||||
>
|
||||
<view class="border-bottom-dashed u-p-b-30 u-p-t-30" v-if="orderCostSummary.newUserDiscount">
|
||||
<view class="u-flex u-p-l-24 u-p-r-24 u-row-between">
|
||||
<view>新客立减</view>
|
||||
<view class="color-red">
|
||||
@@ -34,10 +28,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="border-bottom-dashed u-p-b-30 u-p-t-30"
|
||||
v-if="orderCostSummary.vipDiscountAmount"
|
||||
>
|
||||
<view class="border-bottom-dashed u-p-b-30 u-p-t-30" v-if="orderCostSummary.vipDiscountAmount">
|
||||
<view class="u-flex u-p-l-24 u-p-r-24 u-row-between">
|
||||
<view>会员折扣</view>
|
||||
<view class="color-red">
|
||||
@@ -45,10 +36,8 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="border-bottom-dashed u-p-b-30 u-p-t-30"
|
||||
v-if="orderCostSummary.merchantReduction.actualAmount"
|
||||
>
|
||||
<view class="border-bottom-dashed u-p-b-30 u-p-t-30"
|
||||
v-if="orderCostSummary.merchantReduction.actualAmount">
|
||||
<view class="u-flex u-p-l-24 u-p-r-24 u-row-between">
|
||||
<view>商家减免</view>
|
||||
<view class="color-red">
|
||||
@@ -56,13 +45,10 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="border-bottom-dashed u-p-b-30 u-p-t-30"
|
||||
v-if="
|
||||
<view class="border-bottom-dashed u-p-b-30 u-p-t-30" v-if="
|
||||
orderCostSummary.fullReduction.actualAmount &&
|
||||
orderCostSummary.fullReduction.usedThreshold
|
||||
"
|
||||
>
|
||||
">
|
||||
<view class="u-flex u-p-l-24 u-p-r-24 u-row-between">
|
||||
<view>满减活动</view>
|
||||
<view class="color-red">
|
||||
@@ -75,52 +61,32 @@
|
||||
<view class="u-flex u-p-l-24 u-p-r-24 u-row-between" @click="toQuan">
|
||||
<view>优惠券</view>
|
||||
<view class="color-999 u-flex u-col-center">
|
||||
<text
|
||||
class="color-red"
|
||||
v-if="orderCostSummary.fullReduction.usedThreshold"
|
||||
>满减活动不可与优惠券同享</text
|
||||
>
|
||||
<text v-else-if="orderCostSummary.couponDeductionAmount <= 0"
|
||||
>选择优惠券</text
|
||||
>
|
||||
<text class="color-red"
|
||||
v-if="orderCostSummary.fullReduction.usedThreshold">满减活动不可与优惠券同享</text>
|
||||
<text v-else-if="orderCostSummary.couponDeductionAmount <= 0">选择优惠券</text>
|
||||
<text class="color-red" v-else>
|
||||
-¥{{ orderCostSummary.couponDeductionAmount }}
|
||||
</text>
|
||||
|
||||
<view
|
||||
class="u-flex u-col-center"
|
||||
v-if="!orderCostSummary.fullReduction.usedThreshold"
|
||||
>
|
||||
<view class="u-flex u-col-center" v-if="!orderCostSummary.fullReduction.usedThreshold">
|
||||
<uni-icons type="right" color="#999"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view
|
||||
class="border-bottom u-p-b-30"
|
||||
v-if="discount.value || accountPoints.sel"
|
||||
>
|
||||
<view
|
||||
class="u-flex u-p-l-24 u-p-r-24 u-row-between u-p-t-30"
|
||||
v-if="discount.value"
|
||||
>
|
||||
<view class="border-bottom u-p-b-30" v-if="discount.value || accountPoints.sel">
|
||||
<view class="u-flex u-p-l-24 u-p-r-24 u-row-between u-p-t-30" v-if="discount.value">
|
||||
<view>服务员改价</view>
|
||||
<view class="u-flex u-col-center">
|
||||
<text style="color: rgb(255, 95, 46)"
|
||||
>-¥{{ to2(discount.value) }}</text
|
||||
>
|
||||
<text style="color: rgb(255, 95, 46)">-¥{{ to2(discount.value) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="u-flex u-p-l-24 u-p-r-24 u-row-between u-p-t-30"
|
||||
v-if="orderCostSummary.pointDeductionAmount && accountPoints.sel"
|
||||
>
|
||||
<view class="u-flex u-p-l-24 u-p-r-24 u-row-between u-p-t-30"
|
||||
v-if="orderCostSummary.pointDeductionAmount && accountPoints.sel">
|
||||
<view>积分抵扣</view>
|
||||
<view class="u-flex u-col-center">
|
||||
<text style="color: rgb(255, 95, 46)"
|
||||
>-¥{{ orderCostSummary.pointDeductionAmount }}</text
|
||||
>
|
||||
<text style="color: rgb(255, 95, 46)">-¥{{ orderCostSummary.pointDeductionAmount }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -130,44 +96,28 @@
|
||||
<my-tabs :list="pays.list" v-model="pays.selIndex"></my-tabs>
|
||||
<template v-if="pays.selIndex == 0">
|
||||
<view class="list">
|
||||
<view
|
||||
class="item"
|
||||
@click="changePayType(index, item)"
|
||||
:class="{ disabled: item.disabled }"
|
||||
v-for="(item, index) in pays.payTypes.list"
|
||||
:key="index"
|
||||
>
|
||||
<view
|
||||
class="u-flex u-row-between u-p-t-30 u-p-b-30 border-bottom"
|
||||
>
|
||||
<view class="item" @click="changePayType(index, item)" :class="{ disabled: item.disabled }"
|
||||
v-for="(item, index) in pays.payTypes.list" :key="index">
|
||||
<view class="u-flex u-row-between u-p-t-30 u-p-b-30 border-bottom">
|
||||
<view class="u-flex">
|
||||
<image class="icon" :src="item.icon" mode=""></image>
|
||||
<text class="u-m-l-10 no-wrap">{{ item.payName }}</text>
|
||||
</view>
|
||||
<view class="u-flex color-999 u-font-24">
|
||||
<view
|
||||
class="u-m-r-20"
|
||||
v-if="item.payType == 'arrears' && pageData.buyer.id"
|
||||
@click.stop="chooseBuyer"
|
||||
>
|
||||
<view class="u-m-r-20" v-if="item.payType == 'arrears' && pageData.buyer.id"
|
||||
@click.stop="chooseBuyer">
|
||||
<view>
|
||||
<text>挂账人:</text>
|
||||
<text class="u-m-r-4">{{ pageData.buyer.debtor }}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text>挂账额度:</text>
|
||||
<text
|
||||
>¥{{ pageData.buyer.remainingAmount || "0" }}</text
|
||||
>
|
||||
<text>¥{{ pageData.buyer.remainingAmount || "0" }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="u-m-r-20"
|
||||
v-if="
|
||||
<view class="u-m-r-20" v-if="
|
||||
item.payType == 'member-account' && pageData.user.id
|
||||
"
|
||||
@click.stop="chooseUser"
|
||||
>
|
||||
" @click.stop="chooseUser">
|
||||
<view>
|
||||
<text>会员:</text>
|
||||
<text class="u-m-r-4">{{
|
||||
@@ -184,10 +134,8 @@
|
||||
</view> -->
|
||||
</view>
|
||||
<view :class="{ op3: item.disabled }">
|
||||
<my-radio
|
||||
@click="changePayType(index, item)"
|
||||
:modelValue="index == pays.payTypes.selIndex"
|
||||
>
|
||||
<my-radio @click="changePayType(index, item)"
|
||||
:modelValue="index == pays.payTypes.selIndex">
|
||||
</my-radio>
|
||||
</view>
|
||||
</view>
|
||||
@@ -195,11 +143,8 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="border-bottom-dashed"></view>
|
||||
<view
|
||||
class="u-flex u-row-between u-p-t-24"
|
||||
v-if="pageData.user.id"
|
||||
@click="changeAccountPoints"
|
||||
>
|
||||
<view class="u-flex u-row-between u-p-t-24" v-if="pageData.user.id"
|
||||
@click="changeAccountPoints">
|
||||
<view class="u-flex">
|
||||
<view class="">积分抵扣</view>
|
||||
<view class="color-999 u-m-l-10">
|
||||
@@ -211,37 +156,28 @@
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
<view class="u-flex">
|
||||
<view
|
||||
><text>{{ accountPoints.num }}</text></view
|
||||
>
|
||||
<view
|
||||
v-if="pointDeductionRule.enableRewards"
|
||||
@click.stop="refPointsOpen"
|
||||
>
|
||||
<view><text>{{ userPoints }}</text></view>
|
||||
<view v-if="pointDeductionRule.enableRewards&&accountPoints.sel" @click.stop="refPointsOpen">
|
||||
<up-icon name="edit-pen" size="16" color="#999"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="u-m-l-32 u-relative"
|
||||
v-if="pointDeductionRule.enableRewards"
|
||||
>
|
||||
<view class="u-m-l-32 u-relative" v-if="pointDeductionRule.enableRewards">
|
||||
<view class="u-absolute position-all"></view>
|
||||
<my-radio :modelValue="accountPoints.sel"> </my-radio>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="color-999 u-font-24 u-m-t-16">
|
||||
<view class="" v-if="accountPoints.calcRes.unusableReason">
|
||||
<view class="" v-if="!pointDeductionRule.enableRewards">
|
||||
<text class="color-red">*</text>
|
||||
<text>{{ accountPoints.calcRes.unusableReason }}</text>
|
||||
<text>积分不可用</text>
|
||||
</view>
|
||||
<view class="" v-if="accountPoints.calcRes.usable">
|
||||
<view class="" v-if="pointDeductionRule.enableRewards">
|
||||
<text class="color-red">*</text>
|
||||
<text class="" v-if="pointDeductionRule.enableRewards"
|
||||
>「可用积分{{ pageData.user.id?pageData.user.pointBalance:0}},最大可抵扣{{
|
||||
<text class=""
|
||||
v-if="pointDeductionRule.enableRewards">「可用积分{{ pageData.user.id?pageData.user.pointBalance:0}},最大可抵扣{{
|
||||
maxPointDiscount
|
||||
}}元」</text
|
||||
>
|
||||
}}元」</text>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
@@ -250,9 +186,7 @@
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="pays.selIndex == 1">
|
||||
<view class="u-font-32 u-m-t-40 u-text-center"
|
||||
>请让顾客使用微信/支付宝扫码</view
|
||||
>
|
||||
<view class="u-font-32 u-m-t-40 u-text-center">请让顾客使用微信/支付宝扫码</view>
|
||||
<view class="u-flex u-row-center u-m-t-40">
|
||||
<up-qrcode cid="code" :size="140" :val="payCodeUrl"></up-qrcode>
|
||||
</view>
|
||||
@@ -264,18 +198,14 @@
|
||||
<view class="card border-bottom top u-m-t-32"> </view>
|
||||
<view class="bg-fff card bottom border-r-12 u-p-32">
|
||||
<view class="font-bold u-font-32 u-text-center">
|
||||
¥{{ payPrice }}</view
|
||||
>
|
||||
¥{{ payPrice }}</view>
|
||||
<view class="u-flex u-row-center u-m-t-24">
|
||||
<template v-if="order.status == 'unpaid'">
|
||||
<up-loading-icon size="14" text="等待支付"></up-loading-icon>
|
||||
</template>
|
||||
<template v-if="order.status == 'done'">
|
||||
<view class="u-flex pay-success">
|
||||
<up-icon
|
||||
color="#5CBB6F"
|
||||
name="checkmark-circle-fill"
|
||||
></up-icon>
|
||||
<up-icon color="#5CBB6F" name="checkmark-circle-fill"></up-icon>
|
||||
<view class="u-m-l-6">支付成功</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -285,35 +215,15 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<edit-discount
|
||||
@confirm="editDiscountConfirm"
|
||||
title="优惠金额"
|
||||
:ref="setModel"
|
||||
name="editMoney"
|
||||
:price="returnMerchantReductionBeforeMoney"
|
||||
:discount="discount.discount"
|
||||
></edit-discount>
|
||||
<edit-discount @confirm="editDiscountConfirm" title="优惠金额" :ref="setModel" name="editMoney"
|
||||
:price="returnMerchantReductionBeforeMoney" :discount="discount.discount"></edit-discount>
|
||||
|
||||
<up-modal
|
||||
:title="modal.title"
|
||||
:content="modal.content"
|
||||
:show="modal.show"
|
||||
:confirmText="modal.confirmText"
|
||||
:cancelText="modal.cancelText"
|
||||
showCancelButton
|
||||
closeOnClickOverlay
|
||||
@confirm="confirmModelConfirm"
|
||||
@cancel="confirmModelCancel"
|
||||
@close="confirmModelCancel"
|
||||
width="300px"
|
||||
/>
|
||||
<up-modal :title="modal.title" :content="modal.content" :show="modal.show" :confirmText="modal.confirmText"
|
||||
:cancelText="modal.cancelText" showCancelButton closeOnClickOverlay @confirm="confirmModelConfirm"
|
||||
@cancel="confirmModelCancel" @close="confirmModelCancel" width="300px" />
|
||||
|
||||
<edit-accountPoints
|
||||
@confirm="pointsConfirm"
|
||||
:price="accountPoints.num"
|
||||
:accountPoints="accountPoints"
|
||||
ref="refPoints"
|
||||
></edit-accountPoints>
|
||||
<edit-accountPoints @confirm="pointsConfirm" :price="userPoints" :pointDeductionRule="pointDeductionRule"
|
||||
:maxCanUsePoints="maxCanUsePoints" ref="refPoints"></edit-accountPoints>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -328,11 +238,17 @@ import {
|
||||
computed,
|
||||
inject,
|
||||
} from "vue";
|
||||
import { onLoad, onBackPress, onShow } from "@dcloudio/uni-app";
|
||||
import {
|
||||
onLoad,
|
||||
onBackPress,
|
||||
onShow
|
||||
} from "@dcloudio/uni-app";
|
||||
import BigNumber from "bignumber.js";
|
||||
import go from "@/commons/utils/go.js";
|
||||
import infoBox from "@/commons/utils/infoBox.js";
|
||||
import { hasPermission } from "@/commons/utils/hasPermission.js";
|
||||
import {
|
||||
hasPermission
|
||||
} from "@/commons/utils/hasPermission.js";
|
||||
import editDiscount from "@/components/my-components/edit-discount.vue";
|
||||
import editAccountPoints from "./components/edit-accountPoints.vue";
|
||||
import {
|
||||
@@ -341,18 +257,34 @@ import {
|
||||
returnProductCoupAllPrice,
|
||||
returnProductCanUseNum,
|
||||
} from "../quan_util.js";
|
||||
import { mathFloorPrice } from "@/commons/utils/goodsUtil.js";
|
||||
import { getDiscountByUserId } from "@/http/yskApi/market/consumeDiscount.js";
|
||||
import { useCartStore } from "@/stores/cart.js";
|
||||
import {
|
||||
mathFloorPrice
|
||||
} from "@/commons/utils/goodsUtil.js";
|
||||
import {
|
||||
getDiscountByUserId
|
||||
} from "@/http/yskApi/market/consumeDiscount.js";
|
||||
import {
|
||||
useCartStore
|
||||
} from "@/stores/cart.js";
|
||||
|
||||
const cartStore = useCartStore();
|
||||
|
||||
// import { getCouponList } from '@/http/api/coupon.js'
|
||||
import { getHistoryOrder } from "@/http/api/order.js";
|
||||
import { getPayTypeList } from "@/http/api/payType.js";
|
||||
import { shopUserDetail } from "@/http/api/shopUser.js";
|
||||
import { pointsConfig } from "@/http/yskApi/market/points.js";
|
||||
import { discountActivity } from "@/http/yskApi/market/discountActivity.js";
|
||||
import {
|
||||
getHistoryOrder
|
||||
} from "@/http/api/order.js";
|
||||
import {
|
||||
getPayTypeList
|
||||
} from "@/http/api/payType.js";
|
||||
import {
|
||||
shopUserDetail
|
||||
} from "@/http/api/shopUser.js";
|
||||
import {
|
||||
pointsConfig
|
||||
} from "@/http/yskApi/market/points.js";
|
||||
import {
|
||||
discountActivity
|
||||
} from "@/http/yskApi/market/discountActivity.js";
|
||||
|
||||
import {
|
||||
scanPay,
|
||||
@@ -499,7 +431,9 @@ async function init() {
|
||||
onMessage();
|
||||
});
|
||||
// 获取订单详情
|
||||
const orderRes = await getHistoryOrder({ orderId: order.orderId });
|
||||
const orderRes = await getHistoryOrder({
|
||||
orderId: order.orderId
|
||||
});
|
||||
if (orderRes.status == "cancelled") {
|
||||
uni.showToast({
|
||||
title: "订单已取消",
|
||||
@@ -669,8 +603,7 @@ const orderCostSummary = computed(() => {
|
||||
options.dinnerType,
|
||||
selCoupon.value,
|
||||
activityList.value,
|
||||
orderExtraConfig.value,
|
||||
{},
|
||||
orderExtraConfig.value, {},
|
||||
new Date()
|
||||
);
|
||||
console.log(" 订单费用汇总", costSummary);
|
||||
@@ -703,14 +636,7 @@ watch(
|
||||
}
|
||||
}
|
||||
);
|
||||
watch(
|
||||
() => accountPoints.num,
|
||||
(newval) => {
|
||||
if (accountPoints.sel) {
|
||||
userPoints.value = newval;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
watch(
|
||||
() => pointsCanDicountMaxMoney.value,
|
||||
(newval) => {
|
||||
@@ -719,6 +645,15 @@ watch(
|
||||
}
|
||||
}
|
||||
);
|
||||
watch(
|
||||
() => accountPoints.sel,
|
||||
(newval) => {
|
||||
if (pageData.user.id) {
|
||||
getCalcUsablePoints();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
watch(
|
||||
() => pageData.user.id,
|
||||
(newval) => {
|
||||
@@ -751,8 +686,7 @@ watch(
|
||||
v.disabled = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
}, {
|
||||
immediate: true,
|
||||
}
|
||||
);
|
||||
@@ -763,7 +697,9 @@ watch(
|
||||
clearInterval(timer);
|
||||
if (newval) {
|
||||
timer = setInterval(() => {
|
||||
getHistoryOrder({ orderId: order.orderId }).then((res) => {
|
||||
getHistoryOrder({
|
||||
orderId: order.orderId
|
||||
}).then((res) => {
|
||||
order.status = res.status;
|
||||
if (res.status == "done") {
|
||||
paySuccess();
|
||||
@@ -793,28 +729,25 @@ function getPayParam() {
|
||||
pointsNum: orderCostSummary.value.pointUsed, //(扣除各类折扣 enable_deduction后使用)
|
||||
seatNum: options.dinnerType == "dine-in" ? seatFeeConfig.personCount : 0, //用餐人数
|
||||
newCustomerDiscountAmount: orderCostSummary.value.newUserDiscount, //新客立减
|
||||
newCustomerDiscountId:
|
||||
orderCostSummary.value.newUserDiscount > 0
|
||||
? newUserDiscountRes.value.id
|
||||
: "",
|
||||
newCustomerDiscountId: orderCostSummary.value.newUserDiscount > 0 ?
|
||||
newUserDiscountRes.value.id :
|
||||
"",
|
||||
|
||||
discountActAmount: orderCostSummary.value.fullReduction.actualAmount, //满减抵扣金额
|
||||
discountActId:
|
||||
orderCostSummary.value.fullReduction.usedActivity &&
|
||||
orderCostSummary.value.fullReduction.usedThreshold
|
||||
? orderCostSummary.value.fullReduction.usedActivity.id
|
||||
: null,
|
||||
discountActId: orderCostSummary.value.fullReduction.usedActivity &&
|
||||
orderCostSummary.value.fullReduction.usedThreshold ?
|
||||
orderCostSummary.value.fullReduction.usedActivity.id :
|
||||
null,
|
||||
vipPrice: isVip.value ? 1 : 0, // 是否使用会员价
|
||||
limitRate:
|
||||
order.limitRate && order.limitRate.id
|
||||
? {
|
||||
limitRate: order.limitRate && order.limitRate.id ?
|
||||
{
|
||||
id: order.limitRate.id,
|
||||
discountRate: order.limitRate.discountRate,
|
||||
discountPriority: order.limitRate.discountPriority,
|
||||
foodType: order.limitRate.foodType,
|
||||
foods: order.limitRate.foods,
|
||||
}
|
||||
: null,
|
||||
} :
|
||||
null,
|
||||
vipDiscountAmount: orderCostSummary.value.vipDiscountAmount, //会员折扣减免金额
|
||||
};
|
||||
if (pays.quan.length > 0) {
|
||||
@@ -885,7 +818,7 @@ function setQuan(arr) {
|
||||
* 积分选择
|
||||
*/
|
||||
function refPointsOpen() {
|
||||
if (!accountPoints.calcRes.usable && accountPoints.sel) {
|
||||
if (!pointDeductionRule.enableRewards && accountPoints.sel) {
|
||||
return;
|
||||
}
|
||||
refPoints.value.open();
|
||||
@@ -896,7 +829,7 @@ function refPointsOpen() {
|
||||
* @param {Object} e
|
||||
*/
|
||||
function pointsConfirm(e) {
|
||||
accountPoints.num = e;
|
||||
userPoints.value = e
|
||||
}
|
||||
|
||||
|
||||
@@ -920,21 +853,26 @@ async function getCalcUsablePoints() {
|
||||
const onePointsMoney = pointDeductionRule.pointsPerYuan ? ((1 || 0) / pointDeductionRule.pointsPerYuan) : 0
|
||||
|
||||
|
||||
const calcMaxDiscount = Math.floor(pointsCanDicountMaxMoney.value * (pointDeductionRule.maxDeductionRatio / 100))
|
||||
const userMaxDiscount = BigNumber(userAccountPoints).times(onePointsMoney).decimalPlaces(2, BigNumber.ROUND_DOWN)
|
||||
const calcMaxDiscount = Math.floor(pointsCanDicountMaxMoney.value * (pointDeductionRule.maxDeductionRatio /
|
||||
100))
|
||||
const userMaxDiscount = BigNumber(userAccountPoints).times(onePointsMoney).decimalPlaces(2, BigNumber
|
||||
.ROUND_DOWN)
|
||||
.toNumber()
|
||||
|
||||
maxPointDiscount.value = Math.min(calcMaxDiscount, userMaxDiscount)
|
||||
console.log('积分最大可抵扣金额', maxPointDiscount.value)
|
||||
pointDeductionRule.maxDeductionAmount = maxPointDiscount.value || 0
|
||||
if (accountPoints.sel && pointDeductionRule.enableRewards) {
|
||||
if (pointDeductionRule.enableRewards) {
|
||||
let num = (maxPointDiscount.value || 0) * pointDeductionRule.pointsPerYuan
|
||||
if (num > userAccountPoints) {
|
||||
num = userAccountPoints
|
||||
}
|
||||
maxCanUsePoints.value = num
|
||||
if (accountPoints.sel) {
|
||||
userPoints.value = num
|
||||
}
|
||||
}
|
||||
|
||||
if (!pointDeductionRule.enableRewards) {
|
||||
userPoints.value = 0
|
||||
}
|
||||
@@ -1065,9 +1003,9 @@ function uodateCartAndHistory() {
|
||||
pageData.shopInfo,
|
||||
pageData.user,
|
||||
"productId"
|
||||
)
|
||||
? 1
|
||||
: 0;
|
||||
) ?
|
||||
1 :
|
||||
0;
|
||||
if (canUseLimitTimeDiscount != cart.isTimeDiscount) {
|
||||
newData.history.push({
|
||||
id: cart.id,
|
||||
@@ -1186,6 +1124,7 @@ const tipsMap = {
|
||||
paying: "支付中",
|
||||
success: "已支付成功",
|
||||
};
|
||||
|
||||
function payOrderClick() {
|
||||
const payType = pays.payTypes.list[pays.payTypes.selIndex].payType;
|
||||
if (payType == "scanCode" || payType == "deposit") {
|
||||
@@ -1268,7 +1207,9 @@ async function pay(par) {
|
||||
title: "支付中...",
|
||||
});
|
||||
timer = setInterval(async () => {
|
||||
res = await queryOrderStatus({ orderId: pars.orderId });
|
||||
res = await queryOrderStatus({
|
||||
orderId: pars.orderId
|
||||
});
|
||||
if (res == "done") {
|
||||
clearInterval(timer);
|
||||
uni.hideLoading();
|
||||
@@ -1352,6 +1293,7 @@ async function confirmModelConfirm() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function objToArrary(obj) {
|
||||
if (Object.values(obj) && Array.isArray(Object.values(obj)[0])) {
|
||||
// 是数组
|
||||
@@ -1405,7 +1347,9 @@ function cashConfirmShow() {
|
||||
*/
|
||||
async function getHistoryAndUpdateGoodsList() {
|
||||
// 获取订单详情
|
||||
const orderRes = await getHistoryOrder({ orderId: order.orderId });
|
||||
const orderRes = await getHistoryOrder({
|
||||
orderId: order.orderId
|
||||
});
|
||||
if (orderRes.status == "cancelled") {
|
||||
uni.showToast({
|
||||
title: "订单已取消",
|
||||
@@ -1471,11 +1415,9 @@ $quan-color: #318afe;
|
||||
|
||||
.hui {
|
||||
// background-color: $quan-color;
|
||||
background-image: linear-gradient(
|
||||
to right bottom,
|
||||
background-image: linear-gradient(to right bottom,
|
||||
rgb(254, 103, 4),
|
||||
rgb(241, 50, 42)
|
||||
);
|
||||
rgb(241, 50, 42));
|
||||
padding: 4rpx 10rpx;
|
||||
border-radius: 10rpx;
|
||||
font-size: 24rpx;
|
||||
|
||||
Reference in New Issue
Block a user