diff --git a/app.js b/app.js
index 38e250f..9334036 100644
--- a/app.js
+++ b/app.js
@@ -51,7 +51,7 @@ App({
config2: null, //门店配置
code: null,
heigth:0,
- user_id:null,// 3674923,// 4379287,// null,// 5682068,
+ user_id:6520013,// 3674923,// 4379287,// null,// 5682068,
buy_now:null,
picklist:null, //门店列表
wuliuprice: null, //物流价格表
diff --git a/components/my_confirm/my_confirm.wxml b/components/my_confirm/my_confirm.wxml
index d82fc15..94ba02c 100644
--- a/components/my_confirm/my_confirm.wxml
+++ b/components/my_confirm/my_confirm.wxml
@@ -6,8 +6,8 @@
ⅹ
{{title}}
- {{s_text}}
- {{c_text}}
+ {{s_text}}
+ {{c_text}}
diff --git a/components/my_confirm/my_confirm.wxss b/components/my_confirm/my_confirm.wxss
index f05f462..f7bf1af 100644
--- a/components/my_confirm/my_confirm.wxss
+++ b/components/my_confirm/my_confirm.wxss
@@ -33,9 +33,9 @@
color: #fff;
text-align: center;
position: fixed;
- margin-top: -23rpx;
+ margin-top: -25rpx;
z-index: 66666;
- right: 60rpx;
+ right: 65rpx;
background: #c8162c;
}
.xc-qr-frame{
diff --git a/components/qr_code/qr_code.wxss b/components/qr_code/qr_code.wxss
index 084783b..72ba6ce 100644
--- a/components/qr_code/qr_code.wxss
+++ b/components/qr_code/qr_code.wxss
@@ -117,9 +117,8 @@ margin-top: -5.5rpx;
text-align: center;
position: fixed;
top:940rpx;
- left:345rpx;
-
-
+ left:50%;
+ transform: translateX(-50%);
}
.mt{ margin-top:130rpx}
diff --git a/packageA/pages/myGift/myGift.js b/packageA/pages/myGift/myGift.js
index 593a01c..68eefe9 100644
--- a/packageA/pages/myGift/myGift.js
+++ b/packageA/pages/myGift/myGift.js
@@ -144,8 +144,9 @@ Page({
isShowLoading: true,
})
.then(function(res) {
+
if(res.data.code == 0) {
-
+
self.setData({
isLoading: false
});
@@ -154,10 +155,12 @@ Page({
self.setData({
list: res.data.data
});
+ // console.log(this.data.list);
} else {
self.setData({
'list.pageData': self.data.list.pageData.concat(res.data.data.pageData)
});
+
};
if((res.data.data.pageData.length == 0) || (res.data.data.pageSize * res.data.data.page >= res.data.data.total)) {
diff --git a/packageA/pages/myGift/myGift.wxml b/packageA/pages/myGift/myGift.wxml
index ccc9103..3b6bebb 100644
--- a/packageA/pages/myGift/myGift.wxml
+++ b/packageA/pages/myGift/myGift.wxml
@@ -33,7 +33,7 @@
已售{{item.salenum}}件
- 活动截止日期 {{filter.format_time(item.expdate)}}
+ 活动截止日期 {{filter.format_time(item.endtime)}}
@@ -52,10 +52,10 @@
{{item.lbtitle}}
- 活动截止日期 {{filter.format_time(item.endtime)}}
+ 兑换截止日期 {{filter.format_time(item.endtime)}}
- *请到线下门店兑换
+
diff --git a/packageA/pages/myGiftDetails/myGiftDetails.js b/packageA/pages/myGiftDetails/myGiftDetails.js
index 7fd7754..c38faeb 100644
--- a/packageA/pages/myGiftDetails/myGiftDetails.js
+++ b/packageA/pages/myGiftDetails/myGiftDetails.js
@@ -72,7 +72,7 @@ Page({
if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length>0){
var da= res.data.data.pageData[0]
self.setData({ details:da, });
-
+ console.log(da);
//礼包有俩种类型
if(da.lbtype==1){
app.request.promiseGet('/api/weshop/libao/libaoList/page', {
@@ -94,6 +94,7 @@ Page({
},
isShowLoading: true,
}).then(function(res) {
+ console.log(res);
if(res.data.code==0){
self.setData({
list: res.data.data,
@@ -150,6 +151,7 @@ Page({
},
isShowLoading: true,
}).then(function(res) {
+ console.log(res);
// console.log('res4-->', res);
if(res.data.code==0 && res.data.data) {
self.setData({
@@ -290,6 +292,7 @@ Page({
getApp().request.get("/api/weshop/libao/libaoListvip/getLibaoCode",{
data:data,
success:function (res){
+ console.log(res);
if(res.data.code==0){
th.data.qr_code_object.val=res.data.data;
var qc_com = th.selectComponent("#qrcode"); //组件的id
diff --git a/packageA/pages/myGiftDetails/myGiftDetails.wxml b/packageA/pages/myGiftDetails/myGiftDetails.wxml
index bd8ba1d..036ea05 100644
--- a/packageA/pages/myGiftDetails/myGiftDetails.wxml
+++ b/packageA/pages/myGiftDetails/myGiftDetails.wxml
@@ -3,7 +3,7 @@
- 兑换结束时间:{{filter.format_time(details.expdate,1)}}
+ 兑换结束时间:{{filter.format_time(details.endtime,1)}}
@@ -72,15 +72,13 @@
-
- 满1000.00使用
- ¥1000
+ 满{{item.condition}}使用
+ ¥{{item.money}}
- 活动结束日期: 2022-06-02 00:00:00
+ 活动结束日期{{filter.format_time(item.use_end_time,1)}}
-
@@ -106,7 +104,7 @@
立即购买
- 已领
+ 已领取
一键领取优惠券→
diff --git a/pages/index/index/index.js b/pages/index/index/index.js
index a3220ea..d14bb04 100644
--- a/pages/index/index/index.js
+++ b/pages/index/index/index.js
@@ -1,8 +1,8 @@
-var e = function(e) {
- return e && e.__esModule ? e : {
- default: e
- };
- }(require("../../../utils/LoadMore.js")),
+var e = function (e) {
+ return e && e.__esModule ? e : {
+ default: e
+ };
+}(require("../../../utils/LoadMore.js")),
t = getApp(),
a = t.request,
o = t.globalData.setting,
@@ -72,1003 +72,1001 @@ Page({
is_disgraceful: 0, //是否显示新人广告
new_image: "", //新人有礼弹窗图片
new_nav: "", //新人页面跳转地址
- w_holiday_pop:0,
-
- showHongbao: false,
- showHongbaoSmall: false,
-
- is_full_screen_show:0, //全屏显示
- sec_show:3, //倒计时的秒数
- full_ad:null, //全屏广告
- full_screen:0, //全屏广告
-
+ w_holiday_pop: 0,
+ showHongbao: false,
+ showHongbaoSmall: false,
+ is_full_screen_show: 0, //全屏显示
+ sec_show: 3, //倒计时的秒数
+ full_ad: null, //全屏广告
+ full_screen: 0, //全屏广告
+
},
+ onLoad: async function (tt) {
+ console.log("进入首页-------------");
+ console.log(tt);
+ var th = this;
+ var first_leader = tt.first_leader;
+ if (!first_leader && tt.scene) {
+ var first_leader_str = decodeURIComponent(tt.scene);
+ var f_arr = first_leader_str.split("_");
+ first_leader = f_arr[0] && parseFloat(f_arr[0]) > 0 ? f_arr[0] : null;
+ //注册门店
+ if (f_arr[1] && parseFloat(f_arr[1]) > 0) {
+ getApp().globalData.store_number = f_arr[1];
+ }
+ }
+
+ getApp().getConfig(function (e) {
+ //--首页的问题--
+ if (getApp().globalData.config && getApp().globalData.config.store_name != undefined && getApp().globalData.config.store_name != null) {
+ wx.setNavigationBarTitle({
+ title: getApp().globalData.config.store_name,
+ });
+ } else {
+ wx.setNavigationBarTitle({
+ title: getApp().globalData.setting.appName,
+ });
+ };
+ });
+
+
+ var th = this;
+ getApp().getConfig2(function (config2) {
+ if (config2 && config2.is_overdue == 1) {
+ getApp().promiseGet("/store/storemoduleendtime/page?store_id=" + os.stoid + "&type=5", {}).then(res => {
+ var o = res;
+ if (o.data.code == 0) {
+ var ob = { isout: 0, isbuy: 1 };
+ var arr = o.data.data.pageData;
+ var isbuy = 0;
+ //----如果数组不为空----
+ if (arr.length > 0) {
+ arr.forEach(function (val, ind) {
+ if (val.is_sy == 0 && val.type == 5) {
+ isbuy = 1;
+ var now = ut.gettimestamp();
+ if (now > val.end_time) ob.isout = 1;
+ return false;
+ }
+ })
+ }
+ ob.isbuy = isbuy;
+
+ var pages = getCurrentPages(); //获取加载的页面
+ var currentPage = pages[pages.length - 1]; //获取当前页面的对象
+
+ console.log("当前路由");
+ console.log(currentPage.route);
+
- onLoad: async function(tt) {
- console.log("进入首页-------------");
- console.log(tt);
- var th = this;
- var first_leader=tt.first_leader;
- if(!first_leader && tt.scene){
- var first_leader_str= decodeURIComponent(tt.scene);
- var f_arr=first_leader_str.split("_");
- first_leader=f_arr[0] && parseFloat(f_arr[0])>0?f_arr[0]:null;
- //注册门店
- if(f_arr[1] && parseFloat(f_arr[1])>0){
- getApp().globalData.store_number=f_arr[1];
+ th.setappdata(ob);
+
+ if (ob.isbuy && !ob.isout) {
+ th.onload_init();
+ }
+ } else {
+ th.onload_init();
}
- }
-
- getApp().getConfig(function(e){
- //--首页的问题--
- if (getApp().globalData.config && getApp().globalData.config.store_name != undefined && getApp().globalData.config.store_name != null) {
- wx.setNavigationBarTitle({
- title: getApp().globalData.config.store_name,
- });
- } else {
- wx.setNavigationBarTitle({
- title: getApp().globalData.setting.appName,
- });
- };
- });
-
-
- var th = this;
- getApp().getConfig2(function(config2){
- if(config2 && config2.is_overdue==1){
- getApp().promiseGet("/store/storemoduleendtime/page?store_id=" +os.stoid + "&type=5",{}).then(res=>{
- var o=res;
- if (o.data.code == 0) {
- var ob = { isout: 0, isbuy: 1 };
- var arr = o.data.data.pageData;
- var isbuy = 0;
- //----如果数组不为空----
- if (arr.length > 0) {
- arr.forEach(function (val, ind) {
- if (val.is_sy == 0 && val.type == 5) {
- isbuy = 1;
- var now = ut.gettimestamp();
- if (now > val.end_time) ob.isout = 1;
- return false;
- }
- })
- }
- ob.isbuy = isbuy;
-
- var pages = getCurrentPages(); //获取加载的页面
- var currentPage = pages[pages.length - 1]; //获取当前页面的对象
-
- console.log("当前路由");
- console.log(currentPage.route);
-
-
- th.setappdata(ob);
-
- if(ob.isbuy && !ob.isout){
- th.onload_init();
- }
- }else{
- th.onload_init();
- }
- })
- }
-
- else{
- th.onload_init();
- }
- })
-
- if(first_leader){
- //-- user_id代过来免登录 --
- getApp().globalData.first_leader=first_leader;
- //调用接口判断是不是会员
- getApp().request.promiseGet("/api/weshop/shoppingGuide/get/"+os.stoid+"/"+first_leader,{}).then(res=>{
- if(res.data.code==0){
- getApp().globalData.guide_id=res.data.data.id;
- }
- })
- }
-
- // 判断是否有红包活动
- getApp().request.promiseGet('/api/weshop/redmoney/redConfig/get/'+getApp().globalData.setting.stoid, {
- data: {}
- }).then(function(data) {
- // console.log('909090909090----->', data.data.code);
- let code = data.data.code;
- if(code == 0) {
-
- th.setData({
- showHongbao: true,
- });
- } else if(code == -1) {
- th.setData({
- showHongbao: false,
- });
- };
- });
-
-
- // console.log(9090909);
- //看一下商家是否开通了权益
- //--初始化是否有打勾--
- getApp().request.promiseGet("/api/weshop/users/grade/vip/init/get", {
- data: {
- storeId: os.stoid
+ })
+ }
+
+ else {
+ th.onload_init();
+ }
+ })
+
+ if (first_leader) {
+ //-- user_id代过来免登录 --
+ getApp().globalData.first_leader = first_leader;
+ //调用接口判断是不是会员
+ getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => {
+ if (res.data.code == 0) {
+ getApp().globalData.guide_id = res.data.data.id;
}
- }).then(res => {
- if (res.data.data) {
- var is_init = res.data.data.isBool;
+ })
+ }
+
+ // 判断是否有红包活动
+ getApp().request.promiseGet('/api/weshop/redmoney/redConfig/get/' + getApp().globalData.setting.stoid, {
+ data: {}
+ }).then(function (data) {
+ // console.log('909090909090----->', data.data.code);
+ let code = data.data.code;
+ if (code == 0) {
+
+ th.setData({
+ showHongbao: true,
+ });
+ } else if (code == -1) {
+ th.setData({
+ showHongbao: false,
+ });
+ };
+ });
+
+
+ // console.log(9090909);
+ //看一下商家是否开通了权益
+ //--初始化是否有打勾--
+ getApp().request.promiseGet("/api/weshop/users/grade/vip/init/get", {
+ data: {
+ storeId: os.stoid
+ }
+ }).then(res => {
+ if (res.data.data) {
+ var is_init = res.data.data.isBool;
+ th.setData({
+ is_boot: is_init
+ });
+
+ if (!is_init) {
th.setData({
- is_boot: is_init
+ swiperimage: []
});
-
- if(!is_init){
- th.setData({
- swiperimage: []
- });
- }
}
- })
+ }
+ })
- //调用底部导航
- //getApp().globalData.url=th.data.url
- //t.editTabBar(th,o.stoid,th.data.url);
+ //调用底部导航
+ //getApp().globalData.url=th.data.url
+ //t.editTabBar(th,o.stoid,th.data.url);
- },
-
- async onload_init(){
- var th=this;
- await this.init_load();
- //显示的时候要开启计时器
- this.data.is_timer = 1;
- //如果是自定义模板
- if (this.data.isTemplate) {
- //---先获取会员---
- t.getUserFir(function() {
- th.is_festival();
- var new_nav = th.data.new_nav;
- if (new_nav == "") {
- th.is_new();
- }
- setTimeout(function () {
- if (getApp().globalData.user_id) getApp().requestCardNum(th);
- },500)
-
- });
- } else {
- await this.init_fir();
- wx.setNavigationBarColor({
- frontColor: '#ffffff', // 必写项
- backgroundColor: '#ff7295', // 必写项
- })
- }
-
- //--正再拼团中的处理--
- var url = "/api/weshop/order/pageTuan?pt_status=2&is_pt=1&store_id=" + os.stoid + "&pageSize=6&page=1"
- await getApp().request.promiseGet(url, {}).then(res => {
- if (res.data.code == 0 && res.data.data && res.data.data.pageData) {
- th.data.pt_timer_arr = res.data.data.pageData;
- }
- })
- if (th.data.pt_timer_arr && th.data.pt_timer_arr.length > 0) {
- for (var i in th.data.pt_timer_arr) {
- var p_item = th.data.pt_timer_arr[i];
- await getApp().request.promiseGet("/api/weshop/users/get/" + os.stoid + "/" + p_item.user_id, {
- 1: 1
- }).then(res => {
- th.data.pt_timer_arr[i].head_pic = res.data.data.head_pic;
- th.data.pt_timer_arr[i].nickname = res.data.data.nickname;
- })
- }
- th.Interval_pt();
- }
-
- //---处理正在6个分类----
- await getApp().request.promiseGet("/api/weshop/goodscategory/page", {
- data: {
- store_id: os.stoid,
- pageSize: 5,
- is_show: 1,
- level:1
- }
- }).then(res => {
- if (res.data.data) {
- var gd_category = res.data.data.pageData;
- th.setData({
- gd_category: gd_category
- });
- }
- })
- },
-
-
- //关闭新用户领取广告
- close_disgraceful: function() {
- var th = this;
- th.setData({
- is_disgraceful: 0
- })
- },
+},
- async onShow() {
- var th=this;
- //-- 登录回来判断弹框 --
- var userInfo=getApp().globalData.userInfo;
- if(userInfo){
- th.is_festival();
- var new_nav = th.data.new_nav;
- if (new_nav == "") {
- th.is_new();
- }
+ async onload_init() {
+ var th = this;
+ await this.init_load();
+ //显示的时候要开启计时器
+ this.data.is_timer = 1;
+ //如果是自定义模板
+ if(this.data.isTemplate) {
+ //---先获取会员---
+ t.getUserFir(function () {
+ th.is_festival();
+ var new_nav = th.data.new_nav;
+ if (new_nav == "") {
+ th.is_new();
}
+ setTimeout(function () {
+ if (getApp().globalData.user_id) getApp().requestCardNum(th);
+ }, 500)
- //优惠券要实时更新
- getApp().getConfig2(function(e) {
- var json_d = JSON.parse(e.switch_list);
- th.setData({is_closecoupon: json_d.is_closecoupon})
- th.setData({is_topstore: json_d.is_show_storeselect})
- },1)
-
- if (typeof this.getTabBar === 'function' && this.getTabBar()) {
- var index=getApp().getPageIndex(this);
- this.getTabBar().setData({
- active: index //数字是当前页面在tabbar的索引
- })
-
- getApp().requestCardNum(this);
- }
-
- var th = this;
-
- var show=getApp().globalData.isLoad_ad;
- setTimeout(function(){
- //user没有及时更新
- var userInfo=getApp().globalData.userInfo;
- if(!userInfo || !userInfo.user_id) userInfo=null;
- //有加载过一次首页,就显示
- if(show || userInfo || getApp().globalData.user_id){
- setTimeout(function(){
- full_screen.get_the_full_screen(th);
- },800)
- //动画效果
- if(!th.data.f_hidden){
- wx.showLoading({
- title:'加载中..'
- });
- setTimeout(function(){
- th.setData({f_hidden:1})
- wx.hideLoading();
- },960)
- }
- }else{
- getApp().globalData.isLoad_ad=1;
- }
- },500)
-
-
-
- },
- //当隐藏的时候就关闭计时器
- onHide: function() {
- this.data.is_timer = 0;
- if(this.data.pt_timer) clearInterval(this.data.pt_timer);
- if(this.data.w_holiday_pop) clearInterval(this.data.w_holiday_pop);
- if(this.data.full_screen) clearInterval(this.data.full_screen);
- this.data.w_holiday_pop=0;
+ });
+} else {
+ await this.init_fir();
+ wx.setNavigationBarColor({
+ frontColor: '#ffffff', // 必写项
+ backgroundColor: '#ff7295', // 必写项
+ })
+}
+//--正再拼团中的处理--
+var url = "/api/weshop/order/pageTuan?pt_status=2&is_pt=1&store_id=" + os.stoid + "&pageSize=6&page=1"
+await getApp().request.promiseGet(url, {}).then(res => {
+ if (res.data.code == 0 && res.data.data && res.data.data.pageData) {
+ th.data.pt_timer_arr = res.data.data.pageData;
+ }
+})
+if (th.data.pt_timer_arr && th.data.pt_timer_arr.length > 0) {
+ for (var i in th.data.pt_timer_arr) {
+ var p_item = th.data.pt_timer_arr[i];
+ await getApp().request.promiseGet("/api/weshop/users/get/" + os.stoid + "/" + p_item.user_id, {
+ 1: 1
+ }).then(res => {
+ th.data.pt_timer_arr[i].head_pic = res.data.data.head_pic;
+ th.data.pt_timer_arr[i].nickname = res.data.data.nickname;
+ })
+ }
+ th.Interval_pt();
+}
+
+//---处理正在6个分类----
+await getApp().request.promiseGet("/api/weshop/goodscategory/page", {
+ data: {
+ store_id: os.stoid,
+ pageSize: 5,
+ is_show: 1,
+ level: 1
+ }
+}).then(res => {
+ if (res.data.data) {
+ var gd_category = res.data.data.pageData;
+ th.setData({
+ gd_category: gd_category
+ });
+ }
+})
},
- //同步初始加载
- async init_load() {
- var th=this;
- //因为营销版本的功能包含了自定义模板的功能,是同时的
- //读取全局是否有弄自定义模板
- await api.get_template_fir(o.stoid).then(res => {
- var data = res.data.data;
- if (data && data.length > 0) {
- var temp_data = data[0];
- var t_arr = JSON.parse(temp_data.json_str);
- th.setData({
- template_arr: t_arr,
- isTemplate: 1,
- bgcolor_t: temp_data.bkcolor
- });
- //---如果有设定顶部的颜色的时候--
- if(temp_data.top_color && temp_data.top_color!='null' ){
- wx.setNavigationBarColor({
- frontColor: '#ffffff', // 必写项
- backgroundColor: temp_data.top_color, // 必写项
- })
- }
+//关闭新用户领取广告
+close_disgraceful: function () {
+ var th = this;
+ th.setData({
+ is_disgraceful: 0
+ })
+},
- }
- })
+async onShow() {
+ var th = this;
+ //-- 登录回来判断弹框 --
+ var userInfo = getApp().globalData.userInfo;
+ if (userInfo) {
+ th.is_festival();
+ var new_nav = th.data.new_nav;
+ if (new_nav == "") {
+ th.is_new();
+ }
+ }
-
+ //优惠券要实时更新
+ getApp().getConfig2(function (e) {
+ var json_d = JSON.parse(e.switch_list);
+ th.setData({ is_closecoupon: json_d.is_closecoupon })
+ th.setData({ is_topstore: json_d.is_show_storeselect })
+ }, 1)
-
-
-
-
- },
- //---读取数据内容---
- async init_fir() {
- var th = this;
- //----广告----
- var e = this;
- await getApp().request.promiseGet("/api/weshop/ad/page?pid=2&store_id=" + o.stoid, {
- data: {
- enabled: 1
- }
- }).then(res => {
-
- if(res.data.code==0 && res.data.data.pageData && res.data.data.pageData.length>0){
- var a = res.data.data.pageData;
- var arr = new Array();
- for (var i = 0; i < a.length; i++) {
- var tt = {
- 'ad_code': o.imghost + a[i].ad_code,
- 'media_link': '',
- 'ad_weapplink':a[i].ad_weapplink
- };
- arr.push(tt);
- }
- if (arr.length > 0) e.setData({
- banner: arr,
- });
-
- wx.stopPullDownRefresh();
- }
+ if (typeof this.getTabBar === 'function' && this.getTabBar()) {
+ var index = getApp().getPageIndex(this);
+ this.getTabBar().setData({
+ active: index //数字是当前页面在tabbar的索引
})
- //-----秒杀-----
- var flash_data = null;
- //--获取活动--
- await getApp().request.promiseGet("/api/ms/flash_sale/spikepage", {
- data: {
- store_id: os.stoid,
- timetype: 2,
- is_end: 0,
- is_show: 1,
- pageSize: 9
- },
- }).then(res => {
- var e = res;
- if (e.data.code == 0) {
- flash_data = e.data.data.pageData;
- if (flash_data == null || flash_data.length <= 0) return false;
-
- //当前时间戳
- var nt = ut.gettimestamp();
-
- flash_data.forEach(function(val, ind) {
- if (val.start_time > nt) flash_data[ind].status = 0;
- else if (val.end_time > nt) flash_data[ind].status = 1;
- if (val.buy_num >= val.goods_num) flash_data[ind].status = 2;
- });
+ getApp().requestCardNum(this);
+ }
- var arr = new Array();
- //--三个三个一组---
- for (var i = 0; i < flash_data.length; i += 3) {
- arr.push(flash_data.slice(i, i + 3));
- }
- th.setData({
- saleGoods: arr
+ var th = this;
+
+ var show = getApp().globalData.isLoad_ad;
+ setTimeout(function () {
+ //user没有及时更新
+ var userInfo = getApp().globalData.userInfo;
+ if (!userInfo || !userInfo.user_id) userInfo = null;
+ //有加载过一次首页,就显示
+ if (show || userInfo || getApp().globalData.user_id) {
+ setTimeout(function () {
+ full_screen.get_the_full_screen(th);
+ }, 800)
+ //动画效果
+ if (!th.data.f_hidden) {
+ wx.showLoading({
+ title: '加载中..'
});
- //th.countDown();
+ setTimeout(function () {
+ th.setData({ f_hidden: 1 })
+ wx.hideLoading();
+ }, 960)
}
- });
+ } else {
+ getApp().globalData.isLoad_ad = 1;
+ }
+ }, 500)
+
+
+
+},
+//当隐藏的时候就关闭计时器
+onHide: function () {
+ this.data.is_timer = 0;
+ if (this.data.pt_timer) clearInterval(this.data.pt_timer);
+ if (this.data.w_holiday_pop) clearInterval(this.data.w_holiday_pop);
+ if (this.data.full_screen) clearInterval(this.data.full_screen);
+ this.data.w_holiday_pop = 0;
+
+},
+
+//同步初始加载
+async init_load() {
+ var th = this;
+ //因为营销版本的功能包含了自定义模板的功能,是同时的
+ //读取全局是否有弄自定义模板
+ await api.get_template_fir(o.stoid).then(res => {
+ var data = res.data.data;
+ if (data && data.length > 0) {
+ var temp_data = data[0];
+ var t_arr = JSON.parse(temp_data.json_str);
+ th.setData({
+ template_arr: t_arr,
+ isTemplate: 1,
+ bgcolor_t: temp_data.bkcolor
+ });
- //----拼单-----
- await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/2", {
- data: {
- store_id: os.stoid,
- is_end: 0,
- is_show: 1,
- pageSize: 6
+ //---如果有设定顶部的颜色的时候--
+ if (temp_data.top_color && temp_data.top_color != 'null') {
+ wx.setNavigationBarColor({
+ frontColor: '#ffffff', // 必写项
+ backgroundColor: temp_data.top_color, // 必写项
+ })
}
- }).then(res => {
- var e = res;
- if (e.data.code == 0) {
- var pd_data = e.data.data.pageData;
-
- if (pd_data.length == 0) return;
-
- //获取当前
- var nt = ut.gettimestamp();
- pd_data.forEach(function(val, ind) {
- if (val.start_time > nt) pd_data[ind].status = 0;
- else if (val.end_time > nt) pd_data[ind].status = 1;
- if (val.buy_num >= val.goods_num) pd_data[ind].status = 2;
- });
- //获取当前时间,比较拼团中还在未开始
- var timestamp = new Date().getTime();
- var is_team_tepy;
- for (var j = 0; j < pd_data.length; j++) {
- pd_data[j].is_team_tepy = 1;
- if (timestamp < pd_data[j].start_time * 1000) {
- var is_team_tepy;
- pd_data[j].is_team_tepy = 0;
- }
- }
+ }
+ })
- var arr = new Array();
- //--2个2个一组---
- for (var i = 0; i < pd_data.length; i += 2) {
- arr.push(pd_data.slice(i, i + 2));
- }
- th.setData({
- pindGoods: arr
- });
- th.countDown2();
+
+
+
+
+},
+//---读取数据内容---
+async init_fir() {
+ var th = this;
+ //----广告----
+ var e = this;
+ await getApp().request.promiseGet("/api/weshop/ad/page?pid=2&store_id=" + o.stoid, {
+ data: {
+ enabled: 1
+ }
+ }).then(res => {
+
+ if (res.data.code == 0 && res.data.data.pageData && res.data.data.pageData.length > 0) {
+ var a = res.data.data.pageData;
+ var arr = new Array();
+ for (var i = 0; i < a.length; i++) {
+ var tt = {
+ 'ad_code': o.imghost + a[i].ad_code,
+ 'media_link': '',
+ 'ad_weapplink': a[i].ad_weapplink
+ };
+ arr.push(tt);
}
- })
+ if (arr.length > 0) e.setData({
+ banner: arr,
+ });
+
+ wx.stopPullDownRefresh();
+ }
+ })
+
+ //-----秒杀-----
+ var flash_data = null;
+ //--获取活动--
+ await getApp().request.promiseGet("/api/ms/flash_sale/spikepage", {
+ data: {
+ store_id: os.stoid,
+ timetype: 2,
+ is_end: 0,
+ is_show: 1,
+ pageSize: 9
+ },
+ }).then(res => {
+ var e = res;
+ if (e.data.code == 0) {
+ flash_data = e.data.data.pageData;
+ if (flash_data == null || flash_data.length <= 0) return false;
+
+ //当前时间戳
+ var nt = ut.gettimestamp();
+
+ flash_data.forEach(function (val, ind) {
+ if (val.start_time > nt) flash_data[ind].status = 0;
+ else if (val.end_time > nt) flash_data[ind].status = 1;
+ if (val.buy_num >= val.goods_num) flash_data[ind].status = 2;
+ });
- //------新品-------
- await getApp().request.promiseGet("/api/weshop/goods/page?page=1", {
- data: {
- is_mainshow: 1,
- isonsale: 1,
- is_on_sale: 1,
- store_id: o.stoid,
- pageSize: 9,
- is_new: 1,
- orderField: "sort"
+ var arr = new Array();
+ //--三个三个一组---
+ for (var i = 0; i < flash_data.length; i += 3) {
+ arr.push(flash_data.slice(i, i + 3));
}
- }).then(res => {
- var e = res;
- if (e.data.code == 0) {
- var new_data = e.data.data.pageData;
- var arr = new Array();
- //--三个三个一组---
- for (var i = 0; i < new_data.length; i += 3) {
- arr.push(new_data.slice(i, i + 3));
+ th.setData({
+ saleGoods: arr
+ });
+ //th.countDown();
+ }
+ });
+
+ //----拼单-----
+ await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/2", {
+ data: {
+ store_id: os.stoid,
+ is_end: 0,
+ is_show: 1,
+ pageSize: 6
+ }
+ }).then(res => {
+ var e = res;
+ if (e.data.code == 0) {
+ var pd_data = e.data.data.pageData;
+
+ if (pd_data.length == 0) return;
+
+ //获取当前
+ var nt = ut.gettimestamp();
+ pd_data.forEach(function (val, ind) {
+ if (val.start_time > nt) pd_data[ind].status = 0;
+ else if (val.end_time > nt) pd_data[ind].status = 1;
+ if (val.buy_num >= val.goods_num) pd_data[ind].status = 2;
+ });
+
+ //获取当前时间,比较拼团中还在未开始
+ var timestamp = new Date().getTime();
+ var is_team_tepy;
+ for (var j = 0; j < pd_data.length; j++) {
+ pd_data[j].is_team_tepy = 1;
+ if (timestamp < pd_data[j].start_time * 1000) {
+ var is_team_tepy;
+ pd_data[j].is_team_tepy = 0;
}
- th.setData({
- newGoods: arr,
- });
}
- })
- //------热卖-------
- await getApp().request.promiseGet("/api/weshop/goods/page?page=1", {
- data: {
- is_mainshow: 1,
- isonsale: 1,
- is_on_sale: 1,
- store_id: o.stoid,
- pageSize: 9,
- is_hot: 1,
- orderField: "sort"
- }
- }).then(res => {
- var e = res;
- if (e.data.code == 0) {
- var new_data = e.data.data.pageData;
- var arr = new Array();
- //--三个三个一组---
- for (var i = 0; i < new_data.length; i += 3) {
- arr.push(new_data.slice(i, i + 3));
- }
- th.setData({
- hotGoods: arr,
- });
+ var arr = new Array();
+ //--2个2个一组---
+ for (var i = 0; i < pd_data.length; i += 2) {
+
+ arr.push(pd_data.slice(i, i + 2));
}
- })
- //---调用信息---
- // this.requestRecommend();
- this.setData({
- ishow: 1
- });
-
- //---先获取会员---
- t.getUserFir(function() {
- th.is_festival();
- var new_nav = th.data.new_nav;
- if (new_nav == "") {
- th.is_new();
- }
-
- setTimeout(function () {
- if (getApp().globalData.user_id) getApp().requestCardNum(th);
- },500)
-
- });
-
- setTimeout(function() {
- var goods_list = th.selectComponent("#goods_list"); //组件的id
- goods_list.init();
- goods_list.get_list();
- }, 2000)
- },
- //--判断小程序是否过期--
- setappdata: function(t) {
- if (t.isout == 1)
- wx.reLaunch({
- url: "/pages/error/error?msg=该商城已到期,暂停浏览!\r\n可联系:"+getApp().globalData.config.store_tel,
- });
- if (t.isbuy == 0)
- wx.reLaunch({
- url: "/pages/error/error?msg=还未购买小程序",
+ th.setData({
+ pindGoods: arr
});
- },
- //---加载更多是靠这个函数----
- onReachBottom: function() {
- var goods_list = this.selectComponent("#goods_list"); //组件的id
- if (goods_list) goods_list.get_list();
- },
+ th.countDown2();
+ }
+ })
- onPullDownRefresh: function(e) {
- this.data.recommend = null, this.data.currentPage = 1, n.resetConfig(), this.requestHomePage(),
- this.requestRecommend();
- },
- requestRecommend(){},
- requestHomePage(){},
+ //------新品-------
+ await getApp().request.promiseGet("/api/weshop/goods/page?page=1", {
+ data: {
+ is_mainshow: 1,
+ isonsale: 1,
+ is_on_sale: 1,
+ store_id: o.stoid,
+ pageSize: 9,
+ is_new: 1,
+ orderField: "sort"
+ }
+ }).then(res => {
+ var e = res;
+ if (e.data.code == 0) {
+ var new_data = e.data.data.pageData;
+ var arr = new Array();
+ //--三个三个一组---
+ for (var i = 0; i < new_data.length; i += 3) {
+ arr.push(new_data.slice(i, i + 3));
+ }
+ th.setData({
+ newGoods: arr,
+ });
+ }
+ })
- onUnload: function() {
- this.destroyActivityTimer();
- },
- setCountTime: function(e) {
- e.diffTime || (e.diffTime = new Date().getTime() - 1e3 * e.server_time), this.setData({
- "sale.diffTime": e.diffTime
- }), this.setData({
- "sale.good": e.flash_sale_goods[0]
- }), this.destroyActivityTimer(), this.createActivityTimer();
- },
- createActivityTimer: function() {
- var e = this.data.sale,
- t = this;
- this.data.timer = setInterval(function() {
- var a = 1e3 * e.good.end_time - new Date().getTime() + e.diffTime,
- o = i.transTime(a);
- a <= 0 ? t.requestHomePage() : t.setData({
- "sale.countTime": o
+ //------热卖-------
+ await getApp().request.promiseGet("/api/weshop/goods/page?page=1", {
+ data: {
+ is_mainshow: 1,
+ isonsale: 1,
+ is_on_sale: 1,
+ store_id: o.stoid,
+ pageSize: 9,
+ is_hot: 1,
+ orderField: "sort"
+ }
+ }).then(res => {
+ var e = res;
+ if (e.data.code == 0) {
+ var new_data = e.data.data.pageData;
+ var arr = new Array();
+ //--三个三个一组---
+ for (var i = 0; i < new_data.length; i += 3) {
+ arr.push(new_data.slice(i, i + 3));
+ }
+ th.setData({
+ hotGoods: arr,
});
- }, 1e3);
- },
- destroyActivityTimer: function() {
- this.data.timer && (clearInterval(this.data.timer), this.data.timer = null);
- },
- onPageScroll: function(e) {
- this.data.scrollTop=e.scrollTop;
- var t = getCurrentPages();
- "pages/index/index/index" == t[t.length - 1].route;
- /*--(e.scrollTop > 10 ? wx.setNavigationBarColor({
- frontColor: "#ffffff",
- backgroundColor: "#f95959"
- }) : wx.setNavigationBarColor({
- frontColor: "#000000",
- backgroundColor: "#eeeeee"
- }));--*/
- },
- jumpSearch: function() {
- wx.navigateTo({
- url: "/pages/goods/search/search"
+ }
+ })
+ //---调用信息---
+ // this.requestRecommend();
+ this.setData({
+ ishow: 1
+ });
+
+ //---先获取会员---
+ t.getUserFir(function () {
+ th.is_festival();
+ var new_nav = th.data.new_nav;
+ if (new_nav == "") {
+ th.is_new();
+ }
+
+ setTimeout(function () {
+ if (getApp().globalData.user_id) getApp().requestCardNum(th);
+ }, 500)
+
+ });
+
+ setTimeout(function () {
+ var goods_list = th.selectComponent("#goods_list"); //组件的id
+ goods_list.init();
+ goods_list.get_list();
+ }, 2000)
+},
+
+//--判断小程序是否过期--
+setappdata: function (t) {
+ if (t.isout == 1)
+ wx.reLaunch({
+ url: "/pages/error/error?msg=该商城已到期,暂停浏览!\r\n可联系:" + getApp().globalData.config.store_tel,
});
- },
- onShareAppMessage: function(e) {
- var url="/pages/index/index/index";
- var userInfo=getApp().globalData.userInfo;
- //是分销商才带
- if(userInfo){
- url+="?first_leader="+userInfo.user_id;
- }
- console.log("---首页---分享--");
- var title="商城首页"
- //分享
- if(getApp().globalData.config && getApp().globalData.config.store_name){
- title=getApp().globalData.config.store_name;
- }else if(getApp().globalData.setting.appName){
- title=getApp().globalData.setting.appName;
- }
-
- var ob={
- title: title,
- path:url,
- };
- console.log(ob);
- return ob;
- },
+ if (t.isbuy == 0)
+ wx.reLaunch({
+ url: "/pages/error/error?msg=还未购买小程序",
+ });
+},
+//---加载更多是靠这个函数----
+onReachBottom: function () {
+ var goods_list = this.selectComponent("#goods_list"); //组件的id
+ if (goods_list) goods_list.get_list();
+},
- //图片失败,默认图片
- bind_bnerr: function(e) {
- var _errImg = e.target.dataset.errorimg;
- var _errObj = {};
- _errObj[_errImg] = this.data.url + "/miniapp/images/del/logo.jpg";
- this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
- },
+onPullDownRefresh: function (e) {
+ this.data.recommend = null, this.data.currentPage = 1, n.resetConfig(), this.requestHomePage(),
+ this.requestRecommend();
+},
+requestRecommend() { },
+requestHomePage() { },
+
+onUnload: function () {
+ this.destroyActivityTimer();
+},
+setCountTime: function (e) {
+ e.diffTime || (e.diffTime = new Date().getTime() - 1e3 * e.server_time), this.setData({
+ "sale.diffTime": e.diffTime
+ }), this.setData({
+ "sale.good": e.flash_sale_goods[0]
+ }), this.destroyActivityTimer(), this.createActivityTimer();
+},
+createActivityTimer: function () {
+ var e = this.data.sale,
+ t = this;
+ this.data.timer = setInterval(function () {
+ var a = 1e3 * e.good.end_time - new Date().getTime() + e.diffTime,
+ o = i.transTime(a);
+ a <= 0 ? t.requestHomePage() : t.setData({
+ "sale.countTime": o
+ });
+ }, 1e3);
+},
+destroyActivityTimer: function () {
+ this.data.timer && (clearInterval(this.data.timer), this.data.timer = null);
+},
+onPageScroll: function (e) {
+ this.data.scrollTop = e.scrollTop;
+ var t = getCurrentPages();
+ "pages/index/index/index" == t[t.length - 1].route;
+ /*--(e.scrollTop > 10 ? wx.setNavigationBarColor({
+ frontColor: "#ffffff",
+ backgroundColor: "#f95959"
+ }) : wx.setNavigationBarColor({
+ frontColor: "#000000",
+ backgroundColor: "#eeeeee"
+ }));--*/
+},
+jumpSearch: function () {
+ wx.navigateTo({
+ url: "/pages/goods/search/search"
+ });
+},
+onShareAppMessage: function (e) {
+ var url = "/pages/index/index/index";
+ var userInfo = getApp().globalData.userInfo;
+ //是分销商才带
+ if (userInfo) {
+ url += "?first_leader=" + userInfo.user_id;
+ }
+ console.log("---首页---分享--");
+ var title = "商城首页"
+ //分享
+ if (getApp().globalData.config && getApp().globalData.config.store_name) {
+ title = getApp().globalData.config.store_name;
+ } else if (getApp().globalData.setting.appName) {
+ title = getApp().globalData.setting.appName;
+ }
+
+ var ob = {
+ title: title,
+ path: url,
+ };
+ console.log(ob);
+ return ob;
+},
- //图片失败,默认图片
- bind_bnerr2: function(e) {
- var _errImg = e.target.dataset.errorimg;
- var _errurl = e.target.dataset.url;
+//图片失败,默认图片
+bind_bnerr: function (e) {
+ var _errImg = e.target.dataset.errorimg;
+ var _errObj = {};
+ _errObj[_errImg] = this.data.url + "/miniapp/images/del/logo.jpg";
+ this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
+},
+
+//图片失败,默认图片
+bind_bnerr2: function (e) {
+ var _errImg = e.target.dataset.errorimg;
+ var _errurl = e.target.dataset.url;
+ var _errObj = {};
+ _errObj[_errImg] = "/miniapp/images/default_g_img.gif";
+ this.setData(_errObj); //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
+
+},
+//图片失败,默认图片
+bind_bnerr3: function (e) {
+ var _errImg = e.target.dataset.errorimg;
+ var _Img = e.target.dataset.img;
+ if (_Img != undefined) {
var _errObj = {};
- _errObj[_errImg] = "/miniapp/images/default_g_img.gif";
- this.setData(_errObj); //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
+ _errObj[_errImg] = "/public/images/default_goods_image_240.gif";
+ this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
+ }
+},
- },
- //图片失败,默认图片
- bind_bnerr3: function(e) {
- var _errImg = e.target.dataset.errorimg;
- var _Img = e.target.dataset.img;
- if (_Img != undefined) {
- var _errObj = {};
- _errObj[_errImg] = "/public/images/default_goods_image_240.gif";
- this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
- }
- },
+//秒杀倒计时
+//---小于10的格式化函数----
+timeFormat(param) {
+ return param < 10 ? '0' + param : param;
+},
- //秒杀倒计时
- //---小于10的格式化函数----
- timeFormat(param) {
- return param < 10 ? '0' + param : param;
- },
+//----秒杀倒计时函数-----
+countDown() {
+ if (!this.data.is_timer) return false;
+ var th = this;
+ // 获取当前时间,同时得到活动结束时间数组
+ var newTime = ut.gettimestamp();
+ var List = this.data.saleGoods;
+ for (var j = 0; j < List.length; j++) {
+ var endTimeList = List[j];
+ // 对结束时间进行处理渲染到页面
+ for (var i = 0; i < endTimeList.length; i++) {
+ var o = endTimeList[i];
+ var endTime = o.end_time
+ if (o.status == 0) endTime = o.start_time
- //----秒杀倒计时函数-----
- countDown() {
- if (!this.data.is_timer) return false;
- var th = this;
- // 获取当前时间,同时得到活动结束时间数组
- var newTime = ut.gettimestamp();
- var List = this.data.saleGoods;
- for (var j = 0; j < List.length; j++) {
- var endTimeList = List[j];
- // 对结束时间进行处理渲染到页面
- for (var i = 0; i < endTimeList.length; i++) {
- var o = endTimeList[i];
- var endTime = o.end_time
- if (o.status == 0) endTime = o.start_time
-
- var obj = null;
- // 如果活动未结束,对时间进行处理
- if (endTime - newTime > 0) {
- var time = (endTime - newTime);
- // 获取天、时、分、秒
- var day = parseInt(time / (60 * 60 * 24));
- var hou = parseInt(time % (60 * 60 * 24) / 3600);
- var min = parseInt(time % (60 * 60 * 24) % 3600 / 60);
- var sec = parseInt(time % (60 * 60 * 24) % 3600 % 60);
- obj = {
- day: this.timeFormat(day),
- hou: this.timeFormat(hou),
- min: this.timeFormat(min),
- sec: this.timeFormat(sec)
- }
- } else {
- //活动已结束,全部设置为'00'
- obj = {
- day: '00',
- hou: '00',
- min: '00',
- sec: '00'
- }
+ var obj = null;
+ // 如果活动未结束,对时间进行处理
+ if (endTime - newTime > 0) {
+ var time = (endTime - newTime);
+ // 获取天、时、分、秒
+ var day = parseInt(time / (60 * 60 * 24));
+ var hou = parseInt(time % (60 * 60 * 24) / 3600);
+ var min = parseInt(time % (60 * 60 * 24) % 3600 / 60);
+ var sec = parseInt(time % (60 * 60 * 24) % 3600 % 60);
+ obj = {
+ day: this.timeFormat(day),
+ hou: this.timeFormat(hou),
+ min: this.timeFormat(min),
+ sec: this.timeFormat(sec)
+ }
+ } else {
+ //活动已结束,全部设置为'00'
+ obj = {
+ day: '00',
+ hou: '00',
+ min: '00',
+ sec: '00'
}
- var txt = "saleGoods[" + j + "][" + i + "].djs";
- th.setData({
- [txt]: obj
- });
}
-
+ var txt = "saleGoods[" + j + "][" + i + "].djs";
+ th.setData({
+ [txt]: obj
+ });
}
- setTimeout(th.countDown, 1000);
- },
- //----拼单倒计时函数-----
- countDown2() {
- if (!this.data.is_timer) return false;
-
- var th = this;
- // 获取当前时间,同时得到活动结束时间数组
- var newTime = ut.gettimestamp();
- var List = this.data.pindGoods;
- for (var j = 0; j < List.length; j++) {
- var endTimeList = List[j];
- // 对结束时间进行处理渲染到页面
- for (var i = 0; i < endTimeList.length; i++) {
- var o = endTimeList[i];
- var endTime = o.end_time;
- if (o.status == 0) endTime = o.start_time;
-
- let obj = null;
- // 如果活动未结束,对时间进行处理
- if (endTime - newTime > 0) {
- let time = (endTime - newTime);
- // 获取天、时、分、秒
- let day = parseInt(time / (60 * 60 * 24));
- let hou = parseInt(time % (60 * 60 * 24) / 3600);
- let min = parseInt(time % (60 * 60 * 24) % 3600 / 60);
- let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60);
- obj = {
- day: this.timeFormat(day),
- hou: this.timeFormat(hou),
- min: this.timeFormat(min),
- sec: this.timeFormat(sec)
- }
- } else {
- //活动已结束,全部设置为'00'
- obj = {
- day: '00',
- hou: '00',
- min: '00',
- sec: '00'
- }
+ }
+ setTimeout(th.countDown, 1000);
+},
+
+//----拼单倒计时函数-----
+countDown2() {
+ if (!this.data.is_timer) return false;
+
+ var th = this;
+ // 获取当前时间,同时得到活动结束时间数组
+ var newTime = ut.gettimestamp();
+ var List = this.data.pindGoods;
+ for (var j = 0; j < List.length; j++) {
+ var endTimeList = List[j];
+ // 对结束时间进行处理渲染到页面
+ for (var i = 0; i < endTimeList.length; i++) {
+ var o = endTimeList[i];
+ var endTime = o.end_time;
+ if (o.status == 0) endTime = o.start_time;
+
+ let obj = null;
+ // 如果活动未结束,对时间进行处理
+ if (endTime - newTime > 0) {
+ let time = (endTime - newTime);
+ // 获取天、时、分、秒
+ let day = parseInt(time / (60 * 60 * 24));
+ let hou = parseInt(time % (60 * 60 * 24) / 3600);
+ let min = parseInt(time % (60 * 60 * 24) % 3600 / 60);
+ let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60);
+ obj = {
+ day: this.timeFormat(day),
+ hou: this.timeFormat(hou),
+ min: this.timeFormat(min),
+ sec: this.timeFormat(sec)
+ }
+ } else {
+ //活动已结束,全部设置为'00'
+ obj = {
+ day: '00',
+ hou: '00',
+ min: '00',
+ sec: '00'
}
- var txt = "pindGoods[" + j + "][" + i + "].djs";
- th.setData({
- [txt]: obj
- });
}
+ var txt = "pindGoods[" + j + "][" + i + "].djs";
+ th.setData({
+ [txt]: obj
+ });
}
- setTimeout(th.countDown2, 1000);
- },
+ }
+ setTimeout(th.countDown2, 1000);
+},
- bannerSwiperChange: function(e) {
- var index = e.detail.current;
- this.setData({
- banner_index: index
- });
- },
- flashSwiperChange: function(e) {
- var index = e.detail.current;
- this.setData({
- flash_index: index
- });
- },
- ptSwiperChange: function(e) {
- var index = e.detail.current;
- this.setData({
- pt_index: index
- });
- },
+bannerSwiperChange: function (e) {
+ var index = e.detail.current;
+ this.setData({
+ banner_index: index
+ });
+},
+flashSwiperChange: function (e) {
+ var index = e.detail.current;
+ this.setData({
+ flash_index: index
+ });
+},
+ptSwiperChange: function (e) {
+ var index = e.detail.current;
+ this.setData({
+ pt_index: index
+ });
+},
- Interval_pt() {
- var th = this;
- this.data.pt_timer = setInterval(function() {
- var item = ut.get_rand_item(th.data.pt_timer_arr);
+Interval_pt() {
+ var th = this;
+ this.data.pt_timer = setInterval(function () {
+ var item = ut.get_rand_item(th.data.pt_timer_arr);
+ th.setData({
+ pt_timer_active: 1,
+ pt_timer_item: item
+ });
+ setTimeout(function () {
th.setData({
- pt_timer_active: 1,
- pt_timer_item: item
+ pt_timer_active: 0
});
- setTimeout(function() {
- th.setData({
- pt_timer_active: 0
- });
- }, 1500)
- }, 4000);
- },
+ }, 1500)
+ }, 4000);
+},
- //---扫一扫的函数---
- getScancode: function() {
- var _this = this;
- // 允许从相机和相册扫码
- wx.scanCode({
- success: (res) => {
- var result = res.result;
- wx.navigateTo({
- url: "/pages/goods/search/search?s_key=" + result,
- });
- }
- })
- },
+//---扫一扫的函数---
+getScancode: function () {
+ var _this = this;
+ // 允许从相机和相册扫码
+ wx.scanCode({
+ success: (res) => {
+ var result = res.result;
+ wx.navigateTo({
+ url: "/pages/goods/search/search?s_key=" + result,
+ });
+ }
+ })
+},
- //跳转到分类
- go_cate: function() {
- getApp().goto("/pages/goods/categoryList/categoryList");
- },
+//跳转到分类
+go_cate: function () {
+ getApp().goto("/pages/goods/categoryList/categoryList");
+},
- go_url: function(e) {
- var url = e.currentTarget.dataset.url;
- getApp().goto(url);
- },
+go_url: function (e) {
+ var url = e.currentTarget.dataset.url;
+ getApp().goto(url);
+},
- bind_bnerr_icon: function(e) {
- var def = "/miniapp/images/no_cate_def.png";
- var _err = e.currentTarget.dataset.err;
- var ob = {};
- ob[_err] = def;
- this.setData(ob);
- },
+bind_bnerr_icon: function (e) {
+ var def = "/miniapp/images/no_cate_def.png";
+ var _err = e.currentTarget.dataset.err;
+ var ob = {};
+ ob[_err] = def;
+ this.setData(ob);
+},
- //跳转到分类的商品列表
- go_cate2: function(t) {
- var cid = t.currentTarget.dataset.cid;
- var pid = t.currentTarget.dataset.pid;
- var lurl = "/pages/goods/goodsList/goodsList?cat_id=" + cid + "&pid=" + pid;
+//跳转到分类的商品列表
+go_cate2: function (t) {
+ var cid = t.currentTarget.dataset.cid;
+ var pid = t.currentTarget.dataset.pid;
+ var lurl = "/pages/goods/goodsList/goodsList?cat_id=" + cid + "&pid=" + pid;
+ wx.navigateTo({
+ url: lurl
+ });
+},
+new_nav: function (e) {
+ var th = this;
+ var new_nav = th.data.new_nav;
+ getApp().goto(new_nav);
+},
+//跳转到权益
+go_quanyi: function (t) {
+ var user_info = getApp().globalData.userInfo;
+ if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
wx.navigateTo({
- url: lurl
- });
- },
- new_nav: function(e) {
- var th = this;
- var new_nav = th.data.new_nav;
- getApp().goto(new_nav);
- },
- //跳转到权益
- go_quanyi: function(t) {
- var user_info = getApp().globalData.userInfo;
- if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
- wx.navigateTo({
- url: '/pages/togoin/togoin',
- //url: '/pages/getphone/getphone',
- })
- return false;
- }
- getApp().goto("/pages/user/userqy/userqy");
- },
+ url: '/pages/togoin/togoin',
+ //url: '/pages/getphone/getphone',
+ })
+ return false;
+ }
+ getApp().goto("/pages/user/userqy/userqy");
+},
- imageLoad: function(e) {
- var imgwidth = e.detail.width;
- var imgheight = e.detail.height;
- //宽高比
- var ratio = imgwidth / imgheight;
- //计算的高度值
- var viewHeight = 715 / ratio;
- if (this.data.max_sw_height < viewHeight) this.setData({
- max_sw_height: viewHeight
- });
- },
- //判断该用户是否是新会员
- is_new: function() {
- var th = this;
- wx.hideLoading();
- getApp().request.promiseGet("/api/weshop/marketing/newpeople/act/judge", {
- data: {
- storeId: os.stoid,
- userId: d.user_id
+imageLoad: function (e) {
+ var imgwidth = e.detail.width;
+ var imgheight = e.detail.height;
+ //宽高比
+ var ratio = imgwidth / imgheight;
+ //计算的高度值
+ var viewHeight = 715 / ratio;
+ if (this.data.max_sw_height < viewHeight) this.setData({
+ max_sw_height: viewHeight
+ });
+},
+//判断该用户是否是新会员
+is_new: function () {
+ var th = this;
+ wx.hideLoading();
+ getApp().request.promiseGet("/api/weshop/marketing/newpeople/act/judge", {
+ data: {
+ storeId: os.stoid,
+ userId: d.user_id,
+ }
+ }).then(res => {
+ if (res.data.code == 0) {
+ var actid = res.data.data.id; //活动id
+ var giftBagId = res.data.data.giftBagId; //礼包id
+ var new_nav = "/pages/giftpack/newvipgift/newvipgift?actId=" + actid + '&' + 'actType=' + 1 + '&' + 'giftBagId=' + giftBagId;
+ var new_image = res.data.data.imageurl;
+ var swiperimage = th.data.swiperimage;
+ var img = {
+ image: "/miniapp/images/newpeople/newpeople.png",
+ nav_url: new_nav
}
- }).then(res => {
- if (res.data.code == 0) {
- var actid = res.data.data.id; //活动id
- var giftBagId = res.data.data.giftBagId; //礼包id
- var new_nav = "/pages/giftpack/newvipgift/newvipgift?actId=" + actid + '&' + 'actType=' + 1 + '&' + 'giftBagId=' + giftBagId;
- var new_image = res.data.data.imageurl;
- var swiperimage = th.data.swiperimage;
- var img = {
- image: "/miniapp/images/newpeople/newpeople.png",
- nav_url: new_nav
+ swiperimage.unshift(img);
+ th.setData({
+ swiperimage: swiperimage,
+ new_image: new_image,
+ new_nav: new_nav
+ })
+
+ getApp().request.promiseGet("/api/weshop/marketing/newpeople/act/bound/judge", {
+ data: {
+ storeId: o.stoid,
+ userId: d.user_id
+ }
+ }).then(res => {
+ if (res.data.code == 0) {
+ th.setData({
+ is_disgraceful: 1
+ })
+ } else {
+ th.check_holiday_pop(); //节日的弹窗
}
- swiperimage.unshift(img);
- th.setData({
- swiperimage: swiperimage,
- new_image: new_image,
- new_nav: new_nav
- })
- getApp().request.promiseGet("/api/weshop/marketing/newpeople/act/bound/judge", {
- data: {
- storeId: o.stoid,
- userId: d.user_id
- }
- }).then(res => {
- if (res.data.code == 0) {
- th.setData({
- is_disgraceful: 1
- })
- }else{
- th.check_holiday_pop(); //节日的弹窗
- }
-
- })
- }else{
- th.check_holiday_pop(); //节日的弹窗
- }
-
- })
+ })
+ } else {
+ th.check_holiday_pop(); //节日的弹窗
+ }
- },
-
- is_festival: function(e) {
- var th = this;
- var url = "/api/weshop/marketing/holiday/act/judge";
- getApp().request.promiseGet(url, {
- data: {
- storeId: os.stoid,
- userId: d.user_id
- }
- }).then(res => {
- if (res.data.code == 0) {
- var actid = res.data.data.id; //活动id
- var giftBagId = res.data.data.gifBagId; //礼包id
- var nav_url = "/pages/giftpack/festival/festival?actId=" + actid + '&' + 'actType=' + 3 + '&' + 'giftBagId=' + giftBagId;
- var swiperimage = th.data.swiperimage;
- var actBoundImg = res.data.data.actBoundImg;
-
- th.data.holiday_image= res.data.data.actImg;
- th.data.holiday_url=nav_url;
-
- var img = {
- image: actBoundImg,
- nav_url: nav_url
- }
- swiperimage.unshift(img);
- th.setData({
- swiperimage: swiperimage,
- new_nav: nav_url
- })
+ })
+
+},
+
+is_festival: function (e) {
+ var th = this;
+ var url = "/api/weshop/marketing/holiday/act/judge";
+ getApp().request.promiseGet(url, {
+ data: {
+ storeId: os.stoid,
+ userId: d.user_id,
+ id:th.data.actid //
+ }
+ }).then(res => {
+ if (res.data.code == 0) {
+ var actid = res.data.data.id; //活动id
+ var giftBagId = res.data.data.gifBagId; //礼包id
+ var nav_url = "/pages/giftpack/festival/festival?actId=" + actid + '&' + 'actType=' + 3 + '&' + 'giftBagId=' + giftBagId;
+ var swiperimage = th.data.swiperimage;
+ var actBoundImg = res.data.data.actBoundImg;
+
+ th.data.holiday_image = res.data.data.actImg;
+ th.data.holiday_url = nav_url;
+
+ var img = {
+ image: actBoundImg,
+ nav_url: nav_url
}
+ swiperimage.unshift(img);
+ th.setData({
+ swiperimage: swiperimage,
+ new_nav: nav_url
+ })
+ }
+ })
+},
+
+//弹出节日有礼
+check_holiday_pop: function () {
+ var th = this;
+ getApp().waitfor(th, 'w_holiday_pop', th.data.holiday_image, function () {
+ console.log(th.data.holiday_image);
+ th.setData({
+ new_image: th.data.holiday_image,
+ new_nav: th.data.holiday_url,
+ is_disgraceful: 1
})
- },
-
- //弹出节日有礼
- check_holiday_pop:function(){
- var th=this;
- getApp().waitfor(th,'w_holiday_pop',th.data.holiday_image,function(){
- console.log(th.data.holiday_image);
- th.setData({
- new_image: th.data.holiday_image,
- new_nav: th.data.holiday_url,
- is_disgraceful: 1
- })
- })
- },
-
- go_ad:function(e){
- var url=e.currentTarget.dataset.url;
- if(!url || url=='') return;
- if(url[0]!='/') url='/'+url;
- getApp().goto(url);
- },
-
- //导航跳转
- nav_goto:function(e){
- var url=e.currentTarget.dataset.url;
- if(!url || url=='') return;
- if(url[0]!='/') url='/'+url;
- getApp().goto(url);
- if(this.data.showHongbao) {
- this.setData({
- showHongbao: false,
- showHongbaoSmall: true, //显示抢红包小图标
- });
- }
- },
-
- //----跳转到搭配购买----
- go_test:function () {
- wx.navigateTo({ url: "/packageA/pages/goods_share/goods_share", })
- },
-
-
- onShareTimeline() {
- // getApp().getConfig(function(t) {
- // return {
- // title: '首页-' + getApp().globalData.config.store_name,
- // }
- // });
- var store_name=getApp().globalData.config?getApp().globalData.config.store_name:'';
- if(!store_name)
- store_name=getApp().globalData.setting.appName;
- return {
- title: '首页-' + store_name,
- }
- },
-
-
- // 关闭首页抢红包主弹窗,显示侧边栏抢红包小图标
- closeHongbao() {
- this.setData({
- showHongbao: false, //关闭抢红包主弹窗
- showHongbaoSmall: true, //显示抢红包小图标
- });
- },
-
- /*-- 全屏广告 --*/
- close_full_screen(){
- this.setData({is_full_screen_show:0,sec_show:0});
- },
- //-- 跳转到满屏广告的链接 --
- go_full_ad(){
- if(!this.data.full_ad) return false;
- if(!this.data.full_ad.ad_weapplink) return false;
- getApp().goto(this.data.full_ad.ad_weapplink);
- this.close_full_screen();
- },
+ })
+},
+
+go_ad: function (e) {
+ var url = e.currentTarget.dataset.url;
+ if (!url || url == '') return;
+ if (url[0] != '/') url = '/' + url;
+ getApp().goto(url);
+},
+
+//导航跳转
+nav_goto: function (e) {
+ var url = e.currentTarget.dataset.url;
+ if (!url || url == '') return;
+ if (url[0] != '/') url = '/' + url;
+ getApp().goto(url);
+ if (this.data.showHongbao) {
+ this.setData({
+ showHongbao: false,
+ showHongbaoSmall: true, //显示抢红包小图标
+ });
+ }
+},
+
+//----跳转到搭配购买----
+go_test: function () {
+ wx.navigateTo({ url: "/packageA/pages/goods_share/goods_share", })
+},
+
+
+onShareTimeline() {
+ // getApp().getConfig(function(t) {
+ // return {
+ // title: '首页-' + getApp().globalData.config.store_name,
+ // }
+ // });
+ var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : '';
+ if (!store_name)
+ store_name = getApp().globalData.setting.appName;
+ return {
+ title: '首页-' + store_name,
+ }
+},
+
+
+// 关闭首页抢红包主弹窗,显示侧边栏抢红包小图标
+closeHongbao() {
+ this.setData({
+ showHongbao: false, //关闭抢红包主弹窗
+ showHongbaoSmall: true, //显示抢红包小图标
+ });
+},
+
+/*-- 全屏广告 --*/
+close_full_screen() {
+ this.setData({ is_full_screen_show: 0, sec_show: 0 });
+},
+//-- 跳转到满屏广告的链接 --
+go_full_ad() {
+ if (!this.data.full_ad) return false;
+ if (!this.data.full_ad.ad_weapplink) return false;
+ getApp().goto(this.data.full_ad.ad_weapplink);
+ this.close_full_screen();
+},
});
\ No newline at end of file
diff --git a/project.config.json b/project.config.json
index b6d3437..c8fb41c 100644
--- a/project.config.json
+++ b/project.config.json
@@ -21,21 +21,22 @@
"checkSiteMap": true,
"uploadWithSourceMap": true,
"compileHotReLoad": false,
- "useMultiFrameRuntime": true,
- "useApiHook": true,
+ "lazyloadPlaceholderEnable": false,
+ "useMultiFrameRuntime": false,
+ "useApiHook": false,
"useApiHostProcess": false,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
+ "enableEngineNative": false,
"useIsolateContext": true,
- "useCompilerModule": false,
- "userConfirmedUseCompilerModuleSwitch": false,
"userConfirmedBundleSwitch": false,
"packNpmManually": false,
"packNpmRelationList": [],
- "minifyWXSS": true
+ "minifyWXSS": true,
+ "showES6CompileOption": false
},
"compileType": "miniprogram",
"libVersion": "2.16.0",