Authored by cailing

订单地址修改

@@ -78,7 +78,7 @@ class OrderData @@ -78,7 +78,7 @@ class OrderData
78 public static function viewOrderData($orderCode, $uid, $sessionKey) 78 public static function viewOrderData($orderCode, $uid, $sessionKey)
79 { 79 {
80 $param = Yohobuy::param(); 80 $param = Yohobuy::param();
81 - $param['method'] = 'app.SpaceOrders.info'; 81 + $param['method'] = 'app.SpaceOrders.detail';
82 $param['order_code'] = $orderCode; 82 $param['order_code'] = $orderCode;
83 $param['uid'] = $uid; 83 $param['uid'] = $uid;
84 $param['session_key'] = $sessionKey; 84 $param['session_key'] = $sessionKey;
@@ -82,7 +82,8 @@ class HomeController extends AbstractAction @@ -82,7 +82,8 @@ class HomeController extends AbstractAction
82 82
83 if (empty($result)) { 83 if (empty($result)) {
84 echo ' '; 84 echo ' ';
85 - } else { 85 + }
  86 + else {
86 $this->_view->display('recommend-content', $result); 87 $this->_view->display('recommend-content', $result);
87 } 88 }
88 } 89 }
@@ -127,9 +128,11 @@ class HomeController extends AbstractAction @@ -127,9 +128,11 @@ class HomeController extends AbstractAction
127 128
128 if (empty($result)) { 129 if (empty($result)) {
129 echo ' '; 130 echo ' ';
130 - } else if (isset($result['end'])) { 131 + }
  132 + else if (isset($result['end'])) {
131 echo 'end'; 133 echo 'end';
132 - } else { 134 + }
  135 + else {
133 $this->_view->display('favorite_product', $result); 136 $this->_view->display('favorite_product', $result);
134 } 137 }
135 } 138 }
@@ -150,9 +153,11 @@ class HomeController extends AbstractAction @@ -150,9 +153,11 @@ class HomeController extends AbstractAction
150 153
151 if (empty($result)) { 154 if (empty($result)) {
152 echo ' '; 155 echo ' ';
153 - } else if (isset($result['end'])) { 156 + }
  157 + else if (isset($result['end'])) {
154 echo 'end'; 158 echo 'end';
155 - } else { 159 + }
  160 + else {
156 $this->_view->display('favorite_brand', $result); 161 $this->_view->display('favorite_brand', $result);
157 } 162 }
158 } 163 }
@@ -172,7 +177,8 @@ class HomeController extends AbstractAction @@ -172,7 +177,8 @@ class HomeController extends AbstractAction
172 177
173 if (empty($result)) { 178 if (empty($result)) {
174 echo ' '; 179 echo ' ';
175 - } else { 180 + }
  181 + else {
176 $this->echoJson($result); 182 $this->echoJson($result);
177 } 183 }
178 } 184 }
@@ -211,7 +217,8 @@ class HomeController extends AbstractAction @@ -211,7 +217,8 @@ class HomeController extends AbstractAction
211 217
212 if (empty($result)) { 218 if (empty($result)) {
213 echo ' '; 219 echo ' ';
214 - } else { 220 + }
  221 + else {
215 $this->_view->display('browse-record-content', $result); 222 $this->_view->display('browse-record-content', $result);
216 } 223 }
217 } 224 }
@@ -289,6 +296,7 @@ class HomeController extends AbstractAction @@ -289,6 +296,7 @@ class HomeController extends AbstractAction
289 /* 296 /*
290 * 异步获取我的消息 297 * 异步获取我的消息
291 */ 298 */
  299 +
292 public function ajaxMessageAction() 300 public function ajaxMessageAction()
293 { 301 {
294 $result = array(); 302 $result = array();
@@ -301,7 +309,8 @@ class HomeController extends AbstractAction @@ -301,7 +309,8 @@ class HomeController extends AbstractAction
301 309
302 if (empty($result)) { 310 if (empty($result)) {
303 echo ' '; 311 echo ' ';
304 - } else { 312 + }
  313 + else {
305 $this->_view->display('message-list', $result); 314 $this->_view->display('message-list', $result);
306 } 315 }
307 } 316 }
@@ -309,6 +318,7 @@ class HomeController extends AbstractAction @@ -309,6 +318,7 @@ class HomeController extends AbstractAction
309 /* 318 /*
310 * 异步删除我的消息 319 * 异步删除我的消息
311 */ 320 */
  321 +
