v-viewer转化成cdn文件,优化包

This commit is contained in:
aixianling
2024-01-22 17:12:32 +08:00
parent 1aa2e264d7
commit ad0a91750c
46 changed files with 2283 additions and 1054 deletions

View File

@@ -5,44 +5,44 @@
<template slot="left">
<el-button type="primary" icon="iconfont iconAdd" @click="toAdd('')">添加</el-button>
<ai-select
v-model="search.type"
@change="(search.current = 1), getList()"
placeholder="请选择商品类型"
:selectList="dict.getDict('integralSGType')">
v-model="search.type"
@change="(search.current = 1), getList()"
placeholder="请选择商品类型"
:selectList="dict.getDict('integralSGType')">
</ai-select>
<ai-select
v-model="search.status"
@change="(search.current = 1), getList()"
placeholder="请选择类型"
:selectList="dict.getDict('integralSGStatus')">
v-model="search.status"
@change="(search.current = 1), getList()"
placeholder="请选择类型"
:selectList="dict.getDict('integralSGStatus')">
</ai-select>
</template>
<template slot="right">
<el-input
v-model="search.title"
class="search-input"
size="small"
v-throttle="() => {search.current = 1, getList()}"
placeholder="请输入商品名称"
clearable
@clear="search.current = 1, search.title = '', getList()"
suffix-icon="iconfont iconSearch">
v-model="search.title"
class="search-input"
size="small"
v-throttle="() => {search.current = 1, getList()}"
placeholder="请输入商品名称"
clearable
@clear="search.current = 1, search.title = '', getList()"
suffix-icon="iconfont iconSearch">
</el-input>
</template>
</ai-search-bar>
<ai-table
style="margin-top: 8px;"
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
:current.sync="search.current"
:size.sync="search.size"
@getList="getList">
style="margin-top: 8px;"
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
:current.sync="search.current"
:size.sync="search.size"
@getList="getList">
<el-table-column
label="商品"
slot="goods"
align="left"
width="450">
label="商品"
slot="goods"
align="left"
width="450">
<template v-slot="{ row }">
<div class="goods">
<!-- <ai-uploader class="upload"
@@ -56,7 +56,7 @@
<img :src="row.picUrl" alt="" v-viewer>
<!-- <span class="type type0" v-if="row.type === '0'">积分兑换</span>
<span class="type type1" v-else>京东低价商品</span> -->
<span class="type" :class="`type${row.typeText}`">{{dict.getLabel('integralSGTypeText', row.typeText)}}</span>
<span class="type" :class="`type${row.typeText}`">{{ dict.getLabel('integralSGTypeText', row.typeText) }}</span>
</div>
<p>{{ row.title }}</p>
@@ -79,151 +79,151 @@
</template>
<script>
import Viewer from 'v-viewer'
import Vue from 'vue'
Vue.use(Viewer)
export default {
name: 'GoodsList',
export default {
name: 'GoodsList',
props: {
instance: Function,
dict: Object,
permissions: Function
},
props: {
instance: Function,
dict: Object,
permissions: Function
},
data() {
return {
search: {
type: '',
title: '',
current: 1,
status: '',
size: 10,
},
total: 0,
tableData: [],
colConfigs: [
{prop: 'serialNumber', label: '商品ID', align: 'left'},
{slot: 'goods', align: 'center'},
{prop: 'type', label: '商品类型', align: 'center', format: v => this.dict.getLabel('integralSGType', v)},
{prop: 'onlineTime', label: '上架时间', align: 'center'},
{prop: 'status', label: '状态', align: 'center', format: v => this.dict.getLabel('integralSGStatus', v)}
],
userList: []
}
},
data() {
return {
search: {
type: '',
title: '',
current: 1,
status: '',
size: 10,
},
total: 0,
tableData: [],
colConfigs: [
{ prop: 'serialNumber', label: '商品ID', align: 'left' },
{ slot: 'goods', align: 'center' },
{ prop: 'type', label: '商品类型', align: 'center', format: v => this.dict.getLabel('integralSGType', v) },
{ prop: 'onlineTime', label: '上架时间', align: 'center' },
{ prop: 'status', label: '状态', align: 'center', format: v => this.dict.getLabel('integralSGStatus', v) }
],
userList: []
}
},
computed: {},
computed: {
},
created() {
this.dict.load('integralSGType', 'integralSGStatus', 'integralSGTypeText').then(() => {
this.getList()
})
},
created () {
this.dict.load('integralSGType', 'integralSGStatus', 'integralSGTypeText').then(() => {
this.getList()
methods: {
getList() {
this.instance.post(`/app/appintegralsupermarketgoods/list`, null, {
params: {
...this.search
}
}).then((res) => {
if (res.code == 0) {
res.data.records.map((item) => {
item.typeText = item.type == 0 ? 0 : 1
})
this.tableData = res.data.records
this.total = res.data.total
}
})
},
methods: {
getList () {
this.instance.post(`/app/appintegralsupermarketgoods/list`, null, {
params: {
...this.search
}
}).then((res) => {
onAreaChange() {
this.search.current = 1
this.$nextTick(() => {
this.getTableData()
})
},
toAdd(id) {
this.$emit('change', {
type: 'AddGoods',
params: {
id: id || ''
}
})
},
copy(url) {
let oInput = document.createElement('input')
oInput.value = url
document.body.appendChild(oInput)
oInput.select()
document.execCommand('Copy')
this.$message({
message: '已复制',
type: 'success'
})
oInput.remove()
},
remove(id) {
this.$confirm('确定删除该商品吗?').then(() => {
this.instance.post(`/app/appintegralsupermarketgoods/delete?id=${id}`).then(res => {
if (res.code == 0) {
res.data.records.map((item) => {
item.typeText = item.type == 0 ? 0 : 1
})
this.tableData = res.data.records
this.total = res.data.total
this.$message.success('删除成功!')
this.getList()
}
})
},
})
},
onAreaChange () {
this.search.current = 1
this.$nextTick(() => {
this.getTableData()
})
},
toAdd (id) {
this.$emit('change', {
type: 'AddGoods',
params: {
id: id || ''
changeStatus(row) {
this.$confirm(`确定${row.status === '0' ? '上架' : '下架'}该商品?`).then(() => {
this.instance.post(`/app/appintegralsupermarketgoods/online?id=${row.id}`).then(res => {
if (res.code == 0) {
this.$message.success(`${row.status === '0' ? '上架' : '下架'}成功`)
this.getList()
}
})
},
copy (url) {
let oInput = document.createElement('input')
oInput.value = url
document.body.appendChild(oInput)
oInput.select()
document.execCommand('Copy')
this.$message({
message: '已复制',
type: 'success'
})
oInput.remove()
},
remove (id) {
this.$confirm('确定删除该商品吗?').then(() => {
this.instance.post(`/app/appintegralsupermarketgoods/delete?id=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
},
changeStatus (row) {
this.$confirm(`确定${row.status === '0' ? '上架' : '下架'}该商品?`).then(() => {
this.instance.post(`/app/appintegralsupermarketgoods/online?id=${row.id}`).then(res => {
if (res.code == 0) {
this.$message.success(`${row.status === '0' ? '上架' : '下架'}成功`)
this.getList()
}
})
})
}
})
}
}
}
</script>
<style lang="scss" scoped>
.GoodsList {
.goods {
display: flex;
align-items: center;
}
.img-content {
position: relative;
margin-right: 8px;
img {
width: 120px;
height: 120px;
cursor: pointer;
}
}
.type {
position: absolute;
top: 0;
left: 0;
.GoodsList {
.goods {
display: flex;
align-items: center;
}
.img-content {
position: relative;
margin-right: 8px;
img {
width: 120px;
text-align: center;
color: #fff;
z-index: 999;
font-size: 12px;
}
.type1 {
background-color: #E64E39;
}
.type0 {
background-color: #FF6900;
height: 120px;
cursor: pointer;
}
}
.type {
position: absolute;
top: 0;
left: 0;
width: 120px;
text-align: center;
color: #fff;
z-index: 999;
font-size: 12px;
}
.type1 {
background-color: #E64E39;
}
.type0 {
background-color: #FF6900;
}
}
</style>