|
|
@@ -5,7 +5,7 @@
|
|
|
<!-- 配送 -->
|
|
|
<form @submit="formSubmit">
|
|
|
<block v-if="tabIndex == 0">
|
|
|
- <app-delivery-module ref="appDelivery" />
|
|
|
+ <app-delivery-module ref="appDelivery" @changeAddress="changeAddress" />
|
|
|
</block>
|
|
|
<!-- 自取 -->
|
|
|
<block v-else>
|
|
|
@@ -24,15 +24,15 @@
|
|
|
|
|
|
<!-- 商品金额 -->
|
|
|
<div class="module-com shop-price-wrap">
|
|
|
- <div class="module-tit">商品金额</div>
|
|
|
+ <div class="module-tit">商品信息</div>
|
|
|
<div class="module-det">
|
|
|
<app-list-module v-if="!$util.isEmpty(goodsInfo)" :info="goodsInfo" />
|
|
|
- <div class="shop-prompt">
|
|
|
+ <div class="shop-prompt" v-if="!$util.isEmpty(this.orderShop)" @click="showAlert = true">
|
|
|
<div>
|
|
|
- <span>运费(6公里)</span>
|
|
|
+ <span>{{ `运费(${this.orderShop.freight.first}公里)` }}</span>
|
|
|
<i class="iconfont iconchangjianwentixiangguanwenti2"></i>
|
|
|
</div>
|
|
|
- <div>¥{{ goodsInfo.price }}</div>
|
|
|
+ <div>¥{{ freightPrice }}</div>
|
|
|
</div>
|
|
|
<div class="shop-prompt">
|
|
|
<div>总计</div>
|
|
|
@@ -70,13 +70,13 @@
|
|
|
</form>
|
|
|
<!-- 弹窗 -->
|
|
|
<alert-module :show="showAlert" @click="hideAlert" @cancel="hideAlert">
|
|
|
- <div class="alt-content">
|
|
|
- <div>5公里内免运费</div>
|
|
|
+ <div class="alt-content" v-if="!$util.isEmpty(this.orderShop)">
|
|
|
+ <div>{{ `${this.orderShop.freight.first}公里内免运费` }}</div>
|
|
|
<div>
|
|
|
<span>超过</span>
|
|
|
- <span class="app-price">5公里</span>
|
|
|
+ <span class="app-price">{{ `${this.orderShop.freight.first}公里` }}</span>
|
|
|
<span>每增加1公里</span>
|
|
|
- <span class="app-price">+2元</span>
|
|
|
+ <span class="app-price">{{ `+${this.orderShop.freight.add}元` }}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
</alert-module>
|
|
|
@@ -93,6 +93,7 @@
|
|
|
import AppCouponSel from '@/components/app-coupon-sel'
|
|
|
import AlertModule from '@/components/plugin/alert'
|
|
|
const form = require('@/utils/formValidation.js')
|
|
|
+ import { calcDistance } from '@/utils/common'
|
|
|
// api
|
|
|
import { getShopUser } from '@/utils/auth'
|
|
|
import { getOrderShop } from '@/utils/config'
|
|
|
@@ -137,7 +138,9 @@
|
|
|
mentionForm: {
|
|
|
bookMobile: ''
|
|
|
},
|
|
|
- discountArr: false
|
|
|
+ discountArr: false,
|
|
|
+ // 运费
|
|
|
+ freightPrice: 0
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -145,13 +148,13 @@
|
|
|
...mapGetters({ shopUser: 'getShopUser' }),
|
|
|
// 计算总金额
|
|
|
totalPrice() {
|
|
|
- let totalPrice = this.goodsInfo.price * this.option.goodsNum
|
|
|
+ let totalPrice = this.goodsInfo.price * this.option.goodsNum - freightPrice
|
|
|
console.log('this.shopUser', this.shopUser)
|
|
|
// let discountMember = this.$util.isEmpty(this.shopUser) ? this.shopUser.userAsset.discount * totalPrice : 1 * totalPrice
|
|
|
// discountMember = discountMember / 10
|
|
|
// return discountMember.toFixed(2)
|
|
|
return totalPrice.toFixed(2)
|
|
|
- }
|
|
|
+ },
|
|
|
},
|
|
|
onLoad(option) {
|
|
|
// this.init()
|
|
|
@@ -173,6 +176,11 @@
|
|
|
this.$refs.couponSel._getUserDiscount().then(status => {
|
|
|
this.discountArr = status
|
|
|
})
|
|
|
+
|
|
|
+ if (!this.$util.isEmpty(this.$refs.appDelivery.region) && this.$refs.appDelivery.region.latitude) {
|
|
|
+ // 计算距离价格
|
|
|
+ this.freightPrice = calcDistance(this.orderShop.shop, this.$refs.appDelivery.region, this.orderShop.freight)
|
|
|
+ }
|
|
|
})
|
|
|
getShopUser()
|
|
|
goodsInfo.buyNum = this.option.goodsNum
|
|
|
@@ -222,6 +230,11 @@
|
|
|
anonymityChange(e) {
|
|
|
this.form.anonymity = this.form.anonymity == 1 ? 0 : 1
|
|
|
},
|
|
|
+ // 选择地址
|
|
|
+ changeAddress() {
|
|
|
+ // 计算距离价格
|
|
|
+ this.freightPrice = calcDistance(this.orderShop.shop, this.$refs.appDelivery.region, this.orderShop.freight)
|
|
|
+ },
|
|
|
// 表单验证
|
|
|
formSubmit(e) {
|
|
|
console.log(e)
|