user.vue 12 KB

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