作者 Lijianheng

更新个人中心模块

... ... @@ -9,6 +9,7 @@ Page({
date: '2016-09-01',
time: '12:01',
region: ['请选择', '请选择', '请选择'],
selectregion:"请选择省市区",
// customItem: '全部',
status: false,
... ... @@ -65,7 +66,6 @@ Page({
})
},
// 获取编辑地址的信息、
getEditInfo() {
... ... @@ -110,39 +110,81 @@ Page({
add_1() {
let that = this;
let url = 'user/index/addressPost';
let params = {
address_id: that.data.address_id,
name: that.data.name,
mobile: that.data.mobile,
status: that.data.type,
province: that.data.province,
city: that.data.city,
county: that.data.county,
address: that.data.address
}
let header = {
"XX-Token": wx.getStorageSync('token'),
"XX-Device-Type": 'wxapp'
}
app.post(url, params, header).then((res) => {
console.log(res);
// 接收信息
let name = that.data.name;
let mobile = that.data.mobile;
let province = that.data.province;
let city = that.data.city;
let county = that.data.county;
let address = that.data.address;
// 正则表达式
//let regName = /^[\u4e00-\u9fa5]{0,}$/;
let regPhone = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
if(name ==''){
wx.showToast({
title: '请输入姓名',
icon: 'none'
})
}else if(mobile ==''){
wx.showToast({
title: '请输入手机号',
icon: 'none'
})
}else if(!regPhone.test(mobile)){
wx.showToast({
title: '请输入正确的手机号',
icon: 'none'
})
} else if (that.data.selectregion =="请选择省市区"){
wx.showToast({
title: '请选择省市区',
icon: 'none'
})
} else if (address==''){
wx.showToast({
title: '保存成功',
icon: "none",
duration: 1500
title: '请输入详细地址',
icon: 'none'
})
setTimeout(function () {
wx.navigateTo({
url: '/pages/mine/addr_1/addr_1',
}else{
let url = 'user/index/addressPost';
let params = {
address_id: that.data.address_id,
name: that.data.name,
mobile: that.data.mobile,
status: that.data.type,
province: that.data.province,
city: that.data.city,
county: that.data.county,
address: that.data.address
}
let header = {
"XX-Token": wx.getStorageSync('token'),
"XX-Device-Type": 'wxapp'
}
app.post(url, params, header).then((res) => {
console.log(res);
wx.showToast({
title: '保存成功',
icon: "none",
duration: 1500
})
}, 1000)
setTimeout(function () {
wx.navigateTo({
url: '/pages/mine/addr_1/addr_1',
})
}, 1000)
}).catch((err) => {
}).catch((err) => {
})
})
}
},
... ... @@ -177,6 +219,7 @@ Page({
province: address_1[0],
city: address_1[1],
county: address_1[2],
selectregion: address_1[0] + address_1[1] + address_1[2]
})
... ...
... ... @@ -13,7 +13,8 @@
<view class='top_item_name'>省市/区</view>
<picker mode="region" bindchange="bindRegionChange" value="{{region}}" custom-item="{{customItem}}">
<view class="top_item_right">
<view>{{region[0]}},{{region[1]}},{{region[2]}} </view>
<!-- <view>{{region[0]}},{{region[1]}},{{region[2]}} </view> -->
<view>{{selectregion}}</view>
<!-- 箭头图片 -->
<view class='top_item_right_pic'>
<image src='../../../img/right_1.png'></image>
... ...
... ... @@ -14,21 +14,54 @@ Page({
countDownDay: 0,
countDownHour: 0,
countDownMinute: 0,
collectList: ''
},
bindViewTap: function () {
wx.navigateTo({
// url: '../logs/logs'
})
},
//团购倒计时
countDown() {
let that = this
let objs = Object.assign([], that.data.collectList)
let now_time = parseInt(new Date().getTime())
// console.log('现在的时间:'+now_time)
for (let obj of objs) {
let end_time = obj.end_time * 1000
// console.log(end_time)
let open_time = obj.open_time * 1000
if (now_time < open_time) {
// console.log(333)
//活动未开始
} else if (now_time > end_time) {
// console.log(222)
//活动结束
} else {
// console.log(1111)
let time = (end_time - now_time) / 1000;
let day = parseInt(time / (60 * 60 * 24));
let hou = parseInt(time % (60 * 60 * 24) / 3600);
let min = parseInt(time % (60 * 60 * 24) % 3600 / 60);
let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60);
obj.day = that.timeFormat(day),
obj.hou = that.timeFormat(hou),
obj.min = that.timeFormat(min),
obj.sec = that.timeFormat(sec)
// console.log(obj.day, obj.hou, obj.min, obj.sec)
}
}
that.setData({
collectList: objs
})
console.log(that.data.collectList)
setTimeout(that.countDown, 1000);
},
/**
* 生命周期函数--监听页面加载
... ... @@ -45,7 +78,7 @@ Page({
let that = this;
let url = '/user/index/collect';
let params = {
page: 1
}
let header = {
"XX-Token": wx.getStorageSync('token'),
... ... @@ -61,7 +94,6 @@ Page({
console.log(that.data.collectList)
}).catch((err) => {
})
... ... @@ -107,9 +139,9 @@ Page({
totalSecond--;
if (totalSecond < 0) {
clearInterval(interval);
wx.showToast({
title: '活动已结束',
});
// wx.showToast({
// title: '活动已结束',
// });
this.setData({
countDownDay: '00',
countDownHour: '00',
... ... @@ -118,9 +150,7 @@ Page({
});
}
}.bind(this), 1000);
},
/**
* 生命周期函数--监听页面显示
*/
... ...
... ... @@ -14,7 +14,8 @@
<image src='{{item.thumb}}'></image>
</view>
<view class='top_left_text'>
距结束23时59分距结束23时59分
<!-- 距结束23时59分距结束23时59分 -->
距结束{{item.hou}}小时{{item.min}}分{{item.sec}}秒
</view>
</view>
... ... @@ -40,7 +41,7 @@
</view>
<!-- 右中2 -->
<view class='right_text'>
已拼300份,目标500
已拼{{item.numb}}份,目标{{item.group}}
</view>
<!-- 右下 -->
<view class='right_bottom'>
... ... @@ -84,6 +85,8 @@
</view>
</block>
</view>
</view>
\ No newline at end of file
... ...
... ... @@ -13,23 +13,34 @@ Page({
img: [],
eOrder: '',
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log(options)
that = this
// this.evaluateOrder()
this.setData({
goods_id:options.id,
})
},
// Textarea 中输入的东西
entertext(e){
console.log(e)
this.setData({
text:e.detail.value
})
console.log(this.data.text)
},
// 发表评价
submitComment() {
let that = this;
let url = 'user/index/message';
let params = {
goods_id : that.data.goods_id,
text : that.data.text,
img : that.data.img.join(",")
img : that.data.images.join(",")
}
let header = {
"XX-Token": wx.getStorageSync('token'),
... ... @@ -37,14 +48,18 @@ Page({
}
app.post(url, params, header).then((res) => {
console.log(res);
// 获取值
that.setData({
eOrder: res.data
})
if(res==""){
wx.showToast({
title: '评价成功',
icon:'none'
})
setTimeout(function(){
wx.navigateBack({
checked:true
})
},1500)
}
}).catch((err) => {
... ... @@ -67,6 +82,8 @@ Page({
that.setData({
images: that.data.images.concat(tempFilePaths)
});
console.log(that.data.images)
}
})
},
... ...
<view class='container'>
<view class='top'>
<textarea placeholder='宝贝满足您的期待吗?说说您的意见或者建议把!' placeholder-style='color:#999999'></textarea>
<textarea placeholder='宝贝满足您的期待吗?说说您的意见或者建议把!' placeholder-style='color:#999999' bindinput="entertext"></textarea>
<view class='top_bottom'>
<view></view>
<view class='top_bottom_right'>
... ...
... ... @@ -29,7 +29,10 @@
全部订单
</view>
<view class='mid_top_right' bindtap='btn_myOrder'>
查看全部订单>
查看全部订单
<view class='mid_top_right_pic'>
<image src='../../img/right_1.png'></image>
</view>
</view>
</view>
<!-- 底部内容 -->
... ...
... ... @@ -108,6 +108,7 @@ page{
font-weight:400;
color:rgba(153,153,153,1);
opacity:1;
display: flex;
}
.mid_bottom{
... ... @@ -259,3 +260,13 @@ page{
align-items: center;
justify-content: center;
}
.mid_top_right_pic{
width:16rpx;
height:32rpx;
display:flex;
margin-left: 10rpx
}
.mid_top_right_pic image{
width: 100%;
height: 100%;
}
... ...
... ... @@ -24,12 +24,12 @@ Page({
{
name: '待评价'
},
{
name: '已完成'
},
{
name: '已取消'
}
// {
// name: '已完成'
// },
// {
// name: '已取消'
// }
],
currentTab: 0,
// orderList: '',
... ... @@ -38,10 +38,10 @@ Page({
toCancel: false,
delect_order: false,
// 传数据至评价订单
// goods_id:'',
//倒计时
// countDownList: [],
// actEndTimeList: []
},
... ... @@ -52,30 +52,46 @@ Page({
this.setData({
page:1,
orderList:[]
})
this.myOrder()
console.log(options)
if (options.id == 1) {
this.setData({
currentTab: 1
currentTab: 1,
status:2
})
this.myOrder()
} if (options.id == 2) {
this.setData({
currentTab: 2
currentTab: 2,
status: 99
})
this.myOrder()
} if (options.id == 3) {
this.setData({
currentTab: 3
currentTab: 3,
status: 3
})
this.myOrder()
} if (options.id == 4) {
this.setData({
currentTab: 4
currentTab: 4,
status: 1
})
this.myOrder();
console.log(this.data.orderList)
} if (options.id == 5) {
this.setData({
currentTab: 5
currentTab: 5,
status: 1
})
this.myOrder()
}
console.log(this.data.orderList)
},
timeFormat(param) { //小于10的格式化函数
return param < 10 ? '0' + param : param;
... ... @@ -147,14 +163,10 @@ Page({
that.setData({
orderList: objs
})
console.log(that.data.orderList)
setTimeout(that.countDown, 1000);
},
navbarTap: function (e) {
console.log(88)
let that = this;
... ... @@ -246,27 +258,19 @@ Page({
that.myOrder()
}
},
//评价按钮
btn_eOrder(e) {
console.log(e);
let id=e.currentTab.dataset.id
//去评价
goevalute(e) {
console.log(e)
let id = e.currentTarget.dataset.id
console.log('id为。。。' + id)
wx.navigateTo({
url: '/pages/mine/eOrder/eOrder?id='+id,
url: '/pages/mine/eOrder/eOrder?id=' + id ,
})
},
// 删除订单
// delectOrder(){
// this.setData({
// delect_order:true
// })
// },
// toDelect(){
// this.setData({
// delect_order:false
// })
// },
toDelect(){
this.setData({
delect_order:true
... ...
... ... @@ -89,12 +89,12 @@
</view>
<view class='mid_item_bottom_rig' wx:if="{{item.goods_status==2}}">
<view class='bottom_btn_left' bindtap='cancelOrder'>取消订单</view>
<view class='bottom_btn_right'>立即付款</view>
<view class='bottom_btn_right' >立即付款</view>
</view>
<view wx:if="{{item.goods_status==1}}">
<view class='mid_item_bottom_rig' wx:if="{{item.message_id==0}}">
<view class='bottom_btn_left' bindtap='cancelOrder'>去评价</view>
<view class='bottom_btn_left' bindtap='goevalute' data-id="{{item.goods_id}}">去评价</view>
<view class='bottom_btn_right'>确认订单</view>
</view>
... ... @@ -181,7 +181,7 @@
</view>
<view class='mid_item_bottom_rig'>
<view class='bottom_btn_left' bindtap='cancelOrder' >取消订单</view>
<view class='bottom_btn_right'>立即付款</view>
<view class='bottom_btn_right' >立即付款</view>
</view>
</view>
</view>
... ... @@ -229,18 +229,12 @@
</view>
<!-- 百分比 -->
<view class='mid_right_m'>
<view class='right_m_left'>
<view class='right_m_left_content'></view>
</view>
<view class='right_m_right'>
42%
</view>
<progress percent="{{item.percent}}" show-info color="#B5DE96" border-radius="8" font-size="24rpx" stroke-width="16rpx" />
</view>
<!-- 拼团份数 -->
<view class='mid_right_bottom'>
<view class='mid_right_bottom_lef'>
已拼300份,目标500
已拼{{item.numb}}份,目标{{item.group}}
</view>
<view class='mid_right_bottom_rig'>
{{item.goods_numb}}
... ... @@ -372,7 +366,7 @@
</view>
<view class='mid_item_bottom_rig'>
<view class='bottom_btn_left'>查看物流</view>
<view class='bottom_btn_left'></view>
<view class='bottom_btn_right'>确认订单</view>
</view>
</view>
... ... @@ -383,7 +377,10 @@
</view>
<!-- 待评价 -->
<view class='mid_item' wx:if='{{currentTab == 5}}' wx:for='{{orderList}}' wx:key=''>
<!-- 上 -->
<view wx:if="{{item.message_id==1}}">
<!-- 上 -->
<view class='mid_item_top' >
<!-- 订单号 -->
<view class='mid_item_top_left'>
... ... @@ -442,11 +439,13 @@
</view>
<view class='mid_item_bottom_rig'>
<view class='bottom_btn_left' bindtap='btn_eOrder' data-id="{{item.goods_id}}">去评价</view>
<view class='bottom_btn_left' bindtap='goevalute' data-id="{{item.goods_id}}">去评价</view>
<view class='bottom_btn_right'>确认订单</view>
</view>
</view>
</view>
</view>
<!-- 已完成 -->
<view class='mid_item' wx:if='{{currentTab == 6}}' wx:for='{{orderList}}' wx:key=''>
<!-- 上 -->
... ...