|
@@ -198,7 +198,7 @@ export default {
|
|
|
packCost:0,
|
|
packCost:0,
|
|
|
sendCost:0,
|
|
sendCost:0,
|
|
|
showAddress:'',
|
|
showAddress:'',
|
|
|
- openIntraCity:0 // 是否支持跑腿送: 0不支持 1支持
|
|
|
|
|
|
|
+ openIntraCity:0 // 是否支持跑腿送: 0不支持 1支持 2暂不可用
|
|
|
},
|
|
},
|
|
|
userInfo:{},
|
|
userInfo:{},
|
|
|
shopInfo:{},
|
|
shopInfo:{},
|
|
@@ -211,7 +211,8 @@ export default {
|
|
|
deliveryQuotes: [], // 跑腿平台报价列表
|
|
deliveryQuotes: [], // 跑腿平台报价列表
|
|
|
selectedDeliveryIndex: -1, // 选中的报价索引
|
|
selectedDeliveryIndex: -1, // 选中的报价索引
|
|
|
deliveryQuotesLoading: false, // 报价加载状态
|
|
deliveryQuotesLoading: false, // 报价加载状态
|
|
|
- selectedDeliveryData: null // 选中的报价数据
|
|
|
|
|
|
|
+ selectedDeliveryData: null, // 选中的报价数据
|
|
|
|
|
+ isFreeDelivery: false // 是否免跑腿费
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
onShow() {
|
|
onShow() {
|
|
@@ -236,6 +237,7 @@ export default {
|
|
|
computed: {
|
|
computed: {
|
|
|
modifyPrice(){
|
|
modifyPrice(){
|
|
|
let price = Number(this.allPrice) || 0
|
|
let price = Number(this.allPrice) || 0
|
|
|
|
|
+
|
|
|
if(this.form.sendType == 2){
|
|
if(this.form.sendType == 2){
|
|
|
price = price + Number(this.isFreeDelivery ? 0 : this.form.sendCost || 0) + Number(this.form.packCost || 0)
|
|
price = price + Number(this.isFreeDelivery ? 0 : this.form.sendCost || 0) + Number(this.form.packCost || 0)
|
|
|
} else if (this.form.sendType == 0){
|
|
} else if (this.form.sendType == 0){
|
|
@@ -258,9 +260,39 @@ export default {
|
|
|
}
|
|
}
|
|
|
return false
|
|
return false
|
|
|
},
|
|
},
|
|
|
- isFreeDelivery(){
|
|
|
|
|
|
|
+ totalPrice() {
|
|
|
|
|
+ let allPrice = this.allPrice.toFixed(2)
|
|
|
|
|
+ allPrice = Number(allPrice)
|
|
|
|
|
+ let price = allPrice
|
|
|
|
|
+
|
|
|
|
|
+ // 判断是否需要加跑腿费
|
|
|
|
|
+ if(this.displaySendCost == true){
|
|
|
|
|
+ // 如果不是免跑腿费,则加上跑腿费
|
|
|
|
|
+ if(!this.isFreeDelivery){
|
|
|
|
|
+ price = price + this.form.sendCost
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ this.needAddPackCost = false
|
|
|
|
|
+ if (this.form.sendType == 4) {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ return price.toFixed(2)
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ onLoad(){
|
|
|
|
|
+ if(this.option.account){
|
|
|
|
|
+ uni.setStorageSync('account',this.option.account)
|
|
|
|
|
+ }
|
|
|
|
|
+ if(this.option.hdId){
|
|
|
|
|
+ uni.setStorageSync('hdId',this.option.hdId)
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ checkFreeDelivery(){
|
|
|
// 不显示跑腿费时,不需要判断
|
|
// 不显示跑腿费时,不需要判断
|
|
|
if(this.displaySendCost == false){
|
|
if(this.displaySendCost == false){
|
|
|
|
|
+ this.isFreeDelivery = false
|
|
|
return false
|
|
return false
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -268,19 +300,25 @@ export default {
|
|
|
// showDistance单位是米,hcFreeKm单位是千米
|
|
// showDistance单位是米,hcFreeKm单位是千米
|
|
|
const distanceInMeters = Number(this.showDistance) || 0
|
|
const distanceInMeters = Number(this.showDistance) || 0
|
|
|
const freeKmInMeters = (Number(this.shopInfo.hcFreeKm) || 0) * 1000
|
|
const freeKmInMeters = (Number(this.shopInfo.hcFreeKm) || 0) * 1000
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 如果距离小于免费公里数,则免运费
|
|
// 如果距离小于免费公里数,则免运费
|
|
|
if(distanceInMeters <= freeKmInMeters){
|
|
if(distanceInMeters <= freeKmInMeters){
|
|
|
|
|
+ this.isFreeDelivery = true
|
|
|
return true
|
|
return true
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 条件2: 如果距离大于免费公里数,判断hcMap
|
|
// 条件2: 如果距离大于免费公里数,判断hcMap
|
|
|
if(distanceInMeters > freeKmInMeters){
|
|
if(distanceInMeters > freeKmInMeters){
|
|
|
|
|
+ // 对 this.shopInfo.hcMap 进行类型判断,如果是字符串,则转换为数组
|
|
|
|
|
+ if(typeof this.shopInfo.hcMap === 'string'){
|
|
|
|
|
+ this.shopInfo.hcMap = JSON.parse(this.shopInfo.hcMap)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 判断hcMap是否为空
|
|
// 判断hcMap是否为空
|
|
|
if(this.shopInfo.hcMap && Array.isArray(this.shopInfo.hcMap) && this.shopInfo.hcMap.length > 0){
|
|
if(this.shopInfo.hcMap && Array.isArray(this.shopInfo.hcMap) && this.shopInfo.hcMap.length > 0){
|
|
|
// 获取花材数量和总价
|
|
// 获取花材数量和总价
|
|
|
- const flowerCount = this.allCount.bigLength || 0
|
|
|
|
|
- const flowerPrice = this.allPriceFun || 0
|
|
|
|
|
|
|
+ const flowerCount = this.allCount.bigLength
|
|
|
|
|
+ const flowerPrice = this.allPriceFun
|
|
|
|
|
|
|
|
// 遍历hcMap,检查是否满足免运费条件
|
|
// 遍历hcMap,检查是否满足免运费条件
|
|
|
for(const rule of this.shopInfo.hcMap){
|
|
for(const rule of this.shopInfo.hcMap){
|
|
@@ -290,43 +328,18 @@ export default {
|
|
|
|
|
|
|
|
// 如果花材数量大于num,花材总价大于price,距离小于distance,则免运费
|
|
// 如果花材数量大于num,花材总价大于price,距离小于distance,则免运费
|
|
|
if(flowerCount >= ruleNum && flowerPrice >= rulePrice && distanceInMeters <= ruleDistance){
|
|
if(flowerCount >= ruleNum && flowerPrice >= rulePrice && distanceInMeters <= ruleDistance){
|
|
|
|
|
+ this.isFreeDelivery = true
|
|
|
return true
|
|
return true
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ }else{
|
|
|
|
|
+ console.log('hcMap数据格式出问题了')
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ this.isFreeDelivery = false
|
|
|
return false
|
|
return false
|
|
|
},
|
|
},
|
|
|
- totalPrice() {
|
|
|
|
|
- let allPrice = this.allPrice.toFixed(2)
|
|
|
|
|
- allPrice = Number(allPrice)
|
|
|
|
|
- let price = allPrice
|
|
|
|
|
-
|
|
|
|
|
- // 判断是否需要加跑腿费
|
|
|
|
|
- if(this.displaySendCost == true){
|
|
|
|
|
- // 如果不是免跑腿费,则加上跑腿费
|
|
|
|
|
- if(!this.isFreeDelivery){
|
|
|
|
|
- price = price + this.form.sendCost
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- this.needAddPackCost = false
|
|
|
|
|
- if (this.form.sendType == 4) {
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- return price.toFixed(2)
|
|
|
|
|
- },
|
|
|
|
|
- },
|
|
|
|
|
- onLoad(){
|
|
|
|
|
- if(this.option.account){
|
|
|
|
|
- uni.setStorageSync('account',this.option.account)
|
|
|
|
|
- }
|
|
|
|
|
- if(this.option.hdId){
|
|
|
|
|
- uni.setStorageSync('hdId',this.option.hdId)
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- methods: {
|
|
|
|
|
selTimeFn(e) {
|
|
selTimeFn(e) {
|
|
|
this.form.reachDate = e.detail.value;
|
|
this.form.reachDate = e.detail.value;
|
|
|
},
|
|
},
|
|
@@ -365,13 +378,15 @@ export default {
|
|
|
that.form.lat = userInfo.lat
|
|
that.form.lat = userInfo.lat
|
|
|
that.form.showAddress = userInfo.showAddress
|
|
that.form.showAddress = userInfo.showAddress
|
|
|
|
|
|
|
|
- console.log('shopInfo: ',shopInfo)
|
|
|
|
|
const openIntraCity = shopInfo.openIntraCity
|
|
const openIntraCity = shopInfo.openIntraCity
|
|
|
const hcFreeKm = shopInfo.hcFreeKm
|
|
const hcFreeKm = shopInfo.hcFreeKm
|
|
|
const hcMap = shopInfo.hcMap
|
|
const hcMap = shopInfo.hcMap
|
|
|
that.form.openIntraCity = openIntraCity
|
|
that.form.openIntraCity = openIntraCity
|
|
|
|
|
+
|
|
|
if(Number(openIntraCity) == 1 && that.form.sendType == 2){
|
|
if(Number(openIntraCity) == 1 && that.form.sendType == 2){
|
|
|
that.getDeliveryQuotes()
|
|
that.getDeliveryQuotes()
|
|
|
|
|
+ const isFreeDelivery = that.checkFreeDelivery()
|
|
|
|
|
+ console.log('getUserInfo -- isFreeDelivery: ',isFreeDelivery)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}).catch(()=>{})
|
|
}).catch(()=>{})
|
|
@@ -383,12 +398,15 @@ export default {
|
|
|
},
|
|
},
|
|
|
changeSendType(num){
|
|
changeSendType(num){
|
|
|
this.form.sendType = num
|
|
this.form.sendType = num
|
|
|
|
|
+
|
|
|
if(num == 2){
|
|
if(num == 2){
|
|
|
//计算运费
|
|
//计算运费
|
|
|
//this.calcSendCost()
|
|
//this.calcSendCost()
|
|
|
|
|
|
|
|
if(Number(this.form.openIntraCity) == 1){
|
|
if(Number(this.form.openIntraCity) == 1){
|
|
|
this.getDeliveryQuotes()
|
|
this.getDeliveryQuotes()
|
|
|
|
|
+ const isFreeDelivery = this.checkFreeDelivery()
|
|
|
|
|
+ console.log('changeSendType -- isFreeDelivery: ',isFreeDelivery)
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
// 切换到其他配送方式时清空报价数据
|
|
// 切换到其他配送方式时清空报价数据
|
|
@@ -434,7 +452,6 @@ export default {
|
|
|
}
|
|
}
|
|
|
newFreight(newFreightParams).then(res => {
|
|
newFreight(newFreightParams).then(res => {
|
|
|
if(res.code == 1){
|
|
if(res.code == 1){
|
|
|
- console.log('res: ',res)
|
|
|
|
|
that.form.sendCost = res.data.est_fee?parseFloat(Number(res.data.est_fee/100)):0
|
|
that.form.sendCost = res.data.est_fee?parseFloat(Number(res.data.est_fee/100)):0
|
|
|
}
|
|
}
|
|
|
}).catch(()=>{});
|
|
}).catch(()=>{});
|
|
@@ -520,6 +537,8 @@ export default {
|
|
|
this.selectedDeliveryData = item
|
|
this.selectedDeliveryData = item
|
|
|
this.form.sendCost = item.priceNumber
|
|
this.form.sendCost = item.priceNumber
|
|
|
this.showDistance = item.distance || 0
|
|
this.showDistance = item.distance || 0
|
|
|
|
|
+ const isFreeDelivery = this.checkFreeDelivery()
|
|
|
|
|
+ console.log('selectDelivery -- isFreeDelivery: ',isFreeDelivery)
|
|
|
},
|
|
},
|
|
|
confirmForm() {
|
|
confirmForm() {
|
|
|
const product = this.selectList.map(ele => {
|
|
const product = this.selectList.map(ele => {
|