user.vue 11 KB

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