Commit df434a62c5fe902f383d7361cfc1a7b427a412cc

Authored by yvan.ni
1 parent 93ca5c87

分销我的小店

packageA/pages/distribution/card/card.js
1 // packageA//pages/distribution/card/card.js 1 // packageA//pages/distribution/card/card.js
2 const app = getApp(); 2 const app = getApp();
3 let self = null; 3 let self = null;
  4 +var os = app.globalData.setting;
4 5
5 Page({ 6 Page({
6 7
@@ -41,9 +42,11 @@ Page({ @@ -41,9 +42,11 @@ Page({
41 imghost: app.globalData.setting.imghost, 42 imghost: app.globalData.setting.imghost,
42 isLogin: true, 43 isLogin: true,
43 }); 44 });
  45 +
  46 + var user_id=app.globalData.userInfo.user_id;
44 // 请求数据 47 // 请求数据
45 wx.getImageInfo({ 48 wx.getImageInfo({
46 - src: 'https://test-weshop.xinda100.cn/api/wx/open/app/user/getWeAppEwm/1?sceneValue=6519836&pageValue=pages/index/index/index', 49 + src: os.url+'/api/wx/open/app/user/getWeAppEwm/1?sceneValue='+user_id+'&pageValue=packageA/pages/distribution/shop/shop',
47 success (res) { 50 success (res) {
48 self.setData({ 51 self.setData({
49 img: res.path, 52 img: res.path,
packageA/pages/distribution/shop/shop.js
1 // packageA//pages/distribution/commision/commision.js 1 // packageA//pages/distribution/commision/commision.js
2 const app = getApp(); 2 const app = getApp();
3 let self = null; 3 let self = null;
4 - 4 +var os = app.globalData.setting;
  5 +
5 Page({ 6 Page({
6 7
7 /** 8 /**
@@ -35,6 +36,29 @@ Page({ @@ -35,6 +36,29 @@ Page({
35 userInfo: data, 36 userInfo: data,
36 }); 37 });
37 }); 38 });
  39 +
  40 + //从别人的分享的跳转过来
  41 + var first_leader = decodeURIComponent(options.scene);
  42 + if(first_leader && first_leader!='undefined'){
  43 + getApp().globalData.first_leader=first_leader;
  44 + this.data.first_leader=first_leader;
  45 +
  46 + getApp().request.get("/api/weshop/users/get/" + os.stoid + "/" + first_leader, {
  47 + isShowLoading:false,
  48 + data:{r:Math.random()},
  49 + success: function (e) {
  50 + if(e.data.code==0){
  51 + self.setData({
  52 + userInfo2: e.data.data,
  53 + });
  54 + } ;
  55 +
  56 + },
  57 + });
  58 +
  59 + }
  60 +
  61 +
38 // 判断会员是否授权登录, 62 // 判断会员是否授权登录,
39 // 没有登录则跳转到登录页, 63 // 没有登录则跳转到登录页,
40 // 已登录则设置已登录状态,请求加载签到数据 64 // 已登录则设置已登录状态,请求加载签到数据
@@ -65,15 +89,14 @@ Page({ @@ -65,15 +89,14 @@ Page({
65 /** 89 /**
66 * 生命周期函数--监听页面初次渲染完成 90 * 生命周期函数--监听页面初次渲染完成
67 */ 91 */
68 - onReady: function () {  
69 -  
70 - }, 92 + onReady: function () {},
71 93
72 /** 94 /**
73 * 生命周期函数--监听页面显示 95 * 生命周期函数--监听页面显示
74 */ 96 */
75 onShow: function () { 97 onShow: function () {
76 - if(app.globalData.userInfo) { 98 + //自己登录的
  99 + if(app.globalData.userInfo && !this.data.first_leader) {
77 if(!this.data.isLogin) { 100 if(!this.data.isLogin) {
78 this.setData({ 101 this.setData({
79 userInfo: app.globalData.userInfo, 102 userInfo: app.globalData.userInfo,
@@ -114,7 +137,46 @@ Page({ @@ -114,7 +137,46 @@ Page({
114 }); 137 });
115 138
116 }; 139 };
117 - }; 140 + }
  141 + //被人分享点击开的
  142 + else if(this.data.first_leader){
  143 + this.setData({
  144 + imghost: app.globalData.setting.imghost,
  145 + currentQuery: {
  146 + store_id: app.globalData.setting.stoid,
  147 + user_id: this.data.first_leader,
  148 + },
  149 + isLogin: true,
  150 + });
  151 +
  152 + // 请求数据
  153 + this.getData(true, '/api/weshop/users/distribut/pagemyshop', this.data.currentQuery);
  154 + // 新品
  155 + app.request.promiseGet('/api/weshop/users/distribut/pagemyshop?type=2', {
  156 + data: self.data.currentQuery,
  157 + }).then(res => {
  158 + self.setData({
  159 + newList: res.data.data,
  160 + });
  161 + });
  162 + // 广告banner
  163 + app.request.promiseGet("/api/weshop/ad/page", {
  164 + data: {
  165 + pid: 401,
  166 + enabled: 1,
  167 + store_id: app.globalData.setting.stoid,
  168 + }
  169 + }).then(res => {
  170 + if(res.data.code == 0 && res.data.data) {
  171 + let item = res.data.data.pageData[0];
  172 + if(item && item.ad_code) {
  173 + self.setData({
  174 + ad_img: item.ad_code,
  175 + });
  176 + };
  177 + };
  178 + });
  179 + }
118 180
119 }, 181 },
120 182
@@ -148,11 +210,29 @@ Page({ @@ -148,11 +210,29 @@ Page({
148 210
149 /** 211 /**
150 * 用户点击右上角分享 212 * 用户点击右上角分享
151 - */  
152 - onShareAppMessage: function () {  
153 - 213 + *--点击分享事件--分享我的小店
  214 + *--*/
  215 + onShareAppMessage: function(t) {
  216 +
  217 + var th = this;
  218 + var title= "我的小店";
  219 + var user_id=this.data.first_leader;
  220 + if(!user_id){
  221 + user_id=getApp().globalData.user_id
  222 + }
  223 + var url="/packageA/pages/distribution/shop/shop?scene=" + user_id;
  224 + if(getApp().globalData.user_id){
  225 + url+="&first_leader="+getApp().globalData.user_id;
  226 + }
  227 +
  228 + var ob={
  229 + title: title,
  230 + path:url,
  231 + };
  232 + return ob;
  233 +
154 }, 234 },
155 - 235 +
156 /** 236 /**
157 * 点击下拉菜单 237 * 点击下拉菜单
158 */ 238 */
packageA/pages/distribution/shop/shop.wxml
@@ -5,10 +5,18 @@ @@ -5,10 +5,18 @@
5 <!-- <view><image src="../../../images/jfbuy.jpg" mode="widthFix" class="banner"/></view> --> 5 <!-- <view><image src="../../../images/jfbuy.jpg" mode="widthFix" class="banner"/></view> -->
6 <view><image src="{{imghost + (ad_img ? ad_img:'/miniapp/images/user_index_powder.jpg')}}" mode="widthFix" class="banner"/></view> 6 <view><image src="{{imghost + (ad_img ? ad_img:'/miniapp/images/user_index_powder.jpg')}}" mode="widthFix" class="banner"/></view>
7 <view class="flex bg-white pdh20 jc_sb pr"> 7 <view class="flex bg-white pdh20 jc_sb pr">
8 - <view class="avatar-container"> 8 + <!-- 分享人的头像 -->
  9 + <view class="avatar-container" wx:if="{{userInfo2}}">
  10 + <image class="avatar" src="{{userInfo2.head_pic}}"/>
  11 + <view class="pdt20"><text class="nickname">{{userInfo2.nickname}}</text></view>
  12 + </view>
  13 + <!-- 自己的头像 -->
  14 + <view class="avatar-container" wx:else>
9 <image class="avatar" src="{{userInfo.head_pic}}"/> 15 <image class="avatar" src="{{userInfo.head_pic}}"/>
10 <view class="pdt20"><text class="nickname">{{userInfo.nickname}}</text></view> 16 <view class="pdt20"><text class="nickname">{{userInfo.nickname}}</text></view>
11 </view> 17 </view>
  18 +
  19 +
12 <view class="flex t-c fs24 f1 jc_fe"> 20 <view class="flex t-c fs24 f1 jc_fe">
13 <view class="pdv20 pdh40"> 21 <view class="pdv20 pdh40">
14 <view class="fs30">{{filter.show_default(list.total)}}</view> 22 <view class="fs30">{{filter.show_default(list.total)}}</view>
pages/index/index/index.js
@@ -564,8 +564,6 @@ Page({ @@ -564,8 +564,6 @@ Page({
564 }, 564 },
565 onPageScroll: function(e) { 565 onPageScroll: function(e) {
566 this.data.scrollTop=e.scrollTop; 566 this.data.scrollTop=e.scrollTop;
567 -  
568 -  
569 var t = getCurrentPages(); 567 var t = getCurrentPages();
570 "pages/index/index/index" == t[t.length - 1].route; 568 "pages/index/index/index" == t[t.length - 1].route;
571 /*--(e.scrollTop > 10 ? wx.setNavigationBarColor({ 569 /*--(e.scrollTop > 10 ? wx.setNavigationBarColor({
@@ -588,7 +586,7 @@ Page({ @@ -588,7 +586,7 @@ Page({
588 url+="&first_leader="+getApp().globalData.user_id; 586 url+="&first_leader="+getApp().globalData.user_id;
589 } 587 }
590 var ob={ 588 var ob={
591 - title: getApp().globalData.config.store_name,, 589 + title: getApp().globalData.config.store_name,
592 path:url, 590 path:url,
593 }; 591 };
594 return o.share; 592 return o.share;