edit.vue 28 KB

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