diff --git a/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js b/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js index a446e4e..791e62c 100644 --- a/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js +++ b/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js @@ -630,7 +630,7 @@ Page({ if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { - if (item['exp_sum_type'] == 2) { + if (item['exp_sum_type'] == 2 && back_data.weight_free > 0) { if (goods_weight < 0) goods_weight = 0; goods_weight += item['weight'] * item['buynum']; cut_good_weight += item['weight'] * item['buynum']; diff --git a/packageC/pages/presell/cart/cart.js b/packageC/pages/presell/cart/cart.js index 4d8c024..445639e 100644 --- a/packageC/pages/presell/cart/cart.js +++ b/packageC/pages/presell/cart/cart.js @@ -1913,7 +1913,7 @@ Page({ if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { - if (item['exp_sum_type'] == 2) { + if (item['exp_sum_type'] == 2 && back_data.weight_free > 0) { if (goods_weight < 0) goods_weight = 0; goods_weight += item['weight'] * item['buynum']; cut_good_weight += item['weight'] * item['buynum']; diff --git a/packageC/pages/presell/cart/cart2.js b/packageC/pages/presell/cart/cart2.js index 0280add..102d2f7 100644 --- a/packageC/pages/presell/cart/cart2.js +++ b/packageC/pages/presell/cart/cart2.js @@ -769,7 +769,7 @@ Page({ if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { - if (item['exp_sum_type'] == 2) { + if (item['exp_sum_type'] == 2 && back_data.weight_free > 0) { if (goods_weight < 0) goods_weight = 0; cut_good_weight += item['weight'] * item['buynum']; goods_weight += item['weight'] * item['buynum']; diff --git a/packageC/pages/presell/cart/cart2_pre.js b/packageC/pages/presell/cart/cart2_pre.js index 8c92d21..e9b2809 100644 --- a/packageC/pages/presell/cart/cart2_pre.js +++ b/packageC/pages/presell/cart/cart2_pre.js @@ -391,7 +391,7 @@ Page({ let item = data[i]; if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { - if (item['exp_sum_type'] == 2) { + if (item['exp_sum_type'] == 2 && back_data.weight_free > 0) { goods_weight += item['weight'] * item['buynum']; cut_good_weight += item['weight'] * item['buynum']; } diff --git a/pages/cart/cart2/cart2.js b/pages/cart/cart2/cart2.js index 42b4f98..0baf088 100644 --- a/pages/cart/cart2/cart2.js +++ b/pages/cart/cart2/cart2.js @@ -2007,7 +2007,7 @@ Page({ if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item[j].goods_id) == -1)) { - if (item[j]['exp_sum_type'] == 2) { + if (item[j]['exp_sum_type'] == 2 && back_data.weight_free>0) { if (goods_weight < 0) goods_weight = 0; cut_good_weight += item[j]['weight'] * item[j]['goods_num']; goods_weight += item[j]['weight'] * item[j]['goods_num']; @@ -2533,7 +2533,7 @@ Page({ if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { - if (item['exp_sum_type'] == 2) { + if (item['exp_sum_type'] == 2 && back_data.weight_free>0) { if (goods_weight < 0) goods_weight = 0; goods_weight += item['weight'] * item['buynum']; cut_good_weight += item['weight'] * item['buynum']; @@ -2565,7 +2565,7 @@ Page({ case 3: if (goods_piece < 0) goods_piece = 0; //累积商品数量 - goods_piece += item['buynum']; + goods_piece += parseInt(item['buynum']) ; break; } } diff --git a/pages/cart/cart2_inte/cart2_inte.js b/pages/cart/cart2_inte/cart2_inte.js index c72737e..8148f77 100644 --- a/pages/cart/cart2_inte/cart2_inte.js +++ b/pages/cart/cart2_inte/cart2_inte.js @@ -525,7 +525,7 @@ Page({ if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1) ) { - if (item['exp_sum_type'] == 2) { + if (item['exp_sum_type'] == 2 && back_data.weight_free > 0) { if (goods_weight < 0) goods_weight = 0; goods_weight += item['weight'] * item['buynum']; cut_good_weight += item['weight'] * item['buynum']; diff --git a/pages/cart/cart2_pt/cart2_pt.js b/pages/cart/cart2_pt/cart2_pt.js index 9faac8c..145b114 100644 --- a/pages/cart/cart2_pt/cart2_pt.js +++ b/pages/cart/cart2_pt/cart2_pt.js @@ -553,7 +553,7 @@ Page({ if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { - if (item['exp_sum_type'] == 2) { + if (item['exp_sum_type'] == 2 && back_data.weight_free > 0) { if (goods_weight < 0) goods_weight = 0; cut_good_weight += item['weight'] * item['buynum']; goods_weight += item['weight'] * item['buynum']; diff --git a/pages/cart/cart_wk/cart_wk.js b/pages/cart/cart_wk/cart_wk.js index 07a1950..ddca7b3 100644 --- a/pages/cart/cart_wk/cart_wk.js +++ b/pages/cart/cart_wk/cart_wk.js @@ -625,7 +625,7 @@ Page({ if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { - if (item['exp_sum_type'] == 2) { + if (item['exp_sum_type'] == 2 && back_data.weight_free > 0) { if (goods_weight < 0) goods_weight = 0; goods_weight += item['weight'] * item['buynum']; cut_good_weight += item['weight'] * item['buynum']; diff --git a/pages/store/index.js b/pages/store/index.js index 6738480..de6d033 100644 --- a/pages/store/index.js +++ b/pages/store/index.js @@ -15,10 +15,6 @@ Page({ islading:0, }, - onShow:function(){ - - }, - //调用视频接口 onLoad:function(e){ var th=this; diff --git a/pages/team/team_success/team_success.js b/pages/team/team_success/team_success.js index c1d4bfd..29e6e84 100644 --- a/pages/team/team_success/team_success.js +++ b/pages/team/team_success/team_success.js @@ -323,7 +323,6 @@ Page({ ee.setData({is_pay_wk:1}); } }else{ - console.log("239什么鬼", teamlist); //设置值 ee.setData({ ordertx2: ordertx2, ordertx: ordertx, teamlist: teamlist, teamgroup: teamgroup, @@ -508,9 +507,7 @@ Page({ context.setFillStyle("black"); - - - th.draw_Text(context,share_title, + getApp().draw_Text(context,share_title, 38 * unit, 180 * unit, 200 * unit, 279 * unit, unit); //------产品的价格------- context.setFontSize(24 * unit) @@ -728,34 +725,6 @@ Page({ }, - //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 - draw_Text: function (ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, unit) { - var lineWidth = 0; - var lastSubStrIndex = 0; //每次开始截取的字符串的索引 - var han = 0; - for (let i = 0; i < str.length; i++) { - if (han == 2) return; - - //lineWidth += ctx.measureText(str[i]).width; - lineWidth += ut.measureText(str[i], 21.3 * unit); - - if (lineWidth > canvasWidth) { - han++; - if (han == 2) - ctx.fillText(str.substring(lastSubStrIndex, i) + '...', leftWidth, initHeight); //绘制截取部分 - else - ctx.fillText(str.substring(lastSubStrIndex, i), leftWidth, initHeight); - - initHeight += 22; //22为字体的高度 - lineWidth = 0; - lastSubStrIndex = i; - titleHeight += 20; - } - if (i == str.length - 1) { //绘制剩余部分 - ctx.fillText(str.substring(lastSubStrIndex, i + 1), leftWidth, initHeight); - } - } - }, //c点击打开拼团弹窗 cpd: function() { @@ -906,101 +875,11 @@ Page({ // 保存图片到手机 savePic() { console.log('保存图片'); - var self = this; - // 获取用户的当前设置,返回值中有小程序已经向用户请求过的权限 - this.getSetting().then((res) => { - // 判断用户是否授权了保存到相册的权限,如果没有发起授权 - if (!res.authSetting['scope.writePhotosAlbum']) { - this.authorize().then(() => { - // 同意授权后保存下载文件 - this.saveImage(self.data.shareImgPath) - .then(() => { - self.setData({ - showPoster: false - }); - }); - }) - } else { - // 如果已经授权,保存下载文件 - this.saveImage(self.data.shareImgPath) - .then(() => { - self.setData({ - showPoster: false - }); - }); - } + getApp().savePic(this); - }) }, - // 保存图片到系统相册 - saveImage(saveUrl) { - var self = this; - return new Promise((resolve, reject) => { - wx.saveImageToPhotosAlbum({ - filePath: saveUrl, - success: (res) => { - wx.showToast({ - title: '保存成功', - duration: 1000, - }); - self.setData({ - showPlaybill: 'true' - }); - resolve(); - }, - fail: () => { - wx.showToast({ - title: '保存失败', - duration: 1000, - }); - } - }) - }) - }, - - // 获取用户已经授予了哪些权限 - getSetting() { - return new Promise((resolve, reject) => { - wx.getSetting({ - success: res => { - resolve(res) - } - }) - }) - }, - - // 发起首次授权请求 - authorize() { - // isFirst 用来记录是否为首次发起授权, - // 如果首次授权拒绝后,isFirst赋值为1 - let isFirst = wx.getStorageSync('isFirst') || 0; - return new Promise((resolve, reject) => { - wx.authorize({ - scope: 'scope.writePhotosAlbum', - // 同意授权 - success: () => { - resolve(); - }, - // 拒绝授权,这里是用户拒绝授权后的回调 - fail: res => { - if(isFirst === 0) { - wx.setStorageSync('isFirst', 1); - wx.showToast({ - title: '保存失败', - icon: 'none', - duration: 1000 - }) - } else { - this.showModal(); - } - console.log('拒绝授权'); - reject(); - } - }) - }) - },