Commit 03634695 by 李嘉林

商品列表点击事件

parent 61e3b697
...@@ -153,6 +153,9 @@ export default { ...@@ -153,6 +153,9 @@ export default {
} else if (options.from && (options.from == "home" || options.from == "livedToIndex")) { } else if (options.from && (options.from == "home" || options.from == "livedToIndex")) {
//来自直播详情 //来自直播详情
this.page = decodeURIComponent(options.backpath); this.page = decodeURIComponent(options.backpath);
if(this.page.includes("?")){
this.params="&mixid=" + this.shopId;
}
options.params && (this.params += "&" + serialize(options.params)); options.params && (this.params += "&" + serialize(options.params));
} else if (options.from && options.from == "livedBackShop") { } else if (options.from && options.from == "livedBackShop") {
//直播页back到商城 //直播页back到商城
......
...@@ -77,9 +77,9 @@ export function $themeToLink(data) { ...@@ -77,9 +77,9 @@ export function $themeToLink(data) {
} }
} }
function toPage(backPath, backParams) { function toPage(backPath, backParams = "") {
wx.navigateTo({ wx.navigateTo({
url: `../index/main?from=home&backpath=${backPath}&params=${encodeURIComponent(backParams)}` url: `../index/main?from=home&backpath=${encodeURIComponent(backPath)}&params=${encodeURIComponent(backParams)}`
}); });
} }
......
const app = getApp();
const { goodsApi, DFSImg, $themeToLink } = app;
const componentOptions = { const componentOptions = {
// 组件选项 // 组件选项
options: { options: {
...@@ -18,7 +20,7 @@ const componentOptions = { ...@@ -18,7 +20,7 @@ const componentOptions = {
// 组件数据 // 组件数据
data: { data: {
isPageHidden: false, // 页面是否处于隐藏状态 isPageHidden: false, // 页面是否处于隐藏状态
timeData: {}, timeData: {}
}, },
// 数据监听器 // 数据监听器
observers: {}, observers: {},
...@@ -54,7 +56,49 @@ const componentOptions = { ...@@ -54,7 +56,49 @@ const componentOptions = {
}, },
onChange(e) { onChange(e) {
this.setData({ timeData: e.detail }); this.setData({ timeData: e.detail });
} },
onclickProduct() {
let { goodsType } = this.data.datas.componentData;
let {
productId,
terminalProductId,
terminalGoodsMixId
} = this.data.items;
let linkVal = "";
if (goodsType == 0) {
linkVal = `/goods/${productId}?terminalProductId=${terminalProductId}`;
} else if (goodsType == 1) {
linkVal = `/pointShop/goodsDetail?productId${productId}&terminalProductId=${terminalProductId}&terminalGoodsMixId=${terminalGoodsMixId}`;
}
$themeToLink({
type: 1,
link: linkVal
});
},
onclickBuynow() {
let { btnType } = this.data.datas.componentData;
let {
minProductGoodsMixid,
minProductGoodsId,
minGoodsId
} = this.data.items;
let linkVal = "";
if (btnType < 6) {
// 加入购物车
console.log("加入购物车");
// this.$themeAddToCard(item);
} else {
// 进入确认订单
linkVal = `/order/orderConfirm?productGoodsMixId=${minProductGoodsMixid}&productGoodsId=${minProductGoodsId}&goodsId=${minGoodsId}&qty=1&goodsString=null&source=3`;
}
console.log(linkVal, "-------90");
$themeToLink({ type: 1, link: linkVal });
},
toMerchants() {
let { orgId } = this.data.items;
$themeToLink({ type: 1, link: `/merchantsDetail/${orgId}` });
},
}, },
// 组件生命周期 // 组件生命周期
lifetimes: { lifetimes: {
......
<!-- 商品列表item --> <!-- 商品列表item -->
<view class="goodsItem {{datas.componentData.style==='rowList'?'goodsRowList':''}} {{datas.componentData.style==='heap'?'goodsRowList goodsHeapItem':''}}" style="--proGap2:{{datas.componentData.proGap*2}}rpx;"> <view
class="goodsItem {{datas.componentData.style==='rowList'?'goodsRowList':''}} {{datas.componentData.style==='heap'?'goodsRowList goodsHeapItem':''}}"
style="--proGap2:{{datas.componentData.proGap*2}}rpx;"
bindtap="onclickProduct"
>
<view class="goods-item-child {{datas.componentData['borderColorShow']?'goods-item-child-bd':''}}" style="border-radius:{{datas.componentData.borderRadius}}em;--border_color:{{datas.componentData['borderColor']}};box-shadow:{{datas.componentData['cardShadow']?'0rpx 0rpx 10rpx '+datas.componentData['cardShadowSize']*2+'rpx #ccc':''}};"> <view class="goods-item-child {{datas.componentData['borderColorShow']?'goods-item-child-bd':''}}" style="border-radius:{{datas.componentData.borderRadius}}em;--border_color:{{datas.componentData['borderColor']}};box-shadow:{{datas.componentData['cardShadow']?'0rpx 0rpx 10rpx '+datas.componentData['cardShadowSize']*2+'rpx #ccc':''}};">
<!-- 商户入口-顶部 --> <!-- 商户入口-顶部 -->
<view class="merchantsEntrance flex" wx:if="{{datas.componentData['merchantsEntrance'] && datas.componentData['merchantsEntranceType'] == 0 && datas.componentData.style!='heap'}}"> <view
class="merchantsEntrance flex"
bindtoMerchants="toMerchants"
wx:if="{{datas.componentData['merchantsEntrance'] && datas.componentData['merchantsEntranceType'] == 0 && datas.componentData.style!='heap'}}"
>
<view class="left flex" wx:if="{{items != null}}"> <view class="left flex" wx:if="{{items != null}}">
<view class="logo"> <view class="logo">
<image mode='widthFix' src="{{items.shopLogoUrl}}" /> <image mode='widthFix' src="{{items.shopLogoUrl}}" />
...@@ -152,7 +160,7 @@ ...@@ -152,7 +160,7 @@
> >
已售罄 已售罄
</view> </view>
<view wx:if="{{(items&&items.totalQty-0>0||items&&items.oversoldFlag==1)&& datas.componentData['paynow']}}"> <view wx:if="{{(items&&items.totalQty-0>0||items&&items.oversoldFlag==1)&& datas.componentData['paynow']}}" catchtap="onclickBuynow">
<text wx:if="{{datas.componentData.btnType<6}}" style="color:{{datas.componentData.btnColor}}" class="buy-now-icon iconfont-common {{datas.componentData.btnIcon}}"></text> <text wx:if="{{datas.componentData.btnType<6}}" style="color:{{datas.componentData.btnColor}}" class="buy-now-icon iconfont-common {{datas.componentData.btnIcon}}"></text>
<view <view
wx:else wx:else
...@@ -191,7 +199,11 @@ ...@@ -191,7 +199,11 @@
</block> </block>
</view> </view>
<!-- 商户入口二 --> <!-- 商户入口二 -->
<view class="merchantsEntrance flex" wx:if="{{datas.componentData.merchantsEntrance&&datas.componentData.merchantsEntranceType==1 && datas.componentData.style!='heap'}}"> <view
class="merchantsEntrance flex"
bindtoMerchants="toMerchants"
wx:if="{{datas.componentData.merchantsEntrance&&datas.componentData.merchantsEntranceType==1 && datas.componentData.style!='heap'}}"
>
<view class="left flex" wx:if="{{items!=null}}"> <view class="left flex" wx:if="{{items!=null}}">
<view class="logo"> <view class="logo">
<image mode='widthFix' src="http://test-bucket-ant.oss-cn-shanghai.aliyuncs.com/product/ppefWK8BS6.png?x-oss-process=image/resize,limit_1,w_150,h_150" /> <image mode='widthFix' src="http://test-bucket-ant.oss-cn-shanghai.aliyuncs.com/product/ppefWK8BS6.png?x-oss-process=image/resize,limit_1,w_150,h_150" />
......
...@@ -5,11 +5,10 @@ ...@@ -5,11 +5,10 @@
wx:key="index" wx:key="index"
data-index="{{index}}" data-index="{{index}}"
class="{{'card-swiper-item curdistance' + (swiperCurIndex + index) + (!!item.slideClass? item.slideClass: '')}}" class="{{'card-swiper-item curdistance' + (swiperCurIndex + index) + (!!item.slideClass? item.slideClass: '')}}"
bindtap="next" bindtouchstart="touchCard.start"
catchtouchstart="touchCard.start" bindtouchmove="touchCard.move"
catchtouchmove="touchCard.move" bindtouchend="touchCard.end"
catchtouchend="touchCard.end" bindtouchcancel="touchCard.cancel"
catchtouchcancel="touchCard.cancel"
> >
<goods-item <goods-item
style="width:100%" style="width:100%"
......
const app = getApp(); const app = getApp();
const { goodsApi,DFSImg } = app; const { goodsApi, DFSImg, $themeToLink } = app;
const componentOptions = { const componentOptions = {
// 组件选项 // 组件选项
options: { options: {
...@@ -96,7 +96,12 @@ const componentOptions = { ...@@ -96,7 +96,12 @@ const componentOptions = {
}, },
getProductList(code, type) { getProductList(code, type) {
let { goodsList, goodsSort } = this.data.datas.componentData; let { goodsList, goodsSort } = this.data.datas.componentData;
let { classificationLoadPage,loading,finished,queryProductInfoLoading } = this.data; let {
classificationLoadPage,
loading,
finished,
queryProductInfoLoading
} = this.data;
if (queryProductInfoLoading == true) { if (queryProductInfoLoading == true) {
return; return;
} }
...@@ -111,9 +116,32 @@ const componentOptions = { ...@@ -111,9 +116,32 @@ const componentOptions = {
loading = true; loading = true;
} }
this.setData({ classificationLoadPage, loading }); this.setData({ classificationLoadPage, loading });
let query = { categoryId: this.data.datas.componentData.categoryId, page: this.showRowNum() ? classificationLoadPage : 1, rows: this.showRowNum() ? this.data.classificationLoadNum:this.getItemNum(), sortColumn: goodsSort, sortType: goodsSort != 2 ? 1 : 0, whetherShowSoldOutGoods: this.data.datas.componentData.whetherShowSoldOutGoods, whetherQueryCollectCount: true, whetherUseVirtualSalesQty: true, whetherUseVirtualCollectCount: true, whetherFindDistributionCommission: this.whetherFindDistributionCommission, whetherFindRecommendedCardFlag: this.data.datas.componentData.vipPrice ? 1 : 0, whetherShowGoodsDefaultTagFlag: this.data.datas.componentData.marketingTag ? 1 : 0, whetherFindMultiShopFlag: 1 }; // 当前页 // 一页多少条 //查询销售数量 //查询收藏数 //是否使用虚拟销售数量 //是否使用虚拟收藏人数 //是否查询商品佣金(0:不查询,1:展示,为空不查佣金) //是否查询会员价 1是 0否 //是否展示营销标签 1是 0否 //是否查询多商户 //商城使用 let query = {
categoryId: this.data.datas.componentData.categoryId,
page: this.showRowNum() ? classificationLoadPage : 1,
rows: this.showRowNum()
? this.data.classificationLoadNum
: this.getItemNum(),
sortColumn: goodsSort,
sortType: goodsSort != 2 ? 1 : 0,
whetherShowSoldOutGoods: this.data.datas.componentData
.whetherShowSoldOutGoods,
whetherQueryCollectCount: true,
whetherUseVirtualSalesQty: true,
whetherUseVirtualCollectCount: true,
whetherFindDistributionCommission: this
.whetherFindDistributionCommission,
whetherFindRecommendedCardFlag: this.data.datas.componentData.vipPrice
? 1
: 0,
whetherShowGoodsDefaultTagFlag: this.data.datas.componentData
.marketingTag
? 1
: 0,
whetherFindMultiShopFlag: 1
}; // 当前页 // 一页多少条 //查询销售数量 //查询收藏数 //是否使用虚拟销售数量 //是否使用虚拟收藏人数 //是否查询商品佣金(0:不查询,1:展示,为空不查佣金) //是否查询会员价 1是 0否 //是否展示营销标签 1是 0否 //是否查询多商户 //商城使用
goodsApi.queryProductInfo(query).then(res => { goodsApi.queryProductInfo(query).then(res => {
this.setData({ loading: false, queryProductInfoLoading:false }); this.setData({ loading: false, queryProductInfoLoading: false });
if (res.data.code == 200) { if (res.data.code == 200) {
let goodsLists = res.data.data.list; let goodsLists = res.data.data.list;
if (type == 1) { if (type == 1) {
...@@ -122,9 +150,9 @@ const componentOptions = { ...@@ -122,9 +150,9 @@ const componentOptions = {
goodsList = [...goodsList, ...goodsLists]; goodsList = [...goodsList, ...goodsLists];
} }
if (goodsLists && goodsLists.length < 10) { if (goodsLists && goodsLists.length < 10) {
this.setData({ finished:true }); this.setData({ finished: true });
} }
this.goodsListVal(goodsList,type); this.goodsListVal(goodsList, type);
} }
}); });
} else { } else {
...@@ -178,11 +206,11 @@ const componentOptions = { ...@@ -178,11 +206,11 @@ const componentOptions = {
goodsApi.queryMoreProductInfo(moreQuery).then(res => { goodsApi.queryMoreProductInfo(moreQuery).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
goodsList = res.data.data; goodsList = res.data.data;
this.goodsListVal(goodsList,1); this.goodsListVal(goodsList, 1);
} }
}); });
}, },
goodsListVal(goodsList,type) { goodsListVal(goodsList, type) {
console.log(goodsList, "------------goodsListVal"); console.log(goodsList, "------------goodsListVal");
goodsList.forEach((item, index) => { goodsList.forEach((item, index) => {
item.marketingTag = item.defaultTags item.marketingTag = item.defaultTags
...@@ -192,7 +220,7 @@ const componentOptions = { ...@@ -192,7 +220,7 @@ const componentOptions = {
) )
: []; : [];
item.shopLogoUrl = DFSImg(item.shopLogoUrl); item.shopLogoUrl = DFSImg(item.shopLogoUrl);
item.coverImage = DFSImg(item.coverImage,100,100,0); item.coverImage = DFSImg(item.coverImage, 100, 100, 0);
item.productImgUrl = DFSImg(item.productImgUrl, 100, 100, 0); item.productImgUrl = DFSImg(item.productImgUrl, 100, 100, 0);
item.minPrice = Number(item.minPrice).toFixed(2); item.minPrice = Number(item.minPrice).toFixed(2);
item.qty = Number(item.qty); item.qty = Number(item.qty);
...@@ -311,7 +339,24 @@ const componentOptions = { ...@@ -311,7 +339,24 @@ const componentOptions = {
// 分页加载 // 分页加载
onLoad() { onLoad() {
console.log("---触发分页加载"); console.log("---触发分页加载");
this.getProductList(1,2); this.getProductList(1, 2);
},
viewMore() {
let { goodsType,style, categoryName, categoryId } = this.data.datas.componentData;
let linkVal = "";
if (goodsType != 1) {
if (style == "list") {
linkVal = `/goods/commodityMenu?categoryName=${categoryName}&categoryId=${categoryId}`;
} else {
linkVal = `/goods/commodityMenu`;
}
} else {
linkVal = `/pointShop/productList?categoryName=${categoryName}&categoryId=${categoryId}`;
}
$themeToLink({
type: 1,
link:linkVal,
});
} }
} }
}; };
......
...@@ -9,7 +9,11 @@ ...@@ -9,7 +9,11 @@
</view> </view>
<view class="title">{{datas.componentData['titles']}}</view> <view class="title">{{datas.componentData['titles']}}</view>
</view> </view>
<view class="moreTop" wx:if="{{datas.componentData['moreShow'] && datas.componentData.moreButtonSite=='top' && datas.componentData['goodsSource']!='assign'}}"> <view
class="moreTop"
bindtap="viewMore"
wx:if="{{datas.componentData['moreShow'] && datas.componentData.moreButtonSite=='top' && datas.componentData['goodsSource']!='assign'}}"
>
查看更多 查看更多
<text class="jt"></text> <text class="jt"></text>
</view> </view>
...@@ -91,7 +95,14 @@ ...@@ -91,7 +95,14 @@
<view class="goods-heap-Item" wx:if="{{datas.componentData.style==='heap'}}"> <view class="goods-heap-Item" wx:if="{{datas.componentData.style==='heap'}}">
<heap-item datas="{{datas}}"></heap-item> <heap-item datas="{{datas}}"></heap-item>
</view> </view>
<view
class="moreBottom"
bindtap="viewMore"
wx:if="{{datas.componentData['moreShow'] && datas.componentData.moreButtonSite=='bottom' && datas.componentData['goodsSource']!='assign'}}"
>
查看更多
<text class="jt"></text>
</view>
</view> </view>
</view> </view>
...@@ -40,7 +40,7 @@ image{ ...@@ -40,7 +40,7 @@ image{
font-size: 13px; font-size: 13px;
color: #6b6b6b; color: #6b6b6b;
} }
.moreTop .jt { .moreTop .jt,.moreBottom .jt{
display: inline-block; display: inline-block;
border-top: 1px solid; border-top: 1px solid;
border-right: 1px solid; border-right: 1px solid;
...@@ -50,6 +50,12 @@ image{ ...@@ -50,6 +50,12 @@ image{
transform: rotate(405deg); transform: rotate(405deg);
margin-left: 0px; margin-left: 0px;
} }
.moreBottom {
font-size: 13px;
text-align: center;
padding-top: 0.54em;
color: #6b6b6b;
}
.goodsItem-list{ .goodsItem-list{
flex-wrap: wrap; flex-wrap: wrap;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment