|
@@ -36,7 +36,7 @@ class ServiceOrderLogic extends BaseLogic
|
|
|
if($goods->isEmpty()){
|
|
if($goods->isEmpty()){
|
|
|
throw new Exception('产品不存在!');
|
|
throw new Exception('产品不存在!');
|
|
|
}
|
|
}
|
|
|
- if($params['user_info']['mobile']){
|
|
|
|
|
|
|
+ if(empty($params['user_info']['mobile'])){
|
|
|
throw new Exception('请先补充您的联系方式后在提交订单');
|
|
throw new Exception('请先补充您的联系方式后在提交订单');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -156,7 +156,7 @@ class ServiceOrderLogic extends BaseLogic
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//搜索当前工单下的所有订单记录
|
|
//搜索当前工单下的所有订单记录
|
|
|
- $order_info['pay_orders'] = \app\common\model\recharge\RechargeOrder::where(['work_id'=>$order_info['work_id']])->field('pay_status,payment_type,pay_way,pay_time,order_amount')->order('id asc')->select()->toArray();
|
|
|
|
|
|
|
+ $order_info['pay_orders'] = \app\common\model\recharge\RechargeOrder::where(['work_id'=>$order_info['work_id']])->field('id as order_id, pay_status,payment_type,pay_way,pay_time,order_amount')->order('id asc')->select()->toArray();
|
|
|
$pay_status_data = DictData::where('type_value','pay_status')->column('name','value');
|
|
$pay_status_data = DictData::where('type_value','pay_status')->column('name','value');
|
|
|
$payment_type_data = DictData::where('type_value','payment_type')->column('name','value');
|
|
$payment_type_data = DictData::where('type_value','payment_type')->column('name','value');
|
|
|
$pay_way_data = DictData::where('type_value','pay_way')->column('name','value');
|
|
$pay_way_data = DictData::where('type_value','pay_way')->column('name','value');
|
|
@@ -173,4 +173,43 @@ class ServiceOrderLogic extends BaseLogic
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 取消订单
|
|
|
|
|
+ * @param $params
|
|
|
|
|
+ * @return false|void
|
|
|
|
|
+ */
|
|
|
|
|
+ public static function cancelOrder($params)
|
|
|
|
|
+ {
|
|
|
|
|
+ Db::startTrans();
|
|
|
|
|
+ try {
|
|
|
|
|
+ $work_id = \app\common\model\recharge\RechargeOrder::where([
|
|
|
|
|
+ 'order_type' => 0,
|
|
|
|
|
+ 'user_id' => $params['user_id'],
|
|
|
|
|
+ 'sn'=>$params['sn']
|
|
|
|
|
+ ])->value('work_id');
|
|
|
|
|
+ if(empty($work_id)){
|
|
|
|
|
+ throw new Exception('订单不存在');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $payed_order = \app\common\model\recharge\RechargeOrder::where(['user_id'=>$params['user_id'],'work_id'=>$work_id,'pay_status'=>1])->findOrEmpty();
|
|
|
|
|
+ if(!$payed_order->isEmpty()){
|
|
|
|
|
+ throw new Exception('存在已支付订单,不允许取消订单,请联系客服');
|
|
|
|
|
+ }
|
|
|
|
|
+ //软删除订单
|
|
|
|
|
+ $cancel_order = \app\common\model\recharge\RechargeOrder::where(['user_id'=>$params['user_id'],'work_id'=>$work_id])->findOrEmpty();
|
|
|
|
|
+ $cancel_order->delete();
|
|
|
|
|
+ //更新工单状态为已取消
|
|
|
|
|
+ $service_work = ServiceWork::find($work_id);
|
|
|
|
|
+ $service_work->service_status = 4;
|
|
|
|
|
+ $service_work->save();
|
|
|
|
|
+
|
|
|
|
|
+ Db::commit();
|
|
|
|
|
+ }
|
|
|
|
|
+ catch (\Exception $e) {
|
|
|
|
|
+ self::setError($e->getMessage());
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|