user.vue 11 KB

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