Authored by 郝肖肖

h5 购物车 刷新页面 默认选中对应项

@@ -370,7 +370,7 @@ class CartModel @@ -370,7 +370,7 @@ class CartModel
370 370
371 // cookie保存的数据 371 // cookie保存的数据
372 if (!empty($orderInfo)) { 372 if (!empty($orderInfo)) {
373 - $orderCompute = self::orderCompute($uid, $cartType, $orderInfo['deliveryId'], $orderInfo['paymentTypeId'], $orderInfo['couponCode'], $orderInfo['yohoCoin'], $skuList); 373 + $orderCompute = self::orderCompute($uid, $cartType, $orderInfo['deliveryId'], $orderInfo['paymentType'], $orderInfo['couponCode'], $orderInfo['yohoCoin'], $skuList);
374 } 374 }
375 375
376 // 根据地址id查询地址信息 376 // 根据地址id查询地址信息
@@ -394,10 +394,9 @@ class CartModel @@ -394,10 +394,9 @@ class CartModel
394 394
395 // 配送方式 395 // 配送方式
396 if (isset($payReturn['delivery_way'])) { 396 if (isset($payReturn['delivery_way'])) {
397 - $idArr = array();  
398 $defaultKey = 0; 397 $defaultKey = 0;
399 $oneDeliv = array(); 398 $oneDeliv = array();
400 - 399 + $isDeliveryId = true;
401 $deliveries = $payReturn['delivery_way']; 400 $deliveries = $payReturn['delivery_way'];
402 if (isset($orderCompute['delivery_way']) && !empty($orderCompute['delivery_way'])) { 401 if (isset($orderCompute['delivery_way']) && !empty($orderCompute['delivery_way'])) {
403 $deliveries = $orderCompute['delivery_way']; 402 $deliveries = $orderCompute['delivery_way'];
@@ -414,15 +413,15 @@ class CartModel @@ -414,15 +413,15 @@ class CartModel
414 $oneDeliv['cost'] = $val['delivery_way_cost']; 413 $oneDeliv['cost'] = $val['delivery_way_cost'];
415 ($val['default'] === 'Y') && $defaultKey = $key; 414 ($val['default'] === 'Y') && $defaultKey = $key;
416 415
417 - $idArr[$key] = $oneDeliv['id']; 416 + if (isset($orderInfo['deliveryId']) && $orderInfo['deliveryId'] === $oneDeliv['id']) {
  417 + $oneDeliv['isSelected'] = true;
  418 + $isDeliveryId = false;
  419 + }
418 420
419 $result['dispatchMode'][$key] = $oneDeliv; 421 $result['dispatchMode'][$key] = $oneDeliv;
420 } 422 }
421 423
422 - if (isset($orderInfo['deliveryId']) && isset($idArr[$orderInfo['deliveryId']])) {  
423 - $flag = array_search($orderInfo['deliveryId'], $idArr);  
424 - $flag !== false && $result['dispatchMode'][$flag]['isSelected'] = true;  
425 - } else { 424 + if ($isDeliveryId) {
426 $result['dispatchMode'][$defaultKey]['isSelected'] = true; 425 $result['dispatchMode'][$defaultKey]['isSelected'] = true;
427 } 426 }
428 } 427 }
@@ -499,7 +498,7 @@ class CartModel @@ -499,7 +498,7 @@ class CartModel
499 $onePay['name'] = $pay['payment_type_name']; 498 $onePay['name'] = $pay['payment_type_name'];
500 $onePay['isSupport'] = $pay['is_support'] === 'Y'; 499 $onePay['isSupport'] = $pay['is_support'] === 'Y';
501 // $onePay['default'] = ($pay['default'] === 'Y'); 500 // $onePay['default'] = ($pay['default'] === 'Y');
502 - if ($onePay['paymentType'] == 1) { 501 + if (isset($orderInfo['paymentType']) && $onePay['paymentType'] === $orderInfo['paymentType']) {
503 $onePay['recommend'] = true; 502 $onePay['recommend'] = true;
504 } 503 }
505 504