1
This commit is contained in:
@@ -9,15 +9,20 @@
|
||||
<div class="search-item__wrapper">
|
||||
<div class="left">
|
||||
<div class="search-item">
|
||||
<label>添加方式:</label>
|
||||
<el-radio-group v-model="addType" size="small">
|
||||
<label>打印方式:</label>
|
||||
<el-radio-group v-model="addType" size="small" @click="lableList = [], search.productSkuId = '', search.productSkcId = ''">
|
||||
<el-radio-button label="1">按备货单打印</el-radio-button>
|
||||
<el-radio-button label="2">按SKC打印</el-radio-button>
|
||||
<el-radio-button label="3">按SKU打印</el-radio-button>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<label>店铺:</label>
|
||||
</div>
|
||||
<div class="right"></div>
|
||||
</div>
|
||||
<div class="search-item__wrapper">
|
||||
<div class="left">
|
||||
<div class="search-item" v-show="addType === '1'">
|
||||
<label>发货单:</label>
|
||||
<el-select v-model="search.mallId" placeholder="请选择店铺" size="small">
|
||||
<el-option
|
||||
v-for="item in $store.state.mallList"
|
||||
@@ -26,30 +31,10 @@
|
||||
:value="item.mallId">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-button style="margin-left: 10px;" size="small" :disabled="!search.mallId" :loading="isLoading" @click="searchSkuList">查询</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right"></div>
|
||||
</div>
|
||||
<div class="search-item__wrapper">
|
||||
<div class="left">
|
||||
<div class="search-item" v-show="addType === '1'">
|
||||
<label>备货单:</label>
|
||||
<el-button style="margin-left: 10px;" size="small" :disabled="!search.mallId" :loading="isLoading">查询</el-button>
|
||||
</div>
|
||||
<div class="search-item" v-show="addType === '2'">
|
||||
<label>SKC:</label>
|
||||
<el-input
|
||||
v-model="search.productSkcId"
|
||||
style="width: 250px"
|
||||
size="small"
|
||||
placeholder="多个查询请用户逗号分割"
|
||||
clearable
|
||||
suffix-icon="iconfont iconSearch">
|
||||
</el-input>
|
||||
<el-button style="margin-left: 10px;" @click="getList" size="small" :loading="isLoading">查询</el-button>
|
||||
</div>
|
||||
<div class="search-item" v-show="addType === '3'">
|
||||
<label>SKU:</label>
|
||||
<div class="search-item" v-show="addType === '2' || addType === '3'">
|
||||
<label>{{ addType === '2' ? 'SKC:' : 'SKU:' }}</label>
|
||||
<el-input
|
||||
v-if="addType === '3'"
|
||||
v-model="search.productSkuId"
|
||||
@@ -59,6 +44,29 @@
|
||||
placeholder="多个查询请用户逗号分割"
|
||||
suffix-icon="iconfont iconSearch">
|
||||
</el-input>
|
||||
<el-input
|
||||
v-else
|
||||
v-model="search.productSkcId"
|
||||
style="width: 250px"
|
||||
size="small"
|
||||
placeholder="多个查询请用户逗号分割"
|
||||
clearable
|
||||
suffix-icon="iconfont iconSearch">
|
||||
</el-input>
|
||||
<el-select
|
||||
clearable
|
||||
v-model="search.templateId"
|
||||
placeholder="请选择模板"
|
||||
size="small"
|
||||
@change="getList"
|
||||
style="margin-left: 10px;">
|
||||
<el-option
|
||||
v-for="item in templateList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-button style="margin-left: 10px;" @click="getList" size="small" :loading="isLoading">查询</el-button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -69,7 +77,6 @@
|
||||
:isShowPagination="false"
|
||||
:height="height"
|
||||
@getList="() => {}"
|
||||
@selection-change="handleSelectionChange"
|
||||
:loading="isLoading">
|
||||
<el-table-column slot="options" label="操作" align="center" fixed="right" width="140px">
|
||||
<template v-slot="{ row }">
|
||||
@@ -81,6 +88,17 @@
|
||||
</el-table-column>
|
||||
</ai-table>
|
||||
<Print ref="printRef" :isPrint="true"></Print>
|
||||
<ai-dialog
|
||||
:visible.sync="isShow"
|
||||
title="打印数量"
|
||||
width="890px"
|
||||
@confirm="onConfirm">
|
||||
<el-form class="ai-form" :model="form" ref="form" label-width="80px">
|
||||
<el-form-item label="标签名称" style="width: 100%;" prop="count" :rules="[{ required: true, message: '请输入打印数量', trigger: 'change' }]">
|
||||
<el-input-number v-model="form.count" :min="1" :max="500" label="请输入打印数量"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ai-dialog>
|
||||
</template>
|
||||
</ai-list>
|
||||
</template>
|
||||
@@ -113,13 +131,21 @@
|
||||
productSkuId: '',
|
||||
productSkcId: '',
|
||||
page: 1,
|
||||
size: -1
|
||||
size: -1,
|
||||
templateId: ''
|
||||
},
|
||||
addType: '1',
|
||||
isLoading: false,
|
||||
lableList: [],
|
||||
height: 600,
|
||||
skuChoosedList: []
|
||||
skuChoosedList: [],
|
||||
isShow: false,
|
||||
form: {
|
||||
count: 1
|
||||
},
|
||||
printData: [],
|
||||
templateList: [],
|
||||
page: 1
|
||||
}
|
||||
},
|
||||
|
||||
@@ -134,26 +160,47 @@
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.getTemplateList()
|
||||
this.$nextTick(() => {
|
||||
this.height = document.querySelector('.ai-list__content--right').clientHeight - 140
|
||||
})
|
||||
},
|
||||
|
||||
methods: {
|
||||
getTemplateList () {
|
||||
this.$http.post('/api/template/getPage?size=-1').then(res => {
|
||||
if (res.code === 0) {
|
||||
this.templateList = res.data.records
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
toPrint(row) {
|
||||
this.isLoading = true
|
||||
this.$http.post(`/api/template/detail?id=${row.templateId}`).then(res => {
|
||||
this.isLoading = false
|
||||
const params = JSON.parse(res.data.params)
|
||||
const getValue = v => params.filter(e => e.fieldValue === v)[0].fieldName
|
||||
Object.keys(row).forEach(key => {
|
||||
if (params.findIndex(v => v.fieldValue === key) > -1) {
|
||||
row[getValue(key)] = row[key]
|
||||
}
|
||||
})
|
||||
|
||||
if (res.code === 0) {
|
||||
this.$refs.printRef.toPrint(JSON.parse(res.data.content), row)
|
||||
const params = JSON.parse(res.data.params)
|
||||
const getValue = v => params.filter(e => e.fieldValue === v)[0].fieldName
|
||||
Object.keys(row).forEach(key => {
|
||||
if (params.findIndex(v => v.fieldValue === key) > -1) {
|
||||
row[getValue(key)] = row[key]
|
||||
}
|
||||
})
|
||||
this.printData = {
|
||||
template: JSON.parse(res.data.content),
|
||||
data: row
|
||||
}
|
||||
this.isShow = true
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
onConfirm () {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
this.isShow = false
|
||||
this.$refs.printRef.toPrint(this.printData.template, new Array(this.form.count).fill(this.printData.data))
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -178,8 +225,94 @@
|
||||
})
|
||||
},
|
||||
|
||||
handleSelectionChange(e) {
|
||||
this.skuChoosedList = e
|
||||
getDeliveryOrderSn (page) {
|
||||
return new Promise(resolve => {
|
||||
sendChromeAPIMessage({
|
||||
url: 'bgSongbird-api/supplier/deliverGoods/management/pageQueryDeliveryBatch',
|
||||
needMallId: true,
|
||||
mallId: this.search.mallId,
|
||||
anti: true,
|
||||
data: {
|
||||
pageNo: page,
|
||||
status: 1,
|
||||
onlyTaxWarehouseWaitApply: false,
|
||||
productLabelCodeStyle: 0,
|
||||
pageSize: 200
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.errorCode == 1000000) {
|
||||
resolve({
|
||||
list: res.result.list.map(v => v.deliveryOrderSn),
|
||||
isHasNext: res.result.total && res.result.list.length && (res.result.list.length < 200)
|
||||
})
|
||||
} else {
|
||||
resolve({ list: [], isHasNext: false })
|
||||
}
|
||||
}).catch(() => {
|
||||
resolve({ list: [], isHasNext: false })
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
getLabels (deliveryOrderSnList) {
|
||||
return new Promise(resolve => {
|
||||
sendChromeAPIMessage({
|
||||
url: 'bgSongbird-api/supplier/deliverGoods/management/printProductSkuLabel',
|
||||
needMallId: true,
|
||||
mallId: this.search.mallId,
|
||||
anti: true,
|
||||
data: {
|
||||
deliveryOrderSnList: deliveryOrderSnList
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.errorCode == 1000000) {
|
||||
resolve(res.data.result.map(v => {
|
||||
return {
|
||||
productName: v.productName,
|
||||
productSkcId: v.productSkcId,
|
||||
productSkuId: v.productSkuId,
|
||||
labelCode: v.labelCode,
|
||||
skuExtCode: v.skuExtCode,
|
||||
deliveryNum: v.deliveryNum,
|
||||
skuSpecName: v.secondarySpecVOList.map(item => {
|
||||
return item.specName
|
||||
}).join(',')
|
||||
}
|
||||
}))
|
||||
} else {
|
||||
resolve([])
|
||||
}
|
||||
}).catch(() => {
|
||||
resolve([])
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
async searchSkuList () {
|
||||
let page = 1
|
||||
let isHasNext = true
|
||||
let list = []
|
||||
let deliveryOrderSnList = []
|
||||
this.isLoading = true
|
||||
while (isHasNext) {
|
||||
const result = await this.getDeliveryOrderSn(page)
|
||||
page = page + 1
|
||||
isHasNext = result.isHasNext ? true : false
|
||||
deliveryOrderSnList.push(...result.list)
|
||||
|
||||
await this.$sleepSync(1000)
|
||||
}
|
||||
|
||||
const len = Math.ceil(deliveryOrderSnList.length / 100)
|
||||
for (let i = 0; i < len; i++) {
|
||||
this.page = 1
|
||||
const ids = [...new Set(deliveryOrderSnList)].slice(i * 100, i * 100 + 100).join(',')
|
||||
const res = await this.getLabels(ids)
|
||||
list.push(...res)
|
||||
await this.$sleepSync(500)
|
||||
}
|
||||
|
||||
console.log(list)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
:auto-upload="false"
|
||||
:file-list="fileList"
|
||||
:on-change="onExcelChange">
|
||||
<el-button size="small" type="danger">Excel导入</el-button>
|
||||
<el-button size="small" type="danger" :disabled="!skuList.length">Excel导入</el-button>
|
||||
</el-upload>
|
||||
<json-excel
|
||||
:data="skuList"
|
||||
@@ -29,19 +29,44 @@
|
||||
<el-button size="small" type="warning" :disabled="!skuList.length">Excel导出</el-button>
|
||||
</json-excel>
|
||||
</template>
|
||||
<template #right>
|
||||
</ai-search-bar>
|
||||
<ai-search-bar>
|
||||
<template #left>
|
||||
<div class="search-item" style="margin-bottom: 0;">
|
||||
<label>SKU:</label>
|
||||
<el-input
|
||||
v-model="search.productSkuId"
|
||||
style="width: 250px"
|
||||
size="small"
|
||||
clearable
|
||||
placeholder="请输入SKU"
|
||||
suffix-icon="iconfont iconSearch"
|
||||
@clear="getList">
|
||||
</el-input>
|
||||
</div>
|
||||
<div class="search-item" style="margin-bottom: 0;">
|
||||
<label>SKC:</label>
|
||||
<el-input
|
||||
v-model="search.productSkcId"
|
||||
style="width: 250px"
|
||||
size="small"
|
||||
placeholder="请输入SKC"
|
||||
clearable
|
||||
suffix-icon="iconfont iconSearch"
|
||||
@clear="getList">
|
||||
</el-input>
|
||||
</div>
|
||||
<el-button style="margin-left: 10px;" @click="getList" size="small" :loading="pageShow">查询</el-button>
|
||||
</template>
|
||||
</ai-search-bar>
|
||||
<ai-table
|
||||
:tableData="skuList"
|
||||
:col-configs="colConfigs"
|
||||
:total="total"
|
||||
:current.sync="search.current"
|
||||
:size.sync="search.size"
|
||||
style="margin-top: 8px;"
|
||||
@getList="getList"
|
||||
@selection-change="handleSelectionChange"
|
||||
v-loading="pageShow">
|
||||
v-loading="pageShow"
|
||||
:isShowPagination="false">
|
||||
<el-table-column
|
||||
v-for="(item, index) in relationList"
|
||||
:key="index"
|
||||
@@ -50,19 +75,19 @@
|
||||
:label="item.name"
|
||||
align="center">
|
||||
</el-table-column>
|
||||
<!-- <el-table-column slot="options" label="操作" align="center" fixed="right" width="240px">
|
||||
<el-table-column slot="options" label="操作" align="center" fixed="right" width="120px">
|
||||
<template v-slot="{ row }">
|
||||
<div class="table-options">
|
||||
<el-button type="text" @click="toAdd(row.url)">编辑</el-button>
|
||||
<el-button type="text" @click="toDetail(row.url)">删除</el-button>
|
||||
<el-button type="text" @click="remove(row.id)">删除</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
</el-table-column>
|
||||
</ai-table>
|
||||
<ai-dialog
|
||||
:visible.sync="isShow"
|
||||
title="添加SKU"
|
||||
width="1400px"
|
||||
customFooter
|
||||
@confirm="onConfirm">
|
||||
<div class="search-item__wrapper">
|
||||
<div class="left">
|
||||
@@ -155,6 +180,10 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</ai-table>
|
||||
<template #footer>
|
||||
<el-button @click="isShow = false">取消</el-button>
|
||||
<el-button @click="onConfirm" type="primary" :loading="btnLoading">确认</el-button>
|
||||
</template>
|
||||
</ai-dialog>
|
||||
</template>
|
||||
</ai-list>
|
||||
@@ -176,7 +205,9 @@
|
||||
total: 0,
|
||||
search: {
|
||||
current: 1,
|
||||
size: 100
|
||||
size: -1,
|
||||
productSkuId: '',
|
||||
productSkcId: ''
|
||||
},
|
||||
lableSearch: {
|
||||
current: 1,
|
||||
@@ -225,7 +256,8 @@
|
||||
id: '',
|
||||
fileList: [],
|
||||
pageShow: false,
|
||||
relationList: []
|
||||
relationList: [],
|
||||
btnLoading: false
|
||||
}
|
||||
},
|
||||
|
||||
@@ -239,7 +271,7 @@
|
||||
},
|
||||
|
||||
colConfigs () {
|
||||
const arr = this.isShow ? [] : this.relationList.map(v => {
|
||||
const fields = this.isShow ? [] : this.relationList.map(v => {
|
||||
return {
|
||||
prop: v.field,
|
||||
label: v.name,
|
||||
@@ -256,7 +288,7 @@
|
||||
{ prop: 'productSkuId', label: 'SKU', align: 'center' },
|
||||
{ prop: 'skuExtCode', label: 'SKU货号', align: 'center' },
|
||||
{ prop: 'skuSpecName', label: '次销售属性', align: 'center' },
|
||||
...arr
|
||||
...fields
|
||||
]
|
||||
},
|
||||
|
||||
@@ -287,8 +319,6 @@
|
||||
this.$http.post(`/api/templateRelation/getRelation?templateId=${this.$route.query.id}`).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.relationList = res.data
|
||||
|
||||
console.log(this.relationList)
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -313,7 +343,6 @@
|
||||
onExcelChange (file) {
|
||||
this.pageShow = true
|
||||
this.readXLSX(file.raw).then(res => {
|
||||
console.log(res)
|
||||
this.$http.post(`/api/templateSku/updateBatchSku`, res.map(v => {
|
||||
const result = {
|
||||
templateId: this.id
|
||||
@@ -322,7 +351,6 @@
|
||||
result[this.jsonFields[item]] = v[item]
|
||||
})
|
||||
|
||||
console.log(result)
|
||||
return result
|
||||
})).then(res => {
|
||||
if (res.code === 0) {
|
||||
@@ -341,7 +369,6 @@
|
||||
},
|
||||
|
||||
handleSelectionChange(e) {
|
||||
console.log(e)
|
||||
this.chooseSkuList = e
|
||||
},
|
||||
|
||||
@@ -353,7 +380,7 @@
|
||||
mallId: this.lableSearch.mallId,
|
||||
anti: true,
|
||||
data: {
|
||||
page: 1,
|
||||
page: page,
|
||||
pageSize: 200,
|
||||
catIds: catIds
|
||||
}
|
||||
@@ -361,7 +388,7 @@
|
||||
if (res.errorCode == 1000000) {
|
||||
resolve({
|
||||
list: res.result.pageItems.map(v => v.productSkcId),
|
||||
isHasNext: page * 200 < res.result.total
|
||||
isHasNext: res.result.pageItems.length < 200
|
||||
})
|
||||
} else {
|
||||
resolve({ list: [], isHasNext: false })
|
||||
@@ -373,35 +400,28 @@
|
||||
},
|
||||
|
||||
async onCateChange() {
|
||||
this.$userCheck(this.lableSearch.mallId).then(async () => {
|
||||
let page = 1
|
||||
let list = []
|
||||
let isHasNext = true
|
||||
this.lableList = []
|
||||
this.isLoading = true
|
||||
while (isHasNext) {
|
||||
const result = await this.getSKCList([].concat(this.targetCatId.flat()), page)
|
||||
page = page + 1
|
||||
isHasNext = result.isHasNext ? true : false
|
||||
list.push(...result.list)
|
||||
let page = 1
|
||||
let list = []
|
||||
let isHasNext = true
|
||||
this.lableList = []
|
||||
this.isLoading = true
|
||||
while (isHasNext) {
|
||||
const result = await this.getSKCList([].concat(this.targetCatId.flat()), page)
|
||||
page = page + 1
|
||||
isHasNext = result.isHasNext ? true : false
|
||||
list.push(...result.list)
|
||||
|
||||
await this.$sleepSync(5000)
|
||||
}
|
||||
await this.$sleepSync(1000)
|
||||
}
|
||||
|
||||
const skcList = [...new Set(list)]
|
||||
const len = Math.ceil(skcList.length / 100)
|
||||
for (let i = 0; i < len; i++) {
|
||||
this.skuReqParams.page = 1
|
||||
this.skuReqParams.SKC = [...new Set(list)].slice(i * 100, i * 100 + 100).join(',')
|
||||
await this.requestSKUList(true)
|
||||
await this.$sleepSync(2000)
|
||||
}
|
||||
|
||||
console.log(111)
|
||||
this.isLoading = false
|
||||
}).catch(() => {
|
||||
this.lableSearch.mallId = ''
|
||||
})
|
||||
const skcList = [...new Set(list)]
|
||||
const len = Math.ceil(skcList.length / 100)
|
||||
for (let i = 0; i < len; i++) {
|
||||
this.skuReqParams.page = 1
|
||||
this.skuReqParams.SKC = [...new Set(list)].slice(i * 100, i * 100 + 100).join(',')
|
||||
await this.requestSKUList(true)
|
||||
await this.$sleepSync(500)
|
||||
}
|
||||
},
|
||||
|
||||
requestSKUList(flag) {
|
||||
@@ -437,7 +457,7 @@
|
||||
|
||||
if (res.result.total > this.lableList.length) {
|
||||
this.skuReqParams.page++
|
||||
await this.$sleepSync(5000)
|
||||
await this.$sleepSync(500)
|
||||
await this.requestSKUList()
|
||||
} else {
|
||||
!flag && (this.isLoading = false)
|
||||
@@ -451,22 +471,25 @@
|
||||
return this.$message.error('请选择店铺')
|
||||
}
|
||||
|
||||
this.$userCheck(this.lableSearch.mallId).then(() => {
|
||||
this.lableList = []
|
||||
this.skuReqParams.page = 1
|
||||
this.isLoading = true
|
||||
this.requestSKUList()
|
||||
}).catch(() => {
|
||||
this.lableSearch.mallId = ''
|
||||
})
|
||||
this.lableList = []
|
||||
this.skuReqParams.page = 1
|
||||
this.isLoading = true
|
||||
this.requestSKUList()
|
||||
},
|
||||
|
||||
getList () {
|
||||
this.$http.post(`/api/templateSku/getPage?size=-1&templateId=${this.id}`).then(res => {
|
||||
this.pageShow = true
|
||||
this.$http.post(`/api/templateSku/getPage`, null, {
|
||||
params: {
|
||||
...this.search,
|
||||
templateId: this.id
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.skuList = res.data.records
|
||||
// this.total = res.data.total
|
||||
}
|
||||
|
||||
this.pageShow = false
|
||||
})
|
||||
},
|
||||
|
||||
@@ -475,6 +498,7 @@
|
||||
return this.$message.error('请选择SKU')
|
||||
}
|
||||
|
||||
this.btnLoading = true
|
||||
this.$http.post(`/api/templateSku/addBatchSku`, this.chooseSkuList.map(v => {
|
||||
return {
|
||||
...v,
|
||||
@@ -486,8 +510,24 @@
|
||||
this.isShow = false
|
||||
this.getList()
|
||||
}
|
||||
|
||||
this.btnLoading = false
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
remove (id) {
|
||||
this.$confirm('确定删除该数据?', '温馨提示', {
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http.post(`/api/templateSku/removeById?id=${id}`).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$message.success('删除成功')
|
||||
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -8,10 +8,42 @@
|
||||
<template slot="content">
|
||||
<ai-search-bar>
|
||||
<template #left>
|
||||
<div class="search-item">
|
||||
<label>SKU:</label>
|
||||
<el-input
|
||||
v-model="search.productSkuId"
|
||||
style="width: 250px"
|
||||
size="small"
|
||||
clearable
|
||||
placeholder="请输入SKU"
|
||||
suffix-icon="iconfont iconSearch">
|
||||
</el-input>
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<label>SKC:</label>
|
||||
<el-input
|
||||
v-model="search.productSkcId"
|
||||
style="width: 250px"
|
||||
size="small"
|
||||
placeholder="请输入SKC"
|
||||
clearable
|
||||
suffix-icon="iconfont iconSearch">
|
||||
</el-input>
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<label>模板名称:</label>
|
||||
<el-input
|
||||
v-model="search.name"
|
||||
style="width: 250px"
|
||||
size="small"
|
||||
placeholder="请输入模板名称"
|
||||
clearable
|
||||
suffix-icon="iconfont iconSearch">
|
||||
</el-input>
|
||||
</div>
|
||||
<el-button style="margin-left: 10px;" @click="getList" size="small" :loading="isLoading">查询</el-button>
|
||||
<el-button type="primary" size="small" @click="toAdd('')">添加</el-button>
|
||||
</template>
|
||||
<template #right>
|
||||
</template>
|
||||
</ai-search-bar>
|
||||
<ai-table
|
||||
:tableData="tableData"
|
||||
@@ -20,13 +52,14 @@
|
||||
:current.sync="search.current"
|
||||
:size.sync="search.size"
|
||||
style="margin-top: 8px;"
|
||||
@getList="getList">
|
||||
@getList="getList"
|
||||
:loading="isLoading">
|
||||
<el-table-column slot="options" label="操作" align="center" fixed="right" width="220px">
|
||||
<template v-slot="{ row }">
|
||||
<div class="table-options">
|
||||
<el-button type="text" @click="toAddSku(row.id)">添加SKU</el-button>
|
||||
<el-button type="text" @click="toAddSku(row.id)">管理SKU</el-button>
|
||||
<el-button type="text" @click="toAdd(row.id)">编辑</el-button>
|
||||
<el-button type="text" @click="toDetail(row.url)">删除</el-button>
|
||||
<el-button type="text" @click="remove(row.id)">删除</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -46,11 +79,15 @@
|
||||
{ prop: 'count', label: '绑定SKU数量', align: 'center' },
|
||||
{ prop: 'createTime', label: '创建时间', align: 'center' },
|
||||
],
|
||||
isLoading: false,
|
||||
tableData: [],
|
||||
total: 0,
|
||||
search: {
|
||||
current: 1,
|
||||
size: 10
|
||||
size: 10,
|
||||
name: '',
|
||||
productSkuId: '',
|
||||
productSkcId: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -69,6 +106,7 @@
|
||||
},
|
||||
|
||||
getList () {
|
||||
this.isLoading = true
|
||||
this.$http.post('/api/template/getPage', null, {
|
||||
params: {
|
||||
...this.search
|
||||
@@ -78,6 +116,22 @@
|
||||
this.tableData = res.data.records
|
||||
this.total = res.data.total
|
||||
}
|
||||
|
||||
this.isLoading = false
|
||||
})
|
||||
},
|
||||
|
||||
remove (id) {
|
||||
this.$confirm('确定删除该模板?', '温馨提示', {
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http.post(`/api/template/removeById?id=${id}`).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$message.success('删除成功')
|
||||
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
@@ -89,4 +143,9 @@
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.Template {
|
||||
.search-item {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user