user.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  1. <template>
  2. <view class="container user clearfix">
  3. <cm-custom :navbar-data='nvabarData'></cm-custom>
  4. <view class="user-section">
  5. <view class="header" :style="{background:'url('+ bgImgUrl +')',backgroundSize:'cover'}">
  6. <view class="header-main" :style="{paddingTop:(CustomBar+20)+'px'}" v-if="hasLogin">
  7. <view class="header-text">
  8. <view class="user-item"><text class="u-h1">{{name}}</text>
  9. <text class="u-viptips" v-if="userIdentity == 2">{{userType}}</text>
  10. <text class="u-tips" v-if="userIdentity == 4">{{userType}}</text>
  11. </view>
  12. <view class="user-item"><text class="u-p">账户余额:{{userMoney}}元</text></view>
  13. </view>
  14. <view class="header-icon"><image :src="headpic == null? '../../../static/temp/icon-club@3x.png' : headpic" mode=""></image></view>
  15. </view>
  16. <view class="header-main-none" :style="{paddingTop:(CustomBar+20)+'px'}" v-else>
  17. <view class="header-text">
  18. <view class="user-item">
  19. <text class="u-h1" @click="navigator('/pages/login/login')">账号登录</text><text class="u-h1 line">/</text>
  20. <text class="u-h1" @click="navigatorNex('/pages/login/register')">立即注册</text>
  21. </view>
  22. <view class="user-item">
  23. <text class="u-p" @click="navigator('/pages/login/login')">登录商城了解更多产品信息吧!</text>
  24. </view>
  25. <view class="user-item" @click="navigatorNex('/pages/login/logincode')">
  26. <view class="u-btn"><text>邀请码登录</text><text class="iconfont icon-xiangyouhuabeifen"></text></view>
  27. </view>
  28. </view>
  29. <view class="header-icon" @click="navigator('/pages/login/login')">
  30. <image src="../../../static/temp/icon-club@3x.png" mode=""></image>
  31. </view>
  32. </view>
  33. <!-- 订单 -->
  34. <view class="user-order">
  35. <view class="tab-title" @click="navigator('/pages/user/order/order-list?state=0')">
  36. <text class="cell-tit">我的订单</text>
  37. <text class="cell-more">查看全部</text>
  38. <text class="iconfont icon-xiayibu"></text>
  39. </view>
  40. <view class="order-section">
  41. <view class="order-item" @click="navigator('/pages/user/order/order-list?state=1')" hover-class="common-hover" :hover-stay-time="50">
  42. <view class="order-icon">
  43. <image src="../../../static/temp/order5@3x.png" mode=""></image>
  44. <text v-if="confirmedCount>0"
  45. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"
  46. :class="[confirmedCount < 10 ? 'goleft':'']">
  47. {{confirmedCount == 99? '99+' : confirmedCount}}
  48. </text>
  49. </view>
  50. <text class="order-t">待确认</text>
  51. </view>
  52. <view class="order-item" @click="navigator('/pages/user/order/order-list?state=2')" hover-class="common-hover" :hover-stay-time="50">
  53. <view class="order-icon">
  54. <image src="../../../static/temp/order1@3x.png" mode=""></image>
  55. <text v-if="paymentCount >0"
  56. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num "
  57. :class="[paymentCount < 10 ? 'goleft':'']">
  58. {{paymentCount == 99? '99+' : paymentCount}}
  59. </text>
  60. </view>
  61. <text class="order-t">待付款</text>
  62. </view>
  63. <view class="order-item" @click="navigator('/pages/user/order/order-list?state=3')" hover-class="common-hover" :hover-stay-time="50">
  64. <view class="order-icon">
  65. <image src="../../../static/temp/order2@3x.png" mode=""></image>
  66. <text v-if="waitShipmentsCount >0"
  67. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"
  68. :class="[waitShipmentsCount < 10 ? 'goleft':'']">
  69. {{waitShipmentsCount == 99? '99+' : waitShipmentsCount}}
  70. </text>
  71. </view>
  72. <text class="order-t">待发货</text>
  73. </view>
  74. <view class="order-item" @click="navigator('/pages/user/order/order-list?state=4')" hover-class="common-hover" :hover-stay-time="50">
  75. <view class="order-icon">
  76. <image src="../../../static/temp/order3@3x.png" mode=""></image>
  77. <text v-if="shipmentsCount>0"
  78. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"
  79. :class="[shipmentsCount < 10 ? 'goleft':'']">
  80. {{shipmentsCount == 99? '99+' : shipmentsCount}}
  81. </text>
  82. </view>
  83. <text class="order-t">已发货</text>
  84. </view>
  85. <view class="order-item" @click="navigator('/pages/user/order/order-list?state=5')" hover-class="common-hover" :hover-stay-time="50">
  86. <view class="order-icon">
  87. <image src="../../../static/temp/order4@3x.png" mode=""></image>
  88. <text v-if="salesReturnCount >0"
  89. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"
  90. :class="[salesReturnCount < 10 ? 'goleft':'']">
  91. {{salesReturnCount == 99? '99+' : salesReturnCount}}
  92. </text>
  93. </view>
  94. <text class="order-t">退货/款</text>
  95. </view>
  96. </view>
  97. </view>
  98. </view>
  99. <!-- 底部跳转 -->
  100. <view class="foot-list">
  101. <view class="list-cell-item" v-show="hasLogin">
  102. <view class="list-cell" v-show="userIdentity == 4" @click="navigator(`/pages/login/apply?clubStatus=${clubStatus}`)" hover-class="cell-hover" :hover-stay-time="50">
  103. <text class="cell-tit">升级会员机构</text>
  104. <text class="cell-more">
  105. <text class="txt">{{clubStatusText(clubStatus)}}</text>
  106. <text class="iconfont icon-xiayibu"></text>
  107. </text>
  108. </view>
  109. <view class="list-cell" @click="navigator('/pages/user/regularPurchase/regularPurchase')" hover-class="cell-hover" :hover-stay-time="50">
  110. <text class="cell-tit">再次购买</text>
  111. <text class="cell-more iconfont icon-xiayibu"></text>
  112. </view>
  113. </view>
  114. <view class="list-cell-item">
  115. <view class="list-cell" v-for="(item, index) in firstList" :key="index" @click="navigator(item.path)" hover-class="cell-hover" :hover-stay-time="50">
  116. <text class="cell-tit">{{item.name}}</text>
  117. <text class="cell-more iconfont icon-xiayibu"></text>
  118. </view>
  119. </view>
  120. <view class="list-cell-item">
  121. <view class="list-cell" hover-class="cell-hover" :hover-stay-time="50">
  122. <text class="cell-tit">联系我们</text>
  123. <text class="cell-more" @click="toPhone">{{contactNumber}}</text>
  124. </view>
  125. <view class="list-cell last" @click="this.$api.navigateTo('/pages/user/about/about')" hover-class="cell-hover" :hover-stay-time="50">
  126. <text class="cell-tit">关于我们</text>
  127. <text class="cell-more iconfont icon-xiayibu"></text>
  128. </view>
  129. </view>
  130. </view>
  131. </view>
  132. </view>
  133. </template>
  134. <script>
  135. import uniBadge from '@/components/uni-badge/uni-badge.vue'
  136. import authorize from '@/common/config/authorize.js'
  137. import { mapState,mapMutations } from 'vuex'
  138. import { personalInfo } from "@/api/use.js"
  139. export default{
  140. components: {
  141. uniBadge
  142. },
  143. data() {
  144. return{
  145. nvabarData: {//顶部自定义导航
  146. showCapsule: 1, // 是否显示左上角图标 1表示显示 0表示不显示,
  147. showSearch: 0,
  148. title: '我的', // 导航栏 中间的标题
  149. haveBack:false,
  150. textLeft:this.$store.state.isIphone,
  151. textColor:'#FFFFFF',
  152. bgColor:''
  153. },
  154. CustomBar:this.CustomBar,// 顶部导航栏高度
  155. bgImgUrl:'https://img.caimei365.com/group1/M00/03/94/Cmis216Sk_SAPDwvAAcTspdl8h0610.png',
  156. name:'',
  157. userType:"",
  158. headpic:'',
  159. userMoney:'0.00',
  160. contactNumber:'',
  161. openid:'',
  162. aboutHtml:'',
  163. telPhone:'',
  164. bindMobile:'',
  165. clubStatus:'', //机构升级会员机构审核状态1:待审核 91:审核失败
  166. userIdentity:'', //机构等级
  167. confirmedCount:0,//待确认
  168. paymentCount:0, //待付款角标
  169. waitShipmentsCount:0, //待收货角标
  170. shipmentsCount:0, //已发货角标
  171. salesReturnCount:'',//退货/款角标
  172. firstList:[
  173. {name:'运营人员管理',path:'/pages/user/operator/list'},
  174. {name:'账户余额明细',path:'/pages/user/account/account'},
  175. {name:'收货地址管理',path:'/pages/user/address/address'},
  176. {name:'机构资料',path:'/pages/login/information'},
  177. {name:'账户设置',path:'/pages/user/setting/setting'},
  178. ]
  179. }
  180. },
  181. onLoad(){
  182. },
  183. computed: {
  184. ...mapState(['hasLogin','userInfo'])
  185. },
  186. methods:{
  187. getUserInfo(){
  188. personalInfo({userID:this.userID}).then(response =>{
  189. this.$store.commit('updateAllNum',response.data.count)
  190. let data =response.data
  191. let $userData = data.user
  192. let $clubData = data.club
  193. if($userData.ableUserMoney == 0 || $userData.ableUserMoney ==null){
  194. this.userMoney = '0.00';
  195. }else{
  196. let i = $userData.ableUserMoney.toString().lastIndexOf('.');
  197. let money;
  198. if(i==-1){
  199. money = this.$api.FormatMoney($userData.ableUserMoney); //会所剩余余额
  200. this.userMoney = money +'.00'
  201. }else{
  202. money = this.$api.FormatMoney($userData.ableUserMoney); //会所剩余余额
  203. this.userMoney = money
  204. }
  205. }
  206. this.userIdentity = $userData.userIdentity //机构等级
  207. if(this.userIdentity == 2){
  208. this.name = $clubData.name //会员机构名称
  209. this.userType = '会员机构'
  210. }else{
  211. this.name = $userData.userName //普通机构名称
  212. this.userType = '普通机构'
  213. }
  214. this.headpic = $userData.image //会所头像
  215. this.bindMobile = $userData.bindMobile//登录手机号
  216. this.clubStatus = $userData.clubStatus //机构审核状态
  217. this.contactNumber = data.organize.contactNumber //联系电话
  218. this.confirmedCount = this.showBadge(data.confirmedCount)//待确认
  219. this.paymentCount = this.showBadge(data.paymentCount)//待付款
  220. this.waitShipmentsCount = this.showBadge(data.waitShipmentsCount)//待收货
  221. this.shipmentsCount = this.showBadge(data.shipmentsCount)//已发货
  222. this.salesReturnCount = this.showBadge(data.salesReturnCount)//退货/款
  223. let clubInfo ={name:this.name,image:this.headpic,clubID:$clubData.clubID}
  224. uni.setStorage({//缓存机构
  225. key: 'clubInfo',
  226. data: clubInfo
  227. })
  228. }).catch(error =>{
  229. this.$util.msg(error.msg,2000)
  230. })
  231. },
  232. toPhone(){
  233. uni.makePhoneCall({
  234. phoneNumber:this.contactNumber //仅为示例
  235. });
  236. },
  237. navigator(url){
  238. authorize.getSetting().then(wxResponse =>{// console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
  239. if(wxResponse == 1){
  240. if(this.hasLogin){
  241. this.$api.navigateTo(url)
  242. }else{
  243. this.$api.navigateTo('/pages/login/login?type=0')
  244. }
  245. }else{
  246. this.$api.navigateTo('/pages/authorization/authorization?type=1')
  247. }
  248. })
  249. },
  250. navigatorNex(url){
  251. authorize.getSetting().then(wxResponse =>{// console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
  252. if(wxResponse == 1){
  253. if(!this.hasLogin){
  254. this.$api.navigateTo(url)
  255. }
  256. }else{
  257. this.$api.navigateTo('/pages/authorization/authorization?type=1')
  258. }
  259. })
  260. },
  261. showBadge(n){
  262. let num ='';
  263. if(n>100){num = 99}else{num = n;}
  264. return num;
  265. },
  266. clubStatusText(state){
  267. let stateText;
  268. switch(state){
  269. case 90:
  270. stateText = ''
  271. break;
  272. case 1:
  273. stateText = '待审核'
  274. break;
  275. case 92:
  276. stateText = '审核不通过'
  277. break;
  278. }
  279. return stateText
  280. }
  281. },
  282. onPageScroll(e){//实时获取到滚动的值
  283. if(e.scrollTop>20){
  284. this.nvabarData.bgColor = '#FFFFFF'
  285. this.nvabarData.textColor = '#333333'
  286. }else{
  287. this.nvabarData.bgColor = ''
  288. this.nvabarData.textColor = '#FFFFFF'
  289. }
  290. },
  291. onPullDownRefresh() {//下拉刷新
  292. if(this.hasLogin){
  293. this.getUserInfo()
  294. uni.stopPullDownRefresh()
  295. }else{
  296. uni.stopPullDownRefresh()
  297. }
  298. },
  299. onShow(){
  300. if(this.hasLogin){
  301. this.$api.getStorage().then((resolve) =>{
  302. this.userID = resolve.userID
  303. this.getUserInfo()
  304. })
  305. }else{
  306. this.$store.commit('updateAllNum',0)
  307. }
  308. }
  309. }
  310. </script>
  311. <style lang="scss">
  312. @import "@/uni.scss";
  313. page{
  314. background-color: #F7F7F7;
  315. }
  316. .user{
  317. width: 100%;
  318. height: 100%;
  319. position:relative;
  320. background: rgba(247, 247, 247, 1);
  321. }
  322. .header{
  323. width: 100%;
  324. height: 440rpx;
  325. position: relative;
  326. background-size: cover;
  327. }
  328. .header-main{
  329. width: 702rpx;
  330. height: 128rpx;
  331. padding: 0 24rpx;
  332. display: flex;
  333. .header-text{
  334. flex: 8;
  335. display: flex;
  336. flex-direction: column;
  337. .user-item{
  338. flex: 1;
  339. height: 64rpx;
  340. line-height: 64rpx;
  341. .u-tips{
  342. display: inline-block;
  343. float: left;
  344. width: 98rpx;
  345. height: 30rpx;
  346. border: 1px solid #FFFFFF;
  347. background: linear-gradient(128deg,rgba(242,143,49,1) 0%,rgba(225,86,22,1) 100%);
  348. border-radius: 16rpx;
  349. line-height: 30rpx;
  350. font-size: $font-size-20;
  351. text-align: center;
  352. color: #FFFFFF;
  353. margin-left: 10rpx;
  354. margin-top: 17rpx;
  355. }
  356. .u-viptips{
  357. display: inline-block;
  358. float: left;
  359. width: 98rpx;
  360. height: 30rpx;
  361. border: 1px solid #FFE600;
  362. background: linear-gradient(128deg,rgba(242,143,49,1) 0%,rgba(225,86,22,1) 100%);
  363. border-radius: 16rpx;
  364. line-height: 30rpx;
  365. font-size: $font-size-20;
  366. text-align: center;
  367. color: #FFE600;
  368. margin-left: 10rpx;
  369. margin-top: 17rpx;
  370. }
  371. .u-h1{
  372. float: left;
  373. font-size: $font-size-36;
  374. color: #FFFFFF;
  375. text-align: left;
  376. -o-text-overflow: ellipsis;
  377. text-overflow: ellipsis;
  378. display: -webkit-box;
  379. word-break: break-all;
  380. -webkit-box-orient: vertical;
  381. -webkit-line-clamp: 1;
  382. overflow: hidden;
  383. }
  384. .u-p{
  385. font-size: $font-size-24;
  386. line-height: 64rpx;
  387. color: #FFFFFF;
  388. text-align: left;
  389. }
  390. }
  391. }
  392. .header-icon{
  393. flex: 2;
  394. margin-right: 20rpx;
  395. image{
  396. float: right;
  397. width: 128rpx;
  398. height: 128rpx;
  399. border-radius: 100%;
  400. border: 2rpx solid #FFFFFF;
  401. }
  402. }
  403. }
  404. .header-main-none{
  405. width: 702rpx;
  406. height: 152rpx;
  407. padding: 0 24rpx;
  408. display: flex;
  409. .header-text{
  410. flex: 8;
  411. display: flex;
  412. flex-direction: column;
  413. .user-item{
  414. flex: 1;
  415. height: 50rpx;
  416. line-height: 50rpx;
  417. .line{
  418. margin: 0 10rpx;
  419. }
  420. .u-h1{
  421. float: left;
  422. font-size: $font-size-36;
  423. color: #FFFFFF;
  424. text-align: left;
  425. -o-text-overflow: ellipsis;
  426. text-overflow: ellipsis;
  427. display: -webkit-box;
  428. word-break: break-all;
  429. -webkit-box-orient: vertical;
  430. -webkit-line-clamp: 1;
  431. overflow: hidden;
  432. }
  433. .u-p{
  434. font-size: $font-size-24;
  435. line-height: 50rpx;
  436. color: #EFEFEF;
  437. text-align: left;
  438. }
  439. .u-btn{
  440. width: 160rpx;
  441. height: 40rpx;
  442. background: rgba(255,255,255,.5);
  443. border-radius: 5rpx;
  444. line-height: 40rpx;
  445. text-align: center;
  446. font-size: $font-size-24;
  447. color: #FFFFFF;
  448. display: block;
  449. margin-top: 5rpx;
  450. padding-left: 6rpx;
  451. .icon-xiangyouhuabeifen{
  452. font-size: $font-size-24;
  453. }
  454. }
  455. }
  456. }
  457. .header-icon{
  458. flex: 2;
  459. display: flex;
  460. margin-right: 20rpx;
  461. align-items: center;
  462. justify-content: center;
  463. image{
  464. float: right;
  465. width: 128rpx;
  466. height: 128rpx;
  467. border-radius: 100%;
  468. border: 2rpx solid #FFFFFF;
  469. }
  470. }
  471. }
  472. .user-order{
  473. width: 654rpx;
  474. height: auto;
  475. padding: 0 24rpx;
  476. background-color: $bg-color;
  477. margin-bottom: 24rpx;
  478. position: absolute;
  479. bottom: -170rpx;
  480. left: 24rpx;
  481. border-radius: 20rpx;
  482. box-shadow:0px 3px 6px rgba(225,86,22,0.07);
  483. }
  484. .tab-title{
  485. font-size: $font-size-28;
  486. line-height: 80rpx;
  487. color: #333333;
  488. text-align:left;
  489. border-bottom: 1px solid #F8F8F8;
  490. position: relative;
  491. .cell-tit{
  492. font-size: $font-size-28;
  493. color: $text-color;
  494. }
  495. .cell-more{
  496. float: right;
  497. line-height: 80rpx;
  498. font-size: $font-size-24;
  499. color: $text-color;
  500. padding-right: 30rpx;
  501. }
  502. .iconfont{
  503. width: 30rpx;
  504. height: 80rpx;
  505. line-height: 80rpx;
  506. text-align: center;
  507. position: absolute;
  508. right: 0;
  509. top: 0;
  510. display: block;
  511. font-size: $font-size-28;
  512. }
  513. }
  514. .order-section{
  515. display: flex;
  516. justify-content: space-around;
  517. align-items: center;
  518. flex-wrap:wrap;
  519. height: 99rpx;
  520. padding: 24rpx 0;
  521. }
  522. .order-item{
  523. flex:1;
  524. display: flex;
  525. flex-direction: column;
  526. align-items: center;
  527. position: relative;
  528. &:last-child{
  529. margin-right: 0;
  530. }
  531. .order-icon{
  532. width: 52rpx;
  533. height: 52rpx;
  534. position: relative;
  535. image{
  536. width: 52rpx;
  537. height: 52rpx;
  538. }
  539. .icon-num{
  540. position: absolute;
  541. right:-24rpx;
  542. top: -9rpx;
  543. }
  544. .icon-num.goleft{
  545. right: -12rpx;
  546. }
  547. }
  548. .order-t{
  549. line-height: 50rpx;
  550. font-size: $font-size-24;
  551. color: $text-color;
  552. }
  553. }
  554. .foot-list{
  555. width: 702rpx;
  556. padding: 0 24rpx;
  557. padding-top: 168rpx;
  558. }
  559. .list-cell-item{
  560. width: 654rpx;
  561. height: auto;
  562. margin-bottom: 24rpx;
  563. padding:0 24rpx;
  564. background: $bg-color;
  565. border-radius: 20rpx;
  566. box-shadow:0px 3px 6px rgba(225,86,22,0.07);
  567. }
  568. .list-cell{
  569. display:flex;
  570. width: 100%;
  571. align-items:baseline;
  572. line-height:100rpx;
  573. position:relative;
  574. background: $bg-color;
  575. justify-content: center;
  576. // border-bottom: 1px solid #EBEBEB;
  577. &.cell-hover{
  578. background:#fafafa;
  579. }
  580. .cell-more{
  581. align-self: baseline;
  582. font-size:$font-size-28;
  583. color:$text-color;
  584. margin-left:10rpx;
  585. .txt{
  586. color: #FB4343;
  587. padding-right: 10rpx;
  588. }
  589. }
  590. .cell-tit{
  591. flex: 1;
  592. font-size: $font-size-28;
  593. color: $text-color;
  594. margin-right:10rpx;
  595. }
  596. .cell-tip{
  597. font-size: $font-size-28;
  598. color: $text-color;
  599. }
  600. }
  601. .list-cell.last{
  602. border-bottom: none;
  603. }
  604. .uni-badge--small {
  605. -webkit-transform: scale(.8);
  606. -ms-transform: scale(.8);
  607. transform: scale(.8);
  608. -webkit-transform-origin: center center;
  609. -ms-transform-origin: center center;
  610. transform-origin: center center;
  611. }
  612. .uni-badge {
  613. font-family: 'Helvetica Neue', Helvetica, sans-serif;
  614. -webkit-box-sizing: border-box;
  615. box-sizing: border-box;
  616. font-size: 12px;
  617. line-height: 1;
  618. display: inline-block;
  619. padding: 3px 6px;
  620. color: #333;
  621. border-radius: 100px;
  622. background-color: #f1f1f1;
  623. }
  624. .uni-badge-error {
  625. color: #fff;
  626. background-color: #dd524d;
  627. }
  628. </style>