chenrui 4 yıl önce
ebeveyn
işleme
61b879fde1

+ 8 - 0
src/api/customer.js

@@ -31,6 +31,14 @@ export const custSave = params => {
   })
 }
 
+// 客户详情
+export const custFindById = params => {
+  return axios({
+    url: `/cust/findById/${params.id}`,
+    method: 'post'
+  })
+}
+
 // 删除客户
 export const custDel = params => {
   return axios({

+ 10 - 5
src/views/salesManagement/customerManagement/detailModal.vue

@@ -9,13 +9,11 @@
     @cancle="isShow=false"
     width="80%">
     <!-- 客户详情 -->
-    <div>
-    <!-- <div v-if="detailsData"> -->
+    <div v-if="detailsData">
       <a-row :gutter="35">
         <a-col :span="8" class="item-cont">
           <p class="item-label">客户名称:</p>
-          <p class="item-main">名称思密达</p>
-          <!-- <p class="item-main">{{ detailsData.name }}</p> -->
+          <p class="item-main">{{ detailsData.name }}</p>
         </a-col>
         <a-col :span="8" class="item-cont">
           <p class="item-label">联系手机:</p>
@@ -83,6 +81,7 @@
 
 <script>
 import { STable } from '@/components'
+import { custFindById } from '@/api/customer'
 export default {
   name: 'CustomerManagementDetailModal',
   components: { STable },
@@ -110,7 +109,13 @@ export default {
   methods: {
     //  获取详情
     getDetail(){
-      
+      custFindById({ id: this.itemId }).then(res => {
+        if(res.status == 200){
+          this.detailsData = res.data
+        }else{
+          this.detailsData = null
+        }
+      })
     }
   },
   watch: {

+ 299 - 339
src/views/salesManagement/customerManagement/edit.vue

@@ -1,253 +1,212 @@
 <template>
-  <div class="customerManagementEdit-wrap">
-    <a-page-header :ghost="false" @back="handleBack" class="customerManagementEdit-back">
-      <!-- 自定义的二级文字标题 -->
-      <template slot="subTitle">
-        <a id="customerManagementEdit-back-btn" href="javascript:;" @click="handleBack">返回列表</a>
-      </template>
-    </a-page-header>
-    <a-card :bordered="false" class="customerManagementEdit-table-page-wrapper">
-      <a-form-model
-        id="customerManagementEdit-form"
-        ref="ruleForm"
-        :model="form"
-        :rules="rules"
-        :label-col="formItemLayout.labelCol"
-        :wrapper-col="formItemLayout.wrapperCol"
-      >
-        <a-row :gutter="15">
-          <a-col :span="8">
-            <a-form-model-item label="客户名称" prop="name">
-              <a-input
-                id="customerManagementEdit-name"
-                :maxLength="30"
-                v-model="form.name"
-                placeholder="请输入客户名称(最多30个字符)"
-                allowClear />
-            </a-form-model-item>
-          </a-col>
-          <a-col :span="8">
-            <a-form-model-item label="联系手机" prop="mobile">
-              <a-input
-                id="customerManagementEdit-mobile"
-                :maxLength="11"
-                v-model="form.mobile"
-                placeholder="请输入联系手机(最多11个字符)"
-                allowClear />
-            </a-form-model-item>
-          </a-col>
-          <a-col :span="8">
-            <a-form-model-item label="联系人" prop="contact">
-              <a-input
-                id="customerManagementEdit-contact"
-                :maxLength="30"
-                v-model="form.contact"
-                placeholder="请输入联系人(最多30个字符)"
-                allowClear />
-            </a-form-model-item>
-          </a-col>
-        </a-row>
-        <a-row :gutter="15">
-          <a-col :span="16">
-            <a-form-model-item label="客户地址" required style="margin: 0;" :labelCol="{ span: 4 }" :wrapperCol="{ span: 20 }">
-              <a-row :gutter="15">
-                <!-- 客户地址 -->
-                <a-col span="8">
-                  <a-form-model-item prop="provinceId">
-                    <a-select id="customerManagementEdit-provinceId" @change="getCityList" v-model="form.provinceId" placeholder="请选择省">
-                      <a-select-option v-for="item in addrProvinceList" :value="item.id" :key="item.id + 'a'">{{ item.name }}</a-select-option>
-                    </a-select>
-                  </a-form-model-item>
-                </a-col>
-                <a-col span="8">
-                  <a-form-model-item prop="cityId">
-                    <a-select id="customerManagementEdit-cityId" @change="getAreaList" v-model="form.cityId" placeholder="请选择市">
-                      <a-select-option v-for="item in addrCityList" :value="item.id" :key="item.id + 'b'">{{ item.name }}</a-select-option>
-                    </a-select>
-                  </a-form-model-item>
-                </a-col>
-                <a-col span="8">
-                  <a-form-model-item prop="areaId">
-                    <a-select id="customerManagementEdit-areaId" @change="areaCharged" v-model="form.areaId" placeholder="请选择区/县">
-                      <a-select-option v-for="item in addrAreaList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
-                    </a-select>
-                  </a-form-model-item>
-                </a-col>
-              </a-row>
-            </a-form-model-item>
-          </a-col>
-          <a-col :span="8">
-            <a-form-model-item label="详细地址" prop="address">
-              <a-input
-                id="customerManagementEdit-address"
-                :maxLength="60"
-                v-model="form.address"
-                placeholder="请输入详细地址(最多60个字符)"
-                allowClear />
-            </a-form-model-item>
-          </a-col>
-        </a-row>
-        <a-row :gutter="15">
-          <a-col :span="8">
-            <a-form-model-item label="客户传真" prop="fax">
-              <a-input
-                id="customerManagementEdit-fax"
-                :maxLength="30"
-                v-model="form.fax"
-                placeholder="请输入客户传真(最多30个字符)"
-                allowClear />
-            </a-form-model-item>
-          </a-col>
-          <a-col :span="8">
-            <a-form-model-item label="配送方式" prop="distributionType">
-              <v-select code="DISPATCH_FASHION" id="customerManagementEdit-distributionType" v-model="form.distributionType" allowClear placeholder="请选择配送方式"></v-select>
-            </a-form-model-item>
-          </a-col>
-          <a-col :span="8">
-            <a-form-model-item label="是否卫星仓客户" prop="contactPhone">
-              <a-select id="customerManagementEdit-areaCode" v-model="form.areaCode" placeholder="请选择">
-                <a-select-option v-for="item in addrAreaList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
-              </a-select>
-            </a-form-model-item>
-          </a-col>
-        </a-row>
-        <a-row :gutter="15">
-          <a-col :span="8">
-            <a-form-model-item label="客户类型" prop="custType">
-              <a-select id="customerManagementEdit-custType" v-model="form.custType" allowClear placeholder="请选择客户类型">
-                <a-select-option v-for="item in custTypeList" :value="item.id" :key="item.id">{{ item.name }}</a-select-option>
-              </a-select>
-            </a-form-model-item>
-          </a-col>
-          <a-col :span="8">
-            <a-form-model-item label="价格类型" ref="priceType" prop="priceType">
-              <v-select code="PRICE_TYPE" id="customerManagementEdit-priceType" v-model="form.priceType" @change="changess" allowClear placeholder="请选择价格类型"></v-select>
-            </a-form-model-item>
-          </a-col>
-          <a-col :span="8">
-            <a-form-model-item label="支付方式" prop="payType">
-              <v-select code="PAY_FASHION" id="customerManagementEdit-payType" v-model="form.payType" allowClear placeholder="请选择支付方式" />
-            </a-form-model-item>
-          </a-col>
-        </a-row>
-        <a-row :gutter="15">
-          <a-col :span="8">
-            <a-form-model-item label="收款方式" prop="paymentType">
-              <v-select code="RECEIPT_PAYMENT" id="customerManagementEdit-paymentType" v-model="form.paymentType" allowClear placeholder="请选择收款方式"></v-select>
-            </a-form-model-item>
-          </a-col>
-          <a-col :span="8">
-            <a-form-model-item label="联系电话" prop="contactTel">
-              <a-input
-                id="customerManagementEdit-contactTel"
-                :maxLength="20"
-                v-model="form.contactTel"
-                placeholder="请输入联系电话(最多20个字符)"
-                allowClear />
-            </a-form-model-item>
-          </a-col>
-        </a-row>
-        <a-form-model-item :wrapper-col="{ span: 12, offset: 6 }" style="text-align: center;">
-          <a-button type="primary" @click="handleSubmit" id="customerManagementEdit-btn-submit" style="padding: 0 60px;">保存</a-button>
-        </a-form-model-item>
-      </a-form-model>
-    </a-card>
-  </div>
+	<div class="customerManagementEdit-wrap">
+		<a-page-header :ghost="false" @back="handleBack" class="customerManagementEdit-back">
+			<!-- 自定义的二级文字标题 -->
+			<template slot="subTitle">
+				<a id="customerManagementEdit-back-btn" href="javascript:;" @click="handleBack">返回列表</a>
+			</template>
+		</a-page-header>
+		<a-card :bordered="false" class="customerManagementEdit-table-page-wrapper">
+			<a-form-model
+				id="customerManagementEdit-form"
+				ref="ruleForm"
+				:model="form"
+				:rules="rules"
+				:label-col="formItemLayout.labelCol"
+				:wrapper-col="formItemLayout.wrapperCol"
+			>
+				<a-row :gutter="15">
+					<a-col :span="8">
+						<a-form-model-item label="客户名称" prop="name">
+							<a-input id="customerManagementEdit-name" :maxLength="30" v-model="form.name" placeholder="请输入客户名称(最多30个字符)" allowClear />
+						</a-form-model-item>
+					</a-col>
+					<a-col :span="8">
+						<a-form-model-item label="联系手机" prop="mobile">
+							<a-input id="customerManagementEdit-mobile" :maxLength="11" v-model="form.mobile" placeholder="请输入联系手机(最多11个字符)" allowClear />
+						</a-form-model-item>
+					</a-col>
+					<a-col :span="8">
+						<a-form-model-item label="联系人" prop="contact">
+							<a-input id="customerManagementEdit-contact" :maxLength="30" v-model="form.contact" placeholder="请输入联系人(最多30个字符)" allowClear />
+						</a-form-model-item>
+					</a-col>
+				</a-row>
+				<a-row :gutter="15">
+					<a-col :span="16">
+						<a-form-model-item label="客户地址" required style="margin: 0;" :labelCol="{ span: 4 }" :wrapperCol="{ span: 20 }">
+							<a-row :gutter="15">
+								<!-- 客户地址 -->
+								<a-col span="8">
+									<a-form-model-item prop="provinceId">
+										<a-select id="customerManagementEdit-provinceId" @change="getCityList" v-model="form.provinceId" placeholder="请选择省">
+											<a-select-option v-for="item in addrProvinceList" :value="item.id" :key="item.id + 'a'">{{ item.name }}</a-select-option>
+										</a-select>
+									</a-form-model-item>
+								</a-col>
+								<a-col span="8">
+									<a-form-model-item prop="cityId">
+										<a-select id="customerManagementEdit-cityId" @change="getAreaList" v-model="form.cityId" placeholder="请选择市">
+											<a-select-option v-for="item in addrCityList" :value="item.id" :key="item.id + 'b'">{{ item.name }}</a-select-option>
+										</a-select>
+									</a-form-model-item>
+								</a-col>
+								<a-col span="8">
+									<a-form-model-item prop="areaId">
+										<a-select id="customerManagementEdit-areaId" @change="areaCharged" v-model="form.areaId" placeholder="请选择区/县">
+											<a-select-option v-for="item in addrAreaList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
+										</a-select>
+									</a-form-model-item>
+								</a-col>
+							</a-row>
+						</a-form-model-item>
+					</a-col>
+					<a-col :span="8">
+						<a-form-model-item label="详细地址" prop="address">
+							<a-input id="customerManagementEdit-address" :maxLength="60" v-model="form.address" placeholder="请输入详细地址(最多60个字符)" allowClear />
+						</a-form-model-item>
+					</a-col>
+				</a-row>
+				<a-row :gutter="15">
+					<a-col :span="8">
+						<a-form-model-item label="客户传真" prop="fax">
+							<a-input id="customerManagementEdit-fax" :maxLength="30" v-model="form.fax" placeholder="请输入客户传真(最多30个字符)" allowClear />
+						</a-form-model-item>
+					</a-col>
+					<a-col :span="8">
+						<a-form-model-item label="配送方式" prop="distributionType">
+							<v-select
+								code="DISPATCH_FASHION"
+								id="customerManagementEdit-distributionType"
+								v-model="form.distributionType"
+								allowClear
+								placeholder="请选择配送方式"
+							></v-select>
+						</a-form-model-item>
+					</a-col>
+					<a-col :span="8">
+						<a-form-model-item label="是否卫星仓客户" prop="contactPhone">
+							<a-select id="customerManagementEdit-areaCode" v-model="form.areaCode" placeholder="请选择">
+								<a-select-option v-for="item in addrAreaList" :value="item.id" :key="item.id">{{ item.name }}</a-select-option>
+							</a-select>
+						</a-form-model-item>
+					</a-col>
+				</a-row>
+				<a-row :gutter="15">
+					<a-col :span="8">
+						<a-form-model-item label="客户类型" prop="custType">
+							<a-select id="customerManagementEdit-custType" v-model="form.custType" allowClear placeholder="请选择客户类型">
+								<a-select-option v-for="item in custTypeList" :value="item.id" :key="item.id">{{ item.name }}</a-select-option>
+							</a-select>
+						</a-form-model-item>
+					</a-col>
+					<a-col :span="8">
+						<a-form-model-item label="价格类型" ref="priceType" prop="priceType">
+							<v-select code="PRICE_TYPE" id="customerManagementEdit-priceType" v-model="form.priceType" allowClear placeholder="请选择价格类型" ></v-select>
+						</a-form-model-item>
+					</a-col>
+					<a-col :span="8">
+						<a-form-model-item label="支付方式" prop="payType">
+							<v-select code="PAY_FASHION" id="customerManagementEdit-payType" v-model="form.payType" allowClear placeholder="请选择支付方式" />
+						</a-form-model-item>
+					</a-col>
+				</a-row>
+				<a-row :gutter="15">
+					<a-col :span="8">
+						<a-form-model-item label="收款方式" prop="paymentType">
+							<v-select code="RECEIPT_PAYMENT" id="customerManagementEdit-paymentType" v-model="form.paymentType" allowClear placeholder="请选择收款方式"></v-select>
+						</a-form-model-item>
+					</a-col>
+					<a-col :span="8">
+						<a-form-model-item label="联系电话" prop="contactTel">
+							<a-input id="customerManagementEdit-contactTel" :maxLength="20" v-model="form.contactTel" placeholder="请输入联系电话(最多20个字符)" allowClear />
+						</a-form-model-item>
+					</a-col>
+				</a-row>
+				<a-form-model-item :wrapper-col="{ span: 12, offset: 6 }" style="text-align: center;">
+					<a-button type="primary" @click="handleSubmit" id="customerManagementEdit-btn-submit" style="padding: 0 60px;">保存</a-button>
+				</a-form-model-item>
+			</a-form-model>
+		</a-card>
+	</div>
 </template>
 
 <script>
 import { STable, VSelect } from '@/components'
 import { getProvince, getCityByPro, getDistrictByCity } from '@/api/data'
-import { custSave } from '@/api/customer'
+import { custSave, custFindById } from '@/api/customer'
 import { custTypeFindAll } from '@/api/custType'
 export default {
-  name: 'customerManagementEdit',
-  components: { STable, VSelect },
-  data () {
-    return {
-      formItemLayout: {
-        labelCol: { span: 8 },
-        wrapperCol: { span: 16 }
-      },
-      form: {
-        name: '', // 客户名称
-        mobile: '',  //  联系手机
-        contact: '',  //  联系人
-        provinceId: undefined, //  省
-        province: '',
-        cityId: undefined, // 市
-        city: '',
-        areaId: undefined, // 区
-        area: '',
-        address: '', //  详细地址
-        fax: '',  //  客户传真
-        distributionType: '',  //  配送方式
-        remarks: '',  //  是否卫星仓客户
-        custType: undefined,  //  客户类型
-        priceType: '',  //  价格类型
-        payType: '',  //  支付方式
-        paymentType: '',  //  收款方式
-        contactTel: '',  //  联系电话
-      },
-      rules: {
-        name: [
-          { required: true, message: '请输入客户名称', trigger: 'blur' }
-        ],
-        mobile: [
-          { required: true, message: '请输入联系手机', trigger: 'blur' }
-        ],
-        provinceId: [
-          { required: true, message: '请选择省', trigger: 'change' }
-        ],
-        cityId: [
-          { required: true, message: '请选择市', trigger: 'change' }
-        ],
-        areaId: [
-          { required: true, message: '请选择区/县', trigger: 'change' }
-        ],
-        priceType: [
-          { required: true, message: '请选择价格类型', trigger: 'change' }
-        ],
-        payType: [
-          { required: true, message: '请选择支付方式', trigger: 'change' }
-        ],
-        paymentType: [
-          { required: true, message: '请选择收款方式', trigger: 'change' }
-        ]
-      },
-      addrProvinceList: [], //  省下拉
-      addrCityList: [], //  市下拉
-      addrAreaList: [], //  区下拉
-      custTypeList: [],  //  客户类型  下拉数据
-    }
-  },
-  methods: {
-    changess(val){
-      console.log(val)
-      console.log(this.form.priceType)
-    },
-    //  获取客户信息
-    getDetail () {
-      // goodsFind({ id: this.$route.params.id }).then(res => {
-      //   if (res.status == 200) {
-      //     this.form = Object.assign(this.form, res.data)
-      //   }
-      // })
-    },
-    //  客户类型
-    getCustTypeList(){
-      custTypeFindAll({}).then(res => {
-        if(res.status == 200){
-          this.custTypeList = res.data
-        }
-      })
-    },
-    //  保存
-    handleSubmit (e) {
-      e.preventDefault()
-      const _this = this
-      this.$refs.ruleForm.validate(valid => {
-        if (valid) {
+	name: 'customerManagementEdit',
+	components: { STable, VSelect },
+	data() {
+		return {
+			formItemLayout: {
+				labelCol: { span: 8 },
+				wrapperCol: { span: 16 }
+			},
+			form: {
+				name: '', // 客户名称
+				mobile: '', //  联系手机
+				contact: '', //  联系人
+				provinceId: undefined, //  省
+				province: '',
+				cityId: undefined, // 市
+				city: '',
+				areaId: undefined, // 区
+				area: '',
+				address: '', //  详细地址
+				fax: '', //  客户传真
+				distributionType: '', //  配送方式
+				remarks: '', //  是否卫星仓客户
+				custType: undefined, //  客户类型
+				priceType: '', //  价格类型
+				payType: '', //  支付方式
+				paymentType: '', //  收款方式
+				contactTel: '' //  联系电话
+			},
+			rules: {
+				name: [{ required: true, message: '请输入客户名称', trigger: 'blur' }],
+				mobile: [{ required: true, message: '请输入联系手机', trigger: 'blur' }],
+				provinceId: [{ required: true, message: '请选择省', trigger: 'change' }],
+				cityId: [{ required: true, message: '请选择市', trigger: 'change' }],
+				areaId: [{ required: true, message: '请选择区/县', trigger: 'change' }],
+				custType: [{ required: true, message: '请选择客户类型', trigger: 'change' }],
+				priceType: [{ required: true, message: '请选择价格类型', trigger: 'change' }],
+				payType: [{ required: true, message: '请选择支付方式', trigger: 'change' }],
+				paymentType: [{ required: true, message: '请选择收款方式', trigger: 'change' }]
+			},
+			addrProvinceList: [], //  省下拉
+			addrCityList: [], //  市下拉
+			addrAreaList: [], //  区下拉
+			custTypeList: [] //  客户类型  下拉数据
+		}
+	},
+	methods: {
+		//  获取客户信息
+		getDetail() {
+			custFindById({ id: this.itemId }).then(res => {
+				if (res.status == 200) {
+					// this.detailsData = res.data
+				} else {
+					this.$refs.ruleForm.resetFields()
+				}
+			});
+		},
+		//  客户类型
+		getCustTypeList() {
+			custTypeFindAll({}).then(res => {
+			  if(res.status == 200){
+			    this.custTypeList = res.data
+			  }
+			})
+		},
+		//  保存
+		handleSubmit(e) {
+			e.preventDefault()
+			const _this = this
+			this.$refs.ruleForm.validate(valid => {
+				if (valid) {
           const form = _this.form
           form.id = this.$route.params.id ? this.$route.params.id : null
           let areas = [ form.provinceId, form.cityId, form.areaId ]
@@ -263,104 +222,105 @@ export default {
               }, 1000)
             }
           })
-        } else {
-          console.log('error submit!!')
-          return false
-        }
-      })
-    },
-    //  返回列表
-    handleBack(){
-      this.$router.push({ path: '/salesManagement/customerManagement/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.cityId = undefined
-      this.form.areaId = undefined
-      this.form.address = ''
-      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.areaId = undefined
-      this.form.address = ''
-      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.address = ''
-    }
-  },
-  beforeRouteEnter (to, from, next) {
-    next(vm => {
-      vm.getProvinceList()  //  省市区
-      vm.getCustTypeList()  //  客户类型
-      vm.$refs.ruleForm.resetFields()
-      if (vm.$route.params.id) { //  编辑页
-        vm.getDetail()
-      }
-    })
-  }
-}
+				} else {
+					console.log('error submit!!')
+					return false
+				}
+			})
+		},
+		//  返回列表
+		handleBack() {
+			this.$router.push({ path: '/salesManagement/customerManagement/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.cityId = undefined
+			this.form.areaId = undefined
+			this.form.address = ''
+			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.areaId = undefined
+			this.form.address = ''
+			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.address = ''
+		}
+	},
+	beforeRouteEnter(to, from, next) {
+		next(vm => {
+			vm.getProvinceList()  //  省市区
+			vm.getCustTypeList() //  客户类型
+			vm.$refs.ruleForm.resetFields()
+			if (vm.$route.params.id) {
+				//  编辑页
+				vm.getDetail()
+			}
+		});
+	}
+};
 </script>
 
 <style lang="less">
-  .customerManagementEdit-wrap{
-    .customerManagementEdit-back{
-      margin-bottom: 15px;
-    }
-  }
+.customerManagementEdit-wrap {
+	.customerManagementEdit-back {
+		margin-bottom: 15px;
+	}
+}
 </style>