123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755 |
- <template>
- <div class="merchantInfoManagementEdit-wrap">
- <a-spin :spinning="spinning" tip="Loading...">
- <a-page-header :ghost="false" :backIcon="false" @back="handleBack" class="merchantInfoManagementEdit-cont">
- <!-- 自定义的二级文字标题 -->
- <template slot="subTitle">
- <a id="merchantInfoManagement-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
- </template>
- </a-page-header>
- <a-form-model
- id="merchantInfoManagementEdit-form"
- ref="ruleForm"
- :model="form"
- :rules="rules"
- :label-col="formItemLayout.labelCol"
- :wrapper-col="formItemLayout.wrapperCol">
- <!-- 基础信息 -->
- <a-card size="small" :bordered="false" class="merchantInfoManagementEdit-cont">
- <a-collapse :activeKey="['1']">
- <a-collapse-panel key="1" header="基础信息">
- <a-row>
- <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
- <a-form-model-item label="经销商名称" prop="dealerName">
- <a-input v-model.trim="form.dealerName" id="merchantInfoManagementEdit-dealerName" :maxLength="30" allowClear placeholder="请输入经销商名称(最多30个字符)" />
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
- <a-form-model-item label="经销商别名" prop="dealerAlias">
- <a-input v-model.trim="form.dealerAlias" id="merchantInfoManagementEdit-dealerAlias" :maxLength="30" allowClear placeholder="请输入经销商别名(最多30个字符)" />
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
- <a-form-model-item label="商户类型" prop="dealerType">
- <v-select
- code="DEALER_TYPE"
- id="merchantInfoManagementEdit-dealerType"
- v-model="form.dealerType"
- allowClear
- placeholder="请选择商户类型"></v-select>
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
- <a-form-model-item label="联系人1" prop="contact">
- <a-input v-model.trim="form.contact" id="merchantInfoManagementEdit-contact" :maxLength="30" allowClear placeholder="请输入联系人1(最多30个字符)" />
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
- <a-form-model-item label="联系手机1" prop="contactMobile">
- <a-input v-model.trim="form.contactMobile" id="merchantInfoManagementEdit-contactMobile" :maxLength="11" allowClear placeholder="请输入联系手机1(最多11个字符)" />
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
- <a-form-model-item label="联系角色1" prop="contactRole">
- <a-input v-model.trim="form.contactRole" id="merchantInfoManagementEdit-contactRole" :maxLength="30" allowClear placeholder="请输入联系角色1(最多30个字符)" />
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
- <a-form-model-item label="联系电话" prop="dealerTelephone">
- <a-input v-model.trim="form.dealerTelephone" id="merchantInfoManagementEdit-dealerTelephone" :maxLength="13" allowClear placeholder="请输入联系电话" />
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24" :md="24" :lg="16" :xl="16">
- <a-form-model-item label="地址" required style="margin: 0;" :label-col="{span:4}" :wrapper-col="{span:20}">
- <a-row :gutter="20">
- <!-- 地址 -->
- <a-col span="8">
- <a-form-model-item prop="provinceSn">
- <a-select id="merchantInfoManagementEdit-provinceSn" allowClear @change="getCityList" v-model="form.provinceSn" placeholder="请选择省">
- <a-select-option v-for="item in addrProvinceList" :value="item.areaSn" :key="item.areaSn + '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="merchantInfoManagementEdit-citySn" allowClear @change="getAreaList" v-model="form.citySn" placeholder="请选择市">
- <a-select-option v-for="item in addrCityList" :value="item.areaSn" :key="item.areaSn + 'b'">{{ item.name }}</a-select-option>
- </a-select>
- </a-form-model-item>
- </a-col>
- <a-col span="8">
- <a-form-model-item prop="districtSn">
- <a-select id="merchantInfoManagementEdit-districtSn" allowClear @change="areaCharged" v-model="form.districtSn" placeholder="请选择区/县">
- <a-select-option v-for="item in addrDistrictList" :value="item.areaSn" :key="item.areaSn + 'c'">{{ item.name }}</a-select-option>
- </a-select>
- </a-form-model-item>
- </a-col>
- </a-row>
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
- <a-form-model-item label="详细地址" prop="address">
- <a-input
- id="merchantInfoManagementEdit-address"
- :maxLength="60"
- v-model.trim="form.address"
- placeholder="请输入详细地址(最多60个字符)"
- allowClear />
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
- <a-form-model-item label="授权类型" prop="menuMouldId">
- <v-select
- code="MENU_MOULD"
- id="merchantInfoManagementEdit-menuMouldId"
- v-model="form.menuMouldId"
- allowClear
- placeholder="请选择授权类型"></v-select>
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
- <a-form-model-item label="财务编码" prop="kdMidCustomerFnumber">
- <a-input
- v-model.trim="form.kdMidCustomerFnumber"
- id="merchantInfoManagementEdit-kdMidCustomerFnumber"
- :maxLength="30"
- allowClear
- placeholder="请输入财务编码(最多30个字符)" />
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
- <a-form-model-item label="默认仓库" prop="defaultWarehouseSn" >
- <chooseWarehouse ref="warehouse" v-model="form.defaultWarehouseSn"></chooseWarehouse>
- </a-form-model-item>
- </a-col>
- </a-row>
- </a-collapse-panel>
- </a-collapse>
- </a-card>
- <!-- 公司信息 -->
- <a-card size="small" :bordered="false" class="merchantInfoManagementEdit-cont">
- <a-collapse>
- <a-collapse-panel key="1" header="公司信息">
- <a-row>
- <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
- <a-form-model-item label="经营方式" prop="busniessMode" help="(例:国有企业)">
- <a-input
- v-model.trim="form.busniessMode"
- id="merchantInfoManagementEdit-busniessMode"
- :maxLength="30"
- allowClear
- placeholder="请输入经营方式(最多30个字符)" />
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
- <a-form-model-item label="经营项目" prop="busniessItmes">
- <a-input
- v-model.trim="form.busniessItmes"
- id="merchantInfoManagementEdit-busniessItmes"
- :maxLength="100"
- allowClear
- placeholder="请输入经营项目(最多100个字符)" />
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
- <a-form-model-item label="营业执照名称" prop="licenseName">
- <a-input
- v-model.trim="form.licenseName"
- id="merchantInfoManagementEdit-licenseName"
- :maxLength="100"
- allowClear
- placeholder="请输入营业执照名称(最多100个字符)" />
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
- <a-form-model-item label="公司规模" prop="busniessScope" help="(例:100-999人)">
- <a-input-number
- id="merchantInfoManagementEdit-busniessScope"
- v-model="form.busniessScope"
- :precision="0"
- :min="1"
- :max="99999999"
- placeholder="请输入"
- style="width: 100%;" />
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
- <a-form-model-item label="成立时间" prop="buildDate">
- <a-date-picker
- style="width:100%"
- id="merchantInfoManagementEdit-buildDate"
- :disabledDate="disabledDate"
- v-model="form.buildDate"
- :format="dateFormat"
- allowClear
- placeholder="请选择日期" />
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
- <a-form-model-item label="一般纳税人" prop="isTaxpayer">
- <v-select
- code="FLAG"
- id="customerManagementEdit-isTaxpayer"
- v-model="form.isTaxpayer"
- allowClear
- placeholder="请选择是否"
- ></v-select>
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
- <a-form-model-item label="身份证号码" prop="indentityCard">
- <a-input
- v-model.trim="form.indentityCard"
- id="merchantInfoManagementEdit-indentityCard"
- :maxLength="18"
- allowClear
- placeholder="请输入身份证号码(最多18个字符)" />
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
- <a-form-model-item label="生日" prop="brithday">
- <a-date-picker
- style="width:100%"
- id="merchantInfoManagementEdit-brithday"
- :disabledDate="disabledDate"
- v-model="form.brithday"
- :format="dateFormat"
- allowClear
- placeholder="请选择日期" />
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
- <a-form-model-item label="籍贯" prop="nativePlace">
- <a-input
- v-model.trim="form.nativePlace"
- id="merchantInfoManagementEdit-nativePlace"
- :maxLength="30"
- allowClear
- placeholder="请输入籍贯(最多30个字符)" />
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
- <a-form-model-item label="邮箱" prop="mail">
- <a-input
- v-model.trim="form.mail"
- id="merchantInfoManagementEdit-mail"
- :maxLength="30"
- allowClear
- placeholder="请输入邮箱(最多30个字符)" />
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
- <a-form-model-item label="联系人2" prop="contact2">
- <a-input v-model.trim="form.contact2" id="merchantInfoManagementEdit-contact2" :maxLength="30" allowClear placeholder="请输入联系人2(最多30个字符)" />
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
- <a-form-model-item label="联系手机2" prop="contactMobile2">
- <a-input v-model.trim="form.contactMobile2" id="merchantInfoManagementEdit-contactMobile2" :maxLength="11" allowClear placeholder="请输入联系手机2(最多11个字符)" />
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
- <a-form-model-item label="联系角色2" prop="contractRole2">
- <a-input v-model.trim="form.contractRole2" id="merchantInfoManagementEdit-contractRole2" :maxLength="30" allowClear placeholder="请输入联系角色2(最多30个字符)" />
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
- <a-form-model-item label="邮政编码" prop="zipCode">
- <a-input v-model.trim="form.zipCode" id="merchantInfoManagementEdit-zipCode" :maxLength="6" allowClear placeholder="请输入邮政编码(最多6个字符)" />
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
- <a-form-model-item label="收货人" prop="receiveContact">
- <a-input v-model.trim="form.receiveContact" id="merchantInfoManagementEdit-receiveContact" :maxLength="30" allowClear placeholder="请输入收货人(最多30个字符)" />
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
- <a-form-model-item label="收货电话" prop="receiveMobile">
- <a-input v-model.trim="form.receiveMobile" id="merchantInfoManagementEdit-receiveMobile" :maxLength="13" allowClear placeholder="请输入收货电话" />
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24" :md="24" :lg="16" :xl="16">
- <a-form-model-item label="收货地址" style="margin: 0;" :label-col="{span:4}" :wrapper-col="{span:20}">
- <a-row :gutter="20">
- <!-- 地址 -->
- <a-col span="8">
- <a-form-model-item prop="receiveProvinceSn">
- <a-select id="merchantInfoManagementEdit-receiveProvinceSn" allowClear @change="getCityList1" v-model="form.receiveProvinceSn" placeholder="请选择省">
- <a-select-option v-for="item in addrProvinceList1" :value="item.areaSn" :key="item.areaSn + 'a'">{{ item.name }}</a-select-option>
- </a-select>
- </a-form-model-item>
- </a-col>
- <a-col span="8">
- <a-form-model-item prop="receiveCitySn">
- <a-select id="merchantInfoManagementEdit-receiveCitySn" allowClear @change="getAreaList1" v-model="form.receiveCitySn" placeholder="请选择市">
- <a-select-option v-for="item in addrCityList1" :value="item.areaSn" :key="item.areaSn + 'b'">{{ item.name }}</a-select-option>
- </a-select>
- </a-form-model-item>
- </a-col>
- <a-col span="8">
- <a-form-model-item prop="receiveDistrictSn">
- <a-select id="merchantInfoManagementEdit-receiveDistrictSn" allowClear @change="areaCharged1" v-model="form.receiveDistrictSn" placeholder="请选择区/县">
- <a-select-option v-for="item in addrDistrictList1" :value="item.areaSn" :key="item.areaSn + 'c'">{{ item.name }}</a-select-option>
- </a-select>
- </a-form-model-item>
- </a-col>
- </a-row>
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
- <a-form-model-item label="收货详细地址" prop="receiveAddress">
- <a-input
- id="merchantInfoManagementEdit-receiveAddress"
- :maxLength="60"
- v-model.trim="form.receiveAddress"
- placeholder="请输入收货详细地址(最多60个字符)"
- allowClear />
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
- <a-form-model-item label="银行账户" prop="tradeAccountName" help="(例:张三)">
- <a-input
- v-model.trim="form.tradeAccountName"
- id="merchantInfoManagementEdit-tradeAccountName"
- :maxLength="30"
- allowClear
- placeholder="请输入银行账户(最多30个字符)" />
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
- <a-form-model-item label="开户行" prop="tradeBankName" help="(例:交通银行)">
- <a-input
- v-model.trim="form.tradeBankName"
- id="merchantInfoManagementEdit-tradeBankName"
- :maxLength="30"
- allowClear
- placeholder="请输入开户行(最多30个字符)" />
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
- <a-form-model-item label="银行账号" prop="tradeBankAccount" help="(例:1123 5677 1112 22342 1123)">
- <a-input
- v-model.trim="form.tradeBankAccount"
- @change="bankAccountChange"
- id="merchantInfoManagementEdit-tradeBankAccount"
- :maxLength="30"
- allowClear
- placeholder="请输入银行账号(最多30个字符)" />
- </a-form-model-item>
- </a-col>
- </a-row>
- </a-collapse-panel>
- </a-collapse>
- </a-card>
- <!-- 总部信息 -->
- <a-card size="small" :bordered="false" class="merchantInfoManagementEdit-cont">
- <a-collapse>
- <a-collapse-panel key="1" header="总部信息">
- <a-row>
- <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
- <a-form-model-item label="箭冠汽配代码" prop="jgAutoPartsCode">
- <a-input
- id="merchantInfoManagementEdit-jgAutoPartsCode"
- :maxLength="30"
- v-model.trim="form.jgAutoPartsCode"
- placeholder="请输入箭冠汽配代码(最多30个字符)"
- allowClear />
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
- <a-form-model-item label="门头更换日期" prop="jgDoorHeaderChangeTime">
- <a-date-picker
- style="width:100%"
- id="merchantInfoManagementEdit-jgDoorHeaderChangeTime"
- :disabledDate="disabledDate"
- v-model="form.jgDoorHeaderChangeTime"
- allowClear
- :format="dateFormat"
- placeholder="请选择日期" />
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
- <a-form-model-item label="特约价是否可见" prop="isShowSpecialPrice">
- <a-radio-group
- name="radioGroup"
- v-model="form.isShowSpecialPrice"
- :disabled="detailData&&detailData.dealerLevel == 'SPECIAL'"
- id="merchantInfoManagementEdit-isShowSpecialPrice" >
- <a-radio :value="1">是</a-radio>
- <a-radio :value="0">否</a-radio>
- </a-radio-group>
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24" :md="24" :lg="16" :xl="16">
- <a-form-model-item label="备注" prop="remark" :label-col="{span:4}" :wrapper-col="{span:20}">
- <a-textarea
- id="merchantInfoManagementEdit-remark"
- :maxLength="300"
- v-model="form.remark"
- placeholder="请输入备注(最多300个字符)"
- allowClear />
- </a-form-model-item>
- </a-col>
- </a-row>
- </a-collapse-panel>
- </a-collapse>
- </a-card>
- </a-form-model>
- </a-spin>
- <div class="affix-cont">
- <a-button
- type="primary"
- class="button-primary"
- :disabled="spinning"
- id="merchantInfoManagementEdit-submit-btn"
- size="large"
- @click="handleSubmit"
- style="padding: 0 60px;">保存</a-button>
- </div>
- </div>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import { getArea } from '@/api/data'
- import { VSelect } from '@/components'
- import { dealerSave, dealerFindUpdateInfoBySn } from '@/api/dealer'
- import chooseWarehouse from '@/views/common/chooseWarehouse'
- import moment from 'moment'
- export default {
- name: 'MerchantInfoManagementEdit',
- mixins: [commonMixin],
- components: { VSelect, chooseWarehouse },
- data () {
- return {
- spinning: false,
- formItemLayout: {
- labelCol: {
- span: 8
- },
- wrapperCol: {
- span: 16
- }
- },
- form: {
- dealerName: '',
- dealerAlias: '',
- dealerType: undefined,
- contact: '',
- contactMobile: '',
- provinceSn: undefined,
- citySn: undefined,
- districtSn: undefined,
- address: '',
- menuMouldId: undefined,
- contactRole: '',
- dealerTelephone: '',
- busniessMode: '',
- busniessItmes: '',
- licenseName: '',
- busniessScope: '',
- buildDate: '',
- isTaxpayer: undefined,
- indentityCard: '',
- brithday: '',
- nativePlace: '',
- mail: '',
- contact2: '',
- contactMobile2: '',
- contractRole2: '',
- zipCode: '',
- receiveContact: '',
- receiveMobile: '',
- receiveProvinceSn: undefined,
- receiveCitySn: undefined,
- receiveDistrictSn: undefined,
- receiveAddress: '',
- tradeAccountName: '',
- tradeBankName: '',
- tradeBankAccount: '',
- jgAutoPartsCode: '',
- jgDoorHeaderChangeTime: '',
- isShowSpecialPrice: 0,
- remark: '',
- kdMidCustomerFnumber: '',
- defaultWarehouseSn: undefined
- },
- rules: {
- dealerName: [
- { required: true, message: '请输入经销商名称', trigger: 'change' }
- ],
- dealerAlias: [
- { required: true, message: '请输入经销商别名', trigger: 'change' }
- ],
- dealerType: [
- { required: true, message: '请选择商户类型', trigger: 'change' }
- ],
- contact: [
- { required: true, message: '请输入联系人1', trigger: 'change' }
- ],
- contactMobile: [
- { required: true, message: '请输入联系手机1', trigger: 'change' },
- { pattern: /^[1][0-9]{10}$/, message: '请输入正确的手机号码!' }
- ],
- provinceSn: [
- { required: true, message: '请选择省', trigger: 'change' }
- ],
- citySn: [
- { required: true, message: '请选择市', trigger: 'change' }
- ],
- districtSn: [
- { required: true, message: '请选择区县', trigger: 'change' }
- ],
- address: [
- { required: true, message: '请输入详细地址', trigger: 'change' }
- ],
- menuMouldId: [
- { required: true, message: '请选择授权类型', trigger: 'change' }
- ],
- defaultWarehouseSn: [
- { required: true, message: '请选择默认仓库', trigger: 'change' }
- ],
- dealerTelephone: [
- { pattern: /^[0-9-]{11,13}$/, message: '请输入正确的电话号码!' }
- ],
- contactMobile2: [
- { pattern: /^[1][0-9]{10}$/, message: '请输入正确的手机号码!' }
- ],
- receiveMobile: [
- { pattern: /^[0-9-]{11,13}$/, message: '请输入正确的电话号码!' }
- ],
- indentityCard: [
- { pattern: /^[0-9a-zA-Z]{15,18}$/, message: '请输入15-18位证件号码' }
- ],
- zipCode: [
- { pattern: /^[1-9][0-9]{5}$/, message: '请输入正确的邮政编码' }
- ],
- mail: [
- { type: 'email', message: '请输入正确的邮箱' }
- ],
- tradeBankAccount: [
- { pattern: /^[0-9a-zA-Z]{16,30}$/, message: '请输入正确银行卡号' }
- ]
- },
- addrProvinceList: [], // 省下拉
- addrCityList: [], // 市下拉
- addrDistrictList: [], // 区下拉
- addrProvinceList1: [], // 省下拉
- addrCityList1: [], // 市下拉
- addrDistrictList1: [], // 区下拉
- dateFormat: 'YYYY-MM-DD',
- detailData: null
- }
- },
- methods: {
- bankAccountChange (e) {
- const { value } = e.target
- console.log(value, value.replace(/\s*/g, ''))
- this.form.tradeBankAccount = value.replace(/\s*/g, '')
- },
- // 不可选日期
- disabledDate (date, dateStrings) {
- return date && date.valueOf() > Date.now()
- },
- // 详情编辑
- getDetail () {
- this.spinning = true
- dealerFindUpdateInfoBySn({ sn: this.$route.params.id }).then(res => {
- if (res.status == 200) {
- this.detailData = res.data
- this.form = Object.assign(this.form, res.data)
- this.form.isShowSpecialPrice = Number(this.form.isShowSpecialPrice)
- if (this.form.provinceSn) {
- this.getArea('city', this.form.provinceSn, 0)
- }
- if (this.form.citySn) {
- this.getArea('district', this.form.citySn, 0)
- }
- if (this.form.receiveProvinceSn) {
- this.getArea('city', this.form.receiveProvinceSn, 1)
- }
- if (this.form.receiveCitySn) {
- this.getArea('district', this.form.receiveCitySn, 1)
- }
- }
- this.spinning = false
- })
- },
- // 提交
- handleSubmit () {
- const _this = this
- this.$refs.ruleForm.validate(valid => {
- if (valid) {
- // console.log(this.form, 'form data')
- const params = JSON.parse(JSON.stringify(_this.form))
- params.buildDate = params.buildDate ? moment(params.buildDate).format('YYYY-MM-DD hh:mm:ss') : ''
- params.brithday = params.brithday ? moment(params.brithday).format('YYYY-MM-DD hh:mm:ss') : ''
- params.cooperateEffectiveTime = params.cooperateEffectiveTime ? moment(params.cooperateEffectiveTime).format('YYYY-MM-DD hh:mm:ss') : ''
- params.jgDoorHeaderChangeTime = params.jgDoorHeaderChangeTime ? moment(params.jgDoorHeaderChangeTime).format('YYYY-MM-DD hh:mm:ss') : ''
- _this.spinning = true
- delete params.dealerCode
- dealerSave(params).then(res => {
- if (res.status == 200) {
- _this.$message.success(res.message)
- _this.handleBack()
- _this.spinning = false
- } else {
- _this.spinning = false
- }
- })
- } else {
- return false
- }
- })
- },
- // 返回
- handleBack () {
- this.$router.push({ path: '/dealerManagement/merchantInfoManagement/list', query: { closeLastOldTab: true } })
- },
- // 获取城市列表
- getCityList (val) {
- this.addrCityList = []
- this.addrDistrictList = []
- this.form.citySn = undefined
- this.form.districtSn = undefined
- if (val) {
- this.getArea('city', val, 0)
- this.form.provinceName = this.addrProvinceList.find(item => item.areaSn == val).name
- } else {
- this.form.provinceName = ''
- }
- },
- // 获取区县列表
- getAreaList (val) {
- this.addrDistrictList = []
- this.form.districtSn = undefined
- if (val) {
- this.getArea('district', val, 0)
- this.form.cityName = this.addrCityList.find(item => item.areaSn == val).name
- } else {
- this.form.cityName = ''
- }
- },
- // 区县变更
- areaCharged (val) {
- console.log(val)
- if (val) {
- this.form.districtName = this.addrDistrictList.find(item => item.areaSn == val).name
- } else {
- this.form.districtName = ''
- }
- },
- // 获取城市列表
- getCityList1 (val) {
- this.addrCityList1 = []
- this.addrDistrictList1 = []
- this.form.receiveCitySn = undefined
- this.form.receiveDistrictSn = undefined
- if (val) {
- this.getArea('city', val, 1)
- this.form.receiveProvinceName = this.addrProvinceList1.find(item => item.areaSn == val).name
- } else {
- this.form.receiveProvinceName = ''
- }
- },
- // 获取区县列表
- getAreaList1 (val) {
- this.addrDistrictList1 = []
- this.form.receiveDistrictSn = undefined
- if (val) {
- this.getArea('district', val, 1)
- this.form.receiveCityName = this.addrCityList1.find(item => item.areaSn == val).name
- } else {
- this.form.receiveCityName = ''
- }
- },
- // 区县变更
- areaCharged1 (val) {
- if (val) {
- this.form.receiveDistrictName = this.addrDistrictList1.find(item => item.areaSn == val).name
- } else {
- this.form.receiveDistrictName = ''
- }
- },
- // 省/市/区
- getArea (leve, sn, index) {
- let params
- if (leve == 'province') {
- params = { type: '2' }
- } else {
- params = { parentId: sn, type: leve == 'city' ? '3' : '4' }
- }
- getArea(params).then(res => {
- if (res.status == 200) {
- if (leve == 'province') {
- this.addrProvinceList = JSON.parse(JSON.stringify(res.data || []))
- this.addrProvinceList1 = JSON.parse(JSON.stringify(res.data || []))
- } else if (leve == 'city') {
- this.addrCityList = JSON.parse(JSON.stringify(res.data || []))
- if (index == 1) {
- this.addrCityList1 = JSON.parse(JSON.stringify(res.data || []))
- }
- } else if (leve == 'district') {
- this.addrDistrictList = JSON.parse(JSON.stringify(res.data || []))
- if (index == 1) {
- this.addrDistrictList1 = JSON.parse(JSON.stringify(res.data || []))
- }
- }
- } else {
- if (leve == 'province') {
- this.addrProvinceList = []
- this.addrProvinceList1 = []
- } else if (leve == 'city') {
- this.addrCityList = []
- if (index == 1) {
- this.addrCityList1 = []
- }
- } else if (leve == 'district') {
- this.addrDistrictList = []
- if (index == 1) {
- this.addrDistrictList1 = []
- }
- }
- }
- })
- },
- pageInit () {
- this.getArea('province')
- this.$refs.ruleForm.resetFields()
- if (this.$route.params.id) { // 编辑页
- this.getDetail()
- }
- }
- },
- mounted () {
- if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
- this.pageInit()
- }
- },
- activated () {
- // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
- if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
- this.pageInit()
- }
- },
- beforeRouteEnter (to, from, next) {
- next(vm => {})
- }
- }
- </script>
- <style lang="less">
- .merchantInfoManagementEdit-wrap{
- position: relative;
- height: 100%;
- padding-bottom: 51px;
- box-sizing: border-box;
- >.ant-spin-nested-loading{
- overflow-y: scroll;
- height: 100%;
- }
- .merchantInfoManagementEdit-cont{
- margin-bottom: 10px;
- }
- }
- </style>
|