shish 1 месяц назад
Родитель
Сommit
62d3631fd3
1 измененных файлов с 29 добавлено и 6 удалено
  1. 29 6
      app-hd/controllers/PurchaseController.php

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

@@ -97,6 +97,7 @@ class PurchaseController extends BaseController
         util::complete('确认成功');
     }
 
+    //这个接口只能用于
     public function actionGetFullInfo()
     {
         $get = Yii::$app->request->get();
@@ -105,16 +106,38 @@ class PurchaseController extends BaseController
         if (empty($info)) {
             util::fail('没有找到采购单');
         }
-        if (isset($info['mainId']) == false || $info['mainId'] != $this->mainId) {
+        if (!isset($info['mainId']) || $info['mainId'] != $this->mainId) {
             util::fail('无法访问。。。');
         }
         $orderSn = $info['orderSn'] ?? '';
-        $ghsId = $info['ghsId'] ?? 0;
-        $info['ghsShopId'] = 0;
-        if (!empty($ghsId)) {
-            $ghs = GhsClass::getById($ghsId, true);
-            $info['ghsShopId'] = $ghs->shopId ?? 0;
+        $ghsShopId = $info['ghsShopId'] ?? 0;
+        if (empty($ghsShopId)) {
+            $ghsId = $info['ghsId'] ?? 0;
+            if (!empty($ghsId)) {
+                $ghs = GhsClass::getById($ghsId, true);
+                $ghsShopId = $ghs->shopId ?? 0;
+                PurchaseClass::updateById($id, ['ghsShopId' => $ghsShopId]);
+            }
         }
+
+        //申请售后 0禁止 1允许
+        $afterSale = 1;
+        //下单后多少小时内可以售后,0不限制
+        $saleHour = 12;
+        //是否可以仅退款 1支持 0不支持
+        $refundOnlyPrice = 1;
+        //售后是否要求上传照片 0不要求 1必须
+        $refundMustImg = 0;
+        if (!empty($ghsShopId)) {
+            $shop = ShopClass::getByCondition(['ghsShopId' => $ghsShopId], false, false, 'id,afterSale,saleHour,refundOnlyPrice,refundMustImg');
+            $afterSale = $shop['afterSale'] ?? 1;
+            $saleHour = $shop['saleHour'] ?? 12;
+            $refundOnlyPrice = $shop['refundOnlyPrice'] ?? 1;
+            $refundMustImg = $shop['refundMustImg'] ?? 0;
+        }
+        //售后规则
+        $info['afterSaleRule'] = ['afterSale' => $afterSale, 'saleHour' => $saleHour, 'refundOnlyPrice' => $refundOnlyPrice, 'refundMustImg' => $refundMustImg];
+
         $list = PurchaseItemClass::getAllByCondition(['orderSn' => $orderSn], null, '*');
         if (!empty($list)) {
             foreach ($list as $key => $item) {