312 public function ajaxDelMesAction() 322 public function ajaxDelMesAction()
313 { 323 {
314 $result = array(); 324 $result = array();
@@ -395,7 +405,8 @@ class HomeController extends AbstractAction @@ -395,7 +405,8 @@ class HomeController extends AbstractAction
395 405
396 if (empty($result)) { 406 if (empty($result)) {
397 echo ' '; 407 echo ' ';
398 - } else { 408 + }
  409 + else {
399 $this->_view->display('coupon_list', $result); 410 $this->_view->display('coupon_list', $result);
400 } 411 }
401 } 412 }
@@ -414,7 +425,8 @@ class HomeController extends AbstractAction @@ -414,7 +425,8 @@ class HomeController extends AbstractAction
414 425
415 if (empty($result)) { 426 if (empty($result)) {
416 echo ' '; 427 echo ' ';
417 - } else { 428 + }
  429 + else {
418 $this->_view->display('location-list', $result); 430 $this->_view->display('location-list', $result);
419 } 431 }
420 } 432 }
@@ -491,7 +503,8 @@ class HomeController extends AbstractAction @@ -491,7 +503,8 @@ class HomeController extends AbstractAction
491 $data['id'] = $id; 503 $data['id'] = $id;
492 // 获取特定地址的数据 504 // 获取特定地址的数据
493 $data['address'] = UserModel::getAddressDataById($uid, $id); 505 $data['address'] = UserModel::getAddressDataById($uid, $id);
494 - } else { 506 + }
  507 + else {
495 // 设置网站标题 508 // 设置网站标题
496 $this->setTitle('添加地址'); 509 $this->setTitle('添加地址');
497 $this->setNavHeader('添加地址', true, false); 510 $this->setNavHeader('添加地址', true, false);
@@ -522,7 +535,8 @@ class HomeController extends AbstractAction @@ -522,7 +535,8 @@ class HomeController extends AbstractAction
522 535
523 if (empty($result)) { 536 if (empty($result)) {
524 echo ' '; 537 echo ' ';
525 - } else { 538 + }
  539 + else {
526 $this->echoJson($result); 540 $this->echoJson($result);
527 } 541 }
528 } 542 }
@@ -542,7 +556,8 @@ class HomeController extends AbstractAction @@ -542,7 +556,8 @@ class HomeController extends AbstractAction
542 556
543 if (empty($result)) { 557 if (empty($result)) {
544 echo ' '; 558 echo ' ';
545 - } else { 559 + }
  560 + else {
546 $this->echoJson($result); 561 $this->echoJson($result);
547 } 562 }
548 } 563 }
@@ -562,7 +577,8 @@ class HomeController extends AbstractAction @@ -562,7 +577,8 @@ class HomeController extends AbstractAction
562 577
563 if (empty($result)) { 578 if (empty($result)) {
564 echo ' '; 579 echo ' ';
565 - } else { 580 + }
  581 + else {
566 $this->echoJson($result); 582 $this->echoJson($result);
567 } 583 }
568 } 584 }
@@ -633,9 +649,11 @@ class HomeController extends AbstractAction @@ -633,9 +649,11 @@ class HomeController extends AbstractAction
633 $this->setTitle('我收藏的'); 649 $this->setTitle('我收藏的');
634 $this->setNavHeader('我收藏的', true, ''); 650 $this->setNavHeader('我收藏的', true, '');
635 $this->_view->display('my-guang', array('myGuangPage' => true, 'myGuang' => array('infos' => $guangInfo), 'pageFooter' => true)); 651 $this->_view->display('my-guang', array('myGuangPage' => true, 'myGuang' => array('infos' => $guangInfo), 'pageFooter' => true));
636 - } else if ($page > 1 && $page <= $totalPage) { 652 + }
  653 + else if ($page > 1 && $page <= $totalPage) {
637 $this->_view->display('my-guang-partial', array('infos' => $guangInfo)); 654 $this->_view->display('my-guang-partial', array('infos' => $guangInfo));
638 - } else if ($page > 1 && $page > $totalPage) { 655 + }
  656 + else if ($page > 1 && $page > $totalPage) {
639 echo ' '; //退出循环 657 echo ' '; //退出循环
640 } 658 }
641 } 659 }
@@ -818,9 +836,11 @@ class HomeController extends AbstractAction @@ -818,9 +836,11 @@ class HomeController extends AbstractAction
818 $order = array(); 836 $order = array();
819 if (!empty($data)) { 837 if (!empty($data)) {
820 $order['orders'] = $data; 838 $order['orders'] = $data;
821 - } else if ($page == 1) { 839 + }
  840 + else if ($page == 1) {
822 $order['walkwayUrl'] = Helpers::url('/product/new'); 841 $order['walkwayUrl'] = Helpers::url('/product/new');
823 - } else { 842 + }
  843 + else {
824 echo ' '; 844 echo ' ';
825 exit(); 845 exit();
826 } 846 }
@@ -850,9 +870,11 @@ class HomeController extends AbstractAction @@ -850,9 +870,11 @@ class HomeController extends AbstractAction
850 //将取消状态返回至浏览器 870 //将取消状态返回至浏览器
851 if (!$data) { 871 if (!$data) {
852 $this->echoJson(array('message' => '取消订单失败')); 872 $this->echoJson(array('message' => '取消订单失败'));
853 - } else if (empty($data['code']) && empty($data['message'])) { 873 + }
  874 + else if (empty($data['code']) && empty($data['message'])) {
854 $this->echoJson(array('code' => 200)); 875 $this->echoJson(array('code' => 200));
855 - } else { 876 + }
  877 + else {
856 $this->echoJson($data); 878 $this->echoJson($data);
857 } 879 }
858 } 880 }
@@ -878,7 +900,8 @@ class HomeController extends AbstractAction @@ -878,7 +900,8 @@ class HomeController extends AbstractAction
878 //将订单删除状态返回至浏览器 900 //将订单删除状态返回至浏览器
879 if (empty($data['code']) && empty($data['message'])) { 901 if (empty($data['code']) && empty($data['message'])) {
880 $this->echoJson(array('code' => 200)); 902 $this->echoJson(array('code' => 200));
881 - } else { 903 + }
  904 + else {
882 $this->echoJson($data); 905 $this->echoJson($data);
883 } 906 }
884 } 907 }
@@ -1008,8 +1031,8 @@ class HomeController extends AbstractAction @@ -1008,8 +1031,8 @@ class HomeController extends AbstractAction
1008 $input->SetBody('有货订单号:' . $orderCode); 1031 $input->SetBody('有货订单号:' . $orderCode);
1009 $input->SetOut_trade_no('YOHOBuy_' . $orderCode); // 商户订单号 1032 $input->SetOut_trade_no('YOHOBuy_' . $orderCode); // 商户订单号
1010 $input->SetTotal_fee($totalFee); 1033 $input->SetTotal_fee($totalFee);
1011 - $input->SetTime_start(date("YmdHis", (int)$orderDetail['data']['create_time']));  
1012 - $input->SetTime_expire(date("YmdHis", (int)$orderDetail['data']['create_time'] + 7200)); 1034 + $input->SetTime_start(date("YmdHis", (int) $orderDetail['data']['create_time']));
  1035 + $input->SetTime_expire(date("YmdHis", (int) $orderDetail['data']['create_time'] + 7200));
