|
@@ -132,7 +132,7 @@
|
|
|
|
|
|
<script>
|
|
|
import { STable, VSelect } from '@/components'
|
|
|
-import { getProvince, getCityByPro, getDistrictByCity } from '@/api/data'
|
|
|
+import { getArea } from '@/api/data'
|
|
|
import { custSave, custFindById } from '@/api/customer'
|
|
|
import { custTypeFindAll } from '@/api/custType'
|
|
|
export default {
|
|
@@ -230,80 +230,58 @@ export default {
|
|
|
handleBack () {
|
|
|
this.$router.push({ path: '/customerManagement/customerInfo/list' })
|
|
|
},
|
|
|
- // 获取省列表
|
|
|
- getProvinceList () {
|
|
|
- getProvince().then(res => {
|
|
|
- if (res.status == 200) {
|
|
|
- this.addrProvinceList = res.data || []
|
|
|
- } else {
|
|
|
- this.addrProvinceList = []
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- // 获取城市列表
|
|
|
- getCityList (val) {
|
|
|
- const _this = this
|
|
|
- this.addrProvinceList.map(item => {
|
|
|
- if (item.id == val) {
|
|
|
- _this.form.province = item.name
|
|
|
- }
|
|
|
- })
|
|
|
- this.addrCityList = []
|
|
|
- this.addrAreaList = []
|
|
|
- this.form.citySn = undefined
|
|
|
- this.form.countySn = undefined
|
|
|
- this.form.customerAddr = ''
|
|
|
- this.getCityListRequest(val)
|
|
|
- },
|
|
|
- getCityListRequest (val) {
|
|
|
- getCityByPro({
|
|
|
- id: val
|
|
|
- }).then(res => {
|
|
|
- if (res.status == 200) {
|
|
|
- this.addrCityList = res.data || []
|
|
|
- } else {
|
|
|
- this.addrCityList = []
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- // 获取区县列表
|
|
|
- getAreaList (val) {
|
|
|
- const _this = this
|
|
|
- this.addrCityList.map(item => {
|
|
|
- if (item.id == val) {
|
|
|
- _this.form.city = item.name
|
|
|
- }
|
|
|
- })
|
|
|
- this.addrAreaList = []
|
|
|
- this.form.countySn = undefined
|
|
|
- this.form.customerAddr = ''
|
|
|
- this.getAreaListRequest(val)
|
|
|
- },
|
|
|
- getAreaListRequest (val) {
|
|
|
- getDistrictByCity({
|
|
|
- id: val
|
|
|
- }).then(res => {
|
|
|
- if (res.status == 200) {
|
|
|
- this.addrAreaList = res.data || []
|
|
|
- } else {
|
|
|
- this.addrAreaList = []
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- // 区县变更
|
|
|
- areaCharged (val) {
|
|
|
- const _this = this
|
|
|
- this.addrAreaList.map(item => {
|
|
|
- if (item.id == val) {
|
|
|
- _this.form.area = item.name
|
|
|
- }
|
|
|
- })
|
|
|
- this.form.customerAddr = ''
|
|
|
- }
|
|
|
+ // 获取城市列表
|
|
|
+ getCityList (val) {
|
|
|
+ this.addrCityList = []
|
|
|
+ this.addrDistrictList = []
|
|
|
+ this.form.cityCode = undefined
|
|
|
+ this.form.districtCode = undefined
|
|
|
+ this.form.address = ''
|
|
|
+ this.getArea('city', val)
|
|
|
+ },
|
|
|
+ // 获取区县列表
|
|
|
+ getAreaList (val) {
|
|
|
+ this.addrDistrictList = []
|
|
|
+ this.form.districtCode = undefined
|
|
|
+ this.form.address = ''
|
|
|
+ this.getArea('district', val)
|
|
|
+ },
|
|
|
+ // 区县变更
|
|
|
+ areaCharged (val) {
|
|
|
+ this.form.address = ''
|
|
|
+ },
|
|
|
+ // 省/市/区
|
|
|
+ getArea (type, sn) {
|
|
|
+ let params
|
|
|
+ if (type == 'province') {
|
|
|
+ params = { level: '1' }
|
|
|
+ } else {
|
|
|
+ params = { psn: sn }
|
|
|
+ }
|
|
|
+ getArea(params).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ if (type == 'province') {
|
|
|
+ this.addrProvinceList = res.data || []
|
|
|
+ } else if (type == 'city') {
|
|
|
+ this.addrCityList = res.data || []
|
|
|
+ } else if (type == 'district') {
|
|
|
+ this.addrDistrictList = res.data || []
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (type == 'province') {
|
|
|
+ this.addrProvinceList = []
|
|
|
+ } else if (type == 'city') {
|
|
|
+ this.addrCityList = []
|
|
|
+ } else if (type == 'district') {
|
|
|
+ this.addrDistrictList = []
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
beforeRouteEnter (to, from, next) {
|
|
|
next(vm => {
|
|
|
- vm.getProvinceList() // 省市区
|
|
|
+ vm.getArea('province') // 省市区
|
|
|
// vm.getCustTypeList() // 客户类型
|
|
|
vm.$refs.ruleForm.resetFields()
|
|
|
if (vm.$route.params.id) {
|