|
|
|
@ -12,19 +12,17 @@ declare (strict_types=1); |
|
|
|
|
|
|
|
|
|
namespace app\api\controller; |
|
|
|
|
|
|
|
|
|
use app\api\model\RecoveryOrder; |
|
|
|
|
use app\common\enum\OrderType; |
|
|
|
|
use app\common\enum\user\UserTypeEnum; |
|
|
|
|
use think\response\Json; |
|
|
|
|
use app\api\model\Order as OrderModel; |
|
|
|
|
use app\api\model\Setting as SettingModel; |
|
|
|
|
use app\api\service\User as UserService; |
|
|
|
|
use app\api\service\Order as OrderService; |
|
|
|
|
use app\common\service\qrcode\Extract as ExtractQRcode; |
|
|
|
|
use cores\exception\BaseException; |
|
|
|
|
use app\api\service\TransferRecord; |
|
|
|
|
use app\common\model\TransferRecord as TransferRecordModel; |
|
|
|
|
use app\api\service\User as UserService; |
|
|
|
|
use app\common\enum\OrderType; |
|
|
|
|
use app\common\model\TransferRecord as TransferRecordModel; |
|
|
|
|
use app\common\model\UploadFile; |
|
|
|
|
use app\common\service\qrcode\Extract as ExtractQRcode; |
|
|
|
|
use cores\exception\BaseException; |
|
|
|
|
use think\response\Json; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 我的订单控制器 |
|
|
|
@ -93,6 +91,7 @@ class Order extends Controller |
|
|
|
|
], |
|
|
|
|
]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取调货单物流跟踪信息 |
|
|
|
|
* @param int $orderId 订单ID |
|
|
|
@ -104,7 +103,7 @@ class Order extends Controller |
|
|
|
|
*/ |
|
|
|
|
public function expressSearch(string $expressNo): Json |
|
|
|
|
{ |
|
|
|
|
if(empty($expressNo)) { |
|
|
|
|
if (empty($expressNo)) { |
|
|
|
|
return $this->renderError('物流单号不能为空'); |
|
|
|
|
} |
|
|
|
|
$transferRecordService = new TransferRecord(); |
|
|
|
@ -119,6 +118,7 @@ class Order extends Controller |
|
|
|
|
return $this->renderError('暂无物流信息'); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取物流跟踪信息 |
|
|
|
|
* @param int $orderId 订单ID |
|
|
|
@ -164,6 +164,7 @@ class Order extends Controller |
|
|
|
|
} |
|
|
|
|
return $this->renderError($model->getError()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取当前用户行为数量 |
|
|
|
|
* @return Json |
|
|
|
@ -171,8 +172,8 @@ class Order extends Controller |
|
|
|
|
*/ |
|
|
|
|
public function actionCounts(): Json |
|
|
|
|
{ |
|
|
|
|
$model = new OrderModel; |
|
|
|
|
$counts = $model->getActionCounts(); |
|
|
|
|
$model = new OrderModel; |
|
|
|
|
$counts = $model->getActionCounts(); |
|
|
|
|
$data = [ |
|
|
|
|
'reservation_number' => $counts['reservation_number'],//预约记录 |
|
|
|
|
'view_number' => $counts['view_number'],//浏览记录 |
|
|
|
@ -185,6 +186,7 @@ class Order extends Controller |
|
|
|
|
]; |
|
|
|
|
return $this->renderSuccess($data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取当前用户待处理的订单数量 |
|
|
|
|
* @return Json |
|
|
|
@ -192,11 +194,11 @@ class Order extends Controller |
|
|
|
|
*/ |
|
|
|
|
public function todoCounts(): Json |
|
|
|
|
{ |
|
|
|
|
$model = new OrderModel; |
|
|
|
|
$goods_counts = $model->getTodoCounts(OrderType::ORDER); |
|
|
|
|
$service_counts = $model->getTodoCounts(OrderType::SERVER); |
|
|
|
|
$recovery_counts = $model->getTodoCounts(OrderType::RECOVERY); |
|
|
|
|
$dealer_counts = $model->getTodoCounts(OrderType::DEALER); |
|
|
|
|
$model = new OrderModel; |
|
|
|
|
$goods_counts = $model->getTodoCounts(OrderType::ORDER); |
|
|
|
|
$service_counts = $model->getTodoCounts(OrderType::SERVER); |
|
|
|
|
$recovery_counts = $model->getTodoCounts(OrderType::RECOVERY); |
|
|
|
|
$dealer_counts = $model->getTodoCounts(OrderType::DEALER); |
|
|
|
|
// var_dump($dealer_counts); |
|
|
|
|
$data = [ |
|
|
|
|
'goods_order' => [ |
|
|
|
@ -261,13 +263,13 @@ class Order extends Controller |
|
|
|
|
* @throws \think\db\exception\ModelNotFoundException |
|
|
|
|
*/ |
|
|
|
|
public function transferList(): Json |
|
|
|
|
{ |
|
|
|
|
{ |
|
|
|
|
$params = $this->request->param(); |
|
|
|
|
$where = []; |
|
|
|
|
if (!empty($params['search'])) { |
|
|
|
|
$where[] = ['goods_sn', 'like', "%{$params["search"]}%"]; |
|
|
|
|
} |
|
|
|
|
$list = TransferRecordModel::where('status',1) |
|
|
|
|
$list = TransferRecordModel::where('status', 1) |
|
|
|
|
->where($where) |
|
|
|
|
->order("id desc") |
|
|
|
|
->paginate(10)->each(function ($item, $key) { |
|
|
|
@ -282,7 +284,7 @@ class Order extends Controller |
|
|
|
|
'name' => $value, |
|
|
|
|
'price' => $price, |
|
|
|
|
'num' => $goods_num[$seq] ?? 0, |
|
|
|
|
"image" =>'https://imgservice5.suning.cn/uimg1/b2c/image/nXmtUUkwKxasCEBIX90d7w.png' |
|
|
|
|
"image" => 'https://imgservice5.suning.cn/uimg1/b2c/image/nXmtUUkwKxasCEBIX90d7w.png' |
|
|
|
|
]; |
|
|
|
|
$total_price += $price; |
|
|
|
|
} |
|
|
|
@ -290,7 +292,7 @@ class Order extends Controller |
|
|
|
|
$item['total_price'] = $total_price; |
|
|
|
|
$transfer_image_ids = UploadFile::whereIn('file_id', explode(",", $item['transfer_image_id']))->field('file_id,file_path,file_type,storage,domain')->select(); |
|
|
|
|
foreach ($transfer_image_ids as &$transfer_image_id) { |
|
|
|
|
$transfer_image_id['file_path'] = getUrl($transfer_image_id['file_path'],$transfer_image_id['domain']); |
|
|
|
|
$transfer_image_id['file_path'] = getUrl($transfer_image_id['file_path'], $transfer_image_id['domain']); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$chat_image_ids = UploadFile::whereIn('file_id', explode(",", $item['chat_image_id']))->field('file_id,file_path,file_type,storage,domain')->select(); |
|
|
|
@ -308,9 +310,9 @@ class Order extends Controller |
|
|
|
|
public function editTransfer(): Json |
|
|
|
|
{ |
|
|
|
|
$params = $this->request->param(); |
|
|
|
|
$id = $params['id']??0; |
|
|
|
|
$id = $params['id'] ?? 0; |
|
|
|
|
unset($params['id']); |
|
|
|
|
TransferRecordModel::where('id',$id)->update($params); |
|
|
|
|
TransferRecordModel::where('id', $id)->update($params); |
|
|
|
|
return $this->renderSuccess('ok'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -325,13 +327,4 @@ class Order extends Controller |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|