bill.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <template>
  2. <view class="bill-box flex-common-css box-sizing-border iPhone-bottom">
  3. <Nav title='账单' titleColor='#333'></Nav>
  4. <view class="box-head">
  5. <view class="box-head-1">
  6. <view class="sys-size-32 view-box" :class="navId === item.id?'sys-color-black-3 sys-weight-600':'sys-color-gray-9'"
  7. v-for="(item,i) in navList" :key="i" @click="selectTo(1,item,i)">{{item.name}}</view>
  8. <view class="xian" :class="navIndex === 0?'left-1':'left-2'"></view>
  9. </view>
  10. <view class="box-head-2 box-sizing-border">
  11. <view class="date-view sys-size-28 sys-color-gray-3" @click="selectTo(2)">
  12. {{fromData.time}}
  13. <uni-icons class='ml-4' type="bottom" size="12" color="#333"></uni-icons>
  14. </view>
  15. <view class="sys-size-28 sys-color-gray-9">仅展示当月订单</view>
  16. </view>
  17. </view>
  18. <view v-if="false" class="no-view sys-size-40 sys-color-gray-9">暂无数据</view>
  19. <scroll-view v-else scroll-y="true" class="box-sizing-border list-scroll">
  20. <view class="list-box" v-for="(item,i) in list" :key="i">
  21. <image v-if="navIndex===0" src="@/static/img/wallet/j.png" mode=""></image>
  22. <image v-else src="@/static/img/wallet/bb.png" mode=""></image>
  23. <view class="box-right">
  24. <view class="box-right-1 mb-4">
  25. <view class="sys-size-32 sys-color-gray-3">收益</view>
  26. <view class="sys-size-36 sys-color-4BC285 sys-weight-600">{{item.side===1?'+':''}}{{item.amount}}</view>
  27. <!-- <view class="sys-size-36 sys-color-gray-3 sys-weight-600">-100</view> -->
  28. </view>
  29. <view class="sys-size-24 sys-color-gray-9">{{item.time}}</view>
  30. </view>
  31. </view>
  32. </scroll-view>
  33. <view class="pop-view" v-if="isPop">
  34. <view class="pop-1"></view>
  35. <view class="pop-title sys-size-32 sys-color-gray-3 sys-weight-600 sys-background-gray-f">
  36. 选择时间
  37. <uni-icons class='close-icon' type="closeempty" size="14" color="#333" @click="selectTo(2)"></uni-icons>
  38. </view>
  39. <view class="pop-list sys-background-gray-f">
  40. <view class="list-box sys-size-26" v-for="(item,i) in dateList" @click="selectTo(2,item)">{{item}}</view>
  41. </view>
  42. </view>
  43. </view>
  44. </template>
  45. <script>
  46. import tools from "@/service/tools";
  47. import {getCashFlowHistoryPage, getDailyEarnings, getMyLikeMoments} from "@/api/my";
  48. export default {
  49. data(){
  50. return{
  51. isPop:false,
  52. page:1,
  53. total:0,
  54. list:[],
  55. navId:1,
  56. navIndex:0,
  57. navList:[{name:'JM币',id:1},{name:'波点',id:2},],
  58. dateList:[],
  59. endTime:'',
  60. fromData:{
  61. time:'',
  62. },
  63. }
  64. },
  65. mounted() {
  66. this.endTime = tools.getDateYM();
  67. this.fromData.time = this.endTime;
  68. this.dateList = tools.getCustomTimeList('2020-01',this.endTime,'y-m')
  69. this.startList()
  70. },
  71. methods:{
  72. startList(){
  73. if(this.userId<=0){
  74. // return false
  75. }
  76. this.list=[]
  77. this.isAjax=false
  78. this.total=undefined
  79. this.page=1
  80. if(this.navIndex===0){
  81. this.getCashFlowHistoryPage()
  82. }else {
  83. this.getDailyEarnings()
  84. }
  85. },
  86. getDailyEarnings(){
  87. if(this.isAjax){
  88. return
  89. }
  90. this.isAjax=true
  91. let that=this
  92. getDailyEarnings({'pageNo':this.page,'pageSize':20,'month':this.fromData.time}).then((res)=>{
  93. this.isAjax=false
  94. if(res.code===0){
  95. res.data.data.forEach((item)=>{
  96. that.list.push(item )
  97. })
  98. ++that.page
  99. that.total=res.data.total
  100. }
  101. })
  102. },
  103. getCashFlowHistoryPage(){
  104. if(this.isAjax){
  105. return
  106. }
  107. this.isAjax=true
  108. let that=this
  109. getCashFlowHistoryPage({'pageNo':this.page,'pageSize':20,'month':this.fromData.time}).then((res)=>{
  110. this.isAjax=false
  111. if(res.code===0){
  112. res.data.data.forEach((item)=>{
  113. that.list.push(item )
  114. })
  115. ++that.page
  116. that.total=res.data.total
  117. }
  118. })
  119. },
  120. selectTo(type,item,i){
  121. if(type === 1){
  122. if(this.navId !== item.id){
  123. this.navId = item.id;
  124. this.navIndex = i;
  125. this.fromData.time = this.endTime;
  126. this.startList()
  127. }
  128. }else if(type === 2){
  129. if(item){
  130. this.fromData.time = item;
  131. this.startList()
  132. }
  133. this.isPop = !this.isPop;
  134. }
  135. },
  136. },
  137. }
  138. </script>
  139. <style scoped lang="scss">
  140. .bill-box{
  141. .ml-4{
  142. margin-left: 4rpx;
  143. }
  144. .mb-4{
  145. margin-bottom: 4rpx;
  146. }
  147. .pop-view{
  148. width: 100%;
  149. height: 100vh;
  150. background-color: rgba(0, 0, 0, 0.5);
  151. position: absolute;
  152. top: 0;
  153. left: 0;
  154. z-index: 201;
  155. display: flex;
  156. flex-direction: column;
  157. .pop-1{
  158. height: 30%;
  159. }
  160. .pop-title{
  161. height: 90rpx;
  162. line-height: 90rpx;
  163. text-align: center;
  164. border-bottom: 1px solid #e3e3e3;
  165. position: relative;
  166. border-radius: 16rpx 16rpx 0 0;
  167. .close-icon{
  168. position: absolute;
  169. right: 32rpx;
  170. }
  171. }
  172. .pop-list{
  173. flex: 1;
  174. overflow: auto;
  175. .list-box{
  176. height: 90rpx;
  177. line-height: 90rpx;
  178. text-align: center;
  179. border-bottom: 1px solid #e3e3e3;
  180. }
  181. }
  182. }
  183. .no-view{
  184. text-align: center;
  185. margin-top: 200rpx;
  186. }
  187. .list-scroll{
  188. flex: 1;
  189. overflow: auto;
  190. padding: 8rpx 32rpx;
  191. .list-box{
  192. box-sizing: border-box;
  193. padding: 32rpx 0;
  194. border-bottom: 1rpx solid #EEEEEE;
  195. display: flex;
  196. image{
  197. width: 96rpx;
  198. height: 96rpx;
  199. margin-right: 20rpx;
  200. }
  201. .box-right{
  202. flex: 1;
  203. .box-right-1{
  204. display: flex;
  205. justify-content: space-between;
  206. }
  207. }
  208. }
  209. }
  210. .box-head{
  211. .box-head-1{
  212. width: 100%;
  213. height: 94rpx;
  214. display: flex;
  215. position: relative;
  216. border-bottom: 1rpx solid #EEEEEE;
  217. .view-box{
  218. flex: 1;
  219. line-height: 94rpx;
  220. text-align: center;
  221. }
  222. .xian{
  223. width: 40rpx;
  224. height: 4rpx;
  225. background-color: #333;
  226. position: absolute;
  227. bottom: 0;
  228. }
  229. .left-1{
  230. left: 168rpx;
  231. transition: all 0.5s;
  232. }
  233. .left-2{
  234. left: 545rpx;
  235. transition: all 0.5s;
  236. }
  237. }
  238. .box-head-2{
  239. display: flex;
  240. justify-content: space-between;
  241. align-items: center;
  242. padding: 38rpx 32rpx 0 32rpx;
  243. .date-view{
  244. width: 200rpx;
  245. height: 56rpx;
  246. line-height: 56rpx;
  247. text-align: center;
  248. background: #F2F2F2;
  249. border-radius: 200rpx;
  250. }
  251. }
  252. }
  253. }
  254. </style>