index.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <template>
  2. <view class="account">
  3. <view class="search flex aic">
  4. <u-search placeholder="请输入充值账户" searchIconColor="#2A200A" placeholderColor="#959AA3" bgColor="#F2F3F7" v-model="searchValue" :showAction="false" maxlength="30" height="60rpx" @search="initPage"></u-search>
  5. <view class="date flex aic" @click="show = true">
  6. <text>日期</text>
  7. <re-icon name="icon-xiala" :customStyle="{ fontSize: '10rpx',marginLeft:'10rpx'}"></re-icon>
  8. </view>
  9. </view>
  10. <view class="tabulation">
  11. <mescroll-body height="100%" ref="mescrollRef" bottom="200" @init="mescrollInit" @down="downCallback" :up="upOption" @up="upCallback">
  12. <view class="list" v-if="list.length">
  13. <view class="list-item" v-for="(item,index) in list" :key="index">
  14. <view class="top flex aic jcsb">
  15. <text class="word">{{item.packageName}}</text>
  16. <text class="money">¥{{item.totalAmount}}</text>
  17. </view>
  18. <view class="btom flex-column">
  19. <text>充值账户:{{item.username || '--'}}</text>
  20. <text>有效期至:{{item.expireTime || '--'}}</text>
  21. <text>赠送用户明细:<span v-if="item.trafficSize">赠送流量{{item.trafficSize}}M</span><span v-if="item.trafficSize && item.grabTimes">+</span><span v-if="item.grabTimes">红包机会x{{item.grabTimes}}</span></text>
  22. <text>套餐金额:¥{{item.realPrice}}</text>
  23. <text>套餐折扣:{{item.deductionRatio || '--'}}</text>
  24. <text>实付金额:¥{{item.totalAmount || 0}}</text>
  25. <text>预估收益:¥{{item.deduction || 0}}</text>
  26. <text>充值时间:{{item.payTime || '--'}}</text>
  27. </view>
  28. </view>
  29. </view>
  30. <no-data :statusType="2" :top="0" tipsText="暂无数据" v-if="!isInit&&!list.length"></no-data>
  31. </mescroll-body>
  32. </view>
  33. <u-datetime-picker ref="datetimePicker" closeOnClickOverlay :show="show" v-model="value" mode="date" @confirm="confirm" @close="show = false" @cancel="show = false"></u-datetime-picker>
  34. </view>
  35. </template>
  36. <script>
  37. import MescrollMixin from "@/plugins/mescroll/components/mescroll-uni/mescroll-mixins.js"
  38. import MescrollBody from '@/plugins/mescroll/components/mescroll-uni/mescroll-uni.vue'
  39. import { getOrderPage } from '@/apis/main'
  40. export default {
  41. components: {
  42. MescrollBody
  43. },
  44. data(){
  45. return{
  46. isInit: true, // 初次进入页面
  47. show: false,
  48. searchValue:'',
  49. value: Number(new Date()),
  50. list:[],
  51. date:''
  52. }
  53. },
  54. onShow(){
  55. if(!this.isInit){
  56. this.initPage()
  57. }
  58. },
  59. mixins: [MescrollMixin],
  60. methods: {
  61. // 初始化
  62. initPage() {
  63. this.$nextTick(()=> {
  64. this.mescroll.resetUpScroll()
  65. this.mescroll.scrollTo(0, 300)
  66. })
  67. },
  68. getYMD(timestamp){
  69. let time = new Date(timestamp)
  70. let year = time.getFullYear()
  71. let month = time.getMonth() + 1
  72. let date = time.getDate()
  73. if (month < 10) { month = '0' + month }
  74. if (date < 10) { date = '0' + date }
  75. return year + '-' + month + '-' + date
  76. },
  77. confirm(e) {
  78. console.log('confirm', e)
  79. this.value = e.value
  80. this.date = this.getYMD(this.value)
  81. this.show = false
  82. // this.date = e.value[0].label
  83. this.initPage()
  84. },
  85. // 获取数据
  86. async upCallback(page){
  87. const res = await getOrderPage({
  88. current: page.num,
  89. size: page.size,
  90. username: this.searchValue,
  91. day: this.date
  92. })
  93. if (res) {
  94. //设置列表数据
  95. if (page.num === 1) { //如果是第一页需手动制空列表
  96. this.list = res.records
  97. } else {
  98. this.list = this.list.concat(res.records) //追加新数据
  99. }
  100. this.mescroll.endSuccess(res.records.length, res.total > this.list.length)
  101. }else{
  102. this.mescroll.endErr()
  103. }
  104. uni.hideLoading()
  105. this.isInit = false
  106. }
  107. },
  108. }
  109. </script>
  110. <style lang="scss" scoped>
  111. .account{
  112. height: 100%;
  113. background: #fff;
  114. display: flex;
  115. flex-direction: column;
  116. .search{
  117. padding: 12rpx 24rpx;
  118. .date{
  119. width: 112rpx;
  120. height: 48rpx;
  121. display: flex;
  122. justify-content: center;
  123. align-items: center;
  124. }
  125. }
  126. .tabulation{
  127. // flex-grow: 1;
  128. width: 100%;
  129. height: calc(100% - 43.6rpx);
  130. overflow: hidden;
  131. background: linear-gradient(360deg,#FFFFFF 60%, #FF911A 100%);
  132. padding: 24rpx 20rpx;
  133. .list{
  134. height: 100%;
  135. background: #FFFFFF;
  136. border-radius: 16rpx;
  137. padding: 32rpx;
  138. .list-item{
  139. margin-bottom: 56rpx;
  140. .top{
  141. font-size: 32rpx;
  142. .word{
  143. font-weight: 500;
  144. color: #000000;
  145. }
  146. .money{
  147. font-weight: bold;
  148. color: #EF3B24;
  149. }
  150. }
  151. .btom{
  152. margin-top: 24rpx;
  153. text{
  154. font-weight: 400;
  155. font-size: 28rpx;
  156. color: #7a7a7a;
  157. margin-bottom: 16rpx;
  158. }
  159. text:nth-last-child(1){
  160. margin-bottom: 0;
  161. }
  162. }
  163. }
  164. .list-item:nth-last-child(1){
  165. margin-bottom: 0;
  166. }
  167. }
  168. }
  169. }
  170. </style>