recordCy.vue 3.3 KB

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