index.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <script lang="ts" setup>
  2. import { useRequest } from 'alova/client'
  3. import { storeToRefs } from 'pinia'
  4. import { ref } from 'vue'
  5. import { getAccountCount } from '@/api/home'
  6. import { getUnlockAmountByUserId } from '@/api/income'
  7. import CustomNavigationBar from '@/components/CustomNavigationBar.vue'
  8. import { LOGIN_PAGE } from '@/router/config'
  9. import { useUserStore } from '@/store'
  10. import { useTokenStore } from '@/store/token'
  11. import { changtime, menuButtonInfo, safeAreaInsets, systemInfo } from '@/utils'
  12. import { getImageUrl } from '@/utils/imageUtil'
  13. definePage({
  14. style: {
  15. navigationBarTitleText: '解锁收益',
  16. navigationStyle: 'custom',
  17. },
  18. })
  19. const userStore = useUserStore()
  20. const tokenStore = useTokenStore()
  21. const { hasLogin } = storeToRefs(tokenStore)
  22. // 使用storeToRefs解构userInfo
  23. const { userInfo } = storeToRefs(userStore)
  24. function menuClick(page: string) {
  25. uni.navigateTo({
  26. url: `/pages-A/${page}/index`,
  27. })
  28. }
  29. const show = ref(false)
  30. const filterValue = ref(Number(new Date()))
  31. function confirm() {
  32. // 函数实现
  33. show.value = false
  34. }
  35. function cancel() {
  36. show.value = false
  37. }
  38. function close() {
  39. show.value = false
  40. }
  41. const unlockAmount = ref(0)
  42. // 发券人账户表-通过userId查询账户信息
  43. const { send: getAccountCountRequest, data: accountCountData } = useRequest(getAccountCount, {
  44. immediate: false,
  45. })
  46. const { send: getUnlockAmountByUserIdRequest, data: unlockAmountData } = useRequest(getUnlockAmountByUserId, {
  47. immediate: false,
  48. })
  49. // 移除重复声明,已在下方统一声明
  50. onShow(async () => {
  51. // 登录后查询收益数据
  52. if (hasLogin) {
  53. await getAccountCountRequest()
  54. await getUnlockAmountByUserIdRequest()
  55. unlockAmount.value = unlockAmountData
  56. }
  57. })
  58. function showTimeFilter() {
  59. show.value = true
  60. }
  61. const activeTab = ref('pending')
  62. function changeTab(tab: string) {
  63. activeTab.value = tab
  64. }
  65. function submitPay() {
  66. // 提示联系管理员
  67. uni.showToast({
  68. title: '联系管理员解锁收益!',
  69. icon: 'none',
  70. })
  71. }
  72. </script>
  73. <template>
  74. <view class="profile-container">
  75. <!-- 自定义导航栏 -->
  76. <CustomNavigationBar title="解锁收益" background-color="transparent" />
  77. <!-- 顶部区域 -->
  78. <view class="income-header"
  79. :style="{ background: `url(${getImageUrl('@img/income/income-bg.png')}) no-repeat center center`, backgroundSize: 'cover' }">
  80. <view class="income-header-avatar-info"
  81. :style="{ paddingTop: `${safeAreaInsets.top + menuButtonInfo.height + 12}px` }">
  82. <view class="income-header-balance">
  83. 锁定余额(元)
  84. </view>
  85. <view class="income-header-balance-num">
  86. <view class="income-header-balance-num-amount">
  87. {{ accountCountData?.balance }}
  88. </view>
  89. <view class="income-header-balance-num-btns">
  90. <view class="income-header-balance-num-btn js">
  91. 查看解锁规则
  92. </view>
  93. </view>
  94. </view>
  95. </view>
  96. <view class="income-header-tips">
  97. <view class="income-header-tips-item">
  98. <view class="income-header-tips-item-num">
  99. {{ accountCountData?.withdrawableAmount }}
  100. </view>
  101. <view class="income-header-tips-item-des">
  102. 锁定金额
  103. </view>
  104. </view>
  105. <view class="income-header-tips-item">
  106. <view class="income-header-tips-item-num">
  107. {{ accountCountData?.unsettledAmount }}
  108. </view>
  109. <view class="income-header-tips-item-des">
  110. 未结算金额
  111. </view>
  112. </view>
  113. </view>
  114. </view>
  115. <!-- 菜单 -->
  116. <view class="income-header-menu">
  117. <view class="income-header-menu-title">
  118. 充值解锁金额
  119. </view>
  120. <view class="income-header-menu-input">
  121. <text class="income-header-menu-input-symbol">¥</text>
  122. <u-input v-model="unlockAmount" type="number" border="none" />
  123. </view>
  124. </view>
  125. <view class="income-header-menu-btn" @click="submitPay">
  126. 立即充值
  127. </view>
  128. </view>
  129. </template>
  130. <style lang="scss" scoped>
  131. ::v-deep .u-input__content__field-wrapper__field {
  132. height: 80rpx !important;
  133. font-size: 80rpx !important;
  134. }
  135. .profile-container {
  136. min-height: 100vh;
  137. background-color: #f5f5f5;
  138. line-height: 1;
  139. // padding-top: 44px; /* 为固定导航栏留出空间 */
  140. .income-header {
  141. height: 525rpx;
  142. .income-header-avatar-info {
  143. display: flex;
  144. flex-direction: column;
  145. gap: 30rpx;
  146. padding: 0 24rpx;
  147. .income-header-balance {
  148. font-weight: 400;
  149. font-size: 26rpx;
  150. color: #ffffff;
  151. }
  152. .income-header-balance-num {
  153. display: flex;
  154. justify-content: space-between;
  155. align-items: center;
  156. .income-header-balance-num-amount {
  157. font-weight: 500;
  158. font-size: 65rpx;
  159. color: #ffffff;
  160. }
  161. .income-header-balance-num-btns {
  162. display: flex;
  163. gap: 15rpx;
  164. .income-header-balance-num-btn {
  165. padding: 20rpx 40rpx;
  166. border-radius: 33rpx;
  167. font-weight: 400;
  168. font-size: 26rpx;
  169. &.js {
  170. background: #da4c47;
  171. color: #ffffff;
  172. }
  173. &.tx {
  174. background: #bfbfbf;
  175. color: #747474;
  176. }
  177. }
  178. }
  179. }
  180. }
  181. .income-header-tips {
  182. height: 124rpx;
  183. display: flex;
  184. background: linear-gradient(114deg, #f67873, #fb847f, #f67873);
  185. border-radius: 10rpx;
  186. margin: 47rpx 24rpx 0 24rpx;
  187. .income-header-tips-item {
  188. flex: 1;
  189. display: flex;
  190. flex-direction: column;
  191. justify-content: center;
  192. align-items: center;
  193. gap: 15rpx;
  194. font-weight: 500;
  195. font-size: 30rpx;
  196. color: #ffffff;
  197. line-height: 1;
  198. position: relative;
  199. &:first-child:after {
  200. content: '';
  201. position: absolute;
  202. top: 50%;
  203. right: 0;
  204. transform: translateY(-50%);
  205. width: 2px;
  206. height: 40rpx;
  207. background: #ffffff;
  208. }
  209. .income-header-tips-item-num {
  210. font-weight: bold;
  211. }
  212. .income-header-tips-item-des {
  213. font-weight: 400;
  214. font-size: 24rpx;
  215. color: #ffffff;
  216. }
  217. }
  218. }
  219. }
  220. .income-header-menu {
  221. background: #ffffff;
  222. border-radius: 10rpx;
  223. margin: 24rpx 24rpx 0;
  224. margin-top: -30rpx;
  225. .income-header-menu-title {
  226. font-weight: 400;
  227. font-size: 26rpx;
  228. color: #333333;
  229. padding: 34rpx 20rpx;
  230. border-bottom: 2rpx solid #eeeeee;
  231. }
  232. .income-header-menu-input {
  233. display: flex;
  234. align-items: flex-end;
  235. gap: 17rpx;
  236. padding: 66rpx 20rpx;
  237. .income-header-menu-input-symbol {
  238. font-weight: 400;
  239. font-size: 60rpx;
  240. color: #333333;
  241. }
  242. }
  243. }
  244. .income-header-menu-btn {
  245. width: 600rpx;
  246. line-height: 80rpx;
  247. background: linear-gradient(90deg, #ee6b67 0%, #ff7d78 100%);
  248. border-radius: 10rpx;
  249. margin: 100rpx auto 0;
  250. font-weight: 400;
  251. font-size: 30rpx;
  252. color: #ffffff;
  253. text-align: center;
  254. }
  255. }
  256. </style>