detail.vue 7.8 KB

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