Commit be6cd077 authored by liuyuzhen's avatar liuyuzhen

Merge branch 'master_dev' of git.shenbd.com:qm-develop/shenbd into lyz

parents 43dac90f 90bda454
......@@ -14,6 +14,7 @@ use Our\ImageConst;
use Our\ImageUtil;
use Our\NameConst;
use Our\OrderConst;
use Zend\Validator\File\Count;
/**
* 店铺service
......@@ -992,6 +993,7 @@ class RefundServiceModel extends \Business\AbstractModel
$orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance();
$orderGoodses = \Our\RedisHelper::cachedFunction(\Redis\Db5\RefundReasonRedisModel::getInstance(), array(&$orderGoodsDao, 'getOrderGoodsByOrderIds'), array($orderInfo['orderId'], $this->orderGoodsField), \Our\ApiConst::oneDaySecond);
$orderGoodses = $orderGoodsDao->convertOrderGoods($orderGoodses, 'goodsId');
$allOrderGoods=$orderGoodses;
$goodsIds = $orderGoodsDao->getRefundOrderGoodsIds($orderGoodses);
$alreadyRefundGoodsIds=$goodsIds;
// $this->store=$storeDao->get($this->order['storeId']);
......@@ -1006,11 +1008,18 @@ class RefundServiceModel extends \Business\AbstractModel
ErrorModel::throwException(CodeConfigModel::notExistOrderGoods);
}
$shippingFee = ApiConst::zero;
if (count($orderGoods) == ApiConst::one) {
$shippingFee = $storeDao->isFee($orderInfo['storeId'], $orderInfo['shippingType'], $orderInfo['order_state']) ? $orderInfo['shippingFee'] : ApiConst::zero;
} else {
$allReadyGoodsCount=count($goodsIds);
$allGoodsCount=count($orderGoodses);
if($allReadyGoodsCount==$allGoodsCount){
$shippingFee = $storeDao->isFee($orderInfo['storeId'], $orderInfo['shippingType'], $orderInfo['orderState']) ? $orderInfo['shippingFee'] : ApiConst::zero;
}else{
$shippingFee == ApiConst::zero;
}
// if (count($orderGoods) == ApiConst::one) {
// $shippingFee = $storeDao->isFee($orderInfo['storeId'], $orderInfo['shippingType'], $orderInfo['orderState']) ? $orderInfo['shippingFee'] : ApiConst::zero;
// } else {
// $shippingFee == ApiConst::zero;
// }
$orderGoodsConvert = $orderGoodsDao->getRefundOrderGoods($orderGoods);
$returnData = array(
......@@ -1035,6 +1044,10 @@ class RefundServiceModel extends \Business\AbstractModel
// }
//修改后的优惠金额
$discountAmount=$orderInfo['originAmount']- $orderInfo['orderAmount'];
$mustReduceAmount=ApiConst::zero;
if($discountAmount){
$mustReduceAmount=$orderGoodsDao->getMustReduceAmount($allOrderGoods,$discountAmount,$orderGoodsConvert);
}
if ($orderInfo['paymentTime']) {
$orderConfirmUtil = \Order\OrderConfirmUtil::getInstance();
......@@ -1043,19 +1056,26 @@ class RefundServiceModel extends \Business\AbstractModel
$refundCondition['storeCarts']['storeCarts'] = $cartDao->refundGoodsRemove($refundCondition['storeCarts']['storeCarts'], $goodsIds);
if (!empty($refundCondition['storeCarts']['storeCarts'])) {
$newTotalPrice = $orderConfirmUtil->reCalcOrderAmount($refundCondition['coupon'], $refundCondition['storeCarts']['storeCarts']);
$refundAmount = $orderInfo['orderAmount'] - $orderInfo['shippingFee'] - $newTotalPrice;
$refundAmount = $orderInfo['orderAmount'] - $newTotalPrice;
} else {
$refundAmount = $orderInfo['orderAmount'] - $orderInfo['shippingFee'] - ApiConst::zero;;
$refundAmount = $orderInfo['orderAmount'] - ApiConst::zero;;
}
}
if(!$alreadyRefundGoodsIds){
$refundAmount=$refundAmount-$discountAmount;
}
// if(!$alreadyRefundGoodsIds){
// $refundAmount=$refundAmount-$discountAmount;
// }
} else {
$refundAmount = $orderGoods['goodsPrice']*$orderGoods['goodsNum'];
if(!$alreadyRefundGoodsIds){
$refundAmount=$refundAmount-$discountAmount;
// if(!$alreadyRefundGoodsIds){
// $refundAmount=$refundAmount-$discountAmount;
// }
}
$refundAmount=$refundAmount-$mustReduceAmount;
if($orderInfo['shippingType']==ApiConst::bySeller){
if(!$shippingFee){
$refundAmount=$refundAmount+$orderInfo['shippingFee'];
}
}
$liveMoney=$orderInfo['orderAmount']-$orderInfo['refundAmount'];
......@@ -1063,10 +1083,11 @@ class RefundServiceModel extends \Business\AbstractModel
$refundAmount=$liveMoney;
}
// $returnData['refundAmount'] = $refundAmount - $orderInfo['refundAmount'] - $returnData['needShippingFee'] + $shippingFee;
$returnData['refundAmount'] = $refundAmount - $returnData['needShippingFee'] + $shippingFee;
$returnData['refundAmount'] = $refundAmount - $returnData['needShippingFee'];
if((int)$returnData['refundAmount'] <ApiConst::zero){
$returnData['refundAmount']=ApiConst::zero;
}
// if($orderGoods['goodsType']==ApiConst::goodsTypeFour){
// //已经退款过的金额
// $alreadyRefundMoney=$orderGoodsDao->getIsRefundMoney($orderGoodses,$orderGoods['promotionsId']);
......
This diff is collapsed.
......@@ -208,7 +208,8 @@ class StoreModel extends \DAO\AbstractModel
public function isChargeGet($storeId)
{
$isChargeGet = $this->getInfoById($storeId, 'is_charge_get');
return $isChargeGet > ApiConst::zero ? TRUE : FALSE;
return $isChargeGet['is_charge_get'] > ApiConst::zero ? TRUE : FALSE;
}
//线上支付订单已接单待发货退款是否收取服务费(0:否 1:是)
......
......@@ -27,7 +27,7 @@ class StoreGoodsClassGoodsModel extends \DAO\AbstractModel {
public function getList($where,$field,$order = true){
$this->setDb($this->dbName);
if($order){
return $this->db->select($field)->from($this->_tableName)->where($where)->order('gc_sort','DESC')->fetchAll();
return $this->db->select($field)->from($this->_tableName)->where($where)->order('gc_sort','ASC')->fetchAll();
}
return $this->db->select($field)->from($this->_tableName)->where($where)->fetchAll();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment