authPass.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435
  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. 1、不勾选则不显示价格,非货架产品只显示车主价,不选择车主价时,非货架产品不显示价格<br>
  146. 2、结算价:即易码通进货价
  147. </template>
  148. 价格权限设置<a-icon type="question-circle" style="color: rgba(0,0,0,.65);font-size: 16px;margin-left: 2px;vertical-align: sub;cursor: pointer;" />
  149. </a-tooltip>
  150. </template>
  151. <a-checkbox-group v-model="showPrice">
  152. <a-checkbox value="shelf_price_show">
  153. 车主价
  154. </a-checkbox>
  155. <a-checkbox value="shelf_cost_show">
  156. 结算价
  157. </a-checkbox>
  158. </a-checkbox-group>
  159. </a-form-model-item>
  160. </a-col>
  161. </a-row>
  162. <a-form-model-item :wrapper-col="{ span: 12, offset: 6 }" style="text-align: center;margin-top: 30px;">
  163. <a-button type="primary" @click="saveForm" size="large" id="authPass-btn-submit" style="padding: 0 60px;">审核通过</a-button>
  164. </a-form-model-item>
  165. </a-form-model>
  166. </a-card>
  167. </a-spin>
  168. </div>
  169. </template>
  170. <script>
  171. import { commonMixin } from '@/utils/mixin'
  172. import { STable, VSelect, Upload } from '@/components'
  173. import { getAreaCgj } from '@/api/data'
  174. import custList from '@/views/common/custList.vue'
  175. import { xprhStoreApplyDetail, xprhStoreApplyAudit } from '@/api/approveStore'
  176. import { updateShelfPriceShow } from '@/api/shelf'
  177. export default {
  178. name: 'ApproveStoreAuthPass',
  179. components: { STable, VSelect, custList, Upload },
  180. mixins: [commonMixin],
  181. data () {
  182. return {
  183. spinning: false,
  184. formItemLayout: {
  185. labelCol: { span: 6 },
  186. wrapperCol: { span: 16 }
  187. },
  188. form: {
  189. storeName: '', // 门店名称
  190. contactPhone: '', // 联系手机
  191. contactName: '', // 联系人
  192. addrProvince: undefined, // 省
  193. addrProvinceName: '',
  194. addrCity: undefined, // 市
  195. addrCityName: '',
  196. addrDistrict: undefined, // 区
  197. addrDistrictName: '',
  198. addrDetail: '', // 详细地址
  199. storeImage: '', // 门头照片
  200. licenseImage: '', // 营业执照
  201. settleType: '', // 结算方式
  202. customerSn: undefined, // 关联客户
  203. creditLimit: '', // 授信额度
  204. delearSn: undefined,
  205. applySn: undefined,
  206. auditStatus: 'PASS' // 通过
  207. },
  208. showPrice:['shelf_price_show'], // 价格显示
  209. rules: {
  210. storeImage: [{ required: true, message: '请上传门头照片', trigger: 'change' }],
  211. storeName: [{ required: true, message: '请输入门店名称', trigger: 'change' }],
  212. addrProvince: [{ required: true, message: '请选择省', trigger: 'change' }],
  213. addrCity: [{ required: true, message: '请选择市', trigger: 'change' }],
  214. addrDistrict: [{ required: true, message: '请选择区/县', trigger: 'change' }],
  215. addrDetail: [{ required: true, message: '请输入详细地址', trigger: 'change' }],
  216. contactName: [{ required: true, message: '请输入联系人姓名', trigger: 'change' }],
  217. settleType: [{ required: true, message: '请选择收结算方式', trigger: 'change' }],
  218. customerSn: [{ required: true, message: '请选择关联客户', trigger: 'change' }],
  219. creditLimit: [{ required: true, message: '请输入授信额度', trigger: 'change' }]
  220. },
  221. addrProvinceList: [], // 省下拉
  222. addrCityList: [], // 市下拉
  223. addrDistrictList: [], // 区下拉
  224. settleStyleList: [] // 收款方式 下拉数据
  225. }
  226. },
  227. methods: {
  228. filterEmpty () {
  229. let str = this.form.storeName
  230. str = str.replace(/\ +/g, '')
  231. str = str.replace(/[ ]/g, '')
  232. str = str.replace(/[\r\n]/g, '')
  233. this.form.storeName = str
  234. },
  235. // 关联客户
  236. custChange (obj, row) {
  237. this.form.customerSn = row ? row.customerSn : undefined
  238. },
  239. // 图片上传
  240. changeImage1 (file) {
  241. this.form.storeImage = file
  242. },
  243. removeImage1 () {
  244. this.form.storeImage = ''
  245. this.$refs.storeImage.setFileList('')
  246. },
  247. // 图片上传
  248. changeImage2 (file) {
  249. this.form.licenseImage = file
  250. },
  251. removeImage2 () {
  252. this.form.licenseImage = ''
  253. this.$refs.licenseImage.setFileList('')
  254. },
  255. // 获取客户信息
  256. getDetail () {
  257. xprhStoreApplyDetail({ sn: this.$route.params.sn }).then(res => {
  258. if (res.status == 200) {
  259. if (res.data.addrProvince) { this.getArea('city', res.data.addrProvince) }
  260. if (res.data.addrDistrict) { this.getArea('district', res.data.addrCity) }
  261. this.form = Object.assign(this.form, res.data)
  262. this.$refs.storeImage.setFileList(res.data.storeImage)
  263. this.$refs.licenseImage.setFileList(res.data.licenseImage)
  264. this.form.auditStatus = 'PASS' // 通过
  265. } else {
  266. this.$refs.ruleForm.resetFields()
  267. }
  268. })
  269. },
  270. // 保存
  271. saveForm () {
  272. const _this = this
  273. _this.$refs.ruleForm.validate(valid => {
  274. if (valid) {
  275. _this.$confirm({
  276. title: '操作提示',
  277. content: <div><div>审核通过后,即可成为认证门店,</div><div>确认审核通过吗?</div></div>,
  278. centered: true,
  279. closable: true,
  280. onOk () {
  281. _this.handleSubmit()
  282. }
  283. })
  284. } else {
  285. return false
  286. }
  287. })
  288. },
  289. handleSubmit (e) {
  290. const _this = this
  291. _this.spinning = true
  292. xprhStoreApplyAudit(_this.form).then(res => {
  293. if (res.status == 200) {
  294. const shelfSn = res.data.shelfSn
  295. // 更新价格显示设置
  296. const priceStr = [{paramCode: 'shelf_price_show',paramValue:0},{paramCode: 'shelf_cost_show',paramValue:0}]
  297. priceStr.map(item => {
  298. item.paramValue = _this.showPrice.includes(item.paramCode) ? 1 : 0
  299. })
  300. // 更新价格显示
  301. updateShelfPriceShow({
  302. shelfSn: shelfSn,
  303. paramValue: priceStr
  304. }).then(ret => {
  305. if (ret.status == 200) {
  306. setTimeout(() => {
  307. _this.$message.success(res.message)
  308. _this.handleBack()
  309. _this.spinning = false
  310. }, 100)
  311. } else {
  312. _this.spinning = false
  313. }
  314. })
  315. } else {
  316. _this.spinning = false
  317. }
  318. })
  319. },
  320. // 返回列表
  321. handleBack () {
  322. this.$router.push({ name: 'approveStoreList' })
  323. },
  324. // 获取城市列表
  325. getCityList (val) {
  326. this.addrCityList = []
  327. this.addrDistrictList = []
  328. this.form.addrCity = undefined
  329. this.form.addrDistrict = undefined
  330. if (val) {
  331. this.getArea('city', val)
  332. this.form.addrProvinceName = this.addrProvinceList.find(item => item.areaSn == val).name
  333. } else {
  334. this.form.addrProvinceName = ''
  335. }
  336. },
  337. // 获取区县列表
  338. getAreaList (val) {
  339. this.addrDistrictList = []
  340. this.form.addrDistrict = undefined
  341. if (val) {
  342. this.getArea('district', val)
  343. this.form.addrCityName = this.addrCityList.find(item => item.areaSn == val).name
  344. } else {
  345. this.form.addrCityName = ''
  346. }
  347. },
  348. // 区县变更
  349. areaCharged (val) {
  350. if (val) {
  351. this.form.addrDistrictName = this.addrDistrictList.find(item => item.areaSn == val).name
  352. } else {
  353. this.form.addrDistrictName = ''
  354. }
  355. },
  356. // 省/市/区
  357. getArea (leve, sn) {
  358. let params
  359. if (leve == 'province') {
  360. params = { type: '2' }
  361. } else {
  362. params = { parentId: sn, type: leve == 'city' ? '3' : '4' }
  363. }
  364. getAreaCgj(params).then(res => {
  365. if (res.status == 200) {
  366. if (leve == 'province') {
  367. this.addrProvinceList = res.data || []
  368. } else if (leve == 'city') {
  369. this.addrCityList = res.data || []
  370. } else if (leve == 'district') {
  371. this.addrDistrictList = res.data || []
  372. }
  373. } else {
  374. if (leve == 'province') {
  375. this.addrProvinceList = []
  376. } else if (leve == 'city') {
  377. this.addrCityList = []
  378. } else if (leve == 'district') {
  379. this.addrDistrictList = []
  380. }
  381. }
  382. })
  383. },
  384. // 获取基础数据
  385. getBaseData () {
  386. this.getArea('province') // 省市区
  387. this.$refs.ruleForm.resetFields()
  388. },
  389. initPage () {
  390. this.getBaseData()
  391. // 编辑页
  392. if (this.$route.params.sn) {
  393. this.getDetail()
  394. }
  395. }
  396. },
  397. mounted () {
  398. console.log('mounted')
  399. this.initPage()
  400. },
  401. beforeRouteEnter (to, from, next) {
  402. next(vm => {
  403. console.log('beforeRouteEnter')
  404. })
  405. }
  406. }
  407. </script>
  408. <style lang="less">
  409. .authPass-wrap {
  410. height: 100%;
  411. >.ant-spin-nested-loading{
  412. height: calc(100% - 52px);
  413. overflow-y: auto;
  414. .ant-spin-container{
  415. height: 100%;
  416. }
  417. .upload-desc {
  418. color:#999;
  419. clear:both;
  420. }
  421. }
  422. .ant-form-item-children{
  423. display:block;
  424. }
  425. .authPass-back {
  426. margin-bottom: 10px;
  427. }
  428. .authPass-table-page-wrapper{
  429. height: 100%;
  430. }
  431. }
  432. </style>