Commit 8a37b6af1e018b7fd2111a423a35ae1665cd57c4

Authored by 后端研发-苏明海
2 parents bb14adcd 37a7ae48

Merge branch 'test' into 'qa'

Test

See merge request !1112
... ... @@ -2,7 +2,7 @@ var t = require("setting.js"), o = require("./utils/auth.js"), a = require("./ut
2 2 var os = t;
3 3 var regeneratorRuntime = require('./utils/runtime.js');
4 4 var api = require("./api/api.js")
5   -// import { pluginGD } from './utils/ai_config/config'
  5 +
6 6 //公共方法和变量
7 7 App({
8 8  
... ... @@ -221,21 +221,6 @@ App({
221 221  
222 222 },
223 223  
224   - // overShare:function() {
225   - // // 监听路由切换
226   - // wx.onAppRoute(function(res) {
227   - // console.log('route',res)
228   - // let pages = getCurrentPages()
229   - // let view = pages[pages.length - 1]
230   - // if(view) {
231   - // wx.showShareMenu({
232   - // withShareTicket:true,
233   - // menus:['shareAppMessage','shareTimeline']
234   - // })
235   - // }
236   - // })
237   - // },
238   -
239 224 //---初始化第三方----
240 225 initExt: function () {
241 226 var tt = t;
... ... @@ -267,14 +252,6 @@ App({
267 252 if (null == s.globalData.userInfo) {
268 253 return o.auth(t);
269 254 }
270   - /*---
271   - a.get("/api/user/userInfo", {
272   - isShowLoading: void 0 === i || i,
273   - success: function(o) {
274   - s.globalData.userInfo = o.data.result, s.globalData.userInfo.head_pic = e.getFullUrl(s.globalData.userInfo.head_pic),
275   - "function" == typeof t && t(s.globalData.userInfo, s.globalData.wechatUser);
276   - }
277   - });--*/
278 255 }
279 256 },
280 257 //----------------获取配置参数--------------------
... ... @@ -390,7 +367,6 @@ App({
390 367 });
391 368 },
392 369 showWarning: function (t, o, a, e) {
393   - //var imghost=this.globalData.setting.imghost;
394 370 !a && (a = 1500), void 0 === e && (e = !0), wx.showToast({
395 371 title: t,
396 372 mask: e,
... ... @@ -510,7 +486,7 @@ App({
510 486 wx.navigateTo({ url: url, }) //跳到tabbar页
511 487 }
512 488 }
513   - //wx.navigateTo({ url: url, }) //跳到非tabbar页
  489 +
514 490 },
515 491  
516 492 //显示提示,word提示内容,type 0失败,提示 1成功
... ... @@ -663,11 +639,6 @@ App({
663 639 num += e.data.data.pageData[i].goods_num;
664 640 }
665 641 }
666   - /*---
667   - wx.setTabBarBadge({ //tabbar右上角添加文本
668   - index: 2, ////tabbar下标
669   - text: '' + num //显示的内容
670   - });--*/
671 642 //-- 读取服务卡的数量 --
672 643 that.promiseGet("/api/weshop/cartService/page", {
673 644 data: {
... ... @@ -1075,7 +1046,133 @@ App({
1075 1046 return parseFloat((parseFloat(first_money)+parseFloat(second_money)+parseFloat(third_money)).toFixed(2));
1076 1047 }
1077 1048 }
1078   - }
  1049 + },
  1050 +
  1051 +
  1052 + // 保存图片到手机
  1053 + savePic(th) {
  1054 + console.log('保存图片');
  1055 + var self = th;
  1056 + // 获取用户的当前设置,返回值中有小程序已经向用户请求过的权限
  1057 + this.getSetting().then((res) => {
  1058 + // 判断用户是否授权了保存到相册的权限,如果没有发起授权
  1059 + if (!res.authSetting['scope.writePhotosAlbum']) {
  1060 + this.authorize().then(() => {
  1061 + // 同意授权后保存下载文件
  1062 + this.saveImage(self.data.shareImgPath,th)
  1063 + .then(() => {
  1064 + self.setData({
  1065 + showPoster: false
  1066 + });
  1067 + });
  1068 + })
  1069 + } else {
  1070 + // 如果已经授权,保存下载文件
  1071 + this.saveImage(self.data.shareImgPath)
  1072 + .then(() => {
  1073 + self.setData({
  1074 + showPoster: false
  1075 + });
  1076 + });
  1077 + }
  1078 +
  1079 + })
  1080 + },
  1081 +
  1082 + // 获取用户已经授予了哪些权限
  1083 + getSetting() {
  1084 + return new Promise((resolve, reject) => {
  1085 + wx.getSetting({
  1086 + success: res => {
  1087 + resolve(res)
  1088 + }
  1089 + })
  1090 + })
  1091 + },
  1092 + // 发起首次授权请求
  1093 + authorize() {
  1094 + // isFirst 用来记录是否为首次发起授权,
  1095 + // 如果首次授权拒绝后,isFirst赋值为1
  1096 + let isFirst = wx.getStorageSync('isFirst') || 0;
  1097 + return new Promise((resolve, reject) => {
  1098 + wx.authorize({
  1099 + scope: 'scope.writePhotosAlbum',
  1100 + // 同意授权
  1101 + success: () => {
  1102 + resolve();
  1103 + },
  1104 + // 拒绝授权,这里是用户拒绝授权后的回调
  1105 + fail: res => {
  1106 + if (isFirst === 0) {
  1107 + wx.setStorageSync('isFirst', 1);
  1108 + wx.showToast({
  1109 + title: '保存失败',
  1110 + icon: 'none',
  1111 + duration: 1000
  1112 + })
  1113 + }
  1114 + console.log('拒绝授权');
  1115 + reject();
  1116 + }
  1117 + })
  1118 + })
  1119 + },
  1120 + // 保存图片到系统相册
  1121 + saveImage(saveUrl,th) {
  1122 + var self = th;
  1123 + return new Promise((resolve, reject) => {
  1124 + wx.saveImageToPhotosAlbum({
  1125 + filePath: saveUrl,
  1126 + success: (res) => {
  1127 + wx.showToast({
  1128 + title: '保存成功',
  1129 + duration: 1000,
  1130 + });
  1131 + self.setData({
  1132 + showPlaybill: 'true'
  1133 + });
  1134 + resolve();
  1135 + },
  1136 + fail: () => {
  1137 + wx.showToast({
  1138 + title: '保存失败',
  1139 + duration: 1000,
  1140 + });
  1141 + }
  1142 + })
  1143 + })
  1144 + },
  1145 +
  1146 + //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度
  1147 + draw_Text: function (ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, unit, lineNum) {
  1148 + var lineWidth = 0;
  1149 + var lastSubStrIndex = 0; //每次开始截取的字符串的索引
  1150 + var han = 0;
  1151 + for (let i = 0; i < str.length; i++) {
  1152 + if(lineNum) {
  1153 + if(han == lineNum) return;
  1154 + };
  1155 + if (han == 2) return;
  1156 + //lineWidth += ctx.measureText(str[i]).width;
  1157 + lineWidth += ut.measureText(str[i], 21.3 * unit);
  1158 + if (lineWidth > canvasWidth) {
  1159 + han++;
  1160 +
  1161 + if (han == 2 || han == lineNum)
  1162 + ctx.fillText(str.substring(lastSubStrIndex, i) + '...', leftWidth, initHeight); //绘制截取部分
  1163 + else
  1164 + ctx.fillText(str.substring(lastSubStrIndex, i), leftWidth, initHeight);
  1165 +
  1166 + initHeight += 22; //22为字体的高度
  1167 + lineWidth = 0;
  1168 + lastSubStrIndex = i;
  1169 + titleHeight += 20;
  1170 + }
  1171 + if (i == str.length - 1) { //绘制剩余部分
  1172 + ctx.fillText(str.substring(lastSubStrIndex, i + 1), leftWidth, initHeight);
  1173 + }
  1174 + };
  1175 + },
1079 1176  
1080 1177  
1081 1178 });
... ...
app.json
... ... @@ -145,7 +145,6 @@
145 145 "pages/user/Change_phone/Change_phone",
146 146 "pages/zuhegou/index/index",
147 147 "pages/zuhegou/list/list",
148   - "pages/user/binding_info/binding_info",
149 148 "pages/user/choice_guide/choice_guide",
150 149 "pages/video/index",
151 150 "pages/boxes-list/boxes-list",
... ...
app.wxss
... ... @@ -742,14 +742,14 @@ background: #ffe3e2;
742 742  
743 743  
744 744 /* 图标字体(ty) */
745   -@font-face {
746   - font-family: 'iconfont'; /* Project id 2054717 */
747   - src: url('//at.alicdn.com/t/font_2054717_7asl31h61km.woff2?t=1648457743336') format('woff2'),
  745 +/* @font-face { */
  746 + /* font-family: 'iconfont'; */ /* Project id 2054717 */
  747 + /* src: url('//at.alicdn.com/t/font_2054717_7asl31h61km.woff2?t=1648457743336') format('woff2'),
748 748 url('//at.alicdn.com/t/font_2054717_7asl31h61km.woff?t=1648457743336') format('woff'),
749 749 url('//at.alicdn.com/t/font_2054717_7asl31h61km.ttf?t=1648457743336') format('truetype');
750   -}
  750 +} */
751 751  
752   -.icon-zhibo:before {
  752 +/* .icon-zhibo:before {
753 753 content: "\e623";
754 754 }
755 755  
... ... @@ -800,6 +800,69 @@ background: #ffe3e2;
800 800 font-style: normal;
801 801 -webkit-font-smoothing: antialiased;
802 802 -moz-osx-font-smoothing: grayscale;
  803 +} */
  804 +
  805 +@font-face {
  806 + font-family: "iconfont"; /* Project id 2054717 */
  807 + src: url('//at.alicdn.com/t/c/font_2054717_k2sfcuqycll.woff2?t=1661217430593') format('woff2'),
  808 + url('//at.alicdn.com/t/c/font_2054717_k2sfcuqycll.woff?t=1661217430593') format('woff'),
  809 + url('//at.alicdn.com/t/c/font_2054717_k2sfcuqycll.ttf?t=1661217430593') format('truetype');
  810 +}
  811 +
  812 +.iconfont {
  813 + font-family: "iconfont" !important;
  814 + font-size: 16px;
  815 + font-style: normal;
  816 + -webkit-font-smoothing: antialiased;
  817 + -moz-osx-font-smoothing: grayscale;
  818 +}
  819 +
  820 +.icon-shangjiantou:before {
  821 + content: "\e791";
  822 +}
  823 +
  824 +.icon-zhibo:before {
  825 + content: "\e623";
  826 +}
  827 +
  828 +.icon-dianhua:before {
  829 + content: "\e64b";
  830 +}
  831 +
  832 +.icon-kefu1:before {
  833 + content: "\e651";
  834 +}
  835 +
  836 +.icon-infofill:before {
  837 + content: "\e6e6";
  838 +}
  839 +
  840 +.icon-geren:before {
  841 + content: "\e71d";
  842 +}
  843 +
  844 +.icon-tupian:before {
  845 + content: "\e997";
  846 +}
  847 +
  848 +.icon-wenhao:before {
  849 + content: "\e72d";
  850 +}
  851 +
  852 +.icon-suoxiao:before {
  853 + content: "\e7af";
  854 +}
  855 +
  856 +.icon-yanjing-kai:before {
  857 + content: "\e6f9";
  858 +}
  859 +
  860 +.icon-yanjing-guan:before {
  861 + content: "\e6fa";
  862 +}
  863 +
  864 +.icon-fangda:before {
  865 + content: "\e662";
803 866 }
804 867  
805 868 .icon-checked:before {
... ... @@ -826,6 +889,10 @@ background: #ffe3e2;
826 889 content: "\e6ca";
827 890 }
828 891  
  892 +.icon-xingyungou:before {
  893 + content: "\e622";
  894 +}
  895 +
829 896 .icon-luck:before {
830 897 content: "\e621";
831 898 }
... ... @@ -838,7 +905,6 @@ background: #ffe3e2;
838 905 content: "\e6b4";
839 906 }
840 907  
841   -
842 908 .icon-fenlei:before {
843 909 content: "\e628";
844 910 }
... ... @@ -846,6 +912,7 @@ background: #ffe3e2;
846 912 .icon-arrowup:before {
847 913 content: "\e61e";
848 914 }
  915 +
849 916 .icon-aixin:before {
850 917 content: "\e8c3";
851 918 }
... ... @@ -878,13 +945,14 @@ background: #ffe3e2;
878 945 content: "\e614";
879 946 }
880 947  
  948 +.icon-erweimafenxiang:before {
  949 + content: "\e613";
  950 +}
881 951  
882 952 .icon-zhiwen:before {
883 953 content: "\e6aa";
884 954 }
885 955  
886   -
887   -
888 956 .icon-guan:before {
889 957 content: "\e612";
890 958 }
... ... @@ -897,8 +965,6 @@ background: #ffe3e2;
897 965 content: "\e611";
898 966 }
899 967  
900   -
901   -
902 968 .icon-zhuanpan:before {
903 969 content: "\e642";
904 970 }
... ... @@ -955,6 +1021,14 @@ background: #ffe3e2;
955 1021 content: "\e61d";
956 1022 }
957 1023  
  1024 +.icon-shangjia:before {
  1025 + content: "\e6e5";
  1026 +}
  1027 +
  1028 +.icon-xiajia:before {
  1029 + content: "\e6e4";
  1030 +}
  1031 +
958 1032 .icon-shaixuan:before {
959 1033 content: "\e68a";
960 1034 }
... ... @@ -975,7 +1049,6 @@ background: #ffe3e2;
975 1049 content: "\e638";
976 1050 }
977 1051  
978   -
979 1052 .icon-sousuo:before {
980 1053 content: "\e618";
981 1054 }
... ... @@ -1016,14 +1089,6 @@ background: #ffe3e2;
1016 1089 content: "\e609";
1017 1090 }
1018 1091  
1019   -.icon-shangjia:before {
1020   - content: "\e6e5";
1021   -}
1022   -
1023   -.icon-xiajia:before {
1024   - content: "\e6e4";
1025   -}
1026   -
1027 1092 .icon-yongjin:before {
1028 1093 content: "\e60c";
1029 1094 }
... ... @@ -1048,14 +1113,6 @@ background: #ffe3e2;
1048 1113 content: "\e65e";
1049 1114 }
1050 1115  
1051   -.icon-yihexiao:before {
1052   - content: "\e726";
1053   -}
1054   -
1055   -.icon-daihexiao:before {
1056   - content: "\e727";
1057   -}
1058   -
1059 1116 .icon-meirong2:before {
1060 1117 content: "\e861";
1061 1118 }
... ... @@ -1133,12 +1190,10 @@ background: #ffe3e2;
1133 1190 }
1134 1191  
1135 1192 .icon-arrow_right:before {
1136   - /* > */
1137 1193 content: "\e61f";
1138 1194 }
1139 1195  
1140 1196 .icon-arrow_down:before {
1141   -
1142 1197 content: "\e600";
1143 1198 }
1144 1199  
... ... @@ -1148,3 +1203,4 @@ background: #ffe3e2;
1148 1203  
1149 1204  
1150 1205  
  1206 +
