index.vue 6.9 KB

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