订单添加信用购
This commit is contained in:
parent
11ba0dc8d3
commit
7115792191
@ -114,7 +114,7 @@ class StoreCartDao extends BaseDao
|
|||||||
->append(['bc_extension_one', 'bc_extension_two']);
|
->append(['bc_extension_one', 'bc_extension_two']);
|
||||||
},
|
},
|
||||||
'merchant' => function (Relation $query) use ($uid) {
|
'merchant' => function (Relation $query) use ($uid) {
|
||||||
$query->field('mer_id,mer_name,mer_state,mer_avatar,delivery_way,commission_rate,category_id')->with(['coupon' => function ($query) use ($uid) {
|
$query->field('mer_id,mer_name,mer_state,mer_avatar,delivery_way,commission_rate,category_id,credit_buy')->with(['coupon' => function ($query) use ($uid) {
|
||||||
$query->where('uid', $uid);
|
$query->where('uid', $uid);
|
||||||
},
|
},
|
||||||
'config' => function ($query) {
|
'config' => function ($query) {
|
||||||
|
@ -21,6 +21,12 @@ use app\common\repositories\store\coupon\StoreCouponRepository;
|
|||||||
class StoreGroupOrder extends BaseModel
|
class StoreGroupOrder extends BaseModel
|
||||||
{
|
{
|
||||||
|
|
||||||
|
const PAY_TYPE_BALANCE = 0; //余额支付
|
||||||
|
const PAY_TYPE_WECHAT = 1; //微信支付
|
||||||
|
const PAY_TYPE_ROUTINE = 2; //小程序支付
|
||||||
|
const PAY_TYPE_H5 = 3; //H5支付
|
||||||
|
const PAY_TYPE_CREDIT_BUY = 8; //信用购
|
||||||
|
|
||||||
public static function tablePk(): ?string
|
public static function tablePk(): ?string
|
||||||
{
|
{
|
||||||
return 'group_order_id';
|
return 'group_order_id';
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
namespace app\common\repositories\store\order;
|
namespace app\common\repositories\store\order;
|
||||||
|
|
||||||
use app\common\dao\store\order\StoreCartDao;
|
use app\common\dao\store\order\StoreCartDao;
|
||||||
|
use app\common\model\store\order\StoreGroupOrder;
|
||||||
use app\common\repositories\store\coupon\StoreCouponRepository;
|
use app\common\repositories\store\coupon\StoreCouponRepository;
|
||||||
use app\common\repositories\store\coupon\StoreCouponUserRepository;
|
use app\common\repositories\store\coupon\StoreCouponUserRepository;
|
||||||
use app\common\repositories\store\product\ProductAssistSkuRepository;
|
use app\common\repositories\store\product\ProductAssistSkuRepository;
|
||||||
@ -939,6 +940,9 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
//检查发票状态
|
//检查发票状态
|
||||||
if (isset($receipt_data[$merchantCart['mer_id']]) && !$merchantCart['openReceipt'])
|
if (isset($receipt_data[$merchantCart['mer_id']]) && !$merchantCart['openReceipt'])
|
||||||
throw new ValidateException('该店铺不支持开发票');
|
throw new ValidateException('该店铺不支持开发票');
|
||||||
|
if ($pay_type == StoreGroupOrder::PAY_TYPE_CREDIT_BUY && !$merchantCart['credit_buy']) {
|
||||||
|
throw new ValidateException('该店铺不支持先货后款');
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($merchantCart['list'] as $cart) {
|
foreach ($merchantCart['list'] as $cart) {
|
||||||
if (!$cartSpread && $cart['spread_id']) {
|
if (!$cartSpread && $cart['spread_id']) {
|
||||||
|
@ -74,7 +74,7 @@ class StoreOrderRepository extends BaseRepository
|
|||||||
/**
|
/**
|
||||||
* 支付类型
|
* 支付类型
|
||||||
*/
|
*/
|
||||||
const PAY_TYPE = ['balance', 'weixin', 'routine', 'h5', 'alipay', 'alipayQr', 'weixinQr', 'scrcu'];
|
const PAY_TYPE = ['balance', 'weixin', 'routine', 'h5', 'alipay', 'alipayQr', 'weixinQr', 'scrcu', 'creditBuy'];
|
||||||
|
|
||||||
const TYPE_SN_ORDER = 'wxo';
|
const TYPE_SN_ORDER = 'wxo';
|
||||||
const TYPE_SN_PRESELL = 'wxp';
|
const TYPE_SN_PRESELL = 'wxp';
|
||||||
|
@ -16,6 +16,7 @@ namespace app\common\repositories\system\merchant;
|
|||||||
|
|
||||||
use app\common\dao\system\merchant\MerchantDao;
|
use app\common\dao\system\merchant\MerchantDao;
|
||||||
use app\common\dao\system\serve\ServeOrderDao;
|
use app\common\dao\system\serve\ServeOrderDao;
|
||||||
|
use app\common\model\store\order\StoreGroupOrder;
|
||||||
use app\common\model\store\order\StoreOrder;
|
use app\common\model\store\order\StoreOrder;
|
||||||
use app\common\model\store\product\ProductReply;
|
use app\common\model\store\product\ProductReply;
|
||||||
use app\common\model\store\service\StoreService;
|
use app\common\model\store\service\StoreService;
|
||||||
@ -500,7 +501,8 @@ class MerchantRepository extends BaseRepository
|
|||||||
public function addLockMoney(int $merId, string $orderType, int $orderId, float $money)
|
public function addLockMoney(int $merId, string $orderType, int $orderId, float $money)
|
||||||
{
|
{
|
||||||
if ($money <= 0) return;
|
if ($money <= 0) return;
|
||||||
if (systemConfig('mer_lock_time')) {
|
$payType = StoreOrder::getInstance()->where('order_id', $orderId)->value('pay_type');
|
||||||
|
if (systemConfig('mer_lock_time') || $payType == StoreGroupOrder::PAY_TYPE_CREDIT_BUY) {
|
||||||
app()->make(UserBillRepository::class)->incBill($merId, 'mer_lock_money', $orderType, [
|
app()->make(UserBillRepository::class)->incBill($merId, 'mer_lock_money', $orderType, [
|
||||||
'link_id' => ($orderType === 'order' ? 1 : 2) . $orderId,
|
'link_id' => ($orderType === 'order' ? 1 : 2) . $orderId,
|
||||||
'mer_id' => $merId,
|
'mer_id' => $merId,
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
namespace app\controller\api\store\order;
|
namespace app\controller\api\store\order;
|
||||||
|
|
||||||
|
|
||||||
|
use app\common\model\store\order\StoreGroupOrder;
|
||||||
use app\common\repositories\delivery\DeliveryOrderRepository;
|
use app\common\repositories\delivery\DeliveryOrderRepository;
|
||||||
use app\common\repositories\store\order\StoreOrderCreateRepository;
|
use app\common\repositories\store\order\StoreOrderCreateRepository;
|
||||||
use app\common\repositories\store\order\StoreOrderReceiptRepository;
|
use app\common\repositories\store\order\StoreOrderReceiptRepository;
|
||||||
@ -105,7 +106,7 @@ class StoreOrder extends BaseController
|
|||||||
return $orderCreateRepository->v2CreateOrder(array_search($payType, StoreOrderRepository::PAY_TYPE), $this->request->userInfo(), $cartId, $extend, $mark, $receipt_data, $takes, $couponIds, $useIntegral, $addressId, $post);
|
return $orderCreateRepository->v2CreateOrder(array_search($payType, StoreOrderRepository::PAY_TYPE), $this->request->userInfo(), $cartId, $extend, $mark, $receipt_data, $takes, $couponIds, $useIntegral, $addressId, $post);
|
||||||
});
|
});
|
||||||
|
|
||||||
if ($groupOrder['pay_price'] == 0) {
|
if ($groupOrder['pay_price'] == 0 || $payType == StoreGroupOrder::PAY_TYPE_CREDIT_BUY) {
|
||||||
$this->repository->paySuccess($groupOrder);
|
$this->repository->paySuccess($groupOrder);
|
||||||
return app('json')->status('success', '支付成功', ['order_id' => $groupOrder['group_order_id']]);
|
return app('json')->status('success', '支付成功', ['order_id' => $groupOrder['group_order_id']]);
|
||||||
}
|
}
|
||||||
@ -239,7 +240,7 @@ class StoreOrder extends BaseController
|
|||||||
if (!$groupOrder)
|
if (!$groupOrder)
|
||||||
return app('json')->fail('订单不存在或已支付');
|
return app('json')->fail('订单不存在或已支付');
|
||||||
$this->repository->changePayType($groupOrder, array_search($type, StoreOrderRepository::PAY_TYPE));
|
$this->repository->changePayType($groupOrder, array_search($type, StoreOrderRepository::PAY_TYPE));
|
||||||
if ($groupOrder['pay_price'] == 0) {
|
if ($groupOrder['pay_price'] == 0 || $groupOrder['pay_type'] == StoreGroupOrder::PAY_TYPE_CREDIT_BUY) {
|
||||||
$this->repository->paySuccess($groupOrder);
|
$this->repository->paySuccess($groupOrder);
|
||||||
return app('json')->status('success', '支付成功', ['order_id' => $groupOrder['group_order_id']]);
|
return app('json')->status('success', '支付成功', ['order_id' => $groupOrder['group_order_id']]);
|
||||||
}
|
}
|
||||||
|
@ -87,6 +87,9 @@ class Merchant extends BaseController
|
|||||||
'long',
|
'long',
|
||||||
'lat',
|
'lat',
|
||||||
['delivery_way',[2]],
|
['delivery_way',[2]],
|
||||||
|
'credit_buy',
|
||||||
|
'settle_cycle',
|
||||||
|
'interest_rate',
|
||||||
]);
|
]);
|
||||||
$validate->check($data);
|
$validate->check($data);
|
||||||
$sys_bases_status = systemConfig('sys_bases_status') === '0' ? 0 : 1;
|
$sys_bases_status = systemConfig('sys_bases_status') === '0' ? 0 : 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user