feat: 新增拼团

This commit is contained in:
2026-09-23 10:29:41 +08:00
parent f7b9e66172
commit 67f8b3f352
33 changed files with 7491 additions and 858 deletions
+11 -8
View File
@@ -6,14 +6,19 @@ if (process.env.NODE_ENV === 'development') {
}
// #endif
export const BASE_URL = "https://api.tbmall.xin"; //生产
export const MILD_BASE_URL = "https://agent.tbmall.xin/"; //中台生产
export const kefuBaseUrl = "https://admin.tbmall.xin/api";
// export const BASE_URL = "https://api.tbmall.xin"; //生产
// export const MILD_BASE_URL = "https://agent.tbmall.xin/"; //中台生产
// export const kefuBaseUrl = "https://admin.tbmall.xin/api";
// export const SHARE_URL = 'https://h.tbmall.xin';
// export const BASE_URL = baseUrl; // 本地测试
// export const MILD_BASE_URL = "https://agent.o.tbmall.xin/"; //中台测试
// export const kefuBaseUrl = "https://admin.o.tbmall.xin/api";
export const BASE_URL = baseUrl; // 本地测试
export const SHARE_URL = 'https://h.o.tbmall.xin';
// 微信小程序版本:0-正式版;1-开发版;2-体验版。
// 如果 SHARE_URL 为 https://h.tbmall.xin 则为正式版(0),其余均为体验版(2)
export const MINI_PROGRAM_TYPE = (SHARE_URL && SHARE_URL.replace(/\/$/, '') === 'https://h.tbmall.xin') ? 0 : 2;
export const MILD_BASE_URL = "https://agent.o.tbmall.xin/"; //中台测试
export const kefuBaseUrl = "https://admin.o.tbmall.xin/api";
// https://h.o.tbmall.xin/#/
@@ -22,8 +27,6 @@ export const kefuBaseUrl = "https://admin.tbmall.xin/api";
export const KEFU_BASE_URL = kefuBaseUrl;
export const SHARE_URL = 'https://h.tbmall.xin';
export const PRIVACY_EN = "https://www.finecc.net/?Privacy-Agreement/";//隐私协议地址(英文版)
export const PRIVACY_CN = "https://www.finecc.net/?Privac |y/";//隐私协议地址(中文版)x
+5 -1
View File
@@ -42,10 +42,12 @@ export function filterDouyinPayWays(ways) {
return (ways || []).filter(item => item.type !== 'douyin');
// #endif
}
let pendingSuccessUrl = '';
async function showState(state, key, orderNum) {
if (key !== accountKey()) return;
if (state.state === 'paid') {
const navigated = await jumpToPaymentSuccess();
const navigated = await jumpToPaymentSuccess(pendingSuccessUrl);
if (key !== accountKey()) return;
if (!navigated) {
// Retain the record so the next onShow/click can retry navigation without paying again.
@@ -53,6 +55,7 @@ async function showState(state, key, orderNum) {
return;
}
failureShown.delete(key);
pendingSuccessUrl = '';
} else {
// Same failure page as WeChat/Alipay. Ending the UI attempt is not a channel close.
// Keep unresolved orders for reconciliation, but do not push the page on every onShow.
@@ -178,6 +181,7 @@ export async function appDypayFun(payment) {
// #ifdef APP-PLUS
if (active || resuming) return;
active = true;
pendingSuccessUrl = payment?.customSuccessUrl || '';
const key = accountKey();
try {
if (!key || !payment.orderNum) throw new Error('登录身份或支付订单编号缺失');
+11 -1
View File
@@ -454,7 +454,7 @@ export const FINANCE_WITHDRAWAL_STATUS = [
];
/**
* 页面:1-APP首页,2-APP分类页,3-资讯,4-爆单区,5-好物区,6-积分专区,7-数字积分页 8-新人专享、9-超级补贴、10-限时秒杀、11-领券中心
* 页面:1-APP首页,2-APP分类页,3-资讯,4-爆单区,5-好物区,6-积分专区,7-数字积分页 8-新人专享、9-超级补贴、10-限时秒杀、11-领券中心 12-拼团活动
* @type {[{value: string, key: string}]}
*/
export const APP_PAGE_TYPE = {
@@ -469,6 +469,7 @@ export const APP_PAGE_TYPE = {
SUPER_SUBSIDY: 9,
SECKILL: 10,
COUPON: 11,
GROUP_BUY: 12,
};
/**
@@ -520,6 +521,10 @@ export const ACTIVITY_TYPE = [
key: 'seckill',
value: "秒杀活动"
},
{
key: 'group',
value: "拼团活动"
},
]
// 商品--分类的类型 type
@@ -549,6 +554,11 @@ export const SORT_TYPE = [
value: "限时秒杀",
path: "/pages/active/limited-time/limited-time"
},
{
key: 22,
value: "超值拼团",
path: "/pages/active/group-buying/group-buying"
},
]
// 物流更改状态 0=未申请,1=待审核,2=审核通过,3=审核驳回
+27 -13
View File
@@ -1,5 +1,5 @@
import { appDypayFun } from './douyin-pay.js';
import { jumpToPaymentSuccess, jumpToPaymentFailure } from './payment-navigation.js';
import { appDypayFun } from './douyin-pay.js';
import { jumpToPaymentSuccess, jumpToPaymentFailure } from './payment-navigation.js';
import { feedback } from "@/api/payment.js";
/**
@@ -8,7 +8,7 @@ import { feedback } from "@/api/payment.js";
* @param {Object} orderId 支付的订单ID
* @param {Object} orderNum 支付的订单编号
*/
export function appWxpayFun(alipay, orderId, orderNum) {
export function appWxpayFun(alipay, orderId, orderNum, customSuccessUrl) {
const type = alipay.type;
const orderStr = alipay.orderStr;
console.log("微信支付---", alipay, type);
@@ -29,7 +29,7 @@ export function appWxpayFun(alipay, orderId, orderNum) {
success: function (res) {
console.log("success:" + res);
payFeedbackFun(orderId, orderNum, 1);
jumpWayOk();
jumpWayOk(customSuccessUrl);
},
fail: function (err) {
console.log("fail:", err);
@@ -53,7 +53,7 @@ export function appWxpayFun(alipay, orderId, orderNum) {
success: function (res) {
console.log("success:" + res);
payFeedbackFun(orderId, orderNum, 1);
jumpWayOk();
jumpWayOk(customSuccessUrl);
},
fail: function (err) {
console.log("fail:", err);
@@ -76,8 +76,9 @@ export function appWxpayFun(alipay, orderId, orderNum) {
* @param {Object} alipay 微信支付的参数
* @param {Object} orderId 支付的订单ID
* @param {Object} orderNum 支付的订单编号
* @param {string} customSuccessUrl 自定义成功跳转页面
*/
export function zfbPayFun(alipay, orderId, orderNum) {
export function zfbPayFun(alipay, orderId, orderNum, customSuccessUrl) {
console.log("alipay", alipay);
const type = alipay.type;
const orderStr = alipay.orderStr;
@@ -97,7 +98,7 @@ export function zfbPayFun(alipay, orderId, orderNum) {
success: function (res) {
console.log("zfbPayFun res", res);
payFeedbackFun(orderId, orderNum, 1);
jumpWayOk();
jumpWayOk(customSuccessUrl);
},
fail: function (err) {
console.error("支付宝支付error", err);
@@ -124,13 +125,26 @@ export const appDyPayFun = douyinPayFun;
export const appDouyinPayFun = douyinPayFun;
// 跳转到支付成功页面
export function jumpWayOk() {
return jumpToPaymentSuccess();
}
export function jumpWayOk(customUrl) {
if (customUrl) {
const pages = typeof getCurrentPages === "function" ? getCurrentPages() : [];
if (pages[pages.length - 1]?.route === customUrl.replace(/^\//, "")) return Promise.resolve(true);
return new Promise((resolve) => {
uni.redirectTo({
url: customUrl,
success: () => resolve(true),
fail: () => {
uni.navigateTo({ url: customUrl, success: () => resolve(true), fail: () => resolve(false) });
},
});
});
}
return jumpToPaymentSuccess();
}
// 跳转到支付失败页面
export function jumpWayError() {
return jumpToPaymentFailure();
}
export function jumpWayError() {
return jumpToPaymentFailure();
}
/**
* 支付结果回调
* @param {Object} orderId 支付订单ID
+2 -2
View File
@@ -1,6 +1,6 @@
// Shared result pages for WeChat, Alipay and Douyin. Keep the existing page design.
export function jumpToPaymentSuccess() {
return jumpToPaymentResult('/pages/order_package/order_submit_ok/order_submit_ok');
export function jumpToPaymentSuccess(customUrl) {
return jumpToPaymentResult(customUrl || '/pages/order_package/order_submit_ok/order_submit_ok');
}
export function jumpToPaymentFailure() {
+84 -68
View File
@@ -76,77 +76,93 @@ function request(options) {
reject(new Error('服务请求失败,请稍后重试'));
return;
}
if (data.status === 500) {
uni.showToast({
title: "系统异常,请稍后再试",
icon: "none", // 可选 success/loading/none
duration: 2000, // 持续时长,单位ms
mask: false, // 是否显示透明蒙层,防止触摸穿透
});
if (data.status === 500) {
uni.showToast({
title: "系统异常,请稍后再试",
icon: "none", // 可选 success/loading/none
duration: 2000, // 持续时长,单位ms
mask: false, // 是否显示透明蒙层,防止触摸穿透
});
reject(new Error('系统异常,请稍后再试'));
return;
}
// 601 微信登录没注册
if (data.bizcode === 100) {
resolve(data); // 成功时返回数据
} else if (data.bizcode === 201) {
if ([201, 200].includes(data.errcode)) {
uni.showToast({
title: "登录失效,请重新登录",
icon: "none", // 可选 success/loading/none
duration: 2000, // 持续时长,单位ms
mask: false, // 是否显示透明蒙层,防止触摸穿透
position: "middle", // 位置,可选 top/middle/bottom
});
} else {
uni.showToast({
title: data.msg,
icon: "none", // 可选 success/loading/none
duration: 2000, // 持续时长,单位ms
mask: false, // 是否显示透明蒙层,防止触摸穿透
position: "middle", // 位置,可选 top/middle/bottom
});
}
/**
* 205:已经有账号,返回登录页面
* 200 or 201:token失效,返回登录页面
*/
if ([201, 200, 205].includes(data.errcode)) {
uni.removeStorageSync(TOKEN_NAME);
uni.removeStorageSync(USER_DATA);
let timer = setTimeout(() => {
clearTimeout(timer);
timer = null;
uni.navigateTo({
url: "/pages/login_package/login/login",
});
}, 2000);
}
}
// 601 微信登录没注册
if (data.bizcode === 100) {
resolve(data); // 成功时返回数据
} else if (data.bizcode === 201) {
if ([201, 200].includes(data.errcode)) {
uni.showToast({
title: "登录失效,请重新登录",
icon: "none", // 可选 success/loading/none
duration: 2000, // 持续时长,单位ms
mask: false, // 是否显示透明蒙层,防止触摸穿透
position: "middle", // 位置,可选 top/middle/bottom
});
} else {
uni.showToast({
title: data.msg,
icon: "none", // 可选 success/loading/none
duration: 2000, // 持续时长,单位ms
mask: false, // 是否显示透明蒙层,防止触摸穿透
position: "middle", // 位置,可选 top/middle/bottom
});
}
/**
* 205:已经有账号,返回登录页面
* 200 or 201:token失效,返回登录页面
*/
if ([201, 200, 205].includes(data.errcode)) {
uni.removeStorageSync(TOKEN_NAME);
uni.removeStorageSync(USER_DATA);
let timer = setTimeout(() => {
clearTimeout(timer);
timer = null;
let redirectParam = "";
try {
const pages = getCurrentPages();
if (pages && pages.length) {
const cur = pages[pages.length - 1];
if (cur && cur.route && !cur.route.includes("login_package/login/login")) {
let path = "/" + cur.route;
const opts = cur.options || {};
const qs = Object.keys(opts)
.map((k) => `${k}=${encodeURIComponent(opts[k])}`)
.join("&");
if (qs) path += "?" + qs;
redirectParam = "?redirect=" + encodeURIComponent(path);
}
}
} catch (e) {}
uni.navigateTo({
url: `/pages/login_package/login/login${redirectParam}`,
});
}, 2000);
}
reject(data);
} else {
console.log("错误-1", data, url);
uni.showToast({
title: data.msg || "系统错误,请稍后再试",
icon: "none", // 可选 success/loading/none
duration: 2000, // 持续时长,单位ms
});
reject(data); // 其他错误情况返回错误信息
}
},
fail: (error) => {
console.log("错误-2", url);
if (isShowLoading) {
hideLoading();
}
uni.showToast({
title: "服务器异常,稍后再试",
icon: "none", // 可选 success/loading/none
duration: 2000, // 持续时长,单位ms
});
console.log("错误-1", data, url);
uni.showToast({
title: data.msg || "系统错误,请稍后再试",
icon: "none", // 可选 success/loading/none
duration: 2000, // 持续时长,单位ms
});
reject(data); // 其他错误情况返回错误信息
}
},
fail: (error) => {
console.log("错误-2", url);
if (isShowLoading) {
hideLoading();
}
uni.showToast({
title: "服务器异常,稍后再试",
icon: "none", // 可选 success/loading/none
duration: 2000, // 持续时长,单位ms
});
reject(error);
},
});
});
}
},
});
});
}
export default request;