user.vue 12 KB

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