user.vue 22 KB

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