user.vue 14 KB

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