paymentStatistics.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <template>
  2. <view class="column hb flex-1" >
  3. <view class="searchbox">
  4. <view class="searchbox-bar x-ac">
  5. <view :class="queryParam.type == index+1 ? 'searchbox-item searchbox-active':'searchbox-item'"
  6. v-for="(item,index) in typeOption" :key="index" @click="handleType(index+1)">{{item.label}}</view>
  7. </view>
  8. <view class="x-ac ss mt20" v-show="queryParam.type == 4">
  9. <view class="calendar-day x-c" @click="showCalendar = true"><u-icon name="calendar" color="#999"
  10. size="20"></u-icon>{{startTime}}</view>
  11. <view class="calendar-day x-c" @click="showCalendar = true"><u-icon name="calendar" color="#999"
  12. size="20"></u-icon>{{endTime}}</view>
  13. </view>
  14. </view>
  15. <view >
  16. <u-calendar :show="showCalendar" :mode="mode" @confirm="confirmCalendar" style="flex: 0; overflow: hidden;"
  17. @close="closeCalendar" :minDate="new Date().getTime()-(3600*1000*24*60)" :maxDate="new Date().getTime()"
  18. ></u-calendar>
  19. </view>
  20. <view class="justify-between p40 align-center">
  21. <view>{{PaymentData.statPeriod}}</view>
  22. <view class='base-color-6 fs24'>
  23. <text class="base-color-dark fs32">{{PaymentData.payCount}}</text>笔
  24. </view>
  25. <view>
  26. <view class='fs28 base-color-6'>收入:
  27. <text class="base-success">¥{{PaymentData.totalSales?PaymentData.totalSales:'0.00'}}</text></view>
  28. <!-- <view class='fs28 base-color-6 mt4'>退款:
  29. <text class="base-color-red ">¥{{PaymentData.totalReturn?PaymentData.totalReturn:'0.00'}}</text></view> -->
  30. </view>
  31. </view>
  32. <view class="column scrolly">
  33. <scroll-view :scroll-y="true" class="hb pb40" :refresher-enabled="isEnabled" :refresher-triggered="triggered"
  34. refresher-background="rgba(0,0,0,0)" @refresherrefresh="pullDownRefresh"
  35. @refresherrestore="triggered = false" :upper-threshold="100" :lower-threshold="100"
  36. @refresherabort="triggered = false" @scrolltolower="reachBottom">
  37. <view class="bgf p40 m4 " v-for="(item,index) in paymentList" :key="index">
  38. <!-- <view class="justify-between align-center" @click="tolineDetails(item)"> -->
  39. <view class="justify-between align-center">
  40. <view>
  41. <view class="fs28 base-color-6 mt4" v-if="item.remark">备注:{{item.remark}}</view>
  42. <view class="fs24 base-color-9">支付时间:{{item.payTime}}</view>
  43. </view>
  44. <view class="column centerV">
  45. <view class="base-success fs40 bold">{{item.payMoney.toFixed(2)}}</view>
  46. <!-- <view class="orangecol fs24" v-if="item.refundAuditStatus==0&&item.refundAuditStatus==1"
  47. >{{item.refundAuditStatus==0?'待审核':'退款中'}}</view>
  48. <view class="base-price fs24" v-if="item.refundAuditStatus==2"
  49. >{{item.refundAuditStatus==2?'已退款':''}}</view> -->
  50. </view>
  51. </view>
  52. </view>
  53. <u-loadmore :status="status" />
  54. </scroll-view>
  55. </view>
  56. </view>
  57. </template>
  58. <script>
  59. import {getPaymentList,getPaymentData} from '@/api/payment'
  60. export default {
  61. data() {
  62. return {
  63. typeOption: [{
  64. label: '今日',
  65. value: 1
  66. }, {
  67. label: '本月',
  68. value: 2
  69. }, {
  70. label: '本年',
  71. value: 3
  72. }, {
  73. label: '自定义',
  74. value: 4
  75. }],
  76. queryParam: {
  77. type: 1
  78. },
  79. showCalendar:false,
  80. mode: 'range',
  81. startTime:uni.$u.timeFormat(new Date(), 'yyyy-mm-dd'),
  82. endTime:uni.$u.timeFormat(new Date(), 'yyyy-mm-dd'),
  83. companyId:'',
  84. companyUserId:'',
  85. pageSize:12,
  86. pageNum:1,
  87. triggered: false,
  88. status: 'loadmore',
  89. isEnabled: true,
  90. paymentList:[],
  91. PaymentData:[]
  92. }
  93. },
  94. onLoad(option) {
  95. this.companyUserId=option.companyUserId
  96. this.companyId=option.companyId
  97. this.getlistDiscount()
  98. this.getPaymentDatas("refresh")
  99. },
  100. methods:{
  101. tolineDetails(item){
  102. uni.navigateTo({
  103. url:'/pages_company/order/lineDetails?paymentId='+item.paymentId
  104. })
  105. },
  106. getPaymentDatas(){
  107. const data={
  108. companyUserId:this.companyUserId,
  109. statType:this.queryParam.type,
  110. startDate:this.startTime,
  111. endDate:this.endTime,
  112. companyId:this.companyId
  113. }
  114. getPaymentData(data).then(res=>{
  115. if(res.code==200){
  116. this.PaymentData=res.data
  117. }else{
  118. uni.showToast({
  119. icon:'none',
  120. title: res.msg,
  121. });
  122. }
  123. })
  124. },
  125. handleType(type) {
  126. this.queryParam.type = type
  127. if(this.queryParam.type != 4){
  128. this.pageNum=1
  129. this.paymentList=[]
  130. this.getlistDiscount()
  131. this.getPaymentDatas("refresh")
  132. }
  133. if (this.queryParam.type == 4) {
  134. }
  135. },
  136. confirmCalendar(e) {
  137. this.startTime = e[0]
  138. this.endTime = e[e.length - 1]
  139. this.paymentList=[]
  140. this.getlistDiscount()
  141. this.getPaymentDatas("refresh")
  142. this.showCalendar = false
  143. },
  144. closeCalendar() {
  145. this.showCalendar = false
  146. },
  147. pullDownRefresh() {
  148. // 下拉刷新
  149. this.triggered = true; //下拉了状态为true
  150. setTimeout(() => {
  151. this.triggered = false;
  152. uni.stopPullDownRefresh()
  153. this.pageNum = 1;
  154. this.paymentList=[]
  155. this.getlistDiscount('refresh') //触底 不穿执行else
  156. // 请求接口里面需要判断是不是最后一页 是最后一页 status赋值为‘loadmore’没有更多了
  157. // 请求接口
  158. }, 1000)
  159. },
  160. reachBottom() {
  161. // status这个是加载状态
  162. console.log(111);
  163. if (this.status === 'loadmore') {
  164. this.status = 'loading'
  165. uni.showNavigationBarLoading()
  166. setTimeout(() => {
  167. this.pageNum++
  168. this.getlistDiscount() //触底 不穿执行else
  169. uni.hideNavigationBarLoading()
  170. }, 1000);
  171. }
  172. },
  173. getlistDiscount(type){
  174. const data={
  175. companyUserId:this.companyUserId,
  176. companyId:this.companyId,
  177. statType:this.queryParam.type,
  178. startDate:this.startTime,
  179. endDate:this.endTime,
  180. pageSize:this.pageSize,
  181. pageNum:this.pageNum
  182. }
  183. getPaymentList(data).then(res=>{
  184. if(res.code==200){
  185. // refresh 下拉
  186. if (type == 'refresh') {
  187. this.paymentList = res.data.list
  188. } else {
  189. // 加载更多 当前页和下一页合并
  190. this.paymentList = [...this.paymentList, ...res.data.list]
  191. }
  192. if (res.data.isLastPage) {
  193. this.status = 'nomore'
  194. } else {
  195. this.status = 'loadmore'
  196. }
  197. }else{
  198. uni.showToast({
  199. icon:'none',
  200. title: res.msg,
  201. });
  202. }
  203. })
  204. }
  205. }
  206. }
  207. </script>
  208. <style lang="scss" scoped>
  209. .orangecol{
  210. color: #ffa006;
  211. }
  212. .searchbox {
  213. background-color: #fff;
  214. border-radius: 8rpx 8rpx 0 0;
  215. padding: 15px;
  216. &-item {
  217. height: 23px;
  218. line-height: 23px;
  219. width: 65px;
  220. background: #f5f5f5;
  221. text-align: center;
  222. border-radius: 5px;
  223. font-family: PingFang SC, PingFang SC;
  224. font-weight: 400;
  225. font-size: 12px;
  226. color: #888;
  227. }
  228. &-active {
  229. color: #fff !important;
  230. background-color: #1677ff !important;
  231. }
  232. }
  233. </style>