|
|
@@ -157,26 +157,40 @@
|
|
|
|
|
|
<view v-if="form.sendType == 2">
|
|
|
<view v-if="openIntraCity == 1" class="delivery-section">
|
|
|
- <tui-list-cell v-if="openIntraCity == 1" class="line-cell" :hover="false">
|
|
|
- <!-- 跑腿平台报价列表 -->
|
|
|
+ <!-- 客户地址信息 -->
|
|
|
+ <tui-list-cell class="line-cell" :hover="false" :arrow="true" @click.stop="updateCustomAddress()">
|
|
|
+ <view class="tui-title" style="width:120rpx;">客户地址</view>
|
|
|
+ <view class="address-box">
|
|
|
+ <view v-if="$util.isEmpty(customInfo.long) || $util.isEmpty(customInfo.lat) || $util.isEmpty(customInfo.address)" class="addr-main" style="color: red; font-size: 28rpx;">
|
|
|
+ 客户地址不完善,请修改
|
|
|
+ </view>
|
|
|
+ <view v-else>
|
|
|
+ <view class="addr-main">{{ customInfo.address }}</view>
|
|
|
+ <view class="addr-sub">{{ customInfo.showAddress }}</view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </tui-list-cell>
|
|
|
+ <tui-list-cell class="line-cell" :hover="false">
|
|
|
<view v-if="deliveryQuotes.length > 0" class="delivery-quotes-container">
|
|
|
- <view class="delivery-quotes-grid">
|
|
|
- <view
|
|
|
- v-for="(item, index) in deliveryQuotes"
|
|
|
- :key="index"
|
|
|
- class="delivery-quote-item"
|
|
|
- :class="{
|
|
|
- 'active': selectedDeliveryIndex === index,
|
|
|
- 'disabled': !item.isAble,
|
|
|
- 'fixed-width': deliveryQuotes.length <= 2
|
|
|
- }"
|
|
|
- @click="selectDelivery(item, index)"
|
|
|
- >
|
|
|
- <view class="platform-name">{{ item.displayName || item.name }}</view>
|
|
|
- <view class="platform-price">{{ item.priceText }}元</view>
|
|
|
- <view v-if="item.type" class="platform-type">{{ item.type }}</view>
|
|
|
+ <scroll-view scroll-y class="delivery-quotes-scroll">
|
|
|
+ <view class="delivery-quotes-grid">
|
|
|
+ <view
|
|
|
+ v-for="(item, index) in deliveryQuotes"
|
|
|
+ :key="index"
|
|
|
+ class="delivery-quote-item"
|
|
|
+ :class="{
|
|
|
+ 'active': selectedDeliveryIndex === index,
|
|
|
+ 'disabled': !item.isAble,
|
|
|
+ 'fixed-width': deliveryQuotes.length <= 2
|
|
|
+ }"
|
|
|
+ @click="selectDelivery(item, index)"
|
|
|
+ >
|
|
|
+ <view class="platform-name">{{ item.displayName || item.name }}</view>
|
|
|
+ <view class="platform-price">{{ item.priceText }}元</view>
|
|
|
+ <view v-if="item.type" class="platform-type">{{ item.type }}</view>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
- </view>
|
|
|
+ </scroll-view>
|
|
|
</view>
|
|
|
<view v-else class="empty-quotes-view">
|
|
|
<text>正在获取运费...</text>
|
|
|
@@ -193,13 +207,14 @@
|
|
|
</tui-list-cell>
|
|
|
<tui-list-cell class="line-cell" :hover="false" :arrow="false">
|
|
|
<view class="tui-title title-reduction" style="width: 150upx;">满减规则</view>
|
|
|
- <button @tap="form.reductionRule = 0" class="admin-button-com mini-btn btn-reduction" :class="form.reductionRule == 0 ? 'active' : 'default'">没有满减</button>
|
|
|
- <button @tap="form.reductionRule = 1" class="admin-button-com mini-btn btn-reduction" :class="form.reductionRule == 1 ? 'active' : 'default'">用花材</button>
|
|
|
- <button @tap="form.reductionRule = 2" class="admin-button-com mini-btn btn-reduction-last" :class="form.reductionRule == 2 ? 'active' : 'default'">用花束</button>
|
|
|
+ <button @tap="changeReductionRule(0)" class="admin-button-com mini-btn btn-reduction" :class="form.reductionRule == 0 ? 'active' : 'default'">没有满减</button>
|
|
|
+ <button @tap="changeReductionRule(1)" class="admin-button-com mini-btn btn-reduction" :class="form.reductionRule == 1 ? 'active' : 'default'">用花材</button>
|
|
|
+ <button @tap="changeReductionRule(2)" class="admin-button-com mini-btn btn-reduction-last" :class="form.reductionRule == 2 ? 'active' : 'default'">用花束</button>
|
|
|
</tui-list-cell>
|
|
|
<tui-list-cell class="line-cell" :hover="false" :arrow="false">
|
|
|
<view class="tui-title">运费</view>
|
|
|
- <text v-if="form.reductionRule == 0" class="blue-text">¥{{ form.sendCost }}</text>
|
|
|
+
|
|
|
+ <!-- <text v-if="form.reductionRule == 0" class="blue-text">¥{{ form.sendCost }}</text>
|
|
|
<text v-if="form.reductionRule == 1" class="free-delivery-tag">
|
|
|
<text v-if="isHcMapRule()"><text class="strike-through">¥{{ form.sendCost }}</text>【花材免跑腿费】</text>
|
|
|
<text v-else>¥{{ form.sendCost }}</text>
|
|
|
@@ -207,7 +222,21 @@
|
|
|
<text v-if="form.reductionRule == 2" class="free-delivery-tag">
|
|
|
<text v-if="isHsMapRule()"><text class="strike-through">¥{{ form.sendCost }}</text>【花束免跑腿费】</text>
|
|
|
<text v-else>¥{{ form.sendCost }}</text>
|
|
|
- </text>
|
|
|
+ </text> -->
|
|
|
+ <view v-if="form.reductionRule == 1 && isHcMapRule()">
|
|
|
+ <input type="digit" placeholder="请填写运费" v-model="form.customSendCost" placeholder-class="tui-placeholder" style="border:1upx solid #eee;color:#3385FF;width:150upx;height:70upx;" />
|
|
|
+ </view>
|
|
|
+ <view v-else-if="form.reductionRule == 2">
|
|
|
+ <view v-if="isHsMapRule()">
|
|
|
+ <input type="digit" placeholder="请填写运费" v-model="form.customSendCost" placeholder-class="tui-placeholder" style="border:1upx solid #eee;color:#3385FF;width:150upx;height:70upx;" />
|
|
|
+ </view>
|
|
|
+ <view v-else>
|
|
|
+ <input type="digit" placeholder="请填写运费" v-model="form.sendCost" placeholder-class="tui-placeholder" style="border:1upx solid #eee;color:#3385FF;width:150upx;height:70upx;" />
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view v-else>
|
|
|
+ <input type="digit" placeholder="请填写运费" v-model="form.sendCost" placeholder-class="tui-placeholder" style="border:1upx solid #eee;color:#3385FF;width:150upx;height:70upx;" />
|
|
|
+ </view>
|
|
|
</tui-list-cell>
|
|
|
<tui-list-cell class="line-cell" :hover="false" :arrow="false">
|
|
|
<view class="tui-title">呼叫跑腿</view>
|
|
|
@@ -225,7 +254,7 @@
|
|
|
<view v-else class="delivery-section">
|
|
|
<tui-list-cell class="line-cell" :hover="false" :arrow="false">
|
|
|
<view class="tui-title">运费</view>
|
|
|
- <input type="digit" placeholder="请填写运费" v-model="form.sendCost" placeholder-class="tui-placeholder"/>
|
|
|
+ <input type="digit" placeholder="请填写运费" v-model="form.sendCost" />
|
|
|
</tui-list-cell>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -520,7 +549,8 @@ export default {
|
|
|
reachDate: "",
|
|
|
reachPeriod: "12:00",
|
|
|
historyDate:"",
|
|
|
- sendCost: "",
|
|
|
+ sendCost: "", //系统默认运费
|
|
|
+ customSendCost: 0, //自设置的运费
|
|
|
customId: "",
|
|
|
packCost:"",
|
|
|
product: "",
|
|
|
@@ -540,6 +570,7 @@ export default {
|
|
|
},
|
|
|
showCustomer: false,
|
|
|
customInfo:{discount:1,balance:0},
|
|
|
+ isUpdateAddress: false,
|
|
|
customData: { bigCount: 0, smallCount: 0, userPrice: 0 },
|
|
|
isAddModel:false,
|
|
|
checkStock:true,
|
|
|
@@ -554,7 +585,7 @@ export default {
|
|
|
hcFreeKm: 0, //跑腿免费公里数
|
|
|
hcMap: [], //花材满减规则
|
|
|
hsFreeKm: 0, //花束免费公里数
|
|
|
- hsMap: [], //花束满减规则
|
|
|
+ hsAddFee: 0, //花束满减规则
|
|
|
deliveryQuotes: [], // 跑腿平台报价列表
|
|
|
selectedDeliveryIndex: -1,
|
|
|
selectedDeliveryData: null,
|
|
|
@@ -587,20 +618,21 @@ export default {
|
|
|
}
|
|
|
that.hsFreeKm = data.hsFreeKm
|
|
|
try {
|
|
|
- that.hsMap = typeof data.hsMap === 'string' ? JSON.parse(data.hsMap) : data.hsMap
|
|
|
+ that.hsAddFee = data.hsAddFee
|
|
|
} catch (e) {
|
|
|
- that.hsMap = []
|
|
|
+ that.hsAddFee = 0
|
|
|
}
|
|
|
})
|
|
|
|
|
|
if(Number(option.customId) > 0){
|
|
|
this.form.customId = option.customId
|
|
|
- let that = this
|
|
|
- getCustomInfo({ id: option.customId }).then(res => {
|
|
|
- that.form.customName = res.data.custom.name
|
|
|
- that.customInfo = res.data.custom
|
|
|
- that.$forceUpdate()
|
|
|
- })
|
|
|
+ // let that = this
|
|
|
+ // getCustomInfo({ id: option.customId }).then(res => {
|
|
|
+ // that.form.customName = res.data.custom.name
|
|
|
+ // that.customInfo = res.data.custom
|
|
|
+ // that.$forceUpdate()
|
|
|
+ // })
|
|
|
+ this.getCustomDetail();
|
|
|
|
|
|
//用于混入product的已选中花材!!!!!
|
|
|
this.selectJobId = option.customId
|
|
|
@@ -623,7 +655,6 @@ export default {
|
|
|
if(this.reduceStock == 1){
|
|
|
this.form.hasPay = 2
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
onShow(){
|
|
|
if(!this.$util.isEmpty(uni.getStorageSync("newClient"))){
|
|
|
@@ -638,8 +669,14 @@ export default {
|
|
|
})
|
|
|
|
|
|
//获取跑腿平台报价
|
|
|
- if(this.form.sendType == 2){
|
|
|
- this.getDeliveryQuotes()
|
|
|
+ if(this.openIntraCity == 1 && this.form.sendType == 2){
|
|
|
+ if(this.isUpdateAddress){
|
|
|
+ this.getCustomDetail().then(() => {
|
|
|
+ this.getDeliveryQuotes()
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ this.getDeliveryQuotes()
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
onUnload(){
|
|
|
@@ -647,7 +684,7 @@ export default {
|
|
|
uni.$off('listenGetScanCode')
|
|
|
},
|
|
|
computed: {
|
|
|
- ...mapGetters(["getMerchantInfo","getMyShopInfo", "getLoginInfo"]),
|
|
|
+ ...mapGetters(["getMerchantInfo", "getMyShopInfo", "getLoginInfo"]),
|
|
|
systemPrice(){
|
|
|
let totalPrice = this.allPrice.toFixed(2)
|
|
|
let finalPrice = Number(totalPrice)
|
|
|
@@ -658,28 +695,35 @@ export default {
|
|
|
finalPrice = Number(finalPrice) + sendCost
|
|
|
}else if(this.form.reductionRule == 1){
|
|
|
if(this.isHcMapRule()){
|
|
|
- finalPrice = Number(finalPrice)
|
|
|
+ finalPrice = Number(finalPrice) + Number(this.form.customSendCost)
|
|
|
}else{
|
|
|
finalPrice = Number(finalPrice) + sendCost
|
|
|
}
|
|
|
}else if(this.form.reductionRule == 2){
|
|
|
if(this.isHsMapRule()){
|
|
|
- finalPrice = Number(finalPrice)
|
|
|
+ finalPrice = Number(finalPrice) + Number(this.form.customSendCost)
|
|
|
}else{
|
|
|
+ const distanceInMeters = Number(this.showDistance) || 0
|
|
|
+ const freeKmInMeters = (Number(this.hsFreeKm) || 0) * 1000
|
|
|
+ const diff = distanceInMeters - freeKmInMeters
|
|
|
+ //花束满减规则 -- 每超出1公里,加收 hsAddFee 元(不足1公里按1公里计算)
|
|
|
+ const addFeePrice = Math.ceil(diff / 1000) * this.hsAddFee
|
|
|
+ console.log('addFeePrice', addFeePrice)
|
|
|
+
|
|
|
finalPrice = Number(finalPrice) + sendCost
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return parseFloat(Number(finalPrice).toFixed(2))
|
|
|
},
|
|
|
- labourCost(){
|
|
|
- let cost = 0
|
|
|
- if(Number(this.modifyPrice)>Number(this.systemPrice)){
|
|
|
- cost = Number(this.modifyPrice) - Number(this.systemPrice)
|
|
|
- cost = Number(cost).toFixed(2)
|
|
|
- }
|
|
|
- return cost
|
|
|
- }
|
|
|
+ // labourCost(){
|
|
|
+ // let cost = 0
|
|
|
+ // if(Number(this.modifyPrice) > Number(this.systemPrice)){
|
|
|
+ // cost = Number(this.modifyPrice) - Number(this.systemPrice)
|
|
|
+ // cost = Number(cost).toFixed(2)
|
|
|
+ // }
|
|
|
+ // return cost
|
|
|
+ // }
|
|
|
},
|
|
|
watch: {
|
|
|
systemPrice: {
|
|
|
@@ -696,22 +740,36 @@ export default {
|
|
|
const distanceInMeters = Number(this.showDistance) || 0
|
|
|
const freeKm = type === 'hc' ? this.hcFreeKm : this.hsFreeKm
|
|
|
const freeKmInMeters = (Number(freeKm) || 0) * 1000
|
|
|
- if(distanceInMeters < freeKmInMeters){
|
|
|
+ if(distanceInMeters <= freeKmInMeters){
|
|
|
+ console.log('满足免费公里数条件', type,distanceInMeters,freeKmInMeters)
|
|
|
return true
|
|
|
}
|
|
|
- let map = type === 'hc' ? this.hcMap : this.hsMap
|
|
|
+
|
|
|
+ let map = type === 'hc' ? this.hcMap : ''
|
|
|
if(map && Array.isArray(map) && map.length > 0){
|
|
|
- const flowerCount = this.allCountFun.bigLength || 0
|
|
|
- const flowerPrice = this.allPriceFun || 0
|
|
|
- for(const rule of map){
|
|
|
- const ruleNum = Number(rule.num) || 0
|
|
|
- const rulePrice = Number(rule.price) || 0
|
|
|
- const ruleDistance = (Number(rule.distance) || 0) * 1000
|
|
|
- if(flowerCount >= ruleNum && flowerPrice >= rulePrice && distanceInMeters <= ruleDistance){
|
|
|
- return true
|
|
|
- }
|
|
|
+ const flowerCount = this.allCount.bigLength || 0
|
|
|
+ const flowerPrice = this.allPrice || 0
|
|
|
+ for(const rule of map){
|
|
|
+ const ruleNum = Number(rule.num) || 0
|
|
|
+ const rulePrice = Number(rule.price) || 0
|
|
|
+ const ruleDistance = (Number(rule.distance) || 0) * 1000
|
|
|
+ if(flowerCount >= ruleNum && flowerPrice >= rulePrice && distanceInMeters <= ruleDistance){
|
|
|
+ console.log('满足满减条件',flowerCount,ruleNum,flowerPrice, rulePrice,distanceInMeters,ruleDistance)
|
|
|
+ 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(){
|
|
|
@@ -720,6 +778,28 @@ export default {
|
|
|
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
|
|
|
+ }
|
|
|
+ },
|
|
|
setSendType (type) {
|
|
|
this.form.sendType = type
|
|
|
if (type !== 2) {
|
|
|
@@ -918,7 +998,7 @@ export default {
|
|
|
}
|
|
|
formData.shopId = this.getMerchantInfo.id;
|
|
|
|
|
|
- let params = {...formData,modifyPrice: this.modifyPrice,labourCost:this.labourCost};
|
|
|
+ let params = {...formData,modifyPrice: this.modifyPrice}; //labourCost:this.labourCost
|
|
|
|
|
|
// 如果选择了跑腿配送并且有选中的平台数据,则添加配送平台信息
|
|
|
if (this.form.sendType == 2 && this.selectedDeliveryData) {
|
|
|
@@ -989,6 +1069,11 @@ export default {
|
|
|
|
|
|
},
|
|
|
getDeliveryQuotes(){
|
|
|
+ //如果客户地址缺少经纬度或地址,任何一个,则不要请求后端询价接口
|
|
|
+ if (this.$util.isEmpty(this.customInfo.long) || this.$util.isEmpty(this.customInfo.lat) || this.$util.isEmpty(this.customInfo.address)) {
|
|
|
+ this.$msg('客户地址缺少经纬度或地址,任何一个,无法获取运费', 'none', 2200);
|
|
|
+ return;
|
|
|
+ }
|
|
|
this.deliveryQuotes = []
|
|
|
this.selectedDeliveryIndex = -1
|
|
|
this.selectedDeliveryData = null
|
|
|
@@ -1062,6 +1147,18 @@ export default {
|
|
|
this.getDeliveryQuotes();
|
|
|
}
|
|
|
},
|
|
|
+ getCustomDetail(){
|
|
|
+ let that = this
|
|
|
+ return getCustomInfo({ id: that.option.customId }).then(res => {
|
|
|
+ that.form.customName = res.data.custom.name
|
|
|
+ that.customInfo = res.data.custom
|
|
|
+ that.$forceUpdate()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ updateCustomAddress(){
|
|
|
+ this.isUpdateAddress = true;
|
|
|
+ this.$util.pageTo({ url: '/admin/member/modify?id='+this.customInfo.id+'&name='+this.customInfo.name })
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
@@ -1561,7 +1658,11 @@ export default {
|
|
|
/* 跑腿平台报价样式 */
|
|
|
.delivery-quotes-container {
|
|
|
width: 100%;
|
|
|
- margin-top: 20upx;
|
|
|
+ margin-top: 10upx;
|
|
|
+}
|
|
|
+
|
|
|
+.delivery-quotes-scroll {
|
|
|
+ max-height: 450upx;
|
|
|
}
|
|
|
|
|
|
.delivery-quotes-grid {
|
|
|
@@ -1735,7 +1836,8 @@ export default {
|
|
|
}
|
|
|
|
|
|
.delivery-section {
|
|
|
- border: 1upx solid #eee;
|
|
|
+ border: 1upx solid #2ECE7E;
|
|
|
+ box-shadow: 0 0 12upx #09C567;
|
|
|
margin: 8upx 20upx;
|
|
|
border-radius: 8upx;
|
|
|
}
|
|
|
@@ -1785,5 +1887,21 @@ export default {
|
|
|
color: #049E2C;
|
|
|
margin-left: 5upx;
|
|
|
}
|
|
|
-
|
|
|
+.address-box {
|
|
|
+ flex: 1;
|
|
|
+ text-align: center;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ .addr-main {
|
|
|
+ font-size: 32upx;
|
|
|
+ color: #333;
|
|
|
+ }
|
|
|
+ .addr-sub {
|
|
|
+ font-size: 28upx;
|
|
|
+ color: #999;
|
|
|
+ margin-top: 6upx;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|