|
|
@@ -190,6 +190,11 @@ class BaseExport extends Component {
|
|
|
*/
|
|
|
public function getParams() {
|
|
|
$this->params = CacheHelper::getAsyncParams($this->taskId);
|
|
|
+
|
|
|
+ // 设置语言
|
|
|
+ Yii::$app->language = $this->params['language'] ?? 'en-US';
|
|
|
+ Yii::$app->sourceLanguage = Yii::$app->language == 'zh-CN' ? 'en-US' : 'zh-CN';
|
|
|
+
|
|
|
return $this->params;
|
|
|
}
|
|
|
|
|
|
@@ -512,6 +517,7 @@ class BaseExport extends Component {
|
|
|
$extend = array_merge($extend, [
|
|
|
'exportId' => $export->ID,
|
|
|
'userId' => $params['userId'],
|
|
|
+ 'language' => Yii::$app->language,
|
|
|
]);
|
|
|
// 异步处理添加任务
|
|
|
$taskKey = \Yii::$app->swooleAsyncTimer->asyncHandle($params['action'], $extend);
|
|
|
@@ -661,35 +667,53 @@ class BaseExport extends Component {
|
|
|
EOT;
|
|
|
}
|
|
|
|
|
|
+ $memberCode = Yii::t('ctx', 'memberCode');
|
|
|
+ $memberName = Yii::t('ctx', 'memberName');
|
|
|
+ $memberAddress = Yii::t('ctx', 'memberAddress');
|
|
|
+ $memberPhone = Yii::t('ctx', 'memberPhone');
|
|
|
+ $orderCode = Yii::t('ctx', 'orderCode');
|
|
|
+ $orderDetail = Yii::t('ctx', 'orderDetail');
|
|
|
+ $productCode = Yii::t('ctx', 'productCode');
|
|
|
+ $productName = Yii::t('ctx', 'productName');
|
|
|
+ $productPrice = Yii::t('ctx', 'productPrice');
|
|
|
+ $quantity = Yii::t('ctx', 'qty');
|
|
|
+ $taxRate = Yii::t('ctx', 'taxRate');
|
|
|
+ $totalTax = Yii::t('ctx', 'totalTax');
|
|
|
+ $totalAmount = Yii::t('ctx', 'totalAmount');
|
|
|
+ $total = Yii::t('ctx', 'total');
|
|
|
+ $signature = Yii::t('ctx', 'signature');
|
|
|
+ $date = Yii::t('ctx', 'date');
|
|
|
+ $createAt = Yii::t('ctx', 'createAt');
|
|
|
+
|
|
|
// 订单基本信息
|
|
|
$orderBase = <<<ORDER
|
|
|
<table border="1" style="table-layout: fixed; padding: 10px 20px;" width="100%">
|
|
|
<tr>
|
|
|
- <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">Member Code</td>
|
|
|
+ <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">{$memberCode}</td>
|
|
|
<td width="70%">{$userId}</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
- <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">Member Name</td>
|
|
|
+ <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">{$memberName}</td>
|
|
|
<td width="70%">{$userName}</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
- <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">Member Address</td>
|
|
|
+ <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">{$memberAddress}</td>
|
|
|
<td width="70%">{$address}</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
- <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">Member Phone</td>
|
|
|
+ <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">{$memberPhone}</td>
|
|
|
<td width="70%">{$mobile}</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
- <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">Order Code</td>
|
|
|
+ <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">{$orderCode}</td>
|
|
|
<td width="70%">{$orderSn}</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
- <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">Creation Time</td>
|
|
|
+ <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">{$createAt}</td>
|
|
|
<td width="70%">{$orderAt}</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
- <td class="bg" style="font-weight: bold; font-size: 14px; text-align: center;">Order Detail</td>
|
|
|
+ <td class="bg" style="font-weight: bold; font-size: 14px; text-align: center;">{$orderDetail}</td>
|
|
|
<td class="bg"></td>
|
|
|
</tr>
|
|
|
</table>
|
|
|
@@ -708,14 +732,14 @@ ORDER;
|
|
|
<html lang="en">
|
|
|
<head>
|
|
|
<meta charset="UTF-8" />
|
|
|
- <title>Order detail</title>
|
|
|
+ <title>{$orderDetail}</title>
|
|
|
<style>
|
|
|
table {
|
|
|
border-collapse: collapse;
|
|
|
}
|
|
|
table td, table th {
|
|
|
border: 1px solid #ccc;
|
|
|
- padding: 5px 5px;
|
|
|
+ /*padding: 5px 5px;*/
|
|
|
border-collapse: collapse;
|
|
|
}
|
|
|
/*td {*/
|
|
|
@@ -728,25 +752,25 @@ ORDER;
|
|
|
</head>
|
|
|
<body>
|
|
|
<div class="content">
|
|
|
- <p style="text-align: center; font-weight: bold; font-size: 22px;"><b>Order detail</b><br></p>
|
|
|
+ <p style="text-align: center; font-weight: bold; font-size: 22px;"><b>{$orderDetail}</b><br></p>
|
|
|
<div>
|
|
|
<div style="display: block; width: 100%;">
|
|
|
{$orderBase}
|
|
|
|
|
|
<table border="1" width="100%" style="padding: 10px 5px; text-align: center;">
|
|
|
<tr>
|
|
|
- <th width="15%" style="font-size: 14px; font-weight: bold; text-align: center;">Product Code</th>
|
|
|
- <th width="25%" style="font-size: 14px; font-weight: bold; text-align: center;">Product Name</th>
|
|
|
- <th width="15%" style="font-size: 14px; font-weight: bold; text-align: center;">Product Price</th>
|
|
|
- <th width="10%" style="font-size: 14px; font-weight: bold; text-align: center;">Qty</th>
|
|
|
- <th width="10%" style="font-size: 14px; font-weight: bold; text-align: center;">Tax Rate</th>
|
|
|
- <th width="10%" style="font-size: 14px; font-weight: bold; text-align: center;">Tax</th>
|
|
|
- <th width="15%" style="font-size: 14px; font-weight: bold; text-align: center;">Total Amount</th>
|
|
|
+ <th width="15%" style="font-size: 14px; font-weight: bold; text-align: center;">{$productCode}</th>
|
|
|
+ <th width="20%" style="font-size: 14px; font-weight: bold; text-align: center;">{$productName}</th>
|
|
|
+ <th width="15%" style="font-size: 14px; font-weight: bold; text-align: center;">{$productPrice}</th>
|
|
|
+ <th width="10%" style="font-size: 14px; font-weight: bold; text-align: center;">{$quantity}</th>
|
|
|
+ <th width="12%" style="font-size: 14px; font-weight: bold; text-align: center;">{$taxRate}</th>
|
|
|
+ <th width="13%" style="font-size: 14px; font-weight: bold; text-align: center;">{$totalTax}</th>
|
|
|
+ <th width="15%" style="font-size: 14px; font-weight: bold; text-align: center;">{$totalAmount}</th>
|
|
|
</tr>
|
|
|
{$orderDetails}
|
|
|
<tr>
|
|
|
- <td colspan="3">Total</td>
|
|
|
- <td>{$orderNums}</td>
|
|
|
+ <td colspan="3">{$total}</td>
|
|
|
+ <td style="text-align: right;">{$orderNums}</td>
|
|
|
<td></td>
|
|
|
<td style="text-align: right;">{$totalTaxAmount}</td>
|
|
|
<td style="text-align: right;">{$orderAmount}</td>
|
|
|
@@ -758,11 +782,11 @@ ORDER;
|
|
|
<table width="100%" style="border: none; padding: 10px 20px; text-align: center;">
|
|
|
<tr style="border: none;">
|
|
|
<td width="70%" style="border: none;"></td>
|
|
|
- <td width="30%" style="font-weight: bold; text-align: left; font-size: 14px; border: none;">Signature:</td>
|
|
|
+ <td width="30%" style="font-weight: bold; text-align: left; font-size: 14px; border: none;">{$signature}:</td>
|
|
|
</tr>
|
|
|
<tr style="border: none;">
|
|
|
<td width="70%" style="border: none;"></td>
|
|
|
- <td width="30%" style="font-weight: bold; text-align: left; font-size: 14px; border: none;">Date:</td>
|
|
|
+ <td width="30%" style="font-weight: bold; text-align: left; font-size: 14px; border: none;">{$date}:</td>
|
|
|
</tr>
|
|
|
</table>
|
|
|
</div>
|
|
|
@@ -916,35 +940,53 @@ ORDER;
|
|
|
EOT;
|
|
|
}
|
|
|
|
|
|
+ $memberCode = Yii::t('app', 'memberCode');
|
|
|
+ $memberName = Yii::t('app', 'memberName');
|
|
|
+ $memberAddress = Yii::t('app', 'memberAddress');
|
|
|
+ $memberPhone = Yii::t('app', 'memberPhone');
|
|
|
+ $orderCode = Yii::t('app', 'orderCode');
|
|
|
+ $orderDetail = Yii::t('app', 'orderDetail');
|
|
|
+ $productCode = Yii::t('app', 'productCode');
|
|
|
+ $productName = Yii::t('app', 'productName');
|
|
|
+ $productPrice = Yii::t('app', 'productPrice');
|
|
|
+ $quantity = Yii::t('app', 'qty');
|
|
|
+ $taxRate = Yii::t('app', 'taxRate');
|
|
|
+ $totalTax = Yii::t('app', 'totalTax');
|
|
|
+ $totalAmount = Yii::t('app', 'totalAmount');
|
|
|
+ $total = Yii::t('app', 'total');
|
|
|
+ $signature = Yii::t('app', 'signature');
|
|
|
+ $date = Yii::t('app', 'date');
|
|
|
+ $createAt = Yii::t('app', 'createAt');
|
|
|
+
|
|
|
// 订单基本信息
|
|
|
$orderBase = <<<ORDER
|
|
|
<table border="1" style="table-layout: fixed; padding: 10px 20px;" width="100%">
|
|
|
<tr>
|
|
|
- <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">Member Code</td>
|
|
|
+ <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">{$memberCode}</td>
|
|
|
<td width="70%">{$userId}</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
- <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">Member Name</td>
|
|
|
+ <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">{$memberName}</td>
|
|
|
<td width="70%">{$userName}</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
- <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">Member Address</td>
|
|
|
+ <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">{$memberAddress}</td>
|
|
|
<td width="70%">{$address}</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
- <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">Member Phone</td>
|
|
|
+ <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">{$memberPhone}</td>
|
|
|
<td width="70%">{$mobile}</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
- <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">Order Code</td>
|
|
|
+ <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">{$orderCode}</td>
|
|
|
<td width="70%">{$orderSn}</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
- <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">Creation Time</td>
|
|
|
+ <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">{$createAt}</td>
|
|
|
<td width="70%">{$orderAt}</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
- <td class="bg" style="font-weight: bold; font-size: 14px; text-align: center;">Order Detail</td>
|
|
|
+ <td class="bg" style="font-weight: bold; font-size: 14px; text-align: center;">{$orderDetail}</td>
|
|
|
<td class="bg"></td>
|
|
|
</tr>
|
|
|
</table>
|
|
|
@@ -955,22 +997,22 @@ ORDER;
|
|
|
$l['a_meta_language'] = 'zh';
|
|
|
$l['w_page'] = '页面';
|
|
|
|
|
|
- $orderAmount = Tool::formatAmount($orderAmount);
|
|
|
- $totalTaxAmount = Tool::formatAmount($totalTaxAmount);
|
|
|
+ $orderAmount = sprintf('%.2f', $orderAmount);
|
|
|
+ $totalTaxAmount = sprintf('%.2f', $totalTaxAmount);
|
|
|
|
|
|
$context = <<<ORDER
|
|
|
<!doctype html>
|
|
|
<html lang="en">
|
|
|
<head>
|
|
|
<meta charset="UTF-8" />
|
|
|
- <title>Order detail</title>
|
|
|
+ <title>{$orderDetail}</title>
|
|
|
<style>
|
|
|
table {
|
|
|
border-collapse: collapse;
|
|
|
}
|
|
|
table td, table th {
|
|
|
border: 1px solid #ccc;
|
|
|
- padding: 5px 5px;
|
|
|
+ /*padding: 5px 5px;*/
|
|
|
border-collapse: collapse;
|
|
|
}
|
|
|
/*td {*/
|
|
|
@@ -983,25 +1025,25 @@ ORDER;
|
|
|
</head>
|
|
|
<body>
|
|
|
<div class="content">
|
|
|
- <p style="text-align: center; font-weight: bold; font-size: 22px;"><b>Order detail</b><br></p>
|
|
|
+ <p style="text-align: center; font-weight: bold; font-size: 22px;"><b>{$orderDetail}</b><br></p>
|
|
|
<div>
|
|
|
<div style="display: block; width: 100%;">
|
|
|
{$orderBase}
|
|
|
|
|
|
<table border="1" width="100%" style="padding: 10px 5px; text-align: center;">
|
|
|
<tr>
|
|
|
- <th width="15%" style="font-size: 14px; font-weight: bold; text-align: center;">Product Code</th>
|
|
|
- <th width="25%" style="font-size: 14px; font-weight: bold; text-align: center;">Product Name</th>
|
|
|
- <th width="15%" style="font-size: 14px; font-weight: bold; text-align: center;">Product Price</th>
|
|
|
- <th width="10%" style="font-size: 14px; font-weight: bold; text-align: center;">Qty</th>
|
|
|
- <th width="10%" style="font-size: 14px; font-weight: bold; text-align: center;">Tax Rate</th>
|
|
|
- <th width="10%" style="font-size: 14px; font-weight: bold; text-align: center;">Tax</th>
|
|
|
- <th width="15%" style="font-size: 14px; font-weight: bold; text-align: center;">Total Amount</th>
|
|
|
+ <th width="15%" style="font-size: 14px; font-weight: bold; text-align: center;">{$productCode}</th>
|
|
|
+ <th width="20%" style="font-size: 14px; font-weight: bold; text-align: center;">{$productName}</th>
|
|
|
+ <th width="15%" style="font-size: 14px; font-weight: bold; text-align: center;">{$productPrice}</th>
|
|
|
+ <th width="10%" style="font-size: 14px; font-weight: bold; text-align: center;">{$quantity}</th>
|
|
|
+ <th width="12%" style="font-size: 14px; font-weight: bold; text-align: center;">{$taxRate}</th>
|
|
|
+ <th width="13%" style="font-size: 14px; font-weight: bold; text-align: center;">{$totalTax}</th>
|
|
|
+ <th width="15%" style="font-size: 14px; font-weight: bold; text-align: center;">{$totalAmount}</th>
|
|
|
</tr>
|
|
|
{$orderDetails}
|
|
|
<tr>
|
|
|
- <td colspan="3">Total</td>
|
|
|
- <td>{$orderNums}</td>
|
|
|
+ <td colspan="3">{$total}</td>
|
|
|
+ <td style="text-align: right;">{$orderNums}</td>
|
|
|
<td></td>
|
|
|
<td style="text-align: right;">{$totalTaxAmount}</td>
|
|
|
<td style="text-align: right;">{$orderAmount}</td>
|
|
|
@@ -1013,11 +1055,11 @@ ORDER;
|
|
|
<table width="100%" style="border: none; padding: 10px 20px; text-align: center;">
|
|
|
<tr style="border: none;">
|
|
|
<td width="70%" style="border: none;"></td>
|
|
|
- <td width="30%" style="font-weight: bold; text-align: left; font-size: 14px; border: none;">Signature:</td>
|
|
|
+ <td width="30%" style="font-weight: bold; text-align: left; font-size: 14px; border: none;">{$signature}:</td>
|
|
|
</tr>
|
|
|
<tr style="border: none;">
|
|
|
<td width="70%" style="border: none;"></td>
|
|
|
- <td width="30%" style="font-weight: bold; text-align: left; font-size: 14px; border: none;">Date:</td>
|
|
|
+ <td width="30%" style="font-weight: bold; text-align: left; font-size: 14px; border: none;">{$date}:</td>
|
|
|
</tr>
|
|
|
</table>
|
|
|
</div>
|