Commit 73916f30d46e237feb0aca7a57d9a13a6b135de5
1 parent
10b46184
OA单的优化
Showing
9 changed files
with
443 additions
and
1445 deletions
packageC/pages/group_list/group_list.js
... | ... | @@ -14,10 +14,12 @@ Page({ |
14 | 14 | // goodlist: null, |
15 | 15 | |
16 | 16 | isLogin: false, |
17 | - list: null, | |
17 | + list: [], | |
18 | 18 | isLoading: false, // 检测是否已经发送请求,防止重复发送请求 |
19 | 19 | noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据 |
20 | 20 | pageNum: 1, // 当前页数 |
21 | + | |
22 | + time_arr:[] | |
21 | 23 | }, |
22 | 24 | |
23 | 25 | /** |
... | ... | @@ -63,7 +65,7 @@ Page({ |
63 | 65 | }; |
64 | 66 | |
65 | 67 | this.setData({ |
66 | - list: null, | |
68 | + list: [], | |
67 | 69 | pageNum: 1, |
68 | 70 | noMore: false, |
69 | 71 | }); |
... | ... | @@ -110,7 +112,7 @@ Page({ |
110 | 112 | |
111 | 113 | |
112 | 114 | this.setData({ |
113 | - list: null, | |
115 | + list: [], | |
114 | 116 | type: typeValue, |
115 | 117 | }); |
116 | 118 | |
... | ... | @@ -141,6 +143,9 @@ Page({ |
141 | 143 | * 页面上拉触底事件的处理函数 |
142 | 144 | */ |
143 | 145 | onReachBottom: function () { |
146 | + | |
147 | + if(this.data.isLoading) return false; | |
148 | + | |
144 | 149 | let data = this.data.currentData; |
145 | 150 | this.scrollToLower('/api/weshop/goods/groupBuy/page', data); |
146 | 151 | }, |
... | ... | @@ -148,47 +153,48 @@ Page({ |
148 | 153 | /** |
149 | 154 | * 用户点击右上角分享 |
150 | 155 | */ |
151 | - onShareAppMessage: function () { getApp().globalData.no_clear=1 | |
152 | - | |
153 | - }, | |
156 | + onShareAppMessage: function () { getApp().globalData.no_clear=1; }, | |
154 | 157 | |
155 | 158 | |
156 | 159 | /** |
157 | 160 | * 请求数据 |
158 | 161 | */ |
159 | 162 | getData: function(isInit, url, data) { |
163 | + | |
164 | + wx.showLoading(); | |
165 | + | |
160 | 166 | let p = app.request.promiseGet(url, { |
161 | 167 | data: data, |
162 | - isShowLoading: true, | |
168 | + isShowLoading: false, | |
163 | 169 | }) |
164 | 170 | .then(function(res) { |
165 | - if(res.data.code == 0) { | |
166 | - | |
171 | + | |
172 | + | |
173 | + | |
174 | + if(ut.ajax_ok(res)) { | |
175 | + | |
167 | 176 | self.setData({ |
168 | - isLoading: false | |
169 | - }); | |
177 | + ['list['+(self.data.pageNum-1)+']']:res.data.data.pageData | |
178 | + }) | |
170 | 179 | |
171 | - if(isInit) {// 第一次加载 | |
172 | - self.setData({ | |
173 | - list: res.data.data | |
174 | - }); | |
175 | - } else { | |
176 | - self.setData({ | |
177 | - 'list.pageData': self.data.list.pageData.concat(res.data.data.pageData) | |
178 | - }); | |
179 | - }; | |
180 | - | |
181 | - if((res.data.data.pageData.length == 0) || (res.data.data.pageSize * res.data.data.page >= res.data.data.total)) { | |
180 | + if(res.data.data.pageSize * res.data.data.page >= res.data.data.total){ | |
182 | 181 | self.setData({ |
183 | 182 | noMore: true |
184 | 183 | }); |
185 | 184 | }; |
185 | + | |
186 | + | |
186 | 187 | |
187 | 188 | } else { |
188 | - self.setData({ | |
189 | - 'list.pageData': [] | |
190 | - }); | |
189 | + self.setData({ noMore: true }); | |
191 | 190 | }; |
191 | + | |
192 | + self.setData({ | |
193 | + isLoading: false, | |
194 | + is_get:1 | |
195 | + }); | |
196 | + | |
197 | + wx.hideLoading(); | |
192 | 198 | |
193 | 199 | }); |
194 | 200 | |
... | ... | @@ -218,6 +224,7 @@ Page({ |
218 | 224 | }); |
219 | 225 | requestData.page = this.data.pageNum; |
220 | 226 | this.getData(false, url, requestData); |
227 | + | |
221 | 228 | }; |
222 | 229 | }, |
223 | 230 | |
... | ... | @@ -229,38 +236,64 @@ Page({ |
229 | 236 | |
230 | 237 | |
231 | 238 | //----倒计时函数----- |
232 | - countDown() { | |
233 | - if(!this.data.is_timer) return false; | |
234 | - var th=this; | |
235 | - // 获取当前时间,同时得到活动结束时间数组 | |
236 | - let newTime = ut.gettimestamp(); | |
237 | - var endTimeList = this.data.list.pageData; | |
238 | - if(endTimeList == null) return null; | |
239 | - // 对结束时间进行处理渲染到页面 | |
240 | - for(var i = 0; i < endTimeList.length; i++) { | |
241 | - var o = endTimeList[i]; | |
242 | - var endTime = this.data.type == 1?o.end_time:o.start_time; | |
243 | - // if(th.data.type==0) endTime = o.start_time; | |
244 | - let obj = null; | |
245 | - // 如果活动未结束,对时间进行处理 | |
246 | - if (endTime - newTime > 0) { | |
247 | - let time = (endTime - newTime); | |
248 | - // 获取天、时、分、秒 | |
249 | - let day = parseInt(time / (60 * 60 * 24)); | |
250 | - let hou = parseInt(time % (60 * 60 * 24) / 3600); | |
251 | - let min = parseInt(time % (60 * 60 * 24) % 3600 / 60); | |
252 | - let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); | |
253 | - obj = { | |
254 | - day: this.timeFormat(day), hou: this.timeFormat(hou), min: this.timeFormat(min), sec: this.timeFormat(sec), hide: 1 | |
255 | - } | |
256 | - } else { | |
257 | - //活动已结束,全部设置为'00' | |
258 | - obj = { day: '00', hou: '00', min: '00', sec: '00' } | |
259 | - } | |
260 | - var txt ="goodlist["+i+"].djs"; | |
261 | - th.setData({ [txt]: obj}); | |
262 | - } | |
263 | - }, | |
239 | + countDown() { | |
240 | + | |
241 | + if (!this.data.is_timer) return false; | |
242 | + var th = this; | |
243 | + // 获取当前时间,同时得到活动结束时间数组 | |
244 | + let newTime = ut.gettimestamp(); | |
245 | + | |
246 | + | |
247 | + var time_arr=[]; | |
248 | + | |
249 | + for (let j = 0; j < this.data.list.length; j++) { | |
250 | + var endTimeList = this.data.list[j]; | |
251 | + if (endTimeList == null) return null; | |
252 | + | |
253 | + var arr_new=[]; | |
254 | + | |
255 | + // 对结束时间进行处理渲染到页面 | |
256 | + for (var i = 0; i < endTimeList.length; i++) { | |
257 | + | |
258 | + var o = endTimeList[i]; | |
259 | + var endTime = this.data.type == 1 ? o.end_time : o.start_time; | |
260 | + // if(th.data.type==0) endTime = o.start_time; | |
261 | + let obj = null; | |
262 | + // 如果活动未结束,对时间进行处理 | |
263 | + if (endTime - newTime > 0) { | |
264 | + let time = (endTime - newTime); | |
265 | + // 获取天、时、分、秒 | |
266 | + let day = parseInt(time / (60 * 60 * 24)); | |
267 | + let hou = parseInt(time % (60 * 60 * 24) / 3600); | |
268 | + let min = parseInt(time % (60 * 60 * 24) % 3600 / 60); | |
269 | + let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); | |
270 | + obj = { | |
271 | + day: this.timeFormat(day), | |
272 | + hou: this.timeFormat(hou), | |
273 | + min: this.timeFormat(min), | |
274 | + sec: this.timeFormat(sec), | |
275 | + hide: 1 | |
276 | + } | |
277 | + } else { | |
278 | + //活动已结束,全部设置为'00' | |
279 | + obj = {day: '00', hou: '00', min: '00', sec: '00'} | |
280 | + } | |
281 | + //var txt = "goodlist[" + i + "].djs"; | |
282 | + //th.setData({[txt]: obj}); | |
283 | + | |
284 | + var e={djs:obj}; | |
285 | + arr_new.push(e); | |
286 | + | |
287 | + } | |
288 | + | |
289 | + time_arr.push(arr_new); | |
290 | + | |
291 | + | |
292 | + } | |
293 | + | |
294 | + this.setData({time_arr:time_arr}); | |
295 | + | |
296 | + }, | |
264 | 297 | |
265 | 298 | |
266 | 299 | ... | ... |
packageC/pages/group_list/group_list.wxml
1 | 1 | <view class="list"> |
2 | - <block wx:for="{{list.pageData}}"> | |
3 | - <view class="list-item" bindtap="goto" data-url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}&prom_id={{item.id}}&prom_type=2"> | |
2 | + | |
3 | + <!-- --> | |
4 | + <block wx:for="{{list}}" wx:for-item="p_item" wx:for-index="p_idx"> | |
5 | + | |
6 | + <block wx:for="{{p_item}}"> | |
7 | + <view class="list-item" bindtap="goto" data-url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}&prom_id={{item.id}}&prom_type=2"> | |
4 | 8 | <view class="img-container"> |
5 | 9 | <image class="img-block" src="{{imghost + item.original_img}}" data-val="{{item.original_img}}" |
6 | - data-errorimg="list.pageData[{{index}}].original_img" binderror="bind_bnerr2" lazy-load="true"></image> | |
10 | + data-errorimg="list[{{p_idx}}][{{index}}].original_img" binderror="bind_bnerr2" lazy-load="true"></image> | |
7 | 11 | </view> |
8 | 12 | <view class="mgl20 flex fdc f1 jc_sb"> |
9 | 13 | <view> |
... | ... | @@ -24,7 +28,9 @@ |
24 | 28 | |
25 | 29 | <view>已售<block wx:if="{{type == 1}}">{{item.buy_num+item.virtual_num}}</block><block wx:else>0</block>件</view> |
26 | 30 | |
27 | - <view class=""><text class="iconfont icon-shizhong fs24"></text>{{goodlist[index].djs.day}}天{{goodlist[index].djs.hou}}时{{goodlist[index].djs.min}}分{{goodlist[index].djs.sec}}秒</view> | |
31 | + <view class=""><text class="iconfont icon-shizhong fs24"></text> | |
32 | + {{time_arr[p_idx][index].djs.day}}天{{time_arr[p_idx][index].djs.hou}}时{{time_arr[p_idx][index].djs.min}}分{{time_arr[p_idx][index].djs.sec}}秒 | |
33 | + </view> | |
28 | 34 | </view> |
29 | 35 | |
30 | 36 | |
... | ... | @@ -35,24 +41,11 @@ |
35 | 41 | </view> |
36 | 42 | </view> |
37 | 43 | </view> |
38 | - | |
44 | + </block> | |
39 | 45 | </block> |
40 | 46 | <view style="height:60rpx"></view> |
41 | 47 | </view> |
42 | 48 | |
43 | -<view class="no-more" hidden="{{!noMore}}" wx:if="{{list.pageData.length !== 0}}">—— 已经到底啦 ——</view> | |
44 | -<nodata nodataContainer="t-c" wx:if="{{list.pageData.length == 0}}"></nodata> | |
49 | +<view class="no-more" hidden="{{!noMore}}" wx:if="{{list.length >= 0 && noMore }}">—— 已经到底啦 ——</view> | |
50 | +<nodata nodataContainer="t-c" wx:if="{{list.length == 0 && is_get}}"></nodata> | |
45 | 51 | |
46 | - | |
47 | -<!-- | |
48 | -<view class="kill-time xc-seckill-bottom"> | |
49 | - <view class="theader" > | |
50 | - <view bindtap='tip' data-ty="1" class="xc-border-right flex-center timeac left {{type==1?'active':''}}"> | |
51 | - <image class="xc-bottom" src="{{url}}{{type==1?'/miniapp/images/fire-red.png':'/miniapp/images/fire-black.png'}}"></image> | |
52 | - 火热进行中</view> | |
53 | - <view bindtap='tip' data-ty="0" class=" flex-center timeac right {{type==0?'active':''}}"> | |
54 | - <image class="xc-bottom" src="{{url}}{{type==0?'/miniapp/images/clock-rad.png':'/miniapp/images/clock-black.png'}}"></image> | |
55 | - 即将开始</view> | |
56 | - </view> | |
57 | -</view> | |
58 | ---> | |
59 | 52 | \ No newline at end of file | ... | ... |
packageC/pages/luckyGo/luckyGo_goodsInfo/buy_integral.wxml deleted
1 | -<view bindtap="closeSpecModal_inte" class="cover-layer"></view> | |
2 | - <view class="spec-model"> | |
3 | - <view class="pding"> | |
4 | - <icon bindtap="closeSpecModal_inte" class="modal-close" color="black" size="22" type="cancel"></icon> | |
5 | - <view class="spec-goods"> | |
6 | - <image class="wh100 spec-img xc-distance-bottom" src="{{data.original_img}}" binderror="pop_err_img" data-errorimg="data.original_img"></image> | |
7 | - <view class="spec-goods-info"> | |
8 | - <view class="spec-goods-name ellipsis-2">{{data.goods_name}}</view> | |
9 | - <view class="flex ai_end xc-val-money"> | |
10 | - <view class="spec-goods-price"> | |
11 | - <text wx:if="{{prom_integral}}">{{prom_integral}}积分</text> | |
12 | - <text wx:if="{{prom_integral && prom_price}}">+</text> | |
13 | - <text wx:if="{{prom_price}}">{{prom_price}}元</text> | |
14 | - <text wx:if="{{!prom_integral && !prom_price}}">0积分</text> | |
15 | - </view> | |
16 | - </view> | |
17 | - | |
18 | - | |
19 | - <view class="flex"> | |
20 | - <view class="spec-goods-stock">已售:{{prom_act.buy_num}}</view> | |
21 | - <view class="spec-goods-stock">可售:{{prom_act.limitqty-prom_act.buy_num}}</view> | |
22 | - </view> | |
23 | - | |
24 | - </view> | |
25 | - | |
26 | - <!-- 选择门店模块 --> | |
27 | - <view class="flex-space-between address ai_end xc-width "> | |
28 | - | |
29 | - <view class="flex ai_end" wx:if="{{def_pick_store && def_pick_store.pickup_name}}"> | |
30 | - <text class="fs30 xc-black3 shop_name">{{def_pick_store.pickup_name}}</text> | |
31 | - <view class="distance fs24 xc-ash"wx:if="{{def_pick_store.distance!=null}}"> | |
32 | - 距离:{{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}} | |
33 | - | |
34 | - </view> | |
35 | - </view> | |
36 | - | |
37 | - <!-- 没有门店的时候 --> | |
38 | - <view class="flex" bindtap="choice_store" wx:else> | |
39 | - <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image> | |
40 | - <view class="fs30" style="color:black;">选择门店</view> | |
41 | - </view> | |
42 | - | |
43 | - <view hidden="{{has_def && sys_switch.is_pricing_open_store}}" class="red-co fs28" bindtap="choice_store" > | |
44 | - 更多门店 | |
45 | - <text class="right-arrow"></text> | |
46 | - </view> | |
47 | - </view> | |
48 | - <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view> | |
49 | - <block wx:else> | |
50 | - <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view> | |
51 | - <block wx:else> | |
52 | - <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view> | |
53 | - <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0}}">(库存不足)</view> | |
54 | - </block> | |
55 | - </block> | |
56 | - | |
57 | - <view class="fs24 xc-ash-9f xc-distance-top "wx:if="{{def_pick_store && def_pick_store.fulladdress}}">地址:{{def_pick_store.fulladdress}}</view> | |
58 | - | |
59 | - | |
60 | - <!--商品的属性项目--> | |
61 | - <view class="xc-goods-attribute"> | |
62 | - <view hidden="{{ismend==1}}" class="spec-name">商品规格</view> | |
63 | - <view hidden="{{ismend==1}}" style="max-height: 120rpx;overflow-y: auto;"> | |
64 | - <view class="spec_bt {{gid==item.goods_id?'act':''}}" bindtap="sele_spec" data-gid='{{item.goods_id}}' wx:for="{{sku_g}}" wx:key="sku_g"> | |
65 | - {{item.gg}} | |
66 | - </view> | |
67 | - </view> | |
68 | - </view> | |
69 | - | |
70 | - <view class="b_num"> | |
71 | - <view>购买数量</view> | |
72 | - <view class="count"> | |
73 | - <view bindtap="{{goodsInputNum <= 1 ? '':'subCartNum_inte'}}" class="sub {{goodsInputNum <= 1 ? 'active':''}}">-</view> | |
74 | - <input bindblur="inputCartNum_inte" type="number" value="{{goodsInputNum}}"></input> | |
75 | - <view bindtap="addCartNum_inte" class="add">+</view> | |
76 | - </view> | |
77 | - </view> | |
78 | - </view> | |
79 | - | |
80 | - <!-- 按钮部分 --> | |
81 | - <view class="spec-cart-btns"> | |
82 | - <!-- 根本就找不到门店 --> | |
83 | - <block wx:if="{{def_pick_store && def_pick_store.is_no_dis}}"> | |
84 | - <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">配送不匹配</view> | |
85 | - </block> | |
86 | - | |
87 | - <block wx:else> | |
88 | - | |
89 | - <!-- 根本就找不到门店 --> | |
90 | - <block wx:if="{{!only_pk && !def_pickpu_list}}"> | |
91 | - <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">库存不足</view> | |
92 | - </block> | |
93 | - <block wx:else> | |
94 | - | |
95 | - | |
96 | - <block wx:if="{{only_pk.length && !only_pk.length}}"> | |
97 | - <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">库存不足</view> | |
98 | - </block> | |
99 | - <block wx:else> | |
100 | - <block wx:if="{{def_pickpu_list && !def_pickpu_list.length}}"> | |
101 | - <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">库存不足</view> | |
102 | - </block> | |
103 | - <block wx:else> | |
104 | - <block wx:if="{{!def_pick_store}}"> | |
105 | - <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">请先选择门店</view> | |
106 | - </block> | |
107 | - <block wx:else> | |
108 | - <block wx:if="{{data.store_count<=0}}"> | |
109 | - <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">库存不足</view> | |
110 | - </block> | |
111 | - <block wx:else> | |
112 | - <view bindtap="addCart_inte" class="spec-cart-btn spec-buy" data-action="buy">立即兑换</view> | |
113 | - </block> | |
114 | - | |
115 | - </block> | |
116 | - </block> | |
117 | - </block> | |
118 | - </block> | |
119 | - </block> | |
120 | - </view> | |
121 | - | |
122 | - | |
123 | - </view> | |
124 | - </view> | |
125 | - <view class="clear"></view> | |
126 | 0 | \ No newline at end of file |
packageC/pages/luckyGo/luckyGo_goodsInfo/buy_integral_normal.wxml deleted
1 | -<view bindtap="closeSpecModal_inte_normal" class="cover-layer"></view> | |
2 | - <view class="spec-model"> | |
3 | - <view class="pding"> | |
4 | - <icon bindtap="closeSpecModal_inte_normal" class="modal-close" color="black" size="22" type="cancel"></icon> | |
5 | - <view class="spec-goods"> | |
6 | - <image class="wh100 spec-img xc-distance-bottom" src="{{sele_g.original_img}}" binderror="pop_err_img" data-errorimg="data.original_img"></image> | |
7 | - <view class="spec-goods-info"> | |
8 | - <view class="spec-goods-name ellipsis-2">{{sele_g.goods_name}}</view> | |
9 | - <view class="flex ai_end xc-val-money"> | |
10 | - <text class="fs20">¥</text> | |
11 | - <!-- 如果是等级会员,且有等级价 --> | |
12 | - <block wx:if="{{card_field && sele_g[card_field]>0}}">{{sele_g[card_field]}} </block> | |
13 | - <block wx:else>{{sele_g.shop_price}}</block> | |
14 | - </view> | |
15 | - | |
16 | - <view class="flex"> | |
17 | - <view class="spec-goods-stock">已售:{{sele_g.sales_sum}}</view> | |
18 | - <block wx:if="{{sales_rules==2}}"> | |
19 | - <view class="spec-goods-stock" wx:if="{{def_pick_store && def_pick_store.CanOutQty}}">可售:{{def_pick_store.CanOutQty}}</view> | |
20 | - <view class="spec-goods-stock" wx:else>可售:0</view> | |
21 | - </block> | |
22 | - <block wx:else><view class="spec-goods-stock">可售:{{sele_g.store_count}}</view></block> | |
23 | - </view> | |
24 | - | |
25 | - | |
26 | - </view> | |
27 | - | |
28 | - <!-- 选择门店模块 --> | |
29 | - <view class="flex-space-between address ai_end xc-width "> | |
30 | - | |
31 | - <view class="flex ai_end" wx:if="{{def_pick_store && def_pick_store.pickup_name}}"> | |
32 | - <text class="fs30 xc-black3 shop_name">{{def_pick_store.pickup_name}}</text> | |
33 | - <view class="distance fs24 xc-ash"wx:if="{{def_pick_store.distance!=null}}"> | |
34 | - 距离:{{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}} | |
35 | - | |
36 | - </view> | |
37 | - </view> | |
38 | - | |
39 | - <!-- 没有门店的时候 --> | |
40 | - <view class="flex" bindtap="choice_store" wx:else> | |
41 | - <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image> | |
42 | - <view class="fs30" style="color:black;">选择门店</view> | |
43 | - </view> | |
44 | - | |
45 | - <view hidden="{{has_def && sys_switch.is_pricing_open_store}}" class="red-co fs28" bindtap="choice_store" > | |
46 | - 更多门店 | |
47 | - <text class="right-arrow"></text> | |
48 | - </view> | |
49 | - </view> | |
50 | - <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view> | |
51 | - <block wx:else> | |
52 | - <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view> | |
53 | - <block wx:else> | |
54 | - <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view> | |
55 | - <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0}}">(库存不足)</view> | |
56 | - </block> | |
57 | - </block> | |
58 | - <view class="fs24 xc-ash-9f xc-distance-top "wx:if="{{def_pick_store && def_pick_store.fulladdress}}">地址:{{def_pick_store.fulladdress}}</view> | |
59 | - | |
60 | - | |
61 | - <!--商品的属性项目--> | |
62 | - <view class="xc-goods-attribute"> | |
63 | - <view hidden="{{ismend==1}}" class="spec-name">商品规格</view> | |
64 | - <view hidden="{{ismend==1}}" style="max-height: 120rpx;overflow-y: auto;"> | |
65 | - <view class="spec_bt {{gid==item.goods_id?'act':''}}" bindtap="sele_spec" data-nor="1" data-gid='{{item.goods_id}}' wx:for="{{sku_g_pt}}" wx:key="sku_g"> | |
66 | - {{item.gg}} | |
67 | - </view> | |
68 | - </view> | |
69 | - </view> | |
70 | - | |
71 | - <view class="b_num"> | |
72 | - <view>购买数量</view> | |
73 | - <view class="count"> | |
74 | - <view bindtap="{{goodsInputNum <= 1 ? '':'subCartNum'}}" class="sub {{goodsInputNum <= 1 ? 'active':''}}">-</view> | |
75 | - <input bindblur="inputCartNum" type="number" value="{{goodsInputNum}}"></input> | |
76 | - <view bindtap="addCartNum" class="add">+</view> | |
77 | - </view> | |
78 | - </view> | |
79 | - </view> | |
80 | - | |
81 | - | |
82 | - <!-- 提示再买多少优惠 --> | |
83 | - <view style="margin-top: 35rpx;color:#333;font-size:28rpx;" wx:if="{{hui_condition}}"> | |
84 | - 再买{{hui_condition.need}} | |
85 | - <text wx:if="{{hui_condition.money}}">,免{{hui_condition.money}}元</text> | |
86 | - <text wx:if="{{hui_condition.sale}}">,打{{hui_condition.sale}}折</text> | |
87 | - <text wx:if="{{hui_condition.past==1}}">,包邮</text> | |
88 | - <text wx:if="{{hui_condition.intValue>0}}">,送{{hui_condition.intValue}}积分</text> | |
89 | - <text wx:if="{{hui_condition.couponId>0}}">,送优惠券</text> | |
90 | - <text wx:if="{{hui_condition.gift_id>0}}">,送赠品</text> | |
91 | - <text wx:if="{{hui_condition.lb_id>0}}">,送礼包</text> | |
92 | - <text wx:if="{{hui_condition.zxlb_id>0}}">,送专享礼包</text> | |
93 | - </view> | |
94 | - | |
95 | - | |
96 | - <!-- 按钮部分 --> | |
97 | - <view class="spec-cart-btns"> | |
98 | - | |
99 | - | |
100 | - <!-- 根本就找不到门店 --> | |
101 | - <block wx:if="{{def_pick_store && def_pick_store.is_no_dis}}"> | |
102 | - <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">配送不匹配</view> | |
103 | - </block> | |
104 | - <block wx:else> | |
105 | - <!-- 根本就找不到门店 --> | |
106 | - <block wx:if="{{!only_pk && !def_pickpu_list}}"> | |
107 | - <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">库存不足</view> | |
108 | - </block> | |
109 | - <block wx:else> | |
110 | - | |
111 | - | |
112 | - <block wx:if="{{only_pk.length && !only_pk.length}}"> | |
113 | - <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">库存不足</view> | |
114 | - </block> | |
115 | - <block wx:else> | |
116 | - <block wx:if="{{def_pickpu_list && !def_pickpu_list.length}}"> | |
117 | - <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">库存不足</view> | |
118 | - </block> | |
119 | - <block wx:else> | |
120 | - <block wx:if="{{!def_pick_store}}"> | |
121 | - <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">请先选择门店</view> | |
122 | - </block> | |
123 | - <block wx:else> | |
124 | - <block wx:if="{{data.store_count<=0}}"> | |
125 | - <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">库存不足</view> | |
126 | - </block> | |
127 | - <block wx:else> | |
128 | - <view class="flex jc_sb"> | |
129 | - <view class="spec-cart-btn spec-buy w40" bindtap="addCart" | |
130 | - data-action="add" style="background-color: #ffb03f;">加入购物车</view> | |
131 | - <view class="spec-cart-btn spec-buy w40" bindtap="addCart" | |
132 | - data-action="buy">立即购买</view> | |
133 | - </view> | |
134 | - </block> | |
135 | - | |
136 | - </block> | |
137 | - </block> | |
138 | - </block> | |
139 | - </block> | |
140 | - </block> | |
141 | - </view> | |
142 | - | |
143 | - | |
144 | - </view> | |
145 | - </view> | |
146 | - <view class="clear"></view> | |
147 | 0 | \ No newline at end of file |
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
... | ... | @@ -4066,8 +4066,6 @@ Page({ |
4066 | 4066 | // ind == 1 为普通购买 |
4067 | 4067 | openSpecModel_pt: function (e) { |
4068 | 4068 | |
4069 | - | |
4070 | - | |
4071 | 4069 | this.setData({ open_ind_store: 9, goodsInputNum: 1 }); |
4072 | 4070 | // 判断是否有待支付订单 |
4073 | 4071 | var aid = this.data.group_id; |
... | ... | @@ -4190,7 +4188,9 @@ Page({ |
4190 | 4188 | // } |
4191 | 4189 | // }); |
4192 | 4190 | |
4191 | + | |
4193 | 4192 | th.data.prom_type=9; |
4193 | + | |
4194 | 4194 | th.get_sto(); |
4195 | 4195 | th.setData({ |
4196 | 4196 | is_normal: 0, |
... | ... | @@ -4809,12 +4809,16 @@ Page({ |
4809 | 4809 | context.setTextAlign('left'); |
4810 | 4810 | context.fillText('强烈推荐', 64 * unit, 672 * unit); |
4811 | 4811 | // 7.商品价格 |
4812 | - let price = '¥' + this.data.data.shop_price; | |
4813 | - // if (th.data.prom_act) | |
4814 | - // pri0 = th.data.prom_act.price; | |
4812 | + let price = '¥' + parseFloat( this.data.luckGoInfo.group_price/100).toFixed(2); | |
4815 | 4813 | context.setFontSize(32 * unit); |
4816 | 4814 | context.setFillStyle('#DE1117'); |
4817 | 4815 | context.fillText(price, 54 * unit, 730 * unit); |
4816 | + | |
4817 | + //-- 零售价的优化 -- | |
4818 | + var wp= 60 * unit+ut.measureText( price, 32 * unit); | |
4819 | + var hp=730 * unit | |
4820 | + this.draw_pos_price(context,wp,hp,this.data.data.market_price,unit); | |
4821 | + | |
4818 | 4822 | // 8.商品标题 |
4819 | 4823 | context.setFontSize(20 * unit); |
4820 | 4824 | context.setFillStyle('#898989'); |
... | ... | @@ -4835,6 +4839,29 @@ Page({ |
4835 | 4839 | |
4836 | 4840 | |
4837 | 4841 | |
4842 | + //---市场价划掉--- | |
4843 | + draw_pos_price(context,w,h,market_price,unit){ | |
4844 | + | |
4845 | + if(!this.data.sys_switch) return false; | |
4846 | + if(!this.data.sys_switch.is_retail_price) return false; | |
4847 | + | |
4848 | + | |
4849 | + context.setFillStyle("gray") | |
4850 | + context.setFontSize(22 * unit) | |
4851 | + var pri0 = "¥" + market_price; | |
4852 | + context.fillText(pri0, w, h); | |
4853 | + | |
4854 | + var c_h=h-6; | |
4855 | + context.setStrokeStyle('gray'); | |
4856 | + context.setLineWidth(1 * unit); | |
4857 | + context.moveTo(w - 5, c_h); | |
4858 | + context.lineTo(w + ut.measureText(pri0, 22 * unit) + 5, c_h); | |
4859 | + context.stroke(); | |
4860 | + | |
4861 | + }, | |
4862 | + | |
4863 | + | |
4864 | + | |
4838 | 4865 | //--定义的保存图片方法,分享团--- |
4839 | 4866 | saveImageToPhotosAlbum: function () { |
4840 | 4867 | //--先判断会员状态-- |
... | ... | @@ -4851,8 +4878,8 @@ Page({ |
4851 | 4878 | |
4852 | 4879 | //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团 9幸运购 |
4853 | 4880 | var type = 9; |
4854 | - console.log('type', type); | |
4855 | - if (type == 6) type = 2; | |
4881 | + var th=this; | |
4882 | + | |
4856 | 4883 | if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3; |
4857 | 4884 | |
4858 | 4885 | wx.showLoading({ title: '生成中...', }) |
... | ... | @@ -4882,8 +4909,6 @@ Page({ |
4882 | 4909 | ///二微码 |
4883 | 4910 | var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + |
4884 | 4911 | os.stoid + "?sceneValue=" + scene + "&pageValue=packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo"; |
4885 | - // var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + | |
4886 | - // os.stoid + "?sceneValue=" + scene + "&pageValue=packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo"; | |
4887 | 4912 | |
4888 | 4913 | console.log('path3......', path3); |
4889 | 4914 | |
... | ... | @@ -4899,14 +4924,6 @@ Page({ |
4899 | 4924 | // 先画背景 |
4900 | 4925 | var pg_path = "../../../../images/share/share_bg.png"; |
4901 | 4926 | |
4902 | - // context.fillStyle="#FFFFFF"; | |
4903 | - // context.fillRect(0,0,554 * unit, 899 * unit); | |
4904 | - | |
4905 | - // if(type == 0) { | |
4906 | - // this.drawPoster(context); | |
4907 | - // return false; | |
4908 | - // }; | |
4909 | - | |
4910 | 4927 | |
4911 | 4928 | //-- 如果有自定义海报的时候,判断背景的图片 -- |
4912 | 4929 | if (th.data.share_b_img) { |
... | ... | @@ -4915,17 +4932,17 @@ Page({ |
4915 | 4932 | // context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); |
4916 | 4933 | |
4917 | 4934 | |
4918 | - if (!th.data.share_b_img && (type == 9)) { // 如果是普通商品,绘制新海报 | |
4935 | + if (!th.data.share_b_img) { // 如果是普通商品,绘制新海报 | |
4919 | 4936 | th.drawPoster(context, unit, th.data.share_goods_img, vpath); |
4920 | 4937 | } else { |
4921 | 4938 | context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); |
4922 | 4939 | }; |
4923 | 4940 | |
4924 | - // th.drawPoster(context, unit, th.data.share_goods_img, vpath); | |
4941 | + | |
4925 | 4942 | |
4926 | 4943 | |
4927 | 4944 | //-- 是自定义海报的情况下 -- |
4928 | - if (th.data.share_b_img || type != 0) { | |
4945 | + if (th.data.share_b_img ) { | |
4929 | 4946 | |
4930 | 4947 | |
4931 | 4948 | |
... | ... | @@ -4973,28 +4990,22 @@ Page({ |
4973 | 4990 | // context.setFillStyle("#7f7f7f") |
4974 | 4991 | // context.setFontSize(21.3 * unit) |
4975 | 4992 | // context.fillText("向您发出幸运购邀请", 152 * unit, 90 * unit); |
4976 | - | |
4977 | 4993 | } |
4978 | - | |
4979 | - }; | |
4994 | + } | |
4980 | 4995 | |
4981 | 4996 | |
4982 | 4997 | |
4983 | 4998 | var share_title = th.data.data.goods_name; |
4984 | - if (th.data.prom_type == 1 || th.data.prom_type == 6 || th.data.prom_type == 4) { | |
4985 | - share_title = th.data.prom_act.share_title; | |
4986 | - if (!share_title) share_title = th.data.prom_act.title; | |
4987 | - if (th.data.prom_type == 4) share_title = th.data.prom_act.name; | |
4988 | - } | |
4989 | - | |
4990 | 4999 | //---产品名称--- |
4991 | 5000 | //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 |
4992 | - if (th.data.share_b_img || (type != 4 && type != 9)) { | |
5001 | + if (th.data.share_b_img ) { | |
4993 | 5002 | context.setFillStyle("black"); |
4994 | 5003 | context.setFontSize(21.3 * unit) |
4995 | - th.draw_Text(context, share_title, | |
5004 | + getApp().draw_Text(context, share_title, | |
4996 | 5005 | 38 * unit, 180 * unit, 220 * unit, 220 * unit, unit); |
4997 | 5006 | |
5007 | + | |
5008 | + | |
4998 | 5009 | //------产品的价格------- |
4999 | 5010 | context.setFontSize(23 * unit) |
5000 | 5011 | context.setFillStyle("red") |
... | ... | @@ -5018,276 +5029,49 @@ Page({ |
5018 | 5029 | context.fillText('参团价', 330 * unit, 179 * unit); |
5019 | 5030 | |
5020 | 5031 | //---市场价划掉--- |
5021 | - context.setFillStyle("gray") | |
5022 | - context.setFontSize(22 * unit) | |
5023 | - pri0 = "零售价:¥" + th.data.data.market_price.toFixed(2); | |
5024 | - var wd2 = th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 25; | |
5025 | - context.fillText(pri0, wd2, 213 * unit); | |
5026 | - | |
5027 | - context.setStrokeStyle('gray'); | |
5028 | - context.setLineWidth(1 * unit); | |
5029 | - context.moveTo(wd2 - 5, 206 * unit); | |
5030 | - context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit); | |
5031 | - context.stroke(); | |
5032 | - | |
5033 | - } else if (type == 4 && type != 0) { | |
5034 | - context.setFillStyle("black"); | |
5035 | - context.setFontSize(21.3 * unit) | |
5036 | - th.draw_Text(context, share_title, | |
5037 | - 38 * unit, 170 * unit, 20 * unit, 300 * unit, unit); | |
5038 | - //------ 产品的价格 ----- | |
5039 | - var pri0 = th.data.prom_act.addmoney; | |
5040 | - var integral = th.data.prom_act.integral; | |
5041 | - var text = ""; | |
5042 | - if (integral) { text = integral + "积分"; } | |
5043 | - if (pri0 && integral) { text += "+"; } | |
5044 | - if (pri0) { text += "¥" + pri0; } | |
5045 | - | |
5046 | - if (!pri0 && !integral) { text = "0积分"; } | |
5047 | - context.setFillStyle("red"); | |
5048 | - context.fillText(text, 38 * unit, 235 * unit); | |
5032 | + // context.setFillStyle("gray") | |
5033 | + // context.setFontSize(22 * unit) | |
5034 | + pri0 = "零售价:¥" + th.data.data.market_price.toFixed(2); | |
5035 | + var wd2 = th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 25; | |
5036 | + | |
5037 | + // context.fillText(pri0, wd2, 213 * unit); | |
5038 | + // context.setStrokeStyle('gray'); | |
5039 | + // context.setLineWidth(1 * unit); | |
5040 | + // context.moveTo(wd2 - 5, 206 * unit); | |
5041 | + // context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit); | |
5042 | + // context.stroke(); | |
5043 | + | |
5044 | + th.draw_pos_price(context,wd2, 213 * unit,pri0,unit); | |
5049 | 5045 | |
5050 | 5046 | } |
5051 | 5047 | |
5052 | 5048 | //---中间大图--- |
5053 | - if ( th.data.share_b_img || type != 9) { | |
5054 | - context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit); | |
5049 | + if ( th.data.share_b_img ) { | |
5050 | + context.drawImage(th.data.share_goods_img, 70 * unit, 245 * unit, 408 * unit, 408 * unit); | |
5055 | 5051 | }; |
5056 | 5052 | |
5057 | 5053 | //---自定义海报 产品质量保证 |
5058 | 5054 | if(th.data.share_b_img && th.data.poster.show_quality==1 ){ |
5059 | 5055 | var g_path = "../../../../images/share/s_gou.png"; |
5060 | - context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit); | |
5056 | + context.drawImage(g_path, 56 * unit, 650 * unit, 22 * unit, 22 * unit); | |
5061 | 5057 | context.setFillStyle("red") |
5062 | 5058 | context.setFontSize(18 * unit) |
5063 | - context.fillText("正品保证", 84 * unit, 690 * unit); | |
5059 | + context.fillText("正品保证", 84 * unit, 670 * unit); | |
5064 | 5060 | |
5065 | - context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit); | |
5061 | + context.drawImage(g_path, 218 * unit, 650 * unit, 22 * unit, 22 * unit); | |
5066 | 5062 | context.setFillStyle("red") |
5067 | 5063 | context.setFontSize(18 * unit) |
5068 | - context.fillText("纯实体店", 246 * unit, 690 * unit); | |
5064 | + context.fillText("纯实体店", 246 * unit, 670 * unit); | |
5069 | 5065 | |
5070 | - context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit); | |
5066 | + context.drawImage(g_path, 388 * unit, 650 * unit, 22 * unit, 22 * unit); | |
5071 | 5067 | context.setFillStyle("red") |
5072 | 5068 | context.setFontSize(18 * unit) |
5073 | - context.fillText("官方验证", 420 * unit, 690 * unit); | |
5069 | + context.fillText("官方验证", 420 * unit, 670 * unit); | |
5074 | 5070 | |
5075 | 5071 | } |
5076 | 5072 | |
5077 | 5073 | //-------大图后面就不一样了----------- |
5078 | 5074 | switch (type) { |
5079 | - case 0: break;//普通商品的展示 | |
5080 | - case 4: | |
5081 | - //中间的几个字 | |
5082 | - if (th.data.poster && parseInt(th.data.poster.style) == 2) { | |
5083 | - if (parseInt(th.data.poster.show_quality)) { | |
5084 | - var g_path = "../../../../images/share/s_gou.png"; | |
5085 | - context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit); | |
5086 | - context.setFillStyle("red") | |
5087 | - context.setFontSize(18 * unit) | |
5088 | - context.fillText("正品保证", 84 * unit, 690 * unit); | |
5089 | - | |
5090 | - context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit); | |
5091 | - context.setFillStyle("red") | |
5092 | - context.setFontSize(18 * unit) | |
5093 | - context.fillText("纯实体店", 246 * unit, 690 * unit); | |
5094 | - | |
5095 | - context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit); | |
5096 | - context.setFillStyle("red") | |
5097 | - context.setFontSize(18 * unit) | |
5098 | - context.fillText("官方验证", 420 * unit, 690 * unit); | |
5099 | - } | |
5100 | - | |
5101 | - } else { | |
5102 | - var g_path = "../../../../images/share/s_gou.png"; | |
5103 | - context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit); | |
5104 | - context.setFillStyle("red") | |
5105 | - context.setFontSize(18 * unit) | |
5106 | - context.fillText("正品保证", 84 * unit, 690 * unit); | |
5107 | - | |
5108 | - context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit); | |
5109 | - context.setFillStyle("red") | |
5110 | - context.setFontSize(18 * unit) | |
5111 | - context.fillText("纯实体店", 246 * unit, 690 * unit); | |
5112 | - | |
5113 | - context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit); | |
5114 | - context.setFillStyle("red") | |
5115 | - context.setFontSize(18 * unit) | |
5116 | - context.fillText("官方验证", 420 * unit, 690 * unit); | |
5117 | - } | |
5118 | - | |
5119 | - | |
5120 | - //---画线--- | |
5121 | - context.setLineWidth(1 * unit) | |
5122 | - context.moveTo(32 * unit, 710 * unit) | |
5123 | - context.lineTo(520 * unit, 710 * unit) | |
5124 | - context.stroke(); | |
5125 | - | |
5126 | - //---文字--- | |
5127 | - context.setFillStyle("black") | |
5128 | - context.setFontSize(22 * unit) | |
5129 | - | |
5130 | - if (type == 0) { | |
5131 | - // 原来start ---> | |
5132 | - context.setFontSize(24 * unit) | |
5133 | - context.fillText(th.data.sto_sele_name_1, 40 * unit, 766 * unit); | |
5134 | - | |
5135 | - context.setFontSize(22 * unit) | |
5136 | - context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 806 * unit); | |
5137 | - context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 846 * unit); | |
5138 | - | |
5139 | - } else { | |
5140 | - context.setFontSize(24 * unit) | |
5141 | - context.fillText(th.data.sto_sele_name_1, 40 * unit, 766 * unit); | |
5142 | - context.setFontSize(22 * unit) | |
5143 | - context.fillText("长按识别二维码", 40 * unit, 806 * unit); | |
5144 | - context.fillText("立即开始兑换", 40 * unit, 846 * unit); | |
5145 | - | |
5146 | - } | |
5147 | - | |
5148 | - //---二维吗图--- | |
5149 | - //-- 自定义海报 -- | |
5150 | - if (th.data.poster) { | |
5151 | - var erm_x = parseFloat(th.data.poster.ewm_x) * 2; | |
5152 | - var erm_y = parseFloat(th.data.poster.ewm_y) * 2; | |
5153 | - context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); | |
5154 | - } else { | |
5155 | - //---二维吗图--- | |
5156 | - context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit); | |
5157 | - }; | |
5158 | - | |
5159 | - break; | |
5160 | - case 1: //秒杀商品的展示 | |
5161 | - //---画线--- | |
5162 | - context.setLineWidth(1 * unit) | |
5163 | - context.moveTo(32 * unit, 670 * unit) | |
5164 | - context.lineTo(520 * unit, 670 * unit) | |
5165 | - context.stroke(); | |
5166 | - | |
5167 | - //画秒杀的图片 | |
5168 | - var miaos_path = '../../../../images/share/miao_share.png'; | |
5169 | - context.drawImage(miaos_path, 43 * unit, 700 * unit, 222 * unit, 40 * unit); | |
5170 | - | |
5171 | - context.setFillStyle("black") | |
5172 | - context.setFontSize(24 * unit) | |
5173 | - context.fillText(th.data.sto_sele_name_1, 40 * unit, 786 * unit); | |
5174 | - //---文字--- | |
5175 | - context.setFontSize(22 * unit) | |
5176 | - context.setFillStyle("black") | |
5177 | - context.fillText("特惠好物,限时秒杀", 40 * unit, 826 * unit); | |
5178 | - context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 866 * unit); | |
5179 | - | |
5180 | - | |
5181 | - //---二维吗图--- | |
5182 | - //-- 自定义海报 -- | |
5183 | - if (th.data.poster) { | |
5184 | - var erm_x = parseFloat(th.data.poster.ewm_x) * 2; | |
5185 | - var erm_y = parseFloat(th.data.poster.ewm_y) * 2; | |
5186 | - context.drawImage(vpath, erm_x * unit, erm_y * unit, 135 * unit, 135 * unit); | |
5187 | - } else { | |
5188 | - //---二维吗图--- | |
5189 | - context.drawImage(vpath, 390 * unit, 726 * unit, 135 * unit, 135 * unit); | |
5190 | - } | |
5191 | - break; | |
5192 | - | |
5193 | - case 2: //会员团和商家团的展示 | |
5194 | - //---画线--- | |
5195 | - context.setLineWidth(1 * unit) | |
5196 | - context.moveTo(32 * unit, 670 * unit) | |
5197 | - context.lineTo(520 * unit, 670 * unit) | |
5198 | - context.stroke(); | |
5199 | - //---文字--- | |
5200 | - context.setFillStyle("black") | |
5201 | - context.setFontSize(24 * unit) | |
5202 | - context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit); | |
5203 | - | |
5204 | - //绘制成团图片 | |
5205 | - var ct_img = "../../../../images/share/ct_num.png"; | |
5206 | - context.drawImage(ct_img, 40 * unit, 740 * unit, 120 * unit, 30 * unit); | |
5207 | - var ct_num = th.data.prom_act.ct_num; | |
5208 | - context.setFontSize(14 * unit) | |
5209 | - context.font = 'normal'; | |
5210 | - context.setFillStyle("red") | |
5211 | - if (ct_num < 10) { | |
5212 | - context.fillText(ct_num + "人拼团", 92 * unit, 760 * unit); | |
5213 | - } else { | |
5214 | - context.fillText(ct_num + "人拼团", 86 * unit, 760 * unit); | |
5215 | - } | |
5216 | - context.setFontSize(22 * unit) | |
5217 | - context.fillText("已拼" + th.data.prom_act.buy_num + "份", 166 * unit, 763 * unit); | |
5218 | - | |
5219 | - context.setFillStyle("gray") | |
5220 | - context.fillText("快来和我一起拼团吧!", 40 * unit, 806 * unit); | |
5221 | - context.setFillStyle("black") | |
5222 | - context.font = 'normal bold 18px sans-serif'; | |
5223 | - context.setFontSize(21.3 * unit) | |
5224 | - context.fillText("长按识别二维码,立即参团", 40 * unit, 836 * unit); | |
5225 | - | |
5226 | - | |
5227 | - //---二维吗图--- | |
5228 | - //-- 自定义海报 -- | |
5229 | - if (th.data.poster) { | |
5230 | - var erm_x = parseFloat(th.data.poster.ewm_x) * 2; | |
5231 | - var erm_y = parseFloat(th.data.poster.ewm_y) * 2; | |
5232 | - context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); | |
5233 | - } else { | |
5234 | - //---二维吗图--- | |
5235 | - context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit); | |
5236 | - } | |
5237 | - break | |
5238 | - case 3: //阶梯团的展示 | |
5239 | - //---画线--- | |
5240 | - context.setLineWidth(1 * unit) | |
5241 | - context.moveTo(32 * unit, 670 * unit) | |
5242 | - context.lineTo(520 * unit, 670 * unit) | |
5243 | - context.stroke(); | |
5244 | - //---文字--- | |
5245 | - context.setFillStyle("black") | |
5246 | - context.setFontSize(24 * unit) | |
5247 | - context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit); | |
5248 | - | |
5249 | - //---绘制中间阶梯的价格--- | |
5250 | - var list = th.data.prom_act.ct_rylist; | |
5251 | - for (var i = 0; i < list.length; i++) { | |
5252 | - var item = list[i]; | |
5253 | - var wi = i * 90 * unit; | |
5254 | - context.font = 'normal'; | |
5255 | - context.setFontSize(16 * unit) | |
5256 | - context.setFillStyle("red") | |
5257 | - context.fillText("¥", 40 * unit + wi, 756 * unit); | |
5258 | - context.setFontSize(22 * unit) | |
5259 | - var pri = parseFloat(item.price).toFixed(2); | |
5260 | - context.fillText(pri, 56 * unit + wi, 756 * unit); | |
5261 | - context.setFillStyle("gray") | |
5262 | - context.fillText("满" + item.rynum + "人", 40 * unit + wi, 786 * unit); | |
5263 | - } | |
5264 | - //----------------下面部分---------------- | |
5265 | - // context.setFillStyle("gray") | |
5266 | - // context.fillText("快来和我一起拼团吧!", 40 * unit, 830 * unit); | |
5267 | - // context.setFillStyle("black") | |
5268 | - // context.font = 'normal bold 18px sans-serif'; | |
5269 | - // context.setFontSize(22 * unit) | |
5270 | - // context.fillText("长按识别二维码,立即参团", 40 * unit, 860 * unit); | |
5271 | - //context.setFillStyle("gray") | |
5272 | - context.setFillStyle("black") | |
5273 | - context.fillText("快来和我一起拼团吧!", 40 * unit, 820 * unit); | |
5274 | - //context.font = 'normal bold 18px sans-serif'; | |
5275 | - context.setFontSize(21 * unit) | |
5276 | - context.fillText("长按识别二维码,立即参团", 40 * unit, 850 * unit); | |
5277 | - | |
5278 | - | |
5279 | - //-- 自定义海报 -- | |
5280 | - if (th.data.poster) { | |
5281 | - var erm_x = parseFloat(th.data.poster.ewm_x) * 2; | |
5282 | - var erm_y = parseFloat(th.data.poster.ewm_y) * 2; | |
5283 | - context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); | |
5284 | - } else { | |
5285 | - //---二维吗图--- | |
5286 | - context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit); | |
5287 | - } | |
5288 | - break; | |
5289 | - | |
5290 | - | |
5291 | 5075 | case 9: |
5292 | 5076 | if(th.data.share_b_img){ |
5293 | 5077 | |
... | ... | @@ -5363,12 +5147,11 @@ Page({ |
5363 | 5147 | |
5364 | 5148 | break; |
5365 | 5149 | |
5366 | - | |
5367 | 5150 | } |
5368 | 5151 | |
5369 | 5152 | |
5370 | 5153 | //--- 如果是自定义海报的时候 --- |
5371 | - if ( th.data.share_b_img || type != 9) { | |
5154 | + if ( th.data.share_b_img ) { | |
5372 | 5155 | |
5373 | 5156 | if (th.data.poster && parseInt(th.data.poster.style) == 2) { |
5374 | 5157 | |
... | ... | @@ -5413,6 +5196,14 @@ Page({ |
5413 | 5196 | }; |
5414 | 5197 | |
5415 | 5198 | |
5199 | + if(th.data.poster.show_time==1){ | |
5200 | + var act_time = ''; | |
5201 | + act_time="截止时间:"+ ut.formatTime(th.data.luckGoInfo.end_time); | |
5202 | + context.setFillStyle("red") | |
5203 | + getApp().draw_Text(context, act_time, 38 * unit, 880 * unit, 200 * unit, 340 * unit, unit); | |
5204 | + } | |
5205 | + | |
5206 | + | |
5416 | 5207 | |
5417 | 5208 | //把画板内容绘制成图片,并回调 画板图片路径 |
5418 | 5209 | context.draw(false, function () { |
... | ... | @@ -5464,35 +5255,6 @@ Page({ |
5464 | 5255 | }); |
5465 | 5256 | }, |
5466 | 5257 | |
5467 | - | |
5468 | - //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 | |
5469 | - draw_Text: function (ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, unit) { | |
5470 | - var lineWidth = 0; | |
5471 | - var lastSubStrIndex = 0; //每次开始截取的字符串的索引 | |
5472 | - var han = 0; | |
5473 | - for (let i = 0; i < str.length; i++) { | |
5474 | - if (han == 2) return; | |
5475 | - //lineWidth += ctx.measureText(str[i]).width; | |
5476 | - lineWidth += ut.measureText(str[i], 21.3 * unit); | |
5477 | - if (lineWidth > canvasWidth) { | |
5478 | - han++; | |
5479 | - | |
5480 | - if (han == 2) | |
5481 | - ctx.fillText(str.substring(lastSubStrIndex, i) + '...', leftWidth, initHeight); //绘制截取部分 | |
5482 | - else | |
5483 | - ctx.fillText(str.substring(lastSubStrIndex, i), leftWidth, initHeight); | |
5484 | - | |
5485 | - initHeight += 22; //22为字体的高度 | |
5486 | - lineWidth = 0; | |
5487 | - lastSubStrIndex = i; | |
5488 | - titleHeight += 20; | |
5489 | - } | |
5490 | - if (i == str.length - 1) { //绘制剩余部分 | |
5491 | - ctx.fillText(str.substring(lastSubStrIndex, i + 1), leftWidth, initHeight); | |
5492 | - } | |
5493 | - } | |
5494 | - }, | |
5495 | - | |
5496 | 5258 | // ----视频图片---- |
5497 | 5259 | // 图片计数器 |
5498 | 5260 | swiperChange: function (e) { | ... | ... |
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml
... | ... | @@ -113,12 +113,22 @@ |
113 | 113 | <!-- <view class="fs50 val">{{filters.toFix(data.shop_price,2)}}</view> --> |
114 | 114 | <view class="fs50 val">{{filters.toFix(luckGoInfo.group_price/100,2)}}</view> |
115 | 115 | </view> |
116 | - <view class="word-line fs20 xc-qtunit-price"> | |
117 | -<!-- 手店价--> | |
118 | - <!-- ¥{{filters.toFix(data.shop_price,2)}} --> | |
119 | - <block wx:if="{{card_field && sele_g[card_field]>0}}"><text class="rmb lh1">{{sele_g[card_field]}}</text></block> | |
120 | - <block wx:else><text class="rmb lh1">{{sele_g.shop_price}}</text></block> | |
116 | + <view class="word-line fs20 xc-qtunit-price" wx:if="{{sys_switch.is_retail_price}}" style="margin-left:0" > | |
117 | + 零售价:<text class="rmb lh1">{{data.market_price}}</text> | |
121 | 118 | </view> |
119 | + | |
120 | + <view class="word-line fs20 xc-qtunit-price" wx:else> | |
121 | + | |
122 | + <!-- 手店价--> | |
123 | + <!-- {{filters.toFix(data.shop_price,2)}} --> | |
124 | + <block wx:if="{{card_field && sele_g[card_field]>0}}"><text class="rmb lh1">{{sele_g[card_field]}}</text></block> | |
125 | + <block wx:else><text class="rmb lh1">{{data.shop_price}}</text></block> | |
126 | + </view> | |
127 | + | |
128 | + | |
129 | + | |
130 | + | |
131 | + | |
122 | 132 | </view> |
123 | 133 | |
124 | 134 | |
... | ... | @@ -1049,8 +1059,6 @@ |
1049 | 1059 | <!-- <nav_box></nav_box> --> |
1050 | 1060 | </block> |
1051 | 1061 | |
1052 | - | |
1053 | - | |
1054 | 1062 | <!-- --弹起来,选择规格数量,普通商品购买和秒杀---- --> |
1055 | 1063 | <view hidden="{{!openSpecModal}}"> |
1056 | 1064 | <view bindtap="closeSpecModal" class="cover-layer"></view> |
... | ... | @@ -1336,40 +1344,7 @@ |
1336 | 1344 | <view class="top-frame"> |
1337 | 1345 | <view class="xc-coupon-frame "> |
1338 | 1346 | |
1339 | - <view class="rel" wx:for="{{quan_list}}" wx:key="{{index}}"> | |
1340 | - <view class="coupon flex"> | |
1341 | - <view class="circle xc-circular-one"></view> | |
1342 | - <view class="xc-coupon-left "> | |
1343 | - <view class="flex ai_c xc-money-frame"> | |
1344 | - <text class="xc-money two-level-word xc-rmb">¥</text> | |
1345 | - <text class="one-level-word xc-money">{{item.money}}</text> | |
1346 | - </view> | |
1347 | - <view class="xc-money four-level-word xc-spacing">满{{item.condition}}元可用</view> | |
1348 | - </view> | |
1349 | - <view class="xc-coupon-right flex"> | |
1350 | - <view class="xc-detail-coupon"> | |
1351 | - <view class="four-level-word">订单金额满{{item.condition}}元可用</view> | |
1352 | - <view class="four-level-word xc-below"> | |
1353 | - {{filters.replace_time2(item.start)}} 至 {{filters.replace_time2(item.end)}} | |
1354 | - </view> | |
1355 | - </view> | |
1356 | - <view class="flex-vertical"> | |
1357 | - <view class="three-level-word xc-get background {{item.everyone_num>0 && item.lqnum>=item.everyone_num?'nouse':''}}" data-ind="{{index}}" data-cid="{{item.id}}" bindtap="get_quan"> | |
1358 | - {{ item.linging==1?'领取中':'领取'}} | |
1359 | - </view> | |
1360 | - </view> | |
1361 | - </view> | |
1362 | - <view class="circle xc-circular-two"></view> | |
1363 | - </view> | |
1364 | - </view> | |
1365 | - </view> | |
1366 | - </view> | |
1367 | - </view> | |
1368 | - <view class="cx-confirm pd20" data-coupon='0' bindtap="switchCoupon"> | |
1369 | - <view class="confirm t-c">关闭</view> | |
1370 | - </view> | |
1371 | - </view> | |
1372 | -</view> --> | |
1347 | + | |
1373 | 1348 | <!-- 选择门店的弹框,1.1版最新的 --> |
1374 | 1349 | <block wx:if="{{store==1}}"> |
1375 | 1350 | <view class="mongolia-layer" bindtap="close_popup"></view> | ... | ... |
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxss
packageC/pages/presell/goodsInfo/goodsInfo.js
... | ... | @@ -2775,6 +2775,8 @@ Page({ |
2775 | 2775 | } |
2776 | 2776 | }, |
2777 | 2777 | |
2778 | + | |
2779 | + | |
2778 | 2780 | //--定义的保存图片方法,分享团--- |
2779 | 2781 | saveImageToPhotosAlbum: function () { |
2780 | 2782 | //--先判断会员状态-- |
... | ... | @@ -2823,7 +2825,7 @@ Page({ |
2823 | 2825 | ///二微码 |
2824 | 2826 | var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + |
2825 | 2827 | os.stoid + "?sceneValue=" + scene + "&pageValue=packageC/pages/presell/goodsInfo/goodsInfo"; |
2826 | - | |
2828 | + | |
2827 | 2829 | |
2828 | 2830 | console.log(path3); |
2829 | 2831 | |
... | ... | @@ -2838,9 +2840,6 @@ Page({ |
2838 | 2840 | //先画背景 |
2839 | 2841 | var pg_path = "../../../../images/share/share_bg.png"; |
2840 | 2842 | |
2841 | - // context.fillStyle="#FFFFFF"; | |
2842 | - // context.fillRect(0,0,554 * unit, 899 * unit); | |
2843 | - | |
2844 | 2843 | //-- 如果有自定义海报的时候,判断背景的图片 -- |
2845 | 2844 | if (th.data.share_b_img) { |
2846 | 2845 | pg_path = th.data.share_b_img; |
... | ... | @@ -2893,11 +2892,11 @@ Page({ |
2893 | 2892 | |
2894 | 2893 | //---产品名称--- |
2895 | 2894 | //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 |
2896 | - if (type != 4) { | |
2895 | + | |
2897 | 2896 | context.setFillStyle("black"); |
2898 | 2897 | context.setFontSize(21.3 * unit) |
2899 | 2898 | th.draw_Text(context, share_title, |
2900 | - 80 * unit, 200 * unit, 200 * unit, 279 * unit, unit); | |
2899 | + 80 * unit, 160 * unit, 200 * unit, 279 * unit, unit); | |
2901 | 2900 | |
2902 | 2901 | //------产品的价格------- |
2903 | 2902 | context.setFontSize(22 * unit) |
... | ... | @@ -2909,15 +2908,16 @@ Page({ |
2909 | 2908 | // pri0 = th.data.prom_act.price; |
2910 | 2909 | pri0 = parseFloat(pri0).toFixed(2); |
2911 | 2910 | var wd1 = th.data.screenWidth - ut.measureText(pri0, 31 * unit) - 25; |
2912 | - context.fillText("¥", wd1 - 15, 185 * unit); | |
2911 | + context.fillText("¥", wd1 - 15, 160 * unit); | |
2913 | 2912 | context.setFontSize(22 * unit) |
2914 | - context.fillText(pri0, wd1, 185 * unit); | |
2913 | + context.fillText(pri0, wd1, 165 * unit); | |
2915 | 2914 | |
2916 | 2915 | //---市场价划掉--- |
2917 | - context.setFillStyle("red") | |
2918 | - context.setFontSize(22 * unit) | |
2919 | - pri0 = "¥" + th.data.data.market_price.toFixed(2); | |
2920 | - var wd2 = th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 25; | |
2916 | + // context.setFillStyle("red") | |
2917 | + // context.setFontSize(22 * unit) | |
2918 | + // pri0 = "¥" + th.data.data.market_price.toFixed(2); | |
2919 | + // var wd2 = th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 25; | |
2920 | + | |
2921 | 2921 | |
2922 | 2922 | if(th.data.presellForm.presell_type==1){ |
2923 | 2923 | // context.setStrokeStyle('gray'); |
... | ... | @@ -2926,75 +2926,62 @@ Page({ |
2926 | 2926 | // context.moveTo(wd2 - 5, 206 * unit); |
2927 | 2927 | // context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit); |
2928 | 2928 | // context.stroke(); |
2929 | - }else{ | |
2930 | - context.fillText('定金', wd2, 213 * unit); | |
2929 | + | |
2930 | + //-- 零售价的优化 -- | |
2931 | + var wp= th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 50; | |
2932 | + var hp= 180 * unit | |
2933 | + th.draw_pos_price(context,wp,hp,th.data.data.market_price,unit); | |
2934 | + | |
2935 | + }else{ | |
2936 | + var wd2 = th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 50; | |
2937 | + context.fillText('定金', wd2, 190 * unit); | |
2931 | 2938 | } |
2932 | 2939 | |
2933 | - | |
2934 | - | |
2935 | - } else { | |
2936 | - context.setFillStyle("black"); | |
2937 | - context.setFontSize(21.3 * unit) | |
2938 | - th.draw_Text(context, share_title, | |
2939 | - 38 * unit, 170 * unit, 20 * unit, 300 * unit, unit); | |
2940 | - //------ 产品的价格 ----- | |
2941 | - var pri0 = th.data.prom_act.addmoney; | |
2942 | - var integral = th.data.prom_act.integral; | |
2943 | - var text = ""; | |
2944 | - if (integral) { text = integral + "积分"; } | |
2945 | - if (pri0 && integral) { text += "+"; } | |
2946 | - if (pri0) { text += "¥" + pri0; } | |
2947 | - | |
2948 | - if (!pri0 && !integral) { text = "0积分"; } | |
2949 | - context.setFillStyle("red"); | |
2950 | - context.fillText(text, 38 * unit, 235 * unit); | |
2951 | 2940 | |
2952 | - } | |
2953 | - | |
2954 | 2941 | //console.log(th.data.share_goods_img); |
2955 | 2942 | //let share_goods_img=th.data.presellForm.share_img; |
2956 | 2943 | //share_goods_img?share_goods_img:th.data.data.share_goods_img; |
2957 | 2944 | //---中间大图--- |
2958 | - context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit); | |
2945 | + context.drawImage(th.data.share_goods_img, 70 * unit, 210 * unit, 408 * unit, 408 * unit); | |
2959 | 2946 | //---自定义海报 产品质量保证 |
2960 | 2947 | if(th.data.poster.show_quality==1 ){ |
2961 | 2948 | var g_path = "/images/share/s_gou.png"; |
2962 | - context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit); | |
2949 | + context.drawImage(g_path, 56 * unit, 630 * unit, 22 * unit, 22 * unit); | |
2963 | 2950 | context.setFillStyle("red") |
2964 | 2951 | context.setFontSize(18 * unit) |
2965 | - context.fillText("正品保证", 84 * unit, 690 * unit); | |
2952 | + context.fillText("正品保证", 84 * unit, 650 * unit); | |
2966 | 2953 | |
2967 | - context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit); | |
2954 | + context.drawImage(g_path, 218 * unit, 630 * unit, 22 * unit, 22 * unit); | |
2968 | 2955 | context.setFillStyle("red") |
2969 | 2956 | context.setFontSize(18 * unit) |
2970 | - context.fillText("纯实体店", 246 * unit, 690 * unit); | |
2957 | + context.fillText("纯实体店", 246 * unit, 650 * unit); | |
2971 | 2958 | |
2972 | - context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit); | |
2959 | + context.drawImage(g_path, 388 * unit, 630 * unit, 22 * unit, 22 * unit); | |
2973 | 2960 | context.setFillStyle("red") |
2974 | 2961 | context.setFontSize(18 * unit) |
2975 | - context.fillText("官方验证", 420 * unit, 690 * unit); | |
2962 | + context.fillText("官方验证", 420 * unit, 650 * unit); | |
2976 | 2963 | |
2977 | 2964 | } |
2978 | 2965 | |
2979 | 2966 | //---画线--- |
2980 | 2967 | context.setLineWidth(1 * unit) |
2981 | - context.moveTo(32 * unit, 665 * unit) | |
2982 | - context.lineTo(520 * unit, 665 * unit) | |
2968 | + context.moveTo(32 * unit, 662 * unit) | |
2969 | + context.lineTo(520 * unit, 662 * unit) | |
2983 | 2970 | context.stroke(); |
2984 | 2971 | |
2985 | 2972 | //---文字--- |
2986 | 2973 | context.setFillStyle("black") |
2987 | 2974 | // context.setFontSize(22 * unit) |
2988 | 2975 | context.setFontSize(24 * unit) |
2989 | - context.fillText(th.data.sto_sele_name_1, 40 * unit, 730 * unit); | |
2976 | + context.fillText(th.data.sto_sele_name_1, 40 * unit, 700 * unit); | |
2990 | 2977 | context.setFillStyle("red") |
2991 | 2978 | context.setFontSize(20 * unit) |
2992 | 2979 | var presell_price = `预售价:${th.data.presellList.presell_price}` |
2993 | - context.fillText(presell_price, 40 * unit, 780 * unit); | |
2980 | + context.fillText(presell_price, 40 * unit, 750 * unit); | |
2994 | 2981 | context.setFillStyle("black") |
2995 | 2982 | context.setFontSize(22 * unit) |
2996 | - context.fillText("特惠好物,限时预售", 40 * unit, 826 * unit); | |
2997 | - context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 866 * unit); | |
2983 | + context.fillText("特惠好物,限时预售", 40 * unit, 800 * unit); | |
2984 | + context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 840 * unit); | |
2998 | 2985 | |
2999 | 2986 | //---二维吗图--- |
3000 | 2987 | //-- 自定义海报 -- |
... | ... | @@ -3007,8 +2994,6 @@ Page({ |
3007 | 2994 | context.drawImage(vpath, 390 * unit, 746 * unit, 130 * unit, 116 * unit); |
3008 | 2995 | } |
3009 | 2996 | |
3010 | - | |
3011 | - | |
3012 | 2997 | //--- 如果是自定义海报的时候 --- |
3013 | 2998 | if (th.data.poster && parseInt(th.data.poster.style) == 2) { |
3014 | 2999 | |
... | ... | @@ -3051,6 +3036,13 @@ Page({ |
3051 | 3036 | } |
3052 | 3037 | |
3053 | 3038 | |
3039 | + if(th.data.poster.show_time==1){ | |
3040 | + var act_time=''; | |
3041 | + act_time="截止时间:"+ ut.formatTime(th.data.presellForm.end_time); | |
3042 | + context.setFillStyle("red") | |
3043 | + getApp().draw_Text(context, act_time,38 * unit, 880 * unit, 200 * unit, 340 * unit, unit); | |
3044 | + } | |
3045 | + | |
3054 | 3046 | //把画板内容绘制成图片,并回调 画板图片路径 |
3055 | 3047 | context.draw(false, function () { |
3056 | 3048 | setTimeout(function () { |
... | ... | @@ -3170,490 +3162,7 @@ Page({ |
3170 | 3162 | // 先画背景 |
3171 | 3163 | var pg_path = "../../../../images/share/share_bg.png"; |
3172 | 3164 | |
3173 | - | |
3174 | - //-- 如果有自定义海报的时候,判断背景的图片 -- | |
3175 | - if (th.data.share_b_img) { | |
3176 | - pg_path = th.data.share_b_img; | |
3177 | - } | |
3178 | - // context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); | |
3179 | - console.log('海报类型-----') | |
3180 | - console.log(type); | |
3181 | - | |
3182 | - if ( !th.data.share_b_img && (type == 0 || type == 1 || type == 2 || type == 3 )){ // 如果是普通商品,绘制新海报 | |
3183 | - th.drawPoster(context, unit, th.data.share_goods_img, vpath, type); | |
3184 | - } else { | |
3185 | - context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); | |
3186 | - // var erm_x = parseFloat(th.data.poster.ewm_x) * 2; | |
3187 | - // var erm_y = parseFloat(th.data.poster.ewm_y) * 2; | |
3188 | - // context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); | |
3189 | - // th.drawPoster(context, unit, th.data.share_goods_img, vpath); | |
3190 | - }; | |
3191 | - | |
3192 | - // th.drawPoster(context, unit, th.data.share_goods_img, vpath); | |
3193 | - | |
3194 | - | |
3195 | - //-- 是自定义海报的情况下 -- | |
3196 | - if (th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) { | |
3197 | - | |
3198 | - if (th.data.poster && parseInt(th.data.poster.style) == 2) { | |
3199 | - //在线上分享人的情况下 | |
3200 | - if (parseInt(th.data.poster.show_headpic)) { | |
3201 | - //获取坐标 | |
3202 | - var x = parseFloat(th.data.poster.head_x) * 2; | |
3203 | - var y = parseFloat(th.data.poster.head_y) * 2; | |
3204 | - var x1 = (x + 90) * unit; | |
3205 | - var y1 = (y + 50) * unit; | |
3206 | - //--昵称--- | |
3207 | - context.setFontSize(24 * unit) | |
3208 | - context.setFillStyle("black") | |
3209 | - context.fillText(app.globalData.userInfo.nickname, x1, y1); | |
3210 | - var width = 24 * app.globalData.userInfo.nickname.length * unit + 4 * unit; | |
3211 | - //强烈推荐 改许程 | |
3212 | - var tj_path = "../../../../images/share/q_tj.png"; | |
3213 | - context.drawImage(tj_path, x1 + width, y1 - 22 * unit, 85 * unit, 30 * unit); | |
3214 | - context.setFontSize(16 * unit); | |
3215 | - context.setLineJoin('round'); //交点设置成圆角 | |
3216 | - context.setFillStyle("white"); | |
3217 | - context.fillText('强烈推荐', x1 + width + 8 * unit, y1 - 1 * unit); | |
3218 | - | |
3219 | - //context.setFillStyle("black") | |
3220 | - //context.setFontSize(24 * unit) | |
3221 | - //context.fillText(getApp().globalData.config.store_name, 40 * unit, 130 * unit); | |
3222 | - } | |
3223 | - } else { | |
3224 | - //--昵称--- | |
3225 | - context.setFontSize(24 * unit); | |
3226 | - context.setFillStyle("black"); | |
3227 | - context.fillText(app.globalData.userInfo.nickname, 152 * unit, 76 * unit); | |
3228 | - var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit; | |
3229 | - //强烈推荐 改许程 | |
3230 | - var tj_path = "../../../../images/share/q_tj.png"; | |
3231 | - context.drawImage(tj_path, 152 * unit + width, 54 * unit, 85 * unit, 30 * unit); | |
3232 | - context.setFontSize(16 * unit); | |
3233 | - context.setLineJoin('round'); //交点设置成圆角 | |
3234 | - context.setFillStyle("white"); | |
3235 | - context.fillText('强烈推荐', 149 * unit + width + 15 * unit, 75 * unit); | |
3236 | - } | |
3237 | - | |
3238 | - }; | |
3239 | - | |
3240 | - | |
3241 | - var share_title = th.data.data.goods_name; | |
3242 | - if (th.data.prom_type == 1 || th.data.prom_type == 2 || th.data.prom_type == 6 || th.data.prom_type == 4) { | |
3243 | - share_title = th.data.prom_act.share_title; | |
3244 | - if (!share_title) share_title = th.data.prom_act.title; | |
3245 | - if (th.data.prom_type == 4) share_title = th.data.prom_act.name; | |
3246 | - } | |
3247 | - | |
3248 | - //---产品名称--- | |
3249 | - //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 | |
3250 | - if (th.data.share_b_img || (type != 4 && type != 0 && type != 1 && type != 2 && type != 3)) { | |
3251 | - context.setFillStyle("black"); | |
3252 | - context.setFontSize(21.3 * unit) | |
3253 | - getApp().draw_Text(context, share_title, | |
3254 | - 38 * unit, 180 * unit, 200 * unit, 279 * unit, unit); | |
3255 | - | |
3256 | - //------产品的价格------- | |
3257 | - context.setFontSize(23 * unit) | |
3258 | - context.setFillStyle("red") | |
3259 | - | |
3260 | - var pri0 = th.data.data.shop_price; | |
3261 | - if (th.data.card_field && th.data.data[th.data.card_field]) { | |
3262 | - pri0 = th.data.data[th.data.card_field]; | |
3263 | - } | |
3264 | - | |
3265 | - if (th.data.prom_act) | |
3266 | - pri0 = th.data.prom_price; | |
3267 | - pri0 = parseFloat(pri0).toFixed(2); | |
3268 | - var wd1 = th.data.screenWidth - ut.measureText(pri0, 31 * unit) - 25; | |
3269 | - context.fillText("¥", wd1 - 15, 185 * unit); | |
3270 | - context.setFontSize(31 * unit) | |
3271 | - context.fillText(pri0, wd1, 185 * unit); | |
3272 | - | |
3273 | - //---市场价划掉--- | |
3274 | - /*-- | |
3275 | - context.setFillStyle("gray") | |
3276 | - context.setFontSize(22 * unit) | |
3277 | - pri0 = "¥" + th.data.data.market_price.toFixed(2); | |
3278 | - var wd2 = th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 25; | |
3279 | - context.fillText(pri0, wd2, 213 * unit); | |
3280 | - | |
3281 | - context.setStrokeStyle('gray'); | |
3282 | - context.setLineWidth(1 * unit); | |
3283 | - context.moveTo(wd2 - 5, 206 * unit); | |
3284 | - context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit); | |
3285 | - context.stroke();--*/ | |
3286 | - | |
3287 | - } else if ( ( type == 4 && type != 0 && type != 1 && type != 2 && type != 3)) { | |
3288 | - context.setFillStyle("black"); | |
3289 | - context.setFontSize(21.3 * unit) | |
3290 | - getApp().draw_Text(context, share_title, | |
3291 | - 38 * unit, 170 * unit, 20 * unit, 300 * unit, unit); | |
3292 | - //------ 产品的价格 ----- | |
3293 | - var pri0 = th.data.prom_act.addmoney; | |
3294 | - var integral = th.data.prom_act.integral; | |
3295 | - var text = ""; | |
3296 | - if (integral) { | |
3297 | - text = integral + "积分"; | |
3298 | - } | |
3299 | - if (pri0 && integral) { | |
3300 | - text += "+"; | |
3301 | - } | |
3302 | - if (pri0) { | |
3303 | - text += "¥" + pri0; | |
3304 | - } | |
3305 | - | |
3306 | - if (!pri0 && !integral) { | |
3307 | - text = "0积分"; | |
3308 | - } | |
3309 | - context.setFillStyle("red"); | |
3310 | - context.fillText(text, 38 * unit, 235 * unit); | |
3311 | - | |
3312 | - } | |
3313 | - | |
3314 | - //---中间大图--- | |
3315 | - if ( th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) { | |
3316 | - context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit); | |
3317 | - } | |
3318 | - ; | |
3319 | - | |
3320 | - //---自定义海报 产品质量保证 | |
3321 | - if(th.data.share_b_img && th.data.poster.show_quality==1 ){ | |
3322 | - var g_path = "../../../../images/share/s_gou.png"; | |
3323 | - context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit); | |
3324 | - context.setFillStyle("red") | |
3325 | - context.setFontSize(18 * unit) | |
3326 | - context.fillText("正品保证", 84 * unit, 690 * unit); | |
3327 | - | |
3328 | - context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit); | |
3329 | - context.setFillStyle("red") | |
3330 | - context.setFontSize(18 * unit) | |
3331 | - context.fillText("纯实体店", 246 * unit, 690 * unit); | |
3332 | - | |
3333 | - context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit); | |
3334 | - context.setFillStyle("red") | |
3335 | - context.setFontSize(18 * unit) | |
3336 | - context.fillText("官方验证", 420 * unit, 690 * unit); | |
3337 | - | |
3338 | - } | |
3339 | - //-------大图后面就不一样了----------- | |
3340 | - switch (type) { | |
3341 | - case 0: | |
3342 | - if(!th.data.share_b_img){ | |
3343 | - break | |
3344 | - } | |
3345 | - //---画线--- | |
3346 | - context.setLineWidth(1 * unit) | |
3347 | - context.moveTo(32 * unit, 710 * unit) | |
3348 | - context.lineTo(520 * unit, 710 * unit) | |
3349 | - context.stroke(); | |
3350 | - //---文字--- | |
3351 | - context.setFillStyle("black") | |
3352 | - context.setFontSize(22 * unit) | |
3353 | - // 原来start ---> | |
3354 | - context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 776 * unit); | |
3355 | - context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 826 * unit); | |
3356 | - // <--- 原来end | |
3357 | - // context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 816 * unit); | |
3358 | - // context.setFontSize(18 * unit) | |
3359 | - // context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 850 * unit); | |
3360 | - //---二维吗图--- | |
3361 | - context.drawImage(vpath, 380 * unit, 736 * unit, 120 * unit, 120 * unit); | |
3362 | - break;//普通商品的展示 | |
3363 | - case 4: | |
3364 | - // 中间的几个字 | |
3365 | - if (th.data.poster && parseInt(th.data.poster.style) == 2) { | |
3366 | - if (parseInt(th.data.poster.show_quality)) { | |
3367 | - var g_path = "../../../../images/share/s_gou.png"; | |
3368 | - context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit); | |
3369 | - context.setFillStyle("red") | |
3370 | - context.setFontSize(18 * unit) | |
3371 | - context.fillText("正品保证", 84 * unit, 690 * unit); | |
3372 | - | |
3373 | - context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit); | |
3374 | - context.setFillStyle("red") | |
3375 | - context.setFontSize(18 * unit) | |
3376 | - context.fillText("纯实体店", 246 * unit, 690 * unit); | |
3377 | - | |
3378 | - context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit); | |
3379 | - context.setFillStyle("red") | |
3380 | - context.setFontSize(18 * unit) | |
3381 | - context.fillText("官方验证", 420 * unit, 690 * unit); | |
3382 | - } | |
3383 | - | |
3384 | - } else { | |
3385 | - var g_path = "../../../../images/share/s_gou.png"; | |
3386 | - context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit); | |
3387 | - context.setFillStyle("red") | |
3388 | - context.setFontSize(18 * unit) | |
3389 | - context.fillText("正品保证", 84 * unit, 690 * unit); | |
3390 | - | |
3391 | - context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit); | |
3392 | - context.setFillStyle("red") | |
3393 | - context.setFontSize(18 * unit) | |
3394 | - context.fillText("纯实体店", 246 * unit, 690 * unit); | |
3395 | - | |
3396 | - context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit); | |
3397 | - context.setFillStyle("red") | |
3398 | - context.setFontSize(18 * unit) | |
3399 | - context.fillText("官方验证", 420 * unit, 690 * unit); | |
3400 | - } | |
3401 | - | |
3402 | - | |
3403 | - //---画线--- | |
3404 | - context.setLineWidth(1 * unit) | |
3405 | - context.moveTo(32 * unit, 710 * unit) | |
3406 | - context.lineTo(520 * unit, 710 * unit) | |
3407 | - context.stroke(); | |
3408 | - | |
3409 | - //---文字--- | |
3410 | - context.setFillStyle("black") | |
3411 | - context.setFontSize(22 * unit) | |
3412 | - | |
3413 | - if (type == 0 || type == -1) { | |
3414 | - // 原来start ---> | |
3415 | - context.setFontSize(24 * unit) | |
3416 | - context.fillText(th.data.sto_sele_name_1, 40 * unit, 766 * unit); | |
3417 | - | |
3418 | - context.setFontSize(22 * unit) | |
3419 | - context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 806 * unit); | |
3420 | - context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 846 * unit); | |
3421 | - | |
3422 | - } else { | |
3423 | - context.setFontSize(24 * unit) | |
3424 | - context.fillText(th.data.sto_sele_name_1, 40 * unit, 766 * unit); | |
3425 | - context.setFontSize(22 * unit) | |
3426 | - context.fillText("长按识别二维码", 40 * unit, 806 * unit); | |
3427 | - context.fillText("立即开始兑换", 40 * unit, 846 * unit); | |
3428 | - | |
3429 | - } | |
3430 | - | |
3431 | - //---二维吗图--- | |
3432 | - //-- 自定义海报 -- | |
3433 | - if (th.data.share_b_img || th.data.poster) { | |
3434 | - var erm_x = parseFloat(th.data.poster.ewm_x) * 2; | |
3435 | - var erm_y = parseFloat(th.data.poster.ewm_y) * 2; | |
3436 | - context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); | |
3437 | - } else { | |
3438 | - //---二维吗图--- | |
3439 | - context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit); | |
3440 | - } | |
3441 | - ; | |
3442 | - | |
3443 | - break; | |
3444 | - case 1: //秒杀商品的展示 | |
3445 | - if(!th.data.share_b_img){ | |
3446 | - break | |
3447 | - } | |
3448 | - //---画线--- | |
3449 | - context.setLineWidth(1 * unit) | |
3450 | - context.moveTo(32 * unit, 670 * unit) | |
3451 | - context.lineTo(520 * unit, 670 * unit) | |
3452 | - context.stroke(); | |
3453 | - | |
3454 | - //画秒杀的图片 | |
3455 | - var miaos_path = '../../../../images/share/miao_share.png'; | |
3456 | - context.drawImage(miaos_path, 43 * unit, 700 * unit, 222 * unit, 40 * unit); | |
3457 | - | |
3458 | - context.setFillStyle("black") | |
3459 | - context.setFontSize(24 * unit) | |
3460 | - context.fillText(th.data.sto_sele_name_1, 40 * unit, 786 * unit); | |
3461 | - //---文字--- | |
3462 | - context.setFontSize(22 * unit) | |
3463 | - context.setFillStyle("black") | |
3464 | - context.fillText("特惠好物,限时秒杀", 40 * unit, 826 * unit); | |
3465 | - context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 866 * unit); | |
3466 | - | |
3467 | - | |
3468 | - //---二维吗图--- | |
3469 | - //-- 自定义海报 -- | |
3470 | - if (th.data.share_b_img || th.data.poster) { | |
3471 | - var erm_x = parseFloat(th.data.poster.ewm_x) * 2; | |
3472 | - var erm_y = parseFloat(th.data.poster.ewm_y) * 2; | |
3473 | - context.drawImage(vpath, erm_x * unit, erm_y * unit, 135 * unit, 135 * unit); | |
3474 | - } else { | |
3475 | - //---二维吗图--- | |
3476 | - context.drawImage(vpath, 390 * unit, 726 * unit, 135 * unit, 135 * unit); | |
3477 | - } | |
3478 | - break; | |
3479 | - | |
3480 | - case 2: //会员团和商家团的展示 | |
3481 | - if(!th.data.share_b_img){ | |
3482 | - break | |
3483 | - } | |
3484 | - //---画线--- | |
3485 | - context.setLineWidth(1 * unit) | |
3486 | - context.moveTo(32 * unit, 670 * unit) | |
3487 | - context.lineTo(520 * unit, 670 * unit) | |
3488 | - context.stroke(); | |
3489 | - //---文字--- | |
3490 | - context.setFillStyle("black") | |
3491 | - context.setFontSize(24 * unit) | |
3492 | - context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit); | |
3493 | - | |
3494 | - //绘制成团图片 | |
3495 | - var ct_img = "../../../../images/share/ct_num.png"; | |
3496 | - context.drawImage(ct_img, 40 * unit, 740 * unit, 120 * unit, 30 * unit); | |
3497 | - var ct_num = th.data.prom_act.ct_num; | |
3498 | - context.setFontSize(14 * unit) | |
3499 | - context.font = 'normal'; | |
3500 | - context.setFillStyle("red") | |
3501 | - if (ct_num < 10) { | |
3502 | - context.fillText(ct_num + "人拼团", 92 * unit, 760 * unit); | |
3503 | - } else { | |
3504 | - context.fillText(ct_num + "人拼团", 86 * unit, 760 * unit); | |
3505 | - } | |
3506 | - context.setFontSize(22 * unit) | |
3507 | - context.fillText("已拼" + th.data.prom_act.buy_num + "份", 166 * unit, 763 * unit); | |
3508 | - | |
3509 | - context.setFillStyle("gray") | |
3510 | - context.fillText("快来和我一起拼团吧!", 40 * unit, 806 * unit); | |
3511 | - context.setFillStyle("black") | |
3512 | - context.font = 'normal bold 18px sans-serif'; | |
3513 | - context.setFontSize(21.3 * unit) | |
3514 | - context.fillText("长按识别二维码,立即参团", 40 * unit, 836 * unit); | |
3515 | - | |
3516 | - | |
3517 | - //---二维吗图--- | |
3518 | - //-- 自定义海报 -- | |
3519 | - if (th.data.share_b_img || th.data.poster) { | |
3520 | - var erm_x = parseFloat(th.data.poster.ewm_x) * 2; | |
3521 | - var erm_y = parseFloat(th.data.poster.ewm_y) * 2; | |
3522 | - context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); | |
3523 | - } else { | |
3524 | - //---二维吗图--- | |
3525 | - context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit); | |
3526 | - } | |
3527 | - break | |
3528 | - case 3: //阶梯团的展示 | |
3529 | - if(!th.data.share_b_img){ | |
3530 | - break | |
3531 | - } | |
3532 | - //---画线--- | |
3533 | - context.setLineWidth(1 * unit) | |
3534 | - context.moveTo(32 * unit, 670 * unit) | |
3535 | - context.lineTo(520 * unit, 670 * unit) | |
3536 | - context.stroke(); | |
3537 | - //---文字--- | |
3538 | - context.setFillStyle("black") | |
3539 | - context.setFontSize(24 * unit) | |
3540 | - context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit); | |
3541 | - | |
3542 | - //---绘制中间阶梯的价格--- | |
3543 | - var list = th.data.prom_act.ct_rylist; | |
3544 | - for (var i = 0; i < list.length; i++) { | |
3545 | - var item = list[i]; | |
3546 | - var wi = i * 90 * unit; | |
3547 | - context.font = 'normal'; | |
3548 | - context.setFontSize(16 * unit) | |
3549 | - context.setFillStyle("red") | |
3550 | - context.fillText("¥", 40 * unit + wi, 756 * unit); | |
3551 | - context.setFontSize(22 * unit) | |
3552 | - var pri = parseFloat(item.price).toFixed(2); | |
3553 | - context.fillText(pri, 56 * unit + wi, 756 * unit); | |
3554 | - context.setFillStyle("gray") | |
3555 | - context.fillText("满" + item.rynum + "人", 40 * unit + wi, 786 * unit); | |
3556 | - } | |
3557 | - //----------------下面部分---------------- | |
3558 | - | |
3559 | - context.setFillStyle("black") | |
3560 | - context.fillText("快来和我一起拼团吧!", 40 * unit, 820 * unit); | |
3561 | - //context.font = 'normal bold 18px sans-serif'; | |
3562 | - context.setFontSize(21 * unit) | |
3563 | - context.fillText("长按识别二维码,立即参团", 40 * unit, 850 * unit); | |
3564 | - | |
3565 | - | |
3566 | - //-- 自定义海报 -- | |
3567 | - if (th.data.share_b_img || th.data.poster) { | |
3568 | - var erm_x = parseFloat(th.data.poster.ewm_x) * 2; | |
3569 | - var erm_y = parseFloat(th.data.poster.ewm_y) * 2; | |
3570 | - context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); | |
3571 | - } else { | |
3572 | - //---二维吗图--- | |
3573 | - context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit); | |
3574 | - } | |
3575 | - break | |
3576 | - | |
3577 | - | |
3578 | - case -1: //秒杀商品的展示 | |
3579 | - //---画线--- | |
3580 | - context.setLineWidth(1 * unit) | |
3581 | - context.moveTo(32 * unit, 670 * unit) | |
3582 | - context.lineTo(520 * unit, 670 * unit) | |
3583 | - context.stroke(); | |
3584 | - | |
3585 | - | |
3586 | - context.setFillStyle("black") | |
3587 | - context.setFontSize(24 * unit) | |
3588 | - context.fillText(th.data.sto_sele_name_1, 40 * unit, 744 * unit); | |
3589 | - //---文字--- | |
3590 | - context.setFontSize(22 * unit) | |
3591 | - context.setFillStyle("black") | |
3592 | - context.fillText("长按识别二维码", 40 * unit, 800 * unit); | |
3593 | - context.fillText("立即开始抢购", 40 * unit, 846 * unit); | |
3594 | - | |
3595 | - | |
3596 | - //---二维吗图--- | |
3597 | - //-- 自定义海报 -- | |
3598 | - if (th.data.share_b_img || th.data.poster) { | |
3599 | - var erm_x = parseFloat(th.data.poster.ewm_x) * 2; | |
3600 | - var erm_y = parseFloat(th.data.poster.ewm_y) * 2; | |
3601 | - context.drawImage(vpath, erm_x * unit, erm_y * unit, 135 * unit, 135 * unit); | |
3602 | - } else { | |
3603 | - //---二维吗图--- | |
3604 | - context.drawImage(vpath, 390 * unit, 726 * unit, 135 * unit, 135 * unit); | |
3605 | - } | |
3606 | - break; | |
3607 | - | |
3608 | - | |
3609 | - } | |
3610 | - | |
3611 | - | |
3612 | - //--- 如果是自定义海报的时候 --- | |
3613 | - if ( th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) { | |
3614 | - | |
3615 | - if (th.data.poster && parseInt(th.data.poster.style) == 2) { | |
3616 | - | |
3617 | - //如果显示会员信息的话 | |
3618 | - if (parseInt(th.data.poster.show_headpic)) { | |
3619 | - //获取坐标 | |
3620 | - var x = parseFloat(th.data.poster.head_x) * 2; | |
3621 | - var y = parseFloat(th.data.poster.head_y) * 2; | |
3622 | - //---绘制圆形要放在最后---- | |
3623 | - context.save(); | |
3624 | - context.beginPath(); | |
3625 | - var h_x = x * unit; | |
3626 | - var h_y = y * unit; | |
3627 | - var h_r = 40 * unit; | |
3628 | - var cx = h_x + h_r; | |
3629 | - var cy = h_y + h_r; | |
3630 | - context.arc(cx, cy, h_r, 0, Math.PI * 2, false); | |
3631 | - context.closePath(); | |
3632 | - context.fill(); | |
3633 | - context.clip(); | |
3634 | - context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2); | |
3635 | - context.restore(); | |
3636 | - } | |
3637 | - | |
3638 | - } else { | |
3639 | - //---绘制圆形要放在最后---- | |
3640 | - context.save(); | |
3641 | - context.beginPath(); | |
3642 | - var h_x = 60 * unit; | |
3643 | - var h_y = 24 * unit; | |
3644 | - var h_r = 40 * unit; | |
3645 | - var cx = h_x + h_r; | |
3646 | - var cy = h_y + h_r; | |
3647 | - context.arc(cx, cy, h_r, 0, Math.PI * 2, false); | |
3648 | - context.closePath(); | |
3649 | - context.fill(); | |
3650 | - context.clip(); | |
3651 | - context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2); | |
3652 | - context.restore(); | |
3653 | - } | |
3654 | - | |
3655 | - } | |
3656 | - ; | |
3165 | + th.drawPoster(context, unit, th.data.share_goods_img, vpath, type); | |
3657 | 3166 | |
3658 | 3167 | |
3659 | 3168 | //把画板内容绘制成图片,并回调 画板图片路径 |
... | ... | @@ -3729,144 +3238,126 @@ Page({ |
3729 | 3238 | } |
3730 | 3239 | } |
3731 | 3240 | }, |
3241 | + | |
3732 | 3242 | drawPoster(context, unit, img, vpath, type) { |
3733 | - // 1.灰色背景 | |
3734 | - context.setFillStyle('#f2f1f6'); | |
3735 | - context.rect(0, 0, 554 * unit, 899 * unit); | |
3736 | - context.fill(); | |
3737 | - | |
3738 | - // 2.商城名称 | |
3739 | - let shopName = this.data.sto_sele_name_1; | |
3740 | - context.setTextAlign('center'); | |
3741 | - context.setFontSize(26 * unit); | |
3742 | - context.setFillStyle('black'); | |
3743 | - context.fillText(shopName, 277 * unit, 60 * unit); | |
3744 | - | |
3745 | - // 3.推荐来源 | |
3746 | - let fromText = `来自${getApp().globalData.userInfo.nickname}的推荐`; | |
3747 | - context.setTextAlign('center'); | |
3748 | - context.setFontSize(22 * unit); | |
3749 | - context.setFillStyle('#96959a'); | |
3750 | - context.fillText(fromText, 277 * unit, 105 * unit); | |
3751 | - | |
3752 | - // 4.海报背景 | |
3753 | - context.setFillStyle('white'); | |
3754 | - context.fillRect(37 * unit, 157 * unit, 480 * unit, 673 * unit); | |
3755 | - | |
3756 | - // 5.商品图片 | |
3757 | - // 图片的x坐标 | |
3758 | - let bg_x = 37 * unit | |
3759 | - // 图片的y坐标 | |
3760 | - let bg_y = 157 * unit | |
3761 | - // 图片宽度 | |
3762 | - let bg_w = 480 * unit | |
3763 | - // 图片高度 | |
3764 | - let bg_h = 474 * unit | |
3765 | - // 图片圆角 | |
3766 | - let bg_r = 4 | |
3767 | - // 绘制海报背景图片圆角 | |
3768 | - context.save() | |
3769 | - context.beginPath() | |
3770 | - context.arc(bg_x + bg_r, bg_y + bg_r, bg_r, Math.PI, Math.PI * 1.5) | |
3771 | - context.arc(bg_x + bg_w - bg_r, bg_y + bg_r, bg_r, Math.PI * 1.5, Math.PI * 2) | |
3772 | - context.arc(bg_x + bg_w, bg_y + bg_h, bg_r, 0, Math.PI * 0.5) | |
3773 | - context.arc(bg_x, bg_y + bg_h, 0, Math.PI * 0.5, Math.PI) | |
3774 | - context.clip() | |
3775 | - context.drawImage(img, bg_x, bg_y, bg_w, bg_h); | |
3776 | - context.restore(); | |
3777 | - | |
3778 | - // 6.强烈推荐 | |
3779 | - let src = ''; | |
3780 | - context.beginPath(); | |
3781 | - if(type == 0) { // 普通 | |
3782 | - src = '../../../../images/share/q_tj.png'; | |
3783 | - context.drawImage(src, 54 * unit, 648 * unit, 85 * unit, 30 * unit); | |
3784 | - context.setFontSize(16 * unit) | |
3785 | - context.setFillStyle("white") | |
3786 | - context.setTextAlign('left'); | |
3787 | - context.fillText('强烈推荐', 64 * unit, 668 * unit); | |
3788 | - }; | |
3789 | - if(type == 1) { // 秒杀 | |
3790 | - src = '../../../images/share/miao_share.png'; | |
3791 | - context.drawImage(src, 54 * unit, 648 * unit, 200 * unit, 36 * unit); | |
3792 | - context.setTextAlign('left'); | |
3793 | - }; | |
3794 | - if(type == 2) { // 商家和会员团 | |
3795 | - src = '../../../images/share/ct_num.png'; | |
3796 | - context.drawImage(src, 54 * unit, 648 * unit, 120 * unit, 30 * unit); | |
3797 | - context.setTextAlign('left'); | |
3798 | - | |
3799 | - let ct_num = self.data.prom_act.ct_num; | |
3800 | - context.setFontSize(16 * unit) | |
3801 | - context.font = 'normal'; | |
3802 | - context.setFillStyle("red") | |
3803 | - if (ct_num < 10) { | |
3804 | - context.fillText(ct_num + "人拼团", 100 * unit, 670 * unit); | |
3805 | - } else { | |
3806 | - context.fillText(ct_num + "人拼团", 96 * unit, 670 * unit); | |
3807 | - } | |
3808 | - context.setFontSize(22 * unit) | |
3809 | - context.fillText("已拼" + self.data.prom_act.buy_num + "份", 186 * unit, 672 * unit); | |
3810 | - }; | |
3811 | - if(type == 3) { // 阶梯团 | |
3812 | - let list = self.data.prom_act.ct_rylist; | |
3813 | - for (let i = 0; i < list.length; i++) { | |
3814 | - let item = list[i]; | |
3815 | - let wi = i * 90 * unit; | |
3816 | - context.font = 'normal'; | |
3817 | - context.setTextAlign('left'); | |
3818 | - context.setFontSize(16 * unit) | |
3819 | - context.setFillStyle("red") | |
3820 | - context.fillText("¥", 50 * unit + wi, 680 * unit); | |
3821 | - context.setFontSize(22 * unit) | |
3822 | - let pri = parseFloat(item.price).toFixed(2); | |
3823 | - context.fillText(pri, 66 * unit + wi, 680 * unit); | |
3824 | - context.setFillStyle("gray") | |
3825 | - context.fillText("满" + item.rynum + "人", 50 * unit + wi, 716 * unit); | |
3826 | - } | |
3827 | - }; | |
3828 | - | |
3829 | - // 7.商品价格 | |
3830 | - if(type != 3) { | |
3831 | - let price = this.data.data.shop_price; | |
3832 | - if (this.data.card_field && this.data.data[this.data.card_field]) { | |
3833 | - price = this.data.data[this.data.card_field]; | |
3834 | - } | |
3835 | - if (this.data.prom_act) price = this.data.prom_price; | |
3836 | - price = parseFloat(price).toFixed(2); | |
3837 | - context.setFontSize(32 * unit); | |
3838 | - context.setFillStyle('#DE1117'); | |
3839 | - if (this.data.prom_type == 4 && this.data.prom_integral){ | |
3840 | - context.fillText(this.data.prom_integral+'积分+¥' + price, 54 * unit, 735 * unit); | |
3841 | - }else{ | |
3842 | - if(this.data.prom_type ==8){ | |
3843 | - price = this.data.presellList.presell_price | |
3844 | - context.fillText('¥' + price, 54 * unit, 735 * unit); | |
3845 | - }else{ | |
3846 | - context.fillText('¥' + price, 54 * unit, 735 * unit); | |
3847 | - } | |
3848 | - } | |
3849 | - | |
3243 | + // 1.灰色背景 | |
3244 | + context.setFillStyle('#f2f1f6'); | |
3245 | + context.rect(0, 0, 554 * unit, 899 * unit); | |
3246 | + context.fill(); | |
3247 | + | |
3248 | + // 2.商城名称 | |
3249 | + let shopName = this.data.sto_sele_name_1; | |
3250 | + context.setTextAlign('center'); | |
3251 | + context.setFontSize(26 * unit); | |
3252 | + context.setFillStyle('black'); | |
3253 | + context.fillText(shopName, 277 * unit, 60 * unit); | |
3254 | + | |
3255 | + // 3.推荐来源 | |
3256 | + let fromText = `来自${getApp().globalData.userInfo.nickname}的推荐`; | |
3257 | + context.setTextAlign('center'); | |
3258 | + context.setFontSize(22 * unit); | |
3259 | + context.setFillStyle('#96959a'); | |
3260 | + context.fillText(fromText, 277 * unit, 105 * unit); | |
3261 | + | |
3262 | + // 4.海报背景 | |
3263 | + context.setFillStyle('white'); | |
3264 | + context.fillRect(37 * unit, 157 * unit, 480 * unit, 673 * unit); | |
3265 | + | |
3266 | + // 5.商品图片 | |
3267 | + // 图片的x坐标 | |
3268 | + let bg_x = 37 * unit | |
3269 | + // 图片的y坐标 | |
3270 | + let bg_y = 157 * unit | |
3271 | + // 图片宽度 | |
3272 | + let bg_w = 480 * unit | |
3273 | + // 图片高度 | |
3274 | + let bg_h = 474 * unit | |
3275 | + // 图片圆角 | |
3276 | + let bg_r = 4 | |
3277 | + // 绘制海报背景图片圆角 | |
3278 | + context.save() | |
3279 | + context.beginPath() | |
3280 | + context.arc(bg_x + bg_r, bg_y + bg_r, bg_r, Math.PI, Math.PI * 1.5) | |
3281 | + context.arc(bg_x + bg_w - bg_r, bg_y + bg_r, bg_r, Math.PI * 1.5, Math.PI * 2) | |
3282 | + context.arc(bg_x + bg_w, bg_y + bg_h, bg_r, 0, Math.PI * 0.5) | |
3283 | + context.arc(bg_x, bg_y + bg_h, 0, Math.PI * 0.5, Math.PI) | |
3284 | + context.clip() | |
3285 | + context.drawImage(img, bg_x, bg_y, bg_w, bg_h); | |
3286 | + context.restore(); | |
3287 | + | |
3288 | + // 6.强烈推荐 | |
3289 | + let src = ''; | |
3290 | + context.beginPath(); | |
3291 | + if (type == 0) { // 普通 | |
3292 | + src = '../../../../images/share/q_tj.png'; | |
3293 | + context.drawImage(src, 54 * unit, 648 * unit, 85 * unit, 30 * unit); | |
3294 | + context.setFontSize(16 * unit) | |
3295 | + context.setFillStyle("white") | |
3296 | + context.setTextAlign('left'); | |
3297 | + context.fillText('强烈推荐', 64 * unit, 668 * unit); | |
3298 | + } | |
3299 | + | |
3300 | + | |
3301 | + // 7.商品价格 | |
3302 | + let price = this.data.data.shop_price; | |
3303 | + if (this.data.card_field && this.data.data[this.data.card_field]) { | |
3304 | + price = this.data.data[this.data.card_field]; | |
3305 | + } | |
3306 | + if (this.data.prom_act) price = this.data.prom_price; | |
3307 | + price = parseFloat(price).toFixed(2); | |
3308 | + context.setFontSize(32 * unit); | |
3309 | + context.setFillStyle('#DE1117'); | |
3310 | + | |
3311 | + price = this.data.presellList.presell_price | |
3312 | + context.fillText('¥' + price, 54 * unit, 735 * unit); | |
3313 | + | |
3314 | + | |
3315 | + //-- 零售价的优化 -- | |
3316 | + var wp= 62 * unit+ut.measureText('¥' + price, 32 * unit); | |
3317 | + var hp=735 * unit | |
3318 | + this.draw_pos_price(context,wp,hp,this.data.data.market_price,unit); | |
3319 | + | |
3320 | + | |
3321 | + // 8.商品标题 | |
3322 | + context.setFontSize(20 * unit); | |
3323 | + context.setFillStyle('#898989'); | |
3324 | + getApp().draw_Text(context, this.data.data.goods_name, 54 * unit, 800 * unit, 240 * unit, 280 * unit, unit, 1); | |
3325 | + | |
3326 | + // 9.小程序码 | |
3327 | + context.drawImage(vpath, 375 * unit, 660 * unit, 120 * unit, 120 * unit); | |
3328 | + context.setFontSize(16 * unit); | |
3329 | + context.setFillStyle('#777'); | |
3330 | + context.fillText('长按识别二维码', 378 * unit, 810 * unit); | |
3331 | + | |
3332 | + // 10.竖线 | |
3333 | + context.beginPath(); | |
3334 | + context.setFillStyle('#eee'); | |
3335 | + context.rect(354 * unit, 670 * unit, 1 * unit, 130 * unit); | |
3336 | + context.fill(); | |
3337 | + }, | |
3338 | + | |
3339 | + | |
3340 | + //---市场价划掉--- | |
3341 | + draw_pos_price(context,w,h,market_price,unit){ | |
3342 | + | |
3343 | + if(!this.data.sys_switch) return false; | |
3344 | + if(!this.data.sys_switch.is_retail_price) return false; | |
3345 | + | |
3346 | + context.setFillStyle("gray") | |
3347 | + context.setFontSize(22 * unit) | |
3348 | + var pri0 = "¥" + market_price.toFixed(2); | |
3349 | + context.fillText(pri0, w, h); | |
3350 | + | |
3351 | + var c_h=h-6; | |
3352 | + context.setStrokeStyle('gray'); | |
3353 | + context.setLineWidth(1 * unit); | |
3354 | + context.moveTo(w - 5, c_h); | |
3355 | + context.lineTo(w + ut.measureText(pri0, 22 * unit) + 5, c_h); | |
3356 | + context.stroke(); | |
3850 | 3357 | |
3851 | - }; | |
3852 | - | |
3853 | - // 8.商品标题 | |
3854 | - context.setFontSize(20 * unit); | |
3855 | - context.setFillStyle('#898989'); | |
3856 | - getApp().draw_Text(context, this.data.data.goods_name, 54 * unit, 800 * unit, 240 * unit, 280 * unit, unit, 1); | |
3857 | - | |
3858 | - // 9.小程序码 | |
3859 | - context.drawImage(vpath, 375 * unit, 660 * unit, 120 * unit, 120 * unit); | |
3860 | - context.setFontSize(16 * unit); | |
3861 | - context.setFillStyle('#777'); | |
3862 | - context.fillText('长按识别二维码', 378 * unit, 810 * unit); | |
3863 | - | |
3864 | - // 10.竖线 | |
3865 | - context.beginPath(); | |
3866 | - context.setFillStyle('#eee'); | |
3867 | - context.rect(354 * unit, 670 * unit, 1 * unit, 130 * unit); | |
3868 | - context.fill(); | |
3869 | 3358 | }, |
3359 | + | |
3360 | + | |
3870 | 3361 | // ----视频图片---- |
3871 | 3362 | // 图片计数器 |
3872 | 3363 | swiperChange: function (e) { | ... | ... |
pages/goods/goodsInfo/goodsInfo.js
... | ... | @@ -5371,13 +5371,15 @@ Page({ |
5371 | 5371 | let pri = parseFloat(item.price).toFixed(2); |
5372 | 5372 | context.fillText(pri, 66 * unit + wi, 680 * unit); |
5373 | 5373 | |
5374 | - var wp = 62 * unit + wi + ut.measureText('¥' + pri, 32 * unit); | |
5375 | - var hp = 735 * unit | |
5376 | - self.draw_pos_price(context, wp, hp, self.data.data.market_price, unit); | |
5377 | 5374 | |
5378 | 5375 | context.setFillStyle("gray") |
5379 | 5376 | context.fillText("满" + item.rynum + "人", 50 * unit + wi, 716 * unit); |
5380 | 5377 | } |
5378 | + | |
5379 | + | |
5380 | + var wp= 52 * unit; | |
5381 | + var hp=755 * unit | |
5382 | + self.draw_pos_price(context,wp,hp,self.data.data.market_price,unit); | |
5381 | 5383 | } |
5382 | 5384 | |
5383 | 5385 | |
... | ... | @@ -5394,16 +5396,16 @@ Page({ |
5394 | 5396 | if (this.data.prom_type == 4 && this.data.prom_integral) { |
5395 | 5397 | context.fillText(this.data.prom_integral + '积分+¥' + price, 54 * unit, 735 * unit); |
5396 | 5398 | |
5397 | - var wp = 62 * unit + ut.measureText(this.data.prom_integral + '积分+¥' + price, 32 * unit); | |
5398 | - var hp = 735 * unit | |
5399 | - this.draw_pos_price(context, wp, hp, this.data.data.market_price, unit); | |
5399 | + var wp= 62 * unit+ut.measureText(this.data.prom_integral + '积分+¥' + price, 32 * unit); | |
5400 | + var hp=735 * unit | |
5401 | + this.draw_pos_price(context,wp,hp,this.data.data.market_price,unit); | |
5400 | 5402 | |
5401 | 5403 | } else { |
5402 | 5404 | context.fillText('¥' + price, 54 * unit, 735 * unit); |
5403 | 5405 | |
5404 | - var wp = 62 * unit + ut.measureText('¥' + price, 32 * unit); | |
5405 | - var hp = 735 * unit | |
5406 | - this.draw_pos_price(context, wp, hp, this.data.data.market_price, unit); | |
5406 | + var wp= 62 * unit+ut.measureText('¥' + price, 32 * unit); | |
5407 | + var hp=735 * unit | |
5408 | + this.draw_pos_price(context,wp,hp,this.data.data.market_price,unit); | |
5407 | 5409 | |
5408 | 5410 | } |
5409 | 5411 | |
... | ... | @@ -5429,17 +5431,17 @@ Page({ |
5429 | 5431 | }, |
5430 | 5432 | |
5431 | 5433 | //---市场价划掉--- |
5432 | - draw_pos_price(context, w, h, market_price, unit) { | |
5434 | + draw_pos_price(context,w,h,market_price,unit){ | |
5433 | 5435 | |
5434 | - if (!this.data.sys_switch) return false; | |
5435 | - if (!this.data.sys_switch.is_retail_price) return false; | |
5436 | + if(!this.data.sys_switch) return false; | |
5437 | + if(!this.data.sys_switch.is_retail_price) return false; | |
5436 | 5438 | |
5437 | 5439 | context.setFillStyle("gray") |
5438 | 5440 | context.setFontSize(22 * unit) |
5439 | 5441 | var pri0 = "¥" + market_price.toFixed(2); |
5440 | 5442 | context.fillText(pri0, w, h); |
5441 | 5443 | |
5442 | - var c_h = h - 6; | |
5444 | + var c_h=h-6; | |
5443 | 5445 | context.setStrokeStyle('gray'); |
5444 | 5446 | context.setLineWidth(1 * unit); |
5445 | 5447 | context.moveTo(w - 5, c_h); |
... | ... | @@ -5456,16 +5458,12 @@ Page({ |
5456 | 5458 | var user_info = getApp().globalData.userInfo; |
5457 | 5459 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { |
5458 | 5460 | //getApp().my_warnning("请先登录",0,this); |
5459 | - wx.navigateTo({ | |
5460 | - url: '/packageE/pages/togoin/togoin', | |
5461 | - }) | |
5461 | + wx.navigateTo({url: '/packageE/pages/togoin/togoin',}) | |
5462 | 5462 | return false; |
5463 | 5463 | } |
5464 | 5464 | |
5465 | 5465 | if (this.data.share_hidden) { |
5466 | - this.setData({ | |
5467 | - share_hidden: false, | |
5468 | - }); | |
5466 | + this.setData({share_hidden: false,}); | |
5469 | 5467 | }; |
5470 | 5468 | |
5471 | 5469 | //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团 |
... | ... | @@ -5482,18 +5480,15 @@ Page({ |
5482 | 5480 | if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3; |
5483 | 5481 | console.log('商品类型。。。。。'); |
5484 | 5482 | console.log(type); |
5485 | - wx.showLoading({ | |
5486 | - title: '生成中...', | |
5487 | - }) | |
5488 | - var that = this, | |
5489 | - th = that; | |
5483 | + wx.showLoading({title: '生成中...',}) | |
5484 | + var that = this, th = that; | |
5490 | 5485 | //设置画板显示,才能开始绘图 |
5491 | 5486 | that.setData({ |
5492 | 5487 | canvasHidden: false |
5493 | 5488 | }) |
5494 | 5489 | |
5495 | 5490 | var app = getApp(); |
5496 | - var unit = that.data.screenWidth / 750 * 1.35; //基础单位, | |
5491 | + var unit = that.data.screenWidth / 750 * 1.35; //基础单位, | |
5497 | 5492 | var path2 = that.data.data.original_img; |
5498 | 5493 | var scene = th.data.gid + ""; |
5499 | 5494 | scene += "." + th.data.sele_g.prom_type + "." + th.data.sele_g.prom_id; |
... | ... | @@ -5510,7 +5505,7 @@ Page({ |
5510 | 5505 | } |
5511 | 5506 | ///二微码 |
5512 | 5507 | var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + |
5513 | - os.stoid + "?sceneValue=" + scene + "&pageValue=pages/goods/goodsInfo/goodsInfo"; | |
5508 | + os.stoid + "?sceneValue=" + scene + "&pageValue=pages/goods/goodsInfo/goodsInfo"; | |
5514 | 5509 | |
5515 | 5510 | console.log(path3); |
5516 | 5511 | |
... | ... | @@ -5535,7 +5530,7 @@ Page({ |
5535 | 5530 | console.log('海报类型-----') |
5536 | 5531 | console.log(type); |
5537 | 5532 | |
5538 | - if (!th.data.share_b_img && (type == 0 || type == 1 || type == 2 || type == 3)) { // 如果是普通商品,绘制新海报 | |
5533 | + if ( !th.data.share_b_img && (type == 0 || type == 1 || type == 2 || type == 3 )){ // 如果是普通商品,绘制新海报 | |
5539 | 5534 | th.drawPoster(context, unit, th.data.share_goods_img, vpath, type); |
5540 | 5535 | } else { |
5541 | 5536 | context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); |
... | ... | @@ -5546,10 +5541,10 @@ Page({ |
5546 | 5541 | }; |
5547 | 5542 | |
5548 | 5543 | |
5549 | - | |
5544 | + var act_time=''; | |
5550 | 5545 | |
5551 | 5546 | //-- 是自定义海报的情况下 -- |
5552 | - if (th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) { | |
5547 | + if (th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) { | |
5553 | 5548 | |
5554 | 5549 | if (th.data.poster && parseInt(th.data.poster.style) == 2) { |
5555 | 5550 | //在线上分享人的情况下 |
... | ... | @@ -5595,19 +5590,27 @@ Page({ |
5595 | 5590 | |
5596 | 5591 | |
5597 | 5592 | var share_title = th.data.data.goods_name; |
5593 | + | |
5594 | + | |
5598 | 5595 | if (th.data.prom_type == 1 || th.data.prom_type == 2 || th.data.prom_type == 6 || th.data.prom_type == 4) { |
5599 | 5596 | share_title = th.data.prom_act.share_title; |
5600 | 5597 | if (!share_title) share_title = th.data.prom_act.title; |
5601 | 5598 | if (th.data.prom_type == 4) share_title = th.data.prom_act.name; |
5599 | + | |
5600 | + //-- 显示活动时间 -- | |
5601 | + if(th.data.share_b_img) { | |
5602 | + act_time="截止时间:"+ ut.formatTime(th.data.prom_act.end_time); | |
5603 | + } | |
5602 | 5604 | } |
5603 | 5605 | |
5604 | 5606 | //---产品名称--- |
5605 | 5607 | //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 |
5606 | - if (th.data.share_b_img || (type != 4 && type != 0 && type != 1 && type != 2 && type != 3)) { | |
5608 | + if (th.data.share_b_img || (type != 4 && type != 0 && type != 1 && type != 2 && type != 3)) { | |
5607 | 5609 | context.setFillStyle("black"); |
5608 | 5610 | context.setFontSize(21.3 * unit) |
5609 | 5611 | getApp().draw_Text(context, share_title, |
5610 | - 38 * unit, 180 * unit, 200 * unit, 279 * unit, unit); | |
5612 | + 38 * unit, 170 * unit, 200 * unit, 279 * unit, unit); | |
5613 | + | |
5611 | 5614 | |
5612 | 5615 | //------产品的价格------- |
5613 | 5616 | context.setFontSize(23 * unit) |
... | ... | @@ -5621,17 +5624,18 @@ Page({ |
5621 | 5624 | if (th.data.prom_act) |
5622 | 5625 | pri0 = th.data.prom_price; |
5623 | 5626 | pri0 = parseFloat(pri0).toFixed(2); |
5627 | + | |
5624 | 5628 | var wd1 = th.data.screenWidth - ut.measureText(pri0, 31 * unit) - 25; |
5625 | 5629 | |
5626 | - if (th.data.prom_type != 4) | |
5627 | - context.fillText("¥", wd1 - 15, 185 * unit); | |
5630 | + if(th.data.prom_type!=4) | |
5631 | + context.fillText("¥", wd1 - 15, 175 * unit); | |
5628 | 5632 | |
5629 | 5633 | context.setFontSize(31 * unit) |
5630 | - var pri_str = pri0; | |
5631 | - if (th.data.prom_type == 4) { | |
5632 | - pri_str = ''; | |
5634 | + var pri_str=pri0; | |
5635 | + if(th.data.prom_type==4){ | |
5636 | + pri_str=''; | |
5633 | 5637 | |
5634 | - if (th.data.prom_integral) pri_str = th.data.prom_integral + '积分'; | |
5638 | + if(th.data.prom_integral) pri_str=th.data.prom_integral+'积分'; | |
5635 | 5639 | if (pri0 && th.data.prom_integral) { |
5636 | 5640 | pri_str += "+"; |
5637 | 5641 | } |
... | ... | @@ -5640,8 +5644,9 @@ Page({ |
5640 | 5644 | } |
5641 | 5645 | |
5642 | 5646 | wd1 = th.data.screenWidth - ut.measureText(pri_str, 31 * unit) - 20; |
5647 | + | |
5643 | 5648 | } |
5644 | - context.fillText(pri_str, wd1, 185 * unit); | |
5649 | + context.fillText(pri_str, wd1, 175 * unit); | |
5645 | 5650 | //---市场价划掉--- |
5646 | 5651 | // context.setFillStyle("gray") |
5647 | 5652 | // context.setFontSize(22 * unit) |
... | ... | @@ -5655,15 +5660,18 @@ Page({ |
5655 | 5660 | // context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit); |
5656 | 5661 | // context.stroke(); |
5657 | 5662 | |
5658 | - var wp = 62 * unit + wi + ut.measureText(pri_str, 32 * unit); | |
5659 | - var hp = 735 * unit | |
5660 | - th.draw_pos_price(context, wp, hp, self.data.data.market_price, unit); | |
5663 | + var wp= wd1; | |
5664 | + var hp=203 * unit; | |
5665 | + if(th.data.prom_type!=4) wp-=12; | |
5666 | + th.draw_pos_price(context,wp,hp,self.data.data.market_price,unit); | |
5661 | 5667 | |
5662 | - } else if (type == 4) { | |
5668 | + } else if (type == 4 ) { | |
5663 | 5669 | context.setFillStyle("black"); |
5664 | 5670 | context.setFontSize(21.3 * unit) |
5665 | 5671 | getApp().draw_Text(context, share_title, |
5666 | - 38 * unit, 170 * unit, 20 * unit, 300 * unit, unit); | |
5672 | + 38 * unit, 160 * unit, 20 * unit, 300 * unit, unit); | |
5673 | + | |
5674 | + | |
5667 | 5675 | //------ 产品的价格 ----- |
5668 | 5676 | var pri0 = th.data.prom_act.addmoney; |
5669 | 5677 | var integral = th.data.prom_act.integral; |
... | ... | @@ -5682,7 +5690,7 @@ Page({ |
5682 | 5690 | text = "0积分"; |
5683 | 5691 | } |
5684 | 5692 | context.setFillStyle("red"); |
5685 | - context.fillText(text, 38 * unit, 235 * unit); | |
5693 | + context.fillText(text, 38 * unit, 175 * unit); | |
5686 | 5694 | |
5687 | 5695 | //---市场价划掉--- |
5688 | 5696 | // context.setFillStyle("gray") |
... | ... | @@ -5697,44 +5705,42 @@ Page({ |
5697 | 5705 | // context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit); |
5698 | 5706 | // context.stroke(); |
5699 | 5707 | |
5700 | - | |
5701 | - | |
5702 | - var wp = 62 * unit + wi + ut.measureText(text, 32 * unit); | |
5703 | - var hp = 735 * unit | |
5704 | - th.draw_pos_price(context, wp, hp, self.data.data.market_price, unit); | |
5708 | + var wp= wd1-12; | |
5709 | + var hp=203 * unit | |
5710 | + th.draw_pos_price(context,wp,hp,self.data.data.market_price,unit); | |
5705 | 5711 | |
5706 | 5712 | |
5707 | 5713 | } |
5708 | 5714 | |
5709 | 5715 | //---中间大图--- |
5710 | - if (th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) { | |
5711 | - context.drawImage(th.data.share_goods_img, 70 * unit, 240 * unit, 408 * unit, 408 * unit); | |
5716 | + if ( th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) { | |
5717 | + context.drawImage(th.data.share_goods_img, 70 * unit, 220 * unit, 408 * unit, 408 * unit); | |
5712 | 5718 | } |
5713 | 5719 | |
5714 | 5720 | |
5715 | 5721 | //---自定义海报 产品质量保证 |
5716 | - if (th.data.share_b_img && th.data.poster.show_quality == 1 && type != 4) { | |
5722 | + if(th.data.share_b_img && th.data.poster.show_quality==1 && type!=4){ | |
5717 | 5723 | var g_path = "../../../images/share/s_gou.png"; |
5718 | - context.drawImage(g_path, 56 * unit, 650 * unit, 22 * unit, 22 * unit); | |
5724 | + context.drawImage(g_path, 56 * unit, 640 * unit, 22 * unit, 22 * unit); | |
5719 | 5725 | context.setFillStyle("red") |
5720 | 5726 | context.setFontSize(18 * unit) |
5721 | - context.fillText("正品保证", 84 * unit, 670 * unit); | |
5727 | + context.fillText("正品保证", 84 * unit, 660 * unit); | |
5722 | 5728 | |
5723 | - context.drawImage(g_path, 218 * unit, 650 * unit, 22 * unit, 22 * unit); | |
5729 | + context.drawImage(g_path, 218 * unit, 640 * unit, 22 * unit, 22 * unit); | |
5724 | 5730 | context.setFillStyle("red") |
5725 | 5731 | context.setFontSize(18 * unit) |
5726 | - context.fillText("纯实体店", 246 * unit, 670 * unit); | |
5732 | + context.fillText("纯实体店", 246 * unit, 660 * unit); | |
5727 | 5733 | |
5728 | - context.drawImage(g_path, 388 * unit, 650 * unit, 22 * unit, 22 * unit); | |
5734 | + context.drawImage(g_path, 388 * unit, 640 * unit, 22 * unit, 22 * unit); | |
5729 | 5735 | context.setFillStyle("red") |
5730 | 5736 | context.setFontSize(18 * unit) |
5731 | - context.fillText("官方验证", 420 * unit, 670 * unit); | |
5737 | + context.fillText("官方验证", 420 * unit, 660 * unit); | |
5732 | 5738 | |
5733 | 5739 | } |
5734 | - //-------大图后面就不一样了----------- | |
5740 | + //-------大图后面就不一样了----------- | |
5735 | 5741 | switch (type) { |
5736 | 5742 | case 0: |
5737 | - if (!th.data.share_b_img) { | |
5743 | + if(!th.data.share_b_img){ | |
5738 | 5744 | break |
5739 | 5745 | } |
5740 | 5746 | //---画线--- |
... | ... | @@ -5754,10 +5760,10 @@ Page({ |
5754 | 5760 | // context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 850 * unit); |
5755 | 5761 | //---二维吗图--- |
5756 | 5762 | context.drawImage(vpath, 380 * unit, 736 * unit, 120 * unit, 120 * unit); |
5757 | - break; //普通商品的展示 | |
5763 | + break;//普通商品的展示 | |
5758 | 5764 | case 4: |
5759 | 5765 | |
5760 | - if (th.data.share_b_img && th.data.poster.show_quality == 1 && type != 4) { | |
5766 | + if(th.data.share_b_img && th.data.poster.show_quality==1 && type!=4){ | |
5761 | 5767 | var g_path = "../../../images/share/s_gou.png"; |
5762 | 5768 | context.drawImage(g_path, 56 * unit, 660 * unit, 22 * unit, 22 * unit); |
5763 | 5769 | context.setFillStyle("red") |
... | ... | @@ -5845,7 +5851,7 @@ Page({ |
5845 | 5851 | |
5846 | 5852 | //---二维吗图--- |
5847 | 5853 | //-- 自定义海报 -- |
5848 | - if (th.data.share_b_img || th.data.poster) { | |
5854 | + if (th.data.share_b_img || th.data.poster) { | |
5849 | 5855 | var erm_x = parseFloat(th.data.poster.ewm_x) * 2; |
5850 | 5856 | var erm_y = parseFloat(th.data.poster.ewm_y) * 2; |
5851 | 5857 | context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); |
... | ... | @@ -5857,32 +5863,32 @@ Page({ |
5857 | 5863 | |
5858 | 5864 | break; |
5859 | 5865 | case 1: //秒杀商品的展示 |
5860 | - if (!th.data.share_b_img) { | |
5866 | + if(!th.data.share_b_img){ | |
5861 | 5867 | break |
5862 | 5868 | } |
5863 | 5869 | //---画线--- |
5864 | 5870 | context.setLineWidth(1 * unit) |
5865 | - context.moveTo(32 * unit, 690 * unit) | |
5866 | - context.lineTo(520 * unit, 690 * unit) | |
5871 | + context.moveTo(32 * unit, 670 * unit) | |
5872 | + context.lineTo(520 * unit, 670 * unit) | |
5867 | 5873 | context.stroke(); |
5868 | 5874 | |
5869 | 5875 | //画秒杀的图片 |
5870 | 5876 | var miaos_path = '../../../images/share/miao_share.png'; |
5871 | - context.drawImage(miaos_path, 43 * unit, 700 * unit, 222 * unit, 40 * unit); | |
5877 | + context.drawImage(miaos_path, 43 * unit, 690 * unit, 222 * unit, 40 * unit); | |
5872 | 5878 | |
5873 | 5879 | context.setFillStyle("black") |
5874 | 5880 | context.setFontSize(24 * unit) |
5875 | - context.fillText(th.data.sto_sele_name_1, 40 * unit, 786 * unit); | |
5881 | + context.fillText(th.data.sto_sele_name_1, 40 * unit, 770 * unit); | |
5876 | 5882 | //---文字--- |
5877 | 5883 | context.setFontSize(22 * unit) |
5878 | 5884 | context.setFillStyle("black") |
5879 | - context.fillText("特惠好物,限时秒杀", 40 * unit, 826 * unit); | |
5880 | - context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 866 * unit); | |
5885 | + context.fillText("特惠好物,限时秒杀", 40 * unit, 807 * unit); | |
5886 | + context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 844 * unit); | |
5881 | 5887 | |
5882 | 5888 | |
5883 | 5889 | //---二维吗图--- |
5884 | 5890 | //-- 自定义海报 -- |
5885 | - if (th.data.share_b_img || th.data.poster) { | |
5891 | + if (th.data.share_b_img || th.data.poster) { | |
5886 | 5892 | var erm_x = parseFloat(th.data.poster.ewm_x) * 2; |
5887 | 5893 | var erm_y = parseFloat(th.data.poster.ewm_y) * 2; |
5888 | 5894 | context.drawImage(vpath, erm_x * unit, erm_y * unit, 135 * unit, 135 * unit); |
... | ... | @@ -5893,7 +5899,7 @@ Page({ |
5893 | 5899 | break; |
5894 | 5900 | |
5895 | 5901 | case 2: //会员团和商家团的展示 |
5896 | - if (!th.data.share_b_img) { | |
5902 | + if(!th.data.share_b_img){ | |
5897 | 5903 | break |
5898 | 5904 | } |
5899 | 5905 | //---画线--- |
... | ... | @@ -5931,7 +5937,7 @@ Page({ |
5931 | 5937 | |
5932 | 5938 | //---二维吗图--- |
5933 | 5939 | //-- 自定义海报 -- |
5934 | - if (th.data.share_b_img || th.data.poster) { | |
5940 | + if (th.data.share_b_img || th.data.poster) { | |
5935 | 5941 | var erm_x = parseFloat(th.data.poster.ewm_x) * 2; |
5936 | 5942 | var erm_y = parseFloat(th.data.poster.ewm_y) * 2; |
5937 | 5943 | context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); |
... | ... | @@ -5941,7 +5947,7 @@ Page({ |
5941 | 5947 | } |
5942 | 5948 | break |
5943 | 5949 | case 3: //阶梯团的展示 |
5944 | - if (!th.data.share_b_img) { | |
5950 | + if(!th.data.share_b_img){ | |
5945 | 5951 | break |
5946 | 5952 | } |
5947 | 5953 | //---画线--- |
... | ... | @@ -5979,7 +5985,7 @@ Page({ |
5979 | 5985 | |
5980 | 5986 | |
5981 | 5987 | //-- 自定义海报 -- |
5982 | - if (th.data.share_b_img || th.data.poster) { | |
5988 | + if (th.data.share_b_img || th.data.poster) { | |
5983 | 5989 | var erm_x = parseFloat(th.data.poster.ewm_x) * 2; |
5984 | 5990 | var erm_y = parseFloat(th.data.poster.ewm_y) * 2; |
5985 | 5991 | context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); |
... | ... | @@ -6010,7 +6016,7 @@ Page({ |
6010 | 6016 | |
6011 | 6017 | //---二维吗图--- |
6012 | 6018 | //-- 自定义海报 -- |
6013 | - if (th.data.share_b_img || th.data.poster) { | |
6019 | + if (th.data.share_b_img || th.data.poster) { | |
6014 | 6020 | var erm_x = parseFloat(th.data.poster.ewm_x) * 2; |
6015 | 6021 | var erm_y = parseFloat(th.data.poster.ewm_y) * 2; |
6016 | 6022 | context.drawImage(vpath, erm_x * unit, erm_y * unit, 135 * unit, 135 * unit); |
... | ... | @@ -6025,7 +6031,7 @@ Page({ |
6025 | 6031 | |
6026 | 6032 | |
6027 | 6033 | //--- 如果是自定义海报的时候 --- |
6028 | - if (th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) { | |
6034 | + if ( th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) { | |
6029 | 6035 | |
6030 | 6036 | if (th.data.poster && parseInt(th.data.poster.style) == 2) { |
6031 | 6037 | |
... | ... | @@ -6070,6 +6076,15 @@ Page({ |
6070 | 6076 | } |
6071 | 6077 | |
6072 | 6078 | |
6079 | + | |
6080 | + //-- 自定义的时候 -- | |
6081 | + if(th.data.share_b_img && act_time && th.data.poster.show_time){ | |
6082 | + context.setFillStyle("red") | |
6083 | + getApp().draw_Text(context, act_time,38 * unit, 880 * unit, 200 * unit, 340 * unit, unit); | |
6084 | + } | |
6085 | + | |
6086 | + | |
6087 | + | |
6073 | 6088 | //把画板内容绘制成图片,并回调 画板图片路径 |
6074 | 6089 | context.draw(false, function () { |
6075 | 6090 | setTimeout(function () { | ... | ... |