Authored by 李奇

商品详情页扫描线下店商品码限制登录

... ... @@ -109,29 +109,18 @@ export default class ProductDetail extends Component {
const storeArr = p.split(',') || [];
const storeId = storeArr[1];
if (queryObj.skup) {
wx.hideShareMenu();
this.setState({
skup: queryObj.skup,
storeId
})
this.loadStoreProductInfo(queryObj.skup, storeId);
this.skupMustLogin(queryObj.skup, storeId);
} else {
this.loadElement({ id: queryObj.productId || queryObj.skn });
}
}
} else {
if (options && options.scene) {
console.log(options.scene);
let code = options.scene;
getQRCodeSource(code).then(json => {
if (json) {
if (json.skup) {
wx.hideShareMenu();
this.setState({
skup: json.skup,
storeId: json.storeId
});
this.loadStoreProductInfo(json.skup, json.storeId);
this.skupMustLogin(json.skup, json.storeId);
} else {
this.loadElement(json);
}
... ... @@ -139,12 +128,28 @@ export default class ProductDetail extends Component {
})
.catch(error => {
});
} else {
} else if(options.storeId && options.skup) {
this.skupMustLogin(options.skup, options.storeId);
}
else {
this.loadElement(options);
}
}
}
skupMustLogin(skup, storeId) {
wx.hideShareMenu();
this.setState({
skup,
storeId
});
event.emit('user-is-login', () => {
this.loadStoreProductInfo(skup, storeId);
}, () => {
Taro.redirectTo({
url: `/pages/productDetail/index?skup=${skup}&storeId=${storeId}`,
});
});
}
async loadStoreProductInfo(skup, storeId) {
await getPrivateKey();
productDetailModel.getStoreProductDetail(skup, storeId).then(res => {
... ...