user.vue 12 KB

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