user.vue 16 KB

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