Ver código fonte

花材导入

shish 5 anos atrás
pai
commit
c538b03ad5

+ 27 - 0
app-hd/controllers/CheckOrderController.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace hd\controllers;
+
+use bizGhs\order\classes\CheckOrderClass;
+use bizGhs\product\classes\ProductClass;
+use Yii;
+use common\components\util;
+
+class CheckOrderController extends BaseController
+{
+
+    //订单列表 ssh 2021.1.14
+    public function actionList()
+    {
+        $get = Yii::$app->request->get();
+        $orderStatus = isset($get['status']) ? $get['status'] : '';
+        $where = [];
+        $where['shopId'] = $this->shopId;
+        if (!empty($orderStatus)) {
+            $where['status'] = $orderStatus;
+        }
+        $list = CheckOrderClass::getOrderList($where);
+        util::success($list);
+    }
+
+}

+ 18 - 12
app-hd/controllers/OrderController.php

@@ -5,6 +5,7 @@ namespace hd\controllers;
 use biz\sj\services\MerchantAssetService;
 use biz\sj\services\MerchantExtendService;
 use biz\sj\services\MerchantService;
+use bizHd\custom\classes\CustomClass;
 use bizHd\merchant\services\ShopService;
 use bizHd\order\classes\OrderClass;
 use bizHd\order\classes\OrderSendClass;
@@ -50,12 +51,17 @@ class OrderController extends BaseController
         $post['fromType'] = 1;//商城
         $customId = $post['customId'] ?? 0;
         if (!empty($customId)) {
-            $customId = $this->customId;
+            $customInfo = CustomClass::getCustomInfo($customId);
+            CustomClass::valid($customInfo, $this->sjId);
+            $post['customId'] = $customId;
         }
-        $post['customId'] = $customId;
-        //非门店订单
-        $store = 0;
-        $post['store'] = $store;
+        //门店订单
+        $post['store'] = 1;
+        //员工信息
+        $shopAdmin = $this->shopAdmin;
+        $shopAdminName = $shopAdmin['name'] ?? '';
+        $post['shopAdminName'] = $shopAdminName;
+        $post['shopAdminId'] = $this->shopAdminId;
 
         $couponId = isset($post['couponId']) && !empty($post['couponId']) ? $post['couponId'] : 0;
 
@@ -85,7 +91,7 @@ class OrderController extends BaseController
                     if (empty($goodsStyleList)) {
                         util::fail('商品款式没有找到');
                     }
-                    $styleIdList = array_keys(array_column($goodsStyleList,null,"id"));
+                    $styleIdList = array_keys(array_column($goodsStyleList, null, "id"));
                     if (in_array($goodsStyleId, $styleIdList) == false) {
                         util::fail('商品款式没有找到!');
                     }
@@ -220,7 +226,7 @@ class OrderController extends BaseController
         UserService::validPayPassword($payPassword, $user);
         //支付前验证订单有效性
         OrderService::checkBeforePay($order, $this->adminId);
-        $capitalType = dict::getDict('capitalType','xhOrder','id');
+        $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
         $totalFee = $order['prePrice'];
         $sourceType = 0;
         $discountData = OrderService::getDiscountPrice(['price' => $totalFee, 'sourceType' => $sourceType, 'couponId' => $couponId, 'userId' => $this->adminId]);
@@ -258,7 +264,7 @@ class OrderController extends BaseController
         } else {
             $openId = $this->user['openId'];
         }
