Commit d5213d959d76f93164977dfd9bbce3445a3f588a
1 parent
446a88c9
分享朋友圈优化
Showing
11 changed files
with
1787 additions
and
1829 deletions
app.js
| @@ -428,10 +428,15 @@ App({ | @@ -428,10 +428,15 @@ App({ | ||
| 428 | }) | 428 | }) | 
| 429 | }, | 429 | }, | 
| 430 | //获取场景值 判断是否是单页面 | 430 | //获取场景值 判断是否是单页面 | 
| 431 | - is_Single_page() { | 431 | + is_Single_page(_this,func) { | 
| 432 | let scene = wx.getLaunchOptionsSync().scene; | 432 | let scene = wx.getLaunchOptionsSync().scene; | 
| 433 | //--判断是否是单页面-- | 433 | //--判断是否是单页面-- | 
| 434 | - return scene == 1154? false:true; | 434 | + if(scene !== 1154){ | 
| 435 | + typeof func =="function" && func.bind(_this)(); | ||
| 436 | + }else{ | ||
| 437 | + return false; | ||
| 438 | + } | ||
| 439 | + // return scene == 1154? false:true; | ||
| 435 | }, | 440 | }, | 
| 436 | 441 | ||
| 437 | 442 | 
packageA/pages/liveStream/liveStream.js
| @@ -208,14 +208,13 @@ Page({ | @@ -208,14 +208,13 @@ Page({ | ||
| 208 | * 生命周期函数--监听页面加载 | 208 | * 生命周期函数--监听页面加载 | 
| 209 | */ | 209 | */ | 
| 210 | onLoad: function (options) { | 210 | onLoad: function (options) { | 
| 211 | - self = this; | ||
| 212 | - if(getApp().is_Single_page()){ | 211 | + getApp().is_Single_page(this,function(){ | 
| 213 | app.isLogin().then(function(data) {//进入页面前已经授权登录成功 | 212 | app.isLogin().then(function(data) {//进入页面前已经授权登录成功 | 
| 214 | - self.setData({ | 213 | + this.setData({ | 
| 215 | userInfo: data, | 214 | userInfo: data, | 
| 216 | }); | 215 | }); | 
| 217 | }); | 216 | }); | 
| 218 | - } | 217 | + }) | 
| 219 | 218 | ||
| 220 | }, | 219 | }, | 
| 221 | 220 | 
packageB/pages/luckactivity/luckinfo/luckinfo.js
| @@ -1379,35 +1379,6 @@ Page({ | @@ -1379,35 +1379,6 @@ Page({ | ||
| 1379 | }; | 1379 | }; | 
| 1380 | }, 500); | 1380 | }, 500); | 
| 1381 | }; | 1381 | }; | 
| 1382 | - // if(this.data.isImgOk) { | ||
| 1383 | - // setTimeout(function() { | ||
| 1384 | - // wx.hideLoading(); | ||
| 1385 | - // self.setData({ | ||
| 1386 | - // myimg: self.data.imgPath, | ||
| 1387 | - // hiddenCanvas: true, | ||
| 1388 | - // showMask: true, | ||
| 1389 | - // showPoster: true, | ||
| 1390 | - // }); | ||
| 1391 | - // }, 300); | ||
| 1392 | - | ||
| 1393 | - // } else { | ||
| 1394 | - // wx.showToast({ | ||
| 1395 | - // title: '生成失败,请重新点击', | ||
| 1396 | - // icon: 'none', | ||
| 1397 | - // }); | ||
| 1398 | - // }; | ||
| 1399 | - | ||
| 1400 | - // setTimeout(function() { | ||
| 1401 | - // // if(self.data.myimg) { | ||
| 1402 | - // if(self.data.imgPath) { | ||
| 1403 | - // wx.hideLoading(); | ||
| 1404 | - | ||
| 1405 | - // } else { | ||
| 1406 | - // console.log('没有生成图片!!!!!!', self.data.imgPath); | ||
| 1407 | - // }; | ||
| 1408 | - | ||
| 1409 | - // // } | ||
| 1410 | - // }, 300); | ||
| 1411 | }, | 1382 | }, | 
| 1412 | 1383 | ||
| 1413 | closePoster() { | 1384 | closePoster() { | 
packageB/pages/zuhegou/index/index.js
| @@ -11,80 +11,80 @@ let imgDraw = { | @@ -11,80 +11,80 @@ let imgDraw = { | ||
| 11 | "height": "843px", | 11 | "height": "843px", | 
| 12 | "background": "https://mshopimg.yolipai.net/miniapp/images/zhg/bg-zuhegou.jpg", | 12 | "background": "https://mshopimg.yolipai.net/miniapp/images/zhg/bg-zuhegou.jpg", | 
| 13 | "views": [{ // 头像 | 13 | "views": [{ // 头像 | 
| 14 | - "type": "image", | ||
| 15 | - "url": "https://desk-fd.zol-img.com.cn/t_s960x600c5/g5/M00/0F/08/ChMkJlauzXWIDrXBAAdCg2xP7oYAAH9FQOpVAIAB0Kb342.jpg", | ||
| 16 | - "css": { | ||
| 17 | - "width": "100px", | ||
| 18 | - "height": "100px", | ||
| 19 | - "top": "20px", | ||
| 20 | - "left": "275px", | ||
| 21 | - "borderRadius": "100px", | ||
| 22 | - "mode": "scaleToFill", | ||
| 23 | - "borderWidth": "2px", | ||
| 24 | - "borderColor": "#fff", | ||
| 25 | - } | ||
| 26 | - }, | ||
| 27 | - { //昵称 | ||
| 28 | - "type": "text", | ||
| 29 | - "text": "我是店铺名", | ||
| 30 | - "css": { | ||
| 31 | - "width": "650px", | ||
| 32 | - "color": "#fff", | ||
| 33 | - "top": "136px", | ||
| 34 | - // "left": "137px", | ||
| 35 | - "textAlign": "center", | ||
| 36 | - "fontSize": "26px", | ||
| 37 | - "maxLines": "1", | ||
| 38 | - } | ||
| 39 | - }, | ||
| 40 | - { //10元任选3件 | ||
| 41 | - "type": "text", | ||
| 42 | - "text": "10元3件", | ||
| 43 | - "css": { | ||
| 44 | - "color": "#fff", | ||
| 45 | - "width": "650px", | ||
| 46 | - "top": "270px", | ||
| 47 | - "fontSize": "70px", | ||
| 48 | - "maxLines": "1", | ||
| 49 | - "textAlign": "center", | ||
| 50 | - "fontWeight": "bold", | ||
| 51 | - } | ||
| 52 | - }, | ||
| 53 | - { //活动时间 | ||
| 54 | - "type": "text", | ||
| 55 | - "text": "活动时间:2021.07.06 - 2021.07.08", | ||
| 56 | - "css": { | ||
| 57 | - "color": "#333", | ||
| 58 | - "width": "650px", | ||
| 59 | - "top": "440px", | ||
| 60 | - "fontSize": "26px", | ||
| 61 | - "fontWeight": "normal", | ||
| 62 | - "maxLines": "1", | ||
| 63 | - "textAlign": "center" | ||
| 64 | - } | ||
| 65 | - }, | ||
| 66 | - { // 码 | ||
| 67 | - "type": "image", | ||
| 68 | - "url": "https://desk-fd.zol-img.com.cn/t_s960x600c5/g5/M00/0F/08/ChMkJlauzXWIDrXBAAdCg2xP7oYAAH9FQOpVAIAB0Kb342.jpg", | ||
| 69 | - "css": { | ||
| 70 | - "color": "#000", | ||
| 71 | - "width": "200px", | ||
| 72 | - "height": "200px", | ||
| 73 | - "top": "525px", | ||
| 74 | - "left": "225px", | ||
| 75 | - } | ||
| 76 | - }, | ||
| 77 | - { // 扫码提示 | ||
| 78 | - "type": "text", | ||
| 79 | - "text": "长按扫码即可参与活动", | ||
| 80 | - "css": { | ||
| 81 | - "color": "#666", | ||
| 82 | - "width": "650px", | ||
| 83 | - "top": "750px", | ||
| 84 | - "fontSize": "26px", | ||
| 85 | - "textAlign": "center" | ||
| 86 | - } | ||
| 87 | - }, | 14 | + "type": "image", | 
| 15 | + "url": "https://desk-fd.zol-img.com.cn/t_s960x600c5/g5/M00/0F/08/ChMkJlauzXWIDrXBAAdCg2xP7oYAAH9FQOpVAIAB0Kb342.jpg", | ||
| 16 | + "css": { | ||
| 17 | + "width": "100px", | ||
| 18 | + "height": "100px", | ||
| 19 | + "top": "20px", | ||
| 20 | + "left": "275px", | ||
| 21 | + "borderRadius": "100px", | ||
| 22 | + "mode": "scaleToFill", | ||
| 23 | + "borderWidth": "2px", | ||
| 24 | + "borderColor": "#fff", | ||
| 25 | + } | ||
| 26 | + }, | ||
| 27 | + { //昵称 | ||
| 28 | + "type": "text", | ||
| 29 | + "text": "我是店铺名", | ||
| 30 | + "css": { | ||
| 31 | + "width": "650px", | ||
| 32 | + "color": "#fff", | ||
| 33 | + "top": "136px", | ||
| 34 | + // "left": "137px", | ||
| 35 | + "textAlign": "center", | ||
| 36 | + "fontSize": "26px", | ||
| 37 | + "maxLines": "1", | ||
| 38 | + } | ||
| 39 | + }, | ||
| 40 | + { //10元任选3件 | ||
| 41 | + "type": "text", | ||
| 42 | + "text": "10元3件", | ||
| 43 | + "css": { | ||
| 44 | + "color": "#fff", | ||
| 45 | + "width": "650px", | ||
| 46 | + "top": "270px", | ||
| 47 | + "fontSize": "70px", | ||
| 48 | + "maxLines": "1", | ||
| 49 | + "textAlign": "center", | ||
| 50 | + "fontWeight": "bold", | ||
| 51 | + } | ||
| 52 | + }, | ||
| 53 | + { //活动时间 | ||
| 54 | + "type": "text", | ||
| 55 | + "text": "活动时间:2021.07.06 - 2021.07.08", | ||
| 56 | + "css": { | ||
| 57 | + "color": "#333", | ||
| 58 | + "width": "650px", | ||
| 59 | + "top": "440px", | ||
| 60 | + "fontSize": "26px", | ||
| 61 | + "fontWeight": "normal", | ||
| 62 | + "maxLines": "1", | ||
| 63 | + "textAlign": "center" | ||
| 64 | + } | ||
| 65 | + }, | ||
| 66 | + { // 码 | ||
| 67 | + "type": "image", | ||
| 68 | + "url": "https://desk-fd.zol-img.com.cn/t_s960x600c5/g5/M00/0F/08/ChMkJlauzXWIDrXBAAdCg2xP7oYAAH9FQOpVAIAB0Kb342.jpg", | ||
| 69 | + "css": { | ||
| 70 | + "color": "#000", | ||
| 71 | + "width": "200px", | ||
| 72 | + "height": "200px", | ||
| 73 | + "top": "525px", | ||
| 74 | + "left": "225px", | ||
| 75 | + } | ||
| 76 | + }, | ||
| 77 | + { // 扫码提示 | ||
| 78 | + "type": "text", | ||
| 79 | + "text": "长按扫码即可参与活动", | ||
| 80 | + "css": { | ||
| 81 | + "color": "#666", | ||
| 82 | + "width": "650px", | ||
| 83 | + "top": "750px", | ||
| 84 | + "fontSize": "26px", | ||
| 85 | + "textAlign": "center" | ||
| 86 | + } | ||
| 87 | + }, | ||
| 88 | ] | 88 | ] | 
| 89 | }; | 89 | }; | 
| 90 | 90 | ||
| @@ -123,7 +123,7 @@ Page({ | @@ -123,7 +123,7 @@ Page({ | ||
| 123 | * 生命周期函数--监听页面加载 | 123 | * 生命周期函数--监听页面加载 | 
| 124 | */ | 124 | */ | 
| 125 | onLoad: function (options) { | 125 | onLoad: function (options) { | 
| 126 | - | 126 | + | 
| 127 | console.log(options, 111); | 127 | console.log(options, 111); | 
| 128 | self = this; | 128 | self = this; | 
| 129 | var the_id = options.id; | 129 | var the_id = options.id; | 
| @@ -154,228 +154,224 @@ Page({ | @@ -154,228 +154,224 @@ Page({ | ||
| 154 | } | 154 | } | 
| 155 | }) | 155 | }) | 
| 156 | } | 156 | } | 
| 157 | - | ||
| 158 | - //如果有会员的时候 | ||
| 159 | - var userInfo = getApp().globalData.userInfo; | ||
| 160 | - if (!userInfo) { | ||
| 161 | - if(getApp().is_Single_page()){ | ||
| 162 | - getApp().goto("/pages/togoin/togoin"); | ||
| 163 | - return false; | ||
| 164 | - } | ||
| 165 | - } | ||
| 166 | }, | 157 | }, | 
| 167 | 158 | ||
| 168 | /** | 159 | /** | 
| 169 | * 生命周期函数--监听页面显示 | 160 | * 生命周期函数--监听页面显示 | 
| 170 | */ | 161 | */ | 
| 171 | onShow: function () { | 162 | onShow: function () { | 
| 172 | - var th = this, | ||
| 173 | - that = this, | ||
| 174 | - ee = this; | ||
| 175 | - this.data.is_timer = 1; | ||
| 176 | - if (this.data.act) this.countDown(); | ||
| 177 | - //如果有会员的时候 | ||
| 178 | - var userInfo = getApp().globalData.userInfo; | ||
| 179 | - if (userInfo) { | ||
| 180 | - if (!th.data.is_get_act) { | ||
| 181 | - //获取活动信息 | ||
| 182 | - var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + th.data.id + "/" + userInfo.user_id; | ||
| 183 | - getApp().request.get(url, { | ||
| 184 | - success: function (e) { | ||
| 185 | - th.data.is_get_act = 1; | ||
| 186 | - if (e.data.code == 0 && e.data.data) { | ||
| 187 | - self.setData({ | ||
| 188 | - act: e.data.data | ||
| 189 | - }); | ||
| 190 | - if (e.data.data.is_show != 1) { | ||
| 191 | - th.setData({ | ||
| 192 | - error: '活动未开启' | ||
| 193 | - }); | ||
| 194 | - return false; | ||
| 195 | - } | ||
| 196 | - if (ut.gettimestamp() < e.data.data.start_time) { | ||
| 197 | - th.setData({ | ||
| 198 | - error: '活动还未开始' | 163 | + getApp().is_Single_page(this, function () { | 
| 164 | + var th = this, | ||
| 165 | + that = this, | ||
| 166 | + ee = this; | ||
| 167 | + this.data.is_timer = 1; | ||
| 168 | + if (this.data.act) this.countDown(); | ||
| 169 | + //如果有会员的时候 | ||
| 170 | + var userInfo = getApp().globalData.userInfo; | ||
| 171 | + if (userInfo) { | ||
| 172 | + if (!th.data.is_get_act) { | ||
| 173 | + //获取活动信息 | ||
| 174 | + var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + th.data.id + "/" + userInfo.user_id; | ||
| 175 | + getApp().request.get(url, { | ||
| 176 | + success: function (e) { | ||
| 177 | + th.data.is_get_act = 1; | ||
| 178 | + if (e.data.code == 0 && e.data.data) { | ||
| 179 | + self.setData({ | ||
| 180 | + act: e.data.data | ||
| 199 | }); | 181 | }); | 
| 200 | - return false; | ||
| 201 | - } | ||
| 202 | - if (e.data.data.is_end == 0 && ut.gettimestamp() < e.data.data.end_time) { | ||
| 203 | - //-- 获取商品列表 -- | ||
| 204 | - self.get_list(); | ||
| 205 | - self.countDown(); | 182 | + if (e.data.data.is_show != 1) { | 
| 183 | + th.setData({ | ||
| 184 | + error: '活动未开启' | ||
| 185 | + }); | ||
| 186 | + return false; | ||
| 187 | + } | ||
| 188 | + if (ut.gettimestamp() < e.data.data.start_time) { | ||
| 189 | + th.setData({ | ||
| 190 | + error: '活动还未开始' | ||
| 191 | + }); | ||
| 192 | + return false; | ||
| 193 | + } | ||
| 194 | + if (e.data.data.is_end == 0 && ut.gettimestamp() < e.data.data.end_time) { | ||
| 195 | + //-- 获取商品列表 -- | ||
| 196 | + self.get_list(); | ||
| 197 | + self.countDown(); | ||
| 198 | + } else { | ||
| 199 | + th.setData({ | ||
| 200 | + error: '活动已经过期' | ||
| 201 | + }); | ||
| 202 | + return false; | ||
| 203 | + } | ||
| 206 | } else { | 204 | } else { | 
| 205 | + th.data.is_get_act = 0; | ||
| 207 | th.setData({ | 206 | th.setData({ | 
| 208 | - error: '活动已经过期' | 207 | + error: e.data.msg | 
| 209 | }); | 208 | }); | 
| 210 | return false; | 209 | return false; | 
| 211 | } | 210 | } | 
| 212 | - } else { | ||
| 213 | - th.data.is_get_act = 0; | ||
| 214 | - th.setData({ | ||
| 215 | - error: e.data.msg | ||
| 216 | - }); | ||
| 217 | - return false; | ||
| 218 | } | 211 | } | 
| 219 | - } | ||
| 220 | - }); | ||
| 221 | - } | ||
| 222 | - | ||
| 223 | - //等待活动值 | ||
| 224 | - this.waitfor2(10, 'list', function () { | ||
| 225 | - if (!th.data.list) return false; | ||
| 226 | - if (ut.gettimestamp() < th.data.act.start_time) { | ||
| 227 | - return false; | ||
| 228 | - } | ||
| 229 | - if (th.data.act.is_end == 10 || ut.gettimestamp() >= th.data.act.end_time) { | ||
| 230 | - return false; | 212 | + }); | 
| 231 | } | 213 | } | 
| 232 | - //获取头像的分享 | ||
| 233 | - th.get_head_temp(function () { | ||
| 234 | - var txt = th.data.act.zhprice + "元" + th.data.act.zhbuyqty + "件"; | ||
| 235 | - imgDraw.views[0].url = th.data.share_head; | ||
| 236 | - imgDraw.views[1].text = userInfo.nickname; | ||
| 237 | - imgDraw.views[2].text = txt; | ||
| 238 | - | ||
| 239 | - var start = ut.formar_no_full(th.data.act.start_time, '.'); | ||
| 240 | - var end = ut.formar_no_full(th.data.act.end_time, '.'); | ||
| 241 | - txt = "活动时间:" + start + " - " + end; | ||
| 242 | - imgDraw.views[3].text = txt; | ||
| 243 | - | ||
| 244 | - var scene = th.data.id + ""; | ||
| 245 | - var user_id = getApp().globalData.user_id; | ||
| 246 | - scene += "_" + user_id; | ||
| 247 | - ///二微码 | ||
| 248 | - var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + | ||
| 249 | - os.stoid + "?sceneValue=" + scene + "&pageValue=packageB/pages/zuhegou/index/index"; | ||
| 250 | - wx.getImageInfo({ | ||
| 251 | - src: path3, | ||
| 252 | - success: function (res) { | ||
| 253 | - var vpath = res.path; | ||
| 254 | - imgDraw.views[4].url = vpath; | ||
| 255 | - th.setData({ | ||
| 256 | - imgDraw: imgDraw | ||
| 257 | - }) | ||
| 258 | - } | ||
| 259 | - }) | ||
| 260 | - }) | ||
| 261 | 214 | ||
| 262 | - //获取用户的默认门店 | ||
| 263 | - getApp().get_user_store(function (e) { | ||
| 264 | - if (!e) { | ||
| 265 | - th.data.fir_def_store = {}; //赋值空对象 | 215 | + //等待活动值 | 
| 216 | + this.waitfor2(10, 'list', function () { | ||
| 217 | + if (!th.data.list) return false; | ||
| 218 | + if (ut.gettimestamp() < th.data.act.start_time) { | ||
| 219 | + return false; | ||
| 220 | + } | ||
| 221 | + if (th.data.act.is_end == 10 || ut.gettimestamp() >= th.data.act.end_time) { | ||
| 266 | return false; | 222 | return false; | 
| 267 | } | 223 | } | 
| 224 | + //获取头像的分享 | ||
| 225 | + th.get_head_temp(function () { | ||
| 226 | + var txt = th.data.act.zhprice + "元" + th.data.act.zhbuyqty + "件"; | ||
| 227 | + imgDraw.views[0].url = th.data.share_head; | ||
| 228 | + imgDraw.views[1].text = userInfo.nickname; | ||
| 229 | + imgDraw.views[2].text = txt; | ||
| 230 | + | ||
| 231 | + var start = ut.formar_no_full(th.data.act.start_time, '.'); | ||
| 232 | + var end = ut.formar_no_full(th.data.act.end_time, '.'); | ||
| 233 | + txt = "活动时间:" + start + " - " + end; | ||
| 234 | + imgDraw.views[3].text = txt; | ||
| 235 | + | ||
| 236 | + var scene = th.data.id + ""; | ||
| 237 | + var user_id = getApp().globalData.user_id; | ||
| 238 | + scene += "_" + user_id; | ||
| 239 | + ///二微码 | ||
| 240 | + var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + | ||
| 241 | + os.stoid + "?sceneValue=" + scene + "&pageValue=packageB/pages/zuhegou/index/index"; | ||
| 242 | + wx.getImageInfo({ | ||
| 243 | + src: path3, | ||
| 244 | + success: function (res) { | ||
| 245 | + var vpath = res.path; | ||
| 246 | + imgDraw.views[4].url = vpath; | ||
| 247 | + th.setData({ | ||
| 248 | + imgDraw: imgDraw | ||
| 249 | + }) | ||
| 250 | + } | ||
| 251 | + }) | ||
| 252 | + }) | ||
| 268 | 253 | ||
| 254 | + //获取用户的默认门店 | ||
| 255 | + getApp().get_user_store(function (e) { | ||
| 256 | + if (!e) { | ||
| 257 | + th.data.fir_def_store = {}; //赋值空对象 | ||
| 258 | + return false; | ||
| 259 | + } | ||
| 269 | 260 | ||
| 270 | 261 | ||
| 271 | - var ee = JSON.parse(JSON.stringify(e)); | ||
| 272 | - var appd = getApp().globalData; | ||
| 273 | - //-- 等待定位系统的开启 -- | ||
| 274 | - th.waitfor2(15, 'is_get_local_ok', function () { | ||
| 275 | 262 | ||
| 276 | - if (!th.data.is_get_local_ok) return false; | 263 | + var ee = JSON.parse(JSON.stringify(e)); | 
| 264 | + var appd = getApp().globalData; | ||
| 265 | + //-- 等待定位系统的开启 -- | ||
| 266 | + th.waitfor2(15, 'is_get_local_ok', function () { | ||
| 277 | 267 | ||
| 278 | - var e = JSON.parse(JSON.stringify(ee)); | ||
| 279 | - //如果有开启近距离的话,同时距离优不一样了 | ||
| 280 | - if (that.data.lat != null) { | ||
| 281 | - //如果经纬度有变化的话 | ||
| 282 | - if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) { | ||
| 283 | - that.set_def_storage(e); | ||
| 284 | - } else { | ||
| 285 | - //要用接口是获取距离,js的计算不准 | ||
| 286 | - getApp().request.promiseGet("/api/weshop/pickup/list", { | ||
| 287 | - data: { | ||
| 288 | - store_id: os.stoid, | ||
| 289 | - pickup_id: e.pickup_id, | ||
| 290 | - is_pos: 1, | ||
| 291 | - lat: th.data.lat, | ||
| 292 | - lon: th.data.lon | ||
| 293 | - }, | ||
| 294 | - }).then(res => { | ||
| 295 | - if (res.data.code == 0) { | ||
| 296 | - e = res.data.data.pageData[0]; | ||
| 297 | - if (e) { | ||
| 298 | - e.is_no_dis = ee.is_no_dis; | ||
| 299 | - appd.pk_store = e; | ||
| 300 | - that.set_def_storage(e); | ||
| 301 | - } | 268 | + if (!th.data.is_get_local_ok) return false; | 
| 302 | 269 | ||
| 303 | - } | ||
| 304 | - }) | ||
| 305 | - } | ||
| 306 | - appd.lat = that.data.lat; | ||
| 307 | - appd.lon = that.data.lon; | ||
| 308 | - } else { | ||
| 309 | - if (e) { | ||
| 310 | - e.distance = null; | ||
| 311 | - that.set_def_storage(e); | ||
| 312 | - } | ||
| 313 | - } | ||
| 314 | - }) | ||
| 315 | - }); | 270 | + var e = JSON.parse(JSON.stringify(ee)); | 
| 271 | + //如果有开启近距离的话,同时距离优不一样了 | ||
| 272 | + if (that.data.lat != null) { | ||
| 273 | + //如果经纬度有变化的话 | ||
| 274 | + if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) { | ||
| 275 | + that.set_def_storage(e); | ||
| 276 | + } else { | ||
| 277 | + //要用接口是获取距离,js的计算不准 | ||
| 278 | + getApp().request.promiseGet("/api/weshop/pickup/list", { | ||
| 279 | + data: { | ||
| 280 | + store_id: os.stoid, | ||
| 281 | + pickup_id: e.pickup_id, | ||
| 282 | + is_pos: 1, | ||
| 283 | + lat: th.data.lat, | ||
| 284 | + lon: th.data.lon | ||
| 285 | + }, | ||
| 286 | + }).then(res => { | ||
| 287 | + if (res.data.code == 0) { | ||
| 288 | + e = res.data.data.pageData[0]; | ||
| 289 | + if (e) { | ||
| 290 | + e.is_no_dis = ee.is_no_dis; | ||
| 291 | + appd.pk_store = e; | ||
| 292 | + that.set_def_storage(e); | ||
| 293 | + } | ||
| 316 | 294 | ||
| 317 | - //----获取系统参数----- | ||
| 318 | - getApp().getConfig2(function (e) { | ||
| 319 | - ee.setData({ | ||
| 320 | - bconfig: e, | ||
| 321 | - sales_rules: e.sales_rules, | ||
| 322 | - }); | ||
| 323 | - //设置基本参数 | ||
| 324 | - th.wait_for_store_config(e); | ||
| 325 | - | ||
| 326 | - var json_d = JSON.parse(e.switch_list); | ||
| 327 | - ee.setData({ | ||
| 328 | - store_config: e, | ||
| 329 | - sys_switch: json_d, | ||
| 330 | - is_closecoupon: json_d.is_closecoupon, | ||
| 331 | - is_newsales_rules: json_d.is_newsales_rules, | ||
| 332 | - is_open_offline: json_d.is_pricing_open, | ||
| 333 | - sales_rules: e.sales_rules | 295 | + } | 
| 296 | + }) | ||
| 297 | + } | ||
| 298 | + appd.lat = that.data.lat; | ||
| 299 | + appd.lon = that.data.lon; | ||
| 300 | + } else { | ||
| 301 | + if (e) { | ||
| 302 | + e.distance = null; | ||
| 303 | + that.set_def_storage(e); | ||
| 304 | + } | ||
| 305 | + } | ||
| 306 | + }) | ||
| 334 | }); | 307 | }); | 
| 335 | 308 | ||
| 336 | - //-- 计算等级价相关 -- | ||
| 337 | - var swithc_list = e.switch_list; | ||
| 338 | - var sw_arr = JSON.parse(swithc_list); | ||
| 339 | - //---如果后台又开等级卡的开关--- | ||
| 340 | - if (sw_arr.rank_switch && sw_arr.rank_switch == "2") { | ||
| 341 | - th.setData({ | ||
| 342 | - rank_switch: true | 309 | + //----获取系统参数----- | 
| 310 | + getApp().getConfig2(function (e) { | ||
| 311 | + ee.setData({ | ||
| 312 | + bconfig: e, | ||
| 313 | + sales_rules: e.sales_rules, | ||
| 343 | }); | 314 | }); | 
| 344 | - //---回调卡的列表--- | ||
| 345 | - th.getPlusCardType(function (ob) { | 315 | + //设置基本参数 | 
| 316 | + th.wait_for_store_config(e); | ||
| 317 | + | ||
| 318 | + var json_d = JSON.parse(e.switch_list); | ||
| 319 | + ee.setData({ | ||
| 320 | + store_config: e, | ||
| 321 | + sys_switch: json_d, | ||
| 322 | + is_closecoupon: json_d.is_closecoupon, | ||
| 323 | + is_newsales_rules: json_d.is_newsales_rules, | ||
| 324 | + is_open_offline: json_d.is_pricing_open, | ||
| 325 | + sales_rules: e.sales_rules | ||
| 326 | + }); | ||
| 327 | + | ||
| 328 | + //-- 计算等级价相关 -- | ||
| 329 | + var swithc_list = e.switch_list; | ||
| 330 | + var sw_arr = JSON.parse(swithc_list); | ||
| 331 | + //---如果后台又开等级卡的开关--- | ||
| 332 | + if (sw_arr.rank_switch && sw_arr.rank_switch == "2") { | ||
| 346 | th.setData({ | 333 | th.setData({ | 
| 347 | - card_list: ob.card_list | 334 | + rank_switch: true | 
| 348 | }); | 335 | }); | 
| 349 | - var user = getApp().globalData.userInfo; | ||
| 350 | - if (!user) return false; | ||
| 351 | - if (user.card_field && user['card_expiredate']) { | ||
| 352 | - var str = user['card_expiredate'].replace(/-/g, '/'); | ||
| 353 | - var end = new Date(str); | ||
| 354 | - end = Date.parse(end) / 1000; | ||
| 355 | - var now = ut.gettimestamp(); | ||
| 356 | - //--- 判断是等级会员,且在有效期范围内 --- | ||
| 357 | - if (user.card_field && now < end) { | ||
| 358 | - var card_name = ob.name_map.get(user.card_field); | ||
| 359 | - th.setData({ | ||
| 360 | - card_field: user.card_field, | ||
| 361 | - card_name: card_name, | ||
| 362 | - card_list: ob.card_list | ||
| 363 | - }); | 336 | + //---回调卡的列表--- | 
| 337 | + th.getPlusCardType(function (ob) { | ||
| 338 | + th.setData({ | ||
| 339 | + card_list: ob.card_list | ||
| 340 | + }); | ||
| 341 | + var user = getApp().globalData.userInfo; | ||
| 342 | + if (!user) return false; | ||
| 343 | + if (user.card_field && user['card_expiredate']) { | ||
| 344 | + var str = user['card_expiredate'].replace(/-/g, '/'); | ||
| 345 | + var end = new Date(str); | ||
| 346 | + end = Date.parse(end) / 1000; | ||
| 347 | + var now = ut.gettimestamp(); | ||
| 348 | + //--- 判断是等级会员,且在有效期范围内 --- | ||
| 349 | + if (user.card_field && now < end) { | ||
| 350 | + var card_name = ob.name_map.get(user.card_field); | ||
| 351 | + th.setData({ | ||
| 352 | + card_field: user.card_field, | ||
| 353 | + card_name: card_name, | ||
| 354 | + card_list: ob.card_list | ||
| 355 | + }); | ||
| 356 | + } | ||
| 364 | } | 357 | } | 
| 365 | - } | 358 | + //获取购物车的内容 | 
| 359 | + th.get_cart_val(e); | ||
| 360 | + | ||
| 361 | + }) | ||
| 362 | + } else { | ||
| 366 | //获取购物车的内容 | 363 | //获取购物车的内容 | 
| 367 | th.get_cart_val(e); | 364 | th.get_cart_val(e); | 
| 365 | + } | ||
| 366 | + }, 1); | ||
| 368 | 367 | ||
| 369 | - }) | ||
| 370 | - } else { | ||
| 371 | - //获取购物车的内容 | ||
| 372 | - th.get_cart_val(e); | ||
| 373 | - } | ||
| 374 | - }, 1); | ||
| 375 | - | ||
| 376 | - }) | 368 | + }) | 
| 377 | 369 | ||
| 378 | - } | 370 | + } else { | 
| 371 | + getApp().goto("/pages/togoin/togoin"); | ||
| 372 | + return false; | ||
| 373 | + } | ||
| 374 | + }) | ||
| 379 | }, | 375 | }, | 
| 380 | 376 | ||
| 381 | onHide: function () { | 377 | onHide: function () { | 
| @@ -1898,7 +1894,7 @@ Page({ | @@ -1898,7 +1894,7 @@ Page({ | ||
| 1898 | 1894 | ||
| 1899 | getApp().request.put("/api/weshop/cart/update", { | 1895 | getApp().request.put("/api/weshop/cart/update", { | 
| 1900 | data: updata, | 1896 | data: updata, | 
| 1901 | - success: function (t) {} | 1897 | + success: function (t) { } | 
| 1902 | }); | 1898 | }); | 
| 1903 | th.re_sum_price(); | 1899 | th.re_sum_price(); | 
| 1904 | }) | 1900 | }) | 
| @@ -1975,7 +1971,7 @@ Page({ | @@ -1975,7 +1971,7 @@ Page({ | ||
| 1975 | if (this.data.act.is_bzyh && zhqty_bz.length > 0) { | 1971 | if (this.data.act.is_bzyh && zhqty_bz.length > 0) { | 
| 1976 | if (zhqty_bz.length > 1) { | 1972 | if (zhqty_bz.length > 1) { | 
| 1977 | let zhqty_bz_arr = []; | 1973 | let zhqty_bz_arr = []; | 
| 1978 | - let zhqty_bz_flag=this.zhqty_bz_fun(zhqty_bz,be,zhqty_bz_arr); | 1974 | + let zhqty_bz_flag = this.zhqty_bz_fun(zhqty_bz, be, zhqty_bz_arr); | 
| 1979 | 1975 | ||
| 1980 | if (zhqty_bz_flag) { | 1976 | if (zhqty_bz_flag) { | 
| 1981 | for (let i = 0; i < zhqty_bz.length; i++) { | 1977 | for (let i = 0; i < zhqty_bz.length; i++) { | 
| @@ -1991,7 +1987,7 @@ Page({ | @@ -1991,7 +1987,7 @@ Page({ | ||
| 1991 | } | 1987 | } | 
| 1992 | } | 1988 | } | 
| 1993 | } else { | 1989 | } else { | 
| 1994 | - zhqty_len=1; | 1990 | + zhqty_len = 1; | 
| 1995 | let min_bz_num = Math.min.apply(Math, zhqty_bz_arr.map(function (o) { | 1991 | let min_bz_num = Math.min.apply(Math, zhqty_bz_arr.map(function (o) { | 
| 1996 | return o['num']; | 1992 | return o['num']; | 
| 1997 | })); | 1993 | })); | 
| @@ -2015,9 +2011,9 @@ Page({ | @@ -2015,9 +2011,9 @@ Page({ | ||
| 2015 | } | 2011 | } | 
| 2016 | bz_num_ok = be * vv.zhqty; | 2012 | bz_num_ok = be * vv.zhqty; | 
| 2017 | } | 2013 | } | 
| 2018 | - | ||
| 2019 | - for(let i = 0; i < zhqty_bz.length; i++){ | ||
| 2020 | - let item1=zhqty_bz[i]; | 2014 | + | 
| 2015 | + for (let i = 0; i < zhqty_bz.length; i++) { | ||
| 2016 | + let item1 = zhqty_bz[i]; | ||
| 2021 | for (let j = 0; j < be * item1['zhqty']; j++) { | 2017 | for (let j = 0; j < be * item1['zhqty']; j++) { | 
| 2022 | let index = no_in_arr.findIndex(i => { | 2018 | let index = no_in_arr.findIndex(i => { | 
| 2023 | return item1.goods_id === i.goods_id | 2019 | return item1.goods_id === i.goods_id | 
| @@ -2261,14 +2257,14 @@ Page({ | @@ -2261,14 +2257,14 @@ Page({ | ||
| 2261 | 2257 | ||
| 2262 | }, | 2258 | }, | 
| 2263 | 2259 | ||
| 2264 | - zhqty_bz_fun(zhqty_bz,be,zhqty_bz_arr){ | ||
| 2265 | - let zhqty_bz_flag =true; | ||
| 2266 | - for(let i=0;i<zhqty_bz.length;i++){ | ||
| 2267 | - let item=zhqty_bz[i]; | 2260 | + zhqty_bz_fun(zhqty_bz, be, zhqty_bz_arr) { | 
| 2261 | + let zhqty_bz_flag = true; | ||
| 2262 | + for (let i = 0; i < zhqty_bz.length; i++) { | ||
| 2263 | + let item = zhqty_bz[i]; | ||
| 2268 | let bz_num = be * item['zhqty']; //超量倍增 | 2264 | let bz_num = be * item['zhqty']; //超量倍增 | 
| 2269 | let num = item['num'] - item['zhqty']; //购买数量减去超量 | 2265 | let num = item['num'] - item['zhqty']; //购买数量减去超量 | 
| 2270 | if (bz_num > num) { | 2266 | if (bz_num > num) { | 
| 2271 | - zhqty_bz_flag=false; | 2267 | + zhqty_bz_flag = false; | 
| 2272 | zhqty_bz_arr.push(item); | 2268 | zhqty_bz_arr.push(item); | 
| 2273 | // zhqty_bz.splice(i,1) | 2269 | // zhqty_bz.splice(i,1) | 
| 2274 | } | 2270 | } | 
packageB/pages/zuhegou/preindex/index.js
| @@ -11,80 +11,80 @@ let imgDraw = { | @@ -11,80 +11,80 @@ let imgDraw = { | ||
| 11 | "height": "843px", | 11 | "height": "843px", | 
| 12 | "background": "https://mshopimg.yolipai.net/miniapp/images/zhg/bg-zuhegou.jpg", | 12 | "background": "https://mshopimg.yolipai.net/miniapp/images/zhg/bg-zuhegou.jpg", | 
| 13 | "views": [{ // 头像 | 13 | "views": [{ // 头像 | 
| 14 | - "type": "image", | ||
| 15 | - "url": "https://desk-fd.zol-img.com.cn/t_s960x600c5/g5/M00/0F/08/ChMkJlauzXWIDrXBAAdCg2xP7oYAAH9FQOpVAIAB0Kb342.jpg", | ||
| 16 | - "css": { | ||
| 17 | - "width": "100px", | ||
| 18 | - "height": "100px", | ||
| 19 | - "top": "20px", | ||
| 20 | - "left": "275px", | ||
| 21 | - "borderRadius": "100px", | ||
| 22 | - "mode": "scaleToFill", | ||
| 23 | - "borderWidth": "2px", | ||
| 24 | - "borderColor": "#fff", | ||
| 25 | - } | ||
| 26 | - }, | ||
| 27 | - { //昵称 | ||
| 28 | - "type": "text", | ||
| 29 | - "text": "我是店铺名", | ||
| 30 | - "css": { | ||
| 31 | - "width": "650px", | ||
| 32 | - "color": "#fff", | ||
| 33 | - "top": "136px", | ||
| 34 | - // "left": "137px", | ||
| 35 | - "textAlign": "center", | ||
| 36 | - "fontSize": "26px", | ||
| 37 | - "maxLines": "1", | ||
| 38 | - } | ||
| 39 | - }, | ||
| 40 | - { //10元任选3件 | ||
| 41 | - "type": "text", | ||
| 42 | - "text": "10元任选3件", | ||
| 43 | - "css": { | ||
| 44 | - "color": "#fff", | ||
| 45 | - "width": "650px", | ||
| 46 | - "top": "270px", | ||
| 47 | - "fontSize": "70px", | ||
| 48 | - "maxLines": "1", | ||
| 49 | - "textAlign": "center", | ||
| 50 | - "fontWeight": "bold", | ||
| 51 | - } | ||
| 52 | - }, | ||
| 53 | - { //活动时间 | ||
| 54 | - "type": "text", | ||
| 55 | - "text": "活动时间:2021.07.06 - 2021.07.08", | ||
| 56 | - "css": { | ||
| 57 | - "color": "#333", | ||
| 58 | - "width": "650px", | ||
| 59 | - "top": "440px", | ||
| 60 | - "fontSize": "26px", | ||
| 61 | - "fontWeight": "normal", | ||
| 62 | - "maxLines": "1", | ||
| 63 | - "textAlign": "center" | ||
| 64 | - } | ||
| 65 | - }, | ||
| 66 | - { // 码 | ||
| 67 | - "type": "image", | ||
| 68 | - "url": "https://desk-fd.zol-img.com.cn/t_s960x600c5/g5/M00/0F/08/ChMkJlauzXWIDrXBAAdCg2xP7oYAAH9FQOpVAIAB0Kb342.jpg", | ||
| 69 | - "css": { | ||
| 70 | - "color": "#000", | ||
| 71 | - "width": "200px", | ||
| 72 | - "height": "200px", | ||
| 73 | - "top": "525px", | ||
| 74 | - "left": "225px", | ||
| 75 | - } | ||
| 76 | - }, | ||
| 77 | - { // 扫码提示 | ||
| 78 | - "type": "text", | ||
| 79 | - "text": "长按扫码即可参与活动", | ||
| 80 | - "css": { | ||
| 81 | - "color": "#666", | ||
| 82 | - "width": "650px", | ||
| 83 | - "top": "750px", | ||
| 84 | - "fontSize": "26px", | ||
| 85 | - "textAlign": "center" | ||
| 86 | - } | ||
| 87 | - }, | 14 | + "type": "image", | 
| 15 | + "url": "https://desk-fd.zol-img.com.cn/t_s960x600c5/g5/M00/0F/08/ChMkJlauzXWIDrXBAAdCg2xP7oYAAH9FQOpVAIAB0Kb342.jpg", | ||
| 16 | + "css": { | ||
| 17 | + "width": "100px", | ||
| 18 | + "height": "100px", | ||
| 19 | + "top": "20px", | ||
| 20 | + "left": "275px", | ||
| 21 | + "borderRadius": "100px", | ||
| 22 | + "mode": "scaleToFill", | ||
| 23 | + "borderWidth": "2px", | ||
| 24 | + "borderColor": "#fff", | ||
| 25 | + } | ||
| 26 | + }, | ||
| 27 | + { //昵称 | ||
| 28 | + "type": "text", | ||
| 29 | + "text": "我是店铺名", | ||
| 30 | + "css": { | ||
| 31 | + "width": "650px", | ||
| 32 | + "color": "#fff", | ||
| 33 | + "top": "136px", | ||
| 34 | + // "left": "137px", | ||
| 35 | + "textAlign": "center", | ||
| 36 | + "fontSize": "26px", | ||
| 37 | + "maxLines": "1", | ||
| 38 | + } | ||
| 39 | + }, | ||
| 40 | + { //10元任选3件 | ||
| 41 | + "type": "text", | ||
| 42 | + "text": "10元任选3件", | ||
| 43 | + "css": { | ||
| 44 | + "color": "#fff", | ||
| 45 | + "width": "650px", | ||
| 46 | + "top": "270px", | ||
| 47 | + "fontSize": "70px", | ||
| 48 | + "maxLines": "1", | ||
| 49 | + "textAlign": "center", | ||
| 50 | + "fontWeight": "bold", | ||
| 51 | + } | ||
| 52 | + }, | ||
| 53 | + { //活动时间 | ||
| 54 | + "type": "text", | ||
| 55 | + "text": "活动时间:2021.07.06 - 2021.07.08", | ||
| 56 | + "css": { | ||
| 57 | + "color": "#333", | ||
| 58 | + "width": "650px", | ||
| 59 | + "top": "440px", | ||
| 60 | + "fontSize": "26px", | ||
| 61 | + "fontWeight": "normal", | ||
| 62 | + "maxLines": "1", | ||
| 63 | + "textAlign": "center" | ||
| 64 | + } | ||
| 65 | + }, | ||
| 66 | + { // 码 | ||
| 67 | + "type": "image", | ||
| 68 | + "url": "https://desk-fd.zol-img.com.cn/t_s960x600c5/g5/M00/0F/08/ChMkJlauzXWIDrXBAAdCg2xP7oYAAH9FQOpVAIAB0Kb342.jpg", | ||
| 69 | + "css": { | ||
| 70 | + "color": "#000", | ||
| 71 | + "width": "200px", | ||
| 72 | + "height": "200px", | ||
| 73 | + "top": "525px", | ||
| 74 | + "left": "225px", | ||
| 75 | + } | ||
| 76 | + }, | ||
| 77 | + { // 扫码提示 | ||
| 78 | + "type": "text", | ||
| 79 | + "text": "长按扫码即可参与活动", | ||
| 80 | + "css": { | ||
| 81 | + "color": "#666", | ||
| 82 | + "width": "650px", | ||
| 83 | + "top": "750px", | ||
| 84 | + "fontSize": "26px", | ||
| 85 | + "textAlign": "center" | ||
| 86 | + } | ||
| 87 | + }, | ||
| 88 | ] | 88 | ] | 
| 89 | }; | 89 | }; | 
| 90 | 90 | ||
| @@ -153,229 +153,226 @@ Page({ | @@ -153,229 +153,226 @@ Page({ | ||
| 153 | } | 153 | } | 
| 154 | }) | 154 | }) | 
| 155 | } | 155 | } | 
| 156 | - | ||
| 157 | - //如果有会员的时候 | ||
| 158 | - var userInfo = getApp().globalData.userInfo; | ||
| 159 | - if (!userInfo) { | ||
| 160 | - if(getApp().is_Single_page()){ | ||
| 161 | - getApp().goto("/pages/togoin/togoin"); | ||
| 162 | - return false; | ||
| 163 | - } | ||
| 164 | - } | ||
| 165 | }, | 156 | }, | 
| 166 | 157 | ||
| 167 | /** | 158 | /** | 
| 168 | * 生命周期函数--监听页面显示 | 159 | * 生命周期函数--监听页面显示 | 
| 169 | */ | 160 | */ | 
| 170 | onShow: function () { | 161 | onShow: function () { | 
| 171 | - var th = this, | ||
| 172 | - that = this, | ||
| 173 | - ee = this; | ||
| 174 | - this.data.is_timer = 1; | ||
| 175 | - if (this.data.act) this.countDown(); | ||
| 176 | - //如果有会员的时候 | ||
| 177 | - var userInfo = getApp().globalData.userInfo; | ||
| 178 | - if (userInfo) { | ||
| 179 | - if (!th.data.is_get_act) { | ||
| 180 | - //获取活动信息 | ||
| 181 | - var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + th.data.id + "/" + userInfo.user_id; | ||
| 182 | - getApp().request.get(url, { | ||
| 183 | - success: function (e) { | ||
| 184 | - | ||
| 185 | - th.data.is_get_act = 1; | ||
| 186 | - if (e.data.code == 0 && e.data.data) { | ||
| 187 | - self.setData({ | ||
| 188 | - act: e.data.data | ||
| 189 | - }); | ||
| 190 | - if (e.data.data.is_show != 1) { | ||
| 191 | - th.setData({ | ||
| 192 | - error: '活动未开启' | 162 | + getApp().is_Single_page(this, function () { | 
| 163 | + var th = this, | ||
| 164 | + that = this, | ||
| 165 | + ee = this; | ||
| 166 | + this.data.is_timer = 1; | ||
| 167 | + if (this.data.act) this.countDown(); | ||
| 168 | + //如果有会员的时候 | ||
| 169 | + var userInfo = getApp().globalData.userInfo; | ||
| 170 | + if (userInfo) { | ||
| 171 | + if (!th.data.is_get_act) { | ||
| 172 | + //获取活动信息 | ||
| 173 | + var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + th.data.id + "/" + userInfo.user_id; | ||
| 174 | + getApp().request.get(url, { | ||
| 175 | + success: function (e) { | ||
| 176 | + | ||
| 177 | + th.data.is_get_act = 1; | ||
| 178 | + if (e.data.code == 0 && e.data.data) { | ||
| 179 | + self.setData({ | ||
| 180 | + act: e.data.data | ||
| 193 | }); | 181 | }); | 
| 194 | - return false; | ||
| 195 | - } | ||
| 196 | - // if (ut.gettimestamp() < e.data.data.start_time) { | ||
| 197 | - // th.setData({ | ||
| 198 | - // error: '活动还未开始' | ||
| 199 | - // }); | ||
| 200 | - // return false; | ||
| 201 | - // } | ||
| 202 | - if (e.data.data.is_end == 0 && ut.gettimestamp() < e.data.data.end_time) { | ||
| 203 | - //-- 获取商品列表 -- | ||
| 204 | - self.get_list(); | ||
| 205 | - self.countDown(); | 182 | + if (e.data.data.is_show != 1) { | 
| 183 | + th.setData({ | ||
| 184 | + error: '活动未开启' | ||
| 185 | + }); | ||
| 186 | + return false; | ||
| 187 | + } | ||
| 188 | + // if (ut.gettimestamp() < e.data.data.start_time) { | ||
| 189 | + // th.setData({ | ||
| 190 | + // error: '活动还未开始' | ||
| 191 | + // }); | ||
| 192 | + // return false; | ||
| 193 | + // } | ||
| 194 | + if (e.data.data.is_end == 0 && ut.gettimestamp() < e.data.data.end_time) { | ||
| 195 | + //-- 获取商品列表 -- | ||
| 196 | + self.get_list(); | ||
| 197 | + self.countDown(); | ||
| 198 | + } else { | ||
| 199 | + th.setData({ | ||
| 200 | + error: '活动已经过期' | ||
| 201 | + }); | ||
| 202 | + return false; | ||
| 203 | + } | ||
| 206 | } else { | 204 | } else { | 
| 205 | + th.data.is_get_act = 0; | ||
| 207 | th.setData({ | 206 | th.setData({ | 
| 208 | - error: '活动已经过期' | 207 | + error: e.data.msg | 
| 209 | }); | 208 | }); | 
| 210 | return false; | 209 | return false; | 
| 211 | } | 210 | } | 
| 212 | - } else { | ||
| 213 | - th.data.is_get_act = 0; | ||
| 214 | - th.setData({ | ||
| 215 | - error: e.data.msg | ||
| 216 | - }); | ||
| 217 | - return false; | ||
| 218 | } | 211 | } | 
| 219 | - } | ||
| 220 | - }); | ||
| 221 | - } | ||
| 222 | - | ||
| 223 | - //等待活动值 | ||
| 224 | - this.waitfor2(10, 'list', function () { | ||
| 225 | - if (!th.data.list) return false; | ||
| 226 | - if (ut.gettimestamp() < th.data.act.start_time) { | ||
| 227 | - return false; | ||
| 228 | - } | ||
| 229 | - if (th.data.act.is_end == 10 || ut.gettimestamp() >= th.data.act.end_time) { | ||
| 230 | - return false; | 212 | + }); | 
| 231 | } | 213 | } | 
| 232 | - //获取头像的分享 | ||
| 233 | - th.get_head_temp(function () { | ||
| 234 | - var txt = th.data.act.zhprice + "元任选" + th.data.act.zhbuyqty + "件"; | ||
| 235 | - imgDraw.views[0].url = th.data.share_head; | ||
| 236 | - imgDraw.views[1].text = userInfo.nickname; | ||
| 237 | - imgDraw.views[2].text = txt; | ||
| 238 | - | ||
| 239 | - var start = ut.formar_no_full(th.data.act.start_time, '.'); | ||
| 240 | - var end = ut.formar_no_full(th.data.act.end_time, '.'); | ||
| 241 | - txt = "活动时间:" + start + " - " + end; | ||
| 242 | - imgDraw.views[3].text = txt; | ||
| 243 | - | ||
| 244 | - var scene = th.data.id + ""; | ||
| 245 | - var user_id = getApp().globalData.user_id; | ||
| 246 | - scene += "_" + user_id; | ||
| 247 | - ///二微码 | ||
| 248 | - var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + | ||
| 249 | - os.stoid + "?sceneValue=" + scene + "&pageValue=packageB/pages/zuhegou/index/index"; | ||
| 250 | - wx.getImageInfo({ | ||
| 251 | - src: path3, | ||
| 252 | - success: function (res) { | ||
| 253 | - var vpath = res.path; | ||
| 254 | - imgDraw.views[4].url = vpath; | ||
| 255 | - th.setData({ | ||
| 256 | - imgDraw: imgDraw | ||
| 257 | - }) | ||
| 258 | - } | ||
| 259 | - }) | ||
| 260 | - }) | ||
| 261 | 214 | ||
| 262 | - //获取用户的默认门店 | ||
| 263 | - getApp().get_user_store(function (e) { | ||
| 264 | - if (!e) { | ||
| 265 | - th.data.fir_def_store = {}; //赋值空对象 | 215 | + //等待活动值 | 
| 216 | + this.waitfor2(10, 'list', function () { | ||
| 217 | + if (!th.data.list) return false; | ||
| 218 | + if (ut.gettimestamp() < th.data.act.start_time) { | ||
| 266 | return false; | 219 | return false; | 
| 267 | } | 220 | } | 
| 221 | + if (th.data.act.is_end == 10 || ut.gettimestamp() >= th.data.act.end_time) { | ||
| 222 | + return false; | ||
| 223 | + } | ||
| 224 | + //获取头像的分享 | ||
| 225 | + th.get_head_temp(function () { | ||
| 226 | + var txt = th.data.act.zhprice + "元任选" + th.data.act.zhbuyqty + "件"; | ||
| 227 | + imgDraw.views[0].url = th.data.share_head; | ||
| 228 | + imgDraw.views[1].text = userInfo.nickname; | ||
| 229 | + imgDraw.views[2].text = txt; | ||
| 230 | + | ||
| 231 | + var start = ut.formar_no_full(th.data.act.start_time, '.'); | ||
| 232 | + var end = ut.formar_no_full(th.data.act.end_time, '.'); | ||
| 233 | + txt = "活动时间:" + start + " - " + end; | ||
| 234 | + imgDraw.views[3].text = txt; | ||
| 235 | + | ||
| 236 | + var scene = th.data.id + ""; | ||
| 237 | + var user_id = getApp().globalData.user_id; | ||
| 238 | + scene += "_" + user_id; | ||
| 239 | + ///二微码 | ||
| 240 | + var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + | ||
| 241 | + os.stoid + "?sceneValue=" + scene + "&pageValue=packageB/pages/zuhegou/index/index"; | ||
| 242 | + wx.getImageInfo({ | ||
| 243 | + src: path3, | ||
| 244 | + success: function (res) { | ||
| 245 | + var vpath = res.path; | ||
| 246 | + imgDraw.views[4].url = vpath; | ||
| 247 | + th.setData({ | ||
| 248 | + imgDraw: imgDraw | ||
| 249 | + }) | ||
| 250 | + } | ||
| 251 | + }) | ||
| 252 | + }) | ||
| 268 | 253 | ||
| 254 | + //获取用户的默认门店 | ||
| 255 | + getApp().get_user_store(function (e) { | ||
| 256 | + if (!e) { | ||
| 257 | + th.data.fir_def_store = {}; //赋值空对象 | ||
| 258 | + return false; | ||
| 259 | + } | ||
| 269 | 260 | ||
| 270 | 261 | ||
| 271 | - var ee = JSON.parse(JSON.stringify(e)); | ||
| 272 | - var appd = getApp().globalData; | ||
| 273 | - //-- 等待定位系统的开启 -- | ||
| 274 | - th.waitfor2(15, 'is_get_local_ok', function () { | ||
| 275 | 262 | ||
| 276 | - if (!th.data.is_get_local_ok) return false; | 263 | + var ee = JSON.parse(JSON.stringify(e)); | 
| 264 | + var appd = getApp().globalData; | ||
| 265 | + //-- 等待定位系统的开启 -- | ||
| 266 | + th.waitfor2(15, 'is_get_local_ok', function () { | ||
| 277 | 267 | ||
| 278 | - var e = JSON.parse(JSON.stringify(ee)); | ||
| 279 | - //如果有开启近距离的话,同时距离优不一样了 | ||
| 280 | - if (that.data.lat != null) { | ||
| 281 | - //如果经纬度有变化的话 | ||
| 282 | - if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) { | ||
| 283 | - that.set_def_storage(e); | ||
| 284 | - } else { | ||
| 285 | - //要用接口是获取距离,js的计算不准 | ||
| 286 | - getApp().request.promiseGet("/api/weshop/pickup/list", { | ||
| 287 | - data: { | ||
| 288 | - store_id: os.stoid, | ||
| 289 | - pickup_id: e.pickup_id, | ||
| 290 | - is_pos: 1, | ||
| 291 | - lat: th.data.lat, | ||
| 292 | - lon: th.data.lon | ||
| 293 | - }, | ||
| 294 | - }).then(res => { | ||
| 295 | - if (res.data.code == 0) { | ||
| 296 | - e = res.data.data.pageData[0]; | ||
| 297 | - if (e) { | ||
| 298 | - e.is_no_dis = ee.is_no_dis; | ||
| 299 | - appd.pk_store = e; | ||
| 300 | - that.set_def_storage(e); | ||
| 301 | - } | 268 | + if (!th.data.is_get_local_ok) return false; | 
| 302 | 269 | ||
| 303 | - } | ||
| 304 | - }) | ||
| 305 | - } | ||
| 306 | - appd.lat = that.data.lat; | ||
| 307 | - appd.lon = that.data.lon; | ||
| 308 | - } else { | ||
| 309 | - if (e) { | ||
| 310 | - e.distance = null; | ||
| 311 | - that.set_def_storage(e); | ||
| 312 | - } | ||
| 313 | - } | ||
| 314 | - }) | ||
| 315 | - }); | 270 | + var e = JSON.parse(JSON.stringify(ee)); | 
| 271 | + //如果有开启近距离的话,同时距离优不一样了 | ||
| 272 | + if (that.data.lat != null) { | ||
| 273 | + //如果经纬度有变化的话 | ||
| 274 | + if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) { | ||
| 275 | + that.set_def_storage(e); | ||
| 276 | + } else { | ||
| 277 | + //要用接口是获取距离,js的计算不准 | ||
| 278 | + getApp().request.promiseGet("/api/weshop/pickup/list", { | ||
| 279 | + data: { | ||
| 280 | + store_id: os.stoid, | ||
| 281 | + pickup_id: e.pickup_id, | ||
| 282 | + is_pos: 1, | ||
| 283 | + lat: th.data.lat, | ||
| 284 | + lon: th.data.lon | ||
| 285 | + }, | ||
| 286 | + }).then(res => { | ||
| 287 | + if (res.data.code == 0) { | ||
| 288 | + e = res.data.data.pageData[0]; | ||
| 289 | + if (e) { | ||
| 290 | + e.is_no_dis = ee.is_no_dis; | ||
| 291 | + appd.pk_store = e; | ||
| 292 | + that.set_def_storage(e); | ||
| 293 | + } | ||
| 316 | 294 | ||
| 317 | - //----获取系统参数----- | ||
| 318 | - getApp().getConfig2(function (e) { | ||
| 319 | - ee.setData({ | ||
| 320 | - bconfig: e, | ||
| 321 | - sales_rules: e.sales_rules, | ||
| 322 | - }); | ||
| 323 | - //设置基本参数 | ||
| 324 | - th.wait_for_store_config(e); | ||
| 325 | - | ||
| 326 | - var json_d = JSON.parse(e.switch_list); | ||
| 327 | - ee.setData({ | ||
| 328 | - store_config: e, | ||
| 329 | - sys_switch: json_d, | ||
| 330 | - is_closecoupon: json_d.is_closecoupon, | ||
| 331 | - is_newsales_rules: json_d.is_newsales_rules, | ||
| 332 | - is_open_offline: json_d.is_pricing_open, | ||
| 333 | - sales_rules: e.sales_rules | 295 | + } | 
| 296 | + }) | ||
| 297 | + } | ||
| 298 | + appd.lat = that.data.lat; | ||
| 299 | + appd.lon = that.data.lon; | ||
| 300 | + } else { | ||
| 301 | + if (e) { | ||
| 302 | + e.distance = null; | ||
| 303 | + that.set_def_storage(e); | ||
| 304 | + } | ||
| 305 | + } | ||
| 306 | + }) | ||
| 334 | }); | 307 | }); | 
| 335 | 308 | ||
| 336 | - //-- 计算等级价相关 -- | ||
| 337 | - var swithc_list = e.switch_list; | ||
| 338 | - var sw_arr = JSON.parse(swithc_list); | ||
| 339 | - //---如果后台又开等级卡的开关--- | ||
| 340 | - if (sw_arr.rank_switch && sw_arr.rank_switch == "2") { | ||
| 341 | - th.setData({ | ||
| 342 | - rank_switch: true | 309 | + //----获取系统参数----- | 
| 310 | + getApp().getConfig2(function (e) { | ||
| 311 | + ee.setData({ | ||
| 312 | + bconfig: e, | ||
| 313 | + sales_rules: e.sales_rules, | ||
| 343 | }); | 314 | }); | 
| 344 | - //---回调卡的列表--- | ||
| 345 | - th.getPlusCardType(function (ob) { | 315 | + //设置基本参数 | 
| 316 | + th.wait_for_store_config(e); | ||
| 317 | + | ||
| 318 | + var json_d = JSON.parse(e.switch_list); | ||
| 319 | + ee.setData({ | ||
| 320 | + store_config: e, | ||
| 321 | + sys_switch: json_d, | ||
| 322 | + is_closecoupon: json_d.is_closecoupon, | ||
| 323 | + is_newsales_rules: json_d.is_newsales_rules, | ||
| 324 | + is_open_offline: json_d.is_pricing_open, | ||
| 325 | + sales_rules: e.sales_rules | ||
| 326 | + }); | ||
| 327 | + | ||
| 328 | + //-- 计算等级价相关 -- | ||
| 329 | + var swithc_list = e.switch_list; | ||
| 330 | + var sw_arr = JSON.parse(swithc_list); | ||
| 331 | + //---如果后台又开等级卡的开关--- | ||
| 332 | + if (sw_arr.rank_switch && sw_arr.rank_switch == "2") { | ||
| 346 | th.setData({ | 333 | th.setData({ | 
| 347 | - card_list: ob.card_list | 334 | + rank_switch: true | 
| 348 | }); | 335 | }); | 
| 349 | - var user = getApp().globalData.userInfo; | ||
| 350 | - if (!user) return false; | ||
| 351 | - if (user.card_field && user['card_expiredate']) { | ||
| 352 | - var str = user['card_expiredate'].replace(/-/g, '/'); | ||
| 353 | - var end = new Date(str); | ||
| 354 | - end = Date.parse(end) / 1000; | ||
| 355 | - var now = ut.gettimestamp(); | ||
| 356 | - //--- 判断是等级会员,且在有效期范围内 --- | ||
| 357 | - if (user.card_field && now < end) { | ||
| 358 | - var card_name = ob.name_map.get(user.card_field); | ||
| 359 | - th.setData({ | ||
| 360 | - card_field: user.card_field, | ||
| 361 | - card_name: card_name, | ||
| 362 | - card_list: ob.card_list | ||
| 363 | - }); | 336 | + //---回调卡的列表--- | 
| 337 | + th.getPlusCardType(function (ob) { | ||
| 338 | + th.setData({ | ||
| 339 | + card_list: ob.card_list | ||
| 340 | + }); | ||
| 341 | + var user = getApp().globalData.userInfo; | ||
| 342 | + if (!user) return false; | ||
| 343 | + if (user.card_field && user['card_expiredate']) { | ||
| 344 | + var str = user['card_expiredate'].replace(/-/g, '/'); | ||
| 345 | + var end = new Date(str); | ||
| 346 | + end = Date.parse(end) / 1000; | ||
| 347 | + var now = ut.gettimestamp(); | ||
| 348 | + //--- 判断是等级会员,且在有效期范围内 --- | ||
| 349 | + if (user.card_field && now < end) { | ||
| 350 | + var card_name = ob.name_map.get(user.card_field); | ||
| 351 | + th.setData({ | ||
| 352 | + card_field: user.card_field, | ||
| 353 | + card_name: card_name, | ||
| 354 | + card_list: ob.card_list | ||
| 355 | + }); | ||
| 356 | + } | ||
| 364 | } | 357 | } | 
| 365 | - } | 358 | + //获取购物车的内容 | 
| 359 | + th.get_cart_val(e); | ||
| 360 | + | ||
| 361 | + }) | ||
| 362 | + } else { | ||
| 366 | //获取购物车的内容 | 363 | //获取购物车的内容 | 
| 367 | th.get_cart_val(e); | 364 | th.get_cart_val(e); | 
| 365 | + } | ||
| 366 | + }, 1); | ||
| 368 | 367 | ||
| 369 | - }) | ||
| 370 | - } else { | ||
| 371 | - //获取购物车的内容 | ||
| 372 | - th.get_cart_val(e); | ||
| 373 | - } | ||
| 374 | - }, 1); | 368 | + }) | 
| 375 | 369 | ||
| 376 | - }) | 370 | + } else { | 
| 371 | + getApp().goto("/pages/togoin/togoin"); | ||
| 372 | + return false; | ||
| 373 | + } | ||
| 374 | + }) | ||
| 377 | 375 | ||
| 378 | - } | ||
| 379 | }, | 376 | }, | 
| 380 | 377 | ||
| 381 | onHide: function () { | 378 | onHide: function () { | 
| @@ -1898,7 +1895,7 @@ Page({ | @@ -1898,7 +1895,7 @@ Page({ | ||
| 1898 | 1895 | ||
| 1899 | getApp().request.put("/api/weshop/cart/update", { | 1896 | getApp().request.put("/api/weshop/cart/update", { | 
| 1900 | data: updata, | 1897 | data: updata, | 
| 1901 | - success: function (t) {} | 1898 | + success: function (t) { } | 
| 1902 | }); | 1899 | }); | 
| 1903 | th.re_sum_price(); | 1900 | th.re_sum_price(); | 
| 1904 | }) | 1901 | }) | 
| @@ -1917,7 +1914,7 @@ Page({ | @@ -1917,7 +1914,7 @@ Page({ | ||
| 1917 | var need_to_buy = 0; | 1914 | var need_to_buy = 0; | 
| 1918 | var data = this.data.list; | 1915 | var data = this.data.list; | 
| 1919 | var all_zhqty = 0; //所有商品要求起购数之后 | 1916 | var all_zhqty = 0; //所有商品要求起购数之后 | 
| 1920 | - var zhqty_bz=[]; //超量 | 1917 | + var zhqty_bz = []; //超量 | 
| 1921 | var no_in_arr = []; | 1918 | var no_in_arr = []; | 
| 1922 | for (var i in data) { | 1919 | for (var i in data) { | 
| 1923 | var item = data[i]; | 1920 | var item = data[i]; | 
| @@ -1968,28 +1965,28 @@ Page({ | @@ -1968,28 +1965,28 @@ Page({ | ||
| 1968 | 1965 | ||
| 1969 | //看一下剩下的数量有没有满足组合购的要求,以及要不要倍增 | 1966 | //看一下剩下的数量有没有满足组合购的要求,以及要不要倍增 | 
| 1970 | if (this.data.act.is_bz && no_in_arr.length >= this.data.act.zhbuyqty) { | 1967 | if (this.data.act.is_bz && no_in_arr.length >= this.data.act.zhbuyqty) { | 
| 1971 | - let zhqty_map=new map(); | ||
| 1972 | - //看一下是几倍 | 1968 | + let zhqty_map = new map(); | 
| 1969 | + //看一下是几倍 | ||
| 1973 | var be = parseInt(no_in_arr.length / this.data.act.zhbuyqty); | 1970 | var be = parseInt(no_in_arr.length / this.data.act.zhbuyqty); | 
| 1974 | - if(this.data.act.is_bzyh && zhqty_bz.length > 0 ){ | ||
| 1975 | - for(let i=0;i<zhqty_bz.length;i++){ | ||
| 1976 | - let vv=zhqty_bz[i]; | ||
| 1977 | - let num=0; | ||
| 1978 | - let bz_num=be*vv.zhqty; | ||
| 1979 | - for(let j=0;j<no_in_arr.length;j++){ | ||
| 1980 | - let ii=no_in_arr[j]; | ||
| 1981 | - if(vv.goods_id===ii.goods_id){ | 1971 | + if (this.data.act.is_bzyh && zhqty_bz.length > 0) { | 
| 1972 | + for (let i = 0; i < zhqty_bz.length; i++) { | ||
| 1973 | + let vv = zhqty_bz[i]; | ||
| 1974 | + let num = 0; | ||
| 1975 | + let bz_num = be * vv.zhqty; | ||
| 1976 | + for (let j = 0; j < no_in_arr.length; j++) { | ||
| 1977 | + let ii = no_in_arr[j]; | ||
| 1978 | + if (vv.goods_id === ii.goods_id) { | ||
| 1982 | num++; | 1979 | num++; | 
| 1983 | - zhqty_map.set('num',num); | ||
| 1984 | - zhqty_map.set('price',ii.price); | 1980 | + zhqty_map.set('num', num); | 
| 1981 | + zhqty_map.set('price', ii.price); | ||
| 1985 | } | 1982 | } | 
| 1986 | - | 1983 | + | 
| 1987 | } | 1984 | } | 
| 1988 | } | 1985 | } | 
| 1989 | } | 1986 | } | 
| 1990 | - if(bz_num <= num){ | 1987 | + if (bz_num <= num) { | 
| 1991 | aprice += be * aprice; | 1988 | aprice += be * aprice; | 
| 1992 | - let pop_num=(be * this.data.act.zhbuyqty)-bz_num; | 1989 | + let pop_num = (be * this.data.act.zhbuyqty) - bz_num; | 
| 1993 | console.log(pop_num); | 1990 | console.log(pop_num); | 
| 1994 | for (var m = 0; m < pop_num; m++) { | 1991 | for (var m = 0; m < pop_num; m++) { | 
| 1995 | no_in_arr.pop(); | 1992 | no_in_arr.pop(); | 
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
| @@ -8,7 +8,7 @@ var t = require("../../../../utils/util.js"), | @@ -8,7 +8,7 @@ var t = require("../../../../utils/util.js"), | ||
| 8 | oo = s.globalData, | 8 | oo = s.globalData, | 
| 9 | o = s.globalData.setting, | 9 | o = s.globalData.setting, | 
| 10 | os = o; | 10 | os = o; | 
| 11 | - | 11 | + | 
| 12 | //评价加载更多 | 12 | //评价加载更多 | 
| 13 | var more = function (e) { | 13 | var more = function (e) { | 
| 14 | return e && e.__esModule ? e : { | 14 | return e && e.__esModule ? e : { | 
| @@ -251,48 +251,48 @@ Page({ | @@ -251,48 +251,48 @@ Page({ | ||
| 251 | fir_goods: null, | 251 | fir_goods: null, | 
| 252 | 252 | ||
| 253 | share_hidden: false, | 253 | share_hidden: false, | 
| 254 | - | ||
| 255 | - showRules: false, // 控制规则显示与隐藏 | ||
| 256 | - showReward: false, //控制查看奖励显示与隐藏 | ||
| 257 | - | ||
| 258 | - typeArr: [{ | ||
| 259 | - key: 'point', | ||
| 260 | - name: '积分', | ||
| 261 | - },{ | ||
| 262 | - key: 'grow', | ||
| 263 | - name: '成长值', | ||
| 264 | - },{ | ||
| 265 | - key: 'point', | ||
| 266 | - name: '优惠券', | ||
| 267 | - },{ | ||
| 268 | - key: 'prestore_name', | ||
| 269 | - name: '项目服务', | ||
| 270 | - },{ | ||
| 271 | - key: 'prestore_money', | ||
| 272 | - name: '预存金额', | ||
| 273 | - }], | ||
| 274 | - | ||
| 275 | - | ||
| 276 | - luckGoInfo: {}, | ||
| 277 | - showDetails: false, | ||
| 278 | - num_success: 0, //成团已中商品数量 | ||
| 279 | - isTimeUp: false, | ||
| 280 | - | ||
| 281 | - surplus: 0, | ||
| 282 | - canBuy: false, | ||
| 283 | - btnHidden: false, | 254 | + | 
| 255 | + showRules: false, // 控制规则显示与隐藏 | ||
| 256 | + showReward: false, //控制查看奖励显示与隐藏 | ||
| 257 | + | ||
| 258 | + typeArr: [{ | ||
| 259 | + key: 'point', | ||
| 260 | + name: '积分', | ||
| 261 | + }, { | ||
| 262 | + key: 'grow', | ||
| 263 | + name: '成长值', | ||
| 264 | + }, { | ||
| 265 | + key: 'point', | ||
| 266 | + name: '优惠券', | ||
| 267 | + }, { | ||
| 268 | + key: 'prestore_name', | ||
| 269 | + name: '项目服务', | ||
| 270 | + }, { | ||
| 271 | + key: 'prestore_money', | ||
| 272 | + name: '预存金额', | ||
| 273 | + }], | ||
| 274 | + | ||
| 275 | + | ||
| 276 | + luckGoInfo: {}, | ||
| 277 | + showDetails: false, | ||
| 278 | + num_success: 0, //成团已中商品数量 | ||
| 279 | + isTimeUp: false, | ||
| 280 | + | ||
| 281 | + surplus: 0, | ||
| 282 | + canBuy: false, | ||
| 283 | + btnHidden: false, | ||
| 284 | }, | 284 | }, | 
| 285 | 285 | ||
| 286 | //------初始化加载---------- | 286 | //------初始化加载---------- | 
| 287 | onLoad: function (t) { | 287 | onLoad: function (t) { | 
| 288 | - | 288 | + | 
| 289 | // console.log('onload'); | 289 | // console.log('onload'); | 
| 290 | - if(t && t.group_id) { | ||
| 291 | - this.data.group_id = t.group_id; | ||
| 292 | - }; | ||
| 293 | - | 290 | + if (t && t.group_id) { | 
| 291 | + this.data.group_id = t.group_id; | ||
| 292 | + }; | ||
| 293 | + | ||
| 294 | + | ||
| 294 | 295 | ||
| 295 | - | ||
| 296 | var ee = this, | 296 | var ee = this, | 
| 297 | that = ee, | 297 | that = ee, | 
| 298 | th = ee, | 298 | th = ee, | 
| @@ -303,45 +303,45 @@ Page({ | @@ -303,45 +303,45 @@ Page({ | ||
| 303 | prom_type = t.prom_type, | 303 | prom_type = t.prom_type, | 
| 304 | prom_id = t.group_id; //活动ID | 304 | prom_id = t.group_id; //活动ID | 
| 305 | 305 | ||
| 306 | - if(prom_type) { | ||
| 307 | - // this.data.prom_type = prom_type; | ||
| 308 | - // this.data.prom_id = prom_id; | ||
| 309 | - this.setData({ | ||
| 310 | - prom_type, | ||
| 311 | - prom_id, | ||
| 312 | - }); | ||
| 313 | - } | ||
| 314 | - | ||
| 315 | - | 306 | + if (prom_type) { | 
| 307 | + // this.data.prom_type = prom_type; | ||
| 308 | + // this.data.prom_id = prom_id; | ||
| 309 | + this.setData({ | ||
| 310 | + prom_type, | ||
| 311 | + prom_id, | ||
| 312 | + }); | ||
| 313 | + } | ||
| 314 | + | ||
| 315 | + | ||
| 316 | 316 | ||
| 317 | 317 | ||
| 318 | //---获取手机地址坐标-- | 318 | //---获取手机地址坐标-- | 
| 319 | //--如果tg_id是空的话,分享回来-- | 319 | //--如果tg_id是空的话,分享回来-- | 
| 320 | - // console.log('扫描海报gid'); | 320 | + // console.log('扫描海报gid'); | 
| 321 | if (gid == undefined || gid == null || gid == "") { | 321 | if (gid == undefined || gid == null || gid == "") { | 
| 322 | var gid_str = decodeURIComponent(t.scene); | 322 | var gid_str = decodeURIComponent(t.scene); | 
| 323 | gid_str = gid_str.split("_"); | 323 | gid_str = gid_str.split("_"); | 
| 324 | gid = gid_str[0]; | 324 | gid = gid_str[0]; | 
| 325 | - if(gid.indexOf('.')!=-1) { | ||
| 326 | - var fir_arr=gid.split("."); | ||
| 327 | - gid=fir_arr[0]; | ||
| 328 | - prom_type=fir_arr[1]; | ||
| 329 | - prom_id=fir_arr[2]; | ||
| 330 | - // this.setData({ | ||
| 331 | - // prom_type: prom_type, | ||
| 332 | - // prom_id: prom_id, | ||
| 333 | - // group_id: fir_arr[2], | ||
| 334 | - // }); | ||
| 335 | - this.data.prom_type=prom_type; | ||
| 336 | - this.data.prom_id=prom_id; | ||
| 337 | - this.data.group_id = fir_arr[2]; | 325 | + if (gid.indexOf('.') != -1) { | 
| 326 | + var fir_arr = gid.split("."); | ||
| 327 | + gid = fir_arr[0]; | ||
| 328 | + prom_type = fir_arr[1]; | ||
| 329 | + prom_id = fir_arr[2]; | ||
| 330 | + // this.setData({ | ||
| 331 | + // prom_type: prom_type, | ||
| 332 | + // prom_id: prom_id, | ||
| 333 | + // group_id: fir_arr[2], | ||
| 334 | + // }); | ||
| 335 | + this.data.prom_type = prom_type; | ||
| 336 | + this.data.prom_id = prom_id; | ||
| 337 | + this.data.group_id = fir_arr[2]; | ||
| 338 | } | 338 | } | 
| 339 | 339 | ||
| 340 | 340 | ||
| 341 | if (gid_str.length > 1) { | 341 | if (gid_str.length > 1) { | 
| 342 | first_leader = gid_str[1]; | 342 | first_leader = gid_str[1]; | 
| 343 | } | 343 | } | 
| 344 | - | 344 | + | 
| 345 | //-- 如果有room_id的获取 -- | 345 | //-- 如果有room_id的获取 -- | 
| 346 | if (gid_str.length > 2 && gid_str[2]) { | 346 | if (gid_str.length > 2 && gid_str[2]) { | 
| 347 | room_id = gid_str[2]; | 347 | room_id = gid_str[2]; | 
| @@ -351,7 +351,7 @@ Page({ | @@ -351,7 +351,7 @@ Page({ | ||
| 351 | } | 351 | } | 
| 352 | 352 | ||
| 353 | ee.setData({ gid: gid }); | 353 | ee.setData({ gid: gid }); | 
| 354 | - | 354 | + | 
| 355 | if (first_leader) { | 355 | if (first_leader) { | 
| 356 | 356 | ||
| 357 | getApp().globalData.first_leader = first_leader; | 357 | getApp().globalData.first_leader = first_leader; | 
| @@ -418,10 +418,10 @@ Page({ | @@ -418,10 +418,10 @@ Page({ | ||
| 418 | th.requestCardNum(), wx.pageScrollTo && th.setData({ | 418 | th.requestCardNum(), wx.pageScrollTo && th.setData({ | 
| 419 | supportPageScroll: !0 | 419 | supportPageScroll: !0 | 
| 420 | }); | 420 | }); | 
| 421 | - | ||
| 422 | - | ||
| 423 | - | ||
| 424 | - | 421 | + | 
| 422 | + | ||
| 423 | + | ||
| 424 | + | ||
| 425 | 425 | ||
| 426 | //计算等级价相关 | 426 | //计算等级价相关 | 
| 427 | var swithc_list = e.switch_list; | 427 | var swithc_list = e.switch_list; | 
| @@ -496,7 +496,7 @@ Page({ | @@ -496,7 +496,7 @@ Page({ | ||
| 496 | } else { | 496 | } else { | 
| 497 | //要用接口是获取距离,js的计算不准 | 497 | //要用接口是获取距离,js的计算不准 | 
| 498 | getApp().request.promiseGet("/api/weshop/pickup/list", { | 498 | getApp().request.promiseGet("/api/weshop/pickup/list", { | 
| 499 | - data: { store_id: os.stoid, pickup_id: e.pickup_id, lat: th.data.lat, lon: th.data.lon,is_pos:1 }, | 499 | + data: { store_id: os.stoid, pickup_id: e.pickup_id, lat: th.data.lat, lon: th.data.lon, is_pos: 1 }, | 
| 500 | }).then(res => { | 500 | }).then(res => { | 
| 501 | if (res.data.code == 0) { | 501 | if (res.data.code == 0) { | 
| 502 | e = res.data.data.pageData[0]; | 502 | e = res.data.data.pageData[0]; | 
| @@ -532,15 +532,14 @@ Page({ | @@ -532,15 +532,14 @@ Page({ | ||
| 532 | //--先判断会员登陆状态-- | 532 | //--先判断会员登陆状态-- | 
| 533 | var user_info = getApp().globalData.userInfo; | 533 | var user_info = getApp().globalData.userInfo; | 
| 534 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | 534 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | 
| 535 | - | ||
| 536 | - if(getApp().is_Single_page()){ | 535 | + | 
| 536 | + getApp().is_Single_page(th, function () { | ||
| 537 | wx.navigateTo({ | 537 | wx.navigateTo({ | 
| 538 | url: '/pages/togoin/togoin', | 538 | url: '/pages/togoin/togoin', | 
| 539 | - }) | 539 | + }) | 
| 540 | return false; | 540 | return false; | 
| 541 | - } | 541 | + }) | 
| 542 | } | 542 | } | 
| 543 | - | ||
| 544 | }, | 543 | }, | 
| 545 | 544 | ||
| 546 | 545 | ||
| @@ -636,7 +635,7 @@ Page({ | @@ -636,7 +635,7 @@ Page({ | ||
| 636 | } | 635 | } | 
| 637 | gallery = g; | 636 | gallery = g; | 
| 638 | }) | 637 | }) | 
| 639 | - | 638 | + | 
| 640 | //------是否收藏---------- | 639 | //------是否收藏---------- | 
| 641 | await getApp().request.promiseGet("/api/weshop/goodscollect/page", { | 640 | await getApp().request.promiseGet("/api/weshop/goodscollect/page", { | 
| 642 | data: { | 641 | data: { | 
| @@ -704,7 +703,7 @@ Page({ | @@ -704,7 +703,7 @@ Page({ | ||
| 704 | } | 703 | } | 
| 705 | } | 704 | } | 
| 706 | 705 | ||
| 707 | - if (th.data.is_closecoupon != 1 && (!th.data.fir_quan || th.data.fir_quan.length<=0)) { | 706 | + if (th.data.is_closecoupon != 1 && (!th.data.fir_quan || th.data.fir_quan.length <= 0)) { | 
| 708 | //----获取详情页的券的数量---- | 707 | //----获取详情页的券的数量---- | 
| 709 | await getApp().request.promiseGet("/api/weshop/prom/coupon/pageCouponList", { | 708 | await getApp().request.promiseGet("/api/weshop/prom/coupon/pageCouponList", { | 
| 710 | data: { | 709 | data: { | 
| @@ -728,16 +727,16 @@ Page({ | @@ -728,16 +727,16 @@ Page({ | ||
| 728 | mapurl_f_img = res1.data.data.video_img; | 727 | mapurl_f_img = res1.data.data.video_img; | 
| 729 | } | 728 | } | 
| 730 | }) | 729 | }) | 
| 731 | - | ||
| 732 | - | ||
| 733 | - | ||
| 734 | - | ||
| 735 | - | ||
| 736 | - | ||
| 737 | - | ||
| 738 | - | ||
| 739 | - | ||
| 740 | - | 730 | + | 
| 731 | + | ||
| 732 | + | ||
| 733 | + | ||
| 734 | + | ||
| 735 | + | ||
| 736 | + | ||
| 737 | + | ||
| 738 | + | ||
| 739 | + | ||
| 741 | 740 | ||
| 742 | ee.setData({ | 741 | ee.setData({ | 
| 743 | gallery: gallery, | 742 | gallery: gallery, | 
| @@ -754,7 +753,7 @@ Page({ | @@ -754,7 +753,7 @@ Page({ | ||
| 754 | 753 | ||
| 755 | //---展示--- | 754 | //---展示--- | 
| 756 | onShow: async function () { | 755 | onShow: async function () { | 
| 757 | - // console.log('onshow'); | 756 | + // console.log('onshow'); | 
| 758 | var goods_list = null, th = this, that = this; | 757 | var goods_list = null, th = this, that = this; | 
| 759 | var show_prew_img = this.data.show_prew_img | 758 | var show_prew_img = this.data.show_prew_img | 
| 760 | if (show_prew_img) { | 759 | if (show_prew_img) { | 
| @@ -764,57 +763,57 @@ Page({ | @@ -764,57 +763,57 @@ Page({ | ||
| 764 | 763 | ||
| 765 | // 判断活动是否暂停 | 764 | // 判断活动是否暂停 | 
| 766 | //获取单个活动成团信息 | 765 | //获取单个活动成团信息 | 
| 767 | - await getApp().request.promiseGet('/api/weshop/prom/luckyActivity/page', { | ||
| 768 | - data: { | ||
| 769 | - store_id: o.stoid, | ||
| 770 | - is_end: 0, | ||
| 771 | - timetype: 1, | ||
| 772 | - id: this.data.group_id, | ||
| 773 | - } | ||
| 774 | - }).then(res => { | ||
| 775 | - // console.log() | ||
| 776 | - // console.log('判断活动是否暂停=======》', res.data.data); | ||
| 777 | - if (res.data.code == 0) { | ||
| 778 | - if(res.data.data.pageData && res.data.data.pageData.length == 0) { | ||
| 779 | - let obj = { | ||
| 780 | - day: '00', | ||
| 781 | - hou: '00', | ||
| 782 | - min: '00', | ||
| 783 | - sec: '00' | ||
| 784 | - }; | ||
| 785 | - | ||
| 786 | - th.setData({ | ||
| 787 | - djs: obj, | ||
| 788 | - isTimeUp: true, | ||
| 789 | - }); | ||
| 790 | - } else { | ||
| 791 | - th.setData({ | ||
| 792 | - luckGoInfo: res.data.data.pageData[0], | ||
| 793 | - team_id: res.data.data.pageData[0].team_id, | ||
| 794 | - luckGoMembers: [], | ||
| 795 | - }); | ||
| 796 | - | ||
| 797 | - th.countDown(th.data.luckGoInfo.end_time, 0); | ||
| 798 | - }; | ||
| 799 | - | ||
| 800 | - } else { | 766 | + await getApp().request.promiseGet('/api/weshop/prom/luckyActivity/page', { | 
| 767 | + data: { | ||
| 768 | + store_id: o.stoid, | ||
| 769 | + is_end: 0, | ||
| 770 | + timetype: 1, | ||
| 771 | + id: this.data.group_id, | ||
| 772 | + } | ||
| 773 | + }).then(res => { | ||
| 774 | + // console.log() | ||
| 775 | + // console.log('判断活动是否暂停=======》', res.data.data); | ||
| 776 | + if (res.data.code == 0) { | ||
| 777 | + if (res.data.data.pageData && res.data.data.pageData.length == 0) { | ||
| 778 | + let obj = { | ||
| 779 | + day: '00', | ||
| 780 | + hou: '00', | ||
| 781 | + min: '00', | ||
| 782 | + sec: '00' | ||
| 783 | + }; | ||
| 784 | + | ||
| 785 | + th.setData({ | ||
| 786 | + djs: obj, | ||
| 787 | + isTimeUp: true, | ||
| 788 | + }); | ||
| 789 | + } else { | ||
| 790 | + th.setData({ | ||
| 791 | + luckGoInfo: res.data.data.pageData[0], | ||
| 792 | + team_id: res.data.data.pageData[0].team_id, | ||
| 793 | + luckGoMembers: [], | ||
| 794 | + }); | ||
| 795 | + | ||
| 796 | + th.countDown(th.data.luckGoInfo.end_time, 0); | ||
| 797 | + }; | ||
| 798 | + | ||
| 799 | + } else { | ||
| 801 | // this.data.isTimeUp = true; | 800 | // this.data.isTimeUp = true; | 
| 802 | - th.setData({ | ||
| 803 | - isTimeUp: true, | 801 | + th.setData({ | 
| 802 | + isTimeUp: true, | ||
| 804 | }); | 803 | }); | 
| 805 | - | ||
| 806 | - }; | ||
| 807 | - | ||
| 808 | - | 804 | + | 
| 805 | + }; | ||
| 806 | + | ||
| 807 | + | ||
| 809 | }); | 808 | }); | 
| 810 | - | 809 | + | 
| 811 | // 活动暂停显示空白 | 810 | // 活动暂停显示空白 | 
| 812 | if (this.data.isTimeUp) { | 811 | if (this.data.isTimeUp) { | 
| 813 | wx.showModal({ | 812 | wx.showModal({ | 
| 814 | title: '提示', | 813 | title: '提示', | 
| 815 | content: '活动已经暂停', | 814 | content: '活动已经暂停', | 
| 816 | showCancel: false, | 815 | showCancel: false, | 
| 817 | - success: function(){ | 816 | + success: function () { | 
| 818 | wx.navigateBack(); | 817 | wx.navigateBack(); | 
| 819 | } | 818 | } | 
| 820 | }) | 819 | }) | 
| @@ -883,18 +882,18 @@ Page({ | @@ -883,18 +882,18 @@ Page({ | ||
| 883 | }); | 882 | }); | 
| 884 | } | 883 | } | 
| 885 | } | 884 | } | 
| 886 | - | 885 | + | 
| 887 | //动态获取商品名称 | 886 | //动态获取商品名称 | 
| 888 | wx.setNavigationBarTitle({ | 887 | wx.setNavigationBarTitle({ | 
| 889 | title: t.data.data.goods_name, | 888 | title: t.data.data.goods_name, | 
| 890 | }); | 889 | }); | 
| 891 | 890 | ||
| 892 | - | 891 | + | 
| 893 | 892 | ||
| 894 | //-- 把商品的赋值 -- | 893 | //-- 把商品的赋值 -- | 
| 895 | ee.data.fir_goods = JSON.parse(JSON.stringify(t.data.data)); | 894 | ee.data.fir_goods = JSON.parse(JSON.stringify(t.data.data)); | 
| 896 | - if(ee.data.prom_type!=1 && ee.data.prom_type!=4 && ee.data.prom_type!=6) | ||
| 897 | - ee.check_is_youhui(ee.data.gid); | 895 | + if (ee.data.prom_type != 1 && ee.data.prom_type != 4 && ee.data.prom_type != 6) | 
| 896 | + ee.check_is_youhui(ee.data.gid); | ||
| 898 | 897 | ||
| 899 | t.data.data.on_time = ut.formatTime(t.data.data.on_time, 'yyyy-MM-dd hh:mm:ss'); | 898 | t.data.data.on_time = ut.formatTime(t.data.data.on_time, 'yyyy-MM-dd hh:mm:ss'); | 
| 900 | 899 | ||
| @@ -920,12 +919,12 @@ Page({ | @@ -920,12 +919,12 @@ Page({ | ||
| 920 | a.wxParse("content", "html", t.data.data.goods_content, ee, 6); | 919 | a.wxParse("content", "html", t.data.data.goods_content, ee, 6); | 
| 921 | e.wxParseAddFullImageUrl(ee, "content"); | 920 | e.wxParseAddFullImageUrl(ee, "content"); | 
| 922 | 921 | ||
| 923 | - if(ee.data.prom_type){ | ||
| 924 | - //999 | ||
| 925 | - t.data.data.prom_type=ee.data.prom_type; | ||
| 926 | - t.data.data.prom_id=ee.data.prom_id; | 922 | + if (ee.data.prom_type) { | 
| 923 | + //999 | ||
| 924 | + t.data.data.prom_type = ee.data.prom_type; | ||
| 925 | + t.data.data.prom_id = ee.data.prom_id; | ||
| 927 | } | 926 | } | 
| 928 | - | 927 | + | 
| 929 | ee.setData({ | 928 | ee.setData({ | 
| 930 | data: t.data.data, | 929 | data: t.data.data, | 
| 931 | sele_g: t.data.data, | 930 | sele_g: t.data.data, | 
| @@ -938,7 +937,7 @@ Page({ | @@ -938,7 +937,7 @@ Page({ | ||
| 938 | //默认门店要拿下门店库存 | 937 | //默认门店要拿下门店库存 | 
| 939 | // if (that.data.sales_rules == 2 && that.data.is_newsales_rules) { | 938 | // if (that.data.sales_rules == 2 && that.data.is_newsales_rules) { | 
| 940 | // //获取门店 | 939 | // //获取门店 | 
| 941 | - // ee.get_sto(1); | 940 | + // ee.get_sto(1); | 
| 942 | 941 | ||
| 943 | // } else { | 942 | // } else { | 
| 944 | // //获取门店 | 943 | // //获取门店 | 
| @@ -1024,112 +1023,112 @@ Page({ | @@ -1024,112 +1023,112 @@ Page({ | ||
| 1024 | this.data.enterAddressPage && (this.data.enterAddressPage = !1); | 1023 | this.data.enterAddressPage && (this.data.enterAddressPage = !1); | 
| 1025 | 1024 | ||
| 1026 | 1025 | ||
| 1027 | - //获取单个活动已成团数量 | ||
| 1028 | - getApp().request.get(`/api/weshop/prom/luckyTeam/getCtNum/${o.stoid}/${this.data.group_id}`, { | ||
| 1029 | - success: function (res) { | ||
| 1030 | - if(res.data.code == 0) { | ||
| 1031 | - th.setData({ | ||
| 1032 | - group_num: res.data.data, | ||
| 1033 | - }); | ||
| 1034 | - } | ||
| 1035 | - } | ||
| 1036 | - }); | ||
| 1037 | - | ||
| 1038 | - | ||
| 1039 | - //获取单个活动中奖记录 | ||
| 1040 | - getApp().request.promiseGet('/api/weshop/prom/luckyOrder/page', { | ||
| 1041 | - data: { | ||
| 1042 | - store_id: os.stoid, | ||
| 1043 | - team_status: 2, | ||
| 1044 | - goods_id: this.data.gid, | ||
| 1045 | - rndid: 1, | ||
| 1046 | - } | ||
| 1047 | - }).then(res => { | ||
| 1048 | - if (res.data.code == 0) { | ||
| 1049 | - th.setData({ | ||
| 1050 | - luckGoWinners: res.data.data.pageData, | ||
| 1051 | - }); | ||
| 1052 | - } | ||
| 1053 | - }); | ||
| 1054 | - | ||
| 1055 | - | ||
| 1056 | - //获取单个活动成团已中商品数量 | ||
| 1057 | - let url_num_success = `/api/weshop/prom/luckyOrder/countActNum/${os.stoid}/${this.data.group_id}`; | ||
| 1058 | - getApp().request.get(url_num_success, { | ||
| 1059 | - success: function (res) { | ||
| 1060 | - if (res.data.code == 0) { | ||
| 1061 | - console.log('成团已中商品数量汇总',res.data.data); | ||
| 1062 | - th.setData({ | ||
| 1063 | - num_success: res.data.data, | ||
| 1064 | - }); | ||
| 1065 | - } | ||
| 1066 | - } | ||
| 1067 | - }); | ||
| 1068 | - | ||
| 1069 | - | ||
| 1070 | - | ||
| 1071 | - | ||
| 1072 | - | ||
| 1073 | - // 获取购买次数,判断是否已经超出限购 | ||
| 1074 | - // {store_id}/{user_id}/{aid} | ||
| 1075 | - let get_aid = this.data.prom_id || this.data.luckGoInfo.id; | ||
| 1076 | - await getApp().request.get('/api/weshop/prom/luckyOrder/countActNum/' + os.stoid + '/' + oo.user_id + '/' + get_aid, { | ||
| 1077 | - success: function (res) { | ||
| 1078 | - if(res.data.code == 0) { | ||
| 1079 | - console.log(oo.user_id, '判断是否超出限购,获取购买次数', res, ); | ||
| 1080 | - // th.setData({ | ||
| 1081 | - // num_joined: res.data.data, | ||
| 1082 | - // }); | ||
| 1083 | - let num_joined = res.data.data; | ||
| 1084 | - let group_join_num = th.data.luckGoInfo.group_join_num; | ||
| 1085 | - let canBuy = num_joined >= group_join_num ? false : true; | ||
| 1086 | - th.setData({ | ||
| 1087 | - canBuy, | ||
| 1088 | - }); | ||
| 1089 | - // console.log('canBuy', th.data.canBuy); | ||
| 1090 | - }; | ||
| 1091 | - }, | ||
| 1092 | - }); | ||
| 1093 | - | ||
| 1094 | - | ||
| 1095 | - //获取参团成员 | ||
| 1096 | - await getApp().request.promiseGet('/api/weshop/prom/luckyOrder/page', { | ||
| 1097 | - data: { | ||
| 1098 | - store_id: o.stoid, | ||
| 1099 | - team_id: th.data.team_id, | ||
| 1100 | - } | ||
| 1101 | - }).then(res => { | ||
| 1102 | - if (res.data.code == 0) { | ||
| 1103 | - // console.log(th.data.team_id,'参团成员===============》', res.data.data.pageData); | ||
| 1104 | - th.setData({ | ||
| 1105 | - luckGoMembers: res.data.data.pageData, | ||
| 1106 | - }); | ||
| 1107 | - } | ||
| 1108 | - }); | ||
| 1109 | - | ||
| 1110 | - var p1 = new Promise((resolve, reject) => { | 1026 | + //获取单个活动已成团数量 | 
| 1027 | + getApp().request.get(`/api/weshop/prom/luckyTeam/getCtNum/${o.stoid}/${this.data.group_id}`, { | ||
| 1028 | + success: function (res) { | ||
| 1029 | + if (res.data.code == 0) { | ||
| 1030 | + th.setData({ | ||
| 1031 | + group_num: res.data.data, | ||
| 1032 | + }); | ||
| 1033 | + } | ||
| 1034 | + } | ||
| 1035 | + }); | ||
| 1036 | + | ||
| 1037 | + | ||
| 1038 | + //获取单个活动中奖记录 | ||
| 1039 | + getApp().request.promiseGet('/api/weshop/prom/luckyOrder/page', { | ||
| 1040 | + data: { | ||
| 1041 | + store_id: os.stoid, | ||
| 1042 | + team_status: 2, | ||
| 1043 | + goods_id: this.data.gid, | ||
| 1044 | + rndid: 1, | ||
| 1045 | + } | ||
| 1046 | + }).then(res => { | ||
| 1047 | + if (res.data.code == 0) { | ||
| 1048 | + th.setData({ | ||
| 1049 | + luckGoWinners: res.data.data.pageData, | ||
| 1050 | + }); | ||
| 1051 | + } | ||
| 1052 | + }); | ||
| 1053 | + | ||
| 1054 | + | ||
| 1055 | + //获取单个活动成团已中商品数量 | ||
| 1056 | + let url_num_success = `/api/weshop/prom/luckyOrder/countActNum/${os.stoid}/${this.data.group_id}`; | ||
| 1057 | + getApp().request.get(url_num_success, { | ||
| 1058 | + success: function (res) { | ||
| 1059 | + if (res.data.code == 0) { | ||
| 1060 | + console.log('成团已中商品数量汇总', res.data.data); | ||
| 1061 | + th.setData({ | ||
| 1062 | + num_success: res.data.data, | ||
| 1063 | + }); | ||
| 1064 | + } | ||
| 1065 | + } | ||
| 1066 | + }); | ||
| 1067 | + | ||
| 1068 | + | ||
| 1069 | + | ||
| 1070 | + | ||
| 1071 | + | ||
| 1072 | + // 获取购买次数,判断是否已经超出限购 | ||
| 1073 | + // {store_id}/{user_id}/{aid} | ||
| 1074 | + let get_aid = this.data.prom_id || this.data.luckGoInfo.id; | ||
| 1075 | + await getApp().request.get('/api/weshop/prom/luckyOrder/countActNum/' + os.stoid + '/' + oo.user_id + '/' + get_aid, { | ||
| 1076 | + success: function (res) { | ||
| 1077 | + if (res.data.code == 0) { | ||
| 1078 | + console.log(oo.user_id, '判断是否超出限购,获取购买次数', res,); | ||
| 1079 | + // th.setData({ | ||
| 1080 | + // num_joined: res.data.data, | ||
| 1081 | + // }); | ||
| 1082 | + let num_joined = res.data.data; | ||
| 1083 | + let group_join_num = th.data.luckGoInfo.group_join_num; | ||
| 1084 | + let canBuy = num_joined >= group_join_num ? false : true; | ||
| 1085 | + th.setData({ | ||
| 1086 | + canBuy, | ||
| 1087 | + }); | ||
| 1088 | + // console.log('canBuy', th.data.canBuy); | ||
| 1089 | + }; | ||
| 1090 | + }, | ||
| 1091 | + }); | ||
| 1092 | + | ||
| 1093 | + | ||
| 1094 | + //获取参团成员 | ||
| 1095 | + await getApp().request.promiseGet('/api/weshop/prom/luckyOrder/page', { | ||
| 1096 | + data: { | ||
| 1097 | + store_id: o.stoid, | ||
| 1098 | + team_id: th.data.team_id, | ||
| 1099 | + } | ||
| 1100 | + }).then(res => { | ||
| 1101 | + if (res.data.code == 0) { | ||
| 1102 | + // console.log(th.data.team_id,'参团成员===============》', res.data.data.pageData); | ||
| 1103 | + th.setData({ | ||
| 1104 | + luckGoMembers: res.data.data.pageData, | ||
| 1105 | + }); | ||
| 1106 | + } | ||
| 1107 | + }); | ||
| 1108 | + | ||
| 1109 | + var p1 = new Promise((resolve, reject) => { | ||
| 1111 | // 检查幸运购活动商品库存 | 1110 | // 检查幸运购活动商品库存 | 
| 1112 | getApp().request.get("/api/weshop/activitylist/getActLen/" + o.stoid + "/9/" + this.data.group_id, { | 1111 | getApp().request.get("/api/weshop/activitylist/getActLen/" + o.stoid + "/9/" + this.data.group_id, { | 
| 1113 | - success: function(res) { | 1112 | + success: function (res) { | 
| 1114 | //console.log('当前幸运购活动的剩余库存', res.data.data); | 1113 | //console.log('当前幸运购活动的剩余库存', res.data.data); | 
| 1115 | - if(res.data.code == 0) { | 1114 | + if (res.data.code == 0) { | 
| 1116 | th.setData({ | 1115 | th.setData({ | 
| 1117 | // 剩余库存量 | 1116 | // 剩余库存量 | 
| 1118 | surplus: res.data.data, | 1117 | surplus: res.data.data, | 
| 1119 | }); | 1118 | }); | 
| 1120 | - }; | 1119 | + }; | 
| 1121 | resolve(); | 1120 | resolve(); | 
| 1122 | } | 1121 | } | 
| 1123 | }); | 1122 | }); | 
| 1124 | - | 1123 | + | 
| 1125 | }); | 1124 | }); | 
| 1126 | - | 1125 | + | 
| 1127 | var p2 = new Promise((resolve, reject) => { | 1126 | var p2 = new Promise((resolve, reject) => { | 
| 1128 | // 检查是否已经参团购买 | 1127 | // 检查是否已经参团购买 | 
| 1129 | getApp().request.get("/api/weshop/prom/luckyOrder/getUserOrderInfo/" + o.stoid + "/" + oo.user_id + "/" + this.data.group_id, { | 1128 | getApp().request.get("/api/weshop/prom/luckyOrder/getUserOrderInfo/" + o.stoid + "/" + oo.user_id + "/" + this.data.group_id, { | 
| 1130 | - success: function(res) { | 1129 | + success: function (res) { | 
| 1131 | console.log('当前幸运购活动是否已经参团', res.data.code); | 1130 | console.log('当前幸运购活动是否已经参团', res.data.code); | 
| 1132 | - if(res.data.code == 0) { | 1131 | + if (res.data.code == 0) { | 
| 1133 | th.setData({ | 1132 | th.setData({ | 
| 1134 | showDetails: true, | 1133 | showDetails: true, | 
| 1135 | buyInfo: res.data.data, | 1134 | buyInfo: res.data.data, | 
| @@ -1142,52 +1141,52 @@ Page({ | @@ -1142,52 +1141,52 @@ Page({ | ||
| 1142 | resolve(); | 1141 | resolve(); | 
| 1143 | } | 1142 | } | 
| 1144 | }); | 1143 | }); | 
| 1145 | - | 1144 | + | 
| 1146 | }); | 1145 | }); | 
| 1147 | - | 1146 | + | 
| 1148 | Promise.all([p1, p2]).then(res => { | 1147 | Promise.all([p1, p2]).then(res => { | 
| 1149 | th.setData({ | 1148 | th.setData({ | 
| 1150 | btnHidden: true, | 1149 | btnHidden: true, | 
| 1151 | }); | 1150 | }); | 
| 1152 | }); | 1151 | }); | 
| 1153 | - | ||
| 1154 | - | ||
| 1155 | - console.log('hidddddnnnnnnnn------>>>>', this.data.btnHidden, this.data.isTimeUp) | ||
| 1156 | - | 1152 | + | 
| 1153 | + | ||
| 1154 | + console.log('hidddddnnnnnnnn------>>>>', this.data.btnHidden, this.data.isTimeUp) | ||
| 1155 | + | ||
| 1157 | 1156 | ||
| 1158 | }, | 1157 | }, | 
| 1159 | - | ||
| 1160 | 1158 | ||
| 1161 | - | ||
| 1162 | - | ||
| 1163 | - // 页面卸载 | 1159 | + | 
| 1160 | + | ||
| 1161 | + | ||
| 1162 | + // 页面卸载 | ||
| 1164 | onUnload: function () { | 1163 | onUnload: function () { | 
| 1165 | for (var i = 1; i < 100; i++) { | 1164 | for (var i = 1; i < 100; i++) { | 
| 1166 | clearInterval(i); | 1165 | clearInterval(i); | 
| 1167 | } | 1166 | } | 
| 1168 | }, | 1167 | }, | 
| 1169 | - | ||
| 1170 | - // 页面隐藏 | 1168 | + | 
| 1169 | + // 页面隐藏 | ||
| 1171 | onHide: function () { | 1170 | onHide: function () { | 
| 1172 | this.data.is_timer = 0; | 1171 | this.data.is_timer = 0; | 
| 1173 | for (var i = 1; i < 100; i++) { | 1172 | for (var i = 1; i < 100; i++) { | 
| 1174 | clearInterval(i); | 1173 | clearInterval(i); | 
| 1175 | } | 1174 | } | 
| 1176 | }, | 1175 | }, | 
| 1177 | - | ||
| 1178 | - // 点击顶部选项卡 | 1176 | + | 
| 1177 | + // 点击顶部选项卡 | ||
| 1179 | tabClick: function (t) { | 1178 | tabClick: function (t) { | 
| 1180 | var e = t.currentTarget.id; | 1179 | var e = t.currentTarget.id; | 
| 1181 | this.setData({ | 1180 | this.setData({ | 
| 1182 | activeCategoryId: e | 1181 | activeCategoryId: e | 
| 1183 | - }), | ||
| 1184 | - 1 == e ? this.tabGoodsContent() : 2 == e && this.tabComment(); | 1182 | + }), | 
| 1183 | + 1 == e ? this.tabGoodsContent() : 2 == e && this.tabComment(); | ||
| 1185 | }, | 1184 | }, | 
| 1186 | - | ||
| 1187 | - | ||
| 1188 | 1185 | ||
| 1189 | 1186 | ||
| 1190 | - // 点击评价选项卡下的各评价按钮 | 1187 | + | 
| 1188 | + | ||
| 1189 | + // 点击评价选项卡下的各评价按钮 | ||
| 1191 | tabClick3: function (t) { | 1190 | tabClick3: function (t) { | 
| 1192 | var e = this; | 1191 | var e = this; | 
| 1193 | if (t.currentTarget.id != this.data.activeCategoryId3) { | 1192 | if (t.currentTarget.id != this.data.activeCategoryId3) { | 
| @@ -1200,7 +1199,7 @@ Page({ | @@ -1200,7 +1199,7 @@ Page({ | ||
| 1200 | } | 1199 | } | 
| 1201 | }, | 1200 | }, | 
| 1202 | 1201 | ||
| 1203 | - // 滚动到顶部 | 1202 | + // 滚动到顶部 | 
| 1204 | doScrollTop: function () { | 1203 | doScrollTop: function () { | 
| 1205 | wx.pageScrollTo({ | 1204 | wx.pageScrollTo({ | 
| 1206 | scrollTop: 0 | 1205 | scrollTop: 0 | 
| @@ -1283,9 +1282,9 @@ Page({ | @@ -1283,9 +1282,9 @@ Page({ | ||
| 1283 | th.setData({ | 1282 | th.setData({ | 
| 1284 | open_ind_store: ind | 1283 | open_ind_store: ind | 
| 1285 | }); | 1284 | }); | 
| 1286 | - | ||
| 1287 | - | ||
| 1288 | - th.add_cart_func(t); | 1285 | + | 
| 1286 | + | ||
| 1287 | + th.add_cart_func(t); | ||
| 1289 | }, | 1288 | }, | 
| 1290 | 1289 | ||
| 1291 | 1290 | ||
| @@ -1450,9 +1449,9 @@ Page({ | @@ -1450,9 +1449,9 @@ Page({ | ||
| 1450 | goods_name: o.goods_name, | 1449 | goods_name: o.goods_name, | 
| 1451 | goods_sn: o.goods_sn, | 1450 | goods_sn: o.goods_sn, | 
| 1452 | sku: o.sku, | 1451 | sku: o.sku, | 
| 1453 | - prom_id:th.data.luckGoInfo.id, | 1452 | + prom_id: th.data.luckGoInfo.id, | 
| 1454 | // prom_type:th.data.sele_g.prom_type, | 1453 | // prom_type:th.data.sele_g.prom_type, | 
| 1455 | - prom_type:9, | 1454 | + prom_type: 9, | 
| 1456 | }; | 1455 | }; | 
| 1457 | 1456 | ||
| 1458 | //---是不是从收藏夹出来的--- | 1457 | //---是不是从收藏夹出来的--- | 
| @@ -1620,7 +1619,7 @@ Page({ | @@ -1620,7 +1619,7 @@ Page({ | ||
| 1620 | add_cart_next(e, t, a, o, newd, CanOutQty) { | 1619 | add_cart_next(e, t, a, o, newd, CanOutQty) { | 
| 1621 | var th = this, i = getApp().request; | 1620 | var th = this, i = getApp().request; | 
| 1622 | //---如果商品不是积分购和拼团,要判断一个是否要进行等级价的判断------ | 1621 | //---如果商品不是积分购和拼团,要判断一个是否要进行等级价的判断------ | 
| 1623 | - if ((o.prom_type != 1 || o.prom_id<=0) && ((o.prom_type != 6 && o.prom_type != 4) || th.data.is_normal)) { | 1622 | + if ((o.prom_type != 1 || o.prom_id <= 0) && ((o.prom_type != 6 && o.prom_type != 4) || th.data.is_normal)) { | 
| 1624 | var conf = th.data.bconfig; | 1623 | var conf = th.data.bconfig; | 
| 1625 | if (conf.switch_list && getApp().globalData.userInfo['card_field'] && getApp().globalData.userInfo['card_expiredate']) { | 1624 | if (conf.switch_list && getApp().globalData.userInfo['card_field'] && getApp().globalData.userInfo['card_expiredate']) { | 
| 1626 | var s_list = JSON.parse(conf.switch_list); | 1625 | var s_list = JSON.parse(conf.switch_list); | 
| @@ -1783,7 +1782,7 @@ Page({ | @@ -1783,7 +1782,7 @@ Page({ | ||
| 1783 | // this.data.shippingCost < 0 || this.data.select.stock <= 0 || (Object.assign(e, { | 1782 | // this.data.shippingCost < 0 || this.data.select.stock <= 0 || (Object.assign(e, { | 
| 1784 | // action: "buy_now" | 1783 | // action: "buy_now" | 
| 1785 | // }), | 1784 | // }), | 
| 1786 | - var th = this; | 1785 | + var th = this; | 
| 1787 | this.setData({ | 1786 | this.setData({ | 
| 1788 | openSpecModal: 0, | 1787 | openSpecModal: 0, | 
| 1789 | openSpecModal_inte: 0, | 1788 | openSpecModal_inte: 0, | 
| @@ -1791,15 +1790,15 @@ Page({ | @@ -1791,15 +1790,15 @@ Page({ | ||
| 1791 | openSpecModal_pt: 0, | 1790 | openSpecModal_pt: 0, | 
| 1792 | }) | 1791 | }) | 
| 1793 | 1792 | ||
| 1794 | - // if (e.prom_type == 9) { | ||
| 1795 | - // s.set_b_now(e); | ||
| 1796 | - // // var url = ''; | ||
| 1797 | - // var url = "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id; | ||
| 1798 | - // getApp().goto(url); | ||
| 1799 | - // } else | ||
| 1800 | - | ||
| 1801 | - // if(e.prom_type == 9){ | ||
| 1802 | - if(true){ | 1793 | + // if (e.prom_type == 9) { | 
| 1794 | + // s.set_b_now(e); | ||
| 1795 | + // // var url = ''; | ||
| 1796 | + // var url = "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id; | ||
| 1797 | + // getApp().goto(url); | ||
| 1798 | + // } else | ||
| 1799 | + | ||
| 1800 | + // if(e.prom_type == 9){ | ||
| 1801 | + if (true) { | ||
| 1803 | //要判断积分购的普通购买有没有参加优惠活动 | 1802 | //要判断积分购的普通购买有没有参加优惠活动 | 
| 1804 | if (e.is_normal == 1) { | 1803 | if (e.is_normal == 1) { | 
| 1805 | this.check_nor_promgood(e.goods_id, function (res) { | 1804 | this.check_nor_promgood(e.goods_id, function (res) { | 
| @@ -1807,28 +1806,28 @@ Page({ | @@ -1807,28 +1806,28 @@ Page({ | ||
| 1807 | e.prom_type = 3; | 1806 | e.prom_type = 3; | 
| 1808 | e.prom_id = res.cat_id; | 1807 | e.prom_id = res.cat_id; | 
| 1809 | } else { | 1808 | } else { | 
| 1810 | - e.prom_type = 0; | ||
| 1811 | - // e.prom_id = 0; | ||
| 1812 | - } | 1809 | + e.prom_type = 0; | 
| 1810 | + // e.prom_id = 0; | ||
| 1811 | + } | ||
| 1813 | s.set_b_now(e); | 1812 | s.set_b_now(e); | 
| 1814 | /*-- | 1813 | /*-- | 
| 1815 | wx.redirectTo({ | 1814 | wx.redirectTo({ | 
| 1816 | url: "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id, | 1815 | url: "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id, | 
| 1817 | });--*/ | 1816 | });--*/ | 
| 1818 | - | ||
| 1819 | - // console.log('11111111111111111111111111======》'); | 1817 | + | 
| 1818 | + // console.log('11111111111111111111111111======》'); | ||
| 1820 | // getApp().goto("/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart?is_bnow=1&goods_id=" + e.goods_id); | 1819 | // getApp().goto("/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart?is_bnow=1&goods_id=" + e.goods_id); | 
| 1821 | - getApp().goto("/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart?is_bnow=1&group_id=" + th.data.group_id +"&goods_id=" + e.goods_id + "&alert=" + th.data.luckGoInfo.lc_alert); | 1820 | + getApp().goto("/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart?is_bnow=1&group_id=" + th.data.group_id + "&goods_id=" + e.goods_id + "&alert=" + th.data.luckGoInfo.lc_alert); | 
| 1822 | 1821 | ||
| 1823 | }) | 1822 | }) | 
| 1824 | } else { | 1823 | } else { | 
| 1825 | - //console.log('222222222222222222222222222222======》'); | 1824 | + //console.log('222222222222222222222222222222======》'); | 
| 1826 | //s.set_b_now(e); | 1825 | //s.set_b_now(e); | 
| 1827 | /*-- | 1826 | /*-- | 
| 1828 | wx.redirectTo({ | 1827 | wx.redirectTo({ | 
| 1829 | url: "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id, | 1828 | url: "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id, | 
| 1830 | });--*/ | 1829 | });--*/ | 
| 1831 | - //getApp().goto("/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct?is_bnow=1&goods_id=" + e.goods_id) | 1830 | + //getApp().goto("/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct?is_bnow=1&goods_id=" + e.goods_id) | 
| 1832 | // getApp().goto("/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct?is_bnow=1&group_id=" + this.data.group_id +"&goods_id=" + e.goods_id + "&alert=" + this.data.luckGoInfo.lc_alert); | 1831 | // getApp().goto("/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct?is_bnow=1&group_id=" + this.data.group_id +"&goods_id=" + e.goods_id + "&alert=" + this.data.luckGoInfo.lc_alert); | 
| 1833 | } | 1832 | } | 
| 1834 | 1833 | ||
| @@ -2054,36 +2053,36 @@ Page({ | @@ -2054,36 +2053,36 @@ Page({ | ||
| 2054 | }) | 2053 | }) | 
| 2055 | return false; | 2054 | return false; | 
| 2056 | } | 2055 | } | 
| 2057 | - | ||
| 2058 | - | ||
| 2059 | - | ||
| 2060 | - if(th.data.more_flash && open_store==1){ | ||
| 2061 | - th.setData({is_pop_more:1}); | ||
| 2062 | - }else{ | ||
| 2063 | - var ind = t.currentTarget.dataset.ind; | ||
| 2064 | - //回调。判断是不是优惠促销 | ||
| 2065 | - th.check_is_prom_goods(function () { | ||
| 2066 | - th.setData({ | ||
| 2067 | - openSpecModal: !0, | ||
| 2068 | - openSpecModal_ind: ind, | ||
| 2069 | - }); | ||
| 2070 | - //var is_open=th.data.config | ||
| 2071 | - th.get_off_price(); | ||
| 2072 | - }) | ||
| 2073 | - } | ||
| 2074 | - }, | ||
| 2075 | 2056 | ||
| 2076 | - open_next(){ | ||
| 2077 | - var th=this; | 2057 | + | 
| 2058 | + | ||
| 2059 | + if (th.data.more_flash && open_store == 1) { | ||
| 2060 | + th.setData({ is_pop_more: 1 }); | ||
| 2061 | + } else { | ||
| 2062 | + var ind = t.currentTarget.dataset.ind; | ||
| 2078 | //回调。判断是不是优惠促销 | 2063 | //回调。判断是不是优惠促销 | 
| 2079 | th.check_is_prom_goods(function () { | 2064 | th.check_is_prom_goods(function () { | 
| 2080 | - th.setData({ | ||
| 2081 | - openSpecModal: !0, | ||
| 2082 | - openSpecModal_ind: 1, | ||
| 2083 | - is_pop_more:0 | ||
| 2084 | - }); | ||
| 2085 | - th.get_off_price(); | 2065 | + th.setData({ | 
| 2066 | + openSpecModal: !0, | ||
| 2067 | + openSpecModal_ind: ind, | ||
| 2068 | + }); | ||
| 2069 | + //var is_open=th.data.config | ||
| 2070 | + th.get_off_price(); | ||
| 2086 | }) | 2071 | }) | 
| 2072 | + } | ||
| 2073 | + }, | ||
| 2074 | + | ||
| 2075 | + open_next() { | ||
| 2076 | + var th = this; | ||
| 2077 | + //回调。判断是不是优惠促销 | ||
| 2078 | + th.check_is_prom_goods(function () { | ||
| 2079 | + th.setData({ | ||
| 2080 | + openSpecModal: !0, | ||
| 2081 | + openSpecModal_ind: 1, | ||
| 2082 | + is_pop_more: 0 | ||
| 2083 | + }); | ||
| 2084 | + th.get_off_price(); | ||
| 2085 | + }) | ||
| 2087 | }, | 2086 | }, | 
| 2088 | 2087 | ||
| 2089 | //判断是不是优惠促销 | 2088 | //判断是不是优惠促销 | 
| @@ -2410,47 +2409,47 @@ Page({ | @@ -2410,47 +2409,47 @@ Page({ | ||
| 2410 | // ob.title = text + " " + name; | 2409 | // ob.title = text + " " + name; | 
| 2411 | // } | 2410 | // } | 
| 2412 | 2411 | ||
| 2413 | - // var title = th.data.sele_g.goods_name; | ||
| 2414 | - // var img = th.data.sele_g.original_img; | ||
| 2415 | - | ||
| 2416 | - // var url = `packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo?goods_id=${th.data.sele_g.goods_id}&prom_type=9&group_id=${th.data.group_id}`; //当前页面url | ||
| 2417 | - // if (getApp().globalData.user_id) { | ||
| 2418 | - // url += "&first_leader=" + getApp().globalData.user_id; | ||
| 2419 | - // } | ||
| 2420 | - | ||
| 2421 | - // console.log(url) | ||
| 2422 | - | ||
| 2423 | - // var ob = { | ||
| 2424 | - // title: price + "元 " + title, | ||
| 2425 | - // path: url, | ||
| 2426 | - // imageUrl: img, | ||
| 2427 | - // }; | ||
| 2428 | - | ||
| 2429 | - // return ob; | ||
| 2430 | - | ||
| 2431 | - | ||
| 2432 | - var pagePath = `packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo?goods_id=${this.data.sele_g.goods_id}&prom_type=9&group_id=${this.data.group_id}`; //当前页面url | ||
| 2433 | - // console.log('pagePath=====xxxxxx>', pagePath); | ||
| 2434 | - var imgPath = this.data.iurl + this.data.luckGoInfo.original_img; | ||
| 2435 | - if (pagePath.indexOf('/') != 0) { | ||
| 2436 | - pagePath = '/' + pagePath; | ||
| 2437 | - } | ||
| 2438 | - // if(getApp().globalData.user_id){ | ||
| 2439 | - | ||
| 2440 | - // if(pagePath.indexOf("?")>0){ | ||
| 2441 | - // pagePath+="&first_leader="+getApp().globalData.user_id; | ||
| 2442 | - // }else{ | ||
| 2443 | - // pagePath+="?first_leader="+getApp().globalData.user_id; | ||
| 2444 | - // } | ||
| 2445 | - // } | ||
| 2446 | - return { | ||
| 2447 | - title: "邀您一起参加幸运购", | ||
| 2448 | - path: pagePath, | ||
| 2449 | - imageUrl: imgPath, | ||
| 2450 | - } | ||
| 2451 | - | ||
| 2452 | - | ||
| 2453 | - | 2412 | + // var title = th.data.sele_g.goods_name; | 
| 2413 | + // var img = th.data.sele_g.original_img; | ||
| 2414 | + | ||
| 2415 | + // var url = `packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo?goods_id=${th.data.sele_g.goods_id}&prom_type=9&group_id=${th.data.group_id}`; //当前页面url | ||
| 2416 | + // if (getApp().globalData.user_id) { | ||
| 2417 | + // url += "&first_leader=" + getApp().globalData.user_id; | ||
| 2418 | + // } | ||
| 2419 | + | ||
| 2420 | + // console.log(url) | ||
| 2421 | + | ||
| 2422 | + // var ob = { | ||
| 2423 | + // title: price + "元 " + title, | ||
| 2424 | + // path: url, | ||
| 2425 | + // imageUrl: img, | ||
| 2426 | + // }; | ||
| 2427 | + | ||
| 2428 | + // return ob; | ||
| 2429 | + | ||
| 2430 | + | ||
| 2431 | + var pagePath = `packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo?goods_id=${this.data.sele_g.goods_id}&prom_type=9&group_id=${this.data.group_id}`; //当前页面url | ||
| 2432 | + // console.log('pagePath=====xxxxxx>', pagePath); | ||
| 2433 | + var imgPath = this.data.iurl + this.data.luckGoInfo.original_img; | ||
| 2434 | + if (pagePath.indexOf('/') != 0) { | ||
| 2435 | + pagePath = '/' + pagePath; | ||
| 2436 | + } | ||
| 2437 | + // if(getApp().globalData.user_id){ | ||
| 2438 | + | ||
| 2439 | + // if(pagePath.indexOf("?")>0){ | ||
| 2440 | + // pagePath+="&first_leader="+getApp().globalData.user_id; | ||
| 2441 | + // }else{ | ||
| 2442 | + // pagePath+="?first_leader="+getApp().globalData.user_id; | ||
| 2443 | + // } | ||
| 2444 | + // } | ||
| 2445 | + return { | ||
| 2446 | + title: "邀您一起参加幸运购", | ||
| 2447 | + path: pagePath, | ||
| 2448 | + imageUrl: imgPath, | ||
| 2449 | + } | ||
| 2450 | + | ||
| 2451 | + | ||
| 2452 | + | ||
| 2454 | }, | 2453 | }, | 
| 2455 | 2454 | ||
| 2456 | //-----图片失败,默认图片----- | 2455 | //-----图片失败,默认图片----- | 
| @@ -2526,12 +2525,12 @@ Page({ | @@ -2526,12 +2525,12 @@ Page({ | ||
| 2526 | if (res.data.code == 0) prom = res.data.data; | 2525 | if (res.data.code == 0) prom = res.data.data; | 
| 2527 | }) | 2526 | }) | 
| 2528 | break | 2527 | break | 
| 2529 | - | ||
| 2530 | - case 8: | ||
| 2531 | - continue; | ||
| 2532 | 2528 | ||
| 2533 | case 8: | 2529 | case 8: | 
| 2534 | - continue; | 2530 | + continue; | 
| 2531 | + | ||
| 2532 | + case 8: | ||
| 2533 | + continue; | ||
| 2535 | 2534 | ||
| 2536 | } | 2535 | } | 
| 2537 | 2536 | ||
| @@ -2656,14 +2655,14 @@ Page({ | @@ -2656,14 +2655,14 @@ Page({ | ||
| 2656 | async sele_spec_chech_activity() { | 2655 | async sele_spec_chech_activity() { | 
| 2657 | //---如果是活动的时候--- | 2656 | //---如果是活动的时候--- | 
| 2658 | var prom = null, goodsinfo = this.data.sele_g, th = this; | 2657 | var prom = null, goodsinfo = this.data.sele_g, th = this; | 
| 2659 | - var user_id=getApp().globalData.user_id; | ||
| 2660 | - if(!user_id) user_id=0; | 2658 | + var user_id = getApp().globalData.user_id; | 
| 2659 | + if (!user_id) user_id = 0; | ||
| 2661 | if (goodsinfo.prom_type == 1) { | 2660 | if (goodsinfo.prom_type == 1) { | 
| 2662 | - await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + os.stoid + "/" +user_id+"/"+ goodsinfo.prom_id, { | 2661 | + await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + os.stoid + "/" + user_id + "/" + goodsinfo.prom_id, { | 
| 2663 | }).then(res => { | 2662 | }).then(res => { | 
| 2664 | if (res.data.code == 0) { | 2663 | if (res.data.code == 0) { | 
| 2665 | - prom = res.data.data; | ||
| 2666 | - prom.price=prom.user_price; | 2664 | + prom = res.data.data; | 
| 2665 | + prom.price = prom.user_price; | ||
| 2667 | } | 2666 | } | 
| 2668 | }) | 2667 | }) | 
| 2669 | } | 2668 | } | 
| @@ -2689,11 +2688,11 @@ Page({ | @@ -2689,11 +2688,11 @@ Page({ | ||
| 2689 | var now = ut.gettimestamp(); | 2688 | var now = ut.gettimestamp(); | 
| 2690 | if (prom) { | 2689 | if (prom) { | 
| 2691 | 2690 | ||
| 2692 | - var t1=prom.start_time; | ||
| 2693 | - var prom_st=1; | ||
| 2694 | - if(prom.show_time){ | ||
| 2695 | - t1=prom.show_time; | ||
| 2696 | - if(prom.start_time>now) prom_st=0; | 2691 | + var t1 = prom.start_time; | 
| 2692 | + var prom_st = 1; | ||
| 2693 | + if (prom.show_time) { | ||
| 2694 | + t1 = prom.show_time; | ||
| 2695 | + if (prom.start_time > now) prom_st = 0; | ||
| 2697 | } | 2696 | } | 
| 2698 | if (prom.is_end == 0 && prom.end_time > now && t1 < now) { | 2697 | if (prom.is_end == 0 && prom.end_time > now && t1 < now) { | 
| 2699 | th.setData({ | 2698 | th.setData({ | 
| @@ -2704,37 +2703,37 @@ Page({ | @@ -2704,37 +2703,37 @@ Page({ | ||
| 2704 | prom_start_time: prom.start_time, | 2703 | prom_start_time: prom.start_time, | 
| 2705 | prom_st: prom_st, | 2704 | prom_st: prom_st, | 
| 2706 | prom_act: prom, | 2705 | prom_act: prom, | 
| 2707 | - prom_id:prom.id | 2706 | + prom_id: prom.id | 
| 2708 | }) | 2707 | }) | 
| 2709 | 2708 | ||
| 2710 | - //却换图片 | ||
| 2711 | - th.init(goodsinfo.goods_id); | ||
| 2712 | - var newTime = ut.gettimestamp(); | ||
| 2713 | - var endTime2 = prom.end_time; | ||
| 2714 | - var endTime1 = prom.start_time; | 2709 | + //却换图片 | 
| 2710 | + th.init(goodsinfo.goods_id); | ||
| 2711 | + var newTime = ut.gettimestamp(); | ||
| 2712 | + var endTime2 = prom.end_time; | ||
| 2713 | + var endTime1 = prom.start_time; | ||
| 2715 | 2714 | ||
| 2716 | - this.data.is_timer=0; | 2715 | + this.data.is_timer = 0; | 
| 2717 | 2716 | ||
| 2718 | - setTimeout(function () { | ||
| 2719 | - th.data.is_timer=1; | ||
| 2720 | - if (endTime1 > newTime) { | ||
| 2721 | - th.setData({ | ||
| 2722 | - prom_time_text: '距秒杀开始还有' | ||
| 2723 | - }) | ||
| 2724 | - th.countDown(th.data.luckGoInfo.end_time, 0); | ||
| 2725 | - } else { | ||
| 2726 | - if (endTime2 > newTime) { | ||
| 2727 | - th.setData({ | ||
| 2728 | - prom_time_text: '距秒杀结束还有', | ||
| 2729 | - prom_st: 1 | ||
| 2730 | - }) | ||
| 2731 | - th.countDown(th.data.luckGoInfo.end_time); | ||
| 2732 | - } | ||
| 2733 | - } | 2717 | + setTimeout(function () { | 
| 2718 | + th.data.is_timer = 1; | ||
| 2719 | + if (endTime1 > newTime) { | ||
| 2720 | + th.setData({ | ||
| 2721 | + prom_time_text: '距秒杀开始还有' | ||
| 2722 | + }) | ||
| 2723 | + th.countDown(th.data.luckGoInfo.end_time, 0); | ||
| 2724 | + } else { | ||
| 2725 | + if (endTime2 > newTime) { | ||
| 2726 | + th.setData({ | ||
| 2727 | + prom_time_text: '距秒杀结束还有', | ||
| 2728 | + prom_st: 1 | ||
| 2729 | + }) | ||
| 2730 | + th.countDown(th.data.luckGoInfo.end_time); | ||
| 2731 | + } | ||
| 2732 | + } | ||
| 2734 | 2733 | ||
| 2735 | - },1000) | 2734 | + }, 1000) | 
| 2736 | 2735 | ||
| 2737 | - return false; | 2736 | + return false; | 
| 2738 | } | 2737 | } | 
| 2739 | } | 2738 | } | 
| 2740 | //---设置普通商品--- | 2739 | //---设置普通商品--- | 
| @@ -3241,32 +3240,32 @@ Page({ | @@ -3241,32 +3240,32 @@ Page({ | ||
| 3241 | 3240 | ||
| 3242 | //--------检查是否活动,活动是否开始,或者是否结束------- | 3241 | //--------检查是否活动,活动是否开始,或者是否结束------- | 
| 3243 | async check_prom(gid, prom_type, prom_id) { | 3242 | async check_prom(gid, prom_type, prom_id) { | 
| 3244 | - var ee = this,th = ee; | ||
| 3245 | - var user_id=getApp().globalData.user_id; | ||
| 3246 | - if(!user_id) user_id=0; | 3243 | + var ee = this, th = ee; | 
| 3244 | + var user_id = getApp().globalData.user_id; | ||
| 3245 | + if (!user_id) user_id = 0; | ||
| 3247 | 3246 | ||
| 3248 | - if (prom_type == 3 || prom_type == 0 || prom_type == 2 || prom_type == 5 || prom_type == 7|| prom_type == 9) { | 3247 | + if (prom_type == 3 || prom_type == 0 || prom_type == 2 || prom_type == 5 || prom_type == 7 || prom_type == 9) { | 
| 3249 | this.setData({ | 3248 | this.setData({ | 
| 3250 | - prom_type: 0,isshow: 1, | 3249 | + prom_type: 0, isshow: 1, | 
| 3251 | }); | 3250 | }); | 
| 3252 | return false; | 3251 | return false; | 
| 3253 | } | 3252 | } | 
| 3254 | 3253 | ||
| 3255 | - if (prom_type == 1 && prom_id==0){ | ||
| 3256 | - this.setData({ | ||
| 3257 | - prom_type: 0,isshow: 1, | ||
| 3258 | - }); | 3254 | + if (prom_type == 1 && prom_id == 0) { | 
| 3255 | + this.setData({ | ||
| 3256 | + prom_type: 0, isshow: 1, | ||
| 3257 | + }); | ||
| 3259 | 3258 | ||
| 3260 | - //获取门店 | ||
| 3261 | - this.get_sto(); | ||
| 3262 | - this.get_sku(o.stoid, this.data.data, gid); | ||
| 3263 | - this.check_has_flash(); | ||
| 3264 | - return false; | 3259 | + //获取门店 | 
| 3260 | + this.get_sto(); | ||
| 3261 | + this.get_sku(o.stoid, this.data.data, gid); | ||
| 3262 | + this.check_has_flash(); | ||
| 3263 | + return false; | ||
| 3265 | } | 3264 | } | 
| 3266 | 3265 | ||
| 3267 | //if (prom_type != 3 && prom_type!=0){ | 3266 | //if (prom_type != 3 && prom_type!=0){ | 
| 3268 | //---判断秒杀---- | 3267 | //---判断秒杀---- | 
| 3269 | - if (prom_type == 1 && prom_id>0) { | 3268 | + if (prom_type == 1 && prom_id > 0) { | 
| 3270 | //-------判断活动是否抢光--------- | 3269 | //-------判断活动是否抢光--------- | 
| 3271 | await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/" + prom_type + "/" + prom_id, { | 3270 | await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/" + prom_type + "/" + prom_id, { | 
| 3272 | 1: 1 | 3271 | 1: 1 | 
| @@ -3278,7 +3277,7 @@ Page({ | @@ -3278,7 +3277,7 @@ Page({ | ||
| 3278 | prom_r_null: 1 | 3277 | prom_r_null: 1 | 
| 3279 | }); | 3278 | }); | 
| 3280 | //拿取价格并且判断时间-- | 3279 | //拿取价格并且判断时间-- | 
| 3281 | - getApp().request.get("/api/ms/flash_sale/getNew/" +os.stoid + "/" +user_id+"/"+ prom_id, { | 3280 | + getApp().request.get("/api/ms/flash_sale/getNew/" + os.stoid + "/" + user_id + "/" + prom_id, { | 
| 3282 | success: function (t) { | 3281 | success: function (t) { | 
| 3283 | if (t.data.code != 0) { | 3282 | if (t.data.code != 0) { | 
| 3284 | ee.setData({ | 3283 | ee.setData({ | 
| @@ -3356,51 +3355,51 @@ Page({ | @@ -3356,51 +3355,51 @@ Page({ | ||
| 3356 | 3355 | ||
| 3357 | //如果是进行中的话 | 3356 | //如果是进行中的话 | 
| 3358 | if (endTime1 < newTime) { | 3357 | if (endTime1 < newTime) { | 
| 3359 | - //-- 获取秒杀活动的多少规格 -- | ||
| 3360 | - ee.get_more_flahs(function (list) { | ||
| 3361 | - if (list && list.length > 1) { | ||
| 3362 | - | ||
| 3363 | - var n_item = list[0]; | ||
| 3364 | - var ind = list.findIndex(function (ele) { | ||
| 3365 | - return ele.goods_id == ee.data.data.goods_id; | ||
| 3366 | - }) | ||
| 3367 | - if (ind < 0) return false; | ||
| 3368 | - if (ind > 0) { | ||
| 3369 | - n_item = JSON.parse(JSON.stringify(list[ind])); | ||
| 3370 | - list.splice(ind, 1); | ||
| 3371 | - list.unshift(n_item); | ||
| 3372 | - } | ||
| 3373 | - | ||
| 3374 | - ee.data.sele_g.viplimited = n_item.viplimited; | ||
| 3375 | - ee.data.data.viplimited = n_item.viplimited; | ||
| 3376 | - | ||
| 3377 | - var gb = 1; | ||
| 3378 | - //-- 显示多规格 -- | ||
| 3379 | - for (let i in list) { | ||
| 3380 | - let item = list[i]; | ||
| 3381 | - var gg = ""; | ||
| 3382 | - if (item.goods_spec == "null" || item.goods_spec == null) item.goods_spec = ""; | ||
| 3383 | - if (item.goods_color == "null" || item.goods_color == null) item.goods_color = ""; | ||
| 3384 | - | ||
| 3385 | - if (item.goods_spec != "" && item.goods_color != "") { | ||
| 3386 | - gg = item.goods_spec + "/" + item.goods_color; | ||
| 3387 | - } else if (item.goods_spec != "" || item.goods_color != "") { | ||
| 3388 | - gg = item.goods_spec + item.goods_color; | ||
| 3389 | - } else { | ||
| 3390 | - gg = "规格" + gb; | ||
| 3391 | - gb++; | ||
| 3392 | - } | ||
| 3393 | - item.gg = gg; | ||
| 3394 | - item.prom_id = item.prom_id; | ||
| 3395 | - item.prom_type = 1; | ||
| 3396 | - } | 3358 | + //-- 获取秒杀活动的多少规格 -- | 
| 3359 | + ee.get_more_flahs(function (list) { | ||
| 3360 | + if (list && list.length > 1) { | ||
| 3397 | 3361 | ||
| 3398 | - ee.setData({ | ||
| 3399 | - sku_g: list, | ||
| 3400 | - }); | 3362 | + var n_item = list[0]; | 
| 3363 | + var ind = list.findIndex(function (ele) { | ||
| 3364 | + return ele.goods_id == ee.data.data.goods_id; | ||
| 3365 | + }) | ||
| 3366 | + if (ind < 0) return false; | ||
| 3367 | + if (ind > 0) { | ||
| 3368 | + n_item = JSON.parse(JSON.stringify(list[ind])); | ||
| 3369 | + list.splice(ind, 1); | ||
| 3370 | + list.unshift(n_item); | ||
| 3371 | + } | ||
| 3401 | 3372 | ||
| 3373 | + ee.data.sele_g.viplimited = n_item.viplimited; | ||
| 3374 | + ee.data.data.viplimited = n_item.viplimited; | ||
| 3375 | + | ||
| 3376 | + var gb = 1; | ||
| 3377 | + //-- 显示多规格 -- | ||
| 3378 | + for (let i in list) { | ||
| 3379 | + let item = list[i]; | ||
| 3380 | + var gg = ""; | ||
| 3381 | + if (item.goods_spec == "null" || item.goods_spec == null) item.goods_spec = ""; | ||
| 3382 | + if (item.goods_color == "null" || item.goods_color == null) item.goods_color = ""; | ||
| 3383 | + | ||
| 3384 | + if (item.goods_spec != "" && item.goods_color != "") { | ||
| 3385 | + gg = item.goods_spec + "/" + item.goods_color; | ||
| 3386 | + } else if (item.goods_spec != "" || item.goods_color != "") { | ||
| 3387 | + gg = item.goods_spec + item.goods_color; | ||
| 3388 | + } else { | ||
| 3389 | + gg = "规格" + gb; | ||
| 3390 | + gb++; | ||
| 3402 | } | 3391 | } | 
| 3403 | - }) | 3392 | + item.gg = gg; | 
| 3393 | + item.prom_id = item.prom_id; | ||
| 3394 | + item.prom_type = 1; | ||
| 3395 | + } | ||
| 3396 | + | ||
| 3397 | + ee.setData({ | ||
| 3398 | + sku_g: list, | ||
| 3399 | + }); | ||
| 3400 | + | ||
| 3401 | + } | ||
| 3402 | + }) | ||
| 3404 | } | 3403 | } | 
| 3405 | 3404 | ||
| 3406 | } | 3405 | } | 
| @@ -3736,35 +3735,35 @@ Page({ | @@ -3736,35 +3735,35 @@ Page({ | ||
| 3736 | min: this.timeFormat(min), | 3735 | min: this.timeFormat(min), | 
| 3737 | sec: this.timeFormat(sec) | 3736 | sec: this.timeFormat(sec) | 
| 3738 | } | 3737 | } | 
| 3739 | - // console.log('cd'); | 3738 | + // console.log('cd'); | 
| 3740 | } else { | 3739 | } else { | 
| 3741 | - | ||
| 3742 | - | ||
| 3743 | - | ||
| 3744 | - obj = { | ||
| 3745 | - day: '00', | ||
| 3746 | - hou: '00', | ||
| 3747 | - min: '00', | ||
| 3748 | - sec: '00' | ||
| 3749 | - } | ||
| 3750 | - | ||
| 3751 | - th.setData({ | ||
| 3752 | - djs: obj, | ||
| 3753 | - isTimeUp: true, | ||
| 3754 | - }); | ||
| 3755 | - // console.log('i am here'); | ||
| 3756 | - return false; | 3740 | + | 
| 3741 | + | ||
| 3742 | + | ||
| 3743 | + obj = { | ||
| 3744 | + day: '00', | ||
| 3745 | + hou: '00', | ||
| 3746 | + min: '00', | ||
| 3747 | + sec: '00' | ||
| 3748 | + } | ||
| 3749 | + | ||
| 3750 | + th.setData({ | ||
| 3751 | + djs: obj, | ||
| 3752 | + isTimeUp: true, | ||
| 3753 | + }); | ||
| 3754 | + // console.log('i am here'); | ||
| 3755 | + return false; | ||
| 3757 | } | 3756 | } | 
| 3758 | - | ||
| 3759 | - // ---- | ||
| 3760 | - | ||
| 3761 | - | ||
| 3762 | - | ||
| 3763 | - | ||
| 3764 | - th.setData({ | ||
| 3765 | - djs: obj | ||
| 3766 | - }); | ||
| 3767 | - // ---- | 3757 | + | 
| 3758 | + // ---- | ||
| 3759 | + | ||
| 3760 | + | ||
| 3761 | + | ||
| 3762 | + | ||
| 3763 | + th.setData({ | ||
| 3764 | + djs: obj | ||
| 3765 | + }); | ||
| 3766 | + // ---- | ||
| 3768 | setTimeout(function () { | 3767 | setTimeout(function () { | 
| 3769 | th.countDown(endTime) | 3768 | th.countDown(endTime) | 
| 3770 | }, 1000); | 3769 | }, 1000); | 
| @@ -3799,12 +3798,12 @@ Page({ | @@ -3799,12 +3798,12 @@ Page({ | ||
| 3799 | success: function (t) { | 3798 | success: function (t) { | 
| 3800 | if (t.data.code == 0) { | 3799 | if (t.data.code == 0) { | 
| 3801 | var g_buy_num = t.data.data.goodsbuynum; | 3800 | var g_buy_num = t.data.data.goodsbuynum; | 
| 3802 | - | ||
| 3803 | - //如果是秒杀的时候 | ||
| 3804 | - if(th.data.prom_type==0 && gd.prom_type == 1 ){ | ||
| 3805 | - gd.prom_type= 0; | ||
| 3806 | - } | ||
| 3807 | - | 3801 | + | 
| 3802 | + //如果是秒杀的时候 | ||
| 3803 | + if (th.data.prom_type == 0 && gd.prom_type == 1) { | ||
| 3804 | + gd.prom_type = 0; | ||
| 3805 | + } | ||
| 3806 | + | ||
| 3808 | if (gd.prom_type == 1 || gd.prom_type == 2 || gd.prom_type == 4 || gd.prom_type == 6) { | 3807 | if (gd.prom_type == 1 || gd.prom_type == 2 || gd.prom_type == 4 || gd.prom_type == 6) { | 
| 3809 | //----获取活动购买数---- | 3808 | //----获取活动购买数---- | 
| 3810 | getApp().request.get("/api/weshop/ordergoods/getUserBuyGoodsNum", { | 3809 | getApp().request.get("/api/weshop/ordergoods/getUserBuyGoodsNum", { | 
| @@ -3861,7 +3860,7 @@ Page({ | @@ -3861,7 +3860,7 @@ Page({ | ||
| 3861 | }, | 3860 | }, | 
| 3862 | 3861 | ||
| 3863 | //--点击弹起拼单-- | 3862 | //--点击弹起拼单-- | 
| 3864 | - // ind == 1 为普通购买 | 3863 | + // ind == 1 为普通购买 | 
| 3865 | openSpecModel_pt: function (e) { | 3864 | openSpecModel_pt: function (e) { | 
| 3866 | 3865 | ||
| 3867 | this.setData({ open_ind_store: 9, goodsInputNum: 1 }); | 3866 | this.setData({ open_ind_store: 9, goodsInputNum: 1 }); | 
| @@ -3879,125 +3878,125 @@ Page({ | @@ -3879,125 +3878,125 @@ Page({ | ||
| 3879 | page: 1 | 3878 | page: 1 | 
| 3880 | } | 3879 | } | 
| 3881 | }).then(res => { | 3880 | }).then(res => { | 
| 3882 | - if(res.data.code == 0){ | ||
| 3883 | - if (res.data.data.total > 0) { | ||
| 3884 | - // 待支付订单页面 | ||
| 3885 | - wx.showModal({ | ||
| 3886 | - title: "您已经购买了该商品待支付中", | ||
| 3887 | - success: function (a) { | ||
| 3888 | - if (a.confirm) { | ||
| 3889 | - switOn = false; | ||
| 3890 | - wx.navigateTo({ | ||
| 3891 | - url: "/packageC/pages/luckyGo/luckyGo_order/luckyGo_order?order_id=" + res.data.data.pageData[0]['order_id'] | ||
| 3892 | - }); | ||
| 3893 | - } | 3881 | + if (res.data.code == 0) { | 
| 3882 | + if (res.data.data.total > 0) { | ||
| 3883 | + // 待支付订单页面 | ||
| 3884 | + wx.showModal({ | ||
| 3885 | + title: "您已经购买了该商品待支付中", | ||
| 3886 | + success: function (a) { | ||
| 3887 | + if (a.confirm) { | ||
| 3888 | + switOn = false; | ||
| 3889 | + wx.navigateTo({ | ||
| 3890 | + url: "/packageC/pages/luckyGo/luckyGo_order/luckyGo_order?order_id=" + res.data.data.pageData[0]['order_id'] | ||
| 3891 | + }); | ||
| 3894 | } | 3892 | } | 
| 3895 | - }); | ||
| 3896 | - } else { | ||
| 3897 | - //--先判断会员状态-- | ||
| 3898 | - var user_info = getApp().globalData.userInfo; | ||
| 3899 | - if (user_info == null || user_info.mobile == undefined || user_info.mobile == '' || user_info.mobile == null) { | ||
| 3900 | - wx.navigateTo({ | ||
| 3901 | - url: '/pages/togoin/togoin', | ||
| 3902 | - }) | ||
| 3903 | - return false; | ||
| 3904 | - }; | 3893 | + } | 
| 3894 | + }); | ||
| 3895 | + } else { | ||
| 3896 | + //--先判断会员状态-- | ||
| 3897 | + var user_info = getApp().globalData.userInfo; | ||
| 3898 | + if (user_info == null || user_info.mobile == undefined || user_info.mobile == '' || user_info.mobile == null) { | ||
| 3899 | + wx.navigateTo({ | ||
| 3900 | + url: '/pages/togoin/togoin', | ||
| 3901 | + }) | ||
| 3902 | + return false; | ||
| 3903 | + }; | ||
| 3905 | 3904 | ||
| 3906 | - var th = this; | ||
| 3907 | - var ind = parseInt(e.currentTarget.dataset.ind); | ||
| 3908 | - | ||
| 3909 | - console.log('当前ind========>>>>', ind); | ||
| 3910 | - | ||
| 3911 | - //ind == 1是普通购买 | ||
| 3912 | - if (ind == 1) { | ||
| 3913 | - //如果拼单的sku data是空的,就要先获取一下 | ||
| 3914 | - if (th.data.sku_g_pt) { | ||
| 3915 | - th.get_sto(1); | ||
| 3916 | - th.setData({ | ||
| 3917 | - is_normal: ind, | ||
| 3918 | - openSpecModal_pt: 1 | ||
| 3919 | - }); | ||
| 3920 | - } else { | ||
| 3921 | - th.get_sto(1); | ||
| 3922 | - th.get_sku(o.stoid, th.data.data, th.data.gid, 1, function () { | ||
| 3923 | - th.setData({ | ||
| 3924 | - is_normal: ind, | ||
| 3925 | - openSpecModal_pt: 1 | ||
| 3926 | - }); | ||
| 3927 | - }); | ||
| 3928 | - | 3905 | + var th = this; | 
| 3906 | + var ind = parseInt(e.currentTarget.dataset.ind); | ||
| 3907 | + | ||
| 3908 | + console.log('当前ind========>>>>', ind); | ||
| 3909 | + | ||
| 3910 | + //ind == 1是普通购买 | ||
| 3911 | + if (ind == 1) { | ||
| 3912 | + //如果拼单的sku data是空的,就要先获取一下 | ||
| 3913 | + if (th.data.sku_g_pt) { | ||
| 3914 | + th.get_sto(1); | ||
| 3915 | + th.setData({ | ||
| 3916 | + is_normal: ind, | ||
| 3917 | + openSpecModal_pt: 1 | ||
| 3918 | + }); | ||
| 3919 | + } else { | ||
| 3920 | + th.get_sto(1); | ||
| 3921 | + th.get_sku(o.stoid, th.data.data, th.data.gid, 1, function () { | ||
| 3929 | th.setData({ | 3922 | th.setData({ | 
| 3930 | is_normal: ind, | 3923 | is_normal: ind, | 
| 3931 | openSpecModal_pt: 1 | 3924 | openSpecModal_pt: 1 | 
| 3932 | }); | 3925 | }); | 
| 3933 | - }; | ||
| 3934 | - th.check_is_youhui(th.data.gid, 1); | ||
| 3935 | - } else { | 3926 | + }); | 
| 3936 | 3927 | ||
| 3937 | - // //拼单商品从这里进,先判断有没有买过商品, | ||
| 3938 | - // getApp().request.get("/api/weshop/order/page", { | ||
| 3939 | - // data: { | ||
| 3940 | - // // pt_prom_id: th.data.prom_act.id, | ||
| 3941 | - // user_id: oo.user_id, | ||
| 3942 | - // store_id: os.stoid, | ||
| 3943 | - // pageSize: 1, | ||
| 3944 | - // page: 1 | ||
| 3945 | - // }, | ||
| 3946 | - // success: function (e) { | ||
| 3947 | - // //--跳转到已经购买的情况-- | ||
| 3948 | - // if (e.data.data.pageData.length > 0) { | ||
| 3949 | - // var odr = e.data.data.pageData[0]; | ||
| 3950 | - // //还未支付 | ||
| 3951 | - // if (odr.pt_status == 0 && (odr.order_status == 1 || odr.order_status == 0)) { | ||
| 3952 | - // wx.showModal({ | ||
| 3953 | - // title: "您已经购买了该商品待支付中", | ||
| 3954 | - // success: function (a) { | ||
| 3955 | - // if (a.confirm) { | ||
| 3956 | - // wx.navigateTo({ | ||
| 3957 | - // url: "/pages/user/order_detail/order_detail?order_id=" + odr.order_id, | ||
| 3958 | - // }); | ||
| 3959 | - // } | ||
| 3960 | - // } | ||
| 3961 | - // }); | ||
| 3962 | - // } else if (odr.pt_status == 1 && odr.order_status == 1) { | ||
| 3963 | - | ||
| 3964 | - // if (this.data.is_go_to_team_show) return false; | ||
| 3965 | - // this.data.is_go_to_team_show = 1; | ||
| 3966 | - // wx.showLoading(); | ||
| 3967 | - | ||
| 3968 | - // /*--- | ||
| 3969 | - // wx.redirectTo({ | ||
| 3970 | - // url: "/pages/team/team_success/team_success?ordersn=" + odr.order_sn, | ||
| 3971 | - // });--*/ | ||
| 3972 | - // getApp().goto("/pages/team/team_success/team_success?ordersn=" + odr.order_sn); | ||
| 3973 | - | ||
| 3974 | - // } else { | ||
| 3975 | - // th.setData({ | ||
| 3976 | - // is_normal: ind, | ||
| 3977 | - // openSpecModal_pt: 1 | ||
| 3978 | - // }); | ||
| 3979 | - // } | ||
| 3980 | - | ||
| 3981 | - // } else { | ||
| 3982 | - // th.setData({ | ||
| 3983 | - // is_normal: ind, | ||
| 3984 | - // openSpecModal_pt: 1 | ||
| 3985 | - // }); | ||
| 3986 | - // } | ||
| 3987 | - // } | ||
| 3988 | - // }); | ||
| 3989 | - th.get_sto(1); | ||
| 3990 | th.setData({ | 3928 | th.setData({ | 
| 3991 | - is_normal: 0, | 3929 | + is_normal: ind, | 
| 3992 | openSpecModal_pt: 1 | 3930 | openSpecModal_pt: 1 | 
| 3993 | }); | 3931 | }); | 
| 3994 | - | ||
| 3995 | - } | 3932 | + }; | 
| 3933 | + th.check_is_youhui(th.data.gid, 1); | ||
| 3934 | + } else { | ||
| 3935 | + | ||
| 3936 | + // //拼单商品从这里进,先判断有没有买过商品, | ||
| 3937 | + // getApp().request.get("/api/weshop/order/page", { | ||
| 3938 | + // data: { | ||
| 3939 | + // // pt_prom_id: th.data.prom_act.id, | ||
| 3940 | + // user_id: oo.user_id, | ||
| 3941 | + // store_id: os.stoid, | ||
| 3942 | + // pageSize: 1, | ||
| 3943 | + // page: 1 | ||
| 3944 | + // }, | ||
| 3945 | + // success: function (e) { | ||
| 3946 | + // //--跳转到已经购买的情况-- | ||
| 3947 | + // if (e.data.data.pageData.length > 0) { | ||
| 3948 | + // var odr = e.data.data.pageData[0]; | ||
| 3949 | + // //还未支付 | ||
| 3950 | + // if (odr.pt_status == 0 && (odr.order_status == 1 || odr.order_status == 0)) { | ||
| 3951 | + // wx.showModal({ | ||
| 3952 | + // title: "您已经购买了该商品待支付中", | ||
| 3953 | + // success: function (a) { | ||
| 3954 | + // if (a.confirm) { | ||
| 3955 | + // wx.navigateTo({ | ||
| 3956 | + // url: "/pages/user/order_detail/order_detail?order_id=" + odr.order_id, | ||
| 3957 | + // }); | ||
| 3958 | + // } | ||
| 3959 | + // } | ||
| 3960 | + // }); | ||
| 3961 | + // } else if (odr.pt_status == 1 && odr.order_status == 1) { | ||
| 3962 | + | ||
| 3963 | + // if (this.data.is_go_to_team_show) return false; | ||
| 3964 | + // this.data.is_go_to_team_show = 1; | ||
| 3965 | + // wx.showLoading(); | ||
| 3966 | + | ||
| 3967 | + // /*--- | ||
| 3968 | + // wx.redirectTo({ | ||
| 3969 | + // url: "/pages/team/team_success/team_success?ordersn=" + odr.order_sn, | ||
| 3970 | + // });--*/ | ||
| 3971 | + // getApp().goto("/pages/team/team_success/team_success?ordersn=" + odr.order_sn); | ||
| 3972 | + | ||
| 3973 | + // } else { | ||
| 3974 | + // th.setData({ | ||
| 3975 | + // is_normal: ind, | ||
| 3976 | + // openSpecModal_pt: 1 | ||
| 3977 | + // }); | ||
| 3978 | + // } | ||
| 3979 | + | ||
| 3980 | + // } else { | ||
| 3981 | + // th.setData({ | ||
| 3982 | + // is_normal: ind, | ||
| 3983 | + // openSpecModal_pt: 1 | ||
| 3984 | + // }); | ||
| 3985 | + // } | ||
| 3986 | + // } | ||
| 3987 | + // }); | ||
| 3988 | + th.get_sto(1); | ||
| 3989 | + th.setData({ | ||
| 3990 | + is_normal: 0, | ||
| 3991 | + openSpecModal_pt: 1 | ||
| 3992 | + }); | ||
| 3993 | + | ||
| 3996 | } | 3994 | } | 
| 3997 | - | ||
| 3998 | } | 3995 | } | 
| 3996 | + | ||
| 3997 | + } | ||
| 3999 | }); | 3998 | }); | 
| 4000 | - | 3999 | + | 
| 4001 | 4000 | ||
| 4002 | 4001 | ||
| 4003 | 4002 | ||
| @@ -4005,9 +4004,9 @@ Page({ | @@ -4005,9 +4004,9 @@ Page({ | ||
| 4005 | 4004 | ||
| 4006 | //-----------------拼单生成方法--------------------- | 4005 | //-----------------拼单生成方法--------------------- | 
| 4007 | addCart_pt: function () { | 4006 | addCart_pt: function () { | 
| 4008 | - this.setData({ | ||
| 4009 | - openSpecModal_pt: 0, | ||
| 4010 | - }); | 4007 | + this.setData({ | 
| 4008 | + openSpecModal_pt: 0, | ||
| 4009 | + }); | ||
| 4011 | if (this.data.is_normal == 0) { | 4010 | if (this.data.is_normal == 0) { | 
| 4012 | //看一下有没有起购数,如果有起购数,要计算起购数 | 4011 | //看一下有没有起购数,如果有起购数,要计算起购数 | 
| 4013 | // var qnum = parseFloat(th.data.prom_act.minbuynum); | 4012 | // var qnum = parseFloat(th.data.prom_act.minbuynum); | 
| @@ -4049,7 +4048,7 @@ Page({ | @@ -4049,7 +4048,7 @@ Page({ | ||
| 4049 | // return false; | 4048 | // return false; | 
| 4050 | // } | 4049 | // } | 
| 4051 | // } | 4050 | // } | 
| 4052 | - | 4051 | + | 
| 4053 | //---判断商品是否超出活动限购,拼团的普通购买不计算活动的限购--- | 4052 | //---判断商品是否超出活动限购,拼团的普通购买不计算活动的限购--- | 
| 4054 | // if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0 && th.data.is_normal != 1) { | 4053 | // if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0 && th.data.is_normal != 1) { | 
| 4055 | // if (th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit) { | 4054 | // if (th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit) { | 
| @@ -4098,7 +4097,7 @@ Page({ | @@ -4098,7 +4097,7 @@ Page({ | ||
| 4098 | sto_sele_name: "" | 4097 | sto_sele_name: "" | 
| 4099 | }); | 4098 | }); | 
| 4100 | if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); | 4099 | if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); | 
| 4101 | - | 4100 | + | 
| 4102 | //--------------此时操作的数据------------ | 4101 | //--------------此时操作的数据------------ | 
| 4103 | var newd = { | 4102 | var newd = { | 
| 4104 | goods_id: o.goods_id, | 4103 | goods_id: o.goods_id, | 
| @@ -4171,11 +4170,11 @@ Page({ | @@ -4171,11 +4170,11 @@ Page({ | ||
| 4171 | } | 4170 | } | 
| 4172 | 4171 | ||
| 4173 | } | 4172 | } | 
| 4174 | - | ||
| 4175 | - // else if (th.data.prom_type == 3) { | ||
| 4176 | - // newd.prom_type = 0; | ||
| 4177 | - // newd.prom_id = 0; | ||
| 4178 | - // } | 4173 | + | 
| 4174 | + // else if (th.data.prom_type == 3) { | ||
| 4175 | + // newd.prom_type = 0; | ||
| 4176 | + // newd.prom_id = 0; | ||
| 4177 | + // } | ||
| 4179 | 4178 | ||
| 4180 | newd['pick_name'] = th.data.sto_sele_name; | 4179 | newd['pick_name'] = th.data.sto_sele_name; | 
| 4181 | newd['pick_dis'] = th.data.sto_sele_distr; | 4180 | newd['pick_dis'] = th.data.sto_sele_distr; | 
| @@ -4189,25 +4188,25 @@ Page({ | @@ -4189,25 +4188,25 @@ Page({ | ||
| 4189 | newd['prom_type'] = 0; | 4188 | newd['prom_type'] = 0; | 
| 4190 | newd['prom_id'] = e.act_id; | 4189 | newd['prom_id'] = e.act_id; | 
| 4191 | } | 4190 | } | 
| 4192 | - console.log('aaaaa'); | ||
| 4193 | - newd['prom_type'] = 0; | 4191 | + console.log('aaaaa'); | 
| 4192 | + newd['prom_type'] = 0; | ||
| 4194 | th.buyNow(newd); | 4193 | th.buyNow(newd); | 
| 4195 | }); | 4194 | }); | 
| 4196 | } | 4195 | } | 
| 4197 | else { | 4196 | else { | 
| 4198 | - // 点击立即参团 | ||
| 4199 | - th.buyNow_pt(newd); | ||
| 4200 | - }; | 4197 | + // 点击立即参团 | 
| 4198 | + th.buyNow_pt(newd); | ||
| 4199 | + }; | ||
| 4201 | }) | 4200 | }) | 
| 4202 | }, | 4201 | }, | 
| 4203 | //----------立即购买_pt----------- | 4202 | //----------立即购买_pt----------- | 
| 4204 | buyNow_pt: function (e) { | 4203 | buyNow_pt: function (e) { | 
| 4205 | s.set_b_now(e); | 4204 | s.set_b_now(e); | 
| 4206 | wx.navigateTo({ | 4205 | wx.navigateTo({ | 
| 4207 | - url: "/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct?is_bnow=1&group_id=" + this.data.group_id + "&goods_id=" + e.goods_id + "&alert=" + this.data.luckGoInfo.lc_alert + '&goods_price=' + this.data.luckGoInfo.group_price/100 + '&is_show=' + this.data.luckGoInfo.is_show, | 4206 | + url: "/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct?is_bnow=1&group_id=" + this.data.group_id + "&goods_id=" + e.goods_id + "&alert=" + this.data.luckGoInfo.lc_alert + '&goods_price=' + this.data.luckGoInfo.group_price / 100 + '&is_show=' + this.data.luckGoInfo.is_show, | 
| 4208 | }); | 4207 | }); | 
| 4209 | - | ||
| 4210 | - // getApp().goto("/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart?is_bnow=1&group_id=" + th.data.group_id +"&goods_id=" + e.goods_id + "&alert=" + th.data.luckGoInfo.lc_alert); | 4208 | + | 
| 4209 | + // getApp().goto("/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart?is_bnow=1&group_id=" + th.data.group_id +"&goods_id=" + e.goods_id + "&alert=" + th.data.luckGoInfo.lc_alert); | ||
| 4211 | }, | 4210 | }, | 
| 4212 | 4211 | ||
| 4213 | //-------跳转pt商品------- | 4212 | //-------跳转pt商品------- | 
| @@ -4529,95 +4528,95 @@ Page({ | @@ -4529,95 +4528,95 @@ Page({ | ||
| 4529 | } | 4528 | } | 
| 4530 | }) | 4529 | }) | 
| 4531 | }, | 4530 | }, | 
| 4532 | - | ||
| 4533 | - | ||
| 4534 | - drawPoster(context, unit, img, vpath) { | ||
| 4535 | - // 1.灰色背景 | ||
| 4536 | - context.setFillStyle('#f2f1f6'); | ||
| 4537 | - context.rect(0,0,554*unit,899*unit); | ||
| 4538 | - context.fill(); | ||
| 4539 | - // 2.商城名称 | ||
| 4540 | - let shopName = this.data.sto_sele_name_1; | ||
| 4541 | - // let shopNameLen = context.measureText(shopName); | ||
| 4542 | - // let x_shopNameLen = (554 - shopNameLen.width)/2*unit; | ||
| 4543 | - // console.log('11111111111111',shopNameLen,x_shopNameLen); | ||
| 4544 | - context.setTextAlign('center'); | ||
| 4545 | - context.setFontSize(26*unit); | ||
| 4546 | - context.setFillStyle('black'); | ||
| 4547 | - context.fillText(shopName, 277*unit, 60*unit); | ||
| 4548 | - // // 3.推荐来源 | ||
| 4549 | - let fromText = `来自${getApp().globalData.userInfo.nickname}的推荐`; | ||
| 4550 | - // let fromTextLen = context.measureText(fromText); | ||
| 4551 | - // let x_fromText = (375 - fromTextLen.width)/2; | ||
| 4552 | - // console.log('222222',fromTextLen,x_fromText); | ||
| 4553 | - context.setTextAlign('center'); | ||
| 4554 | - context.setFontSize(22*unit); | ||
| 4555 | - context.setFillStyle('#96959a'); | ||
| 4556 | - context.fillText(fromText, 277*unit, 105*unit); | ||
| 4557 | - // 4.海报背景 | ||
| 4558 | - // context.beginPath(); | ||
| 4559 | - // context.setStrokeStyle('#f2f1f6'); | ||
| 4560 | - context.setFillStyle('white'); | ||
| 4561 | - context.fillRect(37*unit, 157*unit, 480*unit, 673*unit); | ||
| 4562 | - // context.stroke(); | ||
| 4563 | - // context.fill(); | ||
| 4564 | - // 5.商品图片 | ||
| 4565 | - // 图片的x坐标 | ||
| 4566 | - let bg_x = 37*unit | ||
| 4567 | - // 图片的y坐标 | ||
| 4568 | - let bg_y = 157*unit | ||
| 4569 | - // 图片宽度 | ||
| 4570 | - let bg_w = 480*unit | ||
| 4571 | - // 图片高度 | ||
| 4572 | - let bg_h = 474*unit | ||
| 4573 | - // 图片圆角 | ||
| 4574 | - let bg_r = 4 | ||
| 4575 | - // 绘制海报背景图片圆角 | ||
| 4576 | - context.save() | ||
| 4577 | - context.beginPath() | ||
| 4578 | - context.arc(bg_x + bg_r, bg_y + bg_r, bg_r, Math.PI, Math.PI*1.5) | ||
| 4579 | - context.arc(bg_x + bg_w - bg_r, bg_y + bg_r, bg_r, Math.PI * 1.5, Math.PI * 2) | ||
| 4580 | - context.arc(bg_x + bg_w, bg_y + bg_h, bg_r, 0, Math.PI * 0.5) | ||
| 4581 | - context.arc(bg_x, bg_y + bg_h, 0, Math.PI * 0.5, Math.PI) | ||
| 4582 | - context.clip() | ||
| 4583 | - context.drawImage(img, bg_x, bg_y, bg_w, bg_h); | ||
| 4584 | - context.restore() | ||
| 4585 | - // 6.强烈推荐 | ||
| 4586 | - // context.beginPath(); | ||
| 4587 | - let tj_path = "../../../../images/share/q_tj.png"; | ||
| 4588 | - context.beginPath() | ||
| 4589 | - context.drawImage(tj_path, 54*unit, 648*unit, 85*unit, 30*unit); | ||
| 4590 | - context.setFontSize(16*unit) | ||
| 4591 | - context.setLineJoin('round'); //交点设置成圆角 | ||
| 4592 | - context.setFillStyle("white") | ||
| 4593 | - context.setTextAlign('left'); | ||
| 4594 | - context.fillText('强烈推荐', 64*unit, 672*unit); | ||
| 4595 | - // 7.商品价格 | ||
| 4596 | - let price = '¥' + this.data.data.shop_price; | ||
| 4597 | - // if (th.data.prom_act) | ||
| 4598 | - // pri0 = th.data.prom_act.price; | ||
| 4599 | - context.setFontSize(32*unit); | ||
| 4600 | - context.setFillStyle('#DE1117'); | ||
| 4601 | - context.fillText(price, 54*unit, 730*unit); | ||
| 4602 | - // 8.商品标题 | ||
| 4603 | - context.setFontSize(20*unit); | ||
| 4604 | - context.setFillStyle('#898989'); | ||
| 4605 | - this.draw_Text(context, this.data.data.goods_name, | ||
| 4606 | - 54*unit, 770*unit, 240*unit, 240*unit, unit); | ||
| 4607 | - // 9.小程序码 | ||
| 4608 | - context.drawImage(vpath, 375*unit, 660*unit, 120*unit, 120*unit); | ||
| 4609 | - context.setFontSize(16*unit); | ||
| 4610 | - context.setFillStyle('#777'); | ||
| 4611 | - context.fillText('长按识别二维码', 378*unit, 810*unit); | ||
| 4612 | - // 10.竖线 | ||
| 4613 | - context.beginPath(); | ||
| 4614 | - context.setFillStyle('#eee'); | ||
| 4615 | - context.rect(354*unit, 670*unit, 1*unit, 130*unit); | ||
| 4616 | - context.fill(); | ||
| 4617 | - | ||
| 4618 | - }, | ||
| 4619 | - | ||
| 4620 | - | 4531 | + | 
| 4532 | + | ||
| 4533 | + drawPoster(context, unit, img, vpath) { | ||
| 4534 | + // 1.灰色背景 | ||
| 4535 | + context.setFillStyle('#f2f1f6'); | ||
| 4536 | + context.rect(0, 0, 554 * unit, 899 * unit); | ||
| 4537 | + context.fill(); | ||
| 4538 | + // 2.商城名称 | ||
| 4539 | + let shopName = this.data.sto_sele_name_1; | ||
| 4540 | + // let shopNameLen = context.measureText(shopName); | ||
| 4541 | + // let x_shopNameLen = (554 - shopNameLen.width)/2*unit; | ||
| 4542 | + // console.log('11111111111111',shopNameLen,x_shopNameLen); | ||
| 4543 | + context.setTextAlign('center'); | ||
| 4544 | + context.setFontSize(26 * unit); | ||
| 4545 | + context.setFillStyle('black'); | ||
| 4546 | + context.fillText(shopName, 277 * unit, 60 * unit); | ||
| 4547 | + // // 3.推荐来源 | ||
| 4548 | + let fromText = `来自${getApp().globalData.userInfo.nickname}的推荐`; | ||
| 4549 | + // let fromTextLen = context.measureText(fromText); | ||
| 4550 | + // let x_fromText = (375 - fromTextLen.width)/2; | ||
| 4551 | + // console.log('222222',fromTextLen,x_fromText); | ||
| 4552 | + context.setTextAlign('center'); | ||
| 4553 | + context.setFontSize(22 * unit); | ||
| 4554 | + context.setFillStyle('#96959a'); | ||
| 4555 | + context.fillText(fromText, 277 * unit, 105 * unit); | ||
| 4556 | + // 4.海报背景 | ||
| 4557 | + // context.beginPath(); | ||
| 4558 | + // context.setStrokeStyle('#f2f1f6'); | ||
| 4559 | + context.setFillStyle('white'); | ||
| 4560 | + context.fillRect(37 * unit, 157 * unit, 480 * unit, 673 * unit); | ||
| 4561 | + // context.stroke(); | ||
| 4562 | + // context.fill(); | ||
| 4563 | + // 5.商品图片 | ||
| 4564 | + // 图片的x坐标 | ||
| 4565 | + let bg_x = 37 * unit | ||
| 4566 | + // 图片的y坐标 | ||
| 4567 | + let bg_y = 157 * unit | ||
| 4568 | + // 图片宽度 | ||
| 4569 | + let bg_w = 480 * unit | ||
| 4570 | + // 图片高度 | ||
| 4571 | + let bg_h = 474 * unit | ||
| 4572 | + // 图片圆角 | ||
| 4573 | + let bg_r = 4 | ||
| 4574 | + // 绘制海报背景图片圆角 | ||
| 4575 | + context.save() | ||
| 4576 | + context.beginPath() | ||
| 4577 | + context.arc(bg_x + bg_r, bg_y + bg_r, bg_r, Math.PI, Math.PI * 1.5) | ||
| 4578 | + context.arc(bg_x + bg_w - bg_r, bg_y + bg_r, bg_r, Math.PI * 1.5, Math.PI * 2) | ||
| 4579 | + context.arc(bg_x + bg_w, bg_y + bg_h, bg_r, 0, Math.PI * 0.5) | ||
| 4580 | + context.arc(bg_x, bg_y + bg_h, 0, Math.PI * 0.5, Math.PI) | ||
| 4581 | + context.clip() | ||
| 4582 | + context.drawImage(img, bg_x, bg_y, bg_w, bg_h); | ||
| 4583 | + context.restore() | ||
| 4584 | + // 6.强烈推荐 | ||
| 4585 | + // context.beginPath(); | ||
| 4586 | + let tj_path = "../../../../images/share/q_tj.png"; | ||
| 4587 | + context.beginPath() | ||
| 4588 | + context.drawImage(tj_path, 54 * unit, 648 * unit, 85 * unit, 30 * unit); | ||
| 4589 | + context.setFontSize(16 * unit) | ||
| 4590 | + context.setLineJoin('round'); //交点设置成圆角 | ||
| 4591 | + context.setFillStyle("white") | ||
| 4592 | + context.setTextAlign('left'); | ||
| 4593 | + context.fillText('强烈推荐', 64 * unit, 672 * unit); | ||
| 4594 | + // 7.商品价格 | ||
| 4595 | + let price = '¥' + this.data.data.shop_price; | ||
| 4596 | + // if (th.data.prom_act) | ||
| 4597 | + // pri0 = th.data.prom_act.price; | ||
| 4598 | + context.setFontSize(32 * unit); | ||
| 4599 | + context.setFillStyle('#DE1117'); | ||
| 4600 | + context.fillText(price, 54 * unit, 730 * unit); | ||
| 4601 | + // 8.商品标题 | ||
| 4602 | + context.setFontSize(20 * unit); | ||
| 4603 | + context.setFillStyle('#898989'); | ||
| 4604 | + this.draw_Text(context, this.data.data.goods_name, | ||
| 4605 | + 54 * unit, 770 * unit, 240 * unit, 240 * unit, unit); | ||
| 4606 | + // 9.小程序码 | ||
| 4607 | + context.drawImage(vpath, 375 * unit, 660 * unit, 120 * unit, 120 * unit); | ||
| 4608 | + context.setFontSize(16 * unit); | ||
| 4609 | + context.setFillStyle('#777'); | ||
| 4610 | + context.fillText('长按识别二维码', 378 * unit, 810 * unit); | ||
| 4611 | + // 10.竖线 | ||
| 4612 | + context.beginPath(); | ||
| 4613 | + context.setFillStyle('#eee'); | ||
| 4614 | + context.rect(354 * unit, 670 * unit, 1 * unit, 130 * unit); | ||
| 4615 | + context.fill(); | ||
| 4616 | + | ||
| 4617 | + }, | ||
| 4618 | + | ||
| 4619 | + | ||
| 4621 | 4620 | ||
| 4622 | //--定义的保存图片方法,分享团--- | 4621 | //--定义的保存图片方法,分享团--- | 
| 4623 | saveImageToPhotosAlbum: function () { | 4622 | saveImageToPhotosAlbum: function () { | 
| @@ -4630,16 +4629,16 @@ Page({ | @@ -4630,16 +4629,16 @@ Page({ | ||
| 4630 | } | 4629 | } | 
| 4631 | 4630 | ||
| 4632 | if (this.data.share_hidden) { | 4631 | if (this.data.share_hidden) { | 
| 4633 | - this.setData({ share_hidden: false,}); | 4632 | + this.setData({ share_hidden: false, }); | 
| 4634 | }; | 4633 | }; | 
| 4635 | 4634 | ||
| 4636 | //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团 9幸运购 | 4635 | //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团 9幸运购 | 
| 4637 | var type = 9; | 4636 | var type = 9; | 
| 4638 | - console.log('type',type); | 4637 | + console.log('type', type); | 
| 4639 | if (type == 6) type = 2; | 4638 | if (type == 6) type = 2; | 
| 4640 | if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3; | 4639 | if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3; | 
| 4641 | 4640 | ||
| 4642 | - wx.showLoading({ title: '生成中...',}) | 4641 | + wx.showLoading({ title: '生成中...', }) | 
| 4643 | var that = this, th = that; | 4642 | var that = this, th = that; | 
| 4644 | //设置画板显示,才能开始绘图 | 4643 | //设置画板显示,才能开始绘图 | 
| 4645 | that.setData({ | 4644 | that.setData({ | 
| @@ -4650,8 +4649,8 @@ Page({ | @@ -4650,8 +4649,8 @@ Page({ | ||
| 4650 | var unit = that.data.screenWidth / 750 * 1.35; //基础单位, | 4649 | var unit = that.data.screenWidth / 750 * 1.35; //基础单位, | 
| 4651 | var path2 = that.data.data.original_img; | 4650 | var path2 = that.data.data.original_img; | 
| 4652 | var scene = th.data.gid + ""; | 4651 | var scene = th.data.gid + ""; | 
| 4653 | - scene+="."+th.data.sele_g.prom_type+"."+th.data.luckGoInfo.id; | ||
| 4654 | - // th.data.sele_g.prom_id | 4652 | + scene += "." + th.data.sele_g.prom_type + "." + th.data.luckGoInfo.id; | 
| 4653 | + // th.data.sele_g.prom_id | ||
| 4655 | 4654 | ||
| 4656 | var user_id = getApp().globalData.user_id ? getApp().globalData.user_id : 0; | 4655 | var user_id = getApp().globalData.user_id ? getApp().globalData.user_id : 0; | 
| 4657 | if (user_id > 0) { | 4656 | if (user_id > 0) { | 
| @@ -4664,13 +4663,13 @@ Page({ | @@ -4664,13 +4663,13 @@ Page({ | ||
| 4664 | scene += "_" + getApp().globalData.room_id; | 4663 | scene += "_" + getApp().globalData.room_id; | 
| 4665 | } | 4664 | } | 
| 4666 | ///二微码 | 4665 | ///二微码 | 
| 4667 | - var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + | ||
| 4668 | - os.stoid + "?sceneValue=" + scene + "&pageValue=packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo"; | 4666 | + var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + | 
| 4667 | + os.stoid + "?sceneValue=" + scene + "&pageValue=packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo"; | ||
| 4669 | // var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + | 4668 | // var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + | 
| 4670 | // os.stoid + "?sceneValue=" + scene + "&pageValue=packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo"; | 4669 | // os.stoid + "?sceneValue=" + scene + "&pageValue=packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo"; | 
| 4671 | 4670 | ||
| 4672 | - console.log('path3......',path3); | ||
| 4673 | - | 4671 | + console.log('path3......', path3); | 
| 4672 | + | ||
| 4674 | 4673 | ||
| 4675 | // 读取文件成功则OK-- | 4674 | // 读取文件成功则OK-- | 
| 4676 | wx.getImageInfo({ | 4675 | wx.getImageInfo({ | 
| @@ -4685,86 +4684,86 @@ Page({ | @@ -4685,86 +4684,86 @@ Page({ | ||
| 4685 | 4684 | ||
| 4686 | // context.fillStyle="#FFFFFF"; | 4685 | // context.fillStyle="#FFFFFF"; | 
| 4687 | // context.fillRect(0,0,554 * unit, 899 * unit); | 4686 | // context.fillRect(0,0,554 * unit, 899 * unit); | 
| 4688 | - | ||
| 4689 | - // if(type == 0) { | ||
| 4690 | - // this.drawPoster(context); | ||
| 4691 | - // return false; | ||
| 4692 | - // }; | ||
| 4693 | - | 4687 | + | 
| 4688 | + // if(type == 0) { | ||
| 4689 | + // this.drawPoster(context); | ||
| 4690 | + // return false; | ||
| 4691 | + // }; | ||
| 4692 | + | ||
| 4694 | 4693 | ||
| 4695 | //-- 如果有自定义海报的时候,判断背景的图片 -- | 4694 | //-- 如果有自定义海报的时候,判断背景的图片 -- | 
| 4696 | if (th.data.share_b_img) { | 4695 | if (th.data.share_b_img) { | 
| 4697 | pg_path = th.data.share_b_img; | 4696 | pg_path = th.data.share_b_img; | 
| 4698 | } | 4697 | } | 
| 4699 | // context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); | 4698 | // context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); | 
| 4700 | - | ||
| 4701 | - | ||
| 4702 | - if(type == 0) { // 如果是普通商品,绘制新海报 | ||
| 4703 | - th.drawPoster(context, unit, th.data.share_goods_img, vpath); | ||
| 4704 | - } else { | ||
| 4705 | - context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); | ||
| 4706 | - }; | ||
| 4707 | - | ||
| 4708 | - // th.drawPoster(context, unit, th.data.share_goods_img, vpath); | ||
| 4709 | - | 4699 | + | 
| 4700 | + | ||
| 4701 | + if (type == 0) { // 如果是普通商品,绘制新海报 | ||
| 4702 | + th.drawPoster(context, unit, th.data.share_goods_img, vpath); | ||
| 4703 | + } else { | ||
| 4704 | + context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); | ||
| 4705 | + }; | ||
| 4706 | + | ||
| 4707 | + // th.drawPoster(context, unit, th.data.share_goods_img, vpath); | ||
| 4708 | + | ||
| 4710 | 4709 | ||
| 4711 | //-- 是自定义海报的情况下 -- | 4710 | //-- 是自定义海报的情况下 -- | 
| 4712 | - if(type != 0) { | ||
| 4713 | - | ||
| 4714 | - | ||
| 4715 | - | ||
| 4716 | - if (th.data.poster && parseInt(th.data.poster.style) == 2) { | ||
| 4717 | - //在线上分享人的情况下 | ||
| 4718 | - if (parseInt(th.data.poster.show_headpic)) { | ||
| 4719 | - //获取坐标 | ||
| 4720 | - var x = parseFloat(th.data.poster.head_x) * 2; | ||
| 4721 | - var y = parseFloat(th.data.poster.head_y) * 2; | ||
| 4722 | - var x1 = (x + 90) * unit; | ||
| 4723 | - var y1 = (y + 50) * unit; | ||
| 4724 | - //--昵称--- | ||
| 4725 | - context.setFontSize(24 * unit) | ||
| 4726 | - context.setFillStyle("black") | ||
| 4727 | - context.fillText(app.globalData.userInfo.nickname, x1, y1); | ||
| 4728 | - var width = 24 * app.globalData.userInfo.nickname.length * unit + 4 * unit; | ||
| 4729 | - //强烈推荐 改许程 | ||
| 4730 | - var tj_path = "../../../../images/share/q_tj.png"; | ||
| 4731 | - context.drawImage(tj_path, x1 + width, y1 - 22 * unit, 85 * unit, 30 * unit); | ||
| 4732 | - context.setFontSize(16 * unit); | ||
| 4733 | - context.setLineJoin('round'); //交点设置成圆角 | ||
| 4734 | - context.setFillStyle("white"); | ||
| 4735 | - context.fillText('强烈推荐', x1 + width + 8 * unit, y1 - 1 * unit); | ||
| 4736 | - | ||
| 4737 | - //context.setFillStyle("black") | ||
| 4738 | - //context.setFontSize(24 * unit) | ||
| 4739 | - //context.fillText(getApp().globalData.config.store_name, 40 * unit, 130 * unit); | ||
| 4740 | - } | ||
| 4741 | - } else { | ||
| 4742 | - //--昵称--- | ||
| 4743 | - context.setFontSize(24 * unit); | ||
| 4744 | - context.setFillStyle("black"); | ||
| 4745 | - context.fillText(app.globalData.userInfo.nickname, 152 * unit, 60 * unit); | ||
| 4746 | - var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit; | ||
| 4747 | - //强烈推荐 改许程 | ||
| 4748 | - // var tj_path = "../../../../images/share/q_tj.png"; | ||
| 4749 | - // let txt_gn = th.data.luckGoInfo.group_num + '人团'; | ||
| 4750 | - // let width_gn = ut.measureText(txt_gn, 15); | ||
| 4751 | - // context.drawImage(tj_path, 152 * unit + width, 54 * unit, (width_gn + 20) * unit, 30 * unit); | ||
| 4752 | - // context.setFontSize(16 * unit); | ||
| 4753 | - // context.setLineJoin('round'); //交点设置成圆角 | ||
| 4754 | - // context.setFillStyle("white"); | ||
| 4755 | - // context.fillText(txt_gn, 149 * unit + width + 15 * unit, 75 * unit); | ||
| 4756 | - // 发出幸运购活动邀请 | ||
| 4757 | - context.setFillStyle("#7f7f7f") | ||
| 4758 | - context.setFontSize(21.3 * unit) | ||
| 4759 | - context.fillText("向您发出幸运购邀请", 152 * unit, 90 * unit); | ||
| 4760 | - | ||
| 4761 | - } | ||
| 4762 | - | ||
| 4763 | - }; | ||
| 4764 | - | ||
| 4765 | - | ||
| 4766 | - | ||
| 4767 | - var share_title = th.data.data.goods_name; | 4711 | + if (type != 0) { | 
| 4712 | + | ||
| 4713 | + | ||
| 4714 | + | ||
| 4715 | + if (th.data.poster && parseInt(th.data.poster.style) == 2) { | ||
| 4716 | + //在线上分享人的情况下 | ||
| 4717 | + if (parseInt(th.data.poster.show_headpic)) { | ||
| 4718 | + //获取坐标 | ||
| 4719 | + var x = parseFloat(th.data.poster.head_x) * 2; | ||
| 4720 | + var y = parseFloat(th.data.poster.head_y) * 2; | ||
| 4721 | + var x1 = (x + 90) * unit; | ||
| 4722 | + var y1 = (y + 50) * unit; | ||
| 4723 | + //--昵称--- | ||
| 4724 | + context.setFontSize(24 * unit) | ||
| 4725 | + context.setFillStyle("black") | ||
| 4726 | + context.fillText(app.globalData.userInfo.nickname, x1, y1); | ||
| 4727 | + var width = 24 * app.globalData.userInfo.nickname.length * unit + 4 * unit; | ||
| 4728 | + //强烈推荐 改许程 | ||
| 4729 | + var tj_path = "../../../../images/share/q_tj.png"; | ||
| 4730 | + context.drawImage(tj_path, x1 + width, y1 - 22 * unit, 85 * unit, 30 * unit); | ||
| 4731 | + context.setFontSize(16 * unit); | ||
| 4732 | + context.setLineJoin('round'); //交点设置成圆角 | ||
| 4733 | + context.setFillStyle("white"); | ||
| 4734 | + context.fillText('强烈推荐', x1 + width + 8 * unit, y1 - 1 * unit); | ||
| 4735 | + | ||
| 4736 | + //context.setFillStyle("black") | ||
| 4737 | + //context.setFontSize(24 * unit) | ||
| 4738 | + //context.fillText(getApp().globalData.config.store_name, 40 * unit, 130 * unit); | ||
| 4739 | + } | ||
| 4740 | + } else { | ||
| 4741 | + //--昵称--- | ||
| 4742 | + context.setFontSize(24 * unit); | ||
| 4743 | + context.setFillStyle("black"); | ||
| 4744 | + context.fillText(app.globalData.userInfo.nickname, 152 * unit, 60 * unit); | ||
| 4745 | + var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit; | ||
| 4746 | + //强烈推荐 改许程 | ||
| 4747 | + // var tj_path = "../../../../images/share/q_tj.png"; | ||
| 4748 | + // let txt_gn = th.data.luckGoInfo.group_num + '人团'; | ||
| 4749 | + // let width_gn = ut.measureText(txt_gn, 15); | ||
| 4750 | + // context.drawImage(tj_path, 152 * unit + width, 54 * unit, (width_gn + 20) * unit, 30 * unit); | ||
| 4751 | + // context.setFontSize(16 * unit); | ||
| 4752 | + // context.setLineJoin('round'); //交点设置成圆角 | ||
| 4753 | + // context.setFillStyle("white"); | ||
| 4754 | + // context.fillText(txt_gn, 149 * unit + width + 15 * unit, 75 * unit); | ||
| 4755 | + // 发出幸运购活动邀请 | ||
| 4756 | + context.setFillStyle("#7f7f7f") | ||
| 4757 | + context.setFontSize(21.3 * unit) | ||
| 4758 | + context.fillText("向您发出幸运购邀请", 152 * unit, 90 * unit); | ||
| 4759 | + | ||
| 4760 | + } | ||
| 4761 | + | ||
| 4762 | + }; | ||
| 4763 | + | ||
| 4764 | + | ||
| 4765 | + | ||
| 4766 | + var share_title = th.data.data.goods_name; | ||
| 4768 | if (th.data.prom_type == 1 || th.data.prom_type == 6 || th.data.prom_type == 4) { | 4767 | if (th.data.prom_type == 1 || th.data.prom_type == 6 || th.data.prom_type == 4) { | 
| 4769 | share_title = th.data.prom_act.share_title; | 4768 | share_title = th.data.prom_act.share_title; | 
| 4770 | if (!share_title) share_title = th.data.prom_act.title; | 4769 | if (!share_title) share_title = th.data.prom_act.title; | 
| @@ -4784,8 +4783,8 @@ Page({ | @@ -4784,8 +4783,8 @@ Page({ | ||
| 4784 | context.setFillStyle("red") | 4783 | context.setFillStyle("red") | 
| 4785 | 4784 | ||
| 4786 | 4785 | ||
| 4787 | - var pri0 = th.data.luckGoInfo.group_price/100; | ||
| 4788 | - // console.log('pri0========>>>>>', pri0); | 4786 | + var pri0 = th.data.luckGoInfo.group_price / 100; | 
| 4787 | + // console.log('pri0========>>>>>', pri0); | ||
| 4789 | // if (th.data.prom_act) | 4788 | // if (th.data.prom_act) | 
| 4790 | // pri0 = th.data.prom_act.price; | 4789 | // pri0 = th.data.prom_act.price; | 
| 4791 | pri0 = parseFloat(pri0).toFixed(2); | 4790 | pri0 = parseFloat(pri0).toFixed(2); | 
| @@ -4793,13 +4792,13 @@ Page({ | @@ -4793,13 +4792,13 @@ Page({ | ||
| 4793 | context.fillText("¥", wd1 - 15, 185 * unit); | 4792 | context.fillText("¥", wd1 - 15, 185 * unit); | 
| 4794 | context.setFontSize(31 * unit) | 4793 | context.setFontSize(31 * unit) | 
| 4795 | context.fillText(pri0, wd1, 185 * unit); | 4794 | context.fillText(pri0, wd1, 185 * unit); | 
| 4796 | - | ||
| 4797 | - var tj_path = "../../../../images/share/q_tj.png"; | ||
| 4798 | - context.drawImage(tj_path, 315 * unit, 158 * unit, 85 * unit, 30 * unit); | ||
| 4799 | - context.setLineJoin('round'); //交点设置成圆角 | ||
| 4800 | - context.setFontSize(18 * unit); | ||
| 4801 | - context.setFillStyle("white"); | ||
| 4802 | - context.fillText('参团价', 330 * unit, 179 * unit); | 4795 | + | 
| 4796 | + var tj_path = "../../../../images/share/q_tj.png"; | ||
| 4797 | + context.drawImage(tj_path, 315 * unit, 158 * unit, 85 * unit, 30 * unit); | ||
| 4798 | + context.setLineJoin('round'); //交点设置成圆角 | ||
| 4799 | + context.setFontSize(18 * unit); | ||
| 4800 | + context.setFillStyle("white"); | ||
| 4801 | + context.fillText('参团价', 330 * unit, 179 * unit); | ||
| 4803 | 4802 | ||
| 4804 | //---市场价划掉--- | 4803 | //---市场价划掉--- | 
| 4805 | context.setFillStyle("gray") | 4804 | context.setFillStyle("gray") | 
| @@ -4814,7 +4813,7 @@ Page({ | @@ -4814,7 +4813,7 @@ Page({ | ||
| 4814 | context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit); | 4813 | context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit); | 
| 4815 | context.stroke(); | 4814 | context.stroke(); | 
| 4816 | 4815 | ||
| 4817 | - } else if(type == 4 && type != 0) { | 4816 | + } else if (type == 4 && type != 0) { | 
| 4818 | context.setFillStyle("black"); | 4817 | context.setFillStyle("black"); | 
| 4819 | context.setFontSize(21.3 * unit) | 4818 | context.setFontSize(21.3 * unit) | 
| 4820 | th.draw_Text(context, share_title, | 4819 | th.draw_Text(context, share_title, | 
| @@ -4834,12 +4833,12 @@ Page({ | @@ -4834,12 +4833,12 @@ Page({ | ||
| 4834 | } | 4833 | } | 
| 4835 | 4834 | ||
| 4836 | //---中间大图--- | 4835 | //---中间大图--- | 
| 4837 | - if(type != 0) { | ||
| 4838 | - context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit); | ||
| 4839 | - }; | ||
| 4840 | - | ||
| 4841 | - | ||
| 4842 | - | 4836 | + if (type != 0) { | 
| 4837 | + context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit); | ||
| 4838 | + }; | ||
| 4839 | + | ||
| 4840 | + | ||
| 4841 | + | ||
| 4843 | //-------大图后面就不一样了----------- | 4842 | //-------大图后面就不一样了----------- | 
| 4844 | switch (type) { | 4843 | switch (type) { | 
| 4845 | case 0: break;//普通商品的展示 | 4844 | case 0: break;//普通商品的展示 | 
| @@ -5052,130 +5051,130 @@ Page({ | @@ -5052,130 +5051,130 @@ Page({ | ||
| 5052 | context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit); | 5051 | context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit); | 
| 5053 | } | 5052 | } | 
| 5054 | break; | 5053 | break; | 
| 5055 | - | ||
| 5056 | - | ||
| 5057 | - case 9: | ||
| 5058 | - | ||
| 5059 | - //---画线--- | ||
| 5060 | - context.setLineWidth(1 * unit) | ||
| 5061 | - context.moveTo(32 * unit, 680 * unit) | ||
| 5062 | - context.lineTo(520 * unit, 680 * unit) | ||
| 5063 | - context.stroke(); | ||
| 5064 | - | ||
| 5065 | - //---文字--- | ||
| 5066 | - context.setFillStyle("black") | ||
| 5067 | - context.setFontSize(24 * unit) | ||
| 5068 | - context.font = 'normal bold 18px'; | ||
| 5069 | - context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit); | ||
| 5070 | - | ||
| 5071 | - //还差N人,即可成团 | ||
| 5072 | - let group_num = th.data.luckGoInfo.group_num; | ||
| 5073 | - let num_joined = th.data.luckGoInfo.num; | ||
| 5074 | - let delta1 = group_num - num_joined; | ||
| 5075 | - let width_delta1 = ut.measureText(delta1, 15); | ||
| 5076 | - context.setFillStyle("black"); | ||
| 5077 | - context.setFontSize(21.3 * unit); | ||
| 5078 | - context.fillText(group_num + "人团,还差", 40 * unit, 772 * unit); | ||
| 5079 | - context.setFillStyle("#FF6768"); | ||
| 5080 | - context.setFontSize(21.3 * unit); | ||
| 5081 | - context.fillText(delta1, 160 * unit, 772 * unit); | ||
| 5082 | - context.setFillStyle("black"); | ||
| 5083 | - context.setFontSize(21.3 * unit); | ||
| 5084 | - context.fillText("人,即可成团", (170 + width_delta1) * unit, 772 * unit); | ||
| 5085 | - | ||
| 5086 | - // N人得商品,N人全额退款 | ||
| 5087 | - let group_win = th.data.luckGoInfo.group_win; | ||
| 5088 | - let delta2 = group_num - group_win; | ||
| 5089 | - let width_delta2 = ut.measureText(delta2, 16); | ||
| 5090 | - let width_groupNum = ut.measureText(group_num, 15); | ||
| 5091 | - let width_groupWin = ut.measureText(group_win, 15); | ||
| 5092 | - context.setFillStyle("#FF6768"); | ||
| 5093 | - context.setFontSize(21.3 * unit); | ||
| 5094 | - context.fillText(group_win, 40 * unit, 806 * unit); | ||
| 5095 | - context.setFillStyle("black"); | ||
| 5096 | - context.setFontSize(21.3 * unit); | ||
| 5097 | - context.fillText("人得商品,", (54 + width_groupWin) * unit, 806 * unit); | ||
| 5098 | - context.setFillStyle("#FF6768"); | ||
| 5099 | - context.setFontSize(21.3 * unit); | ||
| 5100 | - context.fillText(delta2, 160 * unit, 806 * unit); | ||
| 5101 | - context.setFillStyle("black"); | ||
| 5102 | - context.setFontSize(21.3 * unit); | ||
| 5103 | - context.fillText("人全额退款", (170 + width_delta2) * unit, 806 * unit); | ||
| 5104 | - | ||
| 5105 | - // 并得帮团惊喜礼品 | ||
| 5106 | - context.setFillStyle("black") | ||
| 5107 | - context.setFontSize(21.3 * unit) | ||
| 5108 | - context.fillText("并得帮团", 40 * unit, 840 * unit); | ||
| 5109 | - context.setFillStyle("#FF6768") | ||
| 5110 | - context.setFontSize(21.3 * unit) | ||
| 5111 | - context.fillText("惊喜礼品", 130 * unit, 840 * unit); | ||
| 5112 | - context.setFillStyle("black") | ||
| 5113 | - context.setFontSize(21.3 * unit) | ||
| 5114 | - context.fillText("!", 220 * unit, 840 * unit); | ||
| 5115 | - | ||
| 5116 | - | ||
| 5117 | - //---二维吗图--- | ||
| 5118 | - //-- 自定义海报 -- | ||
| 5119 | - if (th.data.poster) { | ||
| 5120 | - var erm_x = parseFloat(th.data.poster.ewm_x) * 2; | ||
| 5121 | - var erm_y = parseFloat(th.data.poster.ewm_y) * 2; | ||
| 5122 | - context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); | ||
| 5123 | - } else { | ||
| 5124 | - //---二维吗图--- | ||
| 5125 | - context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit); | ||
| 5126 | - } | ||
| 5127 | - | ||
| 5128 | - break; | 5054 | + | 
| 5055 | + | ||
| 5056 | + case 9: | ||
| 5057 | + | ||
| 5058 | + //---画线--- | ||
| 5059 | + context.setLineWidth(1 * unit) | ||
| 5060 | + context.moveTo(32 * unit, 680 * unit) | ||
| 5061 | + context.lineTo(520 * unit, 680 * unit) | ||
| 5062 | + context.stroke(); | ||
| 5063 | + | ||
| 5064 | + //---文字--- | ||
| 5065 | + context.setFillStyle("black") | ||
| 5066 | + context.setFontSize(24 * unit) | ||
| 5067 | + context.font = 'normal bold 18px'; | ||
| 5068 | + context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit); | ||
| 5069 | + | ||
| 5070 | + //还差N人,即可成团 | ||
| 5071 | + let group_num = th.data.luckGoInfo.group_num; | ||
| 5072 | + let num_joined = th.data.luckGoInfo.num; | ||
| 5073 | + let delta1 = group_num - num_joined; | ||
| 5074 | + let width_delta1 = ut.measureText(delta1, 15); | ||
| 5075 | + context.setFillStyle("black"); | ||
| 5076 | + context.setFontSize(21.3 * unit); | ||
| 5077 | + context.fillText(group_num + "人团,还差", 40 * unit, 772 * unit); | ||
| 5078 | + context.setFillStyle("#FF6768"); | ||
| 5079 | + context.setFontSize(21.3 * unit); | ||
| 5080 | + context.fillText(delta1, 160 * unit, 772 * unit); | ||
| 5081 | + context.setFillStyle("black"); | ||
| 5082 | + context.setFontSize(21.3 * unit); | ||
| 5083 | + context.fillText("人,即可成团", (170 + width_delta1) * unit, 772 * unit); | ||
| 5084 | + | ||
| 5085 | + // N人得商品,N人全额退款 | ||
| 5086 | + let group_win = th.data.luckGoInfo.group_win; | ||
| 5087 | + let delta2 = group_num - group_win; | ||
| 5088 | + let width_delta2 = ut.measureText(delta2, 16); | ||
| 5089 | + let width_groupNum = ut.measureText(group_num, 15); | ||
| 5090 | + let width_groupWin = ut.measureText(group_win, 15); | ||
| 5091 | + context.setFillStyle("#FF6768"); | ||
| 5092 | + context.setFontSize(21.3 * unit); | ||
| 5093 | + context.fillText(group_win, 40 * unit, 806 * unit); | ||
| 5094 | + context.setFillStyle("black"); | ||
| 5095 | + context.setFontSize(21.3 * unit); | ||
| 5096 | + context.fillText("人得商品,", (54 + width_groupWin) * unit, 806 * unit); | ||
| 5097 | + context.setFillStyle("#FF6768"); | ||
| 5098 | + context.setFontSize(21.3 * unit); | ||
| 5099 | + context.fillText(delta2, 160 * unit, 806 * unit); | ||
| 5100 | + context.setFillStyle("black"); | ||
| 5101 | + context.setFontSize(21.3 * unit); | ||
| 5102 | + context.fillText("人全额退款", (170 + width_delta2) * unit, 806 * unit); | ||
| 5103 | + | ||
| 5104 | + // 并得帮团惊喜礼品 | ||
| 5105 | + context.setFillStyle("black") | ||
| 5106 | + context.setFontSize(21.3 * unit) | ||
| 5107 | + context.fillText("并得帮团", 40 * unit, 840 * unit); | ||
| 5108 | + context.setFillStyle("#FF6768") | ||
| 5109 | + context.setFontSize(21.3 * unit) | ||
| 5110 | + context.fillText("惊喜礼品", 130 * unit, 840 * unit); | ||
| 5111 | + context.setFillStyle("black") | ||
| 5112 | + context.setFontSize(21.3 * unit) | ||
| 5113 | + context.fillText("!", 220 * unit, 840 * unit); | ||
| 5114 | + | ||
| 5115 | + | ||
| 5116 | + //---二维吗图--- | ||
| 5117 | + //-- 自定义海报 -- | ||
| 5118 | + if (th.data.poster) { | ||
| 5119 | + var erm_x = parseFloat(th.data.poster.ewm_x) * 2; | ||
| 5120 | + var erm_y = parseFloat(th.data.poster.ewm_y) * 2; | ||
| 5121 | + context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); | ||
| 5122 | + } else { | ||
| 5123 | + //---二维吗图--- | ||
| 5124 | + context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit); | ||
| 5125 | + } | ||
| 5126 | + | ||
| 5127 | + break; | ||
| 5129 | 5128 | ||
| 5130 | 5129 | ||
| 5131 | } | 5130 | } | 
| 5132 | 5131 | ||
| 5133 | 5132 | ||
| 5134 | //--- 如果是自定义海报的时候 --- | 5133 | //--- 如果是自定义海报的时候 --- | 
| 5135 | - if(type != 0) { | ||
| 5136 | - | ||
| 5137 | - if (th.data.poster && parseInt(th.data.poster.style) == 2) { | ||
| 5138 | - | ||
| 5139 | - //如果显示会员信息的话 | ||
| 5140 | - if (parseInt(th.data.poster.show_headpic)) { | ||
| 5141 | - //获取坐标 | ||
| 5142 | - var x = parseFloat(th.data.poster.head_x) * 2; | ||
| 5143 | - var y = parseFloat(th.data.poster.head_y) * 2; | ||
| 5144 | - //---绘制圆形要放在最后---- | ||
| 5145 | - context.save(); | ||
| 5146 | - context.beginPath(); | ||
| 5147 | - var h_x = x * unit; | ||
| 5148 | - var h_y = y * unit; | ||
| 5149 | - var h_r = 40 * unit; | ||
| 5150 | - var cx = h_x + h_r; | ||
| 5151 | - var cy = h_y + h_r; | ||
| 5152 | - context.arc(cx, cy, h_r, 0, Math.PI * 2, false); | ||
| 5153 | - context.closePath(); | ||
| 5154 | - context.fill(); | ||
| 5155 | - context.clip(); | ||
| 5156 | - context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2); | ||
| 5157 | - context.restore(); | ||
| 5158 | - } | ||
| 5159 | - | ||
| 5160 | - } else { | ||
| 5161 | - //---绘制圆形要放在最后---- | ||
| 5162 | - context.save(); | ||
| 5163 | - context.beginPath(); | ||
| 5164 | - var h_x = 60 * unit; | ||
| 5165 | - var h_y = 24 * unit; | ||
| 5166 | - var h_r = 40 * unit; | ||
| 5167 | - var cx = h_x + h_r; | ||
| 5168 | - var cy = h_y + h_r; | ||
| 5169 | - context.arc(cx, cy, h_r, 0, Math.PI * 2, false); | ||
| 5170 | - context.closePath(); | ||
| 5171 | - context.fill(); | ||
| 5172 | - context.clip(); | ||
| 5173 | - context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2); | ||
| 5174 | - context.restore(); | ||
| 5175 | - } | ||
| 5176 | - | ||
| 5177 | - }; | ||
| 5178 | - | 5134 | + if (type != 0) { | 
| 5135 | + | ||
| 5136 | + if (th.data.poster && parseInt(th.data.poster.style) == 2) { | ||
| 5137 | + | ||
| 5138 | + //如果显示会员信息的话 | ||
| 5139 | + if (parseInt(th.data.poster.show_headpic)) { | ||
| 5140 | + //获取坐标 | ||
| 5141 | + var x = parseFloat(th.data.poster.head_x) * 2; | ||
| 5142 | + var y = parseFloat(th.data.poster.head_y) * 2; | ||
| 5143 | + //---绘制圆形要放在最后---- | ||
| 5144 | + context.save(); | ||
| 5145 | + context.beginPath(); | ||
| 5146 | + var h_x = x * unit; | ||
| 5147 | + var h_y = y * unit; | ||
| 5148 | + var h_r = 40 * unit; | ||
| 5149 | + var cx = h_x + h_r; | ||
| 5150 | + var cy = h_y + h_r; | ||
| 5151 | + context.arc(cx, cy, h_r, 0, Math.PI * 2, false); | ||
| 5152 | + context.closePath(); | ||
| 5153 | + context.fill(); | ||
| 5154 | + context.clip(); | ||
| 5155 | + context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2); | ||
| 5156 | + context.restore(); | ||
| 5157 | + } | ||
| 5158 | + | ||
| 5159 | + } else { | ||
| 5160 | + //---绘制圆形要放在最后---- | ||
| 5161 | + context.save(); | ||
| 5162 | + context.beginPath(); | ||
| 5163 | + var h_x = 60 * unit; | ||
| 5164 | + var h_y = 24 * unit; | ||
| 5165 | + var h_r = 40 * unit; | ||
| 5166 | + var cx = h_x + h_r; | ||
| 5167 | + var cy = h_y + h_r; | ||
| 5168 | + context.arc(cx, cy, h_r, 0, Math.PI * 2, false); | ||
| 5169 | + context.closePath(); | ||
| 5170 | + context.fill(); | ||
| 5171 | + context.clip(); | ||
| 5172 | + context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2); | ||
| 5173 | + context.restore(); | ||
| 5174 | + } | ||
| 5175 | + | ||
| 5176 | + }; | ||
| 5177 | + | ||
| 5179 | 5178 | ||
| 5180 | 5179 | ||
| 5181 | //把画板内容绘制成图片,并回调 画板图片路径 | 5180 | //把画板内容绘制成图片,并回调 画板图片路径 | 
| @@ -5413,7 +5412,7 @@ Page({ | @@ -5413,7 +5412,7 @@ Page({ | ||
| 5413 | // } | 5412 | // } | 
| 5414 | // }) | 5413 | // }) | 
| 5415 | }, | 5414 | }, | 
| 5416 | - | 5415 | + | 
| 5417 | // 选择门店 | 5416 | // 选择门店 | 
| 5418 | choice_store: function (ee) { | 5417 | choice_store: function (ee) { | 
| 5419 | var th = this; | 5418 | var th = this; | 
| @@ -5429,7 +5428,7 @@ Page({ | @@ -5429,7 +5428,7 @@ Page({ | ||
| 5429 | getApp().confirmBox("门店库存不足", null, 25000, !1); | 5428 | getApp().confirmBox("门店库存不足", null, 25000, !1); | 
| 5430 | return false; | 5429 | return false; | 
| 5431 | } | 5430 | } | 
| 5432 | - | 5431 | + | 
| 5433 | if (th.data.def_pickpu_list && !th.data.def_pickpu_list.length) { | 5432 | if (th.data.def_pickpu_list && !th.data.def_pickpu_list.length) { | 
| 5434 | getApp().confirmBox("门店库存不足", null, 25000, !1); | 5433 | getApp().confirmBox("门店库存不足", null, 25000, !1); | 
| 5435 | return false; | 5434 | return false; | 
| @@ -5489,7 +5488,7 @@ Page({ | @@ -5489,7 +5488,7 @@ Page({ | ||
| 5489 | }) | 5488 | }) | 
| 5490 | } | 5489 | } | 
| 5491 | }, | 5490 | }, | 
| 5492 | - | 5491 | + | 
| 5493 | //关闭选择门店 | 5492 | //关闭选择门店 | 
| 5494 | close_popup: function (e) { | 5493 | close_popup: function (e) { | 
| 5495 | var th = this; | 5494 | var th = this; | 
| @@ -5541,7 +5540,7 @@ Page({ | @@ -5541,7 +5540,7 @@ Page({ | ||
| 5541 | sort_store: function () { | 5540 | sort_store: function () { | 
| 5542 | 5541 | ||
| 5543 | }, | 5542 | }, | 
| 5544 | - | 5543 | + | 
| 5545 | // 返回按钮 | 5544 | // 返回按钮 | 
| 5546 | returns: function () { | 5545 | returns: function () { | 
| 5547 | this.setData({ | 5546 | this.setData({ | 
| @@ -5549,7 +5548,7 @@ Page({ | @@ -5549,7 +5548,7 @@ Page({ | ||
| 5549 | choice_sort_store: 0 | 5548 | choice_sort_store: 0 | 
| 5550 | }); | 5549 | }); | 
| 5551 | }, | 5550 | }, | 
| 5552 | - | 5551 | + | 
| 5553 | //---选择分类门店--- | 5552 | //---选择分类门店--- | 
| 5554 | choice_sort_store: function (e) { | 5553 | choice_sort_store: function (e) { | 
| 5555 | var index = e.currentTarget.dataset.index; | 5554 | var index = e.currentTarget.dataset.index; | 
| @@ -5683,7 +5682,7 @@ Page({ | @@ -5683,7 +5682,7 @@ Page({ | ||
| 5683 | } | 5682 | } | 
| 5684 | else { | 5683 | else { | 
| 5685 | th.setData({ | 5684 | th.setData({ | 
| 5686 | - // openSpecModal_pt: 1, | 5685 | + // openSpecModal_pt: 1, | 
| 5687 | store: 0, | 5686 | store: 0, | 
| 5688 | choice_sort_store: 0, | 5687 | choice_sort_store: 0, | 
| 5689 | sort_store: 0 | 5688 | sort_store: 0 | 
| @@ -5693,7 +5692,7 @@ Page({ | @@ -5693,7 +5692,7 @@ Page({ | ||
| 5693 | th.get_off_price(); | 5692 | th.get_off_price(); | 
| 5694 | }) | 5693 | }) | 
| 5695 | }, | 5694 | }, | 
| 5696 | - | 5695 | + | 
| 5697 | //---点击二级之后的选择--- | 5696 | //---点击二级之后的选择--- | 
| 5698 | choose_for_store: function (e) { | 5697 | choose_for_store: function (e) { | 
| 5699 | var index_c = e.currentTarget.dataset.ind; | 5698 | var index_c = e.currentTarget.dataset.ind; | 
| @@ -5704,7 +5703,7 @@ Page({ | @@ -5704,7 +5703,7 @@ Page({ | ||
| 5704 | }) | 5703 | }) | 
| 5705 | 5704 | ||
| 5706 | }, | 5705 | }, | 
| 5707 | - | 5706 | + | 
| 5708 | //把选择的门店设置成默认的门店def_pick | 5707 | //把选择的门店设置成默认的门店def_pick | 
| 5709 | set_def_pick: function (e) { | 5708 | set_def_pick: function (e) { | 
| 5710 | var th = this; | 5709 | var th = this; | 
| @@ -5904,11 +5903,11 @@ Page({ | @@ -5904,11 +5903,11 @@ Page({ | ||
| 5904 | go_plus: function () { | 5903 | go_plus: function () { | 
| 5905 | getApp().goto("/pages/user/plus/plus"); | 5904 | getApp().goto("/pages/user/plus/plus"); | 
| 5906 | }, | 5905 | }, | 
| 5907 | - | 5906 | + | 
| 5908 | go_card_info: function () { | 5907 | go_card_info: function () { | 
| 5909 | getApp().goto("/pages/user/cardinfo/cardinfo"); | 5908 | getApp().goto("/pages/user/cardinfo/cardinfo"); | 
| 5910 | }, | 5909 | }, | 
| 5911 | - | 5910 | + | 
| 5912 | //-- 根据ID拿出门店 -- | 5911 | //-- 根据ID拿出门店 -- | 
| 5913 | get_pick_from_list(pid) { | 5912 | get_pick_from_list(pid) { | 
| 5914 | var all_pick_list = this.data.all_pick_list; | 5913 | var all_pick_list = this.data.all_pick_list; | 
| @@ -6137,7 +6136,7 @@ Page({ | @@ -6137,7 +6136,7 @@ Page({ | ||
| 6137 | this.get_sto(0) | 6136 | this.get_sto(0) | 
| 6138 | this.setData({ openSpecModal_inte: 1, goodsInputNum: 1 }); | 6137 | this.setData({ openSpecModal_inte: 1, goodsInputNum: 1 }); | 
| 6139 | }, | 6138 | }, | 
| 6140 | - | 6139 | + | 
| 6141 | //-- 积分购普通购买 -- | 6140 | //-- 积分购普通购买 -- | 
| 6142 | go_pay_integral_normal: function () { | 6141 | go_pay_integral_normal: function () { | 
| 6143 | var th = this; | 6142 | var th = this; | 
| @@ -6262,236 +6261,236 @@ Page({ | @@ -6262,236 +6261,236 @@ Page({ | ||
| 6262 | // }) | 6261 | // }) | 
| 6263 | // }, | 6262 | // }, | 
| 6264 | 6263 | ||
| 6265 | - //获取更多秒杀 | ||
| 6266 | - // get_more_flahs: async function (func) { | ||
| 6267 | - // var f_more=false; | ||
| 6268 | - // var user_id=getApp().globalData.user_id; | ||
| 6269 | - // if(!user_id) user_id=0; | ||
| 6270 | - | ||
| 6271 | - // var url="/api/weshop/goods/listSkuFlash?store_id="+os.stoid+"&goods_id="+this.data.data.goods_id+"&user_id="+user_id; | ||
| 6272 | - // //获取秒杀的多规格 | ||
| 6273 | - // await getApp().request.promiseGet(url, {}).then(res=>{ | ||
| 6274 | - // if(res.data.code==0 && res.data.data && res.data.data.length>0){ | ||
| 6275 | - // f_more=res.data.data; | ||
| 6276 | - // } | ||
| 6277 | - // }) | ||
| 6278 | - // if(!f_more) { | ||
| 6279 | - // func(false); | ||
| 6280 | - // return false; | ||
| 6281 | - // } | ||
| 6282 | - // //-- 秒杀的价格要更新 -- | ||
| 6283 | - // for(let i in f_more){ | ||
| 6284 | - | ||
| 6285 | - // let item=f_more[i]; | ||
| 6286 | - // f_more[i].prom_id=item.act_id; | ||
| 6287 | - // f_more[i].prom_type=1; | ||
| 6288 | - // if(item.goods_id==this.data.data.goods_id){ | ||
| 6289 | - // continue; | ||
| 6290 | - // } | ||
| 6291 | - // var url="/api/ms/flash_sale/getNew/"+os.stoid+"/"+user_id+"/"+item.act_id; | ||
| 6292 | - // await getApp().request.promiseGet(url, {}).then(rs=>{ | ||
| 6293 | - // if(rs.data.code==0){ | ||
| 6294 | - // f_more[i].price=rs.data.data.user_price; | 6264 | + //获取更多秒杀 | 
| 6265 | + // get_more_flahs: async function (func) { | ||
| 6266 | + // var f_more=false; | ||
| 6267 | + // var user_id=getApp().globalData.user_id; | ||
| 6268 | + // if(!user_id) user_id=0; | ||
| 6269 | + | ||
| 6270 | + // var url="/api/weshop/goods/listSkuFlash?store_id="+os.stoid+"&goods_id="+this.data.data.goods_id+"&user_id="+user_id; | ||
| 6271 | + // //获取秒杀的多规格 | ||
| 6272 | + // await getApp().request.promiseGet(url, {}).then(res=>{ | ||
| 6273 | + // if(res.data.code==0 && res.data.data && res.data.data.length>0){ | ||
| 6274 | + // f_more=res.data.data; | ||
| 6275 | + // } | ||
| 6276 | + // }) | ||
| 6277 | + // if(!f_more) { | ||
| 6278 | + // func(false); | ||
| 6279 | + // return false; | ||
| 6280 | + // } | ||
| 6281 | + // //-- 秒杀的价格要更新 -- | ||
| 6282 | + // for(let i in f_more){ | ||
| 6283 | + | ||
| 6284 | + // let item=f_more[i]; | ||
| 6285 | + // f_more[i].prom_id=item.act_id; | ||
| 6286 | + // f_more[i].prom_type=1; | ||
| 6287 | + // if(item.goods_id==this.data.data.goods_id){ | ||
| 6288 | + // continue; | ||
| 6289 | + // } | ||
| 6290 | + // var url="/api/ms/flash_sale/getNew/"+os.stoid+"/"+user_id+"/"+item.act_id; | ||
| 6291 | + // await getApp().request.promiseGet(url, {}).then(rs=>{ | ||
| 6292 | + // if(rs.data.code==0){ | ||
| 6293 | + // f_more[i].price=rs.data.data.user_price; | ||
| 6294 | + | ||
| 6295 | + // } | ||
| 6296 | + // }) | ||
| 6297 | + // } | ||
| 6298 | + // func(f_more); | ||
| 6295 | 6299 | ||
| 6296 | - // } | ||
| 6297 | - // }) | 6300 | + // }, | 
| 6301 | + | ||
| 6302 | + //-- 判断是否有秒杀 -- ccc | ||
| 6303 | + check_has_flash: function () { | ||
| 6304 | + // var th=this; | ||
| 6305 | + // var url="/api/weshop/activitylist/getGoodActInfo"; | ||
| 6306 | + // var req_data={ | ||
| 6307 | + // store_id:os.stoid,goodsidlist:this.data.data.goods_id,is_detail:1 | ||
| 6308 | + // }; | ||
| 6309 | + // //获取秒杀的多规格 | ||
| 6310 | + // getApp().request.promiseGet(url, {data:req_data}).then(res=>{ | ||
| 6311 | + // if(res.data.code==0 && res.data.data && res.data.data.length){ | ||
| 6312 | + // th.setData({more_flash:res.data.data}); | ||
| 6298 | // } | 6313 | // } | 
| 6299 | - // func(f_more); | ||
| 6300 | - | ||
| 6301 | - // }, | ||
| 6302 | - | ||
| 6303 | - //-- 判断是否有秒杀 -- ccc | ||
| 6304 | - check_has_flash:function () { | ||
| 6305 | - // var th=this; | ||
| 6306 | - // var url="/api/weshop/activitylist/getGoodActInfo"; | ||
| 6307 | - // var req_data={ | ||
| 6308 | - // store_id:os.stoid,goodsidlist:this.data.data.goods_id,is_detail:1 | ||
| 6309 | - // }; | ||
| 6310 | - // //获取秒杀的多规格 | ||
| 6311 | - // getApp().request.promiseGet(url, {data:req_data}).then(res=>{ | ||
| 6312 | - // if(res.data.code==0 && res.data.data && res.data.data.length){ | ||
| 6313 | - // th.setData({more_flash:res.data.data}); | ||
| 6314 | - // } | ||
| 6315 | - // }) | ||
| 6316 | - }, | 6314 | + // }) | 
| 6315 | + }, | ||
| 6317 | 6316 | ||
| 6318 | - //-- 跳转到秒杀商品详情页 -- ccc | ||
| 6319 | - go_more_flash:function (e) { | ||
| 6320 | - // var prom_id=e.currentTarget.dataset.id; | ||
| 6321 | - // var goods_id=this.data.data.goods_id; | ||
| 6322 | - // var url="/pages/goods/goodsInfo/goodsInfo?goods_id="+goods_id+"&prom_id="+prom_id+"&prom_type=1"; | ||
| 6323 | - // getApp().goto(url); | ||
| 6324 | - }, | 6317 | + //-- 跳转到秒杀商品详情页 -- ccc | 
| 6318 | + go_more_flash: function (e) { | ||
| 6319 | + // var prom_id=e.currentTarget.dataset.id; | ||
| 6320 | + // var goods_id=this.data.data.goods_id; | ||
| 6321 | + // var url="/pages/goods/goodsInfo/goodsInfo?goods_id="+goods_id+"&prom_id="+prom_id+"&prom_type=1"; | ||
| 6322 | + // getApp().goto(url); | ||
| 6323 | + }, | ||
| 6325 | 6324 | ||
| 6326 | - close_pop_more:function () { | ||
| 6327 | - this.setData({is_pop_more:0}) | ||
| 6328 | - }, | 6325 | + close_pop_more: function () { | 
| 6326 | + this.setData({ is_pop_more: 0 }) | ||
| 6327 | + }, | ||
| 6328 | + | ||
| 6329 | + con_weixin: function () { | ||
| 6330 | + var url = this.data.sys_switch.weapp_customertype_url; | ||
| 6331 | + var id = this.data.sys_switch.weapp_customertype_appid; | ||
| 6332 | + wx.openCustomerServiceChat({ | ||
| 6333 | + extInfo: { url: url }, | ||
| 6334 | + corpId: id, | ||
| 6335 | + success(res) { } | ||
| 6336 | + }) | ||
| 6337 | + }, | ||
| 6338 | + | ||
| 6339 | + | ||
| 6340 | + // 显示幸运购规则 | ||
| 6341 | + showRules: function () { | ||
| 6342 | + this.setData({ | ||
| 6343 | + showRules: true, | ||
| 6344 | + }); | ||
| 6345 | + }, | ||
| 6346 | + | ||
| 6347 | + // 关闭幸运购规则 | ||
| 6348 | + closeRules: function () { | ||
| 6349 | + this.setData({ | ||
| 6350 | + showRules: false, | ||
| 6351 | + }); | ||
| 6352 | + }, | ||
| 6353 | + | ||
| 6354 | + // 跳转 | ||
| 6355 | + go: function (e) { | ||
| 6356 | + var url = e.currentTarget.dataset.url; | ||
| 6357 | + getApp().goto(url); | ||
| 6358 | + }, | ||
| 6359 | + | ||
| 6360 | + // 查看奖励 | ||
| 6361 | + showReward: function () { | ||
| 6362 | + | ||
| 6363 | + this.getPrizes(this.data.luckGoInfo.type); | ||
| 6364 | + | ||
| 6365 | + }, | ||
| 6366 | + | ||
| 6367 | + // 关闭奖励 | ||
| 6368 | + closeReward: function () { | ||
| 6369 | + this.setData({ | ||
| 6370 | + showReward: false, | ||
| 6371 | + }); | ||
| 6372 | + }, | ||
| 6373 | + | ||
| 6374 | + | ||
| 6375 | + // 获取优惠券奖励和服务项目奖励 | ||
| 6376 | + getPrizes: function (type) { | ||
| 6377 | + // let currentItem = this.data.list.pageData[currentItemIndex]; | ||
| 6378 | + // let type = type; | ||
| 6379 | + let self = this; | ||
| 6380 | + let app = getApp(); | ||
| 6381 | + // 分割type字符串 | ||
| 6382 | + let typeArr = this.splitStringToArr(type); | ||
| 6383 | + let prizesArr = []; | ||
| 6384 | + let promiseArr = []; | ||
| 6385 | + typeArr.forEach(function (item) { | ||
| 6386 | + | ||
| 6387 | + let obj = {}; | ||
| 6388 | + obj.type = item; | ||
| 6389 | + | ||
| 6390 | + let promise = new Promise((resolve, reject) => { | ||
| 6391 | + switch (item) { | ||
| 6392 | + case 1: { //积分 | ||
| 6393 | + obj.name = '积分'; | ||
| 6394 | + obj.num = 'point'; | ||
| 6395 | + prizesArr.push(obj); | ||
| 6396 | + resolve(); | ||
| 6397 | + break; | ||
| 6398 | + }; | ||
| 6399 | + case 2: { //成长值 | ||
| 6400 | + obj.name = '成长值'; | ||
| 6401 | + obj.num = 'grow'; | ||
| 6402 | + prizesArr.push(obj); | ||
| 6403 | + resolve(); | ||
| 6404 | + break; | ||
| 6405 | + }; | ||
| 6406 | + case 3: { //优惠券 | ||
| 6407 | + app.request.promiseGet('/api/weshop/prom/luckyCoupon/page', { | ||
| 6408 | + data: { | ||
| 6409 | + store_id: os.stoid, | ||
| 6410 | + aid: self.data.luckGoInfo.id, | ||
| 6411 | + } | ||
| 6412 | + }).then(res => { | ||
| 6413 | + if (res.data.code == 0) { | ||
| 6414 | + obj.couponList = res.data.data.pageData; | ||
| 6415 | + prizesArr.push(obj); | ||
| 6416 | + resolve(); | ||
| 6417 | + }; | ||
| 6418 | + }); | ||
| 6419 | + break; | ||
| 6420 | + }; | ||
| 6421 | + case 4: { //服务项目 | ||
| 6422 | + app.request.promiseGet('/api/weshop/prom/luckyService/page', { | ||
| 6423 | + data: { | ||
| 6424 | + store_id: os.stoid, | ||
| 6425 | + aid: self.data.luckGoInfo.id, | ||
| 6426 | + } | ||
| 6427 | + }).then(res => { | ||
| 6428 | + if (res.data.code == 0) { | ||
| 6429 | + obj.serviceList = res.data.data.pageData; | ||
| 6430 | + prizesArr.push(obj); | ||
| 6431 | + resolve(); | ||
| 6432 | + }; | ||
| 6433 | + }); | ||
| 6434 | + break; | ||
| 6435 | + }; | ||
| 6436 | + case 5: { //预存金额 | ||
| 6437 | + obj.name = 'prestore_name'; | ||
| 6438 | + obj.num = 'prestore_money'; | ||
| 6439 | + prizesArr.push(obj); | ||
| 6440 | + resolve(); | ||
| 6441 | + break; | ||
| 6442 | + }; | ||
| 6443 | + }; | ||
| 6444 | + }); | ||
| 6445 | + | ||
| 6446 | + promiseArr.push(promise); | ||
| 6447 | + | ||
| 6448 | + | ||
| 6449 | + Promise.all(promiseArr).then(() => { | ||
| 6450 | + self.setData({ | ||
| 6451 | + prizesArr, | ||
| 6452 | + showReward: true, | ||
| 6453 | + }); | ||
| 6454 | + }); | ||
| 6455 | + | ||
| 6456 | + | ||
| 6457 | + | ||
| 6458 | + }); | ||
| 6459 | + | ||
| 6460 | + | ||
| 6461 | + | ||
| 6462 | + }, | ||
| 6463 | + | ||
| 6464 | + // 将type字符串分割成数组 | ||
| 6465 | + splitStringToArr: function (typeStr) { | ||
| 6466 | + var index; | ||
| 6467 | + var newTypeArr = []; | ||
| 6468 | + var typeStrArr = typeStr.split(','); | ||
| 6469 | + typeStrArr.forEach(function (item) { | ||
| 6470 | + index = parseInt(item); | ||
| 6471 | + newTypeArr.push(index); | ||
| 6472 | + }); | ||
| 6473 | + // console.log('newTypeArr', newTypeArr); | ||
| 6474 | + return newTypeArr; | ||
| 6475 | + }, | ||
| 6476 | + | ||
| 6477 | + | ||
| 6478 | + //弹出活动已经结束 | ||
| 6479 | + timeUp() { | ||
| 6480 | + wx.showToast({ | ||
| 6481 | + title: '本商品活动已经结束!', | ||
| 6482 | + icon: 'none', | ||
| 6483 | + }); | ||
| 6484 | + }, | ||
| 6485 | + | ||
| 6486 | + | ||
| 6487 | + // 预览海报 | ||
| 6488 | + previewPoster() { | ||
| 6489 | + wx.previewImage({ | ||
| 6490 | + current: this.data.shareImgPath, // 当前显示图片的http链接 | ||
| 6491 | + urls: [this.data.shareImgPath],// 需要预览的图片http链接列表 | ||
| 6492 | + }); | ||
| 6493 | + }, | ||
| 6329 | 6494 | ||
| 6330 | - con_weixin:function () { | ||
| 6331 | - var url=this.data.sys_switch.weapp_customertype_url; | ||
| 6332 | - var id=this.data.sys_switch.weapp_customertype_appid; | ||
| 6333 | - wx.openCustomerServiceChat({ | ||
| 6334 | - extInfo: {url: url}, | ||
| 6335 | - corpId: id, | ||
| 6336 | - success(res) {} | ||
| 6337 | - }) | ||
| 6338 | - }, | ||
| 6339 | - | ||
| 6340 | - | ||
| 6341 | - // 显示幸运购规则 | ||
| 6342 | - showRules: function() { | ||
| 6343 | - this.setData({ | ||
| 6344 | - showRules: true, | ||
| 6345 | - }); | ||
| 6346 | - }, | ||
| 6347 | - | ||
| 6348 | - // 关闭幸运购规则 | ||
| 6349 | - closeRules: function() { | ||
| 6350 | - this.setData({ | ||
| 6351 | - showRules: false, | ||
| 6352 | - }); | ||
| 6353 | - }, | ||
| 6354 | - | ||
| 6355 | - // 跳转 | ||
| 6356 | - go: function (e) { | ||
| 6357 | - var url = e.currentTarget.dataset.url; | ||
| 6358 | - getApp().goto(url); | ||
| 6359 | - }, | ||
| 6360 | - | ||
| 6361 | - // 查看奖励 | ||
| 6362 | - showReward: function() { | ||
| 6363 | - | ||
| 6364 | - this.getPrizes(this.data.luckGoInfo.type); | ||
| 6365 | - | ||
| 6366 | - }, | ||
| 6367 | - | ||
| 6368 | - // 关闭奖励 | ||
| 6369 | - closeReward: function() { | ||
| 6370 | - this.setData({ | ||
| 6371 | - showReward: false, | ||
| 6372 | - }); | ||
| 6373 | - }, | ||
| 6374 | - | ||
| 6375 | - | ||
| 6376 | - // 获取优惠券奖励和服务项目奖励 | ||
| 6377 | - getPrizes: function(type) { | ||
| 6378 | - // let currentItem = this.data.list.pageData[currentItemIndex]; | ||
| 6379 | - // let type = type; | ||
| 6380 | - let self = this; | ||
| 6381 | - let app = getApp(); | ||
| 6382 | - // 分割type字符串 | ||
| 6383 | - let typeArr = this.splitStringToArr(type); | ||
| 6384 | - let prizesArr = []; | ||
| 6385 | - let promiseArr = []; | ||
| 6386 | - typeArr.forEach(function(item) { | ||
| 6387 | - | ||
| 6388 | - let obj = {}; | ||
| 6389 | - obj.type = item; | ||
| 6390 | - | ||
| 6391 | - let promise = new Promise((resolve, reject) => { | ||
| 6392 | - switch(item) { | ||
| 6393 | - case 1: { //积分 | ||
| 6394 | - obj.name = '积分'; | ||
| 6395 | - obj.num = 'point'; | ||
| 6396 | - prizesArr.push(obj); | ||
| 6397 | - resolve(); | ||
| 6398 | - break; | ||
| 6399 | - }; | ||
| 6400 | - case 2: { //成长值 | ||
| 6401 | - obj.name = '成长值'; | ||
| 6402 | - obj.num = 'grow'; | ||
| 6403 | - prizesArr.push(obj); | ||
| 6404 | - resolve(); | ||
| 6405 | - break; | ||
| 6406 | - }; | ||
| 6407 | - case 3: { //优惠券 | ||
| 6408 | - app.request.promiseGet('/api/weshop/prom/luckyCoupon/page', { | ||
| 6409 | - data: { | ||
| 6410 | - store_id: os.stoid, | ||
| 6411 | - aid: self.data.luckGoInfo.id, | ||
| 6412 | - } | ||
| 6413 | - }).then(res => { | ||
| 6414 | - if(res.data.code == 0) { | ||
| 6415 | - obj.couponList = res.data.data.pageData; | ||
| 6416 | - prizesArr.push(obj); | ||
| 6417 | - resolve(); | ||
| 6418 | - }; | ||
| 6419 | - }); | ||
| 6420 | - break; | ||
| 6421 | - }; | ||
| 6422 | - case 4: { //服务项目 | ||
| 6423 | - app.request.promiseGet('/api/weshop/prom/luckyService/page', { | ||
| 6424 | - data: { | ||
| 6425 | - store_id: os.stoid, | ||
| 6426 | - aid: self.data.luckGoInfo.id, | ||
| 6427 | - } | ||
| 6428 | - }).then(res => { | ||
| 6429 | - if(res.data.code == 0) { | ||
| 6430 | - obj.serviceList = res.data.data.pageData; | ||
| 6431 | - prizesArr.push(obj); | ||
| 6432 | - resolve(); | ||
| 6433 | - }; | ||
| 6434 | - }); | ||
| 6435 | - break; | ||
| 6436 | - }; | ||
| 6437 | - case 5: { //预存金额 | ||
| 6438 | - obj.name = 'prestore_name'; | ||
| 6439 | - obj.num = 'prestore_money'; | ||
| 6440 | - prizesArr.push(obj); | ||
| 6441 | - resolve(); | ||
| 6442 | - break; | ||
| 6443 | - }; | ||
| 6444 | - }; | ||
| 6445 | - }); | ||
| 6446 | - | ||
| 6447 | - promiseArr.push(promise); | ||
| 6448 | - | ||
| 6449 | - | ||
| 6450 | - Promise.all(promiseArr).then(()=> { | ||
| 6451 | - self.setData({ | ||
| 6452 | - prizesArr, | ||
| 6453 | - showReward: true, | ||
| 6454 | - }); | ||
| 6455 | - }); | ||
| 6456 | - | ||
| 6457 | - | ||
| 6458 | - | ||
| 6459 | - }); | ||
| 6460 | - | ||
| 6461 | - | ||
| 6462 | - | ||
| 6463 | - }, | ||
| 6464 | - | ||
| 6465 | - // 将type字符串分割成数组 | ||
| 6466 | - splitStringToArr: function(typeStr) { | ||
| 6467 | - var index; | ||
| 6468 | - var newTypeArr = []; | ||
| 6469 | - var typeStrArr = typeStr.split(','); | ||
| 6470 | - typeStrArr.forEach(function(item) { | ||
| 6471 | - index = parseInt(item); | ||
| 6472 | - newTypeArr.push(index); | ||
| 6473 | - }); | ||
| 6474 | - // console.log('newTypeArr', newTypeArr); | ||
| 6475 | - return newTypeArr; | ||
| 6476 | - }, | ||
| 6477 | - | ||
| 6478 | - | ||
| 6479 | - //弹出活动已经结束 | ||
| 6480 | - timeUp() { | ||
| 6481 | - wx.showToast({ | ||
| 6482 | - title: '本商品活动已经结束!', | ||
| 6483 | - icon: 'none', | ||
| 6484 | - }); | ||
| 6485 | - }, | ||
| 6486 | - | ||
| 6487 | - | ||
| 6488 | - // 预览海报 | ||
| 6489 | - previewPoster() { | ||
| 6490 | - wx.previewImage({ | ||
| 6491 | - current: this.data.shareImgPath, // 当前显示图片的http链接 | ||
| 6492 | - urls: [this.data.shareImgPath] ,// 需要预览的图片http链接列表 | ||
| 6493 | - }); | ||
| 6494 | - }, | ||
| 6495 | - | ||
| 6496 | 6495 | ||
| 6497 | }); | 6496 | }); | 
packageC/pages/presell/goodsInfo/goodsInfo.js
| @@ -252,9 +252,6 @@ Page({ | @@ -252,9 +252,6 @@ Page({ | ||
| 252 | 252 | ||
| 253 | //------初始化加载---------- | 253 | //------初始化加载---------- | 
| 254 | onLoad: function (t) { | 254 | onLoad: function (t) { | 
| 255 | - if(!getApp().is_Single_page()){ | ||
| 256 | - return false; | ||
| 257 | - } | ||
| 258 | var ee = this, that = ee, th = ee, | 255 | var ee = this, that = ee, th = ee, | 
| 259 | pre_id = t.pre_id, | 256 | pre_id = t.pre_id, | 
| 260 | gid = t.goods_id, | 257 | gid = t.goods_id, | 
pages/giftpack/buygiftpack/giftpackbuy.js
| @@ -77,14 +77,14 @@ Page({ | @@ -77,14 +77,14 @@ Page({ | ||
| 77 | }, | 77 | }, | 
| 78 | onShow: function () { | 78 | onShow: function () { | 
| 79 | //--先判断会员状态-- | 79 | //--先判断会员状态-- | 
| 80 | - var user_info = getApp().globalData.userInfo; | ||
| 81 | - if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | ||
| 82 | - if(getApp().is_Single_page()){ | ||
| 83 | - getApp().goto('/pages/togoin/togoin'); | ||
| 84 | - return false; | 80 | + getApp().is_Single_page(this,function(){ | 
| 81 | + var user_info = getApp().globalData.userInfo; | ||
| 82 | + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | ||
| 83 | + getApp().goto('/pages/togoin/togoin'); | ||
| 84 | + return false; | ||
| 85 | } | 85 | } | 
| 86 | - } | ||
| 87 | - this.getList(); | 86 | + this.getList(); | 
| 87 | + }) | ||
| 88 | }, | 88 | }, | 
| 89 | 89 | ||
| 90 | //购买礼包 | 90 | //购买礼包 | 
pages/giftpack/giftpacklist/giftpacklist.js
| @@ -60,21 +60,19 @@ Page({ | @@ -60,21 +60,19 @@ Page({ | ||
| 60 | }, | 60 | }, | 
| 61 | 61 | ||
| 62 | onShow: function () { | 62 | onShow: function () { | 
| 63 | - //--先判断会员状态-- | ||
| 64 | - var user_info = getApp().globalData.userInfo; | ||
| 65 | - if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | ||
| 66 | - if(getApp().is_Single_page()){ | 63 | + getApp().is_Single_page(this,function () { | 
| 64 | + //--先判断会员状态-- | ||
| 65 | + var user_info = getApp().globalData.userInfo; | ||
| 66 | + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | ||
| 67 | getApp().goto('/pages/togoin/togoin'); | 67 | getApp().goto('/pages/togoin/togoin'); | 
| 68 | return false; | 68 | return false; | 
| 69 | } | 69 | } | 
| 70 | - } | ||
| 71 | - | ||
| 72 | - if (this.data.isBuy == 0) { | ||
| 73 | - this.GetMyGiftList(); | ||
| 74 | - } else { | ||
| 75 | - this.GetBuyGiftList(); | ||
| 76 | - } | ||
| 77 | - | 70 | + if (this.data.isBuy == 0) { | 
| 71 | + this.GetMyGiftList(); | ||
| 72 | + } else { | ||
| 73 | + this.GetBuyGiftList(); | ||
| 74 | + } | ||
| 75 | + }) | ||
| 78 | }, | 76 | }, | 
| 79 | GetBuyPrice: function (e) { | 77 | GetBuyPrice: function (e) { | 
| 80 | var that = this.data; | 78 | var that = this.data; | 
pages/giftpack/mygiftpack/mygiftpack.js
| @@ -74,16 +74,15 @@ Page({ | @@ -74,16 +74,15 @@ Page({ | ||
| 74 | }, | 74 | }, | 
| 75 | onShow: function() { | 75 | onShow: function() { | 
| 76 | //--先判断会员状态-- | 76 | //--先判断会员状态-- | 
| 77 | - var user_info = getApp().globalData.userInfo; | ||
| 78 | - if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | ||
| 79 | - if(getApp().is_Single_page()){ | ||
| 80 | - getApp().goto('/pages/togoin/togoin'); | ||
| 81 | - return false; | 77 | + getApp().is_Single_page(this,function () { | 
| 78 | + var user_info = getApp().globalData.userInfo; | ||
| 79 | + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | ||
| 80 | + getApp().goto('/pages/togoin/togoin'); | ||
| 81 | + return false; | ||
| 82 | } | 82 | } | 
| 83 | - // getApp().goto('/pages/togoin/togoin'); | ||
| 84 | - // return false; | ||
| 85 | - } | ||
| 86 | - this.getList(); | 83 | + this.getList(); | 
| 84 | + }) | ||
| 85 | + | ||
| 87 | 86 | ||
| 88 | }, | 87 | }, | 
| 89 | getList: function() { | 88 | getList: function() { | 
pages/user/assistance/assistance.js
| @@ -28,17 +28,17 @@ Page({ | @@ -28,17 +28,17 @@ Page({ | ||
| 28 | timer: "", //任务列表的定时器 | 28 | timer: "", //任务列表的定时器 | 
| 29 | s_num: "", //多少人已经领取任务 | 29 | s_num: "", //多少人已经领取任务 | 
| 30 | page: 1, //我的任务的当前页 | 30 | page: 1, //我的任务的当前页 | 
| 31 | - | ||
| 32 | - imageUrl:'', | ||
| 33 | - btn_color:'', | ||
| 34 | - bg_color:'', | ||
| 35 | - font_color:'', | 31 | + | 
| 32 | + imageUrl: '', | ||
| 33 | + btn_color: '', | ||
| 34 | + bg_color: '', | ||
| 35 | + font_color: '', | ||
| 36 | }, | 36 | }, | 
| 37 | 37 | ||
| 38 | /** | 38 | /** | 
| 39 | * 生命周期函数--监听页面加载 | 39 | * 生命周期函数--监听页面加载 | 
| 40 | */ | 40 | */ | 
| 41 | - onLoad: function(options) { | 41 | + onLoad: function (options) { | 
| 42 | var th = this; | 42 | var th = this; | 
| 43 | var nav_b = th.selectComponent("#nav_b"); //组件的id | 43 | var nav_b = th.selectComponent("#nav_b"); //组件的id | 
| 44 | nav_b.set_name("助力", "/pages/user/assistance/assistance"); | 44 | nav_b.set_name("助力", "/pages/user/assistance/assistance"); | 
| @@ -48,36 +48,33 @@ Page({ | @@ -48,36 +48,33 @@ Page({ | ||
| 48 | /** | 48 | /** | 
| 49 | * 生命周期函数--监听页面显示 | 49 | * 生命周期函数--监听页面显示 | 
| 50 | */ | 50 | */ | 
| 51 | - onShow: function() { | ||
| 52 | - | 51 | + onShow: function () { | 
| 53 | //--先判断会员状态-- | 52 | //--先判断会员状态-- | 
| 54 | - var user_info = getApp().globalData.userInfo; | ||
| 55 | - if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | ||
| 56 | - if(getApp().is_Single_page()){ | 53 | + getApp().is_Single_page(this, function () { | 
| 54 | + var user_info = getApp().globalData.userInfo; | ||
| 55 | + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | ||
| 57 | getApp().goto('/pages/togoin/togoin'); | 56 | getApp().goto('/pages/togoin/togoin'); | 
| 58 | return false; | 57 | return false; | 
| 59 | } | 58 | } | 
| 60 | - } | 59 | + // 助力活动 | 
| 60 | + this.assistance(); | ||
| 61 | + }) | ||
| 62 | + }, | ||
| 61 | 63 | ||
| 62 | - var th = this; | ||
| 63 | - // 助力活动 | ||
| 64 | - this.assistance(); | 64 | + print() { | 
| 65 | + var user_id = getApp().globalData.user_id; | ||
| 66 | + var store_id = os.stoid; | ||
| 67 | + | ||
| 68 | + getApp().request.promiseGet("/api/weshop/marketing/help/act/judge", { | ||
| 69 | + data: { | ||
| 70 | + storeId: store_id, | ||
| 71 | + userId: user_id | ||
| 72 | + } | ||
| 73 | + }).then(res => { | ||
| 74 | + console.log('res', res); | ||
| 75 | + }); | ||
| 65 | }, | 76 | }, | 
| 66 | - | ||
| 67 | - print() { | ||
| 68 | - var user_id = getApp().globalData.user_id; | ||
| 69 | - var store_id = os.stoid; | ||
| 70 | - | ||
| 71 | - getApp().request.promiseGet("/api/weshop/marketing/help/act/judge", { | ||
| 72 | - data: { | ||
| 73 | - storeId: store_id, | ||
| 74 | - userId: user_id | ||
| 75 | - } | ||
| 76 | - }).then(res => { | ||
| 77 | - console.log('res', res); | ||
| 78 | - }); | ||
| 79 | - }, | ||
| 80 | - | 77 | + | 
| 81 | // 助力活动 | 78 | // 助力活动 | 
| 82 | assistance() { | 79 | assistance() { | 
| 83 | var th = this; | 80 | var th = this; | 
| @@ -96,10 +93,10 @@ Page({ | @@ -96,10 +93,10 @@ Page({ | ||
| 96 | th.setData({ | 93 | th.setData({ | 
| 97 | zl_act: help_data, | 94 | zl_act: help_data, | 
| 98 | help_id: help_data.id, | 95 | help_id: help_data.id, | 
| 99 | - btn_color: help_data.btn_color, | ||
| 100 | - bg_color: help_data.bg_color, | ||
| 101 | - font_color: help_data.font_color, | ||
| 102 | - imageUrl: help_data.imageUrl, | 96 | + btn_color: help_data.btn_color, | 
| 97 | + bg_color: help_data.bg_color, | ||
| 98 | + font_color: help_data.font_color, | ||
| 99 | + imageUrl: help_data.imageUrl, | ||
| 103 | }); | 100 | }); | 
| 104 | if (th.data.help_id != "" && th.data.help_id != null) { | 101 | if (th.data.help_id != "" && th.data.help_id != null) { | 
| 105 | //我的任务 | 102 | //我的任务 | 
| @@ -112,11 +109,11 @@ Page({ | @@ -112,11 +109,11 @@ Page({ | ||
| 112 | storeId: store_id | 109 | storeId: store_id | 
| 113 | } | 110 | } | 
| 114 | }) | 111 | }) | 
| 115 | - }else | ||
| 116 | - getApp().my_warnning("暂无此活动或您不符合商家设置的会员参与对象,无法参与!", 0, th); | 112 | + } else | 
| 113 | + getApp().my_warnning("暂无此活动或您不符合商家设置的会员参与对象,无法参与!", 0, th); | ||
| 117 | return ut.null_promise(); | 114 | return ut.null_promise(); | 
| 118 | }).then(res => { | 115 | }).then(res => { | 
| 119 | - if ( res && res.data &&res.data.code == 0) | 116 | + if (res && res.data && res.data.code == 0) | 
| 120 | th.setData({ | 117 | th.setData({ | 
| 121 | s_num: res.data.data.countAll | 118 | s_num: res.data.data.countAll | 
| 122 | }) | 119 | }) | 
| @@ -126,13 +123,13 @@ Page({ | @@ -126,13 +123,13 @@ Page({ | ||
| 126 | }, | 123 | }, | 
| 127 | 124 | ||
| 128 | //--点击获取用户任务列表--会员的任务列表 | 125 | //--点击获取用户任务列表--会员的任务列表 | 
| 129 | - get_list: function() { | 126 | + get_list: function () { | 
| 130 | 127 | ||
| 131 | var th = this; | 128 | var th = this; | 
| 132 | var page = th.data.page; | 129 | var page = th.data.page; | 
| 133 | - if(page==1)th.data.zl_user_list=[]; | 130 | + if (page == 1) th.data.zl_user_list = []; | 
| 134 | var help_id = this.data.help_id; | 131 | var help_id = this.data.help_id; | 
| 135 | - var r=Math.random()*100; | 132 | + var r = Math.random() * 100; | 
| 136 | t.request.get("/api/weshop/marketing/help/help/user/page", { | 133 | t.request.get("/api/weshop/marketing/help/help/user/page", { | 
| 137 | isShowLoading: true, | 134 | isShowLoading: true, | 
| 138 | data: { | 135 | data: { | 
| @@ -141,9 +138,9 @@ Page({ | @@ -141,9 +138,9 @@ Page({ | ||
| 141 | helpId: help_id, | 138 | helpId: help_id, | 
| 142 | page: page, | 139 | page: page, | 
| 143 | pageSize: 5, | 140 | pageSize: 5, | 
| 144 | - r:r, | 141 | + r: r, | 
| 145 | }, | 142 | }, | 
| 146 | - success: function(res) { | 143 | + success: function (res) { | 
| 147 | clearTimeout(th.data.timer); | 144 | clearTimeout(th.data.timer); | 
| 148 | 145 | ||
| 149 | if (!th.data.is_load) | 146 | if (!th.data.is_load) | 
| @@ -182,17 +179,17 @@ Page({ | @@ -182,17 +179,17 @@ Page({ | ||
| 182 | }, | 179 | }, | 
| 183 | 180 | ||
| 184 | //-----跳转到领取礼包的页面------ | 181 | //-----跳转到领取礼包的页面------ | 
| 185 | - go_task: function() { | 182 | + go_task: function () { | 
| 186 | var th = this; | 183 | var th = this; | 
| 187 | var help_id = th.data.help_id; | 184 | var help_id = th.data.help_id; | 
| 188 | - if (!help_id){ | ||
| 189 | - getApp().my_warnning("暂无此活动或您不符合商家设置的会员参与对象,无法参与!", 0, th); | ||
| 190 | - return false; | ||
| 191 | - } | 185 | + if (!help_id) { | 
| 186 | + getApp().my_warnning("暂无此活动或您不符合商家设置的会员参与对象,无法参与!", 0, th); | ||
| 187 | + return false; | ||
| 188 | + } | ||
| 192 | 189 | ||
| 193 | getApp().goto("/pages/user/assistance/task_assistance?help_id=" + help_id); | 190 | getApp().goto("/pages/user/assistance/task_assistance?help_id=" + help_id); | 
| 194 | }, | 191 | }, | 
| 195 | - switch_head: function(e) { | 192 | + switch_head: function (e) { | 
| 196 | var th = this; | 193 | var th = this; | 
| 197 | var index = e.currentTarget.dataset.index; //获取当前选择的是任务还是活动说明 | 194 | var index = e.currentTarget.dataset.index; //获取当前选择的是任务还是活动说明 | 
| 198 | var switch_head = th.data.switch_head; //0任务,1活动说明 | 195 | var switch_head = th.data.switch_head; //0任务,1活动说明 | 
| @@ -204,50 +201,50 @@ Page({ | @@ -204,50 +201,50 @@ Page({ | ||
| 204 | }, | 201 | }, | 
| 205 | 202 | ||
| 206 | //关闭导航 | 203 | //关闭导航 | 
| 207 | - close: function() { | 204 | + close: function () { | 
| 208 | var th = this; | 205 | var th = this; | 
| 209 | var nav_b = th.selectComponent("#nav_b"); //组件的id | 206 | var nav_b = th.selectComponent("#nav_b"); //组件的id | 
| 210 | nav_b.close_box(); | 207 | nav_b.close_box(); | 
| 211 | }, | 208 | }, | 
| 212 | 209 | ||
| 213 | // 领取礼包 | 210 | // 领取礼包 | 
| 214 | - get_libao: function(e) { | 211 | + get_libao: function (e) { | 
| 215 | var help_id = e.currentTarget.dataset.help_id;//活动id | 212 | var help_id = e.currentTarget.dataset.help_id;//活动id | 
| 216 | var taskId = e.currentTarget.dataset.taskid;//任务id | 213 | var taskId = e.currentTarget.dataset.taskid;//任务id | 
| 217 | var id = e.currentTarget.dataset.id;//用于跳到礼包详情一键全部领取用的任务id | 214 | var id = e.currentTarget.dataset.id;//用于跳到礼包详情一键全部领取用的任务id | 
| 218 | - getApp().goto("/pages/user/assistance/giftpacklist?help_id=" + help_id + "&is_libao=" + 1 + "&taskId=" + taskId+"&id="+id); | 215 | + getApp().goto("/pages/user/assistance/giftpacklist?help_id=" + help_id + "&is_libao=" + 1 + "&taskId=" + taskId + "&id=" + id); | 
| 219 | }, | 216 | }, | 
| 220 | 217 | ||
| 221 | //查看礼包id | 218 | //查看礼包id | 
| 222 | - select_libao: function(e) { | 219 | + select_libao: function (e) { | 
| 223 | var orderSn = e.currentTarget.dataset.ordersn; //订单号 | 220 | var orderSn = e.currentTarget.dataset.ordersn; //订单号 | 
| 224 | getApp().goto("/pages/user/assistance/giftpacklist?orderSn=" + orderSn); | 221 | getApp().goto("/pages/user/assistance/giftpacklist?orderSn=" + orderSn); | 
| 225 | }, | 222 | }, | 
| 226 | 223 | ||
| 227 | //---查看任务--- | 224 | //---查看任务--- | 
| 228 | - go_to_task:function (e) { | 225 | + go_to_task: function (e) { | 
| 229 | var help_id = this.data.help_id; | 226 | var help_id = this.data.help_id; | 
| 230 | - var taskid=e.currentTarget.dataset.taskid; | ||
| 231 | - getApp().goto("/pages/user/assistance/task_assistance?help_id=" + help_id+"&taskid="+taskid); | 227 | + var taskid = e.currentTarget.dataset.taskid; | 
| 228 | + getApp().goto("/pages/user/assistance/task_assistance?help_id=" + help_id + "&taskid=" + taskid); | ||
| 229 | + }, | ||
| 230 | + | ||
| 231 | + onShareAppMessage(res) { | ||
| 232 | + if (res.from === 'button') { | ||
| 233 | + // 来自页面内转发按钮 | ||
| 234 | + console.log(res.target) | ||
| 235 | + } | ||
| 236 | + return { | ||
| 237 | + // title: '自定义转发标题', | ||
| 238 | + } | ||
| 239 | + }, | ||
| 240 | + | ||
| 241 | + onShareTimeline() { | ||
| 242 | + var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; | ||
| 243 | + if (!store_name) | ||
| 244 | + store_name = getApp().globalData.setting.appName; | ||
| 245 | + return { | ||
| 246 | + title: '好友助力-' + store_name, | ||
| 247 | + } | ||
| 232 | }, | 248 | }, | 
| 233 | - | ||
| 234 | - onShareAppMessage(res) { | ||
| 235 | - if (res.from === 'button') { | ||
| 236 | - // 来自页面内转发按钮 | ||
| 237 | - console.log(res.target) | ||
| 238 | - } | ||
| 239 | - return { | ||
| 240 | - // title: '自定义转发标题', | ||
| 241 | - } | ||
| 242 | - }, | ||
| 243 | - | ||
| 244 | - onShareTimeline() { | ||
| 245 | - var store_name=getApp().globalData.config?getApp().globalData.config.store_name:''; | ||
| 246 | - if(!store_name) | ||
| 247 | - store_name=getApp().globalData.setting.appName; | ||
| 248 | - return { | ||
| 249 | - title: '好友助力-' + store_name, | ||
| 250 | - } | ||
| 251 | - }, | ||
| 252 | 249 | ||
| 253 | }) | 250 | }) | 
