feat: place Order
This commit is contained in:
@@ -15,6 +15,7 @@ use App\Cache\Redis\Api\SiteCache;
|
||||
use App\Cache\Redis\RedisCache;
|
||||
use App\Constants\ApiCode;
|
||||
use App\Constants\Common\GoodCode;
|
||||
use App\Constants\ConfigCode;
|
||||
use App\Exception\ErrException;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
@@ -204,11 +205,19 @@ trait OrderTrait
|
||||
/**
|
||||
* 计算服务费
|
||||
* @return void
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
protected function computeSundryPrice(): void
|
||||
{
|
||||
$this->orderRes['sundry_num'] = $this->orderRes['optional_copies'];
|
||||
$this->orderRes['sundry_price'] = '1.00'; //todo 设置
|
||||
$this->orderRes['sundry_num'] = match ($this->configCache->getConfigValue(ConfigCode::SUNDRY_PRICE_COMPUTE_TYPE))
|
||||
{
|
||||
1 => $this->orderRes['optional_copies'],
|
||||
2 => $this->orderRes['meal_copies'],
|
||||
3 => $this->copies,
|
||||
};
|
||||
|
||||
$this->orderRes['sundry_price'] = $this->configCache->getConfigValue(ConfigCode::SUNDRY_UNIT_PRICE);
|
||||
$this->orderRes['total_sundry_price'] = bcmul($this->orderRes['sundry_price'],$this->orderRes['sundry_num'],2);
|
||||
}
|
||||
|
||||
@@ -218,11 +227,15 @@ trait OrderTrait
|
||||
*/
|
||||
protected function computeFavorable(): void
|
||||
{
|
||||
if ($this->couponId <= 0) {
|
||||
if ($this->couponId <= 0 && $this->isAutoSelectCoupon == 1) {
|
||||
$this->couponId = $this->getAutoCouponId();
|
||||
}
|
||||
|
||||
if ($this->couponId <= 0) {
|
||||
$this->orderRes['coupon_id'] = 0;
|
||||
$this->orderRes['coupon'] = [];
|
||||
$this->orderRes['favorable_good_price'] = '0';
|
||||
$this->orderRes['favorable_sundry_price'] = '0';
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user