Authored by Rock Zhang

修复配送方式与配送时间不能保存的bug

... ... @@ -306,7 +306,7 @@ class CartModel
// cookie保存的数据
if (!empty($cookieData)) {
$orderInfo = json_decode($cookieData, true);
$orderCompute = self::orderCompute($uid, $cartType, $orderInfo['deliveryId'], $orderInfo['paymentTypeId'], $orderInfo['couponCode'], $orderInfo['yohoCoin']);
// $orderCompute = self::orderCompute($uid, $cartType, $orderInfo['deliveryId'], $orderInfo['paymentTypeId'], $orderInfo['couponCode'], $orderInfo['yohoCoin']);
}
// 根据地址id查询地址信息
... ... @@ -326,32 +326,50 @@ class CartModel
// 配送方式
if (isset($payReturn['delivery_way'])) {
$idArr = array();
$defaultKey = 0;
$oneDeliv = array();
foreach ($payReturn['delivery_way'] as $val) {
foreach ($payReturn['delivery_way'] as $key => $val) {
$oneDeliv = array();
$oneDeliv['id'] = $val['delivery_way_id'];
$oneDeliv['name'] = $val['delivery_way_name'];
($val['default'] === 'Y') && $defaultKey = $key;
isset($orderInfo['deliveryId']) && $orderInfo['deliveryId'] === $oneDeliv['id'] && $oneDeliv['isSelected'] = true;
$idArr[$key] = $oneDeliv['id'];
!isset($oneDeliv['isSelected']) && $oneDeliv['isSelected'] = ($val['default'] === 'Y');
$result['dispatchMode'][$key] = $oneDeliv;
}
$result['dispatchMode'][] = $oneDeliv;
if (isset($orderInfo['deliveryId'])) {
$flag = array_search($orderInfo['deliveryId'], $idArr);
$flag !== false && $result['dispatchMode'][$flag]['isSelected'] = true;
} else {
$result['dispatchMode'][$defaultKey]['isSelected'] = true;
}
}
// 配送时间
if (isset($payReturn['delivery_time'])) {
$idArr = array();
$defaultKey = 0;
$oneDelivTime = array();
foreach ($payReturn['delivery_time'] as $one) {
foreach ($payReturn['delivery_time'] as $key => $one) {
$oneDelivTime = array();
$oneDelivTime['id'] = $one['delivery_time_id'];
$oneDelivTime['name'] = $one['delivery_time_string'];
$oneDelivTime['default'] = ($one['default'] === 'Y');
isset($orderInfo['deliveryTimeId']) && $orderInfo['deliveryTimeId'] === $oneDelivTime['id'] && $oneDeliv['isSelected'] = true;
($one['default'] === 'Y') && $defaultKey = $key;
$idArr[$key] = $oneDelivTime['id'];
$result['dispatchTime'][] = $oneDelivTime;
}
if (isset($orderInfo['deliveryTimeId'])) {
$flag = array_search($orderInfo['deliveryTimeId'], $idArr);
$flag !== false && $result['dispatchTime'][$flag]['isSelected'] = true;
} else {
$result['dispatchTime'][$defaultKey]['isSelected'] = true;
}
}
// 订单商品
... ...