|
|
@@ -265,13 +265,33 @@ class ServiceOrderLogic extends BaseLogic
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 取消订单优惠券
|
|
|
- * @return void
|
|
|
- */
|
|
|
-// public function canleOrderCoupon()
|
|
|
-// {
|
|
|
-//
|
|
|
-// }
|
|
|
+ * 重置订单优惠券
|
|
|
+ * * @param $params
|
|
|
+ * * * @return array|false
|
|
|
+ */
|
|
|
+ public static function cancelOrderCoupon($params)
|
|
|
+ {
|
|
|
+ Db::startTrans();
|
|
|
+ try {
|
|
|
+ $order = \app\common\model\recharge\RechargeOrder::where('id',$params['order_id'])->findOrEmpty();
|
|
|
+ if(!empty($order['coupon_id'])){
|
|
|
+ $user_coupon_ed = UserCoupon::findOrEmpty($order['coupon_id']);
|
|
|
+ $user_coupon_ed->voucher_count = $user_coupon_ed->voucher_count+1;
|
|
|
+ $user_coupon_ed->voucher_status = 0;
|
|
|
+ $user_coupon_ed->save();
|
|
|
+
|
|
|
+ $order->order_amount = $order->order_amount+$order->coupon_price;
|
|
|
+ $order->coupon_id = 0;
|
|
|
+ $order->coupon_price = 0;
|
|
|
+ $order->save();
|
|
|
+ }
|
|
|
+ Db::commit();
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ self::setError($e->getMessage());
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 获取订单工程师信息
|
|
|
@@ -452,7 +472,7 @@ class ServiceOrderLogic extends BaseLogic
|
|
|
$v['pay_way_name'] = $pay_way_data[$v['pay_way']];
|
|
|
|
|
|
if($v['payment_type']!=1 and !empty($order_info['service_work']['spare_total'])){
|
|
|
- $v['order_total'] = $v['order_total'] - $order_info['service_work']['spare_total'] + $v['coupon_price'];
|
|
|
+ $v['order_total'] = $v['order_total'] - $order_info['service_work']['spare_total'];
|
|
|
$v['order_amount'] = $v['order_amount'] - $order_info['service_work']['spare_total'] + $v['coupon_price'];
|
|
|
}
|
|
|
|