Browse Source

申请售后

shish 1 year ago
parent
commit
8b96fd98de

+ 2 - 0
app-hd/controllers/CgRefundController.php

@@ -138,6 +138,8 @@ class CgRefundController extends BaseController
             $respond = CgRefundService::createOrder($post, $cg);
             $transaction->commit();
 
+            RefundOrderClass::printRefund($respond);
+
             $saleRefundId = $respond->saleRefundId ?? 0;
             $saleRefund = RefundOrderClass::getById($saleRefundId, true);
             if (!empty($saleRefund)) {

+ 60 - 0
biz-ghs/order/classes/RefundOrderClass.php

@@ -4,6 +4,8 @@ namespace bizGhs\order\classes;
 
 use biz\shop\classes\ShopCapitalClass;
 use biz\shop\classes\ShopClass;
+use biz\shop\classes\ShopExtClass;
+use biz\sj\classes\SjClass;
 use biz\stat\classes\StatOutClass;
 use bizGhs\order\traits\OrderTrait;
 use bizGhs\product\classes\ProductClass;
@@ -14,6 +16,7 @@ use common\components\dict;
 use common\components\noticeUtil;
 use common\components\orderSn;
 use bizGhs\shop\classes\ShopMoneyClass;
+use common\components\printUtil;
 use common\components\util;
 use bizGhs\custom\classes\CustomClass;
 use Yii;
@@ -32,6 +35,63 @@ class RefundOrderClass extends BaseClass
     const REFUND_TYPE_MONEY_GOOD = 1; //退款退货
     const REFUND_TYPE_MONEY = 2; // 仅退款
 
+    //打印退款的小票 ssh 20241001
+    public static function printRefund($respond)
+    {
+        $saleRefundId = $respond->saleRefundId ?? 0;
+        $refund = self::getById($saleRefundId, true);
+        if (empty($refund)) {
+            return false;
+        }
+        if ($refund->status != 0) {
+            return false;
+        }
+        $orderSn = $refund->orderSn ?? '';
+        $shopId = $refund->shopId ?? 0;
+        $refundPrice = $refund->refundPrice ?? 0;
+        $shop = ShopClass::getById($shopId, true);
+
+        $sjId = $shop->sjId ?? 0;
+        $sj = SjClass::getById($sjId, true);
+        $sjName = $sj->name ?? '';
+        $shopName = $shop->shopName ?? '';
+        $currentName = $shopName == '首店' ? $sjName : $sjName . ' ' . $shopName;
+
+        $content = "<CB>" . $currentName . "</CB>";
+        $content .= "<CB>退款信息</CB><BR><BR>";
+
+        $content .= '--------------------------------<BR>';
+
+        $content .= '<B>买家信息:</B><BR><BR>';
+        $content .= '<B>' . $refund->customName . '</B><BR>';
+        $content .= '<B>' . $refund->customMobile . '</B><BR>';
+
+        $itemList = RefundOrderItemClass::getAllByCondition(['orderSn' => $orderSn], null, '*', null);
+        if (!empty($itemList)) {
+            foreach ($itemList as $itemInfo) {
+                $name = $itemInfo['name'] ?? '';
+                $num = $itemInfo['xhNum'] ?? 0;
+                $unitName = $itemInfo['xhUnitName'] ?? '扎';
+                $content .= $name . ' ' . $num . $unitName;
+            }
+        }
+
+        $content .= "<BR>";
+        $content .= "<CB>金额:{$refundPrice}</CB><BR><BR>";
+        $content .= "<BR>";
+        $content .= "<CB>状态:待审核</CB><BR><BR>";
+        $content .= "<BR>";
+        $content .= '<AUDIO-REFUND>';
+        $ext = ShopExtClass::getByCondition(['shopId' => $shopId]);
+
+        $printSn = $ext['printSn'] ?? '';
+        if (!empty($printSn)) {
+            $p = new printUtil($printSn);
+            $p->printMsg($content, $shop, $orderSn);
+        }
+
+    }
+
     //审核通过 ssh 20230811
     public static function passRefund($refund, $order)
     {