|
@@ -16,9 +16,7 @@
|
|
<el-form-item
|
|
<el-form-item
|
|
label="手机号"
|
|
label="手机号"
|
|
prop="mobile"
|
|
prop="mobile"
|
|
- :rules="[
|
|
|
|
- { required: true, message: '请输入手机号', trigger: 'blur' },
|
|
|
|
- ]"
|
|
|
|
|
|
+ :rules="[{ required: true, message: '请输入手机号', trigger: 'blur' }]"
|
|
>
|
|
>
|
|
<el-input
|
|
<el-input
|
|
v-model.trim="forms.mobile"
|
|
v-model.trim="forms.mobile"
|
|
@@ -26,63 +24,91 @@
|
|
></el-input>
|
|
></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="所在城市" required>
|
|
<el-form-item label="所在城市" required>
|
|
- <br>
|
|
|
|
|
|
+ <br />
|
|
<div class="provinceWrap">
|
|
<div class="provinceWrap">
|
|
<el-form-item
|
|
<el-form-item
|
|
- prop="province"
|
|
|
|
- :rules="[{ required: true, message: '请选择省', trigger: 'change' }]"
|
|
|
|
- style="margin-right: 0"
|
|
|
|
- >
|
|
|
|
- <el-select
|
|
|
|
- v-model.trim="forms.province"
|
|
|
|
- filterable
|
|
|
|
- placeholder="请选择省"
|
|
|
|
- clearable
|
|
|
|
- style="width: 148px !important;margin-right:5px;"
|
|
|
|
- @change="onChangeProvince"
|
|
|
|
|
|
+ prop="regionProvince"
|
|
|
|
+ :rules="[
|
|
|
|
+ { required: true, message: '请选择省', trigger: 'change' },
|
|
|
|
+ ]"
|
|
|
|
+ style="margin-right: 0"
|
|
|
|
+ >
|
|
|
|
+ <el-select
|
|
|
|
+ v-model.trim="forms.regionProvince"
|
|
|
|
+ filterable
|
|
|
|
+ placeholder="请选择省"
|
|
|
|
+ clearable
|
|
|
|
+ style="width: 148px !important; margin-right: 5px"
|
|
|
|
+ @change="onChangeProvince"
|
|
|
|
+ >
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="item in provinceList"
|
|
|
|
+ :key="item.value"
|
|
|
|
+ :label="item.label"
|
|
|
|
+ :value="item.value"
|
|
|
|
+ ></el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item
|
|
|
|
+ prop="regionCity"
|
|
|
|
+ :rules="[
|
|
|
|
+ { required: true, message: '请选择市', trigger: 'change' },
|
|
|
|
+ ]"
|
|
|
|
+ style="margin-right: 0"
|
|
>
|
|
>
|
|
- <el-option
|
|
|
|
- v-for="item in provinceList"
|
|
|
|
- :key="item.value"
|
|
|
|
- :label="item.label"
|
|
|
|
- :value="item.value"
|
|
|
|
- ></el-option>
|
|
|
|
- </el-select>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item
|
|
|
|
- prop="city"
|
|
|
|
- :rules="[{ required: true, message: '请选择市', trigger: 'change' }]"
|
|
|
|
- style="margin-right: 0"
|
|
|
|
- >
|
|
|
|
- <el-select
|
|
|
|
- v-model.trim="forms.city"
|
|
|
|
- filterable
|
|
|
|
- :disabled="!forms.province"
|
|
|
|
- style="width: 148px !important"
|
|
|
|
- placeholder="请选择市"
|
|
|
|
- clearable
|
|
|
|
|
|
+ <el-select
|
|
|
|
+ v-model.trim="forms.regionCity"
|
|
|
|
+ filterable
|
|
|
|
+ :disabled="!forms.regionProvince"
|
|
|
|
+ style="width: 148px !important; margin-right: 5px"
|
|
|
|
+ placeholder="请选择市"
|
|
|
|
+ @change="onChangeCity"
|
|
|
|
+ clearable
|
|
|
|
+ >
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="item in cityList"
|
|
|
|
+ :key="item.value"
|
|
|
|
+ :label="item.label"
|
|
|
|
+ :value="item.value"
|
|
|
|
+ ></el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item
|
|
|
|
+ prop="regionCounty"
|
|
|
|
+ :rules="[
|
|
|
|
+ { required: true, message: '请选择地区', trigger: 'change' },
|
|
|
|
+ ]"
|
|
|
|
+ style="margin-right: 0"
|
|
>
|
|
>
|
|
- <el-option
|
|
|
|
- v-for="item in cityList"
|
|
|
|
- :key="item.value"
|
|
|
|
- :label="item.label"
|
|
|
|
- :value="item.value"
|
|
|
|
- ></el-option>
|
|
|
|
- </el-select>
|
|
|
|
- </el-form-item>
|
|
|
|
|
|
+ <el-select
|
|
|
|
+ v-model.trim="forms.regionCounty"
|
|
|
|
+ filterable
|
|
|
|
+ :disabled="!forms.regionCity"
|
|
|
|
+ style="width: 148px !important"
|
|
|
|
+ placeholder="请选择地区"
|
|
|
|
+ clearable
|
|
|
|
+ >
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="item in countyList"
|
|
|
|
+ :key="item.value"
|
|
|
|
+ :label="item.label"
|
|
|
|
+ :value="item.value"
|
|
|
|
+ ></el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
</div>
|
|
</div>
|
|
-
|
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item
|
|
<el-form-item
|
|
label="详细地址"
|
|
label="详细地址"
|
|
prop="address"
|
|
prop="address"
|
|
:rules="[
|
|
:rules="[
|
|
- { required: true, message: '请输入详细地址', trigger: 'blur' }
|
|
|
|
|
|
+ { required: true, message: '请输入详细地址', trigger: 'blur' },
|
|
]"
|
|
]"
|
|
>
|
|
>
|
|
<el-input
|
|
<el-input
|
|
v-model.trim="forms.address"
|
|
v-model.trim="forms.address"
|
|
-
|
|
|
|
|
|
+ type="textarea"
|
|
|
|
+ :rows="3"
|
|
placeholder="请输入详细地址"
|
|
placeholder="请输入详细地址"
|
|
></el-input>
|
|
></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -91,66 +117,72 @@
|
|
</template>
|
|
</template>
|
|
<script>
|
|
<script>
|
|
import { areaQueryChild, getParentArea } from "@/api/specialSetting";
|
|
import { areaQueryChild, getParentArea } from "@/api/specialSetting";
|
|
-
|
|
|
|
|
|
+import { addMusicGroupAddr,resetMusicGroupAddr } from "../../api";
|
|
export default {
|
|
export default {
|
|
- props:['form'],
|
|
|
|
|
|
+ props: ["form"],
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
- forms:{
|
|
|
|
- consigneeName:'',
|
|
|
|
- mobile:'',
|
|
|
|
- detailAddress:'',
|
|
|
|
- musicGroupId:'',
|
|
|
|
- regionProvince:'',
|
|
|
|
- regionCity:'',
|
|
|
|
- regionCounty:''
|
|
|
|
|
|
+ forms: {
|
|
|
|
+ consigneeName: "",
|
|
|
|
+ mobile: "",
|
|
|
|
+ detailAddress: "",
|
|
|
|
+ musicGroupId: "",
|
|
|
|
+ regionProvince: "",
|
|
|
|
+ regionCity: "",
|
|
|
|
+ regionCounty: "",
|
|
},
|
|
},
|
|
- provinceList:[],
|
|
|
|
- cityList:[],
|
|
|
|
- countyList:[]
|
|
|
|
-
|
|
|
|
|
|
+ provinceList: [],
|
|
|
|
+ cityList: [],
|
|
|
|
+ countyList: [],
|
|
};
|
|
};
|
|
- },async mounted(){
|
|
|
|
|
|
+ },
|
|
|
|
+ async mounted() {
|
|
|
|
+ if(this.form){
|
|
|
|
+ this.forms = {...this.form}
|
|
|
|
+ }
|
|
await this.getAreaList();
|
|
await this.getAreaList();
|
|
if (this.forms.regionCity) {
|
|
if (this.forms.regionCity) {
|
|
- await getParentArea({ id: this.forms.regionCity }).then(async res => {
|
|
|
|
|
|
+ await getParentArea({ id: this.forms.regionCity }).then(async (res) => {
|
|
if (res.code == 200 && res.data) {
|
|
if (res.code == 200 && res.data) {
|
|
- await this.getAreaList(res.data.id,'regionCity', () => {
|
|
|
|
|
|
+ await this.getAreaList(res.data.id, "regionCity", () => {
|
|
this.$set(this.forms, "regionProvince", res.data.id);
|
|
this.$set(this.forms, "regionProvince", res.data.id);
|
|
this.$set(this.forms, "regionCity", this.forms.regionCity);
|
|
this.$set(this.forms, "regionCity", this.forms.regionCity);
|
|
-
|
|
|
|
});
|
|
});
|
|
-
|
|
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- if(this.forms.regionCity){
|
|
|
|
- await this.getAreaList(this.forms.regionCity,'regionCounty');
|
|
|
|
|
|
+ if (this.forms.regionCity) {
|
|
|
|
+ await this.getAreaList(this.forms.regionCity, "regionCounty");
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
this.$set(this.forms, "regionProvince", null);
|
|
this.$set(this.forms, "regionProvince", null);
|
|
this.$set(this.forms, "city", null);
|
|
this.$set(this.forms, "city", null);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- methods:{
|
|
|
|
|
|
+ methods: {
|
|
onChangeProvince(val) {
|
|
onChangeProvince(val) {
|
|
- this.forms.city = null;
|
|
|
|
- this.getAreaList(val);
|
|
|
|
|
|
+ this.forms.regionCity = null;
|
|
|
|
+ this.forms.regionCounty = null;
|
|
|
|
+ this.getAreaList(val, "");
|
|
|
|
+ },
|
|
|
|
+ onChangeCity(val) {
|
|
|
|
+ this.forms.regionCounty = null;
|
|
|
|
+ this.getAreaList(val, "regionCounty");
|
|
},
|
|
},
|
|
- getAreaList(parentId,type, callback) {
|
|
|
|
|
|
+ getAreaList(parentId, type, callback) {
|
|
parentId = parentId ? parentId : 0;
|
|
parentId = parentId ? parentId : 0;
|
|
- areaQueryChild({ parentId: parentId }).then(res => {
|
|
|
|
|
|
+ areaQueryChild({ parentId: parentId }).then((res) => {
|
|
if (res.code == 200 && res.data) {
|
|
if (res.code == 200 && res.data) {
|
|
let tempData = [];
|
|
let tempData = [];
|
|
- res.data.forEach(item => {
|
|
|
|
|
|
+ res.data.forEach((item) => {
|
|
tempData.push({
|
|
tempData.push({
|
|
label: item.name,
|
|
label: item.name,
|
|
- value: item.id
|
|
|
|
|
|
+ value: item.id,
|
|
});
|
|
});
|
|
});
|
|
});
|
|
if (parentId) {
|
|
if (parentId) {
|
|
- if(type =='regionCounty'){
|
|
|
|
|
|
+ if (type == "regionCounty") {
|
|
this.countyList = tempData;
|
|
this.countyList = tempData;
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
this.cityList = tempData;
|
|
this.cityList = tempData;
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@@ -163,7 +195,32 @@ export default {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
},
|
|
},
|
|
- }
|
|
|
|
|
|
+ async submit() {
|
|
|
|
+ this.$refs.form.validate(async (flag) => {
|
|
|
|
+ if (flag) {
|
|
|
|
+ if (this.forms.id) {
|
|
|
|
+ // 修改 resetMusicGroupAddr
|
|
|
|
+ try {
|
|
|
|
+ const res = await resetMusicGroupAddr({ ...this.forms });
|
|
|
|
+ this.$message.success("修改成功");
|
|
|
|
+ this.$emit("getList");
|
|
|
|
+ } catch (e) {
|
|
|
|
+ console.log(e);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ // 新增
|
|
|
|
+ try {
|
|
|
|
+ const res = await addMusicGroupAddr({ ...this.forms });
|
|
|
|
+ this.$message.success("添加成功");
|
|
|
|
+ this.$emit("getList");
|
|
|
|
+ } catch (e) {
|
|
|
|
+ console.log(e);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ },
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|
|
|
|
|