修复:供应商管理后台 - 订单相关接口报错处理,可以显示部分数据

This commit is contained in:
wuhui_zzw 2024-01-09 14:44:32 +08:00
parent 8f61b74200
commit fbb76380c0
30 changed files with 269 additions and 201 deletions

View File

@ -299,4 +299,17 @@ abstract class BaseDao
$query->where('is_del', $isDel);
})->count($this->getPk()) > 0;
}
/**
* 读取数据条数
* @param array $where
* @return int
*/
public function count(array $where = []): int
{
return $this->search($where)->count();
}
}

View File

@ -955,4 +955,43 @@ class StoreOrderDao extends BaseDao
$query->where($field, $val);
})->count();
}
/**
* 订单搜索列表
* @param array $where
* @param array $field
* @param int $page
* @param int $limit
* @param array $with
* @param string $order
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getOrderList(array $where, array $field, int $page = 0, int $limit = 0, array $with = [], string $order = 'create_time DESC,order_id DESC')
{
$data = $this->search($where)
// ->field($field)
->with(array_merge(['user','spread','refund'],$with))
->when($page && $limit,function($query) use ($page,$limit){
$query->page($page,$limit);
})
->when(!$page && $limit,function($query) use ($limit){
$query->limit($limit);
})
->order($order)
->select()
->toArray();
return $data;
}
}

View File

@ -32,11 +32,12 @@ class SupplierCheckRoleMiddleware implements MiddlewareInterface
if (!$request->supplierId() || !$request->supplierInfo())
throw new AuthException(ApiErrorCode::ERR_ADMINID_VOID);
if ($request->supplierInfo()['level'] ?? 0) {
/** @var LoginServices $services */
$services = app()->make(LoginServices::class);
$services->verifiAuth($request);
}
// 供应商不做验证
// if ($request->supplierInfo()['level'] ?? 0) {
// /** @var LoginServices $services */
// $services = app()->make(LoginServices::class);
// $services->verifiAuth($request);
// }
return $next($request);
}

View File

