Forráskód Böngészése

供货商字段调整

shish 5 éve
szülő
commit
6e68cc41ef

+ 3 - 3
app-ghs/controllers/PurchaseOrderController.php

@@ -32,11 +32,11 @@ class PurchaseOrderController extends BaseController
         //判断花材格式,是否属于当前门店
         ProductClass::valid($ghsItemInfo,$this->shopId);
         //获取供应商信息
-        $supplierId = $post['supplierId'];
-        if(empty($supplierId)){
+        $ghsId = $post['ghsId'];
+        if(empty($ghsId)){
             util::fail("请选择供应商");
         }
-        $supplierInfo = GhsClass::getGhsInfo($supplierId);
+        $supplierInfo = GhsClass::getGhsInfo($ghsId);
         GhsClass::valid($supplierInfo,$this->sjId);
         $post['supplierInfo']= json_encode($supplierInfo);
 

+ 2 - 2
app-hd/controllers/AdminController.php

@@ -202,7 +202,7 @@ class AdminController extends BaseController
 
 		util::success(['mobile' => $mobile]);
 	}
-	
+
 	//设置支付密码 ssh 2021.1.24
 	public function actionSetPayPassword()
 	{
@@ -220,5 +220,5 @@ class AdminController extends BaseController
 		AdminClass::updateById($adminId, ['payPassword' => $string]);
 		util::complete();
 	}
-	
+
 }

+ 8 - 6
app-hd/controllers/PurchaseController.php