-        $capitalType = dict::getDict('capitalType','xhOrder','id');
+        $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
         //流水类型、优惠卷、微信支付(h5还是小程序支付)类型 带到回调
         $wxPayType = 0;
         if (httpUtil::isMiniProgram()) {
@@ -375,7 +381,7 @@ class OrderController extends BaseController
             if (empty($openId)) {
                 util::fail('没有找到客户的openId');
             }
-            $capitalType = dict::getDict('capitalType','xhOrder','id');
+            $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
             //流水类型、优惠卷、微信支付(h5还是小程序支付)类型 带到回调
             $wxPayType = 0;
             if (httpUtil::isMiniProgram()) {
@@ -451,7 +457,7 @@ class OrderController extends BaseController
             $body = '';//商品描述,可空
             $timeout_express = "1m";//超时时间
 
-            $capitalType = dict::getDict('capitalType','xhOrder','id');
+            $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
             $passBackParams = 'capitalType=' . $capitalType . '&couponId=' . $couponId . '&merchantId=' . $merchantId;//将流水类型、优惠卷传过去
             $passBackParams = urlencode($passBackParams);
 
@@ -476,7 +482,7 @@ class OrderController extends BaseController
             $payPassword = isset($post['payPassword']) ? $post['payPassword'] : 0;
             $user = UserService::getUserInfo($this->adminId, false);
             UserService::validPayPassword($payPassword, $user);
-            $capitalType = dict::getDict('capitalType','xhOrder','id');
+            $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
             $callbackParams = [];
             $respond = xhPayToolService::balancePay($callbackParams, $orderSn, $actPrice, $capitalType, $couponId);
             $balance = isset($respond['balance']) ? $respond['balance'] : 0;
@@ -597,7 +603,7 @@ class OrderController extends BaseController
         $orderSn = $order['orderSn'];
 
         //流水类型列表
-        $capitalType = dict::getDict('capitalType','xhOrder','id');
+        $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
         $callbackParams = [];
         switch ($payWay) {
             case 0:

+ 7 - 0
app-hd/controllers/ShopController.php

@@ -16,6 +16,13 @@ class ShopController extends BaseController
 
     public $guestAccess = ['all'];
 
+    //获取当前门店信息 ssh 2021.3.27
+    public function actionCurrentShop()
+    {
+        $shop = $this->shop;
+        util::success($shop);
+    }
+
     //门店列表 ssh 20202.2.29
     public function actionList()
     {

+ 17 - 13
biz-ghs/order/classes/OrderClass.php

@@ -3,6 +3,7 @@
 namespace bizGhs\order\classes;
 
 use biz\express\classes\ExpressClass;
+use biz\shop\classes\ShopAdminClass;
 use biz\shop\classes\ShopClass;
 use biz\shop\models\Shop;
 use biz\shop\services\ShopService;
@@ -54,7 +55,7 @@ class OrderClass extends BaseClass
     const SEND_TYPE_THIRD = 4;
 
 
-    //待付款,待确认
+    //待付款
     const PAY_STATUS_UN_PAY = 1;
     //已付款
     const PAY_STATUS_HAS_PAY = 2;
@@ -76,10 +77,10 @@ class OrderClass extends BaseClass
     const CLEAR_HAS_GATHERING = 2;
 
     public static $sendTypeMap = [
-        self::SEND_TYPE_UNKNOWN =>'未确认',
-        self::SEND_TYPE_NO =>'自取',
-        self::SEND_TYPE_MYSELF =>'商家配送',
-        self::SEND_TYPE_THIRD =>'快递配送',
+        self::SEND_TYPE_UNKNOWN => '未确认',
+        self::SEND_TYPE_NO => '自取',
+        self::SEND_TYPE_MYSELF => '商家配送',
+        self::SEND_TYPE_THIRD => '快递配送',
     ];
 
     //添加订单 ssh 2019.12.5
@@ -99,7 +100,7 @@ class OrderClass extends BaseClass
         $data['bigNum'] = $respond['bigNum'] ?? 0;
         $data['smallNum'] = $respond['smallNum'] ?? 0;
         $data['actPrice'] = $respond['price'] ?? 0;
-        $data['prePrice'] = $respond['price']??0;
+        $data['prePrice'] = $respond['price'] ?? 0;
 
         //将花店每月的总   订单数作为编号
         $data['sendNum'] = StatOrderCountClass::addOrder($month, $sjId);
@@ -326,7 +327,7 @@ class OrderClass extends BaseClass
                     $expressProgress = ['progressName' => OrderExpressClass::$statusMap[$expressInfo['status']] ?? ''];
                 }
             }
-            $list[$key]['sendTypeName'] = self::$sendTypeMap[$val['sendType']]??'未知';
+            $list[$key]['sendTypeName'] = self::$sendTypeMap[$val['sendType']] ?? '未知';
             $list[$key]['expressProgress'] = $expressProgress;
             $list[$key]['customAvatarUrl'] = imgUtil::groupImg($val['customAvatar']);
             $list[$key]['customName'] = isset($val['customId']) && !empty($val['customId']) ? $val['customName'] : '散客';
@@ -501,12 +502,9 @@ class OrderClass extends BaseClass
         //更新订单基础状态和支付状态
         $unSend = self::ORDER_STATUS_UN_SEND;
         $upData = ['status' => $unSend];
-        if ($type == 3) {
-            //客户微信支付
-            $upData['payStatus'] = 2;
-        } elseif ($type == 2) {
+        if ($type == 2) {
             //已付款
-            $upData['payStatus'] = 2;
+            $upData['payStatus'] = self::PAY_STATUS_HAS_PAY;
         } elseif ($type == 1) {
             //欠款
             $customId = $order['customId'] ?? 0;
@@ -526,7 +524,13 @@ class OrderClass extends BaseClass
         $orderSn = $order['orderSn'];
         self::updateById($orderId, $upData);
 
-        //增加业绩
+        //员工业绩、总业绩增加
+        $shopAdminId = $order['shopAdminId'] ?? 0;
+        if (!empty($shopAdminId)) {
+            $shopAdmin = ShopAdminClass::getById($shopAdminId,true);
+            $shopAdmin->kdAmount = bcadd($shopAdmin->kdAmount, $amount, 2);
+            $shopAdmin->save();
+        }
         StatYjClass::addYj($order);
 
         $shop->unPayOrder -= 1;

+ 12 - 0
biz-hd/order/classes/OrderClass.php

@@ -2,8 +2,10 @@
 
 namespace bizHd\order\classes;
 
+use biz\shop\classes\ShopAdminClass;
 use biz\shop\models\Shop;
 use biz\stat\classes\StatOrderCountClass;
+use bizGhs\stat\classes\StatYjClass;
 use bizHd\stat\classes\StatOrderClass;
 use bizHd\user\classes\UserClass;
 use common\components\miniUtil;
@@ -69,6 +71,16 @@ class OrderClass extends BaseClass
         $data['totalFlow'] = OrderClass::ORDER_TOTAL_FLOW;
         $return = self::add($data);
 
+        //员工业绩、总业绩增加
+        $shopAdminId = $return['shopAdminId'] ?? 0;
+        if (!empty($shopAdminId)) {
+            $amount = $return['actPrice'] ?? 0.00;
+            $shopAdmin = ShopAdminClass::getById($shopAdminId, true);
+            $shopAdmin->kdAmount = bcadd($shopAdmin->kdAmount, $amount, 2);
+            $shopAdmin->save();
+        }
+        StatYjClass::addYj($return);
+
         return $return;
     }
 

+ 2 - 4
common/components/dict.php

@@ -14,7 +14,7 @@ class dict
         //显示零售和供货商的演示入口
         'showDemo' => 1,
         //零售演示的管理员id
-        'hdDemoAdminId' => 161,
+        'hdDemoAdminId' => 165,
         //供货商演示的管理员id
         'ghsDemoAdminId' => 125,
         'expressList' => [
@@ -39,16 +39,14 @@ class dict
         //涨价方式
         'riseType' => ['noRise' => 0, 'percent' => 1, 'amount' => 2,],
         'riseTypeName' => [0 => '不涨价', 1 => '按百分比', 2 => '按金额'],
-
+        //支付方式
         'payWay' => ['wxPay' => 0, 'alipay' => 1, 'balancePay' => 2, 'debtPay' => 3],
         'payWayName' => [0 => '微信', 1 => '支付宝', 2 => '余额', 3 => '欠款'],
         'payWayFullName' => [0 => '微信支付', 1 => '支付宝', 2 => '余额支付', 3 => '欠款支付'],
-
         //后台支付方式选项
         'htPayWayOption' => [
             ['name' => '微信', 'id' => 0],
             ['name' => '支付宝', 'id' => 1],
-            ['name' => '余额', 'id' => 2],
         ],
 
         'payStatus' => ['cancel' => -1, 'waitForPay' => 0, 'waitForSend' => 1],

BIN
console/item.xlsx


+ 8 - 1
sql.sql

@@ -2282,4 +2282,11 @@ ALTER TABLE xhPurchaseClear ADD shopId INT NOT NULL DEFAULT 0 COMMENT '门店id'
 ALTER TABLE xhPurchaseClear CHANGE `merchantId` `sjId` INT(11) NOT NULL DEFAULT '0' COMMENT '商家id';
 ALTER TABLE xhPurchaseClear ADD ghsId INT NOT NULL DEFAULT 0 COMMENT '供货商id' AFTER `orderSn`;
 ALTER TABLE `xhPurchase` ADD clearId INT NOT NULL DEFAULT 0 COMMENT '欠款结算id' AFTER `payWay`;
-ALTER TABLE xhApply ADD hasLicense TINYINT NOT NULL DEFAULT 1 COMMENT '提供证件 1有 2没有' AFTER `name`;
+ALTER TABLE xhApply ADD hasLicense TINYINT NOT NULL DEFAULT 1 COMMENT '提供证件 1有 2没有' AFTER `name`;
+ALTER TABLE xhShopAdmin ADD kdAmount DECIMAL(9,2) NOT NULL DEFAULT '0.00' COMMENT '业绩,累计开单金额' AFTER `merchantId`;
+ALTER TABLE `xhOrder` ADD `shopAdminName` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '员工名称' AFTER `actPrice`
+ALTER TABLE `xhOrder` ADD `shopAdminId` INT(11) NOT NULL DEFAULT '0' COMMENT '员工id' AFTER `actPrice`;
+ALTER TABLE xhAdmin DROP INDEX `admin`;
+ALTER TABLE `xhAdmin` ADD UNIQUE INDEX `admin`(`mobile`,`style`);
+ALTER TABLE xhAdmin DROP INDEX `admin`;
+ALTER TABLE `xhAdmin` ADD UNIQUE INDEX `admin`(`mobile`,`style`);