user.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <template>
  2. <view>
  3. <view v-if="(data_base || null) != null">
  4. <!-- 钱包信息 -->
  5. <view class="padding-main">
  6. <view class="padding-main border-radius-main bg-white pr">
  7. <view class="item oh">
  8. <view class="fl cr-base">有效</view>
  9. <view class="fl cr-main fw-b single-text margin-left-sm margin-right-sm">{{user_wallet.normal_money || '0.00'}}</view>
  10. <view class="fl cr-gray unit">元</view>
  11. </view>
  12. <view class="item oh margin-top-sm">
  13. <view class="fl cr-base">冻结</view>
  14. <view class="fl cr-red fw-b single-text margin-left-sm margin-right-sm">{{user_wallet.frozen_money || '0.00'}}</view>
  15. <view class="fl cr-gray unit">元</view>
  16. </view>
  17. <view class="item oh margin-top-sm">
  18. <view class="fl cr-base">赠送</view>
  19. <view class="fl cr-base fw-b single-text margin-left-sm margin-right-sm">{{user_wallet.give_money || '0.00'}}</view>
  20. <view class="fl cr-gray unit">元</view>
  21. </view>
  22. <view class="submit-container pa oh">
  23. <navigator v-if="(data_base || null) != null && (data_base.is_enable_recharge || 0) == 1" class="dis-inline" url="/pages/plugins/wallet/recharge/recharge" hover-class="none">
  24. <button class="round cr-white bg-green br-green text-size-sm fl" size="mini" type="default" hover-class="none">充值</button>
  25. </navigator>
  26. <navigator v-if="(data_base || null) != null && (data_base.is_enable_cash || 0) == 1" class="dis-inline" url="/pages/plugins/wallet/cash-auth/cash-auth" hover-class="none">
  27. <button class="round cr-white bg-main br-main text-size-sm fl margin-left-lg" size="mini" type="default" hover-class="none">提现</button>
  28. </navigator>
  29. </view>
  30. </view>
  31. </view>
  32. <!-- 导航 -->
  33. <view v-if="nav_list.length > 0" class="nav oh">
  34. <block v-for="(item, index) in nav_list" :key="index">
  35. <view class="item fl tc padding-main border-radius-main bg-white">
  36. <navigator :url="item.url" hover-class="none">
  37. <image :src="item.icon" mode="scaleToFill" class="dis-block"></image>
  38. <view class="tc cr-base margin-top-lg">{{item.title}}</view>
  39. </navigator>
  40. </view>
  41. </block>
  42. </view>
  43. <!-- 通知 -->
  44. <view v-if="(data_base.user_center_notice || null) != null && data_base.user_center_notice.length > 0" class="padding-horizontal-main padding-bottom-main">
  45. <view class="notice-content">
  46. <view v-for="(item, index) in data_base.user_center_notice" :key="index" class="item">{{item}}</view>
  47. </view>
  48. </view>
  49. </view>
  50. <view v-else>
  51. <!-- 提示信息 -->
  52. <component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
  53. </view>
  54. </view>
  55. </template>
  56. <script>
  57. const app = getApp();
  58. import componentNoData from "../../../../components/no-data/no-data";
  59. export default {
  60. data() {
  61. return {
  62. data_bottom_line_status: false,
  63. data_list_loding_status: 1,
  64. data_list_loding_msg: '',
  65. data_base: null,
  66. user_wallet: null,
  67. nav_list: [],
  68. submit_disabled_status: false
  69. };
  70. },
  71. components: {
  72. componentNoData
  73. },
  74. props: {},
  75. onLoad(params) {},
  76. onShow() {
  77. this.init();
  78. // 分享菜单处理
  79. app.globalData.page_share_handle();
  80. },
  81. // 下拉刷新
  82. onPullDownRefresh() {
  83. this.get_data();
  84. },
  85. methods: {
  86. init(e) {
  87. var user = app.globalData.get_user_info(this, "init");
  88. if (user != false) {
  89. // 用户未绑定用户则转到登录页面
  90. if (app.globalData.user_is_need_login(user)) {
  91. uni.showModal({
  92. title: '温馨提示',
  93. content: '绑定手机号码',
  94. confirmText: '确认',
  95. cancelText: '暂不',
  96. success: result => {
  97. uni.stopPullDownRefresh();
  98. if (result.confirm) {
  99. uni.navigateTo({
  100. url: "/pages/login/login?event_callback=init"
  101. });
  102. }
  103. }
  104. });
  105. } else {
  106. this.get_data();
  107. }
  108. }
  109. },
  110. // 获取数据
  111. get_data() {
  112. uni.request({
  113. url: app.globalData.get_request_url("index", "user", "wallet"),
  114. method: 'POST',
  115. data: {},
  116. dataType: 'json',
  117. success: res => {
  118. uni.stopPullDownRefresh();
  119. if (res.data.code == 0) {
  120. var data = res.data.data;
  121. this.setData({
  122. data_base: data.base || null,
  123. user_wallet: data.user_wallet || null,
  124. nav_list: data.nav_list || [],
  125. data_list_loding_msg: '',
  126. data_list_loding_status: 0,
  127. data_bottom_line_status: false
  128. });
  129. } else {
  130. this.setData({
  131. data_bottom_line_status: false,
  132. data_list_loding_status: 2,
  133. data_list_loding_msg: res.data.msg
  134. });
  135. if (app.globalData.is_login_check(res.data, this, 'get_data')) {
  136. app.globalData.showToast(res.data.msg);
  137. }
  138. }
  139. },
  140. fail: () => {
  141. uni.stopPullDownRefresh();
  142. this.setData({
  143. data_bottom_line_status: false,
  144. data_list_loding_status: 2,
  145. data_list_loding_msg: '服务器请求出错'
  146. });
  147. app.globalData.showToast('服务器请求出错');
  148. }
  149. });
  150. }
  151. }
  152. };
  153. </script>
  154. <style>
  155. @import './user.css';
  156. </style>