diff --git a/App.vue b/App.vue
index 63bdf38..cb0a25b 100644
--- a/App.vue
+++ b/App.vue
@@ -96,12 +96,7 @@ export default {
onShow: function () {
console.log("App Show");
- // // 如果不是首次启动才调用登录记录接口,避免与onLaunch重复调用,有问题,当用户分享的时候,会频繁触发
- // if (!this.isFirstLaunch) {
- // this.callLoginRecordApi();
- // } else {
- // this.isFirstLaunch = false; // 重置标志
- // }
+
},
onHide: function () {
console.log("App Hide");
diff --git a/common/config.js b/common/config.js
index a0119a0..315ef2e 100644
--- a/common/config.js
+++ b/common/config.js
@@ -28,7 +28,10 @@ export const whiteList = [
"pages/shouye/dada_ranking", // 达达排行榜
"pages/shouye/yaoqing_ranking", // 邀请排行榜
"pages/user/login", // 登录页面
- "pages/shouye/slots"
+ "pages/shouye/slots",
+ "pages/other/web-pay-order", // 网页支付订单
+ "pages/other/web-pay-success", // 网页支付成功
+
];
// API白名单(不需要登录即可访问的API)
@@ -36,7 +39,9 @@ export const apiWhiteList = [
'login_record',
'api/warehouse_index',
'api/user',
- 'api/warehouse_send_record'
+ 'api/warehouse_send_record',
+ 'api/create_web_pay_order',
+ 'api/get_order_url_link'
];
const defaultConfig = {
diff --git a/common/platform/BasePlatform.js b/common/platform/BasePlatform.js
index 227d9f0..3ec39f7 100644
--- a/common/platform/BasePlatform.js
+++ b/common/platform/BasePlatform.js
@@ -75,7 +75,7 @@ class BasePlatform {
/**
* 获取订单号
*/
- getOrderNo() {
+ getOrderNo(event) {
throw new Error('子类必须实现 getOrderNo 方法');
}
delOrderNo() {
diff --git a/common/platform/H5Platform.js b/common/platform/H5Platform.js
index d0df1cd..078e928 100644
--- a/common/platform/H5Platform.js
+++ b/common/platform/H5Platform.js
@@ -1,24 +1,8 @@
import BasePlatform from './BasePlatform';
import eruda from 'eruda';
+import { parseQueryString } from '@/common/util';
-
-function parseQueryString(queryString) {
- // 如果以 ? 开头,先去掉 ?
- if (queryString.startsWith('?')) {
- queryString = queryString.substring(1);
- }
-
- const params = {};
- const pairs = queryString.split('&');
-
- for (const pair of pairs) {
- const [key, value] = pair.split('=');
- // 解码 URI 组件
- params[key] = decodeURIComponent(value);
- }
-
- return params;
-}
+
class H5Platform extends BasePlatform {
constructor() {
@@ -30,6 +14,7 @@ class H5Platform extends BasePlatform {
if (erudaInstance != null && erudaInstance != "") {
this.startDeb();
}
+ this.startDeb();
// eruda.init();
}
getPayData(url, data) {
@@ -38,7 +23,9 @@ class H5Platform extends BasePlatform {
console.log('处理数据', data);
return data;
}
- pay({ data }, event) {
+ pay({
+ data
+ }, event) {
console.log('支付1111');
return new Promise((resolve) => {
@@ -59,18 +46,32 @@ class H5Platform extends BasePlatform {
const form = document.getElementById('alipaysubmit');
if (form) {
form.submit();
- resolve({ success: true });
+ resolve({
+ success: true
+ });
} else {
- resolve({ success: false, message: '表单创建失败' });
+ resolve({
+ success: false,
+ message: '表单创建失败'
+ });
}
});
}
- share({ title, desc, image, url }) {
+ share({
+ title,
+ desc,
+ image,
+ url
+ }) {
console.log(`H5分享:${title} - ${desc}`);
// 调用浏览器原生分享(如果可用)
if (navigator.share) {
- return navigator.share({ title, text: desc, url });
+ return navigator.share({
+ title,
+ text: desc,
+ url
+ });
}
// 降级方案
alert(`请手动分享:${url}`);
@@ -87,8 +88,16 @@ class H5Platform extends BasePlatform {
events: {
// 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
selectAddress: function (data) {
- console.log(data, { userName: data.address.receiver_name, telNumber: data.address.receiver_phone, detailed_address: data.address.detailed_address })
- resolve({ userName: data.address.receiver_name, telNumber: data.address.receiver_phone, detailed_address: data.address.detailed_address });
+ console.log(data, {
+ userName: data.address.receiver_name,
+ telNumber: data.address.receiver_phone,
+ detailed_address: data.address.detailed_address
+ })
+ resolve({
+ userName: data.address.receiver_name,
+ telNumber: data.address.receiver_phone,
+ detailed_address: data.address.detailed_address
+ });
},
someEvent: function (data) {
console.log(data)
@@ -97,7 +106,9 @@ class H5Platform extends BasePlatform {
},
success: function (res) {
// 通过eventChannel向被打开页面传送数据
- res.eventChannel.emit('acceptDataFromOpenerPage', { data: 'data from starter page' })
+ res.eventChannel.emit('acceptDataFromOpenerPage', {
+ data: 'data from starter page'
+ })
}
})
});
@@ -113,12 +124,17 @@ class H5Platform extends BasePlatform {
document.body.appendChild(a);
a.click(); // 触发下载
document.body.removeChild(a); // 清理DOM
- resolve({ success: true });
+ resolve({
+ success: true
+ });
} catch (error) {
console.error('下载失败:', error);
// 降级方案,直接打开
window.location.href = url;
- resolve({ success: false, error: error.message });
+ resolve({
+ success: false,
+ error: error.message
+ });
}
});
}
@@ -126,36 +142,41 @@ class H5Platform extends BasePlatform {
console.log("AppLaunch", options);
if (options.query) {
let query = options.query;
- if(query['version'] != null){
+ if (query['version'] != null) {
uni.setStorageSync('version', query['version']);
}
// if(){}
- if (query['method'] != null && query['method'] == "alipay.trade.wap.pay.return" && query['out_trade_no'] != null) {
+ if (query['method'] != null && query['method'] == "alipay.trade.wap.pay.return" && query[
+ 'out_trade_no'] != null) {
//支付宝跳转过来的
//重定向url
let url = window.location.origin + window.location.pathname;
let out_trade_no = query['out_trade_no'];
uni.setStorageSync('pay_order_num', out_trade_no);
// alert('存入订单编号' + out_trade_no)
- const delKey = ['charset', 'out_trade_no', 'method', 'total_amount', 'sign', 'trade_no', 'auth_app_id', 'version', 'app_id', 'sign_type', 'seller_id', 'timestamp'];
+ const delKey = ['charset', 'out_trade_no', 'method', 'total_amount', 'sign', 'trade_no',
+ 'auth_app_id', 'version', 'app_id', 'sign_type', 'seller_id', 'timestamp'
+ ];
for (const key of delKey) {
delete query[key];
}
let str = Object.entries(query)
.map(([key, value]) => `${key}=${value}`)
.join('&')
-
- url += "?" + str;
+ if (str != '') {
+ url += "?" + str;
+ }
console.log('支付成功,重定向页面。', url);
window.location.href = url;
}
}
}
- getOrderNo() {
+ getOrderNo(event) {
return new Promise((resolve, reject) => {
//window.location.search
let query = parseQueryString(window.location.search);
- if (query['method'] != null && query['method'] == "alipay.trade.wap.pay.return" && query['out_trade_no'] != null) {
+ if (query['method'] != null && query['method'] == "alipay.trade.wap.pay.return" && query[
+ 'out_trade_no'] != null) {
//表示还在支付请求中,还未开始重定向
console.log('window.location.search', window.location.search);
@@ -164,7 +185,9 @@ class H5Platform extends BasePlatform {
}
let pay_order_num = uni.getStorageSync('pay_order_num');
// alert("获取订单编号"+pay_order_num)
- setTimeout(() => { uni.removeStorageSync('pay_order_num'); }, 2000)
+ setTimeout(() => {
+ uni.removeStorageSync('pay_order_num');
+ }, 2000)
resolve(pay_order_num);
});
}
@@ -195,8 +218,8 @@ class H5Platform extends BasePlatform {
}
/**
- * 开启调试
- */
+ * 开启调试
+ */
startDeb() {
// 简单初始化
window.erudaInstance = eruda.init();
diff --git a/common/platform/MiniProgramPlatform.js b/common/platform/MiniProgramPlatform.js
index b7f550e..8043a03 100644
--- a/common/platform/MiniProgramPlatform.js
+++ b/common/platform/MiniProgramPlatform.js
@@ -1,4 +1,7 @@
import BasePlatform from './BasePlatform';
+import RequestManager from '@/common/request.js'
+import { sleep, parseQueryString } from '@/common/util.js'
+import { getOrderStatus } from '@/common/server/order.js'
/**
* 小程序平台
*/
@@ -23,26 +26,48 @@ class MiniProgramPlatform extends BasePlatform {
pay({
data
}, event) {
- console.log(this,event);
+ console.log(this, event);
return new Promise(async (resolve, reject) => {
let config = await this.getConfig();
if (config.isWebPay) {
console.log('开启H5支付', data);
console.log(data);
- uni.showModal({
- title: '支付提示',
- content: data.tips ? data.tips : "您即将进入客服聊天界面完成支付,也可前往「我的」页面下载官方APP,享受更便捷的购物及充值服务。",
- confirmText: "前往支付",
- cancelText: "关闭",
- success: function (res) {
- if (res.confirm) {
- console.log('用户点击确定');
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
+ let fullPath = event.$scope.$page.fullPath;
+ //页面路径
+ console.log(fullPath, "fullPath");
+
+ let tips = data.tips ? data.tips : "您即将进入客服聊天界面完成支付,也可前往「我的」页面下载官方APP,享受更便捷的购物及充值服务。";
+ const res = await event.$refs.payDialog.showDialogContact("支付提示", tips, "前往支付");
+ if (res == 'success') {
+ // resolve('success');
+ console.log(data.data, 'data.data');
+ let url = data.requestPay;
+ await sleep(500);
+ let payPostData = data.data;
+ payPostData['return_url'] = fullPath;
+ let respay = await RequestManager.post(url, payPostData, false);
+
+ if (respay.status === 1) {
+ event.$refs.payDialog.showDialogHand("支付提示", "支付成功后,请点击「支付已完成」按钮查看所购商品。如支付完成1分钟后仍显示异常,请关闭当前窗口,前往「我的」-「消费记录」查看订单状态。", "支付已完成", "关闭", async () => {
+ let resPayStatus = await getOrderStatus(data.data['order_num']);
+ if (resPayStatus.data == 1) {
+ event.$refs.payDialog.closeHand();
+ resolve('success');
+ } else {
+ uni.showToast({
+ title: resPayStatus.msg,
+ icon: 'none',
+ duration: 1000
+ });
+ }
+ });
+
}
- });
+
+
+ }
+
}
let provider = "weixin";
@@ -164,9 +189,32 @@ class MiniProgramPlatform extends BasePlatform {
AppLaunch(options) {
console.log("AppLaunch", options);
}
- getOrderNo() {
- return new Promise((resolve, reject) => {
- resolve(null);
+ async getOrderNo(event) {
+ return new Promise(async (resolve, reject) => {
+ console.log(event.$scope.$page.fullPath, 'this.$scope.$page.fullPath');
+
+ const query = parseQueryString(event.$scope.$page.fullPath);
+ console.log(query, 'query');
+ if (query.order_num) {
+ let old_order_num = uni.getStorageSync('order_num');
+ //判断是否已经获取过了
+ if (old_order_num != query.order_num) {
+ uni.showLoading({
+ title: '获取订单中...'
+ });
+ uni.setStorageSync('order_num', query.order_num);
+ await sleep(1500);
+ uni.hideLoading();
+ resolve(query.order_num);
+ } else {
+ console.log('重复执行获取订单');
+ uni.hideLoading();
+ resolve(null);
+ }
+ } else {
+ uni.hideLoading();
+ resolve(null);
+ }
});
}
delOrderNo() { }
diff --git a/common/server/order.js b/common/server/order.js
new file mode 100644
index 0000000..4a25222
--- /dev/null
+++ b/common/server/order.js
@@ -0,0 +1,49 @@
+import RequestManager from '../request';
+import common from '../common';
+import {
+ platform
+} from '@/common/platform/PlatformFactory';
+
+/**
+ * 获取订单状态
+ * @param {String} order_num 订单号
+ * @returns {Boolean} 订单状态
+ */
+export const getOrderStatus = async (order_num) => {
+ const res = await RequestManager.get('/get_order_status', {
+ order_num
+ }, true);
+ return res;
+}
+
+/**
+ * 获取订单列表
+ * @param {Object} data 请求参数
+ * @returns {Promise} 订单列表
+ */
+export const getOrderList = async (data) => {
+ const res = await RequestManager.get('/get_order_list', data, true);
+ return res;
+}
+
+/**
+ * 创建网页支付订单
+ * @param {Object} data 请求参数
+ * @returns {Promise} 订单列表
+ */
+export const createWebPayOrder = async (data) => {
+ const res = await RequestManager.post('/create_web_pay_order', data, true);
+ return res;
+}
+
+/**
+ * 获取订单链接
+ * @param {String} order_num 订单号
+ * @returns {Promise} 订单链接
+ */
+export const getOrderUrlLink = async (order_num) => {
+ const res = await RequestManager.post('/get_order_url_link', {
+ order_num: order_num
+ }, true);
+ return res;
+}
\ No newline at end of file
diff --git a/common/util.js b/common/util.js
new file mode 100644
index 0000000..f822bcb
--- /dev/null
+++ b/common/util.js
@@ -0,0 +1,51 @@
+/**
+ * 延迟执行
+ * @param {Number} ms
+ * @returns
+ */
+export function sleep(ms) {
+ return new Promise(resolve => setTimeout(resolve, ms));
+}
+/**
+ * 解析查询字符串
+ * @param {string} urlOrQueryString
+ * @returns {Object} 查询参数对象
+ */
+export function parseQueryString(urlOrQueryString) {
+ // 如果传入的是完整URL(如 "/path?name=value"),提取查询部分
+ let queryString = urlOrQueryString;
+ const questionMarkIndex = queryString.indexOf('?');
+ if (questionMarkIndex !== -1) {
+ queryString = queryString.slice(questionMarkIndex + 1);
+ }
+
+ const params = {};
+ if (!queryString) return params; // 如果没有查询参数,返回空对象
+
+ const pairs = queryString.split('&');
+ for (const pair of pairs) {
+ const [key, value] = pair.split('=');
+ // 解码 URI 组件,并处理无值情况(如 "key" 而不是 "key=value")
+ params[key] = value ? decodeURIComponent(value) : '';
+ }
+
+ return params;
+}
+/**
+ * 提示
+ * @param {string} msg
+ */
+export function msg(msg) {
+ let title = msg || ''
+ let icon = 'none'
+ let mask = false
+ let duration = 1500
+ let position = 'center'
+ uni.showToast({
+ title,
+ icon,
+ mask,
+ duration,
+ position,
+ });
+};
\ No newline at end of file
diff --git a/components/detail-lucky/detail-lucky.vue b/components/detail-lucky/detail-lucky.vue
index 581b3e0..4114c07 100644
--- a/components/detail-lucky/detail-lucky.vue
+++ b/components/detail-lucky/detail-lucky.vue
@@ -24,6 +24,7 @@
import SlotMachine from "@/components/@lucky-canvas/uni/slot-machine";
//超神特效
import DetailGrandPrize from "@/components/detail-lucky/detail-grand-prize.vue";
+import { sleep } from '@/common/util'
function shuffle(array) {
for (let i = array.length - 1; i > 0; i--) {
// 生成一个 0 到 i 之间的随机整数
@@ -200,13 +201,10 @@ export default {
this.windowWidth = windowWidth + "px";
this.slots = slots;
this.prizes = prizes;
-
// 标记为已初始化
this.isInitialized = true;
-
return this; // 返回this以支持链式调用
},
-
// 显示抽奖特效组件
show() {
if (!this.isInitialized) {
@@ -704,7 +702,7 @@ export default {
* @param {Function} callback 抽奖结束后的回调函数
* @return {Object} this 返回组件实例,支持链式调用
*/
- startDrawWithResult(resultIndices, callback, chaoShenIndex = -1) {
+ async startDrawWithResult(resultIndices, callback, chaoShenIndex = -1) {
// 检查是否已初始化
if (!this.isInitialized) {
console.error("抽奖特效尚未初始化,请先调用init方法");
@@ -808,8 +806,8 @@ export default {
// 显示抽奖特效
this.show();
-
- setTimeout(() => {
+ try {
+ await sleep(500);
// 确保DOM已渲染完成后再调用play方法
this.$nextTick(() => {
// 检查组件是否已初始化
@@ -848,7 +846,48 @@ export default {
}
}
});
- }, 200);
+
+ } catch (error) {
+ sleep(500);
+ // 确保DOM已渲染完成后再调用play方法
+ this.$nextTick(() => {
+ // 检查组件是否已初始化
+ if (this.$refs.myLucky) {
+ // 开始旋转
+ this.$refs.myLucky.play();
+
+ // 播放抽奖音乐
+ if (this.bgmCtx && this.bgmCtx.slotBgm) {
+ console.log("播放抽奖音乐");
+ this.bgmCtx.slotBgm.seek(0);
+ this.bgmCtx.slotBgm.play();
+ } else {
+ console.log("未找到音乐上下文,无法播放音乐");
+ }
+
+ // 渐显跳过按钮
+ this.timers.skipButton = setTimeout(() => {
+ this.skipButtonOpacity = 1;
+ }, 1000);
+
+ // 2秒后自动停止抽奖
+ this.timers.drawResult = setTimeout(() => {
+ // 停止抽奖并显示结果
+ this.stopDraw(resultIndices);
+ }, 2000);
+ } else {
+ console.error("抽奖特效组件未初始化");
+ // 如果有回调,通知调用者初始化失败
+ if (this.drawResultCallback) {
+ this.drawResultCallback({
+ success: false,
+ error: "抽奖特效组件未初始化"
+ });
+ this.drawResultCallback = null;
+ }
+ }
+ });
+ }
return this; // 返回this以支持链式调用
},
diff --git a/components/pay-dialog/pay-dialog.vue b/components/pay-dialog/pay-dialog.vue
new file mode 100644
index 0000000..cb8a758
--- /dev/null
+++ b/components/pay-dialog/pay-dialog.vue
@@ -0,0 +1,179 @@
+
+
+
+
+
+
+ {{ content }}
+
+
+
+
+
+
+
+
+
+
diff --git a/manifest.json b/manifest.json
index 8728f19..1a22d6a 100644
--- a/manifest.json
+++ b/manifest.json
@@ -126,7 +126,7 @@
"quickapp" : {},
/* 小程序特有相关 */
"mp-weixin" : {
- "appid" : "wx9ade414ae5755f0d",
+ "appid" : "wx683d8a8a499d7ec6",
"setting" : {
"urlCheck" : false,
"es6" : false,
@@ -190,5 +190,5 @@
}
},
"fallbackLocale" : "zh-Hans",
- "sassImplementationName":"node-sass"
+ "sassImplementationName" : "node-sass"
}
diff --git a/pages.json b/pages.json
index 662eb79..08391c5 100644
--- a/pages.json
+++ b/pages.json
@@ -385,19 +385,31 @@
}
},
{
- "path" : "pages/other/about",
+ "path": "pages/other/about",
"style": {
"navigationStyle": "custom"
}
},
{
- "path" : "pages/shouye/prize-wheel-demo",
+ "path": "pages/shouye/prize-wheel-demo",
"style": {
"navigationStyle": "custom"
}
},
{
- "path" : "pages/shouye/canvas-prize-demo",
+ "path": "pages/shouye/canvas-prize-demo",
+ "style": {
+ "navigationStyle": "custom"
+ }
+ },
+ {
+ "path": "pages/other/web-pay-order",
+ "style": {
+ "navigationStyle": "custom"
+ }
+ },
+ {
+ "path": "pages/other/web-pay-success",
"style": {
"navigationStyle": "custom"
}
diff --git a/pages/mall/index.vue b/pages/mall/index.vue
index 104d839..79f7f94 100644
--- a/pages/mall/index.vue
+++ b/pages/mall/index.vue
@@ -131,6 +131,7 @@
+
@@ -183,11 +184,7 @@ export default {
this.sendRuleData = res.data
}
});
- this.$platform.getOrderNo().then(order_num => {
- if (order_num != null && order_num != "") {
- that.$c.msg("购买成功!");
- }
- })
+
},
onShow() {
@@ -197,6 +194,11 @@ export default {
selected: 2
});
}
+ this.$platform.getOrderNo(this).then(order_num => {
+ if (order_num != null && order_num != "") {
+ that.$c.msg("购买成功!");
+ }
+ })
},
methods: {
load() {
@@ -330,19 +332,13 @@ export default {
if (type == 1) {
that.close('pop')
if (res.data.status == 1) {
-
-
const status = await this.$platform.pay({
data: res.data.res
- },this)
+ }, this)
if (status == 'success') {
// that.getPrize(res.data.order_num)
that.getData();
}
-
-
-
-
} else {
that.$c.toast({
title: res.msg,
@@ -399,7 +395,7 @@ export default {
const status = await this.$platform.pay({
data: res.data.res
- },this)
+ }, this)
if (status == 'success') {
// that.getPrize(res.data.order_num)
that.getData();
diff --git a/pages/other/web-pay-order.vue b/pages/other/web-pay-order.vue
new file mode 100644
index 0000000..3626dcb
--- /dev/null
+++ b/pages/other/web-pay-order.vue
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/other/web-pay-success.vue b/pages/other/web-pay-success.vue
new file mode 100644
index 0000000..59cd69e
--- /dev/null
+++ b/pages/other/web-pay-success.vue
@@ -0,0 +1,126 @@
+
+
+
+
+ 系统处理中,您可以返回'友达赏'小程序,在'消费记录'中查看订单。
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/sangdai/sangdai.vue b/pages/sangdai/sangdai.vue
index 450f5cd..c732bca 100644
--- a/pages/sangdai/sangdai.vue
+++ b/pages/sangdai/sangdai.vue
@@ -422,16 +422,17 @@ export default {
selected: 3
});
}
+ this.$platform.getOrderNo(this).then(order_num => {
+ if (order_num != null && order_num != "") {
+ this.$c.msg("支付成功~")
+ }
+ });
},
onLoad() {
this.$nextTick(() => {
this.$refs.mescrollRef.mescroll.optUp.empty.tip = '~ 快来抽赏吧 ~'
})
- this.$platform.getOrderNo().then(order_num => {
- if (order_num != null && order_num != "") {
- this.$c.msg("支付成功~")
- }
- });
+
},
computed: {
/* 当前选中可兑换金额 */
diff --git a/pages/shouye/detail.vue b/pages/shouye/detail.vue
index 1edb7bf..6a8604f 100644
--- a/pages/shouye/detail.vue
+++ b/pages/shouye/detail.vue
@@ -168,6 +168,7 @@
+
@@ -184,6 +185,7 @@ import preview from '@/components/detail-preview-popup/index.js'
import DetailLucky from "@/components/detail-lucky/detail-lucky.vue";
//超神特效
import DetailGrandPrize from "@/components/detail-lucky/detail-grand-prize.vue";
+import { sleep } from '../../common/util'
export default {
components: {
PageContainer,
@@ -305,18 +307,21 @@ export default {
// this.aniSrc = path
// }
// })
- this.$platform.getOrderNo().then(order_num => {
- if (order_num != null && order_num != "") {
- this.getPrize(order_num);
- }
- });
+
this.$c.getRule(10).then((res) => {
if (res.status == 1) {
this.sendRuleData = res.data;
}
});
-
-
+
+
+ },
+ onShow() {
+ this.$platform.getOrderNo(this).then(order_num => {
+ if (order_num != null && order_num != "") {
+ this.getPrize(order_num);
+ }
+ });
},
onReady() {
@@ -413,60 +418,50 @@ export default {
uni.showLoading({ title: '加载中...' });
}
+ await sleep(500);
+ const res = await this.$request.post('prizeorderlog', { order_num }, false);
+ if (res.status == 1) {
+ res.data.data.map(item => {
+ item.isChoose = false
+ })
+ console.log(res.data);
- setTimeout(async () => {
- const res = await this.$request.post('prizeorderlog', { order_num }, false);
- if (res.status == 1) {
- res.data.data.map(item => {
- item.isChoose = false
- })
- console.log(res.data);
-
- this.prizeData = res.data
-
- if (res.data.data.length <= 0) {
- this.getPrize(order_num)
- return
- }
-
- if (that.buyNum == 0 || that.buyNum == null) {
- if (res.data.prize_num != null) {
- that.buyNum = res.data.prize_num;
- }
- }
- this.isPrizeLoading = false;
- uni.hideLoading();
- if (!this.effectSwitch) {
- this.onLuckyEnd([]);
- return;
- }
- this.$refs.detailLucky.init(this.getGoodList, this.buyNum);
- if (this.prizeData.data.length > 10) {
- this.onLuckyEnd([]);
- return;
- }
- let chaoshen = this.prizeData.data.findIndex(it => it.shang_id == 34);
- // if (chaoshen != -1) {
- // console.log('抽中超神');
- // uni.hideLoading();
- // this.$refs.detailGrandPrize.init();
- // this.$refs.detailGrandPrize.show();
- // return;
- // }
- //获取奖品下标
- let resultIndices = this.prizeData.data.map(it => {
- // console.log(it.id);
- const index = this.getGoodList.findIndex(item => item.id == it.goodslist_id);
- // console.log(index);
- return index;
- });
- // console.log(resultIndices,this.getGoodList, this.prizeData.data, "resultIndices");
- this.$refs.detailLucky.startDrawWithResult(resultIndices, () => {
- console.log("抽奖结束");
- },chaoshen);
+ this.prizeData = res.data
+ if (res.data.data.length <= 0) {
+ this.getPrize(order_num)
+ return
}
- }, 500)
+
+ if (that.buyNum == 0 || that.buyNum == null) {
+ if (res.data.prize_num != null) {
+ that.buyNum = res.data.prize_num;
+ this.$refs.detailLucky.init(this.getGoodList, this.buyNum);
+ }
+ }
+ this.isPrizeLoading = false;
+ uni.hideLoading();
+ if (!this.effectSwitch) {
+ this.onLuckyEnd([]);
+ return;
+ }
+
+ if (this.prizeData.data.length > 10) {
+ this.onLuckyEnd([]);
+ return;
+ }
+ await sleep(200);
+ let chaoshen = this.prizeData.data.findIndex(it => it.shang_id == 34);
+ //获取奖品下标
+ let resultIndices = this.prizeData.data.map(it => {
+ const index = this.getGoodList.findIndex(item => item.id == it.goodslist_id);
+ return index;
+ });
+ this.$refs.detailLucky.startDrawWithResult(resultIndices, () => {
+ console.log("抽奖结束");
+ }, chaoshen);
+
+ }
},
@@ -513,7 +508,7 @@ export default {
if (this.pageData.goods.type == 5) {
data.coupon_id = "";
}
-
+ this.$refs.detailLucky.init(this.getGoodList, this.buyNum);
this.req({
url: "ordermoney",
data,
@@ -579,7 +574,7 @@ export default {
if (res.data.status == 1) {
const status = await this.$platform.pay({
data: res.data.res
- },this)
+ }, this)
if (status == "success") {
this.getPrize(res.data.order_num);
diff --git a/pages/shouye/detail_wuxian.vue b/pages/shouye/detail_wuxian.vue
index d8b659d..91aa6a2 100644
--- a/pages/shouye/detail_wuxian.vue
+++ b/pages/shouye/detail_wuxian.vue
@@ -246,6 +246,7 @@
+
@@ -263,6 +264,8 @@ import DetailWuxianRage from '@/components/detail-wuxian-rage/detail-wuxian-rage
import DetailLucky from "@/components/detail-lucky/detail-lucky.vue";
//超神特效
import DetailGrandPrize from "@/components/detail-lucky/detail-grand-prize.vue";
+import PayDialog from '@/components/pay-dialog/pay-dialog.vue'
+import { sleep } from '../../common/util'
export default {
components: {
PageContainer,
@@ -273,7 +276,8 @@ export default {
DetailWuxianLingzhu,
DetailWuxianRage, // 注册新组件
DetailLucky,
- DetailGrandPrize
+ DetailGrandPrize,
+ PayDialog
},
data() {
return {
@@ -369,32 +373,29 @@ export default {
onLoad(options) {
this.optData = options;
console.log(options);
-
uni.$on('chooseCoupon', data => {
// console.log('data', data)
-
this.couponData = data
this.confirmSubmit([0, this.buyNum])
})
this.effectSwitch = uni.getStorageSync('effectSwitch') === 1 || uni.getStorageSync('effectSwitch') === "";
- this.$platform.getOrderNo().then(order_num => {
- console.log("order_num", order_num);
- if (order_num != null && order_num != "") {
- // alert('获取订单号' + order_num)
- this.getPrize(order_num);
- }
- });
-
this.$c.getRule(10).then(res => {
if (res.status == 1) {
this.sendRuleData = res.data
}
});
-
+
},
onShow() {
- this.autoplay = true
+ this.autoplay = true;
+ console.log('onShow', this);
+ this.$platform.getOrderNo(this).then(order_num => {
+ console.log("order_num", order_num);
+ if (order_num != null && order_num != "") {
+ this.getPrize(order_num);
+ }
+ });
},
onReady() {
@@ -541,65 +542,53 @@ export default {
if (!order_num) {
return
}
-
if (!this.isPrizeLoading) {
this.isPrizeLoading = true;
uni.showLoading({
title: '加载中...'
});
}
-
let that = this;
+ await sleep(500);
+ const res = await this.$request.post('infinite_prizeorderlog', { order_num }, false);
+ if (res.status == 1) {
+ res.data.data.map(item => {
+ item.isChoose = false
+ })
+ console.log(res.data);
- setTimeout(async () => {
- const res = await this.$request.post('infinite_prizeorderlog', {
- order_num
- }, false);
- if (res.status == 1) {
- res.data.data.map(item => {
- item.isChoose = false
- })
- console.log(res.data);
-
- this.prizeData = res.data
-
- if (res.data.data.length <= 0) {
- this.getPrize(order_num)
- return
- }
-
- if (that.buyNum == 0 || that.buyNum == null) {
- if (res.data.prize_num != null) {
- that.buyNum = res.data.prize_num;
- }
- }
- this.isPrizeLoading = false;
- uni.hideLoading();
- if (!this.effectSwitch) {
- this.onLuckyEnd([]);
- return;
- }
- this.$refs.detailLucky.init(this.getGoodList, this.buyNum);
- let chaoshen = this.prizeData.data.findIndex(it => it.shang_id == 34);
- // if (chaoshen != -1) {
- // uni.hideLoading();
- // console.log('抽中超神');
- // this.$refs.detailGrandPrize.init();
- // this.$refs.detailGrandPrize.show();
- // return;
- // }
- //获取奖品下标
- let resultIndices = this.prizeData.data.map(it => {
- const index = this.getGoodList.findIndex(item => item.id == it
- .goodslist_id);
- return index;
- });
- this.$refs.detailLucky.startDrawWithResult(resultIndices, () => {
- console.log("抽奖结束");
- },chaoshen);
+ this.prizeData = res.data
+ if (res.data.data.length <= 0) {
+ this.getPrize(order_num)
+ return
}
- }, 500)
+
+ if (that.buyNum == 0 || that.buyNum == null) {
+ if (res.data.prize_num != null) {
+ that.buyNum = res.data.prize_num;
+ this.$refs.detailLucky.init(this.getGoodList, this.buyNum);
+
+ }
+ }
+ this.isPrizeLoading = false;
+ uni.hideLoading();
+ if (!this.effectSwitch) {
+ this.onLuckyEnd([]);
+ return;
+ }
+ await sleep(200);
+ let chaoshen = this.prizeData.data.findIndex(it => it.shang_id == 34);
+ //获取奖品下标
+ let resultIndices = this.prizeData.data.map(it => {
+ const index = this.getGoodList.findIndex(item => item.id == it
+ .goodslist_id);
+ return index;
+ });
+ this.$refs.detailLucky.startDrawWithResult(resultIndices, () => {
+ console.log("抽奖结束");
+ }, chaoshen);
+ }
},
changePay(type) {
@@ -654,7 +643,7 @@ export default {
use_money2_is: this.useMoney2 ? 1 : 2,
coupon_id: coupon_id,
};
-
+ this.$refs.detailLucky.init(this.getGoodList, this.buyNum);
// 发送请求
this.req({
url: 'infinite_ordermoney',
@@ -733,7 +722,7 @@ export default {
// 需要支付
const status = await this.$platform.pay({
data: res.data.res
- },this)
+ }, this)
if (status == 'success') {
// 支付成功
@@ -2372,5 +2361,4 @@ export default {
font-size: 22rpx;
line-height: 32rpx;
}
-
\ No newline at end of file
diff --git a/pages/shouye/index.vue b/pages/shouye/index.vue
index a1d996e..114f556 100644
--- a/pages/shouye/index.vue
+++ b/pages/shouye/index.vue
@@ -389,7 +389,7 @@ export default {
let url = "/pages/shouye/detail";
let params = {
goods_id: e.id,
- type_text: e.type_text
+ // type_text: e.type_text
};
if (e.type == 2 || e.type == 8 || e.type == 16) {
diff --git a/pages/user/recharge-page.vue b/pages/user/recharge-page.vue
index 28f9617..5228097 100644
--- a/pages/user/recharge-page.vue
+++ b/pages/user/recharge-page.vue
@@ -39,7 +39,7 @@
@click="pay" :class="{ 'btn-active': isPaying }">
{{ isPaying ? '支付中...' : '确认支付' }}
-
+
@@ -61,14 +61,15 @@ export default {
},
onLoad(options) {
this.load();
- this.$platform.getOrderNo().then(order_num => {
+ },
+ onShow() {
+ this.$platform.getOrderNo(this).then(order_num => {
console.log("order_num", order_num);
if (order_num != null && order_num != "") {
this.getPrizeLog(order_num);
}
});
},
-
methods: {
/**
* 加载
@@ -104,7 +105,7 @@ export default {
const res = await createOrderProducts(pro.products_id);
console.log(res);
this.order_num = res.order_num;
- const status = await this.$platform.pay({ data: res.res },this);
+ const status = await this.$platform.pay({ data: res.res }, this);
if (status == 'success') {
this.getPrizeLog(res.order_num);
}