authPass.vue 14 KB

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