Commit 9d74d2f527a01eca36c0f8f690e00567e853285a
1 parent
00b9d81f
促销多活动的优化
Showing
6 changed files
with
65 additions
and
7 deletions
components/promate_pop/p_filter.wxs
0 → 100644
1 | +var g_filters = { | |
2 | + //-- 判断是不是有等级价 -- | |
3 | + set_tab_title: function (item) { | |
4 | + switch (item.prom_type) { | |
5 | + case 3: | |
6 | + return '优惠'; | |
7 | + case 5: | |
8 | + return '搭配'; | |
9 | + case 7: | |
10 | + return '组合'; | |
11 | + case 10: | |
12 | + return '阶梯'; | |
13 | + } | |
14 | + return ''; | |
15 | + }, | |
16 | + set_title: function (item) { | |
17 | + switch (item.prom_type) { | |
18 | + case 3: | |
19 | + return '优惠促销'; | |
20 | + case 5: | |
21 | + return '搭配促销'; | |
22 | + case 7: | |
23 | + return '组合购'; | |
24 | + case 10: | |
25 | + return '阶梯促销'; | |
26 | + } | |
27 | + return ''; | |
28 | + }, | |
29 | + | |
30 | + | |
31 | +} | |
32 | +module.exports = { | |
33 | + set_tab_title: g_filters.set_tab_title, | |
34 | + set_title: g_filters.set_title, | |
35 | +} | |
0 | 36 | \ No newline at end of file | ... | ... |
components/promate_pop/promate_pop.js
... | ... | @@ -34,15 +34,18 @@ Component({ |
34 | 34 | }, |
35 | 35 | |
36 | 36 | go_the_url:function (e){ |
37 | - var prom_id = e.currentTarget.dataset.id; | |
38 | - var prom_type = e.currentTarget.dataset.prom_type; | |
37 | + var index=e.currentTarget.dataset.index; | |
38 | + var item=this.data.cx_prom_group[index]; | |
39 | + | |
40 | + var prom_id = item.prom_id; | |
41 | + var prom_type = item.prom_type; | |
39 | 42 | var url=''; |
40 | 43 | switch (parseInt(prom_type)){ |
41 | 44 | case 3: |
42 | 45 | url = "/pages/goods/goodsList/goodsList?prom_type=3&prom_id=" + prom_id; |
43 | 46 | break; |
44 | 47 | case 5: |
45 | - url = "/packageA/pages/prom_list/prom_list?goods_id=" + this.data.gid; | |
48 | + url = "/packageA/pages/prom_list/prom_list?goods_id=" + item.main_gid; | |
46 | 49 | var room_id = getApp().globalData.room_id; |
47 | 50 | if (room_id && this.data.gid == getApp().globalData.room_goods_id) { |
48 | 51 | url += "&room_id=" + room_id; | ... | ... |
components/promate_pop/promate_pop.wxml
... | ... | @@ -44,7 +44,7 @@ |
44 | 44 | |
45 | 45 | <view style="height: 12rpx"></view> |
46 | 46 | </block> |
47 | - <view bindtap="go_the_url" data-id="{{item.id}}" data-prom_type="{{item.prom_type}}" class="xq_btn fs30">详情</view> | |
47 | + <view bindtap="go_the_url" data-index="{{index}}" class="xq_btn fs30">详情</view> | |
48 | 48 | </view> |
49 | 49 | </view> |
50 | 50 | ... | ... |
packageE/pages/cart/cart2/cart2.js
... | ... | @@ -1825,7 +1825,16 @@ Page({ |
1825 | 1825 | //--- 调用接口获取活动 --- |
1826 | 1826 | await getApp().promiseGet('/api/weshop/goods/getGoodsPromInfo', {data:req_d}).then(res => { |
1827 | 1827 | if(res.data.code==0){ |
1828 | - item1.more_cx=res.data.data.more_cx; | |
1828 | + var more_cx=res.data.data.more_cx; | |
1829 | + for(var i=0;i<more_cx.length;i++){ | |
1830 | + if(more_cx[i].prom_type==5){ | |
1831 | + more_cx[i].main_gid= more_cx[i].collocation.main_goods_id; | |
1832 | + var min=more_cx[i].collocation_main_price+more_cx[i].collocation_min_price; | |
1833 | + var max=more_cx[i].collocation_main_price+more_cx[i].collocation_max_price; | |
1834 | + more_cx[i].show_price="¥"+min+"-"+max; | |
1835 | + } | |
1836 | + } | |
1837 | + item1.more_cx=more_cx; | |
1829 | 1838 | |
1830 | 1839 | if(res.data.data.zh_pro){ |
1831 | 1840 | th.data.zhhe_act_map[res.data.data.zh_pro.id]=res.data.data.zh_pro; | ... | ... |
pages/cart/cart/cart.js
... | ... | @@ -69,7 +69,17 @@ Page({ |
69 | 69 | //--- 调用接口获取活动 --- |
70 | 70 | await getApp().promiseGet('/api/weshop/goods/getGoodsPromInfo', {data:req_d}).then(res => { |
71 | 71 | if(res.data.code==0){ |
72 | - item1.more_cx=res.data.data.more_cx; | |
72 | + | |
73 | + var more_cx=res.data.data.more_cx; | |
74 | + for(var i=0;i<more_cx.length;i++){ | |
75 | + if(more_cx[i].prom_type==5){ | |
76 | + more_cx[i].main_gid= more_cx[i].collocation.main_goods_id; | |
77 | + var min=more_cx[i].collocation_main_price+more_cx[i].collocation_min_price; | |
78 | + var max=more_cx[i].collocation_main_price+more_cx[i].collocation_max_price; | |
79 | + more_cx[i].show_price="¥"+min+"-"+max; | |
80 | + } | |
81 | + } | |
82 | + item1.more_cx=more_cx | |
73 | 83 | if(res.data.data.zh_pro){ |
74 | 84 | th.data.zuhe_map[res.data.data.zh_pro.id]=res.data.data.zh_pro; |
75 | 85 | } | ... | ... |
pages/goods/goodsInfo/goodsInfo.js