修复BUG

This commit is contained in:
liu
2026-08-27 14:20:09 +08:00
parent 513cc568a9
commit 52dc6efadf
203 changed files with 576 additions and 1130 deletions
+48
View File
@@ -271,4 +271,52 @@ class StoreOrderItemTest extends ProcurementTestCase
$this->getJson('/order/store?product_name=' . urlencode('不存在的商品'))
->assertOk()->assertJsonPath('data.total', 0);
}
/** 后台订单列表按订货日期区间筛选(快捷按钮下发 Y-m-d 起止日期) */
public function test_admin_order_list_filters_by_order_date_range(): void
{
[$store, $product] = $this->makeStoreWithProduct();
$this->placeOrder($product, $store, 1);
$this->placeOrder($product, $store, 1);
$this->placeOrder($product, $store, 1);
$orders = StoreOrderModel::where('store_id', $store->id)->orderBy('id')->get();
$orders[0]->update(['order_date' => '2026-08-01']);
$orders[1]->update(['order_date' => '2026-08-05']);
$orders[2]->update(['order_date' => '2026-08-10']);
$this->actingAsSysUser();
$this->getJson('/order/store?order_date[]=2026-08-05&order_date[]=2026-08-10')
->assertOk()->assertJsonPath('data.total', 2);
$this->getJson('/order/store?order_date[]=2026-08-05&order_date[]=2026-08-05')
->assertOk()->assertJsonPath('data.total', 1, '今天/昨天等单日快捷按钮起止同日');
$this->getJson('/order/store?order_date[]=2026-08-11&order_date[]=2026-08-12')
->assertOk()->assertJsonPath('data.total', 0);
}
/** 后台订单列表按采购单号模糊搜索 */
public function test_admin_order_list_search_by_purchase_no(): void
{
[$store, $product] = $this->makeStoreWithProduct();
$this->placeOrder($product, $store, 1, StoreOrderModel::STATUS_SUMMARIZED);
$purchase = $this->generatePurchase();
// 生成采购单外的另一笔订单(不应被命中)
$this->placeOrder($product, $store, 1);
$this->actingAsSysUser();
$response = $this->getJson('/order/store?purchase_no=' . $purchase->purchase_no);
$response->assertOk()->assertJsonPath('success', true);
$this->assertSame(1, $response->json('data.total'));
$this->assertSame($purchase->purchase_no, $response->json('data.data.0.purchase.purchase_no'));
// 单号片段模糊命中
$fragment = substr($purchase->purchase_no, -6);
$this->getJson('/order/store?purchase_no=' . $fragment)
->assertOk()->assertJsonPath('data.total', 1);
// 无匹配单号 → 空列表
$this->getJson('/order/store?purchase_no=NOT-EXIST-NO')
->assertOk()->assertJsonPath('data.total', 0);
}
}