commit
011c26a173
4
.gitignore
vendored
4
.gitignore
vendored
@ -2,6 +2,7 @@
|
||||
/.vscode
|
||||
*.log
|
||||
.env
|
||||
.example.env
|
||||
.user.ini
|
||||
.phpstorm.meta.php
|
||||
.constant
|
||||
@ -16,4 +17,5 @@ public/protocol.html
|
||||
runtime/*
|
||||
cert_crmeb copy.key
|
||||
dump.rdb
|
||||
config/swoole.php
|
||||
config/swoole.php
|
||||
.example.env
|
||||
|
@ -72,7 +72,7 @@ class StoreCartDao extends BaseDao
|
||||
public function getAll(int $uid,$product_type,$source=0)
|
||||
{
|
||||
$where=['uid' => $uid, 'is_del' => 0, 'is_new' => 0, 'is_pay' => 0,'product_type' => $product_type,'source'=>$source];
|
||||
if($product_type==0 &&$source>0){
|
||||
if($source==103){
|
||||
$where=['uid' => $uid, 'is_del' => 0, 'is_new' => 0, 'is_pay' => 0,'source'=>$source];
|
||||
}
|
||||
$query = ($this->getModel())::where($where)
|
||||
@ -87,7 +87,6 @@ class StoreCartDao extends BaseDao
|
||||
$query->field('mer_id,mer_name,mer_state,mer_avatar,is_trader,type_id,credit_buy,street_id')->with(['type_names']);
|
||||
}
|
||||
])->select();
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
@ -153,7 +152,11 @@ class StoreCartDao extends BaseDao
|
||||
*/
|
||||
public function getCartCount(int $uid,$product_type,$source=0)
|
||||
{
|
||||
$count = ($this->getModel()::getDB())->where(['uid' => $uid, 'is_del' => 0, 'is_new' => 0, 'is_pay' => 0,'product_type' => $product_type,'is_fail'=>0,'source'=>$source])->count();
|
||||
$where=['uid' => $uid, 'is_del' => 0, 'is_new' => 0, 'is_pay' => 0,'product_type' => $product_type,'is_fail'=>0,'source'=>$source];
|
||||
if($source==103){
|
||||
$where=['uid' => $uid, 'is_del' => 0, 'is_new' => 0, 'is_pay' => 0,'is_fail'=>0,'source'=>$source];
|
||||
}
|
||||
$count = ($this->getModel()::getDB())->where($where)->count();
|
||||
$data[0]['count'] = $count;
|
||||
return $data;
|
||||
}
|
||||
|
@ -138,6 +138,9 @@ class StoreOrderDao extends BaseDao
|
||||
->when(isset($where['order_ids']) && $where['order_ids'] !== '', function ($query) use ($where) {
|
||||
$query->whereIn('order_id', $where['order_ids']);
|
||||
})
|
||||
->when(isset($where['source']) && $where['source'] !== '', function ($query) use ($where) {
|
||||
$query->whereIn('source', $where['source']);
|
||||
})
|
||||
->when(isset($where['order_id']) && $where['order_id'] !== '', function ($query) use ($where) {
|
||||
if (is_array($where['order_id'])) {
|
||||
$query->whereIn('order_id', $where['order_id']);
|
||||
|
@ -53,11 +53,11 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
//检查购物车失效数据
|
||||
if (count($fail)) {
|
||||
if ($fail[0]['is_fail'])
|
||||
throw new ValidateException('[已失效]' . mb_substr($fail[0]['product']['store_name'],0,10).'...');
|
||||
throw new ValidateException('[已失效]' . mb_substr($fail[0]['product']['store_name'], 0, 10) . '...');
|
||||
if (in_array($fail[0]['product_type'], [1, 2, 3]) && !$fail[0]['userPayCount']) {
|
||||
throw new ValidateException('[超出限购数]' . mb_substr($fail[0]['product']['store_name'],0,10).'...');
|
||||
throw new ValidateException('[超出限购数]' . mb_substr($fail[0]['product']['store_name'], 0, 10) . '...');
|
||||
}
|
||||
throw new ValidateException('[已失效]' . mb_substr($fail[0]['product']['store_name'],0,10).'...');
|
||||
throw new ValidateException('[已失效]' . mb_substr($fail[0]['product']['store_name'], 0, 10) . '...');
|
||||
}
|
||||
|
||||
$svip_status = $user->is_svip > 0 && systemConfig('svip_switch_status') == '1';
|
||||
@ -72,30 +72,30 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
//检查商品类型, 活动商品只能单独购买
|
||||
foreach ($merchantCartList as $merchantCart) {
|
||||
|
||||
if(($merchantCart['type_id']!=Merchant::TypeSupplyChain)&&$address){
|
||||
if($merchantCart['street_id']!=$address['street_code']){
|
||||
if (($merchantCart['type_id'] != Merchant::TypeSupplyChain) && $address) {
|
||||
if ($merchantCart['street_id'] != $address['street_code']) {
|
||||
throw new ValidateException('不支持跨区域购买,请在【我的】-【地址管理】更改后重新购买');
|
||||
}
|
||||
}
|
||||
foreach ($merchantCart['list'] as $cart) {
|
||||
if ($cart['product_type']==0) {
|
||||
if ($cart['product_type'] == 0) {
|
||||
if ($cart['product']['once_min_count'] > 0 && $cart['product']['once_min_count'] > $cart['cart_num'])
|
||||
throw new ValidateException('[低于起购数:'.$cart['product']['once_min_count'].']'.mb_substr($cart['product']['store_name'],0,10).'...');
|
||||
throw new ValidateException('[低于起购数:' . $cart['product']['once_min_count'] . ']' . mb_substr($cart['product']['store_name'], 0, 10) . '...');
|
||||
if ($cart['product']['pay_limit'] == 1 && $cart['product']['once_max_count'] < $cart['cart_num'])
|
||||
throw new ValidateException('[超出单次限购数:'.$cart['product']['once_max_count'].']'.mb_substr($cart['product']['store_name'],0,10).'...');
|
||||
if ($cart['product']['pay_limit'] == 2){
|
||||
throw new ValidateException('[超出单次限购数:' . $cart['product']['once_max_count'] . ']' . mb_substr($cart['product']['store_name'], 0, 10) . '...');
|
||||
if ($cart['product']['pay_limit'] == 2) {
|
||||
//如果长期限购
|
||||
//已购买数量
|
||||
$count = app()->make(StoreOrderRepository::class)->getMaxCountNumber($cart['uid'],$cart['product_id']);
|
||||
$count = app()->make(StoreOrderRepository::class)->getMaxCountNumber($cart['uid'], $cart['product_id']);
|
||||
if (($cart['cart_num'] + $count) > $cart['product']['once_max_count'])
|
||||
throw new ValidateException('[超出限购总数:'. $cart['product']['once_max_count'].']'.mb_substr($cart['product']['store_name'],0,10).'...');
|
||||
throw new ValidateException('[超出限购总数:' . $cart['product']['once_max_count'] . ']' . mb_substr($cart['product']['store_name'], 0, 10) . '...');
|
||||
}
|
||||
}
|
||||
if ($cart['product_type'] > 0){
|
||||
if ($cart['product_type'] > 0) {
|
||||
$order_type = $cart['product_type'];
|
||||
$source = $cart['source'];
|
||||
}
|
||||
if ($cart['product_type']<=97 &&$cart['product_type'] > 0 && (($cart['product_type'] != 10 && count($merchantCart['list']) != 1) || count($merchantCartList) != 1)) {
|
||||
$source = $cart['source'];
|
||||
if ($cart['product_type'] <= 97 && $cart['product_type'] > 0 && (($cart['product_type'] != 10 && count($merchantCart['list']) != 1) || count($merchantCartList) != 1)) {
|
||||
throw new ValidateException('活动商品必须单独购买');
|
||||
}
|
||||
if ($cart['product']['type'] && (count($merchantCart['list']) != 1 || count($merchantCartList) != 1)) {
|
||||
@ -105,30 +105,24 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
if ($cart['product']['extend']) {
|
||||
$order_extend = json_decode($cart['product']['extend'], true);
|
||||
}
|
||||
if ($address) {
|
||||
if ($cart['source'] == 0) {
|
||||
$userAddressCode = ($address['province_code'] ?? '') . ',' . ($address['city_code'] ?? '') . ',' . ($address['district_code'] ?? '') . ',' . ($address['street_code'] ?? '') . ',' . ($address['village_code'] ?? '') . ',' . ($address['brigade_id'] ?? 0);
|
||||
$getUrl = env('LOGISTICS_HOST_URL') . '/api/hasCourier?user_address_code=' . $userAddressCode;
|
||||
$client = new \GuzzleHttp\Client();
|
||||
$response = $client->request('GET', $getUrl);
|
||||
$courierData = json_decode($response->getBody(), true);
|
||||
if (empty($courierData['code']) || $courierData['code'] != 1) {
|
||||
throw new ValidateException('该收货区域未设置快递员');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (($order_type == 98 || $order_type == 99) && count($merchantCartList) > 1) {
|
||||
// throw new ValidateException('采购、委托商品不支持跨店购买');
|
||||
// }
|
||||
$community = [];
|
||||
// if ($order_type == 98) {
|
||||
// $sourceIdArray = [];
|
||||
// foreach($merchantCart['list'] as $prod){
|
||||
// if ($prod['source_id'] > 0) {
|
||||
// $sourceIdArray[] = $prod['source_id'];
|
||||
// }
|
||||
// }
|
||||
// if (count($sourceIdArray)) {
|
||||
// if (count(array_unique($sourceIdArray)) > 1) {
|
||||
// throw new ValidateException('转售商品数据异常');
|
||||
// }
|
||||
// $community = Db::name('Community')->where('community_id', $sourceIdArray[0] ?? 0)->field('community_id, title, image')->fetchSql(false)->find();
|
||||
// if ($community) {
|
||||
// $deliverMethod = Db::name('resale')->where('community_id', $sourceIdArray[0] ?? 0)->value('deliver_method');
|
||||
// $deliverMethodArray = explode(',', $deliverMethod);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
unset($merchantCart, $cart);
|
||||
$order_price = 0;
|
||||
$total_true_price = 0;
|
||||
@ -167,9 +161,9 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
//是否自提
|
||||
$isTake = in_array($merchantCart['mer_id'], $takes ?? []);
|
||||
|
||||
// if (!$createOrder && !$isTake) {
|
||||
// $isTake = count($merchantCart['delivery_way']) == 1 && $merchantCart['delivery_way'][0] == '1';
|
||||
// }
|
||||
// if (!$createOrder && !$isTake) {
|
||||
// $isTake = count($merchantCart['delivery_way']) == 1 && $merchantCart['delivery_way'][0] == '1';
|
||||
// }
|
||||
|
||||
$merTake = in_array('1', $merchantCart['delivery_way'], true);
|
||||
$merDelivery = (!$merchantCart['delivery_way'] || !count($merchantCart['delivery_way']) || in_array('2', $merchantCart['delivery_way'], true));
|
||||
@ -178,7 +172,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
$deliveryStatus = true;
|
||||
if ($createOrder && $isTake && !$merTake) {
|
||||
$deliveryStatus = false;
|
||||
// throw new ValidateException('[仅支持快递配送]' . $merchantCart['mer_name']);
|
||||
// throw new ValidateException('[仅支持快递配送]' . $merchantCart['mer_name']);
|
||||
}
|
||||
$product_cart = [];
|
||||
|
||||
@ -198,12 +192,12 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
}
|
||||
if ($createOrder && $isTake && !$merTake) {
|
||||
$deliveryStatus = false;
|
||||
// throw new ValidateException('[仅支持快递配送]' . $cart['product']['store_name']);
|
||||
// throw new ValidateException('[仅支持快递配送]' . $cart['product']['store_name']);
|
||||
}
|
||||
}
|
||||
if (!$merDelivery && !$merTake) {
|
||||
$deliveryStatus = false;
|
||||
// throw new ValidateException('部分商品配送方式不一致,请单独下单');
|
||||
// throw new ValidateException('部分商品配送方式不一致,请单独下单');
|
||||
}
|
||||
if ($deliveryStatus && !$isTake && ($merDelivery || $merTake)) {
|
||||
$isTake = $merDelivery ? 0 : 1;
|
||||
@ -231,8 +225,8 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
}
|
||||
$svip_discount = 0;
|
||||
$realPrice = $this->cartByPrice($cart);
|
||||
if (in_array($source,[9,10,11,12,13])) {
|
||||
if($realPrice==0){
|
||||
if (in_array($source, [9, 10, 11, 12, 13])) {
|
||||
if ($realPrice == 0) {
|
||||
throw new ValidateException('价格必须大于0');
|
||||
}
|
||||
$cart['product']['price'] = $realPrice;
|
||||
@ -379,7 +373,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
$merCouponIds = (array)($useCoupon[$merchantCart['mer_id']] ?? []);
|
||||
$merCouponIds = array_reverse($merCouponIds);
|
||||
$sortIds = $merCouponIds;
|
||||
// $all_coupon_product = [];
|
||||
// $all_coupon_product = [];
|
||||
unset($defaultSort);
|
||||
$defaultSort = [];
|
||||
if (count($merCouponIds)) {
|
||||
@ -397,7 +391,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
|
||||
$pay_price = max(bcsub($valid_total_price, $coupon_price, 2), 0);
|
||||
$_pay_price = $pay_price;
|
||||
|
||||
|
||||
|
||||
$productCouponRate = [];
|
||||
$storeCouponRate = null;
|
||||
@ -422,9 +416,11 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
$cart['coupon_price'] = bcsub($_cartTotalPrice, $cartTotalPrice, 2);
|
||||
$cart['true_price'] = $cartTotalPrice;
|
||||
}
|
||||
$procure = $this->cartByPrice($cart, 1);
|
||||
$procure_price = bcmul($cart['cart_num'], $procure, 2);
|
||||
unset($cart, $_k);
|
||||
$total_true_price = bcadd($_pay_price, $total_true_price, 2);
|
||||
if(count($merchantCartList) > 1 || count($merchantCart['list']) > 1){
|
||||
if (count($merchantCartList) > 1 || count($merchantCart['list']) > 1) {
|
||||
$orderDeliveryStatus = $orderDeliveryStatus && $deliveryStatus;
|
||||
}
|
||||
$merchantCart['order'] = [
|
||||
@ -447,6 +443,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
'delivery_status' => $deliveryStatus,
|
||||
'svip_discount' => $total_svip_discount,
|
||||
'use_svip' => $use_svip,
|
||||
'procure_price' => $procure_price
|
||||
];
|
||||
$order_total_postage = bcadd($order_total_postage, $postage_price, 2);
|
||||
$order_svip_discount = bcadd($total_svip_discount, $order_svip_discount, 2);
|
||||
@ -549,6 +546,8 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
$merchantCart['order']['org_price'] = $org_price;
|
||||
$merchantCart['order']['pay_price'] = $pay_price;
|
||||
$merchantCart['order']['coupon_price'] = $coupon_price;
|
||||
$merchantCart['order']['postage_price'] = $merchantCart['order']['postage_price'];
|
||||
$merchantCart['order']['procure_price'] = $merchantCart['order']['procure_price'];
|
||||
|
||||
$order_price = bcadd($order_price, $pay_price, 2);
|
||||
$order_total_price = bcadd($order_total_price, $total_price, 2);
|
||||
@ -574,34 +573,34 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
$openIntegral = $merIntegralFlag && !$order_type && $sysIntegralConfig['integral_status'] && $sysIntegralConfig['integral_money'] > 0;
|
||||
$total_coupon = bcadd($order_svip_discount, bcadd(bcadd($total_platform_coupon_price, $order_coupon_price, 2), $order_total_integral_price, 2), 2);
|
||||
return compact(
|
||||
'order_type',
|
||||
'source',
|
||||
'order_model',
|
||||
'order_extend',
|
||||
'order_total_postage',
|
||||
'order_price',
|
||||
'total_price',
|
||||
'community',
|
||||
'enabledPlatformCoupon',
|
||||
'platformCoupon',
|
||||
'usePlatformCouponId',
|
||||
'order_total_integral',
|
||||
'order_total_integral_price',
|
||||
'order_total_give_integral',
|
||||
'order_svip_discount',
|
||||
'total_platform_coupon_price',
|
||||
'total_coupon',
|
||||
'order_coupon_price',
|
||||
'order',
|
||||
'status',
|
||||
'address',
|
||||
'openIntegral',
|
||||
'useIntegral',
|
||||
'key'
|
||||
) + ['allow_address' => !$allow_no_address, 'order_delivery_status' => $orderDeliveryStatus];
|
||||
'order_type',
|
||||
'source',
|
||||
'order_model',
|
||||
'order_extend',
|
||||
'order_total_postage',
|
||||
'order_price',
|
||||
'total_price',
|
||||
'community',
|
||||
'enabledPlatformCoupon',
|
||||
'platformCoupon',
|
||||
'usePlatformCouponId',
|
||||
'order_total_integral',
|
||||
'order_total_integral_price',
|
||||
'order_total_give_integral',
|
||||
'order_svip_discount',
|
||||
'total_platform_coupon_price',
|
||||
'total_coupon',
|
||||
'order_coupon_price',
|
||||
'order',
|
||||
'status',
|
||||
'address',
|
||||
'openIntegral',
|
||||
'useIntegral',
|
||||
'key'
|
||||
) + ['allow_address' => !$allow_no_address, 'order_delivery_status' => $orderDeliveryStatus];
|
||||
}
|
||||
|
||||
public function v2CreateOrder(int $pay_type, $user, array $cartId, array $extend, array $mark, array $receipt_data, array $takes = null, array $useCoupon = null, bool $useIntegral = false, int $addressId = null, array $post,int $product_type=0)
|
||||
public function v2CreateOrder(int $pay_type, $user, array $cartId, array $extend, array $mark, array $receipt_data, array $takes = null, array $useCoupon = null, bool $useIntegral = false, int $addressId = null, array $post, int $product_type = 0)
|
||||
{
|
||||
$uid = $user->uid;
|
||||
$orderInfo = $this->v2CartIdByOrderInfo($user, $cartId, $takes, $useCoupon, $useIntegral, $addressId, true);
|
||||
@ -773,7 +772,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
$_order = [
|
||||
'cartInfo' => $merchantCart,
|
||||
'activity_type' => $orderInfo['order_type'],
|
||||
'source' => $orderInfo['source']??2,
|
||||
'source' => $orderInfo['source'] ?? 2,
|
||||
'commission_rate' => (float)$rate,
|
||||
'order_type' => $merchantCart['order']['isTake'] ? 1 : 0,
|
||||
'is_virtual' => $order_model ? 1 : 0,
|
||||
@ -805,7 +804,8 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
'mark' => $mark[$merchantCart['mer_id']] ?? '',
|
||||
'coupon_price' => bcadd($merchantCart['order']['coupon_price'], $merchantCart['order']['platform_coupon_price'], 2),
|
||||
'platform_coupon_price' => $merchantCart['order']['platform_coupon_price'],
|
||||
'pay_type' => $pay_type
|
||||
'pay_type' => $pay_type,
|
||||
'procure_price' => $merchantCart['order']['procure_price'],
|
||||
];
|
||||
$allUseCoupon = array_merge($allUseCoupon, $merchantCart['order']['useCouponIds']);
|
||||
$orderList[] = $_order;
|
||||
|
@ -311,61 +311,40 @@ class StoreOrderRepository extends BaseRepository
|
||||
'financial_record_sn' => $financeSn . ($i++)
|
||||
];
|
||||
|
||||
$_payPrice = bcsub($order->pay_price, bcadd($order['extension_one'], $order['extension_two'], 3), 2);
|
||||
if ($presell) {
|
||||
if (isset($order->orderProduct[0]['cart_info']['presell_extension_one']) && $order->orderProduct[0]['cart_info']['presell_extension_one'] > 0) {
|
||||
$_payPrice = bcadd($_payPrice, $order->orderProduct[0]['cart_info']['presell_extension_one'], 2);
|
||||
}
|
||||
if (isset($order->orderProduct[0]['cart_info']['presell_extension_two']) && $order->orderProduct[0]['cart_info']['presell_extension_two'] > 0) {
|
||||
$_payPrice = bcadd($_payPrice, $order->orderProduct[0]['cart_info']['presell_extension_two'], 2);
|
||||
if($order->source==103){
|
||||
$_payPrice = $order->procure_price;
|
||||
//计算手续费
|
||||
$_order_rate=bcsub($order->pay_price,$_payPrice,2);
|
||||
}else{
|
||||
$_payPrice = $order->pay_price;
|
||||
$_order_rate = 0;
|
||||
|
||||
//平台手续费
|
||||
if ($order['commission_rate'] > 0) {
|
||||
|
||||
$commission_rate = ($order['commission_rate'] / 100);
|
||||
|
||||
$_order_rate = bcmul($_payPrice, $commission_rate, 2);
|
||||
|
||||
$_payPrice = bcsub($_payPrice, $_order_rate, 2);
|
||||
// 结算各镇 小组佣金
|
||||
// event('order.paySuccessOrder', compact('order', '_order_rate'));
|
||||
}
|
||||
}
|
||||
|
||||
// bcsub($order->pay_price, bcadd($order['extension_one'], $order['extension_two'], 3), 2);
|
||||
// if ($presell) {
|
||||
// if (isset($order->orderProduct[0]['cart_info']['presell_extension_one']) && $order->orderProduct[0]['cart_info']['presell_extension_one'] > 0) {
|
||||
// $_payPrice = bcadd($_payPrice, $order->orderProduct[0]['cart_info']['presell_extension_one'], 2);
|
||||
// }
|
||||
// if (isset($order->orderProduct[0]['cart_info']['presell_extension_two']) && $order->orderProduct[0]['cart_info']['presell_extension_two'] > 0) {
|
||||
// $_payPrice = bcadd($_payPrice, $order->orderProduct[0]['cart_info']['presell_extension_two'], 2);
|
||||
// }
|
||||
// }
|
||||
|
||||
$_order_rate = 0;
|
||||
|
||||
//平台手续费
|
||||
if ($order['commission_rate'] > 0) {
|
||||
|
||||
$commission_rate = ($order['commission_rate'] / 100);
|
||||
|
||||
$_order_rate = bcmul($_payPrice, $commission_rate, 2);
|
||||
|
||||
$_payPrice = bcsub($_payPrice, $_order_rate, 2);
|
||||
// 结算各镇 小组佣金
|
||||
event('order.paySuccessOrder', compact('order', '_order_rate'));
|
||||
}
|
||||
|
||||
if (!$presell) {
|
||||
if ($order['extension_one'] > 0) {
|
||||
$finance[] = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
'user_info' => $groupOrder->user->nickname,
|
||||
'user_id' => $uid,
|
||||
'financial_type' => 'brokerage_one',
|
||||
'financial_pm' => 0,
|
||||
'type' => 1,
|
||||
'number' => $order['extension_one'],
|
||||
'mer_id' => $order->mer_id,
|
||||
'financial_record_sn' => $financeSn . ($i++)
|
||||
];
|
||||
}
|
||||
|
||||
if ($order['extension_two'] > 0) {
|
||||
$finance[] = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
'user_info' => $groupOrder->user->nickname,
|
||||
'user_id' => $uid,
|
||||
'financial_type' => 'brokerage_two',
|
||||
'financial_pm' => 0,
|
||||
'type' => 1,
|
||||
'number' => $order['extension_two'],
|
||||
'mer_id' => $order->mer_id,
|
||||
'financial_record_sn' => $financeSn . ($i++)
|
||||
];
|
||||
}
|
||||
|
||||
if ($order['commission_rate'] > 0) {
|
||||
$finance[] = [
|
||||
'order_id' => $order->order_id,
|
||||
@ -401,21 +380,21 @@ class StoreOrderRepository extends BaseRepository
|
||||
'financial_record_sn' => $financeSn . ($i++)
|
||||
];
|
||||
|
||||
if ($order->platform_coupon_price > 0) {
|
||||
$finance[] = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
'user_info' => $groupOrder->user->nickname,
|
||||
'user_id' => $uid,
|
||||
'financial_type' => $isVipCoupon ? 'order_svip_coupon' : 'order_platform_coupon',
|
||||
'financial_pm' => 0,
|
||||
'type' => 1,
|
||||
'number' => $order->platform_coupon_price,
|
||||
'mer_id' => $order->mer_id,
|
||||
'financial_record_sn' => $financeSn . ($i++)
|
||||
];
|
||||
$_payPrice = bcadd($_payPrice, $order->platform_coupon_price, 2);
|
||||
}
|
||||
// if ($order->platform_coupon_price > 0) {
|
||||
// $finance[] = [
|
||||
// 'order_id' => $order->order_id,
|
||||
// 'order_sn' => $order->order_sn,
|
||||
// 'user_info' => $groupOrder->user->nickname,
|
||||
// 'user_id' => $uid,
|
||||
// 'financial_type' => $isVipCoupon ? 'order_svip_coupon' : 'order_platform_coupon',
|
||||
// 'financial_pm' => 0,
|
||||
// 'type' => 1,
|
||||
// 'number' => $order->platform_coupon_price,
|
||||
// 'mer_id' => $order->mer_id,
|
||||
// 'financial_record_sn' => $financeSn . ($i++)
|
||||
// ];
|
||||
// $_payPrice = bcadd($_payPrice, $order->platform_coupon_price, 2);
|
||||
// }
|
||||
if (!$is_combine) {
|
||||
app()->make(MerchantRepository::class)->addLockMoney($order->mer_id, 'order', $order->order_id, $_payPrice);
|
||||
}
|
||||
@ -561,7 +540,7 @@ class StoreOrderRepository extends BaseRepository
|
||||
}
|
||||
}
|
||||
|
||||
public function cartByPrice($cart)
|
||||
public function cartByPrice($cart,$type=0)
|
||||
{
|
||||
if ($cart['product_type'] == '2') {
|
||||
return $cart['productPresellAttr']['presell_price'];
|
||||
@ -584,8 +563,12 @@ class StoreOrderRepository extends BaseRepository
|
||||
// } else {
|
||||
// return $cart['productAttr']['price'];
|
||||
// }
|
||||
if (in_array($cart['source'],[9,10,11,12,13])) {
|
||||
return $cart['productAttr']['procure_price'];
|
||||
if (in_array($cart['source'],[9,10,11,12,13,103])) {
|
||||
if($type==0){
|
||||
return $cart['productAttr']['price'];
|
||||
}else{
|
||||
return $cart['productAttr']['procure_price'];
|
||||
}
|
||||
} else {
|
||||
return $cart['productAttr']['price'];
|
||||
}
|
||||
@ -602,7 +585,11 @@ class StoreOrderRepository extends BaseRepository
|
||||
return $cart['productAttr']['price'];
|
||||
}
|
||||
} else {
|
||||
return $cart['productAttr']['price'];
|
||||
if($type==0){
|
||||
return $cart['productAttr']['price'];
|
||||
}else{
|
||||
return $cart['productAttr']['procure_price'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1798,7 +1785,6 @@ class StoreOrderRepository extends BaseRepository
|
||||
$arr = $this->getOrderType($status);
|
||||
$query = $this->dao->search($where)->where($arr)->where('StoreOrder.is_del', 0);
|
||||
}
|
||||
|
||||
$count = $query->count();
|
||||
$list = $query->with([
|
||||
'orderProduct',
|
||||
|
@ -373,7 +373,11 @@ class Auth extends BaseController
|
||||
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;
|
||||
}
|
||||
$data['mer_info'] = array_merge($mer_arr,$bank_info);
|
||||
if($bank_info){
|
||||
$data['mer_info'] = array_merge($mer_arr,$bank_info);
|
||||
}else{
|
||||
$data['mer_info'] =$mer_arr;
|
||||
}
|
||||
$typCode = Db::name('merchant_type')->where('mer_type_id', $mer_arr['type_id'] ?? 0)->value('type_code');
|
||||
$data['mer_info']['type_code'] = $typCode;
|
||||
$data['mer_info']['setting_status'] = 0;
|
||||
|
@ -97,7 +97,8 @@ class MerchantIntention extends BaseController
|
||||
'village' => $data['village_id'] ?? '',
|
||||
'address' => $data['address'] ?? '',
|
||||
'mer_intention_id' => $intention->mer_intention_id,
|
||||
'type_id'=>$data['mer_type_id']??''
|
||||
'type_id'=>$data['mer_type_id']??'',
|
||||
'is_company'=>$data['is_company']??'',
|
||||
];
|
||||
$postUrl = env('TASK_WORKER_HOST_URL') . '/adminapi/company/createShopMerchant';
|
||||
$res = $this->sendMerIntentionApply($sendData, $postUrl);
|
||||
@ -214,7 +215,8 @@ class MerchantIntention extends BaseController
|
||||
'cardno_front' => $data['cardno_front'] ?? '',
|
||||
'cardno_back' => $data['cardno_back'] ?? '',
|
||||
'mer_intention_id' => $intentionId,
|
||||
'type_id'=>$merInfo['type_id']??''
|
||||
'type_id'=>$merInfo['type_id']??'',
|
||||
'is_company'=>$intenInfo['is_company']??'',
|
||||
|
||||
];
|
||||
$postUrl = env('TASK_WORKER_HOST_URL') . '/adminapi/company/createShopMerchant';
|
||||
@ -311,7 +313,8 @@ class MerchantIntention extends BaseController
|
||||
'village' => $data['village_id'] ?? '',
|
||||
'address' => $data['address'] ?? '',
|
||||
'mer_intention_id' => $id,
|
||||
'type_id'=>$data['mer_type_id']??''
|
||||
'type_id'=>$data['mer_type_id']??'',
|
||||
'is_company'=>$data['is_company']??'',
|
||||
|
||||
];
|
||||
$postUrl = env('TASK_WORKER_HOST_URL') . '/adminapi/company/createShopMerchant';
|
||||
|
@ -102,22 +102,6 @@ class StoreOrder extends BaseController
|
||||
if (!($count = count($cartId)) || $count != count($cartRepository->validIntersection($cartId, $uid)))
|
||||
return app('json')->fail('数据无效');
|
||||
|
||||
if ($addressId) {
|
||||
$addressRepository = app()->make(UserAddressRepository::class);
|
||||
$address = $addressRepository->getWhere(['uid' => $uid, 'address_id' => $addressId]);
|
||||
$cartProductType = Db::name('StoreCart')->where('cart_id', $cartId[0] ?? 0)->value('product_type');
|
||||
$deliveryWay = !empty($takes) ? $takes : [];
|
||||
if ($cartProductType == 0 && count($deliveryWay) == 0) {
|
||||
$userAddressCode = ($address['province_code'] ?? '') . ',' . ($address['city_code'] ?? '') . ',' . ($address['district_code'] ?? '') . ',' . ($address['street_code'] ?? '') . ',' . ($address['village_code'] ?? '') . ',' . ($address['brigade_id'] ?? 0);
|
||||
$getUrl = env('LOGISTICS_HOST_URL') . '/api/hasCourier?user_address_code=' . $userAddressCode;
|
||||
$client = new \GuzzleHttp\Client();
|
||||
$response = $client->request('GET', $getUrl);
|
||||
$courierData = json_decode($response->getBody(), true);
|
||||
if (empty($courierData['code']) || $courierData['code'] != 1) {
|
||||
throw new ValidateException('该收货区域未设置快递员');
|
||||
}
|
||||
}
|
||||
}
|
||||
$groupOrder = app()->make(LockService::class)->exec('order.create', function () use ($orderCreateRepository, $receipt_data, $mark, $extend, $cartId, $payType, $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);
|
||||
});
|
||||
|
@ -77,16 +77,19 @@ class StoreOrderBehalf extends BaseController
|
||||
}else{
|
||||
$where['status']=['=',$status];
|
||||
}
|
||||
$column = Db::name('store_order_behalf')->where('mer_id', $mer_id)->where($where)->page($page)->limit($limit)->column('order_id');
|
||||
if ($column) {
|
||||
$where['order_id'] = $column;
|
||||
if($status==0){
|
||||
$where['status']=2;
|
||||
}elseif($status==1){
|
||||
$where['status']=3;
|
||||
}
|
||||
return app('json')->success($this->repository->getList($where, 1, 100));
|
||||
// $column = Db::name('store_order_behalf')->where('mer_id', $mer_id)->where($where)->page($page)->limit($limit)->column('order_id');
|
||||
// if ($column) {
|
||||
// $where['order_id'] = $column;
|
||||
|
||||
// }
|
||||
if ($status == 0) {
|
||||
$where['status'] = 2;
|
||||
} elseif ($status == 1) {
|
||||
$where['status'] = 3;
|
||||
}
|
||||
$where['source']=103;
|
||||
return app('json')->success($this->repository->getList($where, $page, $limit));
|
||||
|
||||
}
|
||||
return app('json')->success([]);
|
||||
}
|
||||
|
@ -33,23 +33,23 @@ class paySuccess
|
||||
try {
|
||||
$orderList = $event['groupOrder']['orderList'];
|
||||
foreach ($orderList as $k => $order) {
|
||||
$merchant = Merchant::find($order['mer_id']);
|
||||
// $merchant = Merchant::find($order['mer_id']);
|
||||
//添加到代发订单表里
|
||||
if ($merchant['type_id'] == Merchant::TypeSupplyChain) {
|
||||
$codes = explode(',', $order['user_address_code']);
|
||||
if (count($codes) > 4) {
|
||||
$merchant_two = Db::name('merchant')->where('street_id', $codes[3])->where('type_id', 17)->where('category_id', $merchant['category_id'])->find();
|
||||
if ($merchant_two) {
|
||||
$datas = [
|
||||
'master_mer_id' => $order['mer_id'],
|
||||
'mer_id' => $merchant_two['mer_id'],
|
||||
'order_id' => $order['order_id'],
|
||||
'status' => 0
|
||||
];
|
||||
Db::name('store_order_behalf')->insert($datas);
|
||||
}
|
||||
}
|
||||
}
|
||||
// if ($merchant['type_id'] == Merchant::TypeSupplyChain) {
|
||||
// $codes = explode(',', $order['user_address_code']);
|
||||
// if (count($codes) > 4) {
|
||||
// $merchant_two = Db::name('merchant')->where('street_id', $codes[3])->where('type_id', 17)->where('category_id', $merchant['category_id'])->find();
|
||||
// if ($merchant_two) {
|
||||
// $datas = [
|
||||
// 'master_mer_id' => $order['mer_id'],
|
||||
// 'mer_id' => $merchant_two['mer_id'],
|
||||
// 'order_id' => $order['order_id'],
|
||||
// 'status' => 0
|
||||
// ];
|
||||
// Db::name('store_order_behalf')->insert($datas);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
$this->recordOrderAddr($order);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
|
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/mer/js/chunk-1cbbd48a.6225e39f.js
Normal file
1
public/mer/js/chunk-1cbbd48a.6225e39f.js
Normal file
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@
|
||||
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0e276e"],{"7f8a":function(a,t,e){"use strict";e.r(t);var n=function(){var a=this,t=a.$createElement,e=a._self._c||t;return e("div",{staticClass:"divBox"},[e("el-card",{staticClass:"box-card"},[a.FormData?e("form-create",{directives:[{name:"loading",rawName:"v-loading",value:a.loading,expression:"loading"}],ref:"fc",staticClass:"formBox",attrs:{option:a.option,rule:a.FormData.rule,"handle-icon":"false"},on:{submit:a.onSubmit}}):a._e()],1)],1)},o=[],s=e("c7eb"),r=(e("96cf"),e("1da1")),c=e("30ba"),i=e.n(c),u=e("2801"),l=e("0c6d"),m=(e("83d6"),{name:"payType",data:function(){return{option:{form:{labelWidth:"150px"},global:{upload:{props:{onSuccess:function(a,t){200===a.status&&(t.url=a.data.src)}}}}},FormData:null,loading:!1}},components:{formCreate:i.a.$form()},mounted:function(){this.getFrom()},methods:{getFrom:function(){var a=this;this.loading=!0,Object(u["o"])().then(function(){var t=Object(r["a"])(Object(s["a"])().mark((function t(e){return Object(s["a"])().wrap((function(t){while(1)switch(t.prev=t.next){case 0:a.FormData=e.data,a.loading=!1;case 2:case"end":return t.stop()}}),t)})));return function(a){return t.apply(this,arguments)}}()).catch((function(t){a.$message.error(t.message),a.loading=!1}))},onSubmit:function(a){var t=this;l["a"][this.FormData.method.toLowerCase()](this.FormData.api,a).then((function(a){t.$message.success(a.message||"提交成功")})).catch((function(a){t.$message.error(a.message||"提交失败")}))}}}),d=m,f=e("2877"),p=Object(f["a"])(d,n,o,!1,null,"c11bae1c",null);t["default"]=p.exports}}]);
|
1
public/mer/js/chunk-2d0e276e.8bd71ec6.js
Normal file
1
public/mer/js/chunk-2d0e276e.8bd71ec6.js
Normal file
@ -0,0 +1 @@
|
||||
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0e276e"],{"7f8a":function(a,t,e){"use strict";e.r(t);var o=function(){var a=this,t=a.$createElement,e=a._self._c||t;return e("div",{staticClass:"divBox"},[e("el-card",{staticClass:"box-card"},[a.FormData?e("form-create",{directives:[{name:"loading",rawName:"v-loading",value:a.loading,expression:"loading"}],ref:"fc",staticClass:"formBox",attrs:{option:a.option,rule:a.FormData.rule,"handle-icon":"false"},on:{submit:a.onSubmit}}):a._e()],1)],1)},n=[],s=e("c7eb"),r=e("5530"),c=(e("96cf"),e("1da1")),i=e("30ba"),u=e.n(i),l=e("2801"),m=e("0c6d"),d=(e("83d6"),{name:"payType",data:function(){return{option:{form:{labelWidth:"150px"},global:{upload:{props:{onSuccess:function(a,t){200===a.status&&(t.url=a.data.src)}}}}},FormData:null,loading:!1}},components:{formCreate:u.a.$form()},mounted:function(){this.getFrom()},methods:{getFrom:function(){var a=this;this.loading=!0,Object(l["o"])().then(function(){var t=Object(c["a"])(Object(s["a"])().mark((function t(e){return Object(s["a"])().wrap((function(t){while(1)switch(t.prev=t.next){case 0:a.FormData=e.data,console.log(Object(r["a"])({},a.FormData)),a.loading=!1;case 3:case"end":return t.stop()}}),t)})));return function(a){return t.apply(this,arguments)}}()).catch((function(t){a.$message.error(t.message),a.loading=!1}))},onSubmit:function(a){var t=this;m["a"][this.FormData.method.toLowerCase()](this.FormData.api,a).then((function(a){t.$message.success(a.message||"提交成功")})).catch((function(a){t.$message.error(a.message||"提交失败")}))}}}),f=d,p=e("2877"),h=Object(p["a"])(f,o,n,!1,null,"333cd322",null);t["default"]=h.exports}}]);
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user