|
|
import Taro, {Component, login} from '@tarojs/taro';
|
|
|
import {View, Swiper, SwiperItem, Image} from '@tarojs/components';
|
|
|
import {View, Swiper, SwiperItem, Image, Button} from '@tarojs/components';
|
|
|
import {productDetail as productDetailModel} from '../../models';
|
|
|
import {getImgUrl} from '../../utils';
|
|
|
import {ProductList, SelectSize} from '../../components';
|
...
|
...
|
@@ -9,11 +9,12 @@ import config from '../../config.js' |
|
|
import goYohoBuy from '../../assets/images/goYohoBuy@3x.png';
|
|
|
import goOnLine from '../../assets/images/goOnLine@3x.png';
|
|
|
import storeLocation from '../../assets/images/store-location@3x.png';
|
|
|
import backApp from '../../static/images/back2App@3x.png';
|
|
|
import { getGlobalData } from '../../libs/login/login.js';
|
|
|
import router from '../../router/index.js';
|
|
|
const urlParse = require('url');
|
|
|
const queryString = require('querystring');
|
|
|
import getPrivateKey from '../../libs/request/getPrivateKey.js';
|
|
|
|
|
|
import share from '../../static/images/share.png';
|
|
|
import collect from '../../static/images/collect.png';
|
|
|
import collectOff from '../../static/images/collect-off.png';
|
...
|
...
|
@@ -57,6 +58,8 @@ export default class ProductDetail extends Component { |
|
|
skup: '',
|
|
|
storeId: -1,
|
|
|
isLogin: false,
|
|
|
isGoApp: false,
|
|
|
appParameter: '',
|
|
|
productDec: {
|
|
|
color: {
|
|
|
text: '颜色',
|
...
|
...
|
@@ -225,20 +228,22 @@ export default class ProductDetail extends Component { |
|
|
loadElement(options) {
|
|
|
let productId = options.id
|
|
|
|
|
|
const globalData = getGlobalData();
|
|
|
let isGoApp = (globalData.ch == 1036 || globalData.ch == 1069 || globalData.ch == 1011) ? true : false;
|
|
|
|
|
|
let appParameter = `http://m.yohobuy.com?openby:yohobuy={"action":"go.ufo","params":{"pagename":"productDetail","productId":"${productId}"}}`;
|
|
|
|
|
|
if (options && options.scene && options.scene.length > 0) {
|
|
|
var scene = decodeURIComponent(options.scene)
|
|
|
var arr = scene ? scene.split("&") : [];
|
|
|
console.log('============333333==================');
|
|
|
console.log(scene);
|
|
|
console.log(arr);
|
|
|
console.log('============333333==================');
|
|
|
|
|
|
if (arr.length == 1) {
|
|
|
productId = scene;
|
|
|
}
|
|
|
}
|
|
|
this.setState({
|
|
|
id: productId
|
|
|
id: productId,
|
|
|
isGoApp,
|
|
|
appParameter
|
|
|
});
|
|
|
|
|
|
this.getProductData(productId);
|
...
|
...
|
@@ -271,10 +276,6 @@ export default class ProductDetail extends Component { |
|
|
}
|
|
|
product_qrCode = config.domains.yohoApi + '/wechat/miniapp/img-check.jpg?param=' + encodeURIComponent(JSON.stringify(param)) + '&miniQrType=23&miniapp_type=63';
|
|
|
|
|
|
console.log('====================================');
|
|
|
console.log(product_qrCode);
|
|
|
console.log('====================================');
|
|
|
|
|
|
var shareData = {
|
|
|
product_name : productInfo.product_name,
|
|
|
product_price: '¥'+productInfo.max_price,
|
...
|
...
|
@@ -384,7 +385,6 @@ export default class ProductDetail extends Component { |
|
|
}
|
|
|
|
|
|
reportStoreId(storeId, e) {
|
|
|
debugger
|
|
|
console.log(storeId);
|
|
|
console.log(e);
|
|
|
productDetailModel.storeIdLoginReport(storeId, 'OfflineStore', e.detail).then(ret => {});
|
...
|
...
|
@@ -504,6 +504,14 @@ export default class ProductDetail extends Component { |
|
|
router.go('productDetail', params)
|
|
|
}
|
|
|
|
|
|
launchAppError(e) {
|
|
|
Taro.showToast({
|
|
|
title: '打开失败!您可能未安装Yoho!Buy官方APP,请下载后再尝试。',
|
|
|
icon: 'none',
|
|
|
duration: 3000
|
|
|
})
|
|
|
}
|
|
|
|
|
|
componentWillUnmount() {
|
|
|
if (this.props.productDetail.showSharesheet) {
|
|
|
this.onCancelSharesheetCallback();
|
...
|
...
|
@@ -643,7 +651,15 @@ export default class ProductDetail extends Component { |
|
|
}
|
|
|
|
|
|
{
|
|
|
skup ? <Image className="goYohoBuy" onClick={this.goOnLineProuduct.bind(this, id)} src={goOnLine} mode="aspectFill" /> : <Image className="goYohoBuy" onClick={this.goYohoBuyMinApp.bind(this)} src={goYohoBuy} mode="aspectFill" />
|
|
|
isGoApp && (<Button type="default" hover-class="none" open-type="launchApp" app-parameter="{{appParameter}}" binderror="launchAppError">
|
|
|
<Image className="goYohoBuy" src={backApp} mode="aspectFill" />
|
|
|
</Button>)
|
|
|
}
|
|
|
{
|
|
|
(!isGoApp && skup) && <Image className="goYohoBuy" onClick={this.goOnLineProuduct.bind(this, id)} src={goOnLine} mode="aspectFill" />
|
|
|
}
|
|
|
{
|
|
|
(!isGoApp && !skup) && <Image className="goYohoBuy" onClick={this.goYohoBuyMinApp.bind(this)} src={goYohoBuy} mode="aspectFill" />
|
|
|
}
|
|
|
</View>)
|
|
|
}
|
...
|
...
|
|