|
|
@@ -23,9 +23,11 @@ use common\components\dict;
|
|
|
use common\components\httpUtil;
|
|
|
use common\components\imgUtil;
|
|
|
use common\components\orderSn;
|
|
|
+use common\components\printUtil;
|
|
|
use common\components\stringUtil;
|
|
|
use common\components\util;
|
|
|
use bizGhs\base\classes\BaseClass;
|
|
|
+use Yii;
|
|
|
|
|
|
class OrderClass extends BaseClass
|
|
|
{
|
|
|
@@ -163,7 +165,7 @@ class OrderClass extends BaseClass
|
|
|
//减库存
|
|
|
$cgStyle = $data['cgStyle'] ?? 1;
|
|
|
|
|
|
- $checkStock = $cgStyle == dict::getDict('cgStyle','hd') ? true : false;
|
|
|
+ $checkStock = $cgStyle == dict::getDict('cgStyle', 'hd') ? true : false;
|
|
|
$stockInfo = ProductClass::decreaseStock($val['productId'], $val['bigNum'], $val['smallNum'], $checkStock);
|
|
|
//记录库存流水
|
|
|
$recordData = [];
|
|
|
@@ -413,6 +415,62 @@ class OrderClass extends BaseClass
|
|
|
return $list;
|
|
|
}
|
|
|
|
|
|
+ //云打印 shish 20210709
|
|
|
+ public static function onlinePrint($orderInfo, $debtAmount, $showItem)
|
|
|
+ {
|
|
|
+ $respond = self::getPrintData($orderInfo, $debtAmount, $showItem);
|
|
|
+ $content = '<B>' . $respond['sendNum'] . '</B><BR>';
|
|
|
+ $content .= '--------------------------------<BR>';
|
|
|
+ $content .= '<B>' . $respond['custom']['fullAddress'] . '</B><BR>';
|
|
|
+ $content .= '<B>' . $respond['custom']['customName'] . '</B><BR>';
|
|
|
+ $content .= '<B>' . $respond['custom']['customMobile'] . '</B><BR>';
|
|
|
+ if (isset($respond['remark']) && !empty($respond['remark'])) {
|
|
|
+ $content .= '备注:<BR>';
|
|
|
+ $content .= '<CB>' . $respond['remark'] . '</CB><BR>';
|
|
|
+ }
|
|
|
+ //--------------------------------------
|
|
|
+
|
|
|
+ $content .= '花材 数量 金额<BR>';
|
|
|
+ $content .= '--------------------------------<BR>';
|
|
|
+
|
|
|
+// $content .= '饭 10.0 10 100.0<BR>';
|
|
|
+// $content .= '炒饭 10.0 10 100.0<BR>';
|
|
|
+// $content .= '蛋炒饭 10.0 10 100.0<BR>';
|
|
|
+// $content .= '鸡蛋炒饭 10.0 10 100.0<BR>';
|
|
|
+// $content .= '西红柿炒饭 10.0 10 100.0<BR>';
|
|
|
+// $content .= '西红柿蛋炒饭 10.0 10 100.0<BR>';
|
|
|
+// $content .= '西红柿鸡蛋炒饭 10.0 10 100.0<BR>';
|
|
|
+
|
|
|
+ if (isset($respond['product']) && !empty($respond['product'])) {
|
|
|
+ foreach ($respond['product'] as $current) {
|
|
|
+ $content .= $current['name'] . " " . $current['num'] . ' ' . $current['price'] . '<BR>';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $content .= '--------------------------------<BR>';
|
|
|
+ $content .= '总金额:' . $respond['prePrice'] . '<BR>';
|
|
|
+ $content .= '应付金额:' . $respond['realPrice'] . '<BR>';
|
|
|
+ if (isset($respond['debt']) && $respond['debt'] == 1) {
|
|
|
+ $content .= '实付金额:0.00<BR>';
|
|
|
+ } else {
|
|
|
+ $content .= '实付金额:' . $respond['realPrice'] . '<BR>';
|
|
|
+ }
|
|
|
+ if (isset($respond['discountAmount']) && $respond['discountAmount'] > 0) {
|
|
|
+ $content .= '累计欠款:' . $respond['discountAmount'] . '<BR>';
|
|
|
+ }
|
|
|
+ $i = self::getById($orderInfo['id']);
|
|
|
+ $content .= '--------------------------------<BR>';
|
|
|
+ $content .= '订单日期:' . $i['addTime'] . '<BR>';
|
|
|
+ $content .= '订单编号:' . $respond['orderSn'] . '<BR>';
|
|
|
+ $content .= '门店名称:纯彩花艺<BR>';
|
|
|
+ $content .= '门店地址:' . $respond['address'] . '<BR>';
|
|
|
+ $content .= "<BR>";
|
|
|
+ $content .= "<C>扫码下单</C><BR>";
|
|
|
+ $url = Yii::$app->params['ghsDomain'] . '/#/pagesPurchase/ghsProduct';
|
|
|
+ $content .= '<QR>' . $url . '</QR>';//把二维码字符串用标签套上即可自动生成二维码
|
|
|
+ $p = new printUtil('530501507');
|
|
|
+ $p->printMsg($content);
|
|
|
+ }
|
|
|
+
|
|
|
//打印数据 shish 20210702
|
|
|
public static function getPrintData($val, $debtAmount, $showItem)
|
|
|
{
|