|
|
@@ -3,9 +3,11 @@
|
|
|
namespace hd\controllers;
|
|
|
|
|
|
use biz\shop\classes\ShopExtClass;
|
|
|
+use bizHd\custom\classes\CustomClass;
|
|
|
use bizHd\order\classes\OrderClass;
|
|
|
use bizHd\order\classes\OrderGoodsClass;
|
|
|
use bizHd\order\classes\OrderItemClass;
|
|
|
+use bizHd\order\services\OrderService;
|
|
|
use bizHd\refund\classes\HdRefundClass;
|
|
|
use bizHd\refund\classes\HdRefundGoodsClass;
|
|
|
use bizHd\refund\classes\HdRefundItemClass;
|
|
|
@@ -121,7 +123,7 @@ class RefundController extends BaseController
|
|
|
util::fail('历史订单,不能发起退款哦');
|
|
|
}
|
|
|
|
|
|
- //商品花材结构 property 0商品 1花材
|
|
|
+ //商品花材结构 property 0花束 1花材
|
|
|
//[{productId:0,num:1,unitType:0,unitPrice:12,unitName:'扎',property:1}]
|
|
|
$productJson = $post['product'] ?? '';
|
|
|
if (empty($productJson)) {
|
|
|
@@ -154,7 +156,97 @@ class RefundController extends BaseController
|
|
|
$ret = OrderClass::ifMinusRefund($order, $main, $post['price']);
|
|
|
$minusOrderRefund = $ret['minusOrderRefund'] ?? 0;
|
|
|
if ($minusOrderRefund == 1) {
|
|
|
- //走负数订单
|
|
|
+ $customId = $order->customId ?? 0;
|
|
|
+ $custom = CustomClass::getById($customId, true);
|
|
|
+ if (empty($custom)) {
|
|
|
+ util::fail('没有客户哈!');
|
|
|
+ }
|
|
|
+ //线下付款
|
|
|
+ $hasPay = 1;
|
|
|
+ $shopId = $order->shopId;
|
|
|
+ $staffId = $this->shopAdminId;
|
|
|
+ $staffName = $this->shopAdminName;
|
|
|
+ $refundType = $post['refundType'] ?? 1;//1退货并退款2只退款
|
|
|
+ $forwardStock = $refundType == 1 ? 0 : 1;
|
|
|
+ $refundPrice = $post['price'] ?? 0;
|
|
|
+
|
|
|
+ $hasItem = false;
|
|
|
+ $hasBouquet = false;
|
|
|
+ // property 0花束 1花材
|
|
|
+ $orderProductList = [];
|
|
|
+ foreach ($productList as $thisInfo) {
|
|
|
+ $num = $thisInfo['num'] ?? 0;
|
|
|
+ $unitType = $thisInfo['unitType'] ?? 0;
|
|
|
+ $property = $thisInfo['property'] ?? 0;
|
|
|
+ $unitPrice = $thisInfo['unitPrice'] ?? 0;
|
|
|
+ $productId = $thisInfo['productId'] ?? 0;
|
|
|
+ $orderProductList[] = [
|
|
|
+ 'productId' => $productId,
|
|
|
+ 'unitPrice' => $unitPrice,
|
|
|
+ 'remark' => '',
|
|
|
+ 'property' => $property,
|
|
|
+ 'unitType' => $unitType,
|
|
|
+ 'num' => $num,
|
|
|
+ ];
|
|
|
+ if ($property == 0) {
|
|
|
+ $hasBouquet = true;
|
|
|
+ }
|
|
|
+ if ($property == 1) {
|
|
|
+ $hasItem = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $orderType = 0;
|
|
|
+ if ($hasBouquet) {
|
|
|
+ $orderType = 1;
|
|
|
+ }
|
|
|
+ if ($hasItem) {
|
|
|
+ $orderType = 2;
|
|
|
+ }
|
|
|
+ if ($hasItem && $hasBouquet) {
|
|
|
+ $orderType = 3;
|
|
|
+ }
|
|
|
+
|
|
|
+ $sjId = $order->sjId;
|
|
|
+ $mainId = $order->mainId;
|
|
|
+ $deadline = time() + 8640000;
|
|
|
+ $hdId = $order->hdId;
|
|
|
+ $hdName = $order->hdName;
|
|
|
+ $customNamePy = $order->customNamePy;
|
|
|
+ $customName = $order->customName;
|
|
|
+ $orderData = [
|
|
|
+ 'hasPay' => 1,
|
|
|
+ 'payWay' => 0,
|
|
|
+ 'shopId' => $shopId,
|
|
|
+ 'customId' => $customId,
|
|
|
+ 'customName' => $customName,
|
|
|
+ 'customNamePy' => $customNamePy,
|
|
|
+ 'product' => $orderProductList,
|
|
|
+ 'needPrint' => 2,
|
|
|
+ 'getStaffId' => $staffId,
|
|
|
+ 'getStaffName' => $staffName,
|
|
|
+ 'shopAdminId' => $staffId,
|
|
|
+ 'shopAdminName' => $staffName,
|
|
|
+ 'dealPrice' => 1,
|
|
|
+ 'forward' => 0,
|
|
|
+ 'forwardStock' => $forwardStock,
|
|
|
+ 'modifyPrice' => $refundPrice,
|
|
|
+ 'orderType' => $orderType,
|
|
|
+ 'sjId' => $sjId,
|
|
|
+ 'mainId' => $mainId,
|
|
|
+ 'deadline' => $deadline,
|
|
|
+ 'staffId' => $staffId,
|
|
|
+ 'staffName' => $staffName,
|
|
|
+ 'flowerNum' => 0,
|
|
|
+ 'fromType' => 1,
|
|
|
+ 'hdId' => $hdId,
|
|
|
+ 'hdName' => $hdName,
|
|
|
+ 'sendType' => 1,
|
|
|
+ 'sendSide' => 2,
|
|
|
+ 'labourCost' => 0,
|
|
|
+ ];
|
|
|
+ //走负数订单,多处调用这个方法,注意同步修改,搜索关键词 createHdNewOrder
|
|
|
+ $returnOrder = OrderService::createHdOrder($orderData, $custom, $hasPay);
|
|
|
+ util::complete();
|
|
|
} else {
|
|
|
//走正常售后
|
|
|
HdRefundService::addRefund($post, $order);
|