v2.28.0 抖音团购
This commit is contained in:
parent
48191dbe57
commit
479bacee6d
|
|
@ -1,7 +1,7 @@
|
|||
const install = (Vue, vm) => {
|
||||
uni.setStorageSync('deptId', 100);
|
||||
Vue.prototype.$u.http.setConfig({
|
||||
baseUrl: 'http://192.168.1.3:4101', //键辉本地
|
||||
baseUrl: 'http://192.168.1.7:4101', //键辉本地
|
||||
// baseUrl: 'http://192.168.2.221:4101', //景森本地
|
||||
// baseUrl: 'https://ele.ccttiot.com/prod-api', //线上 小鹿appid: wx8a05cf95418a6859 小兔骑骑appid:wx38f96c87621a87ab 遇福兴https://fu.chuantewulian.cn wxcb1d6a5d9dca8bbe
|
||||
// baseUrl: 'https://cc.ccttiot.com/prod-api', //叉车线上
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ export default {
|
|||
// 查询用户会员卡列表
|
||||
getlist() {
|
||||
this.loading = true
|
||||
this.$u.get(`/app/vipUser/list?pageNum=1&pageSize=999&isEffective=true&minSurplusCount=1`).then((res) => {
|
||||
this.$u.get(`/app/vipUser/list?pageNum=1&pageSize=999&isEffective=true&minSurplusCount=1&orderByColumn=createTime&isAsc=desc`).then((res) => {
|
||||
this.loading = false
|
||||
if (res.code == 200) {
|
||||
this.cardList = res.rows || []
|
||||
|
|
|
|||
|
|
@ -1971,7 +1971,8 @@
|
|||
getjisuan() {
|
||||
let data = {
|
||||
suitId: this.suitId,
|
||||
channelId:this.channelId
|
||||
channelId:this.channelId,
|
||||
appId: this.$store.state.appid,
|
||||
}
|
||||
this.$u.post(`/app/order/calculatePrice`, data).then(res => {
|
||||
if (res.code == 200) {
|
||||
|
|
|
|||
411
page_user/verify/components/AreaSelectPopup.vue
Normal file
411
page_user/verify/components/AreaSelectPopup.vue
Normal file
|
|
@ -0,0 +1,411 @@
|
|||
<template>
|
||||
<u-popup v-model="visible" mode="bottom" :border-radius="24" @open="onOpen" @close="onClose">
|
||||
<view class="area-popup">
|
||||
<view class="popup-header">
|
||||
<text class="title">选择运营区</text>
|
||||
<view class="close-btn" @click="close">
|
||||
<u-icon name="close" size="36" color="#666"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 地图区域 -->
|
||||
<view class="map-section">
|
||||
<map
|
||||
id="verifyAreaMap"
|
||||
class="map"
|
||||
:latitude="mapCenter.lat"
|
||||
:longitude="mapCenter.lng"
|
||||
:markers="markers"
|
||||
:show-location="true"
|
||||
scale="14"
|
||||
@regionchange="onRegionChange"
|
||||
></map>
|
||||
<!-- 地图中心标识,提示用户可拖动查询 -->
|
||||
<view class="center-pin">
|
||||
<view class="pin-dot"></view>
|
||||
<view class="pin-stem"></view>
|
||||
</view>
|
||||
<view class="map-tip" @click="onRelocate">
|
||||
<u-icon name="map" size="28" color="#fff"></u-icon>
|
||||
<text>重新定位</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 运营区列表 -->
|
||||
<view class="area-list-section">
|
||||
<view class="list-title">
|
||||
<u-icon name="location" size="28" color="#3996FD"></u-icon>
|
||||
<text>已开通运营区</text>
|
||||
</view>
|
||||
<scroll-view scroll-y class="area-list" :style="{ height: listHeight }">
|
||||
<view
|
||||
v-for="(item, idx) in areaList"
|
||||
:key="item.id"
|
||||
class="area-item"
|
||||
:class="{ active: selectedArea && selectedArea.id === item.id }"
|
||||
@click="onSelectArea(item)"
|
||||
>
|
||||
<view class="area-index">{{ idx + 1 }}</view>
|
||||
<view class="area-main">
|
||||
<view class="area-name">{{ item.name }}</view>
|
||||
<view class="area-region">{{ item.regionMergerName || item.regionName || '--' }}</view>
|
||||
</view>
|
||||
<u-icon name="arrow-right" size="28" color="#c8c9cc"></u-icon>
|
||||
</view>
|
||||
<view v-if="loading" class="loading-wrap">
|
||||
<u-loading mode="circle" size="40"></u-loading>
|
||||
<text>加载中...</text>
|
||||
</view>
|
||||
<view v-else-if="!loading && areaList.length === 0" class="empty-wrap">
|
||||
<u-empty text="暂无开通核销的运营区" mode="list"></u-empty>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/**
|
||||
* 运营区选择弹窗组件
|
||||
* - 顶部地图,支持重新定位
|
||||
* - 底部运营区列表(仅开通核销功能的运营区,按距离排序)
|
||||
*/
|
||||
export default {
|
||||
name: 'AreaSelectPopup',
|
||||
props: {
|
||||
value: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
selectedArea: {
|
||||
type: Object,
|
||||
default: null
|
||||
},
|
||||
appId: {
|
||||
type: [String, Number],
|
||||
default: '1'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
mapCenter: { lat: 0, lng: 0 },
|
||||
areaList: [],
|
||||
loading: false,
|
||||
listHeight: '400rpx',
|
||||
markers: [],
|
||||
regionChangeTimer: null,
|
||||
mapContext: null
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
value: {
|
||||
immediate: true,
|
||||
handler(val) {
|
||||
this.visible = !!val
|
||||
}
|
||||
},
|
||||
visible(val) {
|
||||
this.$emit('input', val)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onOpen() {
|
||||
this.fetchLocationAndAreas()
|
||||
},
|
||||
onClose() {
|
||||
if (this.regionChangeTimer) {
|
||||
clearTimeout(this.regionChangeTimer)
|
||||
this.regionChangeTimer = null
|
||||
}
|
||||
this.$emit('close')
|
||||
},
|
||||
close() {
|
||||
this.visible = false
|
||||
},
|
||||
/** 获取定位并拉取运营区列表 */
|
||||
async fetchLocationAndAreas() {
|
||||
this.loading = true
|
||||
this.areaList = []
|
||||
try {
|
||||
const loc = await this.getLocation()
|
||||
if (loc) {
|
||||
this.mapCenter = { lat: loc.latitude, lng: loc.longitude }
|
||||
this.markers = [{
|
||||
id: 1,
|
||||
latitude: loc.latitude,
|
||||
longitude: loc.longitude,
|
||||
iconPath: '/static/image/icon8.png',
|
||||
width: 30,
|
||||
height: 30
|
||||
}]
|
||||
setTimeout(() => this.initMapContext(), 300)
|
||||
await this.fetchAreaList(loc.longitude, loc.latitude)
|
||||
} else {
|
||||
this.$u.toast('获取位置失败,请检查定位权限')
|
||||
}
|
||||
} catch (e) {
|
||||
this.$u.toast(e.message || '加载失败')
|
||||
} finally {
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
/** 获取定位 */
|
||||
getLocation() {
|
||||
return new Promise((resolve) => {
|
||||
uni.getLocation({
|
||||
type: 'gcj02',
|
||||
success: (res) => resolve(res),
|
||||
fail: () => resolve(null)
|
||||
})
|
||||
})
|
||||
},
|
||||
/** 初始化地图上下文 */
|
||||
initMapContext() {
|
||||
this.mapContext = uni.createMapContext('verifyAreaMap', this)
|
||||
},
|
||||
/** 拉取附近开通核销的运营区(根据地图中心) */
|
||||
async fetchAreaList(lng, lat) {
|
||||
this.loading = true
|
||||
try {
|
||||
const url = `/app/area/nearbyVerifyList?appId=${this.appId}¢er=${lng}¢er=${lat}`
|
||||
const res = await this.$u.get(url)
|
||||
if (res.code === 200 && Array.isArray(res.data)) {
|
||||
this.areaList = res.data
|
||||
} else {
|
||||
this.areaList = []
|
||||
}
|
||||
} finally {
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
/** 地图区域变化(拖动/缩放结束时查询中心点附近运营区) */
|
||||
onRegionChange(e) {
|
||||
if (e.type !== 'end' || e.causedBy !== 'drag') return
|
||||
if (this.regionChangeTimer) clearTimeout(this.regionChangeTimer)
|
||||
this.regionChangeTimer = setTimeout(() => {
|
||||
this.getMapCenterAndFetch()
|
||||
}, 200)
|
||||
},
|
||||
/** 获取地图中心点并拉取运营区列表 */
|
||||
getMapCenterAndFetch() {
|
||||
if (!this.mapContext) this.initMapContext()
|
||||
if (!this.mapContext) return
|
||||
this.mapContext.getCenterLocation({
|
||||
type: 'gcj02',
|
||||
success: (res) => {
|
||||
const lng = res.longitude
|
||||
const lat = res.latitude
|
||||
this.mapCenter = { lat, lng }
|
||||
this.fetchAreaList(lng, lat)
|
||||
}
|
||||
})
|
||||
},
|
||||
/** 重新定位 */
|
||||
onRelocate() {
|
||||
this.fetchLocationAndAreas()
|
||||
},
|
||||
/** 选择运营区 */
|
||||
onSelectArea(area) {
|
||||
this.$emit('select', area)
|
||||
this.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.area-popup {
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
background: linear-gradient(180deg, #f8fbff 0%, #fff 120rpx);
|
||||
}
|
||||
|
||||
.popup-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 28rpx 32rpx 24rpx;
|
||||
|
||||
.title {
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: #1a1a1a;
|
||||
letter-spacing: 0.5rpx;
|
||||
}
|
||||
|
||||
.close-btn {
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 50%;
|
||||
background: #f5f6f8;
|
||||
|
||||
&:active {
|
||||
background: #ebedf0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.map-section {
|
||||
position: relative;
|
||||
height: 340rpx;
|
||||
margin: 0 24rpx 24rpx;
|
||||
border-radius: 20rpx;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 8rpx 32rpx rgba(57, 150, 253, 0.08);
|
||||
|
||||
.map {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
|
||||
/* 地图中心标识,固定于视口中心,提示用户可拖动地图查询 */
|
||||
.center-pin {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -100%);
|
||||
pointer-events: none;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.pin-dot {
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
background: #3996FD;
|
||||
border: 4rpx solid #fff;
|
||||
border-radius: 50%;
|
||||
margin: 0 auto 0;
|
||||
box-shadow: 0 2rpx 12rpx rgba(57, 150, 253, 0.4);
|
||||
}
|
||||
|
||||
.pin-stem {
|
||||
width: 4rpx;
|
||||
height: 36rpx;
|
||||
background: #3996FD;
|
||||
margin: -4rpx auto 0;
|
||||
border-radius: 2rpx;
|
||||
box-shadow: 0 2rpx 8rpx rgba(57, 150, 253, 0.3);
|
||||
}
|
||||
|
||||
.map-tip {
|
||||
position: absolute;
|
||||
bottom: 24rpx;
|
||||
right: 24rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 16rpx 28rpx;
|
||||
background: linear-gradient(135deg, #3996FD 0%, #5eb3ff 100%);
|
||||
border-radius: 40rpx;
|
||||
font-size: 26rpx;
|
||||
color: #fff;
|
||||
box-shadow: 0 6rpx 20rpx rgba(57, 150, 253, 0.35);
|
||||
|
||||
text {
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
|
||||
&:active {
|
||||
opacity: 0.9;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.area-list-section {
|
||||
padding: 0 24rpx 32rpx;
|
||||
|
||||
.list-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 28rpx;
|
||||
color: #646566;
|
||||
margin-bottom: 20rpx;
|
||||
font-weight: 500;
|
||||
|
||||
text {
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.area-list {
|
||||
border-radius: 20rpx;
|
||||
background: #fff;
|
||||
box-shadow: 0 4rpx 24rpx rgba(0, 0, 0, 0.04);
|
||||
border: 1rpx solid #f0f1f3;
|
||||
}
|
||||
|
||||
.area-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 28rpx 28rpx;
|
||||
border-bottom: 1rpx solid #f5f6f8;
|
||||
transition: background 0.2s;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
&:first-child {
|
||||
border-radius: 20rpx 20rpx 0 0;
|
||||
}
|
||||
|
||||
&:active {
|
||||
background: #fafbfc;
|
||||
}
|
||||
|
||||
&.active {
|
||||
background: linear-gradient(90deg, rgba(57, 150, 253, 0.06) 0%, rgba(57, 150, 253, 0.02) 100%);
|
||||
}
|
||||
|
||||
.area-index {
|
||||
width: 44rpx;
|
||||
height: 44rpx;
|
||||
line-height: 44rpx;
|
||||
text-align: center;
|
||||
font-size: 24rpx;
|
||||
font-weight: 600;
|
||||
color: #3996FD;
|
||||
background: rgba(57, 150, 253, 0.1);
|
||||
border-radius: 12rpx;
|
||||
margin-right: 20rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.area-main {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.area-name {
|
||||
font-size: 32rpx;
|
||||
color: #1a1a1a;
|
||||
font-weight: 500;
|
||||
margin-bottom: 6rpx;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.area-region {
|
||||
font-size: 24rpx;
|
||||
color: #969799;
|
||||
line-height: 1.35;
|
||||
}
|
||||
}
|
||||
|
||||
.loading-wrap,
|
||||
.empty-wrap {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 80rpx;
|
||||
color: #969799;
|
||||
font-size: 28rpx;
|
||||
|
||||
text {
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
151
page_user/verify/components/CouponSelectPopup.vue
Normal file
151
page_user/verify/components/CouponSelectPopup.vue
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
<template>
|
||||
<u-popup v-model="visible" mode="center" :border-radius="16" @close="onClose">
|
||||
<view class="coupon-popup">
|
||||
<view class="popup-header">
|
||||
<text class="title">选择要核销的券</text>
|
||||
<u-icon name="close" size="40" @click="close"></u-icon>
|
||||
</view>
|
||||
<scroll-view scroll-y class="coupon-list" :style="{ maxHeight: '500rpx' }">
|
||||
<view
|
||||
v-for="(item, index) in itemList"
|
||||
:key="index"
|
||||
class="coupon-item"
|
||||
:class="{ active: selectedIndex === index }"
|
||||
@click="onSelect(index)"
|
||||
>
|
||||
<view class="coupon-title">{{ item.skuTitle || '卡券' }}</view>
|
||||
<view v-if="item.vip" class="coupon-vip">{{ item.vip.name }}</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="popup-footer">
|
||||
<u-button type="primary" @click="onConfirm" :disabled="selectedIndex < 0">
|
||||
确定核销
|
||||
</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/**
|
||||
* 券码选择弹窗
|
||||
* 当核销准备接口返回多个券时,让用户选择要核销的券
|
||||
*/
|
||||
export default {
|
||||
name: 'CouponSelectPopup',
|
||||
props: {
|
||||
value: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
itemList: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
selectedIndex: -1
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
value: {
|
||||
immediate: true,
|
||||
handler(val) {
|
||||
this.visible = !!val
|
||||
if (val) {
|
||||
this.selectedIndex = this.itemList.length === 1 ? 0 : -1
|
||||
}
|
||||
}
|
||||
},
|
||||
visible(val) {
|
||||
this.$emit('input', val)
|
||||
},
|
||||
itemList: {
|
||||
immediate: true,
|
||||
handler(list) {
|
||||
if (list && list.length === 1 && this.visible) {
|
||||
this.selectedIndex = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
close() {
|
||||
this.visible = false
|
||||
},
|
||||
onClose() {
|
||||
this.$emit('close')
|
||||
},
|
||||
onSelect(index) {
|
||||
this.selectedIndex = index
|
||||
},
|
||||
onConfirm() {
|
||||
if (this.selectedIndex < 0 || !this.itemList[this.selectedIndex]) {
|
||||
this.$u.toast('请选择要核销的券')
|
||||
return
|
||||
}
|
||||
this.$emit('confirm', this.itemList[this.selectedIndex])
|
||||
this.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.coupon-popup {
|
||||
width: 600rpx;
|
||||
padding: 30rpx;
|
||||
background: #fff;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
|
||||
.popup-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
.title {
|
||||
font-size: 34rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
|
||||
.coupon-list {
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.coupon-item {
|
||||
padding: 24rpx;
|
||||
margin-bottom: 16rpx;
|
||||
background: #f7f8fa;
|
||||
border-radius: 12rpx;
|
||||
border: 2rpx solid transparent;
|
||||
|
||||
&.active {
|
||||
border-color: #3996FD;
|
||||
background: #e8f4ff;
|
||||
}
|
||||
|
||||
.coupon-title {
|
||||
font-size: 30rpx;
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.coupon-vip {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.popup-footer {
|
||||
.u-btn {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
480
page_user/verify/index.vue
Normal file
480
page_user/verify/index.vue
Normal file
|
|
@ -0,0 +1,480 @@
|
|||
<template>
|
||||
<view class="page">
|
||||
|
||||
<view class="container">
|
||||
<!-- 运营区选择 -->
|
||||
<view class="section area-section animate-fade-in" @click="openAreaPopup">
|
||||
<view class="section-label">当前运营区</view>
|
||||
<view class="area-select">
|
||||
<text class="area-name">{{ currentArea ? currentArea.name : '请选择运营区' }}</text>
|
||||
<u-icon name="arrow-right" size="32" color="#999"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 核销方式(手风琴) -->
|
||||
<view class="verify-section animate-fade-in" style="animation-delay: 0.08s">
|
||||
<view class="section-label">核销方式</view>
|
||||
<view class="accordion">
|
||||
<view
|
||||
v-for="item in verifyMethods"
|
||||
:key="item.type"
|
||||
class="accordion-item"
|
||||
:class="{
|
||||
expanded: expandedType === item.type,
|
||||
disabled: item.disabled
|
||||
}"
|
||||
>
|
||||
<view
|
||||
class="accordion-header tip-card"
|
||||
:class="{ 'tip-card--disabled': item.disabled }"
|
||||
@click="toggleAccordion(item)"
|
||||
>
|
||||
<view class="tip-icon-wrap" :class="{ 'tip-icon-wrap--disabled': item.disabled }">
|
||||
<image class="tip-icon" :src="item.icon" mode="aspectFit" />
|
||||
</view>
|
||||
<view class="tip-content">
|
||||
<text class="tip-title">{{ item.title }}</text>
|
||||
<text class="tip-desc">{{ item.description }}</text>
|
||||
</view>
|
||||
<view class="arrow-wrap" :class="{ 'arrow-wrap--expanded': expandedType === item.type }">
|
||||
<u-icon name="arrow-down" size="28" :color="item.disabled ? '#c8c9cc' : '#969799'"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="accordion-body"
|
||||
:class="{
|
||||
'accordion-body--expanded': expandedType === item.type,
|
||||
'accordion-body--disabled': item.disabled
|
||||
}"
|
||||
>
|
||||
<view class="accordion-inner">
|
||||
<view v-if="!item.disabled" class="input-wrap">
|
||||
<u-input
|
||||
v-model="couponCode"
|
||||
type="text"
|
||||
placeholder="请输入券码"
|
||||
:border="false"
|
||||
:custom-style="{ fontSize: '30rpx', padding: '0 24rpx' }"
|
||||
/>
|
||||
</view>
|
||||
<view v-else class="coming-soon">{{ item.description }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 核销按钮 -->
|
||||
<view class="submit-section animate-fade-in" style="animation-delay: 0.16s">
|
||||
<u-button
|
||||
type="primary"
|
||||
:loading="verifyLoading"
|
||||
:disabled="!canVerify"
|
||||
@click="onVerify"
|
||||
>
|
||||
核销
|
||||
</u-button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 运营区选择弹窗 -->
|
||||
<area-select-popup
|
||||
v-model="areaPopupVisible"
|
||||
:selected-area="currentArea"
|
||||
:app-id="appId"
|
||||
@select="onAreaSelect"
|
||||
/>
|
||||
|
||||
<!-- 券码选择弹窗 -->
|
||||
<coupon-select-popup
|
||||
v-model="couponPopupVisible"
|
||||
:item-list="prepareItemList"
|
||||
@confirm="onCouponConfirm"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AreaSelectPopup from './components/AreaSelectPopup.vue';
|
||||
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
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
verifyMethods: VERIFY_METHODS,
|
||||
bgc: { backgroundColor: '#fff' },
|
||||
currentArea: null,
|
||||
couponCode: '',
|
||||
expandedType: 'douyin',
|
||||
areaPopupVisible: false,
|
||||
couponPopupVisible: false,
|
||||
verifyLoading: false,
|
||||
prepareItemList: [],
|
||||
preparePayload: null, // 保存 prepare 的请求参数,供 verify 使用
|
||||
appId: '1'
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
canVerify() {
|
||||
return this.currentArea && this.couponCode.trim().length > 0 && !this.verifyLoading
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.appId = this.$store.state.appid || '1'
|
||||
this.initDefaultArea()
|
||||
},
|
||||
methods: {
|
||||
/** 初始化默认运营区:获取当前位置最近的运营区 */
|
||||
async initDefaultArea() {
|
||||
await this.fetchNearestArea()
|
||||
},
|
||||
/** 获取当前位置最近的运营区并设为默认 */
|
||||
async fetchNearestArea() {
|
||||
try {
|
||||
const loc = await this.getLocation()
|
||||
if (!loc) return
|
||||
const url = `/app/area/nearbyVerifyList?appId=${this.appId}¢er=${loc.longitude}¢er=${loc.latitude}`
|
||||
const res = await this.$u.get(url)
|
||||
if (res.code === 200 && Array.isArray(res.data) && res.data.length > 0) {
|
||||
const nearest = res.data[0]
|
||||
this.currentArea = { id: nearest.id, name: nearest.name }
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('获取附近运营区失败', e)
|
||||
}
|
||||
},
|
||||
/** 获取定位 */
|
||||
getLocation() {
|
||||
return new Promise((resolve) => {
|
||||
uni.getLocation({
|
||||
type: 'gcj02',
|
||||
success: (res) => resolve(res),
|
||||
fail: () => resolve(null)
|
||||
})
|
||||
})
|
||||
},
|
||||
openAreaPopup() {
|
||||
this.areaPopupVisible = true
|
||||
},
|
||||
toggleAccordion(item) {
|
||||
if (item.disabled) return
|
||||
this.expandedType = this.expandedType === item.type ? '' : item.type
|
||||
},
|
||||
onAreaSelect(area) {
|
||||
this.currentArea = area
|
||||
},
|
||||
/** 执行核销流程 */
|
||||
async onVerify() {
|
||||
if (!this.canVerify) return
|
||||
this.verifyLoading = true
|
||||
try {
|
||||
const code = this.couponCode.trim()
|
||||
const areaId = this.currentArea.id
|
||||
const prepareRes = await this.callDouyinPrepare(code, areaId)
|
||||
if (!prepareRes || !prepareRes.itemList || prepareRes.itemList.length === 0) {
|
||||
this.$u.toast('未解析到可核销的券')
|
||||
return
|
||||
}
|
||||
this.preparePayload = { code, areaId }
|
||||
if (prepareRes.itemList.length > 1) {
|
||||
this.prepareItemList = prepareRes.itemList
|
||||
this.couponPopupVisible = true
|
||||
} else {
|
||||
await this.doVerify(prepareRes.itemList[0])
|
||||
}
|
||||
} catch (e) {
|
||||
this.$u.toast(e.message || '核销准备失败')
|
||||
} finally {
|
||||
this.verifyLoading = false
|
||||
}
|
||||
},
|
||||
/** 用户在弹窗中选择了券,执行核销 */
|
||||
async onCouponConfirm(item) {
|
||||
this.verifyLoading = true
|
||||
try {
|
||||
await this.doVerify(item)
|
||||
} catch (e) {
|
||||
this.$u.toast(e.message || '核销失败')
|
||||
} finally {
|
||||
this.verifyLoading = false
|
||||
}
|
||||
},
|
||||
/** 调用核销准备接口 */
|
||||
callDouyinPrepare(code, areaId) {
|
||||
return this.$u
|
||||
.post('/app/vipUser/douyinPrepare', { code, areaId })
|
||||
.then((res) => {
|
||||
if (res.code === 200) return res.data
|
||||
throw new Error(res.msg || '准备失败')
|
||||
})
|
||||
},
|
||||
/** 调用核销验券接口 */
|
||||
async doVerify(item) {
|
||||
if (!this.preparePayload) {
|
||||
throw new Error('参数异常,请重试')
|
||||
}
|
||||
uni.showLoading({ title: '核销中...', mask: true })
|
||||
try {
|
||||
const res = await this.$u.post('/app/vipUser/douyinVerify', {
|
||||
code: this.preparePayload.code,
|
||||
areaId: this.preparePayload.areaId,
|
||||
certificateId: item.certificateId
|
||||
})
|
||||
uni.hideLoading()
|
||||
if (res.code === 200) {
|
||||
this.$u.toast('核销成功')
|
||||
this.couponCode = ''
|
||||
this.preparePayload = null
|
||||
uni.navigateTo({ url: '/page_fenbao/huiyuan/myhuiyuan' })
|
||||
} else {
|
||||
throw new Error(res.msg || '核销失败')
|
||||
}
|
||||
} catch (e) {
|
||||
uni.hideLoading()
|
||||
throw e
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@keyframes fadeInUp {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(24rpx);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
.animate-fade-in {
|
||||
animation: fadeInUp 0.4s ease-out both;
|
||||
}
|
||||
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
background: #f7f8fa;
|
||||
}
|
||||
|
||||
.container {
|
||||
padding: 30rpx;
|
||||
}
|
||||
|
||||
.section {
|
||||
margin-bottom: 32rpx;
|
||||
padding: 30rpx;
|
||||
background: #fff;
|
||||
border-radius: 16rpx;
|
||||
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.04);
|
||||
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
||||
|
||||
&:active {
|
||||
transform: scale(0.99);
|
||||
}
|
||||
}
|
||||
|
||||
.section-label {
|
||||
font-size: 26rpx;
|
||||
color: #999;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.area-section {
|
||||
.area-select {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 16rpx 0;
|
||||
|
||||
.area-name {
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.verify-section {
|
||||
margin-bottom: 32rpx;
|
||||
|
||||
.section-label {
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.accordion {
|
||||
.accordion-item {
|
||||
margin-bottom: 20rpx;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
&.expanded {
|
||||
.accordion-header {
|
||||
border-radius: 16rpx 16rpx 0 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.accordion-header {
|
||||
cursor: pointer;
|
||||
transition: background 0.25s ease, border-radius 0.25s ease;
|
||||
|
||||
&:active:not(.tip-card--disabled) {
|
||||
opacity: 0.95;
|
||||
}
|
||||
}
|
||||
|
||||
.arrow-wrap {
|
||||
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
|
||||
&--expanded {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
}
|
||||
|
||||
.accordion-body {
|
||||
overflow: hidden;
|
||||
max-height: 0;
|
||||
background: #fff;
|
||||
border: 1rpx solid transparent;
|
||||
border-top: none;
|
||||
border-radius: 0 0 16rpx 16rpx;
|
||||
transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
|
||||
border-color 0.25s ease;
|
||||
|
||||
&--expanded {
|
||||
max-height: 300rpx;
|
||||
border-color: rgba(57, 150, 253, 0.12);
|
||||
}
|
||||
|
||||
&--disabled.accordion-body--expanded {
|
||||
border-color: rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
}
|
||||
|
||||
.accordion-inner {
|
||||
padding: 20rpx 24rpx 24rpx;
|
||||
}
|
||||
|
||||
.coming-soon {
|
||||
font-size: 28rpx;
|
||||
color: #969799;
|
||||
text-align: center;
|
||||
padding: 24rpx 0;
|
||||
}
|
||||
}
|
||||
|
||||
.tip-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 24rpx 20rpx;
|
||||
background: linear-gradient(135deg, #f8fbff 0%, #f0f7ff 100%);
|
||||
border-radius: 16rpx;
|
||||
border: 1rpx solid rgba(57, 150, 253, 0.12);
|
||||
transition: background 0.25s ease, border-color 0.25s ease, opacity 0.2s ease;
|
||||
|
||||
&--disabled {
|
||||
background: linear-gradient(135deg, #f8f9fa 0%, #f0f1f3 100%);
|
||||
border-color: rgba(0, 0, 0, 0.06);
|
||||
opacity: 0.85;
|
||||
}
|
||||
}
|
||||
|
||||
.tip-icon-wrap {
|
||||
width: 72rpx;
|
||||
height: 72rpx;
|
||||
flex-shrink: 0;
|
||||
margin-right: 24rpx;
|
||||
border-radius: 16rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: transform 0.2s ease;
|
||||
}
|
||||
|
||||
.tip-icon {
|
||||
width: 52rpx;
|
||||
height: 52rpx;
|
||||
}
|
||||
|
||||
.tip-content {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.tip-title {
|
||||
display: block;
|
||||
font-size: 30rpx;
|
||||
color: #1a1a1a;
|
||||
font-weight: 600;
|
||||
margin-bottom: 6rpx;
|
||||
}
|
||||
|
||||
.tip-desc {
|
||||
display: block;
|
||||
font-size: 26rpx;
|
||||
color: #646566;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.input-wrap {
|
||||
border: 1rpx solid #e4e7ed;
|
||||
border-radius: 12rpx;
|
||||
overflow: hidden;
|
||||
background: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.submit-section {
|
||||
margin-top: 60rpx;
|
||||
|
||||
.u-btn {
|
||||
width: 100%;
|
||||
height: 88rpx;
|
||||
font-size: 32rpx;
|
||||
transition: opacity 0.25s ease, transform 0.2s ease;
|
||||
|
||||
&[disabled] {
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
&:active:not([disabled]) {
|
||||
transform: scale(0.98);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -224,13 +224,19 @@
|
|||
"enablePullDownRefresh": false,
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},{
|
||||
}, {
|
||||
"path": "returnbike",
|
||||
"style": {
|
||||
"navigationBarTitleText": "上传",
|
||||
"enablePullDownRefresh": false,
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},{
|
||||
"path": "verify/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "团购核销",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},{
|
||||
"path": "huanbike",
|
||||
"style": {
|
||||
|
|
|
|||
19
pages/my.vue
19
pages/my.vue
|
|
@ -32,6 +32,12 @@
|
|||
</view>
|
||||
<image src="/static/image/jt.png" mode=""></image>
|
||||
</view>
|
||||
<view class="li" @click="btnpage(16)">
|
||||
<view class="lt">
|
||||
<image :src="appimg.mineCouponVerify" mode=""></image> 团购核销
|
||||
</view>
|
||||
<image src="/static/image/jt.png" mode=""></image>
|
||||
</view>
|
||||
<view class="li" @click="btnpage(5)">
|
||||
<view class="lt">
|
||||
<image :src="appimg.mineFaultReport" mode=""></image> 故障上报
|
||||
|
|
@ -492,6 +498,10 @@
|
|||
uni.navigateTo({
|
||||
url: '/page_fenbao/huiyuan/myhuiyuan'
|
||||
})
|
||||
} else if (num == 16) {
|
||||
uni.navigateTo({
|
||||
url: '/page_user/verify/index'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -811,6 +821,15 @@
|
|||
height: 48rpx;
|
||||
margin-right: 38rpx;
|
||||
}
|
||||
|
||||
.verify-icon {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
margin-right: 38rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
image {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user