You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yanzong_qianduan/pages/news/park/recordHistory.vue

218 lines
4.7 KiB

10 months ago
<template>
<view class="record">
<view class="item" v-for="(item,index) in presaList" :key="index">
<view class="hd">
10 months ago
<image :src="item.image"></image>
<view class="info">
10 months ago
<view class="a">{{item.goods_name}}</view>
10 months ago
<view class="b"><text>倒计时</text>
10 months ago
<u-count-down style="margin-left:20rpx;" :timestamp="item.p_time"></u-count-down>
10 months ago
</view>
10 months ago
<view class="c">预约价:<text>{{item.goods_price_min}}</text></view>
</view>
<view class="status">已预约</view>
</view>
<view class="bd">
10 months ago
<view class="btn" @click="onCancel(item)">取消预约</view>
<!-- <view class="btn btn-01">详情</view> -->
</view>
10 months ago
</view>
10 months ago
<view class="empty" v-if="presaList.length == 0">
<u-empty text="暂无记录" mode="list" style="margin-top: 160rpx;"></u-empty>
</view>
10 months ago
</view>
</template>
10 months ago
<script>
10 months ago
import * as GoodsApi from '@/api/goods'
export default {
data() {
return {
presaList: [],
isLoading: false,
10 months ago
total:0,
page:1,
10 months ago
};
10 months ago
},
10 months ago
onLoad() {
this.getPresaleList();
10 months ago
},
10 months ago
methods: {
beginTime(end) {
const now = new Date();
const year = now.getFullYear();
const month = now.getMonth() + 1;
const day = now.getDate();
const hour = now.getHours();
const minute = now.getMinutes();
const second = now.getSeconds();
let start= year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second
return (Date.parse(end.replace(/-/g, '/'))-Date.parse(start.replace(/-/g, '/')))
10 months ago
},
10 months ago
onCancel(item) {
let app = this
uni.showModal({
title: "温馨提示",
content: "是否取消该订单?",
confirmColor: "#F21A1C",
complete(res) {
if (res.confirm) {
GoodsApi.canlpresale({
id: item.id
})
.then(result => {
if (result.status == 200) {
uni.showToast({
title:'取消成功',
icon:'none'
})
10 months ago
app.page=1;
app.presaList = []
10 months ago
app.getPresaleList()
}
})
.finally(() => app.isLoading = false)
}
10 months ago
}
10 months ago
})
},
async getPresaleList() {
let app = this
let res = await GoodsApi.presaleList({page:this.page});
console.log(res)
if (res.status == 200 && res.data.list.data.length>0) {
res.data.list.data.forEach(function(item) {
item.p_time = app.beginTime(item.p_time)
});
app.presaList.push(...res.data.list.data)
app.total = res.data.list.total
10 months ago
}
10 months ago
},
10 months ago
},
10 months ago
onReachBottom() {
if(this.presaList.length <this.total){
this.pageNum ++;
this.getPresaleList();
}
10 months ago
},
}
</script>
<style lang="scss" scoped>
.record {
padding: 0 16rpx 20rpx;
overflow: hidden;
.item {
width: 100%;
padding: 0 30rpx;
box-sizing: border-box;
background-color: #fff;
margin-top: 20rpx;
10 months ago
position: relative;
10 months ago
.hd {
display: flex;
align-items: flex-start;
overflow: hidden;
padding: 15rpx 0;
overflow: hidden;
border-bottom: 1px solid #F2F2F2;
image {
width: 190rpx;
height: 190rpx;
margin-right: 20rpx;
}
10 months ago
.info {
flex: 1;
max-width: 320rpx;
.a {
white-space: nowrap;
font-size: 32rpx;
font-weight: 400;
color: #1E1E1E;
text-overflow: ellipsis;
overflow: hidden;
margin-top: 30rpx;
}
10 months ago
.b {
display: flex;
align-items: center;
margin-top: 10rpx;
text {
color: #949494;
10 months ago
// margin-right: 20rpx;
10 months ago
}
font-size: 28rpx;
font-weight: 400;
color: #FF0E0E;
}
10 months ago
.c {
margin-top: 10rpx;
text {
font-size: 36rpx;
font-weight: 600;
color: #F21A1C;
}
font-size: 28rpx;
font-weight: 400;
color: #FF0E0E;
}
}
.status {
10 months ago
// flex: 1;
// text-align: right;
10 months ago
font-size: 32rpx;
font-weight: 400;
10 months ago
color: #529C30;
10 months ago
position: absolute;
right: 24rpx;
top:14rpx;
}
}
10 months ago
.bd {
padding: 30rpx 0;
overflow: hidden;
display: flex;
align-items: center;
justify-content: flex-end;
.btn {
width: 158rpx;
line-height: 62rpx;
background: #FFFFFF;
border-radius: 62rpx;
text-align: center;
border: 1px solid #C6C6C6;
font-size: 28rpx;
font-weight: 400;
color: #3D3D3D;
margin-left: 20rpx;
&-01 {
background: #F19592;
border-color: #F19592;
color: #fff;
}
}
}
}
}
10 months ago
.empty{
height: calc(100vh - 88rpx);
display: flex;
align-items: center;
justify-content: center;
}
10 months ago
</style>