user.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  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=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. console.log(clubInfo)
  188. uni.setStorage({//缓存机构
  189. key: 'clubInfo',
  190. data: clubInfo
  191. })
  192. }).catch(response =>{
  193. this.$util.msg(response.msg,2000)
  194. })
  195. },
  196. toPhone(){
  197. uni.makePhoneCall({
  198. phoneNumber:this.contactNumber //仅为示例
  199. });
  200. },
  201. navigator(url){
  202. this.$api.navigateTo(url)
  203. },
  204. showBadge(n){
  205. let num ='';
  206. if(n>100){num = 99}else{num = n;}
  207. return num;
  208. },
  209. onPullDownRefresh() {//下拉刷新
  210. this.initData()
  211. uni.stopPullDownRefresh()
  212. },
  213. onShow(){
  214. if(!this.hasLogin){
  215. this.isShowNoLogin = true;
  216. this.$api.redirectTo('/pages/login/login-accont?type=4')
  217. this.$store.commit('updateAllNum',0)
  218. }else{
  219. this.$api.getStorage().then((resolve) =>{
  220. this.userID = resolve.userID
  221. this.initData()
  222. this.isShowNoLogin = false;
  223. })
  224. }
  225. }
  226. }
  227. }
  228. </script>
  229. <style lang="scss">
  230. @import "@/uni.scss";
  231. page{
  232. background-color: #F7F7F7;
  233. }
  234. .user{
  235. width: 100%;
  236. height: 100%;
  237. position:relative;
  238. background: rgba(247, 247, 247, 1);
  239. }
  240. .user-section.none{
  241. display: none;
  242. }
  243. .user-section.show{
  244. display: block;
  245. }
  246. .u-header{
  247. width: 100%;
  248. height: 400rpx;
  249. position: relative;
  250. image{
  251. width: 100%;
  252. height: 400rpx;
  253. }
  254. }
  255. .u-header-main{
  256. width: 100%;
  257. height: 284rpx;
  258. padding: 58rpx 0;
  259. position: absolute;
  260. top: 0;
  261. left: 0;
  262. .user-item{
  263. width: 100%;
  264. display: flex;
  265. flex-direction: column;
  266. align-items: center;
  267. margin-bottom: 16rpx;
  268. .u-h1{
  269. width: 410rpx;
  270. font-size: $font-size-28;
  271. line-height: 40rpx;
  272. color: #FFFFFF;
  273. margin-bottom: 8rpx;
  274. -o-text-overflow: ellipsis;
  275. text-overflow: ellipsis;
  276. display: -webkit-box;
  277. word-break: break-all;
  278. -webkit-box-orient: vertical;
  279. -webkit-line-clamp: 1;
  280. overflow: hidden;
  281. align-items: center;
  282. }
  283. .u-p{
  284. font-size: $font-size-24;
  285. line-height: 40rpx;
  286. color: #FFFFFF;
  287. }
  288. }
  289. .logo-m{
  290. width: 144rpx;
  291. height: 144rpx;
  292. border: 2rpx solid #FFFFFF;
  293. border-radius: 100%;
  294. background: $bg-color;
  295. image{
  296. width: 144rpx;
  297. height: 144rpx;
  298. border-radius: 100%;
  299. }
  300. }
  301. }
  302. .user-order{
  303. width: 702rpx;
  304. height: auto;
  305. padding: 0 24rpx;
  306. background-color: $bg-color;
  307. margin-bottom: 24rpx;
  308. }
  309. .tab-title{
  310. font-size: $font-size-28;
  311. line-height: 80rpx;
  312. color: #333333;
  313. text-align:left;
  314. border-bottom: 1px solid #F8F8F8;
  315. position: relative;
  316. .cell-tit{
  317. font-size: $font-size-28;
  318. color: $text-color;
  319. }
  320. .cell-more{
  321. float: right;
  322. line-height: 80rpx;
  323. font-size: $font-size-24;
  324. color: $text-color;
  325. padding-right: 30rpx;
  326. }
  327. .iconfont{
  328. width: 30rpx;
  329. height: 80rpx;
  330. line-height: 80rpx;
  331. text-align: center;
  332. position: absolute;
  333. right: 0;
  334. top: 0;
  335. display: block;
  336. font-size: $font-size-28;
  337. }
  338. }
  339. .order-section{
  340. display: flex;
  341. justify-content: space-around;
  342. align-items: center;
  343. flex-wrap:wrap;
  344. height: 99rpx;
  345. padding: 24rpx 0;
  346. }
  347. .order-item{
  348. display: flex;
  349. flex-direction: column;
  350. align-items: center;
  351. width: 98rpx;
  352. position: relative;
  353. margin-right: 53rpx;
  354. &:last-child{
  355. margin-right: 0;
  356. }
  357. .order-icon{
  358. width: 52rpx;
  359. height: 52rpx;
  360. position: relative;
  361. image{
  362. width: 52rpx;
  363. height: 52rpx;
  364. }
  365. .icon-num{
  366. position: absolute;
  367. right:-24rpx;
  368. top: -9rpx;
  369. }
  370. .icon-num.goleft{
  371. right: -12rpx;
  372. }
  373. }
  374. .order-t{
  375. line-height: 50rpx;
  376. font-size: $font-size-24;
  377. color: $text-color;
  378. }
  379. }
  380. .foot-list{
  381. width: 100%;
  382. // margin-bottom: 150rpx;
  383. }
  384. .list-cell-item{
  385. width: 702rpx;
  386. height: auto;
  387. margin-bottom: 24rpx;
  388. padding:0 24rpx;
  389. background: $bg-color;
  390. }
  391. .list-cell{
  392. display:flex;
  393. width: 100%;
  394. align-items:baseline;
  395. line-height:100rpx;
  396. position:relative;
  397. background: $bg-color;
  398. justify-content: center;
  399. // border-bottom: 1px solid #EBEBEB;
  400. &.cell-hover{
  401. background:#fafafa;
  402. }
  403. .cell-more{
  404. align-self: baseline;
  405. font-size:$font-size-28;
  406. color:$text-color;
  407. margin-left:10rpx;
  408. }
  409. .cell-tit{
  410. flex: 1;
  411. font-size: $font-size-28;
  412. color: $text-color;
  413. margin-right:10rpx;
  414. }
  415. .cell-tip{
  416. font-size: $font-size-28;
  417. color: $text-color;
  418. }
  419. }
  420. .list-cell.last{
  421. border-bottom: none;
  422. }
  423. .uni-badge--small {
  424. -webkit-transform: scale(.8);
  425. -ms-transform: scale(.8);
  426. transform: scale(.8);
  427. -webkit-transform-origin: center center;
  428. -ms-transform-origin: center center;
  429. transform-origin: center center;
  430. }
  431. .uni-badge {
  432. font-family: 'Helvetica Neue', Helvetica, sans-serif;
  433. -webkit-box-sizing: border-box;
  434. box-sizing: border-box;
  435. font-size: 12px;
  436. line-height: 1;
  437. display: inline-block;
  438. padding: 3px 6px;
  439. color: #333;
  440. border-radius: 100px;
  441. background-color: #f1f1f1;
  442. }
  443. .uni-badge-error {
  444. color: #fff;
  445. background-color: #dd524d;
  446. }
  447. </style>