diff --git a/src/packages/user/api/douyin.ts b/src/packages/user/api/douyin.ts
index 13f98c9..93e93c6 100644
--- a/src/packages/user/api/douyin.ts
+++ b/src/packages/user/api/douyin.ts
@@ -25,6 +25,8 @@ export interface VoucherItem {
status: number
mobile: string
product_name: string
+ // xuchao: 小泥人真实响应带此字段(前端按 product_id 过滤本渠道券码),mock 数据可不填,故设为可选
+ product_id?: string
merchant_name: string
voucherRealnameInfo?: VoucherRealnameInfo[]
}
diff --git a/src/packages/user/pages/buy.vue b/src/packages/user/pages/buy.vue
index be75c93..e772141 100644
--- a/src/packages/user/pages/buy.vue
+++ b/src/packages/user/pages/buy.vue
@@ -211,10 +211,8 @@ async function confirmBuy() {
uni.redirectTo({ url: `/packages/user/pages/order/detail?orderId=${outTradeNo}` })
}, 1500)
} catch (err: any) {
+ // xuchao: 取消/失败后仅提示,停留在购买页(原"跳订单列表"引用了 try 作用域外的 outTradeNo,实为失效死代码,已删)
uni.showToast({ title: err?.errMsg?.includes('cancel') ? '已取消支付' : '支付失败,请重试', icon: 'none' })
- setTimeout(() => {
- uni.redirectTo({ url: `/packages/user/pages/order/list?outTradeNo=${outTradeNo}` })
- }, 1500)
} finally {
paying.value = false
}
diff --git a/src/packages/user/pages/douyin-verify.vue b/src/packages/user/pages/douyin-verify.vue
index 5e5db9c..25461b4 100644
--- a/src/packages/user/pages/douyin-verify.vue
+++ b/src/packages/user/pages/douyin-verify.vue
@@ -4,16 +4,23 @@
-
+
第 1 步:
- 确认抖音下单信息
+ 确认第三方下单信息
- 请确认在抖音平台认证的号码与微信手机号一致,如号码不一致请在抖音订单详情页面复制券号,并粘贴在券号输入框
+ 请确认在第三方平台认证的号码与微信手机号一致,如号码不一致请在第三方订单详情页面复制券号,并粘贴在券号输入框
+
+
+
+
+
+
+
当前微信手机号:
@@ -22,7 +29,7 @@
- 抖音的订单券号:
+ 第三方的订单券号:
@@ -34,7 +41,7 @@
@tap="selectVoucher(group)"
>
- 抖音订单号{{ index + 1 }}:{{ group.code }}(可激活次数{{ group.count }}次)
+ 第三方订单号{{ index + 1 }}:{{ group.code }}(可激活次数{{ group.count }}次)
@@ -176,11 +183,11 @@
1.
- 抖音购卡的手机号和当前登录手机号码不一致
+ 第三方购卡的手机号和当前登录手机号码不一致
2.
- 抖音购卡的订单已经核销完成了
+ 第三方购卡的订单已经核销完成了
3.
@@ -248,6 +255,27 @@ import type { BannerItem } from '../../../api/types'
const userStore = useUserStore()
+// xuchao: 回调式 uni.request Promise 包装。当前 uni-app alpha 运行时下 `await uni.request()`
+// 返回的是 RequestTask(仅含 uniqueId 字段)而非 HTTP 响应,res.data 恒为 undefined,
+// 导致「获取凭证失败」;本页所有第三方直连请求统一改走此封装(对齐 api/request.ts 模式)。
+function rawRequest(options: {
+ url: string
+ method?: 'GET' | 'POST'
+ data?: object
+ header?: Record
+}): Promise {
+ return new Promise((resolve, reject) => {
+ uni.request({
+ url: options.url,
+ method: options.method || 'GET',
+ data: options.data as AnyObject,
+ header: options.header,
+ success: (res: UniApp.RequestSuccessCallbackResult) => resolve(res),
+ fail: (err: UniApp.GeneralCallbackResult) => reject(new Error(err.errMsg || 'request:fail')),
+ })
+ })
+}
+
const phone = ref((uni.getStorageSync('phone') as string) || '')
const maskedPhone = computed(() =>
phone.value ? phone.value.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2') : '-'
@@ -364,7 +392,7 @@ onShow(async () => {
async function fetchOAuthToken() {
try {
console.log('[douyin] fetching OAuth token...')
- const res = await uni.request({
+ const res = await rawRequest({
url: 'https://www.xiaoniren.cn/openapi/oauth2-token/authorize?client_id=uwfdRQD0CjHrz0oY&client_key=186c07637ed40ef9ef0a2289b188ac',
method: 'GET',
})
@@ -389,10 +417,12 @@ async function fetchVouchers() {
if (!phone.value || !accessToken.value) {
vouchers.value = []
vouchersLoaded.value = true
+ // xuchao: 凭证获取失败时无券可展示,同样弹温馨提示引导手动输入券码(此前静默无提示)
+ showNoVoucher.value = true
return
}
try {
- const res = await uni.request({
+ const res = await rawRequest({
url: `https://www.xiaoniren.cn/openapi/ticket/voucher-list?status=1&mobile=${phone.value}&product_id=59221&page=1&per-page=100`,
method: 'GET',
header: {
@@ -425,7 +455,7 @@ async function verifyInputCode() {
}
uni.showLoading({ title: '验证中...', mask: true })
try {
- const res = await uni.request({
+ const res = await rawRequest({
url: `https://www.xiaoniren.cn/openapi/ticket/voucher-list?status=1&code=${encodeURIComponent(code)}&product_id=59221&page=1&per-page=100`,
method: 'GET',
header: {
@@ -496,7 +526,7 @@ async function doActivate() {
uni.showLoading({ title: '核销中...', mask: true })
try {
// 第一步:调后端发卡绑定
- const sendRes = await uni.request({
+ const sendRes = await rawRequest({
url: `${BASE_URL}/open-api/card/sendAndBind`,
method: 'POST',
data: {
@@ -521,7 +551,7 @@ async function doActivate() {
}
// 第二步:验证券码
- const validateRes = await uni.request({
+ const validateRes = await rawRequest({
url: 'https://www.xiaoniren.cn/openapi/ticket/validate',
method: 'POST',
header: {
@@ -720,6 +750,18 @@ function closeNoVoucher() {
color: #ff383c;
line-height: 48rpx;
}
+/* xuchao: 券号下方第三方平台图标行(20x20、间隔 12px 的 2 倍 rpx) */
+.platform-logos {
+ display: flex;
+ flex-direction: row;
+ align-items: center;
+ gap: 24rpx;
+ margin-top: 24rpx;
+}
+.platform-logo {
+ width: 100rpx;
+ height: 100rpx;
+}
.field-box {
display: flex;
align-items: center;
diff --git a/src/pages.json b/src/pages.json
index 3935260..6ecf59c 100644
--- a/src/pages.json
+++ b/src/pages.json
@@ -141,7 +141,7 @@
{
"path": "pages/douyin-verify",
"style": {
- "navigationBarTitleText": "抖音核销",
+ "navigationBarTitleText": "第三方核销",
"backgroundColor": "#FFFFFF",
"backgroundColorTop": "#FFFFFF",
"backgroundColorBottom": "#FFFFFF"
diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue
index f9600f3..74395ba 100644
--- a/src/pages/index/index.vue
+++ b/src/pages/index/index.vue
@@ -9,37 +9,8 @@
-
-
-
-
- 公告
-
-
-
-
- {{ item.title }}
-
-
-
-
- 更多
-
-
-
-
-
+
+
+
+
+
+ 公告
+
+
+
+ {{ item.title }}
+
+
+
+ 更多
+
+
+
+
@@ -336,7 +329,7 @@ function onBannerClick(banner: BannerItem) {
/** 金刚区操作项 */
const quickActions = [
- { label: '抖音核销', icon: 'https://aliyunoss.hn12301.net/pxmall/douyin.png' },
+ { label: '核销验券', icon: 'https://aliyunoss.hn12301.net/pxmall/douyin.png' },
{ label: '我要绑卡', icon: 'https://aliyunoss.hn12301.net/pxmall/card.png' },
{ label: '我要预约', icon: 'https://aliyunoss.hn12301.net/pxmall/reserve.png' },
{ label: '我要入园', icon: 'https://aliyunoss.hn12301.net/pxmall/check.png' },
@@ -365,25 +358,13 @@ function onQuickAction(item: { label: string }) {
uni.navigateTo({ url: '/packages/content/pages/faq' })
return
}
- if (item.label === '抖音核销') {
+ if (item.label === '核销验券') {
uni.navigateTo({ url: '/packages/user/pages/douyin-verify' })
return
}
uni.showToast({ title: `${item.label}功能开发中`, icon: 'none' })
}
-/** 公告轮播状态 */
-const swiperAutoplay = ref(true)
-const currentNoticeIndex = ref(0)
-const currentNoticeType = computed(() => announcements.value[currentNoticeIndex.value]?.type || 'scenic')
-
-/** @param e - swiper change 事件,`{ detail: { current } }` */
-function onNoticeChange(e: { detail: { current: number } }) { currentNoticeIndex.value = e.detail.current }
-/** 触摸公告轮播时暂停自动播放 */
-function onNoticeTouchStart() { swiperAutoplay.value = false }
-/** 触摸结束后恢复自动播放 */
-function onNoticeTouchEnd() { swiperAutoplay.value = true }
-
/** 打开公告详情页 */
function openNotice(item: BannerItem & { typeLabel: string }) {
uni.setStorageSync('notice_detail', {
@@ -500,7 +481,7 @@ function goMore() {
align-items: center;
background: $color-card;
padding: $spacing-2 $spacing-3;
- margin: $spacing-2 $spacing-3 0;
+ margin: 0 $spacing-3 $spacing-3;
border-radius: 24rpx;
box-shadow: $shadow-sm;
}
@@ -520,21 +501,25 @@ function goMore() {
font-weight: $font-weight-medium;
}
-.notice-swiper {
+/* xuchao: 公告两条同时展示,纵向排列替换原单条轮播 */
+.notice-list {
flex: 1;
- height: 40rpx;
+ display: flex;
+ flex-direction: column;
+ gap: $spacing-1;
+ overflow: hidden;
}
.notice-item {
display: flex;
align-items: center;
- height: 40rpx;
+ height: 56rpx;
}
.notice-text {
font-size: $font-size-sm;
color: $color-muted-foreground;
- line-height: 40rpx;
+ line-height: 56rpx;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;