edit.vue 35 KB

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