user.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  1. <template>
  2. <view class="container user clearfix">
  3. <tui-skeleton v-if="skeletonShow" backgroundColor="#fafafa" borderRadius="10rpx" :isLoading ="true" :loadingType="5"></tui-skeleton>
  4. <view class="user-section tui-skeleton">
  5. <view class="u-header tui-skeleton-fillet">
  6. <image src="https://img.caimei365.com/group1/M00/03/94/Cmis216Sk_SAPDwvAAcTspdl8h0610.png" mode=""></image>
  7. <view class="u-header-main">
  8. <view class="user-item">
  9. <view class="logo-m">
  10. <image :src="headpic ? headpic:'https://img.caimei365.com/group1/M00/03/94/Cmis216Sk_OAZaxVAAANf4oruy4674.png'" mode=""></image>
  11. <text class="txt tui-skeleton-fillet">协销员工</text>
  12. </view>
  13. </view>
  14. <view class="user-item tui-skeleton-fillet">
  15. <text class="u-h1">{{name}}</text>
  16. </view>
  17. </view>
  18. </view>
  19. <!-- 订单 -->
  20. <view class="user-order">
  21. <view class="tab-title tui-skeleton-fillet" @click="navigator('/market/pages/order/order-list?listType=0')">
  22. <text class="cell-tit tui-skeleton-fillet">我的订单</text>
  23. <text class="cell-more tui-skeleton-fillet">查看更多</text>
  24. <text class="iconfont icon-xiayibu"></text>
  25. </view>
  26. <view class="order-section">
  27. <view class="order-item" @click="navigator('/market/pages/order/order-list?listType=1')" hover-class="common-hover" :hover-stay-time="50">
  28. <view class="order-icon tui-skeleton-fillet">
  29. <image src="../../static/temp/order1@3x.png" mode=""></image>
  30. <text v-if="beforeConfirmCount >0"
  31. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"
  32. :class="[beforeConfirmCount < 10 ? 'goleft':'']">
  33. {{beforeConfirmCount == 99? '99+' : beforeConfirmCount}}
  34. </text>
  35. </view>
  36. <text class="order-t tui-skeleton-fillet">待确认</text>
  37. </view>
  38. <view class="order-item" @click="navigator('/market/pages/order/order-list?listType=2')" hover-class="common-hover" :hover-stay-time="50">
  39. <view class="order-icon tui-skeleton-fillet">
  40. <image src="../../static/temp/order2@3x.png" mode=""></image>
  41. <text v-if="beforePayCount >0"
  42. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num "
  43. :class="[beforePayCount < 10 ? 'goleft':'']">
  44. {{beforePayCount == 99? '99+' : beforePayCount}}
  45. </text>
  46. </view>
  47. <text class="order-t tui-skeleton-fillet">待付款</text>
  48. </view>
  49. <view class="order-item" @click="navigator('/market/pages/order/order-list?listType=3')" hover-class="common-hover" :hover-stay-time="50">
  50. <view class="order-icon tui-skeleton-fillet">
  51. <image src="../../static/temp/order3@3x.png" mode=""></image>
  52. <text v-if="beforeShipCount >0"
  53. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"
  54. :class="[beforeShipCount < 10 ? 'goleft':'']">
  55. {{beforeShipCount == 99? '99+' : beforeShipCount}}
  56. </text>
  57. </view>
  58. <text class="order-t tui-skeleton-fillet">待发货</text>
  59. </view>
  60. <view class="order-item" @click="navigator('/market/pages/order/order-list?listType=4')" hover-class="common-hover" :hover-stay-time="50">
  61. <view class="order-icon tui-skeleton-fillet">
  62. <image src="../../static/temp/order4@3x.png" mode=""></image>
  63. <text v-if="shippedCount >0"
  64. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"
  65. :class="[shippedCount < 10 ? 'goleft':'']">
  66. {{shippedCount == 99? '99+' : shippedCount}}
  67. </text>
  68. </view>
  69. <text class="order-t tui-skeleton-fillet">已发货</text>
  70. </view>
  71. <view class="order-item" @click="navigator('/market/pages/order/order-list?listType=5')" hover-class="common-hover" :hover-stay-time="50">
  72. <view class="order-icon tui-skeleton-fillet">
  73. <image src="../../static/temp/order5@3x.png" mode=""></image>
  74. <text v-if="refundsCount >0"
  75. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"
  76. :class="[refundsCount < 10 ? 'goleft':'']">
  77. {{refundsCount == 99? '99+' : refundsCount}}
  78. </text>
  79. </view>
  80. <text class="order-t tui-skeleton-fillet">退货/款</text>
  81. </view>
  82. </view>
  83. </view>
  84. <!-- 底部跳转 -->
  85. <view class="foot-list">
  86. <view class="list-cell-item">
  87. <view class="list-cell tui-skeleton-fillet" v-for="(item, index) in firstList" :key="index" @click="navigator(item.path)" hover-class="cell-hover" :hover-stay-time="50">
  88. <text class="cell-tit">{{item.name}}</text>
  89. <text class="cell-more iconfont icon-xiayibu"></text>
  90. </view>
  91. </view>
  92. </view>
  93. </view>
  94. </view>
  95. </template>
  96. <script>
  97. import uniBadge from '@/components/uni-badge/uni-badge.vue'
  98. import { mapState,mapMutations } from 'vuex'
  99. import authorize from '@/common/config/authorize.js'
  100. import { userInfoLogin } from "@/api/use.js"
  101. import { getSellerHome } from "@/api/seller.js"
  102. export default{
  103. components: {
  104. uniBadge,
  105. },
  106. data() {
  107. return{
  108. name:'',
  109. headpic:'',
  110. userMoney:0.00,
  111. userId:'',
  112. skeletonShow:true,
  113. beforeConfirmCount:0,//待确认角标
  114. beforePayCount:0, //待付款角标
  115. beforeShipCount:0, //待发货角标
  116. shippedCount:0, //已发货角标
  117. refundsCount:'', //退货/款角标
  118. firstList:[
  119. {name:'机构列表',path:'/market/pages/club/list'},
  120. {name:'帮机构下单',path:'/market/pages/club/club-list'},
  121. {name:'拉机构上线',path:'/market/pages/login/register'},
  122. {name:'邀请运营人员',path:'/market/pages/club/allClub-list'}
  123. ],
  124. }
  125. },
  126. created() {
  127. this.initData()
  128. },
  129. methods:{
  130. ...mapMutations(['login','logout']),
  131. initData(){
  132. authorize.getCode('weixin').then(wechatcode =>{// 根据微信的code获取用户登录状态:1已登录过 -1未登录过
  133. authorize.getUserInfo('weixin').then(wxResponse =>{
  134. userInfoLogin({code:wechatcode,encryptedData:wxResponse.encryptedData,iv:wxResponse.iv}).then(response =>{
  135. this.$store.commit('updateStatus',response.data)
  136. this.login(response.data);
  137. uni.setStorageSync('token',response.data.token)
  138. uni.removeStorageSync('sessionid')
  139. uni.setStorageSync('sessionid','JSESSIONID='+response.data.sessionId)
  140. this.getUserSellerHome()
  141. }).catch(response =>{
  142. this.logout()
  143. console.log('222222222')
  144. uni.removeStorageSync('sessionid')
  145. uni.setStorageSync('sessionid','JSESSIONID='+response.data)
  146. this.$store.commit('updateStatus',response.data)
  147. this.$api.navigateTo('/market/pages/login/login')
  148. })
  149. })
  150. })
  151. },
  152. getUserSellerHome(){
  153. this.$api.getStorage().then((resolve) =>{
  154. this.userId = resolve.userID
  155. getSellerHome({userId:this.userId}).then(response =>{
  156. let sellerData = response.data
  157. this.name = sellerData.seller.linkMan1?sellerData.seller.linkMan1:'' //协销名称
  158. this.headpic = sellerData.seller.logo //会所头像
  159. this.beforeConfirmCount = this.showBadge(sellerData.beforeConfirmCount)//待付款
  160. this.beforePayCount = this.showBadge(sellerData.beforePayCount)//待付款
  161. this.beforeShipCount = this.showBadge(sellerData.beforeShipCount)//待发货
  162. this.shippedCount = this.showBadge(sellerData.shippedCount)//已发货
  163. this.refundsCount = this.showBadge(sellerData.refundsCount)//退货/款
  164. this.skeletonShow = false;
  165. }).catch(response =>{
  166. this.$util.msg(response.msg,2000)
  167. })
  168. })
  169. },
  170. navigator(url){
  171. this.$api.navigateTo(url)
  172. },
  173. showBadge(n){
  174. let num ='';
  175. if(n>100){num = 99}else{num = n;}
  176. return num;
  177. },
  178. onPullDownRefresh() {//下拉刷新
  179. this.initData()
  180. uni.stopPullDownRefresh()
  181. }
  182. }
  183. }
  184. </script>
  185. <style lang="scss">
  186. @import "@/uni.scss";
  187. page{
  188. background-color: #F7F7F7;
  189. }
  190. .user{
  191. width: 100%;
  192. height: auto;
  193. position:relative;
  194. background: rgba(247, 247, 247, 1);
  195. }
  196. .user-section.none{
  197. display: none;
  198. }
  199. .user-section.show{
  200. display: block;
  201. }
  202. .u-header{
  203. width: 100%;
  204. height: 400rpx;
  205. position: relative;
  206. image{
  207. width: 100%;
  208. height: 400rpx;
  209. }
  210. }
  211. .u-header-main{
  212. width: 100%;
  213. height: 284rpx;
  214. padding: 58rpx 0;
  215. position: absolute;
  216. top: 0;
  217. left: 0;
  218. .user-item{
  219. width: 100%;
  220. display: flex;
  221. flex-direction: column;
  222. align-items: center;
  223. margin-bottom: 16rpx;
  224. .u-h1{
  225. width: 410rpx;
  226. font-size: $font-size-28;
  227. line-height: 40rpx;
  228. color: #FFFFFF;
  229. margin-bottom: 8rpx;
  230. -o-text-overflow: ellipsis;
  231. text-overflow: ellipsis;
  232. display: -webkit-box;
  233. word-break: break-all;
  234. -webkit-box-orient: vertical;
  235. -webkit-line-clamp: 1;
  236. overflow: hidden;
  237. align-items: center;
  238. }
  239. .u-p{
  240. font-size: $font-size-24;
  241. line-height: 40rpx;
  242. color: #FFFFFF;
  243. }
  244. }
  245. .logo-m{
  246. width: 144rpx;
  247. height: 144rpx;
  248. border: 2rpx solid #FFFFFF;
  249. border-radius: 100%;
  250. background: $bg-color;
  251. position: relative;
  252. .txt{
  253. width: 144rpx;
  254. height: 42rpx;
  255. display: inline-block;
  256. background: linear-gradient(45deg,rgba(225,86,22,1) 0%,rgba(255,177,0,1) 100%);
  257. border-radius: 21rpx;
  258. line-height: 42rpx;
  259. text-align: center;
  260. color: #FFFFFF;
  261. font-size: $font-size-22;
  262. position: absolute;
  263. bottom: -10rpx;
  264. left: 0;
  265. }
  266. image{
  267. width: 144rpx;
  268. height: 144rpx;
  269. border-radius: 100%;
  270. }
  271. }
  272. }
  273. .user-order{
  274. width: 702rpx;
  275. height: auto;
  276. padding: 0 24rpx;
  277. background-color: $bg-color;
  278. margin-bottom: 24rpx;
  279. }
  280. .tab-title{
  281. font-size: $font-size-28;
  282. line-height: 80rpx;
  283. color: #333333;
  284. text-align:left;
  285. border-bottom: 1px solid #F8F8F8;
  286. position: relative;
  287. .cell-tit{
  288. font-size: $font-size-28;
  289. color: $text-color;
  290. }
  291. .cell-more{
  292. float: right;
  293. line-height: 80rpx;
  294. font-size: $font-size-24;
  295. color: $text-color;
  296. padding-right: 30rpx;
  297. }
  298. .iconfont{
  299. width: 30rpx;
  300. height: 80rpx;
  301. line-height: 80rpx;
  302. font-size: $font-size-28;
  303. text-align: center;
  304. position: absolute;
  305. right: 0;
  306. top: 0;
  307. display: block;
  308. }
  309. }
  310. .order-section{
  311. display: flex;
  312. justify-content: space-around;
  313. align-items: center;
  314. flex-wrap:wrap;
  315. height: 99rpx;
  316. padding: 24rpx 0;
  317. }
  318. .order-item{
  319. display: flex;
  320. flex-direction: column;
  321. align-items: center;
  322. width: 98rpx;
  323. position: relative;
  324. margin-right: 53rpx;
  325. &:last-child{
  326. margin-right: 0;
  327. }
  328. .order-icon{
  329. width: 52rpx;
  330. height: 52rpx;
  331. position: relative;
  332. image{
  333. width: 52rpx;
  334. height: 52rpx;
  335. }
  336. .icon-num{
  337. position: absolute;
  338. right:-24rpx;
  339. top: -9rpx;
  340. }
  341. .icon-num.goleft{
  342. right: -12rpx;
  343. }
  344. }
  345. .order-t{
  346. line-height: 50rpx;
  347. font-size: $font-size-24;
  348. color: $text-color;
  349. }
  350. }
  351. .foot-list{
  352. width: 100%;
  353. // margin-bottom: 150rpx;
  354. }
  355. .list-cell-item{
  356. width: 702rpx;
  357. height: auto;
  358. margin-bottom: 24rpx;
  359. padding:0 24rpx;
  360. background: $bg-color;
  361. }
  362. .list-cell{
  363. display:flex;
  364. width: 100%;
  365. align-items:baseline;
  366. line-height:100rpx;
  367. position:relative;
  368. background: $bg-color;
  369. justify-content: center;
  370. // border-bottom: 1px solid #EBEBEB;
  371. &.cell-hover{
  372. background:#fafafa;
  373. }
  374. .cell-more{
  375. align-self: baseline;
  376. font-size:$font-size-28;
  377. color:$text-color;
  378. margin-left:10rpx;
  379. }
  380. .cell-tit{
  381. flex: 1;
  382. font-size: $font-size-28;
  383. color: $text-color;
  384. margin-right:10rpx;
  385. }
  386. .cell-tip{
  387. font-size: $font-size-28;
  388. color: $text-color;
  389. }
  390. }
  391. .list-cell.last{
  392. border-bottom: none;
  393. }
  394. .uni-badge--small {
  395. -webkit-transform: scale(.8);
  396. -ms-transform: scale(.8);
  397. transform: scale(.8);
  398. -webkit-transform-origin: center center;
  399. -ms-transform-origin: center center;
  400. transform-origin: center center;
  401. }
  402. .uni-badge {
  403. font-family: 'Helvetica Neue', Helvetica, sans-serif;
  404. -webkit-box-sizing: border-box;
  405. box-sizing: border-box;
  406. font-size: 12px;
  407. line-height: 1;
  408. display: inline-block;
  409. padding: 3px 6px;
  410. color: #333;
  411. border-radius: 100px;
  412. background-color: #f1f1f1;
  413. }
  414. .uni-badge-error {
  415. color: #fff;
  416. background-color: #dd524d;
  417. }
  418. </style>