添加商品自提地址

main
ztt 8 months ago
parent 442bde91b4
commit 851813daeb
  1. 6
      addons/shopro/controller/order/Order.php
  2. 7
      addons/shopro/service/order/OrderCreate.php
  3. 19
      application/admin/model/shopro/order/WarehouseAddress.php

@ -2,6 +2,7 @@
namespace addons\shopro\controller\order; namespace addons\shopro\controller\order;
use app\admin\model\Warehouse;
use think\Db; use think\Db;
use addons\shopro\controller\Common; use addons\shopro\controller\Common;
use addons\shopro\service\order\OrderCreate; use addons\shopro\service\order\OrderCreate;
@ -122,6 +123,11 @@ class Order extends Common
$orderCreate = new OrderCreate($params); $orderCreate = new OrderCreate($params);
$result = $orderCreate->calc(); $result = $orderCreate->calc();
//添加商品自提地址
$result['zt_list'] = (new Warehouse())
->where('id', 'in', $result['goods_list'][0]['goods']['warehouse_ids'])
->select();
if (isset($result['msg']) && $result['msg']) { if (isset($result['msg']) && $result['msg']) {
$this->error($result['msg'], 1, $result); $this->error($result['msg'], 1, $result);
} else { } else {

@ -272,7 +272,9 @@ class OrderCreate
if (is_null($this->userAddress) && $this->calc_type == 'create') { if (is_null($this->userAddress) && $this->calc_type == 'create') {
$this->exception("请选择正确的收货地址"); $this->exception("请选择正确的收货地址");
} }
} else { } elseif(in_array('shopZt', $dispatchTypes)) {
} {
// 不需要收货地址 // 不需要收货地址
$this->need_address = 0; $this->need_address = 0;
} }
@ -1103,6 +1105,9 @@ class OrderCreate
$orderData['coupon_id'] = $result['coupon'] ? $result['coupon']['id'] : 0; $orderData['coupon_id'] = $result['coupon'] ? $result['coupon']['id'] : 0;
$orderData['status'] = Order::STATUS_UNPAID; $orderData['status'] = Order::STATUS_UNPAID;
$orderData['platform'] = request()->header('platform'); $orderData['platform'] = request()->header('platform');
$orderData['warehouse_id'] = 1;//添加自提地址
$ext = $result['promo_infos'] ? ['promo_infos' => $result['promo_infos']] : []; // 促销活动信息 $ext = $result['promo_infos'] ? ['promo_infos' => $result['promo_infos']] : []; // 促销活动信息
if ($this->activity['activity']) { if ($this->activity['activity']) {

@ -0,0 +1,19 @@
<?php
namespace app\admin\model\shopro\order;
use app\admin\model\shopro\Common;
class WarehouseAddress extends Common
{
protected $name = 'shopro_order_warehouse_address';
protected $type = [
];
// 追加属性
protected $append = [
];
}
Loading…
Cancel
Save