my.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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 class="act-item" @click="$app.url.goto('/pages/Invite-staff/Invite-staff')">
  71. <image src="@/static/img/my-icon06.svg" class="icon"></image>
  72. <view class="name">邀请员工</view>
  73. </view> -->
  74. </view>
  75. </view>
  76. </view>
  77. <!-- 导航栏 -->
  78. <app-navigation active="my"></app-navigation>
  79. </ax-body>
  80. </template>
  81. <script>
  82. export default {
  83. data() {
  84. return {
  85. userinfo:{}
  86. }
  87. },
  88. onShow() {
  89. this.getMyAccount()
  90. },
  91. methods: {
  92. refund(){
  93. this.$app.popup.confirm("退款按照购券记录进行逐笔退款,可能产生多笔退款到账记录,请注意查收。","退款说明").then(confirm=>{
  94. if(confirm){
  95. this.$api.base("post",'/orderApi/refund',{}).then(res=>{
  96. if(res.code==0){
  97. this.$app.popup.alert('退款成功!').then(()=>{
  98. this.getMyAccount()
  99. });
  100. }else{
  101. this.$app.popup.alert(res.msg);
  102. }
  103. });
  104. }
  105. });;
  106. },
  107. openPrivacyContract(){
  108. uni.openPrivacyContract();
  109. },
  110. // 打开客服
  111. customerService(){
  112. const cs = this.$config.customerService;
  113. this.$app.act.customerService(cs.id,cs.url).catch(err=>{
  114. console.log(err);
  115. this.$app.popup.alert('客服中心失联啦,请联系管理员!');
  116. });
  117. },
  118. getMyAccount(){
  119. let channelUrl='http://192.168.110.241:9120/zs/channel/admin/'
  120. // let channelUrl='https://channel-api.zonelife.cn/zs/channel/admin/'
  121. this.$api.base("post","/userApi/getUserAccount",{},{}).then(res=>{
  122. this.userinfo = res.accountInfo
  123. // 识别用户是否通过分销码进入小程序
  124. if(uni.getStorageSync('ADMIN_USERID')){
  125. uni.request({
  126. url:channelUrl+'ums/umsAdminUser/distributionBindUser',
  127. method: 'POST',
  128. header: {
  129. 'content-type': 'application/json'
  130. },
  131. data: {
  132. userId: uni.getStorageSync('USER_INFO').id,
  133. adminUserId:parseInt(uni.getStorageSync('ADMIN_USERID')),
  134. },
  135. success: (res) => {
  136. console.info(res.data,'----扫码接口调用');
  137. this.$app.storage.remove('ADMIN_USERID')
  138. },
  139. fail(err) {
  140. console.log(err,'----错误信息');
  141. }
  142. });
  143. }
  144. })
  145. },
  146. onGetPhoneNumber(e){
  147. if(e.detail.code){
  148. this.$api.base("post",'/userApi/getPhone',{code:e.detail.code}).then(res=>{
  149. this.$app.storage.set('USER_INFO',res.userInfo);
  150. this.getMyAccount();
  151. });
  152. }
  153. },
  154. }
  155. }
  156. </script>
  157. <style scoped>
  158. @import url("my.css");
  159. .refund_btn{
  160. position: absolute;
  161. font-size: 14px;
  162. color: #fff;
  163. background-color: #3EB6F8;
  164. padding: 2px 8px;
  165. border-radius: 10px 0 0 10px;
  166. bottom: 5px;
  167. right: 0;
  168. z-index: 99;
  169. }
  170. </style>