brokerage.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  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.brokerage_price || 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. .money{
  170. font-weight: bold;
  171. font-size: 34rpx;
  172. color: #FF4C4C;
  173. }
  174. .balance{
  175. font-weight: 500;
  176. font-size: 24rpx;
  177. color: #979797;
  178. }
  179. }
  180. }
  181. }
  182. </style>
  183. <script>
  184. import {mapState,mapMutations } from 'vuex';
  185. export default {
  186. computed: mapState(['user']),
  187. data() {
  188. return {
  189. statusBarHeight : 20,
  190. isFirst:false,
  191. isPicker : false,
  192. datetime : "",
  193. total : {},
  194. data:[],
  195. page:{
  196. isFirst:false,
  197. isLoad:false,
  198. isFoot:false,
  199. page:1
  200. },
  201. form:{
  202. dateStr : "",
  203. date : "",
  204. type : "all"
  205. },
  206. navList : [
  207. {"name" : "全部","code" : "all"},
  208. {"name" : "收入","code" : "income"},
  209. {"name" : "支出","code" : "disburse"}
  210. ]
  211. }
  212. },
  213. onLoad(options) {
  214. this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  215. this.form.dateStr = this.utils.date('Y月m日');
  216. this.form.date = this.utils.date('Y-m');
  217. this.datetime = this.utils.strtotime() * 1000;
  218. },
  219. onShow() {
  220. this.checkUserLogin({ page: this,isLogion: false,fn:this.initView});
  221. },
  222. methods: {
  223. ...mapMutations(['checkUserLogin']),
  224. /**
  225. * 加载基础配置
  226. */
  227. initView:function(){
  228. this.totalData();
  229. this.getData(true);
  230. },
  231. /**
  232. * 获取数据
  233. */
  234. getData:function(isPull = false){
  235. if(this.page.isLoad) return;
  236. this.page.isLoad = true;
  237. if(isPull) {
  238. this.page.page = 1;
  239. this.page.isLoad = false;
  240. this.page.isFoot = false;
  241. }
  242. uni.showLoading({ title: '获取数据中..' });
  243. var post = {};
  244. post.page = this.page.page;
  245. this
  246. .request
  247. .post("userBrokerage",{
  248. ...this.form,
  249. page : this.page.page
  250. })
  251. .then(res => {
  252. uni.hideLoading();
  253. this.page.isFirst = true;
  254. this.page.isLoad = false;
  255. this.isFirst = true;
  256. if(isPull) {
  257. this.data = res.data.list;
  258. } else {
  259. this.data = this.data.concat(res.data.list);
  260. }
  261. //是否到底
  262. if(res.data.list.length != res.data.pageSize) {
  263. this.page.isFoot = true;
  264. }
  265. })
  266. .catch((res)=>{
  267. console.log(res);
  268. uni.hideLoading();
  269. uni.showModal({title: '系统提示',content: '加载失败,返回在尝试',showCancel: false});
  270. });
  271. },
  272. totalData:function(){
  273. this
  274. .request
  275. .post("userBrokerageTotal",{
  276. ...this.form
  277. })
  278. .then(res => {
  279. if(res.code == 200) {
  280. this.total = res.data;
  281. }
  282. })
  283. },
  284. loadMoreData:function() {
  285. if(this.page.isFoot || this.page.isLoad) {
  286. return;
  287. }
  288. this.page.page ++;
  289. this.getData();
  290. },
  291. tapNav:function(ev) {
  292. this.form.type = ev;
  293. this.getData(true);
  294. },
  295. tapConfirm:function(ev) {
  296. this.form.dateStr = this.utils.date('Y年m月',ev.value / 1000);
  297. this.form.date = this.utils.date('Y-m',ev.value / 1000);
  298. this.isPicker = false;
  299. this.totalData();
  300. this.getData(true);
  301. },
  302. tapTransfer:function(){
  303. uni.navigateTo({
  304. url:"brokerage_tx"
  305. })
  306. }
  307. },
  308. }
  309. </script>
  310. <style>
  311. </style>