integral.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  1. <template>
  2. <view>
  3. <view class="app-bg">
  4. <image src="/static/img/detail_bg.png"></image>
  5. <view class="body fx-h fx-bc fx-ac">
  6. <view class="count">{{ user.integral || 0 }}</view>
  7. <view class="label">我的余额</view>
  8. </view>
  9. <view class="fukuan" @click="fukuan" style="position: absolute;right: 30rpx;top: 180rpx;">
  10. <image src="/static/img/fukuan.png" style="width: 50rpx;height: 50rpx;"></image>
  11. </view>
  12. </view>
  13. <uni-nav-bar color="#fff" :border="false" statusBar backgroundColor="transparent" left-icon="left" @clickLeft="utils.navigateBack()" fixed title="我的趣豆"></uni-nav-bar>
  14. <view class="htop" :style="'height:calc(61vw - ' + statusBarHeight + 'px - 44px);'"></view>
  15. <view class="app-body">
  16. <view class="pannel fx-r fx-bc">
  17. <view class="item fx-h fx-bc fx-ac" @tap="tapSc">
  18. <image src="/static/img/detail_sc.png"></image>
  19. <view class="text">闪兑</view>
  20. </view>
  21. <view class="line"></view>
  22. <view class="item fx-h fx-bc fx-ac" @tap="TapZc">
  23. <image src="/static/img/detail_zc.png"></image>
  24. <view class="text">转账</view>
  25. </view>
  26. </view>
  27. <!--列表数据-->
  28. <view class="nav-list fx-r fx-bc">
  29. <view class="item fx-h fx-bc" @tap="tapNav(item.code)" :class="form.type == item.code ? 'active' : ''" v-for="(item,index) in navList">
  30. <view class="label">{{ item.name }}</view>
  31. <image class="icon" v-if="form.type == item.code" src="/static/img/detail_d.png"></image>
  32. </view>
  33. <view class="fx-g1"></view>
  34. <view class="time fx-r fx-bc" @tap="isPicker = true">
  35. <view class="count">{{ form.dateStr || "" }}</view>
  36. <image class="icon" src="/static/img/detail_next.png"></image>
  37. </view>
  38. </view>
  39. <scroll-view scroll-y class="scroll" :style="'height: calc(100vh - 61vw - 100rpx - 130rpx);'" @scrolltolower="loadMoreData">
  40. <view class="sc-body">
  41. <view class="detail-list" v-if="data.length > 0">
  42. <view class="top fx-r">
  43. <view class="label">{{ this.form.dateStr }}</view>
  44. <view class="fx-g1"></view>
  45. <view class="label">收入:{{ this.total.inMoney || '0.00' }} 支出:{{ this.total.outMoney || '0.00' }}</view>
  46. </view>
  47. <view class="item fx-r fx-bc" v-for="(item,index) in data">
  48. <image class="icon" v-if="item.type == 0" src="/static/img/detail_in.png"></image>
  49. <image class="icon" v-if="item.type == 1" src="/static/img/detail_in.png"></image>
  50. <image class="icon" v-if="item.type == 2" src="/static/img/detail_out.png"></image>
  51. <view class="info">
  52. <view class="title">{{ item.title }}</view>
  53. <view class="tag">{{ item.content }}</view>
  54. <view class="time">{{ item.time }}</view>
  55. </view>
  56. <view class="fx-g1"></view>
  57. <view class="right fx-h">
  58. <view class="money" style="color:#e2a622;" v-if="item.type == 1">+{{item.v}}</view>
  59. <view class="money" v-if="item.type == 2">-{{item.v}}</view>
  60. <view class="fx-g1"></view>
  61. <view class="balance">余额:{{ item.money }}</view>
  62. </view>
  63. </view>
  64. </view>
  65. <view v-if="data.length > 0">
  66. <view class="loading fx-r fx-ac fx-bc" v-if="page.isFrite && !page.isFoot">
  67. <image src="/static/img/xloading.png"></image>
  68. <text>正在载入更多...</text>
  69. </view>
  70. <view class="loading complete" :hidden="!page.isFoot">已加载全部</view>
  71. </view>
  72. <u-empty
  73. v-if="data.length == 0 && isFirst"
  74. mode="data"
  75. icon="/static/img/no-empty.png"
  76. ></u-empty>
  77. </view>
  78. </scroll-view>
  79. </view>
  80. <PayDialog ref="payDialog" @getPassword="getPassword"></PayDialog>
  81. <u-datetime-picker :show="isPicker" v-model="datetime" @confirm="tapConfirm" @cancel="isPicker = false" @close="isPicker = false" mode="year-month"></u-datetime-picker>
  82. <u-popup :show="payCodeShow" @close="payCodeShow = false" @open="payCodeShow = true" mode="center">
  83. <view class="codeBox">
  84. <tki-qrcode v-if="ifShow" cid="qrcode1" ref="qrcode" :val="codePay" :size="size" :unit="unit"
  85. :background="background" :foreground="foreground" :pdground="pdground"
  86. :icon="icon" :iconSize="iconsize" :lv="lv" :onval="onval" :loadMake="loadMake"
  87. :usingComponents="true" @result="qrR" />
  88. </view>
  89. </u-popup>
  90. </view>
  91. </view>
  92. </template>
  93. <style lang="scss">
  94. .codeBox{
  95. padding: 50rpx 50rpx;
  96. border-radius: 25rpx;
  97. }
  98. .app-bg{
  99. position: absolute;
  100. image{width: 100vw;height: 61vw;}
  101. .body{
  102. position: absolute;
  103. height: 61vw;
  104. width: 100vw;
  105. top: 0;
  106. .count{
  107. font-weight: 500;
  108. font-size: 64rpx;
  109. color: #fff;
  110. }
  111. .label{
  112. margin-top: 4px;
  113. color: #fff;
  114. }
  115. }
  116. }
  117. .app-body{
  118. padding: 0px 20rpx;
  119. position: relative;
  120. top: -100rpx;
  121. .pannel{
  122. background: #fff;
  123. width: calc(100% - 80rpx);
  124. margin-left: 40rpx;
  125. box-shadow: 0px 0px 20px 0px rgba(50,50,52,0.06);
  126. border-radius: 20px;
  127. padding: 40rpx 0;
  128. .item{
  129. width: calc(50% - 1px);
  130. image{width: 62rpx;height: 62rpx;}
  131. .text{
  132. font-weight: bold;
  133. font-size: 30rpx;
  134. color: #333333;
  135. margin-top: 4rpx;
  136. }
  137. }
  138. .line{
  139. width: 2rpx;
  140. height: 74rpx;
  141. background: #DCDFE6;
  142. }
  143. }
  144. }
  145. .nav-list{
  146. height: 100rpx;
  147. .item{
  148. margin-right: 50rpx;
  149. .label{
  150. font-weight: bold;
  151. font-size: 30rpx;
  152. color: #5C5C5C;
  153. }
  154. &.active{
  155. .label{
  156. font-weight: bold;
  157. font-size: 36rpx;
  158. color: #2C2C2C;
  159. }
  160. .icon{
  161. width: 36rpx;
  162. height: 14rpx;
  163. margin-top: 4rpx;
  164. }
  165. }
  166. }
  167. .time{
  168. .count{
  169. font-weight: bold;
  170. font-size: 28rpx;
  171. color: #2C2C2C;
  172. }
  173. .label{
  174. font-weight: bold;
  175. font-size: 30rpx;
  176. color: #2C2C2C;
  177. margin-left: 6rpx;
  178. }
  179. .icon{
  180. margin-left: 10rpx;
  181. width: 20rpx;
  182. height: 12rpx;
  183. }
  184. }
  185. }
  186. .detail-list{
  187. background: #FFFFFF;
  188. border-radius: 20rpx;
  189. padding: 40rpx 30rpx;
  190. .top{
  191. margin-bottom: 40rpx;
  192. .label{font-weight: 500;font-size: 25rpx;color: #979797;}
  193. }
  194. .item{
  195. margin-bottom: 40rpx;
  196. .icon{width: 84rpx;height: 84rpx;}
  197. .info{
  198. width: calc(100% - 280rpx);
  199. margin-left: 16rpx;
  200. .title{font-weight: bold;font-size: 28rpx;color: #333333;}
  201. .tag{font-size: 20rpx;color: #979797; margin-top: 6rpx;}
  202. .time{font-size: 24rpx;color: #979797;}
  203. }
  204. .right{
  205. text-align: right;
  206. width: 160rpx;
  207. .money{
  208. font-weight: bold;
  209. font-size: 34rpx;
  210. color: #FF4C4C;
  211. }
  212. .balance{
  213. font-weight: 500;
  214. font-size: 24rpx;
  215. color: #979797;
  216. }
  217. }
  218. }
  219. }
  220. </style>
  221. <script>
  222. import PayDialog from "@/components/ui-pay/payDialog.vue";
  223. import tkiQrcode from '@/components/tki-qrcode/tki-qrcode.vue'
  224. import {mapState,mapMutations } from 'vuex';
  225. export default {
  226. components:{
  227. PayDialog,
  228. tkiQrcode
  229. },
  230. computed: mapState(['user']),
  231. data() {
  232. return {
  233. statusBarHeight : 20,
  234. isFirst:false,
  235. isPicker : false,
  236. datetime : "",
  237. total : {},
  238. data:[],
  239. page:{
  240. isFirst:false,
  241. isLoad:false,
  242. isFoot:false,
  243. page:1
  244. },
  245. form:{
  246. dateStr : "",
  247. date : "",
  248. type : "all"
  249. },
  250. navList : [
  251. {"name" : "全部","code" : "all"},
  252. {"name" : "收入","code" : "income"},
  253. {"name" : "支出","code" : "disburse"}
  254. ],
  255. codePay:'',//付款码 // 要生成的二维码值
  256. payCodeShow:false,//付款码弹窗
  257. ifShow: true,
  258. size: 400, // 二维码大小
  259. unit: 'upx', // 单位
  260. background: '#fff', // 背景色
  261. foreground: '', // 前景色
  262. pdground: '#FF4C4C', // 角标色
  263. icon: '', // 二维码图标
  264. iconsize: 40, // 二维码图标大小
  265. lv: 3, // 二维码容错级别 , 一般不用设置,默认就行
  266. onval: false, // val值变化时自动重新生成二维码
  267. loadMake: true, // 组件加载完成后自动生成二维码
  268. src: '' // 二维码生成后的图片地址或base64
  269. }
  270. },
  271. onLoad(options) {
  272. this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  273. this.form.dateStr = this.utils.date('Y月m日');
  274. this.form.date = this.utils.date('Y-m');
  275. this.datetime = this.utils.strtotime() * 1000;
  276. },
  277. onShow() {
  278. this.initView();
  279. },
  280. methods: {
  281. ...mapMutations(['checkUserLogin']),
  282. /**
  283. * 加载基础配置
  284. */
  285. initView:function(){
  286. this.totalData();
  287. this.getData(true);
  288. },
  289. fukuan(){
  290. this.$refs['payDialog'].show();
  291. },
  292. getPassword(val){
  293. let obj = this
  294. var password = val.password;
  295. obj.request.post("tradeCode",{
  296. payment: password,
  297. }).then(res => {
  298. if(res.code == 200) {
  299. obj.$refs['payDialog'].cleanNum();
  300. obj.$refs['payDialog'].hideFun();
  301. obj.payCodeShow = true
  302. obj.codePay = res.data.rand_code
  303. if(obj.codePay){
  304. setTimeout(function () {
  305. obj.$refs.qrcode._makeCode()
  306. }, 1000);
  307. }
  308. }else{
  309. obj.$refs['payDialog'].cleanNum();
  310. obj.$refs['payDialog'].hideFun();
  311. uni.showModal({title: '系统提示',content: res.msg,showCancel: false});
  312. }
  313. })
  314. },
  315. qrR(res) {
  316. this.src = res
  317. },
  318. /**
  319. * 获取数据
  320. */
  321. getData:function(isPull = false){
  322. if(this.page.isLoad) return;
  323. this.page.isLoad = true;
  324. if(isPull) {
  325. this.page.page = 1;
  326. this.page.isLoad = false;
  327. this.page.isFoot = false;
  328. }
  329. uni.showLoading({ title: '获取数据中..' });
  330. var post = {};
  331. post.page = this.page.page;
  332. this
  333. .request
  334. .post("userIntegral",{
  335. ...this.form,
  336. page : this.page.page
  337. })
  338. .then(res => {
  339. uni.hideLoading();
  340. this.page.isFirst = true;
  341. this.page.isLoad = false;
  342. this.isFirst = true;
  343. if(isPull) {
  344. this.data = res.data.list;
  345. } else {
  346. this.data = this.data.concat(res.data.list);
  347. }
  348. //是否到底
  349. if(res.data.list.length != res.data.pageSize) {
  350. this.page.isFoot = true;
  351. }
  352. })
  353. .catch((res)=>{
  354. console.log(res);
  355. uni.hideLoading();
  356. uni.showModal({title: '系统提示',content: '加载失败,返回在尝试',showCancel: false});
  357. });
  358. },
  359. totalData:function(){
  360. this
  361. .request
  362. .post("userIntegralTotal",{
  363. ...this.form
  364. })
  365. .then(res => {
  366. if(res.code == 200) {
  367. this.total = res.data;
  368. }
  369. })
  370. },
  371. loadMoreData:function() {
  372. if(this.page.isFoot || this.page.isLoad) {
  373. return;
  374. }
  375. this.page.page ++;
  376. this.getData();
  377. },
  378. tapNav:function(ev) {
  379. this.form.type = ev;
  380. this.getData(true);
  381. },
  382. tapConfirm:function(ev) {
  383. this.form.dateStr = this.utils.date('Y年m月',ev.value / 1000);
  384. this.form.date = this.utils.date('Y-m',ev.value / 1000);
  385. this.isPicker = false;
  386. this.totalData();
  387. this.getData(true);
  388. },
  389. tapSc:function(){
  390. uni.navigateTo({
  391. url:"/pages/user/detail/integral_sc"
  392. })
  393. },
  394. /**
  395. * 趣豆转账
  396. */
  397. TapZc:function(){
  398. uni.navigateTo({
  399. url:"/pages/user/detail/integral_gift"
  400. })
  401. }
  402. },
  403. }
  404. </script>