2019-09-06 23:53:10 +08:00

146 lines
3.9 KiB
PHP
Executable File

<?php
namespace wstmart\app\controller;
use wstmart\common\model\Orders as M;
// use think\Loader;
/**
* ============================================================================
* 订单控制器
*/
class Shoporders extends Base{
// protected $beforeActionList = [
// 'checksession', //在任何操作执行前执行checksession方法
// 'islogin' => ['except'=>'login'], //在除login之外的其他方法执行前先执行islogin方法
// 'removesession' => ['only'=>'logout'], //在logout执行前先执行removesession
// ];
protected $beforeActionList = [
'checkAuth',//=>['only'=>'shopjoin,getshopjoininfo'],
'checkDataAuth'
];
/**
* 查看订单凭证
* @return [type] [description]
*/
public function viewCertificate(){
$m = new M();
$rs = $m->viewCertificate(1);
exit(json_encode($rs));
}
/**
* 商家-订单列表
*/
public function getSellerOrderList(){
/*
-3:拒收、退款列表
-2:待付款列表
-1:已取消订单
0: 待发货
1,2:待评价/已完成
*/
$type = input('param.type');
$status = [];
$shopConfirm = -1;
switch ($type) {
case 'waitPay':
$status=-2;
break;
case 'waitDeliver':
$status=0;
$shopConfirm = 1;
break;
case 'waitConfirm':
$status=0;
$shopConfirm = '0,2';
break;
case 'waitReceive':
$status=1;
break;
case 'finish':
$status=2;
break;
case 'abnormal': // 退款/拒收 与取消合并
$status=[-1,-3];
break;
default:
$status=[-5,-4,-3,-2,-1,0,1,2];
break;
}
$m = new M();
$rs = $m->shopOrderList($status,0,$shopConfirm);
//dump($rs);die;
foreach($rs['Rows'] as $k=>$v){
if(!empty($v['list'])){
foreach($v['list'] as $k1=>$v1){
$rs['Rows'][$k]['list'][$k1]['goodsImg'] = $v1['goodsImg'];
}
}
}
exit(jsonReturn('',1,$rs));
}
/**
* 订单确认
* @return [type] [description]
*/
public function orderConfirm(){
$m = new M();
$rs = $m->orderConfirm();
exit(jsonReturn('',1,$rs));
}
/**
* 查看未提交和已提交凭证
*/
public function getCertificate(){
$m = new M();
$rs = $m->getShopCertificate();
exit(json_encode($rs));
}
/**
* 获取已提交的凭证信息
*/
public function getCertificateInfo(){
$m = Model('common/Table');
$m->setTable('order_shop_certificate');
$id = (int)input('id');
$rs = $m->getInfo(['id'=>$id,'shopId'=>(int)session('WST_USER.shopId')],'id,content,imgUrl');
exit(jsonReturn('',1,$rs));
}
/**
* 商家上传凭证
*/
public function uploadCertificate(){
$m = new M();
$rs = $m->uploadShopCertificate();
exit(json_encode($rs));
}
/**
* 商家发货
*/
public function deliver(){
$m = new M();
$rs = $m->deliver();
return $rs;
}
/**
* 商家修改订单价格
*/
// public function editOrderMoney(){
// $m = new M();
// $rs = $m->editOrderMoney();
// return $rs;
// }
/**
* 商家-操作退款
*/
public function toShopRefund(){
return model('OrderRefunds')->getRefundMoneyByOrder((int)input('id'));
}
/**
* 商家处理是否同意退款
*/
public function shopRefund(){
$rs = model('OrderRefunds')->shopRefund();
exit(json_encode($rs)) ;
}
}