Commit 850979dc authored by liuyuzhen's avatar liuyuzhen

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

parents 07902478 bf0edb8e
......@@ -24,7 +24,7 @@ use Zend\Validator\File\Count;
*/
class RefundServiceModel extends \Business\AbstractModel
{
private $orderField = "buyer_id as buyerId,buyer_name as buyerName,order_id as orderId,order_sn as orderSn,store_name as storeName,refund_amount as refundAmount,add_time as AddTime,store_id as storeId,goods_amount as goodsAmount,shipping_fee as shippingFee,order_amount as orderAmount,shipping_type as shippingType,payment_type as paymentType,order_state as orderState,shipping_fee as shippingFee,refund_state as refundState,order_type as orderType,is_receive_payment as isReceivePayment,need_shipping_fee as needShippingFee,payment_code as paymentCode,delay_time as delayTime,gmt_update as gmtUpdate";
private $orderField = "buyer_id as buyerId,buyer_name as buyerName,order_id as orderId,order_sn as orderSn,store_name as storeName,refund_amount as refundAmount,add_time as AddTime,store_id as storeId,goods_amount as goodsAmount,shipping_fee as shippingFee,order_amount as orderAmount,shipping_type as shippingType,payment_type as paymentType,order_state as orderState,shipping_fee as shippingFee,refund_state as refundState,order_type as orderType,is_receive_payment as isReceivePayment,need_shipping_fee as needShippingFee,payment_code as paymentCode,delay_time as delayTime,gmt_update as gmtUpdate,origin_refund_amount as originRefundAmount";
private $orderGoodsField = "commis_rate as commisRate,goods_type as goodsType,order_id as orderId,rec_id as recId,goods_id as goodsId,goods_name as goodsName,goods_price as goodsPrice,goods_num as goodsNum,goods_image as goodsImage,goods_pay_price as goodsPayPrice,sale_act_id as saleActId,sale_id as saleId,comment_state as commentState,is_refund as isRefund,goods_spec as goodsSpec,goods_group as goodsGroup,refund_id as refundId";
private $refundOrderGoodsField = "rec_id as recId,goods_id as goodsId,goods_name as goodsName,goods_num as goodsNum,goods_image as goodsImage,goods_price as goodsPrice,goods_pay_price as goodsPayPrice,goods_spec as goodsSpec,goods_group as goodsGroup";
......@@ -1066,7 +1066,7 @@ class RefundServiceModel extends \Business\AbstractModel
$refundAmount = $orderInfo['orderAmount'] - ApiConst::zero;;
}
}
$refundAmount=$refundAmount-$orderInfo['refundAmount'];
$refundAmount=$refundAmount-$orderInfo['originRefundAmount'];
// if(!$alreadyRefundGoodsIds){
// $refundAmount=$refundAmount-$discountAmount;
// }
......@@ -1078,14 +1078,27 @@ class RefundServiceModel extends \Business\AbstractModel
// $refundAmount=$refundAmount-$discountAmount;
// }
}
if($allReadyGoodsCount==ApiConst::one){
$refundAmount=$refundAmount+$orderInfo['shippingFee'];
if($shippingFee){
$refundAmount=$refundAmount-$orderInfo['shippingFee'];
if($orderInfo['couponId']){
if($shippingFee){
$refundAmount=$refundAmount-$orderInfo['shippingFee'];
}
}else{
$refundAmount=$refundAmount+$orderInfo['shippingFee'];
if($shippingFee){
$refundAmount=$refundAmount-$orderInfo['shippingFee'];
}
}
// if($shippingFee && ($orderInfo['shippingType']==ApiConst::bySeller)){
// $refundAmount=$refundAmount-$orderInfo['shippingFee'];
// }
}else{
if($orderInfo['couponId']){
if($shippingFee){
$refundAmount=$refundAmount-$orderInfo['shippingFee'];
}
}
}
//修改后的优惠金额按比例退回
$discountAmount=$orderInfo['originAmount']- $orderInfo['orderAmount'];
......@@ -1172,6 +1185,7 @@ class RefundServiceModel extends \Business\AbstractModel
$storeDao=\DAO\StoreModel::getInstance();
$orderDao->setDb(DbNameConst::masterDBConnectName);
$orderDao->db->doTransaction();
$originRefundAmount= $refund['refundAmount'];
if($refund['refundType']==ApiConst::refundTypeGoods && $refund['refundShippingType']==ApiConst::bySeller){
$refund['refundAmount']-=$orderInfo['needShippingFee'];
......@@ -1256,6 +1270,7 @@ class RefundServiceModel extends \Business\AbstractModel
$refundArrayUnLine=Common::convertUnderline($refundArray);
$state = $refundReturnDao->addRefundReturn($refundArray,$orderInfo,$orderGoods);
$updateOrderData['refund_amount']= $orderInfo['refundAmount']+ $refundArray['refund_amount'];
$updateOrderData['origin_refund_amount']= $orderInfo['origin_refund_amount']+$originRefundAmount;
$orderDao->deleteOrderCache($memberId,$orderInfo['orderId'],$orderInfo['storeId'],true);
$storeDao->deleteStoreCache($orderInfo['storeId'],$orderInfo['orderId']);
......
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