|
@@ -1,134 +1,133 @@
|
|
<template>
|
|
<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">{{ 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>
|
|
|
|
|
|
+ <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="customerName">
|
|
|
|
+ <a-input id="customerManagementEdit-customerName" :maxLength="30" v-model="form.customerName" placeholder="请输入客户名称(最多30个字符)" allowClear />
|
|
|
|
+ </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-col :span="8">
|
|
|
|
+ <a-form-model-item label="联系人" prop="contactName">
|
|
|
|
+ <a-input id="customerManagementEdit-contactName" :maxLength="30" v-model="form.contactName" 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="provinceSn">
|
|
|
|
+ <a-select id="customerManagementEdit-provinceSn" @change="getCityList" v-model="form.provinceSn" 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="citySn">
|
|
|
|
+ <a-select id="customerManagementEdit-citySn" @change="getAreaList" v-model="form.citySn" 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="countySn">
|
|
|
|
+ <a-select id="customerManagementEdit-countySn" @change="areaCharged" v-model="form.countySn" 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="customerAddr">
|
|
|
|
+ <a-input id="customerManagementEdit-customerAddr" :maxLength="60" v-model="form.customerAddr" 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="dispatchType">
|
|
|
|
+ <v-select
|
|
|
|
+ code="DISPATCH_FASHION"
|
|
|
|
+ id="customerManagementEdit-dispatchType"
|
|
|
|
+ v-model="form.dispatchType"
|
|
|
|
+ allowClear
|
|
|
|
+ placeholder="请选择配送方式"
|
|
|
|
+ ></v-select>
|
|
|
|
+ </a-form-model-item>
|
|
|
|
+ </a-col>
|
|
|
|
+ <a-col :span="8">
|
|
|
|
+ <a-form-model-item label="是否卫星仓客户" prop="satelliteFlag">
|
|
|
|
+ <v-select
|
|
|
|
+ code="DISPATCH_FASHION"
|
|
|
|
+ id="customerManagementEdit-satelliteFlag"
|
|
|
|
+ v-model="form.satelliteFlag"
|
|
|
|
+ allowClear
|
|
|
|
+ placeholder="请选择"
|
|
|
|
+ ></v-select>
|
|
|
|
+ </a-form-model-item>
|
|
|
|
+ </a-col>
|
|
|
|
+ </a-row>
|
|
|
|
+ <a-row :gutter="15">
|
|
|
|
+ <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-col :span="8">
|
|
|
|
+ <a-form-model-item label="收款方式" prop="settleStyleSn">
|
|
|
|
+ <v-select code="RECEIPT_PAYMENT" id="customerManagementEdit-settleStyleSn" v-model="form.settleStyleSn" allowClear placeholder="请选择收款方式"></v-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.customerTypeSn" 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-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>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
@@ -137,83 +136,82 @@ import { getProvince, getCityByPro, getDistrictByCity } from '@/api/data'
|
|
import { custSave, custFindById } from '@/api/customer'
|
|
import { custSave, custFindById } from '@/api/customer'
|
|
import { custTypeFindAll } from '@/api/custType'
|
|
import { custTypeFindAll } from '@/api/custType'
|
|
export default {
|
|
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' }],
|
|
|
|
- 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.$route.params.id }).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) {
|
|
|
|
|
|
+ name: 'CustomerManagementEdit',
|
|
|
|
+ components: { STable, VSelect },
|
|
|
|
+ data () {
|
|
|
|
+ return {
|
|
|
|
+ formItemLayout: {
|
|
|
|
+ labelCol: { span: 8 },
|
|
|
|
+ wrapperCol: { span: 16 }
|
|
|
|
+ },
|
|
|
|
+ form: {
|
|
|
|
+ customerName: '', // 客户名称
|
|
|
|
+ contactTel: '', // 联系电话
|
|
|
|
+ contactName: '', // 联系人
|
|
|
|
+ provinceSn: undefined, // 省
|
|
|
|
+ province: '',
|
|
|
|
+ citySn: undefined, // 市
|
|
|
|
+ city: '',
|
|
|
|
+ countySn: undefined, // 区
|
|
|
|
+ area: '',
|
|
|
|
+ customerAddr: '', // 详细地址
|
|
|
|
+ fax: '', // 客户传真
|
|
|
|
+ dispatchType: '', // 配送方式
|
|
|
|
+ satelliteFlag: undefined, // 是否卫星仓客户
|
|
|
|
+ customerTypeSn: undefined, // 客户类型
|
|
|
|
+ priceType: '', // 价格类型
|
|
|
|
+ payType: '', // 支付方式
|
|
|
|
+ settleStyleSn: '' // 收款方式
|
|
|
|
+ },
|
|
|
|
+ rules: {
|
|
|
|
+ customerName: [{ required: true, message: '请输入客户名称', trigger: 'blur' }],
|
|
|
|
+ contactTel: [{ required: true, message: '请输入联系电话', trigger: 'blur' }],
|
|
|
|
+ provinceSn: [{ required: true, message: '请选择省', trigger: 'change' }],
|
|
|
|
+ citySn: [{ required: true, message: '请选择市', trigger: 'change' }],
|
|
|
|
+ countySn: [{ required: true, message: '请选择区/县', trigger: 'change' }],
|
|
|
|
+ customerTypeSn: [{ required: true, message: '请选择客户类型', trigger: 'change' }],
|
|
|
|
+ priceType: [{ required: true, message: '请选择价格类型', trigger: 'change' }],
|
|
|
|
+ payType: [{ required: true, message: '请选择支付方式', trigger: 'change' }],
|
|
|
|
+ settleStyleSn: [{ required: true, message: '请选择收款方式', trigger: 'change' }]
|
|
|
|
+ },
|
|
|
|
+ addrProvinceList: [], // 省下拉
|
|
|
|
+ addrCityList: [], // 市下拉
|
|
|
|
+ addrAreaList: [], // 区下拉
|
|
|
|
+ custTypeList: [] // 客户类型 下拉数据
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ // 获取客户信息
|
|
|
|
+ getDetail () {
|
|
|
|
+ custFindById({ id: this.$route.params.id }).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
|
|
const form = _this.form
|
|
form.id = this.$route.params.id ? this.$route.params.id : null
|
|
form.id = this.$route.params.id ? this.$route.params.id : null
|
|
- let areas = [ form.provinceId, form.cityId, form.areaId ]
|
|
|
|
|
|
+ const areas = [ form.provinceSn, form.citySn, form.countySn ]
|
|
form.areas = areas.join(',')
|
|
form.areas = areas.join(',')
|
|
- delete form.provinceId
|
|
|
|
- delete form.cityId
|
|
|
|
- console.log(form,'-----提交信息')
|
|
|
|
|
|
+ delete form.provinceSn
|
|
|
|
+ delete form.citySn
|
|
|
|
+ console.log(form, '-----提交信息')
|
|
custSave(form).then(res => {
|
|
custSave(form).then(res => {
|
|
if (res.status == 200) {
|
|
if (res.status == 200) {
|
|
_this.$message.success(res.message)
|
|
_this.$message.success(res.message)
|
|
@@ -222,99 +220,99 @@ export default {
|
|
}, 1000)
|
|
}, 1000)
|
|
}
|
|
}
|
|
})
|
|
})
|
|
- } else {
|
|
|
|
- console.log('error submit!!')
|
|
|
|
- return false
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
- // 返回列表
|
|
|
|
- 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.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: '/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 = ''
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ beforeRouteEnter (to, from, next) {
|
|
|
|
+ next(vm => {
|
|
|
|
+ vm.getProvinceList() // 省市区
|
|
|
|
+ // vm.getCustTypeList() // 客户类型
|
|
|
|
+ vm.$refs.ruleForm.resetFields()
|
|
|
|
+ if (vm.$route.params.id) {
|
|
|
|
+ // 编辑页
|
|
|
|
+ vm.getDetail()
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+}
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="less">
|
|
<style lang="less">
|