user.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677
  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. name: '关于我们',
  194. path: '/pages/user/about/about',
  195. icon: 'https://static.caimei365.com/app/img/icon/icon_club_6@2x.png'
  196. },
  197. {
  198. name: '资质证书',
  199. path: '/pages/service/certificate-page',
  200. icon: 'https://static.caimei365.com/app/img/icon/icon_club_14@2x.png'
  201. }
  202. ],
  203. }
  204. },
  205. created() {
  206. this.initData()
  207. },
  208. computed: {
  209. ...mapState(['hasLogin', 'userInfo'])
  210. },
  211. methods: {
  212. ...mapMutations(['login', 'logout']),
  213. async initData() {
  214. const wechatCode = await authorize.getCode('weixin') // 根据微信的code获取用户登录状态:1已登录过 -1未登录过
  215. const getUserInfo = await authorize.getUserInfo('weixin')
  216. const params = { code: wechatCode, encryptedData: getUserInfo.encryptedData, iv: getUserInfo.iv }
  217. this.UserService.UserLoginAuthApplets(params).then(response => {
  218. if (response.code == 0 || response.code == 4) {
  219. this.isLogin = true
  220. this.userID = response.data.userId
  221. this.userIdentity = response.data.userIdentity
  222. this.clubStatus = response.data.clubStatus
  223. this.serviceProviderId = response.data.serviceProviderId
  224. this.$store.commit('updateStatus', response.data)
  225. this.login(response.data)
  226. uni.setStorageSync('token', response.data.token)
  227. uni.setStorageSync('unionId', response.data.unionId)
  228. uni.setStorageSync('spUserId', response.data.spUserId)
  229. this.getUserSellerHome()
  230. this.getOrderCount()
  231. } else {
  232. this.isLogin = false
  233. this.logout()
  234. uni.setStorageSync('unionId', response.data.unionId)
  235. this.$store.commit('updateStatus', response.data)
  236. this.$api.navigateTo('/pages/seller/login/login')
  237. }
  238. })
  239. },
  240. getUserSellerHome() {
  241. this.$api.getStorage().then(resolve => {
  242. this.userId = resolve.userId ? resolve.userId : 0
  243. this.SellerService.GetSellerHome({ userId: this.userId })
  244. .then(response => {
  245. let sellerData = response.data
  246. this.name = sellerData.linkMan ? sellerData.linkMan : '' //协销名称
  247. this.headpic = sellerData.logo //会所头像
  248. this.skeletonShow = false
  249. })
  250. .catch(error => {
  251. this.$util.msg(error.msg, 2000)
  252. })
  253. })
  254. },
  255. getOrderCount() {
  256. this.SellerService.GetOrderCount({ serviceProviderId: this.serviceProviderId }).then(response => {
  257. let data = response.data
  258. this.beforeConfirmCount = this.showBadge(data.confirmedCount) //待确认
  259. this.beforePayCount = this.showBadge(data.paymentCount) //待付款
  260. this.beforeShipCount = this.showBadge(data.waitShipmentsCount) //待发货
  261. this.shippedCount = this.showBadge(data.shipmentsCount) //已发货
  262. this.refundsCount = this.showBadge(data.salesReturnCount) //退货/款
  263. this.orderNum = this.showBadge(data.uncheckedOrderCount) //未查看订单数量
  264. })
  265. },
  266. TestZHIboFn() {
  267. //测试跳转直播小程序
  268. // uni.navigateToMiniProgram({
  269. // appId: 'wx92d650b253f8f2e3',
  270. // path: '/pages/index/index',
  271. // extraData: {
  272. // 'data1': 'test'
  273. // },
  274. // envVersion: 'develop',
  275. // success(res) {
  276. // // 打开成功
  277. // console.log(res)
  278. // }
  279. // })
  280. },
  281. navigator(url) {
  282. this.$api.navigateTo(url)
  283. },
  284. showBadge(n) {
  285. let num = ''
  286. if (n > 100) {
  287. num = 99
  288. } else {
  289. num = n
  290. }
  291. return num
  292. },
  293. onPullDownRefresh() {
  294. //下拉刷新
  295. this.initData()
  296. uni.stopPullDownRefresh()
  297. }
  298. }
  299. }
  300. </script>
  301. <style lang="scss">
  302. @import '@/uni.scss';
  303. .user {
  304. width: 100%;
  305. height: 100%;
  306. position: relative;
  307. background-color: #f7f7f7;
  308. padding-bottom: 120rpx;
  309. }
  310. .header {
  311. width: 100%;
  312. position: relative;
  313. background-size: cover;
  314. }
  315. .header-main {
  316. width: 702rpx;
  317. height: 130rpx;
  318. padding: 12rpx 24rpx;
  319. display: flex;
  320. .header-text {
  321. flex: 8;
  322. display: flex;
  323. flex-direction: column;
  324. .user-item {
  325. flex: 1;
  326. height: 64rpx;
  327. line-height: 64rpx;
  328. .u-tips {
  329. display: inline-block;
  330. float: left;
  331. width: 98rpx;
  332. height: 30rpx;
  333. border: 1px solid #ffffff;
  334. background: #ffffff;
  335. border-radius: 16rpx;
  336. line-height: 30rpx;
  337. font-size: $font-size-20;
  338. text-align: center;
  339. color: #999;
  340. }
  341. .u-viptips {
  342. display: inline-block;
  343. float: left;
  344. width: 98rpx;
  345. height: 30rpx;
  346. border: 1px solid #ffe600;
  347. background: linear-gradient(128deg, rgba(242, 143, 49, 1) 0%, rgba(225, 86, 22, 1) 100%);
  348. border-radius: 16rpx;
  349. line-height: 30rpx;
  350. font-size: $font-size-20;
  351. text-align: center;
  352. color: #ffe600;
  353. margin-left: 10rpx;
  354. margin-top: 17rpx;
  355. }
  356. .u-h1 {
  357. float: left;
  358. font-size: $font-size-30;
  359. color: #ffffff;
  360. text-align: left;
  361. -o-text-overflow: ellipsis;
  362. text-overflow: ellipsis;
  363. display: -webkit-box;
  364. word-break: break-all;
  365. -webkit-box-orient: vertical;
  366. -webkit-line-clamp: 1;
  367. overflow: hidden;
  368. }
  369. .u-p {
  370. font-size: $font-size-24;
  371. line-height: 64rpx;
  372. color: #ffffff;
  373. text-align: left;
  374. }
  375. }
  376. }
  377. .header-icon {
  378. flex: 2;
  379. margin-right: 20rpx;
  380. image {
  381. float: right;
  382. width: 128rpx;
  383. height: 128rpx;
  384. border-radius: 100%;
  385. border: 2rpx solid #ffffff;
  386. }
  387. }
  388. }
  389. .header-main-none {
  390. width: 702rpx;
  391. height: 152rpx;
  392. padding: 0 24rpx;
  393. display: flex;
  394. .header-text {
  395. flex: 8;
  396. display: flex;
  397. flex-direction: column;
  398. .user-item {
  399. flex: 1;
  400. height: 50rpx;
  401. line-height: 50rpx;
  402. .line {
  403. margin: 0 10rpx;
  404. }
  405. .u-h1 {
  406. float: left;
  407. font-size: $font-size-36;
  408. color: #ffffff;
  409. text-align: left;
  410. -o-text-overflow: ellipsis;
  411. text-overflow: ellipsis;
  412. display: -webkit-box;
  413. word-break: break-all;
  414. -webkit-box-orient: vertical;
  415. -webkit-line-clamp: 1;
  416. overflow: hidden;
  417. }
  418. .u-p {
  419. font-size: $font-size-24;
  420. line-height: 50rpx;
  421. color: #efefef;
  422. text-align: left;
  423. }
  424. .u-btn {
  425. width: 160rpx;
  426. height: 40rpx;
  427. background: rgba(255, 255, 255, 0.5);
  428. border-radius: 5rpx;
  429. line-height: 40rpx;
  430. text-align: center;
  431. font-size: $font-size-24;
  432. color: #ffffff;
  433. display: block;
  434. margin-top: 5rpx;
  435. padding-left: 6rpx;
  436. .icon-xiangyouhuabeifen {
  437. font-size: $font-size-24;
  438. }
  439. }
  440. }
  441. }
  442. .header-icon {
  443. flex: 2;
  444. display: flex;
  445. margin-right: 20rpx;
  446. align-items: center;
  447. justify-content: center;
  448. image {
  449. float: right;
  450. width: 128rpx;
  451. height: 128rpx;
  452. border-radius: 100%;
  453. border: 2rpx solid #ffffff;
  454. }
  455. }
  456. }
  457. .user-order {
  458. width: 654rpx;
  459. height: auto;
  460. padding: 0 24rpx;
  461. background-color: $bg-color;
  462. margin-bottom: 24rpx;
  463. position: absolute;
  464. bottom: -170rpx;
  465. left: 24rpx;
  466. border-radius: 20rpx;
  467. }
  468. .tab-title {
  469. font-size: $font-size-28;
  470. line-height: 80rpx;
  471. color: #333333;
  472. text-align: left;
  473. border-bottom: 1px solid #f8f8f8;
  474. position: relative;
  475. .cell-tit {
  476. font-size: $font-size-28;
  477. color: $text-color;
  478. }
  479. .cell-more {
  480. float: right;
  481. line-height: 80rpx;
  482. font-size: $font-size-24;
  483. color: #666666;
  484. padding-right: 30rpx;
  485. }
  486. .iconfont {
  487. width: 30rpx;
  488. height: 80rpx;
  489. line-height: 80rpx;
  490. text-align: center;
  491. position: absolute;
  492. right: 0;
  493. top: 0;
  494. display: block;
  495. font-size: $font-size-28;
  496. }
  497. }
  498. .order-section {
  499. display: flex;
  500. justify-content: space-around;
  501. align-items: center;
  502. flex-wrap: wrap;
  503. height: 99rpx;
  504. padding: 24rpx 0;
  505. }
  506. .order-item {
  507. flex: 1;
  508. display: flex;
  509. flex-direction: column;
  510. align-items: center;
  511. position: relative;
  512. &:last-child {
  513. margin-right: 0;
  514. }
  515. .order-icon {
  516. width: 52rpx;
  517. height: 52rpx;
  518. position: relative;
  519. image {
  520. width: 52rpx;
  521. height: 52rpx;
  522. }
  523. .icon-num {
  524. position: absolute;
  525. right: -24rpx;
  526. top: -9rpx;
  527. }
  528. .icon-num.goleft {
  529. right: -12rpx;
  530. }
  531. }
  532. .order-t {
  533. line-height: 50rpx;
  534. font-size: $font-size-24;
  535. color: $text-color;
  536. }
  537. }
  538. .foot-list {
  539. width: 100%;
  540. box-sizing: border-box;
  541. padding: 0 24rpx;
  542. padding-top: 168rpx;
  543. padding-bottom: 120rpx;
  544. }
  545. .list-cell-image {
  546. width: 100%;
  547. height: 168rpx;
  548. background: url(https://static.caimei365.com/app/meibohui/app/activity-small-banner@2x.png);
  549. background-size: cover;
  550. box-sizing: border-box;
  551. margin-bottom: 24rpx;
  552. .text {
  553. width: 100%;
  554. height: 100%;
  555. box-sizing: border-box;
  556. padding: 38rpx 56rpx;
  557. .h1 {
  558. line-height: 50rpx;
  559. font-size: $font-size-36;
  560. color: #ffffff;
  561. }
  562. .p {
  563. line-height: 34rpx;
  564. font-size: $font-size-30;
  565. color: #ffffff;
  566. }
  567. }
  568. }
  569. .list-cell-main {
  570. width: 100%;
  571. height: auto;
  572. margin-bottom: 24rpx;
  573. padding: 40rpx 10rpx 0 10rpx;
  574. background: $bg-color;
  575. border-radius: 20rpx;
  576. box-sizing: border-box;
  577. .list-cell-navs {
  578. width: 25%;
  579. height: auto;
  580. float: left;
  581. margin-bottom: 40rpx;
  582. .icon {
  583. width: 40rpx;
  584. height: 40rpx;
  585. margin: 0 auto;
  586. position: relative;
  587. margin-bottom: 10rpx;
  588. .icon-image {
  589. width: 40rpx;
  590. height: 40rpx;
  591. display: block;
  592. }
  593. }
  594. .name {
  595. width: 100%;
  596. height: 40rpx;
  597. line-height: 40rpx;
  598. text-align: center;
  599. font-size: $font-size-24;
  600. color: #999999;
  601. }
  602. }
  603. }
  604. .uni-badge--small {
  605. -webkit-transform: scale(0.8);
  606. -ms-transform: scale(0.8);
  607. transform: scale(0.8);
  608. -webkit-transform-origin: center center;
  609. -ms-transform-origin: center center;
  610. transform-origin: center center;
  611. }
  612. .uni-badge {
  613. font-family: 'Helvetica Neue', Helvetica, sans-serif;
  614. -webkit-box-sizing: border-box;
  615. box-sizing: border-box;
  616. font-size: 12px;
  617. line-height: 1;
  618. display: inline-block;
  619. padding: 3px 6px;
  620. color: #333;
  621. border-radius: 100px;
  622. background-color: #f1f1f1;
  623. }
  624. .uni-badge-error {
  625. color: #fff;
  626. background-color: #dd524d;
  627. }
  628. </style>