user.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667
  1. <template>
  2. <view class="container user clearfix">
  3. <cm-custom :navbar-data="nvabarData" />
  4. <view class="user-section">
  5. <view class="header" :style="{
  6. height: CustomBar + 90 - StatusBar + 'px',
  7. paddingTop: CustomBar + 'px',
  8. background: 'url(' + bgImgUrl + ')',
  9. backgroundSize: 'cover'
  10. }">
  11. <view class="header-main" v-if="hasLogin">
  12. <view class="header-icon" @click="TestZHIboFn()">
  13. <image src="https://static.caimei365.com/app/img/icon/default-head-new.png" mode=""></image>
  14. </view>
  15. <view class="header-text">
  16. <view class="user-item">
  17. <text class="u-h1">{{ name }}</text>
  18. </view>
  19. <view class="user-item"> <text class="u-tips">协销人员</text> </view>
  20. </view>
  21. </view>
  22. <!-- 订单 -->
  23. <view class="user-order">
  24. <view class="tab-title" @click="navigator('/pages/seller/order/order-list?listType=0')">
  25. <text class="cell-tit">我的订单</text> <text class="cell-more">全部订单</text>
  26. <text class="iconfont icon-xiayibu"></text>
  27. </view>
  28. <view class="order-section">
  29. <view class="order-item" @click="navigator('/pages/seller/order/order-list?listType=1')"
  30. hover-class="common-hover" :hover-stay-time="50">
  31. <view class="order-icon">
  32. <image src="https://static.caimei365.com/app/img/icon/order5@3x.png" mode=""></image>
  33. <text v-if="beforeConfirmCount > 0"
  34. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"
  35. :class="[beforeConfirmCount < 10 ? 'goleft' : '']">
  36. {{ beforeConfirmCount >= 99 ? '99+' : beforeConfirmCount }}
  37. </text>
  38. </view>
  39. <text class="order-t">待确认</text>
  40. </view>
  41. <view class="order-item" @click="navigator('/pages/seller/order/order-list?listType=2')"
  42. hover-class="common-hover" :hover-stay-time="50">
  43. <view class="order-icon">
  44. <image src="https://static.caimei365.com/app/img/icon/order1@3x.png" mode=""></image>
  45. <text v-if="beforePayCount > 0"
  46. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num "
  47. :class="[beforePayCount < 10 ? 'goleft' : '']">
  48. {{ beforePayCount >= 99 ? '99+' : beforePayCount }}
  49. </text>
  50. </view>
  51. <text class="order-t">待付款</text>
  52. </view>
  53. <view class="order-item" @click="navigator('/pages/seller/order/order-list?listType=3')"
  54. hover-class="common-hover" :hover-stay-time="50">
  55. <view class="order-icon">
  56. <image src="https://static.caimei365.com/app/img/icon/order2@3x.png" mode=""></image>
  57. <text v-if="beforeShipCount > 0"
  58. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"
  59. :class="[beforeShipCount < 10 ? 'goleft' : '']">
  60. {{ beforeShipCount >= 99 ? '99+' : beforeShipCount }}
  61. </text>
  62. </view>
  63. <text class="order-t">待发货</text>
  64. </view>
  65. <view class="order-item" @click="navigator('/pages/seller/order/order-list?listType=4')"
  66. hover-class="common-hover" :hover-stay-time="50">
  67. <view class="order-icon">
  68. <image src="https://static.caimei365.com/app/img/icon/order3@3x.png" mode=""></image>
  69. <text v-if="shippedCount > 0"
  70. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"
  71. :class="[shippedCount < 10 ? 'goleft' : '']">
  72. {{ shippedCount >= 99 ? '99+' : shippedCount }}
  73. </text>
  74. </view>
  75. <text class="order-t">已发货</text>
  76. </view>
  77. <view class="order-item" @click="navigator('/pages/seller/order/order-list?listType=5')"
  78. hover-class="common-hover" :hover-stay-time="50">
  79. <view class="order-icon">
  80. <image src="https://static.caimei365.com/app/img/icon/order4@3x.png" mode=""></image>
  81. <text v-if="refundsCount > 0"
  82. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"
  83. :class="[refundsCount < 10 ? 'goleft' : '']">
  84. {{ refundsCount >= 99 ? '99+' : refundsCount }}
  85. </text>
  86. </view>
  87. <text class="order-t">退货/款</text>
  88. </view>
  89. </view>
  90. </view>
  91. </view>
  92. <!-- 底部跳转 -->
  93. <view class="foot-list">
  94. <view class="list-cell-main clearfix">
  95. <view class="list-cell-navs" v-for="(item,index) in tabsList" :key="index"
  96. @click="navigator(item.path)">
  97. <view class="icon">
  98. <image class="icon-image" :src="item.icon" mode="widthFix"></image>
  99. </view>
  100. <view class="name">{{ item.name }}</view>
  101. </view>
  102. </view>
  103. <view class="list-cell-main clearfix">
  104. <view class="list-cell-navs" v-for="(item,index) in firstList" :key="index"
  105. @click="navigator(item.path)">
  106. <view class="icon">
  107. <image class="icon-image" :src="item.icon" mode="widthFix"></image>
  108. </view>
  109. <view class="name">{{ item.name }}</view>
  110. </view>
  111. </view>
  112. </view>
  113. </view>
  114. </view>
  115. </template>
  116. <script>
  117. import authorize from '@/common/config/authorize.js'
  118. import { mapState, mapMutations } from 'vuex'
  119. export default {
  120. data() {
  121. return {
  122. nvabarData: {
  123. //顶部自定义导航
  124. showCapsule: 1, // 是否显示左上角图标 1表示显示 0表示不显示,
  125. showSearch: 0,
  126. title: '账户中心', // 导航栏 中间的标题
  127. haveBack: false,
  128. textLeft: this.$store.state.isIphone,
  129. textColor: '#FFFFFF',
  130. bgColor: ''
  131. },
  132. CustomBar: this.CustomBar, // 顶部导航栏高度
  133. StatusBar: this.StatusBar,
  134. bgImgUrl: 'https://static.caimei365.com/app/img/bg/new_home_cumres@2x.png',
  135. name: '',
  136. headpic: '',
  137. userId: '',
  138. serviceProviderId: '',
  139. skeletonShow: true,
  140. orderNum: 0, //未查看订单数量
  141. beforeConfirmCount: 0, //待确认角标
  142. beforePayCount: 0, //待付款角标
  143. beforeShipCount: 0, //待发货角标
  144. shippedCount: 0, //已发货角标
  145. refundsCount: '', //退货/款角标
  146. institutionsCont: 120,
  147. tabsList: [{
  148. name: '机构列表',
  149. path: '/pages/seller/club/list',
  150. icon: 'https://static.caimei365.com/app/img/icon/icon_seller_2@2x.png'
  151. },
  152. {
  153. name: '帮机构下单',
  154. path: '/pages/seller/club/club-list',
  155. icon: 'https://static.caimei365.com/app/img/icon/icon_seller_5@2x.png'
  156. },
  157. {
  158. name: '拉机构上线',
  159. path: '/pages/seller/login/register-select',
  160. icon: 'https://static.caimei365.com/app/img/icon/icon_seller_3@2x.png'
  161. },
  162. {
  163. name: '待注册机构',
  164. path: '/pages/seller/club/stayClub-list',
  165. icon: 'https://static.caimei365.com/app/img/icon/icon_seller_1@2x.png'
  166. },
  167. {
  168. name: '我的名片',
  169. path: '/pages/seller/remarks/business-card',
  170. icon: 'https://static.caimei365.com/app/img/icon/my-card.png'
  171. },
  172. {
  173. name: '机构看板',
  174. path: '/pages/seller/club/club-board',
  175. icon: 'https://static.caimei365.com/app/img/icon/visits.png'
  176. },
  177. {
  178. name: '客户咨询记录',
  179. path: '/pages/seller/remarks/list',
  180. icon: 'https://static.caimei365.com/app/img/icon/icon_seller_7@2x.png'
  181. },
  182. {
  183. name: '邀请运营人员',
  184. path: '/pages/seller/club/allClub-list',
  185. icon: 'https://static.caimei365.com/app/img/icon/icon_seller_4@2x.png'
  186. }
  187. ],
  188. firstList: [{
  189. name: '优惠券',
  190. path: '/pages/seller/cart/coupon',
  191. icon: 'https://static.caimei365.com/app/img/icon/icon_club_13@2x.png'
  192. }],
  193. }
  194. },
  195. created() {
  196. this.initData()
  197. },
  198. computed: {
  199. ...mapState(['hasLogin', 'userInfo'])
  200. },
  201. methods: {
  202. ...mapMutations(['login', 'logout']),
  203. async initData() {
  204. const wechatCode = await authorize.getCode('weixin') // 根据微信的code获取用户登录状态:1已登录过 -1未登录过
  205. const getUserInfo = await authorize.getUserInfo('weixin')
  206. const params = { code: wechatCode, encryptedData: getUserInfo.encryptedData, iv: getUserInfo.iv }
  207. this.UserService.UserLoginAuthApplets(params).then(response => {
  208. if (response.code == 0 || response.code == 4) {
  209. this.isLogin = true
  210. this.userID = response.data.userId
  211. this.userIdentity = response.data.userIdentity
  212. this.clubStatus = response.data.clubStatus
  213. this.serviceProviderId = response.data.serviceProviderId
  214. this.$store.commit('updateStatus', response.data)
  215. this.login(response.data)
  216. uni.setStorageSync('token', response.data.token)
  217. uni.setStorageSync('unionId', response.data.unionId)
  218. uni.setStorageSync('spUserId', response.data.spUserId)
  219. this.getUserSellerHome()
  220. this.getOrderCount()
  221. } else {
  222. this.isLogin = false
  223. this.logout()
  224. uni.setStorageSync('unionId', response.data.unionId)
  225. this.$store.commit('updateStatus', response.data)
  226. this.$api.navigateTo('/pages/seller/login/login')
  227. }
  228. })
  229. },
  230. getUserSellerHome() {
  231. this.$api.getStorage().then(resolve => {
  232. this.userId = resolve.userId ? resolve.userId : 0
  233. this.SellerService.GetSellerHome({ userId: this.userId })
  234. .then(response => {
  235. let sellerData = response.data
  236. this.name = sellerData.linkMan ? sellerData.linkMan : '' //协销名称
  237. this.headpic = sellerData.logo //会所头像
  238. this.skeletonShow = false
  239. })
  240. .catch(error => {
  241. this.$util.msg(error.msg, 2000)
  242. })
  243. })
  244. },
  245. getOrderCount() {
  246. this.SellerService.GetOrderCount({ serviceProviderId: this.serviceProviderId }).then(response => {
  247. let data = response.data
  248. this.beforeConfirmCount = this.showBadge(data.confirmedCount) //待确认
  249. this.beforePayCount = this.showBadge(data.paymentCount) //待付款
  250. this.beforeShipCount = this.showBadge(data.waitShipmentsCount) //待发货
  251. this.shippedCount = this.showBadge(data.shipmentsCount) //已发货
  252. this.refundsCount = this.showBadge(data.salesReturnCount) //退货/款
  253. this.orderNum = this.showBadge(data.uncheckedOrderCount) //未查看订单数量
  254. })
  255. },
  256. TestZHIboFn() {
  257. //测试跳转直播小程序
  258. // uni.navigateToMiniProgram({
  259. // appId: 'wx92d650b253f8f2e3',
  260. // path: '/pages/index/index',
  261. // extraData: {
  262. // 'data1': 'test'
  263. // },
  264. // envVersion: 'develop',
  265. // success(res) {
  266. // // 打开成功
  267. // console.log(res)
  268. // }
  269. // })
  270. },
  271. navigator(url) {
  272. this.$api.navigateTo(url)
  273. },
  274. showBadge(n) {
  275. let num = ''
  276. if (n > 100) {
  277. num = 99
  278. } else {
  279. num = n
  280. }
  281. return num
  282. },
  283. onPullDownRefresh() {
  284. //下拉刷新
  285. this.initData()
  286. uni.stopPullDownRefresh()
  287. }
  288. }
  289. }
  290. </script>
  291. <style lang="scss">
  292. @import '@/uni.scss';
  293. .user {
  294. width: 100%;
  295. height: 100%;
  296. position: relative;
  297. background-color: #f7f7f7;
  298. padding-bottom: 120rpx;
  299. }
  300. .header {
  301. width: 100%;
  302. position: relative;
  303. background-size: cover;
  304. }
  305. .header-main {
  306. width: 702rpx;
  307. height: 130rpx;
  308. padding: 12rpx 24rpx;
  309. display: flex;
  310. .header-text {
  311. flex: 8;
  312. display: flex;
  313. flex-direction: column;
  314. .user-item {
  315. flex: 1;
  316. height: 64rpx;
  317. line-height: 64rpx;
  318. .u-tips {
  319. display: inline-block;
  320. float: left;
  321. width: 98rpx;
  322. height: 30rpx;
  323. border: 1px solid #ffffff;
  324. background: #ffffff;
  325. border-radius: 16rpx;
  326. line-height: 30rpx;
  327. font-size: $font-size-20;
  328. text-align: center;
  329. color: #999;
  330. }
  331. .u-viptips {
  332. display: inline-block;
  333. float: left;
  334. width: 98rpx;
  335. height: 30rpx;
  336. border: 1px solid #ffe600;
  337. background: linear-gradient(128deg, rgba(242, 143, 49, 1) 0%, rgba(225, 86, 22, 1) 100%);
  338. border-radius: 16rpx;
  339. line-height: 30rpx;
  340. font-size: $font-size-20;
  341. text-align: center;
  342. color: #ffe600;
  343. margin-left: 10rpx;
  344. margin-top: 17rpx;
  345. }
  346. .u-h1 {
  347. float: left;
  348. font-size: $font-size-30;
  349. color: #ffffff;
  350. text-align: left;
  351. -o-text-overflow: ellipsis;
  352. text-overflow: ellipsis;
  353. display: -webkit-box;
  354. word-break: break-all;
  355. -webkit-box-orient: vertical;
  356. -webkit-line-clamp: 1;
  357. overflow: hidden;
  358. }
  359. .u-p {
  360. font-size: $font-size-24;
  361. line-height: 64rpx;
  362. color: #ffffff;
  363. text-align: left;
  364. }
  365. }
  366. }
  367. .header-icon {
  368. flex: 2;
  369. margin-right: 20rpx;
  370. image {
  371. float: right;
  372. width: 128rpx;
  373. height: 128rpx;
  374. border-radius: 100%;
  375. border: 2rpx solid #ffffff;
  376. }
  377. }
  378. }
  379. .header-main-none {
  380. width: 702rpx;
  381. height: 152rpx;
  382. padding: 0 24rpx;
  383. display: flex;
  384. .header-text {
  385. flex: 8;
  386. display: flex;
  387. flex-direction: column;
  388. .user-item {
  389. flex: 1;
  390. height: 50rpx;
  391. line-height: 50rpx;
  392. .line {
  393. margin: 0 10rpx;
  394. }
  395. .u-h1 {
  396. float: left;
  397. font-size: $font-size-36;
  398. color: #ffffff;
  399. text-align: left;
  400. -o-text-overflow: ellipsis;
  401. text-overflow: ellipsis;
  402. display: -webkit-box;
  403. word-break: break-all;
  404. -webkit-box-orient: vertical;
  405. -webkit-line-clamp: 1;
  406. overflow: hidden;
  407. }
  408. .u-p {
  409. font-size: $font-size-24;
  410. line-height: 50rpx;
  411. color: #efefef;
  412. text-align: left;
  413. }
  414. .u-btn {
  415. width: 160rpx;
  416. height: 40rpx;
  417. background: rgba(255, 255, 255, 0.5);
  418. border-radius: 5rpx;
  419. line-height: 40rpx;
  420. text-align: center;
  421. font-size: $font-size-24;
  422. color: #ffffff;
  423. display: block;
  424. margin-top: 5rpx;
  425. padding-left: 6rpx;
  426. .icon-xiangyouhuabeifen {
  427. font-size: $font-size-24;
  428. }
  429. }
  430. }
  431. }
  432. .header-icon {
  433. flex: 2;
  434. display: flex;
  435. margin-right: 20rpx;
  436. align-items: center;
  437. justify-content: center;
  438. image {
  439. float: right;
  440. width: 128rpx;
  441. height: 128rpx;
  442. border-radius: 100%;
  443. border: 2rpx solid #ffffff;
  444. }
  445. }
  446. }
  447. .user-order {
  448. width: 654rpx;
  449. height: auto;
  450. padding: 0 24rpx;
  451. background-color: $bg-color;
  452. margin-bottom: 24rpx;
  453. position: absolute;
  454. bottom: -170rpx;
  455. left: 24rpx;
  456. border-radius: 20rpx;
  457. }
  458. .tab-title {
  459. font-size: $font-size-28;
  460. line-height: 80rpx;
  461. color: #333333;
  462. text-align: left;
  463. border-bottom: 1px solid #f8f8f8;
  464. position: relative;
  465. .cell-tit {
  466. font-size: $font-size-28;
  467. color: $text-color;
  468. }
  469. .cell-more {
  470. float: right;
  471. line-height: 80rpx;
  472. font-size: $font-size-24;
  473. color: #666666;
  474. padding-right: 30rpx;
  475. }
  476. .iconfont {
  477. width: 30rpx;
  478. height: 80rpx;
  479. line-height: 80rpx;
  480. text-align: center;
  481. position: absolute;
  482. right: 0;
  483. top: 0;
  484. display: block;
  485. font-size: $font-size-28;
  486. }
  487. }
  488. .order-section {
  489. display: flex;
  490. justify-content: space-around;
  491. align-items: center;
  492. flex-wrap: wrap;
  493. height: 99rpx;
  494. padding: 24rpx 0;
  495. }
  496. .order-item {
  497. flex: 1;
  498. display: flex;
  499. flex-direction: column;
  500. align-items: center;
  501. position: relative;
  502. &:last-child {
  503. margin-right: 0;
  504. }
  505. .order-icon {
  506. width: 52rpx;
  507. height: 52rpx;
  508. position: relative;
  509. image {
  510. width: 52rpx;
  511. height: 52rpx;
  512. }
  513. .icon-num {
  514. position: absolute;
  515. right: -24rpx;
  516. top: -9rpx;
  517. }
  518. .icon-num.goleft {
  519. right: -12rpx;
  520. }
  521. }
  522. .order-t {
  523. line-height: 50rpx;
  524. font-size: $font-size-24;
  525. color: $text-color;
  526. }
  527. }
  528. .foot-list {
  529. width: 100%;
  530. box-sizing: border-box;
  531. padding: 0 24rpx;
  532. padding-top: 168rpx;
  533. padding-bottom: 120rpx;
  534. }
  535. .list-cell-image {
  536. width: 100%;
  537. height: 168rpx;
  538. background: url(https://static.caimei365.com/app/meibohui/app/activity-small-banner@2x.png);
  539. background-size: cover;
  540. box-sizing: border-box;
  541. margin-bottom: 24rpx;
  542. .text {
  543. width: 100%;
  544. height: 100%;
  545. box-sizing: border-box;
  546. padding: 38rpx 56rpx;
  547. .h1 {
  548. line-height: 50rpx;
  549. font-size: $font-size-36;
  550. color: #ffffff;
  551. }
  552. .p {
  553. line-height: 34rpx;
  554. font-size: $font-size-30;
  555. color: #ffffff;
  556. }
  557. }
  558. }
  559. .list-cell-main {
  560. width: 100%;
  561. height: auto;
  562. margin-bottom: 24rpx;
  563. padding: 40rpx 10rpx 0 10rpx;
  564. background: $bg-color;
  565. border-radius: 20rpx;
  566. box-sizing: border-box;
  567. .list-cell-navs {
  568. width: 25%;
  569. height: auto;
  570. float: left;
  571. margin-bottom: 40rpx;
  572. .icon {
  573. width: 40rpx;
  574. height: 40rpx;
  575. margin: 0 auto;
  576. position: relative;
  577. margin-bottom: 10rpx;
  578. .icon-image {
  579. width: 40rpx;
  580. height: 40rpx;
  581. display: block;
  582. }
  583. }
  584. .name {
  585. width: 100%;
  586. height: 40rpx;
  587. line-height: 40rpx;
  588. text-align: center;
  589. font-size: $font-size-24;
  590. color: #999999;
  591. }
  592. }
  593. }
  594. .uni-badge--small {
  595. -webkit-transform: scale(0.8);
  596. -ms-transform: scale(0.8);
  597. transform: scale(0.8);
  598. -webkit-transform-origin: center center;
  599. -ms-transform-origin: center center;
  600. transform-origin: center center;
  601. }
  602. .uni-badge {
  603. font-family: 'Helvetica Neue', Helvetica, sans-serif;
  604. -webkit-box-sizing: border-box;
  605. box-sizing: border-box;
  606. font-size: 12px;
  607. line-height: 1;
  608. display: inline-block;
  609. padding: 3px 6px;
  610. color: #333;
  611. border-radius: 100px;
  612. background-color: #f1f1f1;
  613. }
  614. .uni-badge-error {
  615. color: #fff;
  616. background-color: #dd524d;
  617. }
  618. </style>