balance.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <template>
  2. <view>
  3. <ujp-navbar title="我的余额">
  4. <view class="slot-wrap">
  5. <span class="navBtn oldTextjp2" oldstyle="font-size: 16px;" @click="toRefundList">退余额</span>
  6. </view>
  7. </ujp-navbar>
  8. <view class="balance">
  9. <view class="balanceHead">
  10. <view class="balanceCard">
  11. <view class="balanceCard-head">
  12. <font>总金额</font><u-icon name="question-line" custom-prefix="custom-icon" color="#fff" size="32" @click="show=true"></u-icon>
  13. </view>
  14. <view>
  15. <u-modal v-model="show" :confirm-text="confirmText" confirm-color="#00B962">
  16. <view class="slot-content">
  17. <rich-text :nodes="content"></rich-text>
  18. </view>
  19. </u-modal>
  20. </view>
  21. <view class="balanceCard-main oldTextjp2" oldstyle="font-size: 16px;">
  22. <h2 v-if="personAccount.availableAmount != null">{{personAccount.availableAmount.toFixed(2)}}元</h2>
  23. <view class="balanceCard-btn" @click="rechargeNow">立即充值</view>
  24. </view>
  25. <view class="balanceCard-foot oldTextjp2" oldstyle="font-size: 16px;">
  26. <view class="balanceCard-item" v-if="personAccount.totalAmount != null">可用余额{{personAccount.totalAmount.toFixed(2)}}元</view>
  27. <view class="balanceCard-item" v-if="personAccount.frozenTotal != null">冻结金额{{personAccount.frozenTotal.toFixed(2)}}元</view>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="balanceMain">
  32. <view class="balanceMain-title">
  33. <view class="title">
  34. <u-icon name="todo-fill" custom-prefix="custom-icon" color="#6BC6A7" size="40"></u-icon>
  35. <span class="oldTextjp" oldstyle="font-size: 20px;">充值明细</span>
  36. </view>
  37. <view class="more oldTextjp2" oldstyle="font-size: 16px;" @click="seeAll">
  38. <span>查看全部</span>
  39. <u-icon name="arrow-right-s-line" custom-prefix="custom-icon" color="#B3B3B3" size="32"></u-icon>
  40. </view>
  41. </view>
  42. <view class="balanceMain-list" v-if="accountList.length > 0">
  43. <view class="balanceMain-item" v-for="(item,index) in accountList" :key="item.id" @click="gotoUrl('pages/user/finance/rechargeDet?id=' + item.id)">
  44. <view class="title">
  45. <font class="oldTextjp2" oldstyle="font-size: 18px;">{{item.payNameStr}}</font>
  46. <p class="oldTextjp2" oldstyle="font-size: 14px;">{{item.createTime}}</p>
  47. </view>
  48. <h4 class="oldTextjp2" oldstyle="font-size: 24px;">{{item.amount}}元</h4>
  49. </view>
  50. </view>
  51. </view>
  52. <view class="carNone" v-if="accountList.length == 0">
  53. <img src="static/img/暂无数据-缺省页.png" alt="">
  54. <p class="oldTextjp2" oldstyle="font-size: 18px;">本月暂无充值记录</p>
  55. </view>
  56. </view>
  57. </view>
  58. </template>
  59. <script>
  60. import * as userApi from '@/apis/user.js'
  61. import * as API from '@/apis/index.js'
  62. export default {
  63. data() {
  64. return {
  65. dateMonth: '',
  66. userId: '',
  67. show: false,
  68. confirmText: '知道了',
  69. content: `总金额=可用余额+冻结金额。使用预付费充电时,在充电过程中会冻结部分金额,充电完成后将剩余金额返还至余额账户,每笔预充金额的冻结时间不超过96小时。`,
  70. personAccount: {},
  71. accountList: [],
  72. elderStatus: false,
  73. }
  74. },
  75. onReady() {
  76. var date = new Date();
  77. var year = date.getFullYear();
  78. var monthN = date.getMonth() + 1;
  79. if(monthN >= 1 && monthN <= 9) {
  80. monthN = "0" + monthN;
  81. }
  82. this.dateMonth = year + '-' + monthN + '-01';
  83. this.getCarPersonAccount();
  84. this.getAccountRecordData();
  85. if(this.carhelp.get("getElderModeClass") == "长辈模式") {
  86. this.elderStatus = true;
  87. } else {
  88. this.elderStatus = false;
  89. }
  90. },
  91. methods: {
  92. toRefundList() {
  93. uni.navigateTo({
  94. url: '/pages/user/finance/refundList'
  95. })
  96. },
  97. getAccountRecordData() {
  98. uni.showLoading({
  99. title: "加载中",
  100. mask: true,
  101. })
  102. API.accountRecordData({
  103. queryDate: this.dateMonth
  104. }).then((res) => {
  105. uni.hideLoading();
  106. this.accountList = res.data.data;
  107. }).catch(error => {
  108. uni.showToast({
  109. title: error,
  110. icon: "none"
  111. })
  112. })
  113. },
  114. getCarPersonAccount() {
  115. uni.showLoading({
  116. title: "加载中",
  117. mask: true,
  118. })
  119. userApi.carPersonAccount().then((res) => {
  120. uni.hideLoading();
  121. this.personAccount = res.data;
  122. }).catch(error => {
  123. uni.showToast({
  124. title: error,
  125. icon: "none"
  126. })
  127. })
  128. },
  129. rechargeNow() {
  130. uni.navigateTo({
  131. url: '/pages/user/finance/recharge'
  132. })
  133. },
  134. seeAll() {
  135. uni.navigateTo({
  136. url: '/pages/user/finance/rechargeList'
  137. })
  138. }
  139. }
  140. }
  141. </script>
  142. <style lang="scss" scoped>
  143. .slot-content {
  144. font-size: 28rpx;
  145. color: $u-content-color;
  146. padding-left: 30rpx;
  147. padding-right: 30rpx;
  148. padding-top: 20px;
  149. padding-bottom: 20px;
  150. }
  151. .slot-wrap{
  152. flex: 1;
  153. }
  154. .navBtn{
  155. float: right;
  156. margin-right: 15px;
  157. color:#3fbd70;
  158. }
  159. .carNone{
  160. display: flex;
  161. flex-direction: column;
  162. justify-content: center;
  163. align-items: center;
  164. img{
  165. width: 100%;
  166. height: 100%;
  167. }
  168. p{
  169. margin-top: -60px;
  170. }
  171. }
  172. .balanceHead{
  173. background-color: #fff;
  174. padding: 16px;
  175. .balanceCard{
  176. background-color: #00B962;
  177. border-radius: 12px;
  178. padding: 16px;
  179. .balanceCard-head{
  180. font{
  181. font-size: 18px;
  182. color:#fff;
  183. margin-right: 8px;
  184. }
  185. }
  186. .balanceCard-main{
  187. display: flex;
  188. align-items: center;
  189. justify-content: space-between;
  190. margin-top: 8px;
  191. h2{
  192. font-size: 40px;
  193. color:#fff;
  194. font-weight: normal;
  195. }
  196. .balanceCard-btn{
  197. padding: 8px 20px;
  198. background-color: #fff;
  199. color:#00B962;
  200. border-radius: 18px;
  201. }
  202. }
  203. .balanceCard-foot{
  204. display: flex;
  205. margin-top: 16px;
  206. .balanceCard-item{
  207. flex: 1;
  208. color:#fff;
  209. }
  210. }
  211. }
  212. }
  213. .balanceMain{
  214. background-color: #fff;
  215. margin-top: 12px;
  216. .balanceMain-title{
  217. display: flex;
  218. align-items: center;
  219. justify-content: space-between;
  220. height: 48px;
  221. border-bottom: 1px solid #f7f7f7;
  222. padding: 0 16PX;
  223. .title{
  224. display: flex;
  225. align-items: center;
  226. span{
  227. margin-left: 8px;
  228. font-size: 16px;
  229. }
  230. }
  231. }
  232. .balanceMain-item{
  233. display: flex;
  234. align-items: center;
  235. justify-content: space-between;
  236. padding: 12px 16px;
  237. p{
  238. font-size: 12px;
  239. color:#888;
  240. margin-top: 3px;
  241. }
  242. }
  243. }
  244. </style>