Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop
Showing
8 changed files
with
276 additions
and
46 deletions
@@ -161,7 +161,7 @@ class UserData | @@ -161,7 +161,7 @@ class UserData | ||
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 | $param = Yohobuy::param(); | 163 | $param = Yohobuy::param(); |
164 | - $param['method'] = 'app.yohocoin.lists'; | 164 | + $param['method'] = 'app.coupons.li'; |
165 | $param['uid'] = $uid; | 165 | $param['uid'] = $uid; |
166 | $param['status'] = $status; | 166 | $param['status'] = $status; |
167 | $param['page'] = $page; | 167 | $param['page'] = $page; |
@@ -188,6 +188,76 @@ class UserData | @@ -188,6 +188,76 @@ class UserData | ||
188 | } | 188 | } |
189 | 189 | ||
190 | /** | 190 | /** |
191 | + * 获取三级地址列表数据 | ||
192 | + * | ||
193 | + * @param int $uid 用户ID | ||
194 | + * @return array 地址接口返回的数据 | ||
195 | + */ | ||
196 | + public static function addressListData($uid) | ||
197 | + { | ||
198 | + $param = Yohobuy::param(); | ||
199 | + $param['method'] = 'app.address.getlist'; | ||
200 | + $param['uid'] = $uid; | ||
201 | + $param['client_secret'] = Sign::getSign($param); | ||
202 | + | ||
203 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
204 | + } | ||
205 | + | ||
206 | + /** | ||
207 | + * 保存地址数据 | ||
208 | + * | ||
209 | + * @param int $uid 用户ID | ||
210 | + * @param string $address 地址信息 | ||
211 | + * @param int $area_code 城市码 | ||
212 | + * @param string $consignee 收货人 | ||
213 | + * @param string $email 邮箱地址 | ||
214 | + * @param int $id 地址唯一标识符id | ||
215 | + * @param string $mobile 手机号码 | ||
216 | + * @param string $zip_code 邮编 | ||
217 | + * @return array 地址接口返回的数据 | ||
218 | + */ | ||
219 | + public static function saveAddressData($uid, $address, $area_code, $consignee, $email, $id, $mobile, $zip_code) | ||
220 | + { | ||
221 | + $param = Yohobuy::param(); | ||
222 | + $param['address'] = $address; | ||
223 | + $param['area_code'] = $area_code; | ||
224 | + $param['consignee'] = $consignee; | ||
225 | + $param['email'] = $email; | ||
226 | + | ||
227 | + if ($id !== null) { // 修改 | ||
228 | + $param['id'] = $id; | ||
229 | + $param['method'] = 'app.address.update'; | ||
230 | + } else { // 添加 | ||
231 | + $param['method'] = 'app.address.add'; | ||
232 | + } | ||
233 | + | ||
234 | + $param['mobile'] = $mobile; | ||
235 | + $param['zip_code'] = $zip_code; | ||
236 | + $param['uid'] = $uid; | ||
237 | + $param['client_secret'] = Sign::getSign($param); | ||
238 | + | ||
239 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
240 | + } | ||
241 | + | ||
242 | + /** | ||
243 | + * 设置默认地址 | ||
244 | + * | ||
245 | + * @param int $uid 用户ID | ||
246 | + * @param int $id 地址唯一标识符id | ||
247 | + * @return array 接口返回的数据 | ||
248 | + */ | ||
249 | + public static function setDefaultAddress($uid, $id) | ||
250 | + { | ||
251 | + $param = Yohobuy::param(); | ||
252 | + $param['id'] = $id; | ||
253 | + $param['method'] = 'app.address.setdefault'; | ||
254 | + $param['uid'] = $uid; | ||
255 | + $param['client_secret'] = Sign::getSign($param); | ||
256 | + | ||
257 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
258 | + } | ||
259 | + | ||
260 | + /** | ||
191 | * 意见反馈数据 | 261 | * 意见反馈数据 |
192 | * | 262 | * |
193 | * @param string $udid 客户端唯一标识 | 263 | * @param string $udid 客户端唯一标识 |
@@ -10,20 +10,38 @@ var $ = require('jquery'), | @@ -10,20 +10,38 @@ var $ = require('jquery'), | ||
10 | 10 | ||
11 | var orderId = $('#order-detail').data('id'); | 11 | var orderId = $('#order-detail').data('id'); |
12 | 12 | ||
13 | -var delHammer; | 13 | +var optHammer; |
14 | 14 | ||
15 | lazyLoad(); | 15 | lazyLoad(); |
16 | 16 | ||
17 | //订单删除 | 17 | //订单删除 |
18 | -delHammer = new Hammer(document.getElementsByClassName('btn-del')[0]); | ||
19 | -delHammer.on('tap', function() { | ||
20 | - if (confirm('确定删除订单吗?')) { | ||
21 | - $.ajax({ | ||
22 | - type: 'GET', | ||
23 | - url: '/home/delOrder', | ||
24 | - data: { | ||
25 | - id: orderId | ||
26 | - } | ||
27 | - }); | 18 | +optHammer = new Hammer(document.getElementsByClassName('opt')[0]); |
19 | +optHammer.on('tap', function(e) { | ||
20 | + var $cur = $(e.target); | ||
21 | + | ||
22 | + if ($cur.hasClass('btn-del')) { | ||
23 | + | ||
24 | + //删除订单 | ||
25 | + if (confirm('确定删除订单吗?')) { | ||
26 | + $.ajax({ | ||
27 | + type: 'GET', | ||
28 | + url: '/home/delOrder', | ||
29 | + data: { | ||
30 | + id: orderId | ||
31 | + } | ||
32 | + }); | ||
33 | + } | ||
34 | + } else if ($cur.hasClass('btn-cancel')) { | ||
35 | + | ||
36 | + //取消订单 | ||
37 | + if (confirm('确定取消订单吗?')) { | ||
38 | + $.ajax({ | ||
39 | + type: 'GET', | ||
40 | + url: '/home/cancelOrder', | ||
41 | + data: { | ||
42 | + id: orderId | ||
43 | + } | ||
44 | + }); | ||
45 | + } | ||
28 | } | 46 | } |
29 | }); | 47 | }); |
@@ -123,4 +123,11 @@ | @@ -123,4 +123,11 @@ | ||
123 | text-align: center; | 123 | text-align: center; |
124 | border: 1px solid #000; | 124 | border: 1px solid #000; |
125 | } | 125 | } |
126 | + | ||
127 | + .btn-pay { | ||
128 | + color: #fff; | ||
129 | + border: none; | ||
130 | + background: #d0021b; | ||
131 | + margin-left: 10rem / $pxConvertRem; | ||
132 | + } | ||
126 | } | 133 | } |
@@ -167,13 +167,14 @@ class HomeController extends AbstractAction | @@ -167,13 +167,14 @@ class HomeController extends AbstractAction | ||
167 | $this->setNavHeader('优惠券', true, SITE_MAIN); | 167 | $this->setNavHeader('优惠券', true, SITE_MAIN); |
168 | // $uid = $this->getUid(); | 168 | // $uid = $this->getUid(); |
169 | $uid = 8826435; | 169 | $uid = 8826435; |
170 | - $status = $this->get('status', 0); | ||
171 | $coupons = array( | 170 | $coupons = array( |
172 | - 'couponsUrl' => \Index\UserModel::getCouponData($uid, $status), | 171 | + 'couponsUrl' => array( |
172 | + \Index\UserModel::getCouponData($uid, 0), | ||
173 | + \Index\UserModel::getCouponData($uid, 1), | ||
174 | + ), | ||
173 | 'couponsPage' => true | 175 | 'couponsPage' => true |
174 | ); | 176 | ); |
175 | 177 | ||
176 | - print_r($coupons); | ||
177 | $this->_view->display('coupons', $coupons); | 178 | $this->_view->display('coupons', $coupons); |
178 | 179 | ||
179 | } | 180 | } |
@@ -207,38 +208,69 @@ class HomeController extends AbstractAction | @@ -207,38 +208,69 @@ class HomeController extends AbstractAction | ||
207 | $uid = 967016; | 208 | $uid = 967016; |
208 | 209 | ||
209 | $address = \Index\UserModel::getAddressData($uid); | 210 | $address = \Index\UserModel::getAddressData($uid); |
211 | + $addressList = \Index\UserModel::getAddressListData($uid); | ||
210 | 212 | ||
211 | // print_r($address); | 213 | // print_r($address); |
212 | 214 | ||
213 | $this->_view->display('address', array( | 215 | $this->_view->display('address', array( |
214 | 'addressPage' => true, | 216 | 'addressPage' => true, |
215 | 'pageFooter' => true, | 217 | 'pageFooter' => true, |
216 | - 'address' => $address | 218 | + 'address' => $address, |
219 | + 'addressList' => $addressList | ||
217 | )); | 220 | )); |
218 | } | 221 | } |
219 | 222 | ||
220 | - /** | ||
221 | - * 修改地址 | ||
222 | - */ | ||
223 | - public function editAddressAction() | ||
224 | - { | ||
225 | - // 设置网站标题 | ||
226 | - $this->setTitle('修改地址'); | ||
227 | - $this->setNavHeader('修改地址', true, SITE_MAIN); | 223 | + /** |
224 | + * 修改地址或者添加新地址 | ||
225 | + */ | ||
226 | + public function saveAddressAction() | ||
227 | + { | ||
228 | + $result = array(); | ||
229 | + | ||
230 | + if ($this->isAjax()) { | ||
231 | + // $uid = $this->getUid(); | ||
232 | + $uid = 967016; | ||
233 | + $address = $this->post('address', ''); | ||
234 | + $area_code = $this->post('area_code', ''); | ||
235 | + $consignee = $this->post('consignee', ''); | ||
236 | + $email = $this->post('email', ''); | ||
237 | + $id = $this->post('id', null); | ||
238 | + $mobile = $this->post('mobile', ''); | ||
239 | + $zip_code = $this->post('zip_code', ''); | ||
240 | + | ||
241 | + $result = \Index\UserModel::saveAddressData($uid, $address, $area_code, $consignee, $email, $id, $mobile, $zip_code); | ||
242 | + } | ||
228 | 243 | ||
229 | - // $uid = $this->getUid(); | ||
230 | - $uid = 967016; | 244 | + if (empty($result)) { |
245 | + echo ' '; | ||
246 | + } else { | ||
247 | + $this->echoJson($result); | ||
248 | + } | ||
231 | 249 | ||
232 | - $address = \Index\UserModel::getAddressData($uid); | 250 | + } |
233 | 251 | ||
234 | - // print_r($address); | 252 | + /** |
253 | + * 设置默认地址 | ||
254 | + */ | ||
255 | + public function defaultAddressAction() | ||
256 | + { | ||
257 | + $result = array(); | ||
235 | 258 | ||
236 | - $this->_view->display('edit_address', array( | ||
237 | - 'editAddressPage' => true, | ||
238 | - 'pageFooter' => true, | ||
239 | - 'address' => $address | ||
240 | - )); | ||
241 | - } | 259 | + if ($this->isAjax()) { |
260 | + // $uid = $this->getUid(); | ||
261 | + $uid = 967016; | ||
262 | + $id = $this->post('id', ''); | ||
263 | + | ||
264 | + $result = \Index\UserModel::setDefaultAddress($uid, $id); | ||
265 | + } | ||
266 | + | ||
267 | + if (empty($result)) { | ||
268 | + echo ' '; | ||
269 | + } else { | ||
270 | + $this->echoJson($result); | ||
271 | + } | ||
272 | + | ||
273 | + } | ||
242 | 274 | ||
243 | //在线客服 | 275 | //在线客服 |
244 | public function onlineServiceAction() | 276 | public function onlineServiceAction() |
@@ -261,10 +293,13 @@ class HomeController extends AbstractAction | @@ -261,10 +293,13 @@ class HomeController extends AbstractAction | ||
261 | { | 293 | { |
262 | $service = array(); | 294 | $service = array(); |
263 | $cateId = $this->get('cateId', 0); | 295 | $cateId = $this->get('cateId', 0); |
296 | + $cateName = $this->get('cateName', ''); | ||
264 | if ($cateId > 0) | 297 | if ($cateId > 0) |
265 | { | 298 | { |
266 | $service = home\OnlineModel::getOnlineServiceDetail($cateId); | 299 | $service = home\OnlineModel::getOnlineServiceDetail($cateId); |
267 | } | 300 | } |
301 | + $this->setTitle('在线客服'); | ||
302 | + $this->setNavHeader($cateName, true, ''); | ||
268 | $this->_view->display('online_service_detail', $service); | 303 | $this->_view->display('online_service_detail', $service); |
269 | } | 304 | } |
270 | 305 |
@@ -218,7 +218,7 @@ class UserModel | @@ -218,7 +218,7 @@ class UserModel | ||
218 | 218 | ||
219 | // 处理优惠券数据 | 219 | // 处理优惠券数据 |
220 | if (isset($coupons['data']) && !empty($coupons['data'])) { | 220 | if (isset($coupons['data']) && !empty($coupons['data'])) { |
221 | - $result = $coupons['data']; | 221 | + $result = $coupons['data']['info']; |
222 | } | 222 | } |
223 | 223 | ||
224 | return $result; | 224 | return $result; |
@@ -246,6 +246,96 @@ class UserModel | @@ -246,6 +246,96 @@ class UserModel | ||
246 | } | 246 | } |
247 | 247 | ||
248 | /** | 248 | /** |
249 | + * 处理地址列表数据 | ||
250 | + * | ||
251 | + * @param int $uid 用户ID | ||
252 | + * @return array|mixed 处理之后的地址列表数据 | ||
253 | + */ | ||
254 | + public static function getAddressListData($uid) | ||
255 | + { | ||
256 | + $result = array(); | ||
257 | + | ||
258 | + // 调用接口获取地址列表数据 | ||
259 | + $address = UserData::addressListData($uid); | ||
260 | + | ||
261 | + // 处理地址数据 | ||
262 | + if (isset($address['data']) && !empty($address['data'])) { | ||
263 | + $result = $address['data']; | ||
264 | + } | ||
265 | + | ||
266 | + return $result; | ||
267 | + } | ||
268 | + | ||
269 | + /** | ||
270 | + * 保存地址数据 | ||
271 | + * | ||
272 | + * @param int $uid 用户ID | ||
273 | + * @param string $address 地址信息 | ||
274 | + * @param int $area_code 城市码 | ||
275 | + * @param string $consignee 收货人 | ||
276 | + * @param string $email 邮箱地址 | ||
277 | + * @param int $id 地址唯一标识符id | ||
278 | + * @param string $mobile 手机号码 | ||
279 | + * @param string $zip_code 邮编 | ||
280 | + * @return array|mixed 处理之后的地址列表数据 | ||
281 | + */ | ||
282 | + public static function saveAddressData($uid, $address, $area_code, $consignee, $email, $id, $mobile, $zip_code) | ||
283 | + { | ||
284 | + $result = array(); | ||
285 | + | ||
286 | + // 参数验证 | ||
287 | + if (empty($uid)) { | ||
288 | + $result['code'] = 400; | ||
289 | + $result['message'] = '用户不可用'; | ||
290 | + } else if (empty($address)) { | ||
291 | + $result['code'] = 401; | ||
292 | + $result['message'] = '请输入可用的地址信息'; | ||
293 | + } else if (empty($area_code)) { | ||
294 | + $result['code'] = 402; | ||
295 | + $result['message'] = '地区码不可用'; | ||
296 | + } else if (empty($consignee)) { | ||
297 | + $result['code'] = 403; | ||
298 | + $result['message'] = '请输入收件人姓名'; | ||
299 | + } else if (!empty($email) && Helpers::verifyEmail($email)) { | ||
300 | + $result['code'] = 404; | ||
301 | + $result['message'] = '输入的邮箱地址格式不正确'; | ||
302 | + } else if (!empty($mobile) && Helpers::verifyMobile($mobile)) { | ||
303 | + $result['code'] = 404; | ||
304 | + $result['message'] = '输入的手机号码格式不正确'; | ||
305 | + } else { | ||
306 | + // 调用接口保存地址数据 | ||
307 | + $address = UserData::saveAddressData($uid, $address, $area_code, $consignee, $email, $id, $mobile, $zip_code); | ||
308 | + // 处理返回结果 | ||
309 | + if (isset($address['code']) && $address['code'] == 200) { | ||
310 | + $result = $address['data']; | ||
311 | + } | ||
312 | + } | ||
313 | + | ||
314 | + return $result; | ||
315 | + } | ||
316 | + | ||
317 | + /** | ||
318 | + * 设置默认地址 | ||
319 | + * | ||
320 | + * @param int $uid 用户ID | ||
321 | + * @param int $id 地址唯一标识符id | ||
322 | + * @return array|mixed 处理之后的返回数据 | ||
323 | + */ | ||
324 | + public static function setDefaultAddress($uid, $id) | ||
325 | + { | ||
326 | + $result = array('code' => 400, 'message' => '错误'); | ||
327 | + | ||
328 | + // 调用接口设置默认地址 | ||
329 | + $address = UserData::setDefaultAddress($uid, $id); | ||
330 | + // 处理返回结果 | ||
331 | + if ($address && isset($address['code'])) { | ||
332 | + $result = $address; | ||
333 | + } | ||
334 | + | ||
335 | + return $result; | ||
336 | + } | ||
337 | + | ||
338 | + /** | ||
249 | * 处理意见反馈数据 | 339 | * 处理意见反馈数据 |
250 | * | 340 | * |
251 | * @param string $udid 客户端唯一标识 | 341 | * @param string $udid 客户端唯一标识 |
@@ -227,19 +227,30 @@ class NewsaleModel | @@ -227,19 +227,30 @@ class NewsaleModel | ||
227 | return $result; | 227 | return $result; |
228 | } | 228 | } |
229 | 229 | ||
230 | - /** | ||
231 | - * 筛选出来的热销排行榜商品数据处理 | ||
232 | - * | ||
233 | - * @param array $data 筛选出来的原数据 | ||
234 | - * @return array 处理之后的数据 | ||
235 | - */ | ||
236 | - public static function selectTopData($data) | 230 | + /** |
231 | + * 筛选出来的热销排行榜商品数据处理 | ||
232 | + * | ||
233 | + * @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部 | ||
234 | + * @param string|null $sort 品类ID查询参数 | ||
235 | + * @param integer|null $tab_id Tab的ID | ||
236 | + * @param boolean $notab 时候返回顶部tab的数据,默认返回 | ||
237 | + * @param integer $limit 查询返回的最大限制数, 默认为50 | ||
238 | + * @param integer $page 分页第几页, 默认第1页 | ||
239 | + * @return array 处理之后的数据 | ||
240 | + */ | ||
241 | + public static function selectTopData($gender, $sort, $tab_id, $notab, $limit, $page) | ||
237 | { | 242 | { |
238 | $result = array(); | 243 | $result = array(); |
239 | 244 | ||
245 | + $data = NewsaleData::getTopProducts($gender, $sort, $tab_id, $limit, $page); | ||
246 | + | ||
240 | if (isset($data['code']) && $data['code'] === 200 && isset($data['data']['product_list'])) { | 247 | if (isset($data['code']) && $data['code'] === 200 && isset($data['data']['product_list'])) { |
241 | $result = NewSaleProcess::newSaleData($data['data']); | 248 | $result = NewSaleProcess::newSaleData($data['data']); |
242 | unset($result['filter']); | 249 | unset($result['filter']); |
250 | + | ||
251 | + if ($notab) { | ||
252 | + unset($result['tabs']); | ||
253 | + } | ||
243 | } | 254 | } |
244 | 255 | ||
245 | return $result; | 256 | return $result; |
@@ -42,7 +42,7 @@ class OnlineModel | @@ -42,7 +42,7 @@ class OnlineModel | ||
42 | foreach ($sub as $sk => $sv) | 42 | foreach ($sub as $sk => $sv) |
43 | { | 43 | { |
44 | $qTmp[$sk]['title'] = $sv['category_name']; | 44 | $qTmp[$sk]['title'] = $sv['category_name']; |
45 | - $qTmp[$sk]['link'] = '/home/onlineservicedetail?cateId=' . $sv['id']; | 45 | + $qTmp[$sk]['link'] = '/home/onlineservicedetail?cateId=' . $sv['id'].'&cateName='.$sv['category_name']; |
46 | } | 46 | } |
47 | } | 47 | } |
48 | $question[$key]['list'] = $qTmp; | 48 | $question[$key]['list'] = $qTmp; |
@@ -106,12 +106,11 @@ class NewsaleController extends AbstractAction | @@ -106,12 +106,11 @@ class NewsaleController extends AbstractAction | ||
106 | $tab_id = $this->get('tab_id', null); | 106 | $tab_id = $this->get('tab_id', null); |
107 | $limit = $this->get('limit', 50); | 107 | $limit = $this->get('limit', 50); |
108 | $page = $this->get('page', 1); | 108 | $page = $this->get('page', 1); |
109 | + $notab = (boolean)$this->get('notab', false); | ||
109 | 110 | ||
110 | // 获取性别 | 111 | // 获取性别 |
111 | $gender = Helpers::getGenderByCookie(); | 112 | $gender = Helpers::getGenderByCookie(); |
112 | - | ||
113 | - $data = NewsaleData::getTopProducts($gender, $sort, $tab_id, $limit, $page); | ||
114 | - $result = \Product\NewsaleModel::selectTopData($data); | 113 | + $result = \Product\NewsaleModel::selectTopData($gender, $sort, $tab_id, $notab, $limit, $page); |
115 | } | 114 | } |
116 | 115 | ||
117 | if (empty($result)) { | 116 | if (empty($result)) { |
-
Please register or login to post a comment