brokerage.vue 8.2 KB

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