empty($value['specGroup']) ? '' : implode('+',array_column($value['specGroup'],'specValueName')), 'unitName' => isset($value['unitName']) ? $value['unitName'] : '', 'unitPrice' => isset($value['price']) ? $value['price'] : 0.00, 'num' => isset($value['buyNum']) ? $value['buyNum'] : 0, 'amountPrice' => isset($value['totalMoney']) ? $value['totalMoney'] : 0 ]; } $printData = [ 'title' => '销售单', 'codeName' => '单号', 'code' => $data['no'], 'createTime' => $data['createTime'], 'shopName' => $data['shopName'], 'userName' => $data['customerName'], 'mobile' => $data['receiveData']['mobile'], 'preferential' => $data['preferential'], //优惠金额 'totalMoney' => $data['totalMoney'], 'payAmount' => $data['payAmount'], 'details' => $goods, 'address' => $data['receiveData']['address'] ]; return parent::formatMsg($printData); } /** * 订单 * @param array $data * @return string */ private function orderPattern(array $data) { $goods = []; $goodsDetails = $data['goodsData']; foreach($goodsDetails as $value){ $goods[$value['goodsId']]['title'] = $value['goodsName']; $goods[$value['goodsId']]['skuData'][] = [ 'skuName' => empty($value['specGroup']) ? '' : implode('+',array_column($value['specGroup'],'specValueName')), 'unitName' => isset($value['unitName']) ? $value['unitName'] : '', 'unitPrice' => isset($value['price']) ? $value['price'] : 0.00, 'num' => isset($value['buyNum']) ? $value['buyNum'] : 0, 'amountPrice' => isset($value['totalMoney']) ? $value['totalMoney'] : 0 ]; } $printData = [ 'title' => '订单', 'codeName' => '单号', 'createTime' => $data['createTime'], 'shopName' => $data['shopName'], 'code' => $data['no'], 'userName' => $data['customerName'], 'mobile' => $data['receiveData']['mobile'], 'preferential' => $data['preferential'], //优惠金额 'totalMoney' => $data['totalMoney'], 'payAmount' => $data['payAmount'], 'details' => $goods, 'address' => $data['receiveData']['address'] ]; return parent::formatMsg($printData); } }