diff --git a/app/admin/lists/store_branch_product/StoreBranchProductLists.php b/app/admin/lists/store_branch_product/StoreBranchProductLists.php
index fe143542e..7e36de816 100644
--- a/app/admin/lists/store_branch_product/StoreBranchProductLists.php
+++ b/app/admin/lists/store_branch_product/StoreBranchProductLists.php
@@ -47,7 +47,7 @@ class StoreBranchProductLists extends BaseAdminDataLists implements ListsSearchI
     {
         $status = $this->params['status'] ?? '';
         return StoreBranchProduct::where($this->searchWhere)
-            ->field(['id', 'image', 'store_name', 'cate_id', 'price', 'sales', 'stock', 'unit', 'cost'])
+            ->field(['id', 'image', 'store_name', 'cate_id', 'price', 'sales', 'stock', 'unit', 'cost', 'status'])
             ->when(!empty($this->adminInfo['store_id']), function ($query) {
                 $query->where('store_id', $this->adminInfo['store_id']);
             })
diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php
index 6d004e1b2..3b04aa3d2 100644
--- a/app/api/logic/order/OrderLogic.php
+++ b/app/api/logic/order/OrderLogic.php
@@ -7,6 +7,7 @@ use app\common\enum\PayEnum;
 use app\common\enum\YesNoEnum;
 use app\common\logic\BaseLogic;
 use app\common\logic\CapitalFlowLogic;
+use app\common\logic\StoreFinanceFlowLogic;
 use app\common\model\merchant\Merchant;
 use app\common\model\order\Cart;
 use app\common\model\store_branch_product\StoreBranchProduct;
@@ -15,6 +16,7 @@ use app\common\model\store_order_cart_info\StoreOrderCartInfo;
 use app\common\model\store_product\StoreProduct;
 use app\common\model\store_product_attr_value\StoreProductAttrValue;
 use app\common\model\store_product_unit\StoreProductUnit;
+use app\common\model\system_store\SystemStore;
 use app\common\model\user\User;
 use app\common\model\user\UserAddress;
 use app\Request;
@@ -32,6 +34,7 @@ use Yansongda\Pay\Event\PayEnd;
 class OrderLogic extends BaseLogic
 {
     public static $total;
+
     /**
      * @notes 获取购物车商品信息
      * @param $params
@@ -51,13 +54,13 @@ class OrderLogic extends BaseLogic
             /** 计算价格 */
             foreach ($cart_select as $k => $v) {
                 $find = StoreBranchProduct::where(['id' => $v['goods']])->field('store_name,image,unit,price')->find();
-                if(!$find){
+                if (!$find) {
                     continue;
                 }
                 $cart_select[$k]['total'] = bcmul($v['cart_num'], $find['price'], 2);//钱
                 $cart_select[$k]['price'] = $find['price'];
                 $cart_select[$k]['product_id'] = $find['goods'];
-                $cart_select[$k]['old_cart_id'] = implode(',',$cartId);
+                $cart_select[$k]['old_cart_id'] = implode(',', $cartId);
                 $cart_select[$k]['cart_num'] = $v['cart_num'];
                 $cart_select[$k]['verify_code'] = $params['verify_code'];
                 //理论上每笔都是拆分了
@@ -65,7 +68,7 @@ class OrderLogic extends BaseLogic
 //                $cart_select[$k]['imgs'] = $find['image'];
 //                $cart_select[$k]['unit_name'] = StoreProductUnit::where(['id' => $find['unit']])->value('name');
 
-                self::$total=bcadd(self::$total, $cart_select[$k]['total'], 2);
+                self::$total = bcadd(self::$total, $cart_select[$k]['total'], 2);
             }
             $order = [
                 'add_time' => time(),
@@ -76,8 +79,8 @@ class OrderLogic extends BaseLogic
                 'total_num' => count($cart_select),//总数
                 'pay_type' => $params['pay_type'] ?? 0,
                 'cart_id' => implode(',', $cartId),
-                'store_id'=>$params['store_id'],
-                'shipping_type'=>$params['shipping_type']//配送方式 1=快递 ,2=门店自提
+                'store_id' => $params['store_id'],
+                'shipping_type' => $params['shipping_type']//配送方式 1=快递 ,2=门店自提
 //                'delivery_msg'=>' 预计48小时发货 '
             ];
         } catch (\Exception $e) {
@@ -96,7 +99,7 @@ class OrderLogic extends BaseLogic
         $verify_code = generateUniqueVerificationCode();
         $params['verify_code'] = $verify_code;
         $orderInfo = self::cartIdByOrderInfo($cartId, $addressId, $user, $params);
-        if(!$orderInfo){
+        if (!$orderInfo) {
             return false;
         }
 //  `delivery_name`快递名称/送货人姓名',
@@ -104,21 +107,21 @@ class OrderLogic extends BaseLogic
 //  `delivery_type` '发货类型',
 //  `delivery_id'快递单号/手机号',
         $_order = $orderInfo['order'];
-        if($orderInfo['order']['shipping_type'] == 1){
+        if ($orderInfo['order']['shipping_type'] == 1) {
             $_order['delivery_name'] = $params['delivery_name'];
             $_order['delivery_id'] = $params['delivery_id'];
         }
         $_order['deduction_price'] = 0;
         $_order['uid'] = request()->userId;
-        $user = User::where('id',\request()->userId)->find();
+        $user = User::where('id', \request()->userId)->find();
         $_order['real_name'] = $user['real_name'];
         $_order['mobile'] = $user['mobile'];
         $_order['pay_type'] = $user['pay_type'];
         $_order['verify_code'] = $verify_code;
 
-        if($addressId>0){
-            $address=UserAddress::where(['address_id'=>$addressId,'uid'=>Request()->userId])->find();
-            if($address){
+        if ($addressId > 0) {
+            $address = UserAddress::where(['address_id' => $addressId, 'uid' => Request()->userId])->find();
+            if ($address) {
                 $_order['real_name'] = $address['real_name'];
                 $_order['user_phone'] = $address['phone'];
                 $_order['user_address'] = $address['detail'];
@@ -137,13 +140,13 @@ class OrderLogic extends BaseLogic
             foreach ($goods_list as $k => $v) {
                 $goods_list[$k]['oid'] = $order->id;
                 $goods_list[$k]['uid'] = request()->userId;
-                $goods_list[$k]['cart_id'] = implode(',',$cartId);
+                $goods_list[$k]['cart_id'] = implode(',', $cartId);
                 $goods_list[$k]['delivery_id'] = $params['store_id'];//商家id
 
             }
             (new StoreOrderCartInfo())->saveAll($goods_list);
             $where = ['is_pay' => 0, 'is_del' => 0];
-            Cart::whereIn('cart_id', $cartId)->where($where)->update(['is_pay'=>1]);
+            Cart::whereIn('cart_id', $cartId)->where($where)->update(['is_pay' => 1]);
             Db::commit();
             return $order;
         } catch (\Exception $e) {
@@ -165,8 +168,8 @@ class OrderLogic extends BaseLogic
             return false;
         }
         $mer_id = $user['merchant']['mer_id'];
-        $where1 = ['paid' => 1,'is_opurchase'=>0];
-        $where1[] = ['pay_type','<>',9];
+        $where1 = ['paid' => 1, 'is_opurchase' => 0];
+        $where1[] = ['pay_type', '<>', 9];
 
         $arrs = Cashierclass::where('merchant', $mer_id)->whereDay('create_time')->where($where1)->column('cart_id,id,address_id');
         // $order_id = Cashierclass::where('merchant', $mer_id)->whereDay('create_time')->where($where1)->column('id');
@@ -181,7 +184,7 @@ class OrderLogic extends BaseLogic
             //     self::setError('请先设置配送地址');
             //     return false;
             // }
-            $arr = explode(',',$v['cart_id']);
+            $arr = explode(',', $v['cart_id']);
             foreach ($arr as $kk => $vv) {
                 $cart_arr[] = $vv;
             }
@@ -209,6 +212,7 @@ class OrderLogic extends BaseLogic
         ];
         return ['order' => $order, 'cart_list' => $cart_select];
     }
+
     /**
      * 创建购货订单
      * @return Object|bool
@@ -256,6 +260,7 @@ class OrderLogic extends BaseLogic
             return false;
         }
     }
+
     /**
      * @notes 获取订单号
      * @param $type
@@ -272,8 +277,6 @@ class OrderLogic extends BaseLogic
     }
 
 
-
-
     /**
      * 余额订单支付
      * @param User $user
@@ -337,7 +340,7 @@ class OrderLogic extends BaseLogic
     {
         try {
             $goods_id = StoreOrderCartInfo::where('uid', Request()->userId)->page($params['page_no'])->limit(50)->column('product_id');
-            if(!$goods_id){
+            if (!$goods_id) {
                 return [];
             }
             $goods_arr = array_unique($goods_id);
@@ -349,53 +352,53 @@ class OrderLogic extends BaseLogic
         }
     }
 
-    public static function purchaseAgain($order_id){
-        $arr= StoreOrderCartInfo::where('oid',$order_id)->field('product_id,cart_num,staff_id')->select();
-        $data=[];
-        foreach ($arr as $k=>$v){
-            $data[$k]['product_id']=$v['product_id'];
-            $unique = StoreProductAttrValue::where('product_id',$v['product_id'])->value('v');
-            $data[$k]['product_attr_unique']=$unique;
-            $data[$k]['cart_num']=$v['cart_num'];
-            $data[$k]['type']='';
-            $data[$k]['uid']=Request()->userId;
-            $store_id  = StoreProduct::where('id',$v['product_id'])->value('store_id');
-            $data[$k]['store_id']=$store_id;
-            $data[$k]['staff_id']=$v['staff_id'];
-            $data[$k]['add_time']=time();
-            $data[$k]['combination_id']=0;
-            $data[$k]['seckill_id']=0;
-            $data[$k]['bargain_id']=0;
-            $data[$k]['discount_id']=0;
-            $data[$k]['status']=1;
-            $data[$k]['staff_id']=0;
-            $data[$k]['is_new']=0;
-            $data[$k]['is_del']=0;
-            $data[$k]['is_pay']=0;
+    public static function purchaseAgain($order_id)
+    {
+        $arr = StoreOrderCartInfo::where('oid', $order_id)->field('product_id,cart_num,staff_id')->select();
+        $data = [];
+        foreach ($arr as $k => $v) {
+            $data[$k]['product_id'] = $v['product_id'];
+            $unique = StoreProductAttrValue::where('product_id', $v['product_id'])->value('v');
+            $data[$k]['product_attr_unique'] = $unique;
+            $data[$k]['cart_num'] = $v['cart_num'];
+            $data[$k]['type'] = '';
+            $data[$k]['uid'] = Request()->userId;
+            $store_id = StoreProduct::where('id', $v['product_id'])->value('store_id');
+            $data[$k]['store_id'] = $store_id;
+            $data[$k]['staff_id'] = $v['staff_id'];
+            $data[$k]['add_time'] = time();
+            $data[$k]['combination_id'] = 0;
+            $data[$k]['seckill_id'] = 0;
+            $data[$k]['bargain_id'] = 0;
+            $data[$k]['discount_id'] = 0;
+            $data[$k]['status'] = 1;
+            $data[$k]['staff_id'] = 0;
+            $data[$k]['is_new'] = 0;
+            $data[$k]['is_del'] = 0;
+            $data[$k]['is_pay'] = 0;
         }
-        if($data){
-            ( new Cart())->saveAll($data);
+        if ($data) {
+            (new Cart())->saveAll($data);
             return true;
         }
         return false;
     }
 
 
-
     public static function detail($params): array
     {
-        $find=StoreOrder::where($params)->findOrEmpty()->toArray();
-        if($find){
+        $find = StoreOrder::where($params)->findOrEmpty()->toArray();
+        if ($find) {
 
-            $find['goods_list']= StoreOrderCartInfo::where('oid',$find['id'])
+            $find['goods_list'] = StoreOrderCartInfo::where('oid', $find['id'])
                 ->with('goodsName')
-                ->field('product_id,cart_num nums')->select()->each(function($item){
-                    $item['msg']='预计48小时发货';
-                    $item['unit_name']=StoreProductUnit::where('id',$item['unit'])->value('name');
+                ->field('product_id,cart_num nums')->select()->each(function ($item) {
+                    $item['msg'] = '预计48小时发货';
+                    $item['unit_name'] = StoreProductUnit::where('id', $item['unit'])->value('name');
                 });
-            $merchant=Merchant::where('mer_id',$find['merchant'])->field('mer_id,uid,mer_name,service_phone,mer_address')->find();
-            $merchant['real_name']=User::where('id',$merchant['uid'])->value('real_name');
-            $find['merchant_info']=$merchant;
+            $merchant = Merchant::where('mer_id', $find['merchant'])->field('mer_id,uid,mer_name,service_phone,mer_address')->find();
+            $merchant['real_name'] = User::where('id', $merchant['uid'])->value('real_name');
+            $find['merchant_info'] = $merchant;
 
         }
         return $find;
@@ -414,34 +417,31 @@ class OrderLogic extends BaseLogic
      * @author: codeliu
      * @Time: 2024/6/3  22:42
      */
-    public static function  writeOff($params,$uid): bool
+    public static function writeOff($params, $uid): bool
     {
-        $data = StoreOrderCartInfo::where([
-            'oid'=>$params['order_id'],
-            'verify_code'=>$params['verify_code'],
-            'uid'=>$uid
-        ])->select()->toArray();
-        if (empty($data)){
+        $data = StoreOrder::with('store')->where([
+            'verify_code' => $params['verify_code'],
+            'uid' => $uid
+        ])->find();
+        if (empty($data)) {
             return false;
         }
         Db::startTrans();
         try {
-            $newArr = [];
-            $oid = [];
-            foreach ($data as $k =>$value){
-                $oid [] = $value['oid'];
-                $newArr[$k]['writeoff_time'] = time();
-                $newArr[$k]['id'] = $value['id'];
-                $newArr[$k]['is_writeoff'] = YesNoEnum::YES;
-                $newArr[$k]['update_time'] = time();
+            StoreOrder::update([
+                'status' => OrderEnum::RECEIVED_GOODS,
+                'update_time' => time(),
+            ], ['id' => $data['id']]);
+            (new StoreOrderCartInfo())->update([
+                'writeoff_time' => time(),
+                'is_writeoff' => YesNoEnum::YES,
+                'update_time' => time(),
+            ], ['oid' => $data['id']]);
+            $financeFlow = (new StoreFinanceFlowLogic)->getStoreOrder($data['id'], $data['store_id']);
+            if (!empty($financeFlow)) {
+                $capitalFlowLogic = new CapitalFlowLogic($data->store, 'store');
+                $capitalFlowLogic->storeIncome('store_order_income', 'order', $data['id'], $financeFlow['number']);
             }
-            (new StoreOrderCartInfo())->saveAll($newArr);
-            $oidArr = array_values(array_unique($oid));
-             StoreOrder::whereIn('id',$oidArr)
-                 ->update([
-                     'status' => OrderEnum::RECEIVED_GOODS,
-                     'update_time' => time(),
-                 ]);
             Db::commit();
             return true;
         } catch (\Exception $e) {
@@ -453,6 +453,4 @@ class OrderLogic extends BaseLogic
     }
 
 
-
-
 }
diff --git a/app/api/validate/OrderValidate.php b/app/api/validate/OrderValidate.php
index ded301cf1..d400659fb 100644
--- a/app/api/validate/OrderValidate.php
+++ b/app/api/validate/OrderValidate.php
@@ -17,7 +17,6 @@ class OrderValidate extends BaseValidate
       * @var string[]
       */
     protected $rule = [
-        'order_id' => 'require|number',
         'verify_code' => 'require',
     ];
 
@@ -27,7 +26,6 @@ class OrderValidate extends BaseValidate
      * @var string[]
      */
     protected $field = [
-        'order_id' => '订单',
         'verify_code' => '验证码',
     ];
 
@@ -40,9 +38,9 @@ class OrderValidate extends BaseValidate
      */
     public function sceneCheck()
     {
-        return $this->only(['order_id','verify_code']);
+        return $this->only(['verify_code']);
     }
 
 
 
-}
\ No newline at end of file
+}
diff --git a/app/common/logic/CapitalFlowLogic.php b/app/common/logic/CapitalFlowLogic.php
index cbe68c088..ada7311e3 100644
--- a/app/common/logic/CapitalFlowLogic.php
+++ b/app/common/logic/CapitalFlowLogic.php
@@ -8,10 +8,15 @@ class CapitalFlowLogic extends BaseLogic
 {
 
     public $user;
+    public $store;
 
-    public function __construct($user)
+    public function __construct($obj, $type = 'user')
     {
-        $this->user = $user;
+        if (isset($type)) {
+            $this->user = $obj;
+        } else {
+            $this->store = $obj;
+        }
     }
 
     /**
@@ -77,21 +82,22 @@ class CapitalFlowLogic extends BaseLogic
      * @param $mark
      * @return mixed
      */
-    public function merchantIncome($category, $linkType, $linkId, $amount, $mark = '')
+    public function storeIncome($category, $linkType, $linkId, $amount, $mark = '')
     {
         $model = new CapitalFlow();
-        $model->mer_id = $this->user['mer_id'];
+        $model->store_id = $this->store['store_id'];
         $model->category = $category;
         $model->link_type = $linkType;
         $model->link_id = $linkId;
         $model->amount = $amount;
-        $model->before_balance = $this->user['mer_money'];
-        $model->balance = bcadd($this->user['mer_money'], $amount, 2);
+        $model->before_balance = $this->store['balance'];
+        $model->balance = bcadd($this->store['balance'], $amount, 2);
         $model->create_time = date('Y-m-d H:i:s');
         $model->type = 'in';
         $model->title = $this->getTitle($category, $amount);
         $model->mark = empty($mark) ? $model->title : $mark;
         $model->save();
+        $this->store->update(['balance' => $model->balance], ['id' => $this->store['id']]);
         return $model->id;
     }
 
@@ -104,22 +110,23 @@ class CapitalFlowLogic extends BaseLogic
      * @param $mark
      * @return mixed
      */
-    public function merchantExpense($category, $linkType, $linkId, $amount, $mark = '')
+    public function storeExpense($category, $linkType, $linkId, $amount, $mark = '')
     {
         $model = new CapitalFlow();
-        $model->mer_id = $this->user['mer_id'];
-        $model->uid = $this->user['uid'];
+        $model->store_id = $this->store['store_id'];
+        $model->uid = 0;
         $model->category = $category;
         $model->link_type = $linkType;
         $model->link_id = $linkId;
         $model->amount = $amount;
-        $model->before_balance = $this->user['mer_money'];
-        $model->balance = bcsub($this->user['mer_money'], $amount, 2);
+        $model->before_balance = $this->store['balance'];
+        $model->balance = bcsub($this->store['balance'], $amount, 2);
         $model->create_time = date('Y-m-d H:i:s');
         $model->type = 'out';
         $model->title = $this->getTitle($category, $amount);
         $model->mark = empty($mark) ? $model->title : $mark;
         $model->save();
+        $this->store->update(['balance' => $model->balance], ['id' => $this->store['id']]);
         return $model->id;
     }
 
@@ -128,15 +135,15 @@ class CapitalFlowLogic extends BaseLogic
         switch ($category) {
             case 'user_balance_recharge':
                 return "用户充值{$amount}元";
-            case 'merchant_margin':
+            case 'store_margin':
                 return "店铺自动扣除保证金{$amount}元";
-            case 'merchant_order_income':
+            case 'store_order_income':
                 return "店铺订单收入{$amount}元";
             case 'user_order_refund':
                 return "用户订单退款{$amount}元";
-            case 'merchant_order_refund':
+            case 'store_order_refund':
                 return "店铺订单退款{$amount}元";
-            case 'merchant_margin_refund':
+            case 'store_margin_refund':
                 return "店铺退还保证金{$amount}元";
             case 'user_order_promotion':
                 return "订单推广佣金{$amount}元";
diff --git a/app/common/logic/StoreFinanceFlowLogic.php b/app/common/logic/StoreFinanceFlowLogic.php
index d1682a305..584320465 100644
--- a/app/common/logic/StoreFinanceFlowLogic.php
+++ b/app/common/logic/StoreFinanceFlowLogic.php
@@ -2,6 +2,7 @@
 
 namespace app\common\logic;
 
+use app\common\enum\OrderEnum;
 use app\common\model\store_finance_flow\StoreFinanceFlow;
 
 class StoreFinanceFlowLogic extends BaseLogic
@@ -72,4 +73,13 @@ class StoreFinanceFlowLogic extends BaseLogic
         return 'fn' . $msectime . mt_rand(10000, max(intval($msec * 10000) + 10000, 98369));
     }
 
+    public function getStoreOrder($orderId, $storeId = 0, $status = 0)
+    {
+        return StoreFinanceFlow::where('order_id', $orderId)
+            ->where('store_id', $storeId)
+            ->where('status', $status)
+            ->where('financial_type', OrderEnum::MERCHANT_ORDER_OBTAINS)
+            ->find();
+    }
+
 }
diff --git a/app/common/model/store_order/StoreOrder.php b/app/common/model/store_order/StoreOrder.php
index 87d82e4ef..cdd968394 100644
--- a/app/common/model/store_order/StoreOrder.php
+++ b/app/common/model/store_order/StoreOrder.php
@@ -4,6 +4,7 @@ namespace app\common\model\store_order;
 
 
 use app\common\model\BaseModel;
+use app\common\model\system_store\SystemStore;
 use think\model\concern\SoftDelete;
 
 
@@ -18,5 +19,9 @@ class StoreOrder extends BaseModel
     protected $name = 'store_order';
     protected $deleteTime = 'delete_time';
 
-    
-}
\ No newline at end of file
+    public function store()
+    {
+        return $this->hasOne(SystemStore::class, 'id','store_id');
+    }
+
+}
diff --git a/app/store/controller/store_product/StoreProductController.php b/app/store/controller/store_product/StoreProductController.php
index 1f26b5760..74482cce1 100644
--- a/app/store/controller/store_product/StoreProductController.php
+++ b/app/store/controller/store_product/StoreProductController.php
@@ -80,6 +80,7 @@ class StoreProductController extends BaseAdminController
         ApiDoc\url('/store/store_product/storeProduct/edit'),
         ApiDoc\Method('POST'),
         ApiDoc\NotHeaders(),
+        ApiDoc\Query(name: "id", type: "int", require: true, desc: "id"),
         ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
         ApiDoc\ResponseSuccess("data", type: "array", children: [
             ['name' => 'id', 'desc' => 'ID', 'type' => 'int'],
@@ -108,6 +109,7 @@ class StoreProductController extends BaseAdminController
         ApiDoc\url('/store/store_product/storeProduct/delete'),
         ApiDoc\Method('POST'),
         ApiDoc\NotHeaders(),
+        ApiDoc\Param(name: "id", type: "int", require: true, desc: "id"),
         ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
         ApiDoc\ResponseSuccess("data", type: "array", children: [
             ['name' => 'id', 'desc' => 'ID', 'type' => 'int'],
@@ -133,6 +135,7 @@ class StoreProductController extends BaseAdminController
         ApiDoc\url('/store/store_product/storeProduct/detail'),
         ApiDoc\Method('GET'),
         ApiDoc\NotHeaders(),
+        ApiDoc\Query(name: "id", type: "int", require: true, desc: "id"),
         ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
         ApiDoc\ResponseSuccess("data", type: "array", children: [
             ['name' => 'id', 'desc' => 'ID', 'type' => 'int'],
@@ -158,6 +161,7 @@ class StoreProductController extends BaseAdminController
         ApiDoc\url('/store/store_product/storeProduct/status'),
         ApiDoc\Method('POST'),
         ApiDoc\NotHeaders(),
+        ApiDoc\Param(name: "id", type: "int", require: true, desc: "id"),
         ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
         ApiDoc\ResponseSuccess("data", type: "array"),
     ]
@@ -165,7 +169,7 @@ class StoreProductController extends BaseAdminController
     {
         $params = (new StoreProductValidate())->post()->goCheck('detail');
         StoreBranchProductLogic::status($params);
-        return $this->data([]);
+        return $this->success('操作成功', [], 1, 1);
     }
 
     #[
@@ -183,7 +187,7 @@ class StoreProductController extends BaseAdminController
     {
         $params = (new StoreProductValidate())->post()->goCheck('stock');
         StoreBranchProductLogic::stock($params);
-        return $this->data([]);
+        return $this->success('操作成功', [], 1, 1);
     }
 
 }