From cdb74c3aa69556c8a44e2503c5210d5686792809 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=AF=85?= <1335909236@qq.com> Date: Wed, 10 Dec 2025 09:34:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=98=93=E8=B4=AD=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E7=AB=8B=E5=8D=B3=E6=94=AF=E4=BB=98=E4=BC=A0=E5=80=BC?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/shop/goodsSubmit/index.vue | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/packages/shop/goodsSubmit/index.vue b/packages/shop/goodsSubmit/index.vue index cb48385c..d4d0e168 100644 --- a/packages/shop/goodsSubmit/index.vue +++ b/packages/shop/goodsSubmit/index.vue @@ -371,21 +371,28 @@ export default { user_id: uni.getStorageSync('userId'), // 先判断shopCarList数据中是否包含isAdver且为true order_cate: this.carList.some(item => item.isAdver === true) ? 3 : 1, - goods_list: [{ - supplier_id: this.orderList[0].supplier_id, - supplier_name: this.orderList[0].supplier_name || '', - is_same_day: this.orderList[0].commodity_goods_info.is_same_day, - receiving_name: this.defAddress.name, - receiving_phone: this.defAddress.phone, - receiving_address: this.defAddress.address + this.defAddress.house_number, - merchant_id: this.defAddress.address_id, - goods_and_count: this.orderList.map(item => ({ + goods_list: Object.values(this.orderList.reduce((acc, item) => { + const supplierId = item.supplier_id; + if (!acc[supplierId]) { + acc[supplierId] = { + supplier_id: supplierId, + supplier_name: item.supplier_name || '', + is_same_day: item.commodity_goods_info.is_same_day, + receiving_name: this.defAddress.name, + receiving_phone: this.defAddress.phone, + receiving_address: this.defAddress.address + this.defAddress.house_number, + merchant_id: this.defAddress.address_id, + goods_and_count: [] + }; + } + acc[supplierId].goods_and_count.push({ goods_id: item.goods_id, count: item.count, price: item.commodity_goods_info.sales_price, freight: item.commodity_goods_info.freight, - })) - }] + }); + return acc; + }, {})) } request(apiArr.createOrder, "POST", params).then(resVal => {