index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583
  1. <template>
  2. <view class="">
  3. <u-navbar :is-back="false" title="联兑通商户版"></u-navbar>
  4. <view class="margin-30">
  5. <view class="flex justify-between">
  6. <view class="title ">
  7. <view class="icon">
  8. <image src="@/static/icon/dianpu.png" mode=""></image>
  9. </view>
  10. <view class="center margin-left-10">
  11. <view @click="showShop">
  12. <text class="name">{{shopLable || '去完善商户资料'}}</text>
  13. <u-icon v-if="shopShow" name="arrow-up-fill" style="margin-left: 10rpx;"></u-icon>
  14. <u-icon v-else name="arrow-down-fill" style="margin-left: 10rpx;"></u-icon>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="btn">
  19. <view class="image">
  20. <image src="@/static/icon/logout.png" mode=""></image>
  21. </view>
  22. <view @click="logout" class="center padding-left-10">
  23. <text>退出</text>
  24. <text class="cuIcon-right"></text>
  25. </view>
  26. </view>
  27. </view>
  28. <view class="cu-list grid col-3 no-border top-menu">
  29. <view class="cu-item" @click="operate(index)" v-for="(item,index) in menuList" :key="index">
  30. <view class="grid-icon margin-top-20">
  31. <image style="width: 66rpx;height: 66rpx;" :src="item.icon" />
  32. </view>
  33. <text style="color: #fff;font-size: 26rpx;">{{item.name}}</text>
  34. </view>
  35. </view>
  36. <view class="menu-list">
  37. <view @click="jump('/pages/my-bills/my-bills')" class="menu menu1">
  38. <view class="menu-top">
  39. <image src="@/static/icon/bill.png"></image>
  40. <view class="center padding-left-20">
  41. <text class="text-lg">我的账单</text>
  42. </view>
  43. </view>
  44. <view class="menu-bottom">
  45. <view class="">
  46. <text>今日营收</text>
  47. <text>{{statistic.todayCharge || 0}}</text>
  48. </view>
  49. <view class="">
  50. <text>总资产</text>
  51. <text>{{statistic.totalValue || 0}}</text>
  52. </view>
  53. </view>
  54. </view>
  55. <view class="menu menu2" @click="jump('/pages/member/member')">
  56. <view class="menu-top">
  57. <image src="@/static/icon/center.png"></image>
  58. <view class="center padding-left-20">
  59. <text class="text-lg">会员中心</text>
  60. </view>
  61. </view>
  62. <view class="menu-bottom" style="color: #FFFFFF;">
  63. <view class="">
  64. <text>新增会员</text>
  65. <text>{{statistic.newMember || 0}}</text>
  66. </view>
  67. <view class="">
  68. <text>会员总数</text>
  69. <text>{{statistic.allMembers || 0}}</text>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. <view class="market">
  75. <text class="title">营销管理</text>
  76. <view class="cu-list grid col-2 no-border margin-top-30">
  77. <view class="cu-item" @click="jump(item.path)" v-for="(item,index) in marketList" :key="index">
  78. <view class="grid-icon">
  79. <image style="width: 120rpx;height: 120rpx;" :src="item.icon" />
  80. </view>
  81. <text style="color: #222222;font-size: 26rpx;margin-top: 20rpx;">{{item.name}}</text>
  82. <view class="cu-tag bg-red badge" v-if="item.count>0">{{item.count}}</view>
  83. </view>
  84. </view>
  85. </view>
  86. <view class="system">
  87. <text class="title">数字化系统</text>
  88. <view class="cu-list grid col-4 no-border margin-top-30" style="border-radius:20rpx ;">
  89. <view class="cu-item" @click="jump(item.path)" v-for="(item,index) in systemList" :key="index">
  90. <view class="grid-icon">
  91. <image style="height: 56rpx;width: 56rpx;" :src="item.icon" />
  92. </view>
  93. <text style="color: #222222;font-size: 26rpx;">{{item.name}}</text>
  94. <view class="cu-tag bg-red badge" v-if="item.count>0">{{item.count}}</view>
  95. </view>
  96. </view>
  97. </view>
  98. </view>
  99. <u-modal @confirm="$jump('/pages/member/member')" :show-cancel-button="true" confirm-color="#ff9447"
  100. confirm-text="立即开启" cancel-text="暂不开启" v-model="isOpenMemberShow" content="请先创建会员中心"></u-modal>
  101. <u-select @confirm="shopConfirm" :default-value="defaultValue" v-model="shopShow" value-name="id" label-name="name" :list="shopList">
  102. </u-select>
  103. </view>
  104. </template>
  105. <script>
  106. export default {
  107. data() {
  108. return {
  109. //下拉选择商铺
  110. shopShow: false,
  111. //我的商铺列表
  112. shopList: [],
  113. defaultValue:[0],
  114. //选中的商铺id
  115. shopId: '',
  116. //选中的商铺labe
  117. shopLable: '',
  118. labelIds: '',
  119. labelNames: '',
  120. //选中的商铺所属的商场
  121. mallId: '',
  122. //统计数据
  123. statistic: {},
  124. //菜单
  125. menuList: [{
  126. icon: '/static/icon/scan.png',
  127. name: '扫一扫',
  128. },
  129. {
  130. icon: '/static/icon/pay.png',
  131. name: '收款码',
  132. },
  133. {
  134. icon: '/static/icon/card.png',
  135. name: '卡包',
  136. }
  137. ],
  138. marketList: [{
  139. icon: '/static/icon/faqi.png',
  140. name: '发起活动',
  141. background: "background-image:linear-gradient(#FF9549,#FCB07B)",
  142. path: '/pages/publish/publish',
  143. count: 0
  144. },
  145. {
  146. icon: '/static/icon/qingdan.png',
  147. name: '活动清单',
  148. background: "background-image:linear-gradient(#5892F7,#67BBF9)",
  149. path: '/pages/activity/activity',
  150. count: 0
  151. },
  152. ],
  153. systemList: [{
  154. icon: '/static/icon/system5.png',
  155. name: '添加门店',
  156. path: '/pages/shop-info/shop-info?phone=' + this.$cache.get('phone')
  157. }, {
  158. icon: '/static/icon/system1.png',
  159. name: '外卖平台',
  160. path: ''
  161. },
  162. {
  163. icon: '/static/icon/system2.png',
  164. name: '预约系统',
  165. path: ''
  166. },
  167. {
  168. icon: '/static/icon/system3.png',
  169. name: 'ERP系统',
  170. path: ''
  171. },
  172. {
  173. icon: '/static/icon/system4.png',
  174. name: '线上商城',
  175. path: ''
  176. },
  177. {
  178. icon: '/static/icon/add.png',
  179. name: '添加服务',
  180. path: ''
  181. },
  182. ],
  183. //是否开启会员中心
  184. isOpenMember: false,
  185. isOpenMemberShow: false,
  186. //流程节点信息
  187. taskDetail: {}
  188. }
  189. },
  190. watch:{
  191. defaultValue(){
  192. console.log("123");
  193. }
  194. },
  195. onShow() {
  196. this.init()
  197. },
  198. methods: {
  199. showShop() {
  200. if (this.$isEmpty(this.shopLable)) {
  201. uni.navigateTo({
  202. url: "/pages/shop-info/shop-info?phone=" + this.$cache.get('phone')
  203. })
  204. } else {
  205. this.shopShow = !this.shopShow
  206. }
  207. },
  208. logout() {
  209. this.$dialog.showModal('确定要退出吗?').then(res => {
  210. uni.clearStorage()
  211. uni.reLaunch({
  212. url: "../login/account-login"
  213. })
  214. })
  215. },
  216. async init() {
  217. let phone = this.$cache.get('phone')
  218. let params = {
  219. personTel: phone,
  220. }
  221. let res = await this.$api.shop.list(params)
  222. if (this.$isEmpty(res.data.records)) {
  223. this.$u.vuex('vuex_shopStatus', false)
  224. return
  225. }
  226. this.shopList = res.data.records
  227. let item = this.shopList[this.defaultValue[0]]
  228. this.shopId = item.id
  229. this.shopLable = item.name
  230. this.labelIds = item.labelIds
  231. this.labelNames = item.labelNames
  232. this.mallId = item.mallId
  233. this.cacheSelectedShop(item)
  234. this.getTaskDetail()
  235. if (!this.isFirst) {
  236. this.handelShopStatus()
  237. }
  238. this.isFirst=true
  239. //获取统计数据
  240. this.getStatistic()
  241. },
  242. getStatistic() {
  243. this.$api.shop.statistic({
  244. shopId: this.shopId
  245. }).then(res => {
  246. this.statistic = res.data
  247. })
  248. },
  249. cacheSelectedShop(item) {
  250. let selectedShop = {
  251. id: this.shopId,
  252. label: this.shopLable,
  253. labelIds: this.labelIds,
  254. labelNames: this.labelNames
  255. }
  256. this.$cache.put("selectedShop", Object.assign(item, selectedShop))
  257. this.$u.vuex('vuex_shopStatus', item.auditStatus)
  258. this.$u.vuex('vuex_shopId', this.shopId)
  259. this.$u.vuex('vuex_merchantNo', item.merchantNo)
  260. this.$u.vuex('vuex_mallId', this.mallId)
  261. this.$u.vuex('vuex_isOpenMember', item.isOpenMember == 1 ? true : false)
  262. },
  263. shopConfirm(e) {
  264. this.shopId = e[0].value
  265. this.shopLable = e[0].label
  266. let item = this.shopList.filter((item,index) => {
  267. if (this.shopId == item.id) {
  268. console.log([index]);
  269. this.defaultValue=[index]
  270. return true
  271. }
  272. })
  273. this.labelIds = item.labelIds
  274. this.labelNames = item.labelNames
  275. this.cacheSelectedShop(item[0])
  276. this.getTaskDetail()
  277. this.handelShopStatus()
  278. //获取统计数据
  279. this.getStatistic()
  280. },
  281. jump(path){
  282. let flag=this.handelShopStatus()
  283. if (this.$isNotEmpty(flag)) {
  284. this.$jump(path)
  285. }
  286. },
  287. operate(index) {
  288. let flag=this.handelShopStatus()
  289. if (this.$isEmpty(flag)) {
  290. return
  291. }
  292. //审核通过,校验是否开启会员中心
  293. if (!this.vuex_isOpenMember && (index == 0 || index == 1)) {
  294. this.isOpenMemberShow = true
  295. return
  296. }
  297. if (index == 0) {
  298. this.$jump('/pages/pay/pay')
  299. } else if (index == 1) {
  300. this.$jump('/pages/checkstand/pay-qrcode')
  301. } else if (index == 2) {
  302. this.$jump('/pages/card/card')
  303. }
  304. },
  305. handelShopStatus() {
  306. let _this=this
  307. //商户审核通过
  308. if (this.vuex_shopStatus == this.$global.SHOP_AUDIT.PASS) {
  309. return true
  310. }
  311. //未完善商户资料
  312. if (!this.vuex_shopStatus) {
  313. uni.showModal({
  314. cancelText:'暂不完善',
  315. confirmText:'去完善',
  316. confirmColor:'#FF9447',
  317. cancelColor:'#606266',
  318. showCancel:true,
  319. title:'提示',
  320. content:'商户资料未完善',
  321. success: (res) => {
  322. if (res.confirm) {
  323. this.$jump('/pages/shop-info/shop-info?phone'+ this.$cache.get('phone'))
  324. }
  325. }
  326. })
  327. return
  328. }
  329. //审核失败
  330. if (this.vuex_shopStatus == this.$global.SHOP_AUDIT.FAIL) {
  331. this.$dialog.showModal('商户资料审核失败,请重新申请', true).then(res => {
  332. let params = {
  333. isFail: true,
  334. shopId: this.vuex_shopId
  335. }
  336. uni.navigateTo({
  337. url: "/pages/shop-info/shop-info" + this.$u.queryParams(params)
  338. })
  339. })
  340. return
  341. }
  342. //商户已停用
  343. if (this.vuex_shopStatus == this.$global.SHOP_AUDIT.STOP) {
  344. this.$dialog.showModal('该商户已停用',false)
  345. return
  346. }
  347. //待审核中
  348. if (this.vuex_shopStatus.includes('WAITING')) {
  349. if (this.vuex_shopStatus == this.$global.SHOP_AUDIT.WAITING_SIGN) {
  350. //待签约状态,去签约
  351. uni.showModal({
  352. title: '提示',
  353. content: '商户资料审核通过,请进行签约?',
  354. cancelText:'暂不签约',
  355. confirmColor:'#FF9447',
  356. confirmText:'去签约',
  357. success: function (res) {
  358. if (res.confirm) {
  359. _this.$jump('/pages/webView/webView?url=' + _this.taskDetail.variables.signUrl)
  360. }
  361. }
  362. });
  363. return
  364. }
  365. if (this.vuex_shopStatus == this.$global.SHOP_AUDIT.WAITING_AUTH) {
  366. //待商户认证状态
  367. uni.showModal({
  368. title: '提示',
  369. content: '商户资料审核通过,请进行认证?',
  370. cancelText:'暂不认证',
  371. confirmColor:'#FF9447',
  372. confirmText:'去认证',
  373. success: function (res) {
  374. if (res.confirm) {
  375. _this.$jump('/pages/webView/webView?url=' + _this.taskDetail.variables.qrcodeUrl)
  376. }
  377. }
  378. });
  379. return
  380. }
  381. //待商场审核,待平台审核,待易宝审核状态下,去审核流程详情页
  382. uni.showModal({
  383. title: '提示',
  384. content: '商户资料审核中,查看审核流程?',
  385. cancelText:'暂不查看',
  386. confirmColor:'#FF9447',
  387. confirmText:'查看',
  388. success: function (res) {
  389. if (res.confirm) {
  390. _this.$jump('/pages/flow/flow')
  391. }
  392. }
  393. });
  394. }
  395. },
  396. /**
  397. * 获取流程节点信息
  398. */
  399. async getTaskDetail() {
  400. let audit = (await this.$api.audit.detail({
  401. entityId: this.vuex_shopId
  402. })).data
  403. let params = {
  404. assignee: '$INITIATOR',
  405. processInstanceId: audit.processInstanceId
  406. }
  407. this.$api.flow.getTaskId(params).then(res => {
  408. this.taskDetail = res.data.records[0]
  409. })
  410. },
  411. }
  412. }
  413. </script>
  414. <style lang="scss" scoped>
  415. .cu-list.grid>.cu-item .cu-tag {
  416. right: auto;
  417. left: 54%;
  418. margin-left: 20rpx;
  419. }
  420. .title {
  421. display: flex;
  422. .icon {
  423. background-color: #FFFFFF;
  424. border-radius: 50%;
  425. display: flex;
  426. justify-content: center;
  427. align-items: center;
  428. width: 50rpx;
  429. height: 50rpx;
  430. image {
  431. width: 36rpx;
  432. height: 36rpx;
  433. }
  434. }
  435. text {
  436. font-weight: 800;
  437. font-size: 32rpx;
  438. color: #303030;
  439. }
  440. }
  441. .top-menu {
  442. border-radius: 20rpx;
  443. margin-top: 20rpx;
  444. background-image: linear-gradient(to right, #FBA33D, #FF8D32);
  445. }
  446. .menu-list {
  447. display: flex;
  448. justify-content: space-between;
  449. padding-top: 20rpx;
  450. .menu {
  451. width: 48.8%;
  452. color: #FFFFFF;
  453. display: flex;
  454. flex-direction: column;
  455. align-items: center;
  456. border-radius: 14rpx;
  457. padding: 30rpx 20rpx;
  458. .menu-top {
  459. display: flex;
  460. image {
  461. width: 70rpx;
  462. height: 70rpx;
  463. }
  464. }
  465. .menu-bottom {
  466. padding-top: 20rpx;
  467. font-size: 30rpx;
  468. display: flex;
  469. justify-content: space-around;
  470. width: 100%;
  471. view {
  472. display: flex;
  473. flex-direction: column;
  474. text-align: center;
  475. text:first-child {
  476. margin-bottom: 10rpx;
  477. font-size: 26rpx;
  478. color: #E0E2F6;
  479. }
  480. }
  481. }
  482. }
  483. .menu1 {
  484. background-color: #5C6186;
  485. }
  486. .menu2 {
  487. background-color: #E19D5B;
  488. }
  489. }
  490. .market {
  491. margin-top: 20rpx;
  492. border-radius: 20rpx;
  493. background-color: #FFFFFF;
  494. padding: 30rpx 50rpx 20rpx;
  495. .title {
  496. font-weight: 800;
  497. }
  498. }
  499. .system {
  500. margin-top: 20rpx;
  501. border-radius: 20rpx;
  502. background-color: #FFFFFF;
  503. padding: 30rpx 50rpx 20rpx;
  504. .title {
  505. font-weight: 800;
  506. }
  507. }
  508. .btn {
  509. margin-right: -30rpx;
  510. display: flex;
  511. .image {
  512. display: flex;
  513. justify-content: center;
  514. align-items: center;
  515. border-radius: 50%;
  516. background-color: #FFFFFF;
  517. padding: 8rpx;
  518. image {
  519. width: 20rpx;
  520. height: 20rpx;
  521. }
  522. }
  523. color: #FFFFFF;
  524. border-radius: 50rpx 0 0 50rpx;
  525. padding:8rpx 10rpx 8rpx 35rpx;
  526. background-image: linear-gradient(to right, #FFD67B, #F99200);
  527. }
  528. .money {
  529. font-size: 80rpx;
  530. color: $u-type-warning;
  531. position: relative;
  532. .close {
  533. position: absolute;
  534. top: 20rpx;
  535. right: 20rpx;
  536. line-height: 28rpx;
  537. font-size: 28rpx;
  538. }
  539. }
  540. </style>