diff --git a/app/Admin/Actions/Grid/DealerDeliveryShipping.php b/app/Admin/Actions/Grid/DealerDeliveryShipping.php
new file mode 100644
index 00000000..93434970
--- /dev/null
+++ b/app/Admin/Actions/Grid/DealerDeliveryShipping.php
@@ -0,0 +1,67 @@
+title) {
+ return $this->title;
+ }
+ return ' 确认发货 ';
+ }
+
+ /**
+ * @param Model|Authenticatable|HasPermissions|null $user
+ *
+ * @return bool
+ */
+ protected function authorize($user): bool
+ {
+ return true;
+ return $user->can('dcat.admin.dealer_delivery_bills.shipping');
+ }
+
+ /**
+ * Handle the action request.
+ *
+ * @param Request $request
+ *
+ * @return Response
+ */
+ public function handle(Request $request)
+ {
+ $order = DealerDeliveryBill::findOrFail($this->getKey());
+ try {
+ DB::beginTransaction();
+
+ $order->update([
+ 'status' => DealerDeliveryBillStatus::Shippinged,
+ ]);
+
+ DB::commit();
+ } catch (Throwable $th) {
+ DB::rollBack();
+ report($th);
+ return $this->response()->error('操作失败,'.$th->getMessage())->refresh();
+ }
+
+ return $this->response()->success('操作成功')->refresh();
+ }
+
+ /**
+ * @return string|array|void
+ */
+ public function confirm()
+ {
+ return ['确认当前云仓单已发货?', '确认后将无法逆操作'];
+ }
+}
diff --git a/app/Admin/Controllers/DealerDeliveryBillController.php b/app/Admin/Controllers/DealerDeliveryBillController.php
index ec402590..3e2bea28 100644
--- a/app/Admin/Controllers/DealerDeliveryBillController.php
+++ b/app/Admin/Controllers/DealerDeliveryBillController.php
@@ -2,6 +2,7 @@
namespace App\Admin\Controllers;
+use App\Admin\Actions\Grid\DealerDeliveryShipping;
use App\Admin\Repositories\DealerDeliveryBill;
use App\Admin\Repositories\DealerDeliveryProduct;
use App\Enums\DealerDeliveryBillStatus;
@@ -51,6 +52,10 @@ class DealerDeliveryBillController extends AdminController
if (Admin::user()->can('dcat.admin.dealer_orders.show')) {
$actions->append(' 显示 ');
}
+
+ if ($actions->row->isPaid()) {
+ $actions->append(new DealerDeliveryShipping());
+ }
});
$grid->filter(function (Grid\Filter $filter) {
diff --git a/app/Enums/DealerDeliveryBillStatus.php b/app/Enums/DealerDeliveryBillStatus.php
index a042d81c..7c0ee7d3 100644
--- a/app/Enums/DealerDeliveryBillStatus.php
+++ b/app/Enums/DealerDeliveryBillStatus.php
@@ -5,6 +5,7 @@ namespace App\Enums;
enum DealerDeliveryBillStatus: int {
case Pending = 0; // 待付款
case Paid = 1; // 已付款
+ case Shippinged = 2; //已发货
case Cancelled = 10; // 已取消
public function text()
@@ -17,6 +18,7 @@ enum DealerDeliveryBillStatus: int {
return [
static::Pending->value => '#5b69bc',
static::Paid->value => '#21b978',
+ static::Shippinged->value => '#21b978',
static::Cancelled->value => '#b3b9bf',
];
}
@@ -26,6 +28,7 @@ enum DealerDeliveryBillStatus: int {
return [
static::Pending->value => '待付款',
static::Paid->value => '已付款',
+ static::Shippinged->value => '已发货',
static::Cancelled->value => '已取消',
];
}
diff --git a/app/Models/DealerDeliveryBill.php b/app/Models/DealerDeliveryBill.php
index 39e3c99c..2e5f012f 100644
--- a/app/Models/DealerDeliveryBill.php
+++ b/app/Models/DealerDeliveryBill.php
@@ -76,4 +76,9 @@ class DealerDeliveryBill extends Model
{
return $this->status === DealerDeliveryBillStatus::Pending;
}
+
+ public function isPaid()
+ {
+ return $this->status === DealerDeliveryBillStatus::Paid;
+ }
}