123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216 |
- <template>
- <view class="page" :style="{'min-height':(h)+'px','padding-top':mt+'px'}">
- <c-nav-bar title="核销记录"></c-nav-bar>
- <view class="top">
- <view style="display: flex;align-items: center;">
- <view class="time" @click="show=true">
- <u-icon name="calendar" :label="dateStr" labelPos="right" labelColor="#666" color="#666" space="3px"
- size="25px"></u-icon>
- <u-icon name="arrow-right" color="#999" size="32rpx" style="margin:2rpx 0 0 20rpx;"></u-icon>
- </view>
- <view style="margin: 0 14rpx 0 10rpx;font-size: 30rpx;color: #666;">至</view>
- <view class="time" @click="show2=true">
- <u-icon :label="dateStr2" labelPos="right" labelColor="#666" color="#666" space="3px"
- size="25px"></u-icon>
- <u-icon name="arrow-right" color="#999" size="32rpx"></u-icon>
- </view>
- </view>
- <view class="right">共{{totalNum}}单 收入¥{{totalAmount}}</view>
- </view>
- <view class="list">
- <block v-if="data.length>0">
- <view class="item" v-for="(item,index) in data" :key="index" @tap="toDetails(item)">
- <image :src="item.orderType==2?'../../static/bao.png':'../../static/pin.png'"></image>
- <view class="mid">
- <text>{{item.playDate}}
- {{item.playTime}}出发/{{item.orderType==2?'包船':'拼船'}}/{{item.boatNo}}</text>
- <text>{{item.num}}人 · 出游{{item.playLength}}小时</text>
- <text>上船时间:{{item.updateDate}}</text>
- </view>
- <view class="price">¥{{item.realPrice}}</view>
- </view>
- </block>
- <block v-else>
- <NoData />
- </block>
- </view>
- <u-datetime-picker @confirm="confirmDate" @cancel="show=false" :show="show" v-model="value1"
- visibleItemCount="6" mode="date"></u-datetime-picker>
- <u-datetime-picker @confirm="confirmDate2" @cancel="show2=false" :show="show2" v-model="value2"
- visibleItemCount="6" mode="date"></u-datetime-picker>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- dateStr: new Date().Format('yyyy-MM-dd'),
- dateStr2: new Date().Format('yyyy-MM-dd'),
- date: new Date().Format('yyyy-MM-dd'),
- date2: new Date().Format('yyyy-MM-dd'),
- show: false,
- show2: false,
- k: '',
- data: [],
- value1: Number(new Date()),
- value2: Number(new Date()),
- merchantId: uni.getStorageSync('merchantId'),
- totalAmount: 0,
- totalNum: 0
- }
- },
- onLoad() {
- this.getdata();
- },
- methods: {
- getdata() {
- this.$api.get('/scenic/api/order/writeOffRecordPage', {
- limit: 50,
- page: 1,
- merchantId: this.merchantId,
- // queryDate: this.date,
- startDate: this.date,
- endDate: this.date2
- }).then(res => {
- if (res.data.code == 0) {
- // this.totalAmount = res.data.data.totalAmount;
- this.totalNum = res.data.data.totalNum;
- this.data = res.data.data.pageData.list;
- var num = res.data.data.totalAmount.toString(); // 转成字符串类型 如能确定类型 这步可省去
- if (num.indexOf(".") !== -1) {
- let [integerPart, decimalPart] = num.split(".");
- if (decimalPart.length > 2) {
- decimalPart = decimalPart.substring(0, 2);
- } else if (decimalPart.length === 1) {
- decimalPart += "0";
- }
- num = `${integerPart}.${decimalPart}`;
- } else {
- num += ".00";
- }
- console.log(num);
- this.totalAmount = num
- return num;
- }
- })
- },
- confirmDate(e) {
- // 创建一个Date对象并传入时间戳
- const date = new Date(e.value);
- // 使用Date对象的方法获取年、月、日、小时、分钟和秒
- const year = date.getFullYear();
- const month = ('0' + (date.getMonth() + 1)).slice(-2);
- const day = ('0' + date.getDate()).slice(-2);
- // 格式化时间
- let formattedTime = "";
- formattedTime = `${year}-${month}-${day}`;
- if (Date.parse(formattedTime) - Date.parse(this.date2) > 0) {
- return this.$showToast('开始日期不能大于结束日期');
- }
- this.dateStr = `${year}-${month}-${day}`
- this.date = formattedTime;
- this.show = false;
- this.getdata()
- },
- confirmDate2(e) {
- // 创建一个Date对象并传入时间戳
- const date = new Date(e.value);
- // 使用Date对象的方法获取年、月、日、小时、分钟和秒
- const year = date.getFullYear();
- const month = ('0' + (date.getMonth() + 1)).slice(-2);
- const day = ('0' + date.getDate()).slice(-2);
- // 格式化时间
- let formattedTime = "";
- formattedTime = `${year}-${month}-${day}`;
- if (Date.parse(formattedTime) - Date.parse(this.date) < 0) {
- return this.$showToast('结束日期不能小于开始日期');
- }
- this.dateStr2 = `${year}-${month}-${day}`
- this.date2 = formattedTime;
- this.show2 = false;
- this.getdata()
- },
- toDetails(item) {
- uni.navigateTo({
- url: '/pagesHouse/Verification/recordDetails?orderCode=' + item.orderCode
- })
- }
- }
- }
- </script>
- <style lang="less" scoped>
- /deep/ .uicon-arrow-right {
- margin-top: 4rpx !important;
- }
- .page {
- box-sizing: border-box;
- }
- .top {
- padding: 24rpx 30rpx;
- .time {
- display: flex;
- align-items: center;
- gap: 0 10rpx;
- }
- .right {
- color: #999;
- font-size: 24rpx;
- margin-top: 10rpx;
- margin-left: 6rpx;
- }
- }
- .list {
- padding: 0 30rpx;
- .item {
- padding: 30rpx 0;
- border-bottom: 1rpx solid #EFEFEF;
- display: flex;
- justify-content: space-between;
- image {
- width: 80rpx;
- min-width: 80rpx;
- height: 80rpx;
- }
- .mid {
- margin: 0 30rpx 0 20rpx;
- text {
- display: inline-block;
- font-size: 28rpx;
- color: #777;
- &:first-child {
- font-size: 30rpx;
- color: #111;
- font-weight: bold;
- }
- &:nth-child(2) {
- margin: 18rpx 0;
- }
- }
- }
- .price {
- font-size: 32rpx;
- }
- }
- }
- </style>
|