|
@@ -4,6 +4,7 @@ namespace bizGhs\order\classes;
|
|
|
|
|
|
|
|
use bizGhs\item\classes\ItemClassClass;
|
|
use bizGhs\item\classes\ItemClassClass;
|
|
|
use bizHd\purchase\classes\PurchaseItemClass;
|
|
use bizHd\purchase\classes\PurchaseItemClass;
|
|
|
|
|
+use common\components\arrayUtil;
|
|
|
use wkhtmltox\Image\Converter;
|
|
use wkhtmltox\Image\Converter;
|
|
|
use biz\shop\classes\ShopAdminClass;
|
|
use biz\shop\classes\ShopAdminClass;
|
|
|
use biz\shop\classes\ShopCapitalClass;
|
|
use biz\shop\classes\ShopCapitalClass;
|
|
@@ -123,6 +124,74 @@ class OrderClass extends BaseClass
|
|
|
self::REFUND_YES => '有退款',
|
|
self::REFUND_YES => '有退款',
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
|
|
+ public static function printMyWlList($shop, $beginTime, $endTime)
|
|
|
|
|
+ {
|
|
|
|
|
+ $end = strtotime($endTime);
|
|
|
|
|
+ $begin = strtotime($beginTime);
|
|
|
|
|
+ $different = $end - $begin;
|
|
|
|
|
+ if ($different > 172800) {
|
|
|
|
|
+ util::fail('最多可打印2天订单');
|
|
|
|
|
+ }
|
|
|
|
|
+ $mainId = $shop->mainId;
|
|
|
|
|
+ $orderList = OrderClass::getAllByCondition(['mainId' => $mainId, 'payTime' => ['between', [$beginTime, $endTime]], 'payStatus' => 1], 'id asc', '*', null, true);
|
|
|
|
|
+ if (empty($orderList)) {
|
|
|
|
|
+ util::fail('没有订单需要打印');
|
|
|
|
|
+ }
|
|
|
|
|
+ $ids = [];
|
|
|
|
|
+ foreach ($orderList as $order) {
|
|
|
|
|
+ $customId = $order->customId;
|
|
|
|
|
+ $ids[] = $customId;
|
|
|
|
|
+ }
|
|
|
|
|
+ $ids = array_unique(array_filter($ids));
|
|
|
|
|
+ $customList = CustomClass::getAllByCondition(['id' => ['in', $ids]], null, 'id,mainId,shortName,mobile,wlName', 'id');
|
|
|
|
|
+ $myList = [];
|
|
|
|
|
+ foreach ($orderList as $order) {
|
|
|
|
|
+ $customId = $order->customId;
|
|
|
|
|
+ $custom = $customList[$customId] ?? [];
|
|
|
|
|
+ $sendNum = $order->sendNum;
|
|
|
|
|
+ $customMobile = $order->customMobile;
|
|
|
|
|
+ $shortName = $custom['shortName'] ?? '';
|
|
|
|
|
+ $wlName = $custom['wlName'] ?? '';
|
|
|
|
|
+ $myList[] = ['sendNum' => $sendNum, 'customMobile' => $customMobile, 'shortName' => $shortName, 'wlName' => $wlName];
|
|
|
|
|
+ }
|
|
|
|
|
+ $myList = arrayUtil::arraySort($myList,'customMobile');
|
|
|
|
|
+
|
|
|
|
|
+ $size = 50;
|
|
|
|
|
+ $arr = array_chunk($myList, $size);
|
|
|
|
|
+ $totalPage = count($arr);
|
|
|
|
|
+ foreach ($arr as $key => $sonList) {
|
|
|
|
|
+ $content = '';
|
|
|
|
|
+ if ($totalPage > 1) {
|
|
|
|
|
+ $currentPage = bcadd($key, 1);
|
|
|
|
|
+ $content .= "<CB>第{$currentPage}页,共{$totalPage}页</CB><BR>";
|
|
|
|
|
+ }
|
|
|
|
|
+ $content .= '<BR>';
|
|
|
|
|
+ $content .= '--------------------------------<BR>';
|
|
|
|
|
+ if (!empty($sonList)) {
|
|
|
|
|
+ foreach ($sonList as $info) {
|
|
|
|
|
+ $sendNum = $info['sendNum'];
|
|
|
|
|
+ $customMobile = $info['customMobile'];
|
|
|
|
|
+ $shortName = $info['shortName'];
|
|
|
|
|
+ $wlName = $info['wlName'];
|
|
|
|
|
+ $content .= '<B>' . $sendNum . ' ' . $shortName . '</B><BR>';
|
|
|
|
|
+ $content .= '<BR>';
|
|
|
|
|
+ $content .= '<B>' . $customMobile . ' ' . $wlName . '</B><BR>';
|
|
|
|
|
+ $content .= '--------------------------------<BR>';
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ $content .= '<BR>';
|
|
|
|
|
+ $shopId = $shop->id;
|
|
|
|
|
+ $ext = ShopExtClass::getByCondition(['shopId' => $shopId]);
|
|
|
|
|
+ $printSn = $ext['printSn'] ?? '';
|
|
|
|
|
+ if (empty($printSn)) {
|
|
|
|
|
+ util::fail('没有设置打印机');
|
|
|
|
|
+ }
|
|
|
|
|
+ $p = new printUtil($printSn);
|
|
|
|
|
+ $p->printMsg($content, $shop);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public static function exportOrderData($respond, $mainId)
|
|
public static function exportOrderData($respond, $mainId)
|
|
|
{
|
|
{
|
|
|
$orderList = $respond['list'] ?? [];
|
|
$orderList = $respond['list'] ?? [];
|