|
|
@@ -48,7 +48,7 @@
|
|
|
|
|
|
<div class="shop-prompt">
|
|
|
<div>总计</div>
|
|
|
- <div>¥{{ totalPrice() }}</div>
|
|
|
+ <div>¥{{ totalPrice }}</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -56,11 +56,7 @@
|
|
|
<div class="module-com discount-wrap" v-if="!$util.isEmpty(discountArr)">
|
|
|
<div class="module-tit">可选优惠</div>
|
|
|
<div class="module-det">
|
|
|
- <app-coupon-sel
|
|
|
- ref="couponSel"
|
|
|
- :price="goodsInfo.price * option.goodsNum"
|
|
|
- :discountArr="['member', 'coupon']"
|
|
|
- />
|
|
|
+ <app-coupon-sel ref="couponSel" :price="totalPrice" :discountArr="['member', 'coupon']" />
|
|
|
</div>
|
|
|
</div>
|
|
|
<app-trademark />
|
|
|
@@ -70,7 +66,7 @@
|
|
|
<span>应付款</span>
|
|
|
<span class="app-price">
|
|
|
<span>¥</span>
|
|
|
- <span class="app-size-40">{{ mayPayAmount() }}</span>
|
|
|
+ <span class="app-size-40">{{ mayPayAmount }}</span>
|
|
|
</span>
|
|
|
</div>
|
|
|
<button class="button-com red" formType="submit">确认</button>
|
|
|
@@ -79,7 +75,9 @@
|
|
|
<!-- 弹窗 -->
|
|
|
<alert-module :show="showAlert" @click="hideAlert" @cancel="hideAlert">
|
|
|
<div class="alt-content" v-if="!$util.isEmpty(orderShop)">
|
|
|
- <div><span class="app-price">{{ `${orderShop.freight.first}公里`}}</span>内免运费</div>
|
|
|
+ <div>
|
|
|
+ <span class="app-price">{{ `${orderShop.freight.first}公里`}}</span>内免运费
|
|
|
+ </div>
|
|
|
<div>
|
|
|
<span>超过每增加1公里运费加</span>
|
|
|
<span class="app-price">{{ `${orderShop.freight.add}元` }}</span>
|
|
|
@@ -128,7 +126,6 @@ export default {
|
|
|
],
|
|
|
showAlert: false,
|
|
|
// form
|
|
|
- // 初始form
|
|
|
form: {
|
|
|
anonymity: "0", // 是否匿名 0不 1要
|
|
|
sendDistance: "", // 配送距离,根据腾讯js进行计算
|
|
|
@@ -141,39 +138,33 @@ export default {
|
|
|
},
|
|
|
// 自提form
|
|
|
mentionForm: {
|
|
|
- bookMobile: ''
|
|
|
+ bookMobile: ""
|
|
|
},
|
|
|
discountArr: false,
|
|
|
// 运费
|
|
|
freightPrice: 0,
|
|
|
goodsNum: 1,
|
|
|
//显示的距离
|
|
|
- showDistance:0
|
|
|
+ showDistance: 0,
|
|
|
+ totalPrice: 0,
|
|
|
+ mayPayAmount: 0
|
|
|
};
|
|
|
},
|
|
|
mounted() {},
|
|
|
computed: {
|
|
|
...mapGetters({ orderShop: "getOrderShop" }),
|
|
|
- ...mapGetters({ shopUser: "getShopUser" }),
|
|
|
- //计算总金额
|
|
|
- totalPrice() {
|
|
|
- return function() {
|
|
|
- let totalPrice =
|
|
|
- this.goodsInfo.price * this.goodsNum + this.freightPrice;
|
|
|
- return totalPrice.toFixed(2);
|
|
|
- };
|
|
|
- },
|
|
|
- //计算应付款
|
|
|
- mayPayAmount(){
|
|
|
- return function() {
|
|
|
- let totalPrice =
|
|
|
- this.goodsInfo.price * this.goodsNum + this.freightPrice;
|
|
|
- return totalPrice.toFixed(2);
|
|
|
- };
|
|
|
+ ...mapGetters({ shopUser: "getShopUser" })
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ //运费变化则总金额和应付金额变化
|
|
|
+ freightPrice(newVal) {
|
|
|
+ let price = this.goodsInfo.price * this.goodsInfo.buyNum + newVal;
|
|
|
+ this.totalPrice = price.toFixed(2);
|
|
|
+ this.mayPayAmount = price.toFixed(2);
|
|
|
}
|
|
|
},
|
|
|
onLoad(option) {
|
|
|
- this.goodsNum = option.goodsNum
|
|
|
+ //已有手机号则自动补全
|
|
|
this.$set(this.mentionForm, "bookMobile", this.shopUser.mobile);
|
|
|
},
|
|
|
created() {},
|
|
|
@@ -186,10 +177,9 @@ export default {
|
|
|
: goodsInfo.price;
|
|
|
|
|
|
getOrderShop().then(() => {
|
|
|
- this.$refs.couponSel._getUserDiscount().then(status => {
|
|
|
- console.log('discount'+status)
|
|
|
- this.discountArr = status;
|
|
|
- })
|
|
|
+ this.$refs.couponSel._getUserDiscount().then(discountData => {
|
|
|
+ this.discountArr = discountData;
|
|
|
+ });
|
|
|
});
|
|
|
|
|
|
getShopUser();
|
|
|
@@ -197,11 +187,13 @@ export default {
|
|
|
goodsInfo.buyNum = this.option.goodsNum;
|
|
|
this.goodsInfo = goodsInfo;
|
|
|
|
|
|
+ this.totalPrice = goodsInfo.price * this.option.goodsNum;
|
|
|
+ this.mayPayAmount = this.totalPrice;
|
|
|
+
|
|
|
// 初始化上个页面带入的值
|
|
|
Object.keys(this.form).forEach((i, index) => {
|
|
|
this.form[i] = this.option[i];
|
|
|
});
|
|
|
-
|
|
|
},
|
|
|
// 生成订单
|
|
|
createOrderFn() {
|
|
|
@@ -242,14 +234,14 @@ export default {
|
|
|
anonymityChange(e) {
|
|
|
this.form.anonymity = this.form.anonymity == 1 ? 0 : 1;
|
|
|
},
|
|
|
- // 选择地址
|
|
|
+ // 选择地址
|
|
|
changeAddress(e) {
|
|
|
// 计算客户距离和运费
|
|
|
- let lat = this.$refs.appDelivery.region.latitude
|
|
|
- let long = this.$refs.appDelivery.region.longitude
|
|
|
- getUserDistance({lat:lat,lng:long}).then(res => {
|
|
|
- this.freightPrice = res.data.fee
|
|
|
- this.showDistance = res.data.showDistance
|
|
|
+ let lat = this.$refs.appDelivery.region.latitude;
|
|
|
+ let long = this.$refs.appDelivery.region.longitude;
|
|
|
+ getUserDistance({ lat: lat, lng: long }).then(res => {
|
|
|
+ this.freightPrice = res.data.fee;
|
|
|
+ this.showDistance = res.data.showDistance;
|
|
|
});
|
|
|
},
|
|
|
// 表单验证
|