Commit 96b47f06 authored by xiamw's avatar xiamw

价格列表查询条件优化

parent 256d7cfb
......@@ -14,7 +14,7 @@
<el-form-item :label="$t('商品名称')" prop="titleZh">
<el-input v-model="queryParams.titleZh" :placeholder="$t('请输入商品名称')" clearable @keyup.enter.native="handleQuery" onkeyup="this.value=this.value.replace(/\s+/g, '')" />
</el-form-item>
<el-form-item :label="$t('商品类型')" prop="typeId">
<el-select v-model="queryParams.typeId" :placeholder="$t('选择商品类型')" clearable>
<el-option v-for="type in typeList" :key="type.id" :label="type.titleZh" :value="type.id"/>
......@@ -26,31 +26,78 @@
<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="$t('始发地')" 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-option v-for="city in startCityList" :key="city.id" :label="city.titleZh" :value="city.id" />
</el-select>
</el-form-item>
</el-form-item>
<el-form-item :label="$t('目的地')" prop="destCityId">
<!-- <el-form-item :label="$t('目的地')" 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-option v-for="city in destCityList" :key="city.id" :label="city.titleZh" :value="city.id" />
</el-select>
</el-form-item> -->
<el-form-item :label="$t('目的国')" prop="destCountryId">
<el-select
v-model="destCountryId"
multiple
:label="destCountryId"
clearable
@change="handleQuery"
>
<el-option
v-for="item in countryList"
:key="item.id"
:label="$l(item, 'title')"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('目的地')" prop="destCityId">
<el-select v-model="destCityId"
multiple
clearable
@change="handleQuery">
<el-option
v-for="item in AddressCity"
:key="item.shi"
:label="item.shiName"
:value="item.shi"
></el-option>
</el-select>
</el-form-item>
</el-form-item>
<el-form-item :label="$t('目的仓')" prop="destWarehouseId">
<el-select v-model="destWarehouseId"
clearable
multiple
@change="handleQuery">
<el-option
v-for="item in AddressTown"
:key="item.id"
:label="item.titleZh"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('空运渠道')" 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-option v-for="item in channelList" :key="item.id" :label="item.nameZh" :value="item.channelId" />
</el-select>
</el-form-item>
</el-form-item>
<el-form-item label="" prop="blacklist" v-if="false">
<el-checkbox v-model="queryParams.blacklist"
<el-checkbox v-model="queryParams.blacklist"
:true-label="1" :false-label="0">{{$t('黑名单')}}</el-checkbox>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">{{$t('搜索')}}</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">{{$t('重置')}}</el-button>
......@@ -132,10 +179,10 @@
<el-table-column prop="price" :label="$t('价格')" align="center">
<template slot-scope="scope">
<div>
{{$t('海运费')}}:{{ getCurrencySymbol(scope.row.transportPriceUnit) + scope.row.transportPrice}}&nbsp;
{{$t('海运费')}}:{{ getCurrencySymbol(scope.row.transportPriceUnit) + scope.row.transportPrice}}&nbsp;
{{ getCurrencyTitle(scope.row.transportPriceUnit) + '/' + getUnitTitle(scope.row.transportVolumeUnit)}}
<br />
{{$t('清关费')}}:{{ getCurrencySymbol(scope.row.clearancePriceUnit) + scope.row.clearancePrice}}&nbsp;
{{$t('清关费')}}:{{ getCurrencySymbol(scope.row.clearancePriceUnit) + scope.row.clearancePrice}}&nbsp;
{{ getCurrencyTitle(scope.row.clearancePriceUnit) + '/' + getUnitTitle(scope.row.clearanceVolumeUnit)}}
</div>
</template>
......@@ -184,7 +231,7 @@
<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="$t('商品名称')" prop="titleZh">
<el-input v-model="form.titleZh" disabled />
......@@ -198,26 +245,26 @@
<el-col :span="6">
<el-form-item :label="$t('运输方式')" prop="transportType">
<el-select v-model="form.transportType" clearable @change="transportTypeChange">
<el-option v-for="dict in transportDatas" :key="dict.value" :label="$l(dict, 'label')" :value="dict.value" />
<el-option v-for="dict in transportDatas" :key="dict.value" :label="$l(dict, 'label')" :value="dict.value" />
</el-select>
</el-form-item>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item :label="$t('始发地')" prop="startCityId">
<el-select v-model="form.startCityId" clearable @change="startCityChange">
<el-option v-for="city in startCityList" :key="city.id" :label="$l(city, 'title')" :value="city.id" />
<el-option v-for="city in startCityList" :key="city.id" :label="$l(city, 'title')" :value="city.id" />
</el-select>
</el-form-item>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item :label="$t('目的地')" prop="destCityId">
<el-select v-model="form.destCityId" clearable @change="destCityChange">
<el-option v-for="city in destCityList" :key="city.id" :label="$l(city, 'title')" :value="city.id" />
<el-option v-for="city in destCityList" :key="city.id" :label="$l(city, 'title')" :value="city.id" />
</el-select>
</el-form-item>
</el-form-item>
</el-col>
</el-row>
<el-table
......@@ -243,7 +290,7 @@
})}}
</template>
</el-table-column>
</el-table>
<br />
......@@ -252,7 +299,7 @@
<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="$l(currency, 'title')" :value="currency.id" />
<el-option v-for="currency in currecyList" :key="currency.id" :label="$l(currency, 'title')" :value="currency.id" />
</el-select>
</el-col>
......@@ -262,7 +309,7 @@
<el-col :span="4">
<el-select v-model="form.transportVolumeUnit">
<el-option v-for="unit in unitList" :key="unit.id" :label="$l(unit, 'title')" :value="unit.id" />
<el-option v-for="unit in unitList" :key="unit.id" :label="$l(unit, 'title')" :value="unit.id" />
</el-select>
</el-col>
</el-row>
......@@ -272,7 +319,7 @@
<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="$l(currency, 'title')" :value="currency.id" />
<el-option v-for="currency in currecyList" :key="currency.id" :label="$l(currency, 'title')" :value="currency.id" />
</el-select>
</el-col>
......@@ -282,7 +329,7 @@
<el-col :span="4">
<el-select v-model="form.clearanceVolumeUnit">
<el-option v-for="unit in unitList" :key="unit.id" :label="$l(unit, 'title')" :value="unit.id" />
<el-option v-for="unit in unitList" :key="unit.id" :label="$l(unit, 'title')" :value="unit.id" />
</el-select>
</el-col>
</el-row>
......@@ -334,6 +381,7 @@
</template>
<script>
import { getRegionList } from "@/api/ecw/order";
import { createProductPrice, updateProductPrice, deleteProductPrice, getProductPrice, getProductPricePage, exportProductPriceExcel } from "@/api/ecw/productPrice";
import { openedRouterList } from "@/api/ecw/warehouse";
import { getCityList } from "@/api/ecw/region";
......@@ -353,6 +401,15 @@ export default {
},
data() {
return {
AddressCity: [], //目的城市
AddressProvince: [], //省份
AddressTown: [], //目的仓
countryList: [], //目的国
warehouseList: [], //目前仓
objectiveId: [],
//特性列表
attrList:[],
typeList: [],
......@@ -399,6 +456,10 @@ export default {
clearanceVolumeUnit: null,
shippingChannelId: null,
status: null,
destCityId: null, //目的城市
destCountryId: null, //目的国
destWarehouseId: null, //目的仓
objectiveId: null,
},
// 表单参数
form: {
......@@ -423,10 +484,195 @@ export default {
advanceStatusDictDatas: getDictDatas(DICT_TYPE.ADVANCE_STATUS),
AuditStatusEnum: AuditStatusEnum,
locationList: getDictDatas(DICT_TYPE.ECW_CONTAINER_LOCATION),
};
},
watch: {
destCountryId: {
//监听当前地区值的变化,于与上方地区值进行了双向绑定
deep: true, //深度监听
handler() {
//每当值省份值改变时其下地区值进行清空
this.AddressCity = [];
this.AddressTown = [];
this.destWarehouseId = "";
this.destCityId = "";
this.findByprovinceCode();
if (this.destCountryId == "") {
//1 是所有区域,2 国家,3是市,
getRegionList(4, 4)
.then(({ data }) => {
this.AddressCity = data;
})
.catch((error) => {
console.log(error);
});
getRegionList(5, 5)
.then(({ data }) => {
this.AddressTown = data;
})
.catch((error) => {
console.log(error);
});
} else if (
this.destCountryId != "" &&
this.objectiveId == "" &&
this.destWarehouseId == ""
) {
getRegionList(2, this.destCountryId)
.then(({ data }) => {
this.AddressCity = data;
})
.catch((error) => {
console.log(error);
});
getRegionList(5, 5)
.then(({ data }) => {
this.AddressTown = data;
})
.catch((error) => {
console.log(error);
});
}
},
},
destCityId: {
deep: true, //深度监听 目的仓
handler() {
this.AddressTown = [];
this.destWarehouseId = "";
this.findBycityCode();
if (
this.destCityId != "" &&
this.destCountryId != "" &&
this.destWarehouseId == ""
) {
//获取当前城市值id,获取该城市下区域
getRegionList(3, this.destCityId)
.then(({ data }) => {
this.AddressTown = data;
})
.catch((error) => {
console.log(error);
});
} else if (
this.destCountryId == "" &&
this.destCityId == "" &&
this.destWarehouseId == ""
) {
getRegionList(5, 5)
.then(({ data }) => {
this.AddressTown = data;
})
.catch((error) => {
console.log(error);
});
} else if (
this.destCountryId != "" &&
this.destCityId == "" &&
this.destWarehouseId == ""
) {
getRegionList(2, this.destCountryId)
.then(({ data }) => {
this.AddressCity = data;
})
.catch((error) => {
console.log(error);
});
getRegionList(5, 5)
.then(({ data }) => {
this.AddressTown = data;
})
.catch((error) => {
console.log(error);
});
} else if (
this.destCountryId == "" &&
this.destCityId != "" &&
this.destWarehouseId == ""
) {
//获取当前城市值id,获取该城市下区域
getRegionList(3, this.destCityId)
.then(({ data }) => {
this.AddressTown = data;
})
.catch((error) => {
console.log(error);
});
}
},
},
destWarehouseId: {
deep: true, //深度监听
handler() {
if (
this.destCountryId != "" &&
this.destCityId != "" &&
this.destWarehouseId == ""
) {
//获取当前城市值id,获取该城市下区域
getRegionList(3, this.destCityId)
.then(({ data }) => {
this.AddressTown = data;
})
.catch((error) => {
console.log(error);
});
} else if (
this.destCountryId != "" &&
this.destCityId == "" &&
this.destWarehouseId == ""
) {
getRegionList(5, 5)
.then(({ data }) => {
this.AddressTown = data;
})
.catch((error) => {
console.log(error);
});
} else if (
this.destCountryId == "" &&
this.destCityId != "" &&
this.destWarehouseId == ""
) {
getRegionList(3, this.destCityId)
.then(({ data }) => {
this.AddressTown = data;
})
.catch((error) => {
console.log(error);
});
}
},
},
"$route.query.product_id"() {
// if(!this.$route.query.product_id){
// return this.product = null
// }
// 价格列表 跟 商品的价格列表,有时候商品价格列表的路由变动会导致价格列表也执行此处代码,所以做一个判断排除
// https://zentao.test.jdshangmen.com/bug-view-4928.html
if (this.$route.path != this.entryPath) return;
let productId = this.product?.id;
if (this.$route.name === "ProductPrice") {
if (this.$route.query.product_id != productId) {
this.queryParams = {
pageNo: 1,
pageSize: 10,
productId: this.$route.query.product_id,
typeId: this.$route.query.product_type,
transportType: this.$route.query.transportType,
};
}
getProduct(this.$route.query.product_id).then((res) => {
this.product = res.data;
});
this.getList();
}
},
},
computed: {
keyedChannel(){
return arrryToKeyedObjectBy(this.channelList, 'channelId')
......@@ -514,8 +760,8 @@ export default {
created() {
this.queryParams.blacklist = 1;
// this.transportDatas = getDictDatas(DICT_TYPE.ECW_TRANSPORT_TYPE);
// console.log(this.transportDatas);
let productJson = localStorage.getItem('product');
......@@ -524,9 +770,13 @@ export default {
this.getTypeList();
this.getChannelList()
this.getAttrList();
this.getList();
this.getData();
//获取国家列表
this.getCountryList();
//获取城市列表
this.getAllCityList();
//获取货币列表
......@@ -538,6 +788,28 @@ export default {
methods: {
findByprovinceCode() {
//获取当前省份值id,获取该省份下城市 destCountryId provinceCode
getRegionList(2, this.destCountryId)
.then(({ data }) => {
this.AddressCity = data;
})
.catch((error) => {
console.log(error);
});
},
findBycityCode() {
//获取当前城市值id,获取该城市下区域
getRegionList(3, this.objectiveId)
.then(({ data }) => {
this.AddressTown = data;
})
.catch((error) => {
console.log(error);
});
},
getChannelList(){
getChannelList().then(res => this.channelList = res.data)
},
......@@ -555,6 +827,40 @@ export default {
})
},
getData() {
//加载时发起请求获取所有省份值
getRegionList(1, 1)
.then(({ data }) => {
this.AddressProvince = data;
})
.catch((error) => {
console.log(error);
});
//目的城市
getRegionList(4, 4)
.then(({ data }) => {
this.AddressCity = data;
})
.catch((error) => {
console.log(error);
});
//目的仓
getRegionList(5, 5)
.then(({ data }) => {
this.AddressTown = data;
})
.catch((error) => {
console.log(error);
});
},
/* 国家 */
getCountryList() {
getListTree({ treeType: 1 }).then((response) => {
this.countryList = response.data;
});
},
/**获取所有城市列表 */
getAllCityList() {
getCityList({}).then(response => {
......@@ -585,7 +891,7 @@ export default {
requestCurrencyList() {
getCurrencyList().then(response => {
this.currecyList = response.data;
})
})
},
/**获取所有单位列表 */
......@@ -693,11 +999,11 @@ export default {
} else {
row.auditStatus = row.auditStatus === AuditStatusEnum.PASS ? AuditStatusEnum.NOT_PASS : AuditStatusEnum.PASS;
}
});
},
checkSelectable() {
return !this.isUpdate;
},
......@@ -778,4 +1084,4 @@ export default {
}
}
};
</script>
\ No newline at end of file
</script>
......@@ -63,7 +63,7 @@
>
<el-select
v-model="queryParams.attrId"
:placeholder="$t('选择商品类型')"
:placeholder="$t('选择商品属性')"
clearable
@change="handleQuery"
>
......@@ -133,6 +133,7 @@
<el-form-item :label="$t('目的国')" prop="destCountryId">
<el-select
v-model="destCountryId"
multiple
:label="destCountryId"
clearable
@change="handleQuery"
......@@ -147,7 +148,10 @@
</el-select>
</el-form-item>
<el-form-item :label="$t('目的地')" prop="destCityId">
<el-select v-model="destCityId" clearable @change="handleQuery">
<el-select v-model="destCityId"
multiple
clearable
@change="handleQuery">
<el-option
v-for="item in AddressCity"
:key="item.shi"
......@@ -157,7 +161,10 @@
</el-select>
</el-form-item>
<el-form-item :label="$t('目的仓')" prop="destWarehouseId">
<el-select v-model="destWarehouseId" clearable @change="handleQuery">
<el-select v-model="destWarehouseId"
clearable
multiple
@change="handleQuery">
<el-option
v-for="item in AddressTown"
:key="item.id"
......
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