1013 $input->SetNotify_url(WxPayConfig::NOTIFY_URL); 1036 $input->SetNotify_url(WxPayConfig::NOTIFY_URL);
1014 $input->SetTrade_type("JSAPI"); 1037 $input->SetTrade_type("JSAPI");
1015 $input->SetOpenid($openId); 1038 $input->SetOpenid($openId);
@@ -1017,7 +1040,8 @@ class HomeController extends AbstractAction @@ -1017,7 +1040,8 @@ class HomeController extends AbstractAction
1017 $jsApiParameters = $tools->GetJsApiParameters($order); 1040 $jsApiParameters = $tools->GetJsApiParameters($order);
1018 1041
1019 $this->echoJson(array('code' => 200, 'data' => array('jsApiParameters' => json_decode($jsApiParameters)))); 1042 $this->echoJson(array('code' => 200, 'data' => array('jsApiParameters' => json_decode($jsApiParameters))));
1020 - } while (false); 1043 + }
  1044 + while (false);
1021 } 1045 }
1022 1046
1023 // /* 1047 // /*
@@ -1059,19 +1083,6 @@ class HomeController extends AbstractAction @@ -1059,19 +1083,6 @@ class HomeController extends AbstractAction
1059 //以下是添加的测试数据 1083 //以下是添加的测试数据
1060 $orderDetail['hasChanged'] = 'false'; 1084 $orderDetail['hasChanged'] = 'false';
1061 1085
1062 - //以下是判断能否修改地址  
1063 - if ($orderDetail['orderStatus'] === '待付款' || $orderDetail['orderStatus'] === '备货中' ) {  
1064 - if ($orderDetail['hasChanged'] === 'false') {  
1065 - $changeable = 'true';  
1066 - }else{  
1067 - $changeable = 'false';  
1068 - }  
1069 - }else{  
1070 - $changeable = 'false';  
1071 - }  
1072 -  
1073 - $orderDetail['changeable'] = $changeable;  
1074 -  
1075 $this->_view->display('order-detail', array( 1086 $this->_view->display('order-detail', array(
1076 'orderDetailPage' => true, 1087 'orderDetailPage' => true,
1077 'serviceUrl' => 'http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409&info=', 1088 'serviceUrl' => 'http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409&info=',
@@ -1086,6 +1097,35 @@ class HomeController extends AbstractAction @@ -1086,6 +1097,35 @@ class HomeController extends AbstractAction
1086 } 1097 }
1087 1098
1088 /** 1099 /**
  1100 + * 订单详情页地址修改
  1101 + */
  1102 + public function selectAddress()
  1103 + {
  1104 + $result = array('code' => 400, 'message' => '', 'data' => '');
  1105 +
  1106 + do {
  1107 + /* 判断是不是AJAX请求 */
  1108 + if (!$this->isAjax()) {
  1109 + break;
  1110 + }
  1111 + //获取相关参数
  1112 + $uid = $this->getUid(true);
  1113 + $id = $this->get('id', '');
  1114 + if (!$uid || !$id) {
  1115 + $result = array('code' => 400, 'message' => '缺失必填项', 'data' => '');
  1116 + break;
  1117 + }
  1118 + $result = AddressData::deleteAddress($uid, $id);
  1119 + if (!isset($result['code'])) {
  1120 + break;
  1121 + }
  1122 + }
  1123 + while (false);
  1124 +
  1125 + $this->echoJson($result);
  1126 + }
  1127 +
  1128 + /**
1089 * 帮助中心列表页 1129 * 帮助中心列表页
1090 */ 1130 */
1091 public function helpAction() 1131 public function helpAction()
@@ -1154,8 +1194,10 @@ class HomeController extends AbstractAction @@ -1154,8 +1194,10 @@ class HomeController extends AbstractAction
1154 'pageFooter' => true, 1194 'pageFooter' => true,
1155 'currencyDetailPage' => true 1195 'currencyDetailPage' => true
1156 )); 1196 ));
1157 - } else { 1197 + }
  1198 + else {
1158 echo ' '; 1199 echo ' ';
1159 } 1200 }
1160 } 1201 }
  1202 +
