edit.vue 30 KB

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