|
@@ -74,16 +74,44 @@
|
|
|
<el-form-item label="客户地址" prop="province" :required="true">
|
|
|
<el-row>
|
|
|
<el-col :span="5" style="margin-right: 12px;">
|
|
|
- <el-input type="text" v-model="formData.province" disabled placeholder="请选择省"></el-input>
|
|
|
+ <el-select v-model="formData.provinceId" placeholder="请选择省" style="width: 100%;" @change="changeProvince">
|
|
|
+ <el-option
|
|
|
+ v-for="item in provinceList.map(v => ({ value: v.id, label: v.name }))"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
</el-col>
|
|
|
<el-col :span="5" style="margin-right: 12px;">
|
|
|
- <el-input type="text" v-model="formData.city" disabled placeholder="请选择市"></el-input>
|
|
|
+ <el-select v-model="formData.cityId" placeholder="请选择市" style="width: 100%;" @change="changeCity">
|
|
|
+ <el-option
|
|
|
+ v-for="item in cityList.map(v => ({ value: v.id, label: v.name }))"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
</el-col>
|
|
|
<el-col :span="5" style="margin-right: 12px;">
|
|
|
- <el-input type="text" v-model="formData.area" disabled placeholder="请选择区"></el-input>
|
|
|
+ <el-select v-model="formData.areaId" placeholder="请选择区" style="width: 100%;" @change="changeArea">
|
|
|
+ <el-option
|
|
|
+ v-for="item in areaList.map(v => ({ value: v.id, label: v.name }))"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
- <el-input type="text" v-model="formData.street" disabled placeholder="请选择街道"></el-input>
|
|
|
+ <el-select v-model="formData.streetId" placeholder="请选择街道" style="width: 100%;" @change="changeStreet">
|
|
|
+ <el-option
|
|
|
+ v-for="item in streetList.map(v => ({ value: v.id, label: v.name }))"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</el-form-item>
|
|
@@ -630,11 +658,11 @@ export default {
|
|
|
this.$nextTick(()=>{
|
|
|
this.getOrderTypeList();
|
|
|
this.getGoodsSpecList();
|
|
|
- this.getinitlbslist();
|
|
|
this.formType = type
|
|
|
this.formVisible = true
|
|
|
if (type == 'add') {
|
|
|
this.formDialogType = 0
|
|
|
+ this.getinitlbslist();
|
|
|
} else if(type == 'edit'){
|
|
|
this.formDialogType = 1
|
|
|
getOfflineOrderDetail({ orderId }).then(res => {
|
|
@@ -642,6 +670,7 @@ export default {
|
|
|
res.data.orderSmallTypeText = res.data.orderDetails[0]?.orderSmallTypeText;
|
|
|
this.goodsList = res.data.orderDetails;
|
|
|
Object.assign(this.formData, res.data)
|
|
|
+ this.getinitlbslist();
|
|
|
})
|
|
|
}
|
|
|
})
|
|
@@ -656,6 +685,14 @@ export default {
|
|
|
formCancel() {
|
|
|
this.formVisible = false
|
|
|
this.$refs?.formRef?.resetFields()
|
|
|
+ this.formData.province = '';
|
|
|
+ this.formData.provinceId = '';
|
|
|
+ this.formData.city = '';
|
|
|
+ this.formData.cityId = '';
|
|
|
+ this.formData.area = '';
|
|
|
+ this.formData.areaId = '';
|
|
|
+ this.formData.street = '';
|
|
|
+ this.formData.streetId = '';
|
|
|
this.formData.orderId = '';
|
|
|
this.formData.fileUrl = '';
|
|
|
this.goodsList = [];
|
|
@@ -764,33 +801,35 @@ export default {
|
|
|
// 初始化请求省市区街道下拉选项数据
|
|
|
lbsAmapRegion({ pid: 0 }).then(res => {
|
|
|
this.provinceList = res.data
|
|
|
- // 创建工单时获取ip地址定位赋值
|
|
|
- if (!this.id && this.$IpAdd.province) {
|
|
|
- var item = this.provinceList.find(item => item.name === this.$IpAdd.province)
|
|
|
- if (item) {
|
|
|
- this.formData.provinceId = item.id
|
|
|
- this.formData.province = item.name
|
|
|
+ if (this.formData.province) {
|
|
|
+ var provinceItem = this.provinceList.find(o => o.name === this.formData.province)
|
|
|
+ if (provinceItem) {
|
|
|
+ this.formData.provinceId = provinceItem.id
|
|
|
}
|
|
|
- }
|
|
|
- if (this.formData.provinceId) {
|
|
|
lbsAmapRegion({ pid: this.formData.provinceId }).then(res => {
|
|
|
this.cityList = res.data
|
|
|
- // 创建工单时获取ip地址定位赋值
|
|
|
- if (!this.id && this.$IpAdd.city) {
|
|
|
- var item2 = this.cityList.find(item => item.name === this.$IpAdd.city)
|
|
|
- if (item2) {
|
|
|
- this.formData.cityId = item2.id
|
|
|
- this.formData.city = item2.name
|
|
|
+ if (this.formData.city) {
|
|
|
+ var cityItem = this.cityList.find(o => o.name === this.formData.city)
|
|
|
+ if (cityItem) {
|
|
|
+ this.formData.cityId = cityItem.id
|
|
|
}
|
|
|
- }
|
|
|
- if (this.formData.cityId) {
|
|
|
lbsAmapRegion({ pid: this.formData.cityId }).then(res => {
|
|
|
this.areaList = res.data
|
|
|
- })
|
|
|
- }
|
|
|
- if (this.formData.areaId) {
|
|
|
- lbsAmapRegion({ pid: this.formData.areaId }).then(res => {
|
|
|
- this.streetList = res.data
|
|
|
+ if (this.formData.area) {
|
|
|
+ var areaItem = this.areaList.find(o => o.name === this.formData.area)
|
|
|
+ if (areaItem) {
|
|
|
+ this.formData.areaId = areaItem.id
|
|
|
+ }
|
|
|
+ lbsAmapRegion({ pid: this.formData.areaId }).then(res => {
|
|
|
+ this.streetList = res.data
|
|
|
+ if (this.formData.street) {
|
|
|
+ var streetItem = this.streetList.find(o => o.name === this.formData.street)
|
|
|
+ if (streetItem) {
|
|
|
+ this.formData.streetId = streetItem.id
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
})
|
|
@@ -798,6 +837,73 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
|
|
|
+ delDataK(num) {
|
|
|
+ if (num <= 1) {
|
|
|
+ // 删除市
|
|
|
+ this.formData.cityId = ''
|
|
|
+ this.formData.city = ''
|
|
|
+ // 删除市选项
|
|
|
+ this.cityList = []
|
|
|
+ }
|
|
|
+ if (num <= 2) {
|
|
|
+ // 删除区
|
|
|
+ this.formData.areaId = ''
|
|
|
+ this.formData.area = ''
|
|
|
+ // 删除区选项
|
|
|
+ this.areaList = []
|
|
|
+ }
|
|
|
+ if (num <= 3) {
|
|
|
+ // 删除街道
|
|
|
+ this.formData.streetId = ''
|
|
|
+ this.formData.street = ''
|
|
|
+ // 删除街道选项
|
|
|
+ this.streetList = []
|
|
|
+ }
|
|
|
+ // 删除gps地址
|
|
|
+ this.formData.gpsAddress = ''
|
|
|
+ },
|
|
|
+
|
|
|
+ // 更改省
|
|
|
+ changeProvince(val) {
|
|
|
+ // 获取省名称
|
|
|
+ this.formData.province = this.provinceList.find(item => item.id === val)?.name || ''
|
|
|
+ // 清除市区街道以及详细地址数据
|
|
|
+ this.delDataK(1)
|
|
|
+ lbsAmapRegion({ pid: val }).then(res => {
|
|
|
+ this.cityList = res.data
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ // 更改市
|
|
|
+ changeCity(val) {
|
|
|
+ // 获取市名称
|
|
|
+ this.formData.city = this.cityList.find(item => item.id === val).name
|
|
|
+ // 清除区街道以及详细地址数据
|
|
|
+ this.delDataK(2)
|
|
|
+ lbsAmapRegion({ pid: val }).then(res => {
|
|
|
+ this.areaList = res.data
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ // 更改区
|
|
|
+ changeArea(val) {
|
|
|
+ // 获取区名称
|
|
|
+ this.formData.area = this.areaList.find(item => item.id === val).name
|
|
|
+ // 清除街道以及详细地址数据
|
|
|
+ this.delDataK(3)
|
|
|
+ lbsAmapRegion({ pid: val }).then(res => {
|
|
|
+ this.streetList = res.data
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ // 更改街道
|
|
|
+ changeStreet(val) {
|
|
|
+ // 获取街道名称
|
|
|
+ this.formData.street = this.streetList.find(item => item.id === val).name
|
|
|
+ // 清除详细地址数据
|
|
|
+ this.delDataK(4)
|
|
|
+ },
|
|
|
+
|
|
|
selectAddress(data){
|
|
|
console.log(data);
|
|
|
this.formData.lng = data.center[0]
|