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) => {
uni.setStorageSync('deptId', 100);
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: 'https://ele.ccttiot.com/prod-api', //线上 小鹿appid wx8a05cf95418a6859 小兔骑骑appidwx38f96c87621a87ab 遇福兴https://fu.chuantewulian.cn wxcb1d6a5d9dca8bbe
// baseUrl: 'https://cc.ccttiot.com/prod-api', //叉车线上

View File

@ -1,39 +1,54 @@
<template>
<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">
</u-navbar>
<view class="list">
<view class="list_item" v-for="(item,index) in huiyuanlist" :key="index" @click.stop="tobuy(item)">
<view class="lt">
<text class="discount">{{item.discountValue}}</text>
<view class="decoration">
<view class="circle circle1"></view>
<view class="circle circle2"></view>
<view class="circle circle3"></view>
</view>
</view>
<view class="rt">
<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 class="verify-entry" @click="goVerify" v-if="area != null && area.douyinEnable == true">
<view class="verify-entry-cards">
<view class="card card-back">
<image src="https://api.ccttiot.com/%E7%BE%8E%E5%9B%A2-copy-1772093915776.png" mode="aspectFit" />
</view>
<view class="card card-front">
<image src="https://api.ccttiot.com/%E6%8A%96%E9%9F%B3-1772093491243.png" mode="aspectFit" />
</view>
</view>
<view class="verify-entry-content">
<text class="verify-entry-title">团购核销</text>
<text class="verify-entry-desc">核销抖音美团等团购券</text>
</view>
<u-icon name="arrow-right" size="32" color="#999"></u-icon>
</view>
<view class="list">
<view class="list_item" v-for="(item,index) in huiyuanlist" :key="index" @click.stop="tobuy(item)">
<view class="lt">
<text class="discount">{{item.discountValue}}</text>
<view class="decoration">
<view class="circle circle1"></view>
<view class="circle circle2"></view>
<view class="circle circle3"></view>
</view>
</view>
</view>
</view>
<view class="rt">
<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' />
<view class="buy_box" v-if="show">
<view class="taocan">
@ -78,23 +93,36 @@
export default {
data() {
return {
bgc: {
backgroundColor: "#F7F8FA",
},
bgc: {
backgroundColor: "#F7F8FA",
},
show: false,
huiyuanobj:{},
huiyuanlist:[],
areaId:'',
channelId:'',
zfflag:true
zfflag:true,
area: {}
}
},
onLoad(option) {
this.areaId = option.areaId
this.gethuiyuan()
this.getAreaDetail()
this.gethuiyuan()
this.getchannelid()
},
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
getchannelid(){
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;
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 {
padding: 0 46rpx;

View File

@ -1,6 +1,6 @@
<template>
<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">
</u-navbar>
<view class="jieshao">
@ -165,7 +165,19 @@
当前车辆车型未配置套餐请管理员前往车型中配置
</view>
<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="info-item" v-if="actiobj.freeRideTime != null && actiobj.freeRideTime != '' && actiobj.freeRideTime != 0">
@ -213,17 +225,6 @@
</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>
@ -240,24 +241,21 @@
</view>
</view>
<!-- 会员 -->
<view class="fee_box" @click="btnhuiyuan" v-if="huiyuanlist.length > 0">
<view class="auto_box">
<view class="auto_li" v-for="(item,index) in huiyuanlist" :key="index">
<view class="txt1">
{{item.name.length > 6 ? item.name.slice(0,6) + '...' : item.name}}
</view>
<view class="txt1">
{{item.price}}
</view>
<view class="txt2">
折扣{{item.discountValue}}
</view>
<view class="buy_btn"> <!-- @click.stop="tobuy(item)" -->
购买
</view>
<!-- 特惠购卡/团购核销 入口有卡券或运营区开通核销时显示 -->
<view class="card-verify-entry" @click="btnhuiyuan" v-if="showCardVerifyEntry && bikeobj.areaId">
<view class="entry-cards">
<view class="card card-coupon">
<image src="https://api.ccttiot.com/%E4%BC%98%E6%83%A0%E5%88%B8-1772155543995.png" mode="aspectFit" />
</view>
<view class="card card-back">
<image src="https://api.ccttiot.com/%E7%BE%8E%E5%9B%A2-copy-1772093915776.png" mode="aspectFit" />
</view>
<view class="card card-front">
<image src="https://api.ccttiot.com/%E6%8A%96%E9%9F%B3-1772093491243.png" mode="aspectFit" />
</view>
</view>
<text class="entry-text">特惠购卡 / 团购核销</text>
<u-icon name="arrow-right" size="28" color="#999"></u-icon>
</view>
<u-mask :show="show" :z-index='100' />
@ -701,13 +699,11 @@
ggobj:null,
channelId: '',
sn: '',
tit: '',
logoflag: false,
ver_dataflag: 1,
deviceId: '',
name: '',
zhezhaoflag:true,
tit:' ',
actiobj:{},
countdown:1,
paymentList:[],
@ -725,6 +721,7 @@
huiyuanlist:[],
huiyuanobj:{},
areaDouyinEnable: false,
zfflag:true,
jieliuflag:true,
videoUrl:'',
@ -753,6 +750,11 @@
guideVideoId: '' //
}
},
computed: {
showCardVerifyEntry() {
return this.huiyuanlist.length > 0 || this.areaDouyinEnable
}
},
onLoad(option) {
console.log(option,'sasdadas');
if(option.duoirder){
@ -820,7 +822,6 @@
this.zhezhaoflag = false
uni.hideLoading()
}else{
this.tit= '确认订单页'
this.zhezhaoflag = false
uni.hideLoading()
this.modelId = option.modelId
@ -857,7 +858,6 @@
this.zhezhaoflag = false
uni.hideLoading()
} else {
this.tit= '确认订单页'
this.zhezhaoflag = false
uni.hideLoading()
//
@ -883,7 +883,7 @@
this.gettaocan()
this.getcheliang()
this.getQiniuToken()
this.getAreaDetailForGuide()
this.getAreaDetail()
}
}else{
uni.showModal({
@ -900,7 +900,6 @@
// this.logoflag = true
this.getlogo()
}else{
this.tit= '确认订单页'
this.zhezhaoflag = false
uni.hideLoading()
//
@ -926,7 +925,7 @@
this.getcheliang()
this.getQiniuToken()
this.gettaocan()
this.getAreaDetailForGuide()
this.getAreaDetail()
}
}else{
uni.showModal({
@ -949,7 +948,7 @@
onShow() {
// guideEnable
if (this.bikeobj && this.bikeobj.areaId) {
this.getAreaDetailForGuide()
this.getAreaDetail()
}
},
onHide() {
@ -1008,18 +1007,28 @@
})
},
// guideEnable id
getAreaDetailForGuide() {
getAreaDetail() {
if (!this.bikeobj || !this.bikeobj.areaId) return
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
const areaId = this.bikeobj.areaId
// guideVideoId guideVideo
const videoId = res.data.guideVideoId != null && res.data.guideVideoId !== '' ? String(res.data.guideVideoId) : res.data.guideVideo
const storageKey = 'trueorder_guide_seen_' + areaId
if (uni.getStorageSync(storageKey) === videoId) return // id
this.guideVideoUrl = res.data.guideVideo
this.guideVideoId = videoId
this.showGuideVideo = true
if (res.code != 200 || !res.data) {
return;
}
const data = res.data;
const areaId = data.id;
//
if (!data.guideEnable && !data.guideVideo) {
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
@ -1402,13 +1411,15 @@
this.show = true
this.huiyuanobj = item
},
//
//
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){
this.huiyuanlist = res.data
this.huiyuanlist = res.data || []
}
})
})
},
//
btnhuiyuan(){
@ -1876,7 +1887,7 @@
console.log(res.data,'020202');
this.$u.put(`/app/user/bindArea?areaId=${res.data.areaId}`).then(resp =>{})
this.gettaocan()
this.getAreaDetailForGuide()
this.getAreaDetail()
}
})
} else {
@ -1887,7 +1898,7 @@
this.mac = res.data.mac
this.bikeobj = res.data
this.gettaocan()
this.getAreaDetailForGuide()
this.getAreaDetail()
}
})
}
@ -2280,7 +2291,6 @@
})
}
})
this.tit = '确认订单页'
this.logoflag = false
} else {
uni.showToast({
@ -2758,75 +2768,72 @@
}
}
}
.fee_box {
margin-top: 38rpx;
position: relative;
margin-left: 24rpx;
width: 700rpx;
height: 288rpx;
background-image: url('https://lxnapi.ccttiot.com/bike/img/static/ugciMYClSGgJxP8HYoRU');
background-size: cover;
background-position: center;
background-repeat: no-repeat;
.auto_box::-webkit-scrollbar {
display: none;
.card-verify-entry {
display: flex;
align-items: center;
margin-top: 24rpx;
margin-left: 24rpx;
margin-right: 24rpx;
padding: 24rpx 28rpx;
background: linear-gradient(135deg, #f8fbff 0%, #f0f7ff 100%);
border-radius: 16rpx;
border: 1rpx solid rgba(57, 150, 253, 0.12);
transition: transform 0.2s ease;
&:active {
transform: scale(0.98);
}
.auto_box {
padding-left: 24rpx;
display: flex;
overflow-x: auto; /* 允许横向滚动 */
flex-wrap: nowrap; /* 禁止换行,保持所有元素在一行 */
position: absolute;
top: 90rpx;
width: 100%; /* 根据需要调整宽度 */
height: auto; /* 根据内容自动调整高度 */
.auto_li {
.entry-cards {
position: relative;
padding: 24rpx 28rpx;
margin-right: 22rpx;
width: 408rpx;
height: 176rpx;
flex-shrink: 0; /* 防止子元素被压缩 */
background-image: url('https://lxnapi.ccttiot.com/bike/img/static/ui88NWy9R1j2zFGojdHU');
background-size: cover;
background-position: center;
.txt1{
width: 100%;
font-weight: 700;
font-size: 34rpx;
color: #495E74;
letter-spacing: 0.5rpx;
}
.txt2{
font-weight: 600;
font-size: 26rpx;
color: #495E74;
margin-top: 8rpx;
}
.buy_btn{
position: absolute;
right: 28rpx;
bottom: 40rpx;
display: flex;
align-items: center;
justify-content: center;
width: 140rpx;
height: 56rpx;
background: linear-gradient(135deg, #495E74 0%, #5A6F88 100%);
border-radius: 28rpx;
font-weight: 700;
font-size: 28rpx;
color: #FFF3DB;
box-shadow: 0 4rpx 12rpx rgba(73, 94, 116, 0.3);
transition: all 0.3s ease;
&:active {
transform: scale(0.95);
box-shadow: 0 2rpx 6rpx rgba(73, 94, 116, 0.25);
}
}
}
}
width: 140rpx;
height: 80rpx;
margin-right: 24rpx;
.card {
position: absolute;
width: 56rpx;
height: 56rpx;
border-radius: 12rpx;
background: #fff;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.12);
padding: 6rpx;
box-sizing: border-box;
image {
width: 100%;
height: 100%;
}
}
.card-coupon {
left: 0;
top: 6rpx;
z-index: 0;
transform: rotate(-12deg);
}
.card-back {
left: 38rpx;
top: 2rpx;
z-index: 1;
transform: rotate(-6deg);
}
.card-front {
left: 76rpx;
top: 10rpx;
z-index: 2;
transform: rotate(8deg);
}
}
.entry-text {
flex: 1;
font-size: 30rpx;
font-weight: 600;
color: #1a1a1a;
}
}
.noticetc{
width: 680rpx;
@ -3542,19 +3549,21 @@
.check-icon {
position: absolute;
bottom: 16rpx;
right: 16rpx;
width: 48rpx;
height: 48rpx;
bottom: 0;
right: 0;
width: 56rpx;
height: 56rpx;
background: linear-gradient(135deg, #4297F3 0%, #60A5FA 100%);
border-radius: 50%;
clip-path: polygon(100% 0, 100% 100%, 0 100%);
display: flex;
align-items: center;
justify-content: center;
align-items: flex-end;
justify-content: flex-end;
padding: 0 6rpx 6rpx 0;
box-sizing: border-box;
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 {
font-size: 32rpx;
font-size: 28rpx;
font-weight: 700;
color: #FFFFFF;
line-height: 1;
@ -3639,8 +3648,6 @@
border-width: 3rpx;
background: linear-gradient(135deg, #F0F7FF 0%, #FFFFFF 100%);
box-shadow: 0 6rpx 20rpx rgba(66, 151, 243, 0.25);
transform: translateY(-2rpx);
height: 100% !important;
}
&.interval-billing {
@ -4113,11 +4120,17 @@
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.08);
border: 1rpx solid #F3F4F6;
.package-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 24rpx;
}
.package-title {
font-size: 32rpx;
color: #1F2937;
font-weight: 700;
margin-bottom: 24rpx;
letter-spacing: 0.5rpx;
}
@ -4189,38 +4202,29 @@
}
.package-buttons {
margin-top: 10rpx;
display: flex;
justify-content: space-between;
gap: 16rpx;
align-items: center;
gap: 12rpx;
.parking-btn {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
padding: 16rpx 28rpx;
background: #FFFFFF;
border: 2rpx solid #D1D5DB;
border-radius: 50rpx;
gap: 10rpx;
cursor: pointer;
transition: all 0.3s ease;
padding: 8rpx 18rpx;
background: rgba(66, 151, 243, 0.1);
border: 1rpx solid rgba(66, 151, 243, 0.3);
border-radius: 32rpx;
gap: 6rpx;
transition: all 0.2s ease;
&:active {
transform: scale(0.98);
background: #F9FAFB;
}
.btn-icon {
font-size: 28rpx;
color: #666;
line-height: 1;
transform: scale(0.96);
background: rgba(66, 151, 243, 0.15);
}
.btn-text {
font-size: 28rpx;
color: #333;
font-size: 24rpx;
color: #4297F3;
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="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="area-select">
<text class="area-name">{{ currentArea ? currentArea.name : '请选择运营区' }}</text>
@ -91,12 +91,21 @@
:item-list="prepareItemList"
@confirm="onCouponConfirm"
/>
<!-- 核销成功弹窗 -->
<verify-success-popup
v-model="successPopupVisible"
:coupon-name="successCouponName"
@viewCard="onViewCard"
@continueVerify="onContinueVerify"
/>
</view>
</template>
<script>
import AreaSelectPopup from './components/AreaSelectPopup.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 {
name: 'VerifyIndex',
components: {
AreaSelectPopup,
CouponSelectPopup
CouponSelectPopup,
VerifySuccessPopup
},
data() {
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' },
currentArea: null,
couponCode: '',
@ -141,7 +148,10 @@ export default {
verifyLoading: false,
prepareItemList: [],
preparePayload: null, // prepare verify 使
appId: '1'
appId: '1',
areaId: null,
successPopupVisible: false,
successCouponName: ''
}
},
computed: {
@ -149,21 +159,18 @@ export default {
return this.currentArea && this.couponCode.trim().length > 0 && !this.verifyLoading
}
},
onLoad() {
onLoad(options) {
this.appId = this.$store.state.appid || '1'
this.areaId = options.areaId
this.initDefaultArea()
},
methods: {
/** 初始化默认运营区:获取当前位置最近的运营区 */
async initDefaultArea() {
await this.fetchNearestArea()
},
/** 获取当前位置最近的运营区并设为默认 */
async fetchNearestArea() {
async initDefaultArea() {
try {
const loc = await this.getLocation()
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)
if (res.code === 200 && Array.isArray(res.data) && res.data.length > 0) {
const nearest = res.data[0]
@ -252,10 +259,10 @@ export default {
})
uni.hideLoading()
if (res.code === 200) {
this.$u.toast('核销成功')
this.successCouponName = item.skuTitle || (item.vip && item.vip.name) || '卡券'
this.successPopupVisible = true
this.couponCode = ''
this.preparePayload = null
uni.navigateTo({ url: '/page_fenbao/huiyuan/myhuiyuan' })
} else {
throw new Error(res.msg || '核销失败')
}
@ -263,6 +270,18 @@ export default {
uni.hideLoading()
throw e
}
},
/** 查看卡券 */
onViewCard() {
this.successPopupVisible = false
uni.navigateTo({ url: '/page_fenbao/huiyuan/myhuiyuan' })
},
/** 继续核销 */
onContinueVerify() {
this.successPopupVisible = false
this.couponCode = ''
this.preparePayload = null
this.prepareItemList = []
}
}
}