Files
temu-plugin/src/view/selection/NiubiCopy.vue

128 lines
4.0 KiB
Vue
Raw Normal View History

2023-09-25 10:13:54 +08:00
<template>
<div>
<ai-list class="list">
<ai-title
slot="title"
title="智能复制"
tips="请先在当前浏览器登录“拼多多跨境卖家中心”,期间保持登录状态"
isShowBottomBorder>
</ai-title>
<template slot="content">
<div class="content">
<ai-search-bar>
<template #left>
2023-09-26 13:52:52 +08:00
<div class="search-item">
2023-10-10 15:32:42 +08:00
<label style="width:80px">来源</label>
2023-09-26 13:52:52 +08:00
<ai-select :selectList="$dict.getDict('copy_from')" :clearable="true" v-model="search.type" @change="search.current =1, getList()"></ai-select>
</div>
<div class="search-item">
2023-10-10 15:32:42 +08:00
<label style="width:80px">店铺</label>
2023-09-26 13:52:52 +08:00
<el-select v-model="search.mallId" :clearable="true" @change="search.current =1, getList()" placeholder="请选择店铺" size="small">
<el-option
v-for="item in $store.state.mallList"
:key="item.mallId"
:label="item.mallName"
:value="item.mallId">
</el-option>
</el-select>
</div>
2023-09-25 10:13:54 +08:00
</template>
<template #right>
2023-09-26 13:52:52 +08:00
<el-button type="primary" @click="search.current =1, getList()">查询</el-button>
</template>
</ai-search-bar>
<ai-search-bar>
<template #left>
2023-10-07 15:30:41 +08:00
<el-button type="button" :class="'el-button el-button--primary'" @click="beforeCopy()">开始复制</el-button>
2023-09-25 10:13:54 +08:00
</template>
</ai-search-bar>
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
style="margin-top: 8px;"
:current.sync="search.current" :size.sync="search.size"
@getList="getList">
2023-10-10 15:32:42 +08:00
<el-table-column slot="url" label="商品地址" align="left">
<template slot-scope="scope">
2023-10-25 12:20:10 +08:00
<div><a class="el-link el-link--primary" :href="scope.row.url" target="_blank">{{ scope.row.url }}</a></div>
2023-10-10 15:32:42 +08:00
</template>
</el-table-column>
2023-09-25 10:13:54 +08:00
</ai-table>
</div>
</template>
</ai-list>
<ai-dialog
title="复制"
:visible.sync="copyFromDlgShow"
:close-on-click-modal="false"
width="790px"
customFooter
@close="handleClose">
2023-10-15 22:09:33 +08:00
<ai-copy-from-temu v-if="copyFromDlgShow" @onClose="handleClose" @onSuccess="handleSuccess"></ai-copy-from-temu>
2023-09-25 10:13:54 +08:00
</ai-dialog>
</div>
</template>
<script>
2023-10-15 22:09:33 +08:00
import AiCopyFromTemu from "@/components/AiCopyFromTemu.vue";
2023-09-25 10:13:54 +08:00
export default {
2023-10-07 15:30:41 +08:00
name: 'NiubiCopy',
2023-10-15 22:09:33 +08:00
components: {AiCopyFromTemu},
2023-09-25 10:13:54 +08:00
data () {
return {
search: {
current: 1,
size: 10,
2023-09-26 13:52:52 +08:00
type: '',
mallId: ''
2023-09-25 10:13:54 +08:00
},
2023-10-15 22:09:33 +08:00
2023-09-25 10:13:54 +08:00
colConfigs: [
2023-10-10 15:32:42 +08:00
{ slot: 'url', label: '商品地址', align: 'left' },
2023-10-09 15:32:52 +08:00
{ prop: 'type', label: '来源', width: '100px', align: 'left',format: v => this.$dict.getLabel('copy_from', v), },
{ prop: 'mallName', label: '店铺名称', width: '200px', align: 'left'},
2023-10-16 01:23:01 +08:00
{ prop: 'createTime', label: '复制时间', width: '180px'}
2023-09-25 10:13:54 +08:00
],
tableData: [],
total: 0,
copyFromDlgShow: false,
}
},
created () {
2023-09-26 13:52:52 +08:00
this.$dict.load('copy_from');
2023-10-09 15:32:52 +08:00
this.getList()
2023-09-25 10:13:54 +08:00
},
methods: {
getList () {
2023-09-26 13:52:52 +08:00
this.$http.post('/api/copyProduct/myPage',null,{
2023-09-25 10:13:54 +08:00
params: {
...this.search
}
}).then(res => {
this.tableData = res.data.records
this.total = res.data.total
})
},
2023-10-07 15:30:41 +08:00
beforeCopy() {
2023-09-25 10:13:54 +08:00
this.copyFromDlgShow = true
},
2023-10-15 22:09:33 +08:00
handleClose() {
this.copyFromDlgShow = false
2023-09-27 09:00:28 +08:00
},
2023-10-15 22:09:33 +08:00
// 添加模板成功
handleSuccess() {
this.copyFromDlgShow = false
this.getList()
2023-09-25 10:13:54 +08:00
}
}
}
</script>
<style scoped lang="scss">
</style>