瀏覽代碼

供货商

shish 5 年之前
父節點
當前提交
4491298787

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

@@ -15,7 +15,7 @@ class GhsController extends BaseController
     {
         $get = Yii::$app->request->get();
         $name = isset($get['name']) ? $get['name'] : '';
-        $where = ['sjId' => $this->sjId];
+        $where = ['shopId' => $this->shopId];
         if (!empty($name)) {
             if (stringUtil::isLetter($name)) {
                 $where['py'] = ['like', $name];
@@ -23,8 +23,7 @@ class GhsController extends BaseController
                 $where['name'] = ['like', $name];
             }
         }
-
-        $list = GhsClass::getSupplierList($where);
+        $list = GhsClass::getGhsList($where);
         util::success($list);
     }
 

+ 20 - 0
app-hd/controllers/GhsController.php

@@ -0,0 +1,20 @@
+<?php
+
+namespace hd\controllers;
+
+use biz\ghs\classes\GhsClass;
+use common\components\util;
+
+class GhsController extends BaseController
+{
+
+    //供货商列表 shish 2021.1.24
+    public function actionList()
+    {
+        $where = [];
+        $where['sjId'] = $this->sjId;
+        $respond = GhsClass::getGhsList($where);
+        util::success($respond);
+    }
+
+}

+ 0 - 34
app-hd/controllers/SupplierController.php

@@ -1,34 +0,0 @@
-<?php
-
-namespace hd\controllers;
-
-use biz\ghs\classes\GhsClass;
-use common\components\util;
-use Yii;
-
-class SupplierController extends BaseController
-{
-
-    //供货商列表 shish 2021.1.24
-    public function actionList()
-    {
-        $where = [];
-        $where['sjId'] = $this->sjId;
-        $respond = GhsClass::getSupplierList($where);
-        util::success($respond);
-    }
-
-    //待结款供货商列表 shish 2021.1.26
-    public function actionDebtList()
-    {
-        $get = Yii::$app->request->get();
-        $where = ['merchantId' => $this->sjId];
-        $status = $get['status'] ?? 0;
-        if (!empty($status)) {
-            $where['status'] = $status;
-        }
-        $list = GhsClass::getDebtList($where);
-        util::success($list);
-    }
-
-}

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

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

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

@@ -48,7 +48,7 @@ trait OrderTrait
 			return $list;
 		}
 		$supplierIds = array_unique(array_filter(array_column($list, 'supplierId')));
