detail.vue 7.7 KB

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