diff --git a/app.json b/app.json index 783a32d..73cb302 100644 --- a/app.json +++ b/app.json @@ -1,6 +1,7 @@ { "pages": [ "pages/index/index", + "pages/edit/edit", "pages/cartest/cartest", "pages/actdetail/actdetail", "pages/bannerdetail/index", diff --git a/assets/img/clock.png b/assets/img/clock.png new file mode 100644 index 0000000..31327e8 Binary files /dev/null and b/assets/img/clock.png differ diff --git a/pages/coupon/detail/index.js b/pages/coupon/detail/index.js index 69dad70..edf811f 100644 --- a/pages/coupon/detail/index.js +++ b/pages/coupon/detail/index.js @@ -16,7 +16,13 @@ Page({ tempFilePaths: '', userInfo: {}, hasUserInfo: false, - canIUse: wx.canIUse('button.open-type.getUserInfo') + canIUse: wx.canIUse('button.open-type.getUserInfo'), + + + id: '', + result: [], + end_time: '', + clock: '' }, phone: function () { @@ -29,6 +35,48 @@ Page({ } }, + countdown(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); + that.setData({ + clock: obj, + day: obj.a1, + hour: obj.b1, + min: obj.c1, + sec: obj.d1, + }); + if (total_micro_second <= 0) { + that.setData({ + clock: "已经截止" + }); + //return; + } + setTimeout(function () { + total_micro_second -= 1000; + that.countdown(end_time); + }, 1000) + }, + + // 时间格式化输出,如11:03 25:19 每1s都会调用一次 + dateformat(micro_second) { + // 总秒数 + var second = Math.floor(micro_second / 1000); + // 天数 + var day = Math.floor(second / 3600 / 24) < 10 ? "0" + Math.floor(second / 3600 / 24) : Math.floor(second / 3600 / 24); + // 小时 + var hr = Math.floor(second / 3600 % 24) < 10 ? "0" + Math.floor(second / 3600 % 24) : Math.floor(second / 3600 % 24); + // 分钟 + var min = Math.floor(second / 60 % 60) < 10 ? "0" + Math.floor(second / 60 % 60) : Math.floor(second / 60 % 60); + // 秒 + var sec = Math.floor(second % 60) < 10 ? "0" + Math.floor(second % 60): Math.floor(second % 60); + + // return day + "天" + hr + "小时" + min + "分钟" + sec + "秒"; + return { a1: day, b1: hr, c1: min, d1: sec} + }, onLoad(options) { let that = this; wx.showLoading({ @@ -50,17 +98,21 @@ Page({ }; Http.get(parmer).then(res => { console.log(res.data); - //当前时间与优惠券下架时间做计算 - var endTime = util.fmtDate(res.data.endTime); - if (util.timechuo(endTime).indexOf('-') == 0) { - that.setData({ - endtime: "活动已结束", - }); - } else { - that.setData({ - endtime: util.timechuo(endTime) - }); + if (res.data.endTime){ + that.countdown(res.data.endTime); + //当前时间与优惠券下架时间做计算 + var endTime = util.formatTime(res.data.endTime, "yyyy-MM-dddd hh:mm:ss"); + if (util.timechuo(endTime).indexOf('-') == 0) { + that.setData({ + endtime: "活动已结束", + }); + } else { + that.setData({ + endtime: util.timechuo(endTime) + }); + } } + wx.hideLoading(); that.setData({ data: res.data diff --git a/pages/coupon/detail/index.wxml b/pages/coupon/detail/index.wxml index 0083946..315221e 100644 --- a/pages/coupon/detail/index.wxml +++ b/pages/coupon/detail/index.wxml @@ -10,6 +10,22 @@ + + + + 距结束还剩 : + + 00天 + 00: + 00: + 00 + + {{day}}天 + {{hour}}: + {{min}}: + {{sec}} + + {{data.title}} {{data.subTitle}} @@ -21,10 +37,6 @@ 剩余{{data.remainInventory}}件 - - 距结束: - {{endtime}} - 有效期:自领取之日起 {{validDays}}天内有效 @@ -44,7 +56,6 @@ - \ No newline at end of file diff --git a/pages/coupon/detail/index.wxss b/pages/coupon/detail/index.wxss index 7d2cecd..154d34a 100644 --- a/pages/coupon/detail/index.wxss +++ b/pages/coupon/detail/index.wxss @@ -12,6 +12,7 @@ page { } .banner { + position: relative; width: 750rpx; height: 534.5rpx; } @@ -40,7 +41,7 @@ page { } .fenxiang image { - width: 60rpx; + width: 50rpx; position: absolute; top: 0; right: 0; @@ -298,3 +299,50 @@ page { .txt { margin-right: 30rpx; } +.distance{ + border: none; + border-radius:16rpx; + width: 600rpx; + padding: 16rpx 6rpx 0 0; +} +.distance .txt01{ + display: block; + font-size: 26rpx; + color: #ff4949; +} +.clock{ + width: 116rpx!important; + vertical-align: middle; + margin-right: 10rpx; + margin-top: -4rpx; +} +.qiang{ + position: inline-block; + width: 60rpx; + height: 40rpx; + line-height: 40rpx; + color: #ff4949; + text-align: center; + font-size: 28rpx; + margin-right: 10rpx; +} +.times{ + display: inline-block; + color: #ff4949; + font-weight:bold; + font-size: 26rpx; + text-align:center; +} +.times text{ + display: inline-block; + margin: 6rpx; + width: 46rpx; + height: 56rpx; + text-align: center; + font-size: 28rpx; + line-height: 60rpx; + border-radius:12rpx; + color: #fff; + font-weight:bold; + background: #ff4949; +} \ No newline at end of file diff --git a/pages/edit/edit.js b/pages/edit/edit.js new file mode 100644 index 0000000..87f9139 --- /dev/null +++ b/pages/edit/edit.js @@ -0,0 +1,100 @@ +const app = getApp(); +Page({ + + /** + * 页面的初始数据 + */ + data: { + date: '1988-03-12', + flag:1, + items: [ + { name: 'male', value: '男' }, + { name: 'famale', value: '女' }, + ] + }, + /** + * 获得生日 + */ + bindDateChange: function (e) { + console.log('picker发送选择改变,携带值为', e.detail.value); + this.setData({ + date: e.detail.value, + flag:2 + }) + }, + address: function () { + let that = this; + wx.chooseLocation({ + success:function(res){ + console.log(res); + that.setData({ + name: res.name + }) + }, + fail:function(error){ + console.log(error) + }, + complete:function(data){ + console.log(data); + } + }) + }, + radioChange: function (e) { + console.log('radio发生change事件,携带value值为:', e.detail.value) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + let that = this; + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/edit/edit.json b/pages/edit/edit.json new file mode 100644 index 0000000..137be15 --- /dev/null +++ b/pages/edit/edit.json @@ -0,0 +1,3 @@ +{ + "navigationBarTitleText": "编辑资料" +} \ No newline at end of file diff --git a/pages/edit/edit.wxml b/pages/edit/edit.wxml new file mode 100644 index 0000000..a66c2b9 --- /dev/null +++ b/pages/edit/edit.wxml @@ -0,0 +1,28 @@ +
+ + 姓名 + + + + 生日 + + + {{date}} + + + + 性别 + + + {{item.value}} + + + + + 地址 + + + + + +
\ No newline at end of file diff --git a/pages/edit/edit.wxss b/pages/edit/edit.wxss new file mode 100644 index 0000000..d7c0a74 --- /dev/null +++ b/pages/edit/edit.wxss @@ -0,0 +1,66 @@ +input { + width:600rpx; + display: inline-block; + font-size: 32rpx; + vertical-align: middle; + margin-top: -3rpx; +} + +.radio-group { + display: inline-block; +} + +.section { + height: 100rpx; + line-height: 100rpx; + width: 710rpx; + margin: 0 auto; + border-bottom: 1px solid #eee; +} +.radio{ + margin-right: 30rpx; +} + +.section__title, .picker, picker { + display: inline-block; + font-size: 32rpx; +} + +radio { + transform:scale(0.8); +} +.section__title { + color: #999; +} + +.section > text:nth-of-type(1) { + font-size: 32rpx; + display: inline-block; + margin-right: 20rpx; +} +.btn{ + width: 360rpx; + color: #fff; + margin-top: 60rpx; + height: 86rpx; + line-height: 86rpx; + text-align: center; + border-radius:60rpx; + background: #d95f5a; + font-size: 32rpx; +} +.active{ + background: #f38580; +} +.sec{ + position: relative; +} +.input{ + position: absolute; + left: 84rpx; + z-index: 1000; + top: 0; + bottom: 0; + margin: auto; + background: #fff; +} \ No newline at end of file diff --git a/pages/index/rushToBuy/index.wxss b/pages/index/rushToBuy/index.wxss index 033de98..2051832 100644 --- a/pages/index/rushToBuy/index.wxss +++ b/pages/index/rushToBuy/index.wxss @@ -34,13 +34,13 @@ display: inline-block; margin: 16rpx 30rpx 16rpx; margin-right: 0; - /* overflow: hidden; */ position: relative; background: #fff; /* border: 1rpx solid #dddee1; */ width: 355rpx; box-shadow: 0 0 10px 0 rgba(211,211,211,0.30); border-radius: 10rpx; + overflow: hidden; } .index-scroll-view .commodity:last-child{ margin-right: 30rpx; diff --git a/pages/rushToBuy/index.js b/pages/rushToBuy/index.js index 6a479a1..2f5162a 100644 --- a/pages/rushToBuy/index.js +++ b/pages/rushToBuy/index.js @@ -59,35 +59,34 @@ Page({ loading: false, }) }, 1400); - // if (pageNum == 2) { - // that.setData({ - // list: [] - // }) - // } var tmpArr = that.data.list; tmpArr.push.apply(tmpArr, res.data.list); that.setData({ list: tmpArr }) for (let i = 0; i < that.data.list.length; i++) { - var startTime = util.fmtDate(that.data.list[i].endTime); + var startTime = util.formatTime(that.data.list[i].endTime, "yyyy-MM-dddd hh:mm:ss"); + var alsell = Math.floor((that.data.list[i].inventory - (that.data.list[i].remainInventory))/(that.data.list[i].inventory)*100); util.timechuo(startTime); - console.log(util.timechuo(startTime)); + console.log(alsell); /** * 修改list的endtime * 渲染到页面 */ var endtime = 'list[' + i + '].endtime'; var flags = 'list[' + i + '].flags'; + var alsells = 'list[' + i + '].alsells'; if (util.timechuo(startTime).indexOf('-')==0){ that.setData({ [flags]: "end", - [endtime]: util.timechuo(startTime) + [endtime]: util.timechuo(startTime), + [alsells]: alsell }); } else{ that.setData({ - [endtime]: util.timechuo(startTime) + [endtime]: util.timechuo(startTime), + [alsells]: alsell }); } } diff --git a/pages/rushToBuy/index.wxml b/pages/rushToBuy/index.wxml index 29a7578..7ddb4be 100644 --- a/pages/rushToBuy/index.wxml +++ b/pages/rushToBuy/index.wxml @@ -1,6 +1,6 @@ - + @@ -16,7 +16,7 @@ - + 距结束: @@ -25,11 +25,12 @@ - 剩余: - {{item.remainInventory}}张 + 已售{{item.alsells}}% + - 购买 - 领取 + 马上购 + 立即领 + 已售罄 已结束 diff --git a/pages/rushToBuy/index.wxss b/pages/rushToBuy/index.wxss index c542f9d..2ab5aa0 100644 --- a/pages/rushToBuy/index.wxss +++ b/pages/rushToBuy/index.wxss @@ -120,14 +120,15 @@ } .view1 { - width: 550rpx; + width: 350rpx; display: block; line-height: 33rpx; } .remainingNumber { - font-size: 28rpx; + font-size: 26rpx; color: #b4b4b4; + margin-right: 10rpx; } .realnumber { @@ -174,3 +175,9 @@ color: #ff4949; border: 2rpx solid #ff4949; } +progress{ + display: inline-block; + width: 200rpx; + border-radius:60rpx; + overflow: hidden; +} \ No newline at end of file diff --git a/pages/user/index.js b/pages/user/index.js index cabeece..bc4afbd 100644 --- a/pages/user/index.js +++ b/pages/user/index.js @@ -65,6 +65,11 @@ Page({ } console.log(that.data.flag) }, + gotoedit:function(){ + wx.navigateTo({ + url: '/pages/edit/edit', + }) + }, /** * 生命周期函数--监听页面加载 */ diff --git a/pages/user/index.wxml b/pages/user/index.wxml index 805d751..04952cf 100644 --- a/pages/user/index.wxml +++ b/pages/user/index.wxml @@ -6,15 +6,16 @@ - + - 等级:{{levelName}} + 点击编辑资料 + 当前成长值 {{score}} - 成长值 + {{levelName}} @@ -67,7 +68,7 @@ - 版本号:2.1.4 + 版本号:2.1.8 diff --git a/pages/user/index.wxss b/pages/user/index.wxss index 3ee1eb1..13f6f34 100644 --- a/pages/user/index.wxss +++ b/pages/user/index.wxss @@ -87,7 +87,7 @@ } .chengzhang { - font-size: 28rpx; + font-size: 22rpx; color: #999; line-height: 40rpx; } @@ -96,7 +96,7 @@ position: absolute; right: 24rpx; bottom: 0; - top: 32rpx; + top: 19rpx; } .chengzhang1 text {