anticipate.vue 8.1 KB

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