edit.vue 33 KB

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