diff --git a/src/views/system/jdorder/index.vue b/src/views/system/jdorder/index.vue index 08daf8c..8e4e41b 100644 --- a/src/views/system/jdorder/index.vue +++ b/src/views/system/jdorder/index.vue @@ -5,24 +5,45 @@ 一键转链 - - - - - - - - 生成转链内容 - - 清空 - - + + + + + + + + + + 生成转链内容 + + 清空 + + + + + + + + +
+ 复制通用文案 +
+
+
+

转链结果:

@@ -139,7 +160,7 @@ export default { data() { return { form: { - inputContent: "示例 https://u.jd.com/YDy2OHn" + inputContent: "" }, loading: false, result: "", @@ -214,6 +235,28 @@ export default { }; }, mounted() {}, + computed: { + // 提取通用文案:优先取第一个商品中类型包含“通用”的文案;否则取第一个文案 + generalCopy() { + const data = this.parsedResult; + try { + if (Array.isArray(data) && data.length) { + const productIndex = typeof this.activeProductTab === 'number' ? this.activeProductTab : 0; + const product = data[productIndex] || data[0]; + const wenanList = Array.isArray(product && product.wenan) ? product.wenan : []; + if (wenanList.length) { + const found = wenanList.find(w => (w && (w.type || '').includes('通用'))); + const chosen = found || wenanList[0]; + return (chosen && chosen.content) ? chosen.content : ''; + } + } + if (data && data.generalCopy) { + return String(data.generalCopy || ''); + } + } catch (e) { /* 忽略提取异常 */ } + return ''; + } + }, watch: { 'publishDialog.form.itemBizType'(val) { // 冗余联动,防止@change未触发的情况