1161 } 1203 }
@@ -133,8 +133,8 @@ class OrderModel @@ -133,8 +133,8 @@ class OrderModel
133 $build['date'] = $value['acceptTime']; 133 $build['date'] = $value['acceptTime'];
134 $result['logisticDetail'][] = $build; 134 $result['logisticDetail'][] = $build;
135 } 135 }
136 -  
137 - } while (false); 136 + }
  137 + while (false);
138 138
139 return $result; 139 return $result;
140 } 140 }
@@ -208,20 +208,39 @@ class OrderModel @@ -208,20 +208,39 @@ class OrderModel
208 $result['orderNum'] = $orderDetail['data']['order_code']; 208 $result['orderNum'] = $orderDetail['data']['order_code'];
209 $result['orderTime'] = date('Y-m-d H:i:s', $orderDetail['data']['create_time']); 209 $result['orderTime'] = date('Y-m-d H:i:s', $orderDetail['data']['create_time']);
210 $result['goods'] = Helpers::formatOrderGoods($orderDetail['data']['order_goods'], $count, true); 210 $result['goods'] = Helpers::formatOrderGoods($orderDetail['data']['order_goods'], $count, true);
211 - $result['sumPrice'] = $orderDetail['data']['goods_total_amount']; // 商品总金额  
212 - $result['salePrice'] = self::filterOrderPrice($orderDetail['data']['promotion_amount']); // 活动金额  
213 - $result['freight'] = $orderDetail['data']['shipping_cost']; // 运费  
214 - $result['coupon'] = self::filterOrderPrice($orderDetail['data']['coupons_amount']); // 优惠券  
215 if (isset($orderDetail['data']['promo_code_amount'])) { 211 if (isset($orderDetail['data']['promo_code_amount'])) {
216 $result['promo_code_amount'] = self::filterOrderPrice($orderDetail['data']['promo_code_amount']); // 优惠码 212 $result['promo_code_amount'] = self::filterOrderPrice($orderDetail['data']['promo_code_amount']); // 优惠码
217 } 213 }
218 214
219 - $result['yohoCoin'] = self::filterOrderPrice($orderDetail['data']['yoho_coin_num']); // YOHO币 215 + $result['yohoCoin'] = $orderDetail['data']['yoho_give_coin']; // YOHO币返回
  216 +
