添加结账状态

This commit is contained in:
wangxiaowei 2024-09-07 17:39:03 +08:00
parent e216ba85e3
commit 7b2bc56f5c
3 changed files with 57 additions and 0 deletions

@ -371,4 +371,18 @@ class Order extends ShopBase
'express' => $express
]);
}
// 结账
public function end_bills()
{
if ($this->request->isAjax()) {
$id = $this->request->post('id');
$result = OrderLogic::updateEndBills($id);
if ($result) {
return JsonServer::success('操作成功');
}
return JsonServer::error('操作失败');
}
}
}

@ -1269,4 +1269,12 @@ class OrderLogic extends Logic
return $express_data;
}
public static function updateEndBills($id)
{
return Order::where('id', $id)->update([
'end_bills' => 1,
'update_time' => time()
]);
}
}

@ -239,6 +239,9 @@
<a class="layui-btn layui-btn-normal layui-btn-sm operation-btn"
lay-event="allow">允许售后</a>
{{# } }}
<a class="layui-btn layui-btn-danger layui-btn-sm operation-btn"
lay-event="end-bills">结账</a>
</div>
</script>
@ -319,6 +322,14 @@
{{ d.total_num }}件
</script>
<!--是否结账-->
<script type="text/html" id="end-bills">
{{# if(d.end_bills == 0){ }}
未结账
{{# } else { }}
<span style="font-weight: bold">已结账</span>
{{# } }}
</script>
</div>
</div>
</div>
@ -452,6 +463,7 @@
, {field: 'total_num', title: '商品数量', align: 'center', templet: '#goods_num', width: 70}
, {field: 'total_amount', title: '订单金额', align: 'center', templet: '#amount', width: 150}
, {field: 'delivery', title: '收货信息', align: 'center', templet: '#delivery', width: 200}
, {field: 'end_bills', title: '结账状态', align: 'center', width: 100, templet: '#end-bills'}
, {field: 'pay_status_text', title: '支付状态', align: 'center', width: 100}
, {field: 'order_status_text', title: '订单状态', align: 'center', width: 100}
, {fixed: 'right', title: '操作', width: 300, align: 'center', toolbar: '#order-operation'}
@ -722,6 +734,29 @@
});
}
if (obj.event === 'end-bills') {
layer.confirm('是否结账' + obj.data.order_sn + '', {
btn: ['确认', '取消']
}, function () {
like.ajax({
url: '{:url("order.order/end_bills")}'
, data: {id}
, type: 'post'
, success: function (res) {
if (res.code == 1) {
layui.layer.msg(res.msg, {
offset: '15px'
, icon: 1
, time: 1000
}, function () {
updateTabNumber();
table.reload('order-lists');
});
}
},
});
});
}
});
/**