...
|
...
|
@@ -27,46 +27,12 @@ let yas; |
|
|
|
|
|
Page(Object.assign({
|
|
|
data: {
|
|
|
shopId: 0,
|
|
|
productSkn: 0,
|
|
|
productName: '',
|
|
|
marketPrice: '',
|
|
|
salesPrice: '',
|
|
|
productImages: [],
|
|
|
storage_sum: 0,
|
|
|
buyImmediate: false,
|
|
|
loadingForPayment: false,
|
|
|
selectedSKU: 0,
|
|
|
colorSelected: false,
|
|
|
productSupportServiceList: [],
|
|
|
limitProductCode: '',
|
|
|
price: '',
|
|
|
defaultImage: '',
|
|
|
productDesc: [],
|
|
|
productPhrare: [],
|
|
|
productSizeTitle: [],
|
|
|
productSizeContent: [],
|
|
|
productMeasurementImage: [],
|
|
|
productWashTipsBoList: [],
|
|
|
productMaterialList: [],
|
|
|
productIntroImageList: [],
|
|
|
|
|
|
pickerData: {
|
|
|
view: {
|
|
|
isShow: false,
|
|
|
isSoldOutSoon: false,
|
|
|
goodsList: [],
|
|
|
sizeList: [],
|
|
|
image: '',
|
|
|
goodPrice: '',
|
|
|
price: '',
|
|
|
buyNumber: 1,
|
|
|
minusButtonEnable: false,
|
|
|
plusButtonEnable: true,
|
|
|
buyButtonEnable: true,
|
|
|
buy_limit_number: 0,
|
|
|
bundle_count: 0
|
|
|
},
|
|
|
sourceType: 'goodsDetail'
|
|
|
},
|
|
|
|
|
|
showSnapshootShare: false,
|
|
|
snapshootShareData: {},
|
|
|
|
...
|
...
|
@@ -95,23 +61,13 @@ Page(Object.assign({ |
|
|
productNotForSale: false,
|
|
|
},
|
|
|
onLoad: function(options) {
|
|
|
let productSkn = options.productSkn ? options.productSkn : '';
|
|
|
|
|
|
if (!productSkn) {
|
|
|
productSkn = options.product_skn ? options.product_skn : '';
|
|
|
}
|
|
|
let limitProductCode = options.limitProductCode ? options.limitProductCode : '';
|
|
|
|
|
|
this.setData({
|
|
|
productSkn
|
|
|
limitProductCode
|
|
|
});
|
|
|
this.productInfo();
|
|
|
|
|
|
setTimeout(() => {
|
|
|
this.supportService();
|
|
|
this.productIntro();
|
|
|
this.preferList();
|
|
|
}, 500);
|
|
|
|
|
|
yas = new Yas(app);
|
|
|
yas.pageOpenReport();
|
|
|
},
|
...
|
...
|
@@ -253,117 +209,47 @@ Page(Object.assign({ |
|
|
});
|
|
|
},
|
|
|
productInfo: function() {
|
|
|
detailModel.productInfo(this.data.productSkn)
|
|
|
detailModel.productInfo(app.getUid(), this.data.limitProductCode)
|
|
|
.then(res => {
|
|
|
if (res.code === 200) {
|
|
|
let ImgUrls = [];
|
|
|
let color_length = 0;
|
|
|
|
|
|
if (res.data.goods_list) {
|
|
|
color_length = res.data.goods_list.length;
|
|
|
}
|
|
|
res.data.goods_list.map((item, index) => {
|
|
|
let images = item.images_list;
|
|
|
|
|
|
ImgUrls = [...ImgUrls, ...images];
|
|
|
if (index === 0 && color_length === 1) {
|
|
|
item.selected = true;
|
|
|
this.data.colorSelected = true;
|
|
|
this.data.selectedProductId = item.goods_id;
|
|
|
}
|
|
|
});
|
|
|
let defaultImage;
|
|
|
|
|
|
let isSoldOutSoon = false;
|
|
|
let tags = res.data.tags;
|
|
|
|
|
|
if (tags) {
|
|
|
isSoldOutSoon = tags.includes('is_soon_sold_out');
|
|
|
if (res.data.defaultUrl) {
|
|
|
defaultImage = formatImage.image(res.data.defaultUrl, 168, 232);
|
|
|
}
|
|
|
|
|
|
// pickerData
|
|
|
let pickData = this.data.pickerData;
|
|
|
|
|
|
pickData.view.goodsList = res.data.goods_list;
|
|
|
pickData.view.isSoldOutSoon = isSoldOutSoon;
|
|
|
|
|
|
// 默认显示第一种颜色的尺码
|
|
|
pickData.view.sizeList = res.data.goods_list.length ? res.data.goods_list[0].size_list : [];
|
|
|
|
|
|
let plusButtonEnable = false;
|
|
|
let minusButtonEnable = false;
|
|
|
|
|
|
// 根据库存设置该尺码是否可以选择
|
|
|
let size_length = 0;
|
|
|
let productDesc = [];
|
|
|
|
|
|
if (pickData.view.sizeList) {
|
|
|
size_length = pickData.view.sizeList.length;
|
|
|
if (res.data.attachment) {
|
|
|
productDesc = res.data.attachment.map(a => {
|
|
|
return {
|
|
|
imageUrl: formatImage.image(a.attachUrl, 345, 216),
|
|
|
intro: a.intro
|
|
|
};
|
|
|
});
|
|
|
}
|
|
|
|
|
|
pickData.view.sizeList && pickData.view.sizeList.map((item, index) => {
|
|
|
item.enable = item.storage_number > 0;
|
|
|
if (index === 0 && size_length === 1 && this.data.colorSelected) {
|
|
|
// 当颜色被选中 并且只有一个size 时 才会自动 做选中尺码操作
|
|
|
pickData.view.buyButtonEnable = item.enable;
|
|
|
if (item.enable) {
|
|
|
item.selected = true;
|
|
|
plusButtonEnable = item.storage_number > 1;
|
|
|
this.setData({
|
|
|
selectedSKU: item.product_sku,
|
|
|
storageNumber: item.storage_number
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
pickData.view.plusButtonEnable = plusButtonEnable;
|
|
|
pickData.view.minusButtonEnable = minusButtonEnable;
|
|
|
pickData.view.image = formatImage.image(ImgUrls.length > 0 ? ImgUrls[0].image_url : '', 168, 232);
|
|
|
pickData.view.price = res.data.format_market_price;
|
|
|
pickData.view.goodPrice = res.data.format_sales_price;
|
|
|
|
|
|
let default_image = formatImage.image(ImgUrls.length > 0 ? ImgUrls[0].image_url : '', 750, 1000);
|
|
|
let default_image = defaultImage;
|
|
|
let product_qrCode = config.domains.api + '/wechat/miniapp/img-check.jpg?param=' + res.data.product_skn; // eslint-disable-line
|
|
|
|
|
|
let snapData = {
|
|
|
product_name: res.data.product_name,
|
|
|
product_price: '¥' + res.data.sales_price,
|
|
|
product_price: '¥' + res.data.price,
|
|
|
default_image,
|
|
|
product_qrCode,
|
|
|
product_skn: this.data.productSkn
|
|
|
};
|
|
|
|
|
|
this.setData({
|
|
|
productName: res.data.product_name,
|
|
|
marketPrice: res.data.format_market_price,
|
|
|
salesPrice: res.data.format_sales_price,
|
|
|
productImages: ImgUrls,
|
|
|
pickerData: pickData,
|
|
|
storage_sum: res.data.storage_sum,
|
|
|
productSkn: res.data.productSkn,
|
|
|
productName: res.data.productName,
|
|
|
price: res.data.price,
|
|
|
saleTime: res.data.saleTime,
|
|
|
reminderNum: res.data.reminderNum,
|
|
|
defaultImage,
|
|
|
productDesc,
|
|
|
snapshootShareData: snapData,
|
|
|
shopId: res.data.shop_id,
|
|
|
|
|
|
// 暂时没用
|
|
|
// brand_id: res.data.brand_id,
|
|
|
// isLimitBuy:res.data.isLimitBuy,
|
|
|
// is_deposit_advance:res.data.is_deposit_advance,
|
|
|
// is_secKill:res.data.is_secKill,
|
|
|
// is_advance:res.data.is_advance,
|
|
|
// sales_phrase: res.data.sales_phrase,
|
|
|
// expect_arrival_time: res.data.expect_arrival_time || '',
|
|
|
// isInstalment:res.data.isInstalment,
|
|
|
// product_id: res.data.product_id,
|
|
|
// vipPrice : res.data.vip || '',
|
|
|
// is_supplyed: res.data.is_supplyed,
|
|
|
// bundle_type: res.data.bundle_type,
|
|
|
// store_show_status: res.data.store_show_status,
|
|
|
// attribute: res.data.attribute,
|
|
|
productOnlyProvideByYohoAPP: res.data.is_secKill === 'Y' || res.data.is_advance === 'Y' || res.data.attribute === 3 || res.data.attribute === 4 || res.data.isLimitBuy || res.data.is_deposit_advance === 'Y', // eslint-disable-line
|
|
|
productOnlyProvideByYohoStore: res.data.store_show_status === 3 || res.data.store_show_status === 4, // eslint-disable-line
|
|
|
productNotForSale: res.data.attribute === 2,
|
|
|
showBottomTipView: true
|
|
|
});
|
|
|
|
|
|
this.shopRecList(res.data.shop_id);
|
|
|
}
|
|
|
});
|
|
|
},
|
...
|
...
|
|