index.vue 6.4 KB

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