my.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <ax-body>
  3. <template #title></template>
  4. <view class="page-background"><image src="@/static/img/my-bg.svg" mode="widthFix"></image></view>
  5. <!-- 主内容 -->
  6. <view class="main">
  7. <!-- 用户信息 -->
  8. <view class="app-flex c-between user-card">
  9. <view class="app-flex middle">
  10. <image src="@/static/img/user-avatar.svg" class="user-avatar"></image>
  11. <view>
  12. <view class="user-name">{{userinfo.nickName?userinfo.nickName:'匿名'}}</view>
  13. <view class="user-phone" v-if="userinfo.phone">{{userinfo.phone?userinfo.phone:'未获取手机'}}</view>
  14. <button v-if="!userinfo.phone" @getphonenumber="onGetPhoneNumber" open-type="getPhoneNumber" class="get-phone-number">授权并登录</button>
  15. </view>
  16. </view>
  17. <!-- <image src="@/static/img/seting.svg" class="seting-icon"></image> -->
  18. </view>
  19. <!-- 统计卡 -->
  20. <view class="app-flex c-between">
  21. <view class="sta-card">
  22. <view class="value">{{userinfo.integralNum}}</view>
  23. <view class="name">我的积分</view>
  24. <image src="@/static/img/my-sta-bg01.png" mode="heightFix" class="bg"></image>
  25. </view>
  26. <view class="sta-card">
  27. <view class="value">{{userinfo.params.balance}}</view>
  28. <view class="name">可抵扣余量</view>
  29. <image src="@/static/img/my-sta-bg03.png" mode="heightFix" class="bg"></image>
  30. <view class="refund_btn" @click="refund">
  31. 退还
  32. </view>
  33. </view>
  34. </view>
  35. <view @click="$app.url.goto('/pages/coupon-buy/coupon-buy')" class="buy">购买充电券</view>
  36. <!-- 常用工具 -->
  37. <view class="card">
  38. <view class="card-title">常用工具</view>
  39. <view class="act-wrap">
  40. <view class="act-item" @click="$app.url.goto('/pages/recharge-log/recharge-log')">
  41. <image src="@/static/img/my-icon01.svg" class="icon"></image>
  42. <view class="name">购券记录</view>
  43. </view>
  44. <view class="act-item" @click="$app.url.goto('/pages/order/order')">
  45. <image src="@/static/img/my-icon02.svg" class="icon"></image>
  46. <view class="name">我的订单</view>
  47. </view>
  48. <view class="act-item" @click="$app.url.goto('/pages/feedback/feedback')">
  49. <image src="@/static/img/my-icon03.svg" class="icon"></image>
  50. <view class="name">意见反馈</view>
  51. </view>
  52. <view class="act-item" @click="customerService()">
  53. <image src="@/static/img/my-icon04.svg" class="icon"></image>
  54. <view class="name">在线客服</view>
  55. </view>
  56. </view>
  57. </view>
  58. <!-- 更多功能 -->
  59. <view class="card">
  60. <view class="card-title">更多功能</view>
  61. <view class="act-wrap">
  62. <!-- <view class="act-item about">
  63. <image src="@/static/img/logo-small.png" class="icon"></image>
  64. <view class="name">关于我们</view>
  65. </view> -->
  66. <view class="act-item" @click="openPrivacyContract">
  67. <image src="@/static/img/my-icon05.svg" class="icon"></image>
  68. <view class="name">隐私条例</view>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. <!-- 导航栏 -->
  74. <app-navigation active="my"></app-navigation>
  75. </ax-body>
  76. </template>
  77. <script>
  78. export default {
  79. data() {
  80. return {
  81. userinfo:{}
  82. }
  83. },
  84. onShow() {
  85. this.getMyAccount()
  86. },
  87. methods: {
  88. refund(){
  89. this.$app.popup.confirm("退款按照购券记录进行逐笔退款,可能产生多笔退款到账记录,请注意查收。","退款说明").then(confirm=>{
  90. if(confirm){
  91. this.$api.base("post",'/orderApi/refund',{}).then(res=>{
  92. if(res.code==0){
  93. this.$app.popup.alert('退款成功!').then(()=>{
  94. this.getMyAccount()
  95. });
  96. }else{
  97. this.$app.popup.alert(res.msg);
  98. }
  99. });
  100. }
  101. });;
  102. },
  103. openPrivacyContract(){
  104. uni.openPrivacyContract();
  105. },
  106. // 打开客服
  107. customerService(){
  108. const cs = this.$config.customerService;
  109. this.$app.act.customerService(cs.id,cs.url).catch(err=>{
  110. console.log(err);
  111. this.$app.popup.alert('客服中心失联啦,请联系管理员!');
  112. });
  113. },
  114. getMyAccount(){
  115. this.$api.base("post","/userApi/getUserAccount",{},{}).then(res=>{
  116. this.userinfo = res.accountInfo
  117. })
  118. },
  119. onGetPhoneNumber(e){
  120. if(e.detail.code){
  121. this.$api.base("post",'/userApi/getPhone',{code:e.detail.code}).then(res=>{
  122. this.$app.storage.set('USER_INFO',res.userInfo);
  123. this.getMyAccount();
  124. });
  125. }
  126. },
  127. }
  128. }
  129. </script>
  130. <style scoped>
  131. @import url("my.css");
  132. .refund_btn{
  133. position: absolute;
  134. font-size: 14px;
  135. color: #fff;
  136. background-color: #3EB6F8;
  137. padding: 2px 8px;
  138. border-radius: 10px 0 0 10px;
  139. bottom: 5px;
  140. right: 0;
  141. z-index: 99;
  142. }
  143. </style>