Commit 263865cb923322e773532e1c4bb494ece63b090a
1 parent
727e7243
多赠品的在商品详情页显示多赠品商品
Showing
7 changed files
with
204 additions
and
10 deletions
packageD/pages/gift/gift.js
0 → 100644
1 | +var os = getApp().globalData.setting,ut = require("../../../utils/util.js"); | ||
2 | +var regeneratorRuntime = require('../../../utils/runtime.js'); | ||
3 | + | ||
4 | + | ||
5 | +Page({ | ||
6 | + data: { | ||
7 | + iurl:os.imghost | ||
8 | + }, | ||
9 | + /** | ||
10 | + * 生命周期函数--监听页面加载 | ||
11 | + */ | ||
12 | + onLoad:async function (options) { | ||
13 | + wx.showLoading(); | ||
14 | + var prom=null; | ||
15 | + var prom_list=null; | ||
16 | + //-- 获取活动 -- | ||
17 | + var url="/api/weshop/promgoods/get/"+os.stoid+"/"+options.prom_id; | ||
18 | + await getApp().promiseGet(url,{}).then(res=>{ | ||
19 | + if(res.data.code==0){ | ||
20 | + prom=res.data.data; | ||
21 | + } | ||
22 | + }) | ||
23 | + //-- 获取活动列表 -- | ||
24 | + var url1="/api/weshop/promgoodslist/list"; | ||
25 | + var req_data={ | ||
26 | + prom_id:options.prom_id | ||
27 | + } | ||
28 | + await getApp().promiseGet(url1,{data:req_data}).then(res=>{ | ||
29 | + if(res.data.code==0){ | ||
30 | + prom_list=res.data.data; | ||
31 | + } | ||
32 | + }) | ||
33 | + | ||
34 | + var list=prom_list[options.index]; | ||
35 | + var rule=JSON.parse(list.preferential_type); | ||
36 | + | ||
37 | + var gift_id=rule.gift; | ||
38 | + var g_arr=gift_id.split(","); | ||
39 | + var gift_goods=[]; | ||
40 | + for(let i in g_arr){ | ||
41 | + let item=g_arr[i]; | ||
42 | + var gift=null; | ||
43 | + var good=null; | ||
44 | + var url2="/api/weshop/prom/gift/page?store_id="+os.stoid+"&id="+item; | ||
45 | + await getApp().promiseGet(url2,{}).then(res=>{ | ||
46 | + if(ut.ajax_ok(res)){ | ||
47 | + gift=res.data.data.pageData[0]; | ||
48 | + } | ||
49 | + }) | ||
50 | + | ||
51 | + var url3="/api/weshop/goods/get/"+os.stoid+"/"+gift.goods_id; | ||
52 | + await getApp().promiseGet(url3,{}).then(res=>{ | ||
53 | + if(res.data.code==0){ | ||
54 | + good=res.data.data; | ||
55 | + } | ||
56 | + }) | ||
57 | + gift_goods.push(good) | ||
58 | + } | ||
59 | + | ||
60 | + this.setData({ | ||
61 | + prom:prom,list:list,gift_goods:gift_goods,zp_num:rule.zp_num | ||
62 | + }) | ||
63 | + wx.hideLoading(); | ||
64 | + | ||
65 | + }, | ||
66 | + /*** 生命周期函数--监听页面显示 */ | ||
67 | + onShow:function () { | ||
68 | + | ||
69 | + }, | ||
70 | + | ||
71 | + | ||
72 | + | ||
73 | + | ||
74 | + | ||
75 | + | ||
76 | +}) | ||
0 | \ No newline at end of file | 77 | \ No newline at end of file |
packageD/pages/gift/gift.json
0 → 100644
packageD/pages/gift/gift.wxml
0 → 100644
1 | +<!-- 多赠品 --> | ||
2 | +<view class="duo_gift_sele"> | ||
3 | + <!-- top act_name --> | ||
4 | + <view class="flex gift_top_v ai_c fs30" style="padding-left: 30rpx; margin: 20rpx 0"> | ||
5 | + {{prom.name}},满{{list.condition}}{{list.prom_type==1?'件':'元'}},可任选{{zp_num}}件商品为赠品 | ||
6 | + </view> | ||
7 | + | ||
8 | + <view class="gd_content"> | ||
9 | + <!-- 赠品选择 --> | ||
10 | + <view class="order-item" wx:for="{{gift_goods}}" wx:for-item="items" wx:for-index="idx"> | ||
11 | + <navigator class="goods-img rel" bindtap="go_gd" data-gd="{{items.goods_id}}"> | ||
12 | + <image class="wh100" src="{{iurl+items.original_img}}" binderror="bind_bnerr2" data-errorimg="gift_goods[{{idx}}].original_img"></image> | ||
13 | + </navigator> | ||
14 | + <view class="goods-cont"> | ||
15 | + <view class="goods-name"> | ||
16 | + <navigator bindtap="go_gd" class="ellipsis-2 fs30" data-gd="{{items.goods_id}}">{{items.goods_name}}</navigator> | ||
17 | + </view> | ||
18 | + <view class="specifications ellipsis-1"> | ||
19 | + <view wx:if="{{items.goods_color || items.goods_spec}}"> | ||
20 | + {{items.goods_color}}{{items.goods_color?"/":''}}{{items.goods_spec}}</view> | ||
21 | + <view wx:else>规格1</view> | ||
22 | + </view> | ||
23 | + | ||
24 | + <view class="flex ai_c"> | ||
25 | + <view class="goods-price co-red ellipsis-1"> | ||
26 | + <view class="fs30">¥{{items.shop_price}}</view> | ||
27 | + </view> | ||
28 | + | ||
29 | + <view class="line_th fs22" style="color: #999; margin-left: 10rpx">¥{{items.market_price}}</view> | ||
30 | + </view> | ||
31 | + | ||
32 | + </view> | ||
33 | + </view> | ||
34 | + </view> | ||
35 | + | ||
36 | +</view> |
packageD/pages/gift/gift.wxss
0 → 100644
1 | +page{ background-color:#f0f0f0 } | ||
2 | +.gd_content{ | ||
3 | + background-color: #fff; border-top-left-radius: 20rpx; border-top-right-radius: 20rpx; | ||
4 | +} | ||
5 | + | ||
6 | +.order-item { | ||
7 | + display: flex; | ||
8 | + height: 246rpx; | ||
9 | + border-top: 3rpx solid rgb(245, 245, 245); | ||
10 | + align-items: center; | ||
11 | + padding-right: 30rpx; | ||
12 | +} | ||
13 | + | ||
14 | +.goods-img { | ||
15 | + float: left; | ||
16 | + width: 200rpx; | ||
17 | + height: 200rpx; | ||
18 | + margin: 0 20rpx; | ||
19 | +} | ||
20 | +.goods-cont { | ||
21 | + width: 420rpx; | ||
22 | + height: 165rpx; | ||
23 | + font-size: 28rpx; | ||
24 | + margin-left: 35rpx; | ||
25 | + padding-top: 7rpx; | ||
26 | + padding-bottom: 5rpx; | ||
27 | +} | ||
28 | +.goods-name{ | ||
29 | + max-height: 60rpx; | ||
30 | + line-height: 30rpx; | ||
31 | + margin-bottom: 16rpx; | ||
32 | + font-size:26rpx; | ||
33 | + width: 490rpx; | ||
34 | + display: -webkit-box; | ||
35 | + word-break: break-all; | ||
36 | + -webkit-box-orient: vertical; | ||
37 | + -webkit-line-clamp:1; | ||
38 | + overflow: hidden; | ||
39 | + text-overflow:ellipsis; | ||
40 | + height: 30rpx; | ||
41 | + color: #1d1d1d; | ||
42 | +} | ||
43 | +.specifications { | ||
44 | + padding: 3rpx 8rpx; | ||
45 | + margin-top: 8rpx; | ||
46 | + font-size: 22rpx; | ||
47 | + max-width: 356rpx; | ||
48 | + width: auto; | ||
49 | + height: 30rpx; | ||
50 | + line-height: 29rpx; | ||
51 | + background-color: rgb(236, 236, 236); | ||
52 | + border-radius: 8rpx; | ||
53 | + white-space: nowrap; | ||
54 | + color: rgb(63, 63, 63); | ||
55 | + display: inline-block; | ||
56 | +} | ||
57 | + | ||
58 | +.line_th { | ||
59 | + text-decoration: line-through; | ||
60 | +} | ||
61 | + |
pages/goods/goodsInfo/g_filter.wxs
@@ -98,10 +98,17 @@ var g_filters = { | @@ -98,10 +98,17 @@ var g_filters = { | ||
98 | } else { | 98 | } else { |
99 | return value.toFixed(0); | 99 | return value.toFixed(0); |
100 | }; | 100 | }; |
101 | - }, | 101 | + }, |
102 | + | ||
103 | + is_more_gift:function(str){ | ||
104 | + var arr=str.split(","); | ||
105 | + return arr.length; | ||
106 | + } | ||
107 | + | ||
102 | } | 108 | } |
103 | module.exports = { | 109 | module.exports = { |
104 | is_has_rank:g_filters.is_has_rank, | 110 | is_has_rank:g_filters.is_has_rank, |
105 | get_card_price:g_filters.get_card_price, | 111 | get_card_price:g_filters.get_card_price, |
106 | num:g_filters.num, | 112 | num:g_filters.num, |
113 | + is_more_gift:g_filters.is_more_gift | ||
107 | } | 114 | } |
108 | \ No newline at end of file | 115 | \ No newline at end of file |
pages/goods/goodsInfo/goodsInfo.js
@@ -6994,12 +6994,14 @@ Page({ | @@ -6994,12 +6994,14 @@ Page({ | ||
6994 | hiddenCS: true, | 6994 | hiddenCS: true, |
6995 | }); | 6995 | }); |
6996 | }, | 6996 | }, |
6997 | - | ||
6998 | - | ||
6999 | 6997 | ||
7000 | - | ||
7001 | - | ||
7002 | - | ||
7003 | - | 6998 | + |
6999 | + //显示多赠品 | ||
7000 | + show_zp:function (e) { | ||
7001 | + var prom_id=e.currentTarget.dataset.prom; | ||
7002 | + var index=e.currentTarget.dataset.index; | ||
7003 | + getApp().goto("/packageD/pages/gift/gift?prom_id="+prom_id+"&index="+index); | ||
7004 | + } | ||
7005 | + | ||
7004 | 7006 | ||
7005 | }) | 7007 | }) |
pages/goods/goodsInfo/goodsInfo.wxml
@@ -505,8 +505,16 @@ | @@ -505,8 +505,16 @@ | ||
505 | <text class="tick lh2 pdr20" wx:if="{{item.past==1}}">包邮</text> | 505 | <text class="tick lh2 pdr20" wx:if="{{item.past==1}}">包邮</text> |
506 | <text class="tick lh2 pdr20" wx:if="{{item.intValue>0}}">送{{item.intValue}}积分</text> | 506 | <text class="tick lh2 pdr20" wx:if="{{item.intValue>0}}">送{{item.intValue}}积分</text> |
507 | <view class="tick lh2 pdr20" wx:if="{{item.couponId>0}}">送{{item.couponMoney}}元优惠券</view> | 507 | <view class="tick lh2 pdr20" wx:if="{{item.couponId>0}}">送{{item.couponMoney}}元优惠券</view> |
508 | - <view class="tick ellipsis-1x lh2" wx:if="{{item.gift_id}}">送赠品</view> | ||
509 | - <view class="tick ellipsis-1x lh2 details pdr40" wx:if="{{item.lb_id>0}}" data-id="{{item.lb_id}}" bindtap="viewLbDetails">送{{item.lbtitle}}</view> | 508 | + |
509 | + <block wx:if="{{item.gift_id}}"> | ||
510 | + <view class="tick ellipsis-1x lh2 details pdr40" bindtap="show_zp" data-index="{{index}}" data-prom="{{item.prom_id}}" | ||
511 | + wx:if="{{g_filters.is_more_gift(item.gift_id)>1}}" >送赠品</view> | ||
512 | + <view class="tick ellipsis-1x lh2" wx:else >送{{item.goods_name}}</view> | ||
513 | + </block> | ||
514 | + | ||
515 | + | ||
516 | + | ||
517 | + <view class="tick ellipsis-1x lh2 details pdr40" wx:if="{{item.lb_id>0}}" data-id="{{item.lb_id}}" bindtap="viewLbDetails">送{{item.lbtitle}}</view> | ||
510 | <view class="tick ellipsis-1x lh2 details pdr40" wx:if="{{item.zxlb_id>0}}" data-id="{{item.zxlb_id}}" data-flag="1" bindtap="viewLbDetails">送{{item.zxlbtitle}}</view> | 518 | <view class="tick ellipsis-1x lh2 details pdr40" wx:if="{{item.zxlb_id>0}}" data-id="{{item.zxlb_id}}" data-flag="1" bindtap="viewLbDetails">送{{item.zxlbtitle}}</view> |
511 | </view> | 519 | </view> |
512 | </view> | 520 | </view> |
@@ -1282,7 +1290,7 @@ | @@ -1282,7 +1290,7 @@ | ||
1282 | <text wx:if="{{hui_condition.past==1}}">,包邮</text> | 1290 | <text wx:if="{{hui_condition.past==1}}">,包邮</text> |
1283 | <text wx:if="{{hui_condition.intValue>0}}">,送{{hui_condition.intValue}}积分</text> | 1291 | <text wx:if="{{hui_condition.intValue>0}}">,送{{hui_condition.intValue}}积分</text> |
1284 | <text wx:if="{{hui_condition.couponId>0}}">,送优惠券</text> | 1292 | <text wx:if="{{hui_condition.couponId>0}}">,送优惠券</text> |
1285 | - <text wx:if="{{hui_condition.gift_id>0}}">,送赠品</text> | 1293 | + <text wx:if="{{hui_condition.gift_id}}">,送赠品</text> |
1286 | <text wx:if="{{hui_condition.lb_id>0}}">,送礼包</text> | 1294 | <text wx:if="{{hui_condition.lb_id>0}}">,送礼包</text> |
1287 | <text wx:if="{{hui_condition.zxlb_id>0}}">,送专享礼包</text> | 1295 | <text wx:if="{{hui_condition.zxlb_id>0}}">,送专享礼包</text> |
1288 | </view> | 1296 | </view> |