Files
huangjingfen/pro_v3.5.1_副本/app/controller/supplier/Order.php

228 lines
7.7 KiB
PHP
Raw Normal View History

feat(fsgx): 完成全部24项开发任务 Phase1-7 Phase1 后端核心: - 新增 fsgx_v1.sql 迁移脚本(is_queue_goods/frozen_points/available_points/no_assess) - SystemConfigServices 返佣设置扩展(周期人数/分档比例/范围/时机) - StoreOrderCreateServices 周期循环佣金计算 - StoreOrderTakeServices 佣金发放后同步冻结积分 - StoreProductServices/StoreProduct 保存 is_queue_goods Phase2 后端接口: - GET /api/hjf/brokerage/progress 佣金周期进度 - GET /api/hjf/assets/overview 资产总览 - HjfPointsServices 每日 frozen_points 0.4‰ 释放定时任务 - PUT /adminapi/hjf/member/{uid}/no_assess 不考核接口 - GET /adminapi/hjf/points/release_log 积分日志接口 Phase3 前端清理: - hjfCustom.js 路由精简(仅保留 points/log) - hjfQueue.js/hjfMember.js API 清理/重定向至 CRMEB 原生接口 - pages.json 公排→推荐佣金/佣金记录/佣金规则 Phase4-5 前端改造: - queue/status.vue 推荐佣金进度页整体重写 - 商品详情/订单确认/支付结果页文案与逻辑改造 - 个人中心/资产页/引导页/规则页文案改造 - HjfQueueProgress/HjfRefundNotice/HjfAssetCard 组件改造 - 推广中心嵌入佣金进度摘要 - hjfMockData.js 全量更新(公排字段→佣金字段) Phase6 Admin 增强: - 用户列表新增 frozen_points/available_points 列及不考核操作按钮 - hjfPoints.js USE_MOCK=false 对接真实积分日志接口 Phase7 配置文档: - docs/fsgx-phase7-config-checklist.md 后台配置与全链路验收清单 Made-with: Cursor
2026-03-23 22:32:19 +08:00
<?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;
use app\Request;
use app\services\order\StoreOrderDeliveryServices;
use app\services\order\StoreOrderServices;
use app\services\store\DeliveryServiceServices;
use app\services\order\supplier\SupplierOrderServices;
use crmeb\services\SystemConfigService;
use think\annotation\Inject;
use think\db\exception\DataNotFoundException;
use think\db\exception\ModelNotFoundException;
/**
* Class Order
* @package app\controller\supplier
* @property Request $request
*/
class Order extends AuthController
{
use CommonOrder;
/**
* @var StoreOrderServices
*/
#[Inject]
protected StoreOrderServices $services;
/**
* @var SupplierOrderServices
*/
#[Inject]
protected SupplierOrderServices $supplierOrderServices;
/**
* 配货单信息
* @return mixed
* @throws DataNotFoundException
* @throws ModelNotFoundException
* @throws \think\db\exception\DbException
*/
public function distributionInfo()
{
[$ids] = $this->request->postMore([
['ids', '']
], true);
if (!$ids) {
return app('json')->fail('缺少参数');
}
$id = stringToIntArray($ids);
$data = $this->supplierOrderServices->getDistribution($id);
if (!$data) {
return app('json')->fail('获取失败');
}
$res['list'] = $data;
$station = SystemConfigService::more(['site_name', 'refund_address', 'refund_phone']);
$res = array_merge($res, $station);
return $this->success($res);
}
/**
* 获取订单列表
* @param Request $request
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function lst(Request $request)
{
$where = $request->getMore([
['status', ''],
['real_name', ''],
['is_del', ''],
['data', '', '', 'time'],
['type', ''],
['pay_type', ''],
['order', ''],
['field_key', ''],
]);
$where['type'] = trim($where['type']);
$where['is_system_del'] = 0;
$where['supplier_id'] = $this->supplierId;
$where['type'] = trim($where['type'], ' ');
return $this->success($this->services->getOrderList($where, ['*'], ['split' => function ($query) {
$query->field('id,pid');
}, 'pink', 'invoice']));
}
/**
*获取所有配送员列表
*/
public function get_delivery_list()
{
/** @var DeliveryServiceServices $deliverServices */
$deliverServices = app()->make(DeliveryServiceServices::class);
$data = $deliverServices->getDeliveryList(2, (int)$this->supplierId);
return $this->success($data);
}
/**
* 订单发送货
* @param Request $request
* @param StoreOrderDeliveryServices $services
* @param $id
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function update_delivery(Request $request, StoreOrderDeliveryServices $services, $id)
{
$data = $request->postMore([
['type', 1],
['delivery_name', ''],//快递公司名称
['delivery_id', ''],//快递单号
['delivery_code', ''],//快递公司编码
['express_record_type', 2],//发货记录类型
['express_temp_id', ""],//电子面单模板
['to_name', ''],//寄件人姓名
['to_tel', ''],//寄件人电话
['to_addr', ''],//寄件人地址
['sh_delivery_name', ''],//送货人姓名
['sh_delivery_id', ''],//送货人电话
['sh_delivery_uid', ''],//送货人ID
['delivery_type', 1],//送货类型
['station_type', 1],//送货类型
['cargo_weight', 0],//重量
['mark', '', '', 'remark'],//管理员备注
['remark', '', '', 'delivery_remark'],//第三方配送备注
['fictitious_content', '']//虚拟发货内容
]);
if (!$id) {
return app('json')->fail('缺少发货ID');
}
$services->setItem('supplier_id', $this->supplierId);
$services->delivery((int)$id, $data);
$services->reset();
return app('json')->success('SUCCESS');
}
/**
* 订单拆单发送货
* @param Request $request
* @param StoreOrderDeliveryServices $services
* @param $id
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function split_delivery(Request $request, StoreOrderDeliveryServices $services, $id)
{
$data = $request->postMore([
['type', 1],
['delivery_name', ''],//快递公司名称
['delivery_id', ''],//快递单号
['delivery_code', ''],//快递公司编码
['express_record_type', 2],//发货记录类型
['express_temp_id', ""],//电子面单模板
['to_name', ''],//寄件人姓名
['to_tel', ''],//寄件人电话
['to_addr', ''],//寄件人地址
['sh_delivery_name', ''],//送货人姓名
['sh_delivery_id', ''],//送货人电话
['sh_delivery_uid', ''],//送货人ID
['delivery_type', 1],//送货类型
['station_type', 1],//送货类型
['cargo_weight', 0],//重量
['mark', ''],//备注
['remark', ''],//配送备注
['fictitious_content', ''],//虚拟发货内容
['cart_ids', []]
]);
if (!$id) {
return app('json')->fail('缺少发货ID');
}
if (!$data['cart_ids']) {
return app('json')->fail('请选择发货商品');
}
foreach ($data['cart_ids'] as $cart) {
if (!isset($cart['cart_id']) || !$cart['cart_id'] || !isset($cart['cart_num']) || !$cart['cart_num']) {
return app('json')->fail('请重新选择发货商品,或发货件数');
}
}
$services->setItem('supplier_id', $this->supplierId);
$services->splitDelivery((int)$id, $data);
$services->reset();
return app('json')->success('SUCCESS');
}
/**
* 获取订单拆分子订单列表
* @return mixed
*/
public function split_order(Request $request, $id)
{
if (!$id) {
return app('json')->fail('缺少订单ID');
}
$where = ['pid' => $id, 'is_system_del' => 0, 'supplier_id' => $this->supplierId];
if (!$this->services->count($where)) {
$where = ['id' => $id, 'is_system_del' => 0, 'supplier_id' => $this->supplierId];
}
return app('json')->success($this->services->getSplitOrderList($where, ['*'], ['split', 'pink', 'invoice', 'supplier']));
}
}