Commit dde6c79d by 张立顺

fix bug

1 parent f7dda912
...@@ -1335,22 +1335,10 @@ Page({ ...@@ -1335,22 +1335,10 @@ Page({
// 添加埋点 // 添加埋点
wx.$track.setTrackData(0, 'submit_order', {}, '', 1) wx.$track.setTrackData(0, 'submit_order', {}, '', 1)
}, },
init(userInfo) { /** 扫码 / scene 礼券:需在路由策略 setData 写入 scene 之后调用(见 onRoute) */
let { scene, orderObj } = this.data applyCouponFromScene(userInfo, sceneRaw) {
if (!orderObj.sellerMerchantName) { if (!sceneRaw) return
orderObj.sellerMerchantName = userInfo.merchantName let scene = decodeURIComponent(sceneRaw)
orderObj.sellerName = userInfo.name
orderObj.sellerMerchantId = userInfo.merchantId
orderObj.sellerUserId = userInfo.uuid
this.setData({
orderObj
})
}
// console.log(this.data)
// console.log(scene);
if (scene) {
scene = decodeURIComponent(scene)
if (userInfo.userType == 2) { if (userInfo.userType == 2) {
let id = scene.split('=')[1] let id = scene.split('=')[1]
...@@ -1407,6 +1395,20 @@ Page({ ...@@ -1407,6 +1395,20 @@ Page({
} }
}) })
} }
},
init(userInfo) {
let { scene, orderObj } = this.data
if (!orderObj.sellerMerchantName) {
orderObj.sellerMerchantName = userInfo.merchantName
orderObj.sellerName = userInfo.name
orderObj.sellerMerchantId = userInfo.merchantId
orderObj.sellerUserId = userInfo.uuid
this.setData({
orderObj
})
}
if (scene) {
this.applyCouponFromScene(userInfo, scene)
} }
}, },
async getSelectOrderGoodsList(merchantId) { async getSelectOrderGoodsList(merchantId) {
...@@ -2295,6 +2297,10 @@ Page({ ...@@ -2295,6 +2297,10 @@ Page({
try { try {
const routeContext = new RouteContext(this) const routeContext = new RouteContext(this)
await routeContext.execute(res) await routeContext.execute(res)
if (res && res.scene) {
const userInfo = this.data.userInfo || wx.$util.getUserInfo()
if (userInfo) this.applyCouponFromScene(userInfo, res.scene)
}
} catch (error) { } catch (error) {
console.error('onRoute execution failed:', error) console.error('onRoute execution failed:', error)
// Fallback: 至少保证页面不白屏 // Fallback: 至少保证页面不白屏
......
...@@ -263,7 +263,7 @@ const pointRecord = clickEventType => { ...@@ -263,7 +263,7 @@ const pointRecord = clickEventType => {
* @returns {Function} - 返回一个经过防抖处理的函数。 * @returns {Function} - 返回一个经过防抖处理的函数。
*/ */
const debounce = (func, delay, immediate) => { const debounce = (func, delay, immediate) => {
console.log(delay); // console.log(delay);
let timeoutId; // 用于保存定时器ID let timeoutId; // 用于保存定时器ID
return function (...args) { return function (...args) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!