|
|
@@ -114,7 +114,7 @@ class OrderClass extends BaseClass
|
|
|
|
|
|
//花材列表
|
|
|
$product = $data['product'];
|
|
|
- $respond = OrderItemClass::replaceItem($orderSn, $product);
|
|
|
+ $respond = OrderItemClass::replaceItem($orderSn, $product, $data);
|
|
|
|
|
|
$sendCost = isset($data['sendCost']) && is_numeric($data['sendCost']) ? $data['sendCost'] : 0;
|
|
|
$data['sendCost'] = $sendCost;
|
|
|
@@ -210,7 +210,7 @@ class OrderClass extends BaseClass
|
|
|
$product = $data['product'];
|
|
|
//删除花材再添加
|
|
|
OrderItemClass::deleteByCondition(['orderSn' => $orderSn]);
|
|
|
- $respond = OrderItemClass::replaceItem($orderSn, $product);
|
|
|
+ $respond = OrderItemClass::replaceItem($orderSn, $product, $data);
|
|
|
|
|
|
$sendCost = isset($data['sendCost']) && is_numeric($data['sendCost']) ? $data['sendCost'] : 0;
|
|
|
$data['sendCost'] = $sendCost;
|
|
|
@@ -427,9 +427,10 @@ class OrderClass extends BaseClass
|
|
|
$totalSmallNum = 0;
|
|
|
$kind = 0;
|
|
|
$itemStat = [];
|
|
|
+ //小菊增加部分
|
|
|
+ $xjAddList = [];
|
|
|
if (!empty($list)) {
|
|
|
foreach ($list as $key => $val) {
|
|
|
- $list[$key]['property'] = $val['rank'] . '级';
|
|
|
$price = $val['price'];
|
|
|
$totalPrice = stringUtil::calcAdd($totalPrice, $price);
|
|
|
$kind++;
|
|
|
@@ -437,7 +438,41 @@ class OrderClass extends BaseClass
|
|
|
$currentSmallNum = $val['smallNum'];
|
|
|
$totalBigNum = stringUtil::calcAdd($totalBigNum, $currentBigNum);
|
|
|
$totalSmallNum = stringUtil::calcAdd($totalSmallNum, $currentSmallNum);
|
|
|
+
|
|
|
+ $list[$key]['property'] = '';
|
|
|
+
|
|
|
+ //小菊
|
|
|
+ if (isset($val['variety']) && $val['variety'] == 1) {
|
|
|
+ unset($list[$key]);
|
|
|
+ $currentItemId = $val['id'] ?? 0;
|
|
|
+ $xjList = OrderXjClass::getAllByCondition(['itemId' => $currentItemId], null, '*');
|
|
|
+ if (!empty($xjList)) {
|
|
|
+ foreach ($xjList as $xjKey => $xj) {
|
|
|
+ $xjBase = $val;
|
|
|
+ $num = $xj['num'] ?? 0;
|
|
|
+ $price = $xj['price'] ?? 0;
|
|
|
+ $name = $xj['name'] ?? '';
|
|
|
+ $cover = $xj['cover'] ?? '';
|
|
|
+ if ($num > 0) {
|
|
|
+ $bigTotalPrice = bcmul($price, $num, 2);
|
|
|
+ $xjBase['cover'] = imgUtil::groupImg($cover) . "?x-oss-process=image/resize,m_fill,h_130,w_130";
|
|
|
+ $xjBase['unitPrice'] = $price;
|
|
|
+ $xjBase['price'] = floatval($bigTotalPrice);
|
|
|
+ $xjBase['num'] = floatval($num);
|
|
|
+ $xjBase['bigNum'] = floatval($num);
|
|
|
+ $xjBase['name'] = $name;
|
|
|
+ $xjBase['property'] = '';
|
|
|
+ $xjBase['userPrice'] = $bigTotalPrice;
|
|
|
+ $xjAddList[] = $xjBase;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+ if (!empty($xjAddList)) {
|
|
|
+ $list = array_merge($list, $xjAddList);
|
|
|
+ }
|
|
|
+
|
|
|
$itemStat = ['kind' => $kind, 'bigNum' => $totalBigNum, 'smallNun' => $totalSmallNum, 'totalPrice' => $totalPrice];
|
|
|
}
|
|
|
return ['list' => $list, 'itemStat' => $itemStat];
|
|
|
@@ -507,6 +542,28 @@ class OrderClass extends BaseClass
|
|
|
return $list;
|
|
|
}
|
|
|
|
|
|
+ public static function printGroup($current, $content)
|
|
|
+ {
|
|
|
+ //58mm的机器,一行打印16个汉字,32个字母
|
|
|
+ $name = $current['name'] ?? '';
|
|
|
+ $content .= $name . '<BR>';
|
|
|
+ $name = str_repeat(' ', 10);
|
|
|
+
|
|
|
+ $productNum = $current['num'] ?? '';
|
|
|
+ $blankNum = bcsub(12, strlen($productNum));
|
|
|
+ if ($blankNum > 0) {
|
|
|
+ $productNum = $productNum . str_repeat(' ', $blankNum);
|
|
|
+ }
|
|
|
+
|
|
|
+ $productPrice = $current['price'] ?? '';
|
|
|
+ $blankNum = bcsub(7, strlen($productPrice));
|
|
|
+ if ($blankNum > 0) {
|
|
|
+ $productPrice = $productPrice . str_repeat(' ', $blankNum);
|
|
|
+ }
|
|
|
+ $content .= $name . " " . $productNum . ' ' . $productPrice . '<BR>';
|
|
|
+ return $content;
|
|
|
+ }
|
|
|
+
|
|
|
//云打印 shish 20210709
|
|
|
public static function onlinePrint($orderInfo)
|
|
|
{
|
|
|
@@ -533,23 +590,9 @@ class OrderClass extends BaseClass
|
|
|
|
|
|
if (isset($respond['product']) && !empty($respond['product'])) {
|
|
|
foreach ($respond['product'] as $current) {
|
|
|
- //58mm的机器,一行打印16个汉字,32个字母
|
|
|
- $name = $current['name'] ?? '';
|
|
|
- $content .= $name . '<BR>';
|
|
|
- $name = str_repeat(' ', 10);
|
|
|
|
|
|
- $productNum = $current['num'] ?? '';
|
|
|
- $blankNum = bcsub(12, strlen($productNum));
|
|
|
- if ($blankNum > 0) {
|
|
|
- $productNum = $productNum . str_repeat(' ', $blankNum);
|
|
|
- }
|
|
|
+ $content = self::printGroup($current, $content);
|
|
|
|
|
|
- $productPrice = $current['price'] ?? '';
|
|
|
- $blankNum = bcsub(7, strlen($productPrice));
|
|
|
- if ($blankNum > 0) {
|
|
|
- $productPrice = $productPrice . str_repeat(' ', $blankNum);
|
|
|
- }
|
|
|
- $content .= $name . " " . $productNum . ' ' . $productPrice . '<BR>';
|
|
|
}
|
|
|
$content .= '--------------------------------<BR>';
|
|
|
}
|
|
|
@@ -641,6 +684,8 @@ class OrderClass extends BaseClass
|
|
|
$bigUnitPrice = $itemVal['unitPrice'] ?? 0;
|
|
|
$smallUnitPrice = $itemVal['smallUnitPrice'] ?? 0;
|
|
|
$smallNum = $itemVal['smallNum'] ?? 0;
|
|
|
+
|
|
|
+
|
|
|
if ($bigNum > 0) {
|
|
|
$bigTotalPrice = bcmul($bigUnitPrice, $bigNum, 2);
|
|
|
$printProduct[] = [
|
|
|
@@ -657,6 +702,8 @@ class OrderClass extends BaseClass
|
|
|
'price' => floatval($smallTotalPrice),
|
|
|
];
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -667,15 +714,15 @@ class OrderClass extends BaseClass
|
|
|
$refund = RefundOrderClass::getByCondition(['relateOrderSn' => $relateOrderSn], true);
|
|
|
if (!empty($refund)) {
|
|
|
$refundOrderSn = $refund->orderSn ?? '';
|
|
|
- $refundProductList = RefundOrderItemClass::getAllByCondition(['orderSn' => $refundOrderSn], null,'*');
|
|
|
+ $refundProductList = RefundOrderItemClass::getAllByCondition(['orderSn' => $refundOrderSn], null, '*');
|
|
|
if (!empty($refundProductList)) {
|
|
|
foreach ($refundProductList as $currentRefund) {
|
|
|
$num = $currentRefund['itemNum'] ?? 0;
|
|
|
$unitPrice = $currentRefund['itemPrice'] ?? 0;
|
|
|
- $currentPrice = bcmul($unitPrice,$num,2);
|
|
|
+ $currentPrice = bcmul($unitPrice, $num, 2);
|
|
|
$refundList[] = [
|
|
|
'name' => $currentRefund['name'] ?? '',
|
|
|
- 'num' => floatval($num).'扎*'.floatval($unitPrice),
|
|
|
+ 'num' => floatval($num) . '扎*' . floatval($unitPrice),
|
|
|
'price' => floatval($currentPrice),
|
|
|
];
|
|
|
}
|