edit.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688
  1. <template>
  2. <div class="merchantInfoManagementEdit-wrap">
  3. <a-page-header :ghost="false" :backIcon="false" @back="handleBack" class="merchantInfoManagementEdit-cont">
  4. <!-- 自定义的二级文字标题 -->
  5. <template slot="subTitle">
  6. <a id="merchantInfoManagement-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
  7. </template>
  8. </a-page-header>
  9. <a-spin :spinning="spinning" tip="Loading...">
  10. <a-form-model
  11. id="merchantInfoManagementEdit-form"
  12. ref="ruleForm"
  13. :model="form"
  14. :rules="rules"
  15. :label-col="formItemLayout.labelCol"
  16. :wrapper-col="formItemLayout.wrapperCol">
  17. <!-- 基础信息 -->
  18. <a-card size="small" :bordered="false" class="merchantInfoManagementEdit-cont">
  19. <a-collapse :activeKey="['1']">
  20. <a-collapse-panel key="1" header="基础信息">
  21. <a-row>
  22. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  23. <a-form-model-item label="经销商名称" prop="dealerName">
  24. <a-input v-model.trim="form.dealerName" id="merchantInfoManagementEdit-dealerName" :maxLength="30" allowClear placeholder="请输入经销商名称(最多30个字符)" />
  25. </a-form-model-item>
  26. </a-col>
  27. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  28. <a-form-model-item label="经销商别名" prop="dealerAlias">
  29. <a-input v-model.trim="form.dealerAlias" id="merchantInfoManagementEdit-dealerAlias" :maxLength="30" allowClear placeholder="请输入经销商别名(最多30个字符)" />
  30. </a-form-model-item>
  31. </a-col>
  32. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  33. <a-form-model-item label="商户类型" prop="dealerType">
  34. <v-select
  35. code="DEALER_TYPE"
  36. id="merchantInfoManagementEdit-dealerType"
  37. v-model="form.dealerType"
  38. allowClear
  39. placeholder="请选择商户类型"></v-select>
  40. </a-form-model-item>
  41. </a-col>
  42. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  43. <a-form-model-item label="联系人1" prop="contact">
  44. <a-input v-model.trim="form.contact" id="merchantInfoManagementEdit-contact" :maxLength="30" allowClear placeholder="请输入联系人1(最多30个字符)" />
  45. </a-form-model-item>
  46. </a-col>
  47. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  48. <a-form-model-item label="联系手机1" prop="contactMobile">
  49. <a-input v-model.trim="form.contactMobile" id="merchantInfoManagementEdit-contactMobile" :maxLength="11" allowClear placeholder="请输入联系手机1(最多11个字符)" />
  50. </a-form-model-item>
  51. </a-col>
  52. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  53. <a-form-model-item label="联系角色1" prop="contactRole">
  54. <a-input v-model.trim="form.contactRole" id="merchantInfoManagementEdit-contactRole" :maxLength="30" allowClear placeholder="请输入联系角色1(最多30个字符)" />
  55. </a-form-model-item>
  56. </a-col>
  57. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  58. <a-form-model-item label="联系电话" prop="dealerTelephone">
  59. <a-input v-model.trim="form.dealerTelephone" id="merchantInfoManagementEdit-dealerTelephone" :maxLength="13" allowClear placeholder="请输入联系电话" />
  60. </a-form-model-item>
  61. </a-col>
  62. <a-col :xs="24" :sm="24" :md="24" :lg="16" :xl="16">
  63. <a-form-model-item label="地址" required style="margin: 0;" :label-col="{span:4}" :wrapper-col="{span:20}">
  64. <a-row :gutter="20">
  65. <!-- 地址 -->
  66. <a-col span="8">
  67. <a-form-model-item prop="provinceSn">
  68. <a-select id="merchantInfoManagementEdit-provinceSn" @change="getCityList" v-model="form.provinceSn" placeholder="请选择省">
  69. <a-select-option v-for="item in addrProvinceList" :value="item.areaSn" :key="item.areaSn + 'a'">{{ item.name }}</a-select-option>
  70. </a-select>
  71. </a-form-model-item>
  72. </a-col>
  73. <a-col span="8">
  74. <a-form-model-item prop="citySn">
  75. <a-select id="merchantInfoManagementEdit-citySn" @change="getAreaList" v-model="form.citySn" placeholder="请选择市">
  76. <a-select-option v-for="item in addrCityList" :value="item.areaSn" :key="item.areaSn + 'b'">{{ item.name }}</a-select-option>
  77. </a-select>
  78. </a-form-model-item>
  79. </a-col>
  80. <a-col span="8">
  81. <a-form-model-item prop="districtSn">
  82. <a-select id="merchantInfoManagementEdit-districtSn" @change="areaCharged" v-model="form.districtSn" placeholder="请选择区/县">
  83. <a-select-option v-for="item in addrDistrictList" :value="item.areaSn" :key="item.areaSn + 'c'">{{ item.name }}</a-select-option>
  84. </a-select>
  85. </a-form-model-item>
  86. </a-col>
  87. </a-row>
  88. </a-form-model-item>
  89. </a-col>
  90. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  91. <a-form-model-item label="详细地址" prop="address">
  92. <a-input
  93. id="merchantInfoManagementEdit-address"
  94. :maxLength="60"
  95. v-model="form.address"
  96. placeholder="请输入详细地址(最多60个字符)"
  97. allowClear />
  98. </a-form-model-item>
  99. </a-col>
  100. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  101. <a-form-model-item label="授权类型" prop="menuMouldId">
  102. <v-select
  103. code="MENU_MOULD"
  104. id="merchantInfoManagementEdit-menuMouldId"
  105. v-model="form.menuMouldId"
  106. allowClear
  107. placeholder="请选择授权类型"></v-select>
  108. </a-form-model-item>
  109. </a-col>
  110. </a-row>
  111. </a-collapse-panel>
  112. </a-collapse>
  113. </a-card>
  114. <!-- 公司信息 -->
  115. <a-card size="small" :bordered="false" class="merchantInfoManagementEdit-cont">
  116. <a-collapse>
  117. <a-collapse-panel key="1" header="公司信息">
  118. <a-row>
  119. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  120. <a-form-model-item label="经营方式" prop="busniessMode" help="(例:国有企业)">
  121. <a-input
  122. v-model.trim="form.busniessMode"
  123. id="merchantInfoManagementEdit-busniessMode"
  124. :maxLength="30"
  125. allowClear
  126. placeholder="请输入经营方式(最多30个字符)" />
  127. </a-form-model-item>
  128. </a-col>
  129. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  130. <a-form-model-item label="经营项目" prop="busniessItmes">
  131. <a-input
  132. v-model.trim="form.busniessItmes"
  133. id="merchantInfoManagementEdit-busniessItmes"
  134. :maxLength="30"
  135. allowClear
  136. placeholder="请输入经营项目(最多30个字符)" />
  137. </a-form-model-item>
  138. </a-col>
  139. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  140. <a-form-model-item label="公司规模" prop="busniessScope" help="(例:100-999人)">
  141. <a-input-number
  142. id="merchantInfoManagementEdit-busniessScope"
  143. v-model="form.busniessScope"
  144. :precision="0"
  145. :min="1"
  146. :max="999999"
  147. placeholder="请输入"
  148. style="width: 100%;" />
  149. </a-form-model-item>
  150. </a-col>
  151. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  152. <a-form-model-item label="成立时间" prop="buildDate">
  153. <a-date-picker
  154. style="width:100%"
  155. id="merchantInfoManagementEdit-buildDate"
  156. :disabledDate="disabledDate"
  157. v-model="form.buildDate"
  158. :format="dateFormat"
  159. placeholder="请选择日期" />
  160. </a-form-model-item>
  161. </a-col>
  162. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  163. <a-form-model-item label="一般纳税人" prop="isTaxpayer">
  164. <v-select
  165. code="FLAG"
  166. id="customerManagementEdit-isTaxpayer"
  167. v-model="form.isTaxpayer"
  168. allowClear
  169. placeholder="请选择是否"
  170. ></v-select>
  171. </a-form-model-item>
  172. </a-col>
  173. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  174. <a-form-model-item label="身份证号码" prop="indentityCard">
  175. <a-input
  176. v-model.trim="form.indentityCard"
  177. id="merchantInfoManagementEdit-indentityCard"
  178. :maxLength="18"
  179. allowClear
  180. placeholder="请输入身份证号码(最多18个字符)" />
  181. </a-form-model-item>
  182. </a-col>
  183. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  184. <a-form-model-item label="生日" prop="brithday">
  185. <a-date-picker
  186. style="width:100%"
  187. id="merchantInfoManagementEdit-brithday"
  188. :disabledDate="disabledDate"
  189. v-model="form.brithday"
  190. :format="dateFormat"
  191. placeholder="请选择日期" />
  192. </a-form-model-item>
  193. </a-col>
  194. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  195. <a-form-model-item label="籍贯" prop="nativePlace">
  196. <a-input
  197. v-model.trim="form.nativePlace"
  198. id="merchantInfoManagementEdit-nativePlace"
  199. :maxLength="30"
  200. allowClear
  201. placeholder="请输入籍贯(最多30个字符)" />
  202. </a-form-model-item>
  203. </a-col>
  204. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  205. <a-form-model-item label="邮箱" prop="mail">
  206. <a-input
  207. v-model.trim="form.mail"
  208. id="merchantInfoManagementEdit-mail"
  209. :maxLength="30"
  210. allowClear
  211. placeholder="请输入邮箱(最多30个字符)" />
  212. </a-form-model-item>
  213. </a-col>
  214. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  215. <a-form-model-item label="联系人2" prop="contact2">
  216. <a-input v-model.trim="form.contact2" id="merchantInfoManagementEdit-contact2" :maxLength="30" allowClear placeholder="请输入联系人2(最多30个字符)" />
  217. </a-form-model-item>
  218. </a-col>
  219. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  220. <a-form-model-item label="联系手机2" prop="contactMobile2">
  221. <a-input v-model.trim="form.contactMobile2" id="merchantInfoManagementEdit-contactMobile2" :maxLength="11" allowClear placeholder="请输入联系手机2(最多11个字符)" />
  222. </a-form-model-item>
  223. </a-col>
  224. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  225. <a-form-model-item label="联系角色2" prop="contractRole2">
  226. <a-input v-model.trim="form.contractRole2" id="merchantInfoManagementEdit-contractRole2" :maxLength="30" allowClear placeholder="请输入联系角色2(最多30个字符)" />
  227. </a-form-model-item>
  228. </a-col>
  229. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  230. <a-form-model-item label="邮政编码" prop="zipCode">
  231. <a-input v-model.trim="form.zipCode" id="merchantInfoManagementEdit-zipCode" :maxLength="6" allowClear placeholder="请输入邮政编码(最多6个字符)" />
  232. </a-form-model-item>
  233. </a-col>
  234. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  235. <a-form-model-item label="收货人" prop="receiveContact">
  236. <a-input v-model.trim="form.receiveContact" id="merchantInfoManagementEdit-receiveContact" :maxLength="30" allowClear placeholder="请输入收货人(最多30个字符)" />
  237. </a-form-model-item>
  238. </a-col>
  239. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  240. <a-form-model-item label="收货电话" prop="receiveMobile">
  241. <a-input v-model.trim="form.receiveMobile" id="merchantInfoManagementEdit-receiveMobile" :maxLength="13" allowClear placeholder="请输入收货电话" />
  242. </a-form-model-item>
  243. </a-col>
  244. <a-col :xs="24" :sm="24" :md="24" :lg="16" :xl="16">
  245. <a-form-model-item label="收货地址" style="margin: 0;" :label-col="{span:4}" :wrapper-col="{span:20}">
  246. <a-row :gutter="20">
  247. <!-- 地址 -->
  248. <a-col span="8">
  249. <a-form-model-item prop="receiveProvinceSn">
  250. <a-select id="merchantInfoManagementEdit-receiveProvinceSn" @change="getCityList1" v-model="form.receiveProvinceSn" placeholder="请选择省">
  251. <a-select-option v-for="item in addrProvinceList1" :value="item.areaSn" :key="item.areaSn + 'a'">{{ item.name }}</a-select-option>
  252. </a-select>
  253. </a-form-model-item>
  254. </a-col>
  255. <a-col span="8">
  256. <a-form-model-item prop="receiveCitySn">
  257. <a-select id="merchantInfoManagementEdit-receiveCitySn" @change="getAreaList1" v-model="form.receiveCitySn" placeholder="请选择市">
  258. <a-select-option v-for="item in addrCityList1" :value="item.areaSn" :key="item.areaSn + 'b'">{{ item.name }}</a-select-option>
  259. </a-select>
  260. </a-form-model-item>
  261. </a-col>
  262. <a-col span="8">
  263. <a-form-model-item prop="receiveDistrictSn">
  264. <a-select id="merchantInfoManagementEdit-receiveDistrictSn" @change="areaCharged1" v-model="form.receiveDistrictSn" placeholder="请选择区/县">
  265. <a-select-option v-for="item in addrDistrictList1" :value="item.areaSn" :key="item.areaSn + 'c'">{{ item.name }}</a-select-option>
  266. </a-select>
  267. </a-form-model-item>
  268. </a-col>
  269. </a-row>
  270. </a-form-model-item>
  271. </a-col>
  272. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  273. <a-form-model-item label="收货详细地址" prop="receiveAddress">
  274. <a-input
  275. id="merchantInfoManagementEdit-receiveAddress"
  276. :maxLength="60"
  277. v-model="form.receiveAddress"
  278. placeholder="请输入收货详细地址(最多60个字符)"
  279. allowClear />
  280. </a-form-model-item>
  281. </a-col>
  282. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  283. <a-form-model-item label="银行账户" prop="tradeAccountName" help="(例:张三)">
  284. <a-input
  285. v-model.trim="form.tradeAccountName"
  286. id="merchantInfoManagementEdit-tradeAccountName"
  287. :maxLength="30"
  288. allowClear
  289. placeholder="请输入银行账户(最多30个字符)" />
  290. </a-form-model-item>
  291. </a-col>
  292. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  293. <a-form-model-item label="开户行" prop="tradeBankName" help="(例:交通银行)">
  294. <a-input
  295. v-model.trim="form.tradeBankName"
  296. id="merchantInfoManagementEdit-tradeBankName"
  297. :maxLength="30"
  298. allowClear
  299. placeholder="请输入开户行(最多30个字符)" />
  300. </a-form-model-item>
  301. </a-col>
  302. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  303. <a-form-model-item label="银行账号" prop="tradeBankAccount" help="(例:1123 5677 1112 22342 1123)">
  304. <a-input
  305. v-model.trim="form.tradeBankAccount"
  306. id="merchantInfoManagementEdit-tradeBankAccount"
  307. :maxLength="30"
  308. allowClear
  309. placeholder="请输入银行账号(最多30个字符)" />
  310. </a-form-model-item>
  311. </a-col>
  312. </a-row>
  313. </a-collapse-panel>
  314. </a-collapse>
  315. </a-card>
  316. <!-- 总部信息 -->
  317. <a-card size="small" :bordered="false" class="merchantInfoManagementEdit-cont">
  318. <a-collapse>
  319. <a-collapse-panel key="1" header="总部信息">
  320. <a-row>
  321. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  322. <a-form-model-item label="箭冠汽配代码" prop="jgAutoPartsCode">
  323. <a-input
  324. id="merchantInfoManagementEdit-jgAutoPartsCode"
  325. :maxLength="30"
  326. v-model="form.jgAutoPartsCode"
  327. placeholder="请输入箭冠汽配代码(最多30个字符)"
  328. allowClear />
  329. </a-form-model-item>
  330. </a-col>
  331. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  332. <a-form-model-item label="门头更换日期" prop="jgDoorHeaderChangeTime">
  333. <a-date-picker
  334. style="width:100%"
  335. id="merchantInfoManagementEdit-jgDoorHeaderChangeTime"
  336. :disabledDate="disabledDate"
  337. v-model="form.jgDoorHeaderChangeTime"
  338. :format="dateFormat"
  339. placeholder="请选择日期" />
  340. </a-form-model-item>
  341. </a-col>
  342. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  343. <a-form-model-item label="特约价是否可见" prop="isShowSpecialPrice">
  344. <a-radio-group
  345. name="radioGroup"
  346. v-model="form.isShowSpecialPrice"
  347. :disabled="detailData&&detailData.dealerLevel == 'SPECIAL'"
  348. id="merchantInfoManagementEdit-isShowSpecialPrice" >
  349. <a-radio :value="1">是</a-radio>
  350. <a-radio :value="0">否</a-radio>
  351. </a-radio-group>
  352. </a-form-model-item>
  353. </a-col>
  354. <a-col :xs="24" :sm="24" :md="24" :lg="16" :xl="16">
  355. <a-form-model-item label="备注" prop="remark" :label-col="{span:4}" :wrapper-col="{span:20}">
  356. <a-textarea
  357. id="merchantInfoManagementEdit-remark"
  358. :maxLength="300"
  359. v-model="form.remark"
  360. placeholder="请输入备注(最多300个字符)"
  361. allowClear />
  362. </a-form-model-item>
  363. </a-col>
  364. </a-row>
  365. </a-collapse-panel>
  366. </a-collapse>
  367. </a-card>
  368. </a-form-model>
  369. <a-affix :offset-bottom="0">
  370. <div style="text-align: center;width: 100%;background-color: #fff;padding: 12px 0;box-shadow: 0 0 20px #dcdee2;">
  371. <a-button
  372. type="primary"
  373. class="button-primary"
  374. id="merchantInfoManagementEdit-submit-btn"
  375. size="large"
  376. @click="handleSubmit"
  377. style="padding: 0 60px;">提交</a-button>
  378. </div>
  379. </a-affix>
  380. </a-spin>
  381. </div>
  382. </template>
  383. <script>
  384. import { getArea } from '@/api/data'
  385. import { VSelect } from '@/components'
  386. import { dealerSave, dealerFindUpdateInfoBySn } from '@/api/dealer'
  387. import moment from 'moment'
  388. export default {
  389. components: { VSelect },
  390. data () {
  391. return {
  392. spinning: false,
  393. formItemLayout: {
  394. labelCol: {
  395. span: 8
  396. },
  397. wrapperCol: {
  398. span: 16
  399. }
  400. },
  401. form: {
  402. dealerName: '',
  403. dealerAlias: '',
  404. dealerType: undefined,
  405. contact: '',
  406. contactMobile: '',
  407. provinceSn: undefined,
  408. citySn: undefined,
  409. districtSn: undefined,
  410. address: '',
  411. menuMouldId: undefined,
  412. contactRole: '',
  413. dealerTelephone: '',
  414. busniessMode: '',
  415. busniessItmes: '',
  416. busniessScope: '',
  417. buildDate: '',
  418. isTaxpayer: undefined,
  419. indentityCard: '',
  420. brithday: '',
  421. nativePlace: '',
  422. mail: '',
  423. contact2: '',
  424. contactMobile2: '',
  425. contractRole2: '',
  426. zipCode: '',
  427. receiveContact: '',
  428. receiveMobile: '',
  429. receiveProvinceSn: undefined,
  430. receiveCitySn: undefined,
  431. receiveDistrictSn: undefined,
  432. receiveAddress: '',
  433. tradeAccountName: '',
  434. tradeBankName: '',
  435. tradeBankAccount: '',
  436. jgAutoPartsCode: '',
  437. jgDoorHeaderChangeTime: '',
  438. isShowSpecialPrice: 0,
  439. remark: ''
  440. },
  441. rules: {
  442. dealerName: [
  443. { required: true, message: '请输入经销商名称', trigger: 'change' }
  444. ],
  445. dealerAlias: [
  446. { required: true, message: '请输入经销商别名', trigger: 'change' }
  447. ],
  448. dealerType: [
  449. { required: true, message: '请选择商户类型', trigger: 'change' }
  450. ],
  451. contact: [
  452. { required: true, message: '请输入联系人1', trigger: 'change' }
  453. ],
  454. contactMobile: [
  455. { required: true, message: '请输入联系手机1', trigger: 'change' },
  456. { pattern: /^[1][0-9]{10}$/, message: '请输入正确的手机号码!' }
  457. ],
  458. provinceSn: [
  459. { required: true, message: '请选择省', trigger: 'change' }
  460. ],
  461. citySn: [
  462. { required: true, message: '请选择市', trigger: 'change' }
  463. ],
  464. districtSn: [
  465. { required: true, message: '请选择区县', trigger: 'change' }
  466. ],
  467. address: [
  468. { required: true, message: '请输入详细地址', trigger: 'change' }
  469. ],
  470. menuMouldId: [
  471. { required: true, message: '请选择授权类型', trigger: 'change' }
  472. ],
  473. dealerTelephone: [
  474. { pattern: /^[0-9-]{11,13}$/, message: '请输入正确的电话号码!' }
  475. ],
  476. contactMobile2: [
  477. { pattern: /^[1][0-9]{10}$/, message: '请输入正确的手机号码!' }
  478. ],
  479. receiveMobile: [
  480. { pattern: /^[0-9-]{11,13}$/, message: '请输入正确的电话号码!' }
  481. ],
  482. indentityCard: [
  483. { pattern: /^[0-9a-zA-Z]{15,18}$/, message: '请输入15-18位证件号码' }
  484. ],
  485. zipCode: [
  486. { pattern: /^[1-9][0-9]{5}$/, message: '请输入正确的邮政编码' }
  487. ],
  488. mail: [
  489. { type: 'email', message: '请输入正确的邮箱' }
  490. ],
  491. tradeBankAccount: [
  492. { pattern: /^[0-9a-zA-Z]{16,30}$/, message: '请输入正确银行卡号' }
  493. ]
  494. },
  495. addrProvinceList: [], // 省下拉
  496. addrCityList: [], // 市下拉
  497. addrDistrictList: [], // 区下拉
  498. addrProvinceList1: [], // 省下拉
  499. addrCityList1: [], // 市下拉
  500. addrDistrictList1: [], // 区下拉
  501. dateFormat: 'YYYY-MM-DD',
  502. detailData: null
  503. }
  504. },
  505. methods: {
  506. // 不可选日期
  507. disabledDate (date, dateStrings) {
  508. return date && date.valueOf() > Date.now()
  509. },
  510. // 详情编辑
  511. getDetail () {
  512. dealerFindUpdateInfoBySn({ sn: this.$route.params.id }).then(res => {
  513. if (res.status == 200) {
  514. this.detailData = res.data
  515. this.form = Object.assign(this.form, res.data)
  516. this.form.isShowSpecialPrice = Number(this.form.isShowSpecialPrice)
  517. if (this.form.provinceSn) {
  518. this.getArea('city', this.form.provinceSn, 0)
  519. }
  520. if (this.form.citySn) {
  521. this.getArea('district', this.form.citySn, 0)
  522. }
  523. if (this.form.receiveProvinceSn) {
  524. this.getArea('city', this.form.receiveProvinceSn, 1)
  525. }
  526. if (this.form.receiveCitySn) {
  527. this.getArea('district', this.form.receiveCitySn, 1)
  528. }
  529. }
  530. })
  531. },
  532. // 提交
  533. handleSubmit () {
  534. const _this = this
  535. this.$refs.ruleForm.validate(valid => {
  536. if (valid) {
  537. // console.log(this.form, 'form data')
  538. const params = JSON.parse(JSON.stringify(_this.form))
  539. params.buildDate = params.buildDate ? moment(params.buildDate).format('YYYY-MM-DD hh:mm:ss') : ''
  540. params.brithday = params.brithday ? moment(params.brithday).format('YYYY-MM-DD hh:mm:ss') : ''
  541. params.cooperateEffectiveTime = params.cooperateEffectiveTime ? moment(params.cooperateEffectiveTime).format('YYYY-MM-DD hh:mm:ss') : ''
  542. params.jgDoorHeaderChangeTime = params.jgDoorHeaderChangeTime ? moment(params.jgDoorHeaderChangeTime).format('YYYY-MM-DD hh:mm:ss') : ''
  543. _this.spinning = true
  544. dealerSave(params).then(res => {
  545. if (res.status == 200) {
  546. _this.$message.success(res.message)
  547. _this.handleBack()
  548. _this.spinning = false
  549. } else {
  550. _this.spinning = false
  551. }
  552. })
  553. } else {
  554. return false
  555. }
  556. })
  557. },
  558. // 返回
  559. handleBack () {
  560. this.$router.push({ name: 'merchantInfoManagementList' })
  561. },
  562. // 获取城市列表
  563. getCityList (val) {
  564. const index = this.addrProvinceList.findIndex(item => item.areaSn == val)
  565. if (index >= 0) {
  566. this.form.provinceName = this.addrProvinceList[index].name
  567. }
  568. this.addrCityList = []
  569. this.addrDistrictList = []
  570. this.form.citySn = undefined
  571. this.form.districtSn = undefined
  572. this.form.address = ''
  573. this.getArea('city', val, 0)
  574. },
  575. // 获取区县列表
  576. getAreaList (val) {
  577. const index = this.addrCityList.findIndex(item => item.areaSn == val)
  578. if (index >= 0) {
  579. this.form.cityName = this.addrCityList[index].name
  580. }
  581. this.addrDistrictList = []
  582. this.form.districtSn = undefined
  583. this.form.address = ''
  584. this.getArea('district', val, 0)
  585. },
  586. // 区县变更
  587. areaCharged (val) {
  588. const index = this.addrDistrictList.findIndex(item => item.areaSn == val)
  589. if (index >= 0) {
  590. this.form.districtName = this.addrDistrictList[index].name
  591. }
  592. this.form.address = ''
  593. },
  594. // 获取城市列表
  595. getCityList1 (val) {
  596. const index = this.addrProvinceList1.findIndex(item => item.areaSn == val)
  597. if (index >= 0) {
  598. this.form.receiveProvinceName = this.addrProvinceList1[index].name
  599. }
  600. this.addrCityList1 = []
  601. this.addrDistrictList1 = []
  602. this.form.receiveCitySn = undefined
  603. this.form.receiveDistrictSn = undefined
  604. this.form.receiveAddress = ''
  605. this.getArea('city', val, 1)
  606. },
  607. // 获取区县列表
  608. getAreaList1 (val) {
  609. const index = this.addrCityList1.findIndex(item => item.areaSn == val)
  610. if (index >= 0) {
  611. this.form.receiveCityName = this.addrCityList1[index].name
  612. }
  613. this.addrDistrictList1 = []
  614. this.form.receiveDistrictSn = undefined
  615. this.form.receiveAddress = ''
  616. this.getArea('district', val, 1)
  617. },
  618. // 区县变更
  619. areaCharged1 (val) {
  620. const index = this.addrDistrictList1.findIndex(item => item.areaSn == val)
  621. if (index >= 0) {
  622. this.form.receiveDistrictName = this.addrDistrictList1[index].name
  623. }
  624. this.form.receiveAddress = ''
  625. },
  626. // 省/市/区
  627. getArea (leve, sn, index) {
  628. let params
  629. if (leve == 'province') {
  630. params = { type: '2' }
  631. } else {
  632. params = { parentId: sn, type: leve == 'city' ? '3' : '4' }
  633. }
  634. getArea(params).then(res => {
  635. if (res.status == 200) {
  636. if (leve == 'province') {
  637. this.addrProvinceList = JSON.parse(JSON.stringify(res.data || []))
  638. this.addrProvinceList1 = JSON.parse(JSON.stringify(res.data || []))
  639. } else if (leve == 'city') {
  640. this.addrCityList = JSON.parse(JSON.stringify(res.data || []))
  641. if (index == 1) {
  642. this.addrCityList1 = JSON.parse(JSON.stringify(res.data || []))
  643. }
  644. } else if (leve == 'district') {
  645. this.addrDistrictList = JSON.parse(JSON.stringify(res.data || []))
  646. if (index == 1) {
  647. this.addrDistrictList1 = JSON.parse(JSON.stringify(res.data || []))
  648. }
  649. }
  650. } else {
  651. if (leve == 'province') {
  652. this.addrProvinceList = []
  653. this.addrProvinceList1 = []
  654. } else if (leve == 'city') {
  655. this.addrCityList = []
  656. if (index == 1) {
  657. this.addrCityList1 = []
  658. }
  659. } else if (leve == 'district') {
  660. this.addrDistrictList = []
  661. if (index == 1) {
  662. this.addrDistrictList1 = []
  663. }
  664. }
  665. }
  666. })
  667. }
  668. },
  669. beforeRouteEnter (to, from, next) {
  670. next(vm => {
  671. vm.getArea('province')
  672. vm.$refs.ruleForm.resetFields()
  673. if (vm.$route.params.id) { // 编辑页
  674. vm.getDetail()
  675. }
  676. })
  677. }
  678. }
  679. </script>
  680. <style lang="less">
  681. .merchantInfoManagementEdit-wrap{
  682. .merchantInfoManagementEdit-cont{
  683. margin-bottom: 10px;
  684. }
  685. }
  686. </style>