|
@@ -63,6 +63,8 @@ class ApproachOrderForm extends Model
|
|
|
private $_freight;
|
|
private $_freight;
|
|
|
private $_payAmount;
|
|
private $_payAmount;
|
|
|
private $_orderGoods;
|
|
private $_orderGoods;
|
|
|
|
|
+ private $_standardAmount;
|
|
|
|
|
+ private $_decAmountStandard;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @var ApproachOrder
|
|
* @var ApproachOrder
|
|
@@ -374,7 +376,9 @@ class ApproachOrderForm extends Model
|
|
|
$ids = $this->goodsId;
|
|
$ids = $this->goodsId;
|
|
|
$totalAmount = 0;
|
|
$totalAmount = 0;
|
|
|
$totalPv = 0;
|
|
$totalPv = 0;
|
|
|
|
|
+ $totalAmountStandard = 0;
|
|
|
$goodsType = ShopGoods::GOODS_TYPE;
|
|
$goodsType = ShopGoods::GOODS_TYPE;
|
|
|
|
|
+ $exchangeRate = floatval(Cache::getSystemConfig()['exchangeRate']['VALUE'] ?? 0); // 汇率
|
|
|
foreach ($this->goodsNum as $k => $v) {
|
|
foreach ($this->goodsNum as $k => $v) {
|
|
|
if ($v) {
|
|
if ($v) {
|
|
|
$goods = ShopGoods::findOneAsArray('ID=:ID AND STATUS=1',[':ID'=> $ids[$k]]);
|
|
$goods = ShopGoods::findOneAsArray('ID=:ID AND STATUS=1',[':ID'=> $ids[$k]]);
|
|
@@ -383,13 +387,16 @@ class ApproachOrderForm extends Model
|
|
|
$discount = $goodsType[$goods['TYPE']]['discount'];
|
|
$discount = $goodsType[$goods['TYPE']]['discount'];
|
|
|
$realPrice = $goods['SELL_PRICE'] * $discount/100;
|
|
$realPrice = $goods['SELL_PRICE'] * $discount/100;
|
|
|
$realPv = $goods['PRICE_PV'] * $discount/100;
|
|
$realPv = $goods['PRICE_PV'] * $discount/100;
|
|
|
|
|
+ $realPriceStandard = $goods['SELL_PRICE_STANDARD'] * $discount/100;
|
|
|
} else {
|
|
} else {
|
|
|
$discount = $goods['SELL_DISCOUNT'];
|
|
$discount = $goods['SELL_DISCOUNT'];
|
|
|
$realPrice = $goods['SELL_PRICE'] * $discount;
|
|
$realPrice = $goods['SELL_PRICE'] * $discount;
|
|
|
$realPv = $goods['PRICE_PV'] * $discount;
|
|
$realPv = $goods['PRICE_PV'] * $discount;
|
|
|
|
|
+ $realPriceStandard = $goods['SELL_PRICE_STANDARD'] * $discount;
|
|
|
}
|
|
}
|
|
|
$totalAmount += $realPrice * intval($v);
|
|
$totalAmount += $realPrice * intval($v);
|
|
|
$totalPv += $realPv * intval($v);
|
|
$totalPv += $realPv * intval($v);
|
|
|
|
|
+ $totalAmountStandard += $realPriceStandard * intval($v);
|
|
|
|
|
|
|
|
$this->_orderGoods[] = [
|
|
$this->_orderGoods[] = [
|
|
|
'GOODS_ID' => $goods['ID'],
|
|
'GOODS_ID' => $goods['ID'],
|
|
@@ -405,6 +412,9 @@ class ApproachOrderForm extends Model
|
|
|
'CATEGORY_TYPE' => $goods['CATEGORY_TYPE'],
|
|
'CATEGORY_TYPE' => $goods['CATEGORY_TYPE'],
|
|
|
'PAY_TYPE' => $this->payType,
|
|
'PAY_TYPE' => $this->payType,
|
|
|
'EMAIL' => $this->email,
|
|
'EMAIL' => $this->email,
|
|
|
|
|
+ 'STANDARD_PRICE' => $goods['SELL_PRICE_STANDARD'],
|
|
|
|
|
+ 'REAL_STANDARD_PRICE' => $realPriceStandard,
|
|
|
|
|
+ 'EXCHANGE_RATE' => $exchangeRate,
|
|
|
];
|
|
];
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -424,6 +434,8 @@ class ApproachOrderForm extends Model
|
|
|
$this->_freight = 0;
|
|
$this->_freight = 0;
|
|
|
}
|
|
}
|
|
|
$this->_payAmount = $this->_decAmount + $this->_freight;
|
|
$this->_payAmount = $this->_decAmount + $this->_freight;
|
|
|
|
|
+ $this->_decAmountStandard = $totalAmountStandard;
|
|
|
|
|
+ $this->_standardAmount = $this->_decAmountStandard + $this->_freight;
|
|
|
|
|
|
|
|
$db = \Yii::$app->db;
|
|
$db = \Yii::$app->db;
|
|
|
$transaction = $db->beginTransaction();
|
|
$transaction = $db->beginTransaction();
|
|
@@ -459,6 +471,7 @@ class ApproachOrderForm extends Model
|
|
|
$userRealName = Info::getUserRealNameByUserId($userId);
|
|
$userRealName = Info::getUserRealNameByUserId($userId);
|
|
|
$userMobile = Info::getUserMobileByUserId($userId);
|
|
$userMobile = Info::getUserMobileByUserId($userId);
|
|
|
$userEmail = Info::getUserEmailByUserId($userId);
|
|
$userEmail = Info::getUserEmailByUserId($userId);
|
|
|
|
|
+ $exchangeRate = floatval(Cache::getSystemConfig()['exchangeRate']['VALUE'] ?? 0);
|
|
|
// 加入订单信息
|
|
// 加入订单信息
|
|
|
if ($this->_address['PROVINCE'] != 1) {
|
|
if ($this->_address['PROVINCE'] != 1) {
|
|
|
$warehouse = Region::getWarehouseByCode($this->_address['PROVINCE']);//仓库
|
|
$warehouse = Region::getWarehouseByCode($this->_address['PROVINCE']);//仓库
|
|
@@ -501,6 +514,9 @@ class ApproachOrderForm extends Model
|
|
|
$orderModel->CREATED_AT = Date::nowTime();
|
|
$orderModel->CREATED_AT = Date::nowTime();
|
|
|
$orderModel->CREATE_USER = $userName;
|
|
$orderModel->CREATE_USER = $userName;
|
|
|
$orderModel->EMAIL = $userEmail?$userEmail:$userName.'@elken.net';
|
|
$orderModel->EMAIL = $userEmail?$userEmail:$userName.'@elken.net';
|
|
|
|
|
+ $orderModel->ORDER_AMOUNT_STANDARD = $this->_decAmountStandard;
|
|
|
|
|
+ $orderModel->PAY_AMOUNT_STANDARD = $this->_standardAmount;
|
|
|
|
|
+ $orderModel->EXCHANGE_RATE = $exchangeRate;
|
|
|
if($this->_address['PROVINCE']==1){
|
|
if($this->_address['PROVINCE']==1){
|
|
|
$orderModel->EXPRESS_TYPE = 1;
|
|
$orderModel->EXPRESS_TYPE = 1;
|
|
|
$orderModel->CONSIGNEE = $userRealName;
|
|
$orderModel->CONSIGNEE = $userRealName;
|