user.vue 16 KB

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