Browse Source

采购与下单

shish 5 năm trước cách đây
mục cha
commit
bb9c83c1bb

+ 2 - 3
app/ghs/controllers/OrderController.php

@@ -29,16 +29,15 @@ class OrderController extends BaseController
     public function actionCreateOrder()
     {
         $post = Yii::$app->request->post();
-        //供货商端口:员工开单、客户开单
         $adminId = $this->adminId;
         $shopId = $this->shopId;
         if(!empty($shopId)){
-            //供货商端员工开单
+            //供货商端 员工 开单
             $post['customId'] = $post['customId'] ?? 0;
             $post['adminId'] = $adminId;
             $post['userId'] = 0;
         }else{
-            //供货商端客户开单
+            //供货商端 客户 开单
             $post['userId'] = $adminId;
             $post['adminId'] = 0;
             $post['customId'] = CustomClass::addCustom();

+ 2 - 1
app/shop/controllers/BaseController.php

@@ -26,7 +26,8 @@ class BaseController extends PublicController
 	public function beforeAction($action)
 	{
 		//token验证
-		$adminId = jwt::getLoginId();
+		//$adminId = jwt::getLoginId();
+        $adminId = 18569;
 		$merchantId = 0;
 		$merchant = [];
 		$merchantExtend = [];

+ 10 - 11
app/shop/controllers/PurchaseController.php

@@ -2,6 +2,7 @@
 
 namespace shop\controllers;
 
+use biz\purchase\classes\PurchaseClass;
 use Yii;
 use common\components\util;
 
@@ -11,17 +12,15 @@ class PurchaseController extends BaseController
     //生成采购单 shish 2021.1.17
     public function actionCreateOrder()
     {
-        $itemData = [
-            [
-                'orderId'=>$orderId,
-                'itemId'=>0,
-                'productId'=>0,
-                'unitPrice'=>0.01,
-                'unitNum'=>0,
-                'num'=>0,
-            ],
-        ];
-        //OrderGoodsService::add($data);//创建订单商品列表
+        $post = Yii::$app->request->post();
+        $product = $post['product'] ?? '';
+        $arr = json_decode($product, true);
+
+        //判断product数据是不是同个供货商的
+
+        $post['product'] = $arr;
+        PurchaseClass::addPurchase($post);
+        util::complete();
     }
 
 }

+ 19 - 0
biz/purchase/classes/PurchaseClass.php

@@ -0,0 +1,19 @@
+<?php
+
+namespace biz\purchase\classes;
+
+use Yii;
+use biz\base\classes\BaseClass;
+
+class PurchaseClass extends BaseClass
+{
+
+    public static $baseFile = '\biz\purchase\models\Purchase';
+
+    //添加采购 shish 2021.1.18
+    public static function addPurchase($data)
+    {
+
+    }
+
+}

+ 10 - 0
biz/purchase/models/Purchase.php

@@ -0,0 +1,10 @@
+<?php
+
+namespace biz\purchase\models;
+
+use biz\base\models\Base;
+
+class Purchase extends Base
+{
+
+}

+ 13 - 0
biz/purchase/services/PurchaseService.php

@@ -0,0 +1,13 @@
+<?php
+
+namespace biz\purchase\services;
+
+use biz\base\services\BaseService;
+use Yii;
+
+class PurchaseService extends BaseService
+{
+
+    public static $baseFile = '\biz\purchase\classes\PurchaseClass';
+
+}

+ 2 - 1
sql.sql

@@ -632,4 +632,5 @@ ALTER TABLE `xhSupplier` ADD py VARCHAR(20) NOT NULL DEFAULT '' COMMENT '' AFTER
 ALTER TABLE `xhItem` CHANGE `pyName` `py` VARCHAR(20) NOT NULL DEFAULT '' COMMENT '花材名称的拼音首字母';
 ALTER TABLE `xhGhsOrderItem` ADD orderSn CHAR(40) NOT NULL DEFAULT '' COMMENT '订单编号' AFTER `orderId`;
 ALTER TABLE xhSupplier MODIFY `py` VARCHAR(20) NOT NULL DEFAULT '' COMMENT '名称拼音首字母';
-ALTER TABLE xhSupplier ADD upShopId INT NOT NULL DEFAULT 0 COMMENT '上游供货商门店id' AFTER `py`;
+ALTER TABLE xhSupplier ADD upShopId INT NOT NULL DEFAULT 0 COMMENT '上游供货商门店id' AFTER `py`;
+ALTER TABLE `xhPurchaseItem` ADD orderSn CHAR(40) NOT NULL DEFAULT '' COMMENT '订单编号' AFTER orderId;