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;
}
// 添加的提交
......
This diff is collapsed.
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