shish 4 лет назад
Родитель
Сommit
5f644e6b3e
1 измененных файлов с 4 добавлено и 2 удалено
  1. 4 2
      app-ghs/controllers/ExpendController.php

+ 4 - 2
app-ghs/controllers/ExpendController.php

@@ -42,10 +42,11 @@ class ExpendController extends BaseController
                 if (empty($main)) {
                     util::fail('没有门店信息');
                 }
-                $main->money = bcsub($main->money, $amount, 2);
-                if ($main->money < 0) {
+                $balance = bcsub($main->money, $amount, 2);
+                if ($balance < 0) {
                     util::fail('现金不足');
                 }
+                $main->money = $balance;
                 $main->save();
 
                 $staffId = $this->shopAdminId;
@@ -57,6 +58,7 @@ class ExpendController extends BaseController
                 $capitalType = dict::getDict('capitalType', 'expendRegister', 'id');
 
                 $data = [];
+                $data['balance'] = $balance;
                 $data['mainId'] = $mainId;
                 $data['sjId'] = $this->sjId;
                 $data['amount'] = $amount;