emis-app/components/buns-post-edit-templates/bpe-cost-tmp.vue

173 lines
4.6 KiB
Vue
Raw Normal View History

2024-01-30 07:40:49 +00:00
<template>
<view class="shet-cont">
2024-04-27 09:59:09 +00:00
<view class="jsfm-item nobg" style="padding-top: 0;margin-bottom: 0;">
2024-01-31 06:45:51 +00:00
<u-row>
<view class="lft1 font-28">计费方式</view>
<view style="flex: 1;">
2024-05-26 15:21:59 +00:00
<u-radio-group v-model="modelInfo.calcFeeType">
2024-04-29 08:13:17 +00:00
<u-radio v-for="(item, index) in dicData.emis_calc_fee_type" :label="item.title"
:name="item.val" activeColor="#B12D29" size="30" labelSize="26"
:custom-style="`margin-right: ${index+1<dicData.emis_calc_fee_type.length?30:0}rpx;`">
2024-01-31 06:45:51 +00:00
</u-radio>
2024-04-29 08:13:17 +00:00
</u-radio-group>
2024-01-30 07:40:49 +00:00
</view>
</u-row>
</view>
2024-04-29 08:13:17 +00:00
2024-04-27 09:59:09 +00:00
<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>
2024-04-29 08:13:17 +00:00
<tpx-input v-model:value="item.fee" :isWhite="true" custom-style="width: 120rpx;height: 46rpx;"
suffix="CNY"></tpx-input>
2024-01-31 06:45:51 +00:00
</u-row>
2024-04-27 09:59:09 +00:00
<!-- 干线运输费才显示 续重 -->
<u-row v-if="item.feeCode == '1001'" custom-style="flex: 1">
<text class="font-26 pr-10">续重</text>
2024-04-29 08:13:17 +00:00
<tpx-input v-model:value="item.addWeight" :isWhite="true"
custom-style="width: 120rpx;height: 46rpx;" suffix="KG"></tpx-input>
2024-04-27 05:55:14 +00:00
</u-row>
2024-04-27 09:59:09 +00:00
<view v-if="item.__add" @click="handleDelFee(index)" class="delicon">
<u-icon name="minus-circle" size="30"></u-icon>
</view>
</u-row>
<view v-if="item.calcExp" class="mt-10 clr-sub">计算公式: {{item.calcExp}}</view>
</view>
2024-04-29 08:13:17 +00:00
<tpx-select v-if="feeTypeOptions.length > 0" :list="feeTypeOptions" @onChange="handleAddFee" mode="drop">
2024-04-27 05:55:14 +00:00
<u-row justify="center">
2024-04-29 08:13:17 +00:00
<u-button custom-style="border-radius: 16rpx;height:60rpx;font-size: 30rpx;margin-top: 20rpx;"
:plain="true" type="primary">
2024-04-27 05:55:14 +00:00
<u-icon name="plus" size="30" color="#B12D29"></u-icon>
<text class="pl-10">增加收费项</text>
</u-button>
2024-01-30 07:40:49 +00:00
</u-row>
2024-04-27 09:59:09 +00:00
</tpx-select>
2024-05-06 16:38:24 +00:00
<view class="pt-20">
<u-row custom-style="flex: 1">
<text class="font-26 pr-10">总费用</text>
2024-05-24 07:06:21 +00:00
<tpx-input v-model:value="modelInfo.freight" :isWhite="true" type="digit"
2024-05-06 16:38:24 +00:00
custom-style="width: 120rpx;height: 46rpx;" suffix="CNY"></tpx-input>
</u-row>
</view>
<view class="pt-20">
<u-textarea v-model="modelInfo.feeRemaker" border="surround" height="120" placeholder="费用备注"
maxlength="50" count></u-textarea>
</view>
2024-04-29 08:13:17 +00:00
</view>
2024-01-30 07:40:49 +00:00
</template>
<script>
2024-04-29 08:13:17 +00:00
import * as apiService from "@/common/api"
2024-01-30 07:40:49 +00:00
export default {
computed: {
2024-04-27 05:55:14 +00:00
modelInfo: {
2024-04-29 08:13:17 +00:00
get() {
2024-01-30 07:40:49 +00:00
return this.value
}
2024-04-27 05:55:14 +00:00
},
2024-04-29 08:13:17 +00:00
feeTypeOptions() {
2024-04-27 09:59:09 +00:00
let list = this.dicData.emis_fee_type || []
2024-05-07 13:44:17 +00:00
let curVals = this.modelInfo?.feeItems?.map?.(t => t.feeCode) || []
2024-04-29 08:13:17 +00:00
list = list.filter(t => curVals.indexOf(t.val) == -1)
2024-04-27 09:59:09 +00:00
return list
},
2024-04-27 05:55:14 +00:00
dicData() {
2024-04-29 08:13:17 +00:00
return this.$store.getters.dicData
2024-05-26 15:21:59 +00:00
},
searchParam() {
let info = this.modelInfo
let param = {
productType: info.productType,
// customerCode: info.customerCode,
customsClear: info.customsClear,
customsEclaration: info.customsEclaration,
calcFeeType: info.calcFeeType,
settlementWeight: info.settlementWeight,
totalVolume: info.totalVolume,
sendSiteCode: this.$store.getters.userInfo.ownerSiteCode,
dispatchUnderlingSiteCode: info.dispatchUnderlingSiteCode,
}
return param
}
},
watch: {
searchParam: {
handler(newVal){
let vals = Object.values(newVal)
// 所有关联入参都有值再 执行自动计算
if(vals.length == vals.filter(v => !!v).length) {
this.calcWaybillFee(newVal);
}
},
deep: true,
2024-01-30 07:40:49 +00:00
}
},
props: {
value: {
default () {
2024-04-29 08:13:17 +00:00
return {}
2024-01-30 07:40:49 +00:00
}
2024-04-29 08:46:07 +00:00
},
2024-01-30 07:40:49 +00:00
},
data() {
2024-04-29 08:13:17 +00:00
return {}
2024-01-30 07:40:49 +00:00
},
created() {
},
onHide() {
},
unmounted() {
2024-04-29 08:13:17 +00:00
2024-01-30 07:40:49 +00:00
},
methods: {
2024-04-27 09:59:09 +00:00
handleDelFee(index) {
this.modelInfo.feeItems.splice(index, 1)
},
handleAddFee(val) {
this.modelInfo.feeItems.push({
__add: true,
feeCode: val,
2024-04-29 08:13:17 +00:00
feeName: this.dicData.emis_fee_type.filter(t => t.val == val)[0].title
2024-04-27 09:59:09 +00:00
})
2024-04-29 08:13:17 +00:00
},
2024-04-29 08:46:07 +00:00
async calcWaybillFee(params = {}) {
2024-05-26 15:21:59 +00:00
let res = await apiService.calcWaybillFee({ custNo: this.modelInfo.custNo, ...params })
2024-05-06 16:38:24 +00:00
this.modelInfo.feeItems = res.data.feeList
this.modelInfo.freight = res.data.totalFee
2024-04-27 09:59:09 +00:00
}
2024-01-30 07:40:49 +00:00
}
}
</script>
<style scoped lang="scss">
2024-04-29 08:13:17 +00:00
.shet-cont {}
.jsfm-item {
2024-04-27 09:59:09 +00:00
background-color: #F6F6F6;
padding: 20rpx;
margin-bottom: 20rpx;
2024-01-31 06:45:51 +00:00
border-bottom: 2rpx solid #F6F6F6;
2024-04-29 08:13:17 +00:00
&:last-child {
2024-04-27 09:59:09 +00:00
margin-bottom: 0rpx;
}
2024-04-29 08:13:17 +00:00
.lft1 {
2024-01-31 06:45:51 +00:00
width: 150rpx;
margin-right: 10rpx;
}
2024-04-29 08:13:17 +00:00
.delicon {
2024-01-31 06:45:51 +00:00
padding: 16rpx 0 16rpx 20rpx;
}
2024-01-30 07:40:49 +00:00
}
2024-04-29 08:13:17 +00:00
.nobg {
2024-04-27 09:59:09 +00:00
background-color: transparent;
}
2024-01-30 07:40:49 +00:00
</style>