index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  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" 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. //选中的商铺id
  114. shopId: '',
  115. //选中的商铺labe
  116. shopLable: '',
  117. labelIds: '',
  118. labelNames: '',
  119. //选中的商铺所属的商场
  120. mallId: '',
  121. //统计数据
  122. statistic: {},
  123. //菜单
  124. menuList: [{
  125. icon: '/static/icon/scan.png',
  126. name: '扫一扫',
  127. },
  128. {
  129. icon: '/static/icon/pay.png',
  130. name: '收款码',
  131. },
  132. {
  133. icon: '/static/icon/card.png',
  134. name: '卡包',
  135. }
  136. ],
  137. marketList: [{
  138. icon: '/static/icon/faqi.png',
  139. name: '发起活动',
  140. background: "background-image:linear-gradient(#FF9549,#FCB07B)",
  141. path: '/pages/publish/publish',
  142. count: 0
  143. },
  144. {
  145. icon: '/static/icon/qingdan.png',
  146. name: '活动清单',
  147. background: "background-image:linear-gradient(#5892F7,#67BBF9)",
  148. path: '/pages/activity/activity',
  149. count: 0
  150. },
  151. ],
  152. systemList: [{
  153. icon: '/static/icon/system5.png',
  154. name: '添加门店',
  155. path: '/pages/shop-info/shop-info?phone=' + this.$cache.get('phone')
  156. }, {
  157. icon: '/static/icon/system1.png',
  158. name: '外卖平台',
  159. path: ''
  160. },
  161. {
  162. icon: '/static/icon/system2.png',
  163. name: '预约系统',
  164. path: ''
  165. },
  166. {
  167. icon: '/static/icon/system3.png',
  168. name: 'ERP系统',
  169. path: ''
  170. },
  171. {
  172. icon: '/static/icon/system4.png',
  173. name: '线上商城',
  174. path: ''
  175. },
  176. {
  177. icon: '/static/icon/add.png',
  178. name: '添加服务',
  179. path: ''
  180. },
  181. ],
  182. //是否开启会员中心
  183. isOpenMember: false,
  184. isOpenMemberShow: false,
  185. //流程节点信息
  186. taskDetail: {}
  187. }
  188. },
  189. onShow() {
  190. this.init()
  191. },
  192. methods: {
  193. showShop() {
  194. if (this.$isEmpty(this.shopLable)) {
  195. uni.navigateTo({
  196. url: "/pages/shop-info/shop-info?phone=" + this.$cache.get('phone')
  197. })
  198. } else {
  199. this.shopShow = !this.shopShow
  200. }
  201. },
  202. logout() {
  203. this.$dialog.showModal('确定要退出吗?').then(res => {
  204. uni.clearStorage()
  205. uni.reLaunch({
  206. url: "../login/account-login"
  207. })
  208. })
  209. },
  210. async init() {
  211. let phone = this.$cache.get('phone')
  212. let params = {
  213. personTel: phone,
  214. }
  215. let res = await this.$api.shop.list(params)
  216. if (this.$isEmpty(res.data.records)) {
  217. this.$u.vuex('vuex_shopStatus', false)
  218. return
  219. }
  220. this.shopList = res.data.records
  221. let item = this.shopList[0]
  222. this.shopId = item.id
  223. this.shopLable = item.name
  224. this.labelIds = item.labelIds
  225. this.labelNames = item.labelNames
  226. this.mallId = item.mallId
  227. this.cacheSelectedShop(item)
  228. this.getTaskDetail()
  229. this.handelShopStatus()
  230. //获取统计数据
  231. this.getStatistic()
  232. },
  233. getStatistic() {
  234. this.$api.shop.statistic({
  235. shopId: this.shopId
  236. }).then(res => {
  237. this.statistic = res.data
  238. })
  239. },
  240. cacheSelectedShop(item) {
  241. let selectedShop = {
  242. id: this.shopId,
  243. label: this.shopLable,
  244. labelIds: this.labelIds,
  245. labelNames: this.labelNames
  246. }
  247. this.$cache.put("selectedShop", Object.assign(item, selectedShop))
  248. this.$u.vuex('vuex_shopStatus', item.auditStatus)
  249. this.$u.vuex('vuex_shopId', this.shopId)
  250. this.$u.vuex('vuex_merchantNo', item.merchantNo)
  251. this.$u.vuex('vuex_mallId', this.mallId)
  252. this.$u.vuex('vuex_isOpenMember', item.isOpenMember == 1 ? true : false)
  253. },
  254. shopConfirm(e) {
  255. this.shopId = e[0].value
  256. this.shopLable = e[0].label
  257. let item = this.shopList.filter((item) => {
  258. if (this.shopId == item.id) {
  259. return true
  260. }
  261. })
  262. this.labelIds = item.labelIds
  263. this.labelNames = item.labelNames
  264. this.cacheSelectedShop(item[0])
  265. this.getTaskDetail()
  266. this.handelShopStatus()
  267. //获取统计数据
  268. this.getStatistic()
  269. },
  270. jump(path){
  271. let flag=this.handelShopStatus()
  272. if (this.$isNotEmpty(flag)) {
  273. this.$jump(path)
  274. }
  275. },
  276. operate(index) {
  277. let flag=this.handelShopStatus()
  278. if (this.$isEmpty(flag)) {
  279. return
  280. }
  281. //审核通过,校验是否开启会员中心
  282. if (!this.vuex_isOpenMember && (index == 0 || index == 1)) {
  283. this.isOpenMemberShow = true
  284. return
  285. }
  286. if (index == 0) {
  287. this.$jump('/pages/pay/pay')
  288. } else if (index == 1) {
  289. this.$jump('/pages/checkstand/pay-qrcode')
  290. } else if (index == 2) {
  291. this.$jump('/pages/card/card')
  292. }
  293. },
  294. handelShopStatus() {
  295. //商户审核通过
  296. if (this.vuex_shopStatus == this.$global.SHOP_AUDIT.PASS) {
  297. return true
  298. }
  299. //未完善商户资料
  300. if (!this.vuex_shopStatus) {
  301. uni.showModal({
  302. cancelText:'暂不完善',
  303. confirmText:'去完善',
  304. confirmColor:'#FF9447',
  305. cancelColor:'#606266',
  306. showCancel:true,
  307. title:'提示',
  308. content:'商户资料未完善',
  309. success: (res) => {
  310. if (res.confirm) {
  311. this.$jump('/pages/shop-info/shop-info?phone'+ this.$cache.get('phone'))
  312. }
  313. }
  314. })
  315. return
  316. }
  317. //审核失败
  318. if (this.vuex_shopStatus == this.$global.SHOP_AUDIT.FAIL) {
  319. this.$dialog.showModal('商户资料审核失败,请重新申请', true).then(res => {
  320. let params = {
  321. isFail: true,
  322. shopId: this.vuex_shopId
  323. }
  324. uni.navigateTo({
  325. url: "/pages/shop-info/shop-info" + this.$u.queryParams(params)
  326. })
  327. })
  328. return
  329. }
  330. //商户已停用
  331. if (this.vuex_shopStatus == this.$global.SHOP_AUDIT.STOP) {
  332. this.$dialog.showModal('该商户已停用',false)
  333. return
  334. }
  335. //待审核中
  336. if (this.vuex_shopStatus.includes('WAITING')) {
  337. if (this.vuex_shopStatus == this.$global.SHOP_AUDIT.WAITING_SIGN) {
  338. //待签约状态,去签约
  339. uni.showModal({
  340. title: '提示',
  341. content: '商户资料审核通过,请进行签约?',
  342. cancelText:'暂不签约',
  343. confirmColor:'#FF9447',
  344. confirmText:'去签约',
  345. success: function (res) {
  346. if (res.confirm) {
  347. _this.$jump('/pages/webView/webView?url=' + this.taskDetail.variables.signUrl)
  348. }
  349. }
  350. });
  351. return
  352. }
  353. if (this.vuex_shopStatus == this.$global.SHOP_AUDIT.WAITING_AUTH) {
  354. this.$jump('/pages/webView/webView?url=' + this.taskDetail.variables.qrcodeUrl)
  355. //待商户认证状态
  356. return
  357. }
  358. let _this=this
  359. //待商场审核,待平台审核,待易宝审核状态下,去审核流程详情页
  360. uni.showModal({
  361. title: '提示',
  362. content: '商户资料审核中,查看审核流程?',
  363. cancelText:'暂不查看',
  364. confirmColor:'#FF9447',
  365. confirmText:'查看',
  366. success: function (res) {
  367. if (res.confirm) {
  368. _this.$jump('/pages/flow/flow')
  369. }
  370. }
  371. });
  372. }
  373. },
  374. /**
  375. * 获取流程节点信息
  376. */
  377. async getTaskDetail() {
  378. let audit = (await this.$api.audit.detail({
  379. entityId: this.vuex_shopId
  380. })).data
  381. let params = {
  382. assignee: '$INITIATOR',
  383. processInstanceId: audit.processInstanceId
  384. }
  385. this.$api.flow.getTaskId(params).then(res => {
  386. this.taskDetail = res.data.records[0]
  387. })
  388. },
  389. }
  390. }
  391. </script>
  392. <style lang="scss" scoped>
  393. .cu-list.grid>.cu-item .cu-tag {
  394. right: auto;
  395. left: 54%;
  396. margin-left: 20rpx;
  397. }
  398. .title {
  399. display: flex;
  400. .icon {
  401. background-color: #FFFFFF;
  402. border-radius: 50%;
  403. display: flex;
  404. justify-content: center;
  405. align-items: center;
  406. width: 50rpx;
  407. height: 50rpx;
  408. image {
  409. width: 36rpx;
  410. height: 36rpx;
  411. }
  412. }
  413. text {
  414. font-weight: 800;
  415. font-size: 32rpx;
  416. color: #303030;
  417. }
  418. }
  419. .top-menu {
  420. border-radius: 20rpx;
  421. margin-top: 20rpx;
  422. background-image: linear-gradient(to right, #FBA33D, #FF8D32);
  423. }
  424. .menu-list {
  425. display: flex;
  426. justify-content: space-between;
  427. padding-top: 20rpx;
  428. .menu {
  429. width: 48.8%;
  430. color: #FFFFFF;
  431. display: flex;
  432. flex-direction: column;
  433. align-items: center;
  434. border-radius: 14rpx;
  435. padding: 30rpx 20rpx;
  436. .menu-top {
  437. display: flex;
  438. image {
  439. width: 70rpx;
  440. height: 70rpx;
  441. }
  442. }
  443. .menu-bottom {
  444. padding-top: 20rpx;
  445. font-size: 30rpx;
  446. display: flex;
  447. justify-content: space-around;
  448. width: 100%;
  449. view {
  450. display: flex;
  451. flex-direction: column;
  452. text-align: center;
  453. text:first-child {
  454. margin-bottom: 10rpx;
  455. font-size: 26rpx;
  456. color: #E0E2F6;
  457. }
  458. }
  459. }
  460. }
  461. .menu1 {
  462. background-color: #5C6186;
  463. }
  464. .menu2 {
  465. background-color: #E19D5B;
  466. }
  467. }
  468. .market {
  469. margin-top: 20rpx;
  470. border-radius: 20rpx;
  471. background-color: #FFFFFF;
  472. padding: 30rpx 50rpx 20rpx;
  473. .title {
  474. font-weight: 800;
  475. }
  476. }
  477. .system {
  478. margin-top: 20rpx;
  479. border-radius: 20rpx;
  480. background-color: #FFFFFF;
  481. padding: 30rpx 50rpx 20rpx;
  482. .title {
  483. font-weight: 800;
  484. }
  485. }
  486. .btn {
  487. margin-right: -30rpx;
  488. display: flex;
  489. .image {
  490. display: flex;
  491. justify-content: center;
  492. align-items: center;
  493. border-radius: 50%;
  494. background-color: #FFFFFF;
  495. padding: 8rpx;
  496. image {
  497. width: 20rpx;
  498. height: 20rpx;
  499. }
  500. }
  501. color: #FFFFFF;
  502. border-radius: 50rpx 0 0 50rpx;
  503. padding:8rpx 10rpx 8rpx 35rpx;
  504. background-image: linear-gradient(to right, #FFD67B, #F99200);
  505. }
  506. .money {
  507. font-size: 80rpx;
  508. color: $u-type-warning;
  509. position: relative;
  510. .close {
  511. position: absolute;
  512. top: 20rpx;
  513. right: 20rpx;
  514. line-height: 28rpx;
  515. font-size: 28rpx;
  516. }
  517. }
  518. </style>