|
|
@@ -50,6 +50,7 @@ use common\models\ShopGoods;
|
|
|
use common\models\ShopGoodsNature;
|
|
|
use common\models\User;
|
|
|
use common\models\UserInfo;
|
|
|
+use common\helpers\Tool;
|
|
|
use Yii;
|
|
|
use yii\web\HttpException;
|
|
|
use yii\web\UploadedFile;
|
|
|
@@ -833,6 +834,16 @@ class ShopController extends BaseController {
|
|
|
$filter['condition'] = ' O.IS_DELETE=0 AND O.SN=:SN';
|
|
|
$filter['params'] = [':SN' => $orderSn];
|
|
|
|
|
|
+ // 生成发票编号
|
|
|
+ $order = Order::find()->where(['SN' => $orderSn])->asArray()->one();
|
|
|
+ if (!$order) {
|
|
|
+ return static::notice('订单不存在', 400);
|
|
|
+ }
|
|
|
+ if (!$order['INVOICE_NO']) {
|
|
|
+ $invoiceNo = Tool::generateInvoiceNo();
|
|
|
+ Order::updateAll(['INVOICE_NO' => $invoiceNo], 'SN = :SN', [':SN' => $orderSn]);
|
|
|
+ }
|
|
|
+
|
|
|
$form = new ShopExportForm();
|
|
|
$result = $form->run($filter, \Yii::t('ctx', 'actionOrderInvoiceExport'));
|
|
|
if (!$result) {
|