The front-end Vue passes the value to the background, and the array contains the solution in the form of objects

original format

This is an array that needs to be looped

[
    {
    
    
        "_id": "635cc5942872c6453e58e4bc",
        "deleted_at": null,
        "id": "635cc5942872c6453e58e4bb",
        "supplier_id": "635a50b8c025aa02245eef53",
        "supplier_sku": "sku0000003",
        "mhw_reference_sku": "sku0002",
        "ean_13": "EAN13_0000003",
        "supplier_barcode_by_hmw": "hmw_barcode_0000003",
        "product_name": "供货商产品0000003",
        "category": "bedroom",
        "long": "0.8",
        "width": "0.2",
        "high": "0.6",
        "sales_unit": "suit",
        "unit_price": 0,
        "package_weight": 1.7,
        "packaging_qty": 20000,
        "minimum_purchase_qty": 1,
        "bulk_unit_price": 17000,
        "bulk_qty": 5,
        "gst_free": "No",
        "warranty": "Yes",
        "description": "超薄液晶屏电视",
        "time": 1667024276,
        "updated_at": {
    
    
            "timestamps": 1667024277,
            "datetime": "2022-10-29 14:17:57"
        },
        "created_at": {
    
    
            "timestamps": 1667024277,
            "datetime": "2022-10-29 14:17:57"
        },
        "supplier": {
    
    
            "_id": "635a50b8c025aa02245eef54",
            "deleted_at": null,
            "id": "635a50b8c025aa02245eef53",
            "under_aca_group": "abc",
            "supplier_category": "Bathroom",
            "company_name": "Company Icn 123",
            "company_initial": "002",
            "ABN": "ABN000012",
            "company_phone_number": "400-600-8820",
            "company_website": "www.test.com",
            "stock_check_link": "string",
            "address_billing_address": "地址地址",
            "credit_limit": 50,
            "position": "string",
            "name": "名称名称",
            "email": "[email protected]",
            "phone": "12345678910",
            "purchase_teams_type": "bathroom",
            "purchase_teams_value": 1,
            "rebate_notes": "xxxxx",
            "payment_method": "card",
            "shipping_method": [],
            "time": 1666863288,
            "updated_at": {
    
    
                "timestamps": 1666863288,
                "datetime": "2022-10-27 17:34:48"
            },
            "created_at": {
    
    
                "timestamps": 1666863288,
                "datetime": "2022-10-27 17:34:48"
            },
            "address_pickup_address": [],
            "supplier_contact": [],
            "supplier_product": [],
            "get_address_pickup_address": [],
            "get_supplier_contact": [],
            "get_supplier_product": []
        },
        "order_qty": "11111",
        "tag": "22222",
        "total": 0
    }
]

print as shown

insert image description here

solve

num is the above data data

const product = num.map((item) => ({
purchase_order_id: item.id,
qty: item.order_qty,
tag: item.tag,
tax_type: item.tag,
}));

console.log(product, ‘productproduct’);

After network transfer

You can get the desired data format

insert image description here

At last

If you think the article is good, remember to pay attention, follow and bookmark it. Please correct me if I am wrong. If you need to reprint, please indicate the source, thank you! ! !

Guess you like

Origin blog.csdn.net/m0_49714202/article/details/127793754