authPass.vue 17 KB

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