index.vue 6.6 KB

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