... ...
components/diy_goodsGroup/diy_goodsGroup.js
... ... @@ -139,8 +139,8 @@ Component({
139 139 this.data.g_id = nav_item.data;
140 140 var arr = [];
141 141  
142   - for (var i = 0; i < this.data.g_id.length; i += this.data.goodscount) {
143   - arr.push(this.data.g_id.slice(i, i + this.data.goodscount));
  142 + for (var i = 0; i < this.data.g_id.length; i += parseInt(this.data.goodscount)) {
  143 + arr.push(this.data.g_id.slice(i, i + parseInt(this.data.goodscount)));
144 144 }
145 145 this.data.firist_type_data = arr;
146 146 this.init(this.data.classstyle_id, this.data.wgroup);
... ...
packageB/pages/user/binding_info/binding_info.js deleted
1   -// packageB/pages/user/binding_info/binding_info.js
2   -Page({
3   -
4   - /**
5   - * 页面的初始数据
6   - */
7   - data: {
8   -
9   - },
10   -
11   - /**
12   - * 生命周期函数--监听页面加载
13   - */
14   - onLoad: function (options) {
15   -
16   - },
17   -
18   - /**
19   - * 生命周期函数--监听页面初次渲染完成
20   - */
21   - onReady: function () {
22   -
23   - },
24   -
25   - /**
26   - * 生命周期函数--监听页面显示
27   - */
28   - onShow: function () {
29   - getApp().check_can_share();
30   - },
31   -
32   - /**
33   - * 生命周期函数--监听页面隐藏
34   - */
35   - onHide: function () {
36   -
37   - },
38   -
39   - /**
40   - * 生命周期函数--监听页面卸载
41   - */
42   - onUnload: function () {
43   -
44   - },
45   -
46   - /**
47   - * 页面相关事件处理函数--监听用户下拉动作
48   - */
49   - onPullDownRefresh: function () {
50   -
51   - },
52   -
53   - /**
54   - * 页面上拉触底事件的处理函数
55   - */
56   - onReachBottom: function () {
57   -
58   - },
59   -
60   - /**
61   - * 用户点击右上角分享
62   - */
63   - onShareAppMessage: function () { getApp().globalData.no_clear=1
64   -
65   - }
66   -})
67 0 \ No newline at end of file
packageB/pages/user/binding_info/binding_info.json deleted
1   -{
2   - "usingComponents": {}
3   -}
4 0 \ No newline at end of file
packageB/pages/user/binding_info/binding_info.wxml deleted
1   -<!--packageB/pages/user/binding_info/binding_info.wxml-->
2   -<text>packageB/pages/user/binding_info/binding_info.wxml</text>
packageB/pages/user/binding_info/binding_info.wxss deleted
1   -/* packageB/pages/user/binding_info/binding_info.wxss */
2 0 \ No newline at end of file
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 }
... ...
packageC/pages/presell/cart/juchi_part.wxml
1 1 <!-- 锯齿 -->
2 2 <view class="circle-frame abs">
3   - <view class='circle circle-sawtooth'></view>
4   - <view class='circle circle-sawtooth'></view>
5   - <view class='circle circle-sawtooth'></view>
6   - <view class='circle circle-sawtooth'></view>
7   - <view class='circle circle-sawtooth'></view>
8   - <view class='circle circle-sawtooth'></view>
9   - <view class='circle circle-sawtooth'></view>
10   - <view class='circle circle-sawtooth'></view>
11   - <view class='circle circle-sawtooth'></view>
12   - <view class='circle circle-sawtooth'></view>
13   - <view class='circle circle-sawtooth'></view>
14   - <view class='circle circle-sawtooth'></view>
15   - <view class='circle circle-sawtooth'></view>
16   - <view class='circle circle-sawtooth'></view>
17   - <view class='circle circle-sawtooth'></view>
18   - <view class='circle circle-sawtooth'></view>
19   - <view class='circle circle-sawtooth'></view>
20   - <view class='circle circle-sawtooth'></view>
21   - <view class='circle circle-sawtooth'></view>
22   - <view class='circle circle-sawtooth'></view>
  3 + <view wx:for="{{20}}" class='circle circle-sawtooth'></view>
23 4 </view>
24 5 \ No newline at end of file
... ...
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/juchi_part.wxml
1 1 <!-- 锯齿 -->
2 2 <view class="circle-frame abs">
3   - <view class='circle circle-sawtooth'></view>
4   - <view class='circle circle-sawtooth'></view>
5   - <view class='circle circle-sawtooth'></view>
6   - <view class='circle circle-sawtooth'></view>
7   - <view class='circle circle-sawtooth'></view>
8   - <view class='circle circle-sawtooth'></view>
9   - <view class='circle circle-sawtooth'></view>
10   - <view class='circle circle-sawtooth'></view>
11   - <view class='circle circle-sawtooth'></view>
12   - <view class='circle circle-sawtooth'></view>
13   - <view class='circle circle-sawtooth'></view>
14   - <view class='circle circle-sawtooth'></view>
15   - <view class='circle circle-sawtooth'></view>
16   - <view class='circle circle-sawtooth'></view>
17   - <view class='circle circle-sawtooth'></view>
18   - <view class='circle circle-sawtooth'></view>
19   - <view class='circle circle-sawtooth'></view>
20   - <view class='circle circle-sawtooth'></view>
21   - <view class='circle circle-sawtooth'></view>
22   - <view class='circle circle-sawtooth'></view>
  3 + <view wx:for="{{20}}" class='circle circle-sawtooth'></view>
23 4 </view>
24 5 \ No newline at end of file
... ...
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/giftpack/giftpacklist/giftpacklist.js
1 1 var e = getApp(),
2   - a = e.globalData.setting,
3   - os = a,
4   - t = e.request,
5   - d = e.globalData;
  2 + a = e.globalData.setting,
  3 + os = a,
  4 + t = e.request,
  5 + d = e.globalData;
6 6 var ut = require("../../../utils/util.js");
7 7 var com = require("../public/buy_com.js");
8 8  
9 9 Page({
10   - data: {
11   - url: a.url, //接口网址
12   - iurl: a.imghost, //图片前缀网址
13   - isBuy: 0,
14   - getGiftID: '', //礼包id
15   - giftImage: '',
16   - giftTitle: '',
17   - giftDate: '',
18   - giftPrice: '',
19   - giftIntegral: '',
20   - giftPosPrice: '',
21   - giftQty: '',
22   - giftRemark: '',
23   - giftType: '',
24   - actTitle: '',
25   - getUrl: '',
26   - wareCard: [],
27   - orderSn: "", //订单编号
28   - lbId: "",
29   - code: "", //核销码
30   - c_state: "0", //判断是否已经使用, 0正常 1已使用 2已过期
31   - is_lb: 0, //是否有礼包
32   - default_color: null,
33   - first_leader: e.globalData.first_leader || 0, // 推荐人ID
34   -
35   - //门店相关
36   - ismend: 0,
37   - is_sec_mend: 0,
38   - sto_sele_name: "", //选中的门店名称
39   - sto_sele_id: "", //选中的门店id
40   - sto_sele_distr: "", //选择的门店的配送方式
41   - is_show_sto_cat: 1, //是否显示门店分类
42   - only_pk: null,
43   - all_sto: null,
44   - sec_sto: null, //选择了的门店分类
45   - pickpu_list: null, //读出的所有门店list
46   - def_pickpu_list: null, //一开始5个门店list
47   - sec_pick_index: 0, //第二级门店选择ID
48   - fir_pick_index: 0, //第一级门店选择ID
49   - all_pick_list: null,//所有的门店先记录起来
50   -
51   - select_store: 0, //选择更多
52   - index: 1,
53   - more_store: 0, //选择门店
54   - sort_store: 0, //门店分类
55   - choice_sort_store: 0, //选择分类门店
56   - new_user: 0, //新用户
57   -
58   - def_pick_store: null, // 默认的门店
59   - fir_def_store: null, //客户默认的门店的
60   - lat: null, //维度
61   - lon: null, //经度
62   -
63   - is_get_local_ok: 0, //获取坐标是否完成
64   - region_name: "门店分类", //区域的名字
65   - is_gps: 1,
66   - open_ind_store: 0, //哪里打开的门店列表的控制属性
67   - default_store: {}, //创建添加默认门店地址的对象
68   -
69   - store:0,
70   - openSpecModal:0
71   - },
72   - onLoad: function (options) {
73   -
74   - var th=this;
75   -
76   - this.setData({
77   - params:options,
78   - })
79   -
80   - getApp().getConfig2(function (e) {
81   - var json_d = JSON.parse(e.switch_list);
82   - th.setData({
83   - bconfig: e,
84   - sys_switch:json_d
85   - });
86   - })
87   - },
88   - init(){
89   - let options = this.data?.params; // this.data == null ? undefined:this.data.params
90   - var th = this;
91   - this.setData({
92   - getUserID: d.user_id,
93   - getStorageID: a.stoid,
94   - })
95   - this.setData({
96   - isBuy: options.isBuy,
97   - getGiftID: options.lbId,
98   - orderSn: options.orderSn,
99   - flag: options.flag, // 如果从商品详情页的促销处点击专享礼包跳转到此页,则flag为1
100   - })
101   - if (options.lbId) th.data.lbId = options.lbId;
102   - //-- 获取分享人的ID --
103   - var first_leader = options.first_leader || getApp().globalData.first_leader;
104   - if (first_leader) {
105   - this.setData({
106   - first_leader,
107   - })
108   - //-- user_id代过来免登录 --
109   - getApp().globalData.first_leader = first_leader;
110   - //调用接口判断是不是会员
111   - getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => {
112   - if (res.data.code == 0) {
113   - getApp().globalData.guide_id = res.data.data.id;
114   - }
115   - })
116   - }
117   - th.close();
118   -
119   -
120   - if(this.data.flag == 1) {
121   - this.getZxlbDetails();
122   - } else {
123   - if (this.data.isBuy == 0) {
124   - this.GetMyGiftList();
125   - } else if (this.data.isBuy == 1) {
126   - this.GetBuyGiftList();
127   - };
128   - };
129   - },
130   -
131   - onShow: function () {
132   - getApp().check_can_share();
133   - getApp().is_Single_page(this,function () {
134   - //--先判断会员状态--
135   - var user_info = getApp().globalData.userInfo;
136   - if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
137   - getApp().goto('/pages/togoin/togoin');
138   - return false;
139   - }
140   - this.init();
141   - })
142   - },
143   - GetBuyPrice: function (e) {
144   - var that = this.data;
145   - var th = this;
146   - //如果还没有开始的话
147   - if (th.data.isStart != 1) {
148   - getApp().my_warnning("活动还没有开始", 0, th);
149   - return false;
150   - }
151   -
152   - this.data.payMoney=th.data.sele_g.payMoney;
153   - th.setData({ buyType:2 })
154   - if(th.data.sele_g.is_pickup){
155   - th.setData({
156   - openSpecModal:1
  10 + data: {
  11 + url: a.url, //接口网址
  12 + iurl: a.imghost, //图片前缀网址
  13 + isBuy: 0,
  14 + getGiftID: '', //礼包id
  15 + giftImage: '',
  16 + giftTitle: '',
  17 + giftDate: '',
  18 + giftPrice: '',
  19 + giftIntegral: '',
  20 + giftPosPrice: '',
  21 + giftQty: '',
  22 + giftRemark: '',
  23 + giftType: '',
  24 + actTitle: '',
  25 + getUrl: '',
  26 + wareCard: [],
  27 + orderSn: "", //订单编号
  28 + lbId: "",
  29 + code: "", //核销码
  30 + c_state: "0", //判断是否已经使用, 0正常 1已使用 2已过期
  31 + is_lb: 0, //是否有礼包
  32 + default_color: null,
  33 + first_leader: e.globalData.first_leader || 0, // 推荐人ID
  34 +
  35 + //门店相关
  36 + ismend: 0,
  37 + is_sec_mend: 0,
  38 + sto_sele_name: "", //选中的门店名称
  39 + sto_sele_id: "", //选中的门店id
  40 + sto_sele_distr: "", //选择的门店的配送方式
  41 + is_show_sto_cat: 1, //是否显示门店分类
  42 + only_pk: null,
  43 + all_sto: null,
  44 + sec_sto: null, //选择了的门店分类
  45 + pickpu_list: null, //读出的所有门店list
  46 + def_pickpu_list: null, //一开始5个门店list
  47 + sec_pick_index: 0, //第二级门店选择ID
  48 + fir_pick_index: 0, //第一级门店选择ID
  49 + all_pick_list: null,//所有的门店先记录起来
  50 +
  51 + select_store: 0, //选择更多
  52 + index: 1,
  53 + more_store: 0, //选择门店
  54 + sort_store: 0, //门店分类
  55 + choice_sort_store: 0, //选择分类门店
  56 + new_user: 0, //新用户
  57 +
  58 + def_pick_store: null, // 默认的门店
  59 + fir_def_store: null, //客户默认的门店的
  60 + lat: null, //维度
  61 + lon: null, //经度
  62 +
  63 + is_get_local_ok: 0, //获取坐标是否完成
  64 + region_name: "门店分类", //区域的名字
  65 + is_gps: 1,
  66 + open_ind_store: 0, //哪里打开的门店列表的控制属性
  67 + default_store: {}, //创建添加默认门店地址的对象
  68 +
  69 + store: 0,
  70 + openSpecModal: 0,
  71 +
  72 + sto_sele_name_1: '',
  73 + share_goods_img:'', //礼包的分享图
  74 + canvasHidden:true,
  75 +
  76 + screenWidth: 0
  77 + },
  78 + onLoad: function (options) {
  79 +
  80 + var th = this;
  81 +
  82 + this.setData({
  83 + params: options,
157 84 })
158   - }else{
159   - var my_confirm = th.selectComponent("#my_confirm"); //组件的id
160   - my_confirm.open(
161   - "是否确定购买该礼包",
162   - "取消",
163   - "确定",
164   - function () {
165   - my_confirm.open_cancel(0);
166   - },
167   - function () {
168   - my_confirm.open_cancel(0);
169   - com.buy_libao(th)
170   - }
171 85  
172   - )
173   - }
  86 + getApp().getConfig(function (e) {
  87 + th.setData({sto_sele_name_1: e.store_name})
  88 + })
174 89  
  90 + getApp().getConfig2(function (e) {
  91 + var json_d = JSON.parse(e.switch_list);
  92 + th.setData({
  93 + bconfig: e,
  94 + sys_switch: json_d
  95 + });
  96 + })
175 97  
  98 + //获取用户设备信息,屏幕宽度
  99 + wx.getSystemInfo({
  100 + success: res => {
  101 + th.setData({
  102 + screenWidth: res.screenWidth
  103 + })
  104 + }
  105 + });
176 106  
  107 + },
  108 + init() {
  109 + let options = this.data?.params; // this.data == null ? undefined:this.data.params
  110 + var th = this;
  111 + this.setData({
  112 + getUserID: d.user_id,
  113 + getStorageID: a.stoid,
  114 + })
177 115  
178   - },
179   - GetBuyIntegral: function (e) {
180   - var that = this.data;
181   - var th = this;
  116 + if(!options.lbId && options.scene){
  117 + var gid_str = decodeURIComponent(options.scene);
  118 + gid_str = gid_str.split("_");
182 119  
183   - //如果还没有开始的话
184   - if (th.data.isStart != 1) {
185   - getApp().my_warnning("活动还没有开始", 0, th);
186   - return false;
187   - }
  120 + options.lbId=gid_str[0];
  121 + options.first_leader=gid_str[1];
  122 + options.isBuy=1;
  123 + }
188 124  
189   - th.setData({ buyType:1 });
190   - if(th.data.sele_g.is_pickup){
191   - th.setData({
192   - openSpecModal:1
  125 +
  126 + this.setData({
  127 + isBuy: options.isBuy,
  128 + getGiftID: options.lbId,
  129 + orderSn: options.orderSn,
  130 + flag: options.flag, // 如果从商品详情页的促销处点击专享礼包跳转到此页,则flag为1
193 131 })
194   - }else {
195   - var my_confirm = th.selectComponent("#my_confirm"); //组件的id
196   - my_confirm.open(
197   - "是否确定兑换该礼包",
198   - "取消",
199   - "确定",
200   - function () {
201   - my_confirm.open_cancel(0);
202   - },
203   - function () {
204   - my_confirm.open_cancel(0);
205   - com.buy_libao(th)
206   - })
207   - }
208   -
209   -
210   -
211   -
212   - },
213   -
214   - GetMyGiftList: function () {
215   - var _this = this;
216   - var th = this;
217   - getApp().request.get('/api/weshop/marketing/my/giftbag/detail/get', {
218   - isShowLoading: true,
219   - data: {
220   - "storeId": a.stoid, //商家ID
221   - "userId": d.user_id, //用户ID
222   - "orderSn": th.data.orderSn
223   - },
224   - success: function (res) {
225   - if (res.data.code == 0) {
226   - th.setData({
227   - giftImage: th.data.iurl + res.data.data.lbUrl,
228   - giftTitle: res.data.data.giftTitle,
229   - default_color: res.data.data.bgcolor
230   - })
231   -
232   - if(res.data.data.iswarelbtype==1) {
233   - th.setData({iswarelbtype:1})
234   - }
235   -
236   - if (!res.data.data.giftRemark || res.data.data.giftRemark == '') {
237   - th.setData({
238   - giftRemark: '暂无详情......'
  132 + if (options.lbId) th.data.lbId = options.lbId;
  133 + //-- 获取分享人的ID --
  134 + var first_leader = options.first_leader || getApp().globalData.first_leader;
  135 + if (first_leader) {
  136 + this.setData({
  137 + first_leader,
239 138 })
240   - } else {
241   - th.setData({
242   - giftRemark: res.data.data.giftRemark.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block"')
  139 + //-- user_id代过来免登录 --
  140 + getApp().globalData.first_leader = first_leader;
  141 + //调用接口判断是不是会员
  142 + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => {
  143 + if (res.data.code == 0) {
  144 + getApp().globalData.guide_id = res.data.data.id;
  145 + }
243 146 })
244   - }
245   -
246   - //---获取日期的时间戳---
247   - var t_endtime = res.data.data.endTime;
248   - t_endtime = t_endtime.replace(/-/g, '/');
249   - var t_date = new Date(t_endtime) / 1000;
250   - var t_now = ut.gettimestamp();
251   -
252   - var t_starttime = res.data.data.starTime;
253   - t_starttime = t_starttime.replace(/-/g, '/');
254   - var t_sdate = new Date(t_starttime) / 1000;
255   -
256   - if (res.data.data.goodsUseState) th.setData({
257   - c_state: 1
258   - })
259   - else if (t_date <= t_now)
  147 + }
  148 + th.close();
  149 +
  150 +
  151 + if (this.data.flag == 1) {
  152 + this.getZxlbDetails();
  153 + } else {
  154 + if (this.data.isBuy == 0) {
  155 + this.GetMyGiftList();
  156 + } else if (this.data.isBuy == 1) {
  157 + this.GetBuyGiftList();
  158 + }
  159 +
  160 + }
  161 +
  162 + },
  163 +
  164 + onShow: function () {
  165 + getApp().check_can_share();
  166 + getApp().is_Single_page(this, function () {
  167 + //--先判断会员状态--
  168 + var user_info = getApp().globalData.userInfo;
  169 + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
  170 + getApp().goto('/pages/togoin/togoin');
  171 + return false;
  172 + }
  173 + this.init();
  174 + })
  175 + },
  176 + GetBuyPrice: function (e) {
  177 + var that = this.data;
  178 + var th = this;
  179 + //如果还没有开始的话
  180 + if (th.data.isStart != 1) {
  181 + getApp().my_warnning("活动还没有开始", 0, th);
  182 + return false;
  183 + }
  184 +
  185 + this.data.payMoney = th.data.sele_g.payMoney;
  186 + th.setData({buyType: 2})
  187 + if (th.data.sele_g.is_pickup) {
260 188 th.setData({
261   - c_state: 2
  189 + openSpecModal: 1
262 190 })
263   - else if (t_sdate > t_now)
  191 + } else {
  192 + var my_confirm = th.selectComponent("#my_confirm"); //组件的id
  193 + my_confirm.open(
  194 + "是否确定购买该礼包",
  195 + "取消",
  196 + "确定",
  197 + function () {
  198 + my_confirm.open_cancel(0);
  199 + },
  200 + function () {
  201 + my_confirm.open_cancel(0);
  202 + com.buy_libao(th)
  203 + }
  204 + )
  205 + }
  206 +
  207 +
  208 + },
  209 + GetBuyIntegral: function (e) {
  210 + var that = this.data;
  211 + var th = this;
  212 +
  213 + //如果还没有开始的话
  214 + if (th.data.isStart != 1) {
  215 + getApp().my_warnning("活动还没有开始", 0, th);
  216 + return false;
  217 + }
  218 +
  219 + th.setData({buyType: 1});
  220 + if (th.data.sele_g.is_pickup) {
264 221 th.setData({
265   - c_state: -1
  222 + openSpecModal: 1
266 223 })
267   - th.setData({
268   - giftDate: res.data.data.endTime,
269   - giftPosPrice: res.data.data.giftPosPrice,
270   - giftQty: res.data.data.giftQty,
271   - giftIntegral: res.data.data.payIntegral,
272   - giftPrice: res.data.data.payMoney,
273   - giftType: res.data.data.actType,
274   - actTitle: res.data.data.actTitle,
275   - wareCard: res.data.data.wareCard,
276   - lbId: res.data.data.lbId
277   - })
278   - //判断是否有礼包
279   - for (var i = 0; i < res.data.data.wareCard.length; i++) {
280   - if (res.data.data.wareCard[i].lbType == 1) {
281   - th.setData({
282   - is_lb: 1
283   - })
284   - break;
  224 + } else {
  225 + var my_confirm = th.selectComponent("#my_confirm"); //组件的id
  226 + my_confirm.open(
  227 + "是否确定兑换该礼包",
  228 + "取消",
  229 + "确定",
  230 + function () {
  231 + my_confirm.open_cancel(0);
  232 + },
  233 + function () {
  234 + my_confirm.open_cancel(0);
  235 + com.buy_libao(th)
  236 + })
  237 + }
  238 +
  239 +
  240 + },
  241 +
  242 + GetMyGiftList: function () {
  243 + var _this = this;
  244 + var th = this;
  245 + getApp().request.get('/api/weshop/marketing/my/giftbag/detail/get', {
  246 + isShowLoading: true,
  247 + data: {
  248 + "storeId": a.stoid, //商家ID
  249 + "userId": d.user_id, //用户ID
  250 + "orderSn": th.data.orderSn
  251 + },
  252 + success: function (res) {
  253 + if (res.data.code == 0) {
  254 + th.setData({
  255 + giftImage: th.data.iurl + res.data.data.lbUrl,
  256 + giftTitle: res.data.data.giftTitle,
  257 + default_color: res.data.data.bgcolor
  258 + })
  259 +
  260 + if (res.data.data.iswarelbtype == 1) {
  261 + th.setData({iswarelbtype: 1})
  262 + }
  263 +
  264 + if (!res.data.data.giftRemark || res.data.data.giftRemark == '') {
  265 + th.setData({
  266 + giftRemark: '暂无详情......'
  267 + })
  268 + } else {
  269 + th.setData({
  270 + giftRemark: res.data.data.giftRemark.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block"')
  271 + })
  272 + }
  273 +
  274 + //---获取日期的时间戳---
  275 + var t_endtime = res.data.data.endTime;
  276 + t_endtime = t_endtime.replace(/-/g, '/');
  277 + var t_date = new Date(t_endtime) / 1000;
  278 + var t_now = ut.gettimestamp();
  279 +
  280 + var t_starttime = res.data.data.starTime;
  281 + t_starttime = t_starttime.replace(/-/g, '/');
  282 + var t_sdate = new Date(t_starttime) / 1000;
  283 +
  284 + if (res.data.data.goodsUseState) th.setData({
  285 + c_state: 1
  286 + })
  287 + else if (t_date <= t_now)
  288 + th.setData({
  289 + c_state: 2
  290 + })
  291 + else if (t_sdate > t_now)
  292 + th.setData({
  293 + c_state: -1
  294 + })
  295 + th.setData({
  296 + giftDate: res.data.data.endTime,
  297 + giftPosPrice: res.data.data.giftPosPrice,
  298 + giftQty: res.data.data.giftQty,
  299 + giftIntegral: res.data.data.payIntegral,
  300 + giftPrice: res.data.data.payMoney,
  301 + giftType: res.data.data.actType,
  302 + actTitle: res.data.data.actTitle,
  303 + wareCard: res.data.data.wareCard,
  304 + lbId: res.data.data.lbId
  305 + })
  306 + //判断是否有礼包
  307 + for (var i = 0; i < res.data.data.wareCard.length; i++) {
  308 + if (res.data.data.wareCard[i].lbType == 1) {
  309 + th.setData({
  310 + is_lb: 1
  311 + })
  312 + break;
  313 + }
  314 + }
  315 +
  316 + if (res.data.data.pickup_id) {
  317 + getApp().request.get("/api/weshop/pickup/get/" + os.stoid + "/" + res.data.data.pickup_id, {
  318 + success: function (res) {
  319 + if (res.data.code == 0) {
  320 + th.setData({pick_up: res.data.data});
  321 + }
  322 + }
  323 + });
  324 +
  325 + }
  326 +
  327 +
  328 + } else {
  329 + getApp().my_warnning(res.data.msg, 0, th);
  330 + return false;
  331 + }
285 332 }
286   - }
  333 + });
287 334  
288   - if(res.data.data.pickup_id){
289   - getApp().request.get("/api/weshop/pickup/get/"+os.stoid+"/"+res.data.data.pickup_id,{
290   - success: function (res) {
291   - if(res.data.code==0){
292   - th.setData({pick_up:res.data.data});
293   - }
294   - }
295   - });
  335 + },
  336 + GetBuyGiftList: function () {
  337 + var _this2 = this;
  338 + var th = this.data;
  339 + getApp().request.get('/api/weshop/marketing/giftbag/detail/get', {
  340 + isShowLoading: true,
  341 + data: {
  342 + "storeId": a.stoid, //商家ID
  343 + "userId": d.user_id, //用户ID
  344 + "giftBagId": th.getGiftID
  345 + },
  346 + success: function success(res) {
  347 + if (res.data.code == 0) {
  348 + _this2.setData({
  349 + giftImage: th.iurl + res.data.data.lbUrl,
  350 + giftTitle: res.data.data.giftTitle,
  351 + default_color: res.data.data.bgcolor
  352 + })
  353 + if (res.data.data.giftRemark == '') {
  354 + _this2.setData({
  355 + giftRemark: '暂无详情......'
  356 + })
  357 + } else {
  358 + _this2.setData({
  359 + giftRemark: res.data.data.giftRemark.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block"')
  360 + })
  361 + }
296 362  
297   - }
  363 + var isStart = 0;
  364 + var now = ut.gettimestamp();
  365 +
  366 + var str = res.data.data.starTime.replace(/-/g, '/');
  367 + var start = Date.parse(new Date(str));
  368 + start = start / 1000;
  369 + if (start < now) isStart = 1;
  370 +
  371 + _this2.setData({
  372 + giftDate: res.data.data.endTime,
  373 + giftStart: res.data.data.starTime,
  374 + giftPosPrice: res.data.data.giftPosPrice,
  375 + giftQty: res.data.data.giftQty,
  376 + giftIntegral: res.data.data.payIntegral,
  377 + giftPrice: res.data.data.payMoney,
  378 + giftType: res.data.data.actType,
  379 + actTitle: res.data.data.actTitle,
  380 + wareCard: res.data.data.wareCard,
  381 + isStart: isStart,
  382 + sele_g: res.data.data
  383 + })
  384 +
  385 +
  386 + var sele_g = res.data.data;
  387 + //需不需要门店,不需要门店返回
  388 + if (!sele_g.is_pickup) return false;
  389 +
  390 + com.wait_for_store_config(_this2);
  391 + com.set_user_mo_store(_this2, os, function () {
  392 + if (sele_g.pickup_list && _this2.data.def_pick_store) {
  393 + com.check_def_pk(_this2);
  394 + }
  395 + });
  396 + com.get_sto(_this2, os);
298 397  
299 398  
300   - } else {
301   - getApp().my_warnning(res.data.msg, 0, th);
302   - return false;
  399 + } else {
  400 + getApp().my_warnning(res.data.msg, 0, _this2);
  401 + return false;
  402 + }
  403 + }
  404 + });
  405 +
  406 + },
  407 +
  408 + getZxlbDetails: function () {
  409 +
  410 + var th = this;
  411 + getApp().request.get('/api/weshop/marketing/giftbag/detail/getNew', {
  412 + isShowLoading: true,
  413 + data: {
  414 + "storeId": a.stoid, //商家ID
  415 + //"userId": d.user_id, //用户ID
  416 + "giftBagId": th.data.lbId
  417 + },
  418 + success: function (res) {
  419 + if (res.data.code == 0) {
  420 + th.setData({
  421 + giftImage: th.data.iurl + res.data.data.lbUrl,
  422 + giftTitle: res.data.data.lbTitle,
  423 + default_color: res.data.data.bgcolor
  424 + })
  425 + if (res.data.data.lbIntro == '') {
  426 + th.setData({
  427 + giftRemark: '暂无详情......'
  428 + })
  429 + } else {
  430 + th.setData({
  431 + giftRemark: res.data.data.lbIntro.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block"')
  432 + })
  433 + }
  434 +
  435 + //---获取日期的时间戳---
  436 + let exchangeType = res.data.data.exchangeType;
  437 + let exchangeDay = res.data.data.exchangeDay;
  438 + let exchangeStartTime = res.data.data.exchangeStartTime;
  439 + let exchangeEndTime = res.data.data.exchangeEndTime;
  440 + // let t_endtime;
  441 +
  442 + if (exchangeType == 2) {
  443 + if (exchangeStartTime == 0 || !exchangeStartTime) {
  444 + exchangeStartTime = ut.gettimestamp();
  445 + }
  446 + exchangeStartTime = ut.formatTime(exchangeStartTime, 0);
  447 + exchangeEndTime = ut.formatTime(exchangeEndTime, 0);
  448 + }
  449 +
  450 +
  451 + th.setData({
  452 + // giftDate: t_endtime,
  453 + giftPosPrice: res.data.data.oldPrice,
  454 + giftQty: res.data.data.lbNum,
  455 + giftIntegral: res.data.data.exchangeIntegral,
  456 + giftPrice: res.data.data.lbPrice,
  457 + giftType: res.data.data.actType,
  458 + actTitle: res.data.data.actTitle,
  459 + wareCard: res.data.data.wareCard,
  460 + lbId: res.data.data.lbId,
  461 + exchangeType: exchangeType,
  462 + exchangeDay: exchangeDay,
  463 + exchangeStartTime: exchangeStartTime,
  464 + exchangeEndTime: exchangeEndTime,
  465 + })
  466 + //判断是否有礼包
  467 + for (var i = 0; i < res.data.data.wareCard.length; i++) {
  468 + if (res.data.data.wareCard[i].lbType == 1) {
  469 + th.setData({
  470 + is_lb: 1
  471 + })
  472 + break;
  473 + }
  474 + }
  475 + } else {
  476 + getApp().my_warnning(res.data.msg, 0, th);
  477 + return false;
  478 + }
  479 + }
  480 + });
  481 +
  482 + },
  483 +
  484 +
  485 + //显示核销码
  486 + code_show: function (e) {
  487 + var th = this;
  488 + //--获取成功的时候--
  489 + var no = th.data.code;
  490 + var qc_com = th.selectComponent("#qc_com"); //组件的id
  491 + var obj = {
  492 + val: no,
  493 + content: "请将二维码展示给核销员,收货更快捷"
  494 + };
  495 + qc_com.open(obj)
  496 + },
  497 + //获取核销码
  498 + getcode: function (e) {
  499 + var th = this;
  500 + var orderSn = th.data.orderSn; //订单号
  501 + let codeId = e.currentTarget.dataset.codeid;
  502 + var json = {
  503 + "storeId": a.stoid,
  504 + "orderSn": orderSn,
303 505 }
304   - }
305   - });
306   -
307   - },
308   - GetBuyGiftList: function () {
309   - var _this2 = this;
310   - var th = this.data;
311   - getApp().request.get('/api/weshop/marketing/giftbag/detail/get', {
312   - isShowLoading: true,
313   - data: {
314   - "storeId": a.stoid, //商家ID
315   - "userId": d.user_id, //用户ID
316   - "giftBagId": th.getGiftID
317   - },
318   - success: function success(res) {
319   - if (res.data.code == 0) {
320   - _this2.setData({
321   - giftImage: th.iurl + res.data.data.lbUrl,
322   - giftTitle: res.data.data.giftTitle,
323   - default_color: res.data.data.bgcolor
324   - })
325   - if (res.data.data.giftRemark == '') {
326   - _this2.setData({
327   - giftRemark: '暂无详情......'
328   - })
329   - } else {
330   - _this2.setData({
331   - giftRemark: res.data.data.giftRemark.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block"')
332   - })
333   - }
334   -
335   - var isStart = 0;
336   - var now = ut.gettimestamp();
337   -
338   - var str = res.data.data.starTime.replace(/-/g, '/');
339   - var start = Date.parse(new Date(str));
340   - start = start / 1000;
341   - if (start < now) isStart = 1;
342   -
343   - _this2.setData({
344   - giftDate: res.data.data.endTime,
345   - giftStart: res.data.data.starTime,
346   - giftPosPrice: res.data.data.giftPosPrice,
347   - giftQty: res.data.data.giftQty,
348   - giftIntegral: res.data.data.payIntegral,
349   - giftPrice: res.data.data.payMoney,
350   - giftType: res.data.data.actType,
351   - actTitle: res.data.data.actTitle,
352   - wareCard: res.data.data.wareCard,
353   - isStart: isStart,
354   - sele_g:res.data.data
355   - })
356   -
357   -
358   - var sele_g=res.data.data;
359   - //需不需要门店,不需要门店返回
360   - if(!sele_g.is_pickup) return false;
361   -
362   - com.wait_for_store_config(_this2);
363   - com.set_user_mo_store(_this2,os,function () {
364   - if(sele_g.pickup_list && _this2.data.def_pick_store){
365   - com.check_def_pk(_this2);
  506 + if (codeId && codeId !== "") {
  507 + json.id = codeId
  508 + }
  509 + var data = JSON.stringify(json);
  510 + var url = th.data.url + "/api/weshop/marketing/gift/goods/verify/code/get"; //预约接口地址
  511 + getApp().request.json_post(url, json,
  512 + function (res) {
  513 + if (res.data.code == 0) {
  514 + th.setData({
  515 + code: res.data.data
  516 + })
  517 + th.code_show();
  518 + } else {
  519 + getApp().my_warnning(res.data.msg, 0, th);
366 520 }
367   - });
368   - com.get_sto(_this2,os);
  521 + },
  522 + function (res) {
369 523  
  524 + },
  525 + "put"
  526 + )
370 527  
371   - } else {
372   - getApp().my_warnning(res.data.msg, 0, _this2);
373   - return false;
  528 + },
  529 + //界面跳转
  530 + goto: function (e) {
  531 + var th = this;
  532 + var url = e.currentTarget.dataset.url;
  533 + getApp().goto(url);
  534 + },
  535 + //图片失败,默认图片
  536 + bind_bnerr2: function (e) {
  537 + var _errImg = e.target.dataset.errorimg;
  538 + var _errObj = {};
  539 + _errObj[_errImg] = "/miniapp/images/giftbag/gift01.png";
  540 + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
  541 + },
  542 +
  543 + //图片失败,默认图片
  544 + bind_bnerr: function (e) {
  545 + var _errImg = e.target.dataset.errorimg;
  546 + var _errObj = {};
  547 + _errObj[_errImg] = this.data.iurl + "miniapp/images/big_back.jpg";
  548 + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
  549 + //this.setData({ giftImage: this.data.iurl + "/miniapp/images/giftbag/gift01.png"});
  550 +
  551 + },
  552 +
  553 + //关闭导航
  554 + close: function () {
  555 + var th = this;
  556 + var nav_b = th.selectComponent("#nav_b"); //组件的id
  557 + nav_b.close_box();
  558 + nav_b.set_name("礼包", "/pages/giftpack/buygiftpack/giftpackbuy");
  559 + },
  560 +
  561 + //--- 分享设置 --
  562 + onShareAppMessage: function (e) {
  563 + getApp().globalData.no_clear = 1;
  564 + var curPage = this;
  565 + var pagePath = curPage.route; //当前页面url
  566 + if (pagePath.indexOf('/') != 0) {
  567 + pagePath = '/' + pagePath;
374 568 }
375   - }
376   - });
377   -
378   - },
379   -
380   - getZxlbDetails: function () {
381   -
382   - var th = this;
383   - getApp().request.get('/api/weshop/marketing/giftbag/detail/getNew', {
384   - isShowLoading: true,
385   - data: {
386   - "storeId": a.stoid, //商家ID
387   - //"userId": d.user_id, //用户ID
388   - "giftBagId": th.data.lbId
389   - },
390   - success: function (res) {
391   - if (res.data.code == 0) {
392   - th.setData({
393   - giftImage: th.data.iurl + res.data.data.lbUrl,
394   - giftTitle: res.data.data.lbTitle,
395   - default_color: res.data.data.bgcolor
396   - })
397   - if (res.data.data.lbIntro == '') {
398   - th.setData({
399   - giftRemark: '暂无详情......'
400   - })
401   - } else {
402   - th.setData({
403   - giftRemark: res.data.data.lbIntro.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block"')
404   - })
405   - }
406   -
407   - //---获取日期的时间戳---
408   - let exchangeType = res.data.data.exchangeType;
409   - let exchangeDay = res.data.data.exchangeDay;
410   - let exchangeStartTime = res.data.data.exchangeStartTime;
411   - let exchangeEndTime = res.data.data.exchangeEndTime;
412   - // let t_endtime;
413   -
414   - if(exchangeType == 2) {
415   - if(exchangeStartTime == 0 || !exchangeStartTime) {
416   - exchangeStartTime = ut.gettimestamp();
417   - };
418   - exchangeStartTime = ut.formatTime(exchangeStartTime, 0);
419   - exchangeEndTime = ut.formatTime(exchangeEndTime, 0);
420   - }
421   -
422   -
423   - th.setData({
424   - // giftDate: t_endtime,
425   - giftPosPrice: res.data.data.oldPrice,
426   - giftQty: res.data.data.lbNum,
427   - giftIntegral: res.data.data.exchangeIntegral,
428   - giftPrice: res.data.data.lbPrice,
429   - giftType: res.data.data.actType,
430   - actTitle: res.data.data.actTitle,
431   - wareCard: res.data.data.wareCard,
432   - lbId: res.data.data.lbId,
433   - exchangeType: exchangeType,
434   - exchangeDay: exchangeDay,
435   - exchangeStartTime: exchangeStartTime,
436   - exchangeEndTime: exchangeEndTime,
437   - })
438   - //判断是否有礼包
439   - for (var i = 0; i < res.data.data.wareCard.length; i++) {
440   - if (res.data.data.wareCard[i].lbType == 1) {
441   - th.setData({
442   - is_lb: 1
443   - })
444   - break;
445   - }
446   - }
447   - } else {
448   - getApp().my_warnning(res.data.msg, 0, th);
449   - return false;
450   - }
451   - }
452   - });
453   -
454   - },
455   -
456   -
457   - //显示核销码
458   - code_show: function (e) {
459   - var th = this;
460   - //--获取成功的时候--
461   - var no = th.data.code;
462   - var qc_com = th.selectComponent("#qc_com"); //组件的id
463   - var obj = {
464   - val: no,
465   - content: "请将二维码展示给核销员,收货更快捷"
466   - };
467   - qc_com.open(obj)
468   - },
469   - //获取核销码
470   - getcode: function (e) {
471   - var th = this;
472   - var orderSn = th.data.orderSn; //订单号
473   - let codeId = e.currentTarget.dataset.codeid;
474   - var json = {
475   - "storeId": a.stoid,
476   - "orderSn": orderSn,
477   - }
478   - if (codeId && codeId !== "") {
479   - json.id = codeId
480   - }
481   - var data = JSON.stringify(json);
482   - var url = th.data.url + "/api/weshop/marketing/gift/goods/verify/code/get"; //预约接口地址
483   - getApp().request.json_post(url, json,
484   - function (res) {
485   - if (res.data.code == 0) {
486   - th.setData({
487   - code: res.data.data
488   - })
489   - th.code_show();
490   - } else {
491   - getApp().my_warnning(res.data.msg, 0, th);
  569 + pagePath += "?isBuy=1" + "&lbId=" + this.data.getGiftID + "&first_leader=" + this.data.getUserID;
  570 + // if (this.data.isBuy == 0) {
  571 + // pagePath += "&orderSn=" + this.data.orderSn;
  572 + // } else {
  573 + // pagePath += "&lbId=" + this.data.getGiftID;
  574 + // }
  575 + // console.log('pagePath', pagePath);
  576 + return {
  577 + title: "礼包详情",
  578 + path: pagePath,
492 579 }
493   - },
494   - function (res) {
495   -
496   - },
497   - "put"
498   - )
499   -
500   - },
501   - //界面跳转
502   - goto: function (e) {
503   - var th = this;
504   - var url = e.currentTarget.dataset.url;
505   - getApp().goto(url);
506   - },
507   - //图片失败,默认图片
508   - bind_bnerr2: function (e) {
509   - var _errImg = e.target.dataset.errorimg;
510   - var _errObj = {};
511   - _errObj[_errImg] = "/miniapp/images/giftbag/gift01.png";
512   - this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
513   - },
514   -
515   - //图片失败,默认图片
516   - bind_bnerr: function (e) {
517   - var _errImg = e.target.dataset.errorimg;
518   - var _errObj = {};
519   - _errObj[_errImg] = this.data.iurl + "miniapp/images/big_back.jpg";
520   - this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
521   - //this.setData({ giftImage: this.data.iurl + "/miniapp/images/giftbag/gift01.png"});
522   -
523   - },
524   -
525   - //关闭导航
526   - close: function () {
527   - var th = this;
528   - var nav_b = th.selectComponent("#nav_b"); //组件的id
529   - nav_b.close_box();
530   - nav_b.set_name("礼包", "/pages/giftpack/buygiftpack/giftpackbuy");
531   - },
532   -
533   - //--- 分享设置 --
534   - onShareAppMessage: function (e) {
535   - getApp().globalData.no_clear=1;
536   - var curPage = this;
537   - var pagePath = curPage.route; //当前页面url
538   - if (pagePath.indexOf('/') != 0) {
539   - pagePath = '/' + pagePath;
540   - }
541   - pagePath += "?isBuy=1" + "&lbId=" + this.data.getGiftID + "&first_leader=" + this.data.getUserID;
542   - // if (this.data.isBuy == 0) {
543   - // pagePath += "&orderSn=" + this.data.orderSn;
544   - // } else {
545   - // pagePath += "&lbId=" + this.data.getGiftID;
546   - // }
547   - // console.log('pagePath', pagePath);
548   - return {
549   - title: "礼包详情",
550   - path: pagePath,
551   - }
552   - },
  580 + },
553 581  
554 582 /**
555 583 * 用户分享朋友圈
556 584 */
557 585 onShareTimeline() {
558   - getApp().globalData.no_clear=1;
  586 + getApp().globalData.no_clear = 1;
559 587  
560   - var pagePath ="&isBuy=1" + "&lbId=" + this.data.lbId + "&first_leader=" + this.data.getUserID;
561   - var user_id=getApp().globalData.user_id;
562   - if(!user_id) user_id=0;
  588 + var pagePath = "&isBuy=1" + "&lbId=" + this.data.lbId + "&first_leader=" + this.data.getUserID;
  589 + var user_id = getApp().globalData.user_id;
  590 + if (!user_id) user_id = 0;
563 591  
564 592 return {
565 593 title: "礼包详情",
566   - query: 'first_leader='+user_id+pagePath
  594 + query: 'first_leader=' + user_id + pagePath
567 595 }
568 596 },
569 597  
570   - //免费领取
571   - GetFree: function (e) {
572   - var that = this.data;
573   - var th = this;
  598 + //免费领取
  599 + GetFree: function (e) {
  600 + var that = this.data;
  601 + var th = this;
574 602  
575   - //如果还没有开始的话
576   - if (th.data.isStart != 1) {
577   - getApp().my_warnning("活动还没有开始", 0, th);
578   - return false;
579   - }
  603 + //如果还没有开始的话
  604 + if (th.data.isStart != 1) {
  605 + getApp().my_warnning("活动还没有开始", 0, th);
  606 + return false;
  607 + }
580 608  
581   - th.setData({ buyType:3 });
582   - if(th.data.sele_g.is_pickup){
583   - th.setData({
584   - openSpecModal:1
585   - })
586   - }else {
  609 + th.setData({buyType: 3});
  610 + if (th.data.sele_g.is_pickup) {
  611 + th.setData({
  612 + openSpecModal: 1
  613 + })
  614 + } else {
587 615  
588 616  
589   - // var id = e.currentTarget.dataset.id;//活动id
590   - var my_confirm = th.selectComponent("#my_confirm"); //组件的id
591   - my_confirm.open(
592   - "是否确定领取该礼包",
593   - "取消",
594   - "确定",
595   - function () {
596   - my_confirm.open_cancel(0);
597   - },
598   - function () {
599   - my_confirm.open_cancel(0);
600   - com.buy_libao(th)
601   - })
602   - }
  617 + // var id = e.currentTarget.dataset.id;//活动id
  618 + var my_confirm = th.selectComponent("#my_confirm"); //组件的id
  619 + my_confirm.open(
  620 + "是否确定领取该礼包",
  621 + "取消",
  622 + "确定",
  623 + function () {
  624 + my_confirm.open_cancel(0);
  625 + },
  626 + function () {
  627 + my_confirm.open_cancel(0);
  628 + com.buy_libao(th)
  629 + })
  630 + }
603 631  
604 632  
605   - },
  633 + },
606 634  
607 635 //--- 设置一下默认库存的数量 ----
608 636 set_def_storage(ee) {
... ... @@ -623,7 +651,7 @@ Page({
623 651 var bconfig = th.data.bconfig;
624 652  
625 653 //如果开启了,则不在选择门店
626   - if(this.data.sys_switch.is_pricing_open_store && getApp().globalData.pk_store){
  654 + if (this.data.sys_switch.is_pricing_open_store && getApp().globalData.pk_store) {
627 655 return false;
628 656 }
629 657 if (!th.data.only_pk && !th.data.def_pickpu_list) {
... ... @@ -653,12 +681,12 @@ Page({
653 681 is_gps: 1
654 682 });
655 683 //th.onShow();
656   - com.get_sto(th,os);
  684 + com.get_sto(th, os);
657 685 },
658 686 fail: function (res) {
659 687 //th.onShow();
660 688 th.data.is_get_local_ok = 1;
661   - com.get_sto(th,os);
  689 + com.get_sto(th, os);
662 690 if (res.errCode == 2) {
663 691 th.setData({
664 692 is_gps: 0
... ... @@ -676,7 +704,7 @@ Page({
676 704 })
677 705 } else {
678 706 th.data.is_get_local_ok = 1;
679   - com.get_sto(th,os);
  707 + com.get_sto(th, os);
680 708 }
681 709  
682 710 if (ind != undefined && ind != null) {
... ... @@ -719,16 +747,14 @@ Page({
719 747 openSpecModal: !0,
720 748 openSpecModal_ind: openindstore,
721 749 });
722   - }
723   - else if (openindstore == 4) { //4就是拼团
  750 + } else if (openindstore == 4) { //4就是拼团
724 751 th.setData({
725 752 openSpecModal_pt: 1, //打开拼团购买界面
726 753 store: 0, //关闭门店
727 754 choice_sort_store: 0, //关闭门店2级
728 755 sort_store: 0, //关闭门店2级
729 756 });
730   - }
731   - else {
  757 + } else {
732 758 th.setData({
733 759 store: 0,
734 760 choice_sort_store: 0,
... ... @@ -844,7 +870,7 @@ Page({
844 870 openSpecModal: !0,
845 871 });
846 872  
847   - var user_id=getApp().globalData.user_id;
  873 + var user_id = getApp().globalData.user_id;
848 874 var def_pickup_id = item.pickup_id;
849 875 getApp().request.put('/api/weshop/users/update', {
850 876 data: {
... ... @@ -870,9 +896,265 @@ Page({
870 896 this.setData({openSpecModal: 0});
871 897 },
872 898  
873   - buy_libao:function () {
  899 + buy_libao: function () {
874 900 com.buy_libao(this)
875   - }
  901 + },
  902 +
  903 +
  904 + clickShare() {
  905 + if (!getApp().globalData.user_id) {
  906 + getApp().goto("/pages/togoin/togoin");
  907 + return false;
  908 + }
  909 + this.setData({
  910 + share_hidden: true,
  911 + });
  912 + },
  913 +
  914 + send() {
  915 + this.setData({
  916 + share_hidden: false,
  917 + });
  918 + },
  919 +
  920 + cancel() {
  921 + this.setData({
  922 + share_hidden: false,
  923 + });
  924 + },
  925 +
  926 +
  927 + //--定义的保存图片方法,分享团---
  928 + saveImageToPhotosAlbum: function () {
  929 + //--先判断会员状态--
  930 + var user_info = getApp().globalData.userInfo;
  931 + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
  932 + //getApp().my_warnning("请先登录",0,this);
  933 + wx.navigateTo({url: '/pages/togoin/togoin',})
  934 + return false;
  935 + }
  936 +
  937 + if (this.data.share_hidden) {
  938 + this.setData({share_hidden: false,});
  939 + }
  940 +
  941 + wx.showLoading({title: '生成中...',})
  942 + var that = this, th = that;
  943 + //设置画板显示,才能开始绘图
  944 + that.setData({
  945 + canvasHidden: false
  946 + })
  947 +
  948 + var app = getApp();
  949 + var unit = that.data.screenWidth / 750 * 1.35; //基础单位,
  950 + var scene = th.data.lbId + "";
  951 +
  952 + var user_id = getApp().globalData.user_id ? getApp().globalData.user_id : 0;
  953 + if (user_id > 0) {
  954 + scene += "_" + user_id;
  955 + }
  956 + ///二微码
  957 + var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" +
  958 + os.stoid + "?sceneValue=" + scene + "&pageValue=pages/giftpack/giftpacklist/giftpacklist";
  959 +
  960 + console.log("11111");
  961 + console.log(path3);
  962 +
  963 + // 读取文件成功则OK--
  964 + wx.getImageInfo({
  965 + src: path3,
  966 + success: function (res) {
  967 + th.get_goods_temp(function () {
  968 + var vpath = res.path;
  969 + var context = wx.createCanvasContext('share');
  970 + th.drawPoster(context, unit, th.data.share_goods_img, vpath, 0);
  971 +
  972 + //把画板内容绘制成图片,并回调 画板图片路径
  973 + context.draw(false, function () {
  974 + setTimeout(function () {
  975 + wx.canvasToTempFilePath({
  976 + x: 0,
  977 + y: 0,
  978 + width: 750,
  979 + height: 1217,
  980 + destWidth: 1.2 * 750 * 750 / that.data.screenWidth,
  981 + destHeight: 1.2 * 1217 * 750 / that.data.screenWidth,
  982 + canvasId: 'share',
  983 + success: function (res) {
  984 +
  985 +
  986 + console.log(res.tempFilePath)
  987 +
  988 + that.setData({
  989 + shareImgPath: res.tempFilePath,
  990 + canvasHidden: true
  991 + })
  992 +
  993 + if (!res.tempFilePath) {
  994 + wx.showModal({
  995 + title: '提示',
  996 + content: '图片绘制中,请稍后重试',
  997 + showCancel: false
  998 + })
  999 + return false;
  1000 + }
  1001 +
  1002 + that.setData({
  1003 + showPoster: true,
  1004 + });
  1005 + wx.hideLoading();
  1006 + }
  1007 + })
  1008 + }, 800)
  1009 +
  1010 + });
  1011 + })
  1012 + },
  1013 + fail: function (res) {
  1014 + console.log(res);
  1015 + wx.hideLoading();
  1016 +
  1017 + }
  1018 + });
  1019 + },
  1020 +
  1021 + //-- 小程序绘制海报 --
  1022 + drawPoster(context, unit, img, vpath, type) {
  1023 + // 1.灰色背景
  1024 + context.setFillStyle('#f2f1f6');
  1025 + context.rect(0, 0, 554 * unit, 899 * unit);
  1026 + context.fill();
  1027 +
  1028 + // 2.商城名称
  1029 + let shopName = this.data.sto_sele_name_1;
  1030 + context.setTextAlign('center');
  1031 + context.setFontSize(26 * unit);
  1032 + context.setFillStyle('black');
  1033 + context.fillText(shopName, 277 * unit, 60 * unit);
  1034 +
  1035 + // 3.推荐来源
  1036 + let fromText = `来自${getApp().globalData.userInfo.nickname}的推荐`;
  1037 + context.setTextAlign('center');
  1038 + context.setFontSize(22 * unit);
  1039 + context.setFillStyle('#96959a');
  1040 + context.fillText(fromText, 277 * unit, 105 * unit);
  1041 +
  1042 + // 4.海报背景
  1043 + context.setFillStyle('white');
  1044 + context.fillRect(37 * unit, 157 * unit, 480 * unit, 673 * unit);
  1045 +
  1046 + // 5.商品图片
  1047 + // 图片的x坐标
  1048 + let bg_x = 37 * unit
  1049 + // 图片的y坐标
  1050 + let bg_y = 157 * unit
  1051 + // 图片宽度
  1052 + let bg_w = 480 * unit
  1053 + // 图片高度
  1054 + let bg_h = 474 * unit
  1055 + // 图片圆角
  1056 + let bg_r = 4
  1057 + // 绘制海报背景图片圆角
  1058 + context.save()
  1059 + context.beginPath()
  1060 + context.arc(bg_x + bg_r, bg_y + bg_r, bg_r, Math.PI, Math.PI * 1.5)
  1061 + context.arc(bg_x + bg_w - bg_r, bg_y + bg_r, bg_r, Math.PI * 1.5, Math.PI * 2)
  1062 + context.arc(bg_x + bg_w, bg_y + bg_h, bg_r, 0, Math.PI * 0.5)
  1063 + context.arc(bg_x, bg_y + bg_h, 0, Math.PI * 0.5, Math.PI)
  1064 + context.clip()
  1065 + context.drawImage(img, bg_x, bg_y, bg_w, bg_h);
  1066 + context.restore();
  1067 +
  1068 + // 6.强烈推荐
  1069 + let src = '';
  1070 + context.beginPath();
  1071 + if (type == 0) { // 普通
  1072 + src = '../../../images/share/q_tj.png';
  1073 + context.drawImage(src, 54 * unit, 648 * unit, 85 * unit, 30 * unit);
  1074 + context.setFontSize(16 * unit)
  1075 + context.setFillStyle("white")
  1076 + context.setTextAlign('left');
  1077 + context.fillText('强烈推荐', 64 * unit, 668 * unit);
  1078 + }
  1079 +
  1080 +
  1081 + let price = this.data.giftPrice;
  1082 + let giftIntegral = this.data.giftIntegral;
  1083 + context.setFontSize(32 * unit);
  1084 + context.setFillStyle('#DE1117');
  1085 +
  1086 + var price_txt="";
  1087 + if(price || giftIntegral){
  1088 + if(price){
  1089 + price_txt='¥' + price;
  1090 + if(giftIntegral) price_txt+='+';
  1091 + }
  1092 + if(giftIntegral) price_txt+=giftIntegral+'积分';
  1093 + }else{
  1094 + price_txt="¥0";
  1095 + }
  1096 +
  1097 + context.fillText(price_txt, 54 * unit, 735 * unit);
  1098 +
  1099 +
  1100 + // 8.商品标题
  1101 + context.setFontSize(20 * unit);
  1102 + context.setFillStyle('#898989');
  1103 + getApp().draw_Text(context, this.data.giftTitle, 54 * unit, 800 * unit, 240 * unit, 280 * unit, unit, 1);
  1104 +
  1105 + // 9.小程序码
  1106 + context.drawImage(vpath, 375 * unit, 660 * unit, 120 * unit, 120 * unit);
  1107 + context.setFontSize(16 * unit);
  1108 + context.setFillStyle('#777');
  1109 + context.fillText('长按识别二维码', 378 * unit, 810 * unit);
  1110 +
  1111 + // 10.竖线
  1112 + context.beginPath();
  1113 + context.setFillStyle('#eee');
  1114 + context.rect(354 * unit, 670 * unit, 1 * unit, 130 * unit);
  1115 + context.fill();
  1116 + },
  1117 +
  1118 + //--获取商品图片的本地缓存,回调写法--
  1119 + get_goods_temp: function (tt) {
  1120 + var ee = this;
  1121 + if (ee.data.share_goods_img) {
  1122 + tt();
  1123 + return false;
  1124 + }
  1125 + var img_url = ee.data.giftImage;
  1126 + //获取商品是分享图信息
  1127 + wx.getImageInfo({
  1128 + src: img_url,
  1129 + success: function (res) {
  1130 + //res.path是网络图片的本地地址
  1131 + ee.data.share_goods_img = res.path;
  1132 + tt();
  1133 + },
  1134 + fail: function (res) {
  1135 + ee.data.share_goods_img = "../../../images/share/default_g_img.gif"; //分享的图片不能用网络的
  1136 + tt();
  1137 + }
  1138 + });
  1139 + },
  1140 +
  1141 + closePoster() {
  1142 + this.setData({
  1143 + showPoster: false,
  1144 + });
  1145 + },
  1146 + // 保存图片到手机
  1147 + savePic() {
  1148 + getApp().savePic(this);
  1149 + },
  1150 + // 预览海报
  1151 + previewPoster() {
  1152 + getApp().globalData.no_clear=1;
  1153 + wx.previewImage({
  1154 + current: this.data.shareImgPath, // 当前显示图片的http链接
  1155 + urls: [this.data.shareImgPath] ,// 需要预览的图片http链接列表
  1156 + });
  1157 + },
876 1158  
877 1159  
878 1160  
... ...
pages/giftpack/giftpacklist/giftpacklist.json
... ... @@ -4,6 +4,7 @@
4 4 "warn": "/components/long_warn/long_warn",
5 5 "my_confirm": "/components/my_confirm/my_confirm",
6 6 "qr_code": "/components/qr_code/qr_code",
7   - "nav_b": "/components/nav_b/nav_b"
  7 + "nav_b": "/components/nav_b/nav_b",
  8 + "share": "/components/share/share"
8 9 }
9 10 }
10 11 \ No newline at end of file
... ...
pages/giftpack/giftpacklist/giftpacklist.wxml
... ... @@ -9,7 +9,15 @@
9 9 </view>
10 10  
11 11 <view class="top_title data-v-3a5b7e36">
12   - <text class="data-v-3a5b7e36 ellipsis-2">{{giftTitle}}</text>
  12 + <text class="data-v-3a5b7e36 ellipsis-2" style="width:90%;">{{giftTitle}}</text>
  13 +
  14 + <!-- 这个是分享按钮 -->
  15 + <view wx:if="{{c_state<2}}" class="xc-share-frame t-c" bindtap="clickShare">
  16 + <view class="iconfont icon-share fs40" ></view>
  17 + <view class="fs22 c-7b">分享</view>
  18 + </view>
  19 +
  20 +
13 21 </view>
14 22 <view class="top_time data-v-3a5b7e36" wx:if="{{!flag}}">
15 23 <block wx:if="{{isBuy==1 && giftTitle && isStart!=1}}" >
... ... @@ -17,6 +25,7 @@
17 25 {{"活动开始时间:"+giftStart}}
18 26 </text>
19 27 </block>
  28 +
20 29 <block wx:else>
21 30 <text class="data-v-3a5b7e36" wx:if="{{isBuy==0 && iswarelbtype}}">{{"兑换结束时间:"+giftDate}}</text>
22 31 <text class="data-v-3a5b7e36" wx:if="{{flag == 1}}">
... ... @@ -34,6 +43,8 @@
34 43 </view>
35 44  
36 45 <view class="top_price data-v-3a5b7e36">
  46 +
  47 +
37 48 <block wx:if="{{giftPrice>0}}">
38 49 <text class="data-v-3a5b7e36">{{"¥"+giftPrice}}</text>
39 50 </block>
... ... @@ -46,6 +57,10 @@
46 57 <block wx:if="{{giftType>0}}">
47 58 <text class="data-v-3a5b7e36">{{actTitle}}</text>
48 59 </block>
  60 +
  61 +
  62 +
  63 +
49 64 </view>
50 65 <view class="top_foot data-v-3a5b7e36">
51 66 <view class="top_foot_price data-v-3a5b7e36">
... ... @@ -209,4 +224,26 @@
209 224 <!-- 制作一个圆球导航 -->
210 225 <nav_b id="nav_b"></nav_b>
211 226  
212   -<include src="../public/buy_com.wxml"></include>
213 227 \ No newline at end of file
  228 +<include src="../public/buy_com.wxml"></include>
  229 +<canvas canvas-id='share' style='width:750rpx;height:1217rpx;background-color:white;' wx:if="{{!canvasHidden}}"></canvas>
  230 +<share id="share_button" bind:send="send" bind:cancel="cancel" bind:share_img="saveImageToPhotosAlbum" wx:if="{{share_hidden}}"></share>
  231 +
  232 +
  233 +<view wx:if="{{showPoster}}">
  234 + <view class="mask" catchtap="closePoster"></view>
  235 + <view class="poster-container">
  236 + <view class="poster-wrapper">
  237 + <view class="poster" bindtap="previewPoster">
  238 + <!-- <view class="poster" bindtap="previewImage"> -->
  239 + <image src="{{shareImgPath}}" class="poster-img"></image>
  240 + <view class="btn-close" catchtap="closePoster">
  241 + <text class="iconfont icon-close"></text>
  242 + </view>
  243 + </view>
  244 + <view class="btn-container">
  245 + <!-- <button class="btn-share" open-type="share" bindtap="">微信好友分享</button> -->
  246 + <button class="btn-share" bindtap="savePic">保存到相册</button>
  247 + </view>
  248 + </view>
  249 + </view>
  250 +</view>
214 251 \ No newline at end of file
... ...
pages/giftpack/giftpacklist/giftpacklist.wxss
... ... @@ -26,6 +26,7 @@
26 26 .top_title.data-v-3a5b7e36 {
27 27 font-size: 30rpx;
28 28 margin-bottom: 10rpx;
  29 + position: relative;
29 30 }
30 31  
31 32 .top_time.data-v-3a5b7e36 {
... ... @@ -38,6 +39,7 @@
38 39 color: #d61b30;
39 40 margin-top: 30rpx;
40 41 margin-bottom: 5rpx;
  42 + position: relative;
41 43 }
42 44  
43 45 .top_foot.data-v-3a5b7e36 {
... ... @@ -244,3 +246,7 @@ page.data-v-3a5b7e36 {
244 246  
245 247 .foot_button_intalge.data-v-3a5b7e36.gray{ background-color: #aaa; }
246 248  
  249 +.xc-share-frame {
  250 + position: absolute; right:0; top: -10rpx;
  251 +}
  252 +
... ...
pages/goods/goodsInfo/buy_pt.wxml
... ... @@ -98,16 +98,6 @@
98 98  
99 99  
100 100 <view>
101   - <!--<view bindtap="getmendian" class="quhuo logistics-item" hidden="{{ismend==1}}">-->
102   - <!--<view wx:if="{{sto_sele_name==''}}">取货门店-->
103   - <!--<text class='small'>(选择门店)</text>-->
104   - <!--</view>-->
105   - <!--<view wx:else>{{sto_sele_name}}</view>-->
106   - <!--<view class="item-img">-->
107   - <!--<image class="wh100" src="{{iurl}}/miniapp/images/icon-arrowdown.png"></image>-->
108   - <!--</view>-->
109   - <!--</view>-->
110   -
111 101  
112 102 <view class="b_num" hidden="{{ismend==1}}" style="margin-top: 20rpx">
113 103 <view>购买数量</view>
... ...
pages/goods/goodsInfo/goodsInfo.js
... ... @@ -596,7 +596,7 @@ Page({
596 596 icon: 'none',
597 597 });
598 598 }
599   - ;
  599 +
600 600 if (plist && plist.CanOutQty - lock > 0) {
601 601 ee.CanOutQty = plist.CanOutQty - lock;
602 602 } else {
... ... @@ -1031,7 +1031,6 @@ Page({
1031 1031  
1032 1032 setTimeout(()=>{
1033 1033 wx.createSelectorQuery().selectAll(".showArea, .hideArea").boundingClientRect(res => {
1034   - // console.log('node@@@@@@@', res);
1035 1034 if(res.length != 0) {
1036 1035 this.setData({
1037 1036 showFold: res[0].height < res[1].height,
... ... @@ -4651,10 +4650,6 @@ Page({
4651 4650 if (this.data.is_go_to_team_show) return false;
4652 4651 this.data.is_go_to_team_show = 1;
4653 4652 wx.showLoading();
4654   - /*--
4655   - wx.redirectTo({
4656   - url: "/pages/team/team_success/team_success?ordersn=" + odr.order_sn,
4657   - });--*/
4658 4653  
4659 4654 getApp().goto("/pages/team/team_success/team_success?ordersn=" + odr.order_sn);
4660 4655  
... ... @@ -4806,12 +4801,7 @@ Page({
4806 4801 }
4807 4802 quan_list[ind].start = start;
4808 4803 quan_list[ind].end = end;
4809   - // var start = ut.formatTime(ep.use_start_time, "yyyy-MM-dd");
4810   - // var end = ut.formatTime(ep.use_end_time, "yyyy-MM-dd");
4811   - // start = start.replace("00:00:00", "");
4812   - // end = end.replace("00:00:00", "");
4813   - // quan_list[ind].start = start;
4814   - // quan_list[ind].end = end;
  4804 +
4815 4805 }
4816 4806 }
4817 4807  
... ... @@ -5013,24 +5003,10 @@ Page({
5013 5003  
5014 5004 };
5015 5005  
5016   - //---市场价划掉---
5017   - /*---
5018   - context.setFillStyle("gray")
5019   - context.setFontSize(22 * unit)
5020   - var pri0 = "¥" + this.data.data.market_price.toFixed(2);
5021   - var wd2 = this.data.screenWidth - ut.measureText(pri0, 22 * unit) - 25;
5022   - context.fillText(pri0, 54 * unit, 770 * unit);
5023   -
5024   - context.setStrokeStyle('gray');
5025   - context.setLineWidth(1 * unit);
5026   - context.moveTo(54 * unit, 763 * unit);
5027   - context.lineTo(ut.measureText(pri0, 22 * unit) + 50, 763 * unit);
5028   - context.stroke();--*/
5029   -
5030 5006 // 8.商品标题
5031 5007 context.setFontSize(20 * unit);
5032 5008 context.setFillStyle('#898989');
5033   - this.draw_Text(context, this.data.data.goods_name, 54 * unit, 800 * unit, 240 * unit, 280 * unit, unit, 1);
  5009 + getApp().draw_Text(context, this.data.data.goods_name, 54 * unit, 800 * unit, 240 * unit, 280 * unit, unit, 1);
5034 5010  
5035 5011 // 9.小程序码
5036 5012 context.drawImage(vpath, 375 * unit, 660 * unit, 120 * unit, 120 * unit);
... ... @@ -5185,7 +5161,7 @@ Page({
5185 5161 if (type != 4 && type != 0 && type != 1 && type != 2 && type != 3) {
5186 5162 context.setFillStyle("black");
5187 5163 context.setFontSize(21.3 * unit)
5188   - th.draw_Text(context, share_title,
  5164 + getApp().draw_Text(context, share_title,
5189 5165 38 * unit, 180 * unit, 200 * unit, 279 * unit, unit);
5190 5166  
5191 5167 //------产品的价格-------
... ... @@ -5222,7 +5198,7 @@ Page({
5222 5198 } else if (type == 4 && type != 0 && type != 1 && type != 2 && type != 3) {
5223 5199 context.setFillStyle("black");
5224 5200 context.setFontSize(21.3 * unit)
5225   - th.draw_Text(context, share_title,
  5201 + getApp().draw_Text(context, share_title,
5226 5202 38 * unit, 170 * unit, 20 * unit, 300 * unit, unit);
5227 5203 //------ 产品的价格 -----
5228 5204 var pri0 = th.data.prom_act.addmoney;
... ... @@ -5443,13 +5419,7 @@ Page({
5443 5419 context.fillText("满" + item.rynum + "人", 40 * unit + wi, 786 * unit);
5444 5420 }
5445 5421 //----------------下面部分----------------
5446   - // context.setFillStyle("gray")
5447   - // context.fillText("快来和我一起拼团吧!", 40 * unit, 830 * unit);
5448   - // context.setFillStyle("black")
5449   - // context.font = 'normal bold 18px sans-serif';
5450   - // context.setFontSize(22 * unit)
5451   - // context.fillText("长按识别二维码,立即参团", 40 * unit, 860 * unit);
5452   - //context.setFillStyle("gray")
  5422 +
5453 5423 context.setFillStyle("black")
5454 5424 context.fillText("快来和我一起拼团吧!", 40 * unit, 820 * unit);
5455 5425 //context.font = 'normal bold 18px sans-serif';
... ... @@ -5577,10 +5547,6 @@ Page({
5577 5547 return false;
5578 5548 }
5579 5549  
5580   - // wx.previewImage({
5581   - // //将图片预览出来
5582   - // urls: [that.data.shareImgPath]
5583   - // });
5584 5550 that.setData({
5585 5551 showPoster: true,
5586 5552 });
... ... @@ -5601,37 +5567,6 @@ Page({
5601 5567 },
5602 5568  
5603 5569  
5604   - //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度
5605   - draw_Text: function (ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, unit, lineNum) {
5606   - var lineWidth = 0;
5607   - var lastSubStrIndex = 0; //每次开始截取的字符串的索引
5608   - var han = 0;
5609   - for (let i = 0; i < str.length; i++) {
5610   - if(lineNum) {
5611   - if(han == lineNum) return;
5612   - };
5613   - if (han == 2) return;
5614   - //lineWidth += ctx.measureText(str[i]).width;
5615   - lineWidth += ut.measureText(str[i], 21.3 * unit);
5616   - if (lineWidth > canvasWidth) {
5617   - han++;
5618   -
5619   - if (han == 2 || han == lineNum)
5620   - ctx.fillText(str.substring(lastSubStrIndex, i) + '...', leftWidth, initHeight); //绘制截取部分
5621   - else
5622   - ctx.fillText(str.substring(lastSubStrIndex, i), leftWidth, initHeight);
5623   -
5624   - initHeight += 22; //22为字体的高度
5625   - lineWidth = 0;
5626   - lastSubStrIndex = i;
5627   - titleHeight += 20;
5628   - }
5629   - if (i == str.length - 1) { //绘制剩余部分
5630   - ctx.fillText(str.substring(lastSubStrIndex, i + 1), leftWidth, initHeight);
5631   - }
5632   - };
5633   - },
5634   -
5635 5570 // ----视频图片----
5636 5571 // 图片计数器
5637 5572 swiperChange: function (e) {
... ... @@ -6024,7 +5959,6 @@ Page({
6024 5959 title: item.pickup_name + '库存不足!',
6025 5960 icon: 'none',
6026 5961 });
6027   - // getApp().my_warnning(item.pickup_name + "库存不足!", 0, th);
6028 5962  
6029 5963 }
6030 5964 },
... ... @@ -6101,33 +6035,6 @@ Page({
6101 6035 break
6102 6036 }
6103 6037  
6104   - /*--
6105   - if (openindstore == 1) {
6106   - th.setData({
6107   - openSpecModal: !0,
6108   - openSpecModal_ind: openindstore,
6109   - });
6110   - } else if (openindstore == 2) {
6111   - th.setData({
6112   - openSpecModal: !0,
6113   - openSpecModal_ind: openindstore,
6114   - });
6115   - }
6116   - else if (openindstore == 4) { //4就是拼团
6117   - th.setData({
6118   - openSpecModal_pt: 1, //打开拼团购买界面
6119   - store: 0, //关闭门店
6120   - choice_sort_store: 0, //关闭门店2级
6121   - sort_store: 0, //关闭门店2级
6122   - });
6123   - }
6124   - else {
6125   - th.setData({
6126   - store: 0,
6127   - choice_sort_store: 0,
6128   - sort_store: 0
6129   - })
6130   - }--*/
6131 6038 //如果商品没有其他活动,要取一下线下价格
6132 6039 th.get_off_price();
6133 6040 })
... ... @@ -6487,103 +6394,10 @@ Page({
6487 6394  
6488 6395 // 保存图片到手机
6489 6396 savePic() {
6490   - console.log('保存图片');
6491   - var self = this;
6492   - // 获取用户的当前设置,返回值中有小程序已经向用户请求过的权限
6493   - this.getSetting().then((res) => {
6494   - // 判断用户是否授权了保存到相册的权限,如果没有发起授权
6495   - if (!res.authSetting['scope.writePhotosAlbum']) {
6496   - this.authorize().then(() => {
6497   - // 同意授权后保存下载文件
6498   - this.saveImage(self.data.shareImgPath)
6499   - .then(() => {
6500   - self.setData({
6501   - showPoster: false
6502   - });
6503   - });
6504   - })
6505   - } else {
6506   - // 如果已经授权,保存下载文件
6507   - this.saveImage(self.data.shareImgPath)
6508   - .then(() => {
6509   - self.setData({
6510   - showPoster: false
6511   - });
6512   - });
6513   - }
6514   -
6515   - })
6516   - },
6517   -
6518   - // 获取用户已经授予了哪些权限
6519   - getSetting() {
6520   - return new Promise((resolve, reject) => {
6521   - wx.getSetting({
6522   - success: res => {
6523   - resolve(res)
6524   - }
6525   - })
6526   - })
6527   - },
6528   -
6529   - // 发起首次授权请求
6530   - authorize() {
6531   - // isFirst 用来记录是否为首次发起授权,
6532   - // 如果首次授权拒绝后,isFirst赋值为1
6533   - let isFirst = wx.getStorageSync('isFirst') || 0;
6534   - return new Promise((resolve, reject) => {
6535   - wx.authorize({
6536   - scope: 'scope.writePhotosAlbum',
6537   - // 同意授权
6538   - success: () => {
6539   - resolve();
6540   - },
6541   - // 拒绝授权,这里是用户拒绝授权后的回调
6542   - fail: res => {
6543   - if (isFirst === 0) {
6544   - wx.setStorageSync('isFirst', 1);
6545   - wx.showToast({
6546   - title: '保存失败',
6547   - icon: 'none',
6548   - duration: 1000
6549   - })
6550   - } else {
6551   - this.showModal();
6552   - }
6553   - console.log('拒绝授权');
6554   - reject();
6555   - }
6556   - })
6557   - })
  6397 + getApp().savePic(this);
6558 6398 },
6559 6399  
6560 6400  
6561   - // 保存图片到系统相册
6562   - saveImage(saveUrl) {
6563   - var self = this;
6564   - return new Promise((resolve, reject) => {
6565   - wx.saveImageToPhotosAlbum({
6566   - filePath: saveUrl,
6567   - success: (res) => {
6568   - wx.showToast({
6569   - title: '保存成功',
6570   - duration: 1000,
6571   - });
6572   - self.setData({
6573   - showPlaybill: 'true'
6574   - });
6575   - resolve();
6576   - },
6577   - fail: () => {
6578   - wx.showToast({
6579   - title: '保存失败',
6580   - duration: 1000,
6581   - });
6582   - }
6583   - })
6584   - })
6585   - },
6586   -
6587 6401 previewImage(e) {
6588 6402 this.data.show_prew_img = 1;
6589 6403 getApp().pre_img(this.data.sele_g.original_img);
... ...
pages/payment/pay_success/pay_success.json
1 1 {
2   - "navigationBarTitleText": "支付成功",
3   - "usingComponents": {}
  2 + "navigationBarTitleText": "支付成功"
4 3 }
5 4 \ No newline at end of file
... ...
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  
... ...
pages/template/index.js
... ... @@ -92,21 +92,10 @@ Page({
92 92  
93 93 },
94 94  
95   -
96 95 onPullDownRefresh: function(e) {
97 96  
98 97 },
99   - onUnload: function() {
100   -
101   - },
102   - setCountTime: function(e) {
103   -
104   - },
105   -
106 98  
107   - onPageScroll: function(e) {
108   -
109   - },
110 99  
111 100 onShareAppMessage:async function(e) {
112 101 getApp().globalData.no_clear=1;
... ...
pages/user/address_list/address_list.js
... ... @@ -110,21 +110,12 @@ Page({
110 110 data: { user_id: oo.user_id, is_pickup: 0 },
111 111 isShowLoading:0,
112 112 success: function (s) {
113   - // var add_arr = th.data.addresses;
114   - // for (var i in add_arr){
115   - // add_arr[i].is_pickup=0;
116   - // }
117   - // th.setData({addresses:add_arr});
118 113  
119 114 a.is_pickup = 1;
120 115 t.put("/api/weshop/useraddress/updateById", {
121 116 data: a,
122 117 isShowLoading: 0,
123 118 success: function (s) {
124   - // var obj={};
125   - // var txt = "addresses[" + index +"].is_pickup";
126   - // obj[txt]=1;
127   - // th.setData(obj);
128 119  
129 120 th.data.isloading=0
130 121 if (th.data.is_back) {
... ...
pages/user/assistance/assistance_success.js
... ... @@ -68,13 +68,6 @@ Page({
68 68 },
69 69  
70 70  
71   - /**
72   - * 页面上拉触底事件的处理函数
73   - */
74   - onReachBottom: function () {
75   -
76   - },
77   -
78 71 cklie_button:function(){
79 72 getApp().goto("/pages/user/assistance/assistance")
80 73 }
... ...
pages/user/assistance/friend_assistance.js
... ... @@ -161,12 +161,6 @@ Page({
161 161 nav_b.set_name("助力", "/pages/user/assistance/assistance");
162 162 },
163 163  
164   - /**
165   - * 页面上拉触底事件的处理函数
166   - */
167   - onReachBottom: function() {
168   -
169   - },
170 164  
171 165 /**
172 166 * 用户点击右上角分享
... ...
pages/user/assistance/task_assistance.js
... ... @@ -135,14 +135,6 @@ Page({
135 135 },
136 136  
137 137  
138   -
139   - /**
140   - * 生命周期函数--监听页面初次渲染完成
141   - */
142   - onReady: function () {
143   -
144   - },
145   -
146 138 /**
147 139 * 生命周期函数--监听页面显示
148 140 */
... ... @@ -243,10 +235,6 @@ Page({
243 235 }
244 236 })
245 237  
246   - // 分享的
247   - // setTimeout(function() {
248   - // th.shareFrends();
249   - // }, 1000)
250 238  
251 239 //会员任务列表
252 240 this.user_task_list();
... ... @@ -601,19 +589,6 @@ Page({
601 589 clearInterval(this.data.timer);
602 590 },
603 591  
604   - /**
605   - * 生命周期函数--监听页面卸载
606   - */
607   - onUnload: function () {
608   -
609   - },
610   -
611   - /**
612   - * 页面相关事件处理函数--监听用户下拉动作
613   - */
614   - onPullDownRefresh: function () {
615   -
616   - },
617 592 //----助力任务的时间-----
618 593 countDown() {
619 594 if (!this.data.is_timer) return false;
... ... @@ -661,12 +636,7 @@ Page({
661 636 return param < 10 ? '0' + param : param;
662 637 },
663 638  
664   - /**
665   - * 页面上拉触底事件的处理函数
666   - */
667   - onReachBottom: function () {
668 639  
669   - },
670 640  
671 641 /**
672 642 * 用户点击右上角分享
... ... @@ -1091,22 +1061,7 @@ Page({
1091 1061 getApp().goto("/pages/test/zhuli_test?taskId="+task_id);
1092 1062 },
1093 1063  
1094   -
1095   - // imgH:function(e){
1096   -
1097   - // var winWid = wx.getSystemInfoSync().windowWidth; //获取当前屏幕的宽度
1098   - // var imgh = e.detail.height;                //图片高度
1099   - // var imgw = e.detail.width;
1100   - // var swiperH = winWid*0.827*imgh/imgw + "px"          //等比设置swiper的高度。 即 屏幕宽度 / swiper高度 = 图片宽度 / 图片高度 ==》swiper高度 = 屏幕宽度 * 图片高度 / 图片宽度
1101   - // console.log('imgload',winWid, imgh, imgw, swiperH);
1102   - // this.setData({
1103   - // Hei:swiperH        //设置高度
1104   - // })
1105   -
1106   - // imgs
1107   - // },
1108   -
1109   -
  1064 +
1110 1065 imageLoad: function(e) {
1111 1066 var winWid = wx.getSystemInfoSync().windowWidth;
1112 1067 var imgwidth = e.detail.width;
... ...
pages/user/cardinfo/cardinfo.js
... ... @@ -691,26 +691,7 @@ Page({
691 691  
692 692 },
693 693  
694   - /**
695   - * 生命周期函数--监听页面隐藏
696   - */
697   - onHide: function () {
698   -
699   - },
700   -
701   - /**
702   - * 生命周期函数--监听页面卸载
703   - */
704   - onUnload: function () {
705 694  
706   - },
707   -
708   - /**
709   - * 页面相关事件处理函数--监听用户下拉动作
710   - */
711   - onPullDownRefresh: function () {
712   -
713   - },
714 695  
715 696 /**
716 697 * 页面上拉触底事件的处理函数
... ...