Authored by 郭成尧

'前端取消申请退换货'

... ... @@ -129,7 +129,7 @@ class ReturnsData
* @param $isChange
* @return mixed
*/
public static function setExpressNumber($id, $expressId, $expressNumber,$uid, $expressCompany, $isChange)
public static function setExpressNumber($id, $expressId, $expressNumber, $uid, $expressCompany, $isChange)
{
$param = array();
$param = Yohobuy::param();
... ... @@ -140,7 +140,7 @@ class ReturnsData
$param['uid'] = $uid;
$param['express_company'] = $expressCompany;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::post(yohobuy::API_URL, $param);
}
... ... @@ -236,6 +236,37 @@ class ReturnsData
return Yohobuy::post(yohobuy::API_URL, $param);
}
/**
* 取消退货申请
* @param $id
* @param $uid
* @return mixed
*/
public static function cancelRefund($id, $uid)
{
$param = Yohobuy::param();
$param['method'] = 'app.refund.cancel';
$param['id'] = $id;
$param['uid'] = $uid;
return Yohobuy::post(yohobuy::API_URL, $param);
}
/**
* 取消换货申请
* @param $id
* @param $uid
* @return mixed
*/
public static function cancelChange($id, $uid)
{
$param = Yohobuy::param();
$param['method'] = 'app.change.cancel';
$param['id'] = $id;
$param['uid'] = $uid;
return Yohobuy::post(yohobuy::API_URL, $param);
}
/**
* 获取换货方式
* @param $uid
... ...
... ... @@ -46,7 +46,6 @@ class ReturnsModel
$uri = '/home/returns/refundDetail';
if ($value['canCancel'] === 'Y') {
$list[$key]['canCancelUrl'] = Helpers::url('/home/returns/cancelRefund', $param);
$cancelUri = '/home/returns/';
}
} elseif ($value['refund_type'] == 2) { // tar note 160624 终止换货
$list[$key]['isChange'] = true;
... ... @@ -110,6 +109,10 @@ class ReturnsModel
}
$detail['goods'] = self::getDetailGoods($res['goods_list']);
$detail['expressList'] = self::getExpressCompany();
if ($res['canCancel'] === 'Y') {
$detail['canCancelUrl'] = Helpers::url('/home/returns/cancelChange', array('id' => $id));
}
} else {
return false;
}
... ... @@ -160,6 +163,10 @@ class ReturnsModel
$detail['backMode'] = isset($res['return_amount_mode_name']) ? $res['return_amount_mode_name'] : '';
$detail['goods'] = self::getDetailGoods($res['goods_list']);
$detail['expressList'] = self::getExpressCompany();
if ($res['canCancel'] === 'Y') {
$detail['canCancelUrl'] = Helpers::url('/home/returns/cancelRefund', array('id' => $id));
}
} else {
return false;
}
... ...
... ... @@ -2,6 +2,7 @@
use Action\WebAction;
use Home\ReturnsModel;
use WebPlugin\Helpers;
use LibModels\Web\Home\ReturnsData;
class ReturnsController extends WebAction
{
... ... @@ -53,7 +54,7 @@ class ReturnsController extends WebAction
{
/* 判断是不是AJAX请求 */
if (!$this->isAjax()) {
return;
return;
}
$areaCode = $this->post('areaCode');
//获取必要参数
... ... @@ -82,14 +83,14 @@ class ReturnsController extends WebAction
$uid = $this->getUid();
$goods = $this->post('goods');
$payment = $this->post('payment');
if (empty($orderCode) || $orderCode<1 || empty($goods) || empty($payment)) {
$this->echoJson(array('code'=>203,'message'=>'非法提交'));
if (empty($orderCode) || $orderCode < 1 || empty($goods) || empty($payment)) {
$this->echoJson(array('code' => 203, 'message' => '非法提交'));
}
//调用模型提交退货申请
$res = ReturnsModel::saveRefund($orderCode, $uid, $goods, $payment);
//退货申请成功,返回前端相应格式,并返回退货成功页跳转地址
if (isset($res['code']) && $res['code'] == 200) {
$successUrl = Helpers::url('/home/returns/refundSuccess', array('orderCode'=>$orderCode));
$successUrl = Helpers::url('/home/returns/refundSuccess', array('orderCode' => $orderCode));
$res['data']['refer'] = $successUrl;
}
$this->echoJson($res);
... ... @@ -117,8 +118,8 @@ class ReturnsController extends WebAction
$deliveryType = $this->post('deliveryType');
//判断参数合法性
if (empty($orderCode) || $orderCode<1 || empty($goods) || empty($deliveryType) || empty($consigneeName) || empty($areaCode) || empty($address) || empty($mobile)) {
$this->echoJson(array('code'=>203,'message'=>'非法提交'));
if (empty($orderCode) || $orderCode < 1 || empty($goods) || empty($deliveryType) || empty($consigneeName) || empty($areaCode) || empty($address) || empty($mobile)) {
$this->echoJson(array('code' => 203, 'message' => '非法提交'));
return;
}
//调用模型提交换货申请
... ... @@ -126,7 +127,7 @@ class ReturnsController extends WebAction
//换货成功,返回前端相应格式,并返回换货成功页跳转链接
if (isset($res['code']) && $res['code'] == '200') {
$successUrl = Helpers::url('/home/returns/exchangeSuccess', array('orderCode'=>$orderCode));
$successUrl = Helpers::url('/home/returns/exchangeSuccess', array('orderCode' => $orderCode));
$res['data']['refer'] = $successUrl;
}
... ... @@ -204,6 +205,7 @@ class ReturnsController extends WebAction
//头部导航
$channel = Helpers::getChannelNameByCookie();
$this->setWebNavHeader($channel);
$this->_view->display('returns-detail', array('meReturnsPage' => true, 'returns' => $data));
}
... ... @@ -224,6 +226,7 @@ class ReturnsController extends WebAction
//头部导航
$channel = Helpers::getChannelNameByCookie();
$this->setWebNavHeader($channel);
$this->_view->display('returns-detail', array('meReturnsPage' => true, 'returns' => $data));
}
... ... @@ -246,11 +249,11 @@ class ReturnsController extends WebAction
$expressNumber = $this->post('expressNumber');
$uid = $this->getUid();
$expressCompany = $this->post('expressCompany');
$res = array('code'=>201,'message'=>'请求失败');
$res = array('code' => 201, 'message' => '请求失败');
if (!isset($id) || !isset($expressId) || !isset($expressNumber) || !isset($uid) || !isset($expressCompany) || !isset($isChange)) {
return $res;
}
$res = ReturnsModel::setExpressNumber($id, $expressId, $expressNumber,$uid, $expressCompany, $isChange);
$res = ReturnsModel::setExpressNumber($id, $expressId, $expressNumber, $uid, $expressCompany, $isChange);
$this->echoJson($res);
}
... ... @@ -263,7 +266,7 @@ class ReturnsController extends WebAction
{
//判断是否登录,未登录则退出
if (!$this->getUid()) {
$this->echoJson(array('code'=>'400','message'=>'请登录'));
$this->echoJson(array('code' => '400', 'message' => '请登录'));
exit;
}
$result = ReturnsModel::saveRefundImg('fileData');
... ... @@ -271,7 +274,43 @@ class ReturnsController extends WebAction
$this->echoJson($result);
}
/**
* 取消退货申请
*/
public function cancelRefundAction()
{
$orderId = $this->get('id');
$uid = $this->getUid();
if (!$this->isAjax()) {
return;
}
$res = ReturnsData::cancelRefund($orderId, $uid);
$result = array();
if ($res['code'] === 200) {
$result['message'] = $res['message'];
}
$this->echoJson($result);
}
/**
* 取消换货申请
*/
public function cancelChangeAction()
{
$orderId = $this->get('id');
$uid = $this->getUid();
if (!$this->isAjax()) {
return;
}
$res = ReturnsData::cancelChange($orderId, $uid);
$result = array();
if ($res['code'] === 200) {
$result['message'] = $res['message'];
}
$this->echoJson($result);
}
/**
* 个人中心-根据商品skn,颜色,尺码返回商品的sku,goodsId(待用)
... ...