index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  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.balance }}</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">0</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 } 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. uni.navigateTo({
  71. url: '/pages_mine/pages/withdrawal/index'
  72. })
  73. }
  74. const onIncome = () => {
  75. uni.navigateTo({
  76. url: '/pages_mine/pages/income/index'
  77. })
  78. }
  79. const onAddBankCard = () => {
  80. uni.navigateTo({
  81. url: '/pages_mine/pages/addBankCard/index'
  82. })
  83. }
  84. const onBankCardDetails = (record) => {
  85. uni.navigateTo({
  86. url: '/pages_mine/pages/bankCardDetails/index'
  87. })
  88. }
  89. const init = async() => {
  90. try {
  91. uni.showLoading({
  92. title: '数据加载中...'
  93. });
  94. if(userType === 2){
  95. const res = await getVolunteerAccountInfo();
  96. data.value =res.data;
  97. }
  98. if(userType === 1){
  99. const res = await getAccountInfo();
  100. console.log(1,res);
  101. data.value = res.data;
  102. }
  103. } catch (error) {
  104. console.log('error', error);
  105. uni.showToast({
  106. title: error.msg,
  107. icon: 'error',
  108. });
  109. } finally {
  110. uni.hideLoading();
  111. }
  112. }
  113. onShow(()=>{
  114. init();
  115. })
  116. </script>
  117. <style lang="scss" scoped>
  118. .card-box {
  119. border-radius: 8px;
  120. background: rgba(255, 255, 255, 1);
  121. padding: 20px;
  122. margin-bottom: 12px;
  123. }
  124. .bank-box {
  125. border-radius: 8px;
  126. margin-bottom: 12px;
  127. }
  128. .wallet-main {
  129. position: fixed;
  130. top: 0px;
  131. left: 0px;
  132. right: 0px;
  133. bottom: 0px;
  134. background: rgba(245, 245, 245, 1);
  135. padding: 12px;
  136. overflow: auto;
  137. .wallet-hi-title {
  138. font-size: 20px;
  139. font-weight: 700;
  140. line-height: 28.96px;
  141. color: rgba(51, 51, 51, 1);
  142. }
  143. .wallet-hi-text {
  144. font-size: 14px;
  145. font-weight: 500;
  146. line-height: 20.27px;
  147. color: rgba(153, 153, 153, 1);
  148. }
  149. .wallet-active {
  150. font-size: 14px;
  151. font-weight: 500;
  152. line-height: 20.27px;
  153. color: rgba(255, 87, 4, 1);
  154. }
  155. .wallet-hi {
  156. margin-bottom: 20px;
  157. }
  158. .wallet-box-title {
  159. font-size: 12px;
  160. font-weight: 500;
  161. line-height: 17.38px;
  162. color: rgba(199, 199, 199, 1);
  163. margin-bottom: 8px;
  164. }
  165. .wallet-box-price {
  166. font-size: 30px;
  167. font-weight: 500;
  168. line-height: 35.16px;
  169. color: rgba(252, 228, 187, 1);
  170. }
  171. .wallet-box-price2 {
  172. font-size: 24px;
  173. font-weight: 400;
  174. line-height: 28.13px;
  175. color: rgba(252, 228, 187, 1);
  176. }
  177. .wallet-box {
  178. border-radius: 12px;
  179. background: linear-gradient(131.81deg, rgba(65, 65, 95, 1) 0%, rgba(45, 48, 74, 1) 100%);
  180. margin-bottom: 14px;
  181. .wallet-box-top {
  182. display: flex;
  183. align-content: center;
  184. justify-content: space-between;
  185. .wallet-box-btn1 {
  186. width: 78px;
  187. height: 30px;
  188. opacity: 1;
  189. border-radius: 4px;
  190. 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%);
  191. margin-bottom: 14px;
  192. font-size: 16px;
  193. font-weight: 700;
  194. line-height: 23.17px;
  195. color: rgba(50, 52, 80, 1);
  196. }
  197. .wallet-box-btn2 {
  198. width: 78px;
  199. height: 30px;
  200. opacity: 1;
  201. border-radius: 4px;
  202. border: 1px solid rgba(255, 218, 172, 1);
  203. font-size: 16px;
  204. font-weight: 500;
  205. letter-spacing: 0px;
  206. line-height: 23.17px;
  207. color: rgba(255, 218, 172, 1);
  208. }
  209. }
  210. .wallet-box-bottom{
  211. display: flex;
  212. align-items: center;
  213. justify-content: space-around;
  214. }
  215. }
  216. }
  217. </style>