220 $result['price'] = $orderDetail['data']['amount']; // 实付金额 217 $result['price'] = $orderDetail['data']['amount']; // 实付金额
221 $result['goodsAmount'] = $orderDetail['data']['payment_amount']; // 商品总金额没有人民币符号 218 $result['goodsAmount'] = $orderDetail['data']['payment_amount']; // 商品总金额没有人民币符号
222 $result['orderCount'] = $count; // 订单总件数 219 $result['orderCount'] = $count; // 订单总件数
223 $result['isPay'] = $orderDetail['data']['payment_status'] === 'Y'; 220 $result['isPay'] = $orderDetail['data']['payment_status'] === 'Y';
224 } 221 }
  222 + //相关金额(商品总金额,活动金额,运费,优惠券,YOHO币)
  223 + if (isset($orderDetail['data']['promotion_formulas']) && $orderDetail['data']['promotion_formulas']) {
  224 + foreach ($orderDetail['data']['promotion_formulas'] as $pricek => $pricev) {
  225 + $result['orderBalance'][$pricek] = array('promotion' => $pricev['promotion'], 'account' => $pricev['promotion_amount']);
  226 + }
  227 + }
  228 + //为支付的拆单配送信息
  229 + if (isset($orderDetail['data']['is_multi_package']) && $orderDetail['data']['is_multi_package'] == 'Y') {
  230 + $result['isJit'] = true;
  231 + $result['jitDetailUrl'] = Helpers::url('/cart/index/jitDetail', array('orderCode' => $orderCode, 'sessionKey' => $sessionKey));
  232 + }
  233 + //判断是否可以修改地址
  234 + if (isset($orderDetail['data']['can_update_delivery_address']) && $orderDetail['data']['can_update_delivery_address'] == 'Y') {
  235 + $result['changeable'] = true;
  236 + }
  237 + //判断是否有关联订单
  238 + if (isset($orderDetail['data']['relate_order_code']) && $orderDetail['data']['relate_order_code'] == 'Y') {
  239 + $result['relation'] = true;
  240 + }
  241 +
  242 + //测试
  243 + $result['changeable'] = true;
225 } 244 }
226 245
227 return $result; 246 return $result;
@@ -316,7 +335,7 @@ class OrderModel @@ -316,7 +335,7 @@ class OrderModel
316 case 5: 335 case 5:
317 //待收货状态,给查看物流url 336 //待收货状态,给查看物流url
318 $result['unreceived'] = true; 337 $result['unreceived'] = true;
319 - self::assignExpressInfo($showLogistics, $order, $result); 338 + self::assignExpressInfo($showLogistics, $order, $result);
320 break; 339 break;
321 case 6: 340 case 6:
322 $result['completed'] = true; 341 $result['completed'] = true;
@@ -325,7 +344,8 @@ class OrderModel @@ -325,7 +344,8 @@ class OrderModel
325 default: 344 default:
326 break; 345 break;
327 } 346 }
328 - } while (false); 347 + }
  348 + while (false);
329 349
330 return $result; 350 return $result;
331 } 351 }
@@ -342,7 +362,7 @@ class OrderModel @@ -342,7 +362,7 @@ class OrderModel
342 362
343 if ($showLogistics && isset($order['express_company']['caption'])) { 363 if ($showLogistics && isset($order['express_company']['caption'])) {
344 $result['logisticsCompany'] = $order['express_company']['caption']; 364 $result['logisticsCompany'] = $order['express_company']['caption'];
345 - $result['logisticsNum'] = isset($order['express_number']) ? $order['express_number'] : ''; 365 + $result['logisticsNum'] = isset($order['express_number']) ? $order['express_number'] : '';
346 } 366 }
347 } 367 }
348 368
@@ -354,9 +374,10 @@ class OrderModel @@ -354,9 +374,10 @@ class OrderModel
354 */ 374 */
355 private static function filterOrderPrice($price) 375 private static function filterOrderPrice($price)
356 { 376 {
357 - if (is_string($price) && strstr($price,'¥0.00') !== false) { 377 + if (is_string($price) && strstr($price, '¥0.00') !== false) {
358 return ''; 378 return '';
359 - } else { 379 + }
  380 + else {
360 return $price; 381 return $price;
361 } 382 }
362 } 383 }