edit.vue 29 KB

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