作者 Lijianheng

更新个人中心模块

@@ -9,6 +9,7 @@ Page({ @@ -9,6 +9,7 @@ Page({
9 date: '2016-09-01', 9 date: '2016-09-01',
10 time: '12:01', 10 time: '12:01',
11 region: ['请选择', '请选择', '请选择'], 11 region: ['请选择', '请选择', '请选择'],
  12 + selectregion:"请选择省市区",
12 // customItem: '全部', 13 // customItem: '全部',
13 14
14 status: false, 15 status: false,
@@ -65,7 +66,6 @@ Page({ @@ -65,7 +66,6 @@ Page({
65 }) 66 })
66 }, 67 },
67 68
68 -  
69 // 获取编辑地址的信息、 69 // 获取编辑地址的信息、
70 getEditInfo() { 70 getEditInfo() {
71 71
@@ -110,6 +110,45 @@ Page({ @@ -110,6 +110,45 @@ Page({
110 add_1() { 110 add_1() {
111 111
112 let that = this; 112 let that = this;
  113 +
  114 +
  115 + // 接收信息
  116 + let name = that.data.name;
  117 + let mobile = that.data.mobile;
  118 + let province = that.data.province;
  119 + let city = that.data.city;
  120 + let county = that.data.county;
  121 + let address = that.data.address;
  122 +
  123 + // 正则表达式
  124 + //let regName = /^[\u4e00-\u9fa5]{0,}$/;
  125 + let regPhone = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
  126 + if(name ==''){
  127 + wx.showToast({
  128 + title: '请输入姓名',
  129 + icon: 'none'
  130 + })
  131 + }else if(mobile ==''){
  132 + wx.showToast({
  133 + title: '请输入手机号',
  134 + icon: 'none'
  135 + })
  136 + }else if(!regPhone.test(mobile)){
  137 + wx.showToast({
  138 + title: '请输入正确的手机号',
  139 + icon: 'none'
  140 + })
  141 + } else if (that.data.selectregion =="请选择省市区"){
  142 + wx.showToast({
  143 + title: '请选择省市区',
  144 + icon: 'none'
  145 + })
  146 + } else if (address==''){
  147 + wx.showToast({
  148 + title: '请输入详细地址',
  149 + icon: 'none'
  150 + })
  151 + }else{
113 let url = 'user/index/addressPost'; 152 let url = 'user/index/addressPost';
114 let params = { 153 let params = {
115 154
@@ -143,6 +182,9 @@ Page({ @@ -143,6 +182,9 @@ Page({
143 }).catch((err) => { 182 }).catch((err) => {
144 183
145 }) 184 })
  185 + }
  186 +
  187 +
146 }, 188 },
147 189
148 190
@@ -177,6 +219,7 @@ Page({ @@ -177,6 +219,7 @@ Page({
177 province: address_1[0], 219 province: address_1[0],
178 city: address_1[1], 220 city: address_1[1],
179 county: address_1[2], 221 county: address_1[2],
  222 + selectregion: address_1[0] + address_1[1] + address_1[2]
180 223
181 }) 224 })
182 225
@@ -13,7 +13,8 @@ @@ -13,7 +13,8 @@
13 <view class='top_item_name'>省市/区</view> 13 <view class='top_item_name'>省市/区</view>
14 <picker mode="region" bindchange="bindRegionChange" value="{{region}}" custom-item="{{customItem}}"> 14 <picker mode="region" bindchange="bindRegionChange" value="{{region}}" custom-item="{{customItem}}">
15 <view class="top_item_right"> 15 <view class="top_item_right">
16 - <view>{{region[0]}},{{region[1]}},{{region[2]}} </view> 16 + <!-- <view>{{region[0]}},{{region[1]}},{{region[2]}} </view> -->
  17 + <view>{{selectregion}}</view>
17 <!-- 箭头图片 --> 18 <!-- 箭头图片 -->
18 <view class='top_item_right_pic'> 19 <view class='top_item_right_pic'>
19 <image src='../../../img/right_1.png'></image> 20 <image src='../../../img/right_1.png'></image>
@@ -14,21 +14,54 @@ Page({ @@ -14,21 +14,54 @@ Page({
14 countDownDay: 0, 14 countDownDay: 0,
15 countDownHour: 0, 15 countDownHour: 0,
16 countDownMinute: 0, 16 countDownMinute: 0,
17 -  
18 collectList: '' 17 collectList: ''
19 }, 18 },
20 -  
21 -  
22 -  
23 -  
24 -  
25 bindViewTap: function () { 19 bindViewTap: function () {
26 wx.navigateTo({ 20 wx.navigateTo({
27 // url: '../logs/logs' 21 // url: '../logs/logs'
28 }) 22 })
29 }, 23 },
30 24
31 - 25 + //团购倒计时
  26 + countDown() {
  27 + let that = this
  28 + let objs = Object.assign([], that.data.collectList)
  29 + let now_time = parseInt(new Date().getTime())
  30 + // console.log('现在的时间:'+now_time)
  31 +
  32 + for (let obj of objs) {
  33 +
  34 + let end_time = obj.end_time * 1000
  35 + // console.log(end_time)
  36 + let open_time = obj.open_time * 1000
  37 + if (now_time < open_time) {
  38 + // console.log(333)
  39 + //活动未开始
  40 + } else if (now_time > end_time) {
  41 + // console.log(222)
  42 + //活动结束
  43 + } else {
  44 + // console.log(1111)
  45 + let time = (end_time - now_time) / 1000;
  46 + let day = parseInt(time / (60 * 60 * 24));
  47 + let hou = parseInt(time % (60 * 60 * 24) / 3600);
  48 + let min = parseInt(time % (60 * 60 * 24) % 3600 / 60);
  49 + let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60);
  50 +
  51 + obj.day = that.timeFormat(day),
  52 + obj.hou = that.timeFormat(hou),
  53 + obj.min = that.timeFormat(min),
  54 + obj.sec = that.timeFormat(sec)
  55 +
  56 + // console.log(obj.day, obj.hou, obj.min, obj.sec)
  57 + }
  58 + }
  59 + that.setData({
  60 + collectList: objs
  61 + })
  62 + console.log(that.data.collectList)
  63 + setTimeout(that.countDown, 1000);
  64 + },
32 65
33 /** 66 /**
34 * 生命周期函数--监听页面加载 67 * 生命周期函数--监听页面加载
@@ -45,7 +78,7 @@ Page({ @@ -45,7 +78,7 @@ Page({
45 let that = this; 78 let that = this;
46 let url = '/user/index/collect'; 79 let url = '/user/index/collect';
47 let params = { 80 let params = {
48 - 81 + page: 1
49 } 82 }
50 let header = { 83 let header = {
51 "XX-Token": wx.getStorageSync('token'), 84 "XX-Token": wx.getStorageSync('token'),
@@ -61,7 +94,6 @@ Page({ @@ -61,7 +94,6 @@ Page({
61 console.log(that.data.collectList) 94 console.log(that.data.collectList)
62 95
63 96
64 -  
65 }).catch((err) => { 97 }).catch((err) => {
66 98
67 }) 99 })
@@ -107,9 +139,9 @@ Page({ @@ -107,9 +139,9 @@ Page({
107 totalSecond--; 139 totalSecond--;
108 if (totalSecond < 0) { 140 if (totalSecond < 0) {
109 clearInterval(interval); 141 clearInterval(interval);
110 - wx.showToast({  
111 - title: '活动已结束',  
112 - }); 142 + // wx.showToast({
  143 + // title: '活动已结束',
  144 + // });
113 this.setData({ 145 this.setData({
114 countDownDay: '00', 146 countDownDay: '00',
115 countDownHour: '00', 147 countDownHour: '00',
@@ -118,9 +150,7 @@ Page({ @@ -118,9 +150,7 @@ Page({
118 }); 150 });
119 } 151 }
120 }.bind(this), 1000); 152 }.bind(this), 1000);
121 -  
122 }, 153 },
123 -  
124 /** 154 /**
125 * 生命周期函数--监听页面显示 155 * 生命周期函数--监听页面显示
126 */ 156 */
@@ -14,7 +14,8 @@ @@ -14,7 +14,8 @@
14 <image src='{{item.thumb}}'></image> 14 <image src='{{item.thumb}}'></image>
15 </view> 15 </view>
16 <view class='top_left_text'> 16 <view class='top_left_text'>
17 - 距结束23时59分距结束23时59分 17 + <!-- 距结束23时59分距结束23时59分 -->
  18 + 距结束{{item.hou}}小时{{item.min}}分{{item.sec}}秒
18 19
19 </view> 20 </view>
20 </view> 21 </view>
@@ -40,7 +41,7 @@ @@ -40,7 +41,7 @@
40 </view> 41 </view>
41 <!-- 右中2 --> 42 <!-- 右中2 -->
42 <view class='right_text'> 43 <view class='right_text'>
43 - 已拼300份,目标500 44 + 已拼{{item.numb}}份,目标{{item.group}}
44 </view> 45 </view>
45 <!-- 右下 --> 46 <!-- 右下 -->
46 <view class='right_bottom'> 47 <view class='right_bottom'>
@@ -85,5 +86,7 @@ @@ -85,5 +86,7 @@
85 </block> 86 </block>
86 87
87 88
  89 +
  90 +
88 </view> 91 </view>
89 </view> 92 </view>
@@ -13,23 +13,34 @@ Page({ @@ -13,23 +13,34 @@ Page({
13 img: [], 13 img: [],
14 eOrder: '', 14 eOrder: '',
15 }, 15 },
16 -  
17 /** 16 /**
18 * 生命周期函数--监听页面加载 17 * 生命周期函数--监听页面加载
19 */ 18 */
20 onLoad: function (options) { 19 onLoad: function (options) {
  20 + console.log(options)
21 that = this 21 that = this
22 - // this.evaluateOrder() 22 + this.setData({
  23 + goods_id:options.id,
  24 +
  25 + })
  26 + },
  27 + // Textarea 中输入的东西
  28 + entertext(e){
  29 + console.log(e)
  30 + this.setData({
  31 + text:e.detail.value
  32 + })
  33 + console.log(this.data.text)
23 }, 34 },
24 35
  36 + // 发表评价
25 submitComment() { 37 submitComment() {
26 -  
27 let that = this; 38 let that = this;
28 let url = 'user/index/message'; 39 let url = 'user/index/message';
29 let params = { 40 let params = {
30 goods_id : that.data.goods_id, 41 goods_id : that.data.goods_id,
31 text : that.data.text, 42 text : that.data.text,
32 - img : that.data.img.join(",") 43 + img : that.data.images.join(",")
33 } 44 }
34 let header = { 45 let header = {
35 "XX-Token": wx.getStorageSync('token'), 46 "XX-Token": wx.getStorageSync('token'),
@@ -37,14 +48,18 @@ Page({ @@ -37,14 +48,18 @@ Page({
37 } 48 }
38 app.post(url, params, header).then((res) => { 49 app.post(url, params, header).then((res) => {
39 console.log(res); 50 console.log(res);
40 - // 获取值  
41 - that.setData({  
42 - eOrder: res.data 51 + if(res==""){
  52 + wx.showToast({
  53 + title: '评价成功',
  54 + icon:'none'
43 }) 55 })
44 56
45 -  
46 -  
47 - 57 + setTimeout(function(){
  58 + wx.navigateBack({
  59 + checked:true
  60 + })
  61 + },1500)
  62 + }
48 63
49 }).catch((err) => { 64 }).catch((err) => {
50 65
@@ -67,6 +82,8 @@ Page({ @@ -67,6 +82,8 @@ Page({
67 that.setData({ 82 that.setData({
68 images: that.data.images.concat(tempFilePaths) 83 images: that.data.images.concat(tempFilePaths)
69 }); 84 });
  85 +
  86 + console.log(that.data.images)
70 } 87 }
71 }) 88 })
72 }, 89 },
1 1
2 <view class='container'> 2 <view class='container'>
3 <view class='top'> 3 <view class='top'>
4 - <textarea placeholder='宝贝满足您的期待吗?说说您的意见或者建议把!' placeholder-style='color:#999999'></textarea> 4 + <textarea placeholder='宝贝满足您的期待吗?说说您的意见或者建议把!' placeholder-style='color:#999999' bindinput="entertext"></textarea>
5 <view class='top_bottom'> 5 <view class='top_bottom'>
6 <view></view> 6 <view></view>
7 <view class='top_bottom_right'> 7 <view class='top_bottom_right'>
@@ -29,7 +29,10 @@ @@ -29,7 +29,10 @@
29 全部订单 29 全部订单
30 </view> 30 </view>
31 <view class='mid_top_right' bindtap='btn_myOrder'> 31 <view class='mid_top_right' bindtap='btn_myOrder'>
32 - 查看全部订单> 32 + 查看全部订单
  33 + <view class='mid_top_right_pic'>
  34 + <image src='../../img/right_1.png'></image>
  35 + </view>
33 </view> 36 </view>
34 </view> 37 </view>
35 <!-- 底部内容 --> 38 <!-- 底部内容 -->
@@ -108,6 +108,7 @@ page{ @@ -108,6 +108,7 @@ page{
108 font-weight:400; 108 font-weight:400;
109 color:rgba(153,153,153,1); 109 color:rgba(153,153,153,1);
110 opacity:1; 110 opacity:1;
  111 + display: flex;
111 } 112 }
112 113
113 .mid_bottom{ 114 .mid_bottom{
@@ -259,3 +260,13 @@ page{ @@ -259,3 +260,13 @@ page{
259 align-items: center; 260 align-items: center;
260 justify-content: center; 261 justify-content: center;
261 } 262 }
  263 +.mid_top_right_pic{
  264 + width:16rpx;
  265 + height:32rpx;
  266 + display:flex;
  267 + margin-left: 10rpx
  268 +}
  269 +.mid_top_right_pic image{
  270 + width: 100%;
  271 + height: 100%;
  272 +}
@@ -24,12 +24,12 @@ Page({ @@ -24,12 +24,12 @@ Page({
24 { 24 {
25 name: '待评价' 25 name: '待评价'
26 }, 26 },
27 - {  
28 - name: '已完成'  
29 - },  
30 - {  
31 - name: '已取消'  
32 - } 27 + // {
  28 + // name: '已完成'
  29 + // },
  30 + // {
  31 + // name: '已取消'
  32 + // }
33 ], 33 ],
34 currentTab: 0, 34 currentTab: 0,
35 // orderList: '', 35 // orderList: '',
@@ -38,10 +38,10 @@ Page({ @@ -38,10 +38,10 @@ Page({
38 toCancel: false, 38 toCancel: false,
39 delect_order: false, 39 delect_order: false,
40 40
  41 + // 传数据至评价订单
  42 + // goods_id:'',
  43 +
41 44
42 - //倒计时  
43 - // countDownList: [],  
44 - // actEndTimeList: []  
45 }, 45 },
46 46
47 47
@@ -52,30 +52,46 @@ Page({ @@ -52,30 +52,46 @@ Page({
52 52
53 53
54 54
55 - 55 + this.setData({
  56 + page:1,
  57 + orderList:[]
  58 + })
56 this.myOrder() 59 this.myOrder()
57 console.log(options) 60 console.log(options)
58 if (options.id == 1) { 61 if (options.id == 1) {
59 this.setData({ 62 this.setData({
60 - currentTab: 1 63 + currentTab: 1,
  64 + status:2
61 }) 65 })
  66 + this.myOrder()
62 } if (options.id == 2) { 67 } if (options.id == 2) {
63 this.setData({ 68 this.setData({
64 - currentTab: 2 69 + currentTab: 2,
  70 + status: 99
65 }) 71 })
  72 + this.myOrder()
66 } if (options.id == 3) { 73 } if (options.id == 3) {
67 this.setData({ 74 this.setData({
68 - currentTab: 3 75 + currentTab: 3,
  76 + status: 3
69 }) 77 })
  78 + this.myOrder()
70 } if (options.id == 4) { 79 } if (options.id == 4) {
71 this.setData({ 80 this.setData({
72 - currentTab: 4 81 + currentTab: 4,
  82 + status: 1
73 }) 83 })
  84 + this.myOrder();
  85 + console.log(this.data.orderList)
74 } if (options.id == 5) { 86 } if (options.id == 5) {
75 this.setData({ 87 this.setData({
76 - currentTab: 5 88 + currentTab: 5,
  89 + status: 1
77 }) 90 })
  91 + this.myOrder()
78 } 92 }
  93 +
  94 + console.log(this.data.orderList)
79 }, 95 },
80 timeFormat(param) { //小于10的格式化函数 96 timeFormat(param) { //小于10的格式化函数
81 return param < 10 ? '0' + param : param; 97 return param < 10 ? '0' + param : param;
@@ -147,14 +163,10 @@ Page({ @@ -147,14 +163,10 @@ Page({
147 that.setData({ 163 that.setData({
148 orderList: objs 164 orderList: objs
149 }) 165 })
150 - console.log(that.data.orderList) 166 +
151 setTimeout(that.countDown, 1000); 167 setTimeout(that.countDown, 1000);
152 }, 168 },
153 169
154 -  
155 -  
156 -  
157 -  
158 navbarTap: function (e) { 170 navbarTap: function (e) {
159 console.log(88) 171 console.log(88)
160 let that = this; 172 let that = this;
@@ -246,27 +258,19 @@ Page({ @@ -246,27 +258,19 @@ Page({
246 that.myOrder() 258 that.myOrder()
247 } 259 }
248 }, 260 },
249 - //评价按钮  
250 - btn_eOrder(e) {  
251 - console.log(e);  
252 - let id=e.currentTab.dataset.id 261 +
  262 + //去评价
  263 + goevalute(e) {
  264 + console.log(e)
  265 + let id = e.currentTarget.dataset.id
  266 + console.log('id为。。。' + id)
  267 +
253 wx.navigateTo({ 268 wx.navigateTo({
254 - url: '/pages/mine/eOrder/eOrder?id='+id, 269 + url: '/pages/mine/eOrder/eOrder?id=' + id ,
255 }) 270 })
256 }, 271 },
257 272
258 -  
259 // 删除订单 273 // 删除订单
260 - // delectOrder(){  
261 - // this.setData({  
262 - // delect_order:true  
263 - // })  
264 - // },  
265 - // toDelect(){  
266 - // this.setData({  
267 - // delect_order:false  
268 - // })  
269 - // },  
270 toDelect(){ 274 toDelect(){
271 this.setData({ 275 this.setData({
272 delect_order:true 276 delect_order:true
@@ -89,12 +89,12 @@ @@ -89,12 +89,12 @@
89 </view> 89 </view>
90 <view class='mid_item_bottom_rig' wx:if="{{item.goods_status==2}}"> 90 <view class='mid_item_bottom_rig' wx:if="{{item.goods_status==2}}">
91 <view class='bottom_btn_left' bindtap='cancelOrder'>取消订单</view> 91 <view class='bottom_btn_left' bindtap='cancelOrder'>取消订单</view>
92 - <view class='bottom_btn_right'>立即付款</view> 92 + <view class='bottom_btn_right' >立即付款</view>
93 </view> 93 </view>
94 94
95 <view wx:if="{{item.goods_status==1}}"> 95 <view wx:if="{{item.goods_status==1}}">
96 <view class='mid_item_bottom_rig' wx:if="{{item.message_id==0}}"> 96 <view class='mid_item_bottom_rig' wx:if="{{item.message_id==0}}">
97 - <view class='bottom_btn_left' bindtap='cancelOrder'>去评价</view> 97 + <view class='bottom_btn_left' bindtap='goevalute' data-id="{{item.goods_id}}">去评价</view>
98 <view class='bottom_btn_right'>确认订单</view> 98 <view class='bottom_btn_right'>确认订单</view>
99 </view> 99 </view>
100 100
@@ -181,7 +181,7 @@ @@ -181,7 +181,7 @@
181 </view> 181 </view>
182 <view class='mid_item_bottom_rig'> 182 <view class='mid_item_bottom_rig'>
183 <view class='bottom_btn_left' bindtap='cancelOrder' >取消订单</view> 183 <view class='bottom_btn_left' bindtap='cancelOrder' >取消订单</view>
184 - <view class='bottom_btn_right'>立即付款</view> 184 + <view class='bottom_btn_right' >立即付款</view>
185 </view> 185 </view>
186 </view> 186 </view>
187 </view> 187 </view>
@@ -229,18 +229,12 @@ @@ -229,18 +229,12 @@
229 </view> 229 </view>
230 <!-- 百分比 --> 230 <!-- 百分比 -->
231 <view class='mid_right_m'> 231 <view class='mid_right_m'>
232 - <view class='right_m_left'>  
233 - <view class='right_m_left_content'></view>  
234 - </view>  
235 -  
236 - <view class='right_m_right'>  
237 - 42%  
238 - </view> 232 + <progress percent="{{item.percent}}" show-info color="#B5DE96" border-radius="8" font-size="24rpx" stroke-width="16rpx" />
239 </view> 233 </view>
240 <!-- 拼团份数 --> 234 <!-- 拼团份数 -->
241 <view class='mid_right_bottom'> 235 <view class='mid_right_bottom'>
242 <view class='mid_right_bottom_lef'> 236 <view class='mid_right_bottom_lef'>
243 - 已拼300份,目标500 237 + 已拼{{item.numb}}份,目标{{item.group}}
244 </view> 238 </view>
245 <view class='mid_right_bottom_rig'> 239 <view class='mid_right_bottom_rig'>
246 {{item.goods_numb}} 240 {{item.goods_numb}}
@@ -372,7 +366,7 @@ @@ -372,7 +366,7 @@
372 366
373 </view> 367 </view>
374 <view class='mid_item_bottom_rig'> 368 <view class='mid_item_bottom_rig'>
375 - <view class='bottom_btn_left'>查看物流</view> 369 + <view class='bottom_btn_left'></view>
376 <view class='bottom_btn_right'>确认订单</view> 370 <view class='bottom_btn_right'>确认订单</view>
377 </view> 371 </view>
378 </view> 372 </view>
@@ -383,6 +377,9 @@ @@ -383,6 +377,9 @@
383 </view> 377 </view>
384 <!-- 待评价 --> 378 <!-- 待评价 -->
385 <view class='mid_item' wx:if='{{currentTab == 5}}' wx:for='{{orderList}}' wx:key=''> 379 <view class='mid_item' wx:if='{{currentTab == 5}}' wx:for='{{orderList}}' wx:key=''>
  380 +
  381 +
  382 + <view wx:if="{{item.message_id==1}}">
386 <!-- 上 --> 383 <!-- 上 -->
387 <view class='mid_item_top' > 384 <view class='mid_item_top' >
388 <!-- 订单号 --> 385 <!-- 订单号 -->
@@ -442,11 +439,13 @@ @@ -442,11 +439,13 @@
442 439
443 </view> 440 </view>
444 <view class='mid_item_bottom_rig'> 441 <view class='mid_item_bottom_rig'>
445 - <view class='bottom_btn_left' bindtap='btn_eOrder' data-id="{{item.goods_id}}">去评价</view> 442 + <view class='bottom_btn_left' bindtap='goevalute' data-id="{{item.goods_id}}">去评价</view>
446 <view class='bottom_btn_right'>确认订单</view> 443 <view class='bottom_btn_right'>确认订单</view>
447 </view> 444 </view>
448 </view> 445 </view>
449 </view> 446 </view>
  447 +
  448 + </view>
450 <!-- 已完成 --> 449 <!-- 已完成 -->
451 <view class='mid_item' wx:if='{{currentTab == 6}}' wx:for='{{orderList}}' wx:key=''> 450 <view class='mid_item' wx:if='{{currentTab == 6}}' wx:for='{{orderList}}' wx:key=''>
452 <!-- 上 --> 451 <!-- 上 -->