index.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <template>
  2. <view class="wallet-main">
  3. <view class="wallet-hi">
  4. <view class="wallet-hi-title">Hi,您好!</view>
  5. <text class="wallet-hi-text">为了您更好地使用钱包功能</text>
  6. <!-- <text class="wallet-hi-text">为了您更好地使用钱包功能, <text class="wallet-active" @click="onAddBankCard" >添加银行卡> </text> </text> -->
  7. </view>
  8. <view class="wallet-box card-box">
  9. <view class="wallet-box-top">
  10. <view class="flex-center-column">
  11. <text class="wallet-box-title">钱包总额(元)</text>
  12. <view class="wallet-box-price">{{ data.balance }}</view>
  13. </view>
  14. <view>
  15. <view class="wallet-box-btn1 flex-center" @click="onWithdrawal">提现</view>
  16. <view class="wallet-box-btn2 flex-center" @click="onIncome">收支明细</view>
  17. </view>
  18. </view>
  19. <up-divider v-if="userType === 2"></up-divider>
  20. <view class="wallet-box-bottom" v-if="userType === 2">
  21. <view class="flex-center-column">
  22. <text class="wallet-box-title">累积可提现(元)</text>
  23. <view class="wallet-box-price2">{{ data.totalBalance }}</view>
  24. </view>
  25. <view class="flex-center-column">
  26. <text class="wallet-box-title">待入账(元)</text>
  27. <view class="wallet-box-price2">{{ data.orderFrozenBalance }}</view>
  28. </view>
  29. <view class="flex-center-column">
  30. <text class="wallet-box-title">提现中的金额(元)</text>
  31. <view class="wallet-box-price2">{{data.beBalance}}</view>
  32. </view>
  33. </view>
  34. </view>
  35. <view class="bank-box">
  36. <view v-for="item in bankList" :key="item.cardCode" :style="`background: ${item.color};border-radius: 8px;`" @click="onBankCardDetails(item)" >
  37. <BankItem bankCode="ABC" bankName="中国农业银行" cardType="储蓄卡" cardCode="5106365986893"/>
  38. </view>
  39. </view>
  40. </view>
  41. </template>
  42. <script setup>
  43. import { ref } from 'vue';
  44. import BankItem from '@/pages_mine/components/bank-item/bank-item.vue';
  45. import { getVolunteerAccountInfo,getAccountInfo,getWithdrawStatus } from "@/api/mine";
  46. import {
  47. onShow
  48. } from '@dcloudio/uni-app';
  49. const bankList = ref([
  50. // {
  51. // bankCode: 'ABC',
  52. // bankName: '中国农业银行',
  53. // cardType: '储蓄卡',
  54. // cardCode: '5106365986893',
  55. // color: 'linear-gradient(135deg, rgba(43, 102, 248, 1) 0%, rgba(27, 69, 178, 1) 100%), rgba(0, 0, 0, 0)'
  56. // },
  57. // {
  58. // bankCode: 'ABC',
  59. // bankName: '中国农业银行',
  60. // cardType: '储蓄卡',
  61. // cardCode: '5106365986893',
  62. // color: 'linear-gradient(135deg, rgba(43, 102, 248, 1) 0%, rgba(27, 69, 178, 1) 100%), rgba(0, 0, 0, 0)'
  63. // },
  64. ])
  65. const userType = uni.getStorageSync('userType') //读取本地存储
  66. const data = ref({
  67. balance: 0
  68. });
  69. const onWithdrawal = () => {
  70. // getWithdrawStatus().then(res => {
  71. // if(res.code === 200){
  72. // // uni.navigateTo({
  73. // // url: '/pages_mine/pages/withdrawal/index'
  74. // // })
  75. // 进入提现页面
  76. uni.redirectTo({ url: `/pages_mine/pages/withdrawal/index` });
  77. // }
  78. // })
  79. }
  80. const onIncome = () => {
  81. uni.navigateTo({
  82. url: '/pages_mine/pages/income/index'
  83. })
  84. }
  85. const onAddBankCard = () => {
  86. uni.navigateTo({
  87. url: '/pages_mine/pages/addBankCard/index'
  88. })
  89. }
  90. const onBankCardDetails = (record) => {
  91. uni.navigateTo({
  92. url: '/pages_mine/pages/bankCardDetails/index'
  93. })
  94. }
  95. const init = async() => {
  96. try {
  97. uni.showLoading({
  98. title: '数据加载中...'
  99. });
  100. if(userType === 2){
  101. const res = await getVolunteerAccountInfo();
  102. data.value =res.data;
  103. }
  104. if(userType === 1){
  105. const res = await getAccountInfo();
  106. console.log(1,res);
  107. data.value = res.data;
  108. }
  109. } catch (error) {
  110. console.log('error', error);
  111. uni.showToast({
  112. title: error.msg,
  113. icon: 'error',
  114. });
  115. } finally {
  116. uni.hideLoading();
  117. }
  118. }
  119. onShow(()=>{
  120. init();
  121. })
  122. </script>
  123. <style lang="scss" scoped>
  124. .card-box {
  125. border-radius: 8px;
  126. background: rgba(255, 255, 255, 1);
  127. padding: 20px;
  128. margin-bottom: 12px;
  129. }
  130. .bank-box {
  131. border-radius: 8px;
  132. margin-bottom: 12px;
  133. }
  134. .wallet-main {
  135. position: fixed;
  136. top: 0px;
  137. left: 0px;
  138. right: 0px;
  139. bottom: 0px;
  140. background: rgba(245, 245, 245, 1);
  141. padding: 12px;
  142. overflow: auto;
  143. .wallet-hi-title {
  144. font-size: 20px;
  145. font-weight: 700;
  146. line-height: 28.96px;
  147. color: rgba(51, 51, 51, 1);
  148. }
  149. .wallet-hi-text {
  150. font-size: 14px;
  151. font-weight: 500;
  152. line-height: 20.27px;
  153. color: rgba(153, 153, 153, 1);
  154. }
  155. .wallet-active {
  156. font-size: 14px;
  157. font-weight: 500;
  158. line-height: 20.27px;
  159. color: rgba(255, 87, 4, 1);
  160. }
  161. .wallet-hi {
  162. margin-bottom: 20px;
  163. }
  164. .wallet-box-title {
  165. font-size: 12px;
  166. font-weight: 500;
  167. line-height: 17.38px;
  168. color: rgba(199, 199, 199, 1);
  169. margin-bottom: 8px;
  170. }
  171. .wallet-box-price {
  172. font-size: 30px;
  173. font-weight: 500;
  174. line-height: 35.16px;
  175. color: rgba(252, 228, 187, 1);
  176. }
  177. .wallet-box-price2 {
  178. font-size: 24px;
  179. font-weight: 400;
  180. line-height: 28.13px;
  181. color: rgba(252, 228, 187, 1);
  182. }
  183. .wallet-box {
  184. border-radius: 12px;
  185. background: linear-gradient(131.81deg, rgba(65, 65, 95, 1) 0%, rgba(45, 48, 74, 1) 100%);
  186. margin-bottom: 14px;
  187. .wallet-box-top {
  188. display: flex;
  189. align-content: center;
  190. justify-content: space-between;
  191. .wallet-box-btn1 {
  192. width: 78px;
  193. height: 30px;
  194. opacity: 1;
  195. border-radius: 4px;
  196. background: linear-gradient(222.81deg, rgba(255, 227, 194, 1) 0%, rgba(255, 226, 192, 1) 0%, rgba(255, 225, 189, 1) 0%, rgba(251, 204, 147, 1) 100%);
  197. margin-bottom: 14px;
  198. font-size: 16px;
  199. font-weight: 700;
  200. line-height: 23.17px;
  201. color: rgba(50, 52, 80, 1);
  202. }
  203. .wallet-box-btn2 {
  204. width: 78px;
  205. height: 30px;
  206. opacity: 1;
  207. border-radius: 4px;
  208. border: 1px solid rgba(255, 218, 172, 1);
  209. font-size: 16px;
  210. font-weight: 500;
  211. letter-spacing: 0px;
  212. line-height: 23.17px;
  213. color: rgba(255, 218, 172, 1);
  214. }
  215. }
  216. .wallet-box-bottom{
  217. display: flex;
  218. align-items: center;
  219. justify-content: space-around;
  220. }
  221. }
  222. }
  223. </style>