|
@@ -8,6 +8,7 @@ use app\common\model\OrderVoucher;
|
|
|
use app\common\model\Refund;
|
|
|
use app\common\service\OrderService;
|
|
|
use app\common\validate\TaxValidate;
|
|
|
+use think\Cache;
|
|
|
use think\Db;
|
|
|
use app\common\model\Orders as Order;
|
|
|
|
|
@@ -149,6 +150,7 @@ class Orders extends Api
|
|
|
'id'=>['require'],
|
|
|
]);
|
|
|
$user=$this->auth->getUser();
|
|
|
+ Cache::remember("user_order_show_{$user['id']}",time(),86400);
|
|
|
$this->success('',$this->orderDetail($data['id']));
|
|
|
}
|
|
|
protected function orderDetail($orderId){
|
|
@@ -237,6 +239,7 @@ class Orders extends Api
|
|
|
* @ApiParams (name=reason1,description=配置里的reason里的key)
|
|
|
* @ApiParams (name=reason2,description=原因2)
|
|
|
* @ApiParams (name=amount,description=金额)
|
|
|
+ * @ApiParams (name=fix_order_no,description=维修订单号,在拍维修费时需要)
|
|
|
*/
|
|
|
public function refund(){
|
|
|
$data=$this->_validate([
|
|
@@ -273,6 +276,15 @@ class Orders extends Api
|
|
|
'amount|金额'=>['require','float','gt:0',"elt:{$orderInfo['amount_pay']}"],
|
|
|
]);
|
|
|
}
|
|
|
+ if($config['req_order']){
|
|
|
+ $this->_validate([
|
|
|
+ 'fix_order_no|维修订单号'=>['require',],
|
|
|
+ ]);
|
|
|
+ $fixOrder=Order::statusPay()->where('order_no',$data['fix_order_no'])->where('pay_time',Cache::get("user_order_show_{$user['id']}",null))->find();
|
|
|
+ if(!$fixOrder){
|
|
|
+ $this->error('请完成维修订单支付');
|
|
|
+ }
|
|
|
+ }
|
|
|
if($data['refund_type']==Refund::REFUND_TYPE_ALL){
|
|
|
$refundCount=$orderInfo->refunds()->where('refund_type',Refund::REFUND_TYPE_ALL)->count();
|
|
|
if($refundCount>=3){
|