|
|
|
@ -12,28 +12,29 @@ declare (strict_types=1); |
|
|
|
|
|
|
|
|
|
namespace app\api\service\order; |
|
|
|
|
|
|
|
|
|
use app\api\model\User as UserModel; |
|
|
|
|
use app\api\model\dealer\Order as DealerOrderModel; |
|
|
|
|
use app\api\model\Goods as GoodsModel; |
|
|
|
|
use app\api\model\Order as OrderModel; |
|
|
|
|
use app\api\model\Setting as SettingModel; |
|
|
|
|
use app\api\model\store\Module as StoreModuleModel; |
|
|
|
|
use app\api\model\store\Shop as ShopModel; |
|
|
|
|
use app\api\model\User as UserModel; |
|
|
|
|
use app\api\model\UserCoupon as UserCouponModel; |
|
|
|
|
use app\api\model\store\Module as StoreModuleModel; |
|
|
|
|
use app\api\model\dealer\Order as DealerOrderModel; |
|
|
|
|
use app\api\service\User as UserService; |
|
|
|
|
use app\api\service\user\Grade as UserGradeService; |
|
|
|
|
use app\api\model\wholesaler\Apply; |
|
|
|
|
use app\api\service\coupon\GoodsDeduct as GoodsDeductService; |
|
|
|
|
use app\api\service\points\GoodsDeduct as PointsDeductService; |
|
|
|
|
use app\api\service\order\source\checkout\Factory as CheckoutFactory; |
|
|
|
|
use app\api\service\points\GoodsDeduct as PointsDeductService; |
|
|
|
|
use app\api\service\User as UserService; |
|
|
|
|
use app\api\service\user\Grade as UserGradeService; |
|
|
|
|
use app\common\enum\order\DeliveryType as DeliveryTypeEnum; |
|
|
|
|
use app\common\enum\order\OrderSource as OrderSourceEnum; |
|
|
|
|
use app\common\enum\order\OrderStatus as OrderStatusEnum; |
|
|
|
|
use app\common\enum\order\OrderType; |
|
|
|
|
use app\common\enum\Setting as SettingEnum; |
|
|
|
|
use app\common\enum\order\OrderStatus as OrderStatusEnum; |
|
|
|
|
use app\common\enum\order\OrderSource as OrderSourceEnum; |
|
|
|
|
use app\common\enum\order\DeliveryType as DeliveryTypeEnum; |
|
|
|
|
use app\common\library\helper; |
|
|
|
|
use app\common\service\BaseService; |
|
|
|
|
use app\common\service\delivery\Express as ExpressService; |
|
|
|
|
use app\common\service\goods\source\Factory as StockFactory; |
|
|
|
|
use app\common\library\helper; |
|
|
|
|
use cores\exception\BaseException; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -761,6 +762,17 @@ class Checkout extends BaseService |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private function checkoutAddress($address) |
|
|
|
|
{ |
|
|
|
|
$info = Apply::detail(['user_id' => $this->user['user_id']]); |
|
|
|
|
if (!empty($info)) { |
|
|
|
|
$info = $info->toArray(); |
|
|
|
|
if ($info['province_id'] == $address['province_id'] && $info['city_id'] == $address['city_id']) { |
|
|
|
|
OrderModel::update(['address_match' => 20], ['order_id' => $this->model['order_id']]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 保存订单数据 (实物商品) |
|
|
|
|
* @param $order |
|
|
|
@ -771,6 +783,8 @@ class Checkout extends BaseService |
|
|
|
|
if ($order['delivery'] == DeliveryTypeEnum::EXPRESS) { |
|
|
|
|
// 记录收货地址 |
|
|
|
|
$this->saveOrderAddress($order['address']); |
|
|
|
|
//判断地址与申请采购商时地址否匹配 |
|
|
|
|
$this->checkoutAddress($order['address']); |
|
|
|
|
} elseif ($order['delivery'] == DeliveryTypeEnum::EXTRACT) { |
|
|
|
|
// 记录自提信息 |
|
|
|
|
$this->saveOrderExtract($this->param['linkman'], $this->param['phone']); |
|
|
|
@ -884,7 +898,7 @@ class Checkout extends BaseService |
|
|
|
|
{ |
|
|
|
|
$totalCostPrice = 0; |
|
|
|
|
foreach ($goodsList as $goods) { |
|
|
|
|
$totalCostPrice +=$goods['skuInfo']['cost_price']; |
|
|
|
|
$totalCostPrice += $goods['skuInfo']['cost_price']; |
|
|
|
|
} |
|
|
|
|
return helper::number2($totalCostPrice); |
|
|
|
|
} |
|
|
|
|