user.vue 17 KB

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