edit.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711
  1. <template>
  2. <div class="merchantInfoManagementEdit-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-page-header :ghost="false" :backIcon="false" @back="handleBack" class="merchantInfoManagementEdit-cont">
  5. <!-- 自定义的二级文字标题 -->
  6. <template slot="subTitle">
  7. <a id="merchantInfoManagement-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
  8. </template>
  9. </a-page-header>
  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" allowClear @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" allowClear @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" allowClear @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.trim="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="100"
  135. allowClear
  136. placeholder="请输入经营项目(最多100个字符)" />
  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. allowClear
  160. placeholder="请选择日期" />
  161. </a-form-model-item>
  162. </a-col>
  163. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  164. <a-form-model-item label="一般纳税人" prop="isTaxpayer">
  165. <v-select
  166. code="FLAG"
  167. id="customerManagementEdit-isTaxpayer"
  168. v-model="form.isTaxpayer"
  169. allowClear
  170. placeholder="请选择是否"
  171. ></v-select>
  172. </a-form-model-item>
  173. </a-col>
  174. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  175. <a-form-model-item label="身份证号码" prop="indentityCard">
  176. <a-input
  177. v-model.trim="form.indentityCard"
  178. id="merchantInfoManagementEdit-indentityCard"
  179. :maxLength="18"
  180. allowClear
  181. placeholder="请输入身份证号码(最多18个字符)" />
  182. </a-form-model-item>
  183. </a-col>
  184. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  185. <a-form-model-item label="生日" prop="brithday">
  186. <a-date-picker
  187. style="width:100%"
  188. id="merchantInfoManagementEdit-brithday"
  189. :disabledDate="disabledDate"
  190. v-model="form.brithday"
  191. :format="dateFormat"
  192. allowClear
  193. placeholder="请选择日期" />
  194. </a-form-model-item>
  195. </a-col>
  196. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  197. <a-form-model-item label="籍贯" prop="nativePlace">
  198. <a-input
  199. v-model.trim="form.nativePlace"
  200. id="merchantInfoManagementEdit-nativePlace"
  201. :maxLength="30"
  202. allowClear
  203. placeholder="请输入籍贯(最多30个字符)" />
  204. </a-form-model-item>
  205. </a-col>
  206. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  207. <a-form-model-item label="邮箱" prop="mail">
  208. <a-input
  209. v-model.trim="form.mail"
  210. id="merchantInfoManagementEdit-mail"
  211. :maxLength="30"
  212. allowClear
  213. placeholder="请输入邮箱(最多30个字符)" />
  214. </a-form-model-item>
  215. </a-col>
  216. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  217. <a-form-model-item label="联系人2" prop="contact2">
  218. <a-input v-model.trim="form.contact2" id="merchantInfoManagementEdit-contact2" :maxLength="30" allowClear placeholder="请输入联系人2(最多30个字符)" />
  219. </a-form-model-item>
  220. </a-col>
  221. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  222. <a-form-model-item label="联系手机2" prop="contactMobile2">
  223. <a-input v-model.trim="form.contactMobile2" id="merchantInfoManagementEdit-contactMobile2" :maxLength="11" allowClear placeholder="请输入联系手机2(最多11个字符)" />
  224. </a-form-model-item>
  225. </a-col>
  226. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  227. <a-form-model-item label="联系角色2" prop="contractRole2">
  228. <a-input v-model.trim="form.contractRole2" id="merchantInfoManagementEdit-contractRole2" :maxLength="30" allowClear placeholder="请输入联系角色2(最多30个字符)" />
  229. </a-form-model-item>
  230. </a-col>
  231. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  232. <a-form-model-item label="邮政编码" prop="zipCode">
  233. <a-input v-model.trim="form.zipCode" id="merchantInfoManagementEdit-zipCode" :maxLength="6" allowClear placeholder="请输入邮政编码(最多6个字符)" />
  234. </a-form-model-item>
  235. </a-col>
  236. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  237. <a-form-model-item label="收货人" prop="receiveContact">
  238. <a-input v-model.trim="form.receiveContact" id="merchantInfoManagementEdit-receiveContact" :maxLength="30" allowClear placeholder="请输入收货人(最多30个字符)" />
  239. </a-form-model-item>
  240. </a-col>
  241. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  242. <a-form-model-item label="收货电话" prop="receiveMobile">
  243. <a-input v-model.trim="form.receiveMobile" id="merchantInfoManagementEdit-receiveMobile" :maxLength="13" allowClear placeholder="请输入收货电话" />
  244. </a-form-model-item>
  245. </a-col>
  246. <a-col :xs="24" :sm="24" :md="24" :lg="16" :xl="16">
  247. <a-form-model-item label="收货地址" style="margin: 0;" :label-col="{span:4}" :wrapper-col="{span:20}">
  248. <a-row :gutter="20">
  249. <!-- 地址 -->
  250. <a-col span="8">
  251. <a-form-model-item prop="receiveProvinceSn">
  252. <a-select id="merchantInfoManagementEdit-receiveProvinceSn" allowClear @change="getCityList1" v-model="form.receiveProvinceSn" placeholder="请选择省">
  253. <a-select-option v-for="item in addrProvinceList1" :value="item.areaSn" :key="item.areaSn + 'a'">{{ item.name }}</a-select-option>
  254. </a-select>
  255. </a-form-model-item>
  256. </a-col>
  257. <a-col span="8">
  258. <a-form-model-item prop="receiveCitySn">
  259. <a-select id="merchantInfoManagementEdit-receiveCitySn" allowClear @change="getAreaList1" v-model="form.receiveCitySn" placeholder="请选择市">
  260. <a-select-option v-for="item in addrCityList1" :value="item.areaSn" :key="item.areaSn + 'b'">{{ item.name }}</a-select-option>
  261. </a-select>
  262. </a-form-model-item>
  263. </a-col>
  264. <a-col span="8">
  265. <a-form-model-item prop="receiveDistrictSn">
  266. <a-select id="merchantInfoManagementEdit-receiveDistrictSn" allowClear @change="areaCharged1" v-model="form.receiveDistrictSn" placeholder="请选择区/县">
  267. <a-select-option v-for="item in addrDistrictList1" :value="item.areaSn" :key="item.areaSn + 'c'">{{ item.name }}</a-select-option>
  268. </a-select>
  269. </a-form-model-item>
  270. </a-col>
  271. </a-row>
  272. </a-form-model-item>
  273. </a-col>
  274. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  275. <a-form-model-item label="收货详细地址" prop="receiveAddress">
  276. <a-input
  277. id="merchantInfoManagementEdit-receiveAddress"
  278. :maxLength="60"
  279. v-model.trim="form.receiveAddress"
  280. placeholder="请输入收货详细地址(最多60个字符)"
  281. allowClear />
  282. </a-form-model-item>
  283. </a-col>
  284. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  285. <a-form-model-item label="银行账户" prop="tradeAccountName" help="(例:张三)">
  286. <a-input
  287. v-model.trim="form.tradeAccountName"
  288. id="merchantInfoManagementEdit-tradeAccountName"
  289. :maxLength="30"
  290. allowClear
  291. placeholder="请输入银行账户(最多30个字符)" />
  292. </a-form-model-item>
  293. </a-col>
  294. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  295. <a-form-model-item label="开户行" prop="tradeBankName" help="(例:交通银行)">
  296. <a-input
  297. v-model.trim="form.tradeBankName"
  298. id="merchantInfoManagementEdit-tradeBankName"
  299. :maxLength="30"
  300. allowClear
  301. placeholder="请输入开户行(最多30个字符)" />
  302. </a-form-model-item>
  303. </a-col>
  304. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  305. <a-form-model-item label="银行账号" prop="tradeBankAccount" help="(例:1123 5677 1112 22342 1123)">
  306. <a-input
  307. v-model.trim="form.tradeBankAccount"
  308. id="merchantInfoManagementEdit-tradeBankAccount"
  309. :maxLength="30"
  310. allowClear
  311. placeholder="请输入银行账号(最多30个字符)" />
  312. </a-form-model-item>
  313. </a-col>
  314. </a-row>
  315. </a-collapse-panel>
  316. </a-collapse>
  317. </a-card>
  318. <!-- 总部信息 -->
  319. <a-card size="small" :bordered="false" class="merchantInfoManagementEdit-cont">
  320. <a-collapse>
  321. <a-collapse-panel key="1" header="总部信息">
  322. <a-row>
  323. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  324. <a-form-model-item label="箭冠汽配代码" prop="jgAutoPartsCode">
  325. <a-input
  326. id="merchantInfoManagementEdit-jgAutoPartsCode"
  327. :maxLength="30"
  328. v-model.trim="form.jgAutoPartsCode"
  329. placeholder="请输入箭冠汽配代码(最多30个字符)"
  330. allowClear />
  331. </a-form-model-item>
  332. </a-col>
  333. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  334. <a-form-model-item label="门头更换日期" prop="jgDoorHeaderChangeTime">
  335. <a-date-picker
  336. style="width:100%"
  337. id="merchantInfoManagementEdit-jgDoorHeaderChangeTime"
  338. :disabledDate="disabledDate"
  339. v-model="form.jgDoorHeaderChangeTime"
  340. allowClear
  341. :format="dateFormat"
  342. placeholder="请选择日期" />
  343. </a-form-model-item>
  344. </a-col>
  345. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  346. <a-form-model-item label="特约价是否可见" prop="isShowSpecialPrice">
  347. <a-radio-group
  348. name="radioGroup"
  349. v-model="form.isShowSpecialPrice"
  350. :disabled="detailData&&detailData.dealerLevel == 'SPECIAL'"
  351. id="merchantInfoManagementEdit-isShowSpecialPrice" >
  352. <a-radio :value="1">是</a-radio>
  353. <a-radio :value="0">否</a-radio>
  354. </a-radio-group>
  355. </a-form-model-item>
  356. </a-col>
  357. <a-col :xs="24" :sm="24" :md="24" :lg="16" :xl="16">
  358. <a-form-model-item label="备注" prop="remark" :label-col="{span:4}" :wrapper-col="{span:20}">
  359. <a-textarea
  360. id="merchantInfoManagementEdit-remark"
  361. :maxLength="300"
  362. v-model="form.remark"
  363. placeholder="请输入备注(最多300个字符)"
  364. allowClear />
  365. </a-form-model-item>
  366. </a-col>
  367. </a-row>
  368. </a-collapse-panel>
  369. </a-collapse>
  370. </a-card>
  371. </a-form-model>
  372. </a-spin>
  373. <div class="affix-cont">
  374. <a-button
  375. type="primary"
  376. class="button-primary"
  377. :disabled="spinning"
  378. id="merchantInfoManagementEdit-submit-btn"
  379. size="large"
  380. @click="handleSubmit"
  381. style="padding: 0 60px;">提交</a-button>
  382. </div>
  383. </div>
  384. </template>
  385. <script>
  386. import { getArea } from '@/api/data'
  387. import { VSelect } from '@/components'
  388. import { dealerSave, dealerFindUpdateInfoBySn } from '@/api/dealer'
  389. import moment from 'moment'
  390. export default {
  391. components: { VSelect },
  392. data () {
  393. return {
  394. spinning: false,
  395. formItemLayout: {
  396. labelCol: {
  397. span: 8
  398. },
  399. wrapperCol: {
  400. span: 16
  401. }
  402. },
  403. form: {
  404. dealerName: '',
  405. dealerAlias: '',
  406. dealerType: undefined,
  407. contact: '',
  408. contactMobile: '',
  409. provinceSn: undefined,
  410. citySn: undefined,
  411. districtSn: undefined,
  412. address: '',
  413. menuMouldId: undefined,
  414. contactRole: '',
  415. dealerTelephone: '',
  416. busniessMode: '',
  417. busniessItmes: '',
  418. busniessScope: '',
  419. buildDate: '',
  420. isTaxpayer: undefined,
  421. indentityCard: '',
  422. brithday: '',
  423. nativePlace: '',
  424. mail: '',
  425. contact2: '',
  426. contactMobile2: '',
  427. contractRole2: '',
  428. zipCode: '',
  429. receiveContact: '',
  430. receiveMobile: '',
  431. receiveProvinceSn: undefined,
  432. receiveCitySn: undefined,
  433. receiveDistrictSn: undefined,
  434. receiveAddress: '',
  435. tradeAccountName: '',
  436. tradeBankName: '',
  437. tradeBankAccount: '',
  438. jgAutoPartsCode: '',
  439. jgDoorHeaderChangeTime: '',
  440. isShowSpecialPrice: 0,
  441. remark: ''
  442. },
  443. rules: {
  444. dealerName: [
  445. { required: true, message: '请输入经销商名称', trigger: 'change' }
  446. ],
  447. dealerAlias: [
  448. { required: true, message: '请输入经销商别名', trigger: 'change' }
  449. ],
  450. dealerType: [
  451. { required: true, message: '请选择商户类型', trigger: 'change' }
  452. ],
  453. contact: [
  454. { required: true, message: '请输入联系人1', trigger: 'change' }
  455. ],
  456. contactMobile: [
  457. { required: true, message: '请输入联系手机1', trigger: 'change' },
  458. { pattern: /^[1][0-9]{10}$/, message: '请输入正确的手机号码!' }
  459. ],
  460. provinceSn: [
  461. { required: true, message: '请选择省', trigger: 'change' }
  462. ],
  463. citySn: [
  464. { required: true, message: '请选择市', trigger: 'change' }
  465. ],
  466. districtSn: [
  467. { required: true, message: '请选择区县', trigger: 'change' }
  468. ],
  469. address: [
  470. { required: true, message: '请输入详细地址', trigger: 'change' }
  471. ],
  472. menuMouldId: [
  473. { required: true, message: '请选择授权类型', trigger: 'change' }
  474. ],
  475. dealerTelephone: [
  476. { pattern: /^[0-9-]{11,13}$/, message: '请输入正确的电话号码!' }
  477. ],
  478. contactMobile2: [
  479. { pattern: /^[1][0-9]{10}$/, message: '请输入正确的手机号码!' }
  480. ],
  481. receiveMobile: [
  482. { pattern: /^[0-9-]{11,13}$/, message: '请输入正确的电话号码!' }
  483. ],
  484. indentityCard: [
  485. { pattern: /^[0-9a-zA-Z]{15,18}$/, message: '请输入15-18位证件号码' }
  486. ],
  487. zipCode: [
  488. { pattern: /^[1-9][0-9]{5}$/, message: '请输入正确的邮政编码' }
  489. ],
  490. mail: [
  491. { type: 'email', message: '请输入正确的邮箱' }
  492. ],
  493. tradeBankAccount: [
  494. { pattern: /^[0-9a-zA-Z]{16,30}$/, message: '请输入正确银行卡号' }
  495. ]
  496. },
  497. addrProvinceList: [], // 省下拉
  498. addrCityList: [], // 市下拉
  499. addrDistrictList: [], // 区下拉
  500. addrProvinceList1: [], // 省下拉
  501. addrCityList1: [], // 市下拉
  502. addrDistrictList1: [], // 区下拉
  503. dateFormat: 'YYYY-MM-DD',
  504. detailData: null
  505. }
  506. },
  507. methods: {
  508. // 不可选日期
  509. disabledDate (date, dateStrings) {
  510. return date && date.valueOf() > Date.now()
  511. },
  512. // 详情编辑
  513. getDetail () {
  514. dealerFindUpdateInfoBySn({ sn: this.$route.params.id }).then(res => {
  515. if (res.status == 200) {
  516. this.detailData = res.data
  517. this.form = Object.assign(this.form, res.data)
  518. this.form.isShowSpecialPrice = Number(this.form.isShowSpecialPrice)
  519. if (this.form.provinceSn) {
  520. this.getArea('city', this.form.provinceSn, 0)
  521. }
  522. if (this.form.citySn) {
  523. this.getArea('district', this.form.citySn, 0)
  524. }
  525. if (this.form.receiveProvinceSn) {
  526. this.getArea('city', this.form.receiveProvinceSn, 1)
  527. }
  528. if (this.form.receiveCitySn) {
  529. this.getArea('district', this.form.receiveCitySn, 1)
  530. }
  531. }
  532. })
  533. },
  534. // 提交
  535. handleSubmit () {
  536. const _this = this
  537. this.$refs.ruleForm.validate(valid => {
  538. if (valid) {
  539. // console.log(this.form, 'form data')
  540. const params = JSON.parse(JSON.stringify(_this.form))
  541. params.buildDate = params.buildDate ? moment(params.buildDate).format('YYYY-MM-DD hh:mm:ss') : ''
  542. params.brithday = params.brithday ? moment(params.brithday).format('YYYY-MM-DD hh:mm:ss') : ''
  543. params.cooperateEffectiveTime = params.cooperateEffectiveTime ? moment(params.cooperateEffectiveTime).format('YYYY-MM-DD hh:mm:ss') : ''
  544. params.jgDoorHeaderChangeTime = params.jgDoorHeaderChangeTime ? moment(params.jgDoorHeaderChangeTime).format('YYYY-MM-DD hh:mm:ss') : ''
  545. _this.spinning = true
  546. delete params.dealerCode
  547. dealerSave(params).then(res => {
  548. if (res.status == 200) {
  549. _this.$message.success(res.message)
  550. _this.handleBack()
  551. _this.spinning = false
  552. } else {
  553. _this.spinning = false
  554. }
  555. })
  556. } else {
  557. return false
  558. }
  559. })
  560. },
  561. // 返回
  562. handleBack () {
  563. this.$router.push({ path: '/dealerManagement/merchantInfoManagement/list', query: { closeLastOldTab: true } })
  564. },
  565. // 获取城市列表
  566. getCityList (val) {
  567. this.addrCityList = []
  568. this.addrDistrictList = []
  569. this.form.citySn = undefined
  570. this.form.districtSn = undefined
  571. if (val) {
  572. this.getArea('city', val, 0)
  573. this.form.provinceName = this.addrProvinceList.find(item => item.areaSn == val).name
  574. } else {
  575. this.form.provinceName = ''
  576. }
  577. },
  578. // 获取区县列表
  579. getAreaList (val) {
  580. this.addrDistrictList = []
  581. this.form.districtSn = undefined
  582. if (val) {
  583. this.getArea('district', val, 0)
  584. this.form.cityName = this.addrCityList.find(item => item.areaSn == val).name
  585. } else {
  586. this.form.cityName = ''
  587. }
  588. },
  589. // 区县变更
  590. areaCharged (val) {
  591. if (val) {
  592. this.form.districtName = this.addrDistrictList.find(item => item.areaSn == val).name
  593. } else {
  594. this.form.districtName = ''
  595. }
  596. },
  597. // 获取城市列表
  598. getCityList1 (val) {
  599. this.addrCityList1 = []
  600. this.addrDistrictList1 = []
  601. this.form.receiveCitySn = undefined
  602. this.form.receiveDistrictSn = undefined
  603. if (val) {
  604. this.getArea('city', val, 1)
  605. this.form.receiveProvinceName = this.addrProvinceList1.find(item => item.areaSn == val).name
  606. } else {
  607. this.form.receiveProvinceName = ''
  608. }
  609. },
  610. // 获取区县列表
  611. getAreaList1 (val) {
  612. this.addrDistrictList1 = []
  613. this.form.receiveDistrictSn = undefined
  614. if (val) {
  615. this.getArea('district', val, 1)
  616. this.form.receiveCityName = this.addrCityList1.find(item => item.areaSn == val).name
  617. } else {
  618. this.form.receiveCityName = ''
  619. }
  620. },
  621. // 区县变更
  622. areaCharged1 (val) {
  623. if (val) {
  624. this.form.receiveDistrictName = this.addrDistrictList1.find(item => item.areaSn == val).name
  625. } else {
  626. this.form.receiveDistrictName = ''
  627. }
  628. },
  629. // 省/市/区
  630. getArea (leve, sn, index) {
  631. let params
  632. if (leve == 'province') {
  633. params = { type: '2' }
  634. } else {
  635. params = { parentId: sn, type: leve == 'city' ? '3' : '4' }
  636. }
  637. getArea(params).then(res => {
  638. if (res.status == 200) {
  639. if (leve == 'province') {
  640. this.addrProvinceList = JSON.parse(JSON.stringify(res.data || []))
  641. this.addrProvinceList1 = JSON.parse(JSON.stringify(res.data || []))
  642. } else if (leve == 'city') {
  643. this.addrCityList = JSON.parse(JSON.stringify(res.data || []))
  644. if (index == 1) {
  645. this.addrCityList1 = JSON.parse(JSON.stringify(res.data || []))
  646. }
  647. } else if (leve == 'district') {
  648. this.addrDistrictList = JSON.parse(JSON.stringify(res.data || []))
  649. if (index == 1) {
  650. this.addrDistrictList1 = JSON.parse(JSON.stringify(res.data || []))
  651. }
  652. }
  653. } else {
  654. if (leve == 'province') {
  655. this.addrProvinceList = []
  656. this.addrProvinceList1 = []
  657. } else if (leve == 'city') {
  658. this.addrCityList = []
  659. if (index == 1) {
  660. this.addrCityList1 = []
  661. }
  662. } else if (leve == 'district') {
  663. this.addrDistrictList = []
  664. if (index == 1) {
  665. this.addrDistrictList1 = []
  666. }
  667. }
  668. }
  669. })
  670. },
  671. pageInit () {
  672. this.getArea('province')
  673. this.$refs.ruleForm.resetFields()
  674. if (this.$route.params.id) { // 编辑页
  675. this.getDetail()
  676. }
  677. }
  678. },
  679. mounted () {
  680. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  681. this.pageInit()
  682. }
  683. },
  684. activated () {
  685. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  686. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  687. this.pageInit()
  688. }
  689. },
  690. beforeRouteEnter (to, from, next) {
  691. next(vm => {})
  692. }
  693. }
  694. </script>
  695. <style lang="less">
  696. .merchantInfoManagementEdit-wrap{
  697. position: relative;
  698. height: 100%;
  699. padding-bottom: 51px;
  700. box-sizing: border-box;
  701. >.ant-spin-nested-loading{
  702. overflow-y: scroll;
  703. height: 100%;
  704. }
  705. .merchantInfoManagementEdit-cont{
  706. margin-bottom: 10px;
  707. }
  708. }
  709. </style>