Commit fb4f35b9a558776ccde534910eb475520678d4a9

Authored by yvan.ni
1 parent a1d890b8

小程序业绩归属

packageA/pages/prom_list/prom_list.js
@@ -370,6 +370,20 @@ Page({ @@ -370,6 +370,20 @@ Page({
370 prom_id:o.prom_id 370 prom_id:o.prom_id
371 }; 371 };
372 372
  373 + //---是不是从收藏夹出来的---
  374 + if(th.data.c_guide_id){
  375 + newd['guide_id'] = th.data.c_guide_id;
  376 + newd['guide_type']=2;
  377 + if ("add" == t.currentTarget.dataset.action) newd['guide_type']=3;
  378 + }else{
  379 + if(getApp().globalData.guide_id){
  380 + newd['guide_id'] = getApp().globalData.guide_id;
  381 + newd['guide_type']=0;
  382 + if ("add" == t.currentTarget.dataset.action) newd['guide_type']=1;
  383 + }
  384 + }
  385 +
  386 +
373 //-----如果是秒杀,团购,积分购,拼团----- 387 //-----如果是秒杀,团购,积分购,拼团-----
374 if (th.data.data.prom_type != 5) { 388 if (th.data.data.prom_type != 5) {
375 return s.my_warnning("商品不是搭配活动!", 0, th); 389 return s.my_warnning("商品不是搭配活动!", 0, th);
pages/cart/cart/cart.js
@@ -57,9 +57,12 @@ Page({ @@ -57,9 +57,12 @@ Page({
57 var th = this; 57 var th = this;
58 //调用底部导航 58 //调用底部导航
59 t.editTabBar(th,getApp().globalData.setting.stoid,getApp().globalData.url); 59 t.editTabBar(th,getApp().globalData.setting.stoid,getApp().globalData.url);
60 -  
61 this.getCardList(); 60 this.getCardList();
62 - if(getApp().globalData.user_id) getApp().requestCardNum(); 61 + //--强行等待,让购物车的数量能够正确的线上
  62 + setTimeout(function () {
  63 + if(getApp().globalData.user_id) getApp().requestCardNum(th);
  64 + },500)
  65 +
63 //--获取是否又秒杀活动-- 66 //--获取是否又秒杀活动--
64 getApp().request.promiseGet("/api/ms/flash_sale/spikepage", { 67 getApp().request.promiseGet("/api/ms/flash_sale/spikepage", {
65 data: { 68 data: {
@@ -657,10 +660,11 @@ Page({ @@ -657,10 +660,11 @@ Page({
657 e.doCheckAll(); 660 e.doCheckAll();
658 661
659 t.goods_num=false_data.false_data.buy_limit; 662 t.goods_num=false_data.false_data.buy_limit;
660 - e.update_cart(t, pitem, item);  
661 - 663 + e.update_cart(t, pitem, item);
662 return false; 664 return false;
663 } 665 }
  666 + e.update_cart(t, pitem, item);
  667 +
664 }else{ 668 }else{
665 //--- 看一下是不是线下库存 --- 669 //--- 看一下是不是线下库存 ---
666 if(th.data.sales_rules==2){ 670 if(th.data.sales_rules==2){
@@ -789,6 +793,7 @@ Page({ @@ -789,6 +793,7 @@ Page({
789 e.check_prom_activity(i) 793 e.check_prom_activity(i)
790 } 794 }
791 e.doCheckAll(); 795 e.doCheckAll();
  796 + getApp().requestCardNum(e);
792 } 797 }
793 }); 798 });
794 }, 799 },
pages/cart/cart2/cart2.js
@@ -152,6 +152,7 @@ Page({ @@ -152,6 +152,7 @@ Page({
152 console.log("getuser_addr") 152 console.log("getuser_addr")
153 console.log(ie) 153 console.log(ie)
154 154
  155 +
155 //地址切换要把包邮券清空 156 //地址切换要把包邮券清空
156 if( !th.data.user_addr || th.data.user_addr.address_id!=ie.address_id){ 157 if( !th.data.user_addr || th.data.user_addr.address_id!=ie.address_id){
157 var using_quan=th.data.using_quan; 158 var using_quan=th.data.using_quan;
@@ -167,6 +168,7 @@ Page({ @@ -167,6 +168,7 @@ Page({
167 168
168 //更换地址回来要重新调用计算价钱的接口 169 //更换地址回来要重新调用计算价钱的接口
169 if(!th.data.user_addr || th.data.user_addr.address_id!=ie.address_id){ 170 if(!th.data.user_addr || th.data.user_addr.address_id!=ie.address_id){
  171 + th.setData({user_addr: ie });
170 if (th.data.is_b_now == 1) { 172 if (th.data.is_b_now == 1) {
171 if(th.data.bn_goods) { 173 if(th.data.bn_goods) {
172 th.calculatePrice2(); 174 th.calculatePrice2();
@@ -176,9 +178,9 @@ Page({ @@ -176,9 +178,9 @@ Page({
176 th.calculatePrice(); 178 th.calculatePrice();
177 } 179 }
178 } 180 }
  181 + }else{
  182 + th.setData({user_addr: ie });
179 } 183 }
180 -  
181 - th.setData({user_addr: ie });  
182 var going=0; 184 var going=0;
183 185
184 186
@@ -280,7 +282,7 @@ Page({ @@ -280,7 +282,7 @@ Page({
280 success: function (su) { 282 success: function (su) {
281 if (su.data.code == 0) { 283 if (su.data.code == 0) {
282 var yuer = parseFloat(th.data.userinfo.user_money - 284 var yuer = parseFloat(th.data.userinfo.user_money -
283 - th.data.userinfo.frozen_money - su.data.data.summoney).toFixed(2); 285 + (th.data.userinfo.frozen_money>0?th.data.userinfo.frozen_money:0) - su.data.data.summoney).toFixed(2);
284 th.setData({ txmon: su.data.data.summoney, yuer: yuer }); 286 th.setData({ txmon: su.data.data.summoney, yuer: yuer });
285 } 287 }
286 } 288 }
@@ -596,7 +598,7 @@ Page({ @@ -596,7 +598,7 @@ Page({
596 var all_cutprice=0; //所有的优惠减件 598 var all_cutprice=0; //所有的优惠减件
597 var all_order_prom=0; //所有的订单优惠 599 var all_order_prom=0; //所有的订单优惠
598 600
599 - var umoney = th.data.userinfo.user_money - th.data.txmon - th.data.userinfo.frozen_money; 601 + var umoney = th.data.userinfo.user_money - th.data.txmon - (th.data.userinfo.frozen_money?th.data.userinfo.frozen_money:0);
600 var freight_free = ee.freight_free; //全场满多少包邮 602 var freight_free = ee.freight_free; //全场满多少包邮
601 var no_ex_id=ee.no_ex_id; 603 var no_ex_id=ee.no_ex_id;
602 var no_ex_good=null; 604 var no_ex_good=null;
@@ -1423,7 +1425,20 @@ Page({ @@ -1423,7 +1425,20 @@ Page({
1423 'prom_type':th.data.bn_goods.prom_type, //促销活动类型 1425 'prom_type':th.data.bn_goods.prom_type, //促销活动类型
1424 'prom_id': th.data.bn_goods.prom_id, //促销活动id 1426 'prom_id': th.data.bn_goods.prom_id, //促销活动id
1425 }; 1427 };
1426 - 1428 +
  1429 + //-- 把导购的信息填入--
  1430 + if(gg.guide_id){
  1431 + goods.guide_id=gg.guide_id;
  1432 + goods.guide_type=gg.guide_type;
  1433 + //调用接口判断是不是会员
  1434 + await getApp().request.promiseGet("/api/weshop/shoppingGuide/get/"+oo.stoid+"/"+gg.guide_id,{}).then(res=>{
  1435 + if(res.data.code==0){
  1436 + goods.guide_name=res.data.data.salesman;
  1437 + goods.guide_sn=res.data.data.salesman_no;
  1438 + }
  1439 + })
  1440 + }
  1441 +
1427 //如果不立即购买或者秒杀,如果是线下库存购买的时候 1442 //如果不立即购买或者秒杀,如果是线下库存购买的时候
1428 if(goods.prom_type!=1 && goods.prom_type!=6 && th.data.sales_rules==2){ 1443 if(goods.prom_type!=1 && goods.prom_type!=6 && th.data.sales_rules==2){
1429 var isok=1; 1444 var isok=1;
@@ -1610,6 +1625,19 @@ Page({ @@ -1610,6 +1625,19 @@ Page({
1610 return false; 1625 return false;
1611 } 1626 }
1612 } 1627 }
  1628 +
  1629 + //导购ID
  1630 + if(g_item.guide_id){
  1631 + goods.guide_id=g_item.guide_id;
  1632 + goods.guide_type=g_item.guide_type;
  1633 + //调用接口判断是不是会员
  1634 + await getApp().request.promiseGet("/api/weshop/shoppingGuide/get/"+oo.stoid+"/"+g_item.guide_id,{}).then(res=>{
  1635 + if(res.data.code==0){
  1636 + goods.guide_name=res.data.data.salesman;
  1637 + goods.guide_sn=res.data.data.salesman_no;
  1638 + }
  1639 + })
  1640 + }
1613 1641
1614 item.order_goods.push(goods); 1642 item.order_goods.push(goods);
1615 } 1643 }
@@ -1620,6 +1648,7 @@ Page({ @@ -1620,6 +1648,7 @@ Page({
1620 1648
1621 if (pdata.length==0) return; 1649 if (pdata.length==0) return;
1622 var str = JSON.stringify(pdata); 1650 var str = JSON.stringify(pdata);
  1651 +
1623 1652
1624 wx.showLoading({title: "加载中"}); 1653 wx.showLoading({title: "加载中"});
1625 wx.request({ 1654 wx.request({
pages/cart/cart2_pt/cart2_pt.js
@@ -56,7 +56,8 @@ Page({ @@ -56,7 +56,8 @@ Page({
56 qh:'', //期号 56 qh:'', //期号
57 pt_listno:'',//期号 57 pt_listno:'',//期号
58 is_normal:0, 58 is_normal:0,
59 - is_express:0,//选择物流的控制器 59 + is_express:0,//选择物流的控制器
  60 + yuer:0,
60 }, 61 },
61 onLoad: function(t) { 62 onLoad: function(t) {
62 console.log("onLoad_pt_cart"); 63 console.log("onLoad_pt_cart");
@@ -128,6 +129,18 @@ Page({ @@ -128,6 +129,18 @@ Page({
128 th.setData({ userinfo: to.globalData.userInfo}); 129 th.setData({ userinfo: to.globalData.userInfo});
129 //获取立即购买的商品信息 130 //获取立即购买的商品信息
130 th.get_buy_goods(); 131 th.get_buy_goods();
  132 +
  133 + //获取提现金额
  134 + getApp().request.get("/api/weshop/withdrawals/summoney", {
  135 + data: { user_id: to.globalData.user_id, store_id: oo.stoid, status: 0 },
  136 + success: function (su) {
  137 + if (su.data.code == 0) {
  138 + var yuer = parseFloat(th.data.userinfo.user_money -
  139 + (th.data.userinfo.frozen_money>0?th.data.userinfo.frozen_money:0) - su.data.data.summoney).toFixed(2);
  140 + th.setData({ txmon: su.data.data.summoney, yuer: yuer });
  141 + }
  142 + }
  143 + });
131 }, 144 },
132 145
133 //-----获取立即购买的商品信息---- 146 //-----获取立即购买的商品信息----
@@ -325,12 +338,12 @@ Page({ @@ -325,12 +338,12 @@ Page({
325 var txt2 = "formData.order_amount"; 338 var txt2 = "formData.order_amount";
326 //--------------如果使用余额--------------------- 339 //--------------如果使用余额---------------------
327 if (th.data.bn_use_money == 1) { 340 if (th.data.bn_use_money == 1) {
328 - if (th.data.userinfo.user_money > total_m) { 341 + if ( parseFloat(th.data.yuer) > total_m) {
329 th.setData({ [txt]: total_m, [txt2]:0 }) 342 th.setData({ [txt]: total_m, [txt2]:0 })
330 }else{ 343 }else{
331 - order_m = order_m - th.data.userinfo.user_money; 344 + order_m = order_m - parseFloat(th.data.yuer);
332 order_m = order_m.toFixed(2); 345 order_m = order_m.toFixed(2);
333 - th.setData({ [txt]: th.data.userinfo.user_money, [txt2]: order_m }) 346 + th.setData({ [txt]: th.data.userinfo.yuer, [txt2]: order_m })
334 } 347 }
335 }else{ 348 }else{
336 th.setData({ [txt]: 0, [txt2]: order_m }) 349 th.setData({ [txt]: 0, [txt2]: order_m })
@@ -422,6 +435,13 @@ Page({ @@ -422,6 +435,13 @@ Page({
422 'prom_type':th.data.bn_goods.prom_type, //促销活动类型 435 'prom_type':th.data.bn_goods.prom_type, //促销活动类型
423 'prom_id': th.data.bn_goods.prom_id, //促销活动id 436 'prom_id': th.data.bn_goods.prom_id, //促销活动id
424 }; 437 };
  438 +
  439 + //--导购分享过来的id--
  440 + if(gg.guide_id){
  441 + goods.guide_id=gg.guide_id;
  442 + goods.guide_type=gg.guide_type;
  443 + }
  444 +
425 item.order_goods.push(goods); 445 item.order_goods.push(goods);
426 pdata.push(item); 446 pdata.push(item);
427 447
pages/cart/cart2_pt/cart2_pt.wxml
@@ -105,7 +105,7 @@ @@ -105,7 +105,7 @@
105 <view class="set-mes" wx:if="{{userinfo.user_money>0}}"> 105 <view class="set-mes" wx:if="{{userinfo.user_money>0}}">
106 <view class="use-item" bindtap='set_bn_useyuer'> 106 <view class="use-item" bindtap='set_bn_useyuer'>
107 <icon color="{{bn_use_money?'red':'gray'}}" size="16" type="success"></icon> 107 <icon color="{{bn_use_money?'red':'gray'}}" size="16" type="success"></icon>
108 - <view class="yu_er">使用余额 :¥{{userinfo.user_money}} </view> 108 + <view class="yu_er">使用余额 :¥{{yuer}} </view>
109 109
110 </view> 110 </view>
111 </view> 111 </view>
pages/cart/cart_wk/cart_wk.js
@@ -389,7 +389,7 @@ Page({ @@ -389,7 +389,7 @@ Page({
389 getApp().my_warnning("支付成功",1,th); 389 getApp().my_warnning("支付成功",1,th);
390 setTimeout(function () { 390 setTimeout(function () {
391 th.setData({ isclose: 0 }); 391 th.setData({ isclose: 0 });
392 - wx.navigateTo({ 392 + wx.redirectTo({
393 url: "/pages/user/order_list/order_list" 393 url: "/pages/user/order_list/order_list"
394 }) 394 })
395 }, 1000) 395 }, 1000)
pages/goods/goodsInfo/goodsInfo.js
@@ -251,14 +251,34 @@ Page({ @@ -251,14 +251,34 @@ Page({
251 var ee = this, 251 var ee = this,
252 that = ee, 252 that = ee,
253 th = ee, 253 th = ee,
254 - gid = t.goods_id; 254 + gid = t.goods_id,
  255 + first_leader=t.first_leader;
255 256
256 //---获取手机地址坐标-- 257 //---获取手机地址坐标--
257 //--如果tg_id是空的话,分享回来-- 258 //--如果tg_id是空的话,分享回来--
258 if (gid == undefined || gid == null || gid == "") { 259 if (gid == undefined || gid == null || gid == "") {
259 - gid = decodeURIComponent(t.scene); 260 + var gid_str = decodeURIComponent(t.scene);
  261 + gid_str.split("_");
  262 + gid=gid_str[0];
  263 + if(gid_str.length>1){
  264 + first_leader=gid_str[1];
  265 + }
260 } 266 }
261 ee.setData({ gid: gid}); 267 ee.setData({ gid: gid});
  268 + if(first_leader){
  269 + getApp().globalData.first_leader=first_leader;
  270 + //调用接口判断是不是会员
  271 + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/"+os.stoid+"/"+first_leader,{}).then(res=>{
  272 + if(res.data.code==0){
  273 + getApp().globalData.guide_id=res.data.data.bind_user_id;
  274 + }
  275 + })
  276 + }
  277 +
  278 + var c_guide_id=t.c_guide_id;
  279 + if(c_guide_id){
  280 + th.data.c_guide_id=c_guide_id;
  281 + }
262 282
263 //----获取系统参数----- 283 //----获取系统参数-----
264 getApp().getConfig2(function(e) { 284 getApp().getConfig2(function(e) {
@@ -932,6 +952,19 @@ Page({ @@ -932,6 +952,19 @@ Page({
932 sku: o.sku, 952 sku: o.sku,
933 }; 953 };
934 954
  955 + //---是不是从收藏夹出来的---
  956 + if(th.data.c_guide_id){
  957 + newd['guide_id'] = th.data.c_guide_id;
  958 + newd['guide_type']=2;
  959 + if ("add" == t.currentTarget.dataset.action) newd['guide_type']=3;
  960 + }else{
  961 + if(getApp().globalData.guide_id){
  962 + newd['guide_id'] = getApp().globalData.guide_id;
  963 + newd['guide_type']=0;
  964 + if ("add" == t.currentTarget.dataset.action) newd['guide_type']=1;
  965 + }
  966 + }
  967 +
935 //如果是积分够,is_integral_normal就要有积分购普通购买字段 968 //如果是积分够,is_integral_normal就要有积分购普通购买字段
936 if(o.prom_type==4){ 969 if(o.prom_type==4){
937 newd.is_integral_normal=1; 970 newd.is_integral_normal=1;
@@ -1028,8 +1061,6 @@ Page({ @@ -1028,8 +1061,6 @@ Page({
1028 } 1061 }
1029 } 1062 }
1030 } 1063 }
1031 -  
1032 -  
1033 1064
1034 //if (this.data.data.goods.is_virtual) return this.buyVirtualGoods(d); 1065 //if (this.data.data.goods.is_virtual) return this.buyVirtualGoods(d);
1035 if ("add" == t.currentTarget.dataset.action) { 1066 if ("add" == t.currentTarget.dataset.action) {
@@ -1064,7 +1095,6 @@ Page({ @@ -1064,7 +1095,6 @@ Page({
1064 return s.my_warnning("库存不足!", 0, th); 1095 return s.my_warnning("库存不足!", 0, th);
1065 } 1096 }
1066 } 1097 }
1067 -  
1068 1098
1069 var updata = { 1099 var updata = {
1070 id: item.id, 1100 id: item.id,
@@ -1073,7 +1103,18 @@ Page({ @@ -1073,7 +1103,18 @@ Page({
1073 member_goods_price:newd.goods_price, 1103 member_goods_price:newd.goods_price,
1074 store_id: th.data.stoid, 1104 store_id: th.data.stoid,
1075 }; 1105 };
1076 - 1106 +
  1107 + //---是不是从收藏夹出来的---
  1108 + if(th.data.c_guide_id){
  1109 + updata['guide_id'] = th.data.c_guide_id;
  1110 + updata['guide_type']=3; //加入购物车之后就变成了3
  1111 + }else {
  1112 + if (getApp().globalData.guide_id) {
  1113 + updata['guide_id'] = getApp().globalData.guide_id;
  1114 + updata['guide_type'] = 0;
  1115 + }
  1116 + }
  1117 +
1077 i.put("/api/weshop/cart/update", { 1118 i.put("/api/weshop/cart/update", {
1078 data: updata, 1119 data: updata,
1079 success: function(t) { 1120 success: function(t) {
@@ -1086,6 +1127,8 @@ Page({ @@ -1086,6 +1127,8 @@ Page({
1086 } 1127 }
1087 }); 1128 });
1088 } else { 1129 } else {
  1130 +
  1131 +
1089 i.post("/api/weshop/cart/save", { 1132 i.post("/api/weshop/cart/save", {
1090 data: newd, 1133 data: newd,
1091 success: function(t) { 1134 success: function(t) {
@@ -1124,7 +1167,7 @@ Page({ @@ -1124,7 +1167,7 @@ Page({
1124 break; 1167 break;
1125 } 1168 }
1126 } 1169 }
1127 - 1170 +
1128 } 1171 }
1129 1172
1130 newd['pick_name'] = th.data.sto_sele_name; 1173 newd['pick_name'] = th.data.sto_sele_name;
@@ -1133,9 +1176,7 @@ Page({ @@ -1133,9 +1176,7 @@ Page({
1133 } 1176 }
1134 }, 1177 },
1135 1178
1136 -  
1137 -  
1138 - 1179 +
1139 //----------购买虚拟商品------ 1180 //----------购买虚拟商品------
1140 buyVirtualGoods: function(e) { 1181 buyVirtualGoods: function(e) {
1141 Object.assign(e, { 1182 Object.assign(e, {
@@ -1319,6 +1360,12 @@ Page({ @@ -1319,6 +1360,12 @@ Page({
1319 store_id: o.stoid, 1360 store_id: o.stoid,
1320 add_time: timestamp, 1361 add_time: timestamp,
1321 }; 1362 };
  1363 + //加入收藏夹就是导购的ID
  1364 + if(getApp().globalData.guide_id){
  1365 + d.guide_id=getApp().globalData.guide_id;
  1366 + d.guide_type=2;
  1367 + }
  1368 +
1322 i.post("/api/weshop/goodscollect/save", { //添加收藏 1369 i.post("/api/weshop/goodscollect/save", { //添加收藏
1323 data: d, 1370 data: d,
1324 success: function(e) { 1371 success: function(e) {
@@ -1438,10 +1485,14 @@ Page({ @@ -1438,10 +1485,14 @@ Page({
1438 title=th.data.prom_act.share_title; 1485 title=th.data.prom_act.share_title;
1439 img=th.data.iurl+th.data.prom_act.share_imgurl; 1486 img=th.data.iurl+th.data.prom_act.share_imgurl;
1440 } 1487 }
  1488 + var url="/pages/goods/goodsInfo/goodsInfo?goods_id=" + th.data.gid;
  1489 + if(getApp().globalData.user_id){
  1490 + url+="&first_leader="+getApp().globalData.user_id;
  1491 + }
1441 1492
1442 return { 1493 return {
1443 title: price + "元 " +title, 1494 title: price + "元 " +title,
1444 - path: "/pages/goods/goodsInfo/goodsInfo?goods_id=" + th.data.gid, 1495 + path:url,
1445 imageUrl: img, 1496 imageUrl: img,
1446 } 1497 }
1447 1498
@@ -3126,7 +3177,12 @@ Page({ @@ -3126,7 +3177,12 @@ Page({
3126 var app = getApp(); 3177 var app = getApp();
3127 var unit = that.data.screenWidth / 750 * 1.35; 3178 var unit = that.data.screenWidth / 750 * 1.35;
3128 var path2 = that.data.data.original_img; 3179 var path2 = that.data.data.original_img;
3129 - var scene = th.data.gid; 3180 + var scene = th.data.gid+"";
  3181 + var user_id=getApp().globalData.user_id?getApp().globalData.user_id:0;
  3182 + if(user_id>0){
  3183 + scene+="_"+user_id;
  3184 + }
  3185 +
3130 ///二微码 3186 ///二微码
3131 var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + 3187 var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" +
3132 os.stoid + "?sceneValue=" + scene + "&pageValue=pages/goods/goodsInfo/goodsInfo"; 3188 os.stoid + "?sceneValue=" + scene + "&pageValue=pages/goods/goodsInfo/goodsInfo";
pages/goods/goodsList/goodsList.js
@@ -24,6 +24,19 @@ Page({ @@ -24,6 +24,19 @@ Page({
24 }, 24 },
25 25
26 onLoad: function(t) { 26 onLoad: function(t) {
  27 +
  28 + //接受有没有导购的参数
  29 + var first_leader=t.first_leader;
  30 + if(first_leader){
  31 + getApp().globalData.first_leader=first_leader;
  32 + //调用接口判断是不是会员
  33 + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/"+oo.stoid+"/"+first_leader,{}).then(res=>{
  34 + if(res.data.code==0){
  35 + getApp().globalData.guide_id=res.data.data.bind_user_id;
  36 + }
  37 + })
  38 + }
  39 +
27 var th=this; 40 var th=this;
28 a.init(this, "", "requestData"); 41 a.init(this, "", "requestData");
29 var url = this.data.baseUrl; 42 var url = this.data.baseUrl;
@@ -194,9 +207,23 @@ Page({ @@ -194,9 +207,23 @@ Page({
194 }, 207 },
195 //---------分享配置-------- 208 //---------分享配置--------
196 onShareAppMessage: function (e) { 209 onShareAppMessage: function (e) {
197 - return {  
198 - title: "商品列表",  
199 - } 210 + var curPage=this;
  211 + var pagePath = curPage.route; //当前页面url
  212 + if (pagePath.indexOf('/') != 0) {
  213 + pagePath = '/' + pagePath;
  214 + }
  215 + if(getApp().globalData.user_id){
  216 +
  217 + if(pagePath.indexOf("?")>0){
  218 + pagePath+="&first_leader="+getApp().globalData.user_id;
  219 + }else{
  220 + pagePath+="?first_leader="+getApp().globalData.user_id;
  221 + }
  222 + }
  223 + return {
  224 + title: "商品列表",
  225 + path:pagePath,
  226 + }
200 }, 227 },
201 //---图片失败,默认图片--- 228 //---图片失败,默认图片---
202 bind_bnerr2: function (e) { 229 bind_bnerr2: function (e) {
pages/goods/goodsList/goodsList.json
1 { 1 {
2 - "navigationBarTitleText": "商品列表" 2 + "navigationBarTitleText": "商品列表",
  3 + "usingComponents": {
  4 + "share_box": "/components/share_box/share_box"
  5 + }
3 } 6 }
4 \ No newline at end of file 7 \ No newline at end of file
pages/goods/goodsList/goodsList.wxml
@@ -164,4 +164,6 @@ @@ -164,4 +164,6 @@
164 </view> 164 </view>
165 </view> 165 </view>
166 </view> 166 </view>
167 - </view>  
168 \ No newline at end of file 167 \ No newline at end of file
  168 + </view>
  169 +
  170 +<share_box id="share"></share_box>
169 \ No newline at end of file 171 \ No newline at end of file
pages/goods/search/search.js
@@ -23,6 +23,18 @@ Page({ @@ -23,6 +23,18 @@ Page({
23 adname: "desc", //升降的字段 23 adname: "desc", //升降的字段
24 }, 24 },
25 onLoad: function(t) { 25 onLoad: function(t) {
  26 + //接受有没有导购的参数
  27 + var first_leader=t.first_leader;
  28 + if(first_leader){
  29 + getApp().globalData.first_leader=first_leader;
  30 + //调用接口判断是不是会员
  31 + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/"+oo.stoid+"/"+first_leader,{}).then(res=>{
  32 + if(res.data.code==0){
  33 + getApp().globalData.guide_id=res.data.data.bind_user_id;
  34 + }
  35 + })
  36 + }
  37 +
26 var th=this; 38 var th=this;
27 a.getConfig2(function(rs){ 39 a.getConfig2(function(rs){
28 var arr=new Array(),arr2=new Array(); 40 var arr=new Array(),arr2=new Array();
pages/index/index/index.js
@@ -112,7 +112,6 @@ Page({ @@ -112,7 +112,6 @@ Page({
112 t.editTabBar(th,o.stoid,th.data.url); 112 t.editTabBar(th,o.stoid,th.data.url);
113 113
114 114
115 - if (getApp().globalData.user_id) getApp().requestCardNum();  
116 await this.init_load(); 115 await this.init_load();
117 //显示的时候要开启计时器 116 //显示的时候要开启计时器
118 this.data.is_timer = 1; 117 this.data.is_timer = 1;
@@ -125,6 +124,9 @@ Page({ @@ -125,6 +124,9 @@ Page({
125 if (new_nav == "") { 124 if (new_nav == "") {
126 th.is_new(); 125 th.is_new();
127 } 126 }
  127 + setTimeout(function () {
  128 + if (getApp().globalData.user_id) getApp().requestCardNum(th);
  129 + },500)
128 130
129 }); 131 });
130 } else { 132 } else {
@@ -405,6 +407,11 @@ Page({ @@ -405,6 +407,11 @@ Page({
405 if (new_nav == "") { 407 if (new_nav == "") {
406 th.is_new(); 408 th.is_new();
407 } 409 }
  410 +
  411 + setTimeout(function () {
  412 + if (getApp().globalData.user_id) getApp().requestCardNum(th);
  413 + },500)
  414 +
408 415
409 }); 416 });
410 var goods_list = this.selectComponent("#goods_list"); //组件的id 417 var goods_list = this.selectComponent("#goods_list"); //组件的id
pages/team/team_show/team_show.js
@@ -66,12 +66,29 @@ Page({ @@ -66,12 +66,29 @@ Page({
66 wx.setNavigationBarTitle({ title: "拼团订单",}) 66 wx.setNavigationBarTitle({ title: "拼团订单",})
67 //var postdata=getApp().globalData.to_group; 67 //var postdata=getApp().globalData.to_group;
68 var postdata=options; 68 var postdata=options;
69 - var tg_id = postdata.tg_id; 69 + var tg_id = postdata.tg_id, first_leader=t.first_leader;
70 //如果tg_id是空的话 70 //如果tg_id是空的话
71 if(tg_id==undefined || tg_id==null || tg_id==""){ 71 if(tg_id==undefined || tg_id==null || tg_id==""){
72 - tg_id=decodeURIComponent(postdata.scene); 72 + var tg_id_str=decodeURIComponent(postdata.scene);
  73 + tg_id_str=tg_id_str.split("_");
  74 + tg_id=tg_id_str[0];
  75 + if(tg_id_str.length>1){
  76 + first_leader=tg_id_str[1];
  77 + }
73 } 78 }
74 - this.setData({tg_id: tg_id }); 79 + //--判断一下是不是导购--
  80 + if(first_leader){
  81 + getApp().globalData.first_leader=first_leader;
  82 + //调用接口判断是不是会员
  83 + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/"+os.stoid+"/"+first_leader,{}).then(res=>{
  84 + if(res.data.code==0){
  85 + getApp().globalData.guide_id=res.data.data.bind_user_id;
  86 + }
  87 + })
  88 + }
  89 +
  90 +
  91 + this.setData({tg_id: tg_id });
75 getApp().globalData.to_group=null; 92 getApp().globalData.to_group=null;
76 }, 93 },
77 94
@@ -767,8 +784,12 @@ Page({ @@ -767,8 +784,12 @@ Page({
767 } 784 }
768 newd['pick_dis'] = th.data.pick_dis; 785 newd['pick_dis'] = th.data.pick_dis;
769 786
770 - s.set_b_now(newd); 787 + if(getApp().globalData.guide_id){
  788 + newd['guide_id'] = getApp().globalData.guide_id;
  789 + newd['guide_type']=0;
  790 + }
771 791
  792 + s.set_b_now(newd);
772 wx.navigateTo({ 793 wx.navigateTo({
773 url: "/pages/cart/cart2_pt/cart2_pt?is_bnow=1&goods_id=" + th.data.goods.goods_id, 794 url: "/pages/cart/cart2_pt/cart2_pt?is_bnow=1&goods_id=" + th.data.goods.goods_id,
774 }); 795 });
@@ -882,4 +903,30 @@ Page({ @@ -882,4 +903,30 @@ Page({
882 this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; 903 this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
883 }, 904 },
884 905
  906 + //------ 分享配置 --------
  907 + onShareAppMessage: function (e) {
  908 + var curPage=this;
  909 + var pagePath = curPage.route; //当前页面url
  910 + if (pagePath.indexOf('/') != 0) {
  911 + pagePath = '/' + pagePath;
  912 + }
  913 + var url=pagePath;
  914 +
  915 + //--分享图片--
  916 + img=th.data.iurl+th.data.teamlist.share_imgurl;
  917 + //--把会员分享出去--
  918 + if(getApp().globalData.user_id){
  919 + if(url.indexOf("?")>0)
  920 + url+="&first_leader="+getApp().globalData.user_id;
  921 + else
  922 + url+="?first_leader="+getApp().globalData.user_id;
  923 + }
  924 +
  925 + return {
  926 + path:url,
  927 + title: "商品分类",
  928 + imageUrl: img,
  929 + }
  930 + },
  931 +
885 }) 932 })
886 \ No newline at end of file 933 \ No newline at end of file
pages/team/team_success/team_success.js
@@ -355,6 +355,12 @@ Page({ @@ -355,6 +355,12 @@ Page({
355 var app = getApp(); 355 var app = getApp();
356 var unit = that.data.screenWidth / 750 * 1.35; 356 var unit = that.data.screenWidth / 750 * 1.35;
357 var scene=th.data.teamgroup.id; 357 var scene=th.data.teamgroup.id;
  358 + var user_id=getApp().globalData.user_id?getApp().globalData.user_id:0;
  359 + if(user_id>0){
  360 + scene+="_"+user_id;
  361 + }
  362 +
  363 +
358 //二微码 364 //二微码
359 var path3 = os.url+ "/api/wx/open/app/user/getWeAppEwm/"+ 365 var path3 = os.url+ "/api/wx/open/app/user/getWeAppEwm/"+
360 os.stoid+"?sceneValue="+scene+"&pageValue=pages/team/team_show/team_show"; 366 os.stoid+"?sceneValue="+scene+"&pageValue=pages/team/team_show/team_show";
@@ -667,7 +673,30 @@ Page({ @@ -667,7 +673,30 @@ Page({
667 ob[err_img] = this.data.iurl + "/miniapp/images/default_g_img.gif"; 673 ob[err_img] = this.data.iurl + "/miniapp/images/default_g_img.gif";
668 this.setData(ob); 674 this.setData(ob);
669 675
670 - } 676 + },
  677 +
  678 +
  679 + //------ 分享配置 --------
  680 + onShareAppMessage: function (e) {
  681 + var scene=th.data.teamgroup.id;
  682 + var url="/pages/team/team_show/team_show?tg_id="+scene;
  683 + //--分享图片--
  684 + img=th.data.iurl+th.data.teamlist.share_imgurl;
  685 + //--把会员分享出去--
  686 + if(getApp().globalData.user_id){
  687 + if(url.indexOf("?")>0)
  688 + url+="&first_leader="+getApp().globalData.user_id;
  689 + else
  690 + url+="?first_leader="+getApp().globalData.user_id;
  691 + }
  692 +
  693 + return {
  694 + path:url,
  695 + title: "商品分类",
  696 + imageUrl: img,
  697 + }
  698 + },
  699 +
671 700
672 }) 701 })
673 702
pages/user/collect_list/collect_list.js
@@ -8,6 +8,7 @@ var t = function(t) { @@ -8,6 +8,7 @@ var t = function(t) {
8 o = new t.default(); 8 o = new t.default();
9 var oo = e.globalData.setting, 9 var oo = e.globalData.setting,
10 app_d = e.globalData; 10 app_d = e.globalData;
  11 +var ut = require('../../../utils/util.js');
11 12
12 Page({ 13 Page({
13 data: { 14 data: {
@@ -153,6 +154,19 @@ Page({ @@ -153,6 +154,19 @@ Page({
153 iconClick: function(e) { 154 iconClick: function(e) {
154 var th = this.data; 155 var th = this.data;
155 var index = e.currentTarget.dataset.index; 156 var index = e.currentTarget.dataset.index;
  157 + var url = e.currentTarget.dataset.url;
  158 +
  159 + var item=this.data.collects[index];
  160 + if(url){
  161 + console.log("---");
  162 + console.log(item.add_time);
  163 + console.log(ut.gettimestamp());
  164 +
  165 + if(ut.gettimestamp()-item.add_time<3600*24 && item.guide_id>0)
  166 + url+="&c_guide_id="+item.guide_id;
  167 + getApp().goto(url);
  168 + return false;
  169 + }
156 var collect = "collects[" + index + "].checked"; 170 var collect = "collects[" + index + "].checked";
157 if (this.data.collects[index].checked == true) { 171 if (this.data.collects[index].checked == true) {
158 this.setData({ 172 this.setData({
pages/user/collect_list/collect_list.wxml
@@ -21,7 +21,8 @@ @@ -21,7 +21,8 @@
21 </view> 21 </view>
22 <!-- 商品集合 --> 22 <!-- 商品集合 -->
23 <view class="{{editEd?'collects_max colls_max':'collects_max'}}"> 23 <view class="{{editEd?'collects_max colls_max':'collects_max'}}">
24 - <navigator class="collect flex-vertical" bindtap="iconClick" data-index="{{index}}" wx:for="{{collects}}" wx:key="{{index}}" url="{{editEd==0?'/pages/goods/goodsInfo/goodsInfo?goods_id='+item.goods_id:''}}"> 24 + <navigator class="collect flex-vertical" bindtap="iconClick" data-index="{{index}}" wx:for="{{collects}}" wx:key="{{index}}"
  25 + data-url="{{editEd==0?'/pages/goods/goodsInfo/goodsInfo?goods_id='+item.goods_id:''}}">
25 26
26 <view class="radioCheck iconClick" wx:if="{{editEd}}"> 27 <view class="radioCheck iconClick" wx:if="{{editEd}}">
27 <radio color="rgb(214,1,33)" class="scale" checked="{{item.checked==true?true:false}}"></radio> 28 <radio color="rgb(214,1,33)" class="scale" checked="{{item.checked==true?true:false}}"></radio>
pages/user/index/index.js
@@ -84,10 +84,12 @@ Page({ @@ -84,10 +84,12 @@ Page({
84 need_money = 0, 84 need_money = 0,
85 cur_g_num = 0; 85 cur_g_num = 0;
86 86
87 - //调用底部导航  
88 - getApp().editTabBar(th,getApp().globalData.setting.stoid,getApp().globalData.url); 87 + //调用底部导航
  88 + getApp().editTabBar(th,getApp().globalData.setting.stoid,getApp().globalData.url);
89 getApp().get_isbuy(th.setappdata); 89 getApp().get_isbuy(th.setappdata);
90 - if (getApp().globalData.user_id) getApp().requestCardNum(); 90 + setTimeout(function () {
  91 + if (getApp().globalData.user_id) getApp().requestCardNum(th);
  92 + },500)
91 /*------会员登录------*/ 93 /*------会员登录------*/
92 app.getUserFir(async function(e) { 94 app.getUserFir(async function(e) {
93 if (e != undefined && e != null && e.mobile) { 95 if (e != undefined && e != null && e.mobile) {
pages/user/order_detail/order_detail.js
@@ -522,7 +522,9 @@ Page({ @@ -522,7 +522,9 @@ Page({
522 522
523 zfwk:function(){ 523 zfwk:function(){
524 var url = "/pages/cart/cart_wk/cart_wk?order_id=" + this.data.order.order_id; 524 var url = "/pages/cart/cart_wk/cart_wk?order_id=" + this.data.order.order_id;
525 - getApp().goto(url); 525 + wx.redirectTo({
  526 + url:url,
  527 + })
526 }, 528 },
527 529
528 //--------跳转到退款详情----------- 530 //--------跳转到退款详情-----------
utils/LoadMore.js
@@ -87,7 +87,7 @@ var e = function() { @@ -87,7 +87,7 @@ var e = function() {
87 g[ii].original_img = oo.imghost + g[ii].original_img; 87 g[ii].original_img = oo.imghost + g[ii].original_img;
88 } 88 }
89 89
90 - if (g[ii].add_time != undefined){ 90 + if (g[ii].add_time != undefined && rurl.indexOf("goodscollect")<0){
91 var tx = g[ii].add_time + ""; 91 var tx = g[ii].add_time + "";
92 if (tx.indexOf('-') == -1) { 92 if (tx.indexOf('-') == -1) {
93 g[ii].add_time = ut.formatTime(g[ii].add_time, 'yyyy-MM-dd hh:mm:ss'); 93 g[ii].add_time = ut.formatTime(g[ii].add_time, 'yyyy-MM-dd hh:mm:ss');
utils/pay.js
@@ -34,7 +34,7 @@ module.exports = { @@ -34,7 +34,7 @@ module.exports = {
34 if(t.data.code==0){ 34 if(t.data.code==0){
35 i.weixinPay(t.data.data, e, a); 35 i.weixinPay(t.data.data, e, a);
36 }else{ 36 }else{
37 - getApp().showWarning(t.data.msg); 37 + getApp().confirmBox(t.data.msg);
38 setTimeout(function(){ 38 setTimeout(function(){
39 wx.redirectTo({ 39 wx.redirectTo({
40 url: "/pages/user/order_list/order_list", 40 url: "/pages/user/order_list/order_list",
@@ -62,7 +62,8 @@ module.exports = { @@ -62,7 +62,8 @@ module.exports = {
62 console.log(n), t.showSuccess("支付成功!", e); 62 console.log(n), t.showSuccess("支付成功!", e);
63 }, 63 },
64 fail: function(n) { 64 fail: function(n) {
65 - console.log(n), "requestPayment:fail" == n.errMsg ? t.showWarning("支付失败") : "requestPayment:fail cancel" == n.errMsg ? t.showWarning("您已取消支付") : t.showWarning("支付失败:" + n.errMsg.substr("requestPayment:fail ".length)), 65 + console.log(n), "requestPayment:fail" == n.errMsg ? t.showWarning("支付失败") : "requestPayment:fail cancel" == n.errMsg ? t.showWarning("您已取消支付") :
  66 + t.confirmBox("支付失败:" + n.errMsg.substr("requestPayment:fail ".length)),
66 "function" == typeof a && a(); 67 "function" == typeof a && a();
67 } 68 }
68 }); 69 });