|
|
import wx from '../../../utils/wx';
|
|
|
import {tapToLogin} from '../../../common/login';
|
|
|
import formatImage from '../../../utils/formatImage';
|
|
|
import listModel from '../../../models/product/list';
|
|
|
import detailModel from '../../../models/product/detail';
|
|
|
import config from '../../../common/config';
|
|
|
import {getGoodInfo, getGoodSize} from '../../../utils/productDetail';
|
...
|
...
|
@@ -74,7 +75,10 @@ Page({ |
|
|
loading: false
|
|
|
}
|
|
|
]
|
|
|
}
|
|
|
},
|
|
|
|
|
|
shopRecList: [],
|
|
|
preferList: []
|
|
|
},
|
|
|
onLoad: function (options) {
|
|
|
let productSkn = options.productSkn ? options.productSkn : '';
|
...
|
...
|
@@ -83,27 +87,11 @@ Page({ |
|
|
productSkn = options.product_skn ? options.product_skn : '';
|
|
|
}
|
|
|
|
|
|
// if (options.q && options.q.length >0){
|
|
|
// let urlstring = decodeURIComponent(options.q)
|
|
|
// let skn = this.getParameterByName('skn', urlstring)
|
|
|
// if (skn.length > 0) productSkn= skn;
|
|
|
// }
|
|
|
//
|
|
|
// if (options && options.scene && options.scene.length>0){
|
|
|
// var scene = decodeURIComponent(options.scene)
|
|
|
// if (scene.length > 0) productSkn = scene;
|
|
|
// }
|
|
|
|
|
|
// let from_page_name = options.page_name ? options.page_name : '';
|
|
|
// let from_page_param = options.page_param ? options.page_param : '';
|
|
|
// let current_page_param = productSkn;
|
|
|
// let uid = app.globalData.userInfo.uid>0?app.globalData.userInfo.uid:0;
|
|
|
|
|
|
// Picker.init(this);
|
|
|
this.setData({productSkn});
|
|
|
this.productInfo();
|
|
|
this.supportService();
|
|
|
this.productIntro();
|
|
|
this.preferList();
|
|
|
},
|
|
|
onShareAppMessage: function (res) {
|
|
|
let param = {
|
...
|
...
|
@@ -151,6 +139,63 @@ Page({ |
|
|
showSnapshootShare: false
|
|
|
})
|
|
|
},
|
|
|
shopRecList: function (shopId) {
|
|
|
listModel.productList({
|
|
|
page: 1,
|
|
|
limit: 20,
|
|
|
shop_id: shopId
|
|
|
}).then(res => {
|
|
|
if (res.code === 200) {
|
|
|
const keyAdapter = {
|
|
|
skn: 'product_skn',
|
|
|
salePriceStr: 'sales_price',
|
|
|
productName: 'product_name',
|
|
|
defaultImages: 'default_images'
|
|
|
};
|
|
|
let list = [];
|
|
|
|
|
|
(res.data.product_list || []).forEach(product => {
|
|
|
let item = {};
|
|
|
|
|
|
Object.keys(keyAdapter).forEach(key => {
|
|
|
item[key] = product[keyAdapter[key]]
|
|
|
});
|
|
|
list.push(item);
|
|
|
});
|
|
|
this.setData({
|
|
|
shopRecList: list
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
preferList: function () {
|
|
|
listModel.productList({
|
|
|
page: 1,
|
|
|
limit: 20
|
|
|
}).then(res => {
|
|
|
if (res.code === 200) {
|
|
|
const keyAdapter = {
|
|
|
skn: 'product_skn',
|
|
|
salePriceStr: 'sales_price',
|
|
|
productName: 'product_name',
|
|
|
defaultImages: 'default_images'
|
|
|
};
|
|
|
let list = [];
|
|
|
|
|
|
(res.data.product_list || []).forEach(product => {
|
|
|
let item = {};
|
|
|
|
|
|
Object.keys(keyAdapter).forEach(key => {
|
|
|
item[key] = product[keyAdapter[key]]
|
|
|
});
|
|
|
list.push(item);
|
|
|
});
|
|
|
this.setData({
|
|
|
preferList: list
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
productInfo: function () {
|
|
|
detailModel.productInfo(this.data.productSkn)
|
|
|
.then(res => {
|
...
|
...
|
@@ -253,9 +298,11 @@ Page({ |
|
|
// 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',
|
|
|
// productOnlyProvideByYohoStore: res.data.store_show_status === 3 || res.data.store_show_status === 4,
|
|
|
// productNotForSale: res.data.attribute===2,
|
|
|
shop_id: res.data.shop_id
|
|
|
shopId: res.data.shop_id
|
|
|
// brand_id: res.data.brand_id
|
|
|
});
|
|
|
|
|
|
this.shopRecList(res.data.shop_id);
|
|
|
}
|
|
|
})
|
|
|
.catch(function (error) {
|
...
|
...
|
|