balance.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  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. if(this.carhelp.get("getElderModeClass") == "长辈模式") {
  84. this.elderStatus = true;
  85. } else {
  86. this.elderStatus = false;
  87. }
  88. },
  89. onShow(){
  90. this.getCarPersonAccount();
  91. this.getAccountRecordData();
  92. },
  93. methods: {
  94. toRefundList() {
  95. uni.navigateTo({
  96. url: '/pages/user/finance/refundList'
  97. })
  98. },
  99. getAccountRecordData() {
  100. uni.showLoading({
  101. title: "加载中",
  102. mask: true,
  103. })
  104. API.accountRecordData({
  105. queryDate: this.dateMonth
  106. }).then((res) => {
  107. uni.hideLoading();
  108. this.accountList = res.data.data;
  109. }).catch(error => {
  110. uni.showToast({
  111. title: error,
  112. icon: "none"
  113. })
  114. })
  115. },
  116. getCarPersonAccount() {
  117. uni.showLoading({
  118. title: "加载中",
  119. mask: true,
  120. })
  121. userApi.carPersonAccount().then((res) => {
  122. uni.hideLoading();
  123. this.personAccount = res.data;
  124. }).catch(error => {
  125. uni.showToast({
  126. title: error,
  127. icon: "none"
  128. })
  129. })
  130. },
  131. rechargeNow() {
  132. uni.navigateTo({
  133. url: '/pages/user/finance/recharge'
  134. })
  135. },
  136. seeAll() {
  137. uni.navigateTo({
  138. url: '/pages/user/finance/rechargeList'
  139. })
  140. }
  141. }
  142. }
  143. </script>
  144. <style lang="scss" scoped>
  145. .slot-content {
  146. font-size: 28rpx;
  147. color: $u-content-color;
  148. padding-left: 30rpx;
  149. padding-right: 30rpx;
  150. padding-top: 20px;
  151. padding-bottom: 20px;
  152. }
  153. .slot-wrap{
  154. flex: 1;
  155. }
  156. .navBtn{
  157. float: right;
  158. margin-right: 15px;
  159. color:#3fbd70;
  160. }
  161. .carNone{
  162. display: flex;
  163. flex-direction: column;
  164. justify-content: center;
  165. align-items: center;
  166. img{
  167. width: 100%;
  168. height: 100%;
  169. }
  170. p{
  171. margin-top: -60px;
  172. }
  173. }
  174. .balanceHead{
  175. background-color: #fff;
  176. padding: 16px;
  177. .balanceCard{
  178. background-color: #00B962;
  179. border-radius: 12px;
  180. padding: 16px;
  181. .balanceCard-head{
  182. font{
  183. font-size: 18px;
  184. color:#fff;
  185. margin-right: 8px;
  186. }
  187. }
  188. .balanceCard-main{
  189. display: flex;
  190. align-items: center;
  191. justify-content: space-between;
  192. margin-top: 8px;
  193. h2{
  194. font-size: 40px;
  195. color:#fff;
  196. font-weight: normal;
  197. }
  198. .balanceCard-btn{
  199. padding: 8px 20px;
  200. background-color: #fff;
  201. color:#00B962;
  202. border-radius: 18px;
  203. }
  204. }
  205. .balanceCard-foot{
  206. display: flex;
  207. margin-top: 16px;
  208. .balanceCard-item{
  209. flex: 1;
  210. color:#fff;
  211. }
  212. }
  213. }
  214. }
  215. .balanceMain{
  216. background-color: #fff;
  217. margin-top: 12px;
  218. .balanceMain-title{
  219. display: flex;
  220. align-items: center;
  221. justify-content: space-between;
  222. height: 48px;
  223. border-bottom: 1px solid #f7f7f7;
  224. padding: 0 16PX;
  225. .title{
  226. display: flex;
  227. align-items: center;
  228. span{
  229. margin-left: 8px;
  230. font-size: 16px;
  231. }
  232. }
  233. }
  234. .balanceMain-item{
  235. display: flex;
  236. align-items: center;
  237. justify-content: space-between;
  238. padding: 12px 16px;
  239. p{
  240. font-size: 12px;
  241. color:#888;
  242. margin-top: 3px;
  243. }
  244. }
  245. }
  246. </style>