This commit is contained in:
2025-08-25 01:46:41 +08:00
parent 2d4f31a116
commit 3effbc342c
5 changed files with 183 additions and 7 deletions

View File

@@ -571,15 +571,17 @@ export default {
},
/** 快速发品 */
handleQuickPublish(row) {
// 先用商品链接生成完整商品信息,再打开通用发品弹窗
const id = row.id || this.ids;
getFavoriteProduct(id).then(async res => {
const p = res && res.data ? res.data : (row || {});
try {
// 与转链保持一致:优先使用保存的商品链接,避免用名称/ID 产生歧义
if (!p.productUrl) {
this.$modal.msgWarning('该常用商品缺少商品链接,无法生成完整发品信息');
}
let detail = null;
const inputContent = p.productUrl || p.productName || p.skuid || '';
if (inputContent) {
const r = await generatePromotionContent({ promotionContent: inputContent });
if (p.productUrl) {
const r = await generatePromotionContent({ promotionContent: p.productUrl });
const resultStr = (r && (r.msg || r.data)) || '';
try { const arr = typeof resultStr === 'string' ? JSON.parse(resultStr) : resultStr; if (Array.isArray(arr) && arr.length) detail = arr[0]; } catch(e) {}
}
@@ -592,7 +594,6 @@ export default {
images: images,
originalPrice: detail && detail.price ? Number(detail.price) : (p.price ? Number(p.price) : undefined),
wenanOptions: wenanOptions,
// 预设:同一用户经常固定账号与地区,优先从常用商品扩展字段取值(如有)
userName: p.userName || '',
province: p.province || null,
city: p.city || null,
@@ -605,7 +606,6 @@ export default {
this.publishDialogVisible = true;
}
}).catch(() => {
// 失败也尽量用行数据打开
const images = row && row.productImage ? [row.productImage] : [];
this.publishInitialData = { title: row.productName || '', images, content: '' };
this.publishDialogVisible = true;