瀏覽代碼

[个人资料,限时抢购,优惠券详情][增加,修改]:个人资料增加编辑功能。限时抢购增加进度条,优惠券详情增加倒计时

tags/2.2.4
meo 6 年之前
父節點
當前提交
342c2c6093
共有 16 個檔案被更改,包括 364 行新增41 行删除
  1. +1
    -0
      app.json
  2. 二進制
      assets/img/clock.png
  3. +63
    -11
      pages/coupon/detail/index.js
  4. +17
    -5
      pages/coupon/detail/index.wxml
  5. +49
    -1
      pages/coupon/detail/index.wxss
  6. +100
    -0
      pages/edit/edit.js
  7. +3
    -0
      pages/edit/edit.json
  8. +28
    -0
      pages/edit/edit.wxml
  9. +66
    -0
      pages/edit/edit.wxss
  10. +1
    -1
      pages/index/rushToBuy/index.wxss
  11. +8
    -9
      pages/rushToBuy/index.js
  12. +7
    -6
      pages/rushToBuy/index.wxml
  13. +9
    -2
      pages/rushToBuy/index.wxss
  14. +5
    -0
      pages/user/index.js
  15. +5
    -4
      pages/user/index.wxml
  16. +2
    -2
      pages/user/index.wxss

+ 1
- 0
app.json 查看文件

