扫码支付不扣库存
This commit is contained in:
parent
ad48d8aba6
commit
fc5885494b
@ -324,8 +324,8 @@ class StoreCouponUserDao extends BaseDao
|
||||
]
|
||||
];
|
||||
foreach ($totalAmount as $item) {
|
||||
if (isset($result[$item['type']])) {
|
||||
$result[$item['type']]['total_amount']= bcadd($result[$item['type']]['total_amount'], $item['coupon_price'], 2);
|
||||
if (isset($result[$item['coupon_type']])) {
|
||||
$result[$item['coupon_type']]['total_amount']= bcadd($result[$item['coupon_type']]['total_amount'], $item['coupon_price'], 2);
|
||||
}
|
||||
}
|
||||
return array_values($result);
|
||||
|
@ -42,6 +42,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
{
|
||||
|
||||
public $saleType = Enum::SALE_TYPE_RETAIL;
|
||||
public $isScanOrder = false; //是否扫码支付
|
||||
|
||||
public function v2CartIdByOrderInfo($user, array $cartId, array $takes = null, array $useCoupon = null, bool $useIntegral = false, int $addressId = null, $createOrder = false)
|
||||
{
|
||||
@ -928,12 +929,14 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
}
|
||||
}
|
||||
|
||||
if (!$this->isScanOrder) {
|
||||
if ($orderInfo['status'] == 'noDeliver') throw new ValidateException('部分商品不支持该区域');
|
||||
if ($orderInfo['status'] == 'noAddress') throw new ValidateException('请选择地址');
|
||||
if (!$order_model && $orderInfo['allow_address']) {
|
||||
if (!$orderInfo['address']) throw new ValidateException('请选择正确的收货地址');
|
||||
if (!$orderInfo['address']['province_id']) throw new ValidateException('请完善收货地址信息');
|
||||
}
|
||||
}
|
||||
$orderType = $orderInfo['order_type'];
|
||||
if ($orderType && (count($orderInfo['order']) > 1 || ($orderType != 10 && count($orderInfo['order'][0]['list']) > 1))) {
|
||||
throw new ValidateException('活动商品请单独购买');
|
||||
@ -1173,6 +1176,10 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
$uniqueList[$cart['productAttr']['product_id'] . $cart['productAttr']['unique']] = true;
|
||||
else
|
||||
throw new ValidateException('购物车商品信息重复');
|
||||
//线下扫码支付不扣库存
|
||||
if ($this->isScanOrder) {
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
if ($cart['product_type'] == '1') {
|
||||
|
@ -34,6 +34,50 @@ class FinancialRecordRepository extends BaseRepository
|
||||
|
||||
const FINANCIA_TYPE_SVIP = 'svip';
|
||||
|
||||
const TYPE_NAME_MAP = [
|
||||
'order' => '订单支付',
|
||||
'order_presell' => '预售订单(定金)',
|
||||
'order_refund' => '订单退款',
|
||||
'brokerage_one' => '一级分销佣金',
|
||||
'brokerage_two' => '二级分销佣金',
|
||||
'refund_brokerage_one' => '返还一级佣金',
|
||||
'refund_brokerage_two' => '返还二级佣金',
|
||||
'refund_order' => '订单退款',
|
||||
'order_platform_coupon' => '平台优惠券抵扣',
|
||||
'order_svip_coupon' => '超级会员优惠券抵扣',
|
||||
'commission_to_service_team' => '服务队佣金',
|
||||
'commission_to_platform' => '平台手续费',
|
||||
'commission_to_platform_refund' => '平台手续费退款',
|
||||
'platform_consumption' => '平台优惠',
|
||||
'platform_consumption_refund' => '平台优惠退款',
|
||||
'commission_to_promoter' => '推广人佣金',
|
||||
'commission_to_promoter_refund' => '推广人佣金退款',
|
||||
'auto_margin' => '商户保证金',
|
||||
'auto_margin_refund' => '商户保证金退款',
|
||||
'merchant_order' => '商户订单',
|
||||
'merchant_order_refund' => '商户订单退款',
|
||||
'supply_chain' => '供应链',
|
||||
'presell' => '预售订单(尾款)',
|
||||
'order_charge' => '手续费',
|
||||
'order_true' => '商户入账',
|
||||
'refund_charge' => '返还手续费',
|
||||
'refund_true' => '商户返还入账',
|
||||
'presell_charge' => '预售订单(手续费)',
|
||||
'presell_true' => '商户入账',
|
||||
'mer_presell' => '预售订单(总额)',
|
||||
'refund_platform_coupon' => '退回优惠券补贴',
|
||||
'commission_to_village' => '订单平台佣金',
|
||||
'commission_to_town' => '订单平台佣金',
|
||||
'commission_to_service_team_refund' => '退回平台佣金',
|
||||
'commission_to_village_refund' => '退回平台佣金',
|
||||
'commission_to_town_refund' => '退回平台佣金',
|
||||
'commission_to_entry_merchant' => '订单平台佣金',//入口店铺佣金
|
||||
'commission_to_cloud_warehouse' => '订单平台佣金',//云仓佣金
|
||||
'commission_to_entry_merchant_refund' => '退回平台佣金',
|
||||
'commission_to_cloud_warehouse_refund' => '退回平台佣金',
|
||||
'first_order_commission' => '首单拉新',
|
||||
];
|
||||
|
||||
public function __construct(FinancialRecordDao $dao)
|
||||
{
|
||||
$this->dao = $dao;
|
||||
@ -53,6 +97,12 @@ class FinancialRecordRepository extends BaseRepository
|
||||
$query = $this->dao->search($where)->order('create_time DESC');
|
||||
$count = $query->count();
|
||||
$list = $query->page($page, $limit)->select();
|
||||
foreach ($list as &$item) {
|
||||
if (!empty($where['mer_id'])) {
|
||||
$item['financial_pm'] = $item['financial_pm'] == 0 ? 1 : 0;
|
||||
}
|
||||
$item['financial_type_cn'] = $this->getFinancialTypeName($item['financial_type']);
|
||||
}
|
||||
return compact('count', 'list');
|
||||
}
|
||||
|
||||
@ -676,4 +726,15 @@ class FinancialRecordRepository extends BaseRepository
|
||||
}
|
||||
return compact('count','list');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取财务类型
|
||||
* @param $type
|
||||
* @return string
|
||||
*/
|
||||
public function getFinancialTypeName($type)
|
||||
{
|
||||
return self::TYPE_NAME_MAP[$type] ?? '';
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -109,6 +109,7 @@ class StoreOrder extends BaseController
|
||||
// return app('json')->fail('请选择地址');
|
||||
|
||||
$groupOrder = app()->make(LockService::class)->exec('order.create', function () use ($key, $orderCreateRepository, $receipt_data, $mark, $extend, $cartId, $payType, $takes, $couponIds, $useIntegral, $addressId, $post) {
|
||||
$orderCreateRepository->isScanOrder = (int)$this->request->param('source') == 999;
|
||||
return $orderCreateRepository->v2CreateOrder($key, array_search($payType, StoreOrderRepository::PAY_TYPE), $this->request->userInfo(), $cartId, $extend, $mark, $receipt_data, $takes, $couponIds, $useIntegral, $addressId, $post);
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user