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> <template>
<div v-loading="details.loadingObj.pageLoading"> <div v-loading="details.loadingObj.pageLoading">
<el-form label-width="130px" :model="details.form" ref="formRef"> <el-form label-width="130px" :model="details.form" ref="formRef">
<!-- 价方式 --> <!-- 费类型 -->
<el-form-item <el-form-item
label="计价方式" label="计费类型"
prop="pickupPricingType" prop="pickupPricingType"
:rules="[{ required: true, message: '请选择计价方式', trigger: ['blur', 'change'] }]" :rules="[{ required: true, message: '请选择计价方式', trigger: ['blur', 'change'] }]"
> >
<el-select <el-select
disabled
v-model="details.form.pickupPricingType" v-model="details.form.pickupPricingType"
clearable clearable
multiple multiple
placeholder="请选择计价方式" placeholder="请选择计价方式"
style="width: 20vw" style="width: 20vw"
@change="handleChangePrcieMethod"
> >
<el-option <el-option
v-for="item in details.priceMethodType" v-for="item in details.priceMethodType"
@ -47,7 +47,6 @@
v-model="value.pickupPricingType" v-model="value.pickupPricingType"
clearable clearable
placeholder="请选择车型" placeholder="请选择车型"
@change="handleChangePrcieMethod"
> >
<el-option <el-option
v-for="item in details.priceMethodType" v-for="item in details.priceMethodType"
@ -240,7 +239,6 @@
v-model="details.form.pickupPricingType" v-model="details.form.pickupPricingType"
clearable clearable
placeholder="请选择车型" placeholder="请选择车型"
@change="handleChangePrcieMethod"
> >
<el-option <el-option
v-for="item in details.priceMethodType" v-for="item in details.priceMethodType"
@ -257,7 +255,6 @@
v-model="details.form.pickupPricingType" v-model="details.form.pickupPricingType"
clearable clearable
placeholder="请选择车型" placeholder="请选择车型"
@change="handleChangePrcieMethod"
> >
<el-option <el-option
v-for="item in details.priceMethodType" v-for="item in details.priceMethodType"
@ -274,7 +271,6 @@
v-model="details.form.pickupPricingType" v-model="details.form.pickupPricingType"
clearable clearable
placeholder="请选择车型" placeholder="请选择车型"
@change="handleChangePrcieMethod"
> >
<el-option <el-option
v-for="item in details.priceMethodType" v-for="item in details.priceMethodType"
@ -308,7 +304,6 @@
v-model="value.pickupPricingType" v-model="value.pickupPricingType"
clearable clearable
placeholder="请选择车型" placeholder="请选择车型"
@change="handleChangePrcieMethod"
> >
<el-option <el-option
v-for="item in details.priceMethodType" v-for="item in details.priceMethodType"
@ -459,6 +454,10 @@ import { postFindCategoryInfo } from '@/api/distribution/CreateOrder.js';
const instance = getCurrentInstance(); const instance = getCurrentInstance();
const props = defineProps({
templateData: Object,
});
/** 表单实例 */ /** 表单实例 */
const formRef = ref(); 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 handleTrunkLinePricingType = response => {
const { code, data } = response.data; const { code, data } = response.data;
@ -599,22 +579,100 @@ const handleTrunkLinePricingType = response => {
const _billTemplateDetailArr = []; const _billTemplateDetailArr = [];
for (let i = 0; i < details.priceMethodType.length; i++) { for (let i = 0; i < details.priceMethodType.length; i++) {
const value = details.priceMethodType[i]; const value = details.priceMethodType[i];
if (value.dictKey != '2') {
_billTemplateDetailArr.push({ const _itemObj = {
title: value.dictValue + '计费品类', title: value.dictValue + '计费品类',
code: value.dictKey, code: value.dictKey,
categories: [ categories: [
{ {
reduce: false, reduce: false,
plus: true, plus: true,
goodsName: '', goodsName: '',
goodsId: '', goodsId: '',
goods: '', goods: '',
goodsArr: [], goodsArr: [],
loading: false, 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; details.form.billTemplateDetail = _billTemplateDetailArr;
@ -645,6 +703,20 @@ const initDictionaryBiz = async () => {
const [trunkLineResult, minCostResult] = await Promise.all([trunkLinePromise, minCostPromise]); 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); handleTrunkLinePricingType(trunkLineResult);
handleLowestPrice(minCostResult); handleLowestPrice(minCostResult);

46
src/views/Pricesystem/PricesyHome.vue

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

Loading…
Cancel
Save