代客下单逻辑修改
This commit is contained in:
@@ -29,8 +29,12 @@
|
||||
<view class="u-flex u-p-b-30 u-row-between">
|
||||
<view class="price">
|
||||
<template v-if="goods && goods.isGrounding">
|
||||
<text v-if="goodsData.is_time_discount">¥{{ returnLimitPrice() }}</text>
|
||||
<text :class="{'old-price':goodsData.is_time_discount}">¥{{ to2(goods.salePrice * number) }}</text>
|
||||
<text v-if="is_time_discount"
|
||||
>¥{{ returnLimitPrice() }}</text
|
||||
>
|
||||
<text :class="{ oldPrice: is_time_discount }"
|
||||
>¥{{ goods.salePrice }}</text
|
||||
>
|
||||
</template>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
@@ -67,7 +71,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, reactive, ref, watch,inject } from "vue";
|
||||
import { computed, reactive, ref, watch, inject } from "vue";
|
||||
import util from "../util.js";
|
||||
import infobox from "@/commons/utils/infoBox.js";
|
||||
import myModel from "@/components/my-components/my-model.vue";
|
||||
@@ -75,14 +79,15 @@ import myButton from "@/components/my-components/my-button.vue";
|
||||
import BigNumber from "bignumber.js";
|
||||
const yskUtils = inject("yskUtils");
|
||||
const shopInfo = uni.getStorageSync("shopInfo");
|
||||
const shopUserInfo = uni.getStorageSync("shopUserInfo");
|
||||
|
||||
const props = defineProps({
|
||||
limitTimeDiscount:{
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {};
|
||||
},
|
||||
},
|
||||
limitTimeDiscount: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {};
|
||||
},
|
||||
},
|
||||
goodsData: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
@@ -114,16 +119,33 @@ const props = defineProps({
|
||||
function to2(number) {
|
||||
return Number(number).toFixed(2);
|
||||
}
|
||||
function returnLimitPrice(){
|
||||
const price= yskUtils.limitUtils.returnPrice({
|
||||
|
||||
const is_time_discount = computed(() => {
|
||||
if (!props.limitTimeDiscount || !props.limitTimeDiscount.id) {
|
||||
return false;
|
||||
}
|
||||
const isCanuse = yskUtils.limitUtils.canUseLimitTimeDiscount(
|
||||
goods.value,
|
||||
props.limitTimeDiscount,
|
||||
shopInfo,
|
||||
shopUserInfo,
|
||||
"productId"
|
||||
);
|
||||
console.log('isCanuse');
|
||||
console.log( goods.value);
|
||||
return isCanuse;
|
||||
|
||||
});
|
||||
function returnLimitPrice() {
|
||||
const price = yskUtils.limitUtils.returnPrice({
|
||||
goods: goods.value,
|
||||
shopInfo: shopInfo,
|
||||
limitTimeDiscountRes: props.limitTimeDiscount,
|
||||
shopUserInfo: null,
|
||||
idKey: "id",
|
||||
shopUserInfo: shopUserInfo,
|
||||
idKey: "productId",
|
||||
});
|
||||
|
||||
return BigNumber(price).times(number.value).toNumber()
|
||||
return BigNumber(price).times(number.value).toNumber();
|
||||
}
|
||||
const selSku = computed(() => {
|
||||
return props.skus
|
||||
@@ -228,7 +250,7 @@ function confirm() {
|
||||
if (isDisabled.value) {
|
||||
return;
|
||||
}
|
||||
emits("confirm", goods.value, number.value);
|
||||
emits("confirm", goods.value, number.value,is_time_discount.value);
|
||||
}
|
||||
defineExpose({
|
||||
open,
|
||||
@@ -275,8 +297,8 @@ defineExpose({
|
||||
.border-top {
|
||||
border-top: 1px solid #e5e5e5;
|
||||
}
|
||||
.old-price{
|
||||
color: #999;
|
||||
text-decoration: line-through;
|
||||
.oldPrice {
|
||||
color: #999;
|
||||
text-decoration: line-through;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user