|
|
@@ -83,7 +83,7 @@
|
|
|
<text>运费:</text>
|
|
|
</view>
|
|
|
<view class="item-list_box">
|
|
|
- <view v-if="form.reductionRule == 1 && isHcMapRule()">
|
|
|
+ <view v-if="form.reductionRule != 0 && (isHcMapRule() || isHsMapRule())">
|
|
|
<input type="digit" placeholder="请填写运费" v-model="form.customSendCost" placeholder-class="tui-placeholder" />
|
|
|
</view>
|
|
|
<view v-else>
|
|
|
@@ -103,8 +103,9 @@
|
|
|
<view class="select-item_box">
|
|
|
<view class="title">满减规则</view>
|
|
|
<view class="item-list_box">
|
|
|
- <view @tap="form.reductionRule = 0" :class="[form.reductionRule == 0 ? 'active' : '']">没有满减</view>
|
|
|
- <view @tap="form.reductionRule = 1" :class="[form.reductionRule == 1 ? 'active' : '']">花材满减</view>
|
|
|
+ <view @tap="changeReductionRule(0)" :class="[form.reductionRule == 0 ? 'active' : '']">没有满减</view>
|
|
|
+ <view @tap="changeReductionRule(1)" :class="[form.reductionRule == 1 ? 'active' : '']">用花材</view>
|
|
|
+ <view @tap="changeReductionRule(2)" :class="[form.reductionRule == 2 ? 'active' : '']">用花束</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
@@ -275,7 +276,7 @@ export default {
|
|
|
reachDate: "",
|
|
|
reachPeriod: "12:00",
|
|
|
merchantInfo: {}, // 商户信息
|
|
|
- reductionRule: 0, // 0 没有满减 1 用花材
|
|
|
+ reductionRule: 0, // 0 没有满减 1 用花材 2 用花束
|
|
|
callErrand: 0, //现在呼叫 0 晚点呼叫 1
|
|
|
weight: 1,
|
|
|
deliveryRemark: ''
|
|
|
@@ -342,18 +343,52 @@ export default {
|
|
|
...mapGetters(["getLoginInfo"]),
|
|
|
totalPrice(){
|
|
|
let price = 0
|
|
|
+ const sendCost = Number(this.form.sendCost)
|
|
|
+
|
|
|
if(!this.$util.isEmpty(this.groupInfo)){
|
|
|
price = this.groupInfo.price ? parseFloat(this.groupInfo.price) : 0
|
|
|
}else{
|
|
|
- price = Number(this.allPrice)+Number(this.form.sendCost)+Number(this.form.labourCost)
|
|
|
- price = parseFloat(price.toFixed(2))
|
|
|
+ //区分跑腿和非跑腿
|
|
|
+ if(this.form.sendType == 2){
|
|
|
+ if(this.form.reductionRule != 0){
|
|
|
+ if(this.form.reductionRule == 1){
|
|
|
+ if(this.isHcMapRule()){
|
|
|
+ price = this.allPrice+Number(this.form.customSendCost)
|
|
|
+ }else{
|
|
|
+ price = this.allPrice+sendCost
|
|
|
+ }
|
|
|
+ }else if(this.form.reductionRule == 2){
|
|
|
+ if(this.isHsMapRule()){
|
|
|
+ price = this.allPrice+Number(this.form.customSendCost)
|
|
|
+ }else{
|
|
|
+ const distanceInMeters = Number(this.showDistance) || 0
|
|
|
+ const freeKmInMeters = (Number(this.hsFreeKm) || 0) * 1000
|
|
|
+ const diff = distanceInMeters - freeKmInMeters
|
|
|
+ if(diff > 0){
|
|
|
+ //花束满减规则 -- 每超出1公里,加收 hsAddFee 元(不足1公里按1公里计算)
|
|
|
+ const addFeePrice = Math.ceil(diff / 1000) * this.hsAddFee
|
|
|
+ this.form.sendCost = addFeePrice
|
|
|
+ price = this.allPrice+addFeePrice
|
|
|
+ }else{
|
|
|
+ price = this.allPrice+sendCost
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ price = this.allPrice+sendCost
|
|
|
+ }
|
|
|
+ price = parseFloat(price.toFixed(2))
|
|
|
+ }else{
|
|
|
+ price = Number(this.allPrice)+Number(this.form.labourCost)
|
|
|
+ price = parseFloat(price.toFixed(2))
|
|
|
+ }
|
|
|
}
|
|
|
this.form.modifyPrice = price
|
|
|
|
|
|
return price
|
|
|
},
|
|
|
diffPrice(){
|
|
|
- let price = Number(this.totalPrice) - Number(this.form.modifyPrice)
|
|
|
+ let price = this.totalPrice - Number(this.form.modifyPrice)
|
|
|
price = parseFloat(price.toFixed(2))
|
|
|
return price
|
|
|
},
|
|
|
@@ -533,17 +568,22 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
clearDeliveryList() {
|
|
|
+ this.form.sendCost = 0
|
|
|
+ this.form.customSendCost = 0
|
|
|
+ this.form.reductionRule = 0
|
|
|
+
|
|
|
this.deliveryQuotes = [];
|
|
|
this.selectedDeliveryIndex = -1;
|
|
|
this.selectedDeliveryData = null;
|
|
|
},
|
|
|
checkMapRule(type) {
|
|
|
const distanceInMeters = Number(this.showDistance) || 0;
|
|
|
- const freeKm = type === 'hc' ? this.hcFreeKm : 0; // 只处理花材
|
|
|
+ const freeKm = type === 'hc' ? this.hcFreeKm : this.hsFreeKm;
|
|
|
const freeKmInMeters = (Number(freeKm) || 0) * 1000;
|
|
|
if (distanceInMeters < freeKmInMeters) {
|
|
|
return true;
|
|
|
}
|
|
|
+
|
|
|
let map = type === 'hc' ? this.hcMap : [];
|
|
|
if (map && Array.isArray(map) && map.length > 0) {
|
|
|
let big = 0;
|
|
|
@@ -564,12 +604,49 @@ export default {
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
+ }else{
|
|
|
+ const addFee = distanceInMeters - freeKmInMeters
|
|
|
+ if(addFee > 0){
|
|
|
+ //花束满减规则 -- 每超出1公里,加收 hsAddFee 元(不足1公里按1公里计算)
|
|
|
+ const addFeePrice = Math.ceil(addFee / 1000) * this.hsAddFee
|
|
|
+ console.log('addFeePrice---', addFeePrice)
|
|
|
+ //this.form.sendCost = addFeePrice
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ return true
|
|
|
}
|
|
|
return false;
|
|
|
},
|
|
|
isHcMapRule() {
|
|
|
return this.checkMapRule('hc');
|
|
|
},
|
|
|
+ isHsMapRule() {
|
|
|
+ return this.checkMapRule('hs');
|
|
|
+ },
|
|
|
+ changeReductionRule(rule) {
|
|
|
+ this.form.reductionRule = rule
|
|
|
+ if(rule == 0){
|
|
|
+ // 选中报价卡片
|
|
|
+ this.form.sendCost = this.selectedDeliveryData.priceNumber
|
|
|
+ }else if(rule == 1){
|
|
|
+ if(this.isHcMapRule()){
|
|
|
+ this.form.sendCost = this.selectedDeliveryData.priceNumber
|
|
|
+ }else{
|
|
|
+ this.form.sendCost = 0
|
|
|
+ }
|
|
|
+ }else if(rule == 2){
|
|
|
+ const distanceInMeters = Number(this.showDistance) || 0
|
|
|
+ const freeKmInMeters = (Number(this.hsFreeKm) || 0) * 1000
|
|
|
+ const diff = distanceInMeters - freeKmInMeters
|
|
|
+ let addFeePrice = 0
|
|
|
+ if(diff > 0){
|
|
|
+ addFeePrice = Math.ceil(diff / 1000) * this.hsAddFee
|
|
|
+ }
|
|
|
+ this.form.sendCost = addFeePrice
|
|
|
+ }else{
|
|
|
+ this.form.sendCost = 0
|
|
|
+ }
|
|
|
+ },
|
|
|
getDeliveryQuotes() {
|
|
|
console.log('getDeliveryQuotes', Number(this.customId));
|
|
|
if(Number(this.customId) === 0){
|