From b305a4dd11750caf83e2623d2f6678fd873dc2cb Mon Sep 17 00:00:00 2001 From: From-wh Date: Wed, 21 Oct 2026 11:45:06 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E7=A7=BB=E5=8A=A8=E7=AB=AF=E8=AE=A2?= =?UTF-8?q?=E5=8D=95):=20=E7=A1=AE=E8=AE=A4=E9=A1=B5=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E8=A1=A8=E5=8D=95=E5=AD=97=E6=AE=B5=E5=BD=92=E4=B8=80?= =?UTF-8?q?=E5=8C=96=E5=B9=B6=E6=8C=89=20custom=5Ffield=5FN=20=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/pages/goods/order_confirm/index.vue | 31 +++++++++++++++---- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/frontend/uni-app/src/pages/goods/order_confirm/index.vue b/frontend/uni-app/src/pages/goods/order_confirm/index.vue index 3e0e8ba45..9bb087a01 100644 --- a/frontend/uni-app/src/pages/goods/order_confirm/index.vue +++ b/frontend/uni-app/src/pages/goods/order_confirm/index.vue @@ -1036,10 +1036,18 @@ */ function handleConfirmResponse(res) { userInfo.value = res.data.userInfo; - confirm.value = res.data.custom_form || []; - confirm.value.map(e => { - if (e.label === 'img') e.value = [] - }) + // 中台 confirm 接口返回 {label:标题, field, type, required}; + // 本页模板/校验按 {title, label:类型, status, value} 使用,此处统一归一化 + confirm.value = (res.data.custom_form || []).map(e => { + const type = e.type || e.label || 'text'; + return { + title: e.title || e.label || '', + label: type, + status: e.required !== undefined ? !!e.required : !!e.status, + field: e.field || '', + value: type === 'img' ? [] : '', + }; + }); integral.value = res.data.usable_integral; usable_integral.value = res.data.usable_integral; contacts.value = res.data.userInfo.real_name; @@ -1245,7 +1253,7 @@ real_name: contacts.value, phone: contactsTel.value, mark: mark.value, - custom_form: confirm.value, + custom_form: buildCustomFormPayload(), invoice_id: invChecked.value, }, coupon_id: couponId.value, @@ -1288,7 +1296,7 @@ real_name: contacts.value, phone: contactsTel.value, mark: mark.value, - custom_form: confirm.value, + custom_form: buildCustomFormPayload(), invoice_id: invChecked.value, store_id: system_store.value ? system_store.value.id : 0, delivery_type: shippingType.value == 1 ? 'pickup' : 'delivery', @@ -1312,6 +1320,17 @@ function clickTextArea() { textareaRef.value.focus() } + /** + * 自定义表单提交格式:{custom_field_N: 值} + * 后端按商品定义回填标题后结构化存储,与下单引擎 OrderCreateEngine 提交口径一致 + */ + function buildCustomFormPayload() { + const payload = {}; + confirm.value.forEach((item, index) => { + payload[item.field || 'custom_field_' + index] = item.value; + }); + return payload; + } function SubOrder(e) { let data = {}; // 地址校验:中台直接购买模式按 virtual_type 判断;旧模式保持原有逻辑