Add scenic selection and cooperation order flows aligned with Android.

Upgrade scenic picker with search, location sorting, permission apply/status, and blocking home dialog; add cooperation order module and order source picker improvements with unit tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-07 10:48:43 +08:00
parent 3c4ca7eefb
commit 2bea05b1d9
50 changed files with 5603 additions and 191 deletions

View File

@ -166,4 +166,69 @@ final class OrderListViewModelTests: XCTestCase {
XCTAssertEqual(list[1].photoTravel?.orderPhotoNum, 6)
XCTAssertEqual(list[1].photoTravel?.needCheckIn, true)
}
func testReferralOrderEntityDecodesImages() throws {
let json = """
{
"id": 1,
"referral_order_no": "LD001",
"order_no": "LD001",
"user_mobile": "13800138000",
"remark": "",
"created_at": "2026-06-25",
"status": 1,
"status_label": "",
"images": ["https://cdn.example.com/a.jpg", "https://cdn.example.com/b.jpg"]
}
""".data(using: .utf8)!
let entity = try JSONDecoder().decode(ReferralOrderEntity.self, from: json)
XCTAssertEqual(entity.images.count, 2)
XCTAssertEqual(OrderSourceMapping.lead(from: entity).remark, "")
}
func testOrderSourceLeadMappingUsesStatusLabelFallback() throws {
let json = """
{
"id": 1,
"referral_order_no": "LD002",
"order_no": "LD002",
"user_mobile": "13800138000",
"remark": "",
"created_at": "",
"status": 1,
"status_label": "已完成",
"images": []
}
""".data(using: .utf8)!
let entity = try JSONDecoder().decode(ReferralOrderEntity.self, from: json)
XCTAssertEqual(OrderSourceMapping.lead(from: entity).remark, "")
}
func testOrderSourceSelectionFromBoundReferralUsesRemarkFallback() throws {
let json = """
{
"id": 53,
"order_no": "LD202606250008",
"sale_user_id": 6,
"saler_name": "管铜彬",
"photog_remark_name": "管铜彬1234567",
"saler_phone": "19281871413",
"display_text": "管铜彬1234567 19281871413",
"user_mobile": "13333333331",
"remark": "",
"bind_order_number": "260625128009",
"source_type": 2,
"source_type_label": "下级线索",
"status": 2,
"status_label": "已完成",
"created_at": "2026-06-25 17:13:51"
}
""".data(using: .utf8)!
let referral = try JSONDecoder().decode(BoundReferralOrderEntity.self, from: json)
let selection = OrderSourceMapping.selection(from: referral)
XCTAssertEqual(selection?.person.name, "1234567")
XCTAssertEqual(selection?.lead.remark, "1234567 19281871413")
XCTAssertEqual(selection?.lead.key, "LD202606250008")
}
}