my.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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. let channelUrl='http://192.168.2.21:9120/zs/channel/admin/'
  116. this.$api.base("post","/userApi/getUserAccount",{},{}).then(res=>{
  117. this.userinfo = res.accountInfo
  118. // 识别用户是否通过分销码进入小程序
  119. uni.request({
  120. url:channelUrl+'ums/umsAdminUser/distributionBindUser',
  121. method: 'POST',
  122. header: {
  123. 'content-type': 'application/json'
  124. },
  125. data: {
  126. userId: uni.getStorageSync('USER_INFO').id,
  127. adminUserId:parseInt(uni.getStorageSync('adminUserId')),
  128. },
  129. success: (res) => {
  130. console.info('扫码接口调用');
  131. }
  132. });
  133. })
  134. },
  135. onGetPhoneNumber(e){
  136. if(e.detail.code){
  137. this.$api.base("post",'/userApi/getPhone',{code:e.detail.code}).then(res=>{
  138. this.$app.storage.set('USER_INFO',res.userInfo);
  139. this.getMyAccount();
  140. });
  141. }
  142. },
  143. }
  144. }
  145. </script>
  146. <style scoped>
  147. @import url("my.css");
  148. .refund_btn{
  149. position: absolute;
  150. font-size: 14px;
  151. color: #fff;
  152. background-color: #3EB6F8;
  153. padding: 2px 8px;
  154. border-radius: 10px 0 0 10px;
  155. bottom: 5px;
  156. right: 0;
  157. z-index: 99;
  158. }
  159. </style>