wang hou sheng 10 months ago
parent b620eb0d0d
commit 7e5e812ad3
  1. 36
      app/api/service/order/Checkout.php
  2. 8
      app/store/controller/Order.php

@ -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);
}

@ -35,6 +35,7 @@ class Order extends Controller
$data = $result->items();
if (!empty($data)) {
foreach ($data as $key => $value) {
$data[$key]['address_match_text'] = '--';
$copy_text = "订单号:{$value['order_no']}\n";
foreach ($value['goods'] as $good) {
$copy_text .= "商品名称:{$good['goods_name']}\n";
@ -56,6 +57,13 @@ class Order extends Controller
$copy_text .= "收件地址:$address{$value['address']['detail']}\n";
}
$data[$key]['copy_text'] = $copy_text;
if ($value['delivery_type'] == 10) {
if ($value['address_match'] == 20) {
$data[$key]['address_match_text'] = '匹配';
} else {
$data[$key]['address_match_text'] = '不匹配';
}
}
}
}
$list['current_page'] = $result->currentPage();

Loading…
Cancel
Save