Commit 5472bac4 authored by christ's avatar christ

refund

parent 38e42329
...@@ -152,6 +152,9 @@ class DescribeConst ...@@ -152,6 +152,9 @@ class DescribeConst
const refund='退款'; const refund='退款';
const refundRetund='退货'; const refundRetund='退货';
const sellerRefuseReturn='卖家拒绝退货';
const sellerAgreeReturn='卖家同意退货';
//用户订单送达消息 //用户订单送达消息
const reacheRemindTitle='你的订单卖家已经送达'; const reacheRemindTitle='你的订单卖家已经送达';
const reacheRemindContent='你有新的订单号为{0}的订单已经已经送达'; const reacheRemindContent='你有新的订单号为{0}的订单已经已经送达';
......
...@@ -736,7 +736,7 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -736,7 +736,7 @@ class OrderServiceModel extends \Business\AbstractModel
$orderDao->deleteOrderCache($order['buyerId'],(string)$order['orderId'],$order['storeId'],true); $orderDao->deleteOrderCache($order['buyerId'],(string)$order['orderId'],$order['storeId'],true);
$storeDao->deleteStoreCache($order['storeId'],$order['orderId']); $storeDao->deleteStoreCache($order['storeId'],$order['orderId']);
$push=\Our\Push::getInstance(); $push=\Our\Push::getInstance();
$pushData=array('storeId'=>$order['store_id'], $pushData=array('storeId'=>$order['storeId'],
'type'=>ApiConst::messageWaitReceive, 'type'=>ApiConst::messageWaitReceive,
'waitReceiveCount'=>ApiConst::reduceOne, 'waitReceiveCount'=>ApiConst::reduceOne,
'waitDeliveryCount'=>0, 'waitDeliveryCount'=>0,
...@@ -748,7 +748,7 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -748,7 +748,7 @@ class OrderServiceModel extends \Business\AbstractModel
'alertCount'=>ApiConst::zero, 'alertCount'=>ApiConst::zero,
'params'=>array('c'=>'shopkeeper', 'params'=>array('c'=>'shopkeeper',
'm'=>'orderDetail', 'm'=>'orderDetail',
'orderId'=>$order['order_id'])); 'orderId'=>$order['orderId']));
$push->addOneToClient($pushData); $push->addOneToClient($pushData);
} }
......
...@@ -515,12 +515,27 @@ class RefundReturnModel extends \DAO\AbstractModel { ...@@ -515,12 +515,27 @@ class RefundReturnModel extends \DAO\AbstractModel {
$this->deleteFindByOrderIdCache($refundId); $this->deleteFindByOrderIdCache($refundId);
} }
} }
// public function editOrderUnlock($order_id) {
// $order_id = intval($order_id);
// if ($order_id > 0) {
// $condition = array();
// $condition['order_id'] = $order_id;
// $condition['lock_state'] = array('egt','1');
// $data = array();
// $data['lock_state'] = array('exp','lock_state-1');
// $data['delay_time'] = time();
// $model_order =\DAO\Order\OrderModel::getInstance(DbNameConst::masterDBConnectName);
// $result = $model_order->update($condition,$data);
// return $result;
// }
// return false;
// }
/** /**
*获得退货退款列表 *获得退货退款列表
* *
* @var \DAO\getList * @var \DAO\getList
*/ */
public function getList($where, $field, $pageIndex, $pageSize, $order = array('add_time' => 'desc')) public function getList($where, $field, $pageIndex=ApiConst::zero, $pageSize=ApiConst::pageSize, $order = array('add_time' => 'desc'))
{ {
$this->setDb($this->dbName); $this->setDb($this->dbName);
$refunds = $this->lists($where, $order, $field, $pageIndex, $pageSize); $refunds = $this->lists($where, $order, $field, $pageIndex, $pageSize);
...@@ -535,6 +550,44 @@ class RefundReturnModel extends \DAO\AbstractModel { ...@@ -535,6 +550,44 @@ class RefundReturnModel extends \DAO\AbstractModel {
return $returnType; return $returnType;
} }
public function getRefundOperateState($operate,$refund_info,$order_info = null) {
if (!is_array($refund_info) || empty($refund_info)) return false;
switch ($operate){
//选择配送员
case 'select_deliveryman':
$state = ($refund_info['refund_shipping_type'] == 1 && $refund_info['return_type'] == 2 && $refund_info['goods_state'] == 2 && ($refund_info['seller_state'] == 2 || $refund_info['platform_state'] == 1));
break;
//收货
case 'take_delivery':
$state = ($refund_info['return_type'] == 2 && $refund_info['goods_state'] == 2 && ($refund_info['seller_state'] == 2 || $refund_info['platform_state'] == 1));
//修改退款金额/处理
break;
case 'change_refund':
$state = ($refund_info['seller_state']==1);
break;
//退货
case 'return_goods':
$state = ($refund_info['seller_state']==1 && $refund_info['refund_type']==2);
break;
//退款
case 'return_money':
$state = ($refund_info['seller_state']==1 && $refund_info['refund_type']==1);
break;
//修改收货时间
case 'change_time':
$state = (!$refund_info['receive_time'] && $refund_info['refund_shipping_type'] == 1 && $refund_info['return_type'] == 2 && $refund_info['goods_state'] == 2 && ($refund_info['seller_state'] == 2 || $refund_info['platform_state'] == 1));
break;
//原路退回
case 'return_origin':
$state = ($refund_info['refund_type'] == 1 || ($refund_info['refund_type'] == 2 && $refund_info['goods_state'] == 4)) && $refund_info['is_suc_refund'] == 0 && ($refund_info['seller_state'] == 2 || $refund_info['platform_state'] == 1) && ($order_info && $order_info['payment_type'] != 0 && $order_info['payment_type'] != 2);
break;
//标记为已退款
case 'mark':
$state = ($refund_info['refund_type'] == 1 || ($refund_info['refund_type'] == 2 && $refund_info['goods_state'] == 4)) && $refund_info['is_suc_refund'] == 0 && ($refund_info['seller_state'] == 2 || $refund_info['platform_state'] == 1) && ($order_info && ($order_info['payment_type'] == 0 ||$order_info['payment_type'] == 2)) ;
break;
}
return $state;
}
public function getMemberStoreStaticsByGmtUpdate($gmtUpdate,$pageIndex,$pageSize){ public function getMemberStoreStaticsByGmtUpdate($gmtUpdate,$pageIndex,$pageSize){
$this->setDb($this->dbName); $this->setDb($this->dbName);
$where =\Our\Common::format(' gmt_update>={0} and gmt_update<{1} and refund_state={2}',$gmtUpdate,TIMESTAMP,ApiConst::refundStateComplete); $where =\Our\Common::format(' gmt_update>={0} and gmt_update<{1} and refund_state={2}',$gmtUpdate,TIMESTAMP,ApiConst::refundStateComplete);
...@@ -594,6 +647,7 @@ class RefundReturnModel extends \DAO\AbstractModel { ...@@ -594,6 +647,7 @@ class RefundReturnModel extends \DAO\AbstractModel {
public function getReturnWaitReceive($id){ public function getReturnWaitReceive($id){
$where['store_id']=$id; $where['store_id']=$id;
$where['refund_type']=ApiConst::refundTypeGoods; $where['refund_type']=ApiConst::refundTypeGoods;
$where['return_type']=ApiConst::returnTypeMustReturn;
$where['goods_state']=ApiConst::goodsStateWaitRecieve; $where['goods_state']=ApiConst::goodsStateWaitRecieve;
return $where; return $where;
} }
......
...@@ -130,6 +130,7 @@ class CodeConfigModel ...@@ -130,6 +130,7 @@ class CodeConfigModel
const emptyScanStoreId = 40010; const emptyScanStoreId = 40010;
const emptyScanStoreInfo = 40011; const emptyScanStoreInfo = 40011;
const saveScanStoreInfoFailed = 40012; const saveScanStoreInfoFailed = 40012;
const storeNotOpen = 40013;
//购物车 //购物车
const wrongCartType = 50001; const wrongCartType = 50001;
...@@ -314,7 +315,9 @@ class CodeConfigModel ...@@ -314,7 +315,9 @@ class CodeConfigModel
const orderWxPayError = 30137; const orderWxPayError = 30137;
const orderWxPaySignError = 30138; const orderWxPaySignError = 30138;
const wrongRefundState=300139;
const updateIsRefundFail=300140;
const updateRefundStateNameFail=300141;
//店铺相关错误码 //店铺相关错误码
//商品分类 //商品分类
...@@ -549,6 +552,7 @@ class CodeConfigModel ...@@ -549,6 +552,7 @@ class CodeConfigModel
self::emptyScanStoreId => '扫码关注店铺ID为空', self::emptyScanStoreId => '扫码关注店铺ID为空',
self::emptyScanStoreInfo => '扫码关注店铺不存在', self::emptyScanStoreInfo => '扫码关注店铺不存在',
self::saveScanStoreInfoFailed => '扫码店铺保存失败', self::saveScanStoreInfoFailed => '扫码店铺保存失败',
self::storeNotOpen => '店铺还未配置开启',
//购物车相关 //购物车相关
self::wrongCartType => '加入购物车类型不能为空', self::wrongCartType => '加入购物车类型不能为空',
...@@ -809,6 +813,9 @@ class CodeConfigModel ...@@ -809,6 +813,9 @@ class CodeConfigModel
self::selfGoodsForStoreOrder => '店主不能购买自己的商品', self::selfGoodsForStoreOrder => '店主不能购买自己的商品',
self::orderWxPayError => '微信支付尚未开通', self::orderWxPayError => '微信支付尚未开通',
self::orderWxPaySignError => '微信支付签名错误', self::orderWxPaySignError => '微信支付签名错误',
self::wrongRefundState=>'订单状态有误',
self::updateIsRefundFail=>'更新is_refund失败',
self::updateRefundStateNameFail=>'更新order表refund_state_name失败',
//销售员 //销售员
self::emptySaleGoodsId => '商品id不能为空', self::emptySaleGoodsId => '商品id不能为空',
self::emptySaleGoods => '销售商品不存在', self::emptySaleGoods => '销售商品不存在',
......
...@@ -259,8 +259,13 @@ class ShopkeeperController extends \Our\Controller_AbstractClient { ...@@ -259,8 +259,13 @@ class ShopkeeperController extends \Our\Controller_AbstractClient {
$refundService=\Business\Order\RefundServiceModel::getInstance(); $refundService=\Business\Order\RefundServiceModel::getInstance();
$refundAmount = floatval($this->req['data']['refundAmount']); $refundAmount = floatval($this->req['data']['refundAmount']);
$text = trim($this->req['data']['text']); $text = trim($this->req['data']['text']);
$res = $refundService->refund($this->storeId, $this->sellerId, $this->sellerName, $refundId, $refundAmount, $text); $isGiveUp=$this->req['data']['isGiveUp']?$this->req['data']['isGiveUp']:\Our\ApiConst::zero;
$this->success($res); $res = $refundService->refund($this->storeId, $this->sellerId, $this->sellerName, $refundId, $refundAmount, $text,\Our\ApiConst::refundSellerAgree,$isGiveUp);
if($res){
$this->success('操作成功');
}
ErrorModel::throwException(CodeConfigModel::commonError);
} }
/** /**
......
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