Merge branch 'feature/purchase_record' into dev
This commit is contained in:
commit
4ee14572da
@ -28,6 +28,7 @@ class StoreOrder extends BaseModel
|
|||||||
|
|
||||||
const STATUS_WAIT_CONFIRM = 12; //待确认
|
const STATUS_WAIT_CONFIRM = 12; //待确认
|
||||||
const STATUS_WAIT_PAY = 0; //待支付
|
const STATUS_WAIT_PAY = 0; //待支付
|
||||||
|
const STATUS_WAIT_COMMENT = 2; //待评价
|
||||||
|
|
||||||
public static function tablePk(): ?string
|
public static function tablePk(): ?string
|
||||||
{
|
{
|
||||||
|
@ -15,6 +15,7 @@ use app\common\dao\store\order\StoreOrderDao;
|
|||||||
use app\common\model\store\order\StoreGroupOrder;
|
use app\common\model\store\order\StoreGroupOrder;
|
||||||
use app\common\model\store\order\StoreOrder;
|
use app\common\model\store\order\StoreOrder;
|
||||||
use app\common\model\store\order\StoreOrderInterest;
|
use app\common\model\store\order\StoreOrderInterest;
|
||||||
|
use app\common\model\store\product\PurchaseRecord;
|
||||||
use app\common\model\user\User;
|
use app\common\model\user\User;
|
||||||
use app\common\repositories\BaseRepository;
|
use app\common\repositories\BaseRepository;
|
||||||
use app\common\repositories\delivery\DeliveryOrderRepository;
|
use app\common\repositories\delivery\DeliveryOrderRepository;
|
||||||
@ -2539,4 +2540,32 @@ class StoreOrderRepository extends BaseRepository
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 采购订单列表
|
||||||
|
* @param $merId
|
||||||
|
* @param $page
|
||||||
|
* @param $limit
|
||||||
|
* @return \think\Collection
|
||||||
|
* @throws DataNotFoundException
|
||||||
|
* @throws DbException
|
||||||
|
* @throws ModelNotFoundException
|
||||||
|
*/
|
||||||
|
public function purchaseOrder($merId, $page, $limit)
|
||||||
|
{
|
||||||
|
$orders = StoreOrder::where('mer_id', $merId)
|
||||||
|
->where('pay_type', StoreGroupOrder::PAY_TYPE_CREDIT_BUY)
|
||||||
|
->where('status', StoreOrder::STATUS_WAIT_COMMENT)
|
||||||
|
->page($page, $limit)
|
||||||
|
->select();
|
||||||
|
foreach ($orders as $order) {
|
||||||
|
$products = $order->orderProduct;
|
||||||
|
foreach ($products as &$product) {
|
||||||
|
$purchaseRecord = PurchaseRecord::where(['order_id' => $product['order_id'], 'order_product_id' => $product['product_id'], 'order_unique' => $product['product_sku']])->field('sales_volume')->find();
|
||||||
|
$product['sales_volume'] = empty($purchaseRecord) ? 0 : $purchaseRecord->sales_volume;
|
||||||
|
unset($product['cart_info']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $orders;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2251,6 +2251,9 @@ class ProductRepository extends BaseRepository
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
foreach ($data['attrValue'] as $k => $item) {
|
||||||
|
$data['attrValue'][$k]['stock'] = 0;
|
||||||
|
}
|
||||||
app()->make(ProductLabelRepository::class)->checkHas($merId,$data['mer_labels']);
|
app()->make(ProductLabelRepository::class)->checkHas($merId,$data['mer_labels']);
|
||||||
$count = app()->make(StoreCategoryRepository::class)->getWhereCount(['store_category_id' => $data['cate_id'],'is_show' => 1]);
|
$count = app()->make(StoreCategoryRepository::class)->getWhereCount(['store_category_id' => $data['cate_id'],'is_show' => 1]);
|
||||||
if (!$count) throw new ValidateException('平台分类不存在或不可用');
|
if (!$count) throw new ValidateException('平台分类不存在或不可用');
|
||||||
|
@ -338,4 +338,19 @@ class StoreOrder extends BaseController
|
|||||||
return app('json')->success('订单核销成功');
|
return app('json')->success('订单核销成功');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 采购订单列表
|
||||||
|
* @param $merId
|
||||||
|
* @param StoreOrderRepository $orderRepository
|
||||||
|
* @return \think\Collection
|
||||||
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
|
* @throws \think\db\exception\DbException
|
||||||
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
|
*/
|
||||||
|
public function purchaseOrder($merId, StoreOrderRepository $orderRepository)
|
||||||
|
{
|
||||||
|
[$page, $limit] = $this->getPage();
|
||||||
|
return $orderRepository->purchaseOrder($merId, $page, $limit);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -310,6 +310,7 @@ Route::group('api/', function () {
|
|||||||
Route::get('/dump_temp', '/getFormData');
|
Route::get('/dump_temp', '/getFormData');
|
||||||
Route::get('/delivery_config', '/getDeliveryConfig');
|
Route::get('/delivery_config', '/getDeliveryConfig');
|
||||||
Route::get('/delivery_options', '/getDeliveryOptions');
|
Route::get('/delivery_options', '/getDeliveryOptions');
|
||||||
|
Route::get('/purchaseOrder', '/purchaseOrder');
|
||||||
|
|
||||||
})->prefix('api.server.StoreOrder')->middleware(\app\common\middleware\MerchantServerMiddleware::class,0);
|
})->prefix('api.server.StoreOrder')->middleware(\app\common\middleware\MerchantServerMiddleware::class,0);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user