|
@@ -119,9 +119,6 @@
|
|
export default {
|
|
export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
- Style: {
|
|
|
|
- btn: true
|
|
|
|
- },
|
|
|
|
user: {},
|
|
user: {},
|
|
key: '',
|
|
key: '',
|
|
address: {},
|
|
address: {},
|
|
@@ -276,47 +273,6 @@
|
|
that.$set(that, `costTotal`, arr.data.costTotal);
|
|
that.$set(that, `costTotal`, arr.data.costTotal);
|
|
that.$set(that, `shopInfo`, arr.data.shop);
|
|
that.$set(that, `shopInfo`, arr.data.shop);
|
|
that.$set(that, `buy_num`, arr.data.buy_num);
|
|
that.$set(that, `buy_num`, arr.data.buy_num);
|
|
- // this.computedTotal();
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- async computedTotal() {
|
|
|
|
- const total_detail = this.total_detail;
|
|
|
|
- let total = this.$plus(total_detail.freight_total, total_detail.goods_total)
|
|
|
|
- if (this.coupon.length > 0) {
|
|
|
|
- let discount = 0;
|
|
|
|
- for (const coupon of this.coupon) {
|
|
|
|
- const r = this.couponList.find(f => f._id === coupon)
|
|
|
|
- if (!r) continue;
|
|
|
|
- const {
|
|
|
|
- discount_config,
|
|
|
|
- discount_type
|
|
|
|
- } = r;
|
|
|
|
- if (discount_type === 'min') {
|
|
|
|
- const min = discount_config.min;
|
|
|
|
- discount = this.$plus(discount, min)
|
|
|
|
- } else if (discount_type === 'discount') {
|
|
|
|
- const min = discount_config.min || 0;
|
|
|
|
- let discount_money = 0;
|
|
|
|
- const max = discount_config.max || 0;
|
|
|
|
- // TODO 现在是平台发放的优惠券,所以可以直接用总价*折扣,如果是店铺的折扣券,则需要将金额分开,对应店铺计算折扣
|
|
|
|
- // const dm = min / 10 * total;
|
|
|
|
- const dm = this.$multiply(this.divide(min, 10), total)
|
|
|
|
- if (max !== 0) {
|
|
|
|
- if (max > dm) discount_money = dm;
|
|
|
|
- else discount_money = max
|
|
|
|
- }
|
|
|
|
- discount += discount_money
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- total = this.$minus(total, discount)
|
|
|
|
- }
|
|
|
|
- if (total >= 0) {
|
|
|
|
- this.$set(this, `goods_total`, total);
|
|
|
|
- } else {
|
|
|
|
- uni.showToast({
|
|
|
|
- title: `实付金额不能为负数 不能使用该优惠劵`,
|
|
|
|
- icon: 'none'
|
|
|
|
- })
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|