Commit 752a5e1c6b66831a835123a47906d48e140b5cd7
1 parent
2da3540f
预售分享的优化
Showing
3 changed files
with
99 additions
and
18 deletions
packageC/pages/presell/goodsInfo/goodsInfo.js
| ... | ... | @@ -1555,10 +1555,8 @@ Page({ |
| 1555 | 1555 | if (!title) title = th.data.prom_act.title; |
| 1556 | 1556 | if (th.data.prom_type == 4) title = th.data.prom_act.name; |
| 1557 | 1557 | |
| 1558 | - if (th.data.presellForm.share_img) | |
| 1559 | - img = th.data.iurl + th.data.presellForm.share_img; | |
| 1560 | - | |
| 1561 | - | |
| 1558 | + //if (th.data.presellForm.share_img) | |
| 1559 | + // img = th.data.iurl + th.data.presellForm.share_img; | |
| 1562 | 1560 | |
| 1563 | 1561 | var url = "/packageC/pages/presell/goodsInfo/goodsInfo?goods_id=" + th.data.gid+"&pre_id="+th.data.pre_arr.id; |
| 1564 | 1562 | if (getApp().globalData.user_id) { |
| ... | ... | @@ -3133,13 +3131,9 @@ Page({ |
| 3133 | 3131 | tt(); |
| 3134 | 3132 | return false; |
| 3135 | 3133 | } |
| 3136 | - // var img_url = ee.data.data.original_img; | |
| 3137 | - var img_url = ee.data.presellForm.share_img; | |
| 3138 | - img_url?img_url:ee.data.data.original_img; | |
| 3139 | - | |
| 3140 | - if (img_url) { | |
| 3141 | - img_url = this.data.iurl + img_url; | |
| 3142 | - } | |
| 3134 | + var img_url = ee.data.data.original_img; | |
| 3135 | + //var img_url = ee.data.presellForm.share_img; | |
| 3136 | + //img_url?img_url:ee.data.data.original_img; | |
| 3143 | 3137 | |
| 3144 | 3138 | //获取商品是分享图信息 |
| 3145 | 3139 | wx.getImageInfo({ | ... | ... |
packageC/pages/presell/list/list.js
| ... | ... | @@ -58,6 +58,16 @@ Page({ |
| 58 | 58 | }else{ |
| 59 | 59 | getApp().goto("/pages/togoin/togoin"); |
| 60 | 60 | } |
| 61 | + | |
| 62 | + var room_id = t.room_id; | |
| 63 | + var room_user_share = t.room_user_share; //如果是会员分享带有room_id的话,那么接下来会员分享就不传room_id | |
| 64 | + //-- 如果有房间号 -- | |
| 65 | + if (room_id) { | |
| 66 | + getApp().globalData.room_id = room_id; | |
| 67 | + //如果是会员分享过来的要记录 | |
| 68 | + if (room_user_share) getApp().globalData.room_user_share = room_user_share; | |
| 69 | + } | |
| 70 | + | |
| 61 | 71 | }, |
| 62 | 72 | onShow: function (t) { |
| 63 | 73 | var userInfo=getApp().globalData.userInfo; |
| ... | ... | @@ -235,4 +245,41 @@ Page({ |
| 235 | 245 | } |
| 236 | 246 | }, |
| 237 | 247 | |
| 238 | -}); | |
| 248 | + onShareAppMessage: async function (t) { | |
| 249 | + getApp().globalData.no_clear=1; | |
| 250 | + var img=""; | |
| 251 | + if(this.data.ad_data && this.data.ad_data.length ){ | |
| 252 | + img= this.data.ad_data[0]; | |
| 253 | + }else{ | |
| 254 | + var url="/api/weshop/store/get/"+os.stoid; | |
| 255 | + await getApp().promiseGet(url,{}).then(res=>{ | |
| 256 | + if(res.data.code==0){ | |
| 257 | + img= os.imghost+res.data.data.store_logo | |
| 258 | + } | |
| 259 | + }) | |
| 260 | + } | |
| 261 | + | |
| 262 | + var url = "/packageC/pages/presell/list/list"; | |
| 263 | + if (getApp().globalData.user_id) { | |
| 264 | + url += "&first_leader=" + getApp().globalData.user_id; | |
| 265 | + } | |
| 266 | + //-- 如果房间分享,且不是会员分享的 -- | |
| 267 | + if (getApp().globalData.room_id && | |
| 268 | + this.data.data.goods_id == getApp().globalData.room_goods_id && | |
| 269 | + !getApp().globalData.room_user_share | |
| 270 | + ) { | |
| 271 | + url += "&room_id=" + getApp().globalData.room_id + "&room_user_share=1"; | |
| 272 | + } | |
| 273 | + | |
| 274 | + var ob = { | |
| 275 | + title: "预售列表", path: url, | |
| 276 | + }; | |
| 277 | + | |
| 278 | + if(img){ | |
| 279 | + ob.imageUrl=img; | |
| 280 | + } | |
| 281 | + return ob; | |
| 282 | + } | |
| 283 | + | |
| 284 | + | |
| 285 | + }); | ... | ... |
pages/template/index.js
| ... | ... | @@ -19,7 +19,21 @@ Page({ |
| 19 | 19 | this.data.temp_id=e.scene; |
| 20 | 20 | if(!this.data.temp_id) |
| 21 | 21 | this.data.temp_id=e.sence; |
| 22 | - if(!this.data.temp_id) wx.showModal({ title:"未读取到模板ID" ,}) | |
| 22 | + if(!this.data.temp_id) wx.showModal({ title:"未读取到模板ID" ,}) | |
| 23 | + | |
| 24 | + var first_leader = e.first_leader; | |
| 25 | + if (first_leader) { | |
| 26 | + //-- user_id代过来免登录 -- | |
| 27 | + getApp().globalData.first_leader = first_leader; | |
| 28 | + //调用接口判断是不是会员 | |
| 29 | + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { | |
| 30 | + if (res.data.code == 0) { | |
| 31 | + getApp().globalData.guide_id = res.data.data.id; | |
| 32 | + } | |
| 33 | + }) | |
| 34 | + } | |
| 35 | + | |
| 36 | + | |
| 23 | 37 | |
| 24 | 38 | }, |
| 25 | 39 | |
| ... | ... | @@ -94,26 +108,52 @@ Page({ |
| 94 | 108 | |
| 95 | 109 | }, |
| 96 | 110 | |
| 97 | - onShareAppMessage: function(e) { | |
| 111 | + onShareAppMessage:async function(e) { | |
| 98 | 112 | getApp().globalData.no_clear=1; |
| 113 | + getApp().getConfig(await function(e){ | |
| 114 | + this.setData({ | |
| 115 | + store_config:e | |
| 116 | + }) | |
| 117 | + }.bind(this)) | |
| 118 | + | |
| 119 | + var url= `pages/template/index?sence=`+this.data.temp_id; | |
| 120 | + var userInfo = getApp().globalData.userInfo; | |
| 121 | + //是分销商才带 | |
| 122 | + if (userInfo) { | |
| 123 | + url += "&first_leader=" + userInfo.user_id; | |
| 124 | + } | |
| 125 | + | |
| 126 | + var ob = { | |
| 127 | + title: this.data.share_title, | |
| 128 | + path: url, | |
| 129 | + imageUrl:this.data.url+this.data.store_config.store_logo, | |
| 130 | + }; | |
| 131 | + return ob; | |
| 99 | 132 | }, |
| 100 | 133 | |
| 101 | 134 | /** |
| 102 | 135 | * 用户分享朋友圈 |
| 103 | 136 | */ |
| 104 | 137 | async onShareTimeline(){ |
| 105 | - getApp().globalData.no_clear=1; | |
| 138 | + getApp().globalData.no_clear=1; | |
| 106 | 139 | getApp().getConfig(await function(e){ |
| 107 | 140 | this.setData({ |
| 108 | 141 | store_config:e |
| 109 | 142 | }) |
| 110 | 143 | }.bind(this)) |
| 111 | 144 | var {share_title,temp_id,store_config} = this.data; |
| 112 | - // var url= `pages/template/index?sence=${temp_id}`; | |
| 145 | + var url= `pages/template/index?sence=${temp_id}`; | |
| 146 | + | |
| 147 | + var userInfo = getApp().globalData.userInfo; | |
| 148 | + //是分销商才带 | |
| 149 | + if (userInfo) { | |
| 150 | + url += "&first_leader=" + userInfo.user_id; | |
| 151 | + } | |
| 152 | + | |
| 113 | 153 | var ob = { |
| 114 | 154 | title:share_title, |
| 115 | - // path: url, | |
| 116 | - query:`sence=${temp_id}`, | |
| 155 | + path: url, | |
| 156 | + //query:`sence=${temp_id}`, | |
| 117 | 157 | imageUrl:this.data.url+store_config.store_logo, |
| 118 | 158 | }; |
| 119 | 159 | console.log(ob); | ... | ... |