money.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  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. methods: {
  106. loadData() {
  107. const obj = this;
  108. if (obj.loadingType == 'nomore' || obj.loadingType == 'loading') {
  109. return;
  110. }
  111. obj.loadingType = 'loading';
  112. spreadCommission({ page: obj.page, limit: obj.limit }, obj.type).then(({ data }) => {
  113. if (data == '') {
  114. return;
  115. } else {
  116. obj.list = obj.list.concat(data[0].list);
  117. if (data[0].list.length == obj.limit) {
  118. obj.page++;
  119. } else {
  120. obj.loadingType == 'nomore';
  121. }
  122. }
  123. });
  124. },
  125. navTo(url) {
  126. uni.navigateTo({
  127. url
  128. });
  129. },
  130. handleConfirm(e) {
  131. console.log(e);
  132. this.title = e.item.title;
  133. this.type = e.item.type;
  134. this.page = 1;
  135. (this.limit = 10), (this.loadingType = 'more'), (this.list = []);
  136. this.loadData();
  137. },
  138. handleTap(name) {
  139. this.$refs[name].show();
  140. }
  141. }
  142. };
  143. </script>
  144. <style lang="less">
  145. .center {
  146. height: 100%;
  147. width: 100%;
  148. height: auto;
  149. min-height: 100%;
  150. background: #ffffff;
  151. }
  152. .top {
  153. margin: 20rpx auto 0;
  154. position: relative;
  155. width: 700rpx;
  156. height: 200rpx;
  157. padding: 54rpx 40rpx;
  158. .top-bg {
  159. position: absolute;
  160. top: 0;
  161. left: 0;
  162. right: 0;
  163. width: 700rpx;
  164. height: 200rpx;
  165. border-radius: 25rpx;
  166. }
  167. .top-font {
  168. position: relative;
  169. z-index: 2;
  170. font-size: 32rpx;
  171. font-family: PingFang SC;
  172. font-weight: bold;
  173. color: #ffffff;
  174. line-height: 1;
  175. }
  176. .num {
  177. line-height: 1;
  178. position: relative;
  179. z-index: 2;
  180. margin-top: 24rpx;
  181. font-size: 48rpx;
  182. font-family: PingFang SC;
  183. font-weight: bold;
  184. color: #ffffff;
  185. }
  186. }
  187. .navbar {
  188. display: flex;
  189. justify-content: space-around;
  190. width: 700rpx;
  191. background: #ffffff;
  192. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  193. border-radius: 20rpx;
  194. margin: 40rpx auto 0;
  195. padding: 40rpx 0 50rpx;
  196. .vvv {
  197. width: 2rpx;
  198. height: 74rpx;
  199. background: #dcdcdc;
  200. }
  201. .navbar-item {
  202. display: flex;
  203. flex-direction: column;
  204. align-items: center;
  205. .navbar-font {
  206. margin-bottom: 10rpx;
  207. display: flex;
  208. justify-content: center;
  209. align-items: center;
  210. image {
  211. margin-right: 10rpx;
  212. width: 40rpx;
  213. height: 40rpx;
  214. }
  215. .font {
  216. font-size: 30rpx;
  217. font-weight: bold;
  218. color: #0c1732;
  219. }
  220. }
  221. .navbar-num {
  222. font-size: 34rpx;
  223. font-weight: bold;
  224. color: #0c1732;
  225. }
  226. }
  227. }
  228. .content-box {
  229. margin: 0 30rpx;
  230. .content-title {
  231. margin: 50rpx 0;
  232. display: flex;
  233. justify-content: space-between;
  234. align-items: center;
  235. .title-left {
  236. image {
  237. width: 8rpx;
  238. height: 30rpx;
  239. margin-right: 10rpx;
  240. }
  241. text {
  242. font-size: 34rpx;
  243. font-weight: bold;
  244. color: #0c1732;
  245. }
  246. }
  247. .title-right {
  248. font-size: 30rpx;
  249. font-weight: 500;
  250. color: #0c1732;
  251. display: flex;
  252. align-items: center;
  253. image {
  254. margin-left: 10rpx;
  255. width: 17rpx;
  256. height: 12rpx;
  257. }
  258. }
  259. }
  260. }
  261. .list {
  262. display: flex;
  263. justify-content: space-between;
  264. align-items: center;
  265. .list-box {
  266. width: 700rpx;
  267. height: 143rpx;
  268. width: 100%;
  269. display: flex;
  270. border-radius: 10rpx;
  271. justify-content: space-between;
  272. align-items: center;
  273. margin: 0 30rpx;
  274. .list-left {
  275. height: 143rpx;
  276. display: flex;
  277. flex-direction: column;
  278. justify-content: space-around;
  279. .top1 {
  280. font-size: 30rpx;
  281. font-weight: bold;
  282. color: #0c1732;
  283. }
  284. .bottom {
  285. font-size: 26rpx;
  286. font-weight: 500;
  287. color: #999999;
  288. }
  289. }
  290. .list-right {
  291. font-size: 36rpx;
  292. font-weight: bold;
  293. color: #ea453c;
  294. }
  295. }
  296. }
  297. </style>