edit.vue 33 KB

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