commit
324e24474f
@ -239,7 +239,7 @@ class StoreCart extends BaseModel
|
||||
if($sku->stock < $this->cart_num || $sku->sku->stock < $this->cart_num) return false;
|
||||
break;
|
||||
case 98: //供应链商品
|
||||
if ($this->product->product_type !== 98 || $this->product->is_show !== 1 || $this->productAttr->stock < $this->cart_num || $this->product->is_used !== 1) {
|
||||
if (($this->product->product_type !== 98 || $this->product->is_show !== 1 || $this->productAttr->stock < $this->cart_num || $this->product->is_used !== 1) && !$this->product->isPickupCard()) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
@ -86,7 +86,7 @@ class StoreOrderRepository extends BaseRepository
|
||||
/**
|
||||
* 支付类型
|
||||
*/
|
||||
const PAY_TYPE = ['balance', 'weixin', 'routine', 'h5', 'alipay', 'alipayQr', 'weixinQr', 'scrcu', 'creditBuy'];
|
||||
const PAY_TYPE = ['balance', 'weixin', 'routine', 'h5', 'alipay', 'alipayQr', 'weixinQr', 'scrcu', 'creditBuy', 'merBalance'];
|
||||
|
||||
const TYPE_SN_ORDER = 'wxo';
|
||||
const TYPE_SN_PRESELL = 'wxp';
|
||||
@ -118,6 +118,9 @@ class StoreOrderRepository extends BaseRepository
|
||||
if ($type === 'balance') {
|
||||
return $this->payBalance($user, $groupOrder);
|
||||
}
|
||||
if ($type === 'merBalance') {
|
||||
return $this->payMerBalance($user, $groupOrder);
|
||||
}
|
||||
|
||||
if (in_array($type, ['weixin', 'alipay'], true) && $isApp) {
|
||||
$type .= 'App';
|
||||
@ -173,6 +176,44 @@ class StoreOrderRepository extends BaseRepository
|
||||
return app('json')->status('success', '余额支付成功', ['order_id' => $groupOrder['group_order_id']]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
* @param StoreGroupOrder $groupOrder
|
||||
* @return mixed
|
||||
* @author xaboy
|
||||
* @day 2020/6/9
|
||||
*/
|
||||
public function payMerBalance(User $user, StoreGroupOrder $groupOrder)
|
||||
{
|
||||
if (!systemConfig('yue_pay_status'))
|
||||
throw new ValidateException('未开启余额支付');
|
||||
$merchant = Merchant::where('uid', $user['uid'])->find();
|
||||
if (empty($merchant['mer_money']) || $merchant['mer_money'] < $groupOrder['pay_price'])
|
||||
throw new ValidateException('余额不足,请更换支付方式');
|
||||
Db::startTrans();
|
||||
try {
|
||||
$merchant->mer_money = bcsub($merchant->mer_money, $groupOrder['pay_price'], 2);
|
||||
$merchant->save();
|
||||
$userBillRepository = app()->make(UserBillRepository::class);
|
||||
$userBillRepository->decBill($merchant['uid'], 'mer_money', 'pay_product', [
|
||||
'link_id' => $groupOrder['group_order_id'],
|
||||
'status' => 1,
|
||||
'title' => '购买商品',
|
||||
'number' => $groupOrder['pay_price'],
|
||||
'mark' => '商户余额支付支付' . floatval($groupOrder['pay_price']) . '元购买商品',
|
||||
'balance' => $merchant->mer_money
|
||||
]);
|
||||
$this->paySuccess($groupOrder);
|
||||
Db::commit();
|
||||
} catch (Exception $e) {
|
||||
Db::rollback();
|
||||
Log::error('余额支付失败'.$e->getMessage().'。line:'.$e->getLine().'。file:'.$e->getFile());
|
||||
throw new ValidateException('余额支付失败'.$e->getMessage());
|
||||
}
|
||||
|
||||
return app('json')->status('success', '余额支付成功', ['order_id' => $groupOrder['group_order_id']]);
|
||||
}
|
||||
|
||||
public function changePayType(StoreGroupOrder $groupOrder, int $pay_type)
|
||||
{
|
||||
Db::transaction(function () use ($groupOrder, $pay_type) {
|
||||
|
@ -1284,7 +1284,7 @@ class StoreOtherOrderRepository extends BaseRepository
|
||||
}else{
|
||||
$merchant = Db::name('merchant')->where('uid',$item['uid'])->where('status',1)->field('mer_id,mer_name,is_trader,financial_bank,auto_margin_rate,commission_rate')->find();
|
||||
}
|
||||
$merchant['financial_bank'] = json_decode($merchant['financial_bank'], true);
|
||||
$merchant['financial_bank'] = !empty($merchant['financial_bank']) ? json_decode($merchant['financial_bank'], true) : [];
|
||||
$item['merchant'] = $merchant;
|
||||
});
|
||||
return compact('count', 'list');
|
||||
|
@ -115,7 +115,7 @@ class FinancialRepository extends BaseRepository
|
||||
// ];
|
||||
// break;
|
||||
}
|
||||
return app()->make(MerchantRepository::class)->update($merId,[$key => json_encode($update),'financial_type' => $data['financial_type']]);
|
||||
return app()->make(MerchantRepository::class)->update($merId,[$key => json_encode($update, JSON_UNESCAPED_UNICODE),'financial_type' => $data['financial_type']]);
|
||||
}
|
||||
|
||||
public function applyForm(int $merId)
|
||||
|
@ -776,12 +776,12 @@ class MerchantRepository extends BaseRepository
|
||||
}
|
||||
$rate = $this->forceMargin ? 100 : $merchant['auto_margin_rate'];
|
||||
// //商户押金未完全缴纳且设置了自动扣除比例
|
||||
$margin= bcmul($income, bcdiv($rate, 100,2), 2);
|
||||
// $margin = min(bcsub($margin, $merchant['paid_margin'], 2), $margin);
|
||||
// $income = max(bcsub($income, $margin, 2), 0);
|
||||
// if ($margin <= 0) {
|
||||
// return [$income, $financeDao];
|
||||
// }
|
||||
$margin = bcmul($income, bcdiv($rate, 100,2), 2);
|
||||
$margin = min(bcsub($merchant['margin'], $merchant['paid_margin'], 2), $margin);
|
||||
$income = max(bcsub($income, $margin, 2), 0);
|
||||
if ($margin <= 0) {
|
||||
return [$income, $financeDao];
|
||||
}
|
||||
$financeDao->platformIn($margin, 'auto_margin', $this->merId);
|
||||
if(bcadd($merchant['paid_margin'],$margin)>=$merchant['margin']){
|
||||
$is_margin=10;
|
||||
@ -816,7 +816,7 @@ class MerchantRepository extends BaseRepository
|
||||
throw new \Exception('merchant 保存出错', 500);
|
||||
}
|
||||
|
||||
return [bcsub($income,$margin,2), $financeDao];
|
||||
return [$income, $financeDao];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -368,7 +368,7 @@ class Auth extends BaseController
|
||||
$store_service = Db::name('store_service')->where('uid', $data['uid'])->find();
|
||||
|
||||
if ($store_service) {
|
||||
$mer_arr = Db::name('merchant')->where('mer_id', $store_service['mer_id'])->where('is_del', 0)->field('type_id,mer_avatar,mer_banner,business_status,mer_info,category_id,service_phone,mer_address,uid,mer_name,create_time,update_time,mer_settlement_agree_status,is_margin,street_id,is_company')->find();
|
||||
$mer_arr = Db::name('merchant')->where('mer_id', $store_service['mer_id'])->where('is_del', 0)->field('type_id,mer_avatar,mer_banner,business_status,mer_info,category_id,service_phone,mer_address,uid,mer_name,create_time,update_time,mer_settlement_agree_status,is_margin,street_id,is_company,mer_money')->find();
|
||||
$bank_info = Db::name('merchant_intention')->where('mer_id', $store_service['mer_id'])->field('company_name,bank_username,bank_opening,bank_code')->find();
|
||||
if ($mer_arr && $mer_arr['mer_avatar'] != '' && $mer_arr['mer_banner'] != '' && $mer_arr['mer_info'] && $mer_arr['service_phone'] != '' && $mer_arr['mer_address'] != '') {
|
||||
$data['is_wsxx'] = 1;
|
||||
|
@ -50,14 +50,14 @@ class Order extends BaseController
|
||||
->leftJoin('merchant m', 'o.mer_id = m.mer_id')
|
||||
->leftJoin('store_order_product op', 'o.order_id = op.order_id')
|
||||
->leftJoin('store_product p', 'op.product_id = p.product_id')
|
||||
->whereDay('og.create_time', $day)
|
||||
// ->whereDay('og.create_time', $day)
|
||||
->where('o.paid', 1)
|
||||
->whereNotNull('o.pay_time');
|
||||
|
||||
// 待取货订单数统计query 订单待发货
|
||||
$pendingPickupOrderCountQuery = Db::name('store_order')->alias('o')
|
||||
->leftJoin('product_order_log og', 'o.order_id = og.order_id')
|
||||
->whereDay('og.create_time', $day)
|
||||
// ->whereDay('og.create_time', $day)
|
||||
->where('o.status', 0)
|
||||
->where('o.paid', 1)
|
||||
->whereNotNull('o.pay_time');;
|
||||
@ -65,7 +65,7 @@ class Order extends BaseController
|
||||
// 未配送订单数统计query 订单待收货
|
||||
$undeliveredOrderCountQuery = Db::name('store_order')->alias('o')
|
||||
->leftJoin('product_order_log og', 'o.order_id = og.order_id')
|
||||
->whereDay('og.create_time', $day)
|
||||
// ->whereDay('og.create_time', $day)
|
||||
->where('o.status', 1)
|
||||
->where('o.paid', 1)
|
||||
->whereNotNull('o.pay_time');;
|
||||
@ -73,7 +73,7 @@ class Order extends BaseController
|
||||
// 已完成订单数统计query 订单已完成
|
||||
$doneOrderCountQuery = Db::name('store_order')->alias('o')
|
||||
->leftJoin('product_order_log og', 'o.order_id = og.order_id')
|
||||
->whereDay('og.create_time', $day)
|
||||
// ->whereDay('og.create_time', $day)
|
||||
->whereIn('o.status', [2,3])
|
||||
->where('o.paid', 1)
|
||||
->whereNotNull('o.pay_time');
|
||||
|
@ -189,10 +189,11 @@ class MerchantIntention extends BaseController
|
||||
}
|
||||
if ($this->userInfo) $data['uid'] = $this->userInfo->uid;
|
||||
$settleIn = $this->repository->getWhere(['type' => 1, 'uid' => $data['uid'], 'is_del' => 0]);
|
||||
if (empty($settleIn)) {
|
||||
$merchant = Merchant::where('uid', $data['uid'])->where('is_del', 0)->find();
|
||||
if (empty($settleIn) && empty($merchant)) {
|
||||
return app('json')->fail('请申请商户入驻申请!');
|
||||
}
|
||||
if ($settleIn['status'] == 0) {
|
||||
if (!empty($settleIn) && $settleIn['status'] == 0) {
|
||||
return app('json')->fail('请等待商户入驻申请审核!');
|
||||
}
|
||||
$merIntentionInfo = $this->repository->getWhere(['type' => 2, 'uid' => $data['uid'], 'is_del' => 0]);
|
||||
@ -202,19 +203,19 @@ class MerchantIntention extends BaseController
|
||||
if (!empty($merIntentionInfo) && ($merIntentionInfo['status'] == 1)) {
|
||||
return app('json')->fail('商户交易申请已通过');
|
||||
}
|
||||
$intenInfo['phone'] = $settleIn['phone'];
|
||||
$intenInfo['mer_name'] = $settleIn['mer_name'];
|
||||
$intenInfo['company_name'] = $settleIn['company_name'];
|
||||
$intenInfo['name'] = $settleIn['name'];
|
||||
$intenInfo['social_credit_code'] = $settleIn['social_credit_code'];
|
||||
$intenInfo['images'] = $settleIn['images'];
|
||||
$intenInfo['merchant_category_id'] = $settleIn['merchant_category_id'];
|
||||
$intenInfo['mer_type_id'] = $settleIn['mer_type_id'];
|
||||
$intenInfo['area_id'] = $settleIn['area_id'];
|
||||
$intenInfo['street_id'] = $settleIn['street_id'];
|
||||
$intenInfo['village_id'] = $settleIn['village_id'];
|
||||
$intenInfo['is_nmsc'] = $settleIn['is_nmsc'];
|
||||
$intenInfo['address'] = $settleIn['address'];
|
||||
$intenInfo['phone'] = $merchant['mer_phone'];
|
||||
$intenInfo['mer_name'] = $merchant['mer_name'];
|
||||
$intenInfo['company_name'] = $merchant['mer_name'];
|
||||
$intenInfo['name'] = $merchant['real_name'];
|
||||
$intenInfo['social_credit_code'] = '';
|
||||
$intenInfo['images'] = [];
|
||||
$intenInfo['merchant_category_id'] = $merchant['category_id'];
|
||||
$intenInfo['mer_type_id'] = $merchant['type_id'];
|
||||
$intenInfo['area_id'] = $merchant['area_id'];
|
||||
$intenInfo['street_id'] = $merchant['street_id'];
|
||||
$intenInfo['village_id'] = $merchant['village_id'];
|
||||
$intenInfo['is_nmsc'] = $merchant['is_nmsc'];
|
||||
$intenInfo['address'] = $merchant['mer_address'];
|
||||
$intenInfo['bank_username'] = $data['bank_username'];
|
||||
$intenInfo['bank_opening'] = $data['bank_opening'];
|
||||
$intenInfo['bank_code'] = $data['bank_code'];
|
||||
|
@ -15,22 +15,27 @@ class OrderDeliveryListen implements ListenerInterface
|
||||
public function handle($event): void
|
||||
{
|
||||
$order = $event['order'];
|
||||
$consumptionTotal = 0;
|
||||
foreach ($order->orderProduct as $orderProduct) {
|
||||
if (!$orderProduct->product->isPlatformCard()) {
|
||||
continue;
|
||||
}
|
||||
$consumptionTotal = bcadd($consumptionTotal, $orderProduct->total_price, 2);
|
||||
}
|
||||
if ($consumptionTotal > 0) {
|
||||
$consumption = StoreConsumption::where('type', StoreConsumption::TYPE_PULL_CONSUMPTION)->find();
|
||||
/** @var StoreConsumptionUserDao $repo */
|
||||
$repo = app()->make(StoreConsumptionUserDao::class);
|
||||
$repo->startTime = date('Y-m-d H:i:s');
|
||||
$repo->endTime = '2025-07-01';
|
||||
$repo->send($consumption, 1, $order['uid'], $order['group_order_id'], $order->total_price, StoreConsumptionUser::STATUS_UNUSED);
|
||||
$repo->send($consumption, 1, $order['uid'], $order['group_order_id'], $consumptionTotal, StoreConsumptionUser::STATUS_UNUSED);
|
||||
|
||||
$consumption = StoreConsumption::where('type', StoreConsumption::TYPE_RECHARGE)->find();
|
||||
$repo->startTime = date('Y-m-d H:i:s');
|
||||
$repo->endTime = '2025-07-01';
|
||||
$rate = $this->getRate($order->total_price);
|
||||
$repo->send($consumption, $rate, $order['uid'], $order['group_order_id'], $order->total_price, StoreConsumptionUser::STATUS_REPEAL, StoreConsumptionUser::TYPE_TWO);
|
||||
$consumptionTotal = min($consumptionTotal, 100000);
|
||||
$rate = $this->getRate($consumptionTotal);
|
||||
$repo->send($consumption, $rate, $order['uid'], $order['group_order_id'], $consumptionTotal, StoreConsumptionUser::STATUS_REPEAL, StoreConsumptionUser::TYPE_TWO);
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,7 +47,7 @@ class OrderDeliveryListen implements ListenerInterface
|
||||
$rate = 0.10;
|
||||
} elseif ($orderAmount >= 10000 && $orderAmount < 50000) {
|
||||
$rate = 0.15;
|
||||
} elseif ($orderAmount >= 50000 && $orderAmount <= 100000) {
|
||||
} elseif ($orderAmount >= 50000) {
|
||||
$rate = 0.20;
|
||||
}
|
||||
return $rate ?? 0;
|
||||
|
@ -2,4 +2,4 @@
|
||||
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')
|
||||
if(window.location.protocol == 'https:'){
|
||||
document.write('<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">')
|
||||
}</script><link rel=stylesheet href=/static/index.2da1efab.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/static/js/chunk-vendors.c6349b23.js></script><script src=/static/js/index.66771264.js></script></body></html>
|
||||
}</script><link rel=stylesheet href=/static/index.2da1efab.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/static/js/chunk-vendors.c6349b23.js></script><script src=/static/js/index.4cbffa43.js></script></body></html>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
public/static/js/pages-annex-vip_grade-index.ca8dbe7c.js
Normal file
1
public/static/js/pages-annex-vip_grade-index.ca8dbe7c.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
public/static/js/pages-gather-gather.ef46b6fe.js
Normal file
1
public/static/js/pages-gather-gather.ef46b6fe.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
public/static/js/pages-index-index.62049abd.js
Normal file
1
public/static/js/pages-index-index.62049abd.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
public/static/js/pages-nongKe-food-index.2cbd046e.js
Normal file
1
public/static/js/pages-nongKe-food-index.2cbd046e.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
public/static/js/pages-nongKe-tourism-index.a0327666.js
Normal file
1
public/static/js/pages-nongKe-tourism-index.a0327666.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
public/static/js/pages-payment-get_payment.cf0c9f7e.js
Normal file
1
public/static/js/pages-payment-get_payment.cf0c9f7e.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
public/static/js/pages-payment-settlement.9153d1d8.js
Normal file
1
public/static/js/pages-payment-settlement.9153d1d8.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
public/static/js/pages-product-basicSet.7864fc52.js
Normal file
1
public/static/js/pages-product-basicSet.7864fc52.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
public/static/js/pages-room-histroyroom.e3e3afc3.js
Normal file
1
public/static/js/pages-room-histroyroom.e3e3afc3.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
public/static/js/pages-store-settled-index.0f9ebdc4.js
Normal file
1
public/static/js/pages-store-settled-index.0f9ebdc4.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
public/static/js/pages-store-settled-unit.7f7bede7.js
Normal file
1
public/static/js/pages-store-settled-unit.7f7bede7.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
public/static/js/pages-user-index.b2e401d1.js
Normal file
1
public/static/js/pages-user-index.b2e401d1.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user