user.vue 17 KB

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