user.vue 15 KB

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