diff --git a/src/views/jarvis/batchPublish/index.vue b/src/views/jarvis/batchPublish/index.vue
index 7db4228..221000f 100644
--- a/src/views/jarvis/batchPublish/index.vue
+++ b/src/views/jarvis/batchPublish/index.vue
@@ -10,7 +10,9 @@
+
+
@@ -103,8 +105,112 @@
-
+
+
+
+ 为每个商品设置发布价格和文案版本。固定属性(成色、库存等)将在下一步统一设置。
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ scope.row.productName }}
+ SKUID: {{ scope.row.skuid }}
+
+
+
+
+
+
+ ¥{{ scope.row.price }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 无可用文案
+
+
+
+
+
+
+
+
+ 预览文案
+
+
+
+
+
+
+
+ 批量设置价格
+ 批量选择文案版本
+
+
+
+
+ 上一步
+
+
+ 下一步
+
+
+
+
+
+
+
+
+
+
+ 即将发布 {{ totalPublishCount }} 条商品
+ ({{ selectedProducts.length }} 个商品 × {{ totalSubAccountCount }} 个子账号)
+
+ 请仔细核对发布信息,确认无误后点击"确认发布"按钮。
+
+
+
+
+ {{ selectedProducts.length }}
+ {{ totalSubAccountCount }}
+ {{ totalPublishCount }}
+ {{ publishForm.delaySeconds }}秒
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ scope.row.productName }}
+ SKUID: {{ scope.row.skuid }}
+
+
+
+
+
+ ¥{{ scope.row.publishPrice }}
+
+
+
+
+
+ {{ scope.row.accountName }}
+
+
+
+
+
+ {{ scope.row.subAccount }}
+
+
+
+
+
+ {{ scope.row.wenanType }}
+
+
+
+
+
+
+ 查看文案
+
+
+
+
+
+
+
+ 上一步
+
+
+ 确认发布
+
+
+
+
+
+
+
+
+
+
+ {{ currentPreviewProduct.productName }}
+
+ {{ currentPreviewProduct.wenan && currentPreviewProduct.wenan[currentPreviewProduct.selectedWenanIndex] ?
+ currentPreviewProduct.wenan[currentPreviewProduct.selectedWenanIndex].type : '无' }}
+
+
+
+ 文案内容
+
+
+ {{ currentPreviewProduct.wenan[currentPreviewProduct.selectedWenanIndex].content }}
+
+
+ 暂无文案内容
+
+
+
+ 关闭
+
+ 复制文案
+
+
+
+
+
+
+
+ {{ currentFullWenan.productName }}
+ ¥{{ currentFullWenan.publishPrice }}
+ {{ currentFullWenan.wenanType }}
+
+
+ 文案内容
+
+
+ {{ currentFullWenan ? currentFullWenan.wenanContent : '' }}
+
+
+
+ 关闭
+ 复制文案
+
+
@@ -511,9 +744,61 @@ export default {
// 任务详情
detailVisible: false,
currentTask: null,
- taskItems: []
+ taskItems: [],
+
+ // 文案预览
+ wenanPreviewVisible: false,
+ currentPreviewProduct: null,
+
+ // 完整文案查看
+ fullWenanVisible: false,
+ currentFullWenan: null
};
},
+ computed: {
+ // 计算总子账号数
+ totalSubAccountCount() {
+ return Object.values(this.publishForm.accountSubAccounts)
+ .reduce((sum, subAccounts) => sum + subAccounts.length, 0);
+ },
+
+ // 计算总发布数
+ totalPublishCount() {
+ return this.selectedProducts.length * this.totalSubAccountCount;
+ },
+
+ // 生成预览列表
+ previewList() {
+ const list = [];
+
+ for (const product of this.selectedProducts) {
+ for (const appid of this.publishForm.selectedMainAccounts) {
+ const accountName = this.erpAccounts.find(a => a.value === appid)?.label || appid;
+ const subAccounts = this.publishForm.accountSubAccounts[appid] || [];
+
+ for (const subAccount of subAccounts) {
+ const wenanType = product.wenan && product.wenan[product.selectedWenanIndex] ?
+ product.wenan[product.selectedWenanIndex].type : '无';
+ const wenanContent = product.wenan && product.wenan[product.selectedWenanIndex] ?
+ product.wenan[product.selectedWenanIndex].content : '';
+
+ list.push({
+ skuid: product.skuid,
+ productName: product.productName,
+ productImage: product.productImage,
+ publishPrice: product.publishPrice || product.price,
+ accountName: accountName,
+ subAccount: subAccount,
+ wenanType: wenanType,
+ wenanContent: wenanContent
+ });
+ }
+ }
+ }
+
+ return list;
+ }
+ },
created() {
this.loadERPAccounts();
this.loadProvinces();
@@ -748,7 +1033,17 @@ export default {
try {
const res = await parseLineReport({ message: this.lineReportMessage });
if (res.code === 200) {
- this.parsedProducts = res.data || [];
+ this.parsedProducts = (res.data || []).map(product => {
+ // 初始化商品数据
+ return {
+ ...product,
+ publishPrice: product.price || 0, // 默认发布价格=京东价格
+ wenan: product.wenan || [], // 文案数组
+ selectedWenanIndex: 0, // 默认选择第一个文案
+ images: product.images || [] // 图片数组
+ };
+ });
+
if (this.parsedProducts.length === 0) {
this.$modal.msgWarning("未能识别到商品信息,请检查消息内容");
} else {
@@ -833,10 +1128,17 @@ export default {
skuid: p.skuid,
productName: p.productName,
price: p.price,
+ publishPrice: p.publishPrice, // 【新增】发布价格
productImage: p.productImage,
+ images: p.images || [], // 【新增】图片数组
shopName: p.shopName,
shopId: p.shopId,
- commissionInfo: p.commissionInfo
+ commission: p.commission,
+ commissionShare: p.commissionShare,
+ commissionInfo: p.commissionInfo,
+ // 【新增】文案信息
+ wenan: p.wenan || [],
+ selectedWenanIndex: p.selectedWenanIndex || 0
})),
accountConfigs: accountConfigs,
delaySeconds: this.publishForm.delaySeconds,
@@ -860,7 +1162,7 @@ export default {
if (res.code === 200) {
this.publishResult.taskId = res.data;
this.$modal.msgSuccess("批量发品任务已创建");
- this.activeStep = 3;
+ this.activeStep = 5; // 跳转到第六步(发品进度)
this.startRefreshProgress();
} else {
this.$modal.msgError(res.msg || "提交失败");
@@ -1019,6 +1321,142 @@ export default {
3: "失败"
};
return map[status] || "未知";
+ },
+
+ // 预览文案
+ previewWenan(product) {
+ this.currentPreviewProduct = product;
+ this.wenanPreviewVisible = true;
+ },
+
+ // 复制文案
+ copyWenan() {
+ if (!this.currentPreviewProduct || !this.currentPreviewProduct.wenan ||
+ !this.currentPreviewProduct.wenan[this.currentPreviewProduct.selectedWenanIndex]) {
+ this.$modal.msgWarning('没有可复制的文案');
+ return;
+ }
+
+ const content = this.currentPreviewProduct.wenan[this.currentPreviewProduct.selectedWenanIndex].content;
+
+ // 使用现代浏览器的 Clipboard API
+ if (navigator.clipboard && window.isSecureContext) {
+ navigator.clipboard.writeText(content).then(() => {
+ this.$modal.msgSuccess('文案已复制到剪贴板');
+ }).catch(() => {
+ this.fallbackCopyToClipboard(content);
+ });
+ } else {
+ this.fallbackCopyToClipboard(content);
+ }
+ },
+
+ // 降级复制方案
+ fallbackCopyToClipboard(text) {
+ const textArea = document.createElement("textarea");
+ textArea.value = text;
+ textArea.style.position = "fixed";
+ textArea.style.left = "-999999px";
+ document.body.appendChild(textArea);
+ textArea.focus();
+ textArea.select();
+ try {
+ document.execCommand('copy');
+ this.$modal.msgSuccess('文案已复制到剪贴板');
+ } catch (err) {
+ this.$modal.msgError('复制失败,请手动复制');
+ }
+ document.body.removeChild(textArea);
+ },
+
+ // 批量设置价格
+ batchSetPrice() {
+ if (this.selectedProducts.length === 0) {
+ this.$modal.msgWarning('请先选择商品');
+ return;
+ }
+
+ this.$prompt('请输入统一的发布价格', '批量设置', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ inputPattern: /^\d+(\.\d{1,2})?$/,
+ inputErrorMessage: '请输入有效的价格(最多两位小数)'
+ }).then(({ value }) => {
+ this.selectedProducts.forEach(p => {
+ p.publishPrice = parseFloat(value);
+ });
+ this.$modal.msgSuccess('批量设置成功');
+ }).catch(() => {});
+ },
+
+ // 批量选择文案版本
+ batchSetWenan() {
+ if (this.selectedProducts.length === 0) {
+ this.$modal.msgWarning('请先选择商品');
+ return;
+ }
+
+ // 找到第一个有文案的商品作为参考
+ const firstProductWithWenan = this.selectedProducts.find(p => p.wenan && p.wenan.length > 0);
+ if (!firstProductWithWenan) {
+ this.$modal.msgWarning('所有商品都没有可用的文案');
+ return;
+ }
+
+ // 构建选项
+ const options = firstProductWithWenan.wenan.map((w, index) => ({
+ label: w.type,
+ value: index
+ }));
+
+ this.$prompt('请选择文案版本(索引)', '批量设置', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ inputType: 'number',
+ inputPlaceholder: `请输入 0 到 ${options.length - 1} 之间的数字`
+ }).then(({ value }) => {
+ const index = parseInt(value);
+ if (isNaN(index) || index < 0 || index >= options.length) {
+ this.$modal.msgError(`请输入 0 到 ${options.length - 1} 之间的数字`);
+ return;
+ }
+
+ let successCount = 0;
+ this.selectedProducts.forEach(p => {
+ if (p.wenan && p.wenan.length > index) {
+ p.selectedWenanIndex = index;
+ successCount++;
+ }
+ });
+
+ this.$modal.msgSuccess(`成功设置 ${successCount} 个商品的文案版本为:${options[index].label}`);
+ }).catch(() => {});
+ },
+
+ // 查看完整文案(预览页面使用)
+ viewFullWenan(row) {
+ this.currentFullWenan = row;
+ this.fullWenanVisible = true;
+ },
+
+ // 复制完整文案
+ copyFullWenan() {
+ if (!this.currentFullWenan || !this.currentFullWenan.wenanContent) {
+ this.$modal.msgWarning('没有可复制的文案');
+ return;
+ }
+
+ const content = this.currentFullWenan.wenanContent;
+
+ if (navigator.clipboard && window.isSecureContext) {
+ navigator.clipboard.writeText(content).then(() => {
+ this.$modal.msgSuccess('文案已复制到剪贴板');
+ }).catch(() => {
+ this.fallbackCopyToClipboard(content);
+ });
+ } else {
+ this.fallbackCopyToClipboard(content);
+ }
}
}
};