record.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  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 style="display: flex;align-items: center;">
  6. <view class="time" @click="show=true">
  7. <u-icon name="calendar" :label="dateStr" labelPos="right" labelColor="#666" color="#666" space="3px"
  8. size="25px"></u-icon>
  9. <u-icon name="arrow-right" color="#999" size="32rpx" style="margin:2rpx 0 0 20rpx;"></u-icon>
  10. </view>
  11. <view style="margin: 0 14rpx 0 10rpx;font-size: 30rpx;color: #666;">至</view>
  12. <view class="time" @click="show2=true">
  13. <u-icon :label="dateStr2" labelPos="right" labelColor="#666" color="#666" space="3px"
  14. size="25px"></u-icon>
  15. <u-icon name="arrow-right" color="#999" size="32rpx"></u-icon>
  16. </view>
  17. </view>
  18. <view class="right">共{{totalNum}}单 收入¥{{totalAmount}}</view>
  19. </view>
  20. <view class="list">
  21. <block v-if="data.length>0">
  22. <view class="item" v-for="(item,index) in data" :key="index" @tap="toDetails(item)">
  23. <image :src="item.orderType==2?'../../static/bao.png':'../../static/pin.png'"></image>
  24. <view class="mid">
  25. <text>{{item.playDate}}
  26. {{item.playTime}}出发/{{item.orderType==2?'包船':'拼船'}}/{{item.boatNo}}</text>
  27. <text>{{item.num}}人 · 出游{{item.playLength}}小时</text>
  28. <text>上船时间:{{item.updateDate}}</text>
  29. </view>
  30. <view class="price">¥{{item.realPrice}}</view>
  31. </view>
  32. </block>
  33. <block v-else>
  34. <NoData />
  35. </block>
  36. </view>
  37. <u-datetime-picker @confirm="confirmDate" @cancel="show=false" :show="show" v-model="value1"
  38. visibleItemCount="6" mode="date"></u-datetime-picker>
  39. <u-datetime-picker @confirm="confirmDate2" @cancel="show2=false" :show="show2" v-model="value2"
  40. visibleItemCount="6" mode="date"></u-datetime-picker>
  41. </view>
  42. </template>
  43. <script>
  44. export default {
  45. data() {
  46. return {
  47. dateStr: new Date().Format('yyyy-MM-dd'),
  48. dateStr2: new Date().Format('yyyy-MM-dd'),
  49. date: new Date().Format('yyyy-MM-dd'),
  50. date2: new Date().Format('yyyy-MM-dd'),
  51. show: false,
  52. show2: false,
  53. k: '',
  54. data: [],
  55. value1: Number(new Date()),
  56. value2: Number(new Date()),
  57. merchantId: uni.getStorageSync('merchantId'),
  58. totalAmount: 0,
  59. totalNum: 0
  60. }
  61. },
  62. onLoad() {
  63. this.getdata();
  64. },
  65. methods: {
  66. getdata() {
  67. this.$api.get('/scenic/api/order/writeOffRecordPage', {
  68. limit: 50,
  69. page: 1,
  70. merchantId: this.merchantId,
  71. // queryDate: this.date,
  72. startDate: this.date,
  73. endDate: this.date2
  74. }).then(res => {
  75. if (res.data.code == 0) {
  76. // this.totalAmount = res.data.data.totalAmount;
  77. this.totalNum = res.data.data.totalNum;
  78. this.data = res.data.data.pageData.list;
  79. var num = res.data.data.totalAmount.toString(); // 转成字符串类型 如能确定类型 这步可省去
  80. if (num.indexOf(".") !== -1) {
  81. let [integerPart, decimalPart] = num.split(".");
  82. if (decimalPart.length > 2) {
  83. decimalPart = decimalPart.substring(0, 2);
  84. } else if (decimalPart.length === 1) {
  85. decimalPart += "0";
  86. }
  87. num = `${integerPart}.${decimalPart}`;
  88. } else {
  89. num += ".00";
  90. }
  91. console.log(num);
  92. this.totalAmount = num
  93. return num;
  94. }
  95. })
  96. },
  97. confirmDate(e) {
  98. // 创建一个Date对象并传入时间戳
  99. const date = new Date(e.value);
  100. // 使用Date对象的方法获取年、月、日、小时、分钟和秒
  101. const year = date.getFullYear();
  102. const month = ('0' + (date.getMonth() + 1)).slice(-2);
  103. const day = ('0' + date.getDate()).slice(-2);
  104. // 格式化时间
  105. let formattedTime = "";
  106. formattedTime = `${year}-${month}-${day}`;
  107. if (Date.parse(formattedTime) - Date.parse(this.date2) > 0) {
  108. return this.$showToast('开始日期不能大于结束日期');
  109. }
  110. this.dateStr = `${year}-${month}-${day}`
  111. this.date = formattedTime;
  112. this.show = false;
  113. this.getdata()
  114. },
  115. confirmDate2(e) {
  116. // 创建一个Date对象并传入时间戳
  117. const date = new Date(e.value);
  118. // 使用Date对象的方法获取年、月、日、小时、分钟和秒
  119. const year = date.getFullYear();
  120. const month = ('0' + (date.getMonth() + 1)).slice(-2);
  121. const day = ('0' + date.getDate()).slice(-2);
  122. // 格式化时间
  123. let formattedTime = "";
  124. formattedTime = `${year}-${month}-${day}`;
  125. if (Date.parse(formattedTime) - Date.parse(this.date) < 0) {
  126. return this.$showToast('结束日期不能小于开始日期');
  127. }
  128. this.dateStr2 = `${year}-${month}-${day}`
  129. this.date2 = formattedTime;
  130. this.show2 = false;
  131. this.getdata()
  132. },
  133. toDetails(item) {
  134. uni.navigateTo({
  135. url: '/pagesHouse/Verification/recordDetails?orderCode=' + item.orderCode
  136. })
  137. }
  138. }
  139. }
  140. </script>
  141. <style lang="less" scoped>
  142. /deep/ .uicon-arrow-right {
  143. margin-top: 4rpx !important;
  144. }
  145. .page {
  146. box-sizing: border-box;
  147. }
  148. .top {
  149. padding: 24rpx 30rpx;
  150. .time {
  151. display: flex;
  152. align-items: center;
  153. gap: 0 10rpx;
  154. }
  155. .right {
  156. color: #999;
  157. font-size: 24rpx;
  158. margin-top: 10rpx;
  159. margin-left: 6rpx;
  160. }
  161. }
  162. .list {
  163. padding: 0 30rpx;
  164. .item {
  165. padding: 30rpx 0;
  166. border-bottom: 1rpx solid #EFEFEF;
  167. display: flex;
  168. justify-content: space-between;
  169. image {
  170. width: 80rpx;
  171. min-width: 80rpx;
  172. height: 80rpx;
  173. }
  174. .mid {
  175. margin: 0 30rpx 0 20rpx;
  176. text {
  177. display: inline-block;
  178. font-size: 28rpx;
  179. color: #777;
  180. &:first-child {
  181. font-size: 30rpx;
  182. color: #111;
  183. font-weight: bold;
  184. }
  185. &:nth-child(2) {
  186. margin: 18rpx 0;
  187. }
  188. }
  189. }
  190. .price {
  191. font-size: 32rpx;
  192. }
  193. }
  194. }
  195. </style>