user.vue 12 KB

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