Authored by 李奇

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

@@ -109,29 +109,18 @@ export default class ProductDetail extends Component { @@ -109,29 +109,18 @@ export default class ProductDetail extends Component {
109 const storeArr = p.split(',') || []; 109 const storeArr = p.split(',') || [];
110 const storeId = storeArr[1]; 110 const storeId = storeArr[1];
111 if (queryObj.skup) { 111 if (queryObj.skup) {
112 - wx.hideShareMenu();  
113 - this.setState({  
114 - skup: queryObj.skup,  
115 - storeId  
116 - })  
117 - this.loadStoreProductInfo(queryObj.skup, storeId); 112 + this.skupMustLogin(queryObj.skup, storeId);
118 } else { 113 } else {
119 this.loadElement({ id: queryObj.productId || queryObj.skn }); 114 this.loadElement({ id: queryObj.productId || queryObj.skn });
120 } 115 }
121 } 116 }
122 } else { 117 } else {
123 if (options && options.scene) { 118 if (options && options.scene) {
124 - console.log(options.scene);  
125 let code = options.scene; 119 let code = options.scene;
126 getQRCodeSource(code).then(json => { 120 getQRCodeSource(code).then(json => {
127 if (json) { 121 if (json) {
128 if (json.skup) { 122 if (json.skup) {
129 - wx.hideShareMenu();  
130 - this.setState({  
131 - skup: json.skup,  
132 - storeId: json.storeId  
133 - });  
134 - this.loadStoreProductInfo(json.skup, json.storeId); 123 + this.skupMustLogin(json.skup, json.storeId);
135 } else { 124 } else {
136 this.loadElement(json); 125 this.loadElement(json);
137 } 126 }
@@ -139,12 +128,28 @@ export default class ProductDetail extends Component { @@ -139,12 +128,28 @@ export default class ProductDetail extends Component {
139 }) 128 })
140 .catch(error => { 129 .catch(error => {
141 }); 130 });
142 - } else { 131 + } else if(options.storeId && options.skup) {
  132 + this.skupMustLogin(options.skup, options.storeId);
  133 + }
  134 + else {
143 this.loadElement(options); 135 this.loadElement(options);
144 } 136 }
145 } 137 }
146 } 138 }
147 - 139 + skupMustLogin(skup, storeId) {
  140 + wx.hideShareMenu();
  141 + this.setState({
  142 + skup,
  143 + storeId
  144 + });
  145 + event.emit('user-is-login', () => {
  146 + this.loadStoreProductInfo(skup, storeId);
  147 + }, () => {
  148 + Taro.redirectTo({
  149 + url: `/pages/productDetail/index?skup=${skup}&storeId=${storeId}`,
  150 + });
  151 + });
  152 + }
148 async loadStoreProductInfo(skup, storeId) { 153 async loadStoreProductInfo(skup, storeId) {
149 await getPrivateKey(); 154 await getPrivateKey();
150 productDetailModel.getStoreProductDetail(skup, storeId).then(res => { 155 productDetailModel.getStoreProductDetail(skup, storeId).then(res => {