<template>
|
<view class="success-page">
|
<view class="success-card">
|
<image class="success-icon" src="/static/images/ic_success@2x.png" mode="aspectFit"></image>
|
<view class="success-title">验券成功</view>
|
|
<view class="action-row">
|
<view class="action-btn action-btn--ghost" @click="goHome">回到首页</view>
|
<view class="action-btn action-btn--primary" @click="goScanRide">扫码骑车</view>
|
</view>
|
|
<view class="info-block">
|
<view class="info-label">券码信息:</view>
|
<view class="coupon-card">
|
<view class="coupon-name">{{ couponInfo.name }}</view>
|
<view class="coupon-desc">每日骑行限制时间:{{ couponInfo.limitTimeText }}</view>
|
<view class="coupon-divider"></view>
|
<view class="coupon-date">有效期:{{ couponInfo.period }}</view>
|
</view>
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
const VERIFY_PACKAGE_INFO_KEY = 'verifyPackageInfo'
|
|
const defaultCouponInfo = {
|
name: '',
|
limitTimeText: '--',
|
period: '--'
|
}
|
|
export default {
|
data() {
|
return {
|
couponInfo: {
|
...defaultCouponInfo
|
}
|
}
|
},
|
onLoad() {
|
const packageInfo = uni.getStorageSync(VERIFY_PACKAGE_INFO_KEY)
|
uni.removeStorageSync(VERIFY_PACKAGE_INFO_KEY)
|
|
if (!packageInfo) {
|
return
|
}
|
|
this.couponInfo = {
|
name: packageInfo.name,
|
limitTimeText: `${packageInfo.limitTime ? packageInfo.limitTime + '分钟' : '不限制'}`,
|
period: this.formatPeriod(packageInfo.useStartDate, packageInfo.useEndDate)
|
}
|
},
|
methods: {
|
formatPeriod(useStartDate, useEndDate) {
|
if (useStartDate && useEndDate) {
|
return `${useStartDate} 至 ${useEndDate}`
|
}
|
|
return useStartDate || useEndDate || defaultCouponInfo.period
|
},
|
goHome() {
|
uni.reLaunch({
|
url: '/pages/index/index'
|
})
|
},
|
goScanRide() {
|
uni.$emit('sweep')
|
uni.navigateBack({ delta: 2 });
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.success-page {
|
width: 100%;
|
min-height: 100vh;
|
padding: 20rpx 24rpx;
|
box-sizing: border-box;
|
background: #f7f7f7;
|
|
.success-card {
|
min-height: calc(100vh - 40rpx);
|
padding: 72rpx 36rpx 0;
|
box-sizing: border-box;
|
background: #ffffff;
|
border-radius: 8rpx;
|
display: flex;
|
flex-direction: column;
|
align-items: center;
|
}
|
|
.success-icon {
|
width: 164rpx;
|
height: 164rpx;
|
}
|
|
.success-title {
|
margin-top: 42rpx;
|
font-size: 40rpx;
|
font-weight: 600;
|
line-height: 56rpx;
|
color: #222222;
|
}
|
|
.action-row {
|
width: 100%;
|
margin-top: 74rpx;
|
display: flex;
|
justify-content: space-between;
|
}
|
|
.action-btn {
|
flex: 1;
|
height: 92rpx;
|
border-radius: 46rpx;
|
font-size: 32rpx;
|
font-weight: 500;
|
line-height: 92rpx;
|
text-align: center;
|
box-sizing: border-box;
|
|
& + .action-btn {
|
margin-left: 28rpx;
|
}
|
}
|
|
.action-btn--ghost {
|
background: #ffffff;
|
border: 2rpx solid #d8d8d8;
|
color: #8f8f96;
|
}
|
|
.action-btn--primary {
|
background: #01b6ad;
|
color: #ffffff;
|
}
|
|
.info-block {
|
width: 100%;
|
margin-top: 76rpx;
|
}
|
|
.info-label {
|
font-size: 40rpx;
|
font-weight: 600;
|
line-height: 56rpx;
|
color: #222222;
|
}
|
|
.coupon-card {
|
margin-top: 34rpx;
|
padding: 34rpx 24rpx 30rpx;
|
background: #f6f6f6;
|
border-radius: 4rpx;
|
box-sizing: border-box;
|
}
|
|
.coupon-name {
|
font-size: 40rpx;
|
font-weight: 600;
|
line-height: 56rpx;
|
color: #222222;
|
white-space: nowrap;
|
overflow: hidden;
|
text-overflow: ellipsis;
|
}
|
|
.coupon-desc {
|
margin-top: 22rpx;
|
font-size: 32rpx;
|
font-weight: 400;
|
line-height: 44rpx;
|
color: #888888;
|
}
|
|
.coupon-divider {
|
margin: 28rpx 0 24rpx;
|
border-top: 2rpx dotted #e1e1e1;
|
}
|
|
.coupon-date {
|
font-size: 32rpx;
|
font-weight: 400;
|
line-height: 44rpx;
|
color: #9a9a9a;
|
}
|
}
|
</style>
|