businessQua.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482
  1. <template>
  2. <view class="page">
  3. <view class="top" style="90rpx">
  4. <cu-custom bgColor="bg-fff" :isBack="true">
  5. <block slot="content"> 经营资质</block>
  6. </cu-custom>
  7. </view>
  8. <view class="" style="height:140rpx;margin-bottom: 20rpx;">
  9. <status v-if="form && form.specialStatus !== null" :status="form.specialStatus"
  10. :updateTime="form.specialUpdateTime" :remark="form.specialRemark"></status>
  11. </view>
  12. <view class="tab-top">
  13. <view class="content " style="margin-bottom: 16rpx;">
  14. <text class="text-bold">分类选择</text>
  15. <i class="text-bg "></i>
  16. </view>
  17. <view class="picker" @click="showPicker">
  18. <span style="width: 104rpx;color: #232832;">分类</span>
  19. <view class="right">
  20. <span style="color: #333333;" v-if="showText">{{ showText}}</span>
  21. <span v-else>请选择</span>
  22. <u-icon name="arrow-right"></u-icon>
  23. </view>
  24. </view>
  25. <!-- <form>
  26. <view class="borderRadiu">
  27. <view class=" cu-form-group margin-top1 justify-between">
  28. <view class="content ">
  29. <text class="text-bold">特殊行业经营许可证</text>
  30. <i class="text-bg "></i>
  31. </view>
  32. </view>
  33. <view class="customize">
  34. <view class="business-img flex align-center">
  35. <image :src="specialImg ? specialImg : '/static/store/xukezheng.png'" mode="" @click="businessChange()">
  36. </image>
  37. </view>
  38. </view>
  39. </view>
  40. </form> -->
  41. </view>
  42. <view class="center">
  43. <view class="fath" v-for="item in qualificationNameMap" :key="item.categoryId" style="margin-top: 10px">
  44. <!-- <span style="font-weight: 600"> {{ item.categoryName }} <br /></span> -->
  45. <view class="sun_box">
  46. <view class="sun" v-for="(row, index) in item.qualificationNameCategoryDTOS" :key="index">
  47. <!-- <a-upload v-model:file-list="row.imgList" list-type="picture-card" class="avatar-uploader"
  48. :headers="headers" :action="url" :before-upload="beforeUpload" @change="uploadCertificate"
  49. @remove="removeImage(4)">
  50. <view v-if="row.imgList.length < 1">
  51. <upload-outlined />
  52. <view style="margin-top: 8px">上传附件</view>
  53. </view>
  54. </a-upload> -->
  55. <view class="borderRadiu">
  56. <view class=" cu-form-group margin-top1 justify-between">
  57. <view class="content ">
  58. <text class="text-bold">{{ row.qualificationName }}</text>
  59. <i class="text-bg "></i>
  60. </view>
  61. </view>
  62. <view class="customize">
  63. <view class="business-img flex align-center">
  64. <image :src="row.special ? row.special : '/static/store/xukezheng.png'" mode=""
  65. @click="businessChange(row)">
  66. </image>
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. <view class="padding flex " v-if="this.form.specialStatus !== 0">
  75. <button class="cu-btn round line-gray shadow" @click="$Router.push({ name: 'settings' })">取消</button>
  76. <button style="margin-left: 12upx;width:77%" class="cu-btn bg-blue round " @click="sumbit">提交审核</button>
  77. </view>
  78. <ba-tree-picker ref="treePicker" :multiple='true' @select-change="selectChange" title="选择分类" :localdata="treeData"
  79. valueKey="key" textKey="title" childrenKey="children" />
  80. </view>
  81. </template>
  82. <script>
  83. import configService from '../../common/service/config.service'
  84. import baTreePicker from "@/components/ba-tree-picker/ba-tree-picker.vue"
  85. import {
  86. USER_INFO
  87. } from "@/common/util/constants"
  88. import status from "./components/status.vue"
  89. export default {
  90. data() {
  91. return {
  92. specialImg: '',
  93. form: {},
  94. treeData: [],
  95. isSelectType: false,
  96. treeLeft: [], //一级列表
  97. showText: '',
  98. classifyList: [],
  99. qualificationNameMap: []
  100. }
  101. },
  102. components: {
  103. status,
  104. baTreePicker
  105. },
  106. async onLoad(data) {
  107. if (data.params) {
  108. let obj = JSON.parse(decodeURIComponent(data.params));
  109. this.form = obj
  110. this.qualificationNameMap = this.form.qualificationNameListDTOS;
  111. this.qualificationNameMap.forEach((item) => {
  112. this.showText += item.categoryName + ' / '
  113. item.qualificationNameCategoryDTOS?.forEach((row) => {
  114. // row.special = '';
  115. row.imgList = [];
  116. row.imgList.push({
  117. url: row.special,
  118. });
  119. });
  120. });
  121. // this.specialImg = obj.special
  122. }
  123. },
  124. methods: {
  125. getTree() {
  126. this.$http.get('/sys/category/loadTreeRoot?pcode=' + 'c09' + '&async=' + false).then(res => {
  127. this.treeData = res.data.result
  128. console.log(this.treeData)
  129. })
  130. },
  131. showPicker() {
  132. if (this.form.specialStatus == 0) {
  133. uni.showToast({
  134. icon: 'none',
  135. title: '待审核状态不能修改'
  136. })
  137. } else {
  138. this.$refs.treePicker._show();
  139. }
  140. },
  141. //监听选择(ids为数组)
  142. selectChange(ids, names) {
  143. console.log(ids, names)
  144. this.classifyList = ids
  145. this.showText = names
  146. this.selectClassify()
  147. },
  148. selectClassify() {
  149. let categoryIds = this.classifyList.join(',')
  150. let merchantId = uni.getStorageSync(USER_INFO).merchantId
  151. let categoryNames = this.showText
  152. this.$http.get('/localQualificationClassifica/localQualificationClassifica/getByCategoryId?categoryIds=' +
  153. categoryIds + '&merchantId=' + merchantId + '&categoryNames=' + categoryNames).then(res => {
  154. this.qualificationNameMap = res.data.result
  155. this.qualificationNameMap.forEach((item) => {
  156. item.qualificationNameCategoryDTOS?.forEach((row) => {
  157. row.special = row.special ? row.special : '';
  158. row.imgList = [];
  159. });
  160. });
  161. })
  162. },
  163. async businessChange(row) {
  164. if (this.form.specialStatus == 0) {
  165. uni.showToast({
  166. icon: 'none',
  167. title: '待审核状态不能修改'
  168. })
  169. } else {
  170. let [chooseImageErr, chooseImageRes] = await uni.chooseImage({
  171. count: 1,
  172. sizeType: ['compressed']
  173. });
  174. let size = chooseImageRes.tempFiles[0].size / 1024 / 1024 < 5;
  175. if (!size) {
  176. this.$refs.uToast.show({
  177. title: '上传图片大小不能超过 5MB!',
  178. type: 'error',
  179. })
  180. return false
  181. }
  182. if (chooseImageRes) {
  183. // this.specialImg = chooseImageRes.tempFilePaths[0];
  184. uni.uploadFile({
  185. url: configService.apiUrl + '/sys/common/upload',
  186. filePath: chooseImageRes.tempFilePaths[0],
  187. name: "file",
  188. formData: {
  189. 'biz': 'temp',
  190. },
  191. success: (files) => {
  192. let data = JSON.parse(files.data);
  193. if (data.success) {
  194. // this.specialImg = configService.apiUrl + '/' + data.message
  195. row.special = configService.apiUrl + '/' + data.message
  196. }
  197. }
  198. });
  199. }
  200. }
  201. },
  202. sumbit() {
  203. let hasEmptyImage = false;
  204. this.qualificationNameMap.forEach((item) => {
  205. item.qualificationNameCategoryDTOS?.forEach((row) => {
  206. console.log(row);
  207. // if (row.imgList[0]?.response) {
  208. // row.special = import.meta.env.VITE_GLOB_DOMAIN_URL + '/' + row.imgList[0].response.message;
  209. // }
  210. // 检查图片是否为空
  211. if (!row.special) {
  212. hasEmptyImage = true;
  213. }
  214. });
  215. });
  216. let data = {
  217. merchantId: uni.getStorageSync(USER_INFO).merchantId,
  218. merchantUserId: this.form.merchantUserId,
  219. merchantUserName: this.form.merchantUserName,
  220. // special: this.specialImage[0].url,
  221. qualificationNameListDTOS: this.qualificationNameMap,
  222. source: 1,
  223. };
  224. console.log(data);
  225. if (hasEmptyImage) {
  226. // message.error('请上传全部图片');
  227. uni.showToast({
  228. icon: 'none',
  229. message: '请上传全部图片'
  230. })
  231. } else {
  232. if (this.form.specialStatus == null) {
  233. this.$http.post('/merchant/localMerchantSpecial/add', data).then(res => {
  234. if (res.data.success) {
  235. this.$tip.success(res.data.result || '成功')
  236. uni.navigateBack({
  237. delta: 1 // 返回的页面数,默认为1
  238. })
  239. } else {
  240. this.$tip.error(res.data.message);
  241. }
  242. })
  243. } else {
  244. this.$http.post('/merchant/localMerchantSpecial/edit', {
  245. ...data,
  246. id: this.form.specialId
  247. }).then(res => {
  248. if (res.data.success) {
  249. this.$tip.success(res.data.result || '成功')
  250. uni.navigateBack({
  251. delta: 1 // 返回的页面数,默认为1
  252. })
  253. } else {
  254. this.$tip.error(res.data.message);
  255. }
  256. })
  257. }
  258. // this.$http.post('/merchant/examine/new/special/check', data).then((res) => {
  259. // // this.getDetail();
  260. // });
  261. }
  262. // let data = {
  263. // merchantId: uni.getStorageSync(USER_INFO).merchantId,
  264. // special: this.specialImg,
  265. // }
  266. }
  267. },
  268. mounted() {
  269. // this.getLeftTree()
  270. this.getTree()
  271. }
  272. }
  273. </script>
  274. <style scoped lang="scss">
  275. page {
  276. background: #F8F8FA;
  277. }
  278. .page {
  279. width: 100vw;
  280. height: 100vh;
  281. display: flex;
  282. flex-direction: column;
  283. }
  284. .tab-top {
  285. width: 95%;
  286. padding: 20rpx 16rpx;
  287. background-color: #fff;
  288. margin: 0rpx auto;
  289. }
  290. .borderRadiu {
  291. background-color: #fff;
  292. border-radius: 16rpx;
  293. .customize {
  294. padding: 0 18upx 18upx;
  295. }
  296. .title {
  297. font-size: 30upx;
  298. // padding: 10px;
  299. }
  300. .business-img {
  301. height: 218upx;
  302. width: 360upx;
  303. padding: 16upx;
  304. // padding-bottom: 16upx;
  305. background: url('/static/login/yingye2.png');
  306. margin: 16upx auto;
  307. background-size: cover;
  308. image {
  309. width: 100%;
  310. height: 100%;
  311. }
  312. }
  313. .business-prompt {
  314. padding-top: 16upx;
  315. font-size: 20upx;
  316. color: #999999;
  317. }
  318. }
  319. .booder-top {
  320. border-bottom: 1px solid rgb(238, 238, 238);
  321. padding-bottom: 7px;
  322. }
  323. .sub-bottom {
  324. position: fixed;
  325. width: 100%;
  326. bottom: 0;
  327. background: #FFFFFF;
  328. border-top: 1px solid #EEEEEE;
  329. }
  330. .picker {
  331. height: 74rpx;
  332. display: flex;
  333. align-items: center;
  334. justify-content: space-between;
  335. font-size: 28rpx;
  336. color: #999999;
  337. border-bottom: 1px solid #EEEEEE;
  338. .right {
  339. flex: 1;
  340. display: flex;
  341. align-items: center;
  342. justify-content: space-between;
  343. }
  344. }
  345. .popup {
  346. width: 100vw;
  347. height: 100vh;
  348. position: fixed;
  349. top: 0;
  350. left: 0;
  351. background: rgba(0, 0, 0, 0.4);
  352. display: flex;
  353. align-items: flex-end;
  354. z-index: 99;
  355. .model {
  356. width: 100%;
  357. background-color: #fff;
  358. border-radius: 20rpx 20rpx 0rpx 0rpx;
  359. padding: 0rpx 24rpx;
  360. padding-bottom: 20rpx;
  361. .title {
  362. width: 100%;
  363. height: 86rpx;
  364. display: flex;
  365. align-items: center;
  366. justify-content: center;
  367. border-bottom: 1px solid #EEEEEE;
  368. position: relative;
  369. image {
  370. width: 40rpx;
  371. height: 40rpx;
  372. position: absolute;
  373. right: 0px;
  374. }
  375. }
  376. .tree {
  377. display: flex;
  378. height: 546rpx;
  379. .left {
  380. overflow-y: auto;
  381. .item {
  382. width: 224rpx;
  383. height: 78rpx;
  384. padding: 20rpx;
  385. font-size: 26rpx;
  386. }
  387. .active {
  388. background: rgba(68, 154, 255, 0.1);
  389. color: #2983EC;
  390. }
  391. }
  392. .border {
  393. border-left: 1px solid #eeeeee;
  394. border-right: 1px solid #eeeeee;
  395. }
  396. }
  397. .sub {
  398. display: flex;
  399. justify-content: space-between;
  400. margin-top: 16rpx;
  401. border-top: 1px solid #eeeeee;
  402. padding-top: 16rpx;
  403. .submit {
  404. width: 672rpx;
  405. height: 76rpx;
  406. background: linear-gradient(90deg, #77B6FF 0%, #449AFF 100%);
  407. border-radius: 53rpx;
  408. display: flex;
  409. align-items: center;
  410. justify-content: center;
  411. font-size: 28rpx;
  412. color: #FFFFFF;
  413. }
  414. }
  415. }
  416. }
  417. .center {
  418. flex: 1;
  419. overflow-y: auto;
  420. padding: 0 24rpx;
  421. .fath {
  422. width: 100%;
  423. // height: 100px;
  424. }
  425. }
  426. ::v-deep .uni-flex-item {
  427. flex: 1;
  428. display: flex;
  429. align-items: center;
  430. }
  431. </style>