weizong song 4 years ago
parent e910c39554
commit b0599a587a

@ -88,16 +88,18 @@ class OrdersController extends CommonController
DB::beginTransaction();
try {
foreach($order_items as $order_item) {
if ($order_item->paid_at && $request->total != $order_item->total) {
foreach ($order_items as $order_item) {
if ($request->has("total") && $order_item->paid_at && $request->total != $order_item->total) {
return $this->error("子订单已扣款,不支持后台更改价格,请通过其他方法进行更改");
}
if ($order_item->total == 0 && $request->total != $order_item->total) {
if ($request->has("total") && $order_item->total == 0 && $request->total != $order_item->total) {
return $this->error("未服务子订单不支持后台更改价格,请通过其他方法进行更改");
}
$order_item->update([
"total" => $request->total
]);
if ($request->has("total")) {
$order_item->update([
"total" => $request->total
]);
}
if ($request->factor_item) {
$factors = json_decode($order_item->factors, true);
foreach ($factors as &$factor) {
@ -114,10 +116,10 @@ class OrdersController extends CommonController
}
}
DB::commit();
return $this->success("处理成功".$total."条数据!");
return $this->success("处理成功" . $total . "条数据!");
} catch (\Exception $exception) {
DB::rollBack();
return $this->error($exception->getMessage().$exception->getLine());
return $this->error($exception->getMessage() . $exception->getLine());
}
}

@ -199,7 +199,7 @@
' <input class="form-control" type="number" name="salary" disabled>' +
' </div>';
html += '<div class="custom-control custom-checkbox">' +
'<input type="checkbox" class="custom-control-input" id="is_batch" name="is_batch" value="1">' +
'<input type="checkbox" onchange="changeIsBatch()" class="custom-control-input" id="is_batch" name="is_batch" value="1">' +
'<label class="custom-control-label" for="is_batch">是否批量修改同级子订单</label>' +
'</div>';
$("#factor-box").html(html);
@ -221,6 +221,15 @@
$("#modal-box form").find("input[name=salary]").val(salary);
}
function changeIsBatch() {
var is_batch = $("#is_batch").is(":checked");
if (is_batch) {
$("#modal-box form input[name=total]").prop("disabled", true);
} else {
$("#modal-box form input[name=total]").prop("disabled", false);
}
}
function saveItemChange() {
var url = "{{ url("admin/orders/change-item") }}";
var data = $("#modal-box form").serialize();

Loading…
Cancel
Save