Commit 96b47f06 authored by xiamw's avatar xiamw

价格列表查询条件优化

parent 256d7cfb
......@@ -33,11 +33,58 @@
</el-select>
</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-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 :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" />
......@@ -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: {
......@@ -427,6 +488,191 @@ export default {
};
},
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')
......@@ -527,6 +773,10 @@ export default {
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 => {
......
......@@ -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