修改增收补贴发放的错误
This commit is contained in:
parent
2338f133a1
commit
50fe835c74
@ -224,6 +224,17 @@ class StoreOrderRepository extends BaseRepository
|
||||
Db::transaction(function () use ($groupOrder, $pay_type) {
|
||||
$groupOrder->pay_type = $pay_type;
|
||||
foreach ($groupOrder->orderList as $order) {
|
||||
if ($pay_type == Enum::public) {
|
||||
$order->order_extend = json_encode([
|
||||
'bank_info' => [
|
||||
'company_name' => '泸州里海农业科技有限公司',
|
||||
'corporate_account' => '22170201040004168',
|
||||
'corporate_bank' => '中国农业银行股份有限公司泸州石洞支行',
|
||||
'corporate_bank_address' => '泸州市江阳区分水岭镇振兴路03号1-2-1号',
|
||||
],
|
||||
'corporate_voucher' => '',
|
||||
], JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
$order->pay_type = $pay_type;
|
||||
$order->save();
|
||||
}
|
||||
|
@ -198,29 +198,26 @@ class Store extends BaseController
|
||||
->where('type', StoreCouponDetail::TYPE_INCOME);
|
||||
$count = $query->count();
|
||||
$record = $query->page($page)->limit($limit)->order('id', 'desc')->select()->toArray();
|
||||
if (empty($record) && $type == 2) {
|
||||
if ($type == 2) {
|
||||
$merchantTypeId = Merchant::where('mer_id', $this->merId)->value('type_id');
|
||||
$couponPrice = 0;
|
||||
$saleTarget = 0;
|
||||
$first = $record[0] ?? ['coupon_price' => 0];
|
||||
foreach ($coupon['config'] as $item) {
|
||||
if (in_array($merchantTypeId, $item['type_id'])) {
|
||||
$couponPrice = $item['subsidy'];
|
||||
$saleTarget = $item['amount'];
|
||||
if (in_array($merchantTypeId, $item['type_id']) && $item['subsidy'] > $first['coupon_price']) {
|
||||
array_unshift($record, [
|
||||
'id' => 0,
|
||||
'coupon_price' => $item['subsidy'],
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'status' => StoreCouponDetail::STATUS_INVALID,
|
||||
'send_status' => StoreCouponDetail::SEND_REPEAL,
|
||||
'extra' => [
|
||||
'sale_target' => $item['amount'],
|
||||
'purchase_target' => bcmul($item['amount'], 0.2, 2),
|
||||
'official_purchase_target' => bcmul($item['amount'], 0.3, 2),
|
||||
]
|
||||
]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$record[] = [
|
||||
'id' => 0,
|
||||
'coupon_price' => $couponPrice ?? '0.00',
|
||||
'create_time' => time(),
|
||||
'status' => StoreCouponDetail::STATUS_INVALID,
|
||||
'send_status' => StoreCouponDetail::SEND_REPEAL,
|
||||
'extra' => [
|
||||
'sale_target' => $saleTarget,
|
||||
'purchase_target' => bcmul($saleTarget, 0.2, 2),
|
||||
'official_purchase_target' => bcmul($saleTarget, 0.3, 2),
|
||||
],
|
||||
];
|
||||
}
|
||||
foreach ($record as &$item) {
|
||||
$item['status_cn'] = StoreCouponDetail::STATUS_MAP[$item['status']];
|
||||
|
Loading…
x
Reference in New Issue
Block a user