1
This commit is contained in:
@@ -336,32 +336,7 @@
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 快速发品对话框 -->
|
||||
<el-dialog title="快速发品" :visible.sync="quickPublishVisible" width="600px" append-to-body>
|
||||
<el-form ref="quickPublishForm" :model="quickPublishForm" :rules="quickPublishRules" label-width="100px">
|
||||
<el-form-item label="ERP应用" prop="appid">
|
||||
<el-select v-model="quickPublishForm.appid" placeholder="请选择ERP应用" style="width: 100%">
|
||||
<el-option
|
||||
v-for="app in erpApps"
|
||||
:key="app.value"
|
||||
:label="app.label"
|
||||
:value="app.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品信息">
|
||||
<div style="padding: 10px; background: #f5f5f5; border-radius: 4px;">
|
||||
<div><strong>商品名称:</strong>{{ selectedProduct.productName }}</div>
|
||||
<div><strong>店铺名称:</strong>{{ selectedProduct.shopName }}</div>
|
||||
<div><strong>商品价格:</strong>¥{{ selectedProduct.price }}</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="quickPublishVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="submitQuickPublish" :loading="quickPublishLoading">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
|
||||
<!-- 通用发品对话框:从常用商品直接进入,不显示ERP应用选择 -->
|
||||
<PublishDialog :visible.sync="publishDialogVisible" :initial-data="publishInitialData" :hideAppid="true" />
|
||||
@@ -369,10 +344,11 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listFavoriteProduct, getFavoriteProduct, delFavoriteProduct, addFavoriteProduct, updateFavoriteProduct, updateTopStatus, quickPublishFromFavorite } from "@/api/system/favoriteProduct";
|
||||
import { listFavoriteProduct, getFavoriteProduct, delFavoriteProduct, addFavoriteProduct, updateFavoriteProduct, updateTopStatus } from "@/api/system/favoriteProduct";
|
||||
import { generatePromotionContent } from "@/api/system/jdorder";
|
||||
import { mapGetters, mapActions } from 'vuex'
|
||||
import PublishDialog from '@/components/PublishDialog.vue'
|
||||
// 自动加入常用逻辑由 PublishDialog 内部触发(线报、转链页面),本页主要用于打开发品弹窗
|
||||
|
||||
export default {
|
||||
name: "FavoriteProduct",
|
||||
@@ -426,24 +402,7 @@ export default {
|
||||
// ERP商品对话框
|
||||
erpDialogVisible: false,
|
||||
erpProducts: [],
|
||||
// 快速发品对话框
|
||||
quickPublishVisible: false,
|
||||
quickPublishForm: {
|
||||
appid: ''
|
||||
},
|
||||
quickPublishRules: {
|
||||
appid: [
|
||||
{ required: true, message: "请选择ERP应用", trigger: "change" }
|
||||
]
|
||||
},
|
||||
selectedProduct: {},
|
||||
quickPublishLoading: false,
|
||||
// ERP应用列表
|
||||
erpApps: [
|
||||
{ label: '闲鱼', value: 'xianyu' },
|
||||
{ label: '淘宝', value: 'taobao' },
|
||||
{ label: '京东', value: 'jd' }
|
||||
],
|
||||
|
||||
// 通用发品弹窗
|
||||
publishDialogVisible: false,
|
||||
publishInitialData: {}
|
||||
@@ -618,8 +577,9 @@ export default {
|
||||
const p = res && res.data ? res.data : (row || {});
|
||||
try {
|
||||
let detail = null;
|
||||
if (p.productUrl) {
|
||||
const r = await generatePromotionContent({ promotionContent: p.productUrl });
|
||||
const inputContent = p.productUrl || p.productName || p.skuid || '';
|
||||
if (inputContent) {
|
||||
const r = await generatePromotionContent({ promotionContent: inputContent });
|
||||
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) {}
|
||||
}
|
||||
@@ -651,21 +611,7 @@ export default {
|
||||
this.publishDialogVisible = true;
|
||||
});
|
||||
},
|
||||
/** 提交快速发品 */
|
||||
submitQuickPublish() {
|
||||
this.$refs["quickPublishForm"].validate(valid => {
|
||||
if (valid) {
|
||||
this.quickPublishLoading = true;
|
||||
quickPublishFromFavorite(this.selectedProduct.id, this.quickPublishForm.appid).then(response => {
|
||||
this.$modal.msgSuccess("发品请求已提交");
|
||||
this.quickPublishVisible = false;
|
||||
this.quickPublishLoading = false;
|
||||
}).catch(() => {
|
||||
this.quickPublishLoading = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user