AI生成话术
This commit is contained in:
@@ -93,7 +93,23 @@
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="话术内容" prop="scriptContent">
|
||||
<VditorEditor v-model="form.scriptContent" />
|
||||
<div style="position: relative;">
|
||||
<el-button
|
||||
style="position: absolute; right: 20px; bottom: 20px; z-index: 1000;"
|
||||
v-if="form.productId"
|
||||
type="primary"
|
||||
:loading="generateScriptLoading"
|
||||
@click="handleGenerateScript">
|
||||
生成话术
|
||||
</el-button>
|
||||
<VditorEditor
|
||||
v-loading="generateScriptLoading"
|
||||
:disabled="generateScriptLoading"
|
||||
element-loading-text="生成中..."
|
||||
v-model="form.scriptContent"
|
||||
/>
|
||||
</div>
|
||||
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -120,7 +136,7 @@
|
||||
|
||||
|
||||
<script>
|
||||
import { listProductSalesScript, getProductSalesScript, delProductSalesScript, addProductSalesScript, updateProductSalesScript } from "@/api/wms/productSalesScript";
|
||||
import { listProductSalesScript, getProductSalesScript, delProductSalesScript, addProductSalesScript, updateProductSalesScript, generateForProduct } from "@/api/wms/productSalesScript";
|
||||
import ProductSelect from '@/components/KLPService/ProductSelect';
|
||||
import VditorEditor from '@/components/VditorEditor.vue';
|
||||
|
||||
@@ -183,7 +199,8 @@ export default {
|
||||
remark: [
|
||||
{ required: true, message: "备注不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
},
|
||||
generateScriptLoading: false
|
||||
};
|
||||
},
|
||||
created() {
|
||||
@@ -319,6 +336,22 @@ export default {
|
||||
// 跳转详情页
|
||||
goToDetail(scriptId) {
|
||||
this.$router.push({ path: `/shop/rich/${scriptId}` });
|
||||
},
|
||||
handleGenerateScript() {
|
||||
this.generateScriptLoading = true;
|
||||
const payload = {
|
||||
productId: this.form.productId,
|
||||
scriptCount: 1
|
||||
}
|
||||
if (this.form.scriptTitle) {
|
||||
payload.customPrompt = '本条话术的标题为:' + this.form.scriptTitle;
|
||||
}
|
||||
generateForProduct(payload).then(response => {
|
||||
this.form.scriptContent = response.data[0].scriptContent;
|
||||
// console.log(response.data[0], 'response');
|
||||
}).finally(() => {
|
||||
this.generateScriptLoading = false;
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user