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

完善修复线路价格bug等

parent 45f2ffc8
...@@ -70,3 +70,22 @@ export function batchUpdateProductPrice(query) { ...@@ -70,3 +70,22 @@ export function batchUpdateProductPrice(query) {
data: 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 @@ ...@@ -10,9 +10,9 @@
:remote-method="remoteMethod" :remote-method="remoteMethod"
:loading="loading"> :loading="loading">
<el-option <el-option
v-for="(item, index) in list" v-for="(item, index) in formattedList"
:key="item.id" :key="item.id"
:label="`${item.contactsName}`" :label="`${item.label}`"
:value="index"> :value="index">
</el-option> </el-option>
</el-select> </el-select>
...@@ -44,6 +44,24 @@ export default { ...@@ -44,6 +44,24 @@ export default {
showQuickCreate: false 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:{ watch:{
index(val){ index(val){
this.$emit('input', val !== null ? this.list[val].customerContactsId: null) this.$emit('input', val !== null ? this.list[val].customerContactsId: null)
......
...@@ -88,6 +88,20 @@ export default { ...@@ -88,6 +88,20 @@ export default {
exportCityList(){ exportCityList(){
return this.tradeCityList.filter(item => item.type == 2 || item.type == 3) 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(){ availChannelList(){
return this.channelList.filter(item => !this.channelId || this.channelId == item.channelId) return this.channelList.filter(item => !this.channelId || this.channelId == item.channelId)
}, },
...@@ -181,9 +195,9 @@ export default { ...@@ -181,9 +195,9 @@ export default {
if(this.importCity){ if(this.importCity){
params.destCityId = this.importCity params.destCityId = this.importCity
} }
openedRouterList(params).then(res => { openedRouterList(params).then(res => this.openedRouterList = res.data.filter(item => {
this.openedRouterList = res.data return this.exportCityIds.indexOf(item.startCityId) > -1 && this.importCityIds.indexOf(item.destCityId) > -1
}) }))
}, },
// 切换路线选择 // 切换路线选择
toggleChecker(router, selected){ toggleChecker(router, selected){
......
...@@ -111,7 +111,7 @@ export default { ...@@ -111,7 +111,7 @@ export default {
"dayLimit": undefined, "dayLimit": undefined,
"idList": [], "idList": [],
"isAllProduct": undefined, "isAllProduct": undefined,
"needBook": false, "needBook": undefined,
"packaging": undefined, "packaging": undefined,
"requirements": undefined, "requirements": undefined,
"square": undefined, "square": undefined,
......
...@@ -206,9 +206,9 @@ export default { ...@@ -206,9 +206,9 @@ export default {
selectedRoutes: [], // 勾选的路线渠道 selectedRoutes: [], // 勾选的路线渠道
form: { form: {
stepPrice: 0, stepPrice: 0,
advanceStatus: 0, // advanceStatus: 0,
needBook: 0, // needBook: 0,
dayLimit: 10000 // dayLimit: 10000
}, },
specialProducts: [], specialProducts: [],
priceStepList: [{},{}], // 阶梯价格 priceStepList: [{},{}], // 阶梯价格
...@@ -299,6 +299,10 @@ export default { ...@@ -299,6 +299,10 @@ export default {
if(transportIds.size == 1 && transportIds.has(3)){ if(transportIds.size == 1 && transportIds.has(3)){
this.setDefaultVolumeUnit(6) this.setDefaultVolumeUnit(6)
}else this.setDefaultVolumeUnit(7) }else this.setDefaultVolumeUnit(7)
},
'form.needBook'(val){
if(val) this.$set(this.form, 'dayLimit', 10000)
else delete this.form.dayLimit
} }
}, },
async created() { async created() {
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
:key="item.lineId" :key="item.lineId"
:value="'【' + getDictDataLabel(DICT_TYPE.ECW_TRANSPORT_TYPE, item.warehouseLineDO.transportType) + '】从【' + item.warehouseLineDO.startTitleZh + '】发往【' + item.warehouseLineDO.destTitleZh + '】'" :value="'【' + getDictDataLabel(DICT_TYPE.ECW_TRANSPORT_TYPE, item.warehouseLineDO.transportType) + '】从【' + item.warehouseLineDO.startTitleZh + '】发往【' + item.warehouseLineDO.destTitleZh + '】'"
disabled/> disabled/>
</el-form-item>-- </el-form-item>-->
<!--多条路线批量修改--> <!--多条路线批量修改-->
<el-form-item label="路线" prop="lineChannelList" v-if="lineList.length"> <el-form-item label="路线" prop="lineChannelList" v-if="lineList.length">
<template v-if="lineList.length == 1"> <template v-if="lineList.length == 1">
...@@ -50,7 +50,8 @@ ...@@ -50,7 +50,8 @@
</el-checkbox-group> </el-checkbox-group>
</el-form-item> </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"> <el-card style="margin-bottom: 10px">
<div slot="header" style="font-size:20px;"> <div slot="header" style="font-size:20px;">
...@@ -327,11 +328,25 @@ export default { ...@@ -327,11 +328,25 @@ export default {
item.clearanceVolumeUnit = val 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){ 'form.allVolumeUnit'(val){
this.specialProducts.forEach(item => { this.specialProducts.forEach(item => {
item.allVolumeUnit = val item.allVolumeUnit = val
}) })
}, },
'form.needBook'(val){
if(val) this.$set(this.form, 'dayLimit', 10000)
else delete this.form.dayLimit
},
selectedRoutes(routers) { selectedRoutes(routers) {
let transportIds = [] let transportIds = []
routers.forEach(item => { routers.forEach(item => {
...@@ -349,49 +364,47 @@ export default { ...@@ -349,49 +364,47 @@ export default {
} }
}, },
async created() { 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) { if (this.$route.query.ids) {
let query = { let query = {
ids: this.$route.query.ids ids: this.$route.query.ids
} }
getProductPriceList(query).then(res => { 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 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) { if (this.$route.query.product_type) {
this.$set(this.form, 'productType', +this.$route.query.product_type) this.$set(this.form, 'productType', +this.$route.query.product_type)
} }
if (this.$route.query.product_id) { if (this.$route.query.product_id) {
this.$set(this.form, 'productId', +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.action !== 'update'){
this.setDefaultVolumeUnit(7) this.setDefaultVolumeUnit(7)
} }
/* // 指定产品
else
} */
getCurrencyList().then(res => this.currencyList = res.data) getCurrencyList().then(res => this.currencyList = res.data)
getUnitList().then(res => this.unitList = res.data) getUnitList().then(res => this.unitList = res.data)
...@@ -420,8 +433,12 @@ export default { ...@@ -420,8 +433,12 @@ export default {
return; 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('请选择线路'); this.$message.error('请选择线路');
return; return;
} }
...@@ -434,14 +451,25 @@ export default { ...@@ -434,14 +451,25 @@ export default {
data.priceStepList = this.priceStepList data.priceStepList = this.priceStepList
} }
// 修改的提交 // 修改单条路线
if (this.$route.query.action == 'update') { 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){ if(this.lineList.length == 1){
data.lineChannelList = { data.lineChannelList = {
lineId: this.lineList[0].warehouseLineId, lineId: this.lineList[0].warehouseLineId,
shippingChannelId: this.lineList[0].shippingChannelId || 0 shippingChannelId: this.lineList[0].shippingChannelId || 0
} }
}else{ }
// 指定多条路线的需要过滤未勾选的
else if(this.lineList.length > 1){
data.lineChannelList = [] data.lineChannelList = []
this.lineList.forEach(item => { this.lineList.forEach(item => {
if(this.checkList.indexOf(item.id) > -1){ if(this.checkList.indexOf(item.id) > -1){
...@@ -453,6 +481,10 @@ export default { ...@@ -453,6 +481,10 @@ export default {
} }
}) })
} }
// 未指定路线的从路线选择组件里获取
if(!this.lineList.length){
data.lineChannelList = this.selectedRoutes
}
if(data.lineChannelList.length < 1){ if(data.lineChannelList.length < 1){
return this.$message.error('请选择需要修改的路线') return this.$message.error('请选择需要修改的路线')
} }
...@@ -461,7 +493,6 @@ export default { ...@@ -461,7 +493,6 @@ export default {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.$router.replace('/product/product-price?' + (new URLSearchParams(this.$route.query)).toString()) this.$router.replace('/product/product-price?' + (new URLSearchParams(this.$route.query)).toString())
}) })
return; 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