user.vue 21 KB

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