authPass.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. <template>
  2. <div class="authPass-wrap">
  3. <a-page-header :ghost="false" :backIcon="false" class="authPass-back">
  4. <!-- 自定义的二级文字标题 -->
  5. <template slot="subTitle">
  6. <a id="authPass-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
  7. </template>
  8. </a-page-header>
  9. <a-spin :spinning="spinning" tip="Loading...">
  10. <a-card size="small" :bordered="false" class="authPass-table-page-wrapper">
  11. <a-form-model
  12. id="authPass-form"
  13. ref="ruleForm"
  14. :model="form"
  15. :rules="rules"
  16. :label-col="formItemLayout.labelCol"
  17. :wrapper-col="formItemLayout.wrapperCol"
  18. >
  19. <a-row :gutter="15">
  20. <a-col :span="12">
  21. <a-form-model-item label="门头照片" prop="storeImage">
  22. <Upload
  23. class="upload"
  24. id="noticeEdit-imgPaths"
  25. v-model="form.storeImage"
  26. ref="storeImage"
  27. :fileSize="10"
  28. :maxNums="1"
  29. @remove="removeImage1"
  30. @change="changeImage1"
  31. listType="picture-card"></Upload>
  32. <div class="upload-desc">说明:单张大小小于10Mb,最多1张。</div>
  33. </a-form-model-item>
  34. </a-col>
  35. <a-col :span="12">
  36. <a-form-model-item label="营业执照" prop="licenseImage">
  37. <Upload
  38. class="upload"
  39. id="noticeEdit-imgPaths"
  40. v-model="form.licenseImage"
  41. ref="licenseImage"
  42. :fileSize="10"
  43. :maxNums="1"
  44. @remove="removeImage2"
  45. @change="changeImage2"
  46. listType="picture-card"></Upload>
  47. <div class="upload-desc">说明:单张大小小于10Mb,最多1张。</div>
  48. </a-form-model-item>
  49. </a-col>
  50. <a-col :span="12">
  51. <a-form-model-item label="门店名称" prop="storeName">
  52. <a-input id="authPass-storeName" :maxLength="30" v-model.trim="form.storeName" placeholder="请输入门店名称(最多30个字符)" allowClear />
  53. </a-form-model-item>
  54. </a-col>
  55. </a-row>
  56. <a-row :gutter="15">
  57. <a-col :span="12">
  58. <a-form-model-item label="客户地址" required style="margin: 0;">
  59. <a-row :gutter="15">
  60. <!-- 客户地址 -->
  61. <a-col span="6">
  62. <a-form-model-item prop="addrProvince">
  63. <a-select id="authPass-addrProvince" allowClear @change="getCityList" v-model="form.addrProvince" placeholder="请选择省">
  64. <a-select-option v-for="item in addrProvinceList" :value="item.areaSn" :key="item.areaSn + 'a'">{{ item.name }}</a-select-option>
  65. </a-select>
  66. </a-form-model-item>
  67. </a-col>
  68. <a-col span="6">
  69. <a-form-model-item prop="addrCity">
  70. <a-select id="authPass-addrCity" allowClear @change="getAreaList" v-model="form.addrCity" placeholder="请选择市">
  71. <a-select-option v-for="item in addrCityList" :value="item.areaSn" :key="item.areaSn + 'b'">{{ item.name }}</a-select-option>
  72. </a-select>
  73. </a-form-model-item>
  74. </a-col>
  75. <a-col span="6">
  76. <a-form-model-item prop="addrDistrict">
  77. <a-select id="authPass-addrDistrict" allowClear @change="areaCharged" v-model="form.addrDistrict" placeholder="请选择区/县">
  78. <a-select-option v-for="item in addrDistrictList" :value="item.areaSn" :key="item.areaSn + 'c'">{{ item.name }}</a-select-option>
  79. </a-select>
  80. </a-form-model-item>
  81. </a-col>
  82. </a-row>
  83. </a-form-model-item>
  84. </a-col>
  85. <a-col :span="12">
  86. <a-form-model-item label="详细地址" prop="addrDetail">
  87. <a-textarea id="authPass-addrDetail" :maxLength="100" v-model.trim="form.addrDetail" placeholder="请输入详细地址(最多100个字符)" allowClear />
  88. </a-form-model-item>
  89. </a-col>
  90. </a-row>
  91. <a-row :gutter="15">
  92. <a-col :span="12">
  93. <a-form-model-item label="联系人姓名" prop="contactName">
  94. <a-input
  95. id="authPass-contactName"
  96. :maxLength="20"
  97. v-model.trim="form.contactName"
  98. @change="filterEmpty"
  99. placeholder="请输入联系人姓名(最多20个字符)"
  100. allowClear />
  101. </a-form-model-item>
  102. </a-col>
  103. <a-col :span="12">
  104. <a-form-model-item label="联系人手机" prop="contactPhone">
  105. <a-input
  106. id="authPass-contactPhone"
  107. :maxLength="30"
  108. disabled
  109. v-model.trim="form.contactPhone"
  110. allowClear />
  111. </a-form-model-item>
  112. </a-col>
  113. <a-col :span="12">
  114. <a-form-model-item label="结算方式" prop="settleType">
  115. <v-select
  116. code="SHELF_SETTLE_TYPE"
  117. id="authPass-settleType"
  118. v-model="form.settleType"
  119. allowClear
  120. placeholder="请选择结算方式"
  121. ></v-select>
  122. </a-form-model-item>
  123. </a-col>
  124. <a-col :span="12">
  125. <a-form-model-item label="关联客户" prop="customerSn">
  126. <custList ref="custList" :dealerFlag="0" :isEnabled="true" @change="custChange"></custList>
  127. </a-form-model-item>
  128. </a-col>
  129. <a-col :span="12" v-if="form.settleType == 'CREDIT'">
  130. <a-form-model-item label="授信额度" prop="creditLimit">
  131. <a-input-number
  132. :min="100"
  133. :max="9999999"
  134. style="width:100%"
  135. :precision="2"
  136. v-model="form.creditLimit"
  137. placeholder="请输入大于100的数字(最多允许两位小数)"></a-input-number>
  138. </a-form-model-item>
  139. </a-col>
  140. <a-col :span="12">
  141. <a-form-model-item prop="showPrice">
  142. <template slot="label">
  143. <a-tooltip placement="top">
  144. <template slot="title">
  145. 不勾选则不显示价格,结算价:即易码通进货价。
  146. </template>
  147. 价格权限设置<a-icon type="question-circle" style="color: rgba(0,0,0,.65);font-size: 16px;margin-left: 2px;vertical-align: sub;cursor: pointer;" />
  148. </a-tooltip>
  149. </template>
  150. <a-checkbox-group v-model="showPrice">
  151. <div style="display: flex;padding:10px 0;">
  152. <div style="width: 80px;font-weight: bold;">货架产品:</div>
  153. <a-checkbox value="shelf_price_show">
  154. 车主价
  155. </a-checkbox>
  156. <a-checkbox value="shelf_cost_show">
  157. 结算价
  158. </a-checkbox>
  159. </div>
  160. <div style="display: flex;padding:10px 0;">
  161. <div style="width: 80px;font-weight: bold;">非货架产品:</div>
  162. <a-checkbox value="non_shelf_price_show">
  163. 车主价
  164. </a-checkbox>
  165. <a-checkbox value="non_shelf_cost_show">
  166. 结算价
  167. </a-checkbox>
  168. </div>
  169. </a-checkbox-group>
  170. </a-form-model-item>
  171. </a-col>
  172. </a-row>
  173. <a-form-model-item :wrapper-col="{ span: 12, offset: 6 }" style="text-align: center;margin-top: 30px;">
  174. <a-button type="primary" @click="saveForm" size="large" id="authPass-btn-submit" style="padding: 0 60px;">审核通过</a-button>
  175. </a-form-model-item>
  176. </a-form-model>
  177. </a-card>
  178. </a-spin>
  179. </div>
  180. </template>
  181. <script>
  182. import { commonMixin } from '@/utils/mixin'
  183. import { STable, VSelect, Upload } from '@/components'
  184. import { getAreaCgj } from '@/api/data'
  185. import custList from '@/views/common/custList.vue'
  186. import { xprhStoreApplyDetail, xprhStoreApplyAudit } from '@/api/approveStore'
  187. import { updateShelfPriceShow } from '@/api/shelf'
  188. export default {
  189. name: 'ApproveStoreAuthPass',
  190. components: { STable, VSelect, custList, Upload },
  191. mixins: [commonMixin],
  192. data () {
  193. return {
  194. spinning: false,
  195. formItemLayout: {
  196. labelCol: { span: 6 },
  197. wrapperCol: { span: 16 }
  198. },
  199. form: {
  200. storeName: '', // 门店名称
  201. contactPhone: '', // 联系手机
  202. contactName: '', // 联系人
  203. addrProvince: undefined, // 省
  204. addrProvinceName: '',
  205. addrCity: undefined, // 市
  206. addrCityName: '',
  207. addrDistrict: undefined, // 区
  208. addrDistrictName: '',
  209. addrDetail: '', // 详细地址
  210. storeImage: '', // 门头照片
  211. licenseImage: '', // 营业执照
  212. settleType: '', // 结算方式
  213. customerSn: undefined, // 关联客户
  214. creditLimit: '', // 授信额度
  215. delearSn: undefined,
  216. applySn: undefined,
  217. auditStatus: 'PASS' // 通过
  218. },
  219. showPrice:['shelf_price_show','non_shelf_price_show'], // 价格显示
  220. rules: {
  221. storeImage: [{ required: true, message: '请上传门头照片', trigger: 'change' }],
  222. storeName: [{ required: true, message: '请输入门店名称', trigger: 'change' }],
  223. addrProvince: [{ required: true, message: '请选择省', trigger: 'change' }],
  224. addrCity: [{ required: true, message: '请选择市', trigger: 'change' }],
  225. addrDistrict: [{ required: true, message: '请选择区/县', trigger: 'change' }],
  226. addrDetail: [{ required: true, message: '请输入详细地址', trigger: 'change' }],
  227. contactName: [{ required: true, message: '请输入联系人姓名', trigger: 'change' }],
  228. settleType: [{ required: true, message: '请选择收结算方式', trigger: 'change' }],
  229. customerSn: [{ required: true, message: '请选择关联客户', trigger: 'change' }],
  230. creditLimit: [{ required: true, message: '请输入授信额度', trigger: 'change' }]
  231. },
  232. addrProvinceList: [], // 省下拉
  233. addrCityList: [], // 市下拉
  234. addrDistrictList: [], // 区下拉
  235. settleStyleList: [] // 收款方式 下拉数据
  236. }
  237. },
  238. methods: {
  239. filterEmpty () {
  240. let str = this.form.storeName
  241. str = str.replace(/\ +/g, '')
  242. str = str.replace(/[ ]/g, '')
  243. str = str.replace(/[\r\n]/g, '')
  244. this.form.storeName = str
  245. },
  246. // 关联客户
  247. custChange (obj, row) {
  248. this.form.customerSn = row ? row.customerSn : undefined
  249. },
  250. // 图片上传
  251. changeImage1 (file) {
  252. this.form.storeImage = file
  253. },
  254. removeImage1 () {
  255. this.form.storeImage = ''
  256. this.$refs.storeImage.setFileList('')
  257. },
  258. // 图片上传
  259. changeImage2 (file) {
  260. this.form.licenseImage = file
  261. },
  262. removeImage2 () {
  263. this.form.licenseImage = ''
  264. this.$refs.licenseImage.setFileList('')
  265. },
  266. // 获取客户信息
  267. getDetail () {
  268. xprhStoreApplyDetail({ sn: this.$route.params.sn }).then(res => {
  269. if (res.status == 200) {
  270. if (res.data.addrProvince) { this.getArea('city', res.data.addrProvince) }
  271. if (res.data.addrDistrict) { this.getArea('district', res.data.addrCity) }
  272. this.form = Object.assign(this.form, res.data)
  273. this.$refs.storeImage.setFileList(res.data.storeImage)
  274. this.$refs.licenseImage.setFileList(res.data.licenseImage)
  275. this.form.auditStatus = 'PASS' // 通过
  276. } else {
  277. this.$refs.ruleForm.resetFields()
  278. }
  279. })
  280. },
  281. // 保存
  282. saveForm () {
  283. const _this = this
  284. _this.$refs.ruleForm.validate(valid => {
  285. if (valid) {
  286. _this.$confirm({
  287. title: '操作提示',
  288. content: <div><div>审核通过后,即可成为认证门店,</div><div>确认审核通过吗?</div></div>,
  289. centered: true,
  290. closable: true,
  291. onOk () {
  292. _this.handleSubmit()
  293. }
  294. })
  295. } else {
  296. return false
  297. }
  298. })
  299. },
  300. handleSubmit (e) {
  301. const _this = this
  302. _this.spinning = true
  303. xprhStoreApplyAudit(_this.form).then(res => {
  304. if (res.status == 200) {
  305. const shelfSn = res.data.shelfSn
  306. // 更新价格显示设置
  307. const priceStr = [
  308. {paramCode: 'shelf_price_show',paramValue:0},
  309. {paramCode: 'shelf_cost_show',paramValue:0},
  310. {paramCode: 'non_shelf_price_show',paramValue:0},
  311. {paramCode: 'non_shelf_cost_show',paramValue:0}
  312. ]
  313. priceStr.map(item => {
  314. item.paramValue = _this.showPrice.includes(item.paramCode) ? 1 : 0
  315. })
  316. // 更新价格显示
  317. updateShelfPriceShow({
  318. shelfSn: shelfSn,
  319. paramValue: priceStr
  320. }).then(ret => {
  321. if (ret.status == 200) {
  322. setTimeout(() => {
  323. _this.$message.success(res.message)
  324. _this.handleBack()
  325. _this.spinning = false
  326. }, 100)
  327. } else {
  328. _this.spinning = false
  329. }
  330. })
  331. } else {
  332. _this.spinning = false
  333. }
  334. })
  335. },
  336. // 返回列表
  337. handleBack () {
  338. this.$router.push({ name: 'approveStoreList' })
  339. },
  340. // 获取城市列表
  341. getCityList (val) {
  342. this.addrCityList = []
  343. this.addrDistrictList = []
  344. this.form.addrCity = undefined
  345. this.form.addrDistrict = undefined
  346. if (val) {
  347. this.getArea('city', val)
  348. this.form.addrProvinceName = this.addrProvinceList.find(item => item.areaSn == val).name
  349. } else {
  350. this.form.addrProvinceName = ''
  351. }
  352. },
  353. // 获取区县列表
  354. getAreaList (val) {
  355. this.addrDistrictList = []
  356. this.form.addrDistrict = undefined
  357. if (val) {
  358. this.getArea('district', val)
  359. this.form.addrCityName = this.addrCityList.find(item => item.areaSn == val).name
  360. } else {
  361. this.form.addrCityName = ''
  362. }
  363. },
  364. // 区县变更
  365. areaCharged (val) {
  366. if (val) {
  367. this.form.addrDistrictName = this.addrDistrictList.find(item => item.areaSn == val).name
  368. } else {
  369. this.form.addrDistrictName = ''
  370. }
  371. },
  372. // 省/市/区
  373. getArea (leve, sn) {
  374. let params
  375. if (leve == 'province') {
  376. params = { type: '2' }
  377. } else {
  378. params = { parentId: sn, type: leve == 'city' ? '3' : '4' }
  379. }
  380. getAreaCgj(params).then(res => {
  381. if (res.status == 200) {
  382. if (leve == 'province') {
  383. this.addrProvinceList = res.data || []
  384. } else if (leve == 'city') {
  385. this.addrCityList = res.data || []
  386. } else if (leve == 'district') {
  387. this.addrDistrictList = res.data || []
  388. }
  389. } else {
  390. if (leve == 'province') {
  391. this.addrProvinceList = []
  392. } else if (leve == 'city') {
  393. this.addrCityList = []
  394. } else if (leve == 'district') {
  395. this.addrDistrictList = []
  396. }
  397. }
  398. })
  399. },
  400. // 获取基础数据
  401. getBaseData () {
  402. this.getArea('province') // 省市区
  403. this.$refs.ruleForm.resetFields()
  404. },
  405. initPage () {
  406. this.getBaseData()
  407. // 编辑页
  408. if (this.$route.params.sn) {
  409. this.getDetail()
  410. }
  411. }
  412. },
  413. mounted () {
  414. console.log('mounted')
  415. this.initPage()
  416. },
  417. beforeRouteEnter (to, from, next) {
  418. next(vm => {
  419. console.log('beforeRouteEnter')
  420. })
  421. }
  422. }
  423. </script>
  424. <style lang="less">
  425. .authPass-wrap {
  426. height: 100%;
  427. >.ant-spin-nested-loading{
  428. height: calc(100% - 52px);
  429. overflow-y: auto;
  430. .ant-spin-container{
  431. height: 100%;
  432. }
  433. .upload-desc {
  434. color:#999;
  435. clear:both;
  436. }
  437. }
  438. .ant-form-item-children{
  439. display:block;
  440. }
  441. .authPass-back {
  442. margin-bottom: 10px;
  443. }
  444. .authPass-table-page-wrapper{
  445. height: 100%;
  446. }
  447. }
  448. </style>