-		$supplierInfo = GhsClass::getSupplierByIds($supplierIds);
+		$supplierInfo = GhsClass::getGhsByIds($supplierIds);
 
 		foreach ($list as $k => $val) {
 			$supplierId = $val['supplierId'] ?? 0;

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

@@ -76,7 +76,7 @@ class PurchaseClass extends BaseClass
     {
 
         $supplierIds = array_unique(array_filter(array_column($list, 'supplierId')));
-        $supplierInfo = GhsClass::getSupplierByIds($supplierIds);
+        $supplierInfo = GhsClass::getGhsByIds($supplierIds);
 
         $adminIds = array_unique(array_filter(array_column($list, 'adminId')));
         $adminInfo = AdminClass::getAdminByIds($adminIds, null, 'id');

+ 1 - 1
biz-hd/purchase/services/PurchaseService.php

@@ -36,7 +36,7 @@ class PurchaseService extends BaseService
 		}
 		
 		$supplierIds = array_unique(array_filter(array_column($list, 'supplierId')));
-		$supplierInfo = GhsClass::getSupplierByIds($supplierIds);
+		$supplierInfo = GhsClass::getGhsByIds($supplierIds);
 
 		$adminIds = array_unique(array_filter(array_column($list, 'adminId')));
 		$adminInfo = AdminClass::getAdminByIds($adminIds);

+ 9 - 9
biz/ghs/classses/GhsClass.php → biz/ghs/classes/GhsClass.php

@@ -13,7 +13,7 @@ class GhsClass extends BaseClass
     public static $baseFile = '\biz\ghs\models\Ghs';
 
     //供货商列表 shish 2021.1.24
-    public static function getSupplierList($where)
+    public static function getGhsList($where)
     {
         $data = self::getList('*', $where, 'addTime DESC');
         $data['list'] = self::groupBaseInfo($data['list']);
@@ -21,7 +21,7 @@ class GhsClass extends BaseClass
     }
 
     //根据xhSupplier的id数组 取供货商信息 shish 2021.1.18
-    public static function getSupplierByIds($ids)
+    public static function getGhsByIds($ids)
     {
         $list = self::getByIds($ids, null, 'id');
         if (empty($list)) {
@@ -36,19 +36,19 @@ class GhsClass extends BaseClass
         if (empty($list)) {
             return $list;
         }
+        $prefix = imgUtil::getPrefix();
         foreach ($list as $key => $val) {
-            //头像大图
-            $list[$key]['logoUrl'] = imgUtil::getPrefix() . '/hhb_small.png';
-            //头像小图
-            $list[$key]['smallLogoUrl'] = imgUtil::getPrefix() . '/hhb_small.png';
-            $list[$key]['mobile'] = 15280215347;
-            $list[$key]['address'] = '厦门市集美区印斗北路与乐海路交叉路口西北侧';
+            $avatar = $prefix . 'hhb_small.png';
+            if (!empty($val['avatar'])) {
+                $avatar = $prefix . $val['avatar'];
+            }
+            $list[$key]['avatar'] = $avatar;
         }
         return $list;
     }
 
     //根据供货商信息 shish 2021.1.18
-    public static function getSupplierInfo($id)
+    public static function getGhsInfo($id)
     {
         $info = self::getById($id);
         $list = self::groupBaseInfo([$info]);

+ 32 - 1
sql.sql

@@ -1845,4 +1845,35 @@ ALTER TABLE xhGhs CHANGE `upShopId` `ghsShopId` INT(11) NOT NULL DEFAULT '0' COM
 ALTER TABLE xhGhs MODIFY `ghsShopId` INT(11) NOT NULL DEFAULT '0' COMMENT '供货商的门店id' AFTER ghsSjId;
 ALTER TABLE xhGhs ADD shopId INT NOT NULL DEFAULT 0 COMMENT '门店id' AFTER `ghsShopId`;
 ALTER TABLE xhGhs ADD sjId INT NOT NULL DEFAULT 0 COMMENT '商家id' AFTER `ghsShopId`;
-ALTER TABLE xhGhs DROP COLUMN `merchantId`;
+ALTER TABLE xhGhs DROP COLUMN `merchantId`;
+ALTER TABLE `xhGhs` MODIFY `name` VARCHAR(30) NOT NULL DEFAULT '' COMMENT '供货商名称' AFTER `avatar`;
+ALTER TABLE `xhGhs` MODIFY `py` VARCHAR(20) NOT NULL DEFAULT '' COMMENT '名称拼音首字母' AFTER `name`;
+ALTER TABLE `xhGhs` ADD mobile CHAR(15) NOT NULL DEFAULT '' COMMENT '手机号' AFTER `py`;
+DROP TABLE IF EXISTS `xhGhs`;
+CREATE TABLE IF NOT EXISTS `xhGhs` (
+  `id` INT(11) NOT NULL AUTO_INCREMENT,
+  `avatar` VARCHAR(800) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '头像',
+  `name` VARCHAR(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '供货商名称',
+  `py` VARCHAR(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '名称拼音首字母',
+  `mobile` CHAR(15) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '手机号',
+  `province` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '省',
+  `city` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '市',
+  `dist` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '区县',
+  `address` VARCHAR(500) NOT NULL DEFAULT '' COMMENT '街道地址',
+  `floor` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '楼号门牌号',
+  `fullAddress` VARCHAR(500) NOT NULL DEFAULT '' COMMENT '完整地址',
+    `lat` VARCHAR(20) NOT NULL DEFAULT '' COMMENT '纬度',
+  `long` VARCHAR(20) NOT NULL DEFAULT '' COMMENT '经度',
+  `ghsSjId` INT(11) NOT NULL DEFAULT '0' COMMENT '供货商的商家id',
+  `ghsShopId` INT(11) NOT NULL DEFAULT '0' COMMENT '供货商的门店id',
+  `sjId` INT(11) NOT NULL DEFAULT '0' COMMENT '商家id',
+  `shopId` INT(11) NOT NULL DEFAULT '0' COMMENT '门店id',
+  `debt` TINYINT(4) NOT NULL DEFAULT '1' COMMENT '1没有欠款 2有欠款',
+  `debtNum` SMALLINT(6) NOT NULL DEFAULT '0' COMMENT '欠款订单数,欠款笔数',
+  `debtAmount` DECIMAL(9,2) NOT NULL DEFAULT '0.00' COMMENT '欠款金额',
+  `expendAmount` DECIMAL(9,2) NOT NULL DEFAULT '0.00' COMMENT '消费金额',
+  `expendNum` INT(11) NOT NULL DEFAULT '0' COMMENT '消费次数',
+  `addTime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间',
+  `updateTime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+  PRIMARY KEY (`id`)
+) ENGINE=INNODB AUTO_INCREMENT=125861 COMMENT='供应商关系';