Browse Source

价格

dev-xx
qb 12 months ago
parent
commit
13ea58f63e
  1. 158
      src/views/Pricesystem/Price/PriceBill.vue
  2. 46
      src/views/Pricesystem/PricesyHome.vue

158
src/views/Pricesystem/Price/PriceBill.vue

@ -1,19 +1,19 @@
<template>
<div v-loading="details.loadingObj.pageLoading">
<el-form label-width="130px" :model="details.form" ref="formRef">
<!-- 价方式 -->
<!-- 费类型 -->
<el-form-item
label="计价方式"
label="计费类型"
prop="pickupPricingType"
:rules="[{ required: true, message: '请选择计价方式', trigger: ['blur', 'change'] }]"
>
<el-select
disabled
v-model="details.form.pickupPricingType"
clearable
multiple
placeholder="请选择计价方式"
style="width: 20vw"
@change="handleChangePrcieMethod"
>
<el-option
v-for="item in details.priceMethodType"
@ -47,7 +47,6 @@
v-model="value.pickupPricingType"
clearable
placeholder="请选择车型"
@change="handleChangePrcieMethod"
>
<el-option
v-for="item in details.priceMethodType"
@ -240,7 +239,6 @@
v-model="details.form.pickupPricingType"
clearable
placeholder="请选择车型"
@change="handleChangePrcieMethod"
>
<el-option
v-for="item in details.priceMethodType"
@ -257,7 +255,6 @@
v-model="details.form.pickupPricingType"
clearable
placeholder="请选择车型"
@change="handleChangePrcieMethod"
>
<el-option
v-for="item in details.priceMethodType"
@ -274,7 +271,6 @@
v-model="details.form.pickupPricingType"
clearable
placeholder="请选择车型"
@change="handleChangePrcieMethod"
>
<el-option
v-for="item in details.priceMethodType"
@ -308,7 +304,6 @@
v-model="value.pickupPricingType"
clearable
placeholder="请选择车型"
@change="handleChangePrcieMethod"
>
<el-option
v-for="item in details.priceMethodType"
@ -459,6 +454,10 @@ import { postFindCategoryInfo } from '@/api/distribution/CreateOrder.js';
const instance = getCurrentInstance();
const props = defineProps({
templateData: Object,
});
/** 表单实例 */
const formRef = ref();
@ -569,25 +568,6 @@ const validatePrice = (rule: any, value: any, callback: any) => {
}
};
const goriesloading = ref(false);
/** 计价方式改变时 */
const handleChangePrcieMethod = value => {
console.log('value :>> ', value);
let activeItem: any = {};
for (let i = 0; i < details.lowestType.length; i++) {
const item = details.lowestType[i];
if (item.value !== details.form.pickupMinCostType) continue;
activeItem = item;
break;
}
if (!activeItem.MappingOrNot) return;
if (!details.form.pickupPricingType.includes(activeItem.mapValue))
details.form.pickupMinCostType = '0';
};
/** 处理干线计费模式 */
const handleTrunkLinePricingType = response => {
const { code, data } = response.data;
@ -599,22 +579,100 @@ const handleTrunkLinePricingType = response => {
const _billTemplateDetailArr = [];
for (let i = 0; i < details.priceMethodType.length; i++) {
const value = details.priceMethodType[i];
_billTemplateDetailArr.push({
title: value.dictValue + '计费品类',
code: value.dictKey,
categories: [
{
reduce: false,
plus: true,
goodsName: '',
goodsId: '',
goods: '',
goodsArr: [],
loading: false,
},
],
});
if (value.dictKey != '2') {
const _itemObj = {
title: value.dictValue + '计费品类',
code: value.dictKey,
categories: [
{
reduce: false,
plus: true,
goodsName: '',
goodsId: '',
goods: '',
goodsArr: [],
loading: false,
},
],
};
if (!props.templateData.request) {
_billTemplateDetailArr.push(_itemObj);
continue;
}
const _arr = [];
//
if (value.dictKey === '1') {
const { pickupPieceCategorys } = props.templateData.request;
if (pickupPieceCategorys && pickupPieceCategorys.length !== 0) {
for (let i = 0; i < pickupPieceCategorys.length; i++) {
const item = pickupPieceCategorys[i];
_arr.push({
reduce: i === 0 ? false : true,
plus: true,
goodsName: item.name,
goodsId: item.id,
goods: item.name,
goodsArr: [],
loading: false,
});
}
_itemObj.categories = _arr;
}
}
//
if (value.dictKey === '4') {
const { pickupWeightCategorys } = props.templateData.request;
if (pickupWeightCategorys && pickupWeightCategorys.length !== 0) {
for (let i = 0; i < pickupWeightCategorys.length; i++) {
const item = pickupWeightCategorys[i];
_arr.push({
reduce: i === 0 ? false : true,
plus: true,
goodsName: item.name,
goodsId: item.id,
goods: item.name,
goodsArr: [],
loading: false,
});
}
_itemObj.categories = _arr;
}
}
//
if (value.dictKey === '3') {
const { pickupCubeCategorys } = props.templateData.request;
if (pickupCubeCategorys && pickupCubeCategorys.length !== 0) {
for (let i = 0; i < pickupCubeCategorys.length; i++) {
const item = pickupCubeCategorys[i];
_arr.push({
reduce: i === 0 ? false : true,
plus: true,
goodsName: item.name,
goodsId: item.id,
goods: item.name,
goodsArr: [],
loading: false,
});
}
_itemObj.categories = _arr;
}
}
_billTemplateDetailArr.push(_itemObj);
}
}
details.form.billTemplateDetail = _billTemplateDetailArr;
@ -645,6 +703,20 @@ const initDictionaryBiz = async () => {
const [trunkLineResult, minCostResult] = await Promise.all([trunkLinePromise, minCostPromise]);
await nextTick();
if (Object.keys(props.templateData).length !== 0) {
details.form = deepClone(props.templateData.request);
details.form.pickupPricingType = details.form.pickupPricingType
? details.form.pickupPricingType.split(',')
: [];
details.form.pickupIsByCategory += '';
details.form.pickupMinCostType += '';
details.form.pickupIsUnifyAreaBill += '';
details.form.pickupIsMinCost += '';
}
// 线
handleTrunkLinePricingType(trunkLineResult);
handleLowestPrice(minCostResult);

46
src/views/Pricesystem/PricesyHome.vue

@ -63,17 +63,16 @@ const request = ref({}); //用于保存会显的值
function updateDictionary(targetArray, dictionaryType) {
getDictionaryBiz(dictionaryType)
.then(res => {
console.log(res, '字典');
if (res.data.code == 200) {
if (res.data.data.length) {
res.data.data.forEach(item => {
targetArray.push({
value: item.dictKey,
label: item.dictValue,
id: item.id,
});
});
}
const { code, data } = res.data;
if (code !== 200 || !data) return;
for (const iterator of data) {
targetArray.push({
value: iterator.dictKey,
label: iterator.dictValue,
id: iterator.id,
});
}
})
.catch(() => {});
@ -125,19 +124,20 @@ const onLoad = async () => {
id: $route.query.templateId,
};
$_InfopriceTemplate(data).then(res => {
const { code, data } = res.data;
if (code !== 200 || !data) return;
console.log(res, '获取详情');
if (res.data.code == 200) {
request.value = res.data.data; //
form.value.TemplateName = res.data.data.name || ''; //
form.value.ServiceType = res.data.data.serviceType.split(',') || []; //
console.log('form.value.ServiceType :>> ', form.value.ServiceType);
const result = ServiceList.value.filter(item =>
form.value.ServiceType.includes(item.value)
);
//
executeCheckedResults(result);
}
request.value = data; //
form.value.TemplateName = data.name || ''; //
form.value.ServiceType = data.serviceType.split(',') || []; //
console.log('form.value.ServiceType :>> ', form.value.ServiceType);
const result = ServiceList.value.filter(item => form.value.ServiceType.includes(item.value));
//
executeCheckedResults(result);
});
} catch (error) {
console.log('error :>> ', error);

Loading…
Cancel
Save