瀏覽代碼

预订功能

shish 2 年之前
父節點
當前提交
de37dbeb63

+ 31 - 0
app-ghs/controllers/BookCustomController.php

@@ -0,0 +1,31 @@
+<?php
+
+namespace ghs\controllers;
+
+use bizGhs\book\classes\BookCustomClass;
+use common\components\util;
+use Yii;
+
+class BookCustomController extends BaseController
+{
+
+    //预订客户列表 ssh 20240616
+    public function actionList()
+    {
+        $get = Yii::$app->request->get();
+        $where = [];
+        $where['mainId'] = $this->mainId;
+        $bookSn = $get['bookSn'] ?? '';
+        if (empty($bookSn)) {
+            $shop = $this->shop;
+            $bookSn = $shop->bookSn ?? 0;
+            if (empty($bookSn)) {
+                util::fail('请选择预订活动');
+            }
+        }
+        $where['bookSn'] = $bookSn;
+        $list = BookCustomClass::getAllByCondition($where, 'addTime DESC', '*');
+        util::success(['list' => $list]);
+    }
+
+}

+ 31 - 0
app-ghs/controllers/BookItemCustomController.php

@@ -0,0 +1,31 @@
+<?php
+
+namespace ghs\controllers;
+
+use bizGhs\book\classes\BookItemCustomClass;
+use common\components\util;
+use Yii;
+
+class BookItemCustomController extends BaseController
+{
+
+    //预订客户列表 ssh 20240616
+    public function actionList()
+    {
+        $get = Yii::$app->request->get();
+        $where = [];
+        $where['mainId'] = $this->mainId;
+        $bookSn = $get['bookSn'] ?? '';
+        if (empty($bookSn)) {
+            $shop = $this->shop;
+            $bookSn = $shop->bookSn ?? 0;
+            if (empty($bookSn)) {
+                util::fail('请选择预订活动');
+            }
+        }
+        $where['bookSn'] = $bookSn;
+        $list = BookItemCustomClass::getAllByCondition($where, 'addTime DESC', '*');
+        util::success(['list' => $list]);
+    }
+
+}

+ 1 - 1
app-ghs/controllers/ConsoleController.php

@@ -185,7 +185,7 @@ class ConsoleController extends BaseController
                 ["name" => "商城", "img" => "ghs/home/shop3.png", "url" => "/admin/home/mall"],
                 ["name" => "改价", "img" => "ghs/home/gj.png", "url" => "/admin/changePrice/list2"],
                 ["name" => "花材", "img" => "ghs/home/hcgl.png", "url" => "/admin/item/list2"],
-                ["name" => "预订客户", "img" => "ghs/home/yggl.png", "url" => "/admin/staff/list"],
+                ["name" => "预订客户", "img" => "ghs/home/yggl.png", "url" => "/admin/book/custom"],
                 ["name" => "改库存", "img" => "ghs/home/kcyjs.png", "url" => "/admin/changePrice/changeStock2"],
                 ["name" => "外采", "img" => "ghs/home/icon_caigou.png", "url" => "/pagesPurchase/wcOrder"],
                 ["name" => "供货商", "img" => "ghs/home/icon_ghs.png", "url" => "/pagesPurchase/supplier"],

+ 12 - 0
biz-ghs/book/classes/BookChangeGlobalClass.php

@@ -0,0 +1,12 @@
+<?php
+namespace bizGhs\book\classes;
+use bizGhs\base\classes\BaseClass;
+use common\components\util;
+use Yii;
+
+class BookChangeGlobalClass extends BaseClass
+{
+
+    public static $baseFile = '\bizGhs\book\models\BookChangeGlobal';
+
+}

+ 17 - 1
biz-ghs/book/classes/BookItemClass.php

@@ -77,7 +77,7 @@ class BookItemClass extends BaseClass
             $unique->bookNum = $currentNum;
             $unique->save();
 
-            $has = BookItemCustomClass::getByCondition(['mainId' => $mainId, 'itemId' => $itemId, 'customId' => $customId,], true);
+            $has = BookItemCustomClass::getByCondition(['mainId' => $mainId, 'bookSn' => $bookSn, 'customId' => $customId, 'itemId' => $itemId], true);
             if (empty($has)) {
                 $currentData = [
                     'name' => $name,
@@ -98,6 +98,22 @@ class BookItemClass extends BaseClass
             $has = BookItemCustomClass::getLockById($hasId);
             $has->bookNum = bcadd($has->bookNum, $num);
             $has->save();
+            //新增客户预订
+            $has = BookCustomClass::getByCondition(['mainId' => $mainId, 'bookSn' => $bookSn, 'customId' => $customId], true);
+            if (empty($has)) {
+                $currentData = [
+                    'name' => $customName,
+                    'py' => $customNamePy,
+                    'mainId' => $mainId,
+                    'customId' => $customId,
+                    'bookSn' => $bookSn,
+                ];
+                $has = BookCustomClass::add($currentData, true);
+            }
+            $hasId = $has->id ?? 0;
+            $has = BookCustomClass::getLockById($hasId);
+            $has->bookNum = bcadd($has->bookNum, $num);
+            $has->save();
         }
     }
 

+ 12 - 0
biz-ghs/book/classes/BookOnChangeGlobalClass.php

@@ -0,0 +1,12 @@
+<?php
+namespace bizGhs\book\classes;
+use bizGhs\base\classes\BaseClass;
+use common\components\util;
+use Yii;
+
+class BookOnChangeGlobalClass extends BaseClass
+{
+
+    public static $baseFile = '\bizGhs\book\models\BookOnChangeGlobal';
+
+}

+ 13 - 0
biz-ghs/book/models/BookChangeGlobal.php

@@ -0,0 +1,13 @@
+<?php
+namespace bizGhs\book\models;
+use bizGhs\base\models\Base;
+
+class BookChangeGlobal extends Base
+{
+
+    public static function tableName()
+    {
+        return 'xhBookChangeGlobal';
+    }
+
+}

+ 13 - 0
biz-ghs/book/models/BookOnChangeGlobal.php

@@ -0,0 +1,13 @@
+<?php
+namespace bizGhs\book\models;
+use bizGhs\base\models\Base;
+
+class BookOnChangeGlobal extends Base
+{
+
+    public static function tableName()
+    {
+        return 'xhBookOnChangeGlobal';
+    }
+
+}

+ 13 - 0
biz-ghs/book/services/BookChangeGlobalService.php

@@ -0,0 +1,13 @@
+<?php
+
+namespace bizGhs\book\services;
+
+use bizGhs\base\services\BaseService;
+use Yii;
+
+class BookChangeGlobalService extends BaseService
+{
+
+    public static $baseFile = '\bizGhs\book\classes\BookChangeGlobalClass';
+
+}

+ 13 - 0
biz-ghs/book/services/BookOnChangeGlobalService.php

@@ -0,0 +1,13 @@
+<?php
+
+namespace bizGhs\book\services;
+
+use bizGhs\base\services\BaseService;
+use Yii;
+
+class BookOnChangeGlobalService extends BaseService
+{
+
+    public static $baseFile = '\bizGhs\book\classes\BookOnChangeGlobalClass';
+
+}