info.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <template>
  2. <mobile-frame>
  3. <view class="main">
  4. <view class="info" v-if="type=='0'">
  5. <view class="one">
  6. <view class="left">返现金额</view>
  7. <view class="right">+{{info.money}}</view>
  8. </view>
  9. <view class="two">
  10. <view class="left">状态</view>
  11. <view class="right">{{info.zhStatus}}</view>
  12. </view>
  13. <view class="two">
  14. <view class="left">返现时间</view>
  15. <view class="right">{{info.time}}</view>
  16. </view>
  17. <view class="two">
  18. <view class="left">推荐人</view>
  19. <view class="right">{{info.inviter_name}}</view>
  20. </view>
  21. <view class="two">
  22. <view class="left">来源</view>
  23. <view class="right">{{info.zhSource}}</view>
  24. </view>
  25. </view>
  26. <view class="info" v-else>
  27. <view class="one">
  28. <view class="left">提现金额</view>
  29. <view class="right">-{{info.money}}</view>
  30. </view>
  31. <view class="two">
  32. <view class="left">状态</view>
  33. <view class="right">{{info.zhStatus}}</view>
  34. </view>
  35. <view class="two">
  36. <view class="left">提现时间</view>
  37. <view class="right">{{info.time}}</view>
  38. </view>
  39. <view class="two">
  40. <view class="left">推荐人</view>
  41. <view class="right">{{info.inviter_name}}</view>
  42. </view>
  43. <view class="two">
  44. <view class="left">提现理由</view>
  45. <view class="right">{{info.zhSource}}</view>
  46. </view>
  47. </view>
  48. </view>
  49. </mobile-frame>
  50. </template>
  51. <script>
  52. export default {
  53. data() {
  54. return {
  55. id: '',
  56. // 类型
  57. type: '',
  58. user: {},
  59. info: {},
  60. // 状态
  61. statusList: [],
  62. // 来源
  63. sourceList: [],
  64. };
  65. },
  66. onLoad: async function(e) {
  67. const that = this;
  68. that.$set(that, `id`, e.id || '');
  69. that.$set(that, `type`, e.type || '');
  70. await that.searchOther();
  71. await that.watchLogin();
  72. },
  73. methods: {
  74. // 查询其他信息
  75. async searchOther() {
  76. const that = this;
  77. let res;
  78. res = await that.$api(`/dictData`, 'GET', {
  79. code: "cashBack_status"
  80. });
  81. if (res.errcode == '0') {
  82. that.$set(that, `statusList`, res.data)
  83. }
  84. res = await that.$api(`/dictData`, 'GET', {
  85. code: "cashBack_source"
  86. });
  87. if (res.errcode == '0') {
  88. that.$set(that, `sourceList`, res.data)
  89. }
  90. },
  91. // 监听用户是否登录
  92. watchLogin() {
  93. const that = this;
  94. uni.getStorage({
  95. key: 'token',
  96. success: async function(res) {
  97. let user = that.$jwt(res.data);
  98. if (user) {
  99. that.$set(that, `user`, user);
  100. if (that.id) {
  101. if (that.type == '0') {
  102. // 收益记录
  103. let arr = await that.$api(`/cashBack/${that.id}`, 'GET')
  104. if (arr.errcode == '0') {
  105. let status = that.statusList.find(i => i.value == arr.data.status)
  106. if (status) arr.data.zhStatus = status.label;
  107. let source = that.sourceList.find(i => i.value == arr.data.source)
  108. if (source) arr.data.zhSource = source.label;
  109. // 查询推荐人信息
  110. let res = await that.$api(`/user/${arr.data.inviter}`, 'GET');
  111. if (res.errcode == '0') arr.data.inviter_name = res.data.name
  112. that.$set(that, `info`, arr.data)
  113. }
  114. } else {
  115. // 提现记录
  116. let arr = await that.$api(`/cashBack/${that.id}`, 'GET')
  117. if (arr.errcode == '0') {
  118. let status = that.statusList.find(i => i.value == arr.data.status)
  119. if (status) arr.data.zhStatus = status.label;
  120. let source = that.sourceList.find(i => i.value == arr.data.source)
  121. if (source) arr.data.zhSource = source.label;
  122. // 查询推荐人信息
  123. let res = await that.$api(`/user/${arr.data.inviter}`, 'GET');
  124. if (res.errcode == '0') arr.data.inviter_name = res.data.name
  125. that.$set(that, `info`, arr.data)
  126. }
  127. }
  128. }
  129. }
  130. },
  131. fail: function(err) {
  132. uni.navigateTo({
  133. url: `/pages/login/index`
  134. })
  135. }
  136. });
  137. }
  138. }
  139. }
  140. </script>
  141. <style lang="scss">
  142. .main {
  143. display: flex;
  144. flex-direction: column;
  145. width: 100vw;
  146. height: 100vh;
  147. .info {
  148. padding: 2vw;
  149. .one {
  150. display: flex;
  151. justify-content: space-between;
  152. padding: 10vw 2vw;
  153. border-bottom: 0.5vw solid var(--f1Color);
  154. .left {
  155. color: #696969;
  156. font-size: var(--font14Size);
  157. }
  158. .right {
  159. font-size: var(--font16Size);
  160. font-weight: bold;
  161. }
  162. }
  163. .two {
  164. display: flex;
  165. justify-content: space-between;
  166. padding: 2vw;
  167. .left {
  168. color: #696969;
  169. font-size: var(--font14Size);
  170. }
  171. .right {
  172. color: #A9A9A9;
  173. font-size: var(--font14Size);
  174. }
  175. }
  176. }
  177. }
  178. </style>