Commit 0397b3f9 authored by wanglianghe's avatar wanglianghe

线路价格管理

parent 94ba1400
......@@ -52,6 +52,14 @@ export function getCurrencyPage(query) {
})
}
// 获取所有
export function getCurrencyList() {
return request({
url: '/ecw/currency/list',
method: 'get'
})
}
// 导出 Excel
export function exportCurrencyExcel(query) {
return request({
......
......@@ -52,6 +52,14 @@ export function getUnitPage(query) {
})
}
// 获得所有计量单位
export function getUnitList() {
return request({
url: '/ecw/unit/list',
method: 'get'
})
}
// 导出计量单位 Excel
export function exportUnitExcel(query) {
return request({
......
......@@ -9,6 +9,7 @@ export const DICT_TYPE = {
USER_TYPE: 'user_type',
COMMON_STATUS: 'common_status',
AUDIT_STATUS: 'audit_status',
ADVANCE_STATUS: 'advance_status',
// ========== SYSTEM 模块 ==========
SYSTEM_USER_SEX: 'system_user_sex',
......
......@@ -247,12 +247,11 @@ export default {
/**跳转价格管理 */
toPriceManager(row) {
this.$router.push({
name:'ProductPrice',
params: {
product:row
}
})
localStorage.setItem('product', JSON.stringify(row));
localStorage.setItem('typeList', JSON.stringify(this.typeList));
this.$router.push({
name:'ProductPrice'
})
},
handleStatusChange(row, statusType) {
......
......@@ -2,40 +2,25 @@
<div class="app-container">
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="产品ID" prop="productId">
<el-input v-model="queryParams.productId" placeholder="请输入产品ID" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="线路ID" prop="warehouseLineId">
<el-input v-model="queryParams.warehouseLineId" placeholder="请输入线路ID" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="运费" prop="transportPrice">
<el-input v-model="queryParams.transportPrice" placeholder="请输入运费" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="运费金额单位" prop="transportPriceUnit">
<el-input v-model="queryParams.transportPriceUnit" placeholder="请输入运费金额单位" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="运费体积单位" prop="transportVolumeUnit">
<el-input v-model="queryParams.transportVolumeUnit" placeholder="请输入运费体积单位" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="清关费用" prop="clearancePrice">
<el-input v-model="queryParams.clearancePrice" placeholder="请输入清关费用" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="清关金额单位" prop="clearancePriceUnit">
<el-input v-model="queryParams.clearancePriceUnit" placeholder="请输入清关金额单位" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="清关体积单位" prop="clearanceVolumeUnit">
<el-input v-model="queryParams.clearanceVolumeUnit" placeholder="请输入清关体积单位" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="是否展示 默认为展示" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择是否展示 默认为展示" clearable size="small">
<el-option label="请选择字典生成" value="" />
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="始发地" prop="startCityId">
<el-select v-model="queryParams.startCityId" clearable>
<el-option v-for="city in startCityList" :key="city.id" :label="city.titleZh" :value="city.id" />
</el-select>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd"
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" />
</el-form-item>
</el-form-item>
<el-form-item label="目的地" prop="destCityId">
<el-select v-model="queryParams.destCityId" clearable>
<el-option v-for="city in destCityList" :key="city.id" :label="city.titleZh" :value="city.id" />
</el-select>
</el-form-item>
<el-form-item label="运输方式" prop="transportType">
<el-select v-model="queryParams.transportType" clearable>
<el-option v-for="dict in transportDatas" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
......@@ -48,35 +33,69 @@
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['ecw:product-price:create']">新增</el-button>
</el-col>
<el-col :span="1.5">
<!-- <el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
v-hasPermi="['ecw:product-price:export']">导出</el-button>
</el-col>
</el-col> -->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column label="产品ID" align="center" prop="productId" />
<el-table-column label="线路ID" align="center" prop="warehouseLineId" />
<el-table-column label="运费" align="center" prop="transportPrice" />
<el-table-column label="运费金额单位" align="center" prop="transportPriceUnit" />
<el-table-column label="运费体积单位" align="center" prop="transportVolumeUnit" />
<el-table-column label="清关费用" align="center" prop="clearancePrice" />
<el-table-column label="清关金额单位" align="center" prop="clearancePriceUnit" />
<el-table-column label="清关体积单位" align="center" prop="clearanceVolumeUnit" />
<el-table-column label="是否展示 默认为展示" align="center" prop="status" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<el-table-column label="序号" type="index" width="50" />
<el-table-column prop="tansportType" label="运输方式" align="center" width="100">
<template slot-scope="scope">
<div>
{{ transportName(scope.row.warehouseLineDO.transportType) }}
</div>
</template>
</el-table-column>
<el-table-column prop="startDestTitle" label="始发地/目的地" align="center">
<template slot-scope="scope">
<div>
{{ scope.row.warehouseLineDO.startTitleZh }}
<br />
{{ scope.row.warehouseLineDO.destTitleZh }}
</div>
</template>
</el-table-column>
<el-table-column prop="price" label="价格" align="center">
<template slot-scope="scope">
<div>
海运费:{{ getCurrencySymbol(scope.row.transportPriceUnit) + scope.row.transportPrice}}&nbsp;
{{ getCurrencyTitle(scope.row.transportPriceUnit) + '/' + getUnitTitle(scope.row.transportVolumeUnit)}}
<br />
清关费:{{ getCurrencySymbol(scope.row.clearancePriceUnit) + scope.row.clearancePrice}}&nbsp;
{{ getCurrencyTitle(scope.row.clearancePriceUnit) + '/' + getUnitTitle(scope.row.clearanceVolumeUnit)}}
</div>
</template>
</el-table-column>
<el-table-column prop="auditStatus" align="center" label="是否审核" width="120">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
<el-select v-model="scope.row.auditStatus" @change="handleStatusChange(scope.row)">
<el-option v-for="auditStatusItem in auditStatusDictDatas" :key="auditStatusItem.id" :label="auditStatusItem.label" :value="parseInt(auditStatusItem.value)"/>
</el-select>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<el-table-column prop="advanceStatus" label="预付" align="center" width="80">
<template slot-scope="scope">
<div>
{{ getAdvanceStatuTitle(scope.row.advanceStatus) }}
</div>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="140">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['ecw:product-price:update']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['ecw:product-price:delete']">删除</el-button>
<!-- <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['ecw:product-price:delete']">删除</el-button> -->
</template>
</el-table-column>
</el-table>
......@@ -85,38 +104,122 @@
@pagination="getList"/>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-dialog :title="title" :visible.sync="open" width="900px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="产品ID" prop="productId">
<el-input v-model="form.productId" placeholder="请输入产品ID" />
</el-form-item>
<el-form-item label="线路ID" prop="warehouseLineId">
<el-input v-model="form.warehouseLineId" placeholder="请输入线路ID" />
</el-form-item>
<el-form-item label="运费" prop="transportPrice">
<el-input v-model="form.transportPrice" placeholder="请输入运费" />
</el-form-item>
<el-form-item label="运费金额单位" prop="transportPriceUnit">
<el-input v-model="form.transportPriceUnit" placeholder="请输入运费金额单位" />
</el-form-item>
<el-form-item label="运费体积单位" prop="transportVolumeUnit">
<el-input v-model="form.transportVolumeUnit" placeholder="请输入运费体积单位" />
</el-form-item>
<el-form-item label="清关费用" prop="clearancePrice">
<el-input v-model="form.clearancePrice" placeholder="请输入清关费用" />
<el-form-item label="产品类型" prop="typeId">
<el-select v-model="form.typeId" placeholder="选择产品类型" disabled>
<el-option v-for="type in typeList" :key="type.id" :label="type.titleZh" :value="type.id"/>
</el-select>
</el-form-item>
<el-form-item label="清关金额单位" prop="clearancePriceUnit">
<el-input v-model="form.clearancePriceUnit" placeholder="请输入清关金额单位" />
<el-form-item label="产品名称" prop="titleZh">
<el-input v-model="form.titleZh" disabled />
</el-form-item>
<el-form-item label="清关体积单位" prop="clearanceVolumeUnit">
<el-input v-model="form.clearanceVolumeUnit" placeholder="请输入清关体积单位" />
<el-form-item label="英文名称" prop="titleEn">
<el-input v-model="form.titleEn" disabled />
</el-form-item>
<el-form-item label="是否展示 默认为展示" prop="status">
<el-radio-group v-model="form.status">
<el-radio label="1">请选择字典生成</el-radio>
</el-radio-group>
<el-row :gutter="20" v-if="!form.id">
<el-col :span="6">
<el-form-item label="运输方式" prop="transportType">
<el-select v-model="form.transportType" clearable @change="transportTypeChange">
<el-option v-for="dict in transportDatas" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="始发地" prop="startCityId">
<el-select v-model="form.startCityId" clearable @change="startCityChange">
<el-option v-for="city in startCityList" :key="city.id" :label="city.titleZh" :value="city.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="目的地" prop="destCityId">
<el-select v-model="form.destCityId" clearable @change="destCityChange">
<el-option v-for="city in destCityList" :key="city.id" :label="city.titleZh" :value="city.id" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-table
ref="routeTable"
:data="routedList"
tooltip-effect="dark"
max-height="250"
style="width: 100%"
@selection-change="handleSelectionChange">
<el-table-column
type="selection"
:selectable="checkSelectable"
width="55">
</el-table-column>
<el-table-column
label="线路"
width="800">
<template slot-scope="scope">{{ transportName(scope.row.transportType) + '从【' +
scope.row.startTitleZh + '】发往【' + scope.row.destTitleZh + ''}}</template>
</el-table-column>
</el-table>
<br />
<el-form-item label="海运费" prop="transportPrice">
<el-row :gutter="20">
<el-col :span="4">
<el-select v-model="form.transportPriceUnit">
<el-option v-for="currency in currecyList" :key="currency.id" :label="currency.titleZh" :value="currency.id" />
</el-select>
</el-col>
<el-col :span="6">
<el-input v-model.number="form.transportPrice" type="number" placeholder="整数或者两位小数"/>
</el-col>
<el-col :span="4">
<el-select v-model="form.transportVolumeUnit">
<el-option v-for="unit in unitList" :key="unit.id" :label="unit.titleZh" :value="unit.id" />
</el-select>
</el-col>
</el-row>
</el-form-item>
<el-form-item label="清关费" prop="clearancePrice">
<el-row :gutter="20">
<el-col :span="4">
<el-select v-model="form.clearancePriceUnit">
<el-option v-for="currency in currecyList" :key="currency.id" :label="currency.titleZh" :value="currency.id" />
</el-select>
</el-col>
<el-col :span="6">
<el-input v-model.number="form.clearancePrice" type="number" placeholder="整数或者两位小数"/>
</el-col>
<el-col :span="4">
<el-select v-model="form.clearanceVolumeUnit">
<el-option v-for="unit in unitList" :key="unit.id" :label="unit.titleZh" :value="unit.id" />
</el-select>
</el-col>
</el-row>
</el-form-item>
<el-form-item label="是否预付" prop="advanceStatus">
<el-radio-group v-model="form.advanceStatus">
<el-radio v-for="advanceDict in advanceStatusDictDatas" :label="parseInt(advanceDict.value)">{{advanceDict.label}}</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
......@@ -129,12 +232,29 @@
import { createProductPrice, updateProductPrice, deleteProductPrice, getProductPrice, getProductPricePage, exportProductPriceExcel } from "@/api/ecw/productPrice";
import { openedRouterList } from "@/api/ecw/warehouse";
import { getCityList } from "@/api/ecw/region";
import { getProductTypeList } from "@/api/ecw/productType";
import { getDictDatas, DICT_TYPE } from '@/utils/dict';
import { getCurrencyList } from '@/api/ecw/currency';
import { getUnitList } from '@/api/ecw/unit';
import { AuditStatusEnum} from '@/utils/constants'
export default {
name: "ProductPrice",
components: {
},
data() {
return {
typeList: [],
product: null,
startCityList: [], //始发地城市
destCityList: [], //目的地城市
routedList: [], //已开头路线列表
currecyList: [], //货币列表
unitList: [], //单位列表
routeParams:{}, //路线搜索条件
isUpdate: false, //更新操作
// 遮罩层
loading: true,
// 导出遮罩层
......@@ -165,29 +285,185 @@ export default {
status: null,
},
// 表单参数
form: {},
form: {
typeId: null,
titleZh: null
},
// 表单校验
rules: {
productId: [{ required: true, message: "产品ID不能为空", trigger: "blur" }],
warehouseLineId: [{ required: true, message: "线路ID不能为空", trigger: "blur" }],
}
typeId: [{ required: true, message: "产品类型不能为空", trigger: "blur" }],
titleZh: [{ required: true, message: "产品名称不能为空", trigger: "blur" }],
titleEn: [{ required: true, message: "英文名称不能为空", trigger: "blur" }],
transportPrice: [{ required: true, message: "海运费不能为空", trigger: "blur" }],
clearancePrice: [{ required: true, message: "清关费不能为空", trigger: "blur" }],
advanceStatus: [{ required: true, message: "是否预付不能为空", trigger: "blur" }],
},
transportDatas: getDictDatas(DICT_TYPE.ECW_TRANSPORT_TYPE),
advanceStatusDictDatas: getDictDatas(DICT_TYPE.ADVANCE_STATUS),
AuditStatusEnum: AuditStatusEnum,
auditStatusDictDatas: getDictDatas(DICT_TYPE.AUDIT_STATUS),
lineList: []
};
},
computed: {
transportName() {
return transportType => {
for(let index in this.transportDatas) {
let transportItem = this.transportDatas[index];
if(transportItem.value == transportType) {
return transportItem.label;
}
}
}
},
getCurrencySymbol() {
return currencyId => {
for(let index in this.currecyList) {
let currecyItem = this.currecyList[index];
if(currecyItem.id == currencyId) {
return currecyItem.fuhao;
}
}
}
},
getCurrencyTitle() {
return currencyId => {
for(let index in this.currecyList) {
let currecyItem = this.currecyList[index];
if(currecyItem.id == currencyId) {
return currecyItem.titleZh;
}
}
}
},
getUnitTitle() {
return unitId => {
for(let index in this.unitList) {
let unitItem = this.unitList[index];
if(unitItem.id == unitId) {
return unitItem.titleZh;
}
}
}
},
getAdvanceStatuTitle() {
return value => {
for(let index in this.advanceStatusDictDatas) {
let dictItem = this.advanceStatusDictDatas[index];
if(dictItem.value === '' + value) {
return dictItem.label;
}
}
}
}
},
created() {
let product = this.$route.params.product;
console.log(product);
let productJson = localStorage.getItem('product');
this.product = eval('(' + productJson + ')');
let typeListJson = localStorage.getItem('typeList');
if(typeListJson) {
this.typeList = eval('(' + typeListJson + ')');
} else {
this.getTypeList();
}
this.getList();
//获取城市列表
this.getAllCityList();
//获取货币列表
this.requestCurrencyList();
//获取单位列表
this.requestUnitList();
},
openedRouterList({}).then(response => {
})
getCityList({}).then(response => {
})
},
methods: {
/** 获取产品类型列表 */
getTypeList() {
getProductTypeList().then(response => {
this.typeList = response.data;
})
},
/**获取所有城市列表 */
getAllCityList() {
getCityList({}).then(response => {
let cityList = response.data;
for(let index in cityList) {
let city = cityList[index];
if(city.type == '1') { //进口,目的地
this.destCityList.push(city);
} else if(city.type == '2') { //出口,始发地
this.startCityList.push(city);
} else if(city.type == '3') { //进出口
this.destCityList.push(city);
this.startCityList.push(city);
}
}
})
},
/**获取已开通路线列表 */
getOpenedRouterList() {
openedRouterList(this.routeParams).then(response => {
this.routedList = response.data;
this.setDefaultSelect();
})
},
/**获取所有货币列表 */
requestCurrencyList() {
getCurrencyList().then(response => {
this.currecyList = response.data;
})
},
/**获取所有单位列表 */
requestUnitList() {
getUnitList().then(response => {
this.unitList = response.data;
})
},
handleSelectionChange(val) {
this.lineList = val;
},
/**运输线路改变 */
transportTypeChange(newVal) {
this.routeParams.transportType = this.form.transportType;
this.getOpenedRouterList();
},
/**始发地改变 */
startCityChange(newVal) {
this.routeParams.startCityId = this.form.startCityId;
this.getOpenedRouterList();
},
/**目的地改变 */
destCityChange(newVal) {
this.routeParams.destCityId = this.form.destCityId;
this.getOpenedRouterList();
},
handleStatusChange(row) {
updateProductPrice(row).then(() => {
this.$modal.msgSuccess("修改成功");
}).catch(function() {
row.auditStatus = row.auditStatus === AuditStatusEnum.PASS ? AuditStatusEnum.NOT_PASS : AuditStatusEnum.PASS;
});
},
/** 查询列表 */
getList() {
this.loading = true;
......@@ -236,6 +512,22 @@ export default {
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.routeParams = {};
this.getOpenedRouterList();
this.form.typeId = this.product.typeId;
this.form.titleZh = this.product.titleZh;
this.form.titleEn = this.product.titleEn;
if(this.currecyList) {
let priceUnitId = this.currecyList[0].id;
this.form.transportPriceUnit = priceUnitId;
this.form.clearancePriceUnit = priceUnitId;
}
if(this.unitList) {
let volumeUnitId = this.unitList[0].id;
this.form.transportVolumeUnit = volumeUnitId;
this.form.clearanceVolumeUnit = volumeUnitId;
}
this.isUpdate = false;
this.open = true;
this.title = "添加产品价格";
},
......@@ -243,18 +535,55 @@ export default {
handleUpdate(row) {
this.reset();
const id = row.id;
let lineId = row.warehouseLineId;
this.routeParams = {lineId: lineId};
this.getOpenedRouterList();
getProductPrice(id).then(response => {
this.form = response.data;
this.form.typeId = this.product.typeId;
this.form.titleZh = this.product.titleZh;
this.form.titleEn = this.product.titleEn;
this.isUpdate = true;
this.open = true;
this.title = "修改产品价格";
});
},
checkSelectable() {
return !this.isUpdate;
},
setDefaultSelect() {
let vm = this;
setTimeout(() => {
// 修改线路价格,选中已经选择的
if(vm.isUpdate && vm.routedList && vm.routedList.length) {
vm.$refs.routeTable.toggleRowSelection(vm.routedList[0]);
}
}, 300);
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
}
if(!this.lineList || !this.lineList.length) {
this.$message.error('请选择线路');
return;
}
let lineIdList = [];
this.lineList.map((item) => {
lineIdList.push(item.id);
return item;
});
this.form.lineIdList = lineIdList;
// 修改的提交
if (this.form.id != null) {
updateProductPrice(this.form).then(response => {
......@@ -265,8 +594,9 @@ export default {
return;
}
// 添加的提交
this.form.productId = this.product.id;
createProductPrice(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.$modal.msgSuccess("请求成功");
this.open = false;
this.getList();
});
......@@ -301,3 +631,4 @@ export default {
}
};
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment