user.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  1. <template>
  2. <view class="container user clearfix">
  3. <view class="user-section">
  4. <view class="u-header">
  5. <image src="https://img.caimei365.com/group1/M00/03/94/Cmis216Sk_SAPDwvAAcTspdl8h0610.png" mode=""></image>
  6. <view class="u-header-main">
  7. <view class="user-item">
  8. <view class="logo-m">
  9. <image :src="headpic ? headpic:'https://img.caimei365.com/group1/M00/03/94/Cmis216Sk_OAZaxVAAANf4oruy4674.png'" mode=""></image>
  10. <text class="txt">协销员工</text>
  11. </view>
  12. </view>
  13. <view class="user-item">
  14. <text class="u-h1">{{name}}</text>
  15. </view>
  16. </view>
  17. </view>
  18. <!-- 订单 -->
  19. <view class="user-order">
  20. <view class="tab-title" @click="navigator('/market/pages/order/order-list?listType=0')">
  21. <text class="cell-tit">我的订单</text>
  22. <text class="cell-more">查看更多</text>
  23. <text class="iconfont icon-xiayibu"></text>
  24. </view>
  25. <view class="order-section">
  26. <view class="order-item" @click="navigator('/market/pages/order/order-list?listType=1')" hover-class="common-hover" :hover-stay-time="50">
  27. <view class="order-icon">
  28. <image src="../../static/temp/order1@3x.png" mode=""></image>
  29. <text v-if="beforeConfirmCount >0"
  30. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"
  31. :class="[beforeConfirmCount < 10 ? 'goleft':'']">
  32. {{beforeConfirmCount == 99? '99+' : beforeConfirmCount}}
  33. </text>
  34. </view>
  35. <text class="order-t">待确认</text>
  36. </view>
  37. <view class="order-item" @click="navigator('/market/pages/order/order-list?listType=2')" hover-class="common-hover" :hover-stay-time="50">
  38. <view class="order-icon">
  39. <image src="../../static/temp/order2@3x.png" mode=""></image>
  40. <text v-if="beforePayCount >0"
  41. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num "
  42. :class="[beforePayCount < 10 ? 'goleft':'']">
  43. {{beforePayCount == 99? '99+' : beforePayCount}}
  44. </text>
  45. </view>
  46. <text class="order-t">待付款</text>
  47. </view>
  48. <view class="order-item" @click="navigator('/market/pages/order/order-list?listType=3')" hover-class="common-hover" :hover-stay-time="50">
  49. <view class="order-icon">
  50. <image src="../../static/temp/order3@3x.png" mode=""></image>
  51. <text v-if="beforeShipCount >0"
  52. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"
  53. :class="[beforeShipCount < 10 ? 'goleft':'']">
  54. {{beforeShipCount == 99? '99+' : beforeShipCount}}
  55. </text>
  56. </view>
  57. <text class="order-t">待发货</text>
  58. </view>
  59. <view class="order-item" @click="navigator('/market/pages/order/order-list?listType=4')" hover-class="common-hover" :hover-stay-time="50">
  60. <view class="order-icon">
  61. <image src="../../static/temp/order4@3x.png" mode=""></image>
  62. <text v-if="shippedCount >0"
  63. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"
  64. :class="[shippedCount < 10 ? 'goleft':'']">
  65. {{shippedCount == 99? '99+' : shippedCount}}
  66. </text>
  67. </view>
  68. <text class="order-t">已发货</text>
  69. </view>
  70. <view class="order-item" @click="navigator('/market/pages/order/order-list?listType=5')" hover-class="common-hover" :hover-stay-time="50">
  71. <view class="order-icon">
  72. <image src="../../static/temp/order5@3x.png" mode=""></image>
  73. <text v-if="refundsCount >0"
  74. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"
  75. :class="[refundsCount < 10 ? 'goleft':'']">
  76. {{refundsCount == 99? '99+' : refundsCount}}
  77. </text>
  78. </view>
  79. <text class="order-t">退货/款</text>
  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 class="cell-more iconfont icon-xiayibu"></text>
  89. </view>
  90. </view>
  91. </view>
  92. </view>
  93. </view>
  94. </template>
  95. <script>
  96. import uniBadge from '@/components/uni-badge/uni-badge.vue'
  97. import { mapState,mapMutations } from 'vuex'
  98. import authorize from '@/common/config/authorize.js'
  99. import { userInfoLogin } from "@/api/use.js"
  100. import { getSellerHome } from "@/api/seller.js"
  101. export default{
  102. components: {
  103. uniBadge,
  104. },
  105. data() {
  106. return{
  107. name:'采美协销',
  108. headpic:'',
  109. userMoney:0.00,
  110. userId:'',
  111. aboutHtml:'',
  112. telPhone:'',
  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. }).catch(response =>{
  165. this.$util.msg(response.msg,2000)
  166. })
  167. })
  168. },
  169. navigator(url){
  170. this.$api.navigateTo(url)
  171. },
  172. showBadge(n){
  173. let num ='';
  174. if(n>100){num = 99}else{num = n;}
  175. return num;
  176. },
  177. onPullDownRefresh() {//下拉刷新
  178. this.initData()
  179. uni.stopPullDownRefresh()
  180. }
  181. }
  182. }
  183. </script>
  184. <style lang="scss">
  185. @import "@/uni.scss";
  186. page{
  187. background-color: #F7F7F7;
  188. }
  189. .user{
  190. width: 100%;
  191. height: auto;
  192. position:relative;
  193. background: rgba(247, 247, 247, 1);
  194. }
  195. .user-section.none{
  196. display: none;
  197. }
  198. .user-section.show{
  199. display: block;
  200. }
  201. .u-header{
  202. width: 100%;
  203. height: 400rpx;
  204. position: relative;
  205. image{
  206. width: 100%;
  207. height: 400rpx;
  208. }
  209. }
  210. .u-header-main{
  211. width: 100%;
  212. height: 284rpx;
  213. padding: 58rpx 0;
  214. position: absolute;
  215. top: 0;
  216. left: 0;
  217. .user-item{
  218. width: 100%;
  219. display: flex;
  220. flex-direction: column;
  221. align-items: center;
  222. margin-bottom: 16rpx;
  223. .u-h1{
  224. width: 410rpx;
  225. font-size: $font-size-28;
  226. line-height: 40rpx;
  227. color: #FFFFFF;
  228. margin-bottom: 8rpx;
  229. -o-text-overflow: ellipsis;
  230. text-overflow: ellipsis;
  231. display: -webkit-box;
  232. word-break: break-all;
  233. -webkit-box-orient: vertical;
  234. -webkit-line-clamp: 1;
  235. overflow: hidden;
  236. align-items: center;
  237. }
  238. .u-p{
  239. font-size: $font-size-24;
  240. line-height: 40rpx;
  241. color: #FFFFFF;
  242. }
  243. }
  244. .logo-m{
  245. width: 144rpx;
  246. height: 144rpx;
  247. border: 2rpx solid #FFFFFF;
  248. border-radius: 100%;
  249. background: $bg-color;
  250. position: relative;
  251. .txt{
  252. width: 144rpx;
  253. height: 42rpx;
  254. display: inline-block;
  255. background: linear-gradient(45deg,rgba(225,86,22,1) 0%,rgba(255,177,0,1) 100%);
  256. border-radius: 21rpx;
  257. line-height: 42rpx;
  258. text-align: center;
  259. color: #FFFFFF;
  260. font-size: $font-size-22;
  261. position: absolute;
  262. bottom: -10rpx;
  263. left: 0;
  264. }
  265. image{
  266. width: 144rpx;
  267. height: 144rpx;
  268. border-radius: 100%;
  269. }
  270. }
  271. }
  272. .user-order{
  273. width: 702rpx;
  274. height: auto;
  275. padding: 0 24rpx;
  276. background-color: $bg-color;
  277. margin-bottom: 24rpx;
  278. }
  279. .tab-title{
  280. font-size: $font-size-28;
  281. line-height: 80rpx;
  282. color: #333333;
  283. text-align:left;
  284. border-bottom: 1px solid #F8F8F8;
  285. position: relative;
  286. .cell-tit{
  287. font-size: $font-size-28;
  288. color: $text-color;
  289. }
  290. .cell-more{
  291. float: right;
  292. line-height: 80rpx;
  293. font-size: $font-size-24;
  294. color: $text-color;
  295. padding-right: 30rpx;
  296. }
  297. .iconfont{
  298. width: 30rpx;
  299. height: 80rpx;
  300. line-height: 80rpx;
  301. font-size: $font-size-28;
  302. text-align: center;
  303. position: absolute;
  304. right: 0;
  305. top: 0;
  306. display: block;
  307. }
  308. }
  309. .order-section{
  310. display: flex;
  311. justify-content: space-around;
  312. align-items: center;
  313. flex-wrap:wrap;
  314. height: 99rpx;
  315. padding: 24rpx 0;
  316. }
  317. .order-item{
  318. display: flex;
  319. flex-direction: column;
  320. align-items: center;
  321. width: 98rpx;
  322. position: relative;
  323. margin-right: 53rpx;
  324. &:last-child{
  325. margin-right: 0;
  326. }
  327. .order-icon{
  328. width: 52rpx;
  329. height: 52rpx;
  330. position: relative;
  331. image{
  332. width: 52rpx;
  333. height: 52rpx;
  334. }
  335. .icon-num{
  336. position: absolute;
  337. right:-24rpx;
  338. top: -9rpx;
  339. }
  340. .icon-num.goleft{
  341. right: -12rpx;
  342. }
  343. }
  344. .order-t{
  345. line-height: 50rpx;
  346. font-size: $font-size-24;
  347. color: $text-color;
  348. }
  349. }
  350. .foot-list{
  351. width: 100%;
  352. // margin-bottom: 150rpx;
  353. }
  354. .list-cell-item{
  355. width: 702rpx;
  356. height: auto;
  357. margin-bottom: 24rpx;
  358. padding:0 24rpx;
  359. background: $bg-color;
  360. }
  361. .list-cell{
  362. display:flex;
  363. width: 100%;
  364. align-items:baseline;
  365. line-height:100rpx;
  366. position:relative;
  367. background: $bg-color;
  368. justify-content: center;
  369. // border-bottom: 1px solid #EBEBEB;
  370. &.cell-hover{
  371. background:#fafafa;
  372. }
  373. .cell-more{
  374. align-self: baseline;
  375. font-size:$font-size-28;
  376. color:$text-color;
  377. margin-left:10rpx;
  378. }
  379. .cell-tit{
  380. flex: 1;
  381. font-size: $font-size-28;
  382. color: $text-color;
  383. margin-right:10rpx;
  384. }
  385. .cell-tip{
  386. font-size: $font-size-28;
  387. color: $text-color;
  388. }
  389. }
  390. .list-cell.last{
  391. border-bottom: none;
  392. }
  393. .uni-badge--small {
  394. -webkit-transform: scale(.8);
  395. -ms-transform: scale(.8);
  396. transform: scale(.8);
  397. -webkit-transform-origin: center center;
  398. -ms-transform-origin: center center;
  399. transform-origin: center center;
  400. }
  401. .uni-badge {
  402. font-family: 'Helvetica Neue', Helvetica, sans-serif;
  403. -webkit-box-sizing: border-box;
  404. box-sizing: border-box;
  405. font-size: 12px;
  406. line-height: 1;
  407. display: inline-block;
  408. padding: 3px 6px;
  409. color: #333;
  410. border-radius: 100px;
  411. background-color: #f1f1f1;
  412. }
  413. .uni-badge-error {
  414. color: #fff;
  415. background-color: #dd524d;
  416. }
  417. </style>