user.vue 12 KB

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