user.vue 15 KB

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