balance.vue 8.2 KB

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