|
@@ -6,19 +6,13 @@
|
|
|
<view class="freight-left">运费:</view>
|
|
|
<view class="freight-right" @click.stop="handlePupShow">
|
|
|
<template v-if="handlePostageFlag === 0">
|
|
|
- <view class="freight-text" v-if="handleSupplier.isColdChina"
|
|
|
- >¥{{ handleSupplier.coldChain | NumFormat }}</view
|
|
|
- >
|
|
|
- <view class="freight-text" v-else>包邮</view>
|
|
|
+ <view class="freight-text">包邮</view>
|
|
|
</template>
|
|
|
<view class="freight-text" v-if="handlePostageFlag === 1"
|
|
|
>¥{{ handleTotalPostage | NumFormat }}</view
|
|
|
>
|
|
|
<template v-if="handlePostageFlag === 2">
|
|
|
- <view class="freight-text" v-if="handleSupplier.isColdChina"
|
|
|
- >¥{{ handleSupplier.coldChain | NumFormat }}</view
|
|
|
- >
|
|
|
- <view class="freight-text" v-else>到付</view>
|
|
|
+ <view class="freight-text">到付</view>
|
|
|
</template>
|
|
|
<view class="select"><text class="iconfont icon-xiayibu"></text></view>
|
|
|
</view>
|
|
@@ -40,7 +34,7 @@
|
|
|
</label>
|
|
|
</label>
|
|
|
</radio-group>
|
|
|
- <template v-if="handlePostageFlag === 0">
|
|
|
+ <!-- <template v-if="handlePostageFlag === 0">
|
|
|
<view class="freight-form">
|
|
|
<view class="freight-form-item" v-if="handleSupplier.coldChain > 0">
|
|
|
<view class="label">冷链运输费</view>
|
|
@@ -65,7 +59,7 @@
|
|
|
<view class="texts red" v-else>包邮</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- </template>
|
|
|
+ </template> -->
|
|
|
<template v-if="handlePostageFlag === 1">
|
|
|
<view class="freight-form">
|
|
|
<view class="freight-form-item">
|
|
@@ -78,7 +72,7 @@
|
|
|
maxlength="20"
|
|
|
/>
|
|
|
</view>
|
|
|
- <view class="freight-form-item" v-if="handleSupplier.coldChain > 0">
|
|
|
+ <!-- <view class="freight-form-item" v-if="handleSupplier.coldChain > 0">
|
|
|
<view class="label">冷链运输费</view>
|
|
|
<view class="texts">
|
|
|
<text>¥{{ handleSupplier.coldChain | NumFormat }}</text>
|
|
@@ -97,10 +91,10 @@
|
|
|
<view class="freight-form-item">
|
|
|
<view class="label">总运费 </view>
|
|
|
<view class="texts red">¥{{ handleTotalPostage | NumFormat }} </view>
|
|
|
- </view>
|
|
|
+ </view> -->
|
|
|
</view>
|
|
|
</template>
|
|
|
- <template v-if="handlePostageFlag === 2">
|
|
|
+ <!-- <template v-if="handlePostageFlag === 2">
|
|
|
<view class="freight-form">
|
|
|
<view class="freight-form-item" v-if="handleSupplier.coldChain > 0">
|
|
|
<view class="label">冷链运输费</view>
|
|
@@ -125,7 +119,7 @@
|
|
|
<view class="texts red" v-else>到付</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- </template>
|
|
|
+ </template> -->
|
|
|
<view class="freight-btn" @click="handleComfirm"> 确定 </view>
|
|
|
</view>
|
|
|
</tui-bottom-popup>
|
|
@@ -148,7 +142,7 @@ export default {
|
|
|
return {
|
|
|
popupShow: false,
|
|
|
isColdChina: false,
|
|
|
- handleColdChain:0,// 记录冷链费
|
|
|
+ handleColdChain: 0, // 记录冷链费
|
|
|
handlePostage: 0, // 记录原始运费
|
|
|
handlePostageVal: 0, // 记录修改的运费
|
|
|
handlePostageFlag: 0, // 记录运费类型
|
|
@@ -185,16 +179,12 @@ export default {
|
|
|
computed: {
|
|
|
// 计算总运费
|
|
|
handleTotalPostage() {
|
|
|
- if (this.handleSupplier.isColdChina) {
|
|
|
- return (this.handleSupplier.postage * 100 + this.handleSupplier.coldChain * 100) / 100
|
|
|
- } else {
|
|
|
- return this.handleSupplier.postage
|
|
|
- }
|
|
|
+ return this.handleSupplier.postage
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
supplier: {
|
|
|
- handler: function(el) {
|
|
|
+ handler(el) {
|
|
|
//监听对象的变换使用 function,箭头函数容易出现this指向不正确
|
|
|
this.supplier = el
|
|
|
},
|
|
@@ -208,14 +198,15 @@ export default {
|
|
|
this.isColdChina = data.isColdChina
|
|
|
this.handleColdChain = data.coldChain
|
|
|
this.handleTotalPrice = data.totalPrice
|
|
|
- this.handlePostage = this.handlePostageVal = data.postage
|
|
|
+ this.handlePostage = data.postage
|
|
|
+ this.handlePostageVal = data.postage + data.coldChain
|
|
|
this.handlePostageFlag = data.handlePostageFlag
|
|
|
- console.log('handlePostageFlag', this.handlePostageFlag)
|
|
|
switch (this.handlePostageFlag) {
|
|
|
case 0:
|
|
|
this.radioItems[0].checked = true
|
|
|
break
|
|
|
case 1:
|
|
|
+ this.handleSupplier.postage = this.handleSupplier.postage + this.handleSupplier.coldChain
|
|
|
this.radioItems[1].checked = true
|
|
|
break
|
|
|
case 2:
|
|
@@ -249,29 +240,30 @@ export default {
|
|
|
radioChange($event) {
|
|
|
this.handlePostageFlag = this.handleSupplier.handlePostageFlag = $event.detail.value * 1
|
|
|
if (this.handlePostageFlag === 1) {
|
|
|
- this.handleSupplier.postage = this.handlePostage
|
|
|
+ // 不包邮
|
|
|
+ this.handleSupplier.postage = this.handlePostageVal
|
|
|
} else {
|
|
|
this.handleSupplier.postage = this.handlePostage
|
|
|
}
|
|
|
},
|
|
|
// 确定运费
|
|
|
handleComfirm() {
|
|
|
- if (this.handlePostageFlag === 0) {
|
|
|
- let handleTotalPrice = this.isColdChina ? this.handleTotalPrice : Number(this.repiceNumSub(this.handleTotalPrice, this.handleColdChain))
|
|
|
- this.handleSupplier.totalPrice = Number(this.repiceNumSub(handleTotalPrice, this.handleSupplier.postage))
|
|
|
- this.$emit('changePostage', this.handleSupplier, this.index)
|
|
|
- } else if (this.handlePostageFlag === 1) {
|
|
|
+ // 不包邮
|
|
|
+ if (this.handlePostageFlag === 1) {
|
|
|
if (this.handlePostageVal == 0 || !this.handlePostageVal) {
|
|
|
this.$util.msg('请填写运费', 2000)
|
|
|
return
|
|
|
}
|
|
|
- this.handleSupplier.totalPrice = Number(
|
|
|
- (this.handleTotalPrice * 100 - this.handlePostage * 100 + this.handlePostageVal * 100) / 100
|
|
|
- )
|
|
|
+ let handleTotalPrice = Number(this.repiceNumSub(this.handleTotalPrice, (this.handleColdChain + this.handlePostage)))
|
|
|
+ if(this.handlePostageVal!== (this.handleColdChain + this.handlePostage)){
|
|
|
+ this.handleSupplier.isColdChina = false
|
|
|
+ }
|
|
|
this.handleSupplier.postage = this.handlePostageVal
|
|
|
+ this.handleSupplier.totalPrice = Number((handleTotalPrice * 100 + this.handlePostageVal * 100) / 100)
|
|
|
this.$emit('changePostage', this.handleSupplier, this.index)
|
|
|
+ // 包邮&到付
|
|
|
} else {
|
|
|
- let handleTotalPrice = this.isColdChina ? this.handleTotalPrice : Number(this.repiceNumSub(this.handleTotalPrice, this.handleColdChain))
|
|
|
+ let handleTotalPrice = this.isColdChina ? Number(this.repiceNumSub(this.handleTotalPrice, this.handleColdChain)) : this.handleTotalPrice
|
|
|
this.handleSupplier.totalPrice = Number(this.repiceNumSub(handleTotalPrice, this.handleSupplier.postage))
|
|
|
this.$emit('changePostage', this.handleSupplier, this.index)
|
|
|
}
|