Commit b4a2e2ca authored by dragondean@qq.com's avatar dragondean@qq.com

完善修复线路价格bug等

parent 45f2ffc8
......@@ -70,3 +70,22 @@ export function batchUpdateProductPrice(query) {
data: query
})
}
// 批量拉黑
export function batchBlock(query) {
return request({
url: '/ecw/product-price/batchBlock',
method: 'get',
params: query
})
}
// 批量下架
export function batchOff(query) {
return request({
url: '/ecw/product-price/batchOff',
method: 'get',
params: query
})
}
......@@ -10,9 +10,9 @@
:remote-method="remoteMethod"
:loading="loading">
<el-option
v-for="(item, index) in list"
v-for="(item, index) in formattedList"
:key="item.id"
:label="`${item.contactsName}`"
:label="`${item.label}`"
:value="index">
</el-option>
</el-select>
......@@ -44,6 +44,24 @@ export default {
showQuickCreate: false
}
},
computed:{
formattedList(){
return this.list.map(item => {
item.label = item.contactsName
let more = []
if(item.phoneNew){
more.push(item.phoneNew)
}
if(item.email){
more.push(item.email)
}
if(more.length){
item.label += `(${more.join('|')})`
}
return item
})
}
},
watch:{
index(val){
this.$emit('input', val !== null ? this.list[val].customerContactsId: null)
......
......@@ -88,6 +88,20 @@ export default {
exportCityList(){
return this.tradeCityList.filter(item => item.type == 2 || item.type == 3)
},
exportCityIds(){
let ids = []
this.exportCityList.forEach(item => {
ids.push(item.id)
})
return ids
},
importCityIds(){
let ids = []
this.importCityList.forEach(item => {
ids.push(item.id)
})
return ids
},
availChannelList(){
return this.channelList.filter(item => !this.channelId || this.channelId == item.channelId)
},
......@@ -181,9 +195,9 @@ export default {
if(this.importCity){
params.destCityId = this.importCity
}
openedRouterList(params).then(res => {
this.openedRouterList = res.data
})
openedRouterList(params).then(res => this.openedRouterList = res.data.filter(item => {
return this.exportCityIds.indexOf(item.startCityId) > -1 && this.importCityIds.indexOf(item.destCityId) > -1
}))
},
// 切换路线选择
toggleChecker(router, selected){
......
......@@ -111,7 +111,7 @@ export default {
"dayLimit": undefined,
"idList": [],
"isAllProduct": undefined,
"needBook": false,
"needBook": undefined,
"packaging": undefined,
"requirements": undefined,
"square": undefined,
......
......@@ -206,9 +206,9 @@ export default {
selectedRoutes: [], // 勾选的路线渠道
form: {
stepPrice: 0,
advanceStatus: 0,
needBook: 0,
dayLimit: 10000
// advanceStatus: 0,
// needBook: 0,
// dayLimit: 10000
},
specialProducts: [],
priceStepList: [{},{}], // 阶梯价格
......@@ -299,6 +299,10 @@ export default {
if(transportIds.size == 1 && transportIds.has(3)){
this.setDefaultVolumeUnit(6)
}else this.setDefaultVolumeUnit(7)
},
'form.needBook'(val){
if(val) this.$set(this.form, 'dayLimit', 10000)
else delete this.form.dayLimit
}
},
async created() {
......
......@@ -23,7 +23,7 @@
:key="item.lineId"
:value="'【' + getDictDataLabel(DICT_TYPE.ECW_TRANSPORT_TYPE, item.warehouseLineDO.transportType) + '】从【' + item.warehouseLineDO.startTitleZh + '】发往【' + item.warehouseLineDO.destTitleZh + '】'"
disabled/>
</el-form-item>--
</el-form-item>-->
<!--多条路线批量修改-->
<el-form-item label="路线" prop="lineChannelList" v-if="lineList.length">
<template v-if="lineList.length == 1">
......@@ -50,7 +50,8 @@
</el-checkbox-group>
</el-form-item>
<routers-selector v-if="!$route.query.ids" v-model="selectedRoutes" />
<!--有路线则不显示路线选择器-->
<routers-selector v-else v-model="selectedRoutes" />
<el-card style="margin-bottom: 10px">
<div slot="header" style="font-size:20px;">
......@@ -327,11 +328,25 @@ export default {
item.clearanceVolumeUnit = val
})
},
'form.transportPriceUnit'(val){
this.specialProducts.forEach(item => {
item.transportPriceUnit = val
})
},
'form.clearancePriceUnit'(val){
this.specialProducts.forEach(item => {
item.clearancePriceUnit = val
})
},
'form.allVolumeUnit'(val){
this.specialProducts.forEach(item => {
item.allVolumeUnit = val
})
},
'form.needBook'(val){
if(val) this.$set(this.form, 'dayLimit', 10000)
else delete this.form.dayLimit
},
selectedRoutes(routers) {
let transportIds = []
routers.forEach(item => {
......@@ -349,49 +364,47 @@ export default {
}
},
async created() {
// 修改回显
// action=batchUpdate 表示批量修改单个商品的价格(一条或者多条),如果没有ids显示路线选择组件,否则不显示路线组件
// action=update 表示修改单个商品的单条路线价格,需要回显
if(this.$route.query.action == 'update'){
getProductPrice(this.$route.query.id).then(res => {
this.$set(this, 'form', res.data)
this.lineList = [res.data]
})
}
// action=batchUpdate且ids不为空
if(this.$route.query.action == 'batchUpdate'){
delete this.form.needBook
}
if (this.$route.query.ids) {
let query = {
ids: this.$route.query.ids
}
getProductPriceList(query).then(res => {
this.form = {
productId: res.data[0].productId,
productType: res.data[0].productType,
specialList: res.data[0].specialList,
advanceStatus: res.data[0].advanceStatus,
needBook: res.data[0].needBook,
dayLimit: res.data[0].dayLimit,
containerLocation: res.data[0].containerLocation,
square: res.data[0].square
}
this.lineList = res.data
})
}else{
this.productDisabled = false
}
// 获取类型列表
getProductTypeList().then(res => this.productTypeList = res.data)
// 未指定商品则不禁用商品选择
if(!this.$route.query.product_id){
this.productDisabled = false
}
// 获取类型列表
getProductTypeList().then(res => this.productTypeList = res.data)
if (this.$route.query.product_type) {
this.$set(this.form, 'productType', +this.$route.query.product_type)
}
if (this.$route.query.product_id) {
this.$set(this.form, 'productId', +this.$route.query.product_id)
/*
getProduct(this.$route.query.product_id).then(res => {
this.product = res.data
}) */
}
if (this.$route.query.product_type) {
this.$set(this.form, 'productType', +this.$route.query.product_type)
}
if (this.$route.query.product_id) {
this.$set(this.form, 'productId', +this.$route.query.product_id)
}
// 默认费用单位
// 修改单条路线不回显单位
if(this.$route.query.action !== 'update'){
this.setDefaultVolumeUnit(7)
}
/* // 指定产品
else
} */
getCurrencyList().then(res => this.currencyList = res.data)
getUnitList().then(res => this.unitList = res.data)
......@@ -420,8 +433,12 @@ export default {
return;
}
// 只有新增的时候做判断
if (!this.$route.query.ids && (!this.selectedRoutes || !this.selectedRoutes.length)) {
// 只有修改单条路线的时候,不需要选择路线
/* if (this.$route.query.action !== 'update' && (!this.selectedRoutes || !this.selectedRoutes.length)) {
this.$message.error('请选择线路');
return;
} */
if(!this.lineList.length && (!this.selectedRoutes || !this.selectedRoutes.length)) {
this.$message.error('请选择线路');
return;
}
......@@ -434,14 +451,25 @@ export default {
data.priceStepList = this.priceStepList
}
// 修改的提交
// 修改单条路线
if (this.$route.query.action == 'update') {
return updateProductPrice(data).then(res => {
this.$modal.msgSuccess("请求成功");
this.$router.back()
})
}
// 批量修改(单个商品的单个路线,多个路线,或者全部路线)的提交
if (this.$route.query.action == 'batchUpdate') {
// 指定一条路线
if(this.lineList.length == 1){
data.lineChannelList = {
lineId: this.lineList[0].warehouseLineId,
shippingChannelId: this.lineList[0].shippingChannelId || 0
}
}else{
}
// 指定多条路线的需要过滤未勾选的
else if(this.lineList.length > 1){
data.lineChannelList = []
this.lineList.forEach(item => {
if(this.checkList.indexOf(item.id) > -1){
......@@ -453,6 +481,10 @@ export default {
}
})
}
// 未指定路线的从路线选择组件里获取
if(!this.lineList.length){
data.lineChannelList = this.selectedRoutes
}
if(data.lineChannelList.length < 1){
return this.$message.error('请选择需要修改的路线')
}
......@@ -461,7 +493,6 @@ export default {
this.$modal.msgSuccess("修改成功");
this.$router.replace('/product/product-price?' + (new URLSearchParams(this.$route.query)).toString())
})
return;
}
// 添加的提交
......
......@@ -3,16 +3,16 @@
<div class="page-title">{{$route.query.product_id ? productTitle + '-' : '全部'}}路线价格列表</div>
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="商品编码" prop="productCode" v-if="!$route.query.product_id">
<!-- <el-form-item label="商品编码" prop="productCode" v-if="!$route.query.product_id">
<el-input v-model="queryParams.productCode" placeholder="请输入商品编码" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="海关编码" prop="customsCode" v-if="!$route.query.product_id">
<el-input v-model="queryParams.customsCode" placeholder="请输入海关编码" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
</el-form-item> -->
<el-form-item label="商品名称" prop="titleZh" v-if="!$route.query.product_id">
<el-input v-model="queryParams.titleZh" placeholder="请输入商品名称" clearable @keyup.enter.native="handleQuery"/>
<el-input v-model="queryParams.titleZh" placeholder="请输入中英文名称、商品编码、海关编码" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="商品类型" prop="typeId" v-if="!$route.query.product_id">
......@@ -20,18 +20,18 @@
<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="attrId" v-if="!$route.query.product_id">
<!-- <el-form-item label="商品属性" prop="attrId" v-if="!$route.query.product_id">
<el-select v-model="queryParams.attrId" placeholder="选择商品属性" clearable>
<el-option v-for="attr in attrList" :key="attr.id" :label="attr.attrName" :value="attr.id"/>
</el-select>
</el-form-item>
<el-form-item label="商品特性" prop="attrId" v-if="!$route.query.product_id">
// TODO
</el-form-item>
</el-form-item> -->
<el-form-item label="运输方式" prop="transportType">
<dict-selector :type="DICT_TYPE.ECW_TRANSPORT_TYPE" v-model="queryParams.transportType" formatter="number" />
</el-form-item>
<el-form-item label="空运渠道" prop="shippingChannelId">
<el-form-item label="出货渠道" prop="shippingChannelId">
<el-select v-model="queryParams.shippingChannelId" clearable>
<el-option v-for="item in channelList" :key="item.id" :label="item.nameZh" :value="item.channelId" />
</el-select>
......@@ -68,8 +68,8 @@
<el-col :span="1.5">
<!--未指定商品-->
<el-button v-if="!$route.query.product_id" type="primary" plain icon="el-icon-setting" size="mini" @click="handleBatchEdit">批量设置价格</el-button>
<el-button v-if="!$route.query.product_id" type="primary" plain icon="el-icon-setting" size="mini" @click="handleBatchEdit" :disabled="multiple">批量加入黑名单</el-button>
<el-button v-if="!$route.query.product_id" type="primary" plain icon="el-icon-setting" size="mini" @click="handleBatchEdit" :disabled="multiple">批量下架</el-button>
<el-button v-if="!$route.query.product_id" type="primary" plain icon="el-icon-setting" size="mini" @click="batchBlock" :disabled="multiple">批量加入黑名单</el-button>
<el-button v-if="!$route.query.product_id" type="primary" plain icon="el-icon-setting" size="mini" @click="batchOff" :disabled="multiple">批量下架</el-button>
<!--指定商品-->
<el-button v-if="$route.query.product_id" type="primary" plain icon="el-icon-setting" size="mini" @click="batchSetSingleProductPrice">批量设置单个商品的路线路线</el-button>
......@@ -86,15 +86,15 @@
<el-table-column type="selection" width="55" align="center"></el-table-column>
<el-table-column label="序号" prop="id" width="50" />
<el-table-column label="商品编码" align="center" prop="productCode" v-if="!$route.query.product_id">
<el-table-column label="商品编码" align="center" prop="productCode" >
<template slot-scope="{row}">
<div>
<el-link type="primary" @click.native="handleUpdate(scope.row)">
{{ row.productDO ? row.productDO.productCode : '无productDO字段' }}
</div>
</el-link>
</template>
</el-table-column>
<el-table-column label="海关编码" align="center" prop="customsCode" v-if="!$route.query.product_id">
<el-table-column label="海关编码" align="center" prop="customsCode">
<template slot-scope="{row}">
<div>
{{ row.productDO ? row.productDO.customsCode : '无productDO字段' }}
......@@ -102,17 +102,17 @@
</template>
</el-table-column>
<el-table-column label="商品类型" align="center" prop="typeId" v-if="!$route.query.product_id">
<el-table-column label="商品类型" align="center" prop="typeId">
<template slot-scope="{row}">
<span>{{ row.productDO ? getTypeName(row.productDO.typeId) : '无productDO字段' }}</span>
</template>
</el-table-column>
<el-table-column label="商品名称" align="center" prop="productName" v-if="!$route.query.product_id">
<el-table-column label="商品名称" align="center" prop="productName">
<template slot-scope="{row}">
<div>
<el-link type="primary" @click.native="handleUpdate(scope.row)">
{{ row.productDO ? row.productDO.titleZh + '/' + row.productDO.titleEn : '无productDO字段' }}
</div>
</el-link>
</template>
</el-table-column>
......@@ -164,7 +164,7 @@
<template slot-scope="scope">
<div>
<!-- {{ getAdvanceStatuTitle(scope.row.advanceStatus) }} -->
<dict-tag :type="DICT_TYPE.ADVANCE_STATUS" :value="scope.row.advanceStatus"></dict-tag>
<dict-tag :type="DICT_TYPE.ECW_PAY_ADVANCE" :value="scope.row.needPay"></dict-tag>
</div>
</template>
</el-table-column>
......@@ -174,11 +174,11 @@
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['ecw:product-price:update']">编辑</el-button>
<el-button v-if="!$route.query.product_id" size="mini" type="text" icon="el-icon-edit" @click="updateStatus(scope.row, 'blacklist')"
<el-button size="mini" type="text" icon="el-icon-edit" @click="updateStatus(scope.row, 'blacklist')"
>{{ scope.row.blacklist == 0 ? '加入黑名单' : '移除黑名单' }}</el-button>
<el-button v-if="!$route.query.product_id" size="mini" type="text" icon="el-icon-edit" @click="updateStatus(scope.row, 'auditStatus')"
<el-button size="mini" type="text" icon="el-icon-edit" @click="updateStatus(scope.row, 'auditStatus')"
>{{scope.row.auditStatus == AuditStatusEnum.PASS ? '下架' : '上架'}}</el-button>
<el-button v-if="!$route.query.product_id" size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
<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>
......@@ -191,9 +191,9 @@
</template>
<script>
import { createProductPrice, updateProductPrice, deleteProductPrice, getProductPrice, getProductPricePage, exportProductPriceExcel } from "@/api/ecw/productPrice";
import { createProductPrice, updateProductPrice, deleteProductPrice, getProductPrice, getProductPricePage, exportProductPriceExcel, batchBlock, batchOff } from "@/api/ecw/productPrice";
import { openedRouterList } from "@/api/ecw/warehouse";
import { getCityList } from "@/api/ecw/region";
import { getTradeCityList } from "@/api/ecw/region";
import { getProductTypeList } from "@/api/ecw/productType";
import { getProductAttrList } from "@/api/ecw/productAttr";
import { getDictDatas, DICT_TYPE } from '@/utils/dict'
......@@ -221,8 +221,9 @@ export default {
attrList:[],
typeList: [],
product: null,
startCityList: [], //始发地城市
destCityList: [], //目的地城市
cityList: [],
/* startCityList: [], //始发地城市
destCityList: [], //目的地城市 */
routedList: [], //已开头路线列表
currecyList: [], //货币列表
unitList: [], //单位列表
......@@ -369,23 +370,27 @@ export default {
}
},
/* getAdvanceStatuTitle() {
return value => {
for(let index in this.advanceStatusDictDatas) {
let dictItem = this.advanceStatusDictDatas[index];
if(dictItem.value === '' + value) {
return dictItem.label;
}
}
}
} */
startCityList(){
return this.cityList.filter(item => item.type == 2 || item.type == 3)
},
destCityList(){
return this.cityList.filter(item => item.type == 1 || item.type == 3)
},
},
activated() {
console.log('activated')
/* console.log('activated', this.product.id)
this.$set(this.queryParams, 'typeId', +this.$route.query.product_type || null)
this.handleQuery()
let productId = this.product?.id
console.log(this.$route.query.product_id, productId, this.$route.query.product_id != productId)
if(this.$route.query.product_id != productId){
this.queryParams = {
pageNo: 1,
pageSize: 10
}
}
this.handleQuery() */
},
watch:{
'$route.query.product_id'(){
......@@ -393,26 +398,20 @@ export default {
if(!this.$route.query.product_id){
return this.product = null
}
if(!this.product || this.$route.query.product_id == this.product.id){
let productId = this.product?.id
if(this.$route.query.product_id != productId){
this.queryParams = {
pageNo: 1,
pageSize: 10
}
getProduct(this.$route.query.product_id).then(res => {
this.product = res.data
})
this.handleQuery()
}
}
},
created() {
// this.transportDatas = getDictDatas(DICT_TYPE.ECW_TRANSPORT_TYPE);
// console.log(this.transportDatas);
/* let productJson = localStorage.getItem('product');
// console.log(productJson);
this.product = eval('(' + productJson + ')'); */
/* let typeListJson = localStorage.getItem('typeList');
if(typeListJson) {
this.typeList = eval('(' + typeListJson + ')');
} else {
} */
if(this.$route.query.product_type){
this.$set(this.queryParams, 'typeId', +this.$route.query.product_type);
}
......@@ -424,12 +423,11 @@ export default {
}else{
// 不指定产品获取类型等信息
this.getTypeList();
//获取城市列表
this.getAllCityList();
this.getAttrList();
}
//获取城市列表
this.getAllCityList();
this.getChannelList()
//获取货币列表
......@@ -464,19 +462,8 @@ export default {
/**获取所有城市列表 */
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);
}
}
getTradeCityList({}).then(response => {
this.cityList = response.data;
})
},
......@@ -582,8 +569,9 @@ export default {
return this.$router.push('../../lineProject/product-price/edit?' + (new URLSearchParams(this.$route.query)).toString())
},
// 批量修改单个商品的价格(一条或者多条,后者全部路线)
batchSetSingleProductPrice(){
this.$router.push('../../lineProject/product-price/edit?action=update&product_id=' + this.$route.query.product_id + '&ids=' + this.ids)
this.$router.push('../../lineProject/product-price/edit?action=batchUpdate&product_id=' + this.$route.query.product_id + '&ids=' + this.ids)
},
// 批量设置路线
handleBatchEdit() {
......@@ -591,7 +579,7 @@ export default {
},
/** 修改按钮操作 */
handleUpdate(row) {
return this.$router.push('../../lineProject/product-price/edit?ids=' + row.id)
return this.$router.push('../../lineProject/product-price/edit?action=update&id=' + row.id)
},
updateStatus(row, type) {
......@@ -696,7 +684,20 @@ export default {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
}
},
batchBlock(){
batchBlock({ids: this.ids.join(',')}).then(res => {
this.$message.success(res.msg || '操作成功')
this.handleQuery()
})
},
batchOff(){
batchOff({ids: this.ids.join(',')}).then(res => {
this.$message.success(res.msg || '操作成功')
this.handleQuery()
})
},
}
};
</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