diff --git a/app.js b/app.js
index 59fa07e..ab59cec 100644
--- a/app.js
+++ b/app.js
@@ -52,6 +52,8 @@ App({
config2: null, //门店配置
code: null,
user_id:null,// qa-6519858,//
+ // user_id:6520314,// qa-6519858,//
+ // user_id:14148118,// qa-6519858,//
buy_now: null,
picklist: null, //门店列表
wuliuprice: null, //物流价格表
@@ -1197,5 +1199,66 @@ App({
};
},
+ //跳转视频号
+ openChannelsActivity(obj){
+ if (!obj.finderUserName) {
+ wx.showToast({
+ title: '参数缺少,跳转失败',
+ duration: 2000,
+ });
+ }
+ console.log('视频号参数:')
+ console.log(obj)
+ if (obj.video_type==1) { //1是直播 2 是 视频
+ wx.getChannelsLiveInfo({
+ finderUserName:obj.finderUserName,
+ success:(res)=>{
+ let {feedId ,status,nonceId} = res
+ if (true || status == 2) {
+ wx.openChannelsLive({
+ finderUserName:obj.finderUserName,
+ feedId,
+ nonceId,
+ success:()=>{
+ console.log('进入直播间成功')
+ },
+ fail:(error)=>{
+ console.log('进入直播间失败')
+ console.log(error)
+ }
+ })
+ }
+ },
+ fail:(error)=>{
+ console.log('跳转失败1')
+ console.log(error)
+ wx.showModal({
+ title: '提示',
+ content: '获取直播失败:'+error.err_code,
+ showCancel:false,
+ success (res) {
+ if (res.confirm) {
+ console.log('用户点击确定')
+ } else if (res.cancel) {
+ console.log('用户点击取消')
+ }
+ }
+ })
+ }
+ })
+ }else{
+ wx.openChannelsActivity({
+ finderUserName:obj.finderUserName,
+ feedId:obj.feedId,
+ success:()=>{
+ console.log('跳转成功')
+ },
+ fail:(error)=>{
+ console.log('跳转失败')
+ console.log(error)
+ }
+ })
+ }
+ },
});
diff --git a/app.json b/app.json
index 25b15a6..7b545a5 100644
--- a/app.json
+++ b/app.json
@@ -22,7 +22,6 @@
"pages/user/return_goods_info/return_goods_info",
"pages/user/return_goods/return_goods",
"pages/user/express/express",
- "pages/user/get_user_info/get_user_info",
"pages/activity/seckill_list/seckill_list",
"pages/activity/pind_list/pind_list",
"pages/team/team_success/team_success",
@@ -34,12 +33,11 @@
"pages/user/userqy/userqy",
"pages/user/user_spsy/user_spsy",
- "pages/user/user_fw/user_fw",
+
"pages/user/grow_value/grow_value",
"pages/payment/pay_success/pay_success",
"pages/user/plus/plus",
"pages/user/cardinfo/cardinfo",
- "pages/user/Detailed/Detailed",
"pages/user/my_service/appment_main",
"pages/user/my_service/i_service",
"pages/user/my_service/cosmetology_list",
@@ -209,7 +207,9 @@
"root": "packageE/",
"name": "pack5",
"pages": [
- "pages/togoin/togoin"
+ "pages/togoin/togoin",
+ "pages/user/Detailed/Detailed",
+ "pages/user/user_fw/user_fw"
]
}
diff --git a/components/diy_advertising/diy_advertising.js b/components/diy_advertising/diy_advertising.js
index 91c128d..a1f66ce 100644
--- a/components/diy_advertising/diy_advertising.js
+++ b/components/diy_advertising/diy_advertising.js
@@ -43,7 +43,16 @@ Component({
var url=e.currentTarget.dataset.url;
getApp().goto(url);
},
-
+ nv_void(e){
+ var feedId=e.currentTarget.dataset.feedid;
+ var finderUserName=e.currentTarget.dataset.finderusername;
+ var video_type=e.currentTarget.dataset.video_type;
+ getApp().openChannelsActivity({
+ feedId,
+ finderUserName,
+ video_type
+ })
+ },
imageLoad:function(e){
var imgwidth = e.detail.width;
var imgheight = e.detail.height;
diff --git a/components/diy_advertising/diy_advertising.wxml b/components/diy_advertising/diy_advertising.wxml
index 9ef022d..97f2898 100644
--- a/components/diy_advertising/diy_advertising.wxml
+++ b/components/diy_advertising/diy_advertising.wxml
@@ -19,6 +19,11 @@
+
+
+
+
+
@@ -53,6 +58,11 @@
+
+
+
+
+
@@ -97,6 +107,12 @@
+
+
+
+
+
+
@@ -140,6 +156,11 @@
+
+
+
+
+
@@ -171,6 +192,12 @@
+
+
+
+
+
+
@@ -202,6 +229,11 @@
+
+
+
+
+
@@ -234,6 +266,11 @@
+
+
+
+
+
@@ -265,6 +302,11 @@
+
+
+
+
+
@@ -304,6 +346,11 @@
+
+
+
+
+
@@ -334,6 +381,11 @@
+
+
+
+
+
@@ -367,6 +419,11 @@
+
+
+
+
+
@@ -397,6 +454,11 @@
+
+
+
+
+
@@ -434,6 +496,11 @@
+
+
+
+
+
@@ -464,6 +531,11 @@
+
+
+
+
+
@@ -498,6 +570,11 @@
+
+
+
+
+
@@ -528,6 +605,11 @@
+
+
+
+
+
@@ -567,6 +649,11 @@
+
+
+
+
+
@@ -597,6 +684,11 @@
+
+
+
+
+
@@ -631,6 +723,11 @@
+
+
+
+
+
@@ -655,6 +752,11 @@
+
+
+
+
+
@@ -683,6 +785,11 @@
+
+
+
+
+
@@ -721,6 +828,14 @@
+
+
+
+
+ {{item.title}}
+
+
+
diff --git a/components/diy_goodsGroup/diy_goodsGroup.js b/components/diy_goodsGroup/diy_goodsGroup.js
index 980be53..1ee8e01 100644
--- a/components/diy_goodsGroup/diy_goodsGroup.js
+++ b/components/diy_goodsGroup/diy_goodsGroup.js
@@ -29,7 +29,8 @@ Component({
imghost: o.imghost,
is_recommend: 0,
is_hot: 0,
- is_new: 0,
+ is_new: 0,
+ isyhgoods:0,
baseUrl: "/api/weshop/goods/page",
resourceUrl: t.globalData.setting.resourceUrl,
url: t.globalData.setting.imghost,
@@ -77,7 +78,7 @@ Component({
//最新的版本才有nav_list
if (nav_list) {
- nav_item = nav_list[0];
+ nav_item = nav_list[0];
//要算一下商品goodsid
for (var ij in nav_list) {
var item = nav_list[ij];
@@ -134,6 +135,9 @@ Component({
if (nav_item && nav_item.goodsclass == 3) {
this.data.is_new = 1
}
+ if (nav_item && nav_item.goodsclass == 4) {
+ this.data.isyhgoods = 1
+ }
this.data.requestData = new Array();
this.data.g_id = nav_item.data;
@@ -225,6 +229,7 @@ Component({
if (th.data.is_recommend) r_data.is_recommend = th.data.is_recommend;
if (th.data.is_hot) r_data.is_hot = th.data.is_hot;
if (th.data.is_new) r_data.is_new = th.data.is_new;
+ if (th.data.isyhgoods) r_data.isyhgoods = th.data.isyhgoods;
var user_id = getApp().globalData.user_id;
if (!user_id) user_id = 0;
@@ -239,7 +244,7 @@ Component({
th.setData({
goods_btn: res.data.data.pageData,
total: res.data.data.total
- })
+ })
th.data.currentPage++;
//设置商品熏染
th.set_good(goods);
@@ -277,12 +282,20 @@ Component({
},
setLoading: function () {
- var that = this;
- if (this.data.loading) return false;
- this.data.loading = 1;
- that.init(that.data.classstyle_id, that.data.wgroup);
+ if(this.data.object.column==5){return}
+ if( this.data.goods_btn.length!=0 || this.data.object.goodscount*this.data.page
-
+
@@ -24,8 +24,8 @@
-
-
+
+
@@ -898,5 +898,5 @@
-
+暂无数据
\ No newline at end of file
diff --git a/components/diy_goodsGroup/diy_goodsGroup.wxss b/components/diy_goodsGroup/diy_goodsGroup.wxss
index 4c5461b..616c4bf 100644
--- a/components/diy_goodsGroup/diy_goodsGroup.wxss
+++ b/components/diy_goodsGroup/diy_goodsGroup.wxss
@@ -904,7 +904,13 @@ top: 10rpx;
.zs_goods_xiao_wai{ padding-top:1rpx }
.s1_gk_a1.list_border{ display: block; border-bottom: 1rpx solid #eee}
-
+.nodata-title {
+ padding-top: 40rpx;
+ padding-bottom: 40rpx;
+ color: #bbb;
+ font-size: 28rpx;
+ text-align: center;
+}
diff --git a/components/diy_live/diy_live.js b/components/diy_live/diy_live.js
index 2fb8f34..6c513d1 100644
--- a/components/diy_live/diy_live.js
+++ b/components/diy_live/diy_live.js
@@ -24,7 +24,8 @@ Component({
data: {
// 弹窗显示控制
showHongbao:false,
- showHongbaoSmall: false,
+ showHongbaoSmall: false,
+ imghost:getApp().globalData.setting.imghost
},
/**
diff --git a/components/diy_live/diy_live.wxml b/components/diy_live/diy_live.wxml
index 3a73ee2..ffefe69 100644
--- a/components/diy_live/diy_live.wxml
+++ b/components/diy_live/diy_live.wxml
@@ -3,7 +3,7 @@
-
+
直播
diff --git a/components/diy_nav/diy_nav.js b/components/diy_nav/diy_nav.js
index 7509b78..8e1db16 100644
--- a/components/diy_nav/diy_nav.js
+++ b/components/diy_nav/diy_nav.js
@@ -48,6 +48,18 @@ Component({
var url=e.currentTarget.dataset.url;
console.log('url==>', url);
getApp().goto(url);
+ },
+ nv_void(e){
+ console.log('导航')
+ console.log(e)
+ var feedId=e.currentTarget.dataset.feedid;
+ var finderUserName=e.currentTarget.dataset.finderusername;
+ var video_type=e.currentTarget.dataset.video_type;
+ getApp().openChannelsActivity({
+ feedId,
+ finderUserName,
+ video_type
+ })
}
}
})
\ No newline at end of file
diff --git a/components/diy_nav/diy_nav.wxml b/components/diy_nav/diy_nav.wxml
index 4ab5090..ed60f50 100644
--- a/components/diy_nav/diy_nav.wxml
+++ b/components/diy_nav/diy_nav.wxml
@@ -13,6 +13,11 @@
+
+
+
+
+
@@ -36,6 +41,11 @@
+
+
+
+
+
diff --git a/components/diy_notice/diy_notice.js b/components/diy_notice/diy_notice.js
index 16cb045..27c7776 100644
--- a/components/diy_notice/diy_notice.js
+++ b/components/diy_notice/diy_notice.js
@@ -26,5 +26,15 @@ Component({
var url=e.currentTarget.dataset.url;
getApp().goto(url);
},
+ nv_void(e){
+ var feedId=e.currentTarget.dataset.feedid;
+ var finderUserName=e.currentTarget.dataset.finderusername;
+ var video_type=e.currentTarget.dataset.video_type;
+ getApp().openChannelsActivity({
+ feedId,
+ finderUserName,
+ video_type
+ })
+ }
}
})
\ No newline at end of file
diff --git a/components/diy_notice/diy_notice.wxml b/components/diy_notice/diy_notice.wxml
index 6086942..2f45c6f 100644
--- a/components/diy_notice/diy_notice.wxml
+++ b/components/diy_notice/diy_notice.wxml
@@ -32,6 +32,20 @@
+
+
+
+
+
+
+ {{object.noticetxt}}
+ {{object.noticetxt}}
+ {{object.noticetxt}}
+
+
+
+
+
diff --git a/components/diy_picMax/diy_picMax.js b/components/diy_picMax/diy_picMax.js
index a293a74..fd3bb0e 100644
--- a/components/diy_picMax/diy_picMax.js
+++ b/components/diy_picMax/diy_picMax.js
@@ -32,7 +32,16 @@ Component({
var url = e.currentTarget.dataset.url;
getApp().goto(url);
},
-
+ nv_void(e){
+ var feedId=e.currentTarget.dataset.feedid;
+ var finderUserName=e.currentTarget.dataset.finderusername;
+ var video_type=e.currentTarget.dataset.video_type;
+ getApp().openChannelsActivity({
+ feedId,
+ finderUserName,
+ video_type
+ })
+ },
previewImage(e){
let src =e.currentTarget.dataset.src;
wx.previewImage({
diff --git a/components/diy_picMax/diy_picMax.wxml b/components/diy_picMax/diy_picMax.wxml
index 77393e1..a6b21a2 100644
--- a/components/diy_picMax/diy_picMax.wxml
+++ b/components/diy_picMax/diy_picMax.wxml
@@ -14,6 +14,10 @@
+
+
+
+
@@ -34,6 +38,10 @@
+
+
+
+
diff --git a/components/diy_title/diy_title.js b/components/diy_title/diy_title.js
index 20d76fc..cef6ad0 100644
--- a/components/diy_title/diy_title.js
+++ b/components/diy_title/diy_title.js
@@ -24,6 +24,16 @@ Component({
var txt="object.title_img";
ob[txt] = iurl +'/miniapp/images/logo.png?v=1';
this.setData(ob);
- }
+ },
+ nv_void(e){
+ var feedId=e.currentTarget.dataset.feedid;
+ var finderUserName=e.currentTarget.dataset.finderusername;
+ var video_type=e.currentTarget.dataset.video_type;
+ getApp().openChannelsActivity({
+ feedId,
+ finderUserName,
+ video_type
+ })
+ }
}
})
diff --git a/components/diy_title/diy_title.wxml b/components/diy_title/diy_title.wxml
index eba7b92..3e71532 100644
--- a/components/diy_title/diy_title.wxml
+++ b/components/diy_title/diy_title.wxml
@@ -13,6 +13,9 @@
{{object.title_name}}
+
+ {{object.title_name}}
+
{{object.title_name}}
@@ -38,6 +41,14 @@
+
+
+
+ {{object.title_right}}
+
+
+
+
diff --git a/custom-tab-bar/index.wxml b/custom-tab-bar/index.wxml
index 23f8d7f..9d3b940 100644
--- a/custom-tab-bar/index.wxml
+++ b/custom-tab-bar/index.wxml
@@ -6,7 +6,7 @@
style="color: {{active==idx?fontcolor_sele:fontcolor}};">
- {{cartGoodsNum}}
+
{{item.nav_name}}
diff --git a/images/gt.png b/images/gt.png
deleted file mode 100644
index 5e68248..0000000
--- a/images/gt.png
+++ /dev/null
diff --git a/images/share/default_g_img.gif b/images/share/default_g_img.gif
deleted file mode 100644
index fd72ed1..0000000
--- a/images/share/default_g_img.gif
+++ /dev/null
diff --git a/packageA/pages/activity_share/activity_share.js b/packageA/pages/activity_share/activity_share.js
index f954081..940e4e5 100644
--- a/packageA/pages/activity_share/activity_share.js
+++ b/packageA/pages/activity_share/activity_share.js
@@ -1203,9 +1203,17 @@ Page({
ee.data.share_goods_img = res.path;
tt();
},
- fail: function(res) {
- ee.data.share_goods_img = "../../../images/share/default_g_img.gif"; //分享的图片不能用网络的
- tt();
+ fail: function(res) {
+
+ //获取默认空白图
+ wx.getImageInfo({
+ src: ee.data.url+'/miniapp/images/default_g_img.gif',
+ success: function(res) {
+ ee.data.share_goods_img = res.path; //分享的图片不能用网络的
+ tt();
+ }
+ })
+
}
});
},
diff --git a/packageA/pages/distribution/order/order.wxml b/packageA/pages/distribution/order/order.wxml
index e54e036..a199bce 100644
--- a/packageA/pages/distribution/order/order.wxml
+++ b/packageA/pages/distribution/order/order.wxml
@@ -14,7 +14,7 @@
{{filter.status(item.status, statusArr)}}
-
+
diff --git a/packageA/pages/distribution/shop/shop.js b/packageA/pages/distribution/shop/shop.js
index f9452e5..fb36af6 100644
--- a/packageA/pages/distribution/shop/shop.js
+++ b/packageA/pages/distribution/shop/shop.js
@@ -84,6 +84,15 @@ Page({
})
// this.getData(true, '/api/weshop/users/distribut/pagemyshop', this.data.currentQuery);
}
+
+ getApp().promiseGet("/api/weshop/storeDistribut/get/"+os.stoid,{}).then(rs=>{
+ var dis=rs.data.data;
+ if( dis){
+ self.setData({storeDistribut:dis})
+ }
+ })
+
+
},
/**
@@ -318,10 +327,17 @@ Page({
* 用户点击右上角分享
*--点击分享事件--分享我的小店
*--*/
- onShareAppMessage: function (t) { getApp().globalData.no_clear=1;
+ onShareAppMessage: function (t) {
+ getApp().globalData.no_clear=1;
var th = this;
var title = "我的小店";
+
+ if(this.data.storeDistribut){
+ title=this.data.storeDistribut.distributSharetitle;
+ title+=" "+this.data.storeDistribut.distributShareremark;
+ }
+
var user_id = this.data.first_leader;
if (!user_id) {
user_id = getApp().globalData.user_id
diff --git a/packageA/pages/goodsInfo/goodsInfo.js b/packageA/pages/goodsInfo/goodsInfo.js
index b9d642a..2032b38 100644
--- a/packageA/pages/goodsInfo/goodsInfo.js
+++ b/packageA/pages/goodsInfo/goodsInfo.js
@@ -853,6 +853,13 @@ Page({
}
+ if(this.data.goodsInputNum==0){
+ getApp().my_warnning('请输入购买数量', 1, th, 450);
+ return false;
+ }
+
+
+
if(!ind) ind = t.currentTarget.dataset.openspecmodal_ind;
th.setData({
@@ -870,6 +877,8 @@ Page({
var limitNum = 0;
// 已购买数量
var boughtNum = 0;
+
+ var is_ok=1;
// 秒杀活动
if(this.data.prom_type == 1) {
@@ -895,6 +904,7 @@ Page({
// title: '超出活动库存',
// });
getApp().my_warnning('超出活动库存', 0, self);
+ is_ok=0;
return false;
} else {
// 可购买数量>0
@@ -922,8 +932,9 @@ Page({
// });
getApp().my_warnning('超出活动库存', 0, self);
th.setData({
- goodsInputNum: res,
+ goodsInputNum: res || 1
});
+ is_ok=0;
return false;
};
};
@@ -935,8 +946,9 @@ Page({
// });
getApp().my_warnning('超出限购数量', 0, self);
th.setData({
- goodsInputNum: canBuyNum,
+ goodsInputNum: canBuyNum || 1,
});
+ is_ok=0;
return false;
};
};
@@ -955,7 +967,10 @@ Page({
};
-
+ if(!is_ok) return false;
+
+
+
if(action=="buy"){
//--------------此时操作的数据------------
var newd = {
@@ -1243,7 +1258,7 @@ Page({
// });
getApp().my_warnning('超出活动库存', 0, self);
th.setData({
- goodsInputNum: res,
+ goodsInputNum: res || 1,
});
return false;
};
@@ -1256,7 +1271,7 @@ Page({
// });
getApp().my_warnning('超出限购数量', 0, self);
th.setData({
- goodsInputNum: canBuyNum,
+ goodsInputNum: canBuyNum || 1,
});
return false;
};
@@ -2444,9 +2459,15 @@ Page({
tt();
},
fail: function(res) {
+ //获取默认空白图
+ wx.getImageInfo({
+ src: ee.data.iurl+'/miniapp/images/default_g_img.gif',
+ success: function(res) {
+ ee.data.share_goods_img = res.path; //分享的图片不能用网络的
+ tt();
+ }
+ })
- ee.data.share_goods_img = "../../../images/share/default_g_img.gif"; //分享的图片不能用网络的
- tt();
}
});
},
diff --git a/packageA/pages/goods_share/goods_share.js b/packageA/pages/goods_share/goods_share.js
index a16e3d8..15f3333 100644
--- a/packageA/pages/goods_share/goods_share.js
+++ b/packageA/pages/goods_share/goods_share.js
@@ -806,8 +806,16 @@ Page({
tt();
},
fail: function(res) {
- ee.data.share_goods_img = "../../../images/share/default_g_img.gif"; //分享的图片不能用网络的
- tt();
+
+ //获取默认空白图
+ wx.getImageInfo({
+ src: ee.data.url+'/miniapp/images/default_g_img.gif',
+ success: function(res) {
+ ee.data.share_goods_img = res.path; //分享的图片不能用网络的
+ tt();
+ }
+ })
+
}
});
},
diff --git a/packageA/pages/quan_list/quan_list.js b/packageA/pages/quan_list/quan_list.js
index 3baf596..304a1dd 100644
--- a/packageA/pages/quan_list/quan_list.js
+++ b/packageA/pages/quan_list/quan_list.js
@@ -32,6 +32,9 @@ Page({
//---展示---
onShow: function () {
+ //检查能不能分享
+ getApp().check_can_share();
+
console.log("onShow:1");
this.data.curpage = 1;
this.setData({ dataList: null });
@@ -41,6 +44,8 @@ Page({
//var data = [{ is_get:0,money:50,condition:500,id:1,name: "券名字", endtype: 0, use_start_time: 1579596090, use_end_time: 1611218490, everyone_num: 2,interval_time:1,color:"red"}];
//th.setData({dataList: data});
this.setData({ getcurday: ut.gettimestamp() });
+
+
},
onHide: function () {
@@ -184,5 +189,36 @@ Page({
var index = e.currentTarget.dataset.ind;
var item = this.data.dataList[index];
getApp().goto("/packageA/pages/quan_pro/quan_pro?id=" + item.id);
- }
+ },
+
+
+ //发送给好友
+ onShareAppMessage:async function(e) {
+ getApp().globalData.no_clear=1;
+ var url= `packageA/pages/quan_list/quan_list`;
+ var userInfo = getApp().globalData.userInfo;
+ //是分销商才带
+ if (userInfo) {
+ url += "?first_leader=" + userInfo.user_id;
+ }
+ var ob = {
+ title:"优惠券列表",
+ path: url,
+ //imageUrl:this.data.url+this.data.store_config.store_logo,
+ };
+ return ob;
+ },
+
+ //发送给朋友圈
+ onShareTimeline() {
+ getApp().globalData.no_clear=1;
+ var user_id= getApp().globalData.user_id
+ return {
+ title:"优惠券列表",
+ query: 'first_leader='+user_id
+ }
+ },
+
+
+
});
diff --git a/packageA/pages/quan_pro/quan_pro.js b/packageA/pages/quan_pro/quan_pro.js
index 59d4fde..77a823f 100644
--- a/packageA/pages/quan_pro/quan_pro.js
+++ b/packageA/pages/quan_pro/quan_pro.js
@@ -44,6 +44,10 @@ Page({
//---展示,显示券的信息---
onShow: function() {
+
+ //检查能不能分享
+ getApp().check_can_share();
+
var th=this;
var user_id=getApp().globalData.user_id;
getApp().request.promiseGet("/api/weshop/prom/coupon/pageCouponList", {
@@ -170,4 +174,33 @@ Page({
show_success:0
})
},
+
+ //发送给好友
+ onShareAppMessage:async function(e) {
+ getApp().globalData.no_clear=1;
+ var url= "packageA/pages/quan_pro/quan_pro?id="+this.data.id;
+ var userInfo = getApp().globalData.userInfo;
+ //是分销商才带
+ if (userInfo) {
+ url += "&first_leader=" + userInfo.user_id;
+ }
+ var ob = {
+ title:this.data.q_data.name,
+ path: url,
+ //imageUrl:this.data.url+this.data.store_config.store_logo,
+ };
+ return ob;
+ },
+
+ //发送给朋友圈
+ onShareTimeline() {
+ getApp().globalData.no_clear=1;
+ var user_id= getApp().globalData.user_id
+ return {
+ title:this.data.q_data.name,
+ query: 'id='+this.data.id+'&first_leader='+user_id
+ }
+ },
+
+
});
diff --git a/packageA/pages/service_share/service_share.js b/packageA/pages/service_share/service_share.js
index 747fa0e..e498c8e 100644
--- a/packageA/pages/service_share/service_share.js
+++ b/packageA/pages/service_share/service_share.js
@@ -784,9 +784,15 @@ Page({
ee.data.share_goods_img = res.path;
tt();
},
- fail: function(res) {
- ee.data.share_goods_img = "../../../images/share/default_g_img.gif"; //分享的图片不能用网络的
- tt();
+ fail: function(res) {
+ //获取默认空白图
+ wx.getImageInfo({
+ src: ee.data.url+'/miniapp/images/default_g_img.gif',
+ success: function(res) {
+ ee.data.share_goods_img = res.path; //分享的图片不能用网络的
+ tt();
+ }
+ })
}
});
},
diff --git a/packageB/pages/zuhegou/index/index.js b/packageB/pages/zuhegou/index/index.js
index 8e81cd1..dcc4b7f 100644
--- a/packageB/pages/zuhegou/index/index.js
+++ b/packageB/pages/zuhegou/index/index.js
@@ -116,7 +116,9 @@ Page({
sort_store: 0, //门店分类
choice_sort_store: 0, //选择分类门店
fir_pick_index: 0, //门店选择的下标
- sec_pick_index: 0 //门店选择的下标,地区选择之后的内页
+ sec_pick_index: 0, //门店选择的下标,地区选择之后的内页
+
+ sales_map:{}, //线下销售的map
},
/**
@@ -311,7 +313,6 @@ Page({
getApp().getConfig2(function (e) {
ee.setData({
bconfig: e,
- sales_rules: e.sales_rules,
});
//设置基本参数
th.wait_for_store_config(e);
@@ -357,12 +358,17 @@ Page({
}
}
//获取购物车的内容
- th.get_cart_val(e);
+ setTimeout(function(){
+ th.get_cart_val(e);
+ },1000)
+
})
} else {
//获取购物车的内容
- th.get_cart_val(e);
+ setTimeout(function(){
+ th.get_cart_val(e);
+ },1000)
}
}, 1);
@@ -533,6 +539,9 @@ Page({
//说明是加入购物车是时候
this.data.is_zuhe_addcart = 1;
if (!haveAdded) {
+
+
+
th.data.sele_g = this.data.list[index];
if (!th.data.sele_g.num) th.data.goodsInputNum = 1;
@@ -567,11 +576,14 @@ Page({
}
return false;
} else {
- th.setData({
- is_no_pipei: 0
- });
- th.check_is_in_cart(function () {
- th.add_cart_func();
+ //先判断一下线下库存
+ th.check_pk_store_conut(function(){
+ th.setData({
+ is_no_pipei: 0
+ });
+ th.check_is_in_cart(function () {
+ th.add_cart_func();
+ })
})
}
} else {
@@ -648,6 +660,110 @@ Page({
},
+ //在启用线下的时候,要判断一下是不是有库存
+ async check_pk_store_conut(func,is_no_msg,gd,by_num){
+ var th=this;
+ if(this.data.sales_rules!=2){
+ if(func) func();
+ return false;
+ }
+ //门店库存no
+ var pkno= gd && gd.pickup_no?gd.pickup_no:this.data.def_pick_store.pickup_no;
+ var pickup_id=gd && gd.pick_id?gd.pick_id:this.data.def_pick_store.pickup_id;
+ var lock = [];
+ var plist=null;
+ var good=gd || th.data.sele_g;
+ var buy_num=by_num || th.data.goodsInputNum;
+
+ if(this.data.sales_map[good.goods_id]){
+
+ var mp=this.data.sales_map[good.goods_id];
+ var lock_num=mp.lock_num;
+ var CanOutQty=mp.CanOutQty;
+ if (CanOutQty < lock_num +buy_num) {
+
+ if(!is_no_msg) {
+ wx.showToast({
+ title: "门店库存不足",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ return false;
+ }
+ if(is_no_msg) return true;
+ func();
+
+ }else {
+ //先读取门店的lock,采用链式写法,少用await
+ await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", {
+ data: {store_id: os.stoid, wareId: good.goods_id, pageSize: 1000}
+ }).then(res => {
+ if (res.data.code == 0 && res.data.data.total > 0) {
+ lock = res.data.data.pageData
+ }
+
+ })
+ //---通过接口获取门店的线下库存信息--
+ await getApp().request.promiseGet("/api/weshop/goods/getWareStorages", {
+ data: {
+ storageNos: pkno,
+ wareIds: encodeURIComponent(good.erpwareid),
+ storeId: os.stoid,
+ pageSize: 2000
+ }
+ }).then(res => {
+ if (ut.ajax_ok(res)) {
+ plist = res.data.data.pageData[0];
+ }
+ })
+
+ if(!plist){
+ if(!is_no_msg) {
+ wx.showToast({
+ title: "该商品在门店未找到库存",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ return false;
+ }
+
+ var lock_num = th.find_lock_num(pickup_id, lock);
+ this.data.sales_map[good.goods_id]={
+ CanOutQty:plist.CanOutQty,
+ lock_num:lock_num
+ }
+
+ if (plist.CanOutQty < lock_num + buy_num) {
+ if(!is_no_msg) {
+ wx.showToast({
+ title: "该商品在门店未找到库存",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ return false;
+ }
+ if(is_no_msg) return true;
+ func();
+ }
+
+ },
+
+ find_lock_num(pick_id, lock) {
+ var lock_num = 0;
+ if (!lock) return 0;
+ if (lock.length < 0) return 0;
+ for (var i in lock) {
+ if (pick_id == lock[i].pickupId) {
+ lock_num += lock[i].outQty;
+ }
+ }
+ return lock_num;
+ },
+
+
/**
* 增加数量
*/
@@ -664,13 +780,17 @@ Page({
this.data.changing = 1;
var index = e.currentTarget.dataset.index;
- this.data.sele_g = this.data.list[index];
+ this.data.sele_g = th.data.list[index];
this.data.sele_index = index;
- th.data.goodsInputNum = this.data.sele_g.num + 1;
- if (this.data.sele_g.cart_num) {
- th.data.s_cart_num = this.data.sele_g.cart_num + 1;
- }
- th.add_cart_func();
+ th.data.goodsInputNum = th.data.sele_g.num + 1;
+
+ th.check_pk_store_conut(function(){
+ if (th.data.sele_g.cart_num) {
+ th.data.s_cart_num = th.data.sele_g.cart_num + 1;
+ }
+ th.add_cart_func();
+ })
+
},
/**
@@ -1581,11 +1701,19 @@ Page({
//只是单纯的选择门店
if (this.data.only) {
this.data.only = 0;
+ this.data.sales_map={};
+
return false;
}
- th.check_is_in_cart(function () {
- th.add_cart_func();
+
+ //-- 判断一下库存 --
+ th.check_pk_store_conut(function(){
+ th.check_is_in_cart(function () {
+ th.add_cart_func();
+ })
})
+
+
},
@@ -2116,17 +2244,23 @@ Page({
getApp().request.get("/api/weshop/cart/list", {
data: req,
success: async function (e) {
- if (e.data.code == 0 && e.data.data && e.data.data.pageData && e.data.data.pageData.length) {
+ if(ut.ajax_ok(e)) {
var map = {};
var mlist = e.data.data.pageData;
th.data.cart_list = mlist;
-
for (let i in mlist) {
let item = mlist[i];
if (item.prom_type != 7) continue;
if (item.prom_id != th.data.act.id) continue;
+ if(th.data.def_pick_store && th.data.def_pick_store.pickup_id){
+ if(item.pick_id!=th.data.def_pick_store.pickup_id){
+ continue;
+ }
+ }
map[item.goods_id] = item;
}
+
+ //-- 循环活动的从表 --
for (let j in th.data.list) {
let item_j = th.data.list[j];
item_j.current_price = item_j.shop_price;
@@ -2144,6 +2278,16 @@ Page({
if (map[item_j.goods_id]) {
var cart_num = map[item_j.goods_id].goods_num;
item_j.num = cart_num;
+ item_j.pickup_no = map[item_j.goods_id].pickup_no;
+ item_j.pick_id = map[item_j.goods_id].pick_id;
+
+ //判断库存是不是存在
+ var can_qty=await th.check_pk_store_conut(null,1,item_j,cart_num);
+ if(!can_qty){
+ item_j.num=0;
+ continue;
+ }
+
item_j.cart_num = cart_num;
item_j.cart_id = map[item_j.goods_id].id;
if (item_j.buyqty > 0) {
diff --git a/packageC/pages/goods/distributionCategoryList/index.js b/packageC/pages/goods/distributionCategoryList/index.js
index bce472c..13e3a79 100644
--- a/packageC/pages/goods/distributionCategoryList/index.js
+++ b/packageC/pages/goods/distributionCategoryList/index.js
@@ -143,9 +143,9 @@ Page({
that.setData({ store_config: e, is_do: 1 });
//---有勾品类---
- if (that.data.is_show_pl) {
- that.getGoodsCategoris();
- }
+ //if (that.data.is_show_pl) {
+ // that.getGoodsCategoris();
+ //}
if (that.data.is_show_gb != 1 && that.data.is_show_pp != 1 && that.data.is_show_pl) {
that.data.pl_timer = setInterval(function () {
if (that.data.catelist.length > 0) {
@@ -521,6 +521,7 @@ Page({
let { currentData } = this.data;
currentData.cat_id = this.data.cat_id;
currentData.page = this.data.stylePage;
+ currentData.parent_id = 0;
let url = '/api/weshop/users/distribut/pagemyshop';
getApp().promiseGet(url, {
diff --git a/packageC/pages/goods/distributionCategoryList/index.wxml b/packageC/pages/goods/distributionCategoryList/index.wxml
index ad0d7cb..f34a559 100644
--- a/packageC/pages/goods/distributionCategoryList/index.wxml
+++ b/packageC/pages/goods/distributionCategoryList/index.wxml
@@ -33,7 +33,8 @@
-
+
{{item.name}}
diff --git a/packageC/pages/luckyGo/luckyGo_details/luckyGo_details.js b/packageC/pages/luckyGo/luckyGo_details/luckyGo_details.js
index 4b14fcc..cf05702 100644
--- a/packageC/pages/luckyGo/luckyGo_details/luckyGo_details.js
+++ b/packageC/pages/luckyGo/luckyGo_details/luckyGo_details.js
@@ -952,8 +952,14 @@ Page({
tt();
},
fail: function (res) {
- ee.data.share_img_localpath= "../../../../images/share/default_g_img.gif"; //分享的图片不能用网络的
- tt();
+ //获取默认空白图
+ wx.getImageInfo({
+ src: os.imghost+'/miniapp/images/default_g_img.gif',
+ success: function(res) {
+ ee.data.share_img_localpath = res.path; //分享的图片不能用网络的
+ tt();
+ }
+ })
}
});
},
diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
index 7b03c7e..65d3955 100644
--- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
+++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
@@ -317,6 +317,39 @@ Page({
//检查测肤
getApp().check_skin_face(t,0,gid);
+ //-- 自定义海报 --
+ getApp().request.promiseGet("/api/weshop/goods/poster/page", {
+ data: {store_id: os.stoid, type: 1, is_use: 1}
+ }).then(res => {
+ if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData[0]) {
+
+ var poster_data = res.data.data.pageData[0];
+ var json_str = poster_data.jsonStr;
+
+ if (json_str) {
+ var json_data = JSON.parse(json_str);
+ console.log('自定义海报参数-------');
+ console.log(json_data);
+ if (json_data.bg_img) {
+
+ //-- 把图片那到本地 --
+ wx.getImageInfo({
+ src: json_data.bg_img,
+ success: function (res) {
+ var path = res.path;
+
+ th.setData({share_b_img: path})
+ },
+ fail: function (res) {
+ }
+ });
+ }
+ th.setData({poster: json_data})
+
+ }
+ }
+ })
+
//---获取手机地址坐标--
//--如果tg_id是空的话,分享回来--
// console.log('扫描海报gid');
@@ -714,7 +747,7 @@ Page({
data: {
store_id: os.stoid,
type: 1,
- pageSize: 3,
+ pageSize: 100,
page: 1,
is_share: 0,
},
@@ -722,7 +755,24 @@ Page({
fir_quan = res1.data.data.pageData;
})
}
-
+ //过滤不是本商品的单品优惠券-------------------
+ if(fir_quan.length > 0 ){
+ let goodInfo = ee.data.data
+ for (let index = fir_quan.length-1; index >= 0; index--) {
+ if (fir_quan[index].useobjecttype==20) { //判断是单品优惠券
+ if (fir_quan[index].useobjectno != goodInfo.goods_sn) {
+ fir_quan.splice(index,1)
+ }
+ }
+ }
+ }
+ let arr=[]
+ let length = fir_quan.length
+ if (length <= 3) {
+ arr=fir_quan
+ }else{
+ arr=fir_quan.splice(0,3);
+ }
//--------获取视频图片---------
await getApp().request.promiseGet("/api/weshop/goodsVideos/get/" + os.stoid + "/" + ee.data.gid, {
1: 1
@@ -748,7 +798,7 @@ Page({
is_collect: is_collect,
collect_id: collect_id,
categories3: categories3,
- fir_quan: fir_quan,
+ fir_quan: arr,
fir_comments: fir_com,
mapurl_f_img: mapurl_f_img,
mapurl: mapurl,
@@ -4450,7 +4500,18 @@ Page({
wx.hideLoading();
quan_list = res.data.data.pageData;
})
-
+ //过滤不是本商品的单品优惠券
+ if (quan_list.length > 0) {
+ let goodInfo = th.data.data
+ for (let index = quan_list.length-1; index >= 0; index--) {
+ if (quan_list[index].useobjecttype==20) { //判断是单品优惠券
+ if (quan_list[index].useobjectno != goodInfo.goods_sn) {
+ quan_list.splice(index,1)
+ }
+ }
+ }
+ }
+ //------------------------
if (quan_list) {
for (var ind in quan_list) {
var ep = quan_list[ind];
@@ -4620,7 +4681,7 @@ Page({
// 8.商品标题
context.setFontSize(20 * unit);
context.setFillStyle('#898989');
- this.draw_Text(context, this.data.data.goods_name,
+ getApp().draw_Text(context, this.data.data.goods_name,
54 * unit, 770 * unit, 240 * unit, 240 * unit, unit);
// 9.小程序码
context.drawImage(vpath, 375 * unit, 660 * unit, 120 * unit, 120 * unit);
@@ -4717,7 +4778,7 @@ Page({
// context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit);
- if (type == 0) { // 如果是普通商品,绘制新海报
+ if (!th.data.share_b_img && (type == 9)) { // 如果是普通商品,绘制新海报
th.drawPoster(context, unit, th.data.share_goods_img, vpath);
} else {
context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit);
@@ -4727,7 +4788,7 @@ Page({
//-- 是自定义海报的情况下 --
- if (type != 0) {
+ if (th.data.share_b_img || type != 0) {
@@ -4758,10 +4819,10 @@ Page({
}
} else {
//--昵称---
- context.setFontSize(24 * unit);
- context.setFillStyle("black");
- context.fillText(app.globalData.userInfo.nickname, 152 * unit, 60 * unit);
- var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit;
+ // context.setFontSize(24 * unit);
+ // context.setFillStyle("black");
+ // context.fillText(app.globalData.userInfo.nickname, 152 * unit, 60 * unit);
+ // var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit;
//强烈推荐 改许程
// var tj_path = "../../../../images/share/q_tj.png";
// let txt_gn = th.data.luckGoInfo.group_num + '人团';
@@ -4772,9 +4833,9 @@ Page({
// context.setFillStyle("white");
// context.fillText(txt_gn, 149 * unit + width + 15 * unit, 75 * unit);
// 发出幸运购活动邀请
- context.setFillStyle("#7f7f7f")
- context.setFontSize(21.3 * unit)
- context.fillText("向您发出幸运购邀请", 152 * unit, 90 * unit);
+ // context.setFillStyle("#7f7f7f")
+ // context.setFontSize(21.3 * unit)
+ // context.fillText("向您发出幸运购邀请", 152 * unit, 90 * unit);
}
@@ -4791,7 +4852,7 @@ Page({
//---产品名称---
//文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度
- if (type != 4 && type != 0) {
+ if (th.data.share_b_img || (type != 4 && type != 9)) {
context.setFillStyle("black");
context.setFontSize(21.3 * unit)
th.draw_Text(context, share_title,
@@ -4852,11 +4913,29 @@ Page({
}
//---中间大图---
- if (type != 0) {
+ if ( th.data.share_b_img || type != 9) {
context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit);
};
+ //---自定义海报 产品质量保证
+ if(th.data.share_b_img && th.data.poster.show_quality==1 ){
+ var g_path = "../../../../images/share/s_gou.png";
+ context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit);
+ context.setFillStyle("red")
+ context.setFontSize(18 * unit)
+ context.fillText("正品保证", 84 * unit, 690 * unit);
+
+ context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit);
+ context.setFillStyle("red")
+ context.setFontSize(18 * unit)
+ context.fillText("纯实体店", 246 * unit, 690 * unit);
+ context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit);
+ context.setFillStyle("red")
+ context.setFontSize(18 * unit)
+ context.fillText("官方验证", 420 * unit, 690 * unit);
+
+ }
//-------大图后面就不一样了-----------
switch (type) {
@@ -5073,74 +5152,76 @@ Page({
case 9:
+ if(th.data.share_b_img){
- //---画线---
- context.setLineWidth(1 * unit)
- context.moveTo(32 * unit, 680 * unit)
- context.lineTo(520 * unit, 680 * unit)
- context.stroke();
-
- //---文字---
- context.setFillStyle("black")
- context.setFontSize(24 * unit)
- context.font = 'normal bold 18px';
- context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit);
-
- //还差N人,即可成团
- let group_num = th.data.luckGoInfo.group_num;
- let num_joined = th.data.luckGoInfo.num;
- let delta1 = group_num - num_joined;
- let width_delta1 = ut.measureText(delta1, 15);
- context.setFillStyle("black");
- context.setFontSize(21.3 * unit);
- context.fillText(group_num + "人团,还差", 40 * unit, 772 * unit);
- context.setFillStyle("#FF6768");
- context.setFontSize(21.3 * unit);
- context.fillText(delta1, 160 * unit, 772 * unit);
- context.setFillStyle("black");
- context.setFontSize(21.3 * unit);
- context.fillText("人,即可成团", (170 + width_delta1) * unit, 772 * unit);
-
- // N人得商品,N人全额退款
- let group_win = th.data.luckGoInfo.group_win;
- let delta2 = group_num - group_win;
- let width_delta2 = ut.measureText(delta2, 16);
- let width_groupNum = ut.measureText(group_num, 15);
- let width_groupWin = ut.measureText(group_win, 15);
- context.setFillStyle("#FF6768");
- context.setFontSize(21.3 * unit);
- context.fillText(group_win, 40 * unit, 806 * unit);
- context.setFillStyle("black");
- context.setFontSize(21.3 * unit);
- context.fillText("人得商品,", (54 + width_groupWin) * unit, 806 * unit);
- context.setFillStyle("#FF6768");
- context.setFontSize(21.3 * unit);
- context.fillText(delta2, 160 * unit, 806 * unit);
- context.setFillStyle("black");
- context.setFontSize(21.3 * unit);
- context.fillText("人全额退款", (170 + width_delta2) * unit, 806 * unit);
-
- // 并得帮团惊喜礼品
- context.setFillStyle("black")
- context.setFontSize(21.3 * unit)
- context.fillText("并得帮团", 40 * unit, 840 * unit);
- context.setFillStyle("#FF6768")
- context.setFontSize(21.3 * unit)
- context.fillText("惊喜礼品", 130 * unit, 840 * unit);
- context.setFillStyle("black")
- context.setFontSize(21.3 * unit)
- context.fillText("!", 220 * unit, 840 * unit);
+
+ //---画线---
+ context.setLineWidth(1 * unit)
+ context.moveTo(32 * unit, 680 * unit)
+ context.lineTo(520 * unit, 680 * unit)
+ context.stroke();
+ //---文字---
+ context.setFillStyle("black")
+ context.setFontSize(24 * unit)
+ context.font = 'normal bold 18px';
+ context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit);
+
+ //还差N人,即可成团
+ let group_num = th.data.luckGoInfo.group_num;
+ let num_joined = th.data.luckGoInfo.num;
+ let delta1 = group_num - num_joined;
+ let width_delta1 = ut.measureText(delta1, 15);
+ context.setFillStyle("black");
+ context.setFontSize(21.3 * unit);
+ context.fillText(group_num + "人团,还差", 40 * unit, 772 * unit);
+ context.setFillStyle("#FF6768");
+ context.setFontSize(21.3 * unit);
+ context.fillText(delta1, 160 * unit, 772 * unit);
+ context.setFillStyle("black");
+ context.setFontSize(21.3 * unit);
+ context.fillText("人,即可成团", (170 + width_delta1) * unit, 772 * unit);
+
+ // N人得商品,N人全额退款
+ let group_win = th.data.luckGoInfo.group_win;
+ let delta2 = group_num - group_win;
+ let width_delta2 = ut.measureText(delta2, 16);
+ let width_groupNum = ut.measureText(group_num, 15);
+ let width_groupWin = ut.measureText(group_win, 15);
+ context.setFillStyle("#FF6768");
+ context.setFontSize(21.3 * unit);
+ context.fillText(group_win, 40 * unit, 806 * unit);
+ context.setFillStyle("black");
+ context.setFontSize(21.3 * unit);
+ context.fillText("人得商品,", (54 + width_groupWin) * unit, 806 * unit);
+ context.setFillStyle("#FF6768");
+ context.setFontSize(21.3 * unit);
+ context.fillText(delta2, 160 * unit, 806 * unit);
+ context.setFillStyle("black");
+ context.setFontSize(21.3 * unit);
+ context.fillText("人全额退款", (170 + width_delta2) * unit, 806 * unit);
+
+ // 并得帮团惊喜礼品
+ context.setFillStyle("black")
+ context.setFontSize(21.3 * unit)
+ context.fillText("并得帮团", 40 * unit, 840 * unit);
+ context.setFillStyle("#FF6768")
+ context.setFontSize(21.3 * unit)
+ context.fillText("惊喜礼品", 130 * unit, 840 * unit);
+ context.setFillStyle("black")
+ context.setFontSize(21.3 * unit)
+ context.fillText("!", 220 * unit, 840 * unit);
+ }
//---二维吗图---
//-- 自定义海报 --
- if (th.data.poster) {
+ if (th.data.share_b_img && th.data.poster) {
var erm_x = parseFloat(th.data.poster.ewm_x) * 2;
var erm_y = parseFloat(th.data.poster.ewm_y) * 2;
context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit);
} else {
//---二维吗图---
- context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit);
+ // context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit);
}
break;
@@ -5150,7 +5231,7 @@ Page({
//--- 如果是自定义海报的时候 ---
- if (type != 0) {
+ if ( th.data.share_b_img || type != 9) {
if (th.data.poster && parseInt(th.data.poster.style) == 2) {
@@ -5324,7 +5405,7 @@ Page({
- //--获取头像的本地缓存,回调写法--
+ //--获取头像的本地缓存,回调写法--
get_head_temp: function (tt, func) {
var ee = this;
if (ee.data.share_head) {
@@ -5375,8 +5456,14 @@ Page({
tt();
},
fail: function (res) {
- ee.data.share_goods_img = "../../../../images/share/default_g_img.gif"; //分享的图片不能用网络的
- tt();
+ //获取默认空白图
+ wx.getImageInfo({
+ src: ee.data.iurl+'/miniapp/images/default_g_img.gif',
+ success: function(res) {
+ ee.data.share_goods_img = res.path; //分享的图片不能用网络的
+ tt();
+ }
+ })
}
});
},
diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml
index ba1fc77..2ea6553 100644
--- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml
+++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml
@@ -899,7 +899,7 @@
- {{cartGoodsNum}}
+
购物车
diff --git a/packageC/pages/presell/goodsInfo/goodsInfo.js b/packageC/pages/presell/goodsInfo/goodsInfo.js
index 357861e..32ff65a 100644
--- a/packageC/pages/presell/goodsInfo/goodsInfo.js
+++ b/packageC/pages/presell/goodsInfo/goodsInfo.js
@@ -7,7 +7,7 @@ var ut = require("../../../../utils/util.js"),
oo = s.globalData,
o = s.globalData.setting,
os = o;
-//评价加载更多
+//评价加载更多
var more = function (e) {
return e && e.__esModule ? e : {
default: e
@@ -250,13 +250,13 @@ Page({
share_hidden: false,
pre_arr: null,
-
- hiddenCS: true,
+
+ hiddenCS: true,
},
//------初始化加载----------
onLoad: function (t) {
- self = this;
+ self = this;
var ee = this, that = ee, th = ee,
pre_id = t.pre_id,
gid = t.goods_id,
@@ -264,8 +264,8 @@ Page({
first_leader = t.first_leader,
room_id = t.room_id,
room_user_share = t.room_user_share; //如果是会员分享带有room_id的话,那么接下来会员分享就不传room_id
- //检查测肤
- getApp().check_skin_face(t,0,gid);
+ //检查测肤
+ getApp().check_skin_face(t, 0, gid);
//-- 自定义海报 --
getApp().request.promiseGet("/api/weshop/goods/poster/page", {
@@ -314,7 +314,7 @@ Page({
}
this.setData({
- gid:gid,pre_id:pre_id,presell_id:presell_id
+ gid: gid, pre_id: pre_id, presell_id: presell_id
})
if (first_leader) {
@@ -561,7 +561,7 @@ Page({
data: {
store_id: os.stoid,
type: 1,
- pageSize: 3,
+ pageSize: 100,
page: 1,
is_share: 0,
},
@@ -569,7 +569,24 @@ Page({
fir_quan = res1.data.data.pageData;
})
}
-
+ //过滤不是本商品的单品优惠券-------------------
+ if (fir_quan.length > 0) {
+ let goodInfo = ee.data.data || {}
+ for (let index = fir_quan.length - 1; index >= 0; index--) {
+ if (fir_quan[index].useobjecttype == 20) { //判断是单品优惠券
+ if (fir_quan[index].useobjectno != goodInfo.goods_sn) {
+ fir_quan.splice(index, 1)
+ }
+ }
+ }
+ }
+ let arr = []
+ let length = fir_quan.length
+ if (length <= 3) {
+ arr = fir_quan
+ } else {
+ arr = fir_quan.splice(0, 3);
+ }
//--------获取视频图片---------
await getApp().request.promiseGet("/api/weshop/goodsVideos/get/" + os.stoid + "/" + ee.data.gid, {
1: 1
@@ -587,7 +604,7 @@ Page({
is_collect: is_collect,
collect_id: collect_id,
categories3: categories3,
- fir_quan: fir_quan,
+ fir_quan: arr,
fir_comments: fir_com,
mapurl_f_img: mapurl_f_img,
mapurl: mapurl,
@@ -597,7 +614,7 @@ Page({
//---展示---
onShow: function () {
- getApp().check_can_share();
+ getApp().check_can_share();
var goods_list = null, th = this, that = this;
//-- 如果是预览图片,页面不重新更新 --
@@ -672,8 +689,8 @@ Page({
//-- 把商品的赋值 --
ee.data.fir_goods = JSON.parse(JSON.stringify(t.data.data));
- ee.data.sele_g_id=t.data.data.goods_id;
- ee.data.sele_g=t.data.data;
+ ee.data.sele_g_id = t.data.data.goods_id;
+ ee.data.sele_g = t.data.data;
//获取用户的默认门店
getApp().get_user_store(function (e) {
@@ -681,7 +698,7 @@ Page({
th.data.fir_def_store = {}; //赋值空对象
return false;
}
- if(getApp().globalData.is_dj_pk) th.setData({has_def:1})
+ if (getApp().globalData.is_dj_pk) th.setData({ has_def: 1 })
var ee = JSON.parse(JSON.stringify(e));
@@ -1045,7 +1062,7 @@ Page({
newd.goods_price = th.data.prom_price;
newd.member_goods_price = th.data.prom_price,
- newd.prom_type = 8;
+ newd.prom_type = 8;
newd.prom_id = o.prom_id;
if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);
@@ -1084,8 +1101,8 @@ Page({
return s.my_warnning("库存不足!", 0, th);
}
- if (item.goods_num + th.data.goodsInputNum >th.data.pre_arr.presell_sumqty-th.data.pre_arr.buy_goodnum) {
- return s.my_warnning("库存不足!", 0, th);
+ if (item.goods_num + th.data.goodsInputNum > th.data.pre_arr.presell_sumqty - th.data.pre_arr.buy_goodnum) {
+ return s.my_warnning("库存不足!", 0, th);
}
var updata = {
@@ -1156,10 +1173,10 @@ Page({
app.set_b_now(e);
//如果是全额付款的话
- if(this.data.presellForm.presell_type==1){
- getApp().goto("/packageC/pages/presell/cart/cart2")
- }else{
- getApp().goto("/packageC/pages/presell/cart/cart2_pre");
+ if (this.data.presellForm.presell_type == 1) {
+ getApp().goto("/packageC/pages/presell/cart/cart2")
+ } else {
+ getApp().goto("/packageC/pages/presell/cart/cart2_pre");
}
},
@@ -1213,8 +1230,8 @@ Page({
}
var e = th.data.sele_g.store_count;
- var e2=th.data.pre_arr.presell_sumqty-th.data.pre_arr.buy_goodnum;
- if(e2 {
+ getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + th.data.sele_g.goods_id + "/0" + "/" + getApp().globalData.user_id, {}).then(res => {
if (res.data.code == 0) {
var r_data = res.data.data;
th.data.prom_goods = r_data.promGoodsLists;
@@ -1444,38 +1461,38 @@ Page({
contactService: function () {
getApp().com_call(this);
},
-
- // 获取客服电话
- getTel() {
- return new Promise((resolve, reject) => {
- s.getConfig(function (t) {
- if (t.store_tel == undefined) {
- getApp().request.get("/api/weshop/store/get/" + os.stoid, {
- isShowLoading: 1,
- data: {},
- success: function (rs) {
- getApp().globalData.config = rs.data.data;
- if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) {
- getApp().my_warnning("商家未设置电话", 0, th);
- return false;
- }
- self.setData({
- store_tel: rs.data.data.store_tel,
- });
- // s.confirmBox("请联系客服:" + rs.data.data.store_tel);
- }
- })
- } else {
- self.setData({
- store_tel: t.store_tel,
- });
- // s.confirmBox("请联系客服:" + t.store_tel);
- };
- resolve();
- });
- });
- },
-
+
+ // 获取客服电话
+ getTel() {
+ return new Promise((resolve, reject) => {
+ s.getConfig(function (t) {
+ if (t.store_tel == undefined) {
+ getApp().request.get("/api/weshop/store/get/" + os.stoid, {
+ isShowLoading: 1,
+ data: {},
+ success: function (rs) {
+ getApp().globalData.config = rs.data.data;
+ if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) {
+ getApp().my_warnning("商家未设置电话", 0, th);
+ return false;
+ }
+ self.setData({
+ store_tel: rs.data.data.store_tel,
+ });
+ // s.confirmBox("请联系客服:" + rs.data.data.store_tel);
+ }
+ })
+ } else {
+ self.setData({
+ store_tel: t.store_tel,
+ });
+ // s.confirmBox("请联系客服:" + t.store_tel);
+ };
+ resolve();
+ });
+ });
+ },
+
//-------获取购物车数量----------
requestCardNum: function () {
var t = this;
@@ -1515,7 +1532,7 @@ Page({
b[i] = this.data.iurl + e[i];
}
this.data.show_prew_img = 1;
- getApp().pre_img2(b,t)
+ getApp().pre_img2(b, t)
},
@@ -1526,16 +1543,16 @@ Page({
b[i] = this.data.iurl + e[i];
}
this.data.show_prew_img = 1;
- getApp().pre_img2(b,t)
+ getApp().pre_img2(b, t)
},
previewGoodsCommentImgs: function (t) {
var e = this,
a = this.data.data.comment[t.currentTarget.dataset.cidx].img;
- getApp().globalData.no_clear=1;
+ getApp().globalData.no_clear = 1;
a = a.map(function (t) {
return e.data.url + t;
- }), getApp().pre_img2(a,t);
+ }), getApp().pre_img2(a, t);
this.data.show_prew_img = 1;
},
closePromModal: function () {
@@ -1550,19 +1567,20 @@ Page({
},
//--点击分享事件---
- onShareAppMessage: function (t) { getApp().globalData.no_clear=1;
+ onShareAppMessage: function (t) {
+ getApp().globalData.no_clear = 1;
var th = this;
- var price = th.data.pre_arr.presell_price;
+ var price = th.data.pre_arr.presell_price;
var img = th.data.data.original_img;
- var title = th.data.presellForm.share_title;
+ var title = th.data.presellForm.share_title;
if (!title) title = th.data.prom_act.title;
if (th.data.prom_type == 4) title = th.data.prom_act.name;
//if (th.data.presellForm.share_img)
// img = th.data.iurl + th.data.presellForm.share_img;
- var url = "/packageC/pages/presell/goodsInfo/goodsInfo?goods_id=" + th.data.gid+"&pre_id="+th.data.pre_arr.id;
+ var url = "/packageC/pages/presell/goodsInfo/goodsInfo?goods_id=" + th.data.gid + "&pre_id=" + th.data.pre_arr.id;
if (getApp().globalData.user_id) {
url += "&first_leader=" + getApp().globalData.user_id;
}
@@ -1580,13 +1598,13 @@ Page({
path: url,
imageUrl: img,
};
-
+
ob.title += '\n' + th.data.presellForm.share_remark;
-
-
- console.log(ob,888);
-
+
+ console.log(ob, 888);
+
+
return ob;
},
@@ -1609,22 +1627,22 @@ Page({
//----------装载同一活动中的商品----------
async get_sku(stoid, gd, g_id, is_normal, func) {
- var tt = this, arrdata = null;
- var now = ut.gettimestamp();
- var rq_data={
- store_id: o.stoid,
- sku: gd.sku,
- more_spec: gd.more_spec,
- isonsale: 1,
- is_on_sale: 1,
- pageSize: 500,
- orderField: 'gg_ordid,goods_spec,sort',
- prom_type: 8,
- };
+ var tt = this, arrdata = null;
+ var now = ut.gettimestamp();
+ var rq_data = {
+ store_id: o.stoid,
+ sku: gd.sku,
+ more_spec: gd.more_spec,
+ isonsale: 1,
+ is_on_sale: 1,
+ pageSize: 500,
+ orderField: 'gg_ordid,goods_spec,sort',
+ prom_type: 8,
+ };
- if(tt.data.presellForm && tt.data.presellForm.id){
- rq_data.prom_id=tt.data.presellForm.id;
- }
+ if (tt.data.presellForm && tt.data.presellForm.id) {
+ rq_data.prom_id = tt.data.presellForm.id;
+ }
await getApp().request.promiseGet("/api/weshop/goods/page", {
data: rq_data
@@ -1755,31 +1773,31 @@ Page({
//选择了不同的规格的时候要判断是不是有活动正在进行中
async sele_spec_chech_activity() {
- var prom = null, goodsinfo = this.data.sele_g, th = this;
-
- var all_pre_goods=th.data.all_pre_goods;
- if(all_pre_goods){
- var userInfo = getApp().globalData.userInfo;
- var pre_data = { store_id: os.stoid, is_end: 0, timetype: 1, isuse: 1, goods_id: th.data.gid };
- if (userInfo) {
- pre_data.user_id = userInfo.user_id;
- }
- await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/page", {
- data: pre_data,
- }).then(e => {
- if (e.data.code == 0 && e.data.data.pageData && e.data.data.pageData.length > 0) {
- all_pre_goods=e.data.data.pageData;
- th.data.all_pre_goods=e.data.data.pageData;
- }
- })
+ var prom = null, goodsinfo = this.data.sele_g, th = this;
+
+ var all_pre_goods = th.data.all_pre_goods;
+ if (all_pre_goods) {
+ var userInfo = getApp().globalData.userInfo;
+ var pre_data = { store_id: os.stoid, is_end: 0, timetype: 1, isuse: 1, goods_id: th.data.gid };
+ if (userInfo) {
+ pre_data.user_id = userInfo.user_id;
}
-
- var idx=all_pre_goods.findIndex(function (ele) {
- return ele.goods_id==goodsinfo.goods_id;
+ await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/page", {
+ data: pre_data,
+ }).then(e => {
+ if (e.data.code == 0 && e.data.data.pageData && e.data.data.pageData.length > 0) {
+ all_pre_goods = e.data.data.pageData;
+ th.data.all_pre_goods = e.data.data.pageData;
+ }
})
- var pre_arr =all_pre_goods[idx];
- th.setData({ pre_arr: pre_arr })
- th.data.prom_buy_limit=pre_arr.vip_butyqty;
+ }
+
+ var idx = all_pre_goods.findIndex(function (ele) {
+ return ele.goods_id == goodsinfo.goods_id;
+ })
+ var pre_arr = all_pre_goods[idx];
+ th.setData({ pre_arr: pre_arr })
+ th.data.prom_buy_limit = pre_arr.vip_butyqty;
},
@@ -1870,7 +1888,7 @@ Page({
th.setData({ all_pick_list: e.data.data.pageData });
//--获取线下库存,而且不是新的门店规则, 同时是普通购买的时候,或者同时不能是活动,秒杀,拼团,积分购 预售--
- if (th.data.sales_rules == 2 && !th.data.is_newsales_rules && ((th.data.prom_type != 1 && th.data.prom_type != 6 && th.data.prom_type != 4 && th.data.prom_type !=8 ) || is_normal == 1)) {
+ if (th.data.sales_rules == 2 && !th.data.is_newsales_rules && ((th.data.prom_type != 1 && th.data.prom_type != 6 && th.data.prom_type != 4 && th.data.prom_type != 8) || is_normal == 1)) {
setTimeout(function () {
th.deal_pickup_dline(e);
}, 800)
@@ -1906,15 +1924,15 @@ Page({
success: function (ee) {
if (ee.data.code == 0) {
- var check_all_cate=0;
- if (ee.data.data && ee.data.data.pageData && ee.data.data.pageData.length > 0){
- for(let i in ee.data.data.pageData){
- let item=ee.data.data.pageData[i];
- if(item.is_show==1){
- check_all_cate=1;break
- }
- }
+ var check_all_cate = 0;
+ if (ee.data.data && ee.data.data.pageData && ee.data.data.pageData.length > 0) {
+ for (let i in ee.data.data.pageData) {
+ let item = ee.data.data.pageData[i];
+ if (item.is_show == 1) {
+ check_all_cate = 1; break
+ }
}
+ }
if (check_all_cate) {
@@ -1923,29 +1941,29 @@ Page({
var newarr = new Array();
var qita = new Array();
- var is_del_pk=0;
+ var is_del_pk = 0;
//----要进行门店分组--------
for (var i = 0; i < sto_arr.length; i++) {
//找一下这个门店有没有在分类数组内
var find2 = 0, find2name = "", sort = 0;
- is_del_pk=0;
+ is_del_pk = 0;
for (var m = 0; m < sto_cate.length; m++) {
- if (sto_arr[i].category_id == sto_cate[m].cat_id) {
- if (sto_cate[m].is_show != 1) {
- is_del_pk = 1;
- sto_arr.splice(i, 1);
- i--;
- } else {
- find2 = sto_cate[m].cat_id;
- find2name = sto_cate[m].cat_name;
- sort = sto_cate[m].sort;
- is_del_pk = 0;
- }
- break;
+ if (sto_arr[i].category_id == sto_cate[m].cat_id) {
+ if (sto_cate[m].is_show != 1) {
+ is_del_pk = 1;
+ sto_arr.splice(i, 1);
+ i--;
+ } else {
+ find2 = sto_cate[m].cat_id;
+ find2name = sto_cate[m].cat_name;
+ sort = sto_cate[m].sort;
+ is_del_pk = 0;
}
+ break;
+ }
}
- if(is_del_pk) continue;
+ if (is_del_pk) continue;
if (newarr.length > 0) {
var find = 0;
@@ -1991,17 +2009,17 @@ Page({
}
- var def_arr = new Array();
- //-- 开始就看10个门店 --
- for (var k = 0; k < 10; k++) {
- if (k == sto_arr.length) break;
- def_arr.push(sto_arr[k]);
- }
+ var def_arr = new Array();
+ //-- 开始就看10个门店 --
+ for (var k = 0; k < 10; k++) {
+ if (k == sto_arr.length) break;
+ def_arr.push(sto_arr[k]);
+ }
- th.setData({
- def_pickpu_list: def_arr,
- pickpu_list: ee.data.data.pageData
- });
+ th.setData({
+ def_pickpu_list: def_arr,
+ pickpu_list: ee.data.data.pageData
+ });
//门店分类要排序下
function compare(property) {
return function (a, b) {
@@ -2025,15 +2043,15 @@ Page({
}
- var sd={
- all_sto: newarr,
- is_show_sto_cat:1
- }
- if(!sto_arr || sto_arr.length<=10){
- sd.is_show_sto_cat=-1;
- sd.only_pk=sto_arr;
- }
- th.setData(sd);
+ var sd = {
+ all_sto: newarr,
+ is_show_sto_cat: 1
+ }
+ if (!sto_arr || sto_arr.length <= 10) {
+ sd.is_show_sto_cat = -1;
+ sd.only_pk = sto_arr;
+ }
+ th.setData(sd);
} else {
th.setData({
@@ -2382,21 +2400,21 @@ Page({
}
} else {
- //活动已结束,全部设置为'00'
- obj = {
- day: '00',
- hou: '00',
- min: '00',
- sec: '00'
- }
- th.setData({
- prom_time_text: '活动已经结束:',
- prom_st: 3
- })
- th.setData({
- djs: obj
- });
- return false;
+ //活动已结束,全部设置为'00'
+ obj = {
+ day: '00',
+ hou: '00',
+ min: '00',
+ sec: '00'
+ }
+ th.setData({
+ prom_time_text: '活动已经结束:',
+ prom_st: 3
+ })
+ th.setData({
+ djs: obj
+ });
+ return false;
}
@@ -2410,56 +2428,56 @@ Page({
//-------------获取购买数量的总函数----------------
- get_buy_num: function (gd, func) {
- var map = this.data.g_buy_num,
- th = this,
- user_id = getApp().globalData.user_id;
- if (user_id == null) {
- map.set(gd.goods_id, 0);
+ get_buy_num: function (gd, func) {
+ var map = this.data.g_buy_num,
+ th = this,
+ user_id = getApp().globalData.user_id;
+ if (user_id == null) {
+ map.set(gd.goods_id, 0);
+ th.setData({
+ g_buy_num: map,
+ prom_buy_num: 0,
+ });
+ "function" == typeof func && func();
+ return false;
+ }
+
+ if (map.has(gd.goods_id)) {
+ "function" == typeof func && func();
+ } else {
+ //----获取商品购买数----
+ getApp().request.get("/api/weshop/ordergoods/getUserBuyGoodsNum", {
+ data: {
+ store_id: os.stoid,
+ user_id: user_id,
+ goods_id: gd.goods_id,
+ },
+ success: function (t) {
+ if (t.data.code == 0) {
+ var g_buy_num = t.data.data.goodsbuynum;
+ map.set(gd.goods_id, g_buy_num);
th.setData({
- g_buy_num: map,
- prom_buy_num: 0,
+ g_buy_num: map,
});
- "function" == typeof func && func();
- return false;
- }
-
- if (map.has(gd.goods_id)) {
- "function" == typeof func && func();
- } else {
- //----获取商品购买数----
- getApp().request.get("/api/weshop/ordergoods/getUserBuyGoodsNum", {
- data: {
- store_id: os.stoid,
- user_id: user_id,
- goods_id: gd.goods_id,
- },
- success: function (t) {
- if (t.data.code == 0) {
- var g_buy_num = t.data.data.goodsbuynum;
- map.set(gd.goods_id, g_buy_num);
- th.setData({
- g_buy_num: map,
- });
- getApp().request.get("/api/weshop/order/orderPresell/countBuyGoodsSum",{
- data: {store_id: os.stoid, user_id: user_id, goods_id: gd.goods_id, prom_id: gd.prom_id},
- success: function (e) {
- if (e.data.code == 0) {
- th.setData({prom_buy_num: e.data.data.sumgoodsnum})
- "function" == typeof func && func();
- } else {
- th.setData({prom_buy_num: 0,})
- "function" == typeof func && func();
- }
-
- }
- });
-
- }
+ getApp().request.get("/api/weshop/order/orderPresell/countBuyGoodsSum", {
+ data: { store_id: os.stoid, user_id: user_id, goods_id: gd.goods_id, prom_id: gd.prom_id },
+ success: function (e) {
+ if (e.data.code == 0) {
+ th.setData({ prom_buy_num: e.data.data.sumgoodsnum })
+ "function" == typeof func && func();
+ } else {
+ th.setData({ prom_buy_num: 0, })
+ "function" == typeof func && func();
}
+
+ }
});
+
+ }
}
- },
+ });
+ }
+ },
//--拼单推荐的显示---
tj_Click: function (e) {
@@ -2471,7 +2489,7 @@ Page({
//-------跳转pt商品-------
go_to_nopay: function () {
- var th =this,url = "/pages/user/order_detail/order_detail?order_id=" + th.data.buy_order.order_id;
+ var th = this, url = "/pages/user/order_detail/order_detail?order_id=" + th.data.buy_order.order_id;
getApp().goto(url);
},
@@ -2615,7 +2633,18 @@ Page({
wx.hideLoading();
quan_list = res.data.data.pageData;
})
-
+ //过滤不是本商品的单品优惠券
+ if (quan_list.length > 0) {
+ let goodInfo = th.data.data
+ for (let index = quan_list.length - 1; index >= 0; index--) {
+ if (quan_list[index].useobjecttype == 20) { //判断是单品优惠券
+ if (quan_list[index].useobjectno != goodInfo.goods_sn) {
+ quan_list.splice(index, 1)
+ }
+ }
+ }
+ }
+ //------------------------
if (quan_list) {
for (var ind in quan_list) {
var ep = quan_list[ind];
@@ -2712,7 +2741,13 @@ Page({
}
})
},
-
+ saveImageFn(){
+ if(this.data.share_b_img){
+ this.saveImageToPhotosAlbum()
+ }else{
+ this.saveImageToPhotosAlbumDef()
+ }
+ },
//--定义的保存图片方法,分享团---
saveImageToPhotosAlbum: function () {
//--先判断会员状态--
@@ -2894,7 +2929,25 @@ Page({
//share_goods_img?share_goods_img:th.data.data.share_goods_img;
//---中间大图---
context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit);
+ //---自定义海报 产品质量保证
+ if(th.data.poster.show_quality==1 ){
+ var g_path = "/images/share/s_gou.png";
+ context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit);
+ context.setFillStyle("red")
+ context.setFontSize(18 * unit)
+ context.fillText("正品保证", 84 * unit, 690 * unit);
+
+ context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit);
+ context.setFillStyle("red")
+ context.setFontSize(18 * unit)
+ context.fillText("纯实体店", 246 * unit, 690 * unit);
+
+ context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit);
+ context.setFillStyle("red")
+ context.setFontSize(18 * unit)
+ context.fillText("官方验证", 420 * unit, 690 * unit);
+ }
//---画线---
context.setLineWidth(1 * unit)
@@ -3020,8 +3073,609 @@ Page({
}
});
},
+ //--定义的保存图片方法,分享团---
+ saveImageToPhotosAlbumDef: function () {
+ //--先判断会员状态--
+ var user_info = getApp().globalData.userInfo;
+ if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
+ //getApp().my_warnning("请先登录",0,this);
+ wx.navigateTo({url: '/packageE/pages/togoin/togoin',})
+ return false;
+ }
+
+ if (this.data.share_hidden) {
+ this.setData({share_hidden: false,});
+ };
+
+ //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团
+ var type = this.data.prom_type;
+ console.log('商品类型-----');
+ console.log(type);
+ // if (type == 2) type = -1;
+ if (type == 4) type = 0;
+ if (type == 8) type = 0;
+ if (type == 2) type = 0;
+ if (type == 6) type = 2; // 6拼团 2团购
+ if (type == 10) type = -1;
+
+
+ if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3;
+ console.log('商品类型。。。。。');
+ console.log(type);
+ wx.showLoading({title: '生成中...',})
+ var that = this, th = that;
+ //设置画板显示,才能开始绘图
+ that.setData({
+ canvasHidden: false
+ })
+
+ var app = getApp();
+ var unit = that.data.screenWidth / 750 * 1.35; //基础单位,
+ var path2 = that.data.data.original_img;
+ var scene = th.data.gid + "";
+ scene += "." + th.data.sele_g.prom_type + "." + th.data.sele_g.prom_id;
+
+ var user_id = getApp().globalData.user_id ? getApp().globalData.user_id : 0;
+ if (user_id > 0) {
+ scene += "_" + user_id;
+ }
+ //-- 如果不是会员分享过来的要分享给别人 --
+ if (getApp().globalData.room_id && th.data.data.goods_id == getApp().globalData.room_goods_id && !getApp().globalData.room_user_share) {
+ //固定房间是第3个字符
+ if (!user_id) scene += "_0";
+ scene += "_" + getApp().globalData.room_id;
+ }
+
+ ///二微码
+ var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" +
+ os.stoid + "?sceneValue=" + scene + "&pageValue=packageC/pages/presell/goodsInfo/goodsInfo";
+
+ console.log(path3);
+ // 读取文件成功则OK--
+ wx.getImageInfo({
+ src: path3,
+ success: function (res) {
+ // 回调写法
+ th.get_head_temp(th.get_goods_temp, function () {
+ var vpath = res.path;
+ var context = wx.createCanvasContext('share');
+ // 先画背景
+ var pg_path = "../../../../images/share/share_bg.png";
+
+
+ //-- 如果有自定义海报的时候,判断背景的图片 --
+ if (th.data.share_b_img) {
+ pg_path = th.data.share_b_img;
+ }
+ // context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit);
+ console.log('海报类型-----')
+ console.log(type);
+
+ if ( !th.data.share_b_img && (type == 0 || type == 1 || type == 2 || type == 3 )){ // 如果是普通商品,绘制新海报
+ th.drawPoster(context, unit, th.data.share_goods_img, vpath, type);
+ } else {
+ context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit);
+ // var erm_x = parseFloat(th.data.poster.ewm_x) * 2;
+ // var erm_y = parseFloat(th.data.poster.ewm_y) * 2;
+ // context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit);
+ // th.drawPoster(context, unit, th.data.share_goods_img, vpath);
+ };
+
+ // th.drawPoster(context, unit, th.data.share_goods_img, vpath);
+
+
+ //-- 是自定义海报的情况下 --
+ if (th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) {
+
+ if (th.data.poster && parseInt(th.data.poster.style) == 2) {
+ //在线上分享人的情况下
+ if (parseInt(th.data.poster.show_headpic)) {
+ //获取坐标
+ var x = parseFloat(th.data.poster.head_x) * 2;
+ var y = parseFloat(th.data.poster.head_y) * 2;
+ var x1 = (x + 90) * unit;
+ var y1 = (y + 50) * unit;
+ //--昵称---
+ context.setFontSize(24 * unit)
+ context.setFillStyle("black")
+ context.fillText(app.globalData.userInfo.nickname, x1, y1);
+ var width = 24 * app.globalData.userInfo.nickname.length * unit + 4 * unit;
+ //强烈推荐 改许程
+ var tj_path = "../../../../images/share/q_tj.png";
+ context.drawImage(tj_path, x1 + width, y1 - 22 * unit, 85 * unit, 30 * unit);
+ context.setFontSize(16 * unit);
+ context.setLineJoin('round'); //交点设置成圆角
+ context.setFillStyle("white");
+ context.fillText('强烈推荐', x1 + width + 8 * unit, y1 - 1 * unit);
+
+ //context.setFillStyle("black")
+ //context.setFontSize(24 * unit)
+ //context.fillText(getApp().globalData.config.store_name, 40 * unit, 130 * unit);
+ }
+ } else {
+ //--昵称---
+ context.setFontSize(24 * unit);
+ context.setFillStyle("black");
+ context.fillText(app.globalData.userInfo.nickname, 152 * unit, 76 * unit);
+ var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit;
+ //强烈推荐 改许程
+ var tj_path = "../../../../images/share/q_tj.png";
+ context.drawImage(tj_path, 152 * unit + width, 54 * unit, 85 * unit, 30 * unit);
+ context.setFontSize(16 * unit);
+ context.setLineJoin('round'); //交点设置成圆角
+ context.setFillStyle("white");
+ context.fillText('强烈推荐', 149 * unit + width + 15 * unit, 75 * unit);
+ }
+
+ };
+
+
+ var share_title = th.data.data.goods_name;
+ if (th.data.prom_type == 1 || th.data.prom_type == 2 || th.data.prom_type == 6 || th.data.prom_type == 4) {
+ share_title = th.data.prom_act.share_title;
+ if (!share_title) share_title = th.data.prom_act.title;
+ if (th.data.prom_type == 4) share_title = th.data.prom_act.name;
+ }
+
+ //---产品名称---
+ //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度
+ if (th.data.share_b_img || (type != 4 && type != 0 && type != 1 && type != 2 && type != 3)) {
+ context.setFillStyle("black");
+ context.setFontSize(21.3 * unit)
+ getApp().draw_Text(context, share_title,
+ 38 * unit, 180 * unit, 200 * unit, 279 * unit, unit);
+
+ //------产品的价格-------
+ context.setFontSize(23 * unit)
+ context.setFillStyle("red")
+
+ var pri0 = th.data.data.shop_price;
+ if (th.data.card_field && th.data.data[th.data.card_field]) {
+ pri0 = th.data.data[th.data.card_field];
+ }
+
+ if (th.data.prom_act)
+ pri0 = th.data.prom_price;
+ pri0 = parseFloat(pri0).toFixed(2);
+ var wd1 = th.data.screenWidth - ut.measureText(pri0, 31 * unit) - 25;
+ context.fillText("¥", wd1 - 15, 185 * unit);
+ context.setFontSize(31 * unit)
+ context.fillText(pri0, wd1, 185 * unit);
+
+ //---市场价划掉---
+ /*--
+ context.setFillStyle("gray")
+ context.setFontSize(22 * unit)
+ pri0 = "¥" + th.data.data.market_price.toFixed(2);
+ var wd2 = th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 25;
+ context.fillText(pri0, wd2, 213 * unit);
+
+ context.setStrokeStyle('gray');
+ context.setLineWidth(1 * unit);
+ context.moveTo(wd2 - 5, 206 * unit);
+ context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit);
+ context.stroke();--*/
+
+ } else if ( ( type == 4 && type != 0 && type != 1 && type != 2 && type != 3)) {
+ context.setFillStyle("black");
+ context.setFontSize(21.3 * unit)
+ getApp().draw_Text(context, share_title,
+ 38 * unit, 170 * unit, 20 * unit, 300 * unit, unit);
+ //------ 产品的价格 -----
+ var pri0 = th.data.prom_act.addmoney;
+ var integral = th.data.prom_act.integral;
+ var text = "";
+ if (integral) {
+ text = integral + "积分";
+ }
+ if (pri0 && integral) {
+ text += "+";
+ }
+ if (pri0) {
+ text += "¥" + pri0;
+ }
+
+ if (!pri0 && !integral) {
+ text = "0积分";
+ }
+ context.setFillStyle("red");
+ context.fillText(text, 38 * unit, 235 * unit);
+
+ }
+
+ //---中间大图---
+ if ( th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) {
+ context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit);
+ }
+ ;
+
+ //---自定义海报 产品质量保证
+ if(th.data.share_b_img && th.data.poster.show_quality==1 ){
+ var g_path = "../../../../images/share/s_gou.png";
+ context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit);
+ context.setFillStyle("red")
+ context.setFontSize(18 * unit)
+ context.fillText("正品保证", 84 * unit, 690 * unit);
+
+ context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit);
+ context.setFillStyle("red")
+ context.setFontSize(18 * unit)
+ context.fillText("纯实体店", 246 * unit, 690 * unit);
+
+ context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit);
+ context.setFillStyle("red")
+ context.setFontSize(18 * unit)
+ context.fillText("官方验证", 420 * unit, 690 * unit);
+
+ }
+ //-------大图后面就不一样了-----------
+ switch (type) {
+ case 0:
+ if(!th.data.share_b_img){
+ break
+ }
+ //---画线---
+ context.setLineWidth(1 * unit)
+ context.moveTo(32 * unit, 710 * unit)
+ context.lineTo(520 * unit, 710 * unit)
+ context.stroke();
+ //---文字---
+ context.setFillStyle("black")
+ context.setFontSize(22 * unit)
+ // 原来start --->
+ context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 776 * unit);
+ context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 826 * unit);
+ // <--- 原来end
+ // context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 816 * unit);
+ // context.setFontSize(18 * unit)
+ // context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 850 * unit);
+ //---二维吗图---
+ context.drawImage(vpath, 380 * unit, 736 * unit, 120 * unit, 120 * unit);
+ break;//普通商品的展示
+ case 4:
+ // 中间的几个字
+ if (th.data.poster && parseInt(th.data.poster.style) == 2) {
+ if (parseInt(th.data.poster.show_quality)) {
+ var g_path = "../../../../images/share/s_gou.png";
+ context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit);
+ context.setFillStyle("red")
+ context.setFontSize(18 * unit)
+ context.fillText("正品保证", 84 * unit, 690 * unit);
+
+ context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit);
+ context.setFillStyle("red")
+ context.setFontSize(18 * unit)
+ context.fillText("纯实体店", 246 * unit, 690 * unit);
+
+ context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit);
+ context.setFillStyle("red")
+ context.setFontSize(18 * unit)
+ context.fillText("官方验证", 420 * unit, 690 * unit);
+ }
+
+ } else {
+ var g_path = "../../../../images/share/s_gou.png";
+ context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit);
+ context.setFillStyle("red")
+ context.setFontSize(18 * unit)
+ context.fillText("正品保证", 84 * unit, 690 * unit);
+
+ context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit);
+ context.setFillStyle("red")
+ context.setFontSize(18 * unit)
+ context.fillText("纯实体店", 246 * unit, 690 * unit);
+
+ context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit);
+ context.setFillStyle("red")
+ context.setFontSize(18 * unit)
+ context.fillText("官方验证", 420 * unit, 690 * unit);
+ }
+
+
+ //---画线---
+ context.setLineWidth(1 * unit)
+ context.moveTo(32 * unit, 710 * unit)
+ context.lineTo(520 * unit, 710 * unit)
+ context.stroke();
+
+ //---文字---
+ context.setFillStyle("black")
+ context.setFontSize(22 * unit)
+
+ if (type == 0 || type == -1) {
+ // 原来start --->
+ context.setFontSize(24 * unit)
+ context.fillText(th.data.sto_sele_name_1, 40 * unit, 766 * unit);
+
+ context.setFontSize(22 * unit)
+ context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 806 * unit);
+ context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 846 * unit);
+
+ } else {
+ context.setFontSize(24 * unit)
+ context.fillText(th.data.sto_sele_name_1, 40 * unit, 766 * unit);
+ context.setFontSize(22 * unit)
+ context.fillText("长按识别二维码", 40 * unit, 806 * unit);
+ context.fillText("立即开始兑换", 40 * unit, 846 * unit);
+
+ }
+
+ //---二维吗图---
+ //-- 自定义海报 --
+ if (th.data.share_b_img || th.data.poster) {
+ var erm_x = parseFloat(th.data.poster.ewm_x) * 2;
+ var erm_y = parseFloat(th.data.poster.ewm_y) * 2;
+ context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit);
+ } else {
+ //---二维吗图---
+ context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit);
+ }
+ ;
+
+ break;
+ case 1: //秒杀商品的展示
+ if(!th.data.share_b_img){
+ break
+ }
+ //---画线---
+ context.setLineWidth(1 * unit)
+ context.moveTo(32 * unit, 670 * unit)
+ context.lineTo(520 * unit, 670 * unit)
+ context.stroke();
+
+ //画秒杀的图片
+ var miaos_path = '../../../../images/share/miao_share.png';
+ context.drawImage(miaos_path, 43 * unit, 700 * unit, 222 * unit, 40 * unit);
+
+ context.setFillStyle("black")
+ context.setFontSize(24 * unit)
+ context.fillText(th.data.sto_sele_name_1, 40 * unit, 786 * unit);
+ //---文字---
+ context.setFontSize(22 * unit)
+ context.setFillStyle("black")
+ context.fillText("特惠好物,限时秒杀", 40 * unit, 826 * unit);
+ context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 866 * unit);
+
+
+ //---二维吗图---
+ //-- 自定义海报 --
+ if (th.data.share_b_img || th.data.poster) {
+ var erm_x = parseFloat(th.data.poster.ewm_x) * 2;
+ var erm_y = parseFloat(th.data.poster.ewm_y) * 2;
+ context.drawImage(vpath, erm_x * unit, erm_y * unit, 135 * unit, 135 * unit);
+ } else {
+ //---二维吗图---
+ context.drawImage(vpath, 390 * unit, 726 * unit, 135 * unit, 135 * unit);
+ }
+ break;
+
+ case 2: //会员团和商家团的展示
+ if(!th.data.share_b_img){
+ break
+ }
+ //---画线---
+ context.setLineWidth(1 * unit)
+ context.moveTo(32 * unit, 670 * unit)
+ context.lineTo(520 * unit, 670 * unit)
+ context.stroke();
+ //---文字---
+ context.setFillStyle("black")
+ context.setFontSize(24 * unit)
+ context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit);
+
+ //绘制成团图片
+ var ct_img = "../../../../images/share/ct_num.png";
+ context.drawImage(ct_img, 40 * unit, 740 * unit, 120 * unit, 30 * unit);
+ var ct_num = th.data.prom_act.ct_num;
+ context.setFontSize(14 * unit)
+ context.font = 'normal';
+ context.setFillStyle("red")
+ if (ct_num < 10) {
+ context.fillText(ct_num + "人拼团", 92 * unit, 760 * unit);
+ } else {
+ context.fillText(ct_num + "人拼团", 86 * unit, 760 * unit);
+ }
+ context.setFontSize(22 * unit)
+ context.fillText("已拼" + th.data.prom_act.buy_num + "份", 166 * unit, 763 * unit);
+
+ context.setFillStyle("gray")
+ context.fillText("快来和我一起拼团吧!", 40 * unit, 806 * unit);
+ context.setFillStyle("black")
+ context.font = 'normal bold 18px sans-serif';
+ context.setFontSize(21.3 * unit)
+ context.fillText("长按识别二维码,立即参团", 40 * unit, 836 * unit);
+
+
+ //---二维吗图---
+ //-- 自定义海报 --
+ if (th.data.share_b_img || th.data.poster) {
+ var erm_x = parseFloat(th.data.poster.ewm_x) * 2;
+ var erm_y = parseFloat(th.data.poster.ewm_y) * 2;
+ context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit);
+ } else {
+ //---二维吗图---
+ context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit);
+ }
+ break
+ case 3: //阶梯团的展示
+ if(!th.data.share_b_img){
+ break
+ }
+ //---画线---
+ context.setLineWidth(1 * unit)
+ context.moveTo(32 * unit, 670 * unit)
+ context.lineTo(520 * unit, 670 * unit)
+ context.stroke();
+ //---文字---
+ context.setFillStyle("black")
+ context.setFontSize(24 * unit)
+ context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit);
+
+ //---绘制中间阶梯的价格---
+ var list = th.data.prom_act.ct_rylist;
+ for (var i = 0; i < list.length; i++) {
+ var item = list[i];
+ var wi = i * 90 * unit;
+ context.font = 'normal';
+ context.setFontSize(16 * unit)
+ context.setFillStyle("red")
+ context.fillText("¥", 40 * unit + wi, 756 * unit);
+ context.setFontSize(22 * unit)
+ var pri = parseFloat(item.price).toFixed(2);
+ context.fillText(pri, 56 * unit + wi, 756 * unit);
+ context.setFillStyle("gray")
+ context.fillText("满" + item.rynum + "人", 40 * unit + wi, 786 * unit);
+ }
+ //----------------下面部分----------------
+
+ context.setFillStyle("black")
+ context.fillText("快来和我一起拼团吧!", 40 * unit, 820 * unit);
+ //context.font = 'normal bold 18px sans-serif';
+ context.setFontSize(21 * unit)
+ context.fillText("长按识别二维码,立即参团", 40 * unit, 850 * unit);
+
+
+ //-- 自定义海报 --
+ if (th.data.share_b_img || th.data.poster) {
+ var erm_x = parseFloat(th.data.poster.ewm_x) * 2;
+ var erm_y = parseFloat(th.data.poster.ewm_y) * 2;
+ context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit);
+ } else {
+ //---二维吗图---
+ context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit);
+ }
+ break
+
+
+ case -1: //秒杀商品的展示
+ //---画线---
+ context.setLineWidth(1 * unit)
+ context.moveTo(32 * unit, 670 * unit)
+ context.lineTo(520 * unit, 670 * unit)
+ context.stroke();
+
+
+ context.setFillStyle("black")
+ context.setFontSize(24 * unit)
+ context.fillText(th.data.sto_sele_name_1, 40 * unit, 744 * unit);
+ //---文字---
+ context.setFontSize(22 * unit)
+ context.setFillStyle("black")
+ context.fillText("长按识别二维码", 40 * unit, 800 * unit);
+ context.fillText("立即开始抢购", 40 * unit, 846 * unit);
+
+
+ //---二维吗图---
+ //-- 自定义海报 --
+ if (th.data.share_b_img || th.data.poster) {
+ var erm_x = parseFloat(th.data.poster.ewm_x) * 2;
+ var erm_y = parseFloat(th.data.poster.ewm_y) * 2;
+ context.drawImage(vpath, erm_x * unit, erm_y * unit, 135 * unit, 135 * unit);
+ } else {
+ //---二维吗图---
+ context.drawImage(vpath, 390 * unit, 726 * unit, 135 * unit, 135 * unit);
+ }
+ break;
+
+
+ }
+
+
+ //--- 如果是自定义海报的时候 ---
+ if ( th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) {
+
+ if (th.data.poster && parseInt(th.data.poster.style) == 2) {
+
+ //如果显示会员信息的话
+ if (parseInt(th.data.poster.show_headpic)) {
+ //获取坐标
+ var x = parseFloat(th.data.poster.head_x) * 2;
+ var y = parseFloat(th.data.poster.head_y) * 2;
+ //---绘制圆形要放在最后----
+ context.save();
+ context.beginPath();
+ var h_x = x * unit;
+ var h_y = y * unit;
+ var h_r = 40 * unit;
+ var cx = h_x + h_r;
+ var cy = h_y + h_r;
+ context.arc(cx, cy, h_r, 0, Math.PI * 2, false);
+ context.closePath();
+ context.fill();
+ context.clip();
+ context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2);
+ context.restore();
+ }
+
+ } else {
+ //---绘制圆形要放在最后----
+ context.save();
+ context.beginPath();
+ var h_x = 60 * unit;
+ var h_y = 24 * unit;
+ var h_r = 40 * unit;
+ var cx = h_x + h_r;
+ var cy = h_y + h_r;
+ context.arc(cx, cy, h_r, 0, Math.PI * 2, false);
+ context.closePath();
+ context.fill();
+ context.clip();
+ context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2);
+ context.restore();
+ }
+
+ }
+ ;
+
+
+ //把画板内容绘制成图片,并回调 画板图片路径
+ context.draw(false, function () {
+ setTimeout(function () {
+ wx.canvasToTempFilePath({
+ x: 0,
+ y: 0,
+ width: 750,
+ height: 1217,
+ destWidth: 1.2 * 750 * 750 / that.data.screenWidth,
+ destHeight: 1.2 * 1217 * 750 / that.data.screenWidth,
+ canvasId: 'share',
+ success: function (res) {
+
+ that.setData({
+ shareImgPath: res.tempFilePath,
+ canvasHidden: true
+ })
+
+ if (!res.tempFilePath) {
+ wx.showModal({
+ title: '提示',
+ content: '图片绘制中,请稍后重试',
+ showCancel: false
+ })
+ return false;
+ }
+
+ that.setData({
+ showPoster: true,
+ });
+ wx.hideLoading();
+ }
+ })
+ }, 500)
+
+ });
+ });
+ },
+ fail: function (res) {
+ console.log(res);
+ wx.hideLoading();
+
+ }
+ });
+ },
+
//文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度
draw_Text: function (ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, unit) {
var lineWidth = 0;
@@ -3049,7 +3703,144 @@ Page({
}
}
},
+ drawPoster(context, unit, img, vpath, type) {
+ // 1.灰色背景
+ context.setFillStyle('#f2f1f6');
+ context.rect(0, 0, 554 * unit, 899 * unit);
+ context.fill();
+
+ // 2.商城名称
+ let shopName = this.data.sto_sele_name_1;
+ context.setTextAlign('center');
+ context.setFontSize(26 * unit);
+ context.setFillStyle('black');
+ context.fillText(shopName, 277 * unit, 60 * unit);
+
+ // 3.推荐来源
+ let fromText = `来自${getApp().globalData.userInfo.nickname}的推荐`;
+ context.setTextAlign('center');
+ context.setFontSize(22 * unit);
+ context.setFillStyle('#96959a');
+ context.fillText(fromText, 277 * unit, 105 * unit);
+
+ // 4.海报背景
+ context.setFillStyle('white');
+ context.fillRect(37 * unit, 157 * unit, 480 * unit, 673 * unit);
+
+ // 5.商品图片
+ // 图片的x坐标
+ let bg_x = 37 * unit
+ // 图片的y坐标
+ let bg_y = 157 * unit
+ // 图片宽度
+ let bg_w = 480 * unit
+ // 图片高度
+ let bg_h = 474 * unit
+ // 图片圆角
+ let bg_r = 4
+ // 绘制海报背景图片圆角
+ context.save()
+ context.beginPath()
+ context.arc(bg_x + bg_r, bg_y + bg_r, bg_r, Math.PI, Math.PI * 1.5)
+ context.arc(bg_x + bg_w - bg_r, bg_y + bg_r, bg_r, Math.PI * 1.5, Math.PI * 2)
+ context.arc(bg_x + bg_w, bg_y + bg_h, bg_r, 0, Math.PI * 0.5)
+ context.arc(bg_x, bg_y + bg_h, 0, Math.PI * 0.5, Math.PI)
+ context.clip()
+ context.drawImage(img, bg_x, bg_y, bg_w, bg_h);
+ context.restore();
+
+ // 6.强烈推荐
+ let src = '';
+ context.beginPath();
+ if(type == 0) { // 普通
+ src = '../../../../images/share/q_tj.png';
+ context.drawImage(src, 54 * unit, 648 * unit, 85 * unit, 30 * unit);
+ context.setFontSize(16 * unit)
+ context.setFillStyle("white")
+ context.setTextAlign('left');
+ context.fillText('强烈推荐', 64 * unit, 668 * unit);
+ };
+ if(type == 1) { // 秒杀
+ src = '../../../images/share/miao_share.png';
+ context.drawImage(src, 54 * unit, 648 * unit, 200 * unit, 36 * unit);
+ context.setTextAlign('left');
+ };
+ if(type == 2) { // 商家和会员团
+ src = '../../../images/share/ct_num.png';
+ context.drawImage(src, 54 * unit, 648 * unit, 120 * unit, 30 * unit);
+ context.setTextAlign('left');
+
+ let ct_num = self.data.prom_act.ct_num;
+ context.setFontSize(16 * unit)
+ context.font = 'normal';
+ context.setFillStyle("red")
+ if (ct_num < 10) {
+ context.fillText(ct_num + "人拼团", 100 * unit, 670 * unit);
+ } else {
+ context.fillText(ct_num + "人拼团", 96 * unit, 670 * unit);
+ }
+ context.setFontSize(22 * unit)
+ context.fillText("已拼" + self.data.prom_act.buy_num + "份", 186 * unit, 672 * unit);
+ };
+ if(type == 3) { // 阶梯团
+ let list = self.data.prom_act.ct_rylist;
+ for (let i = 0; i < list.length; i++) {
+ let item = list[i];
+ let wi = i * 90 * unit;
+ context.font = 'normal';
+ context.setTextAlign('left');
+ context.setFontSize(16 * unit)
+ context.setFillStyle("red")
+ context.fillText("¥", 50 * unit + wi, 680 * unit);
+ context.setFontSize(22 * unit)
+ let pri = parseFloat(item.price).toFixed(2);
+ context.fillText(pri, 66 * unit + wi, 680 * unit);
+ context.setFillStyle("gray")
+ context.fillText("满" + item.rynum + "人", 50 * unit + wi, 716 * unit);
+ }
+ };
+
+ // 7.商品价格
+ if(type != 3) {
+ let price = this.data.data.shop_price;
+ if (this.data.card_field && this.data.data[this.data.card_field]) {
+ price = this.data.data[this.data.card_field];
+ }
+ if (this.data.prom_act) price = this.data.prom_price;
+ price = parseFloat(price).toFixed(2);
+ context.setFontSize(32 * unit);
+ context.setFillStyle('#DE1117');
+ if (this.data.prom_type == 4 && this.data.prom_integral){
+ context.fillText(this.data.prom_integral+'积分+¥' + price, 54 * unit, 735 * unit);
+ }else{
+ if(this.data.prom_type ==8){
+ price = this.data.presellList.presell_price
+ context.fillText('¥' + price, 54 * unit, 735 * unit);
+ }else{
+ context.fillText('¥' + price, 54 * unit, 735 * unit);
+ }
+ }
+
+ };
+
+ // 8.商品标题
+ context.setFontSize(20 * unit);
+ context.setFillStyle('#898989');
+ getApp().draw_Text(context, this.data.data.goods_name, 54 * unit, 800 * unit, 240 * unit, 280 * unit, unit, 1);
+
+ // 9.小程序码
+ context.drawImage(vpath, 375 * unit, 660 * unit, 120 * unit, 120 * unit);
+ context.setFontSize(16 * unit);
+ context.setFillStyle('#777');
+ context.fillText('长按识别二维码', 378 * unit, 810 * unit);
+
+ // 10.竖线
+ context.beginPath();
+ context.setFillStyle('#eee');
+ context.rect(354 * unit, 670 * unit, 1 * unit, 130 * unit);
+ context.fill();
+ },
// ----视频图片----
// 图片计数器
swiperChange: function (e) {
@@ -3135,7 +3926,7 @@ Page({
tt();
return false;
}
- var img_url = ee.data.data.original_img;
+ var img_url = ee.data.data.original_img;
//var img_url = ee.data.presellForm.share_img;
//img_url?img_url:ee.data.data.original_img;
@@ -3148,8 +3939,14 @@ Page({
tt();
},
fail: function (res) {
- ee.data.share_goods_img = "../../../../images/share/default_g_img.gif"; //分享的图片不能用网络的
- tt();
+ //获取默认空白图
+ wx.getImageInfo({
+ src: ee.data.iurl + '/miniapp/images/default_g_img.gif',
+ success: function (res) {
+ ee.data.share_goods_img = res.path; //分享的图片不能用网络的
+ tt();
+ }
+ })
}
});
},
@@ -3189,22 +3986,22 @@ Page({
getHistoryBuy() {
let _this = this;
let req_data = {
- store_id: os.stoid,
- goods_id: this.data.gid,
- pay_status: 1,
- rndid: 1
+ store_id: os.stoid,
+ goods_id: this.data.gid,
+ pay_status: 1,
+ rndid: 1
};
getApp().request.promiseGet('/api/weshop/ordergoods/list', {
- data: req_data,
+ data: req_data,
})
- .then(res => {
- if (ut.ajax_ok(res)) {
- _this.setData({
- historyBuyInfo: res.data.data.pageData,
- })
- }
- })
-},
+ .then(res => {
+ if (ut.ajax_ok(res)) {
+ _this.setData({
+ historyBuyInfo: res.data.data.pageData,
+ })
+ }
+ })
+ },
//--调用更新阶梯团的接口--
update_jiti: function (id) {
@@ -3232,8 +4029,8 @@ Page({
var bconfig = th.data.bconfig;
//如果开启了,则不在选择门店
- if(this.data.sys_switch.is_pricing_open_store && getApp().globalData.pk_store){
- return false;
+ if (this.data.sys_switch.is_pricing_open_store && getApp().globalData.pk_store) {
+ return false;
}
if (!th.data.only_pk && !th.data.def_pickpu_list) {
@@ -3857,7 +4654,7 @@ Page({
onShareTimeline() {
- getApp().globalData.no_clear=1;
+ getApp().globalData.no_clear = 1;
var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : '';
if (!store_name)
store_name = getApp().globalData.setting.appName;
@@ -3872,10 +4669,10 @@ Page({
},
clickShare() {
- if(!getApp().globalData.user_id){
- getApp().goto("/packageE/pages/togoin/togoin");
- return false;
- }
+ if (!getApp().globalData.user_id) {
+ getApp().goto("/packageE/pages/togoin/togoin");
+ return false;
+ }
this.setData({ share_hidden: true, });
},
@@ -3906,206 +4703,206 @@ Page({
},
//获取预售的信息
- async get_pre_prom(func) {
- var th = this;
- var presell_id = null;
- var pre_arr = null;
-
- if (!th.data.pre_id) {
- var presell_id = th.data.presell_id;
- var url = "/api/weshop/marketing/marketingPresellList/list"
- var rd = {
- store_id: os.stoid,
- presell_id: presell_id,
- goods_id: th.data.gid
- }
- //------获取预售从表----------
- await getApp().request.promiseGet(url, {
- data: rd
- }).then(res => {
- if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {
- var arr = res.data.data[0];
- presell_id = arr.presell_id;
- th.setData({
- presellList: arr,
- })
- }
- })
+ async get_pre_prom(func) {
+ var th = this;
+ var presell_id = null;
+ var pre_arr = null;
- } else {
- //------获取预售从表----------
- await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/get/" + os.stoid + "/" + th.data.pre_id, {}).then(res => {
- if (res.data.code == 0 && res.data.data) {
- var arr = res.data.data;
- presell_id = arr.presell_id;
- th.setData({
- presellList: arr,
- })
- }
- })
+ if (!th.data.pre_id) {
+ var presell_id = th.data.presell_id;
+ var url = "/api/weshop/marketing/marketingPresellList/list"
+ var rd = {
+ store_id: os.stoid,
+ presell_id: presell_id,
+ goods_id: th.data.gid
+ }
+ //------获取预售从表----------
+ await getApp().request.promiseGet(url, {
+ data: rd
+ }).then(res => {
+ if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {
+ var arr = res.data.data[0];
+ presell_id = arr.presell_id;
+ th.setData({
+ presellList: arr,
+ })
}
+ })
- if (!presell_id) {
- wx.showToast({title: "未找到活动商品", icon: 'none', duration: 3000});
- ut.wx_back();
- return false;
+ } else {
+ //------获取预售从表----------
+ await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/get/" + os.stoid + "/" + th.data.pre_id, {}).then(res => {
+ if (res.data.code == 0 && res.data.data) {
+ var arr = res.data.data;
+ presell_id = arr.presell_id;
+ th.setData({
+ presellList: arr,
+ })
}
+ })
+ }
- var gnext=1;
- //------获取预售主表----------
- await getApp().request.promiseGet(`/api/weshop/marketing/marketingPresellForm/get/${os.stoid}/${presell_id}`, {}).then(res => {
- if (res.data.code == 0 && res.data.data) {
- var act_data = res.data.data;
- if (act_data.is_end) {
- wx.showToast({title: "活动已经结束", icon: 'none', duration: 3000});
- setTimeout(function () {
- ut.wx_back();
- }, 2000)
- gnext=0;
- return false;
- }
- if (act_data.isuse == 0) {
- wx.showToast({title: "活动未启用", icon: 'none', duration: 3000});
- setTimeout(function () {
- ut.wx_back();
- }, 2000)
- gnext=0;
- return false;
- }
-
- var err_txt="活动定金时间已经结束";
- var end_time = act_data.end_time;
- if (act_data.presell_type == 1) {
- err_txt="活动时间已经结束";
- }
- if (end_time < ut.gettimestamp()) {
- wx.showToast({title:err_txt, icon: 'none', duration: 3000});
- setTimeout(function () {
- getApp().goto("/pages/index/index/index");
- }, 2000)
- gnext=0;
- return false;
- }
-
- if (act_data.presell_type == 0) {
- end_time = act_data.pay_enddate;
- err_txt="活动尾款时间已经结束";
- }
- if (end_time < ut.gettimestamp()) {
- wx.showToast({title:err_txt, icon: 'none', duration: 3000});
- setTimeout(function () {
- ut.wx_back();
- }, 2000)
- gnext=0;
- return false;
- }
-
- if (act_data.start_time > ut.gettimestamp()) {
- wx.showToast({title:"活动还未开始", icon: 'none', duration: 3000});
- setTimeout(function () {
- ut.wx_back();
- }, 2000)
- gnext=0;
- return false;
- }
+ if (!presell_id) {
+ wx.showToast({ title: "未找到活动商品", icon: 'none', duration: 3000 });
+ ut.wx_back();
+ return false;
+ }
- th.setData({
- presellForm: res.data.data,
- });
- th.countDown(res.data.data.end_time)
- }
- })
+ var gnext = 1;
+ //------获取预售主表----------
+ await getApp().request.promiseGet(`/api/weshop/marketing/marketingPresellForm/get/${os.stoid}/${presell_id}`, {}).then(res => {
+ if (res.data.code == 0 && res.data.data) {
+ var act_data = res.data.data;
+ if (act_data.is_end) {
+ wx.showToast({ title: "活动已经结束", icon: 'none', duration: 3000 });
+ setTimeout(function () {
+ ut.wx_back();
+ }, 2000)
+ gnext = 0;
+ return false;
+ }
+ if (act_data.isuse == 0) {
+ wx.showToast({ title: "活动未启用", icon: 'none', duration: 3000 });
+ setTimeout(function () {
+ ut.wx_back();
+ }, 2000)
+ gnext = 0;
+ return false;
+ }
- if(!gnext){
- return false;
+ var err_txt = "活动定金时间已经结束";
+ var end_time = act_data.end_time;
+ if (act_data.presell_type == 1) {
+ err_txt = "活动时间已经结束";
+ }
+ if (end_time < ut.gettimestamp()) {
+ wx.showToast({ title: err_txt, icon: 'none', duration: 3000 });
+ setTimeout(function () {
+ getApp().goto("/pages/index/index/index");
+ }, 2000)
+ gnext = 0;
+ return false;
}
- var userInfo = getApp().globalData.userInfo;
- var pre_data = {store_id: os.stoid, is_end: 0, timetype: 1, isuse: 1, prom_type: 8, prom_id: presell_id,pageSize:1000};
- if (userInfo) {
- pre_data.user_id = userInfo.user_id;
+ if (act_data.presell_type == 0) {
+ end_time = act_data.pay_enddate;
+ err_txt = "活动尾款时间已经结束";
}
- await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/page", {
- data: pre_data,
- }).then(e => {
- if (e.data.code == 0 && e.data.data.pageData && e.data.data.pageData.length > 0) {
-
- th.data.all_pre_goods = e.data.data.pageData;
- var idx = e.data.data.pageData.findIndex(function (ele) {
- return ele.id == th.data.presellList.id;
- })
-
- pre_arr = e.data.data.pageData[idx];
- th.setData({pre_arr: pre_arr,show:1})
- th.data.prom_buy_limit = pre_arr.vip_butyqty;
- }
- })
- if (!pre_arr) {
- wx.showToast({title: "当前会员身份不符或者时间已过期,无法参与", icon: 'none', duration: 3000});
- setTimeout(function () {
- ut.wx_back();
- }, 2000)
- return false;
+ if (end_time < ut.gettimestamp()) {
+ wx.showToast({ title: err_txt, icon: 'none', duration: 3000 });
+ setTimeout(function () {
+ ut.wx_back();
+ }, 2000)
+ gnext = 0;
+ return false;
}
- if (func) {
- func();
+
+ if (act_data.start_time > ut.gettimestamp()) {
+ wx.showToast({ title: "活动还未开始", icon: 'none', duration: 3000 });
+ setTimeout(function () {
+ ut.wx_back();
+ }, 2000)
+ gnext = 0;
+ return false;
}
- },
- con_weixin:function () {
- getApp().con_wx(this);
- },
-
- // 预览海报
- previewPoster() {
- getApp().globalData.no_clear=1;
- wx.previewImage({
- current: this.data.shareImgPath, // 当前显示图片的http链接
- urls: [this.data.shareImgPath] ,// 需要预览的图片http链接列表
- });
- },
-
-
- click_contact:function () {
- getApp().globalData.no_clear=1;
- },
-
- //打开客服操作菜单
- openCS() {
- // 判断会员状态
- let user_info = getApp().globalData.userInfo;
- if (user_info == null || user_info.mobile == undefined || user_info.mobile == '' || user_info.mobile == null) {
- wx.navigateTo({
- url: '/packageE/pages/togoin/togoin',
- })
- return false;
- };
- // csType/在线客服设置:
- // 0关闭(如果有设置热线电话,则显示拨打热线电话)、
- // 1小程序客服、
- // 2企业微信客服
- if(this.data.sys_switch) {
- let csType = this.data.sys_switch.weapp_customertype;
- if(csType == 0) {
- // 拨打电话号码
- this.contactService();
- } else {
- this.getTel()
- .then(() => {
- self.setData({
- hiddenCS: false,
- });
- });
- };
- };
-
- },
-
- //关闭客服操作菜单
- closeCS() {
- this.setData({
- hiddenCS: true,
- });
- },
+ th.setData({
+ presellForm: res.data.data,
+ });
+ th.countDown(res.data.data.end_time)
+ }
+ })
+
+ if (!gnext) {
+ return false;
+ }
+
+ var userInfo = getApp().globalData.userInfo;
+ var pre_data = { store_id: os.stoid, is_end: 0, timetype: 1, isuse: 1, prom_type: 8, prom_id: presell_id, pageSize: 1000 };
+ if (userInfo) {
+ pre_data.user_id = userInfo.user_id;
+ }
+ await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/page", {
+ data: pre_data,
+ }).then(e => {
+ if (e.data.code == 0 && e.data.data.pageData && e.data.data.pageData.length > 0) {
+
+ th.data.all_pre_goods = e.data.data.pageData;
+ var idx = e.data.data.pageData.findIndex(function (ele) {
+ return ele.id == th.data.presellList.id;
+ })
+
+ pre_arr = e.data.data.pageData[idx];
+ th.setData({ pre_arr: pre_arr, show: 1 })
+ th.data.prom_buy_limit = pre_arr.vip_butyqty;
+ }
+ })
+ if (!pre_arr) {
+ wx.showToast({ title: "当前会员身份不符或者时间已过期,无法参与", icon: 'none', duration: 3000 });
+ setTimeout(function () {
+ ut.wx_back();
+ }, 2000)
+ return false;
+ }
+ if (func) {
+ func();
+ }
+ },
+
+ con_weixin: function () {
+ getApp().con_wx(this);
+ },
+
+ // 预览海报
+ previewPoster() {
+ getApp().globalData.no_clear = 1;
+ wx.previewImage({
+ current: this.data.shareImgPath, // 当前显示图片的http链接
+ urls: [this.data.shareImgPath],// 需要预览的图片http链接列表
+ });
+ },
+
+
+ click_contact: function () {
+ getApp().globalData.no_clear = 1;
+ },
+
+ //打开客服操作菜单
+ openCS() {
+ // 判断会员状态
+ let user_info = getApp().globalData.userInfo;
+ if (user_info == null || user_info.mobile == undefined || user_info.mobile == '' || user_info.mobile == null) {
+ wx.navigateTo({
+ url: '/packageE/pages/togoin/togoin',
+ })
+ return false;
+ };
+ // csType/在线客服设置:
+ // 0关闭(如果有设置热线电话,则显示拨打热线电话)、
+ // 1小程序客服、
+ // 2企业微信客服
+ if (this.data.sys_switch) {
+ let csType = this.data.sys_switch.weapp_customertype;
+ if (csType == 0) {
+ // 拨打电话号码
+ this.contactService();
+ } else {
+ this.getTel()
+ .then(() => {
+ self.setData({
+ hiddenCS: false,
+ });
+ });
+ };
+ };
+
+ },
+
+ //关闭客服操作菜单
+ closeCS() {
+ this.setData({
+ hiddenCS: true,
+ });
+ },
});
diff --git a/packageC/pages/presell/goodsInfo/goodsInfo.wxml b/packageC/pages/presell/goodsInfo/goodsInfo.wxml
index c0d7388..9c34892 100644
--- a/packageC/pages/presell/goodsInfo/goodsInfo.wxml
+++ b/packageC/pages/presell/goodsInfo/goodsInfo.wxml
@@ -524,7 +524,7 @@
- {{cartGoodsNum}}
+
购物车
@@ -939,7 +939,7 @@
-
+
@@ -951,7 +951,10 @@
-
+
+
+
+
diff --git a/packageC/pages/presell/pregoodsInfo/goodsInfo.js b/packageC/pages/presell/pregoodsInfo/goodsInfo.js
index d72e20a..243429b 100644
--- a/packageC/pages/presell/pregoodsInfo/goodsInfo.js
+++ b/packageC/pages/presell/pregoodsInfo/goodsInfo.js
@@ -556,7 +556,7 @@ Page({
data: {
store_id: os.stoid,
type: 1,
- pageSize: 3,
+ pageSize: 100,
page: 1,
is_share: 0,
},
@@ -564,7 +564,25 @@ Page({
fir_quan = res1.data.data.pageData;
})
}
-
+ //过滤不是本商品的单品优惠券-------------------
+ if(fir_quan.length > 0 ){
+ let goodInfo = ee.data.data
+ for (let index = fir_quan.length-1; index >= 0; index--) {
+ if (fir_quan[index].useobjecttype==20) { //判断是单品优惠券
+ if (fir_quan[index].useobjectno != goodInfo.goods_sn) {
+ fir_quan.splice(index,1)
+ }
+ }
+ }
+ }
+ let arr=[]
+ let length = fir_quan.length
+ if (length <= 3) {
+ arr=fir_quan
+ }else{
+ arr=fir_quan.splice(0,3);
+ }
+ //--------获取视频图片---------
//--------获取视频图片---------
await getApp().request.promiseGet("/api/weshop/goodsVideos/get/" + os.stoid + "/" + ee.data.gid, {
1: 1
@@ -580,7 +598,7 @@ Page({
is_collect: is_collect,
collect_id: collect_id,
categories3: categories3,
- fir_quan: fir_quan,
+ fir_quan: arr,
fir_comments: fir_com,
mapurl_f_img: mapurl_f_img,
mapurl: mapurl,
@@ -2578,7 +2596,18 @@ Page({
wx.hideLoading();
quan_list = res.data.data.pageData;
})
-
+ //过滤不是本商品的单品优惠券
+ if (quan_list.length > 0) {
+ let goodInfo = th.data.data
+ for (let index = quan_list.length-1; index >= 0; index--) {
+ if (quan_list[index].useobjecttype==20) { //判断是单品优惠券
+ if (quan_list[index].useobjectno != goodInfo.goods_sn) {
+ quan_list.splice(index,1)
+ }
+ }
+ }
+ }
+ //------------------------
if (quan_list) {
for (var ind in quan_list) {
var ep = quan_list[ind];
@@ -3115,8 +3144,14 @@ Page({
tt();
},
fail: function (res) {
- ee.data.share_goods_img = "../../../../images/share/default_g_img.gif"; //分享的图片不能用网络的
- tt();
+ //获取默认空白图
+ wx.getImageInfo({
+ src: ee.data.iurl+'/miniapp/images/default_g_img.gif',
+ success: function(res) {
+ ee.data.share_goods_img = res.path; //分享的图片不能用网络的
+ tt();
+ }
+ })
}
});
},
diff --git a/packageD/pages/user/coupons/coupons.js b/packageD/pages/user/coupons/coupons.js
index 92104c9..680eb67 100644
--- a/packageD/pages/user/coupons/coupons.js
+++ b/packageD/pages/user/coupons/coupons.js
@@ -11,10 +11,10 @@ const {
qrcode
} = require('../../../../utils/index.js');
let _this = null;
-
+
Page({
data: {
-
+ iurl: getApp().globalData.setting.imghost,
val:false,
datet: "",
dates: "",
@@ -96,9 +96,47 @@ Page({
},
-
+ //跳转商品
+ nvShop(){
+ let url= '/pages/goods/goodsList/goodsList'
+ getApp().goto(url)
+ },
+ //跳转商品详情
+ nvShopInfo(e){
+ let useobjectid = e.currentTarget.dataset.useobjectid;
+ //------------------------------------------------
+ getApp().request.get('/api/weshop/goods/list', {
+ data: {
+ store_id: os.stoid,
+ erpwareid: useobjectid,
+ },
+ success(res) {
+ if (res.data.code ==0) {
+ let good = res.data.data;
+ if (good.length>0) {
+ let item = good[0]
+ let url = `/pages/goods/goodsInfo/goodsInfo?goods_id=${item.goods_id}&prom_type=${item.prom_type}&prom_id=${item.prom_id}`
+ getApp().goto(url)
+ }else{
+ getApp().showWarning("该商品不存在");
+ }
+ }
+ }
+ })
-
+
+
+ // wx.reLaunch({
+ // url: '/pages/goods/goodsInfo/goodsInfo',
+ // })
+
+
+
+
+
+
+ //------------------------------------------------
+ },
// 点击选中二维码
click: function (e) {
diff --git a/packageD/pages/user/coupons/coupons.wxml b/packageD/pages/user/coupons/coupons.wxml
index dae9b75..ce8691e 100644
--- a/packageD/pages/user/coupons/coupons.wxml
+++ b/packageD/pages/user/coupons/coupons.wxml
@@ -20,11 +20,15 @@
包邮券
微券来源: 微信商城
- {{filter.showBtnText(currentIndex)}}
+ {{filter.showBtnText(currentIndex)}}
-
+
有效期:{{detail.use_start_time==null?" " : time.format_time(detail.use_start_time)}} 至 {{time.format_time(detail.use_end_time)}}
有效期:不限
+
+
+
+
@@ -46,15 +50,17 @@
微券来源: {{detail.SendMan==null?'线下发放':detail.SendMan==''?"线下发放":detail.SendMan}}
- {{filter.showBtnText(currentIndex)}}
+ {{filter.showBtnText(currentIndex)}}
-
+
有效期:{{detail.BeginDate==null ? " " : time.replace_time2(detail.BeginDate)}} 至 {{time.replace_time2(detail.ValidDate)}}
有效期:不限
+
+
-
+
使用说明:{{filter.getNum(detail.Sum)}}元优惠券,{{(detail.UseObjectID==null || detail.UseObjectID=='')?"全场通用":"仅限"+(detail.UseObjectName)+"使用"}},满 {{detail.BuySum==null || detail.BuySum==''?filter.getNum(0):filter.getNum(detail.BuySum)}}元使用 {{detail.region_list_name==null || detail.region_list_name==''?"":",不包邮地区:"+region_list_name}};{{detail.Remark1}};活动名称:{{detail.ActName}}、活动编号:{{detail.ActNo}}
diff --git a/pages/user/Detailed/Detailed.js b/packageE/pages/user/Detailed/Detailed.js
index 16cdf46..3109a8b 100644
--- a/pages/user/Detailed/Detailed.js
+++ b/packageE/pages/user/Detailed/Detailed.js
@@ -3,9 +3,9 @@ var t = getApp(),
a = t.request,
o = t.globalData.setting,
os = o,
- i = require("../../../utils/util.js"),
+ i = require("../../../../utils/util.js"),
ut = i,
- s = require("../../../utils/common.js");
+ s = require("../../../../utils/common.js");
Page({
/**
@@ -222,12 +222,12 @@ Page({
//开启画布
const ctx = wx.createCanvasContext('myCanvas');
//先画背景
- ctx.drawImage("../../../images/share/mackground.png", 0, 0, 554 * unit, 899 * unit);
+ ctx.drawImage("../../../../images/share/mackground.png", 0, 0, 554 * unit, 899 * unit);
ctx.setFontSize(24 * unit);
ctx.setFillStyle("rgb(0,0,0)");
ctx.fillText(nickname, 152 * unit, 76 * unit);
var width = 24 * nickname.length * unit + 2 * unit;
- var tj_path = "../../../images/share/q_tj.png";
+ var tj_path = "../../../../images/share/q_tj.png";
ctx.drawImage(tj_path, 152 * unit + width, 54 * unit, 95 * unit, 30 * unit);
ctx.setFontSize(18 * unit);
ctx.setLineJoin('round'); //交点设置成圆角
diff --git a/pages/user/Detailed/Detailed.json b/packageE/pages/user/Detailed/Detailed.json
index f681560..f681560 100644
--- a/pages/user/Detailed/Detailed.json
+++ b/packageE/pages/user/Detailed/Detailed.json
diff --git a/pages/user/Detailed/Detailed.wxml b/packageE/pages/user/Detailed/Detailed.wxml
index 1518fcc..7a70cab 100644
--- a/pages/user/Detailed/Detailed.wxml
+++ b/packageE/pages/user/Detailed/Detailed.wxml
@@ -5,7 +5,7 @@
- {{datet}}
+ {{datet}}
diff --git a/pages/user/Detailed/Detailed.wxss b/packageE/pages/user/Detailed/Detailed.wxss
index 97a6d96..97a6d96 100644
--- a/pages/user/Detailed/Detailed.wxss
+++ b/packageE/pages/user/Detailed/Detailed.wxss
diff --git a/pages/user/user_fw/user_fw.js b/packageE/pages/user/user_fw/user_fw.js
index d3a057f..548a5be 100644
--- a/pages/user/user_fw/user_fw.js
+++ b/packageE/pages/user/user_fw/user_fw.js
@@ -1,7 +1,7 @@
// pages/user/userfw/userfw.js
var e = getApp(),os = e.globalData.setting;
-var utils = require('../../../utils/util.js');
-var regeneratorRuntime = require('../../../utils/runtime.js');
+var utils = require('../../../../utils/util.js');
+var regeneratorRuntime = require('../../../../utils/runtime.js');
Page({
/**
diff --git a/pages/user/user_fw/user_fw.json b/packageE/pages/user/user_fw/user_fw.json
index 88d15ea..88d15ea 100644
--- a/pages/user/user_fw/user_fw.json
+++ b/packageE/pages/user/user_fw/user_fw.json
diff --git a/pages/user/user_fw/user_fw.wxml b/packageE/pages/user/user_fw/user_fw.wxml
index 838b119..54d0c30 100644
--- a/pages/user/user_fw/user_fw.wxml
+++ b/packageE/pages/user/user_fw/user_fw.wxml
@@ -1,4 +1,4 @@
-
+
diff --git a/pages/user/user_fw/user_fw.wxss b/packageE/pages/user/user_fw/user_fw.wxss
index ce0532e..ce0532e 100644
--- a/pages/user/user_fw/user_fw.wxss
+++ b/packageE/pages/user/user_fw/user_fw.wxss
diff --git a/pages/cart/cart/cart.js b/pages/cart/cart/cart.js
index 6fcc4ab..f23d607 100644
--- a/pages/cart/cart/cart.js
+++ b/pages/cart/cart/cart.js
@@ -28,6 +28,7 @@ Page({
up_dating: 0, //更新中
isreduce: 0, //商品数量是否可减
isadd: 0, //是否可以加商品数量
+ invalidList:[], //失效商品列表
card_field:"",
bconf:null,
@@ -48,9 +49,9 @@ Page({
},
onLoad: function () {
+
var a = this,
ee = a;
-
wx.setNavigationBarTitle({
title: "购物车",
@@ -65,7 +66,9 @@ Page({
onShow: function () {
//每次显示都清空
this.data.in_zhact_gdmap = {};
-
+ this.setData({
+ invalidList:[]
+ });
if (typeof this.getTabBar === 'function' && this.getTabBar()) {
var index = getApp().getPageIndex(this);
@@ -164,9 +167,39 @@ Page({
onUnLoad() {
getApp().globalData.cart_zh_act = null;
},
+
+ //失效商品处理
+ // invType 表示失效的原因,classType 表示类别 0 表示商品,1表示服务
+ disInvalid(item,invType=0,classType=0){
+ let invalidList = this.data.invalidList;
+ let off = true;
+ console.log('失效商品-----1')
+ console.log(item)
+ console.log('失效商品-----2')
+ invalidList.map(ite=>{
+ if(classType ==0 && ite.goods_id == item.goods_id){ //判断该商品是否存在于失效列表中
+ off = false;
+ }
+ if(classType ==1 && ite.service_id == item.service_id){ //判断该商品是否存在于失效列表中
+ off = false;
+ }
+ });
+ if(off){
+ if(invType==0){
+ item.invalid = '商品活动变动';
+ }else if(invType ==1){
+ item.invalid = '商品已下架';
+ }else{
+ item.invalid ="商品超出限购"
+ }
+ item.classType = classType
+ invalidList.push(item);
+ this.setData({invalidList});
+ }
+ },
//-------------获取购物车列表,要安装门店进行分类订单-----------
getCardList: function () {
-
+ this.setData({invalidList:[]}); //重置失效商品
var th = this;
//要获取会员是不是等级会员
@@ -218,6 +251,170 @@ Page({
}, 800)
}
},
+ //失效单选
+ inCheck_th_item: async function(e){
+ console.log('失效单选');
+ console.log(e);
+ let i = e.currentTarget.dataset.item;
+ let invalidList = this.data.invalidList;
+ console.log(i)
+ console.log(invalidList[i])
+ invalidList[i].selected = invalidList[i].selected == 1 ? 0 : 1;
+ console.log(invalidList);
+ this.setData({invalidList});
+ console.log(this.data.invalidList);
+ // this.doCheckAll();
+
+ },
+ //清空失效宝贝
+ delInva(obj=null){
+
+ var th = this;
+ wx.showModal({
+ title: '提示',
+ content: '确认要清空全部失效商品吗?',
+ success(res) {
+ if (res.confirm) {
+ let ainvalid='';
+ let binvalid='';
+ var user_id = getApp().globalData.user_id;
+
+ let ab = 0; //选中
+ let abc = 0; //
+ let arr = obj.id ? [obj] : th.data.invalidList
+ console.log('失效-----')
+ console.log(arr);
+ arr.map(item=>{
+ if (item.classType ==0 ) {
+ ainvalid+=item.id + ',';
+ ab = 1;
+ }
+ if (item.classType ==1 ) {
+ binvalid+=item.id + ',';
+ abc = 1;
+ }
+ });
+
+
+ if (ab == 0 && abc == 0 ) {
+ t.my_warnning('没有需要清空的失效宝贝', 0, th);
+ return false;
+ }
+ if (ab) {
+ ainvalid = ainvalid.substring(0, ainvalid.length - 1);
+ //要删除购物车中的商品
+ var url = '/api/weshop/cart/delIds/' + oo.stoid + '/' + user_id + '/' + ainvalid;
+ getApp().request.delete(url, {
+ success: function (t) {
+ th.getCardList();
+ getApp().requestCardNum(th);
+ }
+ });
+ }
+ if (abc) {
+ binvalid = binvalid.substring(0, binvalid.length - 1);
+ //要删除购物车中的商品
+ var url = '/api/weshop/cartService/delIds/' + oo.stoid + '/' + user_id + '/' + binvalid;
+ getApp().request.delete(url, {
+ success: function (t) {
+ th.getCardList();
+ getApp().requestCardNum(th);
+ }
+ });
+ }
+
+ }
+ }
+ })
+
+
+
+ },
+
+ //---------点击收藏------------
+ collectGoods: async function () {
+
+ let t = this
+ let timestamp = Date.parse(new Date());
+ timestamp = timestamp / 1000;
+ let d = {
+ // goods_id: t.data.data.goods_id,
+ user_id: app.globalData.user_id,
+ store_id: oo.stoid,
+ add_time: timestamp,
+ };
+ //加入收藏夹就是导购的ID
+ if (getApp().globalData.guide_id) {
+ d.guide_id = getApp().globalData.guide_id;
+ d.guide_type = 2;
+ }
+ let off = false
+ let errOff = false
+ var invalidList= [...this.data.invalidList]
+ var arr=[]
+ invalidList.map(async (item,index)=>{
+ if (item.selected) {
+ off = true
+ if(item.classType ==1 ){
+ d.goods_id = item.service_id
+ d.type = 1
+ }else{
+ d.goods_id = item.goods_id
+ d.type =0
+ }
+ let is_collect = 0
+ //------是否收藏----------
+ await getApp().request.promiseGet("/api/weshop/goodscollect/page", {
+ data: {
+ store_id: oo.stoid,
+ goods_id: d.goods_id,
+ user_id: app.globalData.user_id,
+ }
+ }).then(res => {
+ let t = res;
+ let data = t.data.data.pageData;
+ if (data && data.length > 0) {
+ is_collect =1
+ }
+ })
+ if (is_collect) {
+ t.delInva(item)
+ return
+ }
+ await getApp().request.post("/api/weshop/goodscollect/save", { //添加收藏
+ data: d,
+ success: function (e) {
+ t.data.is_collect_load = 0;
+ if (e.data.code == 0) {
+ t.delInva(item)
+ }else{
+ errOff = true
+ arr.push(item)
+ }
+ }
+ });
+ }else{
+ arr.push(item)
+ }
+ });
+ if (off) {
+ t.setData({
+ invalidList:arr
+ })
+ if (errOff) {
+ getApp().my_warnning('移到收藏夹错误', 0, t);
+ }else{
+ wx.showToast({
+ title: "收藏成功",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ console.log('移动成功')
+ }else{
+ getApp().my_warnning('请先选择失效宝贝', 0, t);
+ }
+ },
//-----真的获取购物车--------
get_cart: function () {
@@ -287,10 +484,11 @@ Page({
var tt = ut.gettimestamp();
//如果商品下架了,或者商品是赠品,一开始都要清除
if ((good.down_time > 0 && good.down_time < tt) || good.is_on_sale == 0) {
- var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
- getApp().request.delete(url, {
- success: function (t) {}
- });
+ // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
+ // getApp().request.delete(url, {
+ // success: function (t) {}
+ // });
+ th.disInvalid(item,1);
//商品已经下架
continue;
}
@@ -307,8 +505,9 @@ Page({
if (item.goods_num + goodsbuynum > limit && limit > 0) {
var cbuy = limit - goodsbuynum;
if (cbuy <= 0) {
- var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
- a.delete(url, {});
+ // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
+ // a.delete(url, {});
+ th.disInvalid(item,2);
continue;
}
//-- 购物车更新 --
@@ -323,23 +522,72 @@ Page({
})
item.goods_num = cbuy;
}
-
+ //判断如果是普通商品,后面参加活动了,变成失效商品
+ if (item.prom_type == 0) {
+ var prom = null;
+ var now = ut.gettimestamp();
+ await getApp().request.promiseGet(`/api/weshop/activitylist/listGoodActInfo2`, {
+ data:{
+ "store_id": oo.stoid,
+ "goods_id": item.goods_id,
+ "user_id": user_id,
+ }
+ }).then(res => {
+ if (res.data.code == 0) {
+ prom = res.data.data
+ }
+ })
+ let prom_true = 0
+ let prom_id=0
+ if (prom) {
+ prom.map(item=>{
+ if (item.prom_type==3 || item.prom_type==7) {
+ prom_true = item.prom_type
+ prom_id = item.act_id
+ }
+ })
+ }
+ if (prom_true) {
+ //-- 购物车更新 --
+ var updata1 = {
+ id: item.id,
+ prom_type: prom_true,
+ prom_id,
+ store_id: os.stoid,
+ user_id: getApp().globalData.userInfo.user_id
+ };
+ item.prom_id = prom_id
+ item.prom_type = prom_true
+ getApp().request.put("/api/weshop/cart/update", {
+ data: updata1,
+ })
+
+ }else{
+ if(prom && !item.is_integral_normal && !item.is_pd_normal){
+ th.disInvalid(item);
+ continue;
+ }
+ }
+ }
//如果秒杀活动都去掉了,或者结束了,那么这个商品也没有必要留着
if (item.prom_type == 1) {
var prom = null;
var now = ut.gettimestamp();
await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + os.stoid + '/' + user_id + "/" + item.prom_id, {}).then(res => {
- if (res.data.code == 0) {
+ console.log('活动情况----------------')
+ console.log(res)
+ if (res.data.code == 0) {
prom = res.data.data;
prom.price = prom.user_price;
}
})
//---如果互动都已经过期,或者还未开始,或者无活动
if (!prom || prom.is_end == 1 || prom.end_time < now || prom.start_time > now) {
- var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
- a.delete(url, {
- success: function (t) {}
- });
+ // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
+ // a.delete(url, {
+ // success: function (t) {}
+ // });
+ th.disInvalid(item);
//商品已经下架
continue;
}
@@ -348,8 +596,9 @@ Page({
if (item.goods_num + promgoodsbuynum > prom.buy_limit && prom.buy_limit > 0) {
var cbuy = prom.buy_limit - promgoodsbuynum;
if (cbuy <= 0) {
- var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
- a.delete(url, {});
+ // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
+ // a.delete(url, {});
+ th.disInvalid(item,2);
continue;
}
//-- 购物车更新 --
@@ -380,6 +629,30 @@ Page({
})
}
}
+ // 判断团购活动都去掉了,或者结束了,那么这个商品也没有必要留着
+ else if(item.prom_type ==2){
+ var prom = null;
+ var now = ut.gettimestamp();
+ await getApp().request.promiseGet('/api/weshop/goods/groupBuy/getActInfo/'+ oo.stoid + '/' + item.goods_id + '/' + item.prom_id, {}).then(res => {
+ if (res.data.code == 0) {
+ prom = res.data.data;
+ prom.price = prom.user_price;
+ }
+ });
+ //---如果互动都已经过期,或者还未开始,或者无活动
+ if (!prom || prom.is_end == 1 || prom.end_time < now || prom.start_time > now) {
+ // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
+ // a.delete(url, {
+ // success: function (t) {}
+ // });
+ console.log('团购活动-----');
+ th.disInvalid(item);
+ //商品已经下架
+ continue;
+ }
+
+
+ }
//--判断优惠活动有没有过期,--
else if (item.prom_type == 3) {
var isok = 1,is_g_prom=0;
@@ -405,25 +678,37 @@ Page({
if (res.data.code == 0) {
var r_data = res.data.data;
if (!r_data.promGoodsLists) {
- var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
- getApp().request.delete(url, {});
+ // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
+ // getApp().request.delete(url, {});
//商品已经无活动
- isok = 0;
+ // th.disInvalid(item);
+ // isok = 0;
+ item.prom_type = 0
+ //购物车更新
+ th.cartUpFn(item)
} else {
//如果活动的ID不一样,说明原先的活动已经没有参与了或者过期了
if (item.prom_id != r_data.promGoodsLists[0].prom_id) {
- var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
- getApp().request.delete(url, {});
+ // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
+ // getApp().request.delete(url, {});
//商品已经下架
- isok = 0;
+ // th.disInvalid(item);
+ // isok = 0;
+ item.prom_type = 0
+ //购物车更新
+ th.cartUpFn(item)
}
}
} else {
- var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
- getApp().request.delete(url, {});
- //商品已经下架
- isok = 0;
+ // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
+ // getApp().request.delete(url, {});
+ // th.disInvalid(item);
+ // //商品已经下架
+ // isok = 0;
+ item.prom_type = 0
+ //购物车更新
+ th.cartUpFn(item)
}
})
@@ -432,42 +717,53 @@ Page({
if (res.data.code == 0) {
var r_data = res.data.data;
if (!r_data.promGoodsLists) {
- var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
- getApp().request.delete(url, {});
- //商品已经无活动
- isok = 0;
+ // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
+ // getApp().request.delete(url, {});
+ // th.disInvalid(item);
+ // //商品已经无活动
+ // isok = 0;
+ item.prom_type = 0
+ //购物车更新
+ th.cartUpFn(item)
} else {
//如果活动的ID不一样,说明原先的活动已经没有参与了或者过期了
if (item.prom_id != r_data.promGoodsLists[0].prom_id) {
- var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
- getApp().request.delete(url, {});
- //商品已经下架
- isok = 0;
+ // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
+ // getApp().request.delete(url, {});
+ // th.disInvalid(item);
+ // //商品已经下架
+ // isok = 0;
+ item.prom_type = 0
+ //购物车更新
+ th.cartUpFn(item)
}
}
} else {
- var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
- getApp().request.delete(url, {});
- //商品已经下架
- isok = 0;
+ // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
+ // getApp().request.delete(url, {});
+ // th.disInvalid(item,1);
+ // //商品已经下架
+ // isok = 0;
+ item.prom_type = 0
+ //购物车更新
+ th.cartUpFn(item)
}
})
-
}
-
- if (!isok) continue;
+ // if (!isok) continue;
}
else if (item.prom_type == 7) {
+ console.log('组合购------------');
if(!th.data.zuhe_map[item.prom_id]){
-
+ console.log('组1')
//如果有组合购
var isok = 1;
var is_flag = 1;
var act = null;
var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + item.prom_id + "/" + getApp().globalData.user_id;
await getApp().request.promiseGet(url, {}).then(res => {
- console.log(res, 1000);
+ console.log(res);
if (res.data.code == 0 && res.data.data) {
if (res.data.data.is_show != 1) {
isok = 0;
@@ -492,52 +788,65 @@ Page({
}
})
if (!isok) {
- var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
- getApp().request.delete(url, {});
- th.data.zuhe_map[item.prom_id] = -1;
- continue;
+ // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
+ // getApp().request.delete(url, {});
+ //组合购失效不处理
+ // th.disInvalid(item);
+ // th.data.zuhe_map[item.prom_id] = -1;
+ // continue;
+ item.prom_type = 0
+ //购物车更新
+ th.cartUpFn(item)
+ }else{
+ th.data.zuhe_map[item.prom_id] = act;
+ var url1 = "/api/weshop/prom/zhbuyGoods/page";
+ var req_data = {
+ page: 1,
+ pageSize: 2000,
+ store_id: os.stoid,
+ zh_id: item.prom_id,
+ }
+ await getApp().request.promiseGet(url1, {
+ data: req_data
+ }).then(res => {
+ console.log(res, 2000);
+ if (ut.ajax_ok(res)) {
+ var gdlist = res.data.data.pageData;
+ gdlist.forEach(i => {
+ if (item.goods_id == i.goods_id && !is_flag) {
+ item.prom_type = 0;
+ item.prom_type1 = 0;
+ item.prom_id = 0;
+ item.prom_id1 = 0
+ }
+ })
+ th.data.zuhe_map_good[item.prom_id] = gdlist;
+ }
+ })
}
- th.data.zuhe_map[item.prom_id] = act;
- var url1 = "/api/weshop/prom/zhbuyGoods/page";
- var req_data = {
- page: 1,
- pageSize: 2000,
- store_id: os.stoid,
- zh_id: item.prom_id,
- }
- await getApp().request.promiseGet(url1, {
- data: req_data
- }).then(res => {
- console.log(res, 2000);
- if (ut.ajax_ok(res)) {
- var gdlist = res.data.data.pageData;
- gdlist.forEach(i => {
- if (item.goods_id == i.goods_id && !is_flag) {
- item.prom_type = 0;
- item.prom_type1 = 0;
- item.prom_id = 0;
- item.prom_id1 = 0
- }
- })
- th.data.zuhe_map_good[item.prom_id] = gdlist;
- }
- })
}
-
+ console.log('组2')
if (th.data.zuhe_map[item.prom_id] && th.data.zuhe_map[item.prom_id] != -1) {
+ console.log('组3')
var gdlist = th.data.zuhe_map_good[item.prom_id];
var t_item = gdlist.find(function (ele) {
return ele.goods_id == item.goods_id
})
if (!t_item) {
- var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
- getApp().request.delete(url, {});
- th.data.zuhe_map[item.prom_id] = -1;
- continue;
- }
- item.buyqty = t_item.buyqty;
- item.zh_b_num = promgoodsbuynum;
- item.act = th.data.zuhe_map[item.prom_id];
+ // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
+ // getApp().request.delete(url, {});
+ //组合购不处理
+ // th.disInvalid(item,1);
+ // th.data.zuhe_map[item.prom_id] = -1;
+ // continue;
+ item.prom_type = 0
+ //购物车更新
+ th.cartUpFn(item)
+ }else{
+ item.buyqty = t_item.buyqty;
+ item.zh_b_num = promgoodsbuynum;
+ item.act = th.data.zuhe_map[item.prom_id];
+ }
} //else{
// var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
// getApp().request.delete(url, {});
@@ -578,8 +887,9 @@ Page({
}
})
if (!isok){
- var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
- getApp().request.delete(url, {});
+ // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
+ // getApp().request.delete(url, {});
+ th.disInvalid(item,1);
th.data.ladder_map[item.prom_id]=-1;
continue;
}
@@ -814,10 +1124,23 @@ Page({
}
});
},
-
+ //商品购物车修改
+ cartUpFn(item){
+ let updata1 = {
+ id: item.id,
+ prom_type: 0,
+ prom_id:item.prom_id,
+ store_id: os.stoid,
+ user_id: getApp().globalData.userInfo.user_id
+ };
+ getApp().request.put("/api/weshop/cart/update", {
+ data: updata1,
+ })
+ },
//-----真的获取购物车--------
get_ser_cart: function () {
var th = this;
+ var user_id = getApp().globalData.user_id;
var rd = Math.random().toString(36).substr(2, 15);
getApp().request.get("/api/weshop/cartService/page", {
data: {
@@ -841,23 +1164,101 @@ Page({
good = res.data.data;
})
if (!good) {
- var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
- getApp().request.delete(url, {
- success: function (t) {}
- });
+ // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
+ // getApp().request.delete(url, {
+ // success: function (t) {}
+ // });
+ th.disInvalid({
+ ...item,
+ original_img: good.imgUrl
+ },1,1);
continue;
}
-
+
//如果商品下架了,或者商品是赠品,一开始都要清除
if (good.is_show == 0) {
- var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
- getApp().request.delete(url, {
- success: function (t) {}
- });
+ // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
+ // getApp().request.delete(url, {
+ // success: function (t) {}
+ // });
+ th.disInvalid({
+ ...item,
+ original_img: good.imgUrl
+ },1,1);
//商品已经下架
continue;
}
+ if(item.prom_type ==0){
+ var prom = null;
+ var now = ut.gettimestamp();
+ await getApp().request.promiseGet(`/api/weshop/activitylist/listGoodActInfo2`, {
+ data:{
+ store_id: oo.stoid,
+ goods_id: item.service_id,
+ user_id: user_id,
+ goods_type: 1,
+ }
+ }).then(res => {
+ console.log('服务卡活动信息')
+ console.log(res)
+ console.log('服务卡活动信息-------------')
+ if (res.data.code == 0) {
+ prom = res.data.data
+ }
+ })
+ if(prom){
+ th.disInvalid({
+ ...item,
+ original_img: good.imgUrl
+ },2,1)
+ continue;
+ }
+ }
+
+ if (item.prom_type == 1) {
+ var prom = null;
+ var now = ut.gettimestamp();
+ await getApp().request.promiseGet('/api/ms/flash_sale/getNew/' + os.stoid + '/' + user_id + '/' + item.prom_id, {}).then(res => {
+ if (res.data.code == 0) {
+ prom = res.data.data;
+ prom.price = prom.user_price;
+ }
+ });
+ console.log('服务的秒杀信息')
+ console.log(prom)
+ //---如果互动都已经过期,或者还未开始,或者无活动
+ if (!prom || prom.is_end == 1 || prom.end_time < now || prom.start_time > now) {
+ th.disInvalid({
+ ...item,
+ original_img: good.imgUrl
+ },0,1);
+ continue;
+ }
+ //判断秒杀的限购
+ var msNum=0
+ await getApp().request.promiseGet("/api/weshop/rechargeServicelist/getUserBuyGoodsNum", {
+ data: {
+ store_id: os.stoid,
+ user_id: user_id,
+ card_id: prom.goods_id,
+ }
+ }).then(res=>{
+ if (res.data.code==0) {
+ msNum = res.data.data.cardbuynum
+ console.log('秒杀限购:'+msNum)
+ }
+ })
+ }
+ if (msNum && (msNum >= prom.buy_limit) ) {
+ console.log('秒杀限购')
+ th.disInvalid({
+ ...item,
+ original_img: good.imgUrl
+ },2,1)
+ continue;
+ }
+
all_num += item.goods_num;
item.img_url = oo.imghost + good.imgUrl;
item.selected = 0;
@@ -912,6 +1313,7 @@ Page({
},
+
//设置莫个门店的所有线下价格
async set_offline(list) {
var th = this;
@@ -1625,6 +2027,11 @@ Page({
} else {
if(item[c].prom_type==7){
//先把商品放入组合计算的专用的区域
+ console.log('是组合商品---')
+ console.log(car);
+ console.log(a)
+ console.log(obj)
+ console.log('......................')
zh_calc.add_zhprom(car,a,obj);
}else if(item[c].prom_type==10){
ladder_calc.add_ladder_prom(car,a,obj);
@@ -1644,6 +2051,8 @@ Page({
//总的价格,把组合商品的价格拿出来
var zh_calc_res=zh_calc.calculate_zh(car,a,th);
+ console.log('.组合价-----------')
+ console.log(zh_calc_res)
//总的价格,把阶梯促销商品的价格拿出来
var ladder_calc_res=ladder_calc.calculate_ladder(car,a,th);
@@ -1725,7 +2134,7 @@ Page({
function normal_check(store_count, goodsinfo, wareIds) {
//--- 看一下是不是线下库存 ---
- if (th.data.sales_rules == 2 && goodsinfo.prom_type != 7 && !goodsinfo.whsle_id) {
+ if (th.data.sales_rules == 2 && !goodsinfo.whsle_id) {
th.check_down_line(t, pitem, item, wareIds);
} else {
if (t.goods_num > store_count) {
@@ -2536,6 +2945,23 @@ Page({
}
}
}
+
+ //排除失效商品结算
+ this.data.invalidList.map(item=>{
+ if(item.selected && item.classType==0){
+ rq.put('/api/weshop/cart/update', {
+ data: {
+ id: item.id,
+ selected: 0,
+ store_id: oo.stoid
+ },
+ success: function (ee) {
+ console.log(ee);
+ }
+ });
+ }
+ })
+
if (ab == 0) {
t.my_warnning("未选择商品", 0, th);
wx.hideLoading();
@@ -2715,6 +3141,18 @@ Page({
});
}
}
+ //排除失效服务结算
+ this.data.invalidList.map(item=>{
+ if(item.selected && item.classType==1){
+ rq.promisePut('/api/weshop/cartService/update', {
+ data: {
+ id: item.id,
+ selected: 0,
+ store_id: oo.stoid
+ }
+ });
+ }
+ })
wx.hideLoading();
getApp().goto("/packageA/pages/cart2_ser/cart2_ser?is_cart=1");
}
@@ -2818,6 +3256,21 @@ Page({
});
}
+ setTimeout(()=>{
+ if ((!th.data.requestData|| th.data.requestData.length==0) && (!th.data.service_data|| th.data.service_data.length==0)){
+
+ console.log('---1111---bb');
+ var goods_list = th.selectComponent("#goods_list"); //组件的id
+ if (goods_list) {
+ goods_list.init();
+ goods_list.get_list();
+ }
+
+ }
+
+ },1200)
+
+
},
//跳到首页
goto: function (e) {
@@ -2923,8 +3376,9 @@ Page({
var item = list.goods[ii];
list.goods.splice(ii, 1);
if (item.prom_id == p_item[0] && item.prom_type == 3) {
- var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
- getApp().request.delete(url, {});
+ // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
+ // getApp().request.delete(url, {});
+ th.disInvalid(item);
}
}
continue;
@@ -3227,8 +3681,9 @@ Page({
var item = list.goods[ii];
list.goods.splice(ii, 1);
if (item.prom_id == p_item[0] && item.prom_type == 3) {
- var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
- getApp().request.delete(url, {});
+ // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
+ // getApp().request.delete(url, {});
+ th.disInvalid(item);
}
}
continue;
diff --git a/pages/cart/cart/cart.wxml b/pages/cart/cart/cart.wxml
index 60d4283..82571d8 100644
--- a/pages/cart/cart/cart.wxml
+++ b/pages/cart/cart/cart.wxml
@@ -23,7 +23,7 @@
-
+
@@ -238,11 +238,45 @@
-
-
+
+
+
+
+
+ 失效宝贝{{invalidList.length}}件
+
+ 移到收藏夹
+ 清空失效宝贝
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{items.goods_name || items.service_name}}
+
+
+
+
+ {{items.invalid}}
+
+
+
+
+
+
+
-
+
@@ -272,7 +306,7 @@
-
+
diff --git a/pages/cart/cart/cart.wxss b/pages/cart/cart/cart.wxss
index 0858710..699321e 100644
--- a/pages/cart/cart/cart.wxss
+++ b/pages/cart/cart/cart.wxss
@@ -30,6 +30,9 @@ page {
align-items: center;
justify-content: center;
background-color: rgb(255, 255, 255);
+ /*margin-bottom: 160rpx;*/
+}
+.container.margin_b{
margin-bottom: 160rpx;
}
@@ -222,7 +225,7 @@ radio {
}
.store {
- border-bottom: 7rpx solid rgb(245, 245, 245);
+ /* border-bottom: 7rpx solid rgb(245, 245, 245); */
}
.login-in {
position: relative;
diff --git a/pages/giftpack/giftpacklist/giftpacklist.js b/pages/giftpack/giftpacklist/giftpacklist.js
index 2646e3e..4254171 100644
--- a/pages/giftpack/giftpacklist/giftpacklist.js
+++ b/pages/giftpack/giftpacklist/giftpacklist.js
@@ -1126,8 +1126,14 @@ Page({
tt();
},
fail: function (res) {
- ee.data.share_goods_img = "../../../images/share/default_g_img.gif"; //分享的图片不能用网络的
- tt();
+ //获取默认空白图
+ wx.getImageInfo({
+ src: ee.data.iurl+'/miniapp/images/default_g_img.gif',
+ success: function(res) {
+ ee.data.share_goods_img = res.path; //分享的图片不能用网络的
+ tt();
+ }
+ })
}
});
},
diff --git a/pages/goods/categoryList/categoryList.js b/pages/goods/categoryList/categoryList.js
index d245ad4..676e71c 100644
--- a/pages/goods/categoryList/categoryList.js
+++ b/pages/goods/categoryList/categoryList.js
@@ -5,21 +5,26 @@ var i = function (i) {
};
}(require("../../../utils/LoadMore.js")), a = new i.default(), ut = require("../../../utils/util.js");
//t = i,e = t
+var nextTimeOff=null
Page({
data: {
- is_date:true,
+ is_date: true,
scrollHeight: 0,
- currentTab:-1,
- abc:0,
- windowHeight:0,
+ currentTab: -1,
+ abc: 0,
+ windowHeight: 0,
windowWidth: 0,
- eachLetterHeight:0,
- lettersPosition:0,
- catelist:null, //分类读取
+ eachLetterHeight: 0,
+ lettersPosition: 0,
+ catelist: null, //分类读取
nationlist: null,//国家读取
groups: null, //品牌读取
iurl: oo.imghost,//图片地址
-
+ nextShow:false, //是否跳转下个类型
+ nextShow2:false, //是否跳转下个类型
+ toupper:true,
+ sClientY:0, //滑动初始值
+ eClientY:0, //滑动终值
// 当前选择的导航字母
selected: 0,
// 选择字母视图滚动的位置id
@@ -27,55 +32,55 @@ Page({
// 导航字母
letters: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
'U', 'V', 'W', 'X', 'Y', 'Z'],
- //控制新旧分类版本
- is_used_share:0,
+ //控制新旧分类版本
+ is_used_share: 0,
//国家的控制属性
- is_country:1,
+ is_country: 1,
//品牌的控制属性
- is_brand:1,
+ is_brand: 1,
//选择分类的控制属性
- select_classify_on:223,
- index:223,
- classify_name:"国家",//项目类型
- brand_list:null,//品牌列表
-
- one_level_classify:[],// 新的版本左边的边分类1级
- is_level_three:0,//判断有没有3级
- cat_id:0,
+ select_classify_on: 223,
+ index: 223,
+ classify_name: "国家",//项目类型
+ brand_list: null,//品牌列表
+
+ one_level_classify: [],// 新的版本左边的边分类1级
+ is_level_three: 0,//判断有没有3级
+ cat_id: 0,
pl_timer: null,//只有品类的定时器
- is_pl_time:0,
- requestData:null, //风格三的商品数据列表 分页
- stylePage:1, //商品列表分页标识
+ is_pl_time: 0,
+ requestData: null, //风格三的商品数据列表 分页
+ stylePage: 1, //商品列表分页标识
//风格三使用
url: t.globalData.setting.imghost,
currentPage: 1,
allData: null,
openFilterModal: !1,
- baseUrl: "api/weshop/goods/page?1=1&cat_id=1&parent_id=0&orderField=sort&orderType=asc&page=1&is_mainshow=1&isonsale=1&store_id="+oo.stoid+"&is_recommend=1",
+ baseUrl: "api/weshop/goods/page?1=1&cat_id=1&parent_id=0&orderField=sort&orderType=asc&page=1&is_mainshow=1&isonsale=1&store_id=" + oo.stoid + "&is_recommend=1",
requestUrl: "",
tabname: "goods_id", //排序的字段
adname: "desc", //升降的字段
is_new: 0,
is_hot: 0,
- msgStatus:false, //页面显示暂无数据状态
+ msgStatus: false, //页面显示暂无数据状态
countDownNum: 3,
timer: null, //定时器
- lastMsg:false,
- toView:"",
- is_show_class:false,//是否添加新样式
- status_show:0,
+ lastMsg: false,
+ toView: "",
+ is_show_class: false,//是否添加新样式
+ status_show: 0,
currentTab: 0, //预设当前项的值
-
- load:0,
+
+ load: 0,
xmlist: null,
-
+
},
//判断当前滚动超过一屏时,设置tab标题滚动条。
- checkCor: function() {
+ checkCor: function () {
let that = this;
//这里计算按照实际情况进行修改,动态数据要进行动态分析
//思路:窗体高度/单个分类高度 200rpx 转px计算 =>得到一屏幕所显示的个数,结合后台传回分类总数进行计算
@@ -92,413 +97,418 @@ Page({
},
- onLoad: function(tt) {
- var that = this;
- var first_leader=tt.first_leader;
- if(first_leader){
- //-- user_id代过来免登录 --
- getApp().globalData.first_leader=first_leader;
- }
+ onLoad: function (tt) {
+ // wx.createSelectorQuery().select('#sview').boundingClientRect(function(rect){
+ // console.log('显示下滑区域');
+ // console.log(rect);
+ // }).exec()
- if(tt.type) this.data.type= parseInt(tt.type);
- that.get_brand();
-
- clearInterval(that.data.timer);
- that.setData({ countDownNum: 3, stylePage: 1 });
+ var that = this;
+ var first_leader = tt.first_leader;
+ if (first_leader) {
+ //-- user_id代过来免登录 --
+ getApp().globalData.first_leader = first_leader;
+ }
- const res = wx.getSystemInfoSync(),
- letters = this.data.letters;
- this.setData({
- abc: t.globalData.heigth-88-88-16,
- windowHeight: res.windowHeight,
- windowWidth: res.windowWidth,
-
- });
+ if (tt.type) this.data.type = parseInt(tt.type);
+ that.get_brand();
- var bli = res.windowWidth/750;
- //--------第一个字母距离顶部高度,单位使用的是rpx,须除以bli------
- //才能与touch事件中的数值相加减,css中定义nav高度为94%,所以 *0.94
- const eachLetterHeight = 35.4*bli,
- comTop = (88+88) * bli,
- temp = [];
+ clearInterval(that.data.timer);
+ that.setData({ countDownNum: 3, stylePage: 1 });
- this.setData({
- eachLetterHeight: eachLetterHeight
- });
- //---------求各字母距离设备左上角所处位置---------
- for (let i = 0, len = letters.length; i < len; i++) {
- const x = (this.data.windowWidth - (30 + 50)) * bli,
- y = comTop + (i * eachLetterHeight);
- temp.push([x, y]);
+ const res = wx.getSystemInfoSync(),
+ letters = this.data.letters;
+ this.setData({
+ abc: t.globalData.heigth - 88 - 88 - 16,
+ windowHeight: res.windowHeight,
+ windowWidth: res.windowWidth,
+
+ });
+
+ var bli = res.windowWidth / 750;
+ //--------第一个字母距离顶部高度,单位使用的是rpx,须除以bli------
+ //才能与touch事件中的数值相加减,css中定义nav高度为94%,所以 *0.94
+ const eachLetterHeight = 35.4 * bli,
+ comTop = (88 + 88) * bli,
+ temp = [];
+
+ this.setData({
+ eachLetterHeight: eachLetterHeight
+ });
+ //---------求各字母距离设备左上角所处位置---------
+ for (let i = 0, len = letters.length; i < len; i++) {
+ const x = (this.data.windowWidth - (30 + 50)) * bli,
+ y = comTop + (i * eachLetterHeight);
+ temp.push([x, y]);
+ }
+ this.setData({
+ lettersPosition: temp
+ });
+
+ if (this.data.is_used_share == 0) {
+ this.get_nation();
+ this.getServiceCategory();
+ }
+
+ //风格三
+ //t = i,e = t
+ var th = this;
+ a.init(this, "", "requestData");
+ var url = this.data.baseUrl;
+ this.data.is_new = i.is_new;
+ this.data.is_hot = i.is_hot;
+ if (0 != this.data.cat_id) {
+ url += "&cat_id=" + this.data.cat_id;
+ }
+
+ // this.requestGoodsList(url);
+ getApp().getConfig2(function (rs) {
+ //计算等级价相关
+ var swithc_list = rs.switch_list;
+ var sw_arr = JSON.parse(swithc_list);
+ //---如果后台又开等级卡的开关---
+ if (sw_arr.rank_switch && sw_arr.rank_switch == "2") {
+ th.setData({ rank_switch: true });
+ var user = getApp().globalData.userInfo;
+ var ti = setInterval(function () {
+ if (!user) return false;
+ clearInterval(ti);
+ //---回调卡的列表---
+ th.getPlusCardType(function (ob) {
+ th.setData({ card_list: ob.card_list });
+ if (user.card_field && user['card_expiredate']) {
+ var str = user['card_expiredate'].replace(/-/g, '/');
+ var end = new Date(str);
+ end = Date.parse(end) / 1000;
+ var now = ut.gettimestamp();
+
+ //--- 判断是等级会员,且在有效期范围内 ---
+ if (user.card_field && now < end) {
+ var card_name = ob.name_map.get(user.card_field);
+ //if (card_name.length > 4) card_name = card_name.substring(0, 4);
+ th.setData({ card_field: user.card_field, card_name: card_name, card_list: ob.card_list });
+ }
+ }
+ })
+ }, 500)
}
- this.setData({
- lettersPosition: temp
+ });
+ },
+ onShow: function () {
+ getApp().check_can_share();
+
+ if (typeof this.getTabBar === 'function' && this.getTabBar()) {
+ var index = getApp().getPageIndex(this);
+ this.getTabBar().setData({
+ active: index //数字是当前页面在tabbar的索引
});
-
- if (this.data.is_used_share==0){
- this.get_nation();
- this.getServiceCategory();
+ getApp().requestCardNum(this);
+ }
+
+
+ var that = this;
+ //调用底部导航
+ //t.editTabBar(that,getApp().globalData.setting.stoid,getApp().globalData.url);
+ //this.requestFirstCategoris();
+ setTimeout(function () {
+ //if (getApp().globalData.user_id) getApp().requestCardNum(that);
+ }, 500)
+
+ if (this.data.load) return false;
+
+ getApp().getConfig2(function (e) {
+ console.log('card------------>>>>', e);
+ var data = e;
+ var switch_list_data = data.switch_list;
+ var switch_list = JSON.parse(switch_list_data);
+ var is_newsgoodstype = switch_list.is_newsgoodstype;
+ if (is_newsgoodstype == undefined) {
+ is_newsgoodstype = 0;
}
-
- //风格三
- //t = i,e = t
- var th = this;
- a.init(this, "", "requestData");
- var url = this.data.baseUrl;
- this.data.is_new = i.is_new;
- this.data.is_hot = i.is_hot;
- if (0 != this.data.cat_id) {
- url += "&cat_id=" + this.data.cat_id;
+ that.setData({ is_used_share: is_newsgoodstype });
+ if (e.categoryset.indexOf("," + 1 + ",") != -1) { that.setData({ is_show_pl: 1 }); }
+ if (e.categoryset.indexOf("," + 3 + ",") != -1) { that.setData({ is_show_pp: 1 }); }
+ if (e.categoryset.indexOf("," + 2 + ",") != -1) { that.setData({ is_show_gb: 1 }); }
+ if (e.categoryset.indexOf("," + 4 + ",") != -1) { that.setData({ is_show_xm: 1 }); }
+ that.setData({ store_config: e, is_do: 1 });
+
+ //---有勾品类---
+ if (that.data.is_show_pl) {
+ that.requestFirstCategoris();
}
-
- // this.requestGoodsList(url);
- getApp().getConfig2(function (rs) {
- //计算等级价相关
- var swithc_list = rs.switch_list;
- var sw_arr = JSON.parse(swithc_list);
- //---如果后台又开等级卡的开关---
- if (sw_arr.rank_switch && sw_arr.rank_switch == "2") {
- th.setData({ rank_switch: true });
- var user = getApp().globalData.userInfo;
- var ti = setInterval(function () {
- if (!user) return false;
- clearInterval(ti);
- //---回调卡的列表---
- th.getPlusCardType(function (ob) {
- th.setData({ card_list: ob.card_list });
- if (user.card_field && user['card_expiredate']) {
- var str = user['card_expiredate'].replace(/-/g, '/');
- var end = new Date(str);
- end = Date.parse(end) / 1000;
- var now = ut.gettimestamp();
-
- //--- 判断是等级会员,且在有效期范围内 ---
- if (user.card_field && now < end) {
- var card_name = ob.name_map.get(user.card_field);
- //if (card_name.length > 4) card_name = card_name.substring(0, 4);
- th.setData({ card_field: user.card_field, card_name: card_name, card_list: ob.card_list });
- }
+ if (that.data.is_show_xm != 1 && that.data.is_show_gb != 1 && that.data.is_show_pp != 1 && that.data.is_show_pl) {
+ that.data.pl_timer = setInterval(function () {
+ if (that.data.one_level_classify.length > 0) {
+ var item = that.data.one_level_classify[0], arr = item.array;
+ //----如果有下级的时候-----
+ if (item.array && item.array.length > 0) {
+ var is_lev_thr = 0
+ for (var i = 0; i < arr.length; i++) {
+ if (arr[i].arrays.length > 0) { is_lev_thr = 1; break; }
}
- })
- }, 500)
- }
- });
- },
- onShow:function(){
- getApp().check_can_share();
-
- if (typeof this.getTabBar === 'function' && this.getTabBar()) {
- var index=getApp().getPageIndex(this);
- this.getTabBar().setData({
- active: index //数字是当前页面在tabbar的索引
- });
- getApp().requestCardNum(this);
- }
-
-
- var that=this;
- //调用底部导航
- //t.editTabBar(that,getApp().globalData.setting.stoid,getApp().globalData.url);
- //this.requestFirstCategoris();
- setTimeout(function () {
- //if (getApp().globalData.user_id) getApp().requestCardNum(that);
- },500)
-
- if(this.data.load) return false;
-
- getApp().getConfig2(function (e) {
- console.log('card------------>>>>', e);
- var data=e;
- var switch_list_data = data.switch_list;
- var switch_list = JSON.parse(switch_list_data);
- var is_newsgoodstype = switch_list.is_newsgoodstype;
- if (is_newsgoodstype==undefined)
- {
- is_newsgoodstype=0;
- }
- that.setData({ is_used_share :is_newsgoodstype});
- if (e.categoryset.indexOf("," + 1 + ",") != -1) { that.setData({ is_show_pl: 1 }); }
- if (e.categoryset.indexOf("," + 3 + ",") != -1) { that.setData({ is_show_pp: 1 }); }
- if (e.categoryset.indexOf("," + 2 + ",") != -1) { that.setData({ is_show_gb: 1 }); }
- if (e.categoryset.indexOf("," + 4 + ",") != -1) { that.setData({ is_show_xm: 1 }); }
- that.setData({ store_config: e,is_do:1 });
-
- //---有勾品类---
- if (that.data.is_show_pl){
- that.requestFirstCategoris();
- }
- if (that.data.is_show_xm != 1 && that.data.is_show_gb != 1 && that.data.is_show_pp != 1 && that.data.is_show_pl){
- that.data.pl_timer = setInterval(function () {
- if (that.data.one_level_classify.length>0){
- var item=that.data.one_level_classify[0],arr=item.array;
- //----如果有下级的时候-----
- if(item.array && item.array.length>0){
- var is_lev_thr=0
- for(var i=0;i0) {is_lev_thr=1;break; }
- }
- that.setData({ is_level_three: is_lev_thr });
- if (is_lev_thr!=1) {
- that.setData({ select_classify_on: 0, index: 0, classify_name: item.items.name,cat_id: item.items.id,goodslist: item.array });
- console.log("id:="+item.items.id)
- that.style(that.data.stylePage,that.data.cat_id);
- } else {
- that.setData({ select_classify_on: 0, index: 0, classify_name: item.items.name,cat_id: item.items.id,goodslist: arr });
- console.log("id:="+item.items.id)
- that.style(that.data.stylePage,that.data.cat_id);
- }
- }
- else{
- that.setData({ select_classify_on: 0, index: 0, goodslist: null,classify_name:item.items.name,is_level_three: 0});
- }
- clearInterval(that.data.pl_timer);
- }
- },1000);
-
- } else if (that.data.is_show_gb != 1 && that.data.is_show_pp ){
- that.setData({ select_classify_on: 220, classify_name: "品牌" });
- }
-
-
- var one_level_classify = that.data.one_level_classify;
-
- if (that.data.is_show_pl) that.setData({ currentTab: 0 });
- else if (that.data.is_show_gb){ that.setData({ currentTab: 1 });that.get_nation(); }
- else if (that.data.is_show_pp) {that.setData({ currentTab: 2 });that.get_brand(); }
- else if (that.data.is_show_xm) {that.setData({ currentTab: 3 });that.getServiceCategory(); }
-
-
- var t_type=that.data.type;
- //----求传参过来的控制-----
- if (t_type == 1 && that.data.is_show_gb ) {
- that.setData({ currentTab: 1,select_classify_on:223 });
- that.get_nation();
- } else if (t_type == 2 && that.data.is_show_pp ) {
- that.setData({ currentTab: 2,select_classify_on:220});
- that.get_brand();
- } else if (t_type == 3 && that.data.is_show_xm ) {
- that.setData({ currentTab: 3,select_classify_on:221 });
- that.getServiceCategory();
- } else if (that.data.is_show_pl) {
- that.setData({ currentTab: 0,select_classify_on:0 });
- }
- // 获取默认选中的第一个
- if(that.data.is_show_gb && that.data.select_classify_on == 223){
- that.setData({ status_show: 1 });
- }else if(that.data.is_show_pp && that.data.select_classify_on == 220){
- that.setData({ status_show: 2 });
- }
-
- that.data.load=1;
- })
-
- },
-
- //---------------分类请求接口,数据进行拼装------------------
- requestFirstCategoris: function() {
- var t = this;
- e.get("/api/weshop/goodscategory/page", {
- data: { store_id: oo.stoid,pageSize:6600,is_show:1},
- success: function(e) {
- var arr=new Array();
- var dda = e.data.data.pageData;
- if (dda != null && dda !=""&&dda!=undefined){
- t.setData({is_pl_time:1});
+ that.setData({ is_level_three: is_lev_thr });
+ if (is_lev_thr != 1) {
+ that.setData({ select_classify_on: 0, index: 0, classify_name: item.items.name, cat_id: item.items.id, goodslist: item.array });
+ console.log("id:=" + item.items.id)
+ that.style(that.data.stylePage, that.data.cat_id);
+ } else {
+ that.setData({ select_classify_on: 0, index: 0, classify_name: item.items.name, cat_id: item.items.id, goodslist: arr });
+ console.log("id:=" + item.items.id)
+ that.style(that.data.stylePage, that.data.cat_id);
}
-
- if (t.data.is_used_share == 0) {//is_used_share控制新旧版本
- for(var i=0;i0){
-
- if (parseInt(need_to_insert.parent_id) == parseInt(two_item[pp].items.id)) {
-
- arr[dd].array[pp].arrays.push(need_to_insert); arr.ishaf_three = 0; break;
- }
- }
- }
- }
+ }
+ else {
+ that.setData({ select_classify_on: 0, index: 0, goodslist: null, classify_name: item.items.name, is_level_three: 0 });
+ }
+ clearInterval(that.data.pl_timer);
+ }
+ }, 1000);
+
+ } else if (that.data.is_show_gb != 1 && that.data.is_show_pp) {
+ that.setData({ select_classify_on: 220, classify_name: "品牌" });
+ }
+
+
+ var one_level_classify = that.data.one_level_classify;
+
+ if (that.data.is_show_pl) that.setData({ currentTab: 0 });
+ else if (that.data.is_show_gb) { that.setData({ currentTab: 1 }); that.get_nation(); }
+ else if (that.data.is_show_pp) { that.setData({ currentTab: 2 }); that.get_brand(); }
+ else if (that.data.is_show_xm) { that.setData({ currentTab: 3 }); that.getServiceCategory(); }
+
+
+ var t_type = that.data.type;
+ //----求传参过来的控制-----
+ if (t_type == 1 && that.data.is_show_gb) {
+ that.setData({ currentTab: 1, select_classify_on: 223 });
+ that.get_nation();
+ } else if (t_type == 2 && that.data.is_show_pp) {
+ that.setData({ currentTab: 2, select_classify_on: 220 });
+ that.get_brand();
+ } else if (t_type == 3 && that.data.is_show_xm) {
+ that.setData({ currentTab: 3, select_classify_on: 221 });
+ that.getServiceCategory();
+ } else if (that.data.is_show_pl) {
+ that.setData({ currentTab: 0, select_classify_on: 0 });
+ }
+ // 获取默认选中的第一个
+ if (that.data.is_show_gb && that.data.select_classify_on == 223) {
+ that.setData({ status_show: 1 });
+ } else if (that.data.is_show_pp && that.data.select_classify_on == 220) {
+ that.setData({ status_show: 2 });
+ }
+
+ that.data.load = 1;
+ })
+
+ },
+
+ //---------------分类请求接口,数据进行拼装------------------
+ requestFirstCategoris: function () {
+ var t = this;
+ e.get("/api/weshop/goodscategory/page", {
+ data: { store_id: oo.stoid, pageSize: 6600, is_show: 1 },
+ success: function (e) {
+ var arr = new Array();
+ var dda = e.data.data.pageData;
+ if (dda != null && dda != "" && dda != undefined) {
+ t.setData({ is_pl_time: 1 });
+ }
+
+ if (t.data.is_used_share == 0) {//is_used_share控制新旧版本
+ for (var i = 0; i < dda.length; i++) {
+ if (parseInt(dda[i].level) == 1) {
+ var item = { items: dda[i], array: new Array() }
+ arr.push(item);
+ } else if (parseInt(dda[i].level) == 2) {
+ for (var j = 0; j < arr.length; j++) {
+ if (parseInt(dda[i].parent_id) == parseInt(arr[j].items.id)) {
+ arr[j].array.push(dda[i]); break;
}
}
- for(var i=0;i 4){
- //arr[i]['items']['name'] = mobile_name.substring(0, 4)
- //}
- }
- if(t.data.is_show_pl==1 && t.data.is_show_pp != 1 && t.data.is_show_gb != 1){
- arr[0]['items']['is_show_class'] = true;
- }
- //console.log(arr)
- t.setData({one_level_classify:arr});
- if(t.data.select_classify_on==0){
- var item=arr[0];
+ } else {
+ continue;
+ }
+ }
+ t.setData({ catelist: arr });
+ } else if (t.data.is_used_share == 1 || t.data.is_used_share == 2) {
- var name = item.items.name;
- var cid = item.items.id;
- var arr = item.array;
+ //---------新的版本----------------
+ for (var i = 0; i < dda.length; i++) {
+ //--要排队的元素---
+ var need_to_insert = dda[i];
+ if (parseInt(need_to_insert.level) == 1) {
+ var item = { items: need_to_insert, array: new Array() }//判断数组的长度看看有没有2级菜单
+ arr.push(item);
+ } else if (parseInt(need_to_insert.level) == 2) {
- console.log("11111",item);
+ for (var j = 0; j < arr.length; j++) {
- if (arr.length == 0) {
- t.setData({
- select_classify_on: 0, index: 0, classify_name: name, cat_id: cid,
- goodslist: null, is_level_three: 0
- });
+ if (parseInt(need_to_insert.parent_id) == parseInt(arr[j].items.id)) {
- if(t.data.is_used_share == 2)
- t.style(t.data.stylePage, cid)
+ var ishaf_two = { items: need_to_insert, arrays: new Array() };
+ arr[j].array.push(ishaf_two); arr.ishaf_two = 0;
+ }
+ }
+ } else if (parseInt(need_to_insert.level) == 3) {//判断有3级的时候在二级里添加一个数组
- return false;
- }
- if (arr.length != 0) {
- var is_lev_thr = 0
- for (var i = 0; i < arr.length; i++) {
- if (arr[i].arrays.length > 0) { is_lev_thr = 1; break; }
- }
- t.setData({ is_level_three: is_lev_thr });
-
- if (this.data.is_level_three != 1) {
- t.setData({ index: 0, classify_name: name, goodslist: arr });
- } else {
- t.setData({ index: 0, goodslist: arr });
- }
- }
+ for (var dd = 0; dd < arr.length; dd++) {
+ for (var pp = 0; pp < arr[dd].array.length; pp++) {
+ //--判断二级--
+ var two_item = arr[dd].array;
- t.style(t.data.stylePage, cid)
+ if (two_item && two_item.length > 0) {
+ if (parseInt(need_to_insert.parent_id) == parseInt(two_item[pp].items.id)) {
+
+ arr[dd].array[pp].arrays.push(need_to_insert); arr.ishaf_three = 0; break;
+ }
+ }
}
+ }
+ }
+ }
+ for (var i = 0; i < arr.length; i++) {
+ arr[i]['items']['is_show_class'] = false;
+ var mobile_name = arr[i]['items']['name']
+ //if(mobile_name.length > 4){
+ //arr[i]['items']['name'] = mobile_name.substring(0, 4)
+ //}
+ }
+ if (t.data.is_show_pl == 1 && t.data.is_show_pp != 1 && t.data.is_show_gb != 1) {
+ arr[0]['items']['is_show_class'] = true;
+ }
+ //console.log(arr)
+ t.setData({ one_level_classify: arr });
+ if (t.data.select_classify_on == 0) {
+ var item = arr[0];
+
+ var name = item.items.name;
+ var cid = item.items.id;
+ var arr = item.array;
- }
+ console.log("11111", item);
+ console.log(arr.length);
+
+ if (arr.length == 0) {
+ t.setData({
+ select_classify_on: 0, index: 0, classify_name: name, cat_id: cid,
+ goodslist: null, is_level_three: 0
+ });
+
+ if (t.data.is_used_share == 2)
+ t.style(t.data.stylePage, cid)
+
+ return false;
}
- });
- },
-
- requestCategories: function(t) {
- var s = this;
- e.get("/api/goods/goodsSecAndThirdCategoryList", {
- data: {
- parent_id: t
- },
- success: function(e) {
- s.setData({
- categories: e.data.result,
- currentCategoryId: t
- });
+ if (arr.length != 0) {
+ var is_lev_thr = 0
+ for (var i = 0; i < arr.length; i++) {
+ if (arr[i].arrays.length > 0) { is_lev_thr = 1; break; }
+ }
+ t.setData({ is_level_three: is_lev_thr ,cat_id:cid});
+
+ if (this.data.is_level_three != 1) {
+ t.setData({ index: 0, classify_name: name, goodslist: arr });
+ } else {
+ t.setData({ index: 0, goodslist: arr });
+ }
}
- });
- },
- switchFirstCategory: function(t) {
- this.requestCategories(t.currentTarget.dataset.id);
- },
+ t.style(t.data.stylePage, cid)
- //-----------滑动切换----------
- swiperTab: function (e) {
- var that = this;
- if (e.detail.source == "touch") {
- this.setData({
- currentTab: e.detail.current,
- });
- }
+ }
- //获取国别
- if (e.detail.current == 1 && that.data.nationlist == null) {
- that.get_nation();
- }
- //获取品牌
- if (e.detail.current == 2 && that.data.groups == null) {
- that.get_brand();
+ }
}
+ });
+ },
- //获取服务卡项
- if (e.detail.current == 3 && that.data.xmlist == null) {
- that.getServiceCategory();
+ requestCategories: function (t) {
+ var s = this;
+ e.get("/api/goods/goodsSecAndThirdCategoryList", {
+ data: {
+ parent_id: t
+ },
+ success: function (e) {
+ s.setData({
+ categories: e.data.result,
+ currentCategoryId: t
+ });
}
+ });
+ },
+ switchFirstCategory: function (t) {
+ this.requestCategories(t.currentTarget.dataset.id);
+ },
- },
- //-----------点击切换-----------
- clickTab: function (e) {
- var that = this;
- if (this.data.currentTab === e.target.dataset.current) {
- return false;
- } else {
- that.setData({
- currentTab: e.target.dataset.current
- })
- }
- //获取国别
- if (e.detail.current == 1 && that.data.nationlist == null) {
- that.get_nation();
- }
+ //-----------滑动切换----------
+ swiperTab: function (e) {
+ var that = this;
+ if (e.detail.source == "touch") {
+ this.setData({
+ currentTab: e.detail.current,
+ });
+ }
- //获取品牌
- if (e.detail.current == 2 && that.data.groups == null) {
- that.get_brand();
- }
+ //获取国别
+ if (e.detail.current == 1 && that.data.nationlist == null) {
+ that.get_nation();
+ }
+ //获取品牌
+ if (e.detail.current == 2 && that.data.groups == null) {
+ that.get_brand();
+ }
- //获取服务卡项
- if (e.detail.current == 3 && that.data.xmlist == null) {
- that.getServiceCategory();
- }
+ //获取服务卡项
+ if (e.detail.current == 3 && that.data.xmlist == null) {
+ that.getServiceCategory();
+ }
- },
- tabLetter(e) {
- const index = e.currentTarget.dataset.index;
- this.setData({
- selected: index,
- scrollIntoView: index
+ },
+ //-----------点击切换-----------
+ clickTab: function (e) {
+ var that = this;
+ if (this.data.currentTab === e.target.dataset.current) {
+ return false;
+ } else {
+ that.setData({
+ currentTab: e.target.dataset.current
})
- this.cleanAcitvedStatus();
+ }
+ //获取国别
+ if (e.detail.current == 1 && that.data.nationlist == null) {
+ that.get_nation();
+ }
+
+ //获取品牌
+ if (e.detail.current == 2 && that.data.groups == null) {
+ that.get_brand();
+ }
+
+ //获取服务卡项
+ if (e.detail.current == 3 && that.data.xmlist == null) {
+ that.getServiceCategory();
+ }
+
+ },
+
+ tabLetter(e) {
+ const index = e.currentTarget.dataset.index;
+ this.setData({
+ selected: index,
+ scrollIntoView: index
+ })
+ this.cleanAcitvedStatus();
},
//-------------------清除字母选中状态---------------
cleanAcitvedStatus() {
setTimeout(() => {
- this.setData({selected: 0}) }, 500);
+ this.setData({ selected: 0 })
+ }, 500);
},
//------------手指滑动------------------
@@ -530,19 +540,19 @@ Page({
},
//跳转到分类的商品列表
- go_cate:function(t){
- var cid= t.currentTarget.dataset.cid;
- var pid = t.currentTarget.dataset.pid;
- var lurl = "/pages/goods/goodsList/goodsList?cat_id=" + cid;
- lurl+="&pid="+pid;
- wx.navigateTo({ url: lurl});
+ go_cate: function (t) {
+ var cid = t.currentTarget.dataset.cid;
+ var pid = t.currentTarget.dataset.pid;
+ var lurl = "/pages/goods/goodsList/goodsList?cat_id=" + cid;
+ lurl += "&pid=" + pid;
+ wx.navigateTo({ url: lurl });
},
//跳转到品牌的商品列表
go_brand: function (t) {
var cid = t.currentTarget.dataset.bid;
var lurl = "/pages/goods/goodsList/goodsList?brand_id=" + cid;
- wx.navigateTo({ url: lurl});
+ wx.navigateTo({ url: lurl });
},
//跳转到国别的商品列表
@@ -551,24 +561,24 @@ Page({
var lurl = "/pages/goods/goodsList/goodsList?nation_id=" + cid;
wx.navigateTo({ url: lurl });
},
-
+
//获取国别
- get_nation:function() {
+ get_nation: function () {
var s = this;
e.get("/api/weshop/nation/page", {
data: {
is_hot: 1,
- store_id:oo.stoid,
- pageSize:300,
+ store_id: oo.stoid,
+ pageSize: 300,
},
success: function (e) {
var dda = e.data.data.pageData;
- s.setData({ nationlist:dda})
+ s.setData({ nationlist: dda })
}
});
},
- //获取品牌
+ //获取品牌
get_brand: function () {
var compare = function (prop) {
return function (obj1, obj2) {
@@ -576,8 +586,10 @@ Page({
if (!isNaN(Number(val1)) && !isNaN(Number(val2))) {
val1 = Number(val1); val2 = Number(val2);
}
- if (val1 < val2) { return -1;
- } else if (val1 > val2) { return 1;
+ if (val1 < val2) {
+ return -1;
+ } else if (val1 > val2) {
+ return 1;
} else { return 0; }
}
}
@@ -590,77 +602,77 @@ Page({
pageSize: 10000,
},
success: function (e) {
- var arr=new Array();
- var dda = e.data.data.pageData;
- s.setData({brand_list:dda});
-
-
- for (var i = 0; i < dda.length; i++) {
- //console.log(dda[i].logo)
- if(dda[i].logo==""){
- dda[i].logo= s.data.iurl+"/miniapp/images/no_brand_def.jpg";
- }else if(dda[i].logo && dda[i].logo.indexOf("http")<0){
- dda[i].logo = oo.imghost+dda[i].logo;
- }
-
- //进行排序,只有是默认排序的时候,才按首字母排序
- // if(parseInt(s.data.is_used_share)!=0) continue;
-
- if (arr.length>0){
- var find = 0;
- //寻找字母在arr数组中是否存在,不存在就要添加,存在就在要这个数组添加元素
- for (var k = 0; k < arr.length;k++){
- if(dda[i].zm == arr[k].zm){ find=k+1; break;}
- }
- if (find == 0) {
- var item = { zm: dda[i].zm, array: new Array() }
- item.array.push(dda[i]);
- arr.push(item);
- } else{
- arr[find - 1].array.push(dda[i]);
- }
- }else{
- var item = { zm: dda[i].zm, array: new Array() }
- item.array.push(dda[i]);
- arr.push(item);
- }
- }
- // if(parseInt(s.data.is_used_share)==0){
- // arr.sort(compare("zm"));
- // }else{
- // var ob={array:dda};
- // arr.push(ob);
- // }
-
- arr.sort(compare("zm"));
-
- s.setData({ groups: arr });
- //console.log(s.data.groups)
+ var arr = new Array();
+ var dda = e.data.data.pageData;
+ s.setData({ brand_list: dda });
+
+
+ for (var i = 0; i < dda.length; i++) {
+ //console.log(dda[i].logo)
+ if (dda[i].logo == "") {
+ dda[i].logo = s.data.iurl + "/miniapp/images/no_brand_def.jpg";
+ } else if (dda[i].logo && dda[i].logo.indexOf("http") < 0) {
+ dda[i].logo = oo.imghost + dda[i].logo;
+ }
+
+ //进行排序,只有是默认排序的时候,才按首字母排序
+ // if(parseInt(s.data.is_used_share)!=0) continue;
+
+ if (arr.length > 0) {
+ var find = 0;
+ //寻找字母在arr数组中是否存在,不存在就要添加,存在就在要这个数组添加元素
+ for (var k = 0; k < arr.length; k++) {
+ if (dda[i].zm == arr[k].zm) { find = k + 1; break; }
+ }
+ if (find == 0) {
+ var item = { zm: dda[i].zm, array: new Array() }
+ item.array.push(dda[i]);
+ arr.push(item);
+ } else {
+ arr[find - 1].array.push(dda[i]);
+ }
+ } else {
+ var item = { zm: dda[i].zm, array: new Array() }
+ item.array.push(dda[i]);
+ arr.push(item);
+ }
+ }
+ // if(parseInt(s.data.is_used_share)==0){
+ // arr.sort(compare("zm"));
+ // }else{
+ // var ob={array:dda};
+ // arr.push(ob);
+ // }
+
+ arr.sort(compare("zm"));
+
+ s.setData({ groups: arr });
+ //console.log(s.data.groups)
}
});
},
// 获取服务卡项分类
- getServiceCategory: function() {
+ getServiceCategory: function () {
var s = this;
e.get("/api/weshop/serviceCategory/page", {
data: {
is_show: 1,
- store_id:oo.stoid,
- pageSize: 1000,
+ store_id: oo.stoid,
+ pageSize: 1000,
},
success: function (e) {
var dda = e.data.data.pageData;
- s.setData({
- xmlist:dda,
- });
+ s.setData({
+ xmlist: dda,
+ });
}
});
},
-
- goServiceCategoryList: function(t) {
+
+ goServiceCategoryList: function (t) {
var cid = t.currentTarget.dataset.cid;
var lurl = "/packageA/pages/cardList/cardList?cat_id=" + cid;
wx.navigateTo({ url: lurl });
@@ -668,45 +680,45 @@ Page({
//---------分享配置--------
onShareAppMessage: function (e) {
- getApp().globalData.no_clear=1;
- var url="pages/goods/categoryList/categoryList";
- var userInfo=getApp().globalData.userInfo;
- //是分销商才带
- if(userInfo){
- url+="?first_leader="+userInfo.user_id;
- }
- console.log("--分类分享---分享--");
- console.log(url);
-
+ getApp().globalData.no_clear = 1;
+ var url = "pages/goods/categoryList/categoryList";
+ var userInfo = getApp().globalData.userInfo;
+ //是分销商才带
+ if (userInfo) {
+ url += "?first_leader=" + userInfo.user_id;
+ }
+ console.log("--分类分享---分享--");
+ console.log(url);
+
return {
- title: "商品分类",
- path:url,
+ title: "商品分类",
+ path: url,
}
},
//图片失败,默认图片
- bind_bnerr: function (e) {
+ bind_bnerr: function (e) {
var _errImg = e.target.dataset.errorimg;
var _errObj = {};
- _errObj[_errImg] = this.data.iurl+"/miniapp/images/default_g_img.gif";
+ _errObj[_errImg] = this.data.iurl + "/miniapp/images/default_g_img.gif";
this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
},
- //图片失败,默认图片
- bind_bnerr_pp: function (e) {
- var list = this.data.groups
- var _errImg = e.target.dataset.errorimg;
- var idx = e.target.dataset.idx;
- var pix = e.target.dataset.pix;
-
- },
- //商品图片失败,默认图片
+ //图片失败,默认图片
+ bind_bnerr_pp: function (e) {
+ var list = this.data.groups
+ var _errImg = e.target.dataset.errorimg;
+ var idx = e.target.dataset.idx;
+ var pix = e.target.dataset.pix;
+
+ },
+ //商品图片失败,默认图片
goods_bnerr: function (e) {
- var _errImg = e.target.dataset.err;
+ var _errImg = e.target.dataset.err;
var _errObj = {};
_errObj[_errImg] = this.data.iurl + "/miniapp/images/no_cate_def.png";
this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
},
- goseach:function(){
+ goseach: function () {
wx.navigateTo({
url: "/pages/goods/search/search"
});
@@ -714,106 +726,115 @@ Page({
//图片失败,默认图片
bind_bnerr2: function (e) {
- var _errImg = e.target.dataset.errorimg;
- var _errObj = {};
- _errObj[_errImg] = "/public/images/category.png";
- this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
-
+ var _errImg = e.target.dataset.errorimg;
+ var _errObj = {};
+ _errObj[_errImg] = "/public/images/category.png";
+ this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
+
},
- //图片失败,默认图片
- bind_bnerr_t3: function (e) {
- var _errImg = e.target.dataset.errorimg;
- var _errObj = {};
- _errObj[_errImg] = "/miniapp/images/default_g_img.gif";
- this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
+ //图片失败,默认图片
+ bind_bnerr_t3: function (e) {
+ var _errImg = e.target.dataset.errorimg;
+ var _errObj = {};
+ _errObj[_errImg] = "/miniapp/images/default_g_img.gif";
+ this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
- },
+ },
// 新的版本分类点击一级分类
- click_classify:function(e){
- // 在风格三的时候,才会有current
- clearInterval(this.data.timer);
-
- let cur = e.currentTarget.dataset.current;
- if(cur) {
+ click_classify: function (e) {
+ // 在风格三的时候,才会有current
+ clearInterval(this.data.timer);
+ console.log('类别切换---------------');
+ this.setData({
+ toupper:true,
+ nextShow:false,
+ nextShow2:false
+ })
+ let cur = e.currentTarget.dataset.current;
+ console.log(cur);
+ console.log(this.data.currentTab);
+ if (cur > -1) {
+
if (this.data.currentTab == cur) {
- if (this.data.select_classify_on != 220 && this.data.select_classify_on != 221 && this.data.select_classify_on != 223) {
- return false;
- } else if (cur != 0) {
- return false;
- }
+
+ if (this.data.select_classify_on != 220 && this.data.select_classify_on != 221 && this.data.select_classify_on != 223) {
+ return false;
+ } else if (cur != 0) {
+ return false;
+ }
} else {
- wx.pageScrollTo({
- scrollTop: 0
- })
- this.setData({
- currentTab: cur,
- select_classify_on: cur
- })
- this.checkCor();
+ wx.pageScrollTo({
+ scrollTop: 0
+ })
+ this.setData({
+ currentTab: cur,
+ select_classify_on: cur
+ })
+ this.checkCor();
}
- }
- this.setData({
- countDownNum: 3,
- });
-
- var arr2 = this.data.one_level_classify
- for(var i=0;i 0) { is_lev_thr = 1; break; }
- }
- this.setData({ is_level_three: is_lev_thr });
-
- if (this.data.is_level_three != 1) {
- this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, goodslist: arr });
- } else {
- this.setData({ select_classify_on: indexs, index: indexs, goodslist: arr });
+ }
+ this.setData({
+ countDownNum: 3,
+ });
+
+ var arr2 = this.data.one_level_classify
+ for (var i = 0; i < arr2.length; i++) {
+ if (i == e.currentTarget.dataset.index) {
+ arr2[i]['items']['is_show_class'] = true
+ } else {
+ arr2[i]['items']['is_show_class'] = false
+ }
+ }
+ this.setData({ one_level_classify: arr2 });
+ //this.data.one_level_classify[e.currentTarget.dataset.index]['items']['is_show_class'] = true
+ // console.log(e.currentTarget.dataset.index)
+ clearInterval(this.data.timer);
+ this.setData({ countDownNum: 3, stylePage: 1, scrollTop: 0 });
+ this.data.ishaf_three = 0;
+ var indexs = e.currentTarget.dataset.index;
+ var name = e.currentTarget.dataset.name;
+ var cid = e.currentTarget.dataset.cid;
+ var pid = e.currentTarget.dataset.pid;
+ var arr = e.currentTarget.dataset.arr;
+ console.log("cid:=" + name)
+ if (indexs == 220) { this.get_brand(); }
+ //==2的时候 请求数据为商品,不为分类
+ if (this.data.is_used_share == 2) {
+ this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, cat_id: cid, lastMsg: false, });
+ console.log("edqdqw:=" + this.data.select_classify_on)
+ this.style(this.data.stylePage, cid)
+ } else {
+ if (arr != "undefined" && arr != undefined) {
+ if (arr.length == 0) {
+ this.setData({
+ select_classify_on: indexs, index: indexs, classify_name: name, cat_id: cid,
+ goodslist: null, is_level_three: 0
+ });
+ return false;
}
- }
- }
- this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, cat_id: cid, stylePage: 1,lastMsg: false,});
- }
-
- },
+ if (arr.length != 0) {
+ var is_lev_thr = 0
+ for (var i = 0; i < arr.length; i++) {
+ if (arr[i].arrays.length > 0) { is_lev_thr = 1; break; }
+ }
+ this.setData({ is_level_three: is_lev_thr });
+
+ if (this.data.is_level_three != 1) {
+ this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, goodslist: arr });
+ } else {
+ this.setData({ select_classify_on: indexs, index: indexs, goodslist: arr });
+ }
+ }
+ }
+ this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, cat_id: cid, stylePage: 1, lastMsg: false, });
+ }
+
+ },
//图片失败
@@ -825,34 +846,34 @@ Page({
_errObj[_errImg] = "/miniapp/images/default_g_img.gif";
this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
},
-
-
+
+
//选择更多
- select_more:function(e){
+ select_more: function (e) {
var cid = e.currentTarget.dataset.cid;
var pid = e.currentTarget.dataset.pid;
var lurl = "/pages/goods/goodsList/goodsList?cat_id=" + cid + "&pid=" + pid;
wx.navigateTo({ url: lurl });
-
+
},
-
-
-//扫一扫
- getScancode:function(){
- var _this = this;
- getApp().globalData.no_clear=1;
+
+
+ //扫一扫
+ getScancode: function () {
+ var _this = this;
+ getApp().globalData.no_clear = 1;
// 允许从相机和相册扫码
wx.scanCode({
success: (res) => {
- var result = res.result;
- wx.navigateTo({
- url: "/pages/goods/search/search?s_key="+result,
- });
+ var result = res.result;
+ wx.navigateTo({
+ url: "/pages/goods/search/search?s_key=" + result,
+ });
}
})
},
-
-
+
+
onUnload: function () {
//this.destroyActivityTimer();
},
@@ -882,97 +903,177 @@ Page({
console.log(data.data.data.pageData)
that.setData({
requestData: data.data.data.pageData,
- is_go: 1
+ is_go: 1
});
that.setData({ is_go: 1 });
- that.data.stylePage++ , null == that.data.allData && (that.data.allData = Object.assign({}, data.data.data.pageData)),
+ that.data.stylePage++, null == that.data.allData && (that.data.allData = Object.assign({}, data.data.data.pageData)),
wx.stopPullDownRefresh();
}
});
},
-
+
// 左侧更新
scrollLower: function (data) {
- if(this.data.is_no_more) return false;
+ if (this.data.is_no_more) return false;
var that = this;
clearInterval(that.data.timer);
that.setData({
stylePage: that.data.stylePage + 1,
countDownNum: 3,
lastMsg: false,
- });
- that.style(that.data.stylePage, that.data.cat_id);
+ });
+ // if (nextTimeOff) {
+ // clearTimeout(nextTimeOff)
+ // }
+ // nextTimeOff = setTimeout(()=>{
+ that.style(that.data.stylePage, that.data.cat_id);
+ // },1000)
+ },
+ scrolltoupper(){
+ console.log('到顶部--------');
+ this.setData({
+ toupper:true
+ })
+ },
+ bScroll(even){
+ console.log('滑动开始');
+ console.log(even);
+ this.setData({
+ sClientY:even.changedTouches.length>0 ? even.changedTouches[0].clientY : 0
+ })
+ },
+ btouMove(even){
+ console.log('滑动结束');
+ console.log(even);
+ let eClientY = even.changedTouches.length>0 ? even.changedTouches[0].clientY : 0
+ let sClientY = this.data.sClientY
+ console.log(eClientY - sClientY);
+ if (eClientY - sClientY > 0) {
+ console.log('下滑');
+ console.log(this.data.toupper);
+ if (this.data.toupper) {
+ console.log('下滑请求数据');
+ this.setData({msgStatus:false,is_no_more:false})
+ clearInterval(this.data.timer);
+ this.nextCategory(true)
+ }else{
+ this.disNexCat()
+ }
+ }else{
+ console.log('上滑');
+ if (!this.data.msgStatus) {
+ this.setData({
+ toupper:false
+ })
+ }
+ this.disNexCat()
+ }
+ },
+ disNexCat(){
+ let that = this
+ const { windowHeight } = wx.getSystemInfoSync()
+ wx.createSelectorQuery().select('#sview').boundingClientRect(function(rect){
+ if (rect) {
+ const { top,height } = rect
+ if ((top < windowHeight) && (top + height >0) ) {
+ let nextShow2 = that.data.nextShow2
+ if (nextShow2) {
+ that.nextCategory()
+ }else{
+ that.setData({
+ nextShow2:true
+ })
+ }
+ }else{
+ that.setData({
+ nextShow2:false
+ })
+ }
+ }
+ }).exec()
},
-
//页面版面风格三的时候请求推荐商品 返回
style: function (page, cid) {
console.log("page:=" + page)
+ console.log("cid:=" + cid)
+ console.log("cid:=" + this.data.cat_id);
var s = this
e.get("/api/weshop/goods/page?1=1", {
data: { page: page, cat_id: cid, parent_id: 0, orderField: 'sort', orderType: 'asc', is_mainshow: 1, isonsale: 1, store_id: oo.stoid, is_recommend: 1 },
success: function (e) {
+ console.log('上拉加载。。。。。。。。。');
console.log(e.data.data.pageData)
if (e.data.data.pageData.length > 0) {
+ clearInterval(s.data.timer);
s.setData({
- msgStatus: false,is_no_more:0
+ msgStatus: false, is_no_more: 0
});
//如果有数据 判断分页为第一页的时候直接渲染数据
if (page > 1) {
//如果分页不是在第一页 那么就把返回的数据追加到原有数据后面
var arr = s.data.requestData
-
- for (var i = 0; i < e.data.data.pageData.length;i++){
+
+ for (var i = 0; i < e.data.data.pageData.length; i++) {
arr.push(e.data.data.pageData[i]);
}
-
+
+ if (e.data.data.pageData.length < e.data.data.pageSize) {
+ s.setData({
+ nextShow:true,
+ // nextShow2:true
+ })
+ }
+
s.setData({
requestData: arr
});
-
- }else{
+
+ } else {
s.setData({
requestData: e.data.data.pageData
});
+ if ( e.data.data.pageData.length && (e.data.data.pageData.length < e.data.data.pageSize)) {
+ s.setData({
+ nextShow:true,
+ // nextShow2:true
+ })
+ const { windowHeight } = wx.getSystemInfoSync()
+ wx.createSelectorQuery().select('#sview').boundingClientRect(function(rect){
+ if (rect) {
+ const { top,height } = rect
+ if ((top < windowHeight) && (top + height >0) ) {
+ s.setData({
+ nextShow2:true
+ })
+ }
+ }
+ }).exec()
+ }
if (wx.pageScrollTo) {
wx.pageScrollTo({
scrollTop: 0
})
- }
+ }
}
- s.setData({
- dataLength: s.data.requestData.length,
- });
-
+ s.setData({
+ dataLength: s.data.requestData.length,
+ });
+
} else {
//没有数据页面显示暂无数据
if (page != 1) {
- var dataArray = s.data.one_level_classify
- var index = s.data.index
- dataArray[index]['items']['is_show_class'] = false
- //没有下一个类别的时候
- if(index+1>=dataArray.length){
- s.setData({is_no_more:1});
- }else{
- dataArray[index+1]['items']['is_show_class'] = true
- console.log(dataArray[index + 1]['items'])
- s.setData({
- msgStatus: true,
- stylePage: 1,
- index: index + 1,
- select_classify_on: index + 1,
- cat_id: dataArray[index + 1]['items']['id'],
- classify_name: dataArray[index + 1]['items']['name'],
- one_level_classify: dataArray,
- is_no_more:0
- });
- s.style(s.data.stylePage, dataArray[index + 1]['items']['id'])
- }
-
- }else{
+ let nextShow = s.data.nextShow
+
+ if (!nextShow) {
+ s.setData({
+ nextShow:true
+ })
+ }
+ } else {
//没有数据而且是第一页的时候
s.setData({
stylePage: 1,
@@ -982,9 +1083,10 @@ Page({
msgStatus: true,
countDownNum: countDownNum,
requestData: [],
- is_no_more:0,
+ is_no_more: 0,
});
- s.data.timer=setInterval(function () {
+ clearInterval(s.data.timer);
+ s.data.timer = setInterval(function () {
if (countDownNum == 0) {
clearInterval(s.data.timer);
//关闭定时器之后,可作其他处理
@@ -997,50 +1099,83 @@ Page({
var dataArray = s.data.one_level_classify
var index = s.data.index
console.log(dataArray[index + 1])
- if (dataArray[index + 1] == undefined || dataArray[index + 1] == "undefined"){
+ if (dataArray[index + 1] == undefined || dataArray[index + 1] == "undefined") {
console.log("dataArray[index + 1] = undefined")
s.setData({
stylePage: 1,
msgStatus: true,
lastMsg: true
});
- }else{
+ } else {
dataArray[index]['items']['is_show_class'] = false
- dataArray[index+1]['items']['is_show_class'] = true
+ dataArray[index + 1]['items']['is_show_class'] = true
s.setData({
stylePage: 1,
index: index + 1,
select_classify_on: index + 1,
cat_id: dataArray[index + 1]['items']['id'],
classify_name: dataArray[index + 1]['items']['name'],
- one_level_classify:dataArray
+ one_level_classify: dataArray
});
s.style(s.data.stylePage, dataArray[index + 1]['items']['id']);
}
-
+
}
countDownNum--;
s.setData({
countDownNum: countDownNum
})
var arr2 = s.data.one_level_classify
- for(var i=0;i= dataArray.length || index+s < 0) {
+ this.setData({ is_no_more: 1 });
+ } else {
+ dataArray[index + s]['items']['is_show_class'] = true
+ console.log(dataArray[index + s]['items'])
+ this.setData({
+ msgStatus: true,
+ stylePage: 1,
+ index: index + s,
+ select_classify_on: index + s,
+ cat_id: dataArray[index + s]['items']['id'],
+ classify_name: dataArray[index + s]['items']['name'],
+ one_level_classify: dataArray,
+ is_no_more: 0,
+ currentTab:index + s
+ });
+ this.style(this.data.stylePage, dataArray[index + s]['items']['id'])
+ }
+ },
openFilterModal: function () {
this.setData({
@@ -1090,28 +1225,28 @@ Page({
func(ob);
})
},
-
+
//导航跳转
- nav_goto:function(e){
- var url=e.currentTarget.dataset.url;
- if(!url || url=='') return;
- if(url[0]!='/') url='/'+url;
- getApp().goto(url);
- },
-
- onShareTimeline(){
- getApp().globalData.no_clear=1;
- var store_name=getApp().globalData.config?getApp().globalData.config.store_name:'';
- if(!store_name)
- store_name=getApp().globalData.setting.appName;
-
- var user_id=getApp().globalData.user_id;
- if(!user_id) user_id=0;
-
- return {
- title:'商品分类-'+store_name,
- query: "first_leader=" + user_id
- }
+ nav_goto: function (e) {
+ var url = e.currentTarget.dataset.url;
+ if (!url || url == '') return;
+ if (url[0] != '/') url = '/' + url;
+ getApp().goto(url);
+ },
+
+ onShareTimeline() {
+ getApp().globalData.no_clear = 1;
+ var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : '';
+ if (!store_name)
+ store_name = getApp().globalData.setting.appName;
+
+ var user_id = getApp().globalData.user_id;
+ if (!user_id) user_id = 0;
+
+ return {
+ title: '商品分类-' + store_name,
+ query: "first_leader=" + user_id
}
+ }
});
\ No newline at end of file
diff --git a/pages/goods/categoryList/categoryList.wxml b/pages/goods/categoryList/categoryList.wxml
index f343d68..783beae 100644
--- a/pages/goods/categoryList/categoryList.wxml
+++ b/pages/goods/categoryList/categoryList.wxml
@@ -5,231 +5,219 @@
-
- 分类
- 国家
- 品牌
- 项目
-
+
+ 分类
+ 国家
+ 品牌
+ 项目
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
- {{fitem.items.name}}
-
- {{item.name}}
-
-
-
-
+
+
+
+
+
+
+
+ {{fitem.items.name}}
+
+
+ {{item.name}}
+
+
+
+
-
-
-
-
-
-
-
- {{bitem.name}}
- {{bitem.enname}}
-
-
-
-
+
+
+
+
+
+
+
+ {{bitem.name}}
+ {{bitem.enname}}
+
+
+
+
-
-
-
- {{group.zm}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{item.zm}}
+
+
+
+ {{group.zm}}
+
+
+
+
+
+
+
+
+
+
+
+
+ {{item.zm}}
+
+
-
-
-
-
-
-
-
-
-
-
-
-
- {{fitem.name}}
-
- {{item.name}}
-
-
-
-
-
-
- 暂无项目
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+ {{fitem.name}}
+
+
+ {{item.name}}
+
+
+
+
+
+
+ 暂无项目
+
+
+
+
暂无分类
去逛逛
-
+
-
+
商家暂未设置分类
去逛逛
-
+
-
-
-
-
+
+
-
-
- 搜索店铺商品
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 国家
-
-
-
-
-
-
-
-
-
- 品牌
-
+
+
+ 搜索店铺商品
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 国家
+
+
+
+
+
+
+
+
+
+ 品牌
+
+
+
+
+
+
+ 项目
+
+
+
+
+
+
+
+
+
+
+
+ {{ittms.items.name}}
+
-
-
-
-
- 项目
-
-
-
-
-
-
-
-
-
-
-
- {{ittms.items.name}}
-
-
-
-
-
+
-
-
+
+
+
+
-
- {{ishaf_three==1?good_list.name:classify_name}}
+
+ {{ishaf_three==1?good_list.name:classify_name}}
-
-
-
-
-
-
-
-
- {{bitem.name}}
-
-
- {{bitem.enname}}
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+ {{bitem.name}}
+
+
+ {{bitem.enname}}
+
+
+
+
+
+
-
-
-
-
- {{classify_name}}
-
-
- {{brand_list.zm}}
-
-
-
-
- {{user.name}}2
-
-
-
-
-
-
-
-
- {{item.zm}}
-
-
-
-
-
-
-
-
-
-
-
-
- {{classify_name}}
-
-
-
-
-
-
-
-
- {{item.name}}
-
-
-
-
-
-
- 暂无项目
-
-
-
-
-
-
-
-
- {{classify_name}}
-
- 更多
-
+
+
+
+ {{classify_name}}
+
+
+ {{brand_list.zm}}
+
+
+
+
+ {{user.name}}
+
+
+
+
+
+
+
+ {{item.zm}}
-
-
-
-
-
-
- {{goods.items.name}}
-
-
-
-
- 该类别无子级
-
-
+
+
+
+
+
+
+
+
+
+
+ {{classify_name}}
+
+
+
+
+
+
+
+ {{item.name}}
+
+
+
+
+
+
+ 暂无项目
-
-
-
-
+
+
+
+
+
+
+ {{classify_name}}
+
+ 更多
+
+
+
+
+
+
+
+
+
+ {{goods.items.name}}
+
+
+
+
+ 该类别无子级
+
+
+
+
+
-
+
+
+
+
- {{goods.items.name}}
-
- 更多
+
+
+ {{goods.items.name}}
+
+ 更多
-
-
+
+
-
-
-
-
- {{item.name}}
-
-
-
-
+
+
+
+
+ {{item.name}}
+
+
+
+
-
-
-
+
+
+
-
-
-
-
-
-
- 商家暂未设置分类
- 去逛逛
-
-
+
+
+
+
+
+
+ 商家暂未设置分类
+ 去逛逛
+
+
-
-
-
-
+
+
-
-
-
- 搜索店铺商品
-
-
-
-
-
+
+
+
+ 搜索店铺商品
-
-
-
-
-
-
-
-
- 国家
-
-
-
-
-
- 品牌
-
-
-
-
-
-
-
- 项目
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+ 国家
+
+
+
+
+
+ 品牌
+
+
+
+
+
+
+
+ 项目
+
+
+
+
+
+
+
+
+
+
+
-
-
-
- {{ittms.items.name}}
-
+
+
+ {{ittms.items.name}}
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
- {{ishaf_three==1?good_list.name:classify_name}}
+
+ {{ishaf_three==1?good_list.name:classify_name}}
-
-
-
-
-
-
-
- {{bitem.name}}
-
-
- {{bitem.enname}}
-
-
-
-
-
-
+
+
+
+
+
+
+
+ {{bitem.name}}
+
+
+ {{bitem.enname}}
+
+
+
+
+
+
-
-
+
+
-
-
-
-
-
-
- {{classify_name}}
-
-
- {{brand_list.zm}}
-
-
-
-
- {{user.name}}
-
-
-
-
-
-
-
-
-
- {{item.zm}}
-
-
-
-
-
-
-
-
-
-
-
- {{classify_name}}
-
-
-
-
-
-
-
-
- {{item.name}}
-
-
-
-
-
-
- 暂无项目
-
-
-
-
+
+
+
+
+
+ {{classify_name}}
+
+
+ {{brand_list.zm}}
+
+
+
+
+ {{user.name}}
+
+
+
+
+
+
+
+
+
+ {{item.zm}}
+
+
+
+
+
+
+
+
+
+
+
+ {{classify_name}}
+
+
+
+
+
+
+
+
+ {{item.name}}
+
+
+
+
+
+
+ 暂无项目
+
+
+
+
-
-
-
+
+
+
-
-
+
+
+ {{item.shop_price}}
+
+
+
+
+
+
+
+
+
+
+ {{item.shop_price}}
+
+
+
-
- 该类别暂无推荐商品 {{countDownNum}} 秒后自动跳到下一个类别
- 该类别暂无推荐商品
-
+
+ 评论{{item.comment_count}}
+ 已售{{item.sales_sum}}
+
+
+
+
+
+
+ {{item.shop_price}}
+
+
+
+
+
+
+
+
+
+ {{item.shop_price}}
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+ 暂无更多
+
+
+ 上滑查看下一个分类
+
+
+
+
+
+
+
+
+ 该类别暂无推荐商品
+ {{countDownNum}} 秒后自动跳到下一个类别
+
+ 该类别暂无推荐商品
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
- 商家暂未设置分类
- 去逛逛
-
-
-
+
+
+
+
+
+
+ 商家暂未设置分类
+ 去逛逛
+
+
+
\ No newline at end of file
diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js
index 34ea947..ae82373 100644
--- a/pages/goods/goodsInfo/goodsInfo.js
+++ b/pages/goods/goodsInfo/goodsInfo.js
@@ -286,13 +286,16 @@ Page({
if (json_str) {
var json_data = JSON.parse(json_str);
+ console.log('自定义海报参数-------');
+ console.log(json_data);
if (json_data.bg_img) {
-
+
//-- 把图片那到本地 --
wx.getImageInfo({
src: json_data.bg_img,
success: function (res) {
var path = res.path;
+
th.setData({share_b_img: path})
},
fail: function (res) {
@@ -414,6 +417,7 @@ Page({
is_show_gb: 1
});
}
+ console.log('获取系统参数');
console.log(e);
var json_d = JSON.parse(e.switch_list);
ee.setData({
@@ -737,15 +741,33 @@ Page({
data: {
store_id: os.stoid,
type: 1,
- pageSize: 3,
+ pageSize: 100,
page: 1,
is_share: 0,
},
}).then(res1 => {
+
fir_quan = res1.data.data.pageData;
})
}
-
+ //过滤不是本商品的单品优惠券-------------------
+ if(fir_quan.length > 0 ){
+ let goodInfo = ee.data.data
+ for (let index = fir_quan.length-1; index >= 0; index--) {
+ if (fir_quan[index].useobjecttype==20) { //判断是单品优惠券
+ if (fir_quan[index].useobjectno != goodInfo.goods_sn) {
+ fir_quan.splice(index,1)
+ }
+ }
+ }
+ }
+ let arr=[]
+ let length = fir_quan.length
+ if (length <= 3) {
+ arr=fir_quan
+ }else{
+ arr=fir_quan.splice(0,3);
+ }
//--------获取视频图片---------
await getApp().request.promiseGet("/api/weshop/goodsVideos/get/" + os.stoid + "/" + ee.data.gid, {
1: 1
@@ -761,7 +783,7 @@ Page({
is_collect: is_collect,
collect_id: collect_id,
categories3: categories3,
- fir_quan: fir_quan,
+ fir_quan: arr,
fir_comments: fir_com,
mapurl_f_img: mapurl_f_img,
mapurl: mapurl,
@@ -1841,6 +1863,7 @@ Page({
goods_price: newd.goods_price,
member_goods_price: newd.goods_price,
store_id: th.data.stoid,
+ prom_id:newd.prom_id //把活动id带上去(用于购物车失效变成有效商品)
};
//---是不是从收藏夹出来的---
@@ -1853,6 +1876,7 @@ Page({
updata['guide_type'] = 0;
}
}
+
i.put("/api/weshop/cart/update", {
data: updata,
@@ -2268,7 +2292,7 @@ Page({
sort_store: 0,
open_ind_store: open_store,
})
- //--先判断会员状态--
+ //--先判断会员状态--
var user_info = getApp().globalData.userInfo;
if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
wx.navigateTo({
@@ -2921,7 +2945,8 @@ Page({
}
})
}
-
+ console.log('活动详情------------');
+ console.log(prom);
//----------如果有活动,并且在进行中,就不计算线下库存---------------
var now = ut.gettimestamp();
if (prom) {
@@ -3584,7 +3609,7 @@ Page({
prom_end_time: prom_end_time,
prom_start_time: prom_start_time,
isshow: 1,
- prom_act: t.data.data
+ // prom_act: t.data.data
});
ee.get_sto();
@@ -4765,7 +4790,18 @@ Page({
wx.hideLoading();
quan_list = res.data.data.pageData;
})
-
+ //过滤不是本商品的单品优惠券
+ if (quan_list.length > 0) {
+ let goodInfo = th.data.data
+ for (let index = quan_list.length-1; index >= 0; index--) {
+ if (quan_list[index].useobjecttype==20) { //判断是单品优惠券
+ if (quan_list[index].useobjectno != goodInfo.goods_sn) {
+ quan_list.splice(index,1)
+ }
+ }
+ }
+ }
+ //------------------------
if (quan_list) {
for (var ind in quan_list) {
var ep = quan_list[ind];
@@ -4994,11 +5030,15 @@ Page({
if (this.data.card_field && this.data.data[this.data.card_field]) {
price = this.data.data[this.data.card_field];
}
- if (this.data.prom_act) price = this.data.prom_price;
+ if (this.data.prom_act) price = this.data.prom_price;
price = parseFloat(price).toFixed(2);
context.setFontSize(32 * unit);
- context.setFillStyle('#DE1117');
- context.fillText('¥' + price, 54 * unit, 735 * unit);
+ context.setFillStyle('#DE1117');
+ if (this.data.prom_type == 4 && this.data.prom_integral){
+ context.fillText(this.data.prom_integral+'积分+¥' + price, 54 * unit, 735 * unit);
+ }else{
+ context.fillText('¥' + price, 54 * unit, 735 * unit);
+ }
};
@@ -5038,13 +5078,18 @@ Page({
//类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团
var type = this.data.prom_type;
- if (type == 2) type = -1;
+ console.log('商品类型-----');
+ console.log(type);
+ // if (type == 2) type = -1;
+ if (type == 4) type = 0;
+ if (type == 2) type = 0;
if (type == 6) type = 2; // 6拼团 2团购
if (type == 10) type = -1;
-
+
if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3;
-
+ console.log('商品类型。。。。。');
+ console.log(type);
wx.showLoading({title: '生成中...',})
var that = this, th = that;
//设置画板显示,才能开始绘图
@@ -5092,19 +5137,24 @@ Page({
pg_path = th.data.share_b_img;
}
// context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit);
+ console.log('海报类型-----')
+ console.log(type);
-
- if (type == 0 || type == 1 || type == 2 || type == 3) { // 如果是普通商品,绘制新海报
+ if ( !th.data.share_b_img && (type == 0 || type == 1 || type == 2 || type == 3 )){ // 如果是普通商品,绘制新海报
th.drawPoster(context, unit, th.data.share_goods_img, vpath, type);
} else {
context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit);
+ // var erm_x = parseFloat(th.data.poster.ewm_x) * 2;
+ // var erm_y = parseFloat(th.data.poster.ewm_y) * 2;
+ // context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit);
+ // th.drawPoster(context, unit, th.data.share_goods_img, vpath);
};
-
+
// th.drawPoster(context, unit, th.data.share_goods_img, vpath);
//-- 是自定义海报的情况下 --
- if (type != 0 && type != 1 && type != 2 && type != 3) {
+ if (th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) {
if (th.data.poster && parseInt(th.data.poster.style) == 2) {
//在线上分享人的情况下
@@ -5158,7 +5208,7 @@ Page({
//---产品名称---
//文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度
- if (type != 4 && type != 0 && type != 1 && type != 2 && type != 3) {
+ if (th.data.share_b_img || (type != 4 && type != 0 && type != 1 && type != 2 && type != 3)) {
context.setFillStyle("black");
context.setFontSize(21.3 * unit)
getApp().draw_Text(context, share_title,
@@ -5179,6 +5229,11 @@ Page({
var wd1 = th.data.screenWidth - ut.measureText(pri0, 31 * unit) - 25;
context.fillText("¥", wd1 - 15, 185 * unit);
context.setFontSize(31 * unit)
+ // if(th.data.prom_type==4){
+ // context.fillText(th.data.prom_integral+'积分'+pri0, wd1, 185 * unit);
+ // }else{
+ // context.fillText(pri0, wd1, 185 * unit);
+ // }
context.fillText(pri0, wd1, 185 * unit);
//---市场价划掉---
@@ -5195,7 +5250,7 @@ Page({
context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit);
context.stroke();--*/
- } else if (type == 4 && type != 0 && type != 1 && type != 2 && type != 3) {
+ } else if ( ( type == 4 && type != 0 && type != 1 && type != 2 && type != 3)) {
context.setFillStyle("black");
context.setFontSize(21.3 * unit)
getApp().draw_Text(context, share_title,
@@ -5223,18 +5278,56 @@ Page({
}
//---中间大图---
- if (type != 0 && type != 1 && type != 2 && type != 3) {
+ if ( th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) {
context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit);
}
;
+
+ //---自定义海报 产品质量保证
+ if(th.data.share_b_img && th.data.poster.show_quality==1 ){
+ var g_path = "../../../images/share/s_gou.png";
+ context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit);
+ context.setFillStyle("red")
+ context.setFontSize(18 * unit)
+ context.fillText("正品保证", 84 * unit, 690 * unit);
+
+ context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit);
+ context.setFillStyle("red")
+ context.setFontSize(18 * unit)
+ context.fillText("纯实体店", 246 * unit, 690 * unit);
+
+ context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit);
+ context.setFillStyle("red")
+ context.setFontSize(18 * unit)
+ context.fillText("官方验证", 420 * unit, 690 * unit);
-
- //-------大图后面就不一样了-----------
+ }
+ //-------大图后面就不一样了-----------
switch (type) {
case 0:
+ if(!th.data.share_b_img){
+ break
+ }
+ //---画线---
+ context.setLineWidth(1 * unit)
+ context.moveTo(32 * unit, 710 * unit)
+ context.lineTo(520 * unit, 710 * unit)
+ context.stroke();
+ //---文字---
+ context.setFillStyle("black")
+ context.setFontSize(22 * unit)
+ // 原来start --->
+ context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 776 * unit);
+ context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 826 * unit);
+ // <--- 原来end
+ // context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 816 * unit);
+ // context.setFontSize(18 * unit)
+ // context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 850 * unit);
+ //---二维吗图---
+ context.drawImage(vpath, 380 * unit, 736 * unit, 120 * unit, 120 * unit);
break;//普通商品的展示
case 4:
- //中间的几个字
+ // 中间的几个字
if (th.data.poster && parseInt(th.data.poster.style) == 2) {
if (parseInt(th.data.poster.show_quality)) {
var g_path = "../../../images/share/s_gou.png";
@@ -5303,7 +5396,7 @@ Page({
//---二维吗图---
//-- 自定义海报 --
- if (th.data.poster) {
+ if (th.data.share_b_img || th.data.poster) {
var erm_x = parseFloat(th.data.poster.ewm_x) * 2;
var erm_y = parseFloat(th.data.poster.ewm_y) * 2;
context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit);
@@ -5314,7 +5407,10 @@ Page({
;
break;
- case -12: //秒杀商品的展示
+ case 1: //秒杀商品的展示
+ if(!th.data.share_b_img){
+ break
+ }
//---画线---
context.setLineWidth(1 * unit)
context.moveTo(32 * unit, 670 * unit)
@@ -5337,7 +5433,7 @@ Page({
//---二维吗图---
//-- 自定义海报 --
- if (th.data.poster) {
+ if (th.data.share_b_img || th.data.poster) {
var erm_x = parseFloat(th.data.poster.ewm_x) * 2;
var erm_y = parseFloat(th.data.poster.ewm_y) * 2;
context.drawImage(vpath, erm_x * unit, erm_y * unit, 135 * unit, 135 * unit);
@@ -5347,7 +5443,10 @@ Page({
}
break;
- case -2: //会员团和商家团的展示
+ case 2: //会员团和商家团的展示
+ if(!th.data.share_b_img){
+ break
+ }
//---画线---
context.setLineWidth(1 * unit)
context.moveTo(32 * unit, 670 * unit)
@@ -5383,7 +5482,7 @@ Page({
//---二维吗图---
//-- 自定义海报 --
- if (th.data.poster) {
+ if (th.data.share_b_img || th.data.poster) {
var erm_x = parseFloat(th.data.poster.ewm_x) * 2;
var erm_y = parseFloat(th.data.poster.ewm_y) * 2;
context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit);
@@ -5392,7 +5491,10 @@ Page({
context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit);
}
break
- case -3: //阶梯团的展示
+ case 3: //阶梯团的展示
+ if(!th.data.share_b_img){
+ break
+ }
//---画线---
context.setLineWidth(1 * unit)
context.moveTo(32 * unit, 670 * unit)
@@ -5428,7 +5530,7 @@ Page({
//-- 自定义海报 --
- if (th.data.poster) {
+ if (th.data.share_b_img || th.data.poster) {
var erm_x = parseFloat(th.data.poster.ewm_x) * 2;
var erm_y = parseFloat(th.data.poster.ewm_y) * 2;
context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit);
@@ -5459,7 +5561,7 @@ Page({
//---二维吗图---
//-- 自定义海报 --
- if (th.data.poster) {
+ if (th.data.share_b_img || th.data.poster) {
var erm_x = parseFloat(th.data.poster.ewm_x) * 2;
var erm_y = parseFloat(th.data.poster.ewm_y) * 2;
context.drawImage(vpath, erm_x * unit, erm_y * unit, 135 * unit, 135 * unit);
@@ -5474,7 +5576,7 @@ Page({
//--- 如果是自定义海报的时候 ---
- if (type != 0 && type != 1 && type != 2 && type != 3) {
+ if ( th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) {
if (th.data.poster && parseInt(th.data.poster.style) == 2) {
@@ -5676,8 +5778,14 @@ Page({
tt();
},
fail: function (res) {
- ee.data.share_goods_img = "../../../images/share/default_g_img.gif"; //分享的图片不能用网络的
- tt();
+ //获取默认空白图
+ wx.getImageInfo({
+ src: ee.data.iurl+'/miniapp/images/default_g_img.gif',
+ success: function(res) {
+ ee.data.share_goods_img = res.path; //分享的图片不能用网络的
+ tt();
+ }
+ })
}
});
},
diff --git a/pages/goods/goodsInfo/goodsInfo.wxml b/pages/goods/goodsInfo/goodsInfo.wxml
index 82e49f0..9b90aa1 100644
--- a/pages/goods/goodsInfo/goodsInfo.wxml
+++ b/pages/goods/goodsInfo/goodsInfo.wxml
@@ -169,7 +169,7 @@
{{djs.min}}
分
-
+
{{djs.sec}}
秒
@@ -264,7 +264,7 @@
¥{{filters.toFix(data.shop_price,2)}}
-
+
@@ -604,7 +604,7 @@
-
+
领券
@@ -1034,7 +1034,7 @@
- {{cartGoodsNum}}
+
购物车
diff --git a/pages/index/index/index.js b/pages/index/index/index.js
index e076bd2..12e8ac3 100644
--- a/pages/index/index/index.js
+++ b/pages/index/index/index.js
@@ -14,7 +14,7 @@ var e = function (e) {
var regeneratorRuntime = require('../../../utils/runtime.js');
var api = require('../../../api/api.js');
var d = getApp().globalData;
-
+
var full_screen = require('full_screen.js');
@@ -78,7 +78,7 @@ Page({
showHongbao: false,
showHongbaoSmall: false,
-
+ goodsGroupArr:[], //商品模块列表
is_full_screen_show: 0, //全屏显示
sec_show: 3, //倒计时的秒数
full_ad: null, //全屏广告
@@ -297,8 +297,34 @@ Page({
});
}
})
- },
-
+ },
+ onReady(){
+ console.log('渲染完成----')
+ console.log(this.data.template_arr);
+ console.log('....................');
+ },
+
+ //获取商品模块实例
+ newGoodsGroup(){
+ let arr=[]
+ if (this.data.template_arr.length == 0) {
+ return
+ }
+ this.data.template_arr.map((item,index)=>{
+ if (item.ename == 'goodsGroup') {
+ arr.push(`goodsGroup${index}`)
+ }
+ })
+ if (arr.length > 0) {
+ this.setData({
+ goodsGroupArr : arr
+ })
+ arr.map(item=>{
+ let a = '.'+item
+ this[item] = this.selectComponent(a);
+ })
+ }
+ },
//关闭新用户领取广告
close_disgraceful: function () {
@@ -523,13 +549,17 @@ Page({
if (data && data.length > 0) {
var temp_data = data[0];
var t_arr = JSON.parse(temp_data.json_str);
-
+ console.log('商品列表------------1')
+ console.log(t_arr)
+ console.log('商品列表------------2')
th.setData({
template_arr: t_arr,
isTemplate: 1,
bgcolor_t: temp_data.bkcolor
- });
-
+ });
+ setTimeout(()=>{
+ th.newGoodsGroup()
+ },1000)
//---如果有设定顶部的颜色的时候--
if (temp_data.top_color && temp_data.top_color != 'null') {
@@ -723,6 +753,8 @@ Page({
},
//---加载更多是靠这个函数----
onReachBottom: function () {
+ console.log('下拉加载2');
+
var goods_list = this.selectComponent("#goods_list"); //组件的id
if (goods_list) goods_list.get_list();
@@ -731,7 +763,17 @@ Page({
let item = getApp().globalData.func_list[i];
item.re_show();
}
- }
+ }
+
+
+ //自定义时商品自动加载更多
+ let goodsGroupArr = this.data.goodsGroupArr
+ if (this.data.isTemplate && goodsGroupArr.length >0) {
+ goodsGroupArr.map(item=>{
+ this[item].automore()
+ })
+ }
+
},
onPullDownRefresh: function (e) {
@@ -1226,8 +1268,26 @@ Page({
getApp().goto(url);
},
-
-
+ //视频号跳转
+ nv_void(){
+ // getApp().openChannelsActivity()
+ wx.getChannelsLiveInfo({
+ finderUserName:'sphYA5FuPCZxHaw',
+ success:(res)=>{
+ console.log(res)
+ },
+ fail:(error)=>{
+ console.log(error)
+ }
+ })
+ },
+ getchir(){
+ const child = this.selectComponent('.goodsg');
+ console.log('子组件--------111111------')
+ console.log(child)
+ console.log('子组件----------2222----')
+
+ },
});
diff --git a/pages/index/index/index.json b/pages/index/index/index.json
index e3ab55c..5cc0ca5 100644
--- a/pages/index/index/index.json
+++ b/pages/index/index/index.json
@@ -26,5 +26,6 @@
"mp-dialog": "weui-miniprogram/dialog/dialog",
"mp-sticky": "/components/mp-sticky/mp-sticky"
},
- "enablePullDownRefresh": false
+ "enablePullDownRefresh": false,
+ "onReachBottomDistance":300
}
\ No newline at end of file
diff --git a/pages/index/index/index.wxml b/pages/index/index/index.wxml
index e4d74d2..182b918 100644
--- a/pages/index/index/index.wxml
+++ b/pages/index/index/index.wxml
@@ -209,7 +209,7 @@
-
+
@@ -375,7 +375,7 @@
-
+
@@ -392,7 +392,14 @@
-
+
+
+
+
+
+
+
+
@@ -410,7 +417,7 @@
-
+
diff --git a/pages/team/team_success/team_success.js b/pages/team/team_success/team_success.js
index 81cf88e..945c203 100644
--- a/pages/team/team_success/team_success.js
+++ b/pages/team/team_success/team_success.js
@@ -794,8 +794,14 @@ Page({
tt();
},
fail: function (res) {
- ee.data.share_img_localpath= "../../../images/share/default_g_img.gif"; //分享的图片不能用网络的
- tt();
+ //获取默认空白图
+ wx.getImageInfo({
+ src: os.imghost+'/miniapp/images/default_g_img.gif',
+ success: function(res) {
+ ee.data.share_img_localpath = res.path; //分享的图片不能用网络的
+ tt();
+ }
+ })
}
});
},
diff --git a/pages/template/index.js b/pages/template/index.js
index 2c7e9c2..f8b6b28 100644
--- a/pages/template/index.js
+++ b/pages/template/index.js
@@ -11,7 +11,8 @@ var t = getApp(),
Page({
data: {
url: os.imghost,
- temp_id:0,
+ temp_id:0,
+ goodsGroupArr:[]
},
onLoad: function(e) {
@@ -46,7 +47,27 @@ Page({
}
},
-
+ //获取商品模块实例
+ newGoodsGroup(){
+ let arr=[]
+ if (this.data.template_arr.length == 0) {
+ return
+ }
+ this.data.template_arr.map((item,index)=>{
+ if (item.ename == 'goodsGroup') {
+ arr.push(`goodsGroup${index}`)
+ }
+ })
+ if (arr.length > 0) {
+ this.setData({
+ goodsGroupArr : arr
+ })
+ arr.map(item=>{
+ let a = '.'+item
+ this[item] = this.selectComponent(a);
+ })
+ }
+ },
//当隐藏的时候就关闭计时器
onHide: function() {
@@ -70,6 +91,9 @@ Page({
isTemplate: 1,
bgcolor_t: temp_data.bkcolor
});
+ setTimeout(()=>{
+ th.newGoodsGroup()
+ },1000)
//---如果有设定顶部的颜色的时候--
if(temp_data.top_color && temp_data.top_color!='null' ){
@@ -156,6 +180,14 @@ Page({
item.re_show();
}
}
+
+ //自定义时商品自动加载更多
+ let goodsGroupArr = this.data.goodsGroupArr
+ if (this.data.isTemplate && goodsGroupArr.length >0) {
+ goodsGroupArr.map(item=>{
+ this[item].automore()
+ })
+ }
},
diff --git a/pages/template/index.json b/pages/template/index.json
index c8f5ff7..dca47df 100644
--- a/pages/template/index.json
+++ b/pages/template/index.json
@@ -22,5 +22,6 @@
"scan": "/components/diy_scan/diy_scan",
"presell": "/components/diy_pregoods/diy_pregoods"
},
- "enablePullDownRefresh": false
+ "enablePullDownRefresh": false,
+ "onReachBottomDistance":300
}
\ No newline at end of file
diff --git a/pages/template/index.wxml b/pages/template/index.wxml
index 405353f..0c62bce 100644
--- a/pages/template/index.wxml
+++ b/pages/template/index.wxml
@@ -15,7 +15,7 @@
-
+
diff --git a/pages/user/assistance/task_assistance.wxml b/pages/user/assistance/task_assistance.wxml
index 045baf7..f2a12b8 100644
--- a/pages/user/assistance/task_assistance.wxml
+++ b/pages/user/assistance/task_assistance.wxml
@@ -59,6 +59,12 @@
style="background-color:#{{btn_color ? btn_color:'fbda0e'}};color:{{font_color?('#'+font_color):'white'}};">
好友拆一拆
+
+
+
立即兑换
diff --git a/pages/user/cardinfo/cardinfo.js b/pages/user/cardinfo/cardinfo.js
index 20fb5be..2492876 100644
--- a/pages/user/cardinfo/cardinfo.js
+++ b/pages/user/cardinfo/cardinfo.js
@@ -673,7 +673,7 @@ Page({
tt();
},
fail: function (res) {
- ee.data.head_pic = "../../../images/share/default_g_img.gif"; //分享的图片不能用网络的
+ ee.data.head_pic = "../../../images/share/hui_hear_pic.png"; //分享的图片不能用网络的
tt();
}
});
@@ -707,7 +707,7 @@ Page({
to_user_money:function(){
//提现小于0的值也不提现
if(!this.data.free.VIPRebate || parseFloat(this.data.free.VIPRebate)<=0){
- getApp().my_warnning("您目前没有可提现的金额",0,th); return false;
+ getApp().my_warnning("您目前没有可提现的金额",0,this); return false;
}
this.setData({yu_e_show:1})
},
diff --git a/pages/user/cardinfo/cardinfo.wxml b/pages/user/cardinfo/cardinfo.wxml
index 2341d85..e54425a 100644
--- a/pages/user/cardinfo/cardinfo.wxml
+++ b/pages/user/cardinfo/cardinfo.wxml
@@ -1,5 +1,4 @@
-
@@ -63,7 +62,7 @@
- 明细
+ 明细
转到余额
diff --git a/pages/user/get_user_info/get_user_info.js b/pages/user/get_user_info/get_user_info.js
deleted file mode 100644
index 827f65c..0000000
--- a/pages/user/get_user_info/get_user_info.js
+++ /dev/null
@@ -1,25 +0,0 @@
-var e = getApp();
-
-e.request;
-
-Page({
- data: {
- url: e.globalData.setting.url,
- resourceUrl: e.globalData.setting.resourceUrl,
- requestData: null
- },
- onLoad: function() {},
- onShow: function() {},
- bindGetUserinfo: function(t) {
- if (void 0 != t.detail.userInfo) try {
- wx.setStorageSync("wx_user_info", t.detail.encryptedData), e.globalData.wechatUser = t.detail.userInfo,
- e.auth.login(e.globalData.code, t.detail, function(t) {
- e.showSuccess("登录成功", function() {
- wx.navigateBack();
- });
- });
- } catch (e) {
- console.log(e);
- } else console.log("bindGetUserinfo fail . res.detail.userInfo is undefined");
- }
-});
\ No newline at end of file
diff --git a/pages/user/get_user_info/get_user_info.json b/pages/user/get_user_info/get_user_info.json
deleted file mode 100644
index 78e2c5d..0000000
--- a/pages/user/get_user_info/get_user_info.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "navigationBarTitleText": "登录"
-}
\ No newline at end of file
diff --git a/pages/user/get_user_info/get_user_info.wxml b/pages/user/get_user_info/get_user_info.wxml
deleted file mode 100644
index ffbf8ab..0000000
--- a/pages/user/get_user_info/get_user_info.wxml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- 请先登录, 以便操作更多功能
-
- 返回首页
-
diff --git a/pages/user/get_user_info/get_user_info.wxss b/pages/user/get_user_info/get_user_info.wxss
deleted file mode 100644
index 9cbd46c..0000000
--- a/pages/user/get_user_info/get_user_info.wxss
+++ /dev/null
@@ -1,159 +0,0 @@
-page {
- background-color: #fff;
-}
-
-.container {
- display: flex;
- height: 100%;
- align-items: center;
- justify-content: center;
- background-color: #fff;
- padding-bottom: 100rpx;
-}
-
-.login-in {
- width: 100%;
- box-sizing: border-box;
-}
-
-.order-item {
- display: flex;
- justify-content: space-around;
- height: 200rpx;
- padding: 10rpx 0;
- border-bottom: 1px solid #ddd;
-}
-
-.goods-ico {
- display: flex;
- align-items: center;
-}
-
-.goods-img {
- width: 180rpx;
- height: 180rpx;
- font-size: 0;
- margin-top: 10rpx;
-}
-
-.goods-cont {
- position: relative;
- width: 430rpx;
- height: 200rpx;
- font-size: 28rpx;
-}
-
-.goods-name {
- width: 370rpx;
- height: 64rpx;
- margin: 8rpx 0;
- line-height: 32rpx;
- color: #333;
-}
-
-.goods-attribute {
- max-height: 52rpx;
- line-height: 26rpx;
- font-size: 24rpx;
- color: #999;
-}
-
-.goods-price {
- height: 40rpx;
- line-height: 40rpx;
- margin-top: 10rpx;
-}
-
-.btn-del {
- position: absolute;
- right: 0;
- top: 8rpx;
- width: 34rpx;
- height: 34rpx;
-}
-
-.count {
- position: absolute;
- right: 0;
- bottom: 5rpx;
- width: 156rpx;
- height: 50rpx;
- border: 1px solid #ddd;
-}
-
-.count>view,.count>input {
- float: left;
- width: 50rpx;
- height: 50rpx;
- line-height: 50rpx;
- text-align: center;
-}
-
-.sub {
- border-right: 1px solid #ddd;
-}
-
-.add {
- border-left: 1px solid #ddd;
-}
-
-.pay-for {
- width: 100%;
- height: 100rpx;
- position: fixed;
- left: 0;
- bottom: 0;
- font-size: 28rpx;
- color: #666;
- background-color: #f0f2f5;
-}
-
-.pay-for .pay-btn {
- float: right;
- width: 200rpx;
- height: 100rpx;
- line-height: 100rpx;
- text-align: center;
- background-color: #f23030;
- color: #fff;
- border-radius: 0;
-}
-
-.pay-for .consumer {
- float: right;
- margin-right: 20rpx;
- line-height: 50rpx;
-}
-
-.pay-for .checkbox {
- float: left;
- padding-left: 40rpx;
- line-height: 100rpx;
- display: flex;
- align-items: center;
-}
-
-.pay-for .ico-check {
- display: flex;
- align-items: center;
- margin-right: 20rpx;
-}
-
-.getuse_info {
- width: 60%;
- background-color: #ff354d;
- color: #fff;
- border: none;
- border-radius: 8rpx;
-}
-
-.similer {
- margin: 0 auto;
- margin-top: 20px;
- width: 60%;
- height: 64rpx;
- line-height: 64rpx;
- font-size: 28rpx;
- border-radius: 8rpx;
- border: 1px solid #999;
-}
\ No newline at end of file
diff --git a/pages/user/index/index.js b/pages/user/index/index.js
index 9e8a4df..569a443 100644
--- a/pages/user/index/index.js
+++ b/pages/user/index/index.js
@@ -711,7 +711,7 @@ Page({
url + "&gradeId=" + th.data.gradeId + "&FormId=" + item.Id);
break;
case "02":
- getApp().goto("/pages/user/user_fw/user_fw?gradeId=" + th.data.gradeId + "&FormId=" + item.Id);
+ getApp().goto("/packageE/pages/user/user_fw/user_fw?gradeId=" + th.data.gradeId + "&FormId=" + item.Id);
break;
case "03":
getApp().goto("/pages/user/user_spsy/user_spsy?img=" +
diff --git a/pages/user/order_list/order_list.js b/pages/user/order_list/order_list.js
index 1174760..95de390 100644
--- a/pages/user/order_list/order_list.js
+++ b/pages/user/order_list/order_list.js
@@ -10,7 +10,7 @@ var t = function(t) {
oo = e.globalData,
r = e.request,
rq = r,
- a = require("../../../utils/common.js"),
+ a = require("../../../utils/common.js"),
s = new t.default();
var regeneratorRuntime = require('../../../utils/runtime.js');
var ut= require('../../../utils/util.js');
@@ -481,6 +481,45 @@ Page({
}
});
},
+ //-----删除订单-----
+ deleteSerOrderData: function(t) {
+ var th = this;
+ var order_id = t.currentTarget.dataset.orderid;
+ let order_sn = t.currentTarget.dataset.ordersn;
+ var index = t.currentTarget.dataset.index;
+ // var up_data={order_id: order_id,isdel:1};
+ // var order=th.data.orderList[index];
+ // if(order.order_status!=6){
+ // up_data.order_status=5;
+ // }
+ wx.showModal({
+ title: "是否删除订单?",
+ success: function(tt) {
+ tt.confirm && rq.put("/api/weshop/recharge/update", {
+ data: {
+ store_id: os.stoid,
+ order_id: order_id,
+ order_sn: order_sn,
+ order_status: 5,
+ },
+ success: function(t) {
+ let cardList = th.data.cardList
+ cardList.splice(index,1)
+ th.setData({
+ cardList
+ })
+ // for (var e = 0; e < th.data.orderList.length; e++)
+ // if (th.data.orderList[e].order_id == order_id) {
+ // th.data.orderList.splice(e, 1), th.setData({
+ // orderList: th.data.orderList
+ // });
+ // break;
+ // }
+ }
+ })
+ }
+ });
+ },
deleteOrderData2: function(order_id) {
var th = this;
diff --git a/pages/user/order_list/order_list.wxml b/pages/user/order_list/order_list.wxml
index d1c347d..dd0a79d 100644
--- a/pages/user/order_list/order_list.wxml
+++ b/pages/user/order_list/order_list.wxml
@@ -73,8 +73,12 @@
待发货
待收货
- 待评价
- 已评价
+ 待评价
+
+
+ 已评价
+
+
已取消
@@ -90,8 +94,12 @@
未支付
待发货
待收货
- 待评价
- 已评价
+ 待评价
+
+
+ 已评价
+
+
已取消
@@ -103,8 +111,12 @@
待发货
待收货
- 待评价
- 已评价
+ 待评价
+
+
+ 已评价
+
+
已取消
@@ -294,9 +306,15 @@
待支付
- 待评价
- 已评价
- 已取消
+ 待评价
+
+
+ 已评价
+
+
+ 已取消
+
+
已作废
@@ -367,7 +385,7 @@
取消订单
-
+
订单详情
diff --git a/pages/user/userqy/userqy.js b/pages/user/userqy/userqy.js
index 58789d0..f0f6af4 100644
--- a/pages/user/userqy/userqy.js
+++ b/pages/user/userqy/userqy.js
@@ -197,7 +197,7 @@ Page({
+url+"&gradeId="+th.data.gradeId+"&FormId="+item.Id);
break;
case "02":
- getApp().goto("/pages/user/user_fw/user_fw?gradeId="+th.data.gradeId+"&FormId="+item.Id);
+ getApp().goto("/packageE/pages/user/user_fw/user_fw?gradeId="+th.data.gradeId+"&FormId="+item.Id);
break;
case "03":
getApp().goto("/pages/user/user_spsy/user_spsy?img="+url+"&gradeId="+th.data.gradeId+"&FormId="+item.Id);
diff --git a/utils/auth.js b/utils/auth.js
index f5bf325..7dc9db5 100644
--- a/utils/auth.js
+++ b/utils/auth.js
@@ -269,7 +269,7 @@ module.exports = {
},
goGetUserInfo: function() {
wx.navigateTo({
- url: "/pages/user/get_user_info/get_user_info"
+ url: "/packageE/pages/togoin/togoin"
});
}
};
diff --git a/utils/wxParse/wxParse.wxss b/utils/wxParse/wxParse.wxss
index 11f43ac..8a56072 100644
--- a/utils/wxParse/wxParse.wxss
+++ b/utils/wxParse/wxParse.wxss
@@ -178,6 +178,7 @@ view.wxParse view{
.wxParse-li-text {
align-items: center;
line-height: 20px;
+ position: relative;
}
.wxParse-li-circle {