info.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <mobile-frame>
  3. <view class="main">
  4. <view class="info">
  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>
  27. </mobile-frame>
  28. </template>
  29. <script>
  30. export default {
  31. data() {
  32. return {
  33. id: '',
  34. user: {},
  35. info: {},
  36. // 状态
  37. statusList: [],
  38. // 来源
  39. sourceList: [],
  40. };
  41. },
  42. onLoad: async function(e) {
  43. const that = this;
  44. that.$set(that, `id`, e.id || '');
  45. await that.searchOther();
  46. await that.watchLogin();
  47. },
  48. methods: {
  49. // 查询其他信息
  50. async searchOther() {
  51. const that = this;
  52. let res;
  53. res = await that.$api(`/dictData`, 'GET', {
  54. code: "cashBack_status"
  55. });
  56. if (res.errcode == '0') {
  57. that.$set(that, `statusList`, res.data)
  58. }
  59. res = await that.$api(`/dictData`, 'GET', {
  60. code: "cashBack_source"
  61. });
  62. if (res.errcode == '0') {
  63. that.$set(that, `sourceList`, res.data)
  64. }
  65. },
  66. // 监听用户是否登录
  67. watchLogin() {
  68. const that = this;
  69. uni.getStorage({
  70. key: 'token',
  71. success: async function(res) {
  72. let user = that.$jwt(res.data);
  73. if (user) {
  74. that.$set(that, `user`, user);
  75. if (that.id) {
  76. let arr = await that.$api(`/cashBack/${that.id}`, 'GET')
  77. if (arr.errcode == '0') {
  78. let status = that.statusList.find(i => i.value == arr.data.status)
  79. if (status) arr.data.zhStatus = status.label;
  80. let source = that.sourceList.find(i => i.value == arr.data.source)
  81. if (source) arr.data.zhSource = source.label;
  82. // 查询推荐人信息
  83. let res = await that.$api(`/user/${arr.data.inviter}`, 'GET');
  84. if (res.errcode == '0') arr.data.inviter_name = res.data.name
  85. that.$set(that, `info`, arr.data)
  86. }
  87. }
  88. }
  89. },
  90. fail: function(err) {
  91. uni.navigateTo({
  92. url: `/pages/login/index`
  93. })
  94. }
  95. });
  96. }
  97. }
  98. }
  99. </script>
  100. <style lang="scss">
  101. .main {
  102. display: flex;
  103. flex-direction: column;
  104. width: 100vw;
  105. height: 100vh;
  106. .info {
  107. padding: 2vw;
  108. .one {
  109. display: flex;
  110. justify-content: space-between;
  111. padding: 10vw 2vw;
  112. border-bottom: 0.5vw solid var(--f1Color);
  113. .left {
  114. color: #696969;
  115. font-size: var(--font14Size);
  116. }
  117. .right {
  118. font-size: var(--font16Size);
  119. font-weight: bold;
  120. }
  121. }
  122. .two {
  123. display: flex;
  124. justify-content: space-between;
  125. padding: 2vw;
  126. .left {
  127. color: #696969;
  128. font-size: var(--font14Size);
  129. }
  130. .right {
  131. color: #A9A9A9;
  132. font-size: var(--font14Size);
  133. }
  134. }
  135. }
  136. }
  137. </style>