Commit c4619391e1c9db39bb46dd61fff2bf68a298d3ac

Authored by yvan.ni
1 parent 65b6bbc0

测试的bug优化

packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js
... ... @@ -630,7 +630,7 @@ Page({
630 630  
631 631 if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) {
632 632  
633   - if (item['exp_sum_type'] == 2) {
  633 + if (item['exp_sum_type'] == 2 && back_data.weight_free > 0) {
634 634 if (goods_weight < 0) goods_weight = 0;
635 635 goods_weight += item['weight'] * item['buynum'];
636 636 cut_good_weight += item['weight'] * item['buynum'];
... ...
packageC/pages/presell/cart/cart.js
... ... @@ -1913,7 +1913,7 @@ Page({
1913 1913  
1914 1914 if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) {
1915 1915  
1916   - if (item['exp_sum_type'] == 2) {
  1916 + if (item['exp_sum_type'] == 2 && back_data.weight_free > 0) {
1917 1917 if (goods_weight < 0) goods_weight = 0;
1918 1918 goods_weight += item['weight'] * item['buynum'];
1919 1919 cut_good_weight += item['weight'] * item['buynum'];
... ...
packageC/pages/presell/cart/cart2.js
... ... @@ -769,7 +769,7 @@ Page({
769 769  
770 770 if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) {
771 771  
772   - if (item['exp_sum_type'] == 2) {
  772 + if (item['exp_sum_type'] == 2 && back_data.weight_free > 0) {
773 773 if (goods_weight < 0) goods_weight = 0;
774 774 cut_good_weight += item['weight'] * item['buynum'];
775 775 goods_weight += item['weight'] * item['buynum'];
... ...
packageC/pages/presell/cart/cart2_pre.js
... ... @@ -391,7 +391,7 @@ Page({
391 391 let item = data[i];
392 392  
393 393 if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) {
394   - if (item['exp_sum_type'] == 2) {
  394 + if (item['exp_sum_type'] == 2 && back_data.weight_free > 0) {
395 395 goods_weight += item['weight'] * item['buynum'];
396 396 cut_good_weight += item['weight'] * item['buynum'];
397 397 }
... ...
pages/cart/cart2/cart2.js
... ... @@ -2007,7 +2007,7 @@ Page({
2007 2007  
2008 2008 if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item[j].goods_id) == -1)) {
2009 2009  
2010   - if (item[j]['exp_sum_type'] == 2) {
  2010 + if (item[j]['exp_sum_type'] == 2 && back_data.weight_free>0) {
2011 2011 if (goods_weight < 0) goods_weight = 0;
2012 2012 cut_good_weight += item[j]['weight'] * item[j]['goods_num'];
2013 2013 goods_weight += item[j]['weight'] * item[j]['goods_num'];
... ... @@ -2533,7 +2533,7 @@ Page({
2533 2533  
2534 2534 if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) {
2535 2535  
2536   - if (item['exp_sum_type'] == 2) {
  2536 + if (item['exp_sum_type'] == 2 && back_data.weight_free>0) {
2537 2537 if (goods_weight < 0) goods_weight = 0;
2538 2538 goods_weight += item['weight'] * item['buynum'];
2539 2539 cut_good_weight += item['weight'] * item['buynum'];
... ... @@ -2565,7 +2565,7 @@ Page({
2565 2565 case 3:
2566 2566 if (goods_piece < 0) goods_piece = 0;
2567 2567 //累积商品数量
2568   - goods_piece += item['buynum'];
  2568 + goods_piece += parseInt(item['buynum']) ;
2569 2569 break;
2570 2570 }
2571 2571 }
... ...
pages/cart/cart2_inte/cart2_inte.js
... ... @@ -525,7 +525,7 @@ Page({
525 525  
526 526 if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1) ) {
527 527  
528   - if (item['exp_sum_type'] == 2) {
  528 + if (item['exp_sum_type'] == 2 && back_data.weight_free > 0) {
529 529 if (goods_weight < 0) goods_weight = 0;
530 530 goods_weight += item['weight'] * item['buynum'];
531 531 cut_good_weight += item['weight'] * item['buynum'];
... ...
pages/cart/cart2_pt/cart2_pt.js
... ... @@ -553,7 +553,7 @@ Page({
553 553  
554 554 if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) {
555 555  
556   - if (item['exp_sum_type'] == 2) {
  556 + if (item['exp_sum_type'] == 2 && back_data.weight_free > 0) {
557 557 if (goods_weight < 0) goods_weight = 0;
558 558 cut_good_weight += item['weight'] * item['buynum'];
559 559 goods_weight += item['weight'] * item['buynum'];
... ...
pages/cart/cart_wk/cart_wk.js
... ... @@ -625,7 +625,7 @@ Page({
625 625  
626 626 if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) {
627 627  
628   - if (item['exp_sum_type'] == 2) {
  628 + if (item['exp_sum_type'] == 2 && back_data.weight_free > 0) {
629 629 if (goods_weight < 0) goods_weight = 0;
630 630 goods_weight += item['weight'] * item['buynum'];
631 631 cut_good_weight += item['weight'] * item['buynum'];
... ...
pages/store/index.js
... ... @@ -15,10 +15,6 @@ Page({
15 15 islading:0,
16 16 },
17 17  
18   - onShow:function(){
19   -
20   - },
21   -
22 18 //调用视频接口
23 19 onLoad:function(e){
24 20 var th=this;
... ...
pages/team/team_success/team_success.js
... ... @@ -323,7 +323,6 @@ Page({
323 323 ee.setData({is_pay_wk:1});
324 324 }
325 325 }else{
326   - console.log("239什么鬼", teamlist);
327 326 //设置值
328 327 ee.setData({
329 328 ordertx2: ordertx2, ordertx: ordertx, teamlist: teamlist, teamgroup: teamgroup,
... ... @@ -508,9 +507,7 @@ Page({
508 507 context.setFillStyle("black");
509 508  
510 509  
511   -
512   -
513   - th.draw_Text(context,share_title,
  510 + getApp().draw_Text(context,share_title,
514 511 38 * unit, 180 * unit, 200 * unit, 279 * unit, unit);
515 512 //------产品的价格-------
516 513 context.setFontSize(24 * unit)
... ... @@ -728,34 +725,6 @@ Page({
728 725 },
729 726  
730 727  
731   - //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度
732   - draw_Text: function (ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, unit) {
733   - var lineWidth = 0;
734   - var lastSubStrIndex = 0; //每次开始截取的字符串的索引
735   - var han = 0;
736   - for (let i = 0; i < str.length; i++) {
737   - if (han == 2) return;
738   -
739   - //lineWidth += ctx.measureText(str[i]).width;
740   - lineWidth += ut.measureText(str[i], 21.3 * unit);
741   -
742   - if (lineWidth > canvasWidth) {
743   - han++;
744   - if (han == 2)
745   - ctx.fillText(str.substring(lastSubStrIndex, i) + '...', leftWidth, initHeight); //绘制截取部分
746   - else
747   - ctx.fillText(str.substring(lastSubStrIndex, i), leftWidth, initHeight);
748   -
749   - initHeight += 22; //22为字体的高度
750   - lineWidth = 0;
751   - lastSubStrIndex = i;
752   - titleHeight += 20;
753   - }
754   - if (i == str.length - 1) { //绘制剩余部分
755   - ctx.fillText(str.substring(lastSubStrIndex, i + 1), leftWidth, initHeight);
756   - }
757   - }
758   - },
759 728  
760 729 //c点击打开拼团弹窗
761 730 cpd: function() {
... ... @@ -906,101 +875,11 @@ Page({
906 875 // 保存图片到手机
907 876 savePic() {
908 877 console.log('保存图片');
909   - var self = this;
910   - // 获取用户的当前设置,返回值中有小程序已经向用户请求过的权限
911   - this.getSetting().then((res) => {
912   - // 判断用户是否授权了保存到相册的权限,如果没有发起授权
913   - if (!res.authSetting['scope.writePhotosAlbum']) {
914   - this.authorize().then(() => {
915   - // 同意授权后保存下载文件
916   - this.saveImage(self.data.shareImgPath)
917   - .then(() => {
918   - self.setData({
919   - showPoster: false
920   - });
921   - });
922   - })
923   - } else {
924   - // 如果已经授权,保存下载文件
925   - this.saveImage(self.data.shareImgPath)
926   - .then(() => {
927   - self.setData({
928   - showPoster: false
929   - });
930   - });
931   - }
  878 + getApp().savePic(this);
932 879  
933   - })
934 880 },
935 881  
936 882  
937   - // 保存图片到系统相册
938   - saveImage(saveUrl) {
939   - var self = this;
940   - return new Promise((resolve, reject) => {
941   - wx.saveImageToPhotosAlbum({
942   - filePath: saveUrl,
943   - success: (res) => {
944   - wx.showToast({
945   - title: '保存成功',
946   - duration: 1000,
947   - });
948   - self.setData({
949   - showPlaybill: 'true'
950   - });
951   - resolve();
952   - },
953   - fail: () => {
954   - wx.showToast({
955   - title: '保存失败',
956   - duration: 1000,
957   - });
958   - }
959   - })
960   - })
961   - },
962   -
963   - // 获取用户已经授予了哪些权限
964   - getSetting() {
965   - return new Promise((resolve, reject) => {
966   - wx.getSetting({
967   - success: res => {
968   - resolve(res)
969   - }
970   - })
971   - })
972   - },
973   -
974   - // 发起首次授权请求
975   - authorize() {
976   - // isFirst 用来记录是否为首次发起授权,
977   - // 如果首次授权拒绝后,isFirst赋值为1
978   - let isFirst = wx.getStorageSync('isFirst') || 0;
979   - return new Promise((resolve, reject) => {
980   - wx.authorize({
981   - scope: 'scope.writePhotosAlbum',
982   - // 同意授权
983   - success: () => {
984   - resolve();
985   - },
986   - // 拒绝授权,这里是用户拒绝授权后的回调
987   - fail: res => {
988   - if(isFirst === 0) {
989   - wx.setStorageSync('isFirst', 1);
990   - wx.showToast({
991   - title: '保存失败',
992   - icon: 'none',
993   - duration: 1000
994   - })
995   - } else {
996   - this.showModal();
997   - }
998   - console.log('拒绝授权');
999   - reject();
1000   - }
1001   - })
1002   - })
1003   - },
1004 883  
1005 884  
1006 885  
... ...