...
|
...
|
@@ -10,7 +10,8 @@ Page({ |
|
|
data: {
|
|
|
shopInfo: {},
|
|
|
shopBanner: '',
|
|
|
shopProductList: []
|
|
|
shopProductList: [],
|
|
|
decorFloors: []
|
|
|
},
|
|
|
onLoad: function() {
|
|
|
|
...
|
...
|
@@ -38,6 +39,7 @@ Page({ |
|
|
getShopData: function(shopId) {
|
|
|
this._shopInfo(shopId);
|
|
|
this._shopDecor(shopId);
|
|
|
this._shopFavCount(shopId);
|
|
|
},
|
|
|
|
|
|
getShopProducts: function() {
|
...
|
...
|
@@ -46,7 +48,7 @@ Page({ |
|
|
|
|
|
// 店铺信息
|
|
|
_shopInfo: function(shopId) {
|
|
|
let params = {
|
|
|
const params = {
|
|
|
shop_id: shopId
|
|
|
};
|
|
|
|
...
|
...
|
@@ -70,35 +72,53 @@ Page({ |
|
|
|
|
|
// 店铺装修
|
|
|
_shopDecor: function(shopId) {
|
|
|
let params = {
|
|
|
const params = {
|
|
|
shop_id: shopId
|
|
|
};
|
|
|
|
|
|
indexModel.shopDecorator(params)
|
|
|
.then(res => {
|
|
|
let floor = res.data.modules;
|
|
|
|
|
|
if (floor && floor.length > 0) {
|
|
|
let shopBanner = floor[0];
|
|
|
if (res.code === 200) {
|
|
|
let floors = [];
|
|
|
let modules = res.data.modules;
|
|
|
|
|
|
if (shopBanner && shopBanner.module_type === 'ShopBanner') {
|
|
|
let module_data = JSON.parse(shopBanner.module_data);
|
|
|
if (modules && modules.length > 0) {
|
|
|
floors = modules.map(module => {
|
|
|
module.data = JSON.parse(module.module_data).data;
|
|
|
delete module.module_data;
|
|
|
|
|
|
let data = module_data.data;
|
|
|
return module;
|
|
|
});
|
|
|
|
|
|
if (data && data.length > 0) {
|
|
|
let resource = data[0];
|
|
|
const banner = floors[0];
|
|
|
|
|
|
if (banner && banner.module_type === 'ShopBanner') {
|
|
|
this.setData({
|
|
|
shopBanner: resource.pic
|
|
|
shopBanner: banner.data[0] && banner.data[0].pic
|
|
|
});
|
|
|
}
|
|
|
|
|
|
this.setData({
|
|
|
decorFloors: floors
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
.catch(() => {});
|
|
|
},
|
|
|
|
|
|
// 店铺收藏
|
|
|
_shopFavCount: function(shopId) {
|
|
|
indexModel.shopFavCount({favIds: shopId}).then(res => {
|
|
|
const favCount = res.data[0].approximateCount || '2.1w';
|
|
|
|
|
|
this.setData({
|
|
|
favCount
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
|
|
|
// 商品列表
|
|
|
_productList: function(params) {
|
|
|
|
...
|
...
|
|