Authored by 李奇

appId配置修改

... ... @@ -20,7 +20,7 @@ const config = {
private_key: 'b43890b0a296ff3c7b8c260ca763980b',
app_version: '6.6.0'
},
appid: 'wx66ecf50a505afefa', // 业务中使用、与package.config.json内appid保持一致
appid: 'wxe8bfc9b404772199', // 业务中使用、与package.config.json内appid保持一致
// unionType: '100000000011368', // 渠道号后台写死【测试】
unionType: '100000000011678', // 渠道号后台写死【线上得宝测试店铺测试渠道号】
mini_app_type: '3', // 小程序类型
... ...
... ... @@ -17,11 +17,13 @@ Component({
floorIndex: { // start from 1
type: String,
value: ''
},
floors: {
type: Array,
value: []
}
},
data: {
floors: []
},
methods: {
_refreshChange: function(refresh) {
if (refresh) {
... ...
{
"component": true,
"usingComponents": {
"focus-image": "./focus/focus"
"shop-carousel": "./shop/carousel/carousel"
}
}
... ...
<view class="resources">
<view wx:for="{{floors}}" wx:key="{{index}}" bindclickreport="report">
<focus-image
<shop-carousel
bindclickreport="report"
wx:if="{{item.template_name == 'focus'}}"
swiper-list="{{item.data}}"
wx:if="{{item.module_type == 'CarouselImage'}}"
images="{{item.data}}"
margin-class="{{'margin-bottom-20'}}"
floor-id="{{item.template_id}}"
floor-name="{{item.template_name}}"
floor-index="{{floorIndex}}">
</focus-image>
</shop-carousel>
</view>
</view>
... ...
Component({
properties: {
images: {
type: Array,
value: []
},
swieperSpeed: {
type: String,
value: '0'
},
// use for floors' click report
floorId: {
type: String,
value: ''
},
floorName: {
type: String,
value: ''
},
floorIndex: {
type: String, // start from 1
value: ''
},
marginClass: {
type: String,
value: ''
}
},
data: {
indicatorDots: false,
interval: 5000,
autoplay: true,
duration: 500,
circular: true,
swiperCurrent: 0
},
methods: {
swiperChange: function(e) {
this.setData({
swiperCurrent: e.detail.current
});
},
// use for floors' click report
report: function(e) {
this.triggerEvent('clickreport', e.detail);
}
}
});
... ...
{
"component": true,
"usingComponents": {
"anchor": "../../anchor/anchor"
}
}
... ...
<wxs src="../../../../wxs/helper.wxs" module="helper" />
<view class="resource-shop-carousel {{marginClass}}">
<swiper class="swiper-wrapper" indicator-dots="{{indicatorDots}}"
autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}"
circular="{{circular}}" bindchange="swiperChange">
<block wx:for="{{images}}" wx:key="{{index}}">
<swiper-item>
<anchor
bindclickreport="report"
url="{{item.url}}"
floor-id="{{floorId}}"
floor-name="{{floorName}}"
floor-url="{{item.url}}"
floor-index="{{floorIndex}}"
floor-item-index="{{index + 1}}">
<image mode="widthFix" src="{{helper.image(item.pic, 750, 480)}}" class="slide-image"/>
</anchor>
</swiper-item>
</block>
</swiper>
<view class="dots">
<block wx:for="{{swiperList}}" wx:key="unique">
<view class="dot{{index == swiperCurrent ? ' active' : ''}}"></view>
</block>
</view>
</view>
... ...
.resource-shop-carousel {
position: relative;
width: 100%;
}
.resource-shop-carousel .swiper-wrapper {
height: 234rpx;
}
.resource-shop-carousel .slide-image {
width: 100%;
}
.resource-shop-carousel .dots {
position: absolute;
left: 0;
right: 0;
bottom: 30rpx;
display: flex;
justify-content: center;
}
.resource-shop-carousel .dots .dot {
margin: 0 8rpx;
width: 10rpx;
height: 10rpx;
opacity: 0.7;
background: #fff;
}
.resource-shop-carousel .dots .dot.active {
opacity: 1;
width: 20rpx;
}
.resource-shop-carousel.margin-bottom-20 {
margin-bottom: 20rpx;
}
.resource-shop-carousel.margin-bottom-30 {
margin-bottom: 30rpx;
}
... ...
... ... @@ -41,5 +41,20 @@ export default {
method: 'app.search.shop.productList'
}, params)
});
},
/**
* 店铺收藏数量
* @param shopId 店铺Id
* @returns {*}
*/
shopFavCount(params) {
return api.get({
url: '',
data: Object.assign({
method: 'app.favorite.queryFavoriteCountByShopIds',
type: 'shop',
}, params)
});
}
};
... ...
.container {
border-top: 1rpx solid #eee;
}
page { /* stylelint-disable-line */
display: block;
min-height: 100%;
... ...
... ... @@ -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) {
... ...
... ... @@ -3,15 +3,15 @@
<view class="shop-info">
<image class="info-bg" src="{{shopBanner}}"></image>
<view class="logo-mask"></view>
<view class="info-detail">
<image class="logo" src="{{helper.image(shopInfo.shop_logo, 100, 100)}}"></image>
<text class="name">{{shopInfo.shop_name}}</text>
</view>
<image class="logo" src="{{helper.image(shopInfo.shop_logo, 100, 100)}}"></image>
<text class="name">{{shopInfo.shop_name}}</text>
<view class="fav">粉丝:{{favCount}}</view>
</view>
<resources
bindclickreport="resourceClickReport"
content-code="{{resource.home.top}}"
floor-index="1" refresh="{{pullRefresh}}"></resources>
<view class="separator"></view>
<resources
floors="{{decorFloors}}"
floor-index="1"
bindclickreport="resourceClickReport" ></resources>
<view class="separator"></view>
<view class="product-list">
<view class="list-head">
... ...
... ... @@ -41,6 +41,14 @@
text-overflow: ellipsis;
}
.shop-info .fav {
position: absolute;
left: 450rpx;
bottom: 20rpx;
color: #fff;
font-size: 22rpx;
}
.shop-info .info-detail {
position: absolute;
left: 20rpx;
... ...
... ... @@ -9,7 +9,7 @@
},
"compileType": "miniprogram",
"libVersion": "1.9.1",
"appid": "wx66ecf50a505afefa",
"appid": "wxe8bfc9b404772199",
"projectname": "%E7%BA%A2%E4%BA%BA%E5%B0%8F%E5%BA%97",
"condition": {
"search": {
... ...