From d7d93cf8260a335cafd9854724df47a2cc1b9fbe Mon Sep 17 00:00:00 2001 From: meo <18801474720@163.com> Date: Thu, 14 Mar 2019 19:32:49 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=88=B8=E8=AF=A6=E6=83=85=E5=92=8C=E7=A0=8D?= =?UTF-8?q?=E4=BB=B7=E7=9A=84=E5=80=92=E8=AE=A1=E6=97=B6=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E7=9A=84=E4=BF=AE=E6=94=B9]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ext.json | 2 +- pages/bargain/bargainDatail/bargainDatail.js | 1 + .../bargain/bargainDatail/bargainDatail.wxml | 2 +- pages/coupon/detail/index.js | 244 +++++++++++------- pages/coupon/detail/index.json | 3 +- pages/coupon/detail/index.wxml | 9 +- pages/coupon/detail/index.wxss | 2 +- pages/couponorder/detail/index.wxml | 4 +- pages/index/searchbar/index.wxml | 2 +- pages/joinFrDpell/index.wxml | 1 - pages/main/index.wxml | 2 +- pages/main/index.wxss | 18 +- pages/rushToBuy/index.js | 48 +++- pages/rushToBuy/index.wxml | 25 +- pages/spellGroup/mySpellGroup/index.wxml | 1 - project.config.json | 2 +- utils/HttpBasics.js | 5 - utils/util.js | 4 +- 18 files changed, 217 insertions(+), 158 deletions(-) diff --git a/ext.json b/ext.json index 60b312e..9051b53 100644 --- a/ext.json +++ b/ext.json @@ -4,7 +4,7 @@ "ext": { "weappId": "wxea71200db93d756b", "name": "富茂客官开发", - "appVersion": "C.3.4.7", + "appVersion": "C.3.5.6", "attr": { "ifHaveCarModular": "1", "etcpversion": "release", diff --git a/pages/bargain/bargainDatail/bargainDatail.js b/pages/bargain/bargainDatail/bargainDatail.js index 6fb1a24..2993621 100644 --- a/pages/bargain/bargainDatail/bargainDatail.js +++ b/pages/bargain/bargainDatail/bargainDatail.js @@ -12,6 +12,7 @@ Page({ bannerUrl: imgurl.banner.url, data: null, from: null, + day: null, hour: null, min: null, sec: null, diff --git a/pages/bargain/bargainDatail/bargainDatail.wxml b/pages/bargain/bargainDatail/bargainDatail.wxml index b2fdb35..427a21e 100644 --- a/pages/bargain/bargainDatail/bargainDatail.wxml +++ b/pages/bargain/bargainDatail/bargainDatail.wxml @@ -16,7 +16,7 @@ - 还剩 {{hour}}:{{min}}:{{sec}} 结束 + 还剩 {{day}}天:{{hour}}:{{min}}:{{sec}} 结束 diff --git a/pages/coupon/detail/index.js b/pages/coupon/detail/index.js index 1721221..e8470c2 100644 --- a/pages/coupon/detail/index.js +++ b/pages/coupon/detail/index.js @@ -65,16 +65,22 @@ Page({ hour: "00", min: "00", sec: "00", - countdown: "" + clock02: "00", + day02: "00", + hour02: "00", + min02: "00", + sec02: "00", + countdown: "", + showbutton1:false }, - phone: function (e) { + phone: function(e) { let that = this; wx.makePhoneCall({ phoneNumber: e.target.dataset.merchantlinkphone }); }, // 点击查看更多 - more: function () { + more: function() { let that = this; if (that.data.more == '点击查看更多') { this.setData({ @@ -83,8 +89,7 @@ Page({ more: "点击收起", showMore: true }) - } - else { + } else { this.setData({ hidden: "hidden", height: 4 * 140 + 'rpx', @@ -94,13 +99,13 @@ Page({ } }, //获取当前登录用户信息 - getUserInfo: function () { + getUserInfo: function() { let that = this; // 获取用户信息 Http.get({ - url: config.api.getScore, - data: {} - }) + url: config.api.getScore, + data: {} + }) .then(res => { console.log(res) that.getQueryCardStatus() @@ -121,9 +126,9 @@ Page({ updateDate: util.formatTime(Number(that.data.cardData.updateDate), "yyyy-MM-dd hh:mm:ss") } Http.get({ - url: config.api.queryCardStatus, - data: param - }) + url: config.api.queryCardStatus, + data: param + }) .then(res => { console.log(res, 333333333333) }) @@ -145,9 +150,9 @@ Page({ receivedDisabled: true }) Http.post({ - url: config.api.cardAccept, - data: param - }) + url: config.api.cardAccept, + data: param + }) .then(res => { wx.showToast({ title: '领取成功!', @@ -176,7 +181,7 @@ Page({ showCardOffer: false }) }, - goback: function () { + goback: function() { wx.switchTab({ url: '/pages/main/index', }) @@ -184,7 +189,7 @@ Page({ /** * 点击提交问题单选 */ - formSubmit: function (e) { + formSubmit: function(e) { console.log(e); let that = this; /** @@ -196,19 +201,18 @@ Page({ } else { var answserIs = that.data.anwserId.join(","); } - } - else if (e.currentTarget.dataset.flags == 'single') { + } else if (e.currentTarget.dataset.flags == 'single') { var answserIs = e.detail.value; } console.log(answserIs) console.log(e.currentTarget.dataset.questionid) Http.post({ - url: config.api.answerQuestion, - data: { - answer: answserIs, - questionId: e.currentTarget.dataset.questionid - } - }) + url: config.api.answerQuestion, + data: { + answer: answserIs, + questionId: e.currentTarget.dataset.questionid + } + }) .then(res => { that.closeQuestion(); }) @@ -224,28 +228,28 @@ Page({ /** * 多选 */ - checkboxChange: function (e) { + checkboxChange: function(e) { console.log(e) this.setData({ anwserId: e.detail.value }) }, - closeQuestion: function () { + closeQuestion: function() { let that = this; that.setData({ display: "none", zIndex: 11, opacity: 0 }) - setTimeout(function () { + setTimeout(function() { that.orderFunc(); }, 500) }, /** * gotopay */ - gotopay: function (e) { + gotopay: function(e) { let that = this; var discount = e.currentTarget.dataset.discount; that.setData({ @@ -253,11 +257,11 @@ Page({ showbutton: true }) Http.get({ - url: config.api.getQuestion, - data: { - couponType: JSON.stringify(that.data.data.type) - } - }) + url: config.api.getQuestion, + data: { + couponType: JSON.stringify(that.data.data.type) + } + }) .then(res => { console.log(res); if (res.data == undefined) { @@ -296,7 +300,6 @@ Page({ var total_micro_second = EndTime - NowTime || []; // 渲染倒计时时钟 let obj = that.dateformat(total_micro_second); - console.log(obj) if (total_micro_second > 0) { that.setData({ clock: obj, @@ -313,14 +316,45 @@ Page({ min: "00", sec: "00", }) + that.getDetail(that.data.couponChannelId); } total_micro_second -= 1000; - console.log(obj); }, - countdown: function (end_time) { + // countdown02(end_time) { + // let that = this; + // var EndTime = end_time; + // var NowTime = new Date().getTime(); + // var total_micro_second = EndTime - NowTime || []; + // // 渲染倒计时时钟 + // let obj = that.dateformat(total_micro_second); + // if (total_micro_second > 0) { + // that.setData({ + // clock02: obj, + // day02: obj.a1, + // hour02: obj.b1, + // min02: obj.c1, + // sec02: obj.d1, + // }) + // } else { + // that.setData({ + // clock02: "00", + // day02: "0", + // hour02: "00", + // min02: "00", + // sec02: "00", + // showbutton1: false + // }) + // } + // console.log(that.data.showbutton1) + // setTimeout(function() { + // total_micro_second -= 1000; + // that.countdown02(end_time); + // }, 1000) + // }, + countdown: function(end_time) { let that = this; that.setIntervalTime(end_time); - that.data.setInterval = setInterval(function () { + that.data.setInterval = setInterval(function() { that.setIntervalTime(end_time); }, 1000) }, @@ -346,13 +380,14 @@ Page({ } }, /** - * 获取用户信息 - */ + * 获取用户信息 + */ onLoad(options) { let that = this; wx.showLoading({ title: "加载中..." }); + that.getDetail(options.couponChannelId); /** * 转赠判断 */ @@ -372,10 +407,13 @@ Page({ cardType: options.cardType }) } + }, + getDetail: function(couponChannelId) { + let that = this; var parmer = { url: config.api.couponDetail, data: { - couponChannelId: options.couponChannelId + couponChannelId: couponChannelId } }; Http.get(parmer) @@ -400,19 +438,41 @@ Page({ showbutton1: true }) } - // that.countdown02(res.data.validStartDate) - if (res.data.endTime) { - that.countdown(res.data.endTime); + //如果是砍价券 + // if (res.data.type == 8) { + // that.countdown02(res.data.validStartDate); + // } + if (res.data.endTime && res.data.beginTime) { + //activityStatus==0 活动未开始 + //activityStatus==1 活动已开始 + if (res.data.activityStatus == 0) { + that.countdown(res.data.beginTime); + } else { + that.countdown(res.data.endTime); + } //当前时间与优惠券下架时间做计算 - var endTime = util.formatTime(res.data.endTime, "yyyy-MM-dd hh:mm:ss"); - if (util.timechuo(endTime).indexOf('-') == 0) { - that.setData({ - endtime: "活动已结束", - }); + if (res.data.activityStatus == 0) { + var beginTime = util.formatTime(res.data.beginTime, "yyyy-MM-dd hh:mm:ss"); + if (util.timechuo(beginTime).indexOf('-') == 0) { + that.setData({ + beginTime: "活动已结束", + }); + } else { + that.setData({ + beginTime: util.timechuo(beginTime) + }); + } } else { - that.setData({ - endtime: util.timechuo(endTime) - }); + var endTime = util.formatTime(res.data.endTime, "yyyy-MM-dd hh:mm:ss"); + if (util.timechuo(endTime).indexOf('-') == 0) { + that.setData({ + endtime: "活动已结束", + }); + } else { + that.setData({ + endtime: util.timechuo(endTime) + }); + } } } wx.hideLoading(); @@ -429,7 +489,6 @@ Page({ height: 4 * 140 + 'rpx' }) } - console.log(that.data.height) if (res.data.validType == 1) { that.setData({ validStartDate: util.formatTime(res.data.validStartDate, "yyyy-MM-dd"), @@ -454,7 +513,7 @@ Page({ /** * 邀请好友继续砍价 */ - inviteFriend: function () { + inviteFriend: function() { let that = this; that.orderFunc("discount"); that.setData({ @@ -468,14 +527,14 @@ Page({ let that = this; // 支付成功 Http.post({ - url: config.api.payOrderUpdate, - data: { - payOrderId: payOrderId, - orderId: orderId, - status: status, - reason: reason - } - }) + url: config.api.payOrderUpdate, + data: { + payOrderId: payOrderId, + orderId: orderId, + status: status, + reason: reason + } + }) .then(res => { wx.hideLoading() // 有价券 @@ -496,18 +555,18 @@ Page({ .catch(err => { console.log(err); if (!type) { - setTimeout(function () { + setTimeout(function() { _this.payOrderUpdate(orderId, payOrderId, status, reason, type, _this); }, 2000) } }) }, - checkPhoneStatus: function () { + checkPhoneStatus: function() { let that = this; Http.post({ - url: config.api.checkPhoneStatus, - data: {} - }) + url: config.api.checkPhoneStatus, + data: {} + }) .then(res => { console.log(666, '授权成功!') that.receiveCard() @@ -544,9 +603,9 @@ Page({ console.log(discount) var that = this; Http.post({ - url: config.api.checkPhoneStatus, - data: {} - }) + url: config.api.checkPhoneStatus, + data: {} + }) .then(res => { if (discount == 'discount') { var data = { @@ -667,7 +726,7 @@ Page({ .then(res => { console.log(res) if (discount != 'discount') { - if (typeof (res) != "undefined") { + if (typeof(res) != "undefined") { let orderId = "" + res.data.id; that.setData({ orderId: orderId @@ -678,11 +737,11 @@ Page({ * 支付订单创建 */ Http.post({ - url: config.api.payOrderCreate, - data: { - orderId: orderId - } - }) + url: config.api.payOrderCreate, + data: { + orderId: orderId + } + }) .then(res => { var payOrderId = "" + res.data.payOrderId; wx.hideLoading(); @@ -696,12 +755,12 @@ Page({ wx.showLoading({ title: '订单正在处理中...', }) - setTimeout(function () { + setTimeout(function() { wx.hideLoading() }, 5000) that.payOrderUpdate(that.data.orderId, payOrderId, 1, '', '', that); if (res.errMsg == "requestPayment:ok") { - setTimeout(function () { + setTimeout(function() { wx.hideLoading(); }, 2000); /** @@ -730,7 +789,7 @@ Page({ }) return; }, - complete: res => { } + complete: res => {} }); /// End payment -------- }) @@ -770,20 +829,20 @@ Page({ }, onShow() { this.setData({ - showbutton: false + showbutton: false, + showbutton1:false }) - console.log(this.data.showMore) }, - onShareAppMessage: function (options) { + onShareAppMessage: function(options) { var that = this; var shareObj = { title: that.data.data.title, path: `/pages/index/index?couponChannelId=${that.data.couponChannelId}`, - success: function (res) { - if (res.errMsg == 'shareAppMessage:ok') { } + success: function(res) { + if (res.errMsg == 'shareAppMessage:ok') {} }, - fail: function (error) { - if (res.errMsg == 'shareAppMessage:fail cancel') { } else if (res.errMsg == 'shareAppMessage:fail') { } + fail: function(error) { + if (res.errMsg == 'shareAppMessage:fail cancel') {} else if (res.errMsg == 'shareAppMessage:fail') {} } }; // 来自页面内的按钮的转发 @@ -794,14 +853,9 @@ Page({ // 返回shareObj return shareObj; }, - onUnload: function () { - let that = this; - console.log("onUnload") - clearInterval(that.data.setInterval); - }, - onHide: function () { - let that = this; - console.log("onHide"); - clearInterval(that.data.setInterval); + // 下拉刷新 + onPullDownRefresh: function() { + this.getDetail(this.data.couponChannelId); + wx.stopPullDownRefresh() } }); \ No newline at end of file diff --git a/pages/coupon/detail/index.json b/pages/coupon/detail/index.json index fa43619..38d079e 100644 --- a/pages/coupon/detail/index.json +++ b/pages/coupon/detail/index.json @@ -1,4 +1,5 @@ { "navigationBarTitleText": "券详情", - "backgroundColor":"#f4f4f4" + "backgroundColor":"#f4f4f4", + "enablePullDownRefresh": true } \ No newline at end of file diff --git a/pages/coupon/detail/index.wxml b/pages/coupon/detail/index.wxml index 399cfc7..c131317 100644 --- a/pages/coupon/detail/index.wxml +++ b/pages/coupon/detail/index.wxml @@ -18,12 +18,7 @@ 距开始 : - - {{day}}天: - - {{hour}}: - {{min}}: - {{sec}} + 已经结束 @@ -52,7 +47,7 @@ 剩余{{data.remainInventory}}件 - 砍价活动将于{{day02+'天'+hour02+':'+min02+':'+sec02}}后准时开始 + 有效期:自领取之日起 {{validDays}}天内有效(请在有效期内使用) 有效期: diff --git a/pages/coupon/detail/index.wxss b/pages/coupon/detail/index.wxss index e0a5a88..4b084b4 100644 --- a/pages/coupon/detail/index.wxss +++ b/pages/coupon/detail/index.wxss @@ -377,8 +377,8 @@ button::after{ border: none; } .times text { display: inline-block; margin: 6rpx; - width: 46rpx; height: 56rpx; + padding: 0 6rpx; text-align: center; font-size: 28rpx; line-height: 60rpx; diff --git a/pages/couponorder/detail/index.wxml b/pages/couponorder/detail/index.wxml index 4b7f90c..5fd2532 100644 --- a/pages/couponorder/detail/index.wxml +++ b/pages/couponorder/detail/index.wxml @@ -11,8 +11,8 @@ ¥{{data.salePrice/100}} ¥{{data.salePrice/100}} ¥{{data.price/100}} - - 过期不退款 + + 过期不退款 diff --git a/pages/index/searchbar/index.wxml b/pages/index/searchbar/index.wxml index 54fc318..474ef77 100644 --- a/pages/index/searchbar/index.wxml +++ b/pages/index/searchbar/index.wxml @@ -23,7 +23,7 @@ {{item.merchantName}} - {{item.addr}}{{item.buildingName}}{{item.floorName}} + {{item.buildingName}}{{item.floorName}} diff --git a/pages/joinFrDpell/index.wxml b/pages/joinFrDpell/index.wxml index 9694e73..8b7edae 100644 --- a/pages/joinFrDpell/index.wxml +++ b/pages/joinFrDpell/index.wxml @@ -16,7 +16,6 @@ 限购条件: 每人{{data.useLimitQuantity}}张 - (支持过期自动退款) (不支持过期自动退款) diff --git a/pages/main/index.wxml b/pages/main/index.wxml index d56a234..8cf20c8 100644 --- a/pages/main/index.wxml +++ b/pages/main/index.wxml @@ -2,7 +2,7 @@ - 搜索门店 + 门店> diff --git a/pages/main/index.wxss b/pages/main/index.wxss index cabb333..ff14b2e 100644 --- a/pages/main/index.wxss +++ b/pages/main/index.wxss @@ -124,29 +124,21 @@ page { } .search{ background:rgba(2, 192, 255, 1); - height: 76rpx; - padding: 20rpx 0; + height: 50rpx; } .searchbar{ position: relative; width: 685rpx; height: 76rpx; margin: 0 auto; - background: #fff; - border-radius:60rpx; + text-align: center; } .searchbar image{ - position: absolute; width: 40rpx; - left: 20rpx; - top:0; - bottom: 0; - margin: auto; } .searchbar text{ - font-size: 32rpx; - line-height: 76rpx; - color: #555555; + font-size: 28rpx; + line-height: 50rpx; + color: #fff; display: inline-block; - margin-left: 70rpx; } \ No newline at end of file diff --git a/pages/rushToBuy/index.js b/pages/rushToBuy/index.js index 0980339..6da5696 100644 --- a/pages/rushToBuy/index.js +++ b/pages/rushToBuy/index.js @@ -70,28 +70,50 @@ Page({ }) for (let i = 0; i < that.data.list.length; i++) { var startTime = util.formatTime(that.data.list[i].endTime, "yyyy-MM-dd hh:mm:ss"); + var beginTimes = util.formatTime(that.data.list[i].beginTime, "yyyy-MM-dd hh:mm:ss"); + console.log(that.data.list[i].activityStatus) var alsell = Math.floor((that.data.list[i].inventory - (that.data.list[i].remainInventory))/(that.data.list[i].inventory)*100); - util.timechuo(startTime); /** * 修改list的endtime * 渲染到页面 */ var endtime = 'list[' + i + '].endtime'; + var beginTime = 'list[' + i + '].beginTime'; var flags = 'list[' + i + '].flags'; var alsells = 'list[' + i + '].alsells'; - if (util.timechuo(startTime).indexOf('-')==0){ - that.setData({ - [flags]: "end", - [endtime]: util.timechuo(startTime), - [alsells]: alsell - }); - } - else{ - that.setData({ - [endtime]: util.timechuo(startTime), - [alsells]: alsell - }); + //活动未开始 + console.log(beginTime) + if (that.data.list[i].activityStatus==0){ + if (util.timechuo(beginTime).indexOf('-') == 0) { + that.setData({ + [flags]: "end", + [beginTime]: util.timechuo(beginTimes), + [alsells]: alsell + }); + } + else { + that.setData({ + [beginTime]: util.timechuo(beginTimes), + [alsells]: alsell + }); + } + } if (that.data.list[i].activityStatus != 0) { + //活动已经开始 + if (util.timechuo(startTime).indexOf('-') == 0) { + that.setData({ + [flags]: "end", + [endtime]: util.timechuo(startTime), + [alsells]: alsell + }); + } + else { + that.setData({ + [endtime]: util.timechuo(startTime), + [alsells]: alsell + }); + } } + } }) diff --git a/pages/rushToBuy/index.wxml b/pages/rushToBuy/index.wxml index a803f89..7ddde68 100644 --- a/pages/rushToBuy/index.wxml +++ b/pages/rushToBuy/index.wxml @@ -1,7 +1,7 @@ - + - + @@ -12,17 +12,18 @@ {{item.subTitle}} - 售价:{{item.salePriceStr}}{{item.priceStr}}元 + 售价:{{item.salePriceStr}}{{item.priceStr}}元 - 距结束: + 距结束: 距开始还有: 活动已结束 - {{item.endtime}} + {{item.endtime}} {{beginTime}} + {{item.beginTime}} @@ -31,19 +32,19 @@ - 马上购 - 立即领 - 已售罄 - 即将开始 + 马上购 + 立即领 + 已售罄 + 即将开始 已结束 - - 请您敬请期待 - 我们正在筹备一大堆优惠活动 + + 请您敬请期待 + 我们正在筹备一大堆优惠活动 {{content}} diff --git a/pages/spellGroup/mySpellGroup/index.wxml b/pages/spellGroup/mySpellGroup/index.wxml index 77e7b47..bb48cb9 100644 --- a/pages/spellGroup/mySpellGroup/index.wxml +++ b/pages/spellGroup/mySpellGroup/index.wxml @@ -16,7 +16,6 @@ 限购条件: 每人{{data.useLimitQuantity}}张 - (支持过期自动退款) (不支持过期自动退款) diff --git a/project.config.json b/project.config.json index 1ec26d3..b11f49c 100644 --- a/project.config.json +++ b/project.config.json @@ -9,7 +9,7 @@ "postcss": true, "minified": true, "newFeature": true, - "autoAudits": true + "autoAudits": false }, "compileType": "miniprogram", "libVersion": "2.2.0", diff --git a/utils/HttpBasics.js b/utils/HttpBasics.js index 1d169a6..be80eee 100644 --- a/utils/HttpBasics.js +++ b/utils/HttpBasics.js @@ -34,9 +34,6 @@ class HttpBasics { get({ url, data, headers }) { headers = { ...this.headers, ...headers }; url = `${this.address}${url}`; - wx.showLoading({ - title: '加载中', - }) return new Promise((resolve, reject) => { wx.request({ url: url, @@ -44,12 +41,10 @@ class HttpBasics { data: data, method: "Get", success: res => { - wx.hideLoading() this.responseMap(res, resolve, reject); }, fail: err => { console.log(err) - wx.hideLoading() if (err.errMsg == 'request:fail timeout') { err.errMsg = '请求超时,请检查您的网络设置!' } else if (err.errMsg == 'request:fail '){ diff --git a/utils/util.js b/utils/util.js index c02e895..cbee0bd 100644 --- a/utils/util.js +++ b/utils/util.js @@ -95,9 +95,9 @@ function timechuo(startTime) { if (day && !year && !month){ return (day + '天' + hour + "小时" + minute + "分钟") } else if (month && !year){ - return (month +'个月'+day + '天' + hour + "小时" + minute + "分钟") + return ((month*30+day) +'天' + hour + "小时" + minute + "分钟") } else if (year) { - return (year + '年' + month+'个月'+ day + '天' + hour + "小时" + minute + "分钟") + return ((year*365 + month*30+ day) + '天' + hour + "小时" + minute + "分钟") }else{ return (hour + "小时" + minute + "分钟") }