user.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  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://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 { mapState,mapMutations } from 'vuex'
  122. import { personalInfo } from "@/api/use.js"
  123. export default{
  124. components: {
  125. uniBadge
  126. },
  127. data() {
  128. return{
  129. name:'采美采购商城',
  130. headpic:'',
  131. userMoney:0.00,
  132. contactNumber:'',
  133. openid:'',
  134. aboutHtml:'',
  135. telPhone:'',
  136. confirmedCount:0,//待确认
  137. paymentCount:0, //待付款角标
  138. waitShipmentsCount:0, //待收货角标
  139. shipmentsCount:0, //已发货角标
  140. salesReturnCount:'',//退货/款角标
  141. isShowNoLogin:false,
  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. initData(){
  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(response =>{
  192. this.$util.msg(response.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.initData()
  210. uni.stopPullDownRefresh()
  211. },
  212. onShow(){
  213. if(!this.hasLogin){
  214. this.isShowNoLogin = true;
  215. this.$api.redirectTo('/pages/login/login-accont?type=4')
  216. this.$store.commit('updateAllNum',0)
  217. }else{
  218. this.$api.getStorage().then((resolve) =>{
  219. this.userID = resolve.userID
  220. this.initData()
  221. this.isShowNoLogin = false;
  222. })
  223. }
  224. }
  225. }
  226. }
  227. </script>
  228. <style lang="scss">
  229. @import "@/uni.scss";
  230. page{
  231. background-color: #F7F7F7;
  232. }
  233. .user{
  234. width: 100%;
  235. height: 100%;
  236. position:relative;
  237. background: rgba(247, 247, 247, 1);
  238. }
  239. .user-section.none{
  240. display: none;
  241. }
  242. .user-section.show{
  243. display: block;
  244. }
  245. .u-header{
  246. width: 100%;
  247. height: 400rpx;
  248. position: relative;
  249. image{
  250. width: 100%;
  251. height: 400rpx;
  252. }
  253. }
  254. .u-header-main{
  255. width: 100%;
  256. height: 284rpx;
  257. padding: 58rpx 0;
  258. position: absolute;
  259. top: 0;
  260. left: 0;
  261. .user-item{
  262. width: 100%;
  263. display: flex;
  264. flex-direction: column;
  265. align-items: center;
  266. margin-bottom: 16rpx;
  267. .u-h1{
  268. width: 410rpx;
  269. font-size: $font-size-28;
  270. line-height: 40rpx;
  271. color: #FFFFFF;
  272. margin-bottom: 8rpx;
  273. -o-text-overflow: ellipsis;
  274. text-overflow: ellipsis;
  275. display: -webkit-box;
  276. word-break: break-all;
  277. -webkit-box-orient: vertical;
  278. -webkit-line-clamp: 1;
  279. overflow: hidden;
  280. align-items: center;
  281. }
  282. .u-p{
  283. font-size: $font-size-24;
  284. line-height: 40rpx;
  285. color: #FFFFFF;
  286. }
  287. }
  288. .logo-m{
  289. width: 144rpx;
  290. height: 144rpx;
  291. border: 2rpx solid #FFFFFF;
  292. border-radius: 100%;
  293. background: $bg-color;
  294. image{
  295. width: 144rpx;
  296. height: 144rpx;
  297. border-radius: 100%;
  298. }
  299. }
  300. }
  301. .user-order{
  302. width: 702rpx;
  303. height: auto;
  304. padding: 0 24rpx;
  305. background-color: $bg-color;
  306. margin-bottom: 24rpx;
  307. }
  308. .tab-title{
  309. font-size: $font-size-28;
  310. line-height: 80rpx;
  311. color: #333333;
  312. text-align:left;
  313. border-bottom: 1px solid #F8F8F8;
  314. position: relative;
  315. .cell-tit{
  316. font-size: $font-size-28;
  317. color: $text-color;
  318. }
  319. .cell-more{
  320. float: right;
  321. line-height: 80rpx;
  322. font-size: $font-size-24;
  323. color: $text-color;
  324. padding-right: 30rpx;
  325. }
  326. .iconfont{
  327. width: 30rpx;
  328. height: 80rpx;
  329. line-height: 80rpx;
  330. text-align: center;
  331. position: absolute;
  332. right: 0;
  333. top: 0;
  334. display: block;
  335. font-size: $font-size-28;
  336. }
  337. }
  338. .order-section{
  339. display: flex;
  340. justify-content: space-around;
  341. align-items: center;
  342. flex-wrap:wrap;
  343. height: 99rpx;
  344. padding: 24rpx 0;
  345. }
  346. .order-item{
  347. display: flex;
  348. flex-direction: column;
  349. align-items: center;
  350. width: 98rpx;
  351. position: relative;
  352. margin-right: 53rpx;
  353. &:last-child{
  354. margin-right: 0;
  355. }
  356. .order-icon{
  357. width: 52rpx;
  358. height: 52rpx;
  359. position: relative;
  360. image{
  361. width: 52rpx;
  362. height: 52rpx;
  363. }
  364. .icon-num{
  365. position: absolute;
  366. right:-24rpx;
  367. top: -9rpx;
  368. }
  369. .icon-num.goleft{
  370. right: -12rpx;
  371. }
  372. }
  373. .order-t{
  374. line-height: 50rpx;
  375. font-size: $font-size-24;
  376. color: $text-color;
  377. }
  378. }
  379. .foot-list{
  380. width: 100%;
  381. // margin-bottom: 150rpx;
  382. }
  383. .list-cell-item{
  384. width: 702rpx;
  385. height: auto;
  386. margin-bottom: 24rpx;
  387. padding:0 24rpx;
  388. background: $bg-color;
  389. }
  390. .list-cell{
  391. display:flex;
  392. width: 100%;
  393. align-items:baseline;
  394. line-height:100rpx;
  395. position:relative;
  396. background: $bg-color;
  397. justify-content: center;
  398. // border-bottom: 1px solid #EBEBEB;
  399. &.cell-hover{
  400. background:#fafafa;
  401. }
  402. .cell-more{
  403. align-self: baseline;
  404. font-size:$font-size-28;
  405. color:$text-color;
  406. margin-left:10rpx;
  407. }
  408. .cell-tit{
  409. flex: 1;
  410. font-size: $font-size-28;
  411. color: $text-color;
  412. margin-right:10rpx;
  413. }
  414. .cell-tip{
  415. font-size: $font-size-28;
  416. color: $text-color;
  417. }
  418. }
  419. .list-cell.last{
  420. border-bottom: none;
  421. }
  422. .uni-badge--small {
  423. -webkit-transform: scale(.8);
  424. -ms-transform: scale(.8);
  425. transform: scale(.8);
  426. -webkit-transform-origin: center center;
  427. -ms-transform-origin: center center;
  428. transform-origin: center center;
  429. }
  430. .uni-badge {
  431. font-family: 'Helvetica Neue', Helvetica, sans-serif;
  432. -webkit-box-sizing: border-box;
  433. box-sizing: border-box;
  434. font-size: 12px;
  435. line-height: 1;
  436. display: inline-block;
  437. padding: 3px 6px;
  438. color: #333;
  439. border-radius: 100px;
  440. background-color: #f1f1f1;
  441. }
  442. .uni-badge-error {
  443. color: #fff;
  444. background-color: #dd524d;
  445. }
  446. </style>