Commit 9a133957 authored by chenchuanwen's avatar chenchuanwen

refundreturn

parent 235d91f0
......@@ -158,6 +158,9 @@ class DescribeConst
const refundRetund='退货';
const refundSuccess='退款成功';
const alreadyRecieve='已收货';
const alreadyComplete='已完成';
const sellerRefuseReturn='卖家拒绝退货';
const sellerAgreeReturn='卖家同意退货';
......
......@@ -37,7 +37,7 @@ class RefundServiceModel extends \Business\AbstractModel
//获得退款详情字段
private $refundReturnField = 'refund_id as refundId,order_id as orderId,order_sn as orderSn,refund_sn as refundSn,store_id as storeId,store_name as storeName,seller_state as sellerState,goods_id as goodsId,order_goods_id as orderGoodsId,goods_name as goodsName,goods_num as goodsNum,refund_amount as refundAmount,goods_image as goodsImage,refund_type as refundType,refund_state as refundState,return_type as returnType,add_time as addTime,seller_time as sellerTime,admin_time as adminTime,reason_info as reasonInfo,pic_info as picInfo,buyer_message as buyerMessage,seller_message as sellerMessage,admin_message adminMessage,express_id as expressId,invoice_no as invoiceNo,ship_time as shipTime,delay_time as delayTime,receive_time as receiveTime,shipping_over as shippingOver,shipping_sign as shippingSign,shipping_html as shippingHtml,is_suc_refund as isSucRefund,refund_shipping_type as refundShippingType,address_id as addressId,diliveryman_id as diliverymanId,is_platform_in as isPlatformIn,platform_in_reason as platformInReason,platform_state as platformState,seller_state as sellerState,return_type as returnType,refund_shipping_type as refundShippingType,buyer_refund_amount as buyerRefundAmount,reason_id as reasonId,receive_message as receiveMessage,goods_state as goodsState';
private $storeRefundReturnField = 'refund_id as refundId,order_id as orderId,order_sn as orderSn,refund_sn as refundSn,store_id as storeId,store_name as storeName,seller_state as sellerState,goods_id as goodsId,order_goods_id as orderGoodsId,goods_name as goodsName,goods_num as goodsNum,refund_amount as refundAmount,buyer_refund_amount as buyerRefundAmount,goods_image as goodsImage,refund_type as refundType,refund_state as refundState,return_type as returnType,add_time as addTime,seller_time as sellerTime,admin_time as adminTime,reason_id as reasonId,reason_info as reasonInfo,pic_info as picInfo,buyer_message as buyerMessage,seller_message as sellerMessage,admin_message adminMessage,express_id as expressId,invoice_no as invoiceNo,ship_time as shipTime,delay_time as delayTime,receive_time as receiveTime,receive_message as receiveMessage,shipping_over as shippingOver,shipping_sign as shippingSign,shipping_html as shippingHtml,is_suc_refund as isSucRefund,refund_shipping_type as refundShippingType,address_id as addressId,diliveryman_id as diliverymanId,is_platform_in as isPlatformIn,platform_in_reason as platformInReason,platform_state as platformState,return_type as returnType,refund_shipping_type as refundShippingType,goods_state as goodsState,buyer_name as buyerName';
private $storeRefundReturnField = 'refund_id as refundId,order_id as orderId,order_sn as orderSn,refund_sn as refundSn,store_id as storeId,store_name as storeName,seller_state as sellerState,goods_id as goodsId,order_goods_id as orderGoodsId,goods_name as goodsName,goods_num as goodsNum,refund_amount as refundAmount,buyer_refund_amount as buyerRefundAmount,goods_image as goodsImage,refund_type as refundType,refund_state as refundState,return_type as returnType,add_time as addTime,seller_time as sellerTime,admin_time as adminTime,reason_id as reasonId,reason_info as reasonInfo,pic_info as picInfo,buyer_message as buyerMessage,seller_message as sellerMessage,admin_message adminMessage,express_id as expressId,invoice_no as invoiceNo,ship_time as shipTime,delay_time as delayTime,receive_time as receiveTime,receive_message as receiveMessage,shipping_over as shippingOver,shipping_sign as shippingSign,shipping_html as shippingHtml,is_suc_refund as isSucRefund,refund_shipping_type as refundShippingType,address_id as addressId,diliveryman_id as diliverymanId,is_platform_in as isPlatformIn,platform_in_reason as platformInReason,platform_state as platformState,return_type as returnType,refund_shipping_type as refundShippingType,goods_state as goodsState,buyer_name as buyerName,payment_type as paymentType';
private $order;
......@@ -167,7 +167,7 @@ class RefundServiceModel extends \Business\AbstractModel
}
}
}
$refundUpdate = array('is_suc_refund' => 1, 'gmt_update' => TIMESTAMP, 'refund_state' => 3);
$refundUpdate = array('gmt_update' => TIMESTAMP, 'refund_state' => 3);
$res = $refundReturnDao->update(array('refund_id' => $refund['refund_id']), $refundUpdate);
if (!$res) {
ErrorModel::throwException(CodeConfigModel::refundWriteError);
......@@ -175,7 +175,13 @@ class RefundServiceModel extends \Business\AbstractModel
// showDialog('退款成功,退款表写入失败,请联系工作人员!',$reload,'error');
return false;
}
$result = $orderGoodsDao->update(array('rec_id' => $refund['order_goods_id']), array('refund_state_name'=>'退款成功', 'gmt_update' => TIMESTAMP));
$refundGoodsUpdate= array('refund_state_name'=>DescribeConst::alreadyComplete, 'gmt_update' => TIMESTAMP);
if(!in_array($refund['payment_type'],ArrayConst::orderPayTypeOnlines)){
if($refund['is_suc_refund']!=ApiConst::refundSuccess){
$refundGoodsUpdate['refund_state_name']=DescribeConst::alreadyRecieve;
}
}
$result = $orderGoodsDao->update(array('rec_id' => $refund['order_goods_id']),$refundGoodsUpdate );
if (!$result) {
$refundReturnDao->db->doRollback();
// showDialog('refund_state_name',$reload,'error');
......@@ -223,6 +229,16 @@ class RefundServiceModel extends \Business\AbstractModel
}$updateData=array();
$updateData['is_suc_refund']=ApiConst::refundSuccess;
$updateData['refund_state']=ApiConst::refundStateComplete;
if($returnDetail['goodsState']!=ApiConst::goodsStateRecieved){
if($returnDetail['refundType']==ApiConst::refundApplyOnlyMoney){
$updateData['refund_state']=ApiConst::refundStateComplete;
}else{
$updateData['refund_state']=ApiConst::refundStateProccess;
if($returnDetail['returnType']==ApiConst::returnTypeNotReturn){
$updateData['refund_state']=ApiConst::refundStateComplete;
}
}
}
$res=$refundReturnDao->update(array('refund_id'=>$refundId), $updateData);
$goodsUpdateData['is_refund']=ApiConst::refundSuccess;
$goodsUpdateData['refund_state_name']=DescribeConst::refundSuccess;
......
......@@ -25,7 +25,7 @@ class RefundReturnModel extends \DAO\AbstractModel
* @var string
*/
protected $_tableName = 'han_refund_return';
public $refundDetailField = 'is_platform_in as isPlatformIn,seller_state as sellerState,platform_state as platformState,refund_id as refundId,order_id as orderId,store_id as storeId,order_goods_id as orderGoodsId';
public $refundDetailField = 'is_platform_in as isPlatformIn,seller_state as sellerState,platform_state as platformState,refund_id as refundId,order_id as orderId,store_id as storeId,order_goods_id as orderGoodsId,refund_type as refundType,return_type as returnType,goods_state as goodsState';
public $refundReturnField = "seller_state,refund_state,is_platform_in,platform_state";
private $sumField = "order_id as orderId,buyer_id as buyerId,store_id as storeId,goods_num as goodsNum,refund_amount as refundAmount,is_suc_refund as isSucRefund,gmt_update as gmtUpdate";
private $sumRefundAmount = " sum(refund_amount) as sumRefundAmont";
......@@ -221,21 +221,41 @@ class RefundReturnModel extends \DAO\AbstractModel
return OrderConst::sellerAgree;
}
if ($returnRefund['refundType'] == ApiConst::refundTypeGoods) {
if ($returnRefund['isSucRefund'] == ApiConst::refundSuccess) {
return OrderConst::alreadyReufndMoney;
}
if ($returnRefund['goodsState'] == ApiConst::goodsStateUnRecieve) {
return OrderConst::goodsStateUnRecieve;
}
if ($returnRefund['goodsState'] == ApiConst::goodsStateRecieved) {
return OrderConst::goodsStateRecieved;
return OrderConst::goodsStateUnRecieve;
}
if ($returnRefund['returnType'] == ApiConst::returnTypeNotReturn) {
return OrderConst::sellerAgreeReturn;
}
if ($returnRefund['returnType'] == ApiConst::returnTypeMustReturn) {
return OrderConst::waitSellerRecieve;
if ($returnRefund['isSucRefund'] == ApiConst::refundSuccess) {
if($returnRefund['goodsState'] == ApiConst::goodsStateRecieved){
return OrderConst::complete;
}
if($isSeller){
if ($returnRefund['returnType'] == ApiConst::returnTypeNotReturn) {
$stateName= OrderConst::complete;
}
if ($returnRefund['returnType'] == ApiConst::returnTypeMustReturn) {
$stateName=OrderConst::alreadyReufndMoney;
}
}else{
if ($returnRefund['returnType'] == ApiConst::returnTypeNotReturn) {
$stateName= OrderConst::sellerAgreeReturn;
}
if ($returnRefund['returnType'] == ApiConst::returnTypeMustReturn) {
$stateName=OrderConst::waitSellerRecieve;
}
}
}else{
if($returnRefund['goodsState'] == ApiConst::goodsStateRecieved){
return OrderConst::goodsStateRecieved;
}
if ($returnRefund['returnType'] == ApiConst::returnTypeNotReturn) {
$stateName= OrderConst::sellerAgreeReturn;
}
if ($returnRefund['returnType'] == ApiConst::returnTypeMustReturn) {
$stateName=OrderConst::waitSellerRecieve;
}
}
return $stateName;
}
}
if ($returnRefund['sellerState'] == ApiConst::refundSellerRefuse) {
......
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