wallet.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <view>
  3. <cu-custom bgColor="bg-luohu" :isBack="true">
  4. <block slot="backText">返回</block>
  5. <block slot="content">我的钱包</block>
  6. </cu-custom>
  7. <view>
  8. <view class="card-wrap">
  9. <view class="card">
  10. <view class="card-title">
  11. <view class="left">我的余额</view>
  12. <view class="right">
  13. <u-icon name="/static/icon/qrcode.png" size="40"></u-icon>
  14. </view>
  15. </view>
  16. <view class="amount-wrap">
  17. <view class="amount">
  18. <u-count-to :start-val="0" :end-val="monkey" :decimals="2" color="#FFFFFF"></u-count-to>
  19. <!-- {{monkey}} -->
  20. <text class="unit">元</text>
  21. </view>
  22. <!-- <view class="fewAmount">=¥34,087.8452</view> -->
  23. </view>
  24. <view class="buttom">最近刷新时间:{{time}}</view>
  25. </view>
  26. </view>
  27. </view>
  28. <view>
  29. <view class="list-wrap">
  30. <view class="list-top">
  31. <view class="topBox1" :class="showIndex == 0 ? 'show' : ''" @click="showClick(0)">充值</view>
  32. <view class="topBox2" :class="showIndex == 1 ? 'show' : ''" @click="showClick(1)">扣除</view>
  33. </view>
  34. <scroll-view :scroll-y="true" class="scroll">
  35. <view class="csrBox" v-for="(item,index) in monkeyList" :key="index">
  36. <view class="img">
  37. <image src="../../static/chong.png" v-if="showIndex == 0"></image>
  38. <image src="../../static/kou.png" v-if="showIndex == 1"></image>
  39. </view>
  40. <view class="content">
  41. <view class="left">
  42. <view v-if="showIndex == 0">
  43. <view>支付方式:{{item.chong_zhi_fang_sh || '其他'}}</view>
  44. <view class="time">充值时间:{{setTime(item.create_time_)}}</view>
  45. </view>
  46. <view v-if="showIndex == 1">
  47. <view>委托单:{{item.wei_tuo_dan_hao_}}</view>
  48. <view class="time">扣除时间:{{setTime(item.create_time_)}}</view>
  49. </view>
  50. </view>
  51. <view class="right">
  52. <view v-if="showIndex == 0">+{{item.chong_zhi_jin_e_}}</view>
  53. <view v-if="showIndex == 1">-{{item.kou_fei_jin_e_}}</view>
  54. </view>
  55. </view>
  56. </view>
  57. </scroll-view>
  58. </view>
  59. </view>
  60. </view>
  61. </template>
  62. <script>
  63. import {
  64. ACCESS_TOKEN,
  65. USER_NAME,
  66. USER_INFO
  67. } from "@/common/util/constants" // 拉取登录token,userName,userInfo
  68. import http from '@/common/service/http.js'
  69. import md5 from "@/common/util/md5.js"
  70. export default {
  71. data() {
  72. return {
  73. showIndex: 0,
  74. time: '',
  75. monkey: '0.00',
  76. monkeyList: []
  77. }
  78. },
  79. filters: {
  80. },
  81. created() {
  82. this.getInit()
  83. this.getYuE()
  84. this.getChong()
  85. },
  86. methods: {
  87. getInit() {
  88. var nowDate = new Date((new Date).getTime() + 8 * 60 * 60 * 1000)
  89. var time = nowDate.toJSON().split('T').join(' ').substr(0, 16);
  90. this.time = time
  91. },
  92. setTime(value) {
  93. let time = this.$dayjs(value).format('YYYY-MM-DD HH:mm:ss')
  94. return time
  95. },
  96. //充值和扣除切换
  97. showClick(index) {
  98. this.showIndex = index
  99. this.monkeyList = []
  100. if (index == 0) {
  101. this.getChong()
  102. } else {
  103. this.getKou()
  104. }
  105. },
  106. getYuE() {
  107. let info = uni.getStorageSync(USER_INFO);
  108. let useId = info.user.id
  109. let sql =
  110. `select * from t_khqb where xuan_ze_ke_hu_ = '${useId}' order by create_time_ desc limit 1`
  111. let requestData = this.$sig(sql)
  112. this.$http.post("/ibps/business/v3/sys/universal/inputSqlSelectData", requestData).then(res => {
  113. if (res.data.state == 200) {
  114. const datas = res.data.variables.data
  115. if (datas.length > 0) {
  116. this.monkey = (parseFloat(datas[0].zhang_hu_yu_e_ || 0)).toFixed(2) || '0.00'
  117. } else {
  118. this.monkey = '0.00'
  119. }
  120. }
  121. })
  122. },
  123. getChong() {
  124. let info = uni.getStorageSync(USER_INFO);
  125. let useId = info.user.id
  126. let sql =
  127. `select tc.* from t_czjl tc left join t_khqb tk on tc.parent_id_ = tk.id_ where tk.xuan_ze_ke_hu_ = '${useId}' order by tc.create_time_ desc`
  128. let requestData = this.$sig(sql)
  129. this.$http.post("/ibps/business/v3/sys/universal/inputSqlSelectData", requestData).then(res => {
  130. if (res.data.state == 200) {
  131. const datas = res.data.variables.data
  132. if (datas.length > 0) {
  133. this.monkeyList = datas
  134. }
  135. }
  136. })
  137. },
  138. getKou() {
  139. let info = uni.getStorageSync(USER_INFO);
  140. let useId = info.user.id
  141. let sql =
  142. `select tc.* from t_kfjl tc left join t_khqb tk on tc.parent_id_ = tk.id_ where tk.xuan_ze_ke_hu_ = '${useId}' order by tc.create_time_ desc`
  143. let requestData = this.$sig(sql)
  144. this.$http.post("/ibps/business/v3/sys/universal/inputSqlSelectData", requestData).then(res => {
  145. if (res.data.state == 200) {
  146. const datas = res.data.variables.data
  147. if (datas.length > 0) {
  148. this.monkeyList = datas
  149. }
  150. }
  151. })
  152. }
  153. }
  154. }
  155. </script>
  156. <style lang="scss" scoped>
  157. .card-wrap {
  158. display: flex;
  159. justify-content: center;
  160. .card {
  161. // width: 650rpx;
  162. width: 100%;
  163. height: 350rpx;
  164. margin: 20rpx;
  165. background: linear-gradient(to right, #4c9fff, #2f72ff);
  166. // background-color: $uni-bg-assist;
  167. border-radius: 18rpx;
  168. // box-shadow: 0 2px 12px 0 rgba(56, 130, 255, 0.6);
  169. color: #ffffff;
  170. padding: 40rpx;
  171. .card-title {
  172. display: flex;
  173. justify-content: space-between;
  174. }
  175. .amount-wrap {
  176. margin-top: 20rpx;
  177. .amount {
  178. font-size: 52rpx;
  179. display: flex;
  180. .unit {
  181. font-size: 28rpx;
  182. margin-top: 10rpx;
  183. margin-left: 20rpx;
  184. }
  185. }
  186. .fewAmount {
  187. margin-top: 20rpx;
  188. font-size: 28rpx;
  189. }
  190. }
  191. .buttom {
  192. margin-top: 100rpx;
  193. font-size: 28rpx;
  194. color: #ffffff;
  195. }
  196. }
  197. }
  198. .list-wrap {
  199. width: calc(100% - 40rpx);
  200. background: #ffffff;
  201. border-radius: 18rpx 18rpx 0 0;
  202. position: fixed;
  203. bottom: 0rpx;
  204. top: 480rpx;
  205. left: 20rpx;
  206. right: 20rpx;
  207. .list-top {
  208. border-radius: 18rpx 18rpx 0 0;
  209. display: flex;
  210. align-items: center;
  211. justify-content: space-between;
  212. .topBox1 {
  213. text-align: center;
  214. width: 100%;
  215. background-color: #4c9fff;
  216. border-radius: 18rpx 0 0 0;
  217. padding: 20rpx 0;
  218. color: #ffffff;
  219. }
  220. .topBox2 {
  221. text-align: center;
  222. width: 100%;
  223. background-color: #4c9fff;
  224. border-radius: 0 18rpx 0 0;
  225. padding: 20rpx 0;
  226. color: #ffffff;
  227. }
  228. }
  229. .scroll {
  230. height: calc(100% - 80rpx);
  231. .csrBox {
  232. display: flex;
  233. align-items: center;
  234. padding: 15rpx 0 15rpx 15rpx;
  235. .img {
  236. margin-right: 15rpx;
  237. image {
  238. width: 40rpx;
  239. height: 40rpx;
  240. }
  241. }
  242. .content {
  243. width: 100%;
  244. display: flex;
  245. align-items: center;
  246. justify-content: space-between;
  247. border-bottom: 1rpx #F5F5F5 solid;
  248. .left {
  249. font-weight: 500;
  250. font-size: 28rpx;
  251. line-height: 40rpx;
  252. .time {
  253. line-height: 45rpx;
  254. font-size: 24rpx;
  255. color: #C0C0C0;
  256. }
  257. }
  258. .right {
  259. font-weight: 500;
  260. margin-right: 15rpx;
  261. }
  262. }
  263. }
  264. }
  265. }
  266. .show {
  267. background-color: #ffffff !important;
  268. color: #2f72ff !important;
  269. }
  270. </style>