anticipate.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  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.anticipate || 0 }}</view>
  7. <view class="label">我的余额</view>
  8. </view>
  9. <view class="transfer fx-r fx-bc" @tap="tapTransfer">
  10. <image src="/static/img/ic_transfer.png"></image>
  11. 余额转账
  12. </view>
  13. </view>
  14. <uni-nav-bar color="#fff" :border="false" statusBar backgroundColor="transparent" left-icon="left" @clickLeft="utils.navigateBack()" fixed title="我的易趣卷"></uni-nav-bar>
  15. <view class="htop" :style="'height:calc(61vw - ' + statusBarHeight + 'px - 44px);'"></view>
  16. <view class="app-body">
  17. <!--列表数据-->
  18. <view class="nav-list fx-r fx-bc">
  19. <view class="item fx-h fx-bc" @tap="tapNav(item.code)" :class="form.type == item.code ? 'active' : ''" v-for="(item,index) in navList">
  20. <view class="label">{{ item.name }}</view>
  21. <image class="icon" v-if="form.type == item.code" src="/static/img/detail_d.png"></image>
  22. </view>
  23. <view class="fx-g1"></view>
  24. <view class="time fx-r fx-bc" @tap="isPicker = true">
  25. <view class="count">{{ form.dateStr || "" }}</view>
  26. <image class="icon" src="/static/img/detail_next.png"></image>
  27. </view>
  28. </view>
  29. <scroll-view scroll-y class="scroll" :style="'height: calc(100vh - 61vw - 100rpx);'" @scrolltolower="loadMoreData">
  30. <view class="sc-body">
  31. <view class="detail-list" v-if="data.length > 0">
  32. <view class="top fx-r">
  33. <view class="label">{{ this.form.dateStr }}</view>
  34. <view class="fx-g1"></view>
  35. <view class="label">收入:{{ this.total.inMoney || '0.00' }} 支出:{{ this.total.outMoney || '0.00' }}</view>
  36. </view>
  37. <view class="item fx-r fx-bc" v-for="(item,index) in data">
  38. <image class="icon" v-if="item.type == 0" src="/static/img/detail_in.png"></image>
  39. <image class="icon" v-if="item.type == 1" src="/static/img/detail_in.png"></image>
  40. <image class="icon" v-if="item.type == 2" src="/static/img/detail_out.png"></image>
  41. <view class="info">
  42. <view class="title">{{ item.title }}</view>
  43. <view class="tag">{{ item.content }}</view>
  44. <view class="time">{{ item.time }}</view>
  45. </view>
  46. <view class="fx-g1"></view>
  47. <view class="right fx-h">
  48. <view class="money" style="color:#e2a622;" v-if="item.type == 1">+{{item.v}}</view>
  49. <view class="money" v-if="item.type == 2">-{{item.v}}</view>
  50. <view class="fx-g1"></view>
  51. <view class="balance">余额:{{ item.money }}</view>
  52. </view>
  53. </view>
  54. </view>
  55. <view v-if="data.length > 0">
  56. <view class="loading fx-r fx-ac fx-bc" v-if="page.isFrite && !page.isFoot">
  57. <image src="/static/img/xloading.png"></image>
  58. <text>正在载入更多...</text>
  59. </view>
  60. <view class="loading complete" :hidden="!page.isFoot">已加载全部</view>
  61. </view>
  62. <u-empty
  63. v-if="data.length == 0 && isFirst"
  64. mode="data"
  65. icon="/static/img/no-empty.png"
  66. ></u-empty>
  67. </view>
  68. </scroll-view>
  69. </view>
  70. <u-datetime-picker :show="isPicker" v-model="datetime" @confirm="tapConfirm" @cancel="isPicker = false" @close="isPicker = false" mode="year-month"></u-datetime-picker>
  71. </view>
  72. </view>
  73. </template>
  74. <style lang="scss">
  75. .app-bg{
  76. position: absolute;
  77. image{width: 100vw;height: 61vw;}
  78. .body{
  79. position: absolute;
  80. height: 61vw;
  81. width: 100vw;
  82. top: 0;
  83. .count{
  84. font-weight: 500;
  85. font-size: 64rpx;
  86. color: #fff;
  87. }
  88. .label{
  89. margin-top: 4px;
  90. color: #fff;
  91. }
  92. }
  93. .transfer{
  94. position: absolute;
  95. bottom: 80rpx;
  96. right: 20rpx;
  97. color: #FFFFFF;
  98. image{
  99. width: 25px;
  100. height: 19px;
  101. margin-right: 10px;
  102. }
  103. }
  104. }
  105. .app-body{
  106. padding: 0px 20rpx;
  107. }
  108. .nav-list{
  109. height: 100rpx;
  110. .item{
  111. margin-right: 50rpx;
  112. .label{
  113. font-weight: bold;
  114. font-size: 30rpx;
  115. color: #5C5C5C;
  116. }
  117. &.active{
  118. .label{
  119. font-weight: bold;
  120. font-size: 36rpx;
  121. color: #2C2C2C;
  122. }
  123. .icon{
  124. width: 36rpx;
  125. height: 14rpx;
  126. margin-top: 4rpx;
  127. }
  128. }
  129. }
  130. .time{
  131. .count{
  132. font-weight: bold;
  133. font-size: 28rpx;
  134. color: #2C2C2C;
  135. }
  136. .label{
  137. font-weight: bold;
  138. font-size: 30rpx;
  139. color: #2C2C2C;
  140. margin-left: 6rpx;
  141. }
  142. .icon{
  143. margin-left: 10rpx;
  144. width: 20rpx;
  145. height: 12rpx;
  146. }
  147. }
  148. }
  149. .detail-list{
  150. background: #FFFFFF;
  151. border-radius: 20rpx;
  152. padding: 40rpx 30rpx;
  153. .top{
  154. margin-bottom: 40rpx;
  155. .label{font-weight: 500;font-size: 25rpx;color: #979797;}
  156. }
  157. .item{
  158. margin-bottom: 40rpx;
  159. .icon{width: 84rpx;height: 84rpx;}
  160. .info{
  161. width: calc(100% - 280rpx);
  162. margin-left: 16rpx;
  163. .title{font-weight: bold;font-size: 28rpx;color: #333333;}
  164. .tag{font-size: 24rpx;color: #979797; margin-top: 6rpx;}
  165. .time{font-size: 24rpx;color: #979797;}
  166. }
  167. .right{
  168. text-align: right;
  169. width: 160rpx;
  170. .money{
  171. font-weight: bold;
  172. font-size: 34rpx;
  173. color: #FF4C4C;
  174. }
  175. .balance{
  176. font-weight: 500;
  177. font-size: 24rpx;
  178. color: #979797;
  179. }
  180. }
  181. }
  182. }
  183. </style>
  184. <script>
  185. import {mapState,mapMutations } from 'vuex';
  186. export default {
  187. computed: mapState(['user']),
  188. data() {
  189. return {
  190. statusBarHeight : 20,
  191. isFirst:false,
  192. isPicker : false,
  193. datetime : "",
  194. total : {},
  195. data:[],
  196. page:{
  197. isFirst:false,
  198. isLoad:false,
  199. isFoot:false,
  200. page:1
  201. },
  202. form:{
  203. dateStr : "",
  204. date : "",
  205. type : "all"
  206. },
  207. navList : [
  208. {"name" : "全部","code" : "all"},
  209. {"name" : "收入","code" : "income"},
  210. {"name" : "支出","code" : "disburse"}
  211. ]
  212. }
  213. },
  214. onLoad(options) {
  215. this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  216. this.form.dateStr = this.utils.date('Y月m日');
  217. this.form.date = this.utils.date('Y-m');
  218. this.datetime = this.utils.strtotime() * 1000;
  219. },
  220. onShow() {
  221. this.initView();
  222. },
  223. methods: {
  224. ...mapMutations(['checkUserLogin']),
  225. /**
  226. * 加载基础配置
  227. */
  228. initView:function(){
  229. this.totalData();
  230. this.getData(true);
  231. },
  232. /**
  233. * 获取数据
  234. */
  235. getData:function(isPull = false){
  236. if(this.page.isLoad) return;
  237. this.page.isLoad = true;
  238. if(isPull) {
  239. this.page.page = 1;
  240. this.page.isLoad = false;
  241. this.page.isFoot = false;
  242. }
  243. uni.showLoading({ title: '获取数据中..' });
  244. var post = {};
  245. post.page = this.page.page;
  246. this
  247. .request
  248. .post("userAnticipate",{
  249. ...this.form,
  250. page : this.page.page
  251. })
  252. .then(res => {
  253. uni.hideLoading();
  254. this.page.isFirst = true;
  255. this.page.isLoad = false;
  256. this.isFirst = true;
  257. if(isPull) {
  258. this.data = res.data.list;
  259. } else {
  260. this.data = this.data.concat(res.data.list);
  261. }
  262. //是否到底
  263. if(res.data.list.length != res.data.pageSize) {
  264. this.page.isFoot = true;
  265. }
  266. })
  267. .catch((res)=>{
  268. console.log(res);
  269. uni.hideLoading();
  270. uni.showModal({title: '系统提示',content: '加载失败,返回在尝试',showCancel: false});
  271. });
  272. },
  273. totalData:function(){
  274. this
  275. .request
  276. .post("userAnticipateTotal",{
  277. ...this.form
  278. })
  279. .then(res => {
  280. if(res.code == 200) {
  281. this.total = res.data;
  282. }
  283. })
  284. },
  285. loadMoreData:function() {
  286. if(this.page.isFoot || this.page.isLoad) {
  287. return;
  288. }
  289. this.page.page ++;
  290. this.getData();
  291. },
  292. tapNav:function(ev) {
  293. this.form.type = ev;
  294. this.getData(true);
  295. },
  296. tapConfirm:function(ev) {
  297. this.form.dateStr = this.utils.date('Y年m月',ev.value / 1000);
  298. this.form.date = this.utils.date('Y-m',ev.value / 1000);
  299. this.isPicker = false;
  300. this.totalData();
  301. this.getData(true);
  302. },
  303. tapTransfer:function(){
  304. uni.navigateTo({
  305. url:"anticipate_gift"
  306. })
  307. }
  308. },
  309. }
  310. </script>
  311. <style>
  312. </style>