|
|
@@ -114,12 +114,14 @@ class ShopController extends BaseController {
|
|
|
// 'exchange' => 0,
|
|
|
'tourism_points' => 0,
|
|
|
'garage_points' => 0,
|
|
|
+ 'villa_points' => 0,
|
|
|
];
|
|
|
if ($userBonusResult = UserBonus::findOneAsArray(['USER_ID' => $userId])) {
|
|
|
// $userBalance['points'] = $userBonusResult['RECONSUME_POINTS'];
|
|
|
// $userBalance['exchange'] = $userBonusResult['EXCHANGE_POINTS'];
|
|
|
$userBalance['tourism_points'] = $userBonusResult['TOURISM_POINTS'];
|
|
|
$userBalance['garage_points'] = $userBonusResult['GARAGE_POINTS'];
|
|
|
+ $userBalance['villa_points'] = $userBonusResult['VILLA_POINTS'];
|
|
|
}
|
|
|
if ($userCashResult = UserWallet::findOneAsArray(['USER_ID' => $userId])) {
|
|
|
$userBalance['cash'] = $userCashResult['CASH'];
|
|
|
@@ -271,12 +273,23 @@ class ShopController extends BaseController {
|
|
|
return static::notice('');
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @throws HttpException
|
|
|
+ */
|
|
|
+ public function actionDecOrderList() {
|
|
|
+ $version = \Yii::$app->request->get('v');
|
|
|
+
|
|
|
+ $data = $version == 2 ? $this->decOrderListV2() : $this->decOrderListV1();
|
|
|
+
|
|
|
+ return static::notice($data);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 我的报单
|
|
|
* @return mixed
|
|
|
* @throws HttpException
|
|
|
*/
|
|
|
- public function actionDecOrderList() {
|
|
|
+ public function decOrderListV1() {
|
|
|
$condition = ' DO.USER_ID=:USER_ID AND DO.IS_DEL=0';
|
|
|
$params[':USER_ID'] = \Yii::$app->user->id;
|
|
|
|
|
|
@@ -329,6 +342,85 @@ class ShopController extends BaseController {
|
|
|
$value['TOTAL_AMOUNT'] = Tool::formatPrice($value['REAL_PRICE'] * $value['BUY_NUMS']);
|
|
|
}
|
|
|
|
|
|
+ return $data;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 我的报单
|
|
|
+ * @return mixed
|
|
|
+ * @throws HttpException
|
|
|
+ */
|
|
|
+ public function decOrderListV2() {
|
|
|
+ $condition = ' DO.USER_ID=:USER_ID AND DO.IS_DEL=0';
|
|
|
+ $params[':USER_ID'] = \Yii::$app->user->id;
|
|
|
+
|
|
|
+ $orderQuery = DecOrder::find()
|
|
|
+ ->alias('DO')
|
|
|
+ ->where($condition, $params)
|
|
|
+ ->select('DO.DEC_SN,DO.ORDER_SN,DO.CREATED_AT,O.STATUS,O.CONSIGNEE,O.MOBILE,O.PAY_TYPE,O.PAY_AT,O.ADDRESS,O.CITY_NAME,O.LGA_NAME,O.PROVINCE,U.USER_NAME USER_NAME,U.REAL_NAME REAL_NAME,RU.USER_NAME REC_USER_NAME,RU.REAL_NAME REC_REAL_NAME,CU.USER_NAME CON_USER_NAME,CU.REAL_NAME CON_REAL_NAME')
|
|
|
+ ->join('LEFT JOIN', User::tableName() . ' AS U', 'DO.TO_USER_ID=U.ID')
|
|
|
+ ->join('LEFT JOIN', User::tableName() . ' AS RU', 'DO.REC_USER_ID=RU.ID')
|
|
|
+ ->join('LEFT JOIN', User::tableName() . ' AS CU', 'DO.CON_USER_ID=CU.ID')
|
|
|
+ ->join('LEFT JOIN', Order::tableName() . ' AS O', 'O.SN=DO.ORDER_SN')
|
|
|
+ ->orderBy('DO.CREATED_AT DESC');
|
|
|
+
|
|
|
+ // 订单中间表只查询待支付和支付失败的订单
|
|
|
+ $params[':NOT_PAID'] = \Yii::$app->params['orderStatus']['notPaid']['value']; // 待支付
|
|
|
+ $params[':FAIL_PAID'] = \Yii::$app->params['orderStatus']['failPaid']['value']; // 支付失败
|
|
|
+ $orderStandardQuery = ApproachDecOrder::find()
|
|
|
+ ->alias('DO')
|
|
|
+ ->where($condition . ' AND (O.STATUS = :NOT_PAID OR O.STATUS = :FAIL_PAID)', $params)
|
|
|
+ ->select('DO.DEC_SN,DO.ORDER_SN,DO.CREATED_AT,O.STATUS,O.CONSIGNEE,O.MOBILE,O.PAY_TYPE,O.PAY_AT,O.ADDRESS,O.CITY_NAME,O.LGA_NAME,O.PROVINCE,U.USER_NAME USER_NAME,U.REAL_NAME REAL_NAME,RU.USER_NAME REC_USER_NAME,RU.REAL_NAME REC_REAL_NAME,CU.USER_NAME CON_USER_NAME,CU.REAL_NAME CON_REAL_NAME')
|
|
|
+ ->join('LEFT JOIN', User::tableName() . ' AS U', 'DO.TO_USER_ID=U.ID')
|
|
|
+ ->join('LEFT JOIN', User::tableName() . ' AS RU', 'DO.REC_USER_ID=RU.ID')
|
|
|
+ ->join('LEFT JOIN', User::tableName() . ' AS CU', 'DO.CON_USER_ID=CU.ID')
|
|
|
+ ->join('LEFT JOIN', ApproachOrder::tableName() . ' AS O', 'O.SN=DO.ORDER_SN')
|
|
|
+ ->orderBy('DO.CREATED_AT DESC');
|
|
|
+
|
|
|
+ $queryAll = $orderQuery->union($orderStandardQuery, true);
|
|
|
+ $query = (new Query())->from(['Q' => $queryAll])->select('Q.*')->distinct()->orderBy(['CREATED_AT' => SORT_DESC]);
|
|
|
+
|
|
|
+ $totalCount = $query->count();
|
|
|
+ $pagination = new Pagination(['totalCount' => $totalCount, 'pageSize' => \Yii::$app->request->get('pageSize')]);
|
|
|
+ $lists = $query->offset($pagination->offset)->limit($pagination->limit)->all();
|
|
|
+
|
|
|
+ $data = [
|
|
|
+ 'list' => $lists,
|
|
|
+ 'currentPage'=>$pagination->page,
|
|
|
+ 'totalPages'=>$pagination->pageCount,
|
|
|
+ 'startNum' => $pagination->page * $pagination->pageSize + 1,
|
|
|
+ 'totalCount' => $pagination->totalCount,
|
|
|
+ 'pageSize' => $pagination->pageSize,
|
|
|
+ ];
|
|
|
+
|
|
|
+ foreach ($data['list'] as &$value) {
|
|
|
+ if (($value['PAY_TYPE'] == 'pay_stack') && in_array($value['STATUS'], [\Yii::$app->params['orderStatus']['notPaid']['value'], \Yii::$app->params['orderStatus']['failPaid']['value']])) {
|
|
|
+ // 订单中间表
|
|
|
+ $orderGoods = ApproachOrderGoods::findAllAsArray('ORDER_SN=:ORDER_SN', [':ORDER_SN' => $value['ORDER_SN']], 'SKU_CODE,GOODS_TITLE,BUY_NUMS,TAX_RATE,REAL_PV,REAL_PRICE');
|
|
|
+ } else {
|
|
|
+ // 订单表
|
|
|
+ $orderGoods = OrderGoods::findAllAsArray('ORDER_SN=:ORDER_SN', [':ORDER_SN' => $value['ORDER_SN']], 'SKU_CODE,GOODS_TITLE,BUY_NUMS,TAX_RATE,REAL_PV,REAL_PRICE');
|
|
|
+ }
|
|
|
+ $value['hasChildren'] = $orderGoods;
|
|
|
+ $value['PAY_TYPE'] = array_column(ShopGoods::SALE_TYPE, NULL, 'label')[$value['PAY_TYPE']]['name'] ?? '';
|
|
|
+ $value['STATUS'] = \Yii::$app->params['orderStatus'][$value['STATUS']]['label'] ?? '';
|
|
|
+ $value['CREATED_AT'] = $value['CREATED_AT'] ? Date::convert($value['CREATED_AT'],'Y-m-d H:i:s') : '';
|
|
|
+ $value['FULL_ADDRESS'] = trim(implode(', ', [$value['ADDRESS'], $value['CITY_NAME'], $value['LGA_NAME'], Region::getCnName($value['PROVINCE'])]), ', ');
|
|
|
+
|
|
|
+ unset($value['ADDRESS'], $value['CITY_NAME'], $value['LGA_NAME'], $value['PROVINCE']);
|
|
|
+ }
|
|
|
+
|
|
|
+ return $data;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @throws HttpException
|
|
|
+ */
|
|
|
+ public function actionOrderList() {
|
|
|
+ $version = \Yii::$app->request->get('v');
|
|
|
+
|
|
|
+ $data = $version == 2 ? $this->orderListV2() : $this->orderListV1();
|
|
|
+
|
|
|
return static::notice($data);
|
|
|
}
|
|
|
|
|
|
@@ -337,14 +429,14 @@ class ShopController extends BaseController {
|
|
|
* @return mixed
|
|
|
* @throws HttpException
|
|
|
*/
|
|
|
- public function actionOrderList() {
|
|
|
+ public function orderListV1() {
|
|
|
$uname = Info::getUserNameByUserId(\Yii::$app->user->id);
|
|
|
$condition = " (USER_ID=:USER_ID OR CREATE_USER='$uname') AND O.IS_DELETE = 0";
|
|
|
$params[':USER_ID'] = \Yii::$app->user->id;
|
|
|
$orderQuery = Order::find()
|
|
|
->alias('O')
|
|
|
->where($condition, $params)
|
|
|
- ->select('O.*,U.REAL_NAME,SG.CATEGORY_TYPE,OG.REAL_PRICE,OG.TAX_RATE,OG.BUY_NUMS,OG.SKU_CODE,OG.GOODS_TITLE,OG.REAL_PV')
|
|
|
+ ->select('O.*,U.REAL_NAME,SG.CATEGORY_TYPE,OG.REAL_PRICE,OG.TAX_RATE,OG.BUY_NUMS,OG.SKU_CODE,OG.GOODS_TITLE,OG.REAL_PV,SG.COVER')
|
|
|
->join('LEFT JOIN', User::tableName() . ' AS U', 'U.ID=O.USER_ID')
|
|
|
->join('LEFT JOIN', OrderGoods::tableName() . ' AS OG', 'OG.ORDER_SN=O.SN')
|
|
|
->join('LEFT JOIN', ShopGoods::tableName() . ' AS SG', 'SG.ID=OG.GOODS_ID')
|
|
|
@@ -356,7 +448,7 @@ class ShopController extends BaseController {
|
|
|
$orderStandardQuery = ApproachOrder::find()
|
|
|
->alias('O')
|
|
|
->where($condition . ' AND (O.STATUS = :NOT_PAID OR O.STATUS = :FAIL_PAID)', $params)
|
|
|
- ->select('O.*,U.REAL_NAME,SG.CATEGORY_TYPE,OG.REAL_PRICE,OG.TAX_RATE,OG.BUY_NUMS,OG.SKU_CODE,OG.GOODS_TITLE,OG.REAL_PV')
|
|
|
+ ->select('O.*,U.REAL_NAME,SG.CATEGORY_TYPE,OG.REAL_PRICE,OG.TAX_RATE,OG.BUY_NUMS,OG.SKU_CODE,OG.GOODS_TITLE,OG.REAL_PV,SG.COVER')
|
|
|
->join('LEFT JOIN', User::tableName() . ' AS U', 'U.ID=O.USER_ID')
|
|
|
->join('LEFT JOIN', ApproachOrderGoods::tableName() . ' AS OG', 'OG.ORDER_SN=O.SN')
|
|
|
->join('LEFT JOIN', ShopGoods::tableName() . ' AS SG', 'SG.ID=OG.GOODS_ID')
|
|
|
@@ -410,7 +502,68 @@ class ShopController extends BaseController {
|
|
|
$data['list'][$key]['TOTAL_AMOUNT'] = Tool::formatPrice($value['REAL_PRICE'] * $value['BUY_NUMS']);
|
|
|
}
|
|
|
|
|
|
- return static::notice($data);
|
|
|
+ return $data;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 我的订单
|
|
|
+ * @return mixed
|
|
|
+ * @throws HttpException
|
|
|
+ */
|
|
|
+ public function orderListV2() {
|
|
|
+ $uname = Info::getUserNameByUserId(\Yii::$app->user->id);
|
|
|
+ $condition = " (O.USER_ID=:USER_ID OR O.CREATE_USER='{$uname}') AND O.IS_DELETE = 0";
|
|
|
+ $params[':USER_ID'] = \Yii::$app->user->id;
|
|
|
+ $orderQuery = Order::find()
|
|
|
+ ->alias('O')
|
|
|
+ ->where($condition, $params)
|
|
|
+ ->select('O.ID,O.SN,O.USER_NAME,O.ORDER_TYPE,O.ORDER_AMOUNT,O.STATUS,O.CREATED_AT,O.PAY_TYPE,O.PAY_AT,O.CONSIGNEE,O.MOBILE,O.ADDRESS,O.CITY_NAME,O.LGA_NAME,O.PROVINCE,U.REAL_NAME')
|
|
|
+ ->join('LEFT JOIN', User::tableName() . ' AS U', 'U.ID=O.USER_ID');
|
|
|
+
|
|
|
+ // 订单中间表只查询待支付和支付失败的订单
|
|
|
+ $params[':NOT_PAID'] = \Yii::$app->params['orderStatus']['notPaid']['value']; // 待支付
|
|
|
+ $params[':FAIL_PAID'] = \Yii::$app->params['orderStatus']['failPaid']['value']; // 支付失败
|
|
|
+ $orderStandardQuery = ApproachOrder::find()
|
|
|
+ ->alias('O')
|
|
|
+ ->where($condition . ' AND (O.STATUS = :NOT_PAID OR O.STATUS = :FAIL_PAID)', $params)
|
|
|
+ ->select('O.ID,O.SN,O.USER_NAME,O.ORDER_TYPE,O.ORDER_AMOUNT,O.STATUS,O.CREATED_AT,O.PAY_TYPE,O.PAY_AT,O.CONSIGNEE,O.MOBILE,O.ADDRESS,O.CITY_NAME,O.LGA_NAME,O.PROVINCE,U.REAL_NAME')
|
|
|
+ ->join('LEFT JOIN', User::tableName() . ' AS U', 'U.ID=O.USER_ID');
|
|
|
+
|
|
|
+ $queryAll = $orderQuery->union($orderStandardQuery, true);
|
|
|
+ $query = (new Query())->from(['Q' => $queryAll])->select('Q.*')->distinct()->orderBy(['CREATED_AT' => SORT_DESC]);
|
|
|
+
|
|
|
+ $totalCount = $query->count();
|
|
|
+ $pagination = new Pagination(['totalCount' => $totalCount, 'pageSize' => \Yii::$app->request->get('pageSize')]);
|
|
|
+ $lists = $query->offset($pagination->offset)->limit($pagination->limit)->all();
|
|
|
+
|
|
|
+ $data = [
|
|
|
+ 'list' => $lists,
|
|
|
+ 'currentPage'=>$pagination->page,
|
|
|
+ 'totalPages'=>$pagination->pageCount,
|
|
|
+ 'startNum' => $pagination->page * $pagination->pageSize + 1,
|
|
|
+ 'totalCount' => $pagination->totalCount,
|
|
|
+ 'pageSize' => $pagination->pageSize,
|
|
|
+ ];
|
|
|
+
|
|
|
+ foreach ($data['list'] as $key => $value) {
|
|
|
+ if (($value['PAY_TYPE'] == 'pay_stack') && in_array($value['STATUS'], [\Yii::$app->params['orderStatus']['notPaid']['value'], \Yii::$app->params['orderStatus']['failPaid']['value']])) {
|
|
|
+ // 订单中间表
|
|
|
+ $orderGoods = ApproachOrderGoods::findAllAsArray('ORDER_SN=:SN', [':SN' => $value['SN']], 'SKU_CODE,GOODS_TITLE,BUY_NUMS,TAX_RATE,REAL_PV,REAL_PRICE');
|
|
|
+ } else {
|
|
|
+ // 订单表
|
|
|
+ $orderGoods = OrderGoods::findAllAsArray('ORDER_SN=:SN', [':SN' => $value['SN']], 'SKU_CODE,GOODS_TITLE,BUY_NUMS,TAX_RATE,REAL_PV,REAL_PRICE');
|
|
|
+ }
|
|
|
+ $data['list'][$key]['hasChildren'] = $orderGoods;
|
|
|
+ $data['list'][$key]['ORDER_TYPE'] = $value['ORDER_TYPE']=='ZC' ? 'Welcome Pack' : (in_array($value['PAY_TYPE'], ['cash', 'pay_stack']) ? 'Repeat Purchase': 'Points');
|
|
|
+ $data['list'][$key]['PAY_TYPE'] = array_column(ShopGoods::SALE_TYPE, NULL, 'label')[$value['PAY_TYPE']]['name'] ?? '';
|
|
|
+ $data['list'][$key]['STATUS'] = \Yii::$app->params['orderStatus'][$value['STATUS']]['label'] ?? '';
|
|
|
+ $data['list'][$key]['FULL_ADDRESS'] = trim(implode(', ', [$value['ADDRESS'], $value['CITY_NAME'], $value['LGA_NAME'], Region::getCnName($value['PROVINCE'])]), ', ');
|
|
|
+ $data['list'][$key]['SHOW_BV'] = !in_array($value['PAY_TYPE'], [5, 6]);
|
|
|
+
|
|
|
+ unset($data['list'][$key]['ADDRESS'], $data['list'][$key]['CITY_NAME'], $data['list'][$key]['LGA_NAME'], $data['list'][$key]['PROVINCE']);
|
|
|
+ }
|
|
|
+
|
|
|
+ return $data;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -460,11 +613,11 @@ class ShopController extends BaseController {
|
|
|
if (\Yii::$app->request->isPost) {
|
|
|
$formModel = new OrderForm();
|
|
|
$formModel->scenario = 'reconsumeOrder';
|
|
|
- $formModel->remark = '帮会员复销';
|
|
|
+ $formModel->remark = Yii::t('app', 'reconsume');
|
|
|
$post = \Yii::$app->request->post();
|
|
|
$post['type'] = DeclarationForm::TYPE_FX;
|
|
|
if ($formModel->load($post, '') && $formModel->reconsumeAdd()) {
|
|
|
- return static::notice('帮会员复消成功');
|
|
|
+ return static::notice(Yii::t('app', 'reconsumeSuccessfully'));
|
|
|
} else {
|
|
|
return static::notice(Form::formatErrorsForApi($formModel->getErrors()),400);
|
|
|
}
|
|
|
@@ -485,19 +638,19 @@ class ShopController extends BaseController {
|
|
|
// ],
|
|
|
[
|
|
|
'name' => '1',
|
|
|
- 'label' => 'Standard Products',//普通商品列表
|
|
|
+ 'label' => Yii::t('app', 'standardProducts'),
|
|
|
],
|
|
|
// [
|
|
|
// 'name' => '4',
|
|
|
-// 'label' => 'Travel Fund Products',//旅游积分商品
|
|
|
+// 'label' => Yii::t('app', 'travelFundProducts'),
|
|
|
// ],
|
|
|
[
|
|
|
'name' => '5',
|
|
|
- 'label' => 'Car Fund Products',//车奖积分商品
|
|
|
+ 'label' => Yii::t('app', 'carFundProducts'),
|
|
|
],
|
|
|
[
|
|
|
'name' => '6',
|
|
|
- 'label' => 'Villa Fund Products',//房奖积分商品
|
|
|
+ 'label' => Yii::t('app', 'villaFundProducts'),
|
|
|
],
|
|
|
];
|
|
|
return static::notice($data);
|
|
|
@@ -563,7 +716,7 @@ class ShopController extends BaseController {
|
|
|
$userName = $value['REAL_NAME'];
|
|
|
$address = $provinceName . $cityName . $countyName . $value['ADDRESS'];
|
|
|
$mobile = $value['MOBILE'];
|
|
|
- $orderAt = Date::convert($value['PAY_AT'],'Y-m-d H:i:s');
|
|
|
+ $orderAt = Date::convert($value['CREATED_AT'],'Y-m-d H:i:s');
|
|
|
|
|
|
// 总价
|
|
|
$totalAmount = $value['BUY_NUMS'] * $value['REAL_PRICE'];
|
|
|
@@ -578,46 +731,64 @@ class ShopController extends BaseController {
|
|
|
// 订单详情
|
|
|
$orderDetails .= <<<EOT
|
|
|
<tr>
|
|
|
- <td>{$value['SKU_CODE']}</td>
|
|
|
- <td>{$value['GOODS_TITLE']}</td>
|
|
|
+ <td style="text-align: center;">{$value['SKU_CODE']}</td>
|
|
|
+ <td style="text-align: center;">{$value['GOODS_TITLE']}</td>
|
|
|
<td style="text-align: right;">{$productAmount}</td>
|
|
|
- <td>{$value['BUY_NUMS']}</td>
|
|
|
- <td style="text-align: right;">{$value['TAX_RATE']}</td>
|
|
|
+ <td style="text-align: right;">{$value['BUY_NUMS']}</td>
|
|
|
+ <td style="text-align: right;">{$value['TAX_RATE']}%</td>
|
|
|
<td style="text-align: right;">{$taxAmount}</td>
|
|
|
<td style="text-align: right;">{$totalAmount}</td>
|
|
|
</tr>
|
|
|
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>
|
|
|
@@ -636,14 +807,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 {*/
|
|
|
@@ -656,25 +827,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>
|
|
|
@@ -686,11 +857,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>
|
|
|
@@ -810,7 +981,7 @@ ORDER;
|
|
|
$userName = $value['REAL_NAME'];
|
|
|
$address = $provinceName . $cityName . $countyName . $value['ADDRESS'];
|
|
|
$mobile = $value['MOBILE'];
|
|
|
- $orderAt = Date::convert($value['PAY_AT'] ?? $value['CREATED_AT'],'Y-m-d H:i:s');
|
|
|
+ $orderAt = Date::convert($value['CREATED_AT'],'Y-m-d H:i:s');
|
|
|
|
|
|
// 总价
|
|
|
$totalAmount = $value['BUY_NUMS'] * $value['REAL_PRICE'];
|
|
|
@@ -824,46 +995,64 @@ ORDER;
|
|
|
// 订单详情
|
|
|
$orderDetails .= <<<EOT
|
|
|
<tr>
|
|
|
- <td>{$value['SKU_CODE']}</td>
|
|
|
- <td>{$value['GOODS_TITLE']}</td>
|
|
|
+ <td style="text-align: center;">{$value['SKU_CODE']}</td>
|
|
|
+ <td style="text-align: center;">{$value['GOODS_TITLE']}</td>
|
|
|
<td style="text-align: right;">{$value['REAL_PRICE']}</td>
|
|
|
- <td>{$value['BUY_NUMS']}</td>
|
|
|
- <td style="text-align: right;">{$value['TAX_RATE']}</td>
|
|
|
+ <td style="text-align: right;">{$value['BUY_NUMS']}</td>
|
|
|
+ <td style="text-align: right;">{$value['TAX_RATE']}%</td>
|
|
|
<td style="text-align: right;">{$taxAmount}</td>
|
|
|
<td style="text-align: right;">{$totalAmount}</td>
|
|
|
</tr>
|
|
|
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>
|
|
|
@@ -882,14 +1071,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 {*/
|
|
|
@@ -902,28 +1091,28 @@ 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 20px; text-align: center;">
|
|
|
+ <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>{$totalTaxAmount}</td>
|
|
|
- <td>{$orderAmount}</td>
|
|
|
+ <td style="text-align: right;">{$totalTaxAmount}</td>
|
|
|
+ <td style="text-align: right;">{$orderAmount}</td>
|
|
|
</tr>
|
|
|
</table>
|
|
|
</div>
|
|
|
@@ -932,11 +1121,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>
|
|
|
@@ -1071,7 +1260,7 @@ ORDER;
|
|
|
if (\Yii::$app->request->isPost) {
|
|
|
$formModel = new BaApproachOrderForm();
|
|
|
$formModel->scenario = 'userOrder';
|
|
|
- $formModel->remark = '复销备注';
|
|
|
+ $formModel->remark = Yii::t('app', 'reconsumeRemark');
|
|
|
$post = \Yii::$app->request->post();
|
|
|
$post['type'] = DeclarationForm::TYPE_FX;
|
|
|
if ($formModel->load($post, '') && $order = $formModel->add()) {
|
|
|
@@ -1161,12 +1350,23 @@ ORDER;
|
|
|
return static::notice($data);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @throws HttpException
|
|
|
+ */
|
|
|
+ public function actionBaDecOrderList() {
|
|
|
+ $version = \Yii::$app->request->get('v');
|
|
|
+
|
|
|
+ $data = $version == 2 ? $this->baDecOrderListV2() : $this->baDecOrderListV1();
|
|
|
+
|
|
|
+ return static::notice($data);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 我的BA报单
|
|
|
* @return mixed
|
|
|
* @throws HttpException
|
|
|
*/
|
|
|
- public function actionBaDecOrderList() {
|
|
|
+ public function baDecOrderListV1() {
|
|
|
$condition = ' DO.USER_ID=:USER_ID AND DO.IS_DEL=0';
|
|
|
$params[':USER_ID'] = \Yii::$app->user->id;
|
|
|
|
|
|
@@ -1219,7 +1419,75 @@ ORDER;
|
|
|
$value['TOTAL_AMOUNT'] = Tool::formatPrice($value['REAL_PRICE'] * $value['BUY_NUMS']);
|
|
|
}
|
|
|
|
|
|
- return static::notice($data);
|
|
|
+ return $data;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 我的BA报单
|
|
|
+ * @return mixed
|
|
|
+ * @throws HttpException
|
|
|
+ */
|
|
|
+ public function baDecOrderListV2() {
|
|
|
+ $condition = ' DO.USER_ID=:USER_ID AND DO.IS_DEL=0';
|
|
|
+ $params[':USER_ID'] = \Yii::$app->user->id;
|
|
|
+
|
|
|
+ $orderQuery = BaDecOrder::find()
|
|
|
+ ->alias('DO')
|
|
|
+ ->where($condition, $params)
|
|
|
+ ->select('DO.DEC_SN,DO.ORDER_SN,DO.CREATED_AT,O.STATUS,O.CONSIGNEE,O.MOBILE,O.PAY_TYPE,O.PAY_AT,O.ADDRESS,O.CITY_NAME,O.LGA_NAME,O.PROVINCE,U.USER_NAME USER_NAME,U.REAL_NAME REAL_NAME,RU.USER_NAME REC_USER_NAME,RU.REAL_NAME REC_REAL_NAME,CU.USER_NAME CON_USER_NAME,CU.REAL_NAME CON_REAL_NAME')
|
|
|
+ ->join('LEFT JOIN', BaUser::tableName() . ' AS U', 'DO.TO_USER_ID=U.ID')
|
|
|
+ ->join('LEFT JOIN', User::tableName() . ' AS RU', 'DO.REC_USER_ID=RU.ID')
|
|
|
+ ->join('LEFT JOIN', User::tableName() . ' AS CU', 'DO.CON_USER_ID=CU.ID')
|
|
|
+ ->join('LEFT JOIN', BaOrder::tableName() . ' AS O', 'O.SN=DO.ORDER_SN')
|
|
|
+ ->orderBy('DO.CREATED_AT DESC');
|
|
|
+
|
|
|
+ // 订单中间表只查询待支付和支付失败的订单
|
|
|
+ $params[':NOT_PAID'] = \Yii::$app->params['orderStatus']['notPaid']['value']; // 待支付
|
|
|
+ $params[':FAIL_PAID'] = \Yii::$app->params['orderStatus']['failPaid']['value']; // 支付失败
|
|
|
+ $orderStandardQuery = BaApproachDecOrder::find()
|
|
|
+ ->alias('DO')
|
|
|
+ ->where($condition . ' AND (O.STATUS = :NOT_PAID OR O.STATUS = :FAIL_PAID)', $params)
|
|
|
+ ->select('DO.DEC_SN,DO.ORDER_SN,DO.CREATED_AT,O.STATUS,O.CONSIGNEE,O.MOBILE,O.PAY_TYPE,O.PAY_AT,O.ADDRESS,O.CITY_NAME,O.LGA_NAME,O.PROVINCE,U.USER_NAME USER_NAME,U.REAL_NAME REAL_NAME,RU.USER_NAME REC_USER_NAME,RU.REAL_NAME REC_REAL_NAME,CU.USER_NAME CON_USER_NAME,CU.REAL_NAME CON_REAL_NAME')
|
|
|
+ ->join('LEFT JOIN', BaUser::tableName() . ' AS U', 'DO.TO_USER_ID=U.ID')
|
|
|
+ ->join('LEFT JOIN', User::tableName() . ' AS RU', 'DO.REC_USER_ID=RU.ID')
|
|
|
+ ->join('LEFT JOIN', User::tableName() . ' AS CU', 'DO.CON_USER_ID=CU.ID')
|
|
|
+ ->join('LEFT JOIN', BaApproachOrder::tableName() . ' AS O', 'O.SN=DO.ORDER_SN')
|
|
|
+ ->orderBy('DO.CREATED_AT DESC');
|
|
|
+
|
|
|
+ $queryAll = $orderQuery->union($orderStandardQuery, true);
|
|
|
+ $query = (new Query())->from(['Q' => $queryAll])->select('Q.*')->distinct()->orderBy(['CREATED_AT' => SORT_DESC]);
|
|
|
+
|
|
|
+ $totalCount = $query->count();
|
|
|
+ $pagination = new Pagination(['totalCount' => $totalCount, 'pageSize' => \Yii::$app->request->get('pageSize')]);
|
|
|
+ $lists = $query->offset($pagination->offset)->limit($pagination->limit)->all();
|
|
|
+
|
|
|
+ $data = [
|
|
|
+ 'list' => $lists,
|
|
|
+ 'currentPage'=>$pagination->page,
|
|
|
+ 'totalPages'=>$pagination->pageCount,
|
|
|
+ 'startNum' => $pagination->page * $pagination->pageSize + 1,
|
|
|
+ 'totalCount' => $pagination->totalCount,
|
|
|
+ 'pageSize' => $pagination->pageSize,
|
|
|
+ ];
|
|
|
+
|
|
|
+ foreach ($data['list'] as &$value) {
|
|
|
+ if (($value['PAY_TYPE'] == 'pay_stack') && in_array($value['STATUS'], [\Yii::$app->params['orderStatus']['notPaid']['value'], \Yii::$app->params['orderStatus']['failPaid']['value']])) {
|
|
|
+ // 订单中间表
|
|
|
+ $orderGoods = BaApproachOrderGoods::findAllAsArray('ORDER_SN=:ORDER_SN', [':ORDER_SN' => $value['ORDER_SN']], 'SKU_CODE,GOODS_TITLE,BUY_NUMS,TAX_RATE,REAL_PV,REAL_PRICE');
|
|
|
+ } else {
|
|
|
+ // 订单表
|
|
|
+ $orderGoods = BaOrderGoods::findAllAsArray('ORDER_SN=:ORDER_SN', [':ORDER_SN' => $value['ORDER_SN']], 'SKU_CODE,GOODS_TITLE,BUY_NUMS,TAX_RATE,REAL_PV,REAL_PRICE');
|
|
|
+ }
|
|
|
+ $value['hasChildren'] = $orderGoods;
|
|
|
+ $value['STATUS'] = \Yii::$app->params['orderStatus'][$value['STATUS']]['label'] ?? '';
|
|
|
+ $value['CREATED_AT'] = $value['CREATED_AT'] ? Date::convert($value['CREATED_AT'],'Y-m-d H:i:s') : '';
|
|
|
+ $value['PAY_TYPE'] = array_column(ShopGoods::SALE_TYPE, NULL, 'label')[$value['PAY_TYPE']]['name'] ?? '';
|
|
|
+ $value['FULL_ADDRESS'] = trim(implode(', ', [$value['ADDRESS'], $value['CITY_NAME'], $value['LGA_NAME'], Region::getCnName($value['PROVINCE'])]), ', ');
|
|
|
+
|
|
|
+ unset($value['ADDRESS'], $value['CITY_NAME'], $value['LGA_NAME'], $value['PROVINCE']);
|
|
|
+ }
|
|
|
+
|
|
|
+ return $data;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -1297,46 +1565,64 @@ ORDER;
|
|
|
// 订单详情
|
|
|
$orderDetails .= <<<EOT
|
|
|
<tr>
|
|
|
- <td>{$value['SKU_CODE']}</td>
|
|
|
- <td>{$value['GOODS_TITLE']}</td>
|
|
|
+ <td style="text-align: center;">{$value['SKU_CODE']}</td>
|
|
|
+ <td style="text-align: center;">{$value['GOODS_TITLE']}</td>
|
|
|
<td style="text-align: right;">{$value['REAL_PRICE']}</td>
|
|
|
- <td>{$value['BUY_NUMS']}</td>
|
|
|
- <td style="text-align: right;">{$value['TAX_RATE']}</td>
|
|
|
+ <td style="text-align: right;">{$value['BUY_NUMS']}</td>
|
|
|
+ <td style="text-align: right;">{$value['TAX_RATE']}%</td>
|
|
|
<td style="text-align: right;">{$taxAmount}</td>
|
|
|
<td style="text-align: right;">{$totalAmount}</td>
|
|
|
</tr>
|
|
|
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>
|
|
|
@@ -1355,14 +1641,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 {*/
|
|
|
@@ -1375,28 +1661,28 @@ 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 20px; text-align: center;">
|
|
|
+ <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="8%" 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="12%" 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>{$totalTaxAmount}</td>
|
|
|
- <td>{$orderAmount}</td>
|
|
|
+ <td style="text-align: right;">{$totalTaxAmount}</td>
|
|
|
+ <td style="text-align: right;">{$orderAmount}</td>
|
|
|
</tr>
|
|
|
</table>
|
|
|
</div>
|
|
|
@@ -1405,11 +1691,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>
|