From b8961f178740f99ce54cfcbfd88235eaf8b79872 Mon Sep 17 00:00:00 2001
From: quanwei <419654421@qq.com>
Date: Fri, 12 Dec 2025 18:59:02 +0800
Subject: [PATCH] 保证金和年卡放同一个页面

---
 admin/app/common/model/release/Order.php |  109 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 109 insertions(+), 0 deletions(-)

diff --git a/admin/app/common/model/release/Order.php b/admin/app/common/model/release/Order.php
new file mode 100644
index 0000000..72a5817
--- /dev/null
+++ b/admin/app/common/model/release/Order.php
@@ -0,0 +1,109 @@
+<?php
+
+namespace app\common\model\plus\release;
+
+use app\common\enum\order\OrderPayTypeEnum;
+use app\common\model\BaseModel;
+
+
+/**
+ * 订单模型
+ */
+class Order extends BaseModel
+{
+    protected $name = 'release_order';
+    protected $pk = 'id';
+
+    /**
+     * 追加字段
+     * @var string[]
+     */
+    protected $append = [
+        'state_text',
+    ];
+
+    /**
+     * 需求用户
+     * @return \think\model\relation\BelongsTo
+     */
+    public function demanduser()
+    {
+        return $this->belongsTo('app\common\model\user\User','demand_user_id','user_id');
+    }
+
+     /**
+     * 供应用户
+     * @return \think\model\relation\BelongsTo
+     */
+    public function supplyuser()
+    {
+        return $this->belongsTo('app\common\model\user\User','supply_user_id','user_id');
+    }
+
+    /**
+     * 关联项目
+     * @return \think\model\relation\hasMany
+     */
+    public function project()
+    {
+        return $this->belongsTo('app\common\model\plus\release\Project','project_id','project_id');
+    }
+
+
+
+    /**
+     * 订单状态文字描述
+     * @param $value
+     * @param $data
+     * @return string
+     */
+    public function getStateTextAttr($value, $data)
+    {
+        if($data['order_status'] == 20){
+            return '已取消';
+        }
+        // 订单状态
+        if ($data['pay_status'] == 10 && $data['pay_type'] == 40) {
+            return '待确认支付';
+        }else if ($data['pay_status'] == 10 && $data['pay_type'] != 40) {
+            return '未付款';
+        }else if($data['pay_status'] == 20 && $data['order_status'] == 10){
+            return '进行中';
+        }else if($data['pay_status'] == 20 && $data['order_status'] == 30){
+            return '已完成';
+        }
+        return "";
+    }
+
+    /**
+     * 付款状态
+     * @param $value
+     * @return array
+     */
+    public function getPayTypeAttr($value)
+    {
+        if(empty($value)){
+            return ['text' => '', 'value' => 0];
+        }
+        return ['text' => OrderPayTypeEnum::data()[$value]['name'], 'value' => $value];
+    }
+
+    /**
+     * 详情
+     */
+    public static function detail($id)
+    {
+        $model = new static();
+        return $model->with(['demanduser','supplyuser',"project"])->find($id);
+    }
+
+    /**
+     * 详情
+     */
+    public static function getDetail($order_no)
+    {
+        $model = new static();
+        return $model->with(["project"])->where("order_no",'=',$order_no)->find();
+    }
+
+}

--
Gitblit v1.9.2