@@ -19,17 +19,19 @@ class PurchaseController extends BaseController
     public function actionCreateOrder()
     {
         $post = Yii::$app->request->post();
-        $supplierId = $post['supplierId'] ?? 0;
+        $ghsId = $post['ghsId'] ?? 0;
         //供货商
-        $supplier = GhsClass::getById($supplierId);
+        $supplier = GhsClass::getById($ghsId);
         if (empty($supplier)) {
             util::fail('没有找到供货商');
         }
         $ghsShopId = $supplier['ghsShopId'] ?? 0;
-        $ghsSjId = $supplier['ghsSjId'] ?? 0;
-        $post['ghsShopId'] = $ghsShopId;
-        $post['ghsSjId'] = $ghsSjId;
+        $post['merchantId'] = $this->sjId;
         $post['shopId'] = $this->shopId;
+        $post['shopAdminId'] = $this->shopAdminId;
+        $shopAdmin = $this->shopAdmin;
+        $name = $shopAdmin['name'] ?? '';
+        $post['shopAdminName'] = $name;
         $product = $post['product'] ?? '';
         $productList = json_decode($product, true);
         //判断product数据是不是同个供货商的
@@ -78,7 +80,7 @@ class PurchaseController extends BaseController
     public function actionList()
     {
         $get = Yii::$app->request->get();
-        $where = ['merchantId' => $this->sjId];
+        $where = ['shopId' => $this->shopId];
         $status = $get['status'] ?? 0;
         if (!empty($status)) {
             $where['status'] = $status;

+ 2 - 2
biz-ghs/order/classes/PurchaseOrderClass.php

@@ -193,8 +193,8 @@ class PurchaseOrderClass extends BaseClass
         $orderData = self::groupAdmin($orderData);
 
 		//供货商信息
-        $supplierId = $orderData['supplierId'] ?? 0;
-        $supplierInfo = GhsClass::getGhsInfo($supplierId);
+        $ghsId = $orderData['ghsId'] ?? 0;
+        $supplierInfo = GhsClass::getGhsInfo($ghsId);
         $orderData['supplierName'] = $supplierInfo['name'] ?? '';
         $orderData['supplierMobile'] = $supplierInfo['mobile'] ?? '';
 	    $orderData['supplierAddress'] = $supplierInfo['address'] ?? '';

+ 7 - 7
biz-ghs/order/traits/OrderTrait.php

@@ -54,15 +54,15 @@ trait OrderTrait
 		if (empty($list)) {
 			return $list;
 		}
-		$supplierIds = array_unique(array_filter(array_column($list, 'supplierId')));
-		$supplierInfo = GhsClass::getGhsByIds($supplierIds);
+		$ghsIds = array_unique(array_filter(array_column($list, 'ghsId')));
+		$supplierInfo = GhsClass::getGhsByIds($ghsIds);
 
 		foreach ($list as $k => $val) {
-			$supplierId = $val['supplierId'] ?? 0;
-			$list[$k]['supplierName'] = $supplierInfo[$supplierId]['name'] ?? '';
-			$list[$k]['supplierAvatar'] = $supplierInfo[$supplierId]['smallLogoUrl'] ?? '';
-			$list[$k]['supplierMobile'] = $supplierInfo[$supplierId]['mobile'] ?? '';
-			$list[$k]['supplierAddress'] = $supplierInfo[$supplierId]['address'] ?? '';
+			$ghsId = $val['ghsId'] ?? 0;
+			$list[$k]['supplierName'] = $supplierInfo[$ghsId]['name'] ?? '';
+			$list[$k]['supplierAvatar'] = $supplierInfo[$ghsId]['smallLogoUrl'] ?? '';
+			$list[$k]['supplierMobile'] = $supplierInfo[$ghsId]['mobile'] ?? '';
+			$list[$k]['supplierAddress'] = $supplierInfo[$ghsId]['address'] ?? '';
 		}
 		return $list;
 	}

+ 12 - 12
biz-hd/purchase/classes/PurchaseClass.php

@@ -51,8 +51,8 @@ class PurchaseClass extends BaseClass
         PurchaseItemClass::batchAdd($productList);
 
         //供货商增加订单
-        $ghsSjId = $data['ghsSjId'] ?? 0;
-        $ghsShopId = $data['ghsShopId'] ?? 0;
+
+
         $getType = $data['getType'];
         $orderData = [
             'prePrice' => 0.01,
@@ -63,7 +63,7 @@ class PurchaseClass extends BaseClass
             'merchantId' => $ghsSjId,
             'sendType'=>$getType,
         ];
-        $shop = ShopClass::getShopInfo($ghsShopId);
+
         \bizGhs\order\classes\OrderClass::addOrder($orderData, $shop, true);
 
         return $respond;
@@ -82,8 +82,8 @@ class PurchaseClass extends BaseClass
     public static function groupPurchase($list, $showButton = false, $showProduct = false)
     {
 
-        $supplierIds = array_unique(array_filter(array_column($list, 'supplierId')));
-        $supplierInfo = GhsClass::getGhsByIds($supplierIds);
+        $ghsIds = array_unique(array_filter(array_column($list, 'ghsId')));
+        $supplierInfo = GhsClass::getGhsByIds($ghsIds);
 
         $adminIds = array_unique(array_filter(array_column($list, 'adminId')));
         $adminInfo = AdminClass::getAdminByIds($adminIds, null, 'id');
@@ -93,11 +93,11 @@ class PurchaseClass extends BaseClass
             $adminId = $val['adminId'] ?? 0;
             $list[$key]['adminName'] = $adminInfo[$adminId]['name'] ?? '';
 
-            $supplierId = $val['supplierId'] ?? 0;
-            $list[$key]['supplierName'] = $supplierInfo[$supplierId]['name'] ?? '';
-            $list[$key]['supplierAvatar'] = $supplierInfo[$supplierId]['smallLogoUrl'] ?? '';
-            $list[$key]['supplierMobile'] = $supplierInfo[$supplierId]['mobile'] ?? '';
-            $list[$key]['supplierAddress'] = $supplierInfo[$supplierId]['address'] ?? '';
+            $ghsId = $val['ghsId'] ?? 0;
+            $list[$key]['supplierName'] = $supplierInfo[$ghsId]['name'] ?? '';
+            $list[$key]['supplierAvatar'] = $supplierInfo[$ghsId]['smallLogoUrl'] ?? '';
+            $list[$key]['supplierMobile'] = $supplierInfo[$ghsId]['mobile'] ?? '';
+            $list[$key]['supplierAddress'] = $supplierInfo[$ghsId]['address'] ?? '';
 
             if ($showButton) {
                 $list[$key]['buttonList'] = [
@@ -150,8 +150,8 @@ class PurchaseClass extends BaseClass
     //采购订单支付成功后回调处理流程
     public static function complete($purchase)
     {
-        $supplierId = $purchase->supplierId;
-        if (empty($supplierId)) {
+        $ghsId = $purchase->ghsId;
+        if (empty($ghsId)) {
 
             //补充供货商关系
             $ghsSjId = $purchase->ghsSjId;

+ 5 - 11
biz-hd/purchase/services/PurchaseService.php

@@ -19,12 +19,6 @@ class PurchaseService extends BaseService
     {
         $data = PurchaseClass::getList('*', $where, 'addTime DESC');
         $data['list'] = self::groupInfo($data['list']);
-        $data['allNum'] = 0;
-        $data['unPayNum'] = 0;
-        $data['unSendNum'] = 0;
-        $data['sendingNum'] = 0;
-        $data['finishNum'] = 0;
-        $data['debtNum'] = 0;
         return $data;
     }
 
@@ -35,16 +29,16 @@ class PurchaseService extends BaseService
             return $list;
         }
 
-        $supplierIds = array_unique(array_filter(array_column($list, 'supplierId')));
-        $supplierInfo = GhsClass::getGhsByIds($supplierIds);
+        $ghsIds = array_unique(array_filter(array_column($list, 'ghsId')));
+        $supplierInfo = GhsClass::getGhsByIds($ghsIds);
 
         $adminIds = array_unique(array_filter(array_column($list, 'adminId')));
         $adminInfo = AdminClass::getAdminByIds($adminIds);
 
         foreach ($list as $key => $val) {
-            $supplierId = $val['supplierId'];
-            $list[$key]['supplierName'] = $supplierInfo[$supplierId]['name'] ?? '';
-            $list[$key]['supplierAvatar'] = $supplierInfo[$supplierId]['logoUrl'] ?? imgUtil::getPrefix() . '/hhb_small.png';
+            $ghsId = $val['ghsId'];
+            $list[$key]['supplierName'] = $supplierInfo[$ghsId]['name'] ?? '';
+            $list[$key]['supplierAvatar'] = $supplierInfo[$ghsId]['logoUrl'] ?? imgUtil::getPrefix() . '/hhb_small.png';
             $adminId = $val['adminId'] ?? 0;
             $list[$key]['adminName'] = $adminInfo[$adminId]['name'] ?? '';
             $list[$key]['status'] = rand(1, 4);

+ 17 - 1
sql.sql

@@ -2225,10 +2225,26 @@ ALTER TABLE `xhRenew` DROP COLUMN `beforeDeadline`;
 ALTER TABLE `xhRenew` ADD deadline DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '到期时间' AFTER `setId`;
 ALTER TABLE `xhRenew` ADD beforeDeadline DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '上次到期时间' AFTER `deadline`;
 ALTER TABLE xhSjExt ADD rechargeRenew TINYINT NOT NULL DEFAULT 1 COMMENT '参与充值续期活动 1没有 2有' AFTER `rrkdKey`;
+DROP TABLE IF EXISTS `xhShopImg`;
+ALTER TABLE xhShop ADD img VARCHAR(1000) NOT NULL DEFAULT '' COMMENT '图片' AFTER `adminId`;
+ALTER TABLE xhPurchase DROP COLUMN `upId`;
+ALTER TABLE xhPurchase DROP COLUMN `upShopId`;
+ALTER TABLE xhPurchase MODIFY `status` TINYINT(2) NOT NULL DEFAULT '1' COMMENT '订单状态 1待付款,待确认,2待配送,3配送中,4已完成';
+ALTER TABLE xhPurchase ADD shopAdminId INT NOT NULL DEFAULT 0 COMMENT '员工id' AFTER `merchantId`;
+ALTER TABLE xhPurchase ADD shopAdminName VARCHAR(50) NOT NULL DEFAULT '' COMMENT '员工姓名' AFTER shopAdminId;
+ALTER TABLE xhGhsPurchaseOrder ADD shopAdminId INT NOT NULL DEFAULT 0 COMMENT '员工id' AFTER `merchantId`;
+ALTER TABLE xhGhsPurchaseOrder ADD shopAdminName VARCHAR(50) NOT NULL DEFAULT '' COMMENT '员工姓名' AFTER shopAdminId;
 
 执行命令将原有的商品拼音补齐 yii goods/py
 
 ===============linqh  2021-04-25
 =====
 ALTER TABLE `xhGhsPurchaseOrder`
-ADD COLUMN `supplierInfo`  varchar(500) NOT NULL DEFAULT '' COMMENT '供应商信息' AFTER `supplierId`;
+ADD COLUMN `supplierInfo`  varchar(500) NOT NULL DEFAULT '' COMMENT '供应商信息' AFTER `supplierId`;
+
+
+==== shish 20210426
+ALTER TABLE xhGhsPurchaseOrder CHANGE `supplierId` `ghsId` INT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '供货商ID';
+ALTER TABLE xhGhsPurchaseOrder CHANGE `supplierInfo` `ghsInfo` VARCHAR(5000) NOT NULL DEFAULT '' COMMENT '供应商信息';
+ALTER TABLE xhPurchase CHANGE `supplierId` `ghsId` INT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '供货商ID';
+ALTER TABLE xhPurchase ADD `ghsInfo` VARCHAR(2000) NOT NULL DEFAULT '' COMMENT '供应商信息' AFTER `ghsId`;