user.vue 23 KB

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