center.vue 6.3 KB

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