Commit 9a9fe6f6 authored by yaya's avatar yaya

功能优化

parent 90127c17
...@@ -90,3 +90,90 @@ export function findSpecialList(data) { ...@@ -90,3 +90,90 @@ export function findSpecialList(data) {
}) })
} }
/**
* 添加专场
* @param data
* @returns {*}
*/
export function addSpecial(data) {
return request({
url: '/specialPerformance/create',
method: 'post',
data
})
}
/**
* 删除专场
* @param data
* @returns {*}
*/
export function deleteSpecial(data) {
return request({
url: '/specialPerformance/delete',
method: 'post',
data
})
}
/**
* 编辑专场
* @param data
* @returns {*}
*/
export function updateSpecial(data) {
return request({
url: '/specialPerformance/update',
method: 'post',
data
})
}
/**
* 专场详情
* @param data
* @returns {*}
*/
export function specialDetail(data) {
return request({
url: '/specialPerformance/findDetail',
method: 'post',
data
})
}
/**
* 专场下拍品
* @param data
* @returns {*}
*/
export function findSpecialListById(data) {
return request({
url: '/specialPerformance/findItemListById',
method: 'post',
data
})
}
/**
* 删除专场下拍品
* @param data
* @returns {*}
*/
export function deleteSpecialItem(data) {
return request({
url: '/specialPerformance/deleteItem',
method: 'post',
data
})
}
/**
* 添加专场下拍品
* @param data
* @returns {*}
*/
export function addSpecialItem(data) {
return request({
url: '/specialPerformance/addItem',
method: 'post',
data
})
}
...@@ -537,6 +537,19 @@ export const asyncRouterMap = [ ...@@ -537,6 +537,19 @@ export const asyncRouterMap = [
}, },
hidden: true hidden: true
}, },
{
path: 'specialDetail',
component: () => import('@/views/sale/specialDetail'),
name: 'specialDetail',
meta: {
perms: [],
title: '专场详情',
icon: 'list',
noCache: true,
keepAlive: true
},
hidden: true
},
{ {
path: 'itemDetail', path: 'itemDetail',
component: () => import('@/views/sale/itemDetail'), component: () => import('@/views/sale/itemDetail'),
......
...@@ -65,7 +65,11 @@ ...@@ -65,7 +65,11 @@
<el-table-column align="center" label="数量" prop="stock" /> <el-table-column align="center" label="数量" prop="stock" />
<el-table-column align="center" label="发布者" prop="creatorName" /> <el-table-column align="center" label="发布者" prop="creatorName" />
<el-table-column align="center" label="更新时间" prop="updateTime" /> <el-table-column align="center" label="更新时间" prop="updateTime" />
<el-table-column align="center" label="状态" prop="statusName" /> <el-table-column align="center" label="状态" prop="auctionStateName" width="100">
<template slot-scope="scope">
<span class="tooltip-span">{{ `${scope.row.auctionStateName || '-'}` }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="300" fixed="right"> <el-table-column align="center" label="操作" width="300" fixed="right">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
...@@ -79,7 +83,7 @@ ...@@ -79,7 +83,7 @@
@click="handleToEdit(scope.row)">编辑 @click="handleToEdit(scope.row)">编辑
</el-button> </el-button>
<el-button <el-button
:disabled="(!scope.row.editAble && scope.row.type === 2)" v-if="(scope.row.auctionState === 40 || scope.row.auctionState === 50)"
type="danger" type="danger"
size="mini" size="mini"
@click="handleDelete(scope.row)">重新上架 @click="handleDelete(scope.row)">重新上架
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
type="selection" type="selection"
width="55"/> width="55"/>
<el-table-column align="center" min-width="100px" prop="id" label="拍卖ID" fixed="left"/> <el-table-column align="center" min-width="100px" prop="id" label="拍卖ID" fixed="left"/>
<el-table-column align="center" label="封面图" prop="itemImg"> <el-table-column align="center" label="拍品图片" prop="itemImg">
<template slot-scope="scope"> <template slot-scope="scope">
<div class="image_preview"> <div class="image_preview">
<el-image <el-image
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="拍卖名称" min-width="150px" prop="name"> <el-table-column align="center" label="拍卖标题" min-width="150px" prop="name">
<template slot-scope="scope"> <template slot-scope="scope">
<Line2Hidden :text="scope.row.name" /> <Line2Hidden :text="scope.row.name" />
</template> </template>
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
@pagination="getList" /> @pagination="getList" />
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="handleCancelConsignDialog"> </el-button> <el-button @click="handleCancelConsignDialog"> </el-button>
<el-button type="primary" @click="handleCancelValue"> </el-button> <el-button type="primary" @click="handleSubmit"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
</template> </template>
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
<script> <script>
import Line2Hidden from '@/components/line2Hidden' import Line2Hidden from '@/components/line2Hidden'
import Pagination from '@/components/Pagination' import Pagination from '@/components/Pagination'
import { findAuctionList } from '@/api/business/sale' import { findAuctionList, addSpecialItem } from '@/api/business/sale'
export default { export default {
name: 'SelectSpecialDialog', name: 'SelectSpecialDialog',
components: { components: {
...@@ -94,7 +94,7 @@ export default { ...@@ -94,7 +94,7 @@ export default {
type: Boolean, type: Boolean,
default: false default: false
}, },
saleId: { specialPerformanceId: {
type: String, type: String,
default: '' default: ''
} }
...@@ -145,8 +145,29 @@ export default { ...@@ -145,8 +145,29 @@ export default {
this.listLoading = false this.listLoading = false
}) })
}, },
handleCancelValue() { handleSubmit() {
if (!this.selectionIdList || this.selectionIdList.length === 0) {
this.$notify.warning({
message: '请选择藏品'
})
return
}
const params = {
itemIds: this.selectionIdList.join(','),
specialPerformanceId: this.specialPerformanceId
}
addSpecialItem(params).then(response => {
this.$notify.success({
message: '添加拍品成功'
})
this.$emit('refreshList')
this.$emit('cancelDialog')
this.listLoading = false
}).catch((e) => {
this.list = []
this.total = 0
this.listLoading = false
})
} }
} }
} }
...@@ -158,10 +179,15 @@ export default { ...@@ -158,10 +179,15 @@ export default {
text-align: center; text-align: center;
} }
.image_preview { .image_preview {
width: 60px; width: 90px;
height: 60px; height: 60px;
align-content: center; align-content: center;
justify-content: center; justify-content: center;
display: flex;
.table-td-thumb {
width: 60px;
height: 60px;
}
} }
.image { .image {
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
type="selection" type="selection"
width="55"/> width="55"/>
<el-table-column align="center" min-width="100px" prop="id" label="拍品ID" fixed="left"/> <el-table-column align="center" min-width="100px" prop="id" label="拍品ID" fixed="left"/>
<el-table-column align="center" label="封面图" prop="itemImg"> <el-table-column align="center" label="封面图" prop="itemImg" min-width="100px">
<template slot-scope="scope"> <template slot-scope="scope">
<!-- <img v-if="scope.row.images" :src="scope.row.images.split(';')[0]" width="60px" height="60px" @click="handleShowPreview(scope.row.images)">--> <!-- <img v-if="scope.row.images" :src="scope.row.images.split(';')[0]" width="60px" height="60px" @click="handleShowPreview(scope.row.images)">-->
<div class="image_preview"> <div class="image_preview">
...@@ -85,24 +85,23 @@ ...@@ -85,24 +85,23 @@
<span class="tooltip-span">{{ `${scope.row.statusName || '-'}` }}</span> <span class="tooltip-span">{{ `${scope.row.statusName || '-'}` }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="操作" width="230"> <el-table-column align="center" label="操作" width="260">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
type="text" type="primary"
size="mini" size="mini"
@click="handleToDetail(scope.row)">详情 @click="handleToDetail(scope.row)">详情
</el-button> </el-button>
<el-button <el-button
v-if="scope.row.status === 0" v-if="scope.row.status === 0"
:disabled="scope.row.isTransformAuction" :disabled="scope.row.isTransformAuction"
type="text" type="primary"
size="mini" size="mini"
@click="handleToAuction(scope.row)">转拍卖 @click="handleToAuction(scope.row)">转拍卖
</el-button> </el-button>
<el-button <el-button
v-if="scope.row.status === 0" v-if="scope.row.status === 0"
class="red_button" type="danger"
type="text"
size="mini" size="mini"
@click="handleSetItemOff(scope.row)">违规下架 @click="handleSetItemOff(scope.row)">违规下架
</el-button> </el-button>
......
<template> <template>
<div> <div>
<div class="op-container"> <div class="op-container">
<el-button type="primary" @click="handleSave">保存</el-button> <el-button type="primary" @click="handleSave">保存</el-button>
...@@ -6,10 +6,23 @@ ...@@ -6,10 +6,23 @@
</div> </div>
<el-form ref="goods" :rules="rules" :model="goods" label-width="150px"> <el-form ref="goods" :rules="rules" :model="goods" label-width="150px">
<el-card class="box-card"> <el-card class="box-card">
<el-form-item label="专场标题:" prop="name"> <el-form-item label="专场标题:" prop="title">
<el-input v-model="goods.name" :maxlength="15"/> <el-input v-model="goods.title" :maxlength="15"/>
</el-form-item> </el-form-item>
<el-form-item label="背景图:" prop="images"> <el-form-item label="时间:" prop="startTime">
<el-date-picker
v-model="specialTime"
:picker-options="pickerOptions"
type="datetimerange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
format="yyyy-MM-dd HH:mm:ss"
value-format="yyyy-MM-dd HH:mm:ss"
align="right"
@change="handleSetTime"/>
</el-form-item>
<el-form-item label="背景图:" prop="backgroundImage">
<el-upload <el-upload
:action="uploadPath" :action="uploadPath"
:headers="headers" :headers="headers"
...@@ -18,29 +31,16 @@ ...@@ -18,29 +31,16 @@
:on-exceed="uploadOverrun" :on-exceed="uploadOverrun"
:on-success="handleGalleryUrl" :on-success="handleGalleryUrl"
:on-remove="handleRemove" :on-remove="handleRemove"
multiple
accept=".jpg,.jpeg,.png,.gif" accept=".jpg,.jpeg,.png,.gif"
list-type="picture-card"> list-type="picture-card">
<i class="el-icon-plus" /> <i class="el-icon-plus" />
</el-upload> </el-upload>
<div>建议尺寸2000*1024</div> <div>建议尺寸2000*1024</div>
</el-form-item> </el-form-item>
<el-form-item label="时间:" prop="images">
<el-date-picker
v-model="specialTime"
:picker-options="pickerOptions"
type="datetimerange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
format="yyyy-MM-dd HH:mm:ss"
value-format="yyyy-MM-dd HH:mm:ss"
align="right"/>
</el-form-item>
</el-card> </el-card>
<el-card class="box-card"> <el-card v-if="id" class="box-card">
<div class="op-add"> <div class="op-add">
<div>{{ `${total > 0 ? '共计${total}件藏品' : ''}` }}</div> <div class="item_num">{{ `${total > 0 ? `共计${total}件藏品` : ''}` }}</div>
<el-button type="primary" @click="handleAdd">添加拍品</el-button> <el-button type="primary" @click="handleAdd">添加拍品</el-button>
</div> </div>
<el-table <el-table
...@@ -50,25 +50,49 @@ ...@@ -50,25 +50,49 @@
element-loading-text="正在查询中..." element-loading-text="正在查询中..."
border border
fit fit
height="800" height="600"
highlight-current-row> highlight-current-row>
<el-table-column align="center" label="专场标题" min-width="150px" prop="name"> <el-table-column align="center" min-width="100px" prop="id" label="拍卖ID" fixed="left"/>
<el-table-column align="center" label="拍品图片" prop="itemImg">
<template slot-scope="scope">
<div class="image_preview">
<el-image
:preview-src-list="scope.row.images.split(';')"
:src="scope.row.images.split(';')[0]"
class="table-td-thumb"
/>
</div>
</template>
</el-table-column>
<el-table-column align="center" label="拍卖标题" min-width="150px" prop="name">
<template slot-scope="scope"> <template slot-scope="scope">
<Line2Hidden :text="scope.row.name" /> <Line2Hidden :text="scope.row.name" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="竞拍时间" prop="updateTime" /> <el-table-column align="center" label="起拍价" prop="startPrice">
<el-table-column align="center" label="藏品数" prop="stock" /> <template slot-scope="scope">
<el-table-column align="center" label="状态" prop="stock" /> <span class="tooltip-span">{{ `${scope.row.startPrice ? `¥ ${scope.row.startPrice}` : '-'}` }}</span>
<el-table-column align="center" label="出价次数" prop="stock" /> </template>
<el-table-column align="center" label="更新时间" prop="updateTime" /> </el-table-column>
<el-table-column align="center" label="加价幅度" prop="addExtent">
<template slot-scope="scope">
<span class="tooltip-span">{{ `${scope.row.addExtent ? `¥ ${scope.row.addExtent}` : '-'}` }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="理想价格" prop="distributionPrice">
<template slot-scope="scope">
<span class="tooltip-span">{{ `${scope.row.distributionPrice ? `¥ ${scope.row.distributionPrice}` : '-'}` }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="发布者" prop="creatorName" />
<el-table-column align="center" label="状态" prop="statusName" />
<el-table-column align="center" label="操作" width="100"> <el-table-column align="center" label="操作" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
:disabled="(!scope.row.editAble && scope.row.type === 2)"
type="danger" type="danger"
size="mini" size="mini"
@click="handleDelete(scope.row)">删除 @click="handleDeleteSpecialItem(scope.row)">删除
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
...@@ -86,6 +110,7 @@ ...@@ -86,6 +110,7 @@
<SelectSpecialDialog <SelectSpecialDialog
v-if="isShowAddSpecialDialog" v-if="isShowAddSpecialDialog"
:show-add-special-dialog="isShowAddSpecialDialog" :show-add-special-dialog="isShowAddSpecialDialog"
:special-performance-id="id"
@cancelDialog="isShowAddSpecialDialog = false" @cancelDialog="isShowAddSpecialDialog = false"
@refreshList="handleFilter" @refreshList="handleFilter"
/> />
...@@ -99,16 +124,18 @@ import { uploadPath } from '@/api/business/storage' ...@@ -99,16 +124,18 @@ import { uploadPath } from '@/api/business/storage'
import { getToken } from '@/utils/auth' import { getToken } from '@/utils/auth'
import Editor from '@tinymce/tinymce-vue' import Editor from '@tinymce/tinymce-vue'
import { MessageBox } from 'element-ui' import { MessageBox } from 'element-ui'
import { createSale, findSaleDetail, updateSale, getSaleList } from '../../api/business/sale' import { addSpecial, specialDetail, updateSpecial, findSpecialListById, deleteSpecialItem } from '../../api/business/sale'
import UploadFile from './UploadImg' import UploadFile from './UploadImg'
import draggable from 'vuedraggable' import draggable from 'vuedraggable'
import SelectSpecialDialog from './components/selectSpecialDialog' import SelectSpecialDialog from './components/selectSpecialDialog'
import Pagination from '@/components/Pagination' import Pagination from '@/components/Pagination'
import Line2Hidden from '@/components/line2Hidden'
export default { export default {
name: 'SaleAdd', name: 'SaleAdd',
components: { Pagination, SelectSpecialDialog, UploadFile, Editor, draggable }, components: { Pagination, SelectSpecialDialog, UploadFile, Editor, draggable, Line2Hidden },
data() { data() {
return { return {
id: '',
isShowAddSpecialDialog: false, isShowAddSpecialDialog: false,
listLoading: false, listLoading: false,
listQuery: { listQuery: {
...@@ -117,13 +144,11 @@ export default { ...@@ -117,13 +144,11 @@ export default {
}, },
list: [], list: [],
total: 0, total: 0,
specialTime: '', specialTime: [],
uploadPath, uploadPath,
numType: -1, numType: -1,
goods: { goods: {
images: [], backgroundImage: ''
type: 1,
buyLimitNum: 0
}, },
pickerOptions: { pickerOptions: {
shortcuts: [{ shortcuts: [{
...@@ -154,16 +179,9 @@ export default { ...@@ -154,16 +179,9 @@ export default {
}, },
itemImages: [], itemImages: [],
rules: { rules: {
images: [{ required: true, message: '至少一张图片', trigger: 'blur' }], backgroundImage: [{ required: true, message: '至少一张图片', trigger: 'blur' }],
name: [{ required: true, message: '商品名称不能为空', trigger: 'blur' }], title: [{ required: true, message: '专场标题不能为空', trigger: 'blur' }],
stock: [{ required: true, message: '数量不能为空', trigger: 'blur' }], startTime: [{ required: true, message: '时间不能为空', trigger: 'blur' }]
rebate: [{ required: true, message: '佣金比例不能为空', trigger: 'blur' }],
distributionPrice: [{ required: true, message: '供货价不能为空', trigger: 'blur' }],
buyLimitNum: [{ required: true, message: '限购数量不能为空', trigger: 'blur' }],
auctionStartTime: [{ required: true, message: '开始时间不能为空', trigger: 'blur' }],
auctionEndTime: [{ required: true, message: '截拍时间不能为空', trigger: 'blur' }],
startPrice: [{ required: true, message: '起拍价不能为空', trigger: 'blur' }],
addExtent: [{ required: true, message: '加价幅度不能为空', trigger: 'blur' }]
} }
} }
}, },
...@@ -191,44 +209,30 @@ export default { ...@@ -191,44 +209,30 @@ export default {
this.getList() this.getList()
}, },
methods: { methods: {
change() { handleSetTime(value) {
const newList = [] console.log('====', value)
for (var i = 0; i < this.goods.images.length; i++) { if (!value) {
newList.push({ return
url: this.goods.images[i]
})
} }
this.itemImages = newList this.goods.startTime = this.specialTime[0]
this.goods.endTime = this.specialTime[1]
}, },
previewImg(url) { previewImg(url) {
window.open(url, '_blank') window.open(url, '_blank')
}, },
removeImg(url) { removeImg(url) {
this.goods.images.forEach((val, key) => { this.goods.backgroundImage = ''
if (url === val) { this.itemImages = []
this.goods.images.splice(key, 1)
this.change()
}
})
this.itemImages.forEach((val, key) => {
if (url === val.url) {
this.itemImages.splice(key, 1)
this.change()
}
})
}, },
handlerNumTypeChange(e) { handlerNumTypeChange(e) {
console.log('==e==', e) console.log('==e==', e)
}, },
handlerClose(imageList) {
this.itemImages = imageList
},
/** /**
* 获取详情 * 获取详情
* @param loading * @param loading
*/ */
handleGetDetail(loading) { handleGetDetail(loading) {
findSaleDetail({ id: this.id }) specialDetail({ specialPerformanceId: this.id })
.then(response => { .then(response => {
if (loading) { if (loading) {
loading.close() loading.close()
...@@ -236,20 +240,16 @@ export default { ...@@ -236,20 +240,16 @@ export default {
console.log('====', response.data.data) console.log('====', response.data.data)
if (response.data.data) { if (response.data.data) {
this.goods = response.data.data this.goods = response.data.data
if (!response.data.data.buyLimitNum || response.data.data.buyLimitNum === -1) { const list = []
this.goods.buyLimitNum = 0 if (this.goods.backgroundImage) {
this.numType = -1 list.push({
} else { url: this.goods.backgroundImage
this.numType = 2
}
this.goods.images = response.data.data.images ? response.data.data.images.split(';') : []
if (this.goods.images && this.goods.images.length > 0) {
for (var i = 0; i < this.goods.images.length; i++) {
this.itemImages.push({
url: this.goods.images[i]
}) })
} }
} this.itemImages = list
this.specialTime = [this.goods.startTime, this.goods.endTime]
console.log('==itemImages==', this.itemImages)
} }
}) })
.catch(response => { .catch(response => {
...@@ -272,35 +272,22 @@ export default { ...@@ -272,35 +272,22 @@ export default {
* 保存 * 保存
*/ */
handleSave() { handleSave() {
if (this.goods.images.length === 0) { if (!this.goods.backgroundImage) {
this.$message({ this.$message({
type: 'error', type: 'error',
message: '最少上传1张图片!' message: '最少上传1张背景图片!'
}) })
return return
} }
if (this.goods.stock <= 0) { if (!this.specialTime) {
this.$message({ this.$message({
type: 'error', type: 'error',
message: '库存需大于0!' message: '请选择时间'
}) })
return return
} }
if (this.numType === 2 && this.goods.buyLimitNum <= 0) { this.goods.startTime = this.specialTime[0]
this.$message({ this.goods.endTime = this.specialTime[1]
type: 'error',
message: '限购数量需大于0!'
})
return
}
if (this.goods.images) {
if (typeof this.goods.images !== 'string') {
this.goods.images = this.goods.images.join(';')
}
} else {
this.goods.images = ''
}
this.$refs.goods.validate((valid) => { this.$refs.goods.validate((valid) => {
if (valid) { if (valid) {
const loading = this.$loading({ const loading = this.$loading({
...@@ -309,11 +296,9 @@ export default { ...@@ -309,11 +296,9 @@ export default {
spinner: 'el-icon-loading', spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)' background: 'rgba(0, 0, 0, 0.7)'
}) })
if (this.numType === -1) {
this.goods.buyLimitNum = -1
}
if (this.id) { if (this.id) {
updateSale(this.goods) this.goods.specialPerformanceId = this.id
updateSpecial(this.goods)
.then(response => { .then(response => {
if (loading) { if (loading) {
loading.close() loading.close()
...@@ -322,35 +307,37 @@ export default { ...@@ -322,35 +307,37 @@ export default {
title: '成功', title: '成功',
message: '编辑成功' message: '编辑成功'
}) })
this.$router.push({ path: '/sale/saleList' }) this.$router.push({ path: '/sale/specialList' })
}) })
.catch(response => { .catch(response => {
if (loading) { if (loading) {
loading.close() loading.close()
} }
this.goods.images = this.goods.images.split(';') || [] this.goods.backgroundImage = ''
MessageBox.alert('业务错误:' + response.data.errmsg, '警告', { MessageBox.alert('业务错误:' + response.data.errmsg, '警告', {
confirmButtonText: '确定', confirmButtonText: '确定',
type: 'error' type: 'error'
}) })
}) })
} else { } else {
createSale(this.goods) addSpecial(this.goods)
.then(response => { .then(response => {
if (loading) { if (loading) {
loading.close() loading.close()
} }
this.$notify.success({ this.$notify.success({
title: '成功', title: '成功',
message: '创建成功' message: '新增成功'
}) })
this.$router.push({ path: '/sale/saleList' }) this.id = response.data.data.specialPerformanceId
this.goods.id = response.data.data.specialPerformanceId
console.log('==specialPerformanceId==', response.data.data.specialPerformanceId)
}) })
.catch(response => { .catch(response => {
if (loading) { if (loading) {
loading.close() loading.close()
} }
this.goods.images = this.goods.images.split(';') || [] this.goods.backgroundImage = ''
MessageBox.alert('业务错误:' + response.data.errmsg || '请求失败,请重试', '警告', { MessageBox.alert('业务错误:' + response.data.errmsg || '请求失败,请重试', '警告', {
confirmButtonText: '确定', confirmButtonText: '确定',
type: 'error' type: 'error'
...@@ -375,34 +362,25 @@ export default { ...@@ -375,34 +362,25 @@ export default {
}, },
handleGalleryUrl(response, file, fileList) { handleGalleryUrl(response, file, fileList) {
if (response.errno === 0) { if (response.errno === 0) {
this.goods.images.push(response.data.url) // this.goods.images.push(response.data.url)
this.goods.backgroundImage = response.data.url
} }
}, },
handleRemove: function(file, fileList) { handleRemove: function(file, fileList) {
var url this.goods.backgroundImage = ''
if (file.response === undefined) {
url = file.url
} else {
url = file.response.data.url
}
for (var i = 0; i < this.goods.images.length; i++) {
// 这里存在两种情况
// 1. 如果所删除图片是刚刚上传的图片,那么图片地址是file.response.data.url
// 此时的file.url虽然存在,但是是本机地址,而不是远程地址。
// 2. 如果所删除图片是后台返回的已有图片,那么图片地址是file.url
if (this.goods.images[i] === url) {
this.goods.images.splice(i, 1)
}
}
}, },
handleFilter() { handleFilter() {
this.listQuery.page = 1 this.listQuery.page = 1
this.getList() this.getList()
}, },
getList() { getList() {
localStorage.setItem('systemState', '') if (!this.id) {
return
}
this.listLoading = true this.listLoading = true
getSaleList(this.listQuery).then(response => { this.listQuery.specialPerformanceId = this.id
findSpecialListById(this.listQuery).then(response => {
debugger
this.list = response.data.data.dataList this.list = response.data.data.dataList
this.total = response.data.data.total this.total = response.data.data.total
this.listLoading = false this.listLoading = false
...@@ -411,6 +389,31 @@ export default { ...@@ -411,6 +389,31 @@ export default {
this.total = 0 this.total = 0
this.listLoading = false this.listLoading = false
}) })
},
handleDeleteSpecialItem(row) {
this.$confirm('是否将该藏品删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const params = {
specialPerformanceId: this.id,
itemId: row.id
}
deleteSpecialItem(params).then(response => {
this.list = this.list.filter((item) => {
if (item.id !== row.id) {
return item
}
})
this.$notify.success({
message: '删除成功'
})
}).catch((e) => {
console.log('===报错=', e)
this.$message.error(e.data && e.data.errmsg || '请求失败, 请重试')
})
})
} }
} }
} }
...@@ -433,7 +436,12 @@ export default { ...@@ -433,7 +436,12 @@ export default {
.op-add { .op-add {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-content: baseline;
padding-bottom: 24px; padding-bottom: 24px;
.item_num {
font-weight: 600;
padding-top: 15px;
}
} }
.add_auction { .add_auction {
margin-left: auto; margin-left: auto;
...@@ -454,6 +462,17 @@ export default { ...@@ -454,6 +462,17 @@ export default {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
} }
.image_preview {
width: 90px;
height: 60px;
align-content: center;
justify-content: center;
display: flex;
.table-td-thumb {
width: 60px;
height: 60px;
}
}
.ant-upload-list-item { .ant-upload-list-item {
......
<template>
<div class="page_itemDetail">
<el-card class="box-card" style="margin: 16px">
<div class="user_info flex" >
<el-form ref="addInviteRef" label-width="120px">
<el-form-item label="专场标题:">
<div>{{ itemContent && itemContent.title || '-' }}</div>
</el-form-item>
<el-form-item label="时间:">
<div>{{ `${itemContent.startTime || '-'} 至 ${itemContent.endTime || '-'}` }}</div>
</el-form-item>
<el-form-item label="商品图片/视频:">
<div v-if="itemContent && itemContent.imageList" class="image">
<div v-for="item in itemContent.imageList" :key="item.url" class="image_item" @click="handleShowLargeDialog(item.type, item.url, item.videoUrl)">
<img :src="item.url" class="image_item_content" >
<img v-if="item.type === 1" class="image_content_video_icon" src="https://cdn.wanwudezhi.com/static/web-static/image/10651432d8c28651da81753c260d81b3_120x120.png">
</div>
</div>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card v-if="id" class="box-card">
<div class="op-add">
<div class="item_num">{{ `${total > 0 ? `共计${total}件藏品` : ''}` }}</div>
</div>
<el-table
v-loading="listLoading"
:data="list"
size="small"
element-loading-text="正在查询中..."
border
fit
height="600"
highlight-current-row>
<el-table-column align="center" min-width="100px" prop="id" label="拍卖ID" fixed="left"/>
<el-table-column align="center" label="拍品图片" prop="itemImg">
<template slot-scope="scope">
<div class="image_preview">
<el-image
:preview-src-list="scope.row.images.split(';')"
:src="scope.row.images.split(';')[0]"
class="table-td-thumb"
/>
</div>
</template>
</el-table-column>
<el-table-column align="center" label="拍卖标题" min-width="150px" prop="name">
<template slot-scope="scope">
<Line2Hidden :text="scope.row.name" />
</template>
</el-table-column>
<el-table-column align="center" label="起拍价" prop="startPrice">
<template slot-scope="scope">
<span class="tooltip-span">{{ `${scope.row.startPrice ? `¥ ${scope.row.startPrice}` : '-'}` }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="加价幅度" prop="addExtent">
<template slot-scope="scope">
<span class="tooltip-span">{{ `${scope.row.addExtent ? `¥ ${scope.row.addExtent}` : '-'}` }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="理想价格" prop="distributionPrice">
<template slot-scope="scope">
<span class="tooltip-span">{{ `${scope.row.distributionPrice ? `¥ ${scope.row.distributionPrice}` : '-'}` }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="发布者" prop="creatorName" />
<el-table-column align="center" label="状态" prop="statusName" />
</el-table>
<Pagination
v-if="total > 0"
v-show="total>0"
:total="total"
:page.sync="listQuery.page"
:limit.sync="listQuery.limit"
@pagination="getList" />
</el-card>
<CheckLargeImageDialog
:show-large-dialog="showLargeDialog"
:image-url="imageUrl"
@closeLargeDialog="showLargeDialog = false"
/>
<CheckVideoDialog
:show-video-dialog="showVideoDialog"
:video-url="videosUrl"
@closeLargeDialog="showVideoDialog = false" />
</div>
</template>
<script>
import { findSpecialListById, specialDetail } from '../../api/business/sale'
import CheckLargeImageDialog from '../goods/components/CheckLargeImageDialog'
import CheckVideoDialog from '../goods/components/CheckVideoDialog'
import Line2Hidden from '@/components/line2Hidden'
export default {
name: 'SpecialDetail',
components: { CheckVideoDialog, CheckLargeImageDialog, Line2Hidden },
data() {
return {
id: '',
itemContent: {
imageList: []
},
imageUrl: '',
showLargeDialog: false,
showVideoDialog: false,
videosUrl: '',
listLoading: false,
listQuery: {
page: 1,
limit: 20
},
list: [],
total: 0
}
},
created() {
if (this.$route.query.id == null) {
return
}
this.id = this.$route.query.id
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
this.handleGetDetail(loading)
this.getList()
},
methods: {
/**
* 获取详情
* @param loading
*/
handleGetDetail(loading) {
specialDetail({ specialPerformanceId: this.id })
.then(response => {
if (loading) {
loading.close()
}
console.log('====', response.data.data)
if (response.data.data) {
this.itemContent = response.data.data
const list = []
list.push({
url: this.itemContent.backgroundImage,
videoUrl: '',
type: 2
})
this.itemContent.imageList = list
}
})
.catch(response => {
if (loading) {
loading.close()
}
})
},
/**
* 展示大图
* @param imageUrl
*/
handleShowLargeDialog(type, imageUrl, videoUrl) {
if (type === 1) {
this.videosUrl = videoUrl
this.showVideoDialog = true
} else {
this.imageUrl = imageUrl
this.showLargeDialog = true
}
},
getList() {
if (!this.id) {
return
}
localStorage.setItem('systemState', '')
this.listLoading = true
this.listQuery.specialPerformanceId = this.id
findSpecialListById(this.listQuery).then(response => {
debugger
this.list = response.data.data.data.dataList
this.total = response.data.data.data.total
this.listLoading = false
}).catch((e) => {
this.list = []
this.total = 0
this.listLoading = false
})
}
}
}
</script>
<style lang="scss" scoped>
.page_itemDetail {
padding: 20px;
.image_preview {
width: 90px;
height: 60px;
align-content: center;
justify-content: center;
display: flex;
.table-td-thumb {
width: 60px;
height: 60px;
}
}
.op-add {
display: flex;
justify-content: space-between;
align-content: baseline;
padding-bottom: 24px;
.item_num {
font-weight: 600;
padding-top: 15px;
}
}
.image {
width: 100%;
display: flex;
flex-direction: row;
}
.image_item {
width: 100px;
height: 100px;
margin-right: 10px;
margin-top: 16px;
position: relative;
.image_item_content {
width: 100px;
height: 100px;
}
.image_content_video_icon {
position: absolute;
width: 30px;
height: 30px;
top: 10px;
left: 10px;
}
}
}
/deep/ .el-form-item {
margin-bottom: 0
}
</style>
...@@ -63,8 +63,7 @@ ...@@ -63,8 +63,7 @@
<script> <script>
import Line2Hidden from '@/components/line2Hidden' import Line2Hidden from '@/components/line2Hidden'
import Pagination from '@/components/Pagination' import Pagination from '@/components/Pagination'
import { findSpecialList, updateOnSale, deleteSaleItem } from '@/api/business/sale' import { findSpecialList, deleteSpecial } from '@/api/business/sale'
import { MessageBox } from 'element-ui'
export default { export default {
name: 'SaleList', name: 'SaleList',
...@@ -117,22 +116,6 @@ export default { ...@@ -117,22 +116,6 @@ export default {
} }
this.getList() this.getList()
}, },
handleSaleSwitch(e, item) {
const params = { id: item.id, isOnSale: e }
updateOnSale(params)
.then(response => {
this.$notify.success({
message: e ? '上架成功' : '下架成功'
})
})
.catch(response => {
item.isOnSale = !e
MessageBox.alert('业务错误:' + response.data.errmsg, '警告', {
confirmButtonText: '确定',
type: 'error'
})
})
},
handleCreate() { handleCreate() {
this.$router.push({ path: '/sale/specialAdd' }) this.$router.push({ path: '/sale/specialAdd' })
}, },
...@@ -161,7 +144,7 @@ export default { ...@@ -161,7 +144,7 @@ export default {
* 详情 * 详情
*/ */
handleToDetail(item) { handleToDetail(item) {
this.$router.push({ path: '/sale/saleAdd', query: { id: item.id }}) this.$router.push({ path: '/sale/specialDetail', query: { id: item.id }})
}, },
/** /**
* 删除 * 删除
...@@ -173,9 +156,9 @@ export default { ...@@ -173,9 +156,9 @@ export default {
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
const data = { const data = {
id: item.id specialPerformanceId: item.id
} }
deleteSaleItem(data).then((res) => { deleteSpecial(data).then((res) => {
this.$notify.success({ this.$notify.success({
title: '成功', title: '成功',
message: '删除成功' message: '删除成功'
...@@ -211,10 +194,15 @@ export default { ...@@ -211,10 +194,15 @@ export default {
justify-content: space-between; justify-content: space-between;
} }
.image_preview { .image_preview {
width: 60px; width: 90px;
height: 60px; height: 60px;
align-content: center; align-content: center;
justify-content: center; justify-content: center;
display: flex;
.table-td-thumb {
width: 60px;
height: 60px;
}
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment