user.vue 14 KB

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