diff --git a/pages/giftpack/birthdaygift/birthdaygift.js b/pages/giftpack/birthdaygift/birthdaygift.js index c789f95..206af80 100644 --- a/pages/giftpack/birthdaygift/birthdaygift.js +++ b/pages/giftpack/birthdaygift/birthdaygift.js @@ -19,7 +19,7 @@ Page({ getActId: '', getActType: '', giftID: '', - receiveState: '一键全部领取', + receiveState: 0, textTitle: '', getUrl: '', noShow: false, @@ -29,13 +29,11 @@ Page({ growUpTitle: "", is_sub: 0, //是否重复领取 }, - GetList: function () { + GetList: function() { var th = this; var url = "/api/weshop/marketing/giftbag/bound/get"; - wx.showLoading({ - title: '加载中', - }) getApp().request.promiseGet(url, { + isShowLoading: true, data: { "actId": th.data.getActId, //活动id "actType": 4, //活动类型 1新人礼 2评价有礼 3节日营销 4生日营销 @@ -44,7 +42,6 @@ Page({ "userId": d.user_id //用户ID } }).then(res => { - wx.hideLoading(); if (res.data.code == 0) { if (res.data.data.lbCoupons.length > 0 && res.data.data.lbCoupons != null) { //礼包内容--礼券 @@ -93,19 +90,18 @@ Page({ }) if (res.data.data.receiveState == 0) { th.setData({ - receiveState: '一键全部领取' + receiveState: 0 }) } else { th.setData({ - receiveState: '已领取' + receiveState: 1 }) } if (res.data.data.actIntro != '') { th.setData({ textShow: true, - textTitle: res.data.data.actIntro.replace(/\/g, '\div>') + textTitle: res.data.data.actIntro.replace(/\ - - {{receiveState}} - + + + 已领取 + + + + + 一键全部领取 + + diff --git a/pages/giftpack/evaluategift/evaluategift.js b/pages/giftpack/evaluategift/evaluategift.js index b41121c..442f981 100644 --- a/pages/giftpack/evaluategift/evaluategift.js +++ b/pages/giftpack/evaluategift/evaluategift.js @@ -19,7 +19,7 @@ Page({ getActId: '', getActType: '', giftBagId: '', - receiveState: '一键全部领取', + receiveState: 0, textTitle: '', getUrl: '', noShow: false, @@ -39,6 +39,7 @@ Page({ }) var url = "/api/weshop/marketing/giftbag/bound/get"; getApp().request.promiseGet(url, { + isShowLoading: true, data: { "actId": th.data.getActId, //活动Id "actType": 2, //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 @@ -50,7 +51,6 @@ Page({ "gifbagid": th.data.giftBagId } }).then(res => { - wx.hideLoading(); if (res.data.code == 0) { if (res.data.data.lbCoupons.length > 0 && res.data.data.lbCoupons != null) { //礼包内容--礼券 @@ -99,18 +99,18 @@ Page({ }) if (res.data.data.receiveState == 0) { th.setData({ - receiveState: '一键全部领取' + receiveState:0 }) } else { th.setData({ - receiveState: '已领取' + receiveState: 1 }) } if (res.data.data.actIntro != '') { th.setData({ textShow: true, - textTitle: res.data.data.actIntro + textTitle: res.data.data.actIntro.replace(/\ - - - - + + + + @@ -94,8 +94,13 @@ 分类限定 + + 包邮券 + + {{item.sum+"元券"}} {{"满"+item.buySum+"元可以用"}} + @@ -147,7 +152,7 @@ 活动规则: - + @@ -161,9 +166,16 @@ - - {{receiveState}} - + + + 已领取 + + + + + 一键全部领取 + + diff --git a/pages/giftpack/festival/festival.js b/pages/giftpack/festival/festival.js new file mode 100644 index 0000000..c2fa8f3 --- /dev/null +++ b/pages/giftpack/festival/festival.js @@ -0,0 +1,209 @@ +var i = require("../../../utils/util.js") +var e = getApp(), + a = e.globalData.setting, + os = a, + t = e.request, + d = e.globalData; +Page({ + data: { + url: a.url, //接口网址 + iurl: a.imghost, //图片前缀网址 + itemShow: false, //项目栏目是否显示 + cardShow: false, //代金券栏目是否显示 + packShow: false, //福利栏目是否显示 + textShow: false, //规则是否显示 + integralShow: true, //积分领取是否显示 + growUpShow: true, //成长值领取是否显示 + itemButton: '', + cardButton: '', + getActId: '', + getActType: '', + giftID: '', + receiveState: 0, + textTitle: '', + getUrl: '', + noShow: false, + cards: [], //礼包内容--礼券 + itemWare: [], //礼包内容--服务项目 + integralTitle: "", + growUpTitle: "", + is_sub: 0, //是否重复领取 + bimg: "", //评价有礼背景图片 + actFontColor: "", //字体颜色 + actBgColor: "", //背景颜色 + }, + GetList: function() { + var th = this; + wx.showLoading({ + title: '加载中', + }) + var url = "/api/weshop/marketing/giftbag/bound/get"; + getApp().request.promiseGet(url, { + isShowLoading: true, + data: { + "actId": th.data.getActId, //活动id + "actType": 3, //活动类型 1新人礼 2评价有礼 3节日营销 4生日营销 + "giftBagId": th.data.giftID, //礼包ID + "storeId": a.stoid, //商家ID + "userId": d.user_id //用户ID + } + }).then(res => { + if (res.data.code == 0) { + if (res.data.data.lbCoupons != null && res.data.data.lbCoupons.length > 0) { + //礼包内容--礼券 + th.setData({ + cardShow: true, + cards: res.data.data.lbCoupons + }) + } + if (res.data.data.lbSM != null && res.data.data.lbSM.length > 0) { + //礼包内容--服务项目 + th.setData({ + itemShow: true, + itemWare: res.data.data.lbSM + }) + } + //礼包积分 + if (res.data.data.lbIntegral <= 0) { + if (res.data.data.lbGrowthValue <= 0) { + th.setData({ + packShow: false + }) + } else { + th.setData({ + packShow: false, + integralShow: false, + growUpShow: true + }) + } + + } else { + if (res.data.data.lbGrowthValue > 0) { + th.setData({ + packShow: true + }) + } else { + th.setData({ + packShow: true, + integralShow: true, + growUpShow: false + }) + } + } + th.setData({ + integralTitle: '价值' + res.data.data.lbIntegral + '积分', + growUpTitle: '价值' + res.data.data.lbGrowthValue + '成长值' + }) + if (res.data.data.receiveState == 0) { + th.setData({ + receiveState: 0 + }) + } else { + th.setData({ + receiveState: 1 + }) + } + + if (res.data.data.actIntro != '') { + th.setData({ + textShow: true, + textTitle: res.data.data.actIntro.replace(/\ { + if (res.data.code == 0) { + th.setData({ + bimg: res.data.data.actBoundImg, + actFontColor: res.data.data.actFontColor, //字体颜色 + actBgColor: res.data.data.actBgColor, //背景颜色 + + }) + } + }) + }, + //界面跳转 + goto: function(e) { + var url = e.currentTarget.dataset.url; + getApp().goto(url); + }, + //图片失败,默认图片 + bind_bnerr1: function(e) { + var th = this; + var _errImg = e.target.dataset.errorimg; + var _Img = e.target.dataset.img; + if (_Img != undefined) { + var _errObj = {}; + _errObj[_errImg] = "/miniapp/images/giftbag/gift02.png"; + th.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; + } + }, +}); \ No newline at end of file diff --git a/pages/giftpack/festival/festival.json b/pages/giftpack/festival/festival.json new file mode 100644 index 0000000..3e38fd3 --- /dev/null +++ b/pages/giftpack/festival/festival.json @@ -0,0 +1,7 @@ +{ + "navigationBarTitleText": "节日有礼", + "usingComponents": { + "warn": "/components/long_warn/long_warn", + "my_confirm": "/components/my_confirm/my_confirm" + } +} \ No newline at end of file diff --git a/pages/giftpack/festival/festival.wxml b/pages/giftpack/festival/festival.wxml new file mode 100644 index 0000000..81da5c8 --- /dev/null +++ b/pages/giftpack/festival/festival.wxml @@ -0,0 +1,178 @@ + + + + + + + + + ______ + + + 新人专享\n你的美丽我来缔造 + + + ______ + + + + + + + + + + + + + + + + + + 免费领取 + + + {{item.fromName}} + + + + + {{item.fromName}} + + + {{"新人可免费享受专业"+item.fromName+",可以享受"+item.num+"次。"}} + + + 数量: + {{item.num}} + + + + + + + + + + + + + + + + + + + ——— + + + 新人专享优惠券 + + + ——— + + + + + + + + + 全场通用 + + + 品牌限定 + + + 品类限定 + + + 用途限定 + + + 分类限定 + + + {{item.sum+"元券"}} + {{"满"+item.buySum+"元可以用"}} + + + + + + + + + + + + + + + + + + ——— + + + 新人专享福利 + + + ——— + + + + + + + + + + + + + + + + + + + + + + + + + 活动规则: + + + + + + + + + + + + 本活动最终解释权归公司所有,如果有问题请联系客服 + + + + + + + 已领取 + + + + + 一键全部领取 + + + + + + + \ No newline at end of file diff --git a/pages/giftpack/festival/festival.wxss b/pages/giftpack/festival/festival.wxss new file mode 100644 index 0000000..8fe8975 --- /dev/null +++ b/pages/giftpack/festival/festival.wxss @@ -0,0 +1,411 @@ +@charset "UTF-8"; + +/* Author XGQ + * 2019-10-27 + */ + +.image_box { + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; +} + +.image_box image { + width: 100%; + height: 690rpx; +} + +.top { + margin: -20rpx 28rpx 45rpx 28rpx; + padding: 10rpx 10rpx 70rpx 10rpx; + background-color: #fff; + border-radius: 0rpx 0rpx 15rpx 15rpx; +} + +.top_box { + display: -webkit-box; + display: -webkit-flex; + display: flex; + text-align: center; + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; +} + +.top_box_text { + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; + margin: 50rpx 15rpx 20rpx 15rpx; +} + +.top_box_text text { + color: #FFB72D; + font-size: 40rpx; +} + +.top_item { + display: -webkit-box; + display: -webkit-flex; + display: flex; + width: 100%; + margin: 60rpx 0 0 0; +} + +.top_item_img { + float: left; + width: 28%; + margin: 0rpx 10rpx 0rpx 20rpx; +} + +.top_item_img image { + width: 150rpx; + height: 150rpx; + border-radius: 50%; + border: #f96865 solid 3rpx; +} + +.top_item_center { + float: left; + width: 50%; +} + +.top_item_center_title { + font-size: 35rpx; + color: #FFB72D; + -webkit-box-pack: start; + -webkit-justify-content: flex-start; + justify-content: flex-start; + padding: 0 10rpx 15rpx 0rpx; + word-break: break-all; + /*属性规定自动换行的处理方法。normal(使用浏览器默认的换行规则。),break-all(允许在单词内换行。),keep-all(只能在半角空格或连字符处换行。)*/ + text-overflow: ellipsis; + display: -webkit-box; + /** 对象作为伸缩盒子模型显示 **/ + -webkit-box-orient: vertical; + /** 设置或检索伸缩盒对象的子元素的排列方式 **/ + -webkit-line-clamp: 2; + /** 显示的行数 **/ + overflow: hidden; + /** 隐藏超出的内容 **/ +} + +.top_item_center_ramke { + font-size: 25rpx; + -webkit-box-pack: start; + -webkit-justify-content: flex-start; + justify-content: flex-start; + line-height: 35rpx; + letter-spacing: 0.5rpx; + word-break: break-all; + /*属性规定自动换行的处理方法。normal(使用浏览器默认的换行规则。),break-all(允许在单词内换行。),keep-all(只能在半角空格或连字符处换行。)*/ + text-overflow: ellipsis; + display: -webkit-box; + /** 对象作为伸缩盒子模型显示 **/ + -webkit-box-orient: vertical; + /** 设置或检索伸缩盒对象的子元素的排列方式 **/ + -webkit-line-clamp: 2; + /** 显示的行数 **/ + overflow: hidden; + /** 隐藏超出的内容 **/ +} + +.top_item_button { + float: right; + width: 22%; + padding: 65rpx 20rpx 0 1rpx; +} + +.top_item_button button { + font-size: 25rpx; + background: #fd6969; + color: #fff; + border-radius: 50rpx; + height: 45rpx; + line-height: 45rpx; +} + +.top_card { + width: calc(50% - 30rpx); + display: inline-block; + margin: 15rpx; +} + +.top_card_box { + background-size: cover; + background-position: center; + background-repeat: no-repeat; + border-radius: 20rpx; + height: 250rpx; + margin: 5rpx; +} + +.img1 { + background-image: url(https://mshopimg.yolipai.net/miniapp/images/giftbag/vip01.png); +} + +.img2 { + background-image: url(https://mshopimg.yolipai.net/miniapp/images/giftbag/vip02.png); +} + +.img3 { + background-image: url(https://mshopimg.yolipai.net/miniapp/images/giftbag/vip03.png); +} + +.top_card_tite_box { + width: 100%; + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-pack: end; + -webkit-justify-content: flex-end; + justify-content: flex-end; +} + +.top_card_tite_a { + padding: 5rpx 25rpx 5rpx 25rpx; + line-height: 29rpx; + font-size: 25rpx; + color: #fff; + background: #ffa7c0; + border-radius: 0rpx 20rpx 0rpx 6rpx; +} + +.top_card_tite_b { + padding: 5rpx 25rpx 5rpx 25rpx; + line-height: 29rpx; + font-size: 25rpx; + color: #fff; + background: #50dfdb; + border-radius: 0rpx 20rpx 0rpx 6rpx; +} + +.top_card_tite_c { + padding: 5rpx 25rpx 5rpx 25rpx; + line-height: 29rpx; + font-size: 25rpx; + color: #fff; + background: #92cbff; + border-radius: 0rpx 20rpx 0rpx 6rpx; +} + +.top_card_tite_d { + padding: 5rpx 25rpx 5rpx 25rpx; + line-height: 29rpx; + font-size: 25rpx; + color: #fff; + border-radius: 0rpx 20rpx 0rpx 6rpx; +} + +.top_card_counte { + padding: 40rpx 20rpx 0 0; + text-align: center; + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; + color: #fff; + font-size: 40rpx; +} + +.top_card_remak { + padding: 20rpx 0 40rpx 0; + text-align: center; + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; + font-size: 20rpx; + color: #fff; +} + +.top_card_button_a button { + margin: 0 85rpx; + background: #ffa6bc; + border-radius: 50rpx; + line-height: 40rpx; + height: 40rpx; + color: white; + font-size: 25rpx; +} + +.top_card_button_b button { + margin: 0 85rpx; + background: #50dfdb; + border-radius: 50rpx; + line-height: 40rpx; + height: 40rpx; + color: white; + font-size: 25rpx; +} + +.top_card_button_c button { + margin: 0 85rpx; + background: #75bcfc; + border-radius: 50rpx; + line-height: 40rpx; + height: 40rpx; + color: white; + font-size: 25rpx; +} + +.top_card_button_d button { + margin: 0 85rpx; + border-radius: 50rpx; + line-height: 40rpx; + height: 40rpx; + color: white; + font-size: 25rpx; +} + +.top_box_image { + padding: 20rpx 20rpx 20rpx 20rpx; +} + +.top_box_image image { + height: 216rpx; + width: 100%; +} + +.top_box_image button { + margin: 15rpx 95rpx 0rpx 95rpx; + background: rgb(254,182,44); + border-radius: 50rpx; + line-height: 60rpx; + height: 60rpx; + color: white; + font-size: 30rpx; +} + +.foot_box { + margin: 0 30rpx 40rpx 30rpx; + background: #fff; + border-radius: 20rpx; +} + +.foot_box_title { + color: #000; + padding: 20rpx 30rpx 20rpx 30rpx; +} + +.foot_box_text { + font-size: 30rpx; + color: #000; + line-height: 48rpx; + padding: 20rpx 35rpx 50rpx 30rpx; +} + +.button_box { + margin: 50rpx 50rpx 50rpx 50rpx; + text-align: center; +} + +.button { + margin: 0 30rpx; + background: #FFDB97; + border-radius: 50rpx; + line-height: 80rpx; + height: 80rpx; + color: white; + font-size: 35rpx; +} + +.button_text { + padding-top: 20rpx; + font-size: 20rpx; + color: white; + height: 100rpx; +} + +.foot_empty { + height: 90rpx; +} + +.foot_button { + display: -webkit-box; + display: -webkit-flex; + display: flex; + margin: 20rpx 0rpx 0rpx 0rpx; + padding: 25rpx 0rpx; + background: #fff; + text-align: center; + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; + position: fixed; + bottom: 0; + left: 0; + width: 100%; + z-index: 10; +} + +.foot_button_buy { + background: #FFB72D; + color: #fff; + width: 400rpx; + height: 70rpx; + font-size: 28rpx; + line-height: 70rpx; + border-radius: 40rpx; +} + +.foot_button_notbuy { + background: #999; + color: #fff; + width: 400rpx; + height: 70rpx; + font-size: 28rpx; + line-height: 70rpx; + border-radius: 40rpx; +} + +/* page { + background-color: #FFB72D; +} */ + +button::after { + border: none; +} + +.foot_box_text ._img { + width: 100%; +} + +.foot_box_text .img { + line-height: 0; +} + +.image { + width: 400rpx; + height: 200rpx; +} + +.num { + color: #FFB72D; +} + +.lvip { + left: 30rpx; + bottom: -58rpx; + width: 20rpx; + height: 90rpx; + z-index: 5; +} + +.rvip { + right: 30rpx; + bottom: -58rpx; + width: 20rpx; + height: 90rpx; + z-index: 5; +} diff --git a/pages/user/assistance/assistance.js b/pages/user/assistance/assistance.js index 41d119f..679a63e 100644 --- a/pages/user/assistance/assistance.js +++ b/pages/user/assistance/assistance.js @@ -6,7 +6,9 @@ var t = getApp(), ut = i, s = require("../../../utils/common.js"); var regeneratorRuntime = require('../../../utils/runtime.js'); -var oo = t.globalData.setting,os=oo, ut= require("../../../utils/util.js"); +var oo = t.globalData.setting, + os = oo, + ut = require("../../../utils/util.js"); Page({ /** @@ -22,10 +24,10 @@ Page({ cur_page: 1, //页码 page_num: 5, //每页多少个 is_show_more: 0, //是否加载更多 - help_id:"",//助力活动的id - timer:"",//任务列表的定时器 - s_num:"",//多少人已经领取任务 - page:1,//我的任务的当前页 + help_id: "", //助力活动的id + timer: "", //任务列表的定时器 + s_num: "", //多少人已经领取任务 + page: 1, //我的任务的当前页 }, /** @@ -36,79 +38,85 @@ Page({ var nav_b = th.selectComponent("#nav_b"); //组件的id nav_b.set_name("助力", "/pages/user/assistance/assistance"); // 助力活动 - this.assistance(); + th.assistance(); }, /** * 生命周期函数--监听页面显示 */ onShow: function() { - + }, // 助力活动 - assistance() { - var th=this; + assistance() { + var th = this; var user_id = getApp().globalData.user_id; var store_id = os.stoid; - getApp().request.promiseGet("/api/weshop/marketing/help/act/judge", { + isShowLoading: true, data: { storeId: store_id, userId: user_id } }).then(res => { if (res.data.code == 0) { - var help_data=res.data.data; - th.setData({ zl_act:help_data, help_id:help_data.id }); - if (th.data.help_id != "" && th.data.help_id!=null) { - //我的任务 + var help_data = res.data.data; + help_data.remark = help_data.remark.replace(/\{ - if(res.data.code==0) - th.setData({s_num:res.data.data.countAll}) - }) - - + return ut.null_promise(); + }).then(res => { + if (res.data.code == 0) + th.setData({ + s_num: res.data.data.countAll + }) + }) + + }, //--点击获取用户任务列表--会员的任务列表 - get_list:function() { - + get_list: function() { + var th = this; - var page=th.data.page; - var help_id=this.data.help_id; + var page = th.data.page; + var help_id = this.data.help_id; t.request.get("/api/weshop/marketing/help/help/user/page", { + isShowLoading: true, data: { - userId:getApp().globalData.user_id, + userId: getApp().globalData.user_id, storeId: os.stoid, helpId: help_id, page: page, - pageSize:5 + pageSize: 5 }, success: function(res) { clearTimeout(th.data.timer); - - if (!th.data.is_load) - th.setData({ - is_load: 1 - }) - - + + if (!th.data.is_load) + th.setData({ + is_load: 1 + }) + if (res.data.code == 0) { - + var list = th.data.zl_user_list; //连接数组 - list = list.concat(res.data.data.pageData); + list = list.concat(res.data.data.pageData); th.setData({ zl_user_list: list, is_load: 1, @@ -117,20 +125,18 @@ Page({ th.setData({ is_show_more: 1 }) - }else{ + } else { var page = th.data.page + 1; th.setData({ is_show_more: 0, page: page }) } - } else { - - getApp().showWarning("暂无更多内容",0); + getApp().my_confirm(res.data.msg, 0, th); th.setData({ is_show_more: 1, - page: page + page: page }) } @@ -140,11 +146,11 @@ Page({ //-----跳转到领取礼包的页面------ go_task: function() { - - var help_id=this.data.help_id; - getApp().goto("/pages/user/assistance/task_assistance?help_id="+help_id); + var th = this; + var help_id = th.data.help_id; + getApp().goto("/pages/user/assistance/task_assistance?help_id=" + help_id); }, - switch_head: function (e) { + switch_head: function(e) { var th = this; var index = e.currentTarget.dataset.index; //获取当前选择的是任务还是活动说明 var switch_head = th.data.switch_head; //0任务,1活动说明 @@ -156,22 +162,22 @@ Page({ }, //关闭导航 - close: function () { + close: function() { var th = this; var nav_b = th.selectComponent("#nav_b"); //组件的id nav_b.close_box(); }, + // 领取礼包 - get_libao:function(e){ - var libao_id=e.currentTarget.dataset.libaoid; - var completeid= e.currentTarget.dataset.completeid; - - getApp().goto("/pages/user/assistance/giftpacklist?libao_id=" + libao_id + "&is_libao=" + 1 + "&completeid=" + completeid); + get_libao: function(e) { + var libao_id = e.currentTarget.dataset.libaoid; + getApp().goto("/pages/user/assistance/giftpacklist?libao_id=" + libao_id + "&is_libao=" + 1); }, + //查看礼包id - select_libao:function(){ - var libao_id = e.currentTarget.dataset.libaoid; - var ordersn = e.currentTarget.dataset.orderid; - getApp().goto("/pages/user/assistance/giftpacklist?libao_id=" + libao_id + "&is_libao=" + 0 + "&ordersn=" + ordersn ); + select_libao: function() { + var orderSn = e.currentTarget.dataset.orderSn;//订单号 + getApp().goto("/pages/user/assistance/giftpacklist?orderSn=" + orderSn); } + }) \ No newline at end of file diff --git a/pages/user/assistance/assistance.json b/pages/user/assistance/assistance.json index 63f5fe9..b1940cd 100644 --- a/pages/user/assistance/assistance.json +++ b/pages/user/assistance/assistance.json @@ -1,6 +1,5 @@ { "navigationBarTitleText": "好友助力,得好礼", - "navigationStyle": "custom", "usingComponents": { "warn": "/components/long_warn/long_warn", "my_confirm": "/components/my_confirm/my_confirm", diff --git a/pages/user/assistance/assistance.wxml b/pages/user/assistance/assistance.wxml index 8b09dca..82516c5 100644 --- a/pages/user/assistance/assistance.wxml +++ b/pages/user/assistance/assistance.wxml @@ -8,16 +8,15 @@ - + 机会总是留给最有行动力的人 - 活动时间: - {{filter_s.format_time(zl_act.beginDate,0)}} 至 {{filter_s.format_time(zl_act.endDate,0)}} - + 活动时间:{{filter_s.format_time(zl_act.beginDate,0)}} 至 {{filter_s.format_time(zl_act.endDate,0)}} + @@ -48,31 +47,30 @@ {{item.helpTaskName}} - + - 领取礼包 + 领取礼包 - - {{item.zlHelpNum}}/{{item.helpNum}} - - - 查看礼包 - - - + + {{item.zlHelpNum}}/{{item.helpNum}} + + + 查看礼包 + + + - - - - 点击加载更多 - - - + + + + 点击加载更多 + + + - + @@ -93,11 +91,14 @@ - - + + + + + 暂无活动说明 + - diff --git a/pages/user/assistance/assistance.wxss b/pages/user/assistance/assistance.wxss index 39bf1cd..1e35456 100644 --- a/pages/user/assistance/assistance.wxss +++ b/pages/user/assistance/assistance.wxss @@ -2,6 +2,7 @@ page { background-color: rgb(208, 17, 25); width: 100%; height: 100%; + } .lumi { diff --git a/pages/user/assistance/assistance_success.json b/pages/user/assistance/assistance_success.json index d494c4d..f338325 100644 --- a/pages/user/assistance/assistance_success.json +++ b/pages/user/assistance/assistance_success.json @@ -1,6 +1,5 @@ { "navigationBarTitleText": "好友助力,得好礼", - "navigationStyle": "custom", "usingComponents": { "warn": "/components/long_warn/long_warn", "my_confirm": "/components/my_confirm/my_confirm", diff --git a/pages/user/assistance/friend_assistance.json b/pages/user/assistance/friend_assistance.json index 63f5fe9..b1940cd 100644 --- a/pages/user/assistance/friend_assistance.json +++ b/pages/user/assistance/friend_assistance.json @@ -1,6 +1,5 @@ { "navigationBarTitleText": "好友助力,得好礼", - "navigationStyle": "custom", "usingComponents": { "warn": "/components/long_warn/long_warn", "my_confirm": "/components/my_confirm/my_confirm", diff --git a/pages/user/assistance/friend_assistance.wxml b/pages/user/assistance/friend_assistance.wxml index e96ff62..f9b47ad 100644 --- a/pages/user/assistance/friend_assistance.wxml +++ b/pages/user/assistance/friend_assistance.wxml @@ -1,7 +1,7 @@ - + {{user.nickname}} @@ -9,7 +9,7 @@ - + diff --git a/pages/user/assistance/giftpacklist.js b/pages/user/assistance/giftpacklist.js index a4c09b9..f20ad1e 100644 --- a/pages/user/assistance/giftpacklist.js +++ b/pages/user/assistance/giftpacklist.js @@ -10,7 +10,6 @@ Page({ url: a.url, //接口网址 iurl: a.imghost, //图片前缀网址 isBuy: 0, - getGiftID: '', //礼包id giftImage: '', giftTitle: '', giftDate: '', @@ -29,39 +28,47 @@ Page({ c_state: "0", //判断是否已经使用, 0正常 1已使用 2已过期 is_lb: 0, //是否有礼包 receiveState: 0, //0未领取 1已领取 - completeid: "", is_sub: 0, //判断是否重复提交 is_libao: 0, //0轮播查看活动 1领取礼包 2.查看礼包详情 held_id: "", //活动id taskId: "", //任务id orderSn: "", //订单号 + is_type:"",//类型 0.轮播过来的 1.领取礼包过来的 2.查看礼包过来的 + is_head:0,//数据是否加载完成 + giftBagId:"",//礼包id }, onLoad: function(options) { var th = this; if (options.is_libao == 0) { th.setData({ - held_id: options.help_id, //options.help_id - taskId: options.taskId, //options.libao_id + held_id: options.help_id, + taskId: options.taskId, + is_type:0 }) th.help(); } if (options.is_libao == 1) { th.setData({ - taskId: options.libao_id, - held_id: options.held_id + giftBagId: options.libao_id, + is_type: 1 }) th.GetBuyGiftList(); } if (options.order_sn) { th.setData({ - orderSn: options.orderSn + orderSn: options.orderSn, + is_type: 2 }) th.GetMyGiftList(); } - th.close(); }, onShow: function() { - + var th = this; + var is_read = th.data.is_read; + if (is_read){ + var nav_b = th.selectComponent("#nav_b"); //组件的id + nav_b.set_name("助力", "/pages/user/assistance/assistance"); + } }, //助力活动查看礼包详情调用 help: function(e) { @@ -78,7 +85,8 @@ Page({ if (res.data.code == 0) { th.setData({ giftImage: th.data.iurl + res.data.data.lbUrl, - giftTitle: res.data.data.giftTitle + giftTitle: res.data.data.giftTitle, + is_head:1 }) if (res.data.data.giftRemark == '') { th.setData({ @@ -90,22 +98,7 @@ Page({ }) } - // //---获取日期的时间戳--- - // var t_endtime = res.data.data.endTime; - // t_endtime = t_endtime.replace(/-/g, '/'); - // var t_date = new Date(t_endtime) / 1000; - // var t_now = ut.gettimestamp(); - - // if (res.data.data.goodsUseState) th.setData({ - // c_state: 1 - // }) - // else if (t_date <= t_now) - // th.setData({ - // c_state: 2 - // }) - th.setData({ - giftDate: res.data.data.endTime, giftPosPrice: res.data.data.giftPosPrice, giftQty: res.data.data.giftQty, giftIntegral: res.data.data.payIntegral, @@ -145,7 +138,8 @@ Page({ if (res.data.code == 0) { th.setData({ giftImage: th.data.iurl + res.data.data.lbUrl, - giftTitle: res.data.data.giftTitle + giftTitle: res.data.data.giftTitle, + is_head:1 }) if (res.data.data.giftRemark == '') { th.setData({ @@ -210,9 +204,9 @@ Page({ is_sub: 1 }) var json = { - "actId": th.data.completeid, //活动Id + "actId": th.data.held_id, //活动Id "actType": 5, //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 - "giftBagId": th.data.giftID, //礼包Id + "giftBagId": th.data.giftBagId, //礼包Id "storeId": a.stoid, //商家Id "userId": d.user_id //用户ID }; @@ -234,7 +228,7 @@ Page({ }, function(res) { - }, "post" + } ) @@ -248,13 +242,14 @@ Page({ data: { "storeId": a.stoid, //商家ID "userId": d.user_id, //用户ID - "giftBagId": th.taskId + "giftBagId": th.giftBagId }, success: function(res) { if (res.data.code == 0) { _this2.setData({ giftImage: th.iurl + res.data.data.lbUrl, - giftTitle: res.data.data.giftTitle + giftTitle: res.data.data.giftTitle, + is_head:1 }) if (res.data.data.giftRemark == '') { @@ -267,7 +262,6 @@ Page({ }) } _this2.setData({ - giftDate: res.data.data.endTime, giftPosPrice: res.data.data.giftPosPrice, giftQty: res.data.data.giftQty, giftIntegral: res.data.data.payIntegral, @@ -345,6 +339,5 @@ Page({ var th = this; var nav_b = th.selectComponent("#nav_b"); //组件的id nav_b.close_box(); - nav_b.set_name("礼包", "/pages/giftpack/buygiftpack/giftpackbuy"); } }); \ No newline at end of file diff --git a/pages/user/assistance/giftpacklist.json b/pages/user/assistance/giftpacklist.json index d1b12a8..5eaa23f 100644 --- a/pages/user/assistance/giftpacklist.json +++ b/pages/user/assistance/giftpacklist.json @@ -1,5 +1,5 @@ { - "navigationBarTitleText": "助力详情", + "navigationBarTitleText": "礼包详情", "usingComponents": { "warn": "/components/long_warn/long_warn", "my_confirm": "/components/my_confirm/my_confirm", diff --git a/pages/user/assistance/giftpacklist.wxml b/pages/user/assistance/giftpacklist.wxml index 8cf8d4e..509fad8 100644 --- a/pages/user/assistance/giftpacklist.wxml +++ b/pages/user/assistance/giftpacklist.wxml @@ -1,4 +1,4 @@ - + @@ -6,7 +6,7 @@ {{giftTitle}} - + {{"兑换截至时间:"+giftDate}} @@ -65,27 +65,30 @@ {{"数量:"+item.num}} - - - - + + + + + + + - - - - + + + + - - - - - - - - - 奖励已发放 - - + + + + + + + + 奖励已发放 + + + @@ -99,21 +102,14 @@ - - - - - - 已领取 - - - - - 一键全部领取 - - + + + + + 一键全部领取 + - + 无核销商品 @@ -123,7 +119,7 @@ 立即使用 - + 商品已核销 @@ -131,8 +127,13 @@ - - + + + + 回到首页 + + + @@ -140,4 +141,4 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/pages/user/assistance/giftpacklist.wxss b/pages/user/assistance/giftpacklist.wxss index 5c97c3b..7026432 100644 --- a/pages/user/assistance/giftpacklist.wxss +++ b/pages/user/assistance/giftpacklist.wxss @@ -1,4 +1,4 @@ - @charset "UTF-8"; +@charset "UTF-8"; /* Author XGQ * 2019-12-12 @@ -96,6 +96,7 @@ border: 2rpx solid #999; width: 120rpx; height: 120rpx; + /* background-color: rgba(153, 153, 153, 0.664); */ } .box_ware_item.data-v-3a5b7e36 { @@ -239,6 +240,7 @@ page.data-v-3a5b7e36 { .foot_box_remark.data-v-3a5b7e36 .img { line-height: 0; } -.overdue.data-v-3a5b7e36{ - background-color: rgb(153,153,153); -} \ No newline at end of file + +.overdue.data-v-3a5b7e36 { + background-color: rgb(153, 153, 153); +} diff --git a/pages/user/assistance/task_assistance.js b/pages/user/assistance/task_assistance.js index 7d50b95..222a0b8 100644 --- a/pages/user/assistance/task_assistance.js +++ b/pages/user/assistance/task_assistance.js @@ -32,10 +32,11 @@ Page({ dismantle: null, //帮拆记录数据集 is_user_task: null, //判断是不是领取的任务 zzjx_id: "", //真正进行的任务id - is_show:0,//任务的加载更多 - is_bc_show:0,//帮拆的加载更多 - bc_page:1,//帮拆的页码 - rw_page:1,//任务的页码 + is_show: 0, //任务的加载更多 + is_bc_show: 0, //帮拆的加载更多 + bc_page: 1, //帮拆的页码 + rw_page: 1, //任务的页码 + block: 0, //阻断助力的用户图片多次添加 //*********************************************start钱 canvasHidden: 0, //分享图片是否已经生成 is_share: 0, //是否显示画布 @@ -46,7 +47,12 @@ Page({ "miniapp/images/friendhelp/check.png", "miniapp/images/friendhelp/unfinished.png", "/public/upload/libao/temp/2019/12-20/51f251f44ea0f67b8efdc5bfa3a434b0.jpg" ], //固的分享图片 - dynamic: [], //已助力的微信头像数组 + + dynamic: null, //已助力的微信头像数组 + head_pic_arr: [], //助力的头像 + share_lb_img: "", //分享的礼包图片 + + is_generate: 0, //是否重复点击拆一拆 already: 0, //已有几人助力 lack: 0, //还差几人助力 @@ -59,8 +65,10 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function(options) { - var help_id = options.help_id; var th = this; + var help_id = options.help_id; + var nav_b = th.selectComponent("#nav_b"); //组件的id + nav_b.set_name("助力", "/pages/user/assistance/assistance"); th.setData({ help_id: help_id }); @@ -73,7 +81,7 @@ Page({ th.close(); th.syinfo(); th.imageinfo(); - //end + }, @@ -93,7 +101,7 @@ Page({ function(res) { if (res.data.code == 0) { getApp().my_warnning(res.data.data, 1, th); - //判断是不是领取的任务 + //判断是不是领取的任务 th.get_user_task(); //会员任务列表 th.user_task_list(); @@ -139,11 +147,11 @@ Page({ //任务时间 设置全局定时器 th.setData({ - timer:setInterval(function () { + timer: setInterval(function() { th.countDown(); }, 1000) }) - + } } @@ -179,7 +187,6 @@ Page({ }); var task_number = data_aissa[0].giftQty - data_aissa[0].useGiftQty; var taskid = data_aissa[0].id; - console.log("参考", data_aissa); th.setData({ aitem: data_aissa, task_number: task_number, @@ -200,16 +207,12 @@ Page({ //会员任务列表 this.user_task_list(); - //获取助力活动参与的人数 + //获取助力活动参与的人数 this.get_user_task_num(); }, - - - - //帮拆记录的 dismantle_record: function(e) { var aitem = this.data.aitem; //任务的数据集 @@ -242,15 +245,16 @@ Page({ success: function(res) { if (res.data.code == 0) { var dismantle = res.data.data.pageData[0].zlHelpUser; - if(res.data.data.total>5){ + if (res.data.data.total > 5) { var bc_page = th.data.bc_page + 1; - th.data({ bc_page: bc_page, - is_bc_show:1 + th.data({ + bc_page: bc_page, + is_bc_show: 1 }) - }else{ - getApp().showWarning("暂无更多内容", 0); + } else { + getApp().showWarning("暂无更多内容", 0, th); } - + th.setData({ dismantle: dismantle }); @@ -265,15 +269,13 @@ Page({ }, // 领取礼包 get_libao: function(e) { - var libao_id = e.currentTarget.dataset.libaoid; - var completeid = e.currentTarget.dataset.completeid; - console.log("礼包id", libao_id); - getApp().goto("/pages/user/assistance/giftpacklist?libao_id=" + libao_id + "&is_libao=" + 1 + "&completeid=" + completeid); + var libao_id = e.currentTarget.dataset.libaoid; //礼包id + getApp().goto("/pages/user/assistance/giftpacklist?libao_id=" + libao_id + "&is_libao=" + 1); }, //查看礼包id - select_libao: function() { - var libao_id = e.currentTarget.dataset.libaoid; - getApp().goto("/pages/user/assistance/giftpacklist?libao_id=" + libao_id + "&is_libao=" + 0); + select_libao: function(e) { + var orderSn = e.currentTarget.dataset.orderSn; + getApp().goto("/pages/user/assistance/giftpacklist?orderSn=" + orderSn); }, //划动的时候监听 @@ -283,8 +285,6 @@ Page({ var aitem = this.data.aitem; var task_number = aitem[ind].giftQty - aitem[ind].useGiftQty; var task_id = aitem[ind].id; - console.log("划动的任务总数", task_number, "任务所有的参数", aitem, - "任务id", task_id); th.setData({ sw_index: ind, task_number: task_number, @@ -304,7 +304,6 @@ Page({ var th = this; var nav_b = th.selectComponent("#nav_b"); //组件的id nav_b.close_box(); - nav_b.set_name("助力", "/pages/user/assistance/assistance"); }, // 获取会员的参与的任务列表 我的任务 user_task_list: function(e) { @@ -324,30 +323,27 @@ Page({ }); var help_id = th.data.help_id; var user_id = getApp().globalData.user_id; - var rw_page=th.data.rw_page; + var rw_page = th.data.rw_page; rq.get("/api/weshop/marketing/help/help/user/page", { data: { - page:rw_page, - pageSize:5, + page: rw_page, + pageSize: 5, helpId: help_id, storeId: os.stoid, userId: user_id }, success: function(su) { if (su.data.code == 0) { - if (su.data.data.total > 5){ + if (su.data.data.total > 5) { + var rw_page = th.data.rw_page + 1; th.setData({ rw_page: rw_page, is_show: 1 }) + getApp().my_warnning(); getApp().showWarning("暂无更多内容", 0); - }else{ - var rw_page = th.data.rw_page + 1; - th.setData({ - rw_page: rw_page, - - }) } + var user_list = su.data.data.pageData; th.setData({ user_task_list: user_list @@ -389,7 +385,6 @@ Page({ storeId: os.stoid, }, success: function(su) { - console.log(su.data.code, "获取助力活动参与的人数", su.data) if (su.data.code == 0) { var usercount = su.data.data.countAll; @@ -413,7 +408,6 @@ Page({ swiperError: swiperError }) if (swiperError >= 3) { //在开关被触发3次以上 - console.error(this.data.swiperError) this.setData({ sw_index: this.data.preIndex }); //,重置current为正确索引 @@ -504,7 +498,6 @@ Page({ // var o = endTimeList[i]; var endTime = th.data.endDate; - console.log("结束时间5555555", endTime); // if (o.status == 0) endTime = o.start_time var obj = null; @@ -531,7 +524,7 @@ Page({ sec: '00' } } - var txt = "aitem[" +0+ "].djs"; + var txt = "aitem[" + 0 + "].djs"; th.setData({ [txt]: obj }); @@ -582,238 +575,165 @@ Page({ } }) }, - //钱 分享图 - imageinfo: function() { - var th = this; - var images = th.data.images; - var iurl = th.data.iurl; - wx.getImageInfo({ - src: iurl + images[0], - success: function(res) { - console.log(res + i); - //res.path是网络图片的本地地址 - images[0] = res.path; - }, - fail: function(res) { - console.log(res.toString() + "" + i); - } - }); - wx.getImageInfo({ - src: iurl + images[1], - success: function(res) { - console.log(res + i); - //res.path是网络图片的本地地址 - images[1] = res.path; - }, - fail: function(res) { - console.log(res.toString() + "" + i); - } - }); - wx.getImageInfo({ - src: iurl + images[2], - success: function(res) { - console.log(res + i); - //res.path是网络图片的本地地址 - images[2] = res.path; - }, - fail: function(res) { - console.log(res.toString() + "" + i); - } - }); - wx.getImageInfo({ - src: iurl + images[3], - success: function(res) { - console.log(res + i); - //res.path是网络图片的本地地址 - images[3] = res.path; - }, - fail: function(res) { - console.log(res.toString() + "" + i); - } - }); - wx.getImageInfo({ - src: iurl + images[4], - success: function(res) { - console.log(res + i); - //res.path是网络图片的本地地址 - images[4] = res.path; - }, - fail: function(res) { - console.log(res.toString() + "" + i); - } - }); - wx.getImageInfo({ - src: iurl + images[5], - success: function(res) { - console.log(res + i); - //res.path是网络图片的本地地址 - images[5] = res.path; - }, - fail: function(res) { - console.log(res.toString() + "" + i); - } - }); - wx.getImageInfo({ - src: iurl + images[6], - success: function(res) { - console.log(res + i); - //res.path是网络图片的本地地址 - images[6] = res.path; - }, - fail: function(res) { - console.log(res.toString() + "" + i); - } - }); - wx.getImageInfo({ - src: iurl + images[7], - success: function(res) { - console.log(res + i); - //res.path是网络图片的本地地址 - images[7] = res.path; - }, - fail: function(res) { - console.log(res.toString() + "" + i); - } - }) - th.setData({ - images: images - }) - - }, - //生成分享图,用于分享给好友帮拆 - demolition: function() { - var th = this; - }, //************************ */ shareFrends: function(e) { var th = this; - var is_generate = th.data.is_generate; //是否重复提交拆一拆 - if (is_generate == 0) { - th.setData({ - is_generate: 1 - }) - var scene = th.data.gid; - ///二微码 - // var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + - // a.stoid + "?sceneValue=" + scene + "&pageValue=pages/goods/goodsInfo/goodsInfo"; - var iurl = th.data.iurl; //图片地址前缀 - const ctx = wx.createCanvasContext('share_id'); //绘图上下文 - var unit = th.data.screenWidth / 750 * 1.35; - var numsize = 20 * unit; //几人助力字体大小 - var size = 15 * unit; - var num = th.data.already; //已有几位好友助力 - var q_num = th.data.lack; //还差几位好友助力 - var already = num.toString().length + 1; //已有几位好友助力 - var lack = q_num.toString().length + 1; //还差几位好友助力 - var imagesize = 40 * unit; //助力人的图片大小 - var left = 74 * unit; //助力人头像跟左边的距离 - var spacing = 12 * unit; //助力人图片间距 - var images = th.data.images; - ctx.drawImage(images[0], 0, 0, 445 * unit, 700 * unit); //分享的背景图片 - ctx.drawImage(images[1], 37 * unit, 185 * unit, 370 * unit, 377 * unit); //分享的背景图片 - ctx.drawImage(images[5], 90 * unit, 231 * unit, 266 * unit, 160 * unit); //分享的背景图片 - ctx.setFillStyle("rgb(221,153,116)"); - ctx.setFontSize(size) - ctx.fillText("已有", 77 * unit, 430 * unit); - ctx.setFillStyle("#FF4746"); - ctx.setFontSize(numsize) - ctx.fillText(num + "位", 108 * unit, 430 * unit); - ctx.setFillStyle("rgb(221,153,116)"); - ctx.setFontSize(size) - ctx.fillText("好友助力,还差", 116 * unit + already * numsize * unit, 430 * unit); - ctx.setFillStyle("#FF4746"); - ctx.setFontSize(numsize); - ctx.fillText(q_num + "位", 223 * unit + already * numsize * unit, 430 * unit); - ctx.setFillStyle("rgb(221,153,116)"); - ctx.setFontSize(size); - ctx.fillText("达成助力", 230 * unit + lack * numsize * unit + already * numsize * unit, 430 * unit); - var c = q_num / num; - ctx.drawImage(images[2], 65 * unit, 445 * unit, 320 * unit, 12 * unit); - ctx.drawImage(images[3], 65 * unit, 445 * unit, 320 * unit * c, 12 * unit); - // var dynamic = th.data.dynamic; //助力的微信头像 - // console.log(dynamic[0].headPic + "动态图片显示"); - for (var i = 0; i < 6; i++) { - if (i < 0) { - // ctx.beginPath(); - // ctx.arc(left + imagesize / 2, 505 * unit, imagesize / 2, 0, 2 * Math.PI); - // ctx.setLineWidth(1); - // ctx.setStrokeStyle('red'); - ctx.save(); - ctx.beginPath(); //开始绘制 - ctx.arc(left + imagesize / 2, 505 * unit, imagesize / 2, 0, 2 * Math.PI); - ctx.setLineWidth(4 * unit); - ctx.setStrokeStyle('red'); - ctx.setFillStyle("white"); - ctx.fill(); - ctx.clip(); - ctx.drawImage(dynamic[i].headPic, left, 505 * unit - imagesize / 2, imagesize, imagesize); - ctx.restore(); //恢复之前保存的绘图上下文 恢复之前保存的绘图上下午即状态 还可以继续绘制 - } else { - // 助力人的头像 - ctx.drawImage(images[4], left, 505 * unit - imagesize / 2, imagesize, imagesize); //分享的背景图片 + if (th.data.is_generate) return; + th.data.is_generate = 1; + + var scene = 1; + ///二微码 + var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + + os.stoid + "?sceneValue=" + scene + "&pageValue=pages/index/index/index"; + //读取文件成功则OK-- + wx.getImageInfo({ + src: path3, + success: function(res) { + var ewm_path = res.path; // + //var act_time="2019.06.26 - 2019.07.02"; //活动的时间 + var bg_time = ut.formar_no_full(th.data.dynamic.beginDate); + var end_time = ut.formar_no_full(th.data.dynamic.endDate); + var act_time = bg_time + "-" + end_time; + + + var iurl = th.data.iurl; //图片地址前缀 + const ctx = wx.createCanvasContext('share_id'); //绘图上下文 + var unit = th.data.screenWidth / 750 * 1.35; + var numsize = 20 * unit; //几人助力字体大小 + var head_list_img = th.data.head_pic_arr; + var num = th.data.head_pic_arr.length; //已有几位好友助力 + + var aitem = th.data.aitem; //任务的数据集 + var sw_index = th.data.sw_index; //轮播的下标 + //任务id + var help_num = aitem[sw_index].helpNum; + var q_num = help_num - num; //还差几位好友助力 + var already = num.toString().length + 1; //已有几位好友助力 + var lack = q_num.toString().length + 1; //还差几位好友助力 + + var size = 15 * unit; + var imagesize = 40 * unit; //助力人的图片大小 + var left = 74 * unit; //助力人头像跟左边的距离 + var spacing = 12 * unit; //助力人图片间距 + var images = th.data.images; + ctx.drawImage(images[0], 0, 0, 445 * unit, 700 * unit); //分享的背景图片 + ctx.drawImage(images[1], 37 * unit, 185 * unit, 370 * unit, 377 * unit); //分享的背景图片 + + + ctx.drawImage(th.data.share_lb_img, 90 * unit, 231 * unit, 266 * unit, 160 * unit); //分享的礼包的背景图片 + + ctx.setFillStyle("rgb(221,153,116)"); + ctx.setFontSize(size) + ctx.fillText("已有", 77 * unit, 430 * unit); + ctx.setFillStyle("#FF4746"); + ctx.setFontSize(numsize) + ctx.fillText(num + "位", 108 * unit, 430 * unit); + ctx.setFillStyle("rgb(221,153,116)"); + ctx.setFontSize(size) + ctx.fillText("好友助力,还差", 116 * unit + already * numsize * unit, 430 * unit); + ctx.setFillStyle("#FF4746"); + ctx.setFontSize(numsize); + ctx.fillText(q_num + "位", 223 * unit + already * numsize * unit, 430 * unit); + ctx.setFillStyle("rgb(221,153,116)"); + ctx.setFontSize(size); + ctx.fillText("达成助力", 230 * unit + lack * numsize * unit + already * numsize * unit, 430 * unit); + var c = num / help_num; + ctx.drawImage(images[2], 65 * unit, 445 * unit, 320 * unit, 12 * unit); + ctx.drawImage(images[3], 65 * unit, 445 * unit, 320 * unit * c, 12 * unit); + var head_list_num = 30; + var is_head_list = 0; + if (help_num < 8) { + // 判断已助力的人数 + + for (var a = 0; a < head_list_img.length; a++) { + ctx.save(); + ctx.beginPath(); //开始绘制 + ctx.arc(left + imagesize / 2, 505 * unit, imagesize / 2, 0, 2 * Math.PI); + ctx.setLineWidth(4 * unit); + ctx.setStrokeStyle('red'); + ctx.setFillStyle("white"); + ctx.fill(); + ctx.clip(); + ctx.drawImage(head_list_img[a], left , 505 * unit - imagesize / 2, imagesize, imagesize); + ctx.restore(); + left += imagesize + spacing; + } + //这个是还未助力的位置 + for (var i = 0; i < q_num; i++) { + // 助力人的头像 + ctx.drawImage(images[4], left , 505 * unit - imagesize / 2, imagesize, imagesize); //分享的背景图片 + left += imagesize + spacing; + } } - left += imagesize + spacing; - } - ctx.setFillStyle("rgb(255,255,255)"); - ctx.setFontSize(size); - ctx.fillText("优惠乐翻天,精彩就在你身边!", 37 * unit, 595 * unit); - ctx.setFillStyle("rgb(255,255,255)"); - ctx.setFontSize(size); - ctx.fillText("2019.06.26 - 2019.07.02!", 37 * unit, 620 * unit); - ctx.setFillStyle("rgb(255,255,255)"); - ctx.setFontSize(size); - ctx.fillText("长按识别二维码,可帮我助力!", 37 * unit, 660 * unit); - ctx.drawImage(images[5], 325 * unit, 585 * unit, 77 * unit, 77 * unit); //分享的背景图片 - ctx.save(); - //读取文件成功则OK-- - // wx.getImageInfo({ - // src: path3, - // success: function (res) { - //把画板内容绘制成图片,并回调 画板图片路径 - ctx.draw(false, function() { - setTimeout(function() { - wx.canvasToTempFilePath({ - x: 0, - y: 0, - width: 300, - height: 500, - destWidth: 400 * 2, - destHeight: 720 * 2, - canvasId: 'share_id', - success: function(res) { - wx.hideLoading(); - var shareImgPath = th.data.shareImgPath; - shareImgPath[0] = res.tempFilePath; - - th.setData({ - shareImgPath: shareImgPath, - canvasHidden: 1, - is_share: 1, - is_generate: 0, - canvasHidden: 1 - }) - if (!res.tempFilePath) { - wx.showModal({ - title: '提示', - content: '图片绘制中,请稍后重试', - showCancel: false + + + + ctx.setFillStyle("rgb(255,255,255)"); + ctx.setFontSize(size); + ctx.fillText("优惠乐翻天,精彩就在你身边!", 37 * unit, 595 * unit); + ctx.setFillStyle("rgb(255,255,255)"); + ctx.setFontSize(size); + + ctx.fillText(act_time, 37 * unit, 620 * unit); //绘制活动是时间 + ctx.setFillStyle("rgb(255,255,255)"); + ctx.setFontSize(size); + ctx.fillText("长按识别二维码,可帮我助力!", 37 * unit, 660 * unit); + ctx.drawImage(ewm_path, 325 * unit, 585 * unit, 77 * unit, 77 * unit); //分享的背景图片 + ctx.save(); + //读取文件成功则OK-- + // wx.getImageInfo({ + // src: path3, + // success: function (res) { + //把画板内容绘制成图片,并回调 画板图片路径 + ctx.draw(false, function() { + setTimeout(function() { + wx.canvasToTempFilePath({ + x: 0, + y: 0, + width: 300, + height: 500, + destWidth: 400 * 2, + destHeight: 720 * 2, + canvasId: 'share_id', + success: function(res) { + wx.hideLoading(); + var shareImgPath = th.data.shareImgPath; + shareImgPath[0] = res.tempFilePath; + + th.setData({ + shareImgPath: shareImgPath, + canvasHidden: 1, + is_share: 1, + is_generate: 0, + canvasHidden: 1 }) - return false; + if (!res.tempFilePath) { + wx.showModal({ + title: '提示', + content: '图片绘制中,请稍后重试', + showCancel: false + }) + return false; + } + + }, + fail(r) { + } + }, 500) + }) + }) + } + }) - }, - fail(r) { - } - }, 500) - }) - }) - } }, + + preview: function() { var th = this; var shareImgPath = th.data.shareImgPath; @@ -845,86 +765,31 @@ Page({ } }) }, + //把固定的图片加载到本地 - imageinfo: function() { + imageinfo: async function() { var th = this; var images = th.data.images; var iurl = th.data.iurl; - wx.getImageInfo({ - src: iurl + images[0], - success: function(res) { - //res.path是网络图片的本地地址 - images[0] = res.path; - }, - fail: function(res) { - - } - }); - wx.getImageInfo({ - src: iurl + images[1], - success: function(res) { - //res.path是网络图片的本地地址 - images[1] = res.path; - }, - fail: function(res) { - - } - }); - wx.getImageInfo({ - src: iurl + images[2], - success: function(res) { - //res.path是网络图片的本地地址 - images[2] = res.path; - }, - fail: function(res) { - - } - }); - wx.getImageInfo({ - src: iurl + images[3], - success: function(res) { - - //res.path是网络图片的本地地址 - images[3] = res.path; - }, - fail: function(res) { - - } - }); - wx.getImageInfo({ - src: iurl + images[4], - success: function(res) { - - //res.path是网络图片的本地地址 - images[4] = res.path; - }, - fail: function(res) { - - } - }); - wx.getImageInfo({ - src: iurl + images[5], - success: function(res) { + for (var i in images) { + var img_path = iurl + images[i]; + await getApp().request.promise_downimg(img_path).then(res => { + images[i] = res; + }) + } - //res.path是网络图片的本地地址 - images[5] = res.path; - }, - fail: function(res) { + th.data.images = images; + }, - } - }); - th.setData({ - images: images - }) - }, //好友猜一猜 save_share: function(e) { var th = this; var aitem = this.data.aitem; //任务的数据集 var sw_index = this.data.sw_index; //轮播的下标 + var sw_item = aitem[sw_index]; //任务id - var taskid = aitem[sw_index].id + var taskid = sw_item.id; th.setData({ is_share: 1 }) @@ -940,14 +805,14 @@ Page({ if (res.data.code == 0) { var data = res.data.data.pageData; //帮拆数组 if (data.length > 0) { - // th.setData({ - // dynamic: data - // }) - // th.info_head(function() { - th.shareFrends(); - // }); - //th.imageinfo(); - + th.data.dynamic = data[0]; + var path = th.data.iurl + sw_item.giftBagUrl; + //先获取礼包分享时的本地路径 + getApp().request.promise_downimg(path).then(res => { + th.data.share_lb_img = res; + //先获取会员的头像 + th.info_head(th.shareFrends); + }); } } else { wx.hideLoading(); @@ -955,93 +820,33 @@ Page({ } }) }, + //把已助力好友头像下载到本地 - info_head: function(e) { + info_head: async function(func) { var th = this; - var images = th.data.dynamic; - if (images[0] != null && images[0] != "" && images[0] != undefined) { - console.log(images[0].headPic + "就将计就计"); - wx.getImageInfo({ - src: images[0].headPic, - success: function(res) { - //res.path是网络图片的本地地址 - images[0].headPic = res.path; - }, - fail: function(res) { - - } - }); - } - if (images[1] != null && images[1] != "" && images[1] != undefined) { - wx.getImageInfo({ - src: images[1].headPic, - success: function(res) { - //res.path是网络图片的本地地址 - images[1].headPic = res.path; - }, - fail: function(res) { - - } - }); + var images = th.data.dynamic.zlHelpUser; + console.log(images,"图片长度", images.length); + var arr = new Array(); + var block = th.data.block; + if (images) { + th.data.head_pic_arr.length = 0; + for (var i in images) { + var img_path = images[i].headPic; + await getApp().request.promise_downimg(img_path).then(res => { + th.data.head_pic_arr.push(res); + }) + } } - if (images[2] != null && images[2] != "" && images[2] != undefined) { - wx.getImageInfo({ - src: images[2].headPic, - success: function(res) { - //res.path是网络图片的本地地址 - images[2].headPic = res.path; - }, - fail: function(res) { + func(); + }, - } - }); - } - if (images[3] != null && images[3] != "" && images[3] != undefined) { - wx.getImageInfo({ - src: images[3].headPic, - success: function(res) { - //res.path是网络图片的本地地址 - images[3].headPic = res.path; - }, - fail: function(res) { - } - }); - } - // if (images[4] != null && images[4] != "" && images[4] != undefined) { - // wx.getImageInfo({ - // src: images[4].headPic, - // success: function(res) { - // //res.path是网络图片的本地地址 - // images[4].headPic = res.path; - // }, - // fail: function(res) { - - // } - // }); - // } - // if (images[5] != null && images[5] != "" && images[5] != undefined) { - // wx.getImageInfo({ - // src: images[5].headPic, - // success: function (res) { - // //res.path是网络图片的本地地址 - // images[5].headPic = res.path; - // }, - // fail: function (res) { - - // } - // }); - //} - th.setData({ - dynamic: images - }) - }, //礼包的详情 轮播图 libao_details: function(e) { var th = this; - var help_id = th.data.help_id;//活动id - var taskId = th.data.taskid;//任务id + var help_id = th.data.help_id; //活动id + var taskId = th.data.taskid; //任务id getApp().goto("/pages/user/assistance/giftpacklist?help_id=" + help_id + "&is_libao=" + 0 + "&taskId=" + taskId); }, //正在进行任务 diff --git a/pages/user/assistance/task_assistance.json b/pages/user/assistance/task_assistance.json index 63f5fe9..b1940cd 100644 --- a/pages/user/assistance/task_assistance.json +++ b/pages/user/assistance/task_assistance.json @@ -1,6 +1,5 @@ { "navigationBarTitleText": "好友助力,得好礼", - "navigationStyle": "custom", "usingComponents": { "warn": "/components/long_warn/long_warn", "my_confirm": "/components/my_confirm/my_confirm", diff --git a/pages/user/assistance/task_assistance.wxml b/pages/user/assistance/task_assistance.wxml index 22495c6..afa13fa 100644 --- a/pages/user/assistance/task_assistance.wxml +++ b/pages/user/assistance/task_assistance.wxml @@ -1,13 +1,19 @@ - - + + - - {{aitem[sw_index].helpTaskName}} + + + {{aitem[sw_index].helpTaskName}} + - 活动剩余时间: {{aitem[0].djs.day}}:{{aitem[0].djs.hou}}:{{aitem[0].djs.min}}:{{aitem[0].djs.sec}} - + 活动剩余时间: + {{aitem[0].djs.day}}: + {{aitem[0].djs.hou}}: + {{aitem[0].djs.min}}: + {{aitem[0].djs.sec}} + @@ -16,10 +22,10 @@ - + - 礼包详情 - + 礼包详情 + @@ -28,31 +34,31 @@ - - - - + + + + + + {{is_user_task.zlHelpNum}}/{{is_user_task.helpNum}} - {{is_user_task.zlHelpNum}}/{{is_user_task.helpNum}} - 今天剩余可领{{task_number}}个任务 - + 就选它了 - - 好友拆一拆 + + 好友拆一拆 - + - + @@ -67,66 +73,65 @@ - + - - + + {{item.helpTaskName}} - {{item.zlHelpNum}}/{{item.helpNum}} - 查看礼包 - 领取礼包 + {{item.zlHelpNum}}/{{item.helpNum}} + 查看礼包 + 领取礼包 - - 暂无任务记录 - - + + 暂无任务记录 + + - + - + - + - - - - - {{item.nickName}} - - {{filter.format_time(item.zltime)}} + + + + + {{item.nickName}} + + {{filter.format_time(item.zltime)}} + - - - - 点击加载更多 - - - - - - - 暂无任务记录 + + + 点击加载更多 + + + + + + + 暂无任务记录 + + - - - + @@ -136,7 +141,7 @@ 点击加载更多 - + 已有 {{usercount}} 人领取了任务 @@ -145,14 +150,14 @@ - + - + diff --git a/pages/user/assistance/task_assistance.wxss b/pages/user/assistance/task_assistance.wxss index 30aeed1..4b265e8 100644 --- a/pages/user/assistance/task_assistance.wxss +++ b/pages/user/assistance/task_assistance.wxss @@ -1,52 +1,58 @@ -page{ +page { background: #d01119; width: 100%; - height: 100% + height: 100%; } -.top-back{ + + +.top-back { width: 100%; height: 60%; - background-repead:no-repead; - background-size:100% 100%; - + background-repead: no-repead; + background-size: 100% 100%; } -.top-frame{ + +.top-frame { width: 100%; height: auto; - padding-top: 50rpx -} -.top-title{ - letter-spacing:10rpx + padding-top: 50rpx; } -.activity-data{ - padding-top: 10rpx; + +.top-title { letter-spacing: 10rpx; + width: 300rpx; +} +.activity-data { + padding-top: 10rpx; + letter-spacing: 2rpx; } -.xc-specific-more-frame{ + +.xc-specific-more-frame { width: 100%; height: 40%; - margin-top: 20rpx; } -.task-number{ - margin-top: 50rpx + +.task-number { + margin-top: 50rpx; } -.task_clike{ + +.task_clike { margin: auto; width: 60%; height: 65rpx; border-radius: 50rpx; margin-top: 20rpx; background: #fbda0e; - color:#d01119; + color: #d01119; line-height: 65rpx; letter-spacing: 5rpx; - box-shadow: 0rpx 7rpx 0rpx 0rpx rgb(245, 119, 6); + box-shadow: 0rpx 7rpx 0rpx 0rpx rgb(245, 119, 6); } -/* 底部列表样式 */ +/* 底部列表样式 */ .head { border-bottom: 4rpx solid rgb(253, 193, 7); @@ -73,7 +79,7 @@ page{ } .unfinished { - width:35rpx; + width: 35rpx; height: 35rpx; margin-right: 10rpx; } @@ -110,27 +116,31 @@ page{ .receive { padding-bottom: 50rpx; } -.xc-center-img{ + +.xc-center-img { width: 100%; - height: 100% + height: 100%; } -.xc-left{ +.xc-left { width: 40rpx; height: 40rpx; } -.bcolor { -border-color: #fff; +.bcolor { + border-color: #fff; } -.xc-right{ + +.xc-right { width: 40rpx; height: 40rpx; } -.user_img{ + +.user_img { width: 50rpx; - height: 50rpx; + height: 50rpx; } + .dust { position: fixed; width: 100%; @@ -140,69 +150,74 @@ border-color: #fff; } .closes { - margin-top: 20rpx; + margin-top: 20rpx; } .canvas { position: fixed; z-index: 11; width: 100%; - top:20rpx; + top: 20rpx; } .close { width: 70rpx; height: 70rpx; } -.plan-frame{ - width: 86%; - margin: auto; + +.plan-frame { + width: 86%; + margin: auto; margin-top: 50rpx; - } -.plan-frame .plan_num{ - width: 90%; - background: #ffe7ab; - border-radius: 20rpx; - height: 22rpx; + +.plan-frame .plan_num { + width: 90%; + background: #ffe7ab; + border-radius: 20rpx; + height: 22rpx; margin-right: 10rpx; } -.is_plam{ - border-radius: 20rpx; + +.is_plam { + border-radius: 20rpx; background: #fcc001; - height: 100%; - top: 0rpx; - left: 0rpx; + height: 100%; + top: 0rpx; + left: 0rpx; } + .dust { position: fixed; width: 100%; height: 100%; - background-color: red; + background-color: #d01119; z-index: 10; } .closes { - margin-top: 20rpx; + margin-top: 20rpx; } .canvas { position: fixed; z-index: 20; width: 100%; - top:20rpx; + top: 20rpx; } .close { width: 70rpx; height: 70rpx; } -.select_details{ + +.select_details { width: 100%; height: 50rpx; line-height: 50rpx; text-align: center; - background: #000; - opacity:0.6; filter: alpha(opacity=60); + background: #000; + opacity: 0.6; + filter: alpha(opacity=60); bottom: 0rpx; -} \ No newline at end of file +} diff --git a/pages/user/coupons/coupons.js b/pages/user/coupons/coupons.js index cc3b4f7..b4a1052 100644 --- a/pages/user/coupons/coupons.js +++ b/pages/user/coupons/coupons.js @@ -26,7 +26,9 @@ Page({ * 页面的初始数据 */ data: { - sheng:3, + sheng:1, //是否有更多 + overdue_sheng:1, //是否有更多 + details: [], //可使用的数据 sum: 0, //全部票 val: 0, //可使用票 @@ -49,14 +51,20 @@ Page({ udata: null, iurl:os.imghost, is_show_dhwz:0, + + b_can_arr:null, //包邮券的未使用内容 + b_out_arr:null, //包邮券的已过期的内容 + b_isuse_arr:null,//包邮券的已使用的内容 + + isloading:0, //正在加载中的代码 }, // 点击选中二维码 click: function(e) { var val = e.currentTarget.dataset.cashrepno; getApp().globalData.val =val; - wx.navigateTo({ - url: 'qr_code/qr_code', - }) + wx.navigateTo({ + url: 'qr_code/qr_code', + }) }, // 点击返回主页 @@ -136,134 +144,158 @@ Page({ var json_d = JSON.parse(ee.switch_list); th.setData({ is_show_dhwz: json_d.dhwz_switch }); }) + }, onShow: function() { - // this.setData({ - // details: [], - - // }); - this.myyhj(); - + var th=this; + wx.setNavigationBarTitle({ title: "我的优惠券", }) + //--先判断会员状态-- 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/getphone/getphone', }) return false; } - wx.setNavigationBarTitle({ - title: "我的优惠券", - }) + this.init(th.myyhj); + }, + + //----------券的界面初始化----------- + init:function(func){ + var user_id = getApp().globalData.user_id; + var store_id = os.stoid; + var th=this; + rq.get("/api/weshop/users/getinfo/" + os.stoid + "/" + user_id, { + isShowLoading: 0, + success: function (su) { + + var data = su.data.data; + data.cashcount = parseInt(data.CashCount); + getApp().globalData.Integral = data.Integral; + + getApp().request.promiseGet("/api/weshop/userfeemail/pageAndArea",{data:{user_id: user_id, store_id: os.stoid, pageSize:200}}).then(res=>{ + if(res.data.code==0 && res.data.data && res.data.data.total>0 ){ + var b_arr=res.data.data.pageData; + var b_can_arr=[]; //未使用 + var b_out_arr=[]; //已过期 + var b_isuse_arr=[]; //已过期 + for(var i in b_arr){ + b_arr[i].isby=1; + if(b_arr[i].isuse==0){ + if(b_arr[i].use_end_time { - var a = res.data; - val = a.data.total; - - var details = a.data.pageData; - - if (details.length == 0) { - - this.setData({sheng:0}); - getApp().showWarning("未找更多数据"); - return false; - } - - details.forEach(function (val, ind) { - - big_arr.push(val); - }) - - this.setData({ - details: big_arr, - }); - setTimeout(function () { - - for (var i = 0; i < details.length; i++) { - var no = i + len; - qrcode('qrcode' + no, details[i].CashRepNo, 460, 460); - } - wx.hideLoading(); - }, 1000) - - }) - this.setData({ - val: val - }); - } - var get_data = { - user_id: user_id, - store_id: store_id, - IsUse:2, - pageSize: 1, - page: e.data.current_page - }; + var get_data = { + user_id: user_id, + store_id: store_id, + IsUse: 0, + pageSize: 10, + page: e.data.current_page + }; + var big_arr = this.data.details; + //可用券加入包邮券 + if(big_arr.length==0 && this.data.b_can_arr){ + big_arr=this.data.b_can_arr; + } + init_num=this.data.b_can_arr.length; + + wx.showLoading(); th.data.isloading=1; + getApp().request.promiseGet("/api/weshop/users/listQuan", { + data: get_data, + }).then(res => { + th.data.isloading=0; + + var a = res.data; + val = a.data.total; + var details = a.data.pageData; + + //没有找到优惠券的时候 + if (details.length == 0 && th.data.current_page==1) { + this.setData({sheng:0}); + getApp().showWarning("未找更多数据"); + if(big_arr.length>0) { + th.setData({ details: big_arr, }); + th.setData({ val: init_num}); + setTimeout(function(){ + details=big_arr; + for (var i = 0; i < details.length; i++) { + var no = i + len; + qrcode('qrcode' + no, details[i].CashRepNo?details[i].CashRepNo:details[i].no, 460, 460); + } + },1000) + } + return false; + } + + th.setData({ val: val+init_num }); + + //数组合并 + big_arr=big_arr.concat(details); + //设置数组 + th.setData({ details: big_arr, }); + + //延迟显示二维码的内容 + setTimeout(function () { + if(th.data.current_page==1) details=big_arr; + for (var i = 0; i < details.length; i++) { + var no = i + len; + qrcode('qrcode' + no, details[i].CashRepNo?details[i].CashRepNo:details[i].no, 460, 460); + } + wx.hideLoading(); + }, 1200) + + }) + - var big_arrs = this.data.details; - await getApp().request.promiseGet("/api/weshop/users/listQuan" - , { - data: get_data, - }).then(res => { - var a = res.data; - number= a.data.total; - - var details = a.data.pageData; - - - }) - this.setData({ - number: number - }); - - + }, - async overdue(){ + + overdue:function(){ + if(this.data.isloading) return; var len = this.data.details.length; this.data.current_page++; - var e = this, - sum, val, number; + var e = this,sum, val, number; var user_id = getApp().globalData.user_id; - var store_id = os.stoid; + var store_id = os.stoid,init_num=0,th=this; var get_data = { user_id: user_id, @@ -273,57 +305,74 @@ Page({ page: e.data.current_page }; var big_arr= this.data.details; - wx.showLoading(); - await getApp().request.promiseGet("/api/weshop/users/listQuan" + //可用券加入包邮券 + if(big_arr.length==0 && this.data.b_out_arr){ + big_arr=this.data.b_can_arr; + } + init_num=this.data.b_out_arr.length; + + + wx.showLoading();th.data.isloading=1; + getApp().request.promiseGet("/api/weshop/users/listQuan" , { data: get_data, }).then(res => { + + th.data.isloading=0; var a = res.data; - number = a.data.total; - + number = a.data.total; var details = a.data.pageData; - if (details.length == 0) { - //this.data.is_no_more = 1; + this.setData({overdue_sheng:0}); getApp().showWarning("未找更多数据"); + if( big_arr.length>0 && th.data.current_page==1) { + th.setData({ details: big_arr, }); + th.setData({ number: init_num}); + setTimeout(function(){ + details=big_arr; + for (var i = 0; i < details.length; i++) { + var no = i + len; + qrcode('qrcode' + no, details[i].CashRepNo?details[i].CashRepNo:details[i].no, 460, 460); + } + },1000) + + } return false; } - details.forEach(function (val, ind) { - - big_arr.push(val); - }) - - + big_arr=big_arr.concat(details); + this.setData({ - details: big_arr, + details: big_arr, number:number+init_num, }); + + + setTimeout(function () { + if(th.data.current_page==1) details=big_arr; for (var i = 0; i < details.length; i++) { var no = i + len; - qrcode('qrcode' + no, details[i].CashRepNo, 460, 460); + qrcode('qrcode' + no, details[i].CashRepNo?details[i].CashRepNo:details[i].no, 460, 460); } wx.hideLoading(); - }, 800) }) }, + //---加载更多是靠这个函数---- onReachBottom: function() { - var sheng=this.data.sheng; - - if (sheng==3){ - this.myyhj(); - }else{ - getApp().showWarning("未找更多数据"); - } - + if(this.data.isloading) return false; //正在加载中,则不处理 var currentTab=this.data.currentTab; if (currentTab==2){ - this.overdue(); + if(this.data.overdue_sheng==0) return false; + this.overdue(); } + if (currentTab==0){ + if(this.data.sheng==0) return false; + this.myyhj(); + } }, /** * 生命周期函数--监听页面隐藏 @@ -333,21 +382,6 @@ Page({ }, /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function() { - - }, - - - /** * 用户点击右上角分享 */ onShareAppMessage: function() { diff --git a/pages/user/coupons/coupons.wxml b/pages/user/coupons/coupons.wxml index 595edc7..83ec009 100644 --- a/pages/user/coupons/coupons.wxml +++ b/pages/user/coupons/coupons.wxml @@ -28,6 +28,27 @@ + + + {{detail.no}} + + 包邮券 + + 微券来源: 微信商城 + + + 有效期: {{time.format_time(detail.use_start_time)}}至{{time.format_time(detail.use_end_time)}} + + + 有效期: time.format_time(detail.use_start_time)至不限 + 有效期:不限 + + 使用说明: 包邮券,全场通用,满 {{detail.condition}}元使用 {{detail.title==null?"":",不包邮地区:"+detail.title}} + + + + + {{detail.CashRepNo}} @@ -42,10 +63,11 @@ 有效期:不限 - 使用说明: {{filter.getNum(detail.Sum)}}元优惠券,{{(detail.UseObjectID==null || detail.UseObjectID=='')?"全场通用":"仅限"+(detail.UseObjectName)+"使用"}},满 {{detail.BuySum==null?filter.getNum(0):filter.getNum(detail.BuySum)}}元使用{{detail.region_list_name==null?"":",不包邮地区:"+region_list_name}} + 使用说明: {{filter.getNum(detail.Sum)}}元优惠券,{{(detail.UseObjectID==null || detail.UseObjectID=='')?"全场通用":"仅限"+(detail.UseObjectName)+"使用"}},满 {{detail.BuySum==null?filter.getNum(0):filter.getNum(detail.BuySum)}}元使用 {{detail.region_list_name==null?"":",不包邮地区:"+region_list_name}} + \ No newline at end of file diff --git a/pages/user/coupons/query/index.js b/pages/user/coupons/query/index.js index ecfaac6..47431f0 100644 --- a/pages/user/coupons/query/index.js +++ b/pages/user/coupons/query/index.js @@ -30,7 +30,9 @@ Page({ ], display:false, is_no_more: 0, - current_page:0, + current_page:1, + by_list:[], + islading:0, }, /** * 生命周期函数--监听页面加载 @@ -65,9 +67,7 @@ Page({ // }, //监听输入框显示清空按钮 watchPassWord: function (event) { - console.log("监听输入框显示清空按钮"); var val = event.detail.value; - console.log("是什么", val); if (val != "" && val != null) { var isBind = false; this.setData({ isBind: isBind }); @@ -78,7 +78,6 @@ Page({ * 点击下拉框 */ bindShowMsg() { - console.log(!this.data.select); this.setData({ select: !this.data.select }) @@ -87,7 +86,6 @@ Page({ * 已选下拉框 */ mySelect(e) { - console.log(e) var name = e.currentTarget.dataset.name; this.setData({ grade_name: name, @@ -103,41 +101,38 @@ Page({ var stime = th.data.datet; var etime = th.data.dates; var tpye = th.data.grade_name; - console.log(tpye,"选中类型",stime, "数据绑定", etime) + //开始获取时间结束 - console.log(stime, "结束开始", etime); //删除字符中的—— var datatk = stime.replace(/[-]/g, ""); - console.log("aaa", datak); - var dataj = etime.replace(/[-]/g, ""); - console.log("开始", datatk, "结束", dataj); + var dataj = etime.replace(/[-]/g, ""); //转换类型 var datak = parseInt(datatk); var dataj = parseInt(dataj); - console.log("sk", datak, "js", dataj); + //判断初始时间小于结束时间 if (datak > dataj) { - console.log("开始时间", datak, '结束时间', dataj, "时间判断"); - getApp().showWarning("结束时间错误"); - + getApp().showWarning("结束时间错误"); } else { this.setData({ details: [] }); - console.log(datak, dataj, "时间判断2"); - console.log("有进来吗", stime, etime); - this.setData({ current_page: 0 }); + this.data.current_page=1; + this.data.is_no_more=0; + this.data.by_list=[]; + this.data.details=[]; this.wjquery(); } }, //微卷查询流水明细 - async wjquery() { - console.log("进来wjquery", this.data.is_no_more); - - //if (this.data.is_no_more) return; + async wjquery() { + if (this.data.islading) return; + if(this.data.is_no_more) return; + this.data.islading=1; + var th=this; + var len = this.data.details.length; - this.data.current_page++; - var e = this, - sum, val, number; + + var e = this,sum, val, number; var user_id = getApp().globalData.user_id; var store_id = os.stoid; var stime = this.data.datet; @@ -152,69 +147,108 @@ Page({ pageSize: 10, page: e.data.current_page }; + + var dd={ user_id: user_id, store_id: store_id,pageSize: 100}; + dd.isuse=0; // 判断下拉框,添加类型 - if (tpye == "已使用"){ - console.log("已使用"); + if (tpye == "已使用"){ get_data.IsUse = 1; - } else if (tpye == "已过期"){ - console.log("已过期"); + dd.isuse=1; + } else if (tpye == "已过期"){ get_data.IsUse = 2; } else if (tpye == "未使用"){ - get_data.IsUse = 0; + get_data.IsUse = 0; } if (etime != "" && etime != null) { get_data.EndDate = etime; + + //时间要转成时间戳 + var new_t=new Date(etime)/1000; + dd.etime=new_t; } if (stime != "" && stime != null) { - get_data.BeginDate= stime; + get_data.BeginDate= stime; + //时间要转成时间戳 + var new_t=new Date(stime)/1000; + dd.stime=new_t; } + + var by_list=[]; + if(th.data.current_page==1){ + //先拿包邮券 + await getApp().request.promiseGet("/api/weshop/userfeemail/pageAndArea", { + data: dd, + }).then(res => { + if(res.data.code==0 && res.data.data && res.data.data.total>0){ + by_list=res.data.data.pageData; + for(var i in by_list){ + by_list[i].isby=1; + //过滤是时间的范围 + if(get_data.IsUse == 2 && by_list[i].use_end_time>=ut.gettimestamp()){ + th.data.by_list.push(by_list[i]); + }else if(get_data.IsUse == 0 && by_list[i].use_end_time0) + big_arr=th.data.by_list; + + await getApp().request.promiseGet("/api/weshop/users/listQuan", { data: get_data, isShowLoading: 1 }).then(res => { - console.log("1" + res); + + th.data.islading=0; var a = res.data; var len = e.data.details.length; var details = a.data.pageData; - console.log("无限大乱斗" + details); - - if (details.length == 0) { + + if (details.length == 0 ) { this.data.is_no_more = 1; getApp().showWarning("未找更多数据"); - + if(th.data.by_list && th.data.current_page==1){ + th.setData({ val: val,details:th.data.by_list}); + details=th.data.by_list; + setTimeout(function () { + for (var i = 0; i < details.length; i++) { + var no = i + len; + qrcode('qrcode' + no, details[i].no,460, 460); + } + }, 100) + } return false; } - console.log("无限大乱斗" + details); - - val = a.data.total; - - - console.log("长度", details.length); - details.forEach(function (val, ind) { - big_arr.push(val); - }) - + + th.data.current_page++; + val = a.data.total+th.data.by_list.length; + big_arr=big_arr.concat(details); this.setData({ - details: big_arr, + details: big_arr,val: val }); setTimeout(function () { + if(by_list) details=big_arr; for (var i = 0; i < details.length; i++) { var no = i + len; - qrcode('qrcode' + no, details[i].CashRepNo,460, 460); - console.log("是三生三世" + no); + qrcode('qrcode' + no, details[i].CashRepNo?details[i].CashRepNo:details[i].no,460, 460); } }, 100) }) - this.setData({ - val: val - }); + + + }, //---加载更多是靠这个函数---- onReachBottom: function () { diff --git a/pages/user/coupons/query/index.wxml b/pages/user/coupons/query/index.wxml index f8d6213..af3319f 100644 --- a/pages/user/coupons/query/index.wxml +++ b/pages/user/coupons/query/index.wxml @@ -52,10 +52,39 @@ - - - - + + + + + + + {{detail.no}} + + + 包邮券 + + 微券来源: 微信商城 + + + 有效期: + {{detail.use_start_time==null?" " : time.format_time(detail.use_start_time)}} + 至 {{ time.format_time(detail.use_end_time)}} + + + 有效期: 不限 + + 使用说明: 包邮券,全场通用,满 {{detail.condition}}元使用{{detail.title?",不包邮地区:"+detail.title:""}} + + + + + + + + + + + {{detail.CashRepNo}} @@ -77,6 +106,6 @@ - - + + diff --git a/pages/user/integral/integral.wxml b/pages/user/integral/integral.wxml index 450c1b4..bd352ff 100644 --- a/pages/user/integral/integral.wxml +++ b/pages/user/integral/integral.wxml @@ -8,7 +8,6 @@ - diff --git a/pages/user/my_service/i_service.wxml b/pages/user/my_service/i_service.wxml index 5c0be86..98d62fa 100644 --- a/pages/user/my_service/i_service.wxml +++ b/pages/user/my_service/i_service.wxml @@ -15,7 +15,7 @@ - + diff --git a/utils/filter.wxs b/utils/filter.wxs index 10c101d..b71c82d 100644 --- a/utils/filter.wxs +++ b/utils/filter.wxs @@ -8,11 +8,13 @@ var filters = { }, replace_time2: function (val) { + if(val==null || val==undefined || val=='') return ""; var a = val.split(" "); return a[0]; }, format_time:function(ts,isFull) { + if(ts==null || ts==undefined || ts=='') return ""; var d = getDate(ts*1000) var fm=[d.getFullYear(), d.getMonth()+1, d.getDate()].join('-'); if(isFull==1) diff --git a/utils/request.js b/utils/request.js index 437cec9..c87ca77 100644 --- a/utils/request.js +++ b/utils/request.js @@ -238,6 +238,21 @@ module.exports = { success: function (res) { succ(res);th.hideLoading(); }, fail:function(res){fail(res);} }) + }, + + promise_downimg(url){ + return new Promise((resolve, reject) => { + wx.getImageInfo({ + src: url, + success: function(res) { + //res.path是网络图片的本地地址 + resolve(res.path); + }, + fail: function(err) { + reject(err); + } + }); + }) } }; \ No newline at end of file diff --git a/utils/util.js b/utils/util.js index d28ccb5..fe5146f 100644 --- a/utils/util.js +++ b/utils/util.js @@ -304,10 +304,23 @@ function draw_randon_rect(ctx,x,y,r,w,h){ ctx.lineTo(x, y + r) ctx.lineTo(x + r, y) // 这里是使用 fill 还是 stroke都可以,二选一即可,但是需要与上面对应 - ctx.fill(); - + ctx.fill(); } +/** + * @param {Object} num 数量,最大5 + * @param {Object} x 中心坐标 + * @param {Object} y y中心坐标 + * @param {Object} sp 圆的间隔 + * @param {Object} r 圆的半径 + */ +function get_box_arr(num,x,y,sp,r){ + if(num==1) return [{x:x,y:y}]; + if(num==2) return [{x:x-sp/2-r,y:y},{x:x+sp/2+r,y:y}]; + if(num==3) return [{x:x-sp-2*r,y:y},{x:x,y:y},{x:x+sp+2*r,y:y}]; + if(num==4) return [{x:x-sp/2-r-sp-2*r,y:y},{x:x-sp/2-r,y:y},{x:x+sp/2+r,y:y},{x:x+sp/2+r+sp+2*r,y:y}]; + if(num==5) return [{x:x-2*sp-4*r,y:y},{x:x-sp-2*r,y:y},{x:x,y:y},{x:x+sp+2*r,y:y},{x:x+2*sp+4*r,y:y}]; +} function null_promise(){ var promise=new Promise(function(resolve, reject){ var ob={code:-1,data:null}; resolve(ob); }); return promise; @@ -336,6 +349,11 @@ module.exports = { for (var o in n) new RegExp("(" + o + ")").test(r) && (r = r.replace(RegExp.$1, 1 == RegExp.$1.length ? n[o] : ("00" + n[o]).substr(("" + n[o]).length))); return r; }, + formar_no_full(e){ + var t= new Date(1e3 * e); + return t.getFullYear() +"-"+(t.getMonth() + 1)+"-"+t.getDate(); + }, + json2Form: function(e) { var r = []; for (var t in e) r.push(encodeURIComponent(t) + "=" + encodeURIComponent(e[t])); @@ -406,4 +424,5 @@ module.exports = { getDistance:getDistance, //获取俩个经纬网度之间的距离 draw_randon_rect:draw_randon_rect ,//画图画圆角矩形 null_promise:null_promise,//返回空的promise + get_box_arr:get_box_arr,//返回圆的数组 };