brokerage.vue 8.3 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.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"
  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="opendataTimeUv()">
  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='dataTimeUv' v-model="datetime" @confirm="tapConfirm" @cancel="closedataTimeUv()"
  71. @close="closedataTimeUv()" mode="year-month"></uv-datetime-picker>
  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. .money {
  191. font-weight: bold;
  192. font-size: 34rpx;
  193. color: #FF4C4C;
  194. }
  195. .balance {
  196. font-weight: 500;
  197. font-size: 24rpx;
  198. color: #979797;
  199. }
  200. }
  201. }
  202. }
  203. </style>
  204. <script>
  205. import {
  206. mapState,
  207. mapMutations
  208. } from 'vuex';
  209. export default {
  210. computed: mapState(['user']),
  211. data() {
  212. return {
  213. statusBarHeight: 20,
  214. isFirst: false,
  215. datetime: "",
  216. total: {},
  217. data: [],
  218. page: {
  219. isFirst: false,
  220. isLoad: false,
  221. isFoot: false,
  222. page: 1
  223. },
  224. form: {
  225. dateStr: "",
  226. date: "",
  227. type: "all"
  228. },
  229. navList: [{
  230. "name": "全部",
  231. "code": "all"
  232. },
  233. {
  234. "name": "收入",
  235. "code": "income"
  236. },
  237. {
  238. "name": "支出",
  239. "code": "disburse"
  240. }
  241. ]
  242. }
  243. },
  244. onLoad(options) {
  245. this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  246. this.form.dateStr = this.utils.date('Y月m日');
  247. this.form.date = this.utils.date('Y-m');
  248. this.datetime = this.utils.strtotime() * 1000;
  249. },
  250. onShow() {
  251. this.checkUserLogin({
  252. page: this,
  253. isLogion: false,
  254. fn: this.initView
  255. });
  256. },
  257. methods: {
  258. ...mapMutations(['checkUserLogin']),
  259. /**
  260. * 加载基础配置
  261. */
  262. initView: function() {
  263. this.totalData();
  264. this.getData(true);
  265. },
  266. /**
  267. * 获取数据
  268. */
  269. getData: function(isPull = false) {
  270. if (this.page.isLoad) return;
  271. this.page.isLoad = true;
  272. if (isPull) {
  273. this.page.page = 1;
  274. this.page.isLoad = false;
  275. this.page.isFoot = false;
  276. }
  277. uni.showLoading({
  278. title: '获取数据中..'
  279. });
  280. var post = {};
  281. post.page = this.page.page;
  282. this
  283. .request
  284. .post("userBrokerage", {
  285. ...this.form,
  286. page: this.page.page
  287. })
  288. .then(res => {
  289. uni.hideLoading();
  290. this.page.isFirst = true;
  291. this.page.isLoad = false;
  292. this.isFirst = true;
  293. if (isPull) {
  294. this.data = res.data.list;
  295. } else {
  296. this.data = this.data.concat(res.data.list);
  297. }
  298. //是否到底
  299. if (res.data.list.length != res.data.pageSize) {
  300. this.page.isFoot = true;
  301. }
  302. })
  303. .catch((res) => {
  304. console.log(res);
  305. uni.hideLoading();
  306. uni.showModal({
  307. title: '系统提示',
  308. content: '加载失败,返回在尝试',
  309. showCancel: false
  310. });
  311. });
  312. },
  313. totalData: function() {
  314. this
  315. .request
  316. .post("userBrokerageTotal", {
  317. ...this.form
  318. })
  319. .then(res => {
  320. if (res.code == 200) {
  321. this.total = res.data;
  322. }
  323. })
  324. },
  325. loadMoreData: function() {
  326. if (this.page.isFoot || this.page.isLoad) {
  327. return;
  328. }
  329. this.page.page++;
  330. this.getData();
  331. },
  332. tapNav: function(ev) {
  333. this.form.type = ev;
  334. this.getData(true);
  335. },
  336. tapConfirm: function(ev) {
  337. this.form.dateStr = this.utils.date('Y年m月', ev.value / 1000);
  338. this.form.date = this.utils.date('Y-m', ev.value / 1000);
  339. this.isPicker = false;
  340. this.$refs.dataTimeUv.close()
  341. this.totalData();
  342. this.getData(true);
  343. },
  344. closedataTimeUv(){
  345. this.$refs.dataTimeUv.close()
  346. },
  347. opendataTimeUv(){
  348. this.$refs.dataTimeUv.open()
  349. },
  350. tapTransfer: function() {
  351. uni.navigateTo({
  352. url: "brokerage_tx"
  353. })
  354. }
  355. },
  356. }
  357. </script>
  358. <style>
  359. </style>