money.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. <template>
  2. <view class="center">
  3. <view class="top">
  4. <image class="top-bg" src="../../static/img/order99.png" mode=""></image>
  5. <view class="top-font">现金余额(元)</view>
  6. <view class="num">{{ userInfo.now_money || '0.00' }}</view>
  7. </view>
  8. <view class="navbar">
  9. <view class="navbar-item" @click="navTo('/pages/money/qudou')">
  10. <view class="navbar-font">
  11. <image class="navbar-image" src="../../static/img/been.png" mode=""></image>
  12. <view class="font">趣豆</view>
  13. </view>
  14. <view class="navbar-num">{{ userInfo.integral || '0.00' }}</view>
  15. </view>
  16. <view class="vvv"></view>
  17. <view class="navbar-item">
  18. <view class="navbar-font" @click="navTo('/pages/user/award')">
  19. <image class="navbar-image" src="../../static/money/m03.png" mode=""></image>
  20. <view class="font">佣金</view>
  21. </view>
  22. <view class="navbar-num">{{ userInfo.brokerage_price }}</view>
  23. </view>
  24. <view class="vvv"></view>
  25. <view class="navbar-item">
  26. <view class="navbar-font" @click="navTo('/pages/user/myAppointment')">
  27. <image class="navbar-image" src="../../static/money/m04.png" mode=""></image>
  28. <view class="font">预约券</view>
  29. </view>
  30. <view class="navbar-num">{{ userInfo.anticipate }}</view>
  31. </view>
  32. </view>
  33. <view class="content-box">
  34. <view class="content-title">
  35. <view class="title-left">
  36. <image src="../../static/money/m02.png" mode=""></image>
  37. <text>现金余额明细</text>
  38. </view>
  39. <view class="title-right">
  40. <view @tap="handleTap('picker')">{{ title }}</view>
  41. <lb-picker ref="picker" v-model="value" mode="selector" :list="typeList" :dataset="{ name: 'type' }" @confirm="handleConfirm"></lb-picker>
  42. <image src="../../static/money/m01.png" mode=""></image>
  43. </view>
  44. </view>
  45. <scroll-view scroll-y="true" class="scroll-list" :style="{'height' : height}" @scrolltolower="loadData()">
  46. <view class="list" v-for="(item, index) in list" :style="{ background: index % 2 == 0 ? '#F9F9F9' : '#fff' }">
  47. <view class="list-box">
  48. <view class="list-left">
  49. <view class="top1">{{ item.title }}</view>
  50. <view class="bottom">{{ item.add_time }}</view>
  51. </view>
  52. <view class="list-right" :style="{ color: index % 2 == 0 ? '#ff0000' : '#000000' }">{{ item.pm == 1 ? '+' : '-' }}{{ item.number }}</view>
  53. </view>
  54. </view>
  55. </scroll-view>
  56. </view>
  57. <u-tabbar activeColor="#f42b4e" v-model="current" :list="tabbar" :mid-button="true"></u-tabbar>
  58. </view>
  59. </template>
  60. <script>
  61. import { tabbar } from '@/utils/tabbar.js';
  62. import { mapState, mapMutations } from 'vuex';
  63. import LbPicker from '@/components/lb-picker';
  64. import { spreadCommission, userBalance } from '@/api/wallet.js';
  65. export default {
  66. components: {
  67. LbPicker
  68. },
  69. onReady(res) {
  70. var _this = this;
  71. uni.getSystemInfo({
  72. success: resu => {
  73. const query = uni.createSelectorQuery();
  74. query.select('.scroll-list').boundingClientRect();
  75. query.exec(function(res) {
  76. console.log(res, 'ddddddddddddd');
  77. _this.height = resu.windowHeight - res[0].top + 'px';
  78. console.log('打印页面的剩余高度', _this.height);
  79. });
  80. },
  81. fail: res => {}
  82. });
  83. },
  84. data() {
  85. return {
  86. height:'',
  87. current: 3,
  88. tabbar: tabbar,
  89. list: [],
  90. typeList: [{ title: '收入', type: 2 }, { title: '支出', type: 1 }],
  91. type: 2,
  92. title: '收入',
  93. value: '',
  94. page: 1,
  95. limit: 10,
  96. loadingType: 'more'
  97. };
  98. },
  99. computed: {
  100. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  101. },
  102. onLoad() {
  103. this.loadData();
  104. },
  105. onReachBottom() {
  106. this.loadData();
  107. },
  108. methods: {
  109. loadData() {
  110. const obj = this;
  111. if (obj.loadingType == 'nomore' || obj.loadingType == 'loading') {
  112. return;
  113. }
  114. obj.loadingType = 'loading';
  115. spreadCommission({ page: obj.page, limit: obj.limit }, obj.type).then(({ data }) => {
  116. if (data == '') {
  117. return;
  118. } else {
  119. obj.list = obj.list.concat(data[0].list);
  120. if (data[0].list.length == obj.limit) {
  121. obj.page++;
  122. } else {
  123. obj.loadingType == 'nomore';
  124. }
  125. }
  126. });
  127. },
  128. navTo(url) {
  129. uni.navigateTo({
  130. url
  131. });
  132. },
  133. handleConfirm(e) {
  134. console.log(e);
  135. this.title = e.item.title;
  136. this.type = e.item.type;
  137. this.page = 1;
  138. (this.limit = 10), (this.loadingType = 'more'), (this.list = []);
  139. this.loadData();
  140. },
  141. handleTap(name) {
  142. this.$refs[name].show();
  143. }
  144. }
  145. };
  146. </script>
  147. <style lang="less">
  148. .center {
  149. height: 100%;
  150. width: 100%;
  151. height: auto;
  152. min-height: 100%;
  153. background: #ffffff;
  154. }
  155. .top {
  156. margin: 20rpx auto 0;
  157. position: relative;
  158. width: 700rpx;
  159. height: 200rpx;
  160. padding: 54rpx 40rpx;
  161. .top-bg {
  162. position: absolute;
  163. top: 0;
  164. left: 0;
  165. right: 0;
  166. width: 700rpx;
  167. height: 200rpx;
  168. border-radius: 25rpx;
  169. }
  170. .top-font {
  171. position: relative;
  172. z-index: 2;
  173. font-size: 32rpx;
  174. font-family: PingFang SC;
  175. font-weight: bold;
  176. color: #ffffff;
  177. line-height: 1;
  178. }
  179. .num {
  180. line-height: 1;
  181. position: relative;
  182. z-index: 2;
  183. margin-top: 24rpx;
  184. font-size: 48rpx;
  185. font-family: PingFang SC;
  186. font-weight: bold;
  187. color: #ffffff;
  188. }
  189. }
  190. .navbar {
  191. display: flex;
  192. justify-content: space-around;
  193. width: 700rpx;
  194. background: #ffffff;
  195. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  196. border-radius: 20rpx;
  197. margin: 40rpx auto 0;
  198. padding: 40rpx 0 50rpx;
  199. .vvv {
  200. width: 2rpx;
  201. height: 74rpx;
  202. background: #dcdcdc;
  203. }
  204. .navbar-item {
  205. display: flex;
  206. flex-direction: column;
  207. align-items: center;
  208. .navbar-font {
  209. margin-bottom: 10rpx;
  210. display: flex;
  211. justify-content: center;
  212. align-items: center;
  213. image {
  214. margin-right: 10rpx;
  215. width: 40rpx;
  216. height: 40rpx;
  217. }
  218. .font {
  219. font-size: 30rpx;
  220. font-weight: bold;
  221. color: #0c1732;
  222. }
  223. }
  224. .navbar-num {
  225. font-size: 34rpx;
  226. font-weight: bold;
  227. color: #0c1732;
  228. }
  229. }
  230. }
  231. .content-box {
  232. margin: 0 30rpx;
  233. .content-title {
  234. margin: 50rpx 0;
  235. display: flex;
  236. justify-content: space-between;
  237. align-items: center;
  238. .title-left {
  239. image {
  240. width: 8rpx;
  241. height: 30rpx;
  242. margin-right: 10rpx;
  243. }
  244. text {
  245. font-size: 34rpx;
  246. font-weight: bold;
  247. color: #0c1732;
  248. }
  249. }
  250. .title-right {
  251. font-size: 30rpx;
  252. font-weight: 500;
  253. color: #0c1732;
  254. display: flex;
  255. align-items: center;
  256. image {
  257. margin-left: 10rpx;
  258. width: 17rpx;
  259. height: 12rpx;
  260. }
  261. }
  262. }
  263. }
  264. .list {
  265. display: flex;
  266. justify-content: space-between;
  267. align-items: center;
  268. .list-box {
  269. width: 700rpx;
  270. height: 143rpx;
  271. width: 100%;
  272. display: flex;
  273. border-radius: 10rpx;
  274. justify-content: space-between;
  275. align-items: center;
  276. margin: 0 30rpx;
  277. .list-left {
  278. height: 143rpx;
  279. display: flex;
  280. flex-direction: column;
  281. justify-content: space-around;
  282. .top1 {
  283. font-size: 30rpx;
  284. font-weight: bold;
  285. color: #0c1732;
  286. }
  287. .bottom {
  288. font-size: 26rpx;
  289. font-weight: 500;
  290. color: #999999;
  291. }
  292. }
  293. .list-right {
  294. font-size: 36rpx;
  295. font-weight: bold;
  296. color: #ea453c;
  297. }
  298. }
  299. }
  300. </style>