recordCy.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <template>
  2. <view class="page" :style="{'min-height':(h)+'px','padding-top':mt+'px'}">
  3. <c-nav-bar title="核销记录"></c-nav-bar>
  4. <view class="top">
  5. <view class="time" @click="show=true">
  6. <u-icon name="calendar" :label="dateStr" labelPos="right" labelColor="#666" color="#666" space="7px"
  7. size="25px"></u-icon>
  8. <u-icon name="arrow-down" color="#999" size="20px" style="margin-left: 20rpx;"></u-icon>
  9. </view>
  10. <view class="right">共{{totalNum}}单 收入¥{{totalAmount}}</view>
  11. </view>
  12. <view class="list">
  13. <view class="item" v-for="(item,index) in data" :key="index">
  14. <image :src="item.productImg|delArr"></image>
  15. <view class="mid">
  16. <text>{{item.productName}}</text>
  17. <text>核销时间:{{item.writeOffTime}}</text>
  18. </view>
  19. <view class="price">¥{{item.realityPay}}</view>
  20. </view>
  21. </view>
  22. <u-datetime-picker @confirm="confirmDate" @cancel="show=false" :show="show" v-model="value1"
  23. visibleItemCount="6" mode="year-month"></u-datetime-picker>
  24. </view>
  25. </template>
  26. <script>
  27. export default {
  28. data() {
  29. return {
  30. dateStr: new Date().Format('yyyy年-MM月'),
  31. date: new Date().Format('yyyy-MM'),
  32. show: false,
  33. k: '',
  34. data: [],
  35. value1: Number(new Date()),
  36. merchantId: uni.getStorageSync('merchantId'),
  37. totalAmount: 0,
  38. totalNum: 0
  39. }
  40. },
  41. filters: {
  42. delArr(val) {
  43. if (val) {
  44. return val.split(',')[0]
  45. }
  46. }
  47. },
  48. onLoad() {
  49. this.getdata();
  50. },
  51. methods: {
  52. getdata() {
  53. this.$api.post('/api/merchant/food/getMerchantFoodWriteOffList', {
  54. dateType:1,
  55. merchantId: this.merchantId,
  56. queryDate: this.date
  57. }).then(res => {
  58. if (res.data.code == 0) {
  59. this.totalAmount = res.data.data.orderAmount;
  60. this.totalNum = res.data.data.orders;
  61. this.data=res.data.data.merchantOrderDTOS;
  62. }
  63. console.log(res)
  64. })
  65. },
  66. confirmDate(e) {
  67. // 创建一个Date对象并传入时间戳
  68. const date = new Date(e.value);
  69. // 使用Date对象的方法获取年、月、日、小时、分钟和秒
  70. const year = date.getFullYear();
  71. const month = ('0' + (date.getMonth() + 1)).slice(-2);
  72. const day = ('0' + date.getDate()).slice(-2);
  73. // 格式化时间
  74. let formattedTime = "";
  75. formattedTime = `${year}-${month}`;
  76. this.dateStr = `${year}年-${month}月`
  77. this.date = formattedTime;
  78. this.show = false;
  79. this.getdata()
  80. },
  81. }
  82. }
  83. </script>
  84. <style lang="less" scoped>
  85. .page{
  86. box-sizing: border-box;
  87. }
  88. .top {
  89. padding: 24rpx 30rpx;
  90. display: flex;
  91. justify-content: space-between;
  92. align-items: center;
  93. .time {
  94. display: flex;
  95. align-items: center;
  96. gap: 0 10rpx;
  97. }
  98. .right {
  99. color: #999;
  100. font-size: 24rpx;
  101. }
  102. }
  103. .list {
  104. padding: 0 30rpx;
  105. .item {
  106. padding: 30rpx 0;
  107. border-bottom: 1rpx solid #EFEFEF;
  108. display: flex;
  109. justify-content: space-between;
  110. image {
  111. width: 136rpx;
  112. min-width: 136rpx;
  113. height: 136rpx;
  114. }
  115. .mid {
  116. margin: 0 30rpx 0 20rpx;
  117. text {
  118. display: inline-block;
  119. font-size: 28rpx;
  120. color: #777;
  121. &:first-child {
  122. font-size: 30rpx;
  123. color: #111;
  124. font-weight: bold;
  125. margin: 18rpx 0;
  126. }
  127. }
  128. }
  129. .price {
  130. font-size: 32rpx;
  131. margin-top: 10rpx;
  132. }
  133. }
  134. }
  135. </style>