v2.28.1 抖音团购优化

This commit is contained in:
磷叶 2026-02-27 10:56:06 +08:00
parent 479bacee6d
commit 2a8c98fbea
5 changed files with 459 additions and 223 deletions

View File

@ -1,7 +1,7 @@
const install = (Vue, vm) => { const install = (Vue, vm) => {
uni.setStorageSync('deptId', 100); uni.setStorageSync('deptId', 100);
Vue.prototype.$u.http.setConfig({ Vue.prototype.$u.http.setConfig({
baseUrl: 'http://192.168.1.7:4101', //键辉本地 baseUrl: 'http://192.168.1.3:4101', //键辉本地
// baseUrl: 'http://192.168.2.221:4101', //景森本地 // baseUrl: 'http://192.168.2.221:4101', //景森本地
// baseUrl: 'https://ele.ccttiot.com/prod-api', //线上 小鹿appid wx8a05cf95418a6859 小兔骑骑appidwx38f96c87621a87ab 遇福兴https://fu.chuantewulian.cn wxcb1d6a5d9dca8bbe // baseUrl: 'https://ele.ccttiot.com/prod-api', //线上 小鹿appid wx8a05cf95418a6859 小兔骑骑appidwx38f96c87621a87ab 遇福兴https://fu.chuantewulian.cn wxcb1d6a5d9dca8bbe
// baseUrl: 'https://cc.ccttiot.com/prod-api', //叉车线上 // baseUrl: 'https://cc.ccttiot.com/prod-api', //叉车线上

View File

@ -1,39 +1,54 @@
<template> <template>
<view class="page"> <view class="page">
<u-navbar title="购买会员" :border-bottom="false" :background="bgc" back-icon-color="#333333" title-color='#333333' <u-navbar title="优惠中心" :border-bottom="false" :background="bgc" back-icon-color="#333333" title-color='#333333'
title-size='36' height='36' id="navbar"> title-size='36' height='36' id="navbar">
</u-navbar> </u-navbar>
<view class="list"> <view class="verify-entry" @click="goVerify" v-if="area != null && area.douyinEnable == true">
<view class="list_item" v-for="(item,index) in huiyuanlist" :key="index" @click.stop="tobuy(item)"> <view class="verify-entry-cards">
<view class="lt"> <view class="card card-back">
<text class="discount">{{item.discountValue}}</text> <image src="https://api.ccttiot.com/%E7%BE%8E%E5%9B%A2-copy-1772093915776.png" mode="aspectFit" />
<view class="decoration"> </view>
<view class="circle circle1"></view> <view class="card card-front">
<view class="circle circle2"></view> <image src="https://api.ccttiot.com/%E6%8A%96%E9%9F%B3-1772093491243.png" mode="aspectFit" />
<view class="circle circle3"></view> </view>
</view> </view>
</view> <view class="verify-entry-content">
<view class="rt"> <text class="verify-entry-title">团购核销</text>
<view class="bd"> <text class="verify-entry-desc">核销抖音美团等团购券</text>
<view class="name"> </view>
{{item.name.length > 6 ? item.name.slice(0,6) + '...' : item.name}} <u-icon name="arrow-right" size="32" color="#999"></u-icon>
<text class="hot-tag">热门</text> </view>
</view> <view class="list">
<view class="qixian"> <view class="list_item" v-for="(item,index) in huiyuanlist" :key="index" @click.stop="tobuy(item)">
<text class="icon"></text> <view class="lt">
有效期{{item.validDays}} <text class="discount">{{item.discountValue}}</text>
</view> <view class="decoration">
<view class="qixian"> <view class="circle circle1"></view>
<text class="icon">📍</text> <view class="circle circle2"></view>
仅限{{item.areaName}}使用 <view class="circle circle3"></view>
</view>
</view>
<view class="cz">
<text class="price">{{item.price}}</text>
</view> </view>
</view> </view>
</view> <view class="rt">
</view> <view class="bd">
<view class="name">
{{item.name.length > 6 ? item.name.slice(0,6) + '...' : item.name}}
<text class="hot-tag">热门</text>
</view>
<view class="qixian">
<text class="icon"></text>
有效期{{item.validDays}}
</view>
<view class="qixian">
<text class="icon">📍</text>
仅限{{item.areaName}}使用
</view>
</view>
<view class="cz">
<text class="price">{{item.price}}</text>
</view>
</view>
</view>
</view>
<u-mask :show="show" :z-index='100' /> <u-mask :show="show" :z-index='100' />
<view class="buy_box" v-if="show"> <view class="buy_box" v-if="show">
<view class="taocan"> <view class="taocan">
@ -78,23 +93,36 @@
export default { export default {
data() { data() {
return { return {
bgc: { bgc: {
backgroundColor: "#F7F8FA", backgroundColor: "#F7F8FA",
}, },
show: false, show: false,
huiyuanobj:{}, huiyuanobj:{},
huiyuanlist:[], huiyuanlist:[],
areaId:'', areaId:'',
channelId:'', channelId:'',
zfflag:true zfflag:true,
area: {}
} }
}, },
onLoad(option) { onLoad(option) {
this.areaId = option.areaId this.areaId = option.areaId
this.gethuiyuan() this.getAreaDetail()
this.gethuiyuan()
this.getchannelid() this.getchannelid()
}, },
methods: { methods: {
getAreaDetail() {
if (!this.areaId) {
this.area = {};
return;
}
this.$u.get(`/app/area/detail?id=${this.areaId}`).then((res) => {
if (res.code == 200) {
this.area = res.data
}
})
},
// channelId // channelId
getchannelid(){ getchannelid(){
this.$u.get(`/app/channel/list?appId=${this.$store.state.appid}&areaId=${this.areaId}&bstType=3&appType=1`).then((res) => { this.$u.get(`/app/channel/list?appId=${this.$store.state.appid}&areaId=${this.areaId}&bstType=3&appType=1`).then((res) => {
@ -189,8 +217,10 @@
} }
}) })
}, },
handlePay() { goVerify() {
// uni.navigateTo({
url: '/page_user/verify/index?areaId=' + this.areaId,
})
} }
} }
} }
@ -202,6 +232,75 @@
padding-bottom: 50rpx; padding-bottom: 50rpx;
box-sizing: border-box; box-sizing: border-box;
} }
.verify-entry {
display: flex;
align-items: center;
margin: 24rpx 40rpx;
padding: 28rpx 24rpx;
background: linear-gradient(135deg, #f8fbff 0%, #f0f7ff 100%);
border-radius: 20rpx;
border: 1rpx solid rgba(57, 150, 253, 0.12);
transition: transform 0.2s ease;
&:active {
transform: scale(0.98);
}
.verify-entry-cards {
position: relative;
width: 110rpx;
height: 80rpx;
margin-right: 24rpx;
.card {
position: absolute;
width: 64rpx;
height: 64rpx;
border-radius: 14rpx;
background: #fff;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.12);
padding: 8rpx;
box-sizing: border-box;
image {
width: 100%;
height: 100%;
}
}
.card-back {
left: 0;
top: 2rpx;
z-index: 1;
transform: rotate(-10deg);
}
.card-front {
left: 44rpx;
top: 10rpx;
z-index: 2;
transform: rotate(8deg);
}
}
.verify-entry-content {
flex: 1;
.verify-entry-title {
display: block;
font-size: 32rpx;
font-weight: 600;
color: #1a1a1a;
margin-bottom: 4rpx;
}
.verify-entry-desc {
font-size: 24rpx;
color: #646566;
}
}
}
.buy_box { .buy_box {
padding: 0 46rpx; padding: 0 46rpx;

View File

@ -1,6 +1,6 @@
<template> <template>
<view class="page"> <view class="page">
<u-navbar :title="tit" :border-bottom="false" :background="bgc" back-icon-color="#fff" title-color='#fff' <u-navbar title="确认订单" :border-bottom="false" :background="bgc" back-icon-color="#fff" title-color='#fff'
title-size='36' height='50' id="navbar" :custom-back="btnfh"> title-size='36' height='50' id="navbar" :custom-back="btnfh">
</u-navbar> </u-navbar>
<view class="jieshao"> <view class="jieshao">
@ -165,7 +165,19 @@
当前车辆车型未配置套餐请管理员前往车型中配置 当前车辆车型未配置套餐请管理员前往车型中配置
</view> </view>
<view class="package-info-box" v-if="taocanlist.length != 0"> <view class="package-info-box" v-if="taocanlist.length != 0">
<view class="package-title">套餐说明</view> <view class="package-header">
<view class="package-title">套餐说明</view>
<view class="package-buttons">
<view class="parking-btn" @click="btntcd">
<u-icon name="map" color="#4297F3" size="22"></u-icon>
<text class="btn-text">查看还车点</text>
</view>
<view class="parking-btn" @click="btnkefu">
<u-icon name="phone-fill" color="#4297F3" size="22"></u-icon>
<text class="btn-text">联系客服</text>
</view>
</view>
</view>
<view class="package-content"> <view class="package-content">
<!-- 免费骑行 --> <!-- 免费骑行 -->
<view class="info-item" v-if="actiobj.freeRideTime != null && actiobj.freeRideTime != '' && actiobj.freeRideTime != 0"> <view class="info-item" v-if="actiobj.freeRideTime != null && actiobj.freeRideTime != '' && actiobj.freeRideTime != 0">
@ -213,17 +225,6 @@
</view> </view>
</view> </view>
</view> </view>
<!-- 查看还车点按钮 -->
<view class="package-buttons">
<view class="parking-btn" @click="btntcd">
<u-icon name="map" color="#666" size="28"></u-icon>
<text class="btn-text">查看还车点</text>
</view>
<view class="parking-btn" @click="btnkefu">
<u-icon name="phone-fill" color="#666" size="28"></u-icon>
<text class="btn-text">联系客服</text>
</view>
</view>
</view> </view>
</view> </view>
@ -240,24 +241,21 @@
</view> </view>
</view> </view>
<!-- 会员 --> <!-- 特惠购卡/团购核销 入口有卡券或运营区开通核销时显示 -->
<view class="fee_box" @click="btnhuiyuan" v-if="huiyuanlist.length > 0"> <view class="card-verify-entry" @click="btnhuiyuan" v-if="showCardVerifyEntry && bikeobj.areaId">
<view class="auto_box"> <view class="entry-cards">
<view class="auto_li" v-for="(item,index) in huiyuanlist" :key="index"> <view class="card card-coupon">
<view class="txt1"> <image src="https://api.ccttiot.com/%E4%BC%98%E6%83%A0%E5%88%B8-1772155543995.png" mode="aspectFit" />
{{item.name.length > 6 ? item.name.slice(0,6) + '...' : item.name}} </view>
</view> <view class="card card-back">
<view class="txt1"> <image src="https://api.ccttiot.com/%E7%BE%8E%E5%9B%A2-copy-1772093915776.png" mode="aspectFit" />
{{item.price}} </view>
</view> <view class="card card-front">
<view class="txt2"> <image src="https://api.ccttiot.com/%E6%8A%96%E9%9F%B3-1772093491243.png" mode="aspectFit" />
折扣{{item.discountValue}}
</view>
<view class="buy_btn"> <!-- @click.stop="tobuy(item)" -->
购买
</view>
</view> </view>
</view> </view>
<text class="entry-text">特惠购卡 / 团购核销</text>
<u-icon name="arrow-right" size="28" color="#999"></u-icon>
</view> </view>
<u-mask :show="show" :z-index='100' /> <u-mask :show="show" :z-index='100' />
@ -701,13 +699,11 @@
ggobj:null, ggobj:null,
channelId: '', channelId: '',
sn: '', sn: '',
tit: '',
logoflag: false, logoflag: false,
ver_dataflag: 1, ver_dataflag: 1,
deviceId: '', deviceId: '',
name: '', name: '',
zhezhaoflag:true, zhezhaoflag:true,
tit:' ',
actiobj:{}, actiobj:{},
countdown:1, countdown:1,
paymentList:[], paymentList:[],
@ -725,6 +721,7 @@
huiyuanlist:[], huiyuanlist:[],
huiyuanobj:{}, huiyuanobj:{},
areaDouyinEnable: false,
zfflag:true, zfflag:true,
jieliuflag:true, jieliuflag:true,
videoUrl:'', videoUrl:'',
@ -753,6 +750,11 @@
guideVideoId: '' // guideVideoId: '' //
} }
}, },
computed: {
showCardVerifyEntry() {
return this.huiyuanlist.length > 0 || this.areaDouyinEnable
}
},
onLoad(option) { onLoad(option) {
console.log(option,'sasdadas'); console.log(option,'sasdadas');
if(option.duoirder){ if(option.duoirder){
@ -820,7 +822,6 @@
this.zhezhaoflag = false this.zhezhaoflag = false
uni.hideLoading() uni.hideLoading()
}else{ }else{
this.tit= '确认订单页'
this.zhezhaoflag = false this.zhezhaoflag = false
uni.hideLoading() uni.hideLoading()
this.modelId = option.modelId this.modelId = option.modelId
@ -857,7 +858,6 @@
this.zhezhaoflag = false this.zhezhaoflag = false
uni.hideLoading() uni.hideLoading()
} else { } else {
this.tit= '确认订单页'
this.zhezhaoflag = false this.zhezhaoflag = false
uni.hideLoading() uni.hideLoading()
// //
@ -883,7 +883,7 @@
this.gettaocan() this.gettaocan()
this.getcheliang() this.getcheliang()
this.getQiniuToken() this.getQiniuToken()
this.getAreaDetailForGuide() this.getAreaDetail()
} }
}else{ }else{
uni.showModal({ uni.showModal({
@ -900,7 +900,6 @@
// this.logoflag = true // this.logoflag = true
this.getlogo() this.getlogo()
}else{ }else{
this.tit= '确认订单页'
this.zhezhaoflag = false this.zhezhaoflag = false
uni.hideLoading() uni.hideLoading()
// //
@ -926,7 +925,7 @@
this.getcheliang() this.getcheliang()
this.getQiniuToken() this.getQiniuToken()
this.gettaocan() this.gettaocan()
this.getAreaDetailForGuide() this.getAreaDetail()
} }
}else{ }else{
uni.showModal({ uni.showModal({
@ -949,7 +948,7 @@
onShow() { onShow() {
// guideEnable // guideEnable
if (this.bikeobj && this.bikeobj.areaId) { if (this.bikeobj && this.bikeobj.areaId) {
this.getAreaDetailForGuide() this.getAreaDetail()
} }
}, },
onHide() { onHide() {
@ -1008,18 +1007,28 @@
}) })
}, },
// guideEnable id // guideEnable id
getAreaDetailForGuide() { getAreaDetail() {
if (!this.bikeobj || !this.bikeobj.areaId) return if (!this.bikeobj || !this.bikeobj.areaId) return
this.$u.get(`/app/area/detail?id=${this.bikeobj.areaId}`).then((res) => { this.$u.get(`/app/area/detail?id=${this.bikeobj.areaId}`).then((res) => {
if (res.code != 200 || !res.data || res.data.guideEnable !== true || !res.data.guideVideo) return if (res.code != 200 || !res.data) {
const areaId = this.bikeobj.areaId return;
// guideVideoId guideVideo }
const videoId = res.data.guideVideoId != null && res.data.guideVideoId !== '' ? String(res.data.guideVideoId) : res.data.guideVideo const data = res.data;
const storageKey = 'trueorder_guide_seen_' + areaId const areaId = data.id;
if (uni.getStorageSync(storageKey) === videoId) return // id
this.guideVideoUrl = res.data.guideVideo //
this.guideVideoId = videoId if (!data.guideEnable && !data.guideVideo) {
this.showGuideVideo = true const videoId = data.guideVideo;
const storageKey = 'trueorder_guide_seen_' + areaId
if (!uni.getStorageSync(storageKey) === videoId) {
this.guideVideoUrl = data.guideVideo
this.guideVideoId = videoId
this.showGuideVideo = true
}
}
//
this.areaDouyinEnable = data.douyinEnable;
}) })
}, },
// id // id
@ -1402,13 +1411,15 @@
this.show = true this.show = true
this.huiyuanobj = item this.huiyuanobj = item
}, },
// //
gethuiyuan(){ gethuiyuan(){
this.$u.get(`/app/vip/listByArea?areaId=${this.bikeobj.areaId}`).then(res=>{ if (!this.bikeobj || !this.bikeobj.areaId) return
const areaId = this.bikeobj.areaId
this.$u.get(`/app/vip/listByArea?areaId=${areaId}`).then(res=>{
if(res.code == 200){ if(res.code == 200){
this.huiyuanlist = res.data this.huiyuanlist = res.data || []
} }
}) })
}, },
// //
btnhuiyuan(){ btnhuiyuan(){
@ -1876,7 +1887,7 @@
console.log(res.data,'020202'); console.log(res.data,'020202');
this.$u.put(`/app/user/bindArea?areaId=${res.data.areaId}`).then(resp =>{}) this.$u.put(`/app/user/bindArea?areaId=${res.data.areaId}`).then(resp =>{})
this.gettaocan() this.gettaocan()
this.getAreaDetailForGuide() this.getAreaDetail()
} }
}) })
} else { } else {
@ -1887,7 +1898,7 @@
this.mac = res.data.mac this.mac = res.data.mac
this.bikeobj = res.data this.bikeobj = res.data
this.gettaocan() this.gettaocan()
this.getAreaDetailForGuide() this.getAreaDetail()
} }
}) })
} }
@ -2280,7 +2291,6 @@
}) })
} }
}) })
this.tit = '确认订单页'
this.logoflag = false this.logoflag = false
} else { } else {
uni.showToast({ uni.showToast({
@ -2758,75 +2768,72 @@
} }
} }
} }
.fee_box { .card-verify-entry {
margin-top: 38rpx; display: flex;
position: relative; align-items: center;
margin-left: 24rpx; margin-top: 24rpx;
width: 700rpx; margin-left: 24rpx;
height: 288rpx; margin-right: 24rpx;
background-image: url('https://lxnapi.ccttiot.com/bike/img/static/ugciMYClSGgJxP8HYoRU'); padding: 24rpx 28rpx;
background-size: cover; background: linear-gradient(135deg, #f8fbff 0%, #f0f7ff 100%);
background-position: center; border-radius: 16rpx;
background-repeat: no-repeat; border: 1rpx solid rgba(57, 150, 253, 0.12);
.auto_box::-webkit-scrollbar { transition: transform 0.2s ease;
display: none;
&:active {
transform: scale(0.98);
} }
.auto_box {
padding-left: 24rpx; .entry-cards {
display: flex;
overflow-x: auto; /* 允许横向滚动 */
flex-wrap: nowrap; /* 禁止换行,保持所有元素在一行 */
position: absolute;
top: 90rpx;
width: 100%; /* 根据需要调整宽度 */
height: auto; /* 根据内容自动调整高度 */
.auto_li {
position: relative; position: relative;
padding: 24rpx 28rpx; width: 140rpx;
margin-right: 22rpx; height: 80rpx;
width: 408rpx; margin-right: 24rpx;
height: 176rpx;
flex-shrink: 0; /* 防止子元素被压缩 */ .card {
background-image: url('https://lxnapi.ccttiot.com/bike/img/static/ui88NWy9R1j2zFGojdHU'); position: absolute;
background-size: cover; width: 56rpx;
background-position: center; height: 56rpx;
.txt1{ border-radius: 12rpx;
width: 100%; background: #fff;
font-weight: 700; box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.12);
font-size: 34rpx; padding: 6rpx;
color: #495E74; box-sizing: border-box;
letter-spacing: 0.5rpx;
} image {
.txt2{ width: 100%;
font-weight: 600; height: 100%;
font-size: 26rpx; }
color: #495E74; }
margin-top: 8rpx;
} .card-coupon {
.buy_btn{ left: 0;
position: absolute; top: 6rpx;
right: 28rpx; z-index: 0;
bottom: 40rpx; transform: rotate(-12deg);
display: flex; }
align-items: center;
justify-content: center; .card-back {
width: 140rpx; left: 38rpx;
height: 56rpx; top: 2rpx;
background: linear-gradient(135deg, #495E74 0%, #5A6F88 100%); z-index: 1;
border-radius: 28rpx; transform: rotate(-6deg);
font-weight: 700; }
font-size: 28rpx;
color: #FFF3DB; .card-front {
box-shadow: 0 4rpx 12rpx rgba(73, 94, 116, 0.3); left: 76rpx;
transition: all 0.3s ease; top: 10rpx;
&:active { z-index: 2;
transform: scale(0.95); transform: rotate(8deg);
box-shadow: 0 2rpx 6rpx rgba(73, 94, 116, 0.25); }
} }
}
} .entry-text {
} flex: 1;
font-size: 30rpx;
font-weight: 600;
color: #1a1a1a;
}
} }
.noticetc{ .noticetc{
width: 680rpx; width: 680rpx;
@ -3542,19 +3549,21 @@
.check-icon { .check-icon {
position: absolute; position: absolute;
bottom: 16rpx; bottom: 0;
right: 16rpx; right: 0;
width: 48rpx; width: 56rpx;
height: 48rpx; height: 56rpx;
background: linear-gradient(135deg, #4297F3 0%, #60A5FA 100%); background: linear-gradient(135deg, #4297F3 0%, #60A5FA 100%);
border-radius: 50%; clip-path: polygon(100% 0, 100% 100%, 0 100%);
display: flex; display: flex;
align-items: center; align-items: flex-end;
justify-content: center; justify-content: flex-end;
padding: 0 6rpx 6rpx 0;
box-sizing: border-box;
z-index: 10; z-index: 10;
box-shadow: 0 4rpx 12rpx rgba(66, 151, 243, 0.4); box-shadow: -2rpx -2rpx 8rpx rgba(66, 151, 243, 0.3);
.check-mark { .check-mark {
font-size: 32rpx; font-size: 28rpx;
font-weight: 700; font-weight: 700;
color: #FFFFFF; color: #FFFFFF;
line-height: 1; line-height: 1;
@ -3639,8 +3648,6 @@
border-width: 3rpx; border-width: 3rpx;
background: linear-gradient(135deg, #F0F7FF 0%, #FFFFFF 100%); background: linear-gradient(135deg, #F0F7FF 0%, #FFFFFF 100%);
box-shadow: 0 6rpx 20rpx rgba(66, 151, 243, 0.25); box-shadow: 0 6rpx 20rpx rgba(66, 151, 243, 0.25);
transform: translateY(-2rpx);
height: 100% !important;
} }
&.interval-billing { &.interval-billing {
@ -4113,11 +4120,17 @@
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.08); box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.08);
border: 1rpx solid #F3F4F6; border: 1rpx solid #F3F4F6;
.package-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 24rpx;
}
.package-title { .package-title {
font-size: 32rpx; font-size: 32rpx;
color: #1F2937; color: #1F2937;
font-weight: 700; font-weight: 700;
margin-bottom: 24rpx;
letter-spacing: 0.5rpx; letter-spacing: 0.5rpx;
} }
@ -4189,38 +4202,29 @@
} }
.package-buttons { .package-buttons {
margin-top: 10rpx;
display: flex; display: flex;
justify-content: space-between; align-items: center;
gap: 16rpx; gap: 12rpx;
.parking-btn { .parking-btn {
flex: 1;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
padding: 16rpx 28rpx; padding: 8rpx 18rpx;
background: #FFFFFF; background: rgba(66, 151, 243, 0.1);
border: 2rpx solid #D1D5DB; border: 1rpx solid rgba(66, 151, 243, 0.3);
border-radius: 50rpx; border-radius: 32rpx;
gap: 10rpx; gap: 6rpx;
cursor: pointer; transition: all 0.2s ease;
transition: all 0.3s ease;
&:active { &:active {
transform: scale(0.98); transform: scale(0.96);
background: #F9FAFB; background: rgba(66, 151, 243, 0.15);
}
.btn-icon {
font-size: 28rpx;
color: #666;
line-height: 1;
} }
.btn-text { .btn-text {
font-size: 28rpx; font-size: 24rpx;
color: #333; color: #4297F3;
font-weight: 500; font-weight: 500;
} }
} }

View File

@ -0,0 +1,114 @@
<template>
<u-popup v-model="visible" mode="center" :border-radius="20" :closeable="true">
<view class="success-popup">
<view class="success-icon-wrap">
<u-icon name="checkmark-circle-fill" color="#10B981" size="80"></u-icon>
</view>
<text class="success-title">核销成功</text>
<text class="success-coupon-name">{{ couponName }}</text>
<view class="success-btns">
<view class="success-btn primary" @click="onViewCard">查看卡券</view>
<view class="success-btn secondary" @click="onContinueVerify">继续核销</view>
</view>
</view>
</u-popup>
</template>
<script>
/**
* 核销成功弹窗
* 展示核销成功的卡券名称提供查看卡券继续核销两个操作
*/
export default {
name: 'VerifySuccessPopup',
props: {
value: {
type: Boolean,
default: false
},
couponName: {
type: String,
default: ''
}
},
computed: {
visible: {
get() {
return this.value
},
set(val) {
this.$emit('input', val)
}
}
},
methods: {
onViewCard() {
this.$emit('viewCard')
},
onContinueVerify() {
this.$emit('continueVerify')
}
}
}
</script>
<style lang="scss" scoped>
.success-popup {
width: 560rpx;
padding: 48rpx 40rpx;
background: #fff;
border-radius: 20rpx;
text-align: center;
}
.success-icon-wrap {
margin-bottom: 24rpx;
}
.success-title {
display: block;
font-size: 36rpx;
font-weight: 700;
color: #1a1a1a;
margin-bottom: 16rpx;
}
.success-coupon-name {
display: block;
font-size: 30rpx;
color: #646566;
margin-bottom: 40rpx;
padding: 0 20rpx;
word-break: break-all;
}
.success-btns {
display: flex;
gap: 24rpx;
justify-content: center;
}
.success-btn {
flex: 1;
height: 80rpx;
line-height: 80rpx;
font-size: 30rpx;
font-weight: 500;
border-radius: 12rpx;
text-align: center;
&.primary {
background: linear-gradient(135deg, #4297F3 0%, #60A5FA 100%);
color: #fff;
}
&.secondary {
background: #f0f2f5;
color: #646566;
}
&:active {
opacity: 0.9;
}
}
</style>

View File

@ -3,7 +3,7 @@
<view class="container"> <view class="container">
<!-- 运营区选择 --> <!-- 运营区选择 -->
<view class="section area-section animate-fade-in" @click="openAreaPopup"> <view class="section area-section animate-fade-in" @click="openAreaPopup" v-if="!areaId">
<view class="section-label">当前运营区</view> <view class="section-label">当前运营区</view>
<view class="area-select"> <view class="area-select">
<text class="area-name">{{ currentArea ? currentArea.name : '请选择运营区' }}</text> <text class="area-name">{{ currentArea ? currentArea.name : '请选择运营区' }}</text>
@ -91,12 +91,21 @@
:item-list="prepareItemList" :item-list="prepareItemList"
@confirm="onCouponConfirm" @confirm="onCouponConfirm"
/> />
<!-- 核销成功弹窗 -->
<verify-success-popup
v-model="successPopupVisible"
:coupon-name="successCouponName"
@viewCard="onViewCard"
@continueVerify="onContinueVerify"
/>
</view> </view>
</template> </template>
<script> <script>
import AreaSelectPopup from './components/AreaSelectPopup.vue'; import AreaSelectPopup from './components/AreaSelectPopup.vue';
import CouponSelectPopup from './components/CouponSelectPopup.vue'; import CouponSelectPopup from './components/CouponSelectPopup.vue';
import VerifySuccessPopup from './components/VerifySuccessPopup.vue';
/** /**
* 核销页面 * 核销页面
@ -105,33 +114,31 @@ import CouponSelectPopup from './components/CouponSelectPopup.vue';
* - 券码输入框 * - 券码输入框
* - 核销按钮调用准备接口 -> 多券则弹窗选择 -> 调用核销接口 * - 核销按钮调用准备接口 -> 多券则弹窗选择 -> 调用核销接口
*/ */
/** 核销方式配置icon(image url 或 uview icon 名), title, description, disabled */
const VERIFY_METHODS = [
{
type: 'douyin',
icon: 'https://api.ccttiot.com/%E6%8A%96%E9%9F%B3-1772093491243.png',
title: '抖音核销',
description: '请输入抖音券码进行核销',
disabled: false
},
{
type: 'meituan',
icon: 'https://api.ccttiot.com/%E7%BE%8E%E5%9B%A2-copy-1772093915776.png',
title: '美团核销',
description: '即将开放',
disabled: true
}
]
export default { export default {
name: 'VerifyIndex', name: 'VerifyIndex',
components: { components: {
AreaSelectPopup, AreaSelectPopup,
CouponSelectPopup CouponSelectPopup,
VerifySuccessPopup
}, },
data() { data() {
return { return {
verifyMethods: VERIFY_METHODS, verifyMethods: [
{
type: 'douyin',
icon: 'https://api.ccttiot.com/%E6%8A%96%E9%9F%B3-1772093491243.png',
title: '抖音核销',
description: '请输入抖音券码进行核销',
disabled: false
},
{
type: 'meituan',
icon: 'https://api.ccttiot.com/%E7%BE%8E%E5%9B%A2-copy-1772093915776.png',
title: '美团核销',
description: '即将开放',
disabled: true
}
],
bgc: { backgroundColor: '#fff' }, bgc: { backgroundColor: '#fff' },
currentArea: null, currentArea: null,
couponCode: '', couponCode: '',
@ -141,7 +148,10 @@ export default {
verifyLoading: false, verifyLoading: false,
prepareItemList: [], prepareItemList: [],
preparePayload: null, // prepare verify 使 preparePayload: null, // prepare verify 使
appId: '1' appId: '1',
areaId: null,
successPopupVisible: false,
successCouponName: ''
} }
}, },
computed: { computed: {
@ -149,21 +159,18 @@ export default {
return this.currentArea && this.couponCode.trim().length > 0 && !this.verifyLoading return this.currentArea && this.couponCode.trim().length > 0 && !this.verifyLoading
} }
}, },
onLoad() { onLoad(options) {
this.appId = this.$store.state.appid || '1' this.appId = this.$store.state.appid || '1'
this.areaId = options.areaId
this.initDefaultArea() this.initDefaultArea()
}, },
methods: { methods: {
/** 初始化默认运营区:获取当前位置最近的运营区 */
async initDefaultArea() {
await this.fetchNearestArea()
},
/** 获取当前位置最近的运营区并设为默认 */ /** 获取当前位置最近的运营区并设为默认 */
async fetchNearestArea() { async initDefaultArea() {
try { try {
const loc = await this.getLocation() const loc = await this.getLocation()
if (!loc) return if (!loc) return
const url = `/app/area/nearbyVerifyList?appId=${this.appId}&center=${loc.longitude}&center=${loc.latitude}` const url = `/app/area/nearbyVerifyList?appId=${this.appId}&center=${loc.longitude}&center=${loc.latitude}&areaId=${this.areaId}`
const res = await this.$u.get(url) const res = await this.$u.get(url)
if (res.code === 200 && Array.isArray(res.data) && res.data.length > 0) { if (res.code === 200 && Array.isArray(res.data) && res.data.length > 0) {
const nearest = res.data[0] const nearest = res.data[0]
@ -252,10 +259,10 @@ export default {
}) })
uni.hideLoading() uni.hideLoading()
if (res.code === 200) { if (res.code === 200) {
this.$u.toast('核销成功') this.successCouponName = item.skuTitle || (item.vip && item.vip.name) || '卡券'
this.successPopupVisible = true
this.couponCode = '' this.couponCode = ''
this.preparePayload = null this.preparePayload = null
uni.navigateTo({ url: '/page_fenbao/huiyuan/myhuiyuan' })
} else { } else {
throw new Error(res.msg || '核销失败') throw new Error(res.msg || '核销失败')
} }
@ -263,6 +270,18 @@ export default {
uni.hideLoading() uni.hideLoading()
throw e throw e
} }
},
/** 查看卡券 */
onViewCard() {
this.successPopupVisible = false
uni.navigateTo({ url: '/page_fenbao/huiyuan/myhuiyuan' })
},
/** 继续核销 */
onContinueVerify() {
this.successPopupVisible = false
this.couponCode = ''
this.preparePayload = null
this.prepareItemList = []
} }
} }
} }