This commit is contained in:
aihe 2024-06-02 18:16:18 +08:00
parent 6aa83f599b
commit fc1279608e
2 changed files with 93 additions and 19 deletions

View File

@ -1,6 +1,20 @@
<template>
<view class="shet-cont">
<view class="jsfm-item nobg" style="padding-top: 0;margin-bottom: 0;">
<view class="">
<tpx-text-item label="特殊报价">
<template v-slot:right>
<u-switch v-model="modelInfo.blSpecialQuote" activeValue="1" inactiveValue="0" active-color="#B12D29" size="34"></u-switch>
</template>
</tpx-text-item>
</view>
<view class="pt-20">
<tpx-text-item label="敏感物">
<template v-slot:right>
<u-switch v-model="modelInfo.blSpecialGoods" activeValue="1" inactiveValue="0" active-color="#B12D29" size="34"></u-switch>
</template>
</tpx-text-item>
</view>
<view class="jsfm-item nobg" style=";margin-bottom: 0;padding-left: 0;">
<u-row>
<view class="lft1 font-28">计费方式</view>
<view style="flex: 1;">
@ -15,23 +29,35 @@
</view>
<view v-for="(item, index) in modelInfo.feeItems" class="jsfm-item">
<u-row custom-style="gap: 20rpx;">
<u-row custom-style="flex: 1">
<text class="font-26 pr-10">{{item.feeName}}</text>
<tpx-input v-model:value="item.fee" :isWhite="true" custom-style="width: 120rpx;height: 46rpx;"
suffix="CNY"></tpx-input>
</u-row>
<!-- 干线运输费才显示 续重 -->
<u-row v-if="item.feeCode == '1001'" custom-style="flex: 1">
<text class="font-26 pr-10">续重</text>
<tpx-input v-model:value="item.addWeight" :isWhite="true"
custom-style="width: 120rpx;height: 46rpx;" suffix="KG"></tpx-input>
</u-row>
<view v-if="item.__add" @click="handleDelFee(index)" class="delicon">
<u-icon name="minus-circle" size="30"></u-icon>
<!-- 手动添加的才能删除 -->
<u-row justify="between">
<view >
<text class="">应收:</text> {{item.fee || 0}}
</view>
<view v-if="item.blAutoGen == 0" @click="handleDelFee(index)" class="delicon">
<u-icon name="trash" size="32"></u-icon>
</view>
</u-row>
<view v-if="item.calcExp" class="mt-10 clr-sub">计算公式: {{item.calcExp}}</view>
<u-row style="width:450rpx;margin-top:10rpx;">
<text class="font-26 pr-20">{{item.feeName}}</text>
<tpx-input v-model:value="item.realFee" @change="(val)=> { handleRlFeeChange(item, val) }" _digit="5" :isWhite="true" custom-style="width: 120rpx;height: 46rpx;"
:disabled="modelInfo.blSpecialQuote != 1" suffix="CNY"></tpx-input>
</u-row>
<u-row custom-style="gap: 20rpx;margin-top:10rpx;">
<u-row custom-style="flex: 1">
<text class="font-26 pr-10">续重单价</text>
<tpx-input v-model:value="item.addWeightPrice" @change="(val)=> { handleAwPriceChange(item, val) }" _digit="5" :isWhite="true"
:disabled="modelInfo.blSpecialQuote != 1" custom-style="width: 120rpx;height: 46rpx;" suffix="CNY"></tpx-input>
</u-row>
<u-row custom-style="flex: 1">
<text class="font-26 pr-10">首重费</text>
<tpx-input v-model:value="item.initialWeightFee" @change="(val)=> { handleIwFeeChange(item, val) }" _digit="5" :isWhite="true"
:disabled="modelInfo.blSpecialQuote != 1" custom-style="width: 120rpx;height: 46rpx;" suffix="CNY"></tpx-input>
</u-row>
</u-row>
<view v-if="item.calcExp" class="mt-10">
<text class="">计算公式:</text> {{item.calcExp}}
</view>
</view>
<tpx-select v-if="feeTypeOptions.length > 0" :list="feeTypeOptions" @onChange="handleAddFee" mode="drop">
@ -134,7 +160,7 @@
},
handleAddFee(val) {
this.modelInfo.feeItems.push({
__add: true,
blAutoGen: 0, // 手动添加的费用标识
feeCode: val,
feeName: this.dicData.emis_fee_type.filter(t => t.val == val)[0].title
})
@ -144,6 +170,45 @@
this.modelInfo.feeItems = res.data.feeList
this.modelInfo.freight = res.data.totalFee
},
handleRlFeeChange(item, val){
// 手动添加,需要更新应收
if(item.blAutoGen == 0) {
item.fee = val
}
setTimeout(()=> {
this.calteFreight()
}, 500)
},
handleAwPriceChange(item) {
setTimeout(()=> {
this.calteShiRealfee(item)
}, 500)
},
handleIwFeeChange(item){
setTimeout(()=> {
this.calteShiRealfee(item)
}, 500)
},
calteShiRealfee(item){
if(item.blAutoGen == 1 && item.calcExp) {
let { settlementWeight } = this.modelInfo
let { initialWeightFee, addWeightPrice, calcExp } = item
let expr = calcExp;
expr = expr.replace("s", initialWeightFee);
expr = expr.replace("d", addWeightPrice);
expr = expr.replace("w", settlementWeight);
item.realFee = parseFloat(eval(expr)).toFixed(2);
this.calteFreight()
}
},
// 更新总费用
calteFreight(){
let total = 0
this.modelInfo.feeItems.map(t=> {
total += (+t.realFee)
})
this.modelInfo.freight = total
}
}
}
@ -153,6 +218,7 @@
.shet-cont {}
.jsfm-item {
position: relative;
background-color: #F6F6F6;
padding: 20rpx;
margin-bottom: 20rpx;
@ -163,6 +229,7 @@
}
.lft1 {
font-weight: 700;
width: 150rpx;
margin-right: 10rpx;
}

View File

@ -15,8 +15,15 @@
export default {
computed: {
inputStyle(){
let sty1 = 'border:0;border-radius: 10rpx;background-color: #F6F6F6;padding: 11rpx 20rpx;'
this.isWhite && (sty1 += 'background-color: #fff;border: 1rpx solid #dadbde;')
let bgColor = '#F6F6F6'
let sty1 = 'border:0;border-radius: 10rpx;padding: 11rpx 20rpx;'
if(this.isWhite) {
bgColor = '#fff'
sty1 += 'border: 1rpx solid #dadbde;'
}
if(!this.disabled) {
sty1 += `background-color:${bgColor};`
}
return `${sty1};${this.customStyle};`
}
},