修改增收补贴发放的错误
This commit is contained in:
parent
2338f133a1
commit
50fe835c74
@ -224,6 +224,17 @@ class StoreOrderRepository extends BaseRepository
|
|||||||
Db::transaction(function () use ($groupOrder, $pay_type) {
|
Db::transaction(function () use ($groupOrder, $pay_type) {
|
||||||
$groupOrder->pay_type = $pay_type;
|
$groupOrder->pay_type = $pay_type;
|
||||||
foreach ($groupOrder->orderList as $order) {
|
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->pay_type = $pay_type;
|
||||||
$order->save();
|
$order->save();
|
||||||
}
|
}
|
||||||
|
@ -198,29 +198,26 @@ class Store extends BaseController
|
|||||||
->where('type', StoreCouponDetail::TYPE_INCOME);
|
->where('type', StoreCouponDetail::TYPE_INCOME);
|
||||||
$count = $query->count();
|
$count = $query->count();
|
||||||
$record = $query->page($page)->limit($limit)->order('id', 'desc')->select()->toArray();
|
$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');
|
$merchantTypeId = Merchant::where('mer_id', $this->merId)->value('type_id');
|
||||||
$couponPrice = 0;
|
$first = $record[0] ?? ['coupon_price' => 0];
|
||||||
$saleTarget = 0;
|
|
||||||
foreach ($coupon['config'] as $item) {
|
foreach ($coupon['config'] as $item) {
|
||||||
if (in_array($merchantTypeId, $item['type_id'])) {
|
if (in_array($merchantTypeId, $item['type_id']) && $item['subsidy'] > $first['coupon_price']) {
|
||||||
$couponPrice = $item['subsidy'];
|
array_unshift($record, [
|
||||||
$saleTarget = $item['amount'];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$record[] = [
|
|
||||||
'id' => 0,
|
'id' => 0,
|
||||||
'coupon_price' => $couponPrice ?? '0.00',
|
'coupon_price' => $item['subsidy'],
|
||||||
'create_time' => time(),
|
'create_time' => date('Y-m-d H:i:s'),
|
||||||
'status' => StoreCouponDetail::STATUS_INVALID,
|
'status' => StoreCouponDetail::STATUS_INVALID,
|
||||||
'send_status' => StoreCouponDetail::SEND_REPEAL,
|
'send_status' => StoreCouponDetail::SEND_REPEAL,
|
||||||
'extra' => [
|
'extra' => [
|
||||||
'sale_target' => $saleTarget,
|
'sale_target' => $item['amount'],
|
||||||
'purchase_target' => bcmul($saleTarget, 0.2, 2),
|
'purchase_target' => bcmul($item['amount'], 0.2, 2),
|
||||||
'official_purchase_target' => bcmul($saleTarget, 0.3, 2),
|
'official_purchase_target' => bcmul($item['amount'], 0.3, 2),
|
||||||
],
|
]
|
||||||
];
|
]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
foreach ($record as &$item) {
|
foreach ($record as &$item) {
|
||||||
$item['status_cn'] = StoreCouponDetail::STATUS_MAP[$item['status']];
|
$item['status_cn'] = StoreCouponDetail::STATUS_MAP[$item['status']];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user