center.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <template>
  2. <view class="pages">
  3. <view class="page-bg">
  4. <img class="img" :src="staticUrl+'/img/center-index-bg.png'" alt="">
  5. </view>
  6. <view class="base-info page-wrap u-flex u-row-between">
  7. <view class="left u-flex">
  8. <u-avatar :src="avatar||staticUrl+'/img/avatar.png'" size="110rpx"></u-avatar>
  9. <view class="info">
  10. <view class="name ellipsis-1">{{vuex_member_info.name}}</view>
  11. <view class="level u-flex">
  12. <u-icon :name="staticUrl+'/img/level-01.png'" color="#333333" size="30rpx"></u-icon>
  13. <text class="level-name">{{vuex_member_info.levelName}}</text>
  14. </view>
  15. </view>
  16. </view>
  17. <u-icon @click="$u.route('/center/memberinfo',{type:'redirectTo'})" name="setting-fill" color="#333333" size="38rpx"></u-icon>
  18. </view>
  19. <view class="property page-wrap u-flex u-row-between">
  20. <view class="property-item" @click="showPayCode = true">
  21. <view class="up">
  22. <u-icon :name="staticUrl+'/img/paycode.png'" color="#333333" size="42rpx"></u-icon>
  23. </view>
  24. <view class="down">付款码</view>
  25. </view>
  26. <view class="property-item">
  27. <view class="up">{{memberInfo.balance}}</view>
  28. <view class="down">余额</view>
  29. </view>
  30. <view class="property-item">
  31. <view class="up">{{memberInfo.credit}}</view>
  32. <view class="down">积分</view>
  33. </view>
  34. <view class="property-item">
  35. <view class="up">{{memberInfo.couponNum}}</view>
  36. <view class="down">优惠券</view>
  37. </view>
  38. </view>
  39. <view class="order-state">
  40. <view class="title">我的订单</view>
  41. <view class="u-flex u-row-between">
  42. <view class="state" @click="orderClick(item,index)" v-for="(item,index) in orderState" :key="index">
  43. <view class="up">
  44. <u-icon :name="item.ico" color="#333333" size="60rpx"></u-icon>
  45. <u-badge v-if="item.badge" type="error" max="99" :value="orderBadge[item.badge]" :absolute="true" :offset="[0,0]"></u-badge>
  46. </view>
  47. <view class="down">{{item.name}}</view>
  48. </view>
  49. </view>
  50. </view>
  51. <view class="tools page-wrap">
  52. <view class="title">常用工具</view>
  53. <view class="u-flex u-row-left">
  54. <view class="tool-item"
  55. v-for="(item,index) in tools"
  56. @click="toolsClick(item)"
  57. :key="index">
  58. <view class="up">
  59. <u-icon :name="item.ico" color="#333333" size="60rpx"></u-icon>
  60. </view>
  61. <view class="down">{{item.name}}</view>
  62. </view>
  63. </view>
  64. </view>
  65. <u-overlay :show="showPayCode" @click="showPayCode = false">
  66. <view class="pay-code-warp u-flex u-row-center">
  67. <view class="rect" @tap.stop>
  68. <u--image :showLoading="true" :src="payCodeImg" width="180px" height="180px"></u--image>
  69. </view>
  70. </view>
  71. </u-overlay>
  72. <tabbar :tabbarIndexProps="3" />
  73. </view>
  74. </template>
  75. <script>
  76. import tabbar from "../components/tabbar.vue"
  77. export default {
  78. components:{
  79. tabbar
  80. },
  81. data() {
  82. return {
  83. staticUrl:this.$commonConfig.staticUrl,
  84. avatar:this.$commonConfig.staticUrl+'/img/avatar.png',
  85. showPayCode:false,
  86. payCodeImg:'https://cdn.uviewui.com/uview/album/1.jpg',
  87. memberInfo:{},
  88. orderState:[
  89. {name:'全部订单',status:'',ico:this.$commonConfig.staticUrl+'/img/orderstateico-all.png'},
  90. {name:'待付款',status:'0',ico:this.$commonConfig.staticUrl+'/img/orderstateico-01.png',badge:'noPayNum'},
  91. // {name:'待发货',status:'1',ico:this.$commonConfig.staticUrl+'/img/orderstateico-01.png',badge:'noPayNum'},
  92. {name:'待收货',status:'2',ico:this.$commonConfig.staticUrl+'/img/orderstateico-02.png',badge:'collectNum'},
  93. {name:'待评价',status:'3',ico:this.$commonConfig.staticUrl+'/img/orderstateico-03.png',badge:'commentNum'},
  94. {name:'退款/售后',status:'7',ico:this.$commonConfig.staticUrl+'/img/orderstateico-04.png',badge:'refundNum'},
  95. ],
  96. orderBadge:{
  97. noPayNum:'0',
  98. deliverNum:'0',
  99. collectNum:'0',
  100. commentNum:'0',
  101. refundNum:'0',
  102. },
  103. tools:[
  104. {name:'充值中心',url:'/center/recharge',ico:this.$commonConfig.staticUrl+'/img/tool-chongzhi.png'},
  105. {name:'地址管理',url:'/center/addrlist',ico:this.$commonConfig.staticUrl+'/img/tool-map.png'},
  106. ]
  107. }
  108. },
  109. onShow() {
  110. this.getMemberInfo();
  111. this.statisticsOrder();
  112. },
  113. onLoad() {
  114. },
  115. methods: {
  116. getMemberInfo(){
  117. this.$u.api.memberInfo({id:this.vuex_member_info.id}).then(res=>{
  118. this.memberInfo = res.data;
  119. this.avatar = res.data.avatar;
  120. this.$u.vuex('vuex_member_info', res.data);
  121. // console.log('memberInfo',this.memberInfo);
  122. }).catch(err=>{
  123. console.log('memberInfo',err.data);
  124. })
  125. },
  126. toolsClick(item){
  127. console.log('item',item);
  128. uni.$u.route(item.url);
  129. },
  130. orderClick(item,index){
  131. console.log('item',item);
  132. uni.$u.route('/shopping/order', {
  133. // current: index,
  134. status: item.status,
  135. type: 'redirectTo'
  136. });
  137. },
  138. statisticsOrder(){
  139. this.$u.api.statisticsOrder().then(res=>{
  140. let data = res.data || {};
  141. this.orderBadge = Object.assign(this.orderBadge,data)
  142. // console.log('statisticsOrder',res.data);
  143. // console.log('this.orderBadge',this.orderBadge);
  144. }).catch(err=>{
  145. console.log('memberInfo',err.data);
  146. })
  147. }
  148. }
  149. }
  150. </script>
  151. <style>
  152. page{
  153. background-color: #F5F5F5;
  154. padding-top: 60px;
  155. }
  156. </style>
  157. <style lang="scss" scoped>
  158. .title{
  159. font-size: 32rpx;
  160. font-weight: 600;
  161. color: #333333;
  162. line-height: 45rpx;
  163. margin-bottom: 30rpx;
  164. }
  165. .base-info{
  166. margin-bottom: 10rpx;
  167. .info{
  168. margin-left: 30rpx;
  169. .name{
  170. font-size: 40rpx;
  171. font-weight: 600;
  172. color: #333333;
  173. line-height: 56rpx;
  174. margin-bottom: 10rpx;
  175. }
  176. .level{
  177. width: fit-content;
  178. background: linear-gradient(131deg, #FFF2DB 0%, #FFD9A5 100%);
  179. border-radius: 2px;
  180. font-size: 22rpx;
  181. font-weight: 400;
  182. color: #333333;
  183. line-height: 30rpx;
  184. padding: 6rpx 16rpx;
  185. .level-name{
  186. margin-left: 10rpx;
  187. }
  188. }
  189. }
  190. }
  191. .property{
  192. text-align: center;
  193. .up{
  194. font-size: 32rpx;
  195. font-weight: 600;
  196. color: #333333;
  197. line-height: 45rpx;
  198. /deep/ .u-icon{
  199. display: block;
  200. }
  201. }
  202. .down{
  203. font-size: 26rpx;
  204. font-weight: 400;
  205. color: #666666;
  206. line-height: 37rpx;
  207. }
  208. }
  209. .order-state{
  210. .title{margin-bottom: 30rpx;}
  211. background-color: #fff;
  212. padding: 30rpx;
  213. margin: 0 20rpx 50rpx;
  214. .state{
  215. text-align: center;
  216. /deep/ .u-icon{
  217. display: block;
  218. }
  219. .up{
  220. position: relative;
  221. }
  222. .down{
  223. font-size: 22rpx;
  224. font-weight: 400;
  225. color: #666666;
  226. line-height: 31rpx;
  227. }
  228. }
  229. }
  230. .tools{
  231. .tool-item{
  232. margin-left: 40rpx;
  233. text-align: center;
  234. /deep/ .u-icon{
  235. display: block;
  236. }
  237. .down{
  238. font-size: 22rpx;
  239. font-weight: 400;
  240. color: #666666;
  241. line-height: 31rpx;
  242. }
  243. }
  244. }
  245. .pay-code-warp{
  246. height: 100vh;
  247. }
  248. </style>