|
|
@@ -239,7 +239,7 @@
|
|
|
<appTimer :placeholder="'默认30分钟内配送'" @confirm="onConfirm" :sendTime="sendTime"></appTimer>
|
|
|
<tui-list-cell class="line-cell" :hover="false" :arrow="false" v-show="form.sendType == 1">
|
|
|
<view class="tui-title ">运费</view>
|
|
|
- <input type="number" placeholder="留空表示免运费" @input="countAllPrices" v-model="form.sendCost" placeholder-class="tui-placeholder">
|
|
|
+ <input type="number" placeholder="留空表示免运费" @input="countAllPrices" v-model="form.sendCost" placeholder-class="tui-placeholder" disabled>
|
|
|
</tui-list-cell>
|
|
|
<tui-list-cell class="line-cell" :hover="false" :arrow="true" @click="pageTo({url: '/admin/coupon/selectCouponList'})">
|
|
|
<view class="tui-title ">红包/抵用券</view>
|
|
|
@@ -265,8 +265,12 @@
|
|
|
<text class="price-title">总金额</text>
|
|
|
<text class="price-number">
|
|
|
¥
|
|
|
- <text class="large" v-if="form.sendType==1">{{ this.numberAdd(allPrice, Number(form.sendCost)) }}</text>
|
|
|
- <text class="large" v-else>{{ allPrice}}</text>
|
|
|
+ <text class="large" v-if="form.sendType==1 && !couponSumText">{{ numberAdd(allPrice, Number(form.sendCost)) }}</text>
|
|
|
+ <text class="large" v-else-if="form.sendType==1 && couponSumText">{{ allPrice + Number(form.sendCost) - Number(couponSumText) }}</text>
|
|
|
+ <text class="large" v-else-if="form.sendType==2 && !couponSumText">{{ allPrice}}</text>
|
|
|
+ <text class="large" v-else-if="form.sendType==2 && couponSumText">{{ NumberSub(allPrice, Number(couponSumText))}}</text>
|
|
|
+ <text class="large" v-else-if="!form.sendType && !couponSumText">{{ allPrice }}</text>
|
|
|
+ <text class="large" v-else-if="!form.sendType && couponSumText">{{ NumberSub(allPrice, Number(couponSumText)) }}</text>
|
|
|
</text>
|
|
|
</view>
|
|
|
<button class="admin-button-com blue middle" @click="affirmFormSubmit">提交</button>
|
|
|
@@ -337,7 +341,7 @@ export default {
|
|
|
// 详细地址
|
|
|
// showRegion: false,
|
|
|
showCustomer: false,
|
|
|
- couponSumText: uni.getStorageSync('selectCouponInfo').couponSum ? uni.getStorageSync('selectCouponInfo').couponSum : '',
|
|
|
+ couponSumText: '',
|
|
|
couponText: ''
|
|
|
};
|
|
|
},
|
|
|
@@ -353,19 +357,20 @@ export default {
|
|
|
title: this.getMerchantInfo.name
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+ this.getGhsData(e.id);
|
|
|
+ },
|
|
|
+ onShow() {
|
|
|
if(uni.getStorageSync('selectCouponInfo').couponSum) {
|
|
|
- this.couponText = '-¥' + uni.getStorageSync('selectCouponInfo').couponSum
|
|
|
+ this.couponSumText = uni.getStorageSync('selectCouponInfo').couponSum
|
|
|
+ this.couponText = '-¥' + this.couponSumText
|
|
|
} else {
|
|
|
this.hasCoupon()
|
|
|
}
|
|
|
- this.getGhsData(e.id);
|
|
|
- },
|
|
|
+ },
|
|
|
computed: {
|
|
|
...mapGetters(["getMerchantInfo", "getLoginInfo"])
|
|
|
},
|
|
|
- onUnload() {
|
|
|
- uni.removeStorageSync('selectCouponInfo')
|
|
|
- },
|
|
|
methods: {
|
|
|
...mapActions(["initMerchantInfo"]),
|
|
|
init() {
|
|
|
@@ -382,7 +387,7 @@ export default {
|
|
|
// 是否有可用优惠券
|
|
|
hasCoupon() {
|
|
|
let amount = this.form.sendType == 1 ? this.allPrice+Number(this.form.sendCost) : this.allPrice
|
|
|
- shopHouponHas(amount).then(res => {
|
|
|
+ shopHouponHas({amount}).then(res => {
|
|
|
console.log(377, res)
|
|
|
this.couponText = res.data.has ? '有可用优惠券' : ''
|
|
|
console.log(this.couponText)
|
|
|
@@ -462,6 +467,7 @@ export default {
|
|
|
content: '确认提交?',
|
|
|
success: function (res) {
|
|
|
if (res.confirm) {
|
|
|
+ uni.removeStorageSync('selectCouponInfo')
|
|
|
createOrder(parameter).then(res => {
|
|
|
self.resetSelectInfoByType(self.pageType);
|
|
|
const {data: { orderSn,actPrice }} = res;
|
|
|
@@ -486,6 +492,22 @@ export default {
|
|
|
m = Math.pow(10, Math.max(r1, r2))
|
|
|
n = (r1 >= r2) ? r1 : r2;
|
|
|
return ((arg1 * m + arg2 * m) / m).toFixed(n);
|
|
|
+ },
|
|
|
+ NumberSub(arg1, arg2) {
|
|
|
+ var re1, re2, m, n;
|
|
|
+ try {
|
|
|
+ re1 = arg1.toString().split(".")[1].length;
|
|
|
+ } catch (e) {
|
|
|
+ re1 = 0;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ re2 = arg2.toString().split(".")[1].length;
|
|
|
+ } catch (e) {
|
|
|
+ re2 = 0;
|
|
|
+ }
|
|
|
+ m = Math.pow(10, Math.max(re1, re2));
|
|
|
+ n = (re1 >= re2) ? re1 : re2;
|
|
|
+ return ((arg1 * m - arg2 * m) / m).toFixed(n);
|
|
|
},
|
|
|
// 表单验证
|
|
|
async formSubmit(e) {
|