emis-app/components/buns-post-edit-templates/bpe-cost-tmp.vue
2024-05-07 21:44:17 +08:00

155 lines
4.1 KiB
Vue

<template>
<view class="shet-cont">
<view class="jsfm-item nobg" style="padding-top: 0;margin-bottom: 0;">
<u-row>
<view class="lft1 font-28">计费方式</view>
<view style="flex: 1;">
<u-radio-group v-model="modelInfo.calcFeeType" @change="handleFeeTypeChange">
<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;`">
</u-radio>
</u-radio-group>
</view>
</u-row>
</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>
</view>
</u-row>
<view v-if="item.calcExp" class="mt-10 clr-sub">计算公式: {{item.calcExp}}</view>
</view>
<tpx-select v-if="feeTypeOptions.length > 0" :list="feeTypeOptions" @onChange="handleAddFee" mode="drop">
<u-row justify="center">
<u-button custom-style="border-radius: 16rpx;height:60rpx;font-size: 30rpx;margin-top: 20rpx;"
:plain="true" type="primary">
<u-icon name="plus" size="30" color="#B12D29"></u-icon>
<text class="pl-10">增加收费项</text>
</u-button>
</u-row>
</tpx-select>
<view class="pt-20">
<u-row custom-style="flex: 1">
<text class="font-26 pr-10">总费用</text>
<tpx-input v-model:value="modelInfo.freight" :isWhite="true" type="number"
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>
</view>
</template>
<script>
import * as apiService from "@/common/api"
export default {
computed: {
modelInfo: {
get() {
return this.value
}
},
feeTypeOptions() {
let list = this.dicData.emis_fee_type || []
let curVals = this.modelInfo?.feeItems?.map?.(t => t.feeCode) || []
list = list.filter(t => curVals.indexOf(t.val) == -1)
return list
},
dicData() {
return this.$store.getters.dicData
}
},
props: {
value: {
default () {
return {}
}
},
searchParam: {
default () {
return {}
}
}
},
data() {
return {}
},
created() {
;(!this.modelInfo.feeItems || this.modelInfo.feeItems.length == 0) && this.calcWaybillFee();
},
onHide() {
},
unmounted() {
},
methods: {
handleDelFee(index) {
this.modelInfo.feeItems.splice(index, 1)
},
handleAddFee(val) {
this.modelInfo.feeItems.push({
__add: true,
feeCode: val,
feeName: this.dicData.emis_fee_type.filter(t => t.val == val)[0].title
})
},
handleFeeTypeChange(val) {
this.calcWaybillFee({ calcFeeType: val })
},
async calcWaybillFee(params = {}) {
let res = await apiService.calcWaybillFee({ custNo: this.modelInfo.custNo, ...this.searchParam, ...params })
this.modelInfo.feeItems = res.data.feeList
this.modelInfo.freight = res.data.totalFee
}
}
}
</script>
<style scoped lang="scss">
.shet-cont {}
.jsfm-item {
background-color: #F6F6F6;
padding: 20rpx;
margin-bottom: 20rpx;
border-bottom: 2rpx solid #F6F6F6;
&:last-child {
margin-bottom: 0rpx;
}
.lft1 {
width: 150rpx;
margin-right: 10rpx;
}
.delicon {
padding: 16rpx 0 16rpx 20rpx;
}
}
.nobg {
background-color: transparent;
}
</style>