user.vue 13 KB

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