@@ -1,6 +1,7 @@
{ {
"pages": [ "pages": [
"pages/index/index", "pages/index/index",
"pages/edit/edit",
"pages/cartest/cartest", "pages/cartest/cartest",
"pages/actdetail/actdetail", "pages/actdetail/actdetail",
"pages/bannerdetail/index", "pages/bannerdetail/index",


二進制
assets/img/clock.png 查看文件

Before After
Width: 225  |  Height: 77  |  Size: 7.2 KiB

+ 63
- 11
pages/coupon/detail/index.js 查看文件

@@ -16,7 +16,13 @@ Page({
tempFilePaths: '', tempFilePaths: '',
userInfo: {}, userInfo: {},
hasUserInfo: false, hasUserInfo: false,
canIUse: wx.canIUse('button.open-type.getUserInfo')
canIUse: wx.canIUse('button.open-type.getUserInfo'),


id: '',
result: [],
end_time: '',
clock: ''
}, },


phone: function () { 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) { onLoad(options) {
let that = this; let that = this;
wx.showLoading({ wx.showLoading({
@@ -50,17 +98,21 @@ Page({
}; };
Http.get(parmer).then(res => { Http.get(parmer).then(res => {
console.log(res.data); 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(); wx.hideLoading();
that.setData({ that.setData({
data: res.data data: res.data


+ 17
- 5
pages/coupon/detail/index.wxml 查看文件

@@ -10,6 +10,22 @@
<button class='share user-motto' data-id='{{data.id}}' data-couponId='{{data.couponId}}' data-title='{{data.title}}' id="shareBtn" open-type="share" hover-class="other-button-hover"></button> <button class='share user-motto' data-id='{{data.id}}' data-couponId='{{data.couponId}}' data-title='{{data.title}}' id="shareBtn" open-type="share" hover-class="other-button-hover"></button>
</view> </view>
<view> <view>
<view class='distance' wx:if="{{data.targetAd==2&&data.endTime!=undefined&&data.type!=5}}">
<view style='text-align:center;display:inline-block;'>
<image class='clock' src='./../../../assets/img/clock.png' mode='widthFix'></image>
<text class="qiang">距结束还剩 :</text>
</view>
<view wx:if="{{total_micro_second<=0||data.remainInventory==0}}" class='times'> <text>00</text>天
<text>00</text>:
<text>00</text>:
<text>00</text></view>
<view wx:if="{{clock!='已经截止'&&data.remainInventory!=0}}" class='times'>
<text>{{day}}</text>天
<text>{{hour}}</text>:
<text>{{min}}</text>:
<text>{{sec}}</text>
</view>
</view>
<text class='title'>{{data.title}}</text> <text class='title'>{{data.title}}</text>
<text class="subTitle">{{data.subTitle}}</text> <text class="subTitle">{{data.subTitle}}</text>
<view class='salePriceStr clearfix'> <view class='salePriceStr clearfix'>
@@ -21,10 +37,6 @@
<text class="restNum fr">剩余<text>{{data.remainInventory}}件</text></text> <text class="restNum fr">剩余<text>{{data.remainInventory}}件</text></text>
</view> </view>


<view class='rest' wx:if="{{data.targetAd==2&&data.endTime!=undefined&&data.type!=5}}">
<text class='txt01'>距结束:</text>
<text class='time'>{{endtime}}</text>
</view>


<view class='rest' wx:if="{{data.validType==2}}">有效期:自领取之日起 <view class='rest' wx:if="{{data.validType==2}}">有效期:自领取之日起
<text class='time'>{{validDays}}</text>天内有效</view> <text class='time'>{{validDays}}</text>天内有效</view>
@@ -44,7 +56,6 @@
</view> </view>
</view> </view>
</view> </view>

<view class='posi'> <view class='posi'>
<view class='posi_logo'> <view class='posi_logo'>
<view> <view>
@@ -72,5 +83,6 @@
<button bindtap='orderFunc' class='buy' wx:if="{{data.salePriceStr==0&&data.remainInventory!=0&&endtime!='活动已结束'}}">免费领取</button> <button bindtap='orderFunc' class='buy' wx:if="{{data.salePriceStr==0&&data.remainInventory!=0&&endtime!='活动已结束'}}">免费领取</button>
<button class='buy' wx:if="{{data.remainInventory==0&&endtime!='活动已结束'}}" style="background:#999;color: #fff;">已售罄</button> <button class='buy' wx:if="{{data.remainInventory==0&&endtime!='活动已结束'}}" style="background:#999;color: #fff;">已售罄</button>
<button class='buy' wx:if="{{endtime=='活动已结束'}}" style="background:#999;color: #fff;">活动已结束</button> <button class='buy' wx:if="{{endtime=='活动已结束'}}" style="background:#999;color: #fff;">活动已结束</button>
<button class='buy' wx:if="{{total_micro_second<=0}}" style="background:#999;color: #fff;">活动已结束</button>
</view> </view>
</view> </view>

+ 49
- 1
pages/coupon/detail/index.wxss 查看文件

@@ -12,6 +12,7 @@ page {
} }


.banner { .banner {
position: relative;
width: 750rpx; width: 750rpx;
height: 534.5rpx; height: 534.5rpx;
} }
@@ -40,7 +41,7 @@ page {
} }


.fenxiang image { .fenxiang image {
width: 60rpx;
width: 50rpx;
position: absolute; position: absolute;
top: 0; top: 0;
right: 0; right: 0;
@@ -298,3 +299,50 @@ page {
.txt { .txt {
margin-right: 30rpx; 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;
}

+ 100
- 0
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 () {

}
})

+ 3
- 0
pages/edit/edit.json 查看文件

@@ -0,0 +1,3 @@
{
"navigationBarTitleText": "编辑资料"
}

+ 28
- 0
pages/edit/edit.wxml 查看文件

@@ -0,0 +1,28 @@
<form bindsubmit="formSubmit">
<view class='section'>
<text>姓名</text>
<input type="text" placeholder='请填写名字' />
</view>
<view class="section sec">
<text>生日</text>
<picker mode="date" value="{{date}}" start="1930-09-01" end="2017-09-01" bindchange="bindDateChange">
<input wx:if="{{flag==1}}" class='input' placeholder='请输入生日' disabled/>
<view wx:if="{{flag==2}}" class="picker"> {{date}}</view>
</picker>
</view>
<view class="section section_gap">
<text>性别</text>
<radio-group class="radio-group" bindchange="radioChange">
<radio class="radio" wx:for-items="{{items}}" wx:key="name" value="{{item.name}}" checked="{{item.checked}}">
<text>{{item.value}}</text>
</radio>
</radio-group>
</view>
<view class='section' bindtap='address'>
<text>地址</text>
<input wx:if="{{name}}" type="text" placeholder='{{name}}' disabled/>
<input wx:if="{{!name}}" type="text" placeholder='请输入地址' disabled/>
</view>

<button class='btn' formType="submit" hover-class='active'>修改会员资料</button>
</form>

+ 66
- 0
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;
}

+ 1
- 1
pages/index/rushToBuy/index.wxss 查看文件

@@ -34,13 +34,13 @@
display: inline-block; display: inline-block;
margin: 16rpx 30rpx 16rpx; margin: 16rpx 30rpx 16rpx;
margin-right: 0; margin-right: 0;
/* overflow: hidden; */
position: relative; position: relative;
background: #fff; background: #fff;
/* border: 1rpx solid #dddee1; */ /* border: 1rpx solid #dddee1; */
width: 355rpx; width: 355rpx;
box-shadow: 0 0 10px 0 rgba(211,211,211,0.30); box-shadow: 0 0 10px 0 rgba(211,211,211,0.30);
border-radius: 10rpx; border-radius: 10rpx;
overflow: hidden;
} }
.index-scroll-view .commodity:last-child{ .index-scroll-view .commodity:last-child{
margin-right: 30rpx; margin-right: 30rpx;


+ 8
- 9
pages/rushToBuy/index.js 查看文件

@@ -59,35 +59,34 @@ Page({
loading: false, loading: false,
}) })
}, 1400); }, 1400);
// if (pageNum == 2) {
// that.setData({
// list: []
// })
// }
var tmpArr = that.data.list; var tmpArr = that.data.list;
tmpArr.push.apply(tmpArr, res.data.list); tmpArr.push.apply(tmpArr, res.data.list);
that.setData({ that.setData({
list: tmpArr list: tmpArr
}) })
for (let i = 0; i < that.data.list.length; i++) { 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); util.timechuo(startTime);
console.log(util.timechuo(startTime));
console.log(alsell);
/** /**
* 修改list的endtime * 修改list的endtime
* 渲染到页面 * 渲染到页面
*/ */
var endtime = 'list[' + i + '].endtime'; var endtime = 'list[' + i + '].endtime';
var flags = 'list[' + i + '].flags'; var flags = 'list[' + i + '].flags';
var alsells = 'list[' + i + '].alsells';
if (util.timechuo(startTime).indexOf('-')==0){ if (util.timechuo(startTime).indexOf('-')==0){
that.setData({ that.setData({
[flags]: "end", [flags]: "end",
[endtime]: util.timechuo(startTime)
[endtime]: util.timechuo(startTime),
[alsells]: alsell
}); });
} }
else{ else{
that.setData({ that.setData({
[endtime]: util.timechuo(startTime)
[endtime]: util.timechuo(startTime),
[alsells]: alsell
}); });
} }
} }


+ 7
- 6
pages/rushToBuy/index.wxml 查看文件

@@ -1,6 +1,6 @@
<!-- 限时抢购 查看更多对应的页面 --> <!-- 限时抢购 查看更多对应的页面 -->
<view class='flashSale'> <view class='flashSale'>
<view wx:for="{{list}}" wx:if="{{item.targetA!='end'}}" class='flashSaleItemWrap' wx:key="index">
<view wx:for="{{list}}" wx:if="{{item.targetA!='end'}}" class='flashSaleItemWrap' wx:key="index">
<view class='flashSaleItem'> <view class='flashSaleItem'>
<view class='flashSaleItemTop'> <view class='flashSaleItemTop'>
<view class='flashSaleItemTopL'> <view class='flashSaleItemTopL'>
@@ -16,7 +16,7 @@
</view> </view>
</view> </view>
</view> </view>
<image class='lines' src='./../../assets/img/lines.png' mode='widthFix'></image>
<image class='lines' src='./../../assets/img/lines.png' mode='widthFix'></image>
<view class='flashSaleItemBottom'> <view class='flashSaleItemBottom'>
<view class='flashSaleItemBottomTop'> <view class='flashSaleItemBottomTop'>
<text class='remainingTime'>距结束:</text> <text class='remainingTime'>距结束:</text>
@@ -25,11 +25,12 @@
</view> </view>
<view class='flashSaleItemBottomBottm'> <view class='flashSaleItemBottomBottm'>
<view class="view1"> <view class="view1">
<text class="remainingNumber">剩余:</text>
<text class='realnumber'>{{item.remainInventory}}张</text>
<text class="remainingNumber">已售{{item.alsells}}%</text>
<progress percent="{{(item.inventory-item.remainInventory)/item.inventory*100}}" stroke-width="6" activeColor="#ff4949" />
</view> </view>
<view class='buy' data-couponId="{{item.couponId}}" data-couponChannelId="{{item.id}}" data-targetAd="{{item.targetAd}}" bindtap="gotodetail" hover-class='active' wx:if="{{item.salePriceStr!=0}}">购买</view>
<view class='buy' data-couponId="{{item.couponId}}" data-couponChannelId="{{item.id}}" data-targetAd="{{item.targetAd}}" bindtap="gotodetail" hover-class='active' wx:if="{{item.salePriceStr==0}}">领取</view>
<view class='buy' data-couponId="{{item.couponId}}" data-couponChannelId="{{item.id}}" data-targetAd="{{item.targetAd}}" bindtap="gotodetail" hover-class='active' wx:if="{{item.salePriceStr!=0}}">马上购</view>
<view class='buy' data-couponId="{{item.couponId}}" data-couponChannelId="{{item.id}}" data-targetAd="{{item.targetAd}}" bindtap="gotodetail" hover-class='active' wx:if="{{item.salePriceStr==0&&item.remainInventory!=0}}">立即领</view>
<view class='buy' data-couponId="{{item.couponId}}" data-couponChannelId="{{item.id}}" data-targetAd="{{item.targetAd}}" bindtap="gotodetail" hover-class='active' style='background:#999;color:#fff;border:1px solid #999;' wx:if="{{item.salePriceStr==0&&item.remainInventory==0}}">已售罄</view>
<view class='buy' wx:if="{{item.flags=='end'}}" style='background:#999;color:#fff;border:1px solid #999;'>已结束</view> <view class='buy' wx:if="{{item.flags=='end'}}" style='background:#999;color:#fff;border:1px solid #999;'>已结束</view>
</view> </view>
</view> </view>


+ 9
- 2
pages/rushToBuy/index.wxss 查看文件

@@ -120,14 +120,15 @@
} }
.view1 { .view1 {
width: 550rpx;
width: 350rpx;
display: block; display: block;
line-height: 33rpx; line-height: 33rpx;
} }
.remainingNumber { .remainingNumber {
font-size: 28rpx;
font-size: 26rpx;
color: #b4b4b4; color: #b4b4b4;
margin-right: 10rpx;
} }
.realnumber { .realnumber {
@@ -174,3 +175,9 @@
color: #ff4949; color: #ff4949;
border: 2rpx solid #ff4949; border: 2rpx solid #ff4949;
} }
progress{
display: inline-block;
width: 200rpx;
border-radius:60rpx;
overflow: hidden;
}

+ 5
- 0
pages/user/index.js 查看文件

@@ -65,6 +65,11 @@ Page({
} }
console.log(that.data.flag) console.log(that.data.flag)
}, },
gotoedit:function(){
wx.navigateTo({
url: '/pages/edit/edit',
})
},
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */


+ 5
- 4
pages/user/index.wxml 查看文件

@@ -6,15 +6,16 @@
<view class="user-avatar"> <view class="user-avatar">
<open-data class="open" type="userAvatarUrl"></open-data> <open-data class="open" type="userAvatarUrl"></open-data>
</view> </view>
<view class="user-phone">
<view class="user-phone" bindtap='gotoedit'>
<open-data type="userNickName"></open-data> <open-data type="userNickName"></open-data>
<view class='chengzhang'>等级:{{levelName}}</view>
<view class='chengzhang'>点击编辑资料</view>
</view> </view>
<view class='chengzhang1' bindtap='gotograde'> <view class='chengzhang1' bindtap='gotograde'>
<text style="color:#01bffe;">当前成长值</text>
<view class="view">{{score}} <view class="view">{{score}}
<image src='./../../assets/img/shang.png' mode="widthFix"></image> <image src='./../../assets/img/shang.png' mode="widthFix"></image>
</view> </view>
<text>成长值</text>
<text>{{levelName}}</text>
</view> </view>
</view> </view>
<view class="user-btns"> <view class="user-btns">
@@ -67,7 +68,7 @@
<view class="margin"></view> <view class="margin"></view>
<!-- <button bindtap="navigateTo" class="user-out-btn">退出登陆</button> --> <!-- <button bindtap="navigateTo" class="user-out-btn">退出登陆</button> -->
<view bindlongtap='showVersion' class='version'> <view bindlongtap='showVersion' class='version'>
<view wx:if="{{flag=='show'}}">版本号:2.1.4</view>
<view wx:if="{{flag=='show'}}">版本号:2.1.8</view>
<view wx:if="{{flag=='hidden'}}"></view> <view wx:if="{{flag=='hidden'}}"></view>
</view> </view>
</view> </view>


+ 2
- 2
pages/user/index.wxss 查看文件

@@ -87,7 +87,7 @@
} }


.chengzhang { .chengzhang {
font-size: 28rpx;
font-size: 22rpx;
color: #999; color: #999;
line-height: 40rpx; line-height: 40rpx;
} }
@@ -96,7 +96,7 @@
position: absolute; position: absolute;
right: 24rpx; right: 24rpx;
bottom: 0; bottom: 0;
top: 32rpx;
top: 19rpx;
} }


.chengzhang1 text { .chengzhang1 text {


Loading…
取消
儲存