user.vue 17 KB

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