Commit 063700c64501275e2226af437f4370df1a6cdea3

Authored by yvan.ni
1 parent f19bf8ee

1、分享白屏的优化

2、无权限的优惠优化
packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.js
... ... @@ -203,7 +203,6 @@ Page({
203 203 onLoad: function (t) {
204 204 self = this;
205 205 this.setData({options: t,});
206   -
207 206 var ee = this, that = ee, th = ee,
208 207 gid = t.goods_id,
209 208 first_leader = t.first_leader;
... ... @@ -241,17 +240,28 @@ Page({
241 240 if (gid == undefined || gid == null || gid == "") {
242 241 var gid_str = decodeURIComponent(t.scene);
243 242 gid_str = gid_str.split("_");
244   - gid = gid_str[0];
  243 + gid = parseInt(gid_str[0]);
  244 + that.data.options.goods_id=gid;
  245 +
  246 +
245 247 if (gid_str.length > 1) {
246 248 first_leader = gid_str[1];
247 249 }
248 250 //-- 如果有room_id的获取 --
249 251 if (gid_str.length > 2 && gid_str[2]) {
250   - room_id = gid_str[2];
  252 + room_id = parseInt(gid_str[2]);
251 253 room_user_share = 1;
  254 +
  255 + that.data.options.room_id=room_id;
  256 + that.data.options.prom_type= parseInt(gid_str[3]);
  257 + that.data.options.prom_id=parseInt(gid_str[4]);
252 258 }
  259 +
  260 + this.setData({options: that.data.options});
  261 +
253 262 }
254 263  
  264 +
255 265 //-- 如果有房间号 --
256 266 if (room_id) {
257 267 getApp().globalData.room_id = room_id;
... ... @@ -261,10 +271,7 @@ Page({
261 271 getApp().globalData.room_user_share = room_user_share;
262 272 }
263 273  
264   -
265   -
266 274 ee.setData({gid: gid});
267   -
268 275 if (first_leader) {
269 276 getApp().globalData.first_leader = first_leader;
270 277 //调用接口判断是不是会员
... ... @@ -1145,10 +1152,7 @@ Page({
1145 1152 }
1146 1153 var title = th.data.data.goods_name;
1147 1154 var img = th.data.data.original_img;
1148   - if (th.data.prom_type == 6) {
1149   - title = th.data.prom_act.share_title;
1150   - img = th.data.iurl + th.data.prom_act.share_imgurl;
1151   - }
  1155 +
1152 1156  
1153 1157  
1154 1158 var url = "/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo?goods_id=" + th.data.gid;
... ... @@ -1163,6 +1167,12 @@ Page({
1163 1167 url += "&room_id=" + getApp().globalData.room_id + "&room_user_share=1";
1164 1168 }
1165 1169  
  1170 + //如果是拼团的时候
  1171 + if (th.data.prom_type == 6) {
  1172 + title = th.data.prom_act.share_title;
  1173 + img = th.data.iurl + th.data.prom_act.share_imgurl;
  1174 + url += "&prom_id="+th.data.prom_id+"&prom_type=6";
  1175 + }
1166 1176  
1167 1177 var ob = {
1168 1178 title: price + "元 " + title,
... ... @@ -1537,13 +1547,22 @@ Page({
1537 1547 var user_id = getApp().globalData.user_id ? getApp().globalData.user_id : 0;
1538 1548 if (user_id > 0) {
1539 1549 scene += "_" + user_id;
  1550 + }else{
  1551 + scene += "_0";
1540 1552 }
  1553 +
1541 1554 //-- 如果不是会员分享过来的要分享给别人 --
1542 1555 if (getApp().globalData.room_id && th.data.data.goods_id == getApp().globalData.room_goods_id && !getApp().globalData.room_user_share) {
1543 1556 //固定房间是第3个字符
1544   - if (!user_id) scene += "_0";
1545 1557 scene += "_" + getApp().globalData.room_id;
  1558 + }else{
  1559 + scene += "_0";
1546 1560 }
  1561 +
  1562 + scene += "_6";
  1563 + scene += "_"+this.data.prom_act.id ;
  1564 +
  1565 +
1547 1566 ///二微码
1548 1567 var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" +
1549 1568 os.stoid + "?sceneValue=" + scene + "&pageValue=packageA/pages/serviceCard_pd/goodsInfo/goodsInfo";
... ... @@ -2742,14 +2761,13 @@ Page({
2742 2761 } else {
2743 2762 throw (res);
2744 2763 }
2745   - ;
2746 2764 }).catch(err => {
  2765 +
2747 2766 });
2748 2767  
2749 2768 }
2750   - ;
2751 2769 }
2752   - ;
  2770 +
2753 2771 });
2754 2772 },
2755 2773  
... ... @@ -2819,15 +2837,26 @@ Page({
2819 2837 th.countDown(endTime)
2820 2838 }, 1000);
2821 2839 },
2822   - get_normal(gid) {
2823   - this.setData({
2824   - prom_type: 0,
2825   - isshow: 1,
2826   - });
2827   - this.get_sku(os.stoid, this.data.data, gid);
2828   - this.get_sto();
2829   - //this.check_is_youhui(gid, 1);
2830   - this.data.is_normal = 1;
  2840 +
  2841 + get_normal(gid,txt) {
  2842 + // this.setData({
  2843 + // prom_type: 0,
  2844 + // isshow: 1,
  2845 + // });
  2846 + // this.get_sku(os.stoid, this.data.data, gid);
  2847 + // this.get_sto();
  2848 + // //this.check_is_youhui(gid, 1);
  2849 + // this.data.is_normal = 1;
  2850 + if(txt) {
  2851 + wx.showToast({
  2852 + title: txt,
  2853 + icon: 'none'
  2854 + });
  2855 + }
  2856 + setTimeout(() => {
  2857 + getApp().goto('/pages/index/index/index');
  2858 + },2000)
  2859 +
2831 2860 },
2832 2861 //获取redis中的数量
2833 2862 async getactLen() {
... ... @@ -2866,24 +2895,24 @@ Page({
2866 2895 os.stoid + "/" + prom_id, {
2867 2896 success: async function (t) {
2868 2897 if (t.data.code != 0) {
2869   - ee.get_normal(gid);
  2898 + ee.get_normal(gid,'未找到活动');
2870 2899 return false;
2871 2900 }
2872 2901 //----已经结束-----
2873 2902 if (t.data.data.is_end == 1) {
2874   - ee.get_normal(gid);
  2903 + ee.get_normal(gid,'活动已经结束');
2875 2904 return false;
2876 2905 }
2877 2906 //----已经过期-----
2878 2907 var now = ut.gettimestamp();
2879 2908 if (t.data.data.end_time < now) {
2880   - ee.get_normal(gid);
  2909 + ee.get_normal(gid,'活动已经结束');
2881 2910 return false;
2882 2911 }
2883 2912  
2884 2913 /*-- 还没有开始预热的也不显示 --*/
2885 2914 if (t.data.data.show_time > now) {
2886   - ee.get_normal(gid);
  2915 + ee.get_normal(gid,'活动还未开始');
2887 2916 return false;
2888 2917 }
2889 2918  
... ... @@ -2895,13 +2924,12 @@ Page({
2895 2924 });
2896 2925 wx.showToast({
2897 2926 title: '此商品暂时没有拼单活动',
2898   - icon: 'none',
2899   - success(){
2900   - setTimeout(() => {
2901   - wx.navigateBack()
2902   - }, 2000)
2903   - }
  2927 + icon: 'none'
2904 2928 });
  2929 +
  2930 + setTimeout(() => {
  2931 + getApp().goto('/pages/index/index/index');
  2932 + },2000)
2905 2933 return false
2906 2934 }
2907 2935  
... ... @@ -2923,7 +2951,16 @@ Page({
2923 2951 }
2924 2952 })
2925 2953 if (!flag) {
2926   - ee.get_normal(gid);
  2954 + //ee.get_normal(gid);
  2955 +
  2956 + wx.showToast({
  2957 + title: '会员无权限参与此活动',
  2958 + icon: 'none'
  2959 + });
  2960 + setTimeout(() => {
  2961 + getApp().goto('/pages/index/index/index');
  2962 + },2000)
  2963 +
2927 2964 return false;
2928 2965  
2929 2966 }
... ...