@ -43,6 +43,12 @@ class StoreOrder extends BaseModel
return $this->hasMany(StoreRefundOrder::class,'order_id','order_id');
}
public function refund()
{
return $this->hasMany(StoreRefundOrder::class,'order_id','order_id');
}
public function orderStatus()
{
return $this->hasMany(StoreOrderStatus::class,'order_id','order_id')->order('change_time DESC');

View File

@ -1,13 +1,4 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\controller\supplier;

View File

@ -1,13 +1,4 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\controller\supplier;
use app\common\controller\Order as CommonOrder;
@ -29,6 +20,8 @@ class Order extends AuthController
use CommonOrder;
protected $orderServices;
protected $supplierOrderServices;
/**
* Order constructor.
@ -69,9 +62,15 @@ class Order extends AuthController
$where['pid'] = 0;
}
$where['supplier_id'] = $this->supplierId;
return $this->success($this->services->getOrderList($where, ['*'], ['split' => function ($query) {
$query->field('id,pid');
}, 'pink', 'invoice']));
$data = $this->services->getOrderList($where,['*'],[
// 'split' => function($query){
// $query->field('id,pid');
// },
// 'pink',
// 'invoice'
]);
return app('json')->success('',$data);
}
/**

View File

@ -51,7 +51,8 @@ class Refund extends AuthController
['refund_type', 0]
]);
$where['supplier_id'] = $this->supplierId;
return $this->success($this->services->refundList($where));
return app('json')->success('',$this->services->refundList($where));
}
/**

View File

@ -47,7 +47,8 @@ class Queue extends AuthController
['limit', 20],
]);
$data = $this->services->getList($where);
return $this->success($data);
return app('json')->success('',$data);
}
/**

View File

@ -921,23 +921,23 @@ class StoreBargainServices extends BaseServices
$item['status'] = '已删除';
} else if ($item['paid'] == 0 && $item['status'] == 0) {
$item['status'] = '未支付';
} else if ($item['paid'] == 1 && $item['status'] == 4 && in_array($item['shipping_type'], [1, 3]) && $item['refund_status'] == 0) {
} else if ($item['paid'] == 1 && $item['status'] == 4 && in_array($item['delivery_type'], [1, 3]) && $item['refund_status'] == 0) {
$item['status'] = '部分发货';
} else if ($item['paid'] == 1 && $item['refund_status'] == 2) {
$item['status'] = '已退款';
} else if ($item['paid'] == 1 && $item['status'] == 5 && $item['refund_status'] == 0) {
$item['status'] = $item['shipping_type'] == 2 ? '部分核销' : '部分收货';
$item['status'] = $item['delivery_type'] == 2 ? '部分核销' : '部分收货';
$item['_status'] = 12;//已支付 部分核销
} else if ($item['paid'] == 1 && $item['refund_status'] == 1) {
$item['status'] = '申请退款';
} else if ($item['paid'] == 1 && $item['refund_status'] == 4) {
$item['status'] = '退款中';
} else if ($item['paid'] == 1 && $item['status'] == 0 && in_array($item['shipping_type'], [1, 3]) && $item['refund_status'] == 0) {
} else if ($item['paid'] == 1 && $item['status'] == 0 && in_array($item['delivery_type'], [1, 3]) && $item['refund_status'] == 0) {
$item['status'] = '未发货';
$item['_status'] = 2;//已支付 未发货
} else if ($item['paid'] == 1 && in_array($item['status'], [0, 1]) && $item['shipping_type'] == 2 && $item['refund_status'] == 0) {
} else if ($item['paid'] == 1 && in_array($item['status'], [0, 1]) && $item['delivery_type'] == 2 && $item['refund_status'] == 0) {
$item['status'] = '未核销';
} else if ($item['paid'] == 1 && in_array($item['status'], [1, 5]) && in_array($item['shipping_type'], [1, 3]) && $item['refund_status'] == 0) {
} else if ($item['paid'] == 1 && in_array($item['status'], [1, 5]) && in_array($item['delivery_type'], [1, 3]) && $item['refund_status'] == 0) {
$item['status'] = '待收货';
} else if ($item['paid'] == 1 && $item['status'] == 2 && $item['refund_status'] == 0) {
$item['status'] = '待评价';

View File

@ -102,14 +102,14 @@ class UserCollagePartakeServices extends BaseServices
* @param int $uid
* @param array $cartList
* @param array $addr
* @param int $shipping_type
* @param int $delivery_type
* @param int $store_id
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function handleCartList(int $uid, array $cartList, int $shipping_type = 1, int $store_id = 0)
public function handleCartList(int $uid, array $cartList, int $delivery_type = 1, int $store_id = 0)
{
if (!$cartList) {
return [$cartList, [], [], [], 0, [], []];
@ -232,7 +232,7 @@ class UserCollagePartakeServices extends BaseServices
$valid[] = $item;
} else {
$condition = !in_array(isset($item['productInfo']['product_id']) ? $item['productInfo']['product_id'] : $item['productInfo']['id'], $productIds) || $item['cart_num'] > ($allStock[$attrUniquesArr[$item['product_attr_unique']] ?? ''] ?? 0);
switch ($shipping_type) {
switch ($delivery_type) {
case -1://购物车列表展示
if ($isBranchProduct && $store_id && ($store_id != $product_store_id || !in_array(3, $item['productInfo']['delivery_type']))) {
$item['is_valid'] = 0;

View File

@ -97,18 +97,18 @@ class UserCollageServices extends BaseServices
* @param int $uid
* @param int $store_id
* @param int $address_id
* @param int $shipping_type
* @param int $delivery_type
* @return \crmeb\basic\BaseModel|\think\Model
*/
public function setUserCollage(int $uid, int $store_id, int $address_id, int $shipping_type)
public function setUserCollage(int $uid, int $store_id, int $address_id, int $delivery_type)
{
if ($this->dao->be(['uid' => $uid, 'type' => 9, 'store_id' => $store_id, 'address_id' => $address_id, 'shipping_type' => $shipping_type, 'status' => [0, 1]])) throw new ValidateException('您已在拼单中,不能再次拼单!');
if ($this->dao->be(['uid' => $uid, 'type' => 9, 'store_id' => $store_id, 'address_id' => $address_id, 'delivery_type' => $delivery_type, 'status' => [0, 1]])) throw new ValidateException('您已在拼单中,不能再次拼单!');
$data = [
'uid' => $uid,
'type' => 9,
'store_id' => $store_id,
'address_id' => $address_id,
'shipping_type' => $shipping_type,
'delivery_type' => $delivery_type,
'add_time' => time()
];
$res = $this->dao->save($data);

View File

@ -751,23 +751,23 @@ class StoreCombinationServices extends BaseServices
$item['status'] = '已删除';
} else if ($item['paid'] == 0 && $item['status'] == 0) {
$item['status'] = '未支付';
} else if ($item['paid'] == 1 && $item['status'] == 4 && in_array($item['shipping_type'], [1, 3]) && $item['refund_status'] == 0) {
} else if ($item['paid'] == 1 && $item['status'] == 4 && in_array($item['delivery_type'], [1, 3]) && $item['refund_status'] == 0) {
$item['status'] = '部分发货';
} else if ($item['paid'] == 1 && $item['refund_status'] == 2) {
$item['status'] = '已退款';
} else if ($item['paid'] == 1 && $item['status'] == 5 && $item['refund_status'] == 0) {
$item['status'] = $item['shipping_type'] == 2 ? '部分核销' : '部分收货';
$item['status'] = $item['delivery_type'] == 2 ? '部分核销' : '部分收货';
$item['_status'] = 12;//已支付 部分核销
} else if ($item['paid'] == 1 && $item['refund_status'] == 1) {
$item['status'] = '申请退款';
} else if ($item['paid'] == 1 && $item['refund_status'] == 4) {
$item['status'] = '退款中';
} else if ($item['paid'] == 1 && $item['status'] == 0 && in_array($item['shipping_type'], [1, 3]) && $item['refund_status'] == 0) {
} else if ($item['paid'] == 1 && $item['status'] == 0 && in_array($item['delivery_type'], [1, 3]) && $item['refund_status'] == 0) {
$item['status'] = '未发货';
$item['_status'] = 2;//已支付 未发货
} else if ($item['paid'] == 1 && in_array($item['status'], [0, 1]) && $item['shipping_type'] == 2 && $item['refund_status'] == 0) {
} else if ($item['paid'] == 1 && in_array($item['status'], [0, 1]) && $item['delivery_type'] == 2 && $item['refund_status'] == 0) {
$item['status'] = '未核销';
} else if ($item['paid'] == 1 && in_array($item['status'], [1, 5]) && in_array($item['shipping_type'], [1, 3]) && $item['refund_status'] == 0) {
} else if ($item['paid'] == 1 && in_array($item['status'], [1, 5]) && in_array($item['delivery_type'], [1, 3]) && $item['refund_status'] == 0) {
$item['status'] = '待收货';
} else if ($item['paid'] == 1 && $item['status'] == 2 && $item['refund_status'] == 0) {
$item['status'] = '待评价';

View File

@ -664,7 +664,7 @@ class StoreCouponIssueServices extends BaseServices
* @param int $uid
* @param $cartId
* @param bool $new
* @param int $shipping_type
* @param int $delivery_type
* @param int $store_id
* @return array
* @throws \Psr\SimpleCache\InvalidArgumentException
@ -672,11 +672,11 @@ class StoreCouponIssueServices extends BaseServices
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function beUsableCouponList(int $uid, $cartId, bool $new, int $shipping_type = 1, int $store_id = 0)
public function beUsableCouponList(int $uid, $cartId, bool $new, int $delivery_type = 1, int $store_id = 0)
{
/** @var StoreCartServices $services */
$services = app()->make(StoreCartServices::class);
$cartGroup = $services->getUserProductCartListV1($uid, $cartId, $new, [], $shipping_type, $store_id);
$cartGroup = $services->getUserProductCartListV1($uid, $cartId, $new, [], $delivery_type, $store_id);
/** @var StoreCouponUserServices $coupServices */
$coupServices = app()->make(StoreCouponUserServices::class);
return $coupServices->getUsableCouponList($uid, $cartGroup, $store_id);

View File

@ -874,23 +874,23 @@ class StoreSeckillServices extends BaseServices
$item['status'] = '已删除';
} else if ($item['paid'] == 0 && $item['status'] == 0) {
$item['status'] = '未支付';
} else if ($item['paid'] == 1 && $item['status'] == 4 && in_array($item['shipping_type'], [1, 3]) && $item['refund_status'] == 0) {
} else if ($item['paid'] == 1 && $item['status'] == 4 && in_array($item['delivery_type'], [1, 3]) && $item['refund_status'] == 0) {
$item['status'] = '部分发货';
} else if ($item['paid'] == 1 && $item['refund_status'] == 2) {
$item['status'] = '已退款';
} else if ($item['paid'] == 1 && $item['status'] == 5 && $item['refund_status'] == 0) {
$item['status'] = $item['shipping_type'] == 2 ? '部分核销' : '部分收货';
$item['status'] = $item['delivery_type'] == 2 ? '部分核销' : '部分收货';
$item['_status'] = 12;//已支付 部分核销
} else if ($item['paid'] == 1 && $item['refund_status'] == 1) {
$item['status'] = '申请退款';
} else if ($item['paid'] == 1 && $item['refund_status'] == 4) {
$item['status'] = '退款中';
} else if ($item['paid'] == 1 && $item['status'] == 0 && in_array($item['shipping_type'], [1, 3]) && $item['refund_status'] == 0) {
} else if ($item['paid'] == 1 && $item['status'] == 0 && in_array($item['delivery_type'], [1, 3]) && $item['refund_status'] == 0) {
$item['status'] = '未发货';
$item['_status'] = 2;//已支付 未发货
} else if ($item['paid'] == 1 && in_array($item['status'], [0, 1]) && $item['shipping_type'] == 2 && $item['refund_status'] == 0) {
} else if ($item['paid'] == 1 && in_array($item['status'], [0, 1]) && $item['delivery_type'] == 2 && $item['refund_status'] == 0) {
$item['status'] = '未核销';
} else if ($item['paid'] == 1 && in_array($item['status'], [1, 5]) && in_array($item['shipping_type'], [1, 3]) && $item['refund_status'] == 0) {
} else if ($item['paid'] == 1 && in_array($item['status'], [1, 5]) && in_array($item['delivery_type'], [1, 3]) && $item['refund_status'] == 0) {
$item['status'] = '待收货';
} else if ($item['paid'] == 1 && $item['status'] == 2 && $item['refund_status'] == 0) {
$item['status'] = '待评价';

View File

@ -117,7 +117,7 @@ class StoreCartServices extends BaseServices
* @param $cartIds
* @param bool $new
* @param array $addr
* @param int $shipping_type
* @param int $delivery_type
* @param int $store_id
* @param int $coupon_id
* @param bool $isCart
@ -127,7 +127,7 @@ class StoreCartServices extends BaseServices
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getUserProductCartListV1(int $uid, $cartIds, bool $new, array $addr = [], int $shipping_type = 1, int $store_id = 0, int $coupon_id = 0, bool $isCart = false)
public function getUserProductCartListV1(int $uid, $cartIds, bool $new, array $addr = [], int $delivery_type = 1, int $store_id = 0, int $coupon_id = 0, bool $isCart = false)
{
if ($new) {
$cartIds = $cartIds && is_string($cartIds) ? explode(',', $cartIds) : (is_array($cartIds) ? $cartIds : []);
@ -153,7 +153,7 @@ class StoreCartServices extends BaseServices
}
}
[$cartInfo, $valid, $invalid] = $this->handleCartList($uid, $cartInfo, $addr, $shipping_type, $store_id);
[$cartInfo, $valid, $invalid] = $this->handleCartList($uid, $cartInfo, $addr, $delivery_type, $store_id);
$type = array_unique(array_column($cartInfo, 'type'));
$product_type = array_unique(array_column($cartInfo, 'product_type'));
$activity_id = array_unique(array_column($cartInfo, 'activity_id'));
@ -574,7 +574,7 @@ class StoreCartServices extends BaseServices
* @param array $cartIds
* @param int $storeId
* @param int $staff_id
* @param int $shipping_type
* @param int $delivery_type
* @param int $touristUid
* @param int $numType
* @param bool $new
@ -584,7 +584,7 @@ class StoreCartServices extends BaseServices
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getUserCartList(int $uid, int $status, array $cartIds = [], int $storeId = 0, int $staff_id = 0, int $shipping_type = -1, int $touristUid = 0, int $numType = 0, bool $new = false, bool $isCart = true)
public function getUserCartList(int $uid, int $status, array $cartIds = [], int $storeId = 0, int $staff_id = 0, int $delivery_type = -1, int $touristUid = 0, int $numType = 0, bool $new = false, bool $isCart = true)
{
// [$page, $limit] = $this->getPageValue();
if ($new) {
@ -611,7 +611,7 @@ class StoreCartServices extends BaseServices
$count = $promotionsPrice = $coupon_price = $firstOrderPrice = 0;
$cartList = $valid = $promotions = $coupon = $invalid = $type = $activity_id = [];
if ($list) {
[$list, $valid, $invalid] = $this->handleCartList($uid, $list, [], $shipping_type, $storeId);
[$list, $valid, $invalid] = $this->handleCartList($uid, $list, [], $delivery_type, $storeId);
$activity_id = array_unique(array_column($list, 'activity_id'));
$type = array_unique(array_column($list, 'type'));
@ -844,14 +844,14 @@ class StoreCartServices extends BaseServices
* @param int $uid
* @param array $cartList
* @param array $addr
* @param int $shipping_type
* @param int $delivery_type
* @param int $store_id
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function handleCartList(int $uid, array $cartList, array $addr = [], int $shipping_type = 1, int $store_id = 0)
public function handleCartList(int $uid, array $cartList, array $addr = [], int $delivery_type = 1, int $store_id = 0)
{
if (!$cartList) {
return [$cartList, [], [], [], 0, [], []];
@ -881,7 +881,7 @@ class StoreCartServices extends BaseServices
}
}
//不送达运费模板
if ($shipping_type == 1 && $addr) {
if ($delivery_type == 1 && $addr) {
$cityId = (int)($addr['city_id'] ?? 0);
if ($cityId) {
/** @var CityAreaServices $cityAreaServices */
@ -1054,7 +1054,7 @@ class StoreCartServices extends BaseServices
$invalid[] = $item;
} else {
$condition = !in_array(isset($item['productInfo']['product_id']) ? $item['productInfo']['product_id'] : $item['productInfo']['id'], $productIds) || $item['cart_num'] > ($allStock[$attrUniquesArr[$item['product_attr_unique']] ?? ''] ?? 0);
switch ($shipping_type) {
switch ($delivery_type) {
case -1://购物车列表展示
if ($isBranchProduct && $store_id && ($store_id != $product_store_id)) {
$item['is_valid'] = 0;
@ -1419,7 +1419,7 @@ class StoreCartServices extends BaseServices
* @param $cartId
* @param bool $new
* @param int $addressId
* @param int $shipping_type
* @param int $delivery_type
* @param int $store_id
* @return array
* @throws \Psr\SimpleCache\InvalidArgumentException
@ -1428,7 +1428,7 @@ class StoreCartServices extends BaseServices
* @throws \think\db\exception\ModelNotFoundException
* @throws \throwable
*/
public function computeUserCart(array $user, $cartId, bool $new, int $addressId, int $shipping_type = 1, int $store_id = 0)
public function computeUserCart(array $user, $cartId, bool $new, int $addressId, int $delivery_type = 1, int $store_id = 0)
{
$addr = $data = [];
$uid = (int)$user['uid'];
@ -1456,7 +1456,7 @@ class StoreCartServices extends BaseServices
$storeServices->getStoreInfo($store_id);
}
//获取购物车信息
$cartGroup = $this->getUserProductCartListV1($uid, $cartId, $new, $addr, $shipping_type, $store_id, 0, true);
$cartGroup = $this->getUserProductCartListV1($uid, $cartId, $new, $addr, $delivery_type, $store_id, 0, true);
$storeFreePostage = floatval(sys_config('store_free_postage')) ?: 0;//满额包邮金额
$valid = $cartGroup['valid'] ?? [];
/** @var StoreOrderComputedServices $computedServices */

View File

@ -392,7 +392,7 @@ class StoreOrderComputedServices extends BaseServices
/**
* 计算邮费
* @param int $shipping_type
* @param int $delivery_type
* @param string $payType
* @param array $cartInfo
* @param array $addr
@ -402,7 +402,7 @@ class StoreOrderComputedServices extends BaseServices
* @param array $userInfo
* @return array
*/
public function computedPayPostage(int $shipping_type, string $payType, array $cartInfo, array $addr, string $payPrice, array $postage = [], array $other, $userInfo = [])
public function computedPayPostage(int $delivery_type, string $payType, array $cartInfo, array $addr, string $payPrice, array $postage = [], array $other, $userInfo = [])
{
$storePostageDiscount = 0;
$storeFreePostage = $postage['storeFreePostage'] ?? 0;
@ -413,12 +413,12 @@ class StoreOrderComputedServices extends BaseServices
if (!$addr && !isset($addr['id']) || !$cartInfo) {
$payPostage = 0;
} else {
//$shipping_type = 1 快递发货 $shipping_type = 2 门店自提
if ($shipping_type == 2) {
if (!sys_config('store_func_status', 1) || !sys_config('store_self_mention', 1)) $shipping_type = 1;
//$delivery_type = 1 快递发货 $delivery_type = 2 门店自提
if ($delivery_type == 2) {
if (!sys_config('store_func_status', 1) || !sys_config('store_self_mention', 1)) $delivery_type = 1;
}
//门店自提 || (线下支付 && 线下支付包邮) 没有邮费支付
if ($shipping_type === 2 || ($payType == 'offline' && ((isset($other['offlinePostage']) && $other['offlinePostage']) || sys_config('offline_postage')) == 1)) {
if ($delivery_type === 2 || ($payType == 'offline' && ((isset($other['offlinePostage']) && $other['offlinePostage']) || sys_config('offline_postage')) == 1)) {
$payPostage = 0;
} else {
if (!$postage || !isset($postage['storePostage']) || !isset($postage['storePostageDiscount'])) {

View File

@ -180,7 +180,7 @@ class StoreOrderCreateServices extends BaseServices
if ($status >= 2) throw new ValidateException($type == 10 ? '桌码' : '拼单' . '已生成订单!');
$activity_id = $collate_code_id;
}
//$shipping_type = 1 快递发货 $shipping_type = 2 门店自提
//$delivery_type = 1 快递发货 $delivery_type = 2 门店自提
if (!sys_config('store_func_status', 1) || !sys_config('store_self_mention', 1)) $shippingType = 1;
$userAddress = $addressInfo['province'] . ' ' . $addressInfo['city'] . ' ' . $addressInfo['district'] . ' ' . $addressInfo['street'] . ' ' . $addressInfo['detail'];
@ -216,7 +216,7 @@ class StoreOrderCreateServices extends BaseServices
'is_channel' => $isChannel,
'add_time' => time(),
'unique' => $key,
'shipping_type' => $shippingType,
'delivery_type' => $shippingType,
'channel_type' => $userInfo['user_type'],
'province' => '',
'spread_uid' => 0,

View File

@ -65,7 +65,7 @@ class StoreOrderDeliveryServices extends BaseServices
if ($orderInfo->status == 1) {
throw new ValidateException('订单已发货请勿重复操作!');
}
if ($orderInfo->shipping_type == 2) {
if ($orderInfo->delivery_type == 2) {
throw new ValidateException('核销订单不能发货!');
}
if (isset($orderInfo['pinkStatus']) && $orderInfo['pinkStatus'] != 2) {
@ -133,7 +133,7 @@ class StoreOrderDeliveryServices extends BaseServices
if ($orderInfo->is_del) {
throw new ValidateException('订单已删除,不能发货!');
}
if ($orderInfo->shipping_type == 2) {
if ($orderInfo->delivery_type == 2) {
throw new ValidateException('核销订单不能发货!');
}
if (isset($orderInfo['pinkStatus']) && $orderInfo['pinkStatus'] != 2) {
@ -534,7 +534,7 @@ class StoreOrderDeliveryServices extends BaseServices
$orderService = app()->make(StoreOrderServices::class);
$orderInfo = $orderService->getOne(['id' => $orderId]);
if (!$orderInfo) throw new ValidateException('订单不存在');
if (in_array($orderInfo->shipping_type, [2, 4])) throw new ValidateException('订单无法打印');
if (in_array($orderInfo->delivery_type, [2, 4])) throw new ValidateException('订单无法打印');
if (!$orderInfo->express_dump) throw new ValidateException('请先发货');
if (!sys_config('config_export_open', 0)) {
throw new ValidateException('请先在系统设置中打开单子面单打印开关');

View File

@ -82,7 +82,7 @@ class StoreOrderRefundServices extends BaseServices
}
[$page, $limit] = $this->getPageValue();
$with = array_merge($with, ['order' => function ($query) {
$query->field('id,shipping_type')->bind(['shipping_type']);
$query->field('id,delivery_type')->bind(['delivery_type']);
}]);
$list = $this->dao->getRefundList($where, '*', $with, $page, $limit);
$count = $this->dao->count($where);
@ -106,7 +106,7 @@ class StoreOrderRefundServices extends BaseServices
$item['total_num'] = $item['refund_num'];
$item['pay_price'] = $item['refund_price'];
$item['pay_postage'] = 0;
if (isset($item['shipping_type']) && !in_array($item['shipping_type'], [2, 4])) {
if (isset($item['delivery_type']) && !in_array($item['delivery_type'], [2, 4])) {
$item['pay_postage'] = floatval($this->getOrderSumPrice($item['cart_info'], 'postage_price', false));
}
$item['status_name'] = [
@ -246,7 +246,7 @@ class StoreOrderRefundServices extends BaseServices
foreach ($cartInfos as $cart) {
$_info = is_string($cart['cart_info']) ? json_decode($cart['cart_info'], true) : $cart['cart_info'];
$total_price = bcadd((string)$total_price, bcmul((string)($_info['truePrice'] ?? 0), (string)$cart['cart_num'], 4), 2);
if (!in_array($order['shipping_type'], [2, 4])) {
if (!in_array($order['delivery_type'], [2, 4])) {
$pay_postage = bcadd((string)$pay_postage, (string)($_info['postage_price'] ?? 0), 2);
}
}
@ -386,7 +386,7 @@ class StoreOrderRefundServices extends BaseServices
foreach ($cartInfos as $cart) {
$_info = is_string($cart['cart_info']) ? json_decode($cart['cart_info'], true) : $cart['cart_info'];
$total_price = bcadd((string)$total_price, bcmul((string)($_info['truePrice'] ?? 0), (string)$cart['cart_num'], 4), 2);
if (!in_array($order['shipping_type'], [2, 4])) {
if (!in_array($order['delivery_type'], [2, 4])) {
$pay_postage = bcadd((string)$pay_postage, (string)($_info['postage_price'] ?? 0), 2);
}
}
@ -1229,7 +1229,7 @@ class StoreOrderRefundServices extends BaseServices
$orderData['vip_true_price'] = $vipTruePrice;
$orderData['postage_price'] = 0;
$orderData['pay_postage'] = 0;
if (!in_array($orderInfo['shipping_type'], [2, 4])) {
if (!in_array($orderInfo['delivery_type'], [2, 4])) {
$orderData['pay_postage'] = $this->getOrderSumPrice($orderData['cart_info'], 'postage_price', false);
}
$orderData['member_price'] = 0;
@ -1298,7 +1298,7 @@ class StoreOrderRefundServices extends BaseServices
'refund_phone' => $refund_phone,
'refund_address' => $refund_address,
];
$orderData['shipping_type'] = $orderInfo['shipping_type'];
$orderData['delivery_type'] = $orderInfo['delivery_type'];
$orderData['real_name'] = $orderInfo['real_name'];
$orderData['user_phone'] = $orderInfo['user_phone'];
$orderData['user_address'] = $orderInfo['user_address'];

View File

@ -135,11 +135,13 @@ class StoreOrderServices extends BaseServices
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getOrderList(array $where, array $field = ['*'], array $with = [], bool $abridge = false, string $order = 'add_time DESC,id DESC')
public function getOrderList(array $where, array $field = ['*'], array $with = [], bool $abridge = false, string $order = 'create_time DESC,order_id DESC')
{
[$page, $limit] = $this->getPageValue();
$data = $this->dao->getOrderList($where, $field, $page, $limit, $with, $order);
$count = $this->dao->count($where);
// debug([$count, $data]);
$stat = [];
$batch_url = "file/upload/1";
if ($data) {
@ -159,7 +161,7 @@ class StoreOrderServices extends BaseServices
foreach ($cartInfos as $cart) {
$_info = is_string($cart['cart_info']) ? json_decode($cart['cart_info'], true) : $cart['cart_info'];
$total_price = bcadd((string)$total_price, bcmul((string)($_info['truePrice'] ?? 0), (string)$cart['cart_num'], 4), 2);
if (!in_array($item['shipping_type'], [2, 4])) {
if (!in_array($item['delivery_type'], [2, 4])) {
$pay_postage = bcadd((string)$pay_postage, (string)($_info['postage_price'] ?? 0), 2);
}
}
@ -434,7 +436,7 @@ class StoreOrderServices extends BaseServices
$status['_class'] = 'state-ysh';
}
} elseif ($order['status'] == 5) {
if ($order['shipping_type'] == 2) {
if ($order['delivery_type'] == 2) {
$status['_type'] = 5;
$status['_title'] = '部分核销';
$status['_msg'] = '部分核销,请继续进行核销';
@ -456,7 +458,7 @@ class StoreOrderServices extends BaseServices
$status['_title'] = '申请退款中';
$status['_msg'] = '商家同意退款,请填写退货订单号';
$status['_class'] = 'state-sqtk';
if ($order['shipping_type'] == 1 || !$storeInfo) {//平台
if ($order['delivery_type'] == 1 || !$storeInfo) {//平台
$status['refund_name'] = sys_config('refund_name', '');
$status['refund_phone'] = sys_config('refund_phone', '');
$status['refund_address'] = sys_config('refund_address', '');
@ -470,7 +472,7 @@ class StoreOrderServices extends BaseServices
$status['_title'] = '申请退款中';
$status['_msg'] = '等待商家收货';
$status['_class'] = 'state-sqtk';
if ($order['shipping_type'] == 1 || !$storeInfo) {//平台
if ($order['delivery_type'] == 1 || !$storeInfo) {//平台
$status['refund_name'] = sys_config('refund_name', '');
$status['refund_phone'] = sys_config('refund_phone', '');
$status['refund_address'] = sys_config('refund_address', '');
@ -499,7 +501,7 @@ class StoreOrderServices extends BaseServices
$status['_title'] = '拼团中';
$status['_msg'] = '等待其他人参加拼团';
$status['_class'] = 'state-nfh';
} else if (in_array($order['shipping_type'], [1, 3])) {
} else if (in_array($order['delivery_type'], [1, 3])) {
$status['_type'] = 1;
$status['_title'] = '未发货';
$status['_msg'] = '商家未发货,请耐心等待';
@ -511,7 +513,7 @@ class StoreOrderServices extends BaseServices
$status['_class'] = 'state-nfh';
}
} else {
if (in_array($order['shipping_type'], [1, 3])) {
if (in_array($order['delivery_type'], [1, 3])) {
$status['_type'] = 1;
$status['_title'] = '未发货';
$status['_msg'] = '商家未发货,请耐心等待';
@ -599,53 +601,54 @@ class StoreOrderServices extends BaseServices
public function tidyOrderType($order, bool $abridge = false)
{
$pink_name = $color = '';
if ($order && isset($order['type'])) {
switch ($order['type']) {
// 1:秒杀 2:预售 3:助力 10:套餐
if ($order && isset($order['activity_type'])) {
switch ($order['activity_type']) {
case 0://普通订单
if ($order['shipping_type'] == 1) {
// if ($order['delivery_type'] == 1) {
$pink_name = $abridge ? '普通' : '[普通订单]';
$color = '#895612';
} else if ($order['shipping_type'] == 2) {
$pink_name = $abridge ? '核销' : '[核销订单]';
$color = '#8956E8';
} else if ($order['shipping_type'] == 3) {
$pink_name = $abridge ? '分配' : '[分配订单]';
$color = '#FFA21B';
} else if ($order['shipping_type'] == 4) {
$pink_name = $abridge ? '收银' : '[收银订单]';
$color = '#2EC479';
}
// } else if ($order['delivery_type'] == 2) {
// $pink_name = $abridge ? '核销' : '[核销订单]';
// $color = '#8956E8';
// } else if ($order['delivery_type'] == 3) {
// $pink_name = $abridge ? '分配' : '[分配订单]';
// $color = '#FFA21B';
// } else if ($order['delivery_type'] == 4) {
// $pink_name = $abridge ? '收银' : '[收银订单]';
// $color = '#2EC479';
// }
break;
case 1://秒杀
$pink_name = $abridge ? '秒杀' : '[秒杀订单]';
$color = '#32c5e9';
break;
case 2://砍价
$pink_name = $abridge ? '砍价' : '[砍价订单]';
case 2://预售
$pink_name = $abridge ? '预售' : '[预售订单]';
$color = '#12c5e9';
break;
case 3://拼团
case 3://助力
if (isset($order['pinkStatus'])) {
switch ($order['pinkStatus']) {
case 1:
$pink_name = $abridge ? '拼团' : '[拼团订单]正在进行中';
$pink_name = $abridge ? '助力' : '[助力订单]正在进行中';
$color = '#f00';
break;
case 2:
$pink_name = $abridge ? '拼团' : '[拼团订单]已完成';
$pink_name = $abridge ? '助力' : '[助力订单]已完成';
$color = '#00f';
break;
case 3:
$pink_name = $abridge ? '拼团' : '[拼团订单]未完成';
$pink_name = $abridge ? '助力' : '[助力订单]未完成';
$color = '#f0f';
break;
default:
$pink_name = $abridge ? '拼团' : '[拼团订单]历史订单';
$pink_name = $abridge ? '助力' : '[助力订单]历史订单';
$color = '#457856';
break;
}
} else {
$pink_name = $abridge ? '拼团' : '[拼团订单]历史订单';
$pink_name = $abridge ? '助力' : '[助力订单]历史订单';
$color = '#457856';
}
break;
@ -673,8 +676,8 @@ class StoreOrderServices extends BaseServices
$pink_name = $abridge ? '拼单' : '[拼单订单]';
$color = '#12c5e9';
break;
case 10://桌码
$pink_name = $abridge ? '桌码' : '[桌码订单]';
case 10://套餐
$pink_name = $abridge ? '套餐' : '[套餐订单]';
$color = '#F5222D';
break;
}
@ -696,10 +699,10 @@ class StoreOrderServices extends BaseServices
/** @var StoreOrderCartInfoServices $services */
$services = app()->make(StoreOrderCartInfoServices::class);
foreach ($data as &$item) {
if ($is_cart_info) $item['_info'] = $services->getOrderCartInfo((int)$item['id']);
$item['add_time'] = date('Y-m-d H:i:s', $item['add_time']);
$item['_refund_time'] = isset($item['refund_reason_time']) && $item['refund_reason_time'] ? date('Y-m-d H:i:s', $item['refund_reason_time']) : '';
$item['_pay_time'] = isset($item['pay_time']) && $item['pay_time'] ? date('Y-m-d H:i:s', $item['pay_time']) : '';
if ($is_cart_info) $item['_info'] = $services->getOrderCartInfo((int)$item['order_id']);
// $item['add_time'] = date('Y-m-d H:i:s', $item['create_time']);
// $item['_refund_time'] = isset($item['refund_reason_time']) && $item['refund_reason_time'] ? date('Y-m-d H:i:s', $item['refund_reason_time']) : '';
// $item['_pay_time'] = isset($item['pay_time']) && $item['pay_time'] ? date('Y-m-d H:i:s', $item['pay_time']) : '';
[$pink_name, $color] = $this->tidyOrderType($item, $abridge);
$item['pink_name'] = $pink_name;
$item['color'] = $color;
@ -739,69 +742,83 @@ class StoreOrderServices extends BaseServices
if($item['is_del'] || $item['is_system_del']){
$status_name['status_name'] = '已删除';
$item['_status'] = -1;
} else if ($item['paid'] == 0 && $item['status'] == 0) {
}
elseif($item['paid'] == 0 && $item['status'] == 0){
$status_name['status_name'] = '未支付';
$item['_status'] = 1;//未支付
} else if ($item['paid'] == 1 && $item['status'] == 4 && in_array($item['shipping_type'], [1, 3]) && $item['refund_status'] == 0) {
}
elseif($item['paid'] == 1 && $item['status'] == 4 && in_array($item['delivery_type'],[1,3])){
$status_name['status_name'] = '部分发货';
$item['_status'] = 8;//已支付 部分发货
} else if ($item['paid'] == 1 && $item['refund_status'] == 2) {
}
elseif($item['paid'] == 1 && $item['status'] == -1){
$status_name['status_name'] = '已退款';
$item['_status'] = 7;//已支付 已退款
} else if ($item['paid'] == 1 && $item['status'] == 5 && $item['refund_status'] == 0) {
$status_name['status_name'] = $item['shipping_type'] == 2 ? '部分核销' : '部分收货';
}
elseif($item['paid'] == 1 && $item['status'] == 5){
$status_name['status_name'] = $item['delivery_type'] == 2 ? '部分核销' : '部分收货';
$item['_status'] = 12;//已支付 部分核销
} else if ($item['paid'] == 1 && $item['refund_status'] == 1) {
}
elseif($item['paid'] == 1 && $item['refund'] && ($item['refund']['status'] ?? '') == 0){
$item['_status'] = 3;//已支付 申请退款中
$refundReasonTime = $item['refund_reason_time'] ? date('Y-m-d H:i', $item['refund_reason_time']) : '';
$refundReasonWapImg = json_decode($item['refund_reason_wap_img'], true);
// $refundReasonTime = $item['refund_reason_time'] ? date('Y-m-d H:i',$item['refund_reason_time']) : '';
$refundReasonTime = $item['refund'][0] ? $item['refund'][0]['create_time'] : '';
$refundReasonWapImg = $item['refund'][0]['pics'] ? json_decode($item['refund'][0]['pics'],TRUE) : [];
$refundReasonWapImg = $refundReasonWapImg ? $refundReasonWapImg : [];
$img = [];
if(count($refundReasonWapImg)){
foreach($refundReasonWapImg as $itemImg){
if (strlen(trim($itemImg)))
$img[] = $itemImg;
if(strlen(trim($itemImg))) $img[] = $itemImg;
}
}
$status_name['status_name'] = <<<HTML
<b style="color:#f124c7">申请退款</b><br/>
<span>退款原因:{$item['refund_reason_wap']}</span><br/>
<span>备注说明:{$item['refund_reason_wap_explain']}</span><br/>
<span>退款原因:{$item['refund'][0]['refund_message']}</span><br/>
<span>备注说明:{$item['refund'][0]['mark']}</span><br/>
<span>退款时间:{$refundReasonTime}</span><br/>
<span>退款凭证:</span>
HTML;
$status_name['pics'] = $img;
} else if ($item['paid'] == 1 && $item['refund_status'] == 4) {
}
elseif($item['paid'] == 1 && $item['refund'] && ($item['refund']['status'] ?? '') == 3){
$item['_status'] = 10;//拆单发货 已全部申请退款
$status_name['status_name'] = '退款中';
} else if ($item['paid'] == 1 && $item['status'] == 0 && in_array($item['shipping_type'], [1, 3, 4]) && $item['refund_status'] == 0) {
}
elseif($item['paid'] == 1 && $item['status'] == 0 && in_array($item['delivery_type'],[1,3,4])){
$status_name['status_name'] = '未发货';
$item['_status'] = 2;//已支付 未发货
} else if ($item['paid'] == 1 && in_array($item['status'], [0, 1]) && $item['shipping_type'] == 2 && $item['refund_status'] == 0) {
}
elseif($item['paid'] == 1 && in_array($item['status'],[0,1]) && $item['delivery_type'] == 2){
$status_name['status_name'] = '未核销';
$item['_status'] = 11;//已支付 待核销
} else if ($item['paid'] == 1 && in_array($item['status'], [1, 5]) && in_array($item['shipping_type'], [1, 3, 4]) && $item['refund_status'] == 0) {
}
elseif($item['paid'] == 1 && in_array($item['status'],[1,5]) && in_array($item['delivery_type'],[1,3,4])){
$status_name['status_name'] = '待收货';
$item['_status'] = 4;//已支付 待收货
} else if ($item['paid'] == 1 && $item['status'] == 2 && $item['refund_status'] == 0) {
}
elseif($item['paid'] == 1 && $item['status'] == 2){
$status_name['status_name'] = '待评价';
$item['_status'] = 5;//已支付 待评价
} else if ($item['paid'] == 1 && $item['status'] == 3 && $item['refund_status'] == 0) {
}
elseif($item['paid'] == 1 && $item['status'] == 3){
$status_name['status_name'] = '已完成';
$item['_status'] = 6;//已支付 已完成
} else if ($item['paid'] == 1 && $item['refund_status'] == 3) {
}
elseif($item['paid'] == 1 && $item['refund'] && ($item['refund']['status'] ?? '') == 3){
$item['_status'] = 9;//拆单发货 部分申请退款
$status_name['status_name'] = '部分退款';
}
$item['status_name'] = $status_name;
if ($item['store_id'] == 0 && $item['clerk_id'] == 0 && !isset($item['clerk_name'])) {
if ($item['mer_id'] == 0 && !isset($item['clerk_name'])) {
$item['clerk_name'] = '总平台';
}
//根据核销员更改store_name
if ($item['clerk_id'] && isset($item['staff_store_id']) && $item['staff_store_id']) {
if (isset($item['verify_service_id']) && $item['verify_service_id']) {
/** @var SystemStoreServices $store */
$store = app()->make(SystemStoreServices::class);
$storeOne = $store->value(['id' => $item['staff_store_id']], 'name');
$storeOne = $store->value(['id' => $item['verify_service_id']], 'name');
if ($storeOne) $item['store_name'] = $storeOne;
}
//自购返佣
@ -809,6 +826,7 @@ HTML;
$item['spread_nickname'] = isset($item['spread_nickname']) ? $item['spread_nickname'] . '(自购)' : '';
}
}
return $data;
}
@ -1044,11 +1062,11 @@ HTML;
//未支付
$data['unpaid'] = (string)$this->dao->count($count_where + ['status' => 0]);
//未发货
$data['unshipped'] = (string)$this->dao->count($count_where + ['status' => 1, 'shipping_type' => 1]);
$data['unshipped'] = (string)$this->dao->count($count_where + ['status' => 1, 'delivery_type' => 1]);
//部分发货
$data['partshipped'] = (string)$this->dao->count($count_where + ['status' => 7, 'shipping_type' => 1]);
$data['partshipped'] = (string)$this->dao->count($count_where + ['status' => 7, 'delivery_type' => 1]);
//待收货
$data['untake'] = (string)$this->dao->count($count_where + ['status' => 2, 'shipping_type' => 1]);
$data['untake'] = (string)$this->dao->count($count_where + ['status' => 2, 'delivery_type' => 1]);
//待核销
$data['write_off'] = (string)$this->dao->count($count_where + ['status' => 5]);
//已核销
@ -1590,7 +1608,7 @@ HTML;
* @param $cartId
* @param bool $new
* @param int $addressId
* @param int $shipping_type
* @param int $delivery_type
* @param int $store_id
* @param int $coupon_id
* @return array
@ -1599,7 +1617,7 @@ HTML;
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getOrderConfirmData(array $user, $cartId, bool $new, int $addressId, int $shipping_type = 1, int $store_id = 0, int $coupon_id = 0)
public function getOrderConfirmData(array $user, $cartId, bool $new, int $addressId, int $delivery_type = 1, int $store_id = 0, int $coupon_id = 0)
{
$addr = $data = [];
$uid = (int)$user['uid'];
@ -1629,7 +1647,7 @@ HTML;
/** @var StoreCartServices $cartServices */
$cartServices = app()->make(StoreCartServices::class);
//获取购物车信息
$cartGroup = $cartServices->getUserProductCartListV1($uid, $cartId, $new, $addr, $shipping_type, $store_id, $coupon_id);
$cartGroup = $cartServices->getUserProductCartListV1($uid, $cartId, $new, $addr, $delivery_type, $store_id, $coupon_id);
$storeFreePostage = floatval(sys_config('store_free_postage')) ?: 0;//满额包邮金额
$data['storeFreePostage'] = $storeFreePostage;
$validCartInfo = $cartGroup['valid'];
@ -2304,9 +2322,9 @@ HTML;
*/
public function outGetShippingType(string $oid)
{
$shipping_type = $this->dao->value(['order_id' => $oid], 'shipping_type');
$shipping_type = $shipping_type == 1 ? '商家配送' : '到店自提';
return compact('shipping_type');
$delivery_type = $this->dao->value(['order_id' => $oid], 'delivery_type');
$delivery_type = $delivery_type == 1 ? '商家配送' : '到店自提';
return compact('delivery_type');
}
/**
@ -2559,7 +2577,7 @@ HTML;
}
//扣门店库存
$res = $branchProductServics->regressionBranchProductStock($orderInfo, $cart_info, -1, 1, $store_id);
$res = $res && $this->dao->update($id, ['store_id' => $storeInfo['id'], 'shipping_type' => $orderInfo['shipping_type'] == 1 ? 3 : $orderInfo['shipping_type']]);
$res = $res && $this->dao->update($id, ['store_id' => $storeInfo['id'], 'delivery_type' => $orderInfo['delivery_type'] == 1 ? 3 : $orderInfo['delivery_type']]);
return $res;
});
$orderInfo['store_id'] = $storeInfo['id'];

View File

@ -90,7 +90,7 @@ class StoreOrderSuccessServices extends BaseServices
$luckLotteryServices->setCacheLotteryNum((int)$orderInfo['uid'], 'order');
}
//门店
// if ($orderInfo['shipping_type'] == 4) {
// if ($orderInfo['delivery_type'] == 4) {
// //订单发货
// OrderDeliveryJob::dispatch([$orderInfo, [], 4]);
// //订单收货

View File

@ -116,7 +116,7 @@ class StoreOrderTakeServices extends BaseServices
throw new ValidateException('收货失败');
}
//核销订单 修改订单商品核销状态
if ($order['shipping_type'] == 2 || (in_array($order['shipping_type'], [1, 3]) && $order['delivery_type'] == 'send')) {
if ($order['delivery_type'] == 2 || (in_array($order['delivery_type'], [1, 3]) && $order['delivery_type'] == 'send')) {
//修改原来订单商品信息
$cartData['is_writeoff'] = 1;
$cartData['write_surplus_times'] = 0;

View File

@ -228,7 +228,7 @@ class BranchOrderServices extends BaseServices
//分配订单
$data['store_order_price'] = $this->dao->sum(['type' => 7] + $order_where + $where, 'pay_price', true);
//核销订单
$data['store_writeoff_order_price'] = $this->dao->sum(['shipping_type' => 2] + $order_where + $where, 'pay_price', true);
$data['store_writeoff_order_price'] = $this->dao->sum(['delivery_type' => 2] + $order_where + $where, 'pay_price', true);
/** @var StoreUserServices $storeUserServices */
$storeUserServices = app()->make(StoreUserServices::class);
$data['store_user_count'] = $storeUserServices->count($where);

View File

@ -66,14 +66,14 @@ class WriteOffOrderServices extends BaseServices
case 0://管理员
break;
case 1://门店
if ($orderInfo['shipping_type'] == 2 && $info && isset($info['store_id']) && $info['store_id'] == $store_id) {
if ($orderInfo['delivery_type'] == 2 && $info && isset($info['store_id']) && $info['store_id'] == $store_id) {
$isAuth = true;
} else {
$isAuth = false;
}
break;
case 2://配送员
if (in_array($orderInfo['shipping_type'], [1, 3]) && $info && $orderInfo['delivery_type'] == 'send' && $orderInfo['delivery_uid'] == $uid) {
if (in_array($orderInfo['delivery_type'], [1, 3]) && $info && $orderInfo['delivery_type'] == 'send' && $orderInfo['delivery_uid'] == $uid) {
$isAuth = true;
} else {
$isAuth = false;
@ -327,7 +327,7 @@ class WriteOffOrderServices extends BaseServices
//验证核销权限
$this->checkAuth($uid, $orderInfo, $auth, $staff_id);
if (!$orderInfo['verify_code'] || ($orderInfo['shipping_type'] != 2 && $orderInfo['delivery_type'] != 'send')) {
if (!$orderInfo['verify_code'] || ($orderInfo['delivery_type'] != 2 && $orderInfo['delivery_type'] != 'send')) {
throw new ValidateException('此订单不能被核销');
}
/** @var StoreOrderRefundServices $storeOrderRefundServices */

View File

@ -669,9 +669,9 @@ class ExportServices extends BaseServices
if ($item['paid'] == 0 && $item['status'] == 0) {
$item['status_name'] = '未支付';
} else if ($item['paid'] == 1 && $item['status'] == 4 && in_array($item['shipping_type'], [1, 3]) && $item['refund_status'] == 0) {
} else if ($item['paid'] == 1 && $item['status'] == 4 && in_array($item['delivery_type'], [1, 3]) && $item['refund_status'] == 0) {
$item['status_name'] = '部分发货';
} else if ($item['paid'] == 1 && $item['status'] == 5 && $item['shipping_type'] == 2 && $item['refund_status'] == 0) {
} else if ($item['paid'] == 1 && $item['status'] == 5 && $item['delivery_type'] == 2 && $item['refund_status'] == 0) {
$item['status_name'] = '部分核销';
} else if ($item['paid'] == 1 && $item['refund_status'] == 1) {
$item['status_name'] = '申请退款';
@ -679,11 +679,11 @@ class ExportServices extends BaseServices
$item['status_name'] = '已退款';
} else if ($item['paid'] == 1 && $item['refund_status'] == 4) {
$item['status_name'] = '退款中';
} else if ($item['paid'] == 1 && $item['status'] == 0 && in_array($item['shipping_type'], [1, 3]) && $item['refund_status'] == 0) {
} else if ($item['paid'] == 1 && $item['status'] == 0 && in_array($item['delivery_type'], [1, 3]) && $item['refund_status'] == 0) {
$item['status_name'] = '未发货';
} else if ($item['paid'] == 1 && in_array($item['status'], [0, 1]) && $item['shipping_type'] == 2 && $item['refund_status'] == 0) {
} else if ($item['paid'] == 1 && in_array($item['status'], [0, 1]) && $item['delivery_type'] == 2 && $item['refund_status'] == 0) {
$item['status_name'] = '未核销';
} else if ($item['paid'] == 1 && in_array($item['status'], [1, 5]) && in_array($item['shipping_type'], [1, 3]) && $item['refund_status'] == 0) {
} else if ($item['paid'] == 1 && in_array($item['status'], [1, 5]) && in_array($item['delivery_type'], [1, 3]) && $item['refund_status'] == 0) {
$item['status_name'] = '待收货';
} else if ($item['paid'] == 1 && $item['status'] == 2 && $item['refund_status'] == 0) {
$item['status_name'] = '待评价';

View File

@ -271,15 +271,15 @@ class StoreFinanceFlowServices extends BaseServices
}
//门店订单
$this->savaData($order, $total_price, 1, 2, 1, $append);
if ($order['shipping_type'] == 1) {//配送订单
if ($order['delivery_type'] == 1) {//配送订单
//分配订单费率
$rate = sys_config('store_self_order_rate');
$type = 12;
} elseif ($order['shipping_type'] == 2) {
} elseif ($order['delivery_type'] == 2) {
//核销订单费率
$rate = sys_config('store_writeoff_order_rate');
$type = 10;
} else if ($order['shipping_type'] == 4) {
} else if ($order['delivery_type'] == 4) {
//收银订单费率
$rate = sys_config('store_cashier_order_rate');
$type = 9;
@ -309,15 +309,15 @@ class StoreFinanceFlowServices extends BaseServices
$this->savaData($order, $order['pay_price'], 1, 1, 1);
//门店订单
$this->savaData($order, $total_price, 1, 2, 1, $append);
if ($order['shipping_type'] == 1) {//配送订单
if ($order['delivery_type'] == 1) {//配送订单
//分配订单费率
$rate = sys_config('store_self_order_rate');
$type = 12;
} elseif ($order['shipping_type'] == 2) {
} elseif ($order['delivery_type'] == 2) {
//核销订单费率
$rate = sys_config('store_writeoff_order_rate');
$type = 10;
} else if ($order['shipping_type'] == 4) {
} else if ($order['delivery_type'] == 4) {
//收银订单费率
$rate = sys_config('store_cashier_order_rate');
$type = 9;
@ -387,10 +387,10 @@ class StoreFinanceFlowServices extends BaseServices
}
}
if (!$rate) {//未获取到,下单保存费率;获取系统配置
if ($order['shipping_type'] == 2) {
if ($order['delivery_type'] == 2) {
//核销订单费率
$rate = sys_config('store_writeoff_order_rate');
} else if ($order['shipping_type'] == 4) {
} else if ($order['delivery_type'] == 4) {
//收银订单费率
$rate = sys_config('store_cashier_order_rate');
} else {

View File

@ -147,7 +147,7 @@ class SupplierFlowingWaterServices extends BaseServices
if ($order['supplier_id'] <= 0) return true;
$data = $cartInfoServices->getOrderCartInfoSettlePrice($order['id']);
$pay_postage = 0;
if (isset($order['shipping_type']) && !in_array($order['shipping_type'], [2, 4])) {
if (isset($order['delivery_type']) && !in_array($order['delivery_type'], [2, 4])) {
$pay_postage = floatval($storeOrderRefundServices->getOrderSumPrice($data['info'], 'postage_price', false));
}
if ($order['type'] == 8) {

View File

@ -383,7 +383,7 @@ class SystemAdminServices extends BaseServices
try {
/** @var StoreOrderServices $orderServices */
$orderServices = app()->make(StoreOrderServices::class);
$data['ordernum'] = $orderServices->count(['is_del' => 0, 'status' => 1, 'shipping_type' => 1]);
$data['ordernum'] = $orderServices->count(['is_del' => 0, 'status' => 1, 'delivery_type' => 1]);
/** @var StoreProductServices $productServices */
$productServices = app()->make(StoreProductServices::class);
$data['inventory'] = $productServices->count(['type' => 5]);

View File

@ -1,18 +1,7 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace crmeb\basic;
use crmeb\interfaces\JobInterface;
use think\facade\Log;
use crmeb\interfaces\SupplierJobInterface;
use think\queue\Job;
/**
@ -20,7 +9,7 @@ use think\queue\Job;
* Class BaseJobs
* @package crmeb\basic
*/
class BaseJobs implements JobInterface
class BaseJobs implements SupplierJobInterface
{
/**

View File

@ -0,0 +1,10 @@
<?php
namespace crmeb\interfaces;
use think\queue\Job;
interface SupplierJobInterface
{
public function fire(Job $job, $data): void;
}