Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop
Showing
11 changed files
with
206 additions
and
51 deletions
@@ -160,15 +160,24 @@ class UserData | @@ -160,15 +160,24 @@ class UserData | ||
160 | */ | 160 | */ |
161 | public static function couponData($uid, $status, $page = 1, $limit = 10) | 161 | public static function couponData($uid, $status, $page = 1, $limit = 10) |
162 | { | 162 | { |
163 | + $urlList = array(); | ||
164 | + | ||
163 | $param = Yohobuy::param(); | 165 | $param = Yohobuy::param(); |
164 | $param['method'] = 'app.coupons.li'; | 166 | $param['method'] = 'app.coupons.li'; |
165 | $param['uid'] = $uid; | 167 | $param['uid'] = $uid; |
166 | - $param['status'] = $status; | 168 | + $param['status'] = 0; |
167 | $param['page'] = $page; | 169 | $param['page'] = $page; |
168 | $param['limit'] = $limit; | 170 | $param['limit'] = $limit; |
171 | + | ||
169 | $param['client_secret'] = Sign::getSign($param); | 172 | $param['client_secret'] = Sign::getSign($param); |
173 | + $urlList['unused'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param); | ||
170 | 174 | ||
171 | - return Yohobuy::get(Yohobuy::API_URL, $param); | 175 | + unset($param['client_secret']); |
176 | + $param['status'] = 1; | ||
177 | + $param['client_secret'] = Sign::getSign($param); | ||
178 | + $urlList['used'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param); | ||
179 | + | ||
180 | + return Yohobuy::getMulti($urlList); | ||
172 | } | 181 | } |
173 | 182 | ||
174 | /** | 183 | /** |
@@ -224,7 +233,7 @@ class UserData | @@ -224,7 +233,7 @@ class UserData | ||
224 | $param['consignee'] = $consignee; | 233 | $param['consignee'] = $consignee; |
225 | $param['email'] = $email; | 234 | $param['email'] = $email; |
226 | 235 | ||
227 | - if ($id !== null) { // 修改 | 236 | + if (!empty($id)) { // 修改 |
228 | $param['id'] = $id; | 237 | $param['id'] = $id; |
229 | $param['method'] = 'app.address.update'; | 238 | $param['method'] = 'app.address.update'; |
230 | } else { // 添加 | 239 | } else { // 添加 |
static/js/me/address.js
0 → 100644
1 | +/** | ||
2 | + * 地址管理 | ||
3 | + * @author: bikai<kai.bi@yoho.cn> | ||
4 | + * @date: 2015/11/17 | ||
5 | + */ | ||
6 | + | ||
7 | +var $ = require('jquery'), | ||
8 | + tip = require('../plugin/tip'); | ||
9 | + | ||
10 | +var $action = $('.action'), | ||
11 | + $addressForm = $('.edit-address'), | ||
12 | + $submit = $('.submit'), | ||
13 | + $addAddress = $('.add-address'), | ||
14 | + $editAddressPage = $('.my-edit-address-page'), | ||
15 | + $addressListPage = $('.my-address-list-page'), | ||
16 | + $area = $('.area'), | ||
17 | + $footer = $('#yoho-footer'), | ||
18 | + isSubmiting, | ||
19 | + newArea = []; | ||
20 | + | ||
21 | +function editAddress(data) { | ||
22 | + data = data || {}; | ||
23 | + $addressForm.find('[name="id"]').val(data.id || ''); | ||
24 | + $addressForm.find('[name="consignee"]').val(data.consignee || ''); | ||
25 | + $addressForm.find('[name="mobile"]').val(data.mobile || ''); | ||
26 | + $addressForm.find('[name="area_code"]').val(data.areaCode || ''); | ||
27 | + $addressForm.find('[name="area"]').val(data.area || ''); | ||
28 | + $addressForm.find('[name="address"]').val(data.address || ''); | ||
29 | + $editAddressPage.show(); | ||
30 | + $addressForm.find('[name="consignee"]').focus(); | ||
31 | +} | ||
32 | + | ||
33 | +function deleteAddress(data) { | ||
34 | + | ||
35 | +} | ||
36 | + | ||
37 | +// 添加地址 | ||
38 | +$addAddress.on('touchend', function() { | ||
39 | + editAddress(); | ||
40 | +}); | ||
41 | + | ||
42 | +// 编辑或删除 | ||
43 | +$action.on('touchend', '.edit', function() { | ||
44 | + editAddress($(this).data()); | ||
45 | +}).on('touchend', '.del', function() { | ||
46 | + deleteAddress(); | ||
47 | +}); | ||
48 | + | ||
49 | +$submit.on('touchend', function() { | ||
50 | + $addressForm.submit(); | ||
51 | + return false; | ||
52 | +}); | ||
53 | + | ||
54 | +$addressForm.on('submit', function() { | ||
55 | + if (isSubmiting) { | ||
56 | + return false; | ||
57 | + } | ||
58 | + isSubmiting = true; | ||
59 | + $.ajax({ | ||
60 | + method: 'POST', | ||
61 | + url: '/home/saveaddress', | ||
62 | + data: $(this).serialize() | ||
63 | + }).then(function(res) { | ||
64 | + if ($.type(res) !== 'object') { | ||
65 | + res = {}; | ||
66 | + } | ||
67 | + if (res.code !== 200) { | ||
68 | + tip.show(res.message || '网络出了点问题~'); | ||
69 | + } else { | ||
70 | + window.location.reload(); | ||
71 | + } | ||
72 | + }).fail(function() { | ||
73 | + tip.show('网络出了点问题~'); | ||
74 | + }).always(function() { | ||
75 | + isSubmiting = false; | ||
76 | + }); | ||
77 | + return false; | ||
78 | +}); | ||
79 | + | ||
80 | +// 省市区 | ||
81 | +$area.on('touchend', function() { | ||
82 | + $footer.hide(); | ||
83 | + $addressListPage.show(); | ||
84 | +}); | ||
85 | + | ||
86 | +$addressListPage.on('touchend', '.address', function() { | ||
87 | + newArea.push($(this).children('.caption').text()); | ||
88 | + $(this).siblings().hide(); | ||
89 | + $(this).children('ul').show(); | ||
90 | + return false; | ||
91 | +}).on('touchend', '.address-last', function() { | ||
92 | + | ||
93 | + // 填结果到 html | ||
94 | + newArea.push($(this).children('.caption').text()); | ||
95 | + $('[name="area"]').val(newArea.join(' ')); | ||
96 | + $('[name="area_code"]').val($(this).data('id')); | ||
97 | + | ||
98 | + // 恢复默认的三级选择 | ||
99 | + $addressListPage.hide(); | ||
100 | + $addressListPage.find('ul').hide(); | ||
101 | + $addressListPage.children('ul').show().children('li').show(); | ||
102 | + $footer.show(); | ||
103 | + newArea = []; | ||
104 | + return false; | ||
105 | +}); |
@@ -102,7 +102,7 @@ | @@ -102,7 +102,7 @@ | ||
102 | .my-edit-address-page { | 102 | .my-edit-address-page { |
103 | position: absolute; | 103 | position: absolute; |
104 | bottom: 0; | 104 | bottom: 0; |
105 | - top: pxToRem(90px); | 105 | + top: 0; |
106 | width: 100%; | 106 | width: 100%; |
107 | color: #d0d0d0; | 107 | color: #d0d0d0; |
108 | background: #f0f0f0; | 108 | background: #f0f0f0; |
@@ -157,7 +157,7 @@ | @@ -157,7 +157,7 @@ | ||
157 | 157 | ||
158 | textarea { | 158 | textarea { |
159 | height: pxToRem(58px) * 2; | 159 | height: pxToRem(58px) * 2; |
160 | - padding: pxToRem(20px) pxToRem(10px); | 160 | + padding: pxToRem(20px) 0; |
161 | } | 161 | } |
162 | } | 162 | } |
163 | 163 | ||
@@ -171,4 +171,32 @@ | @@ -171,4 +171,32 @@ | ||
171 | font-size: pxToRem(32px); | 171 | font-size: pxToRem(32px); |
172 | line-height: pxToRem(88px); | 172 | line-height: pxToRem(88px); |
173 | } | 173 | } |
174 | -} | ||
174 | +} | ||
175 | + | ||
176 | +.my-address-list-page { | ||
177 | + position: absolute; | ||
178 | + bottom: 0; | ||
179 | + top: 0; | ||
180 | + width: 100%; | ||
181 | + color: #444; | ||
182 | + background: #fff; | ||
183 | + | ||
184 | + li { | ||
185 | + padding: 0 pxToRem(30px); | ||
186 | + font-size: pxToRem(32px); | ||
187 | + line-height: pxToRem(88px); | ||
188 | + border-bottom: 1px solid #e0e0e0; | ||
189 | + .iconfont { | ||
190 | + float: right; | ||
191 | + color: #d0d0d0; | ||
192 | + } | ||
193 | + ul { | ||
194 | + display: none; | ||
195 | + position: absolute; | ||
196 | + top: 0; | ||
197 | + left: 0; | ||
198 | + background: #fff; | ||
199 | + width: 100%; | ||
200 | + } | ||
201 | + } | ||
202 | +} |
@@ -6,7 +6,7 @@ | @@ -6,7 +6,7 @@ | ||
6 | <span class="tel">{{mobile}}</span> | 6 | <span class="tel">{{mobile}}</span> |
7 | <p class="address-info">{{area}} {{address}}</p> | 7 | <p class="address-info">{{area}} {{address}}</p> |
8 | <div class="action iconfont"> | 8 | <div class="action iconfont"> |
9 | - <a href="/home/address/edit?id={{address_id}}" class="edit"></a> | 9 | + <span class="edit" data-id="{{address_id}}" data-consignee="{{consignee}}" data-mobile="{{mobile}}" data-area-code="{{area_code}}" data-area="{{area}}" data-address="{{address}}"></span> |
10 | <span class="del" data-id="{{address_id}}"></span> | 10 | <span class="del" data-id="{{address_id}}"></span> |
11 | </div> | 11 | </div> |
12 | </div> | 12 | </div> |
@@ -30,5 +30,7 @@ | @@ -30,5 +30,7 @@ | ||
30 | </div> | 30 | </div> |
31 | </div> | 31 | </div> |
32 | </div> | 32 | </div> |
33 | + {{> me/address/edit-address}} | ||
34 | + {{> me/address/address-list}} | ||
33 | </div> | 35 | </div> |
34 | {{> layout/footer}} | 36 | {{> layout/footer}} |
1 | +<div class="my-address-list-page hide"> | ||
2 | + <ul class="address-list"> | ||
3 | + {{# addressList}} | ||
4 | + <li class="address"> | ||
5 | + <span class="caption">{{caption}}</span> | ||
6 | + <span class="iconfont"></span> | ||
7 | + <ul> | ||
8 | + {{# sub}} | ||
9 | + <li class="address"> | ||
10 | + <span class="caption">{{caption}}</span> | ||
11 | + <span class="iconfont"></span> | ||
12 | + <ul class="address-list"> | ||
13 | + {{# sub}} | ||
14 | + <li class="address-last" data-id="{{code}}"> | ||
15 | + <span class="caption">{{caption}}</span> | ||
16 | + </li> | ||
17 | + {{/ sub}} | ||
18 | + </ul> | ||
19 | + </li> | ||
20 | + {{/ sub}} | ||
21 | + </ul> | ||
22 | + </li> | ||
23 | + {{/ addressList}} | ||
24 | + </ul> | ||
25 | +</div> |
1 | -{{> layout/header}} | ||
2 | -<div class="my-edit-address-page yoho-page"> | 1 | +<div class="my-edit-address-page hide"> |
3 | <form class="edit-address"> | 2 | <form class="edit-address"> |
3 | + <input type="hidden" name="id" value=""> | ||
4 | <label class="username"> | 4 | <label class="username"> |
5 | - 用户名 | ||
6 | - <input type="text" name="name" value="张三"> | 5 | + 收件人 |
6 | + <input type="text" name="consignee" value=""> | ||
7 | </label> | 7 | </label> |
8 | <label class="mobile"> | 8 | <label class="mobile"> |
9 | 手机号码 | 9 | 手机号码 |
10 | - <input type="text" name="mobile" value="18911110110"> | 10 | + <input type="text" name="mobile" value=""> |
11 | </label> | 11 | </label> |
12 | <label class="area"> | 12 | <label class="area"> |
13 | 省市区 | 13 | 省市区 |
14 | - <input type="text" name="area" value="江苏省南京市栖霞区"> | 14 | + <input type="hidden" name="area_code" value=""> |
15 | + <input type="text" name="area" value="" readonly> | ||
15 | <span class="iconfont"></span> | 16 | <span class="iconfont"></span> |
16 | </label> | 17 | </label> |
17 | <label class="address"> | 18 | <label class="address"> |
18 | 详细地址 | 19 | 详细地址 |
19 | - <textarea name="address">东大街西大66号茶馆东大街西大66号茶馆东大街西大66号茶馆</textarea> | 20 | + <textarea name="address"></textarea> |
20 | </label> | 21 | </label> |
21 | 22 | ||
22 | </form> | 23 | </form> |
@@ -24,5 +25,4 @@ | @@ -24,5 +25,4 @@ | ||
24 | <div class="submit"> | 25 | <div class="submit"> |
25 | 确认 | 26 | 确认 |
26 | </div> | 27 | </div> |
27 | -</div> | ||
28 | -{{> layout/footer}} | ||
28 | +</div> |
@@ -187,9 +187,10 @@ class HomeController extends AbstractAction | @@ -187,9 +187,10 @@ class HomeController extends AbstractAction | ||
187 | * YOHO币 | 187 | * YOHO币 |
188 | */ | 188 | */ |
189 | public function currencyAction() { | 189 | public function currencyAction() { |
190 | - $this->setTitle('YOHO币'); | ||
191 | - $this->setNavHeader('优惠券', true, SITE_MAIN); | 190 | + $this->setTitle('YOHO币'); |
191 | + $this->setNavHeader('YOHO币', true, false); | ||
192 | 192 | ||
193 | + // $uid = $this->getUid(); | ||
193 | $uid = 967016; | 194 | $uid = 967016; |
194 | $currency = \Index\UserModel::getYohoCoinData($uid); | 195 | $currency = \Index\UserModel::getYohoCoinData($uid); |
195 | 196 | ||
@@ -211,8 +212,8 @@ class HomeController extends AbstractAction | @@ -211,8 +212,8 @@ class HomeController extends AbstractAction | ||
211 | 'couponsUrl' => \Index\UserModel::getCouponData($uid, $status), | 212 | 'couponsUrl' => \Index\UserModel::getCouponData($uid, $status), |
212 | 'couponsPage' => true | 213 | 'couponsPage' => true |
213 | ); | 214 | ); |
215 | + print_r($coupons); | ||
214 | 216 | ||
215 | - print_r($coupons); | ||
216 | $this->_view->display('coupons', $coupons); | 217 | $this->_view->display('coupons', $coupons); |
217 | } | 218 | } |
218 | 219 | ||
@@ -244,7 +245,7 @@ class HomeController extends AbstractAction | @@ -244,7 +245,7 @@ class HomeController extends AbstractAction | ||
244 | $address = \Index\UserModel::getAddressData($uid); | 245 | $address = \Index\UserModel::getAddressData($uid); |
245 | $addressList = \Index\UserModel::getAddressListData($uid); | 246 | $addressList = \Index\UserModel::getAddressListData($uid); |
246 | 247 | ||
247 | - // print_r($address); | 248 | + // print_r($addressList); |
248 | 249 | ||
249 | $this->_view->display('address', array( | 250 | $this->_view->display('address', array( |
250 | 'addressPage' => true, | 251 | 'addressPage' => true, |
@@ -310,7 +311,7 @@ class HomeController extends AbstractAction | @@ -310,7 +311,7 @@ class HomeController extends AbstractAction | ||
310 | 311 | ||
311 | $service = home\OnlineModel::getOnlineServiceInfo(); | 312 | $service = home\OnlineModel::getOnlineServiceInfo(); |
312 | 313 | ||
313 | - $this->_view->display('online_service', array( | 314 | + $this->_view->display('online-service', array( |
314 | 'onlineServicePage' => true, | 315 | 'onlineServicePage' => true, |
315 | // 'pageFooter' => true, | 316 | // 'pageFooter' => true, |
316 | 'service' => $service | 317 | 'service' => $service |
@@ -327,7 +328,7 @@ class HomeController extends AbstractAction | @@ -327,7 +328,7 @@ class HomeController extends AbstractAction | ||
327 | } | 328 | } |
328 | $this->setTitle('在线客服'); | 329 | $this->setTitle('在线客服'); |
329 | $this->setNavHeader($cateName, true, ''); | 330 | $this->setNavHeader($cateName, true, ''); |
330 | - $this->_view->display('online_service_detail', $service); | 331 | + $this->_view->display('online-service-detail', $service); |
331 | } | 332 | } |
332 | 333 | ||
333 | /** | 334 | /** |
@@ -351,31 +352,11 @@ class HomeController extends AbstractAction | @@ -351,31 +352,11 @@ class HomeController extends AbstractAction | ||
351 | 352 | ||
352 | $suggest = \Index\UserModel::getSuggestData($udid, $page, $limit); | 353 | $suggest = \Index\UserModel::getSuggestData($udid, $page, $limit); |
353 | 354 | ||
354 | - print_r($suggest); | ||
355 | $this->_view->display('suggest', array( | 355 | $this->_view->display('suggest', array( |
356 | 'suggestPage' => true, //加载js | 356 | 'suggestPage' => true, //加载js |
357 | 'pageFooter' => true, | 357 | 'pageFooter' => true, |
358 | 'suggest' => true, | 358 | 'suggest' => true, |
359 | - 'suggestContent' => array( | ||
360 | - 0 => array( | ||
361 | - 'imgUrl' => 'http://img11.static.yhbimg.com/yhb-img01/2015/09/12/06/0115bdfeb4a7dca4b4bfdf0e850f82f2a1.jpg?imageView/2/w/640/h/240', | ||
362 | - 'title' => '为什么手机不能退换货?', | ||
363 | - 'content' => 'YOHO!有货的退换货承诺:自您签收商品7日内可以退货,15日内可以换货,在商品吊牌、标签、包装完整,不影响二次销售的情况下,YOHO!有货将为您办理退换货服务。', | ||
364 | - 'good' => true, | ||
365 | - 'bad' => false), | ||
366 | - 1 => array( | ||
367 | - 'imgUrl' => 'http://img11.static.yhbimg.com/yhb-img01/2015/09/12/06/0115bdfeb4a7dca4b4bfdf0e850f82f2a1.jpg?imageView/2/w/640/h/240', | ||
368 | - 'title' => '为什么手机不能退换货?', | ||
369 | - 'content' => 'YOHO!有货的退换货承诺:自您签收商品7日内可以退货,15日内可以换货,在商品吊牌、标签、包装完整,不影响二次销售的情况下,YOHO!有货将为您办理退换货服务。', | ||
370 | - 'good' => false, | ||
371 | - 'bad' => true), | ||
372 | - 2 => array( | ||
373 | - 'imgUrl' => 'http://img11.static.yhbimg.com/yhb-img01/2015/09/12/06/0115bdfeb4a7dca4b4bfdf0e850f82f2a1.jpg?imageView/2/w/640/h/240', | ||
374 | - 'title' => '为什么手机不能退换货?', | ||
375 | - 'content' => 'YOHO!有货的退换货承诺:自您签收商品7日内可以退货,15日内可以换货,在商品吊牌、标签、包装完整,不影响二次销售的情况下,YOHO!有货将为您办理退换货服务。', | ||
376 | - 'good' => false, | ||
377 | - 'bad' => false) | ||
378 | - ) | 359 | + 'suggestContent' => $suggest |
379 | )); | 360 | )); |
380 | } | 361 | } |
381 | 362 |
@@ -30,7 +30,7 @@ class UserModel | @@ -30,7 +30,7 @@ class UserModel | ||
30 | // 调用接口获取个人详情 | 30 | // 调用接口获取个人详情 |
31 | $userData = UserData::userData($uid); | 31 | $userData = UserData::userData($uid); |
32 | 32 | ||
33 | - // 处理个人详情数据 | 33 | + // 处理个人详情数 |
34 | if (isset($userData['data']) && !empty($userData['data'])) { | 34 | if (isset($userData['data']) && !empty($userData['data'])) { |
35 | $result = $userData['data']; | 35 | $result = $userData['data']; |
36 | $result['gender'] = $result['gender'] == 1 ? '男' : '女'; | 36 | $result['gender'] = $result['gender'] == 1 ? '男' : '女'; |
@@ -213,8 +213,11 @@ class UserModel | @@ -213,8 +213,11 @@ class UserModel | ||
213 | $coupons = UserData::couponData($uid, $status); | 213 | $coupons = UserData::couponData($uid, $status); |
214 | 214 | ||
215 | // 处理优惠券数据 | 215 | // 处理优惠券数据 |
216 | - if (isset($coupons['data']) && !empty($coupons['data'])) { | ||
217 | - $result = $coupons['data']['info']; | 216 | + if (!empty($coupons['unused'])) { |
217 | + $result['unused'] = $coupons['unused']['info']; | ||
218 | + } | ||
219 | + if (!empty($coupons['used'])) { | ||
220 | + $result['used'] = $coupons['used']['info']; | ||
218 | } | 221 | } |
219 | 222 | ||
220 | return $result; | 223 | return $result; |
@@ -353,14 +356,11 @@ class UserModel | @@ -353,14 +356,11 @@ class UserModel | ||
353 | $one = array(); | 356 | $one = array(); |
354 | foreach ($suggest['data']['list'] as $val) { | 357 | foreach ($suggest['data']['list'] as $val) { |
355 | $one = array(); | 358 | $one = array(); |
356 | - $one['hasImage'] = $val['has_image']; | ||
357 | $one['imgUrl'] = Helpers::getImageUrl($val['cover_image'], 640, 240); | 359 | $one['imgUrl'] = Helpers::getImageUrl($val['cover_image'], 640, 240); |
358 | $one['title'] = $val['filter_content']; | 360 | $one['title'] = $val['filter_content']; |
359 | $one['content'] = $val['reply_content']; | 361 | $one['content'] = $val['reply_content']; |
360 | - $one['good'] = $val['is_reliable']; | ||
361 | - $one['bad'] = !$val['is_reliable']; | ||
362 | - $one['goodNum'] = $val['reliable']; | ||
363 | - $one['badNum'] = $val['unreliable']; | 362 | + $one['good'] = boolval($val['is_reliable']); |
363 | + $one['bad'] = !$one['good']; | ||
364 | 364 | ||
365 | $result[] = $one; | 365 | $result[] = $one; |
366 | } | 366 | } |
-
Please register or login to post a comment