user.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437
  1. <template>
  2. <view class="container user clearfix" :style="{paddingBottom:isIphoneX?'140rpx':'98rpx'}">
  3. <view class="user-section" :class="[!isShowNoLogin ? 'show' : 'none']">
  4. <view class="u-header">
  5. <image src="https://admin-b.caimei365.com/userfiles/1/images/photo/2020/03/%E6%88%91%E7%9A%84%20%E2%80%93%201%403x.png" mode=""></image>
  6. <view class="u-header-main">
  7. <view class="user-item">
  8. <view class="logo-m">
  9. <image :src="headpic == null? '../../../static/temp/icon-club@3x.png' : headpic" 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?state=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?state=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="paymentCount >0"
  30. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"
  31. :class="[paymentCount < 10 ? 'goleft':'']">
  32. {{paymentCount == 99? '99+' : paymentCount}}
  33. </text>
  34. </view>
  35. <text class="order-t">待付款</text>
  36. </view>
  37. <view class="order-item" @click="navigator('/market/pages/order/order-list?state=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="waitShipmentsCount >0"
  41. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num "
  42. :class="[waitShipmentsCount < 10 ? 'goleft':'']">
  43. {{waitShipmentsCount == 99? '99+' : waitShipmentsCount}}
  44. </text>
  45. </view>
  46. <text class="order-t">待发货</text>
  47. </view>
  48. <view class="order-item" @click="navigator('/market/pages/order/order-list?state=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="shipmentsCount >0"
  52. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"
  53. :class="[shipmentsCount < 10 ? 'goleft':'']">
  54. {{shipmentsCount == 99? '99+' : shipmentsCount}}
  55. </text>
  56. </view>
  57. <text class="order-t">待确认</text>
  58. </view>
  59. <view class="order-item" @click="navigator('/market/pages/order/order-list?state=5')" 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="salesReturnCount >0"
  63. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"
  64. :class="[salesReturnCount < 10 ? 'goleft':'']">
  65. {{salesReturnCount == 99? '99+' : salesReturnCount}}
  66. </text>
  67. </view>
  68. <text class="order-t">已发货</text>
  69. </view>
  70. <view class="order-item" @click="navigator('/market/pages/order/order-list?state=4')" hover-class="common-hover" :hover-stay-time="50">
  71. <view class="order-icon">
  72. <image src="../../../static/temp/order5@3x.png" mode=""></image>
  73. </view>
  74. <text class="order-t">退货/款</text>
  75. </view>
  76. </view>
  77. </view>
  78. <!-- 底部跳转 -->
  79. <view class="foot-list">
  80. <view class="list-cell-item">
  81. <view class="list-cell" v-for="(item, index) in firstList" :key="index" @click="navigator(item.path)" hover-class="cell-hover" :hover-stay-time="50">
  82. <text class="cell-tit">{{item.name}}</text>
  83. <text class="cell-more iconfont icon-xiayibu"></text>
  84. </view>
  85. </view>
  86. </view>
  87. </view>
  88. <!-- 底部tabbar -->
  89. <cu-tabbar :active-index ="2"></cu-tabbar>
  90. </view>
  91. </template>
  92. <script>
  93. import cuTabbar from '@/components/cu-tabbar.vue'
  94. import uniBadge from '@/components/uni-badge/uni-badge.vue'
  95. import { mapState,mapMutations } from 'vuex'
  96. import { personalInfo } from "@/api/use.js"
  97. export default{
  98. components: {
  99. uniBadge,
  100. cuTabbar
  101. },
  102. data() {
  103. return{
  104. name:'采美采购商城',
  105. headpic:'',
  106. userMoney:0.00,
  107. contactNumber:'',
  108. openid:'',
  109. aboutHtml:'',
  110. telPhone:'',
  111. paymentCount:0, //待付款角标
  112. waitShipmentsCount:0, //待收货角标
  113. shipmentsCount:0, //已发货角标
  114. salesReturnCount:'',//退货/款角标
  115. isShowNoLogin:false,
  116. isIphoneX:this.$store.state.isIphoneX,
  117. firstList:[
  118. {name:'机构列表',path:'/market/pages/club/list'},
  119. {name:'帮机构下单',path:'/market/pages/club/club-list'},
  120. {name:'拉机构上线',path:'/market/pages/login/register'}
  121. ],
  122. }
  123. },
  124. onLoad(){
  125. },
  126. computed: {
  127. ...mapState(['hasLogin','userInfo'])
  128. },
  129. methods:{
  130. initData(){
  131. personalInfo({userID:this.userID}).then(response =>{
  132. this.$store.commit('updateAllNum',response.data.count)
  133. let user_data =response.data
  134. let _userData = user_data.user
  135. let _clubData = user_data.club
  136. if(_userData.ableUserMoney == 0){
  137. this.userMoney = '0.00';
  138. }else{
  139. let i = _userData.ableUserMoney.toString().lastIndexOf('.');
  140. let money;
  141. if(i==-1){
  142. money = this.$api.FormatMoney(_userData.ableUserMoney); //会所剩余余额
  143. this.userMoney = money +'.00'
  144. }else{
  145. money = this.$api.FormatMoney(_userData.ableUserMoney); //会所剩余余额
  146. this.userMoney = money
  147. }
  148. }
  149. this.name = _clubData.name //会所名称
  150. this.headpic = _userData.image //会所头像
  151. this.contactNumber = user_data.organize.contactNumber //联系电话
  152. this.paymentCount = this.showBadge(user_data.paymentCount)//待付款
  153. this.waitShipmentsCount = this.showBadge(user_data.waitShipmentsCount)//待收货
  154. this.shipmentsCount = this.showBadge(user_data.shipmentsCount)//已发货
  155. this.salesReturnCount = this.showBadge(user_data.salesReturnCount)//退货/款
  156. let clubInfo ={name:this.name,image:this.headpic,clubID:_clubData.clubID}
  157. uni.setStorage({//缓存机构
  158. key: 'clubInfo',
  159. data: clubInfo
  160. })
  161. }).catch(response =>{
  162. this.$util.msg(response.msg,2000)
  163. })
  164. },
  165. toPhone(){
  166. uni.makePhoneCall({
  167. phoneNumber:this.contactNumber //仅为示例
  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. onShow(){
  183. if(!this.hasLogin){
  184. this.isShowNoLogin = true;
  185. this.$api.redirectTo('/pages/login/login-accont?type=4')
  186. this.$store.commit('updateAllNum',0)
  187. }else{
  188. this.$api.getStorage().then((resolve) =>{
  189. // console.log(resolve)
  190. this.userID = resolve.userID
  191. this.initData()
  192. this.isShowNoLogin = false;
  193. })
  194. }
  195. }
  196. }
  197. }
  198. </script>
  199. <style lang="scss">
  200. @import "@/uni.scss";
  201. page{
  202. background-color: #F7F7F7;
  203. }
  204. .user{
  205. width: 100%;
  206. height: 100%;
  207. position:relative;
  208. background: rgba(247, 247, 247, 1);
  209. }
  210. .user-section.none{
  211. display: none;
  212. }
  213. .user-section.show{
  214. display: block;
  215. }
  216. .u-header{
  217. width: 100%;
  218. height: 400rpx;
  219. position: relative;
  220. image{
  221. width: 100%;
  222. height: 400rpx;
  223. }
  224. }
  225. .u-header-main{
  226. width: 100%;
  227. height: 284rpx;
  228. padding: 58rpx 0;
  229. position: absolute;
  230. top: 0;
  231. left: 0;
  232. .user-item{
  233. width: 100%;
  234. display: flex;
  235. flex-direction: column;
  236. align-items: center;
  237. margin-bottom: 16rpx;
  238. .u-h1{
  239. width: 410rpx;
  240. font-size: $font-size-28;
  241. line-height: 40rpx;
  242. color: #FFFFFF;
  243. margin-bottom: 8rpx;
  244. -o-text-overflow: ellipsis;
  245. text-overflow: ellipsis;
  246. display: -webkit-box;
  247. word-break: break-all;
  248. -webkit-box-orient: vertical;
  249. -webkit-line-clamp: 1;
  250. overflow: hidden;
  251. align-items: center;
  252. }
  253. .u-p{
  254. font-size: $font-size-24;
  255. line-height: 40rpx;
  256. color: #FFFFFF;
  257. }
  258. }
  259. .logo-m{
  260. width: 144rpx;
  261. height: 144rpx;
  262. border: 2rpx solid #FFFFFF;
  263. border-radius: 100%;
  264. background: $bg-color;
  265. position: relative;
  266. .txt{
  267. width: 144rpx;
  268. height: 42rpx;
  269. display: inline-block;
  270. background: linear-gradient(45deg,rgba(225,86,22,1) 0%,rgba(255,177,0,1) 100%);
  271. border-radius: 21rpx;
  272. line-height: 42rpx;
  273. text-align: center;
  274. color: #FFFFFF;
  275. font-size: $font-size-22;
  276. position: absolute;
  277. bottom: -10rpx;
  278. left: 0;
  279. }
  280. image{
  281. width: 144rpx;
  282. height: 144rpx;
  283. border-radius: 100%;
  284. }
  285. }
  286. }
  287. .user-order{
  288. width: 702rpx;
  289. height: auto;
  290. padding: 0 24rpx;
  291. background-color: $bg-color;
  292. margin-bottom: 24rpx;
  293. }
  294. .tab-title{
  295. font-size: $font-size-28;
  296. line-height: 80rpx;
  297. color: #333333;
  298. text-align:left;
  299. border-bottom: 1px solid #F8F8F8;
  300. position: relative;
  301. .cell-tit{
  302. font-size: $font-size-28;
  303. color: $text-color;
  304. }
  305. .cell-more{
  306. float: right;
  307. line-height: 80rpx;
  308. font-size: $font-size-28;
  309. color: $text-color;
  310. padding-right: 40rpx;
  311. }
  312. .iconfont{
  313. width: 30rpx;
  314. height: 80rpx;
  315. line-height: 80rpx;
  316. text-align: center;
  317. position: absolute;
  318. right: 0;
  319. top: 0;
  320. display: block;
  321. }
  322. }
  323. .order-section{
  324. display: flex;
  325. justify-content: space-around;
  326. align-items: center;
  327. flex-wrap:wrap;
  328. height: 99rpx;
  329. padding: 24rpx 0;
  330. }
  331. .order-item{
  332. display: flex;
  333. flex-direction: column;
  334. align-items: center;
  335. width: 98rpx;
  336. position: relative;
  337. margin-right: 53rpx;
  338. &:last-child{
  339. margin-right: 0;
  340. }
  341. .order-icon{
  342. width: 52rpx;
  343. height: 52rpx;
  344. position: relative;
  345. image{
  346. width: 52rpx;
  347. height: 52rpx;
  348. }
  349. .icon-num{
  350. position: absolute;
  351. right:-24rpx;
  352. top: -9rpx;
  353. }
  354. .icon-num.goleft{
  355. right: -12rpx;
  356. }
  357. }
  358. .order-t{
  359. line-height: 50rpx;
  360. font-size: $font-size-24;
  361. color: $text-color;
  362. }
  363. }
  364. .foot-list{
  365. width: 100%;
  366. // margin-bottom: 150rpx;
  367. }
  368. .list-cell-item{
  369. width: 702rpx;
  370. height: auto;
  371. margin-bottom: 24rpx;
  372. padding:0 24rpx;
  373. background: $bg-color;
  374. }
  375. .list-cell{
  376. display:flex;
  377. width: 100%;
  378. align-items:baseline;
  379. line-height:100rpx;
  380. position:relative;
  381. background: $bg-color;
  382. justify-content: center;
  383. // border-bottom: 1px solid #EBEBEB;
  384. &.cell-hover{
  385. background:#fafafa;
  386. }
  387. .cell-more{
  388. align-self: baseline;
  389. font-size:$font-size-28;
  390. color:$text-color;
  391. margin-left:10rpx;
  392. }
  393. .cell-tit{
  394. flex: 1;
  395. font-size: $font-size-28;
  396. color: $text-color;
  397. margin-right:10rpx;
  398. }
  399. .cell-tip{
  400. font-size: $font-size-28;
  401. color: $text-color;
  402. }
  403. }
  404. .list-cell.last{
  405. border-bottom: none;
  406. }
  407. .uni-badge--small {
  408. -webkit-transform: scale(.8);
  409. -ms-transform: scale(.8);
  410. transform: scale(.8);
  411. -webkit-transform-origin: center center;
  412. -ms-transform-origin: center center;
  413. transform-origin: center center;
  414. }
  415. .uni-badge {
  416. font-family: 'Helvetica Neue', Helvetica, sans-serif;
  417. -webkit-box-sizing: border-box;
  418. box-sizing: border-box;
  419. font-size: 12px;
  420. line-height: 1;
  421. display: inline-block;
  422. padding: 3px 6px;
  423. color: #333;
  424. border-radius: 100px;
  425. background-color: #f1f1f1;
  426. }
  427. .uni-badge-error {
  428. color: #fff;
  429. background-color: #dd524d;
  430. }
  431. </style>