center.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  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" 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">
  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. <tabbar :tabbarIndexProps="Number(3)" />
  66. </view>
  67. </template>
  68. <script>
  69. import tabbar from "../components/tabbar.vue"
  70. export default {
  71. components:{
  72. tabbar
  73. },
  74. data() {
  75. return {
  76. staticUrl:this.$commonConfig.staticUrl,
  77. avatar:this.$commonConfig.staticUrl+'/img/avatar.png',
  78. memberInfo:{},
  79. orderState:[
  80. {name:'全部订单',status:'',ico:this.$commonConfig.staticUrl+'/img/orderstateico-all.png'},
  81. {name:'待付款',status:'0',ico:this.$commonConfig.staticUrl+'/img/orderstateico-01.png',badge:'noPayNum'},
  82. {name:'待收货',status:'2',ico:this.$commonConfig.staticUrl+'/img/orderstateico-02.png',badge:'collectNum'},
  83. {name:'待评价',status:'3',ico:this.$commonConfig.staticUrl+'/img/orderstateico-03.png',badge:'commentNum'},
  84. {name:'退款/售后',status:'7',ico:this.$commonConfig.staticUrl+'/img/orderstateico-04.png',badge:'refundNum'},
  85. ],
  86. orderBadge:{
  87. noPayNum:'0',
  88. deliverNum:'0',
  89. collectNum:'0',
  90. commentNum:'0',
  91. refundNum:'0',
  92. },
  93. tools:[
  94. {name:'充值中心',url:'/center/addrlist',ico:this.$commonConfig.staticUrl+'/img/tool-chongzhi.png'},
  95. {name:'地址管理',url:'/center/addrlist',ico:this.$commonConfig.staticUrl+'/img/tool-map.png'},
  96. ]
  97. }
  98. },
  99. onShow() {
  100. this.getMemberInfo();
  101. this.statisticsOrder();
  102. },
  103. onLoad() {
  104. },
  105. methods: {
  106. getMemberInfo(){
  107. this.$u.api.memberInfo({id:this.vuex_user_info.userid}).then(res=>{
  108. this.memberInfo = res.data;
  109. this.avatar = res.data.avatar;
  110. // console.log('memberInfo',this.memberInfo);
  111. }).catch(err=>{
  112. console.log('memberInfo',err.data);
  113. })
  114. },
  115. toolsClick(item){
  116. console.log('item',item);
  117. uni.$u.route(item.url);
  118. },
  119. orderClick(item,index){
  120. console.log('item',item);
  121. uni.$u.route('/shopping/order', {
  122. current: index,
  123. type: 'redirectTo'
  124. });
  125. },
  126. statisticsOrder(){
  127. this.$u.api.statisticsOrder().then(res=>{
  128. let data = res.data || {};
  129. this.orderBadge = Object.assign(this.orderBadge,data)
  130. // console.log('statisticsOrder',res.data);
  131. // console.log('this.orderBadge',this.orderBadge);
  132. }).catch(err=>{
  133. console.log('memberInfo',err.data);
  134. })
  135. }
  136. }
  137. }
  138. </script>
  139. <style>
  140. page{
  141. background-color: #F5F5F5;
  142. }
  143. </style>
  144. <style lang="scss" scoped>
  145. .title{
  146. font-size: 32rpx;
  147. font-weight: 600;
  148. color: #333333;
  149. line-height: 45rpx;
  150. margin-bottom: 30rpx;
  151. }
  152. .base-info{
  153. margin-bottom: 10rpx;
  154. .info{
  155. margin-left: 30rpx;
  156. .name{
  157. font-size: 40rpx;
  158. font-weight: 600;
  159. color: #333333;
  160. line-height: 56rpx;
  161. margin-bottom: 10rpx;
  162. }
  163. .level{
  164. background: linear-gradient(131deg, #FFF2DB 0%, #FFD9A5 100%);
  165. border-radius: 2px;
  166. font-size: 22rpx;
  167. font-weight: 400;
  168. color: #333333;
  169. line-height: 30rpx;
  170. padding: 6rpx 16rpx;
  171. .level-name{
  172. margin-left: 10rpx;
  173. }
  174. }
  175. }
  176. }
  177. .property{
  178. text-align: center;
  179. .up{
  180. font-size: 32rpx;
  181. font-weight: 600;
  182. color: #333333;
  183. line-height: 45rpx;
  184. /deep/ .u-icon{
  185. display: block;
  186. }
  187. }
  188. .down{
  189. font-size: 26rpx;
  190. font-weight: 400;
  191. color: #666666;
  192. line-height: 37rpx;
  193. }
  194. }
  195. .order-state{
  196. .title{margin-bottom: 30rpx;}
  197. background-color: #fff;
  198. padding: 30rpx;
  199. margin: 0 20rpx 50rpx;
  200. .state{
  201. text-align: center;
  202. /deep/ .u-icon{
  203. display: block;
  204. }
  205. .up{
  206. position: relative;
  207. }
  208. .down{
  209. font-size: 22rpx;
  210. font-weight: 400;
  211. color: #666666;
  212. line-height: 31rpx;
  213. }
  214. }
  215. }
  216. .tools{
  217. .tool-item{
  218. margin-left: 40rpx;
  219. text-align: center;
  220. /deep/ .u-icon{
  221. display: block;
  222. }
  223. .down{
  224. font-size: 22rpx;
  225. font-weight: 400;
  226. color: #666666;
  227. line-height: 31rpx;
  228. }
  229. }
  230. }
  231. </style>