Commit 02ed64de authored by yaya's avatar yaya

feat: 倒计时展示优化

parent 4e476c0f
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
multiple multiple
accept=".jpg,.jpeg,.png,.gif" accept=".jpg,.jpeg,.png,.gif"
list-type="picture-card"> list-type="picture-card">
<i class="el-icon-plus"/> <div>+最多三张凭证</div>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -108,19 +108,13 @@ export default { ...@@ -108,19 +108,13 @@ export default {
} else { } else {
url = file.response.data.url url = file.response.data.url
} }
if (url === this.goods.topImage) { for (var i = 0; i < this.saleForm.images.length; i++) {
this.goods.topImage = ''
}
for (var i = 0; i < this.goods.images.length; i++) {
// 这里存在两种情况 // 这里存在两种情况
// 1. 如果所删除图片是刚刚上传的图片,那么图片地址是file.response.data.url // 1. 如果所删除图片是刚刚上传的图片,那么图片地址是file.response.data.url
// 此时的file.url虽然存在,但是是本机地址,而不是远程地址。 // 此时的file.url虽然存在,但是是本机地址,而不是远程地址。
// 2. 如果所删除图片是后台返回的已有图片,那么图片地址是file.url // 2. 如果所删除图片是后台返回的已有图片,那么图片地址是file.url
if (url === this.goods.topImage) { if (this.saleForm.images[i] === url) {
this.goods.topImage = '' this.saleForm.images.splice(i, 1)
}
if (this.goods.images[i] === url) {
this.goods.images.splice(i, 1)
} }
} }
}, },
...@@ -154,6 +148,8 @@ export default { ...@@ -154,6 +148,8 @@ export default {
}) })
return return
} }
console.log('=====图片itemImages', this.itemImages)
console.log('=====图片', this.saleForm.images)
if (this.saleId) { if (this.saleId) {
const params = { credential: this.saleForm.images.join(';'), saleId: this.saleId } const params = { credential: this.saleForm.images.join(';'), saleId: this.saleId }
this.$refs.finish.validate((valid) => { this.$refs.finish.validate((valid) => {
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
@click="finishSettlementDialogShow = true">向用户结款 @click="finishSettlementDialogShow = true">向用户结款
</el-button> </el-button>
<el-button <el-button
v-if="systemState < 20" v-if="systemState < 16"
type="danger" type="danger"
size="mini" size="mini"
@click="cancelConsignDialogShow = true">取消寄售 @click="cancelConsignDialogShow = true">取消寄售
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
<el-table <el-table
v-loading="listLoading" v-loading="listLoading"
:data="list" :data="list"
:key="itemKey"
size="small" size="small"
element-loading-text="正在查询中..." element-loading-text="正在查询中..."
border border
...@@ -44,7 +45,7 @@ ...@@ -44,7 +45,7 @@
</el-table-column> </el-table-column>
<el-table-column align="center" label="状态" prop="systemStateName" /> <el-table-column align="center" label="状态" prop="systemStateName" />
<el-table-column v-if="listQuery.systemState === '1' || listQuery.systemState === '8'" align="center" label="等待用户确认" prop="intervalTime" min-width="100px"> <el-table-column v-if="listQuery.systemState === '1' || listQuery.systemState === '8'" align="center" label="等待用户确认" min-width="100px">
<template slot-scope="scope"> <template slot-scope="scope">
<div v-if="!scope.row.isHasPrice" >暂无估价</div> <div v-if="!scope.row.isHasPrice" >暂无估价</div>
<div v-if="scope.row.isHasPrice" > <div v-if="scope.row.isHasPrice" >
...@@ -182,6 +183,7 @@ export default { ...@@ -182,6 +183,7 @@ export default {
}, },
data() { data() {
return { return {
itemKey: 0,
tabList: [ tabList: [
{ {
label: '图文估价', label: '图文估价',
...@@ -237,7 +239,18 @@ export default { ...@@ -237,7 +239,18 @@ export default {
this.listQuery.systemState = localStorage.getItem('systemState') || '1' this.listQuery.systemState = localStorage.getItem('systemState') || '1'
this.getList() this.getList()
}, },
destroyed() {
this.clearAll()
},
methods: { methods: {
// 清除所有定时器
clearAll() {
if (this.list) {
this.list.forEach(el => {
clearInterval(el.countDown)
})
}
},
handlerGetList() { handlerGetList() {
this.listQuery.page = 1 this.listQuery.page = 1
this.getList() this.getList()
...@@ -253,12 +266,14 @@ export default { ...@@ -253,12 +266,14 @@ export default {
localStorage.setItem('systemState', '') localStorage.setItem('systemState', '')
this.listLoading = true this.listLoading = true
findConsignList(this.listQuery).then(response => { findConsignList(this.listQuery).then(response => {
this.clearAll()
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
if (this.listQuery.systemState === '1' || this.listQuery.systemState === '8') { if (this.listQuery.systemState === '1' || this.listQuery.systemState === '8') {
this.list.forEach((el) => { this.itemKey++
this.countDown(el) this.list.forEach((item) => {
this.countDown(item)
}) })
} }
}).catch((e) => { }).catch((e) => {
...@@ -340,22 +355,22 @@ export default { ...@@ -340,22 +355,22 @@ export default {
this.currentSaleId = item.saleId this.currentSaleId = item.saleId
}, },
/** 倒计时*/ /** 倒计时*/
countDown(row) { countDown(item) {
// acceptanceOverTime 是我后台返回的截止时间 // acceptanceOverTime 是我后台返回的截止时间
if (new Date(row.countdownTime).getTime() - new Date().getTime() <= 0) { if (new Date(item.countdownTime).getTime() - new Date().getTime() <= 0) {
return return
} }
/* setInterval(() => { item.countDown = setInterval(() => {
if (new Date(row.countdownTime).getTime() - new Date().getTime() <= 0) { if (new Date(item.countdownTime).getTime() - new Date().getTime() <= 0) {
row.intervalTime = '已超时' item.intervalTime = '已超时'
return return
} }
row.intervalTime = this.formatDuring(new Date(row.countdownTime).getTime() - new Date().getTime()) this.itemKey++
console.log('===row.intervalTime==', row.intervalTime) item.intervalTime = this.formatDuring(new Date(item.countdownTime).getTime() - new Date().getTime())
}, 1000) */ }, 1000)
// 这边采取的是10秒调用一次 // 这边采取的是10秒调用一次
// 这里采用简单写法,直接在查询的时候调用一次,不用等定时器调用 // 这里采用简单写法,直接在查询的时候调用一次,不用等定时器调用
row.intervalTime = this.formatDuring(new Date(row.countdownTime).getTime() - new Date().getTime()) item.intervalTime = this.formatDuring(new Date(item.countdownTime).getTime() - new Date().getTime())
}, },
formatDuring(mss) { formatDuring(mss) {
console.log('======mss=', mss) console.log('======mss=', mss)
...@@ -368,7 +383,7 @@ export default { ...@@ -368,7 +383,7 @@ export default {
// 得到秒数 // 得到秒数
const seconds = parseInt((mss % (1000 * 60)) / 1000) const seconds = parseInt((mss % (1000 * 60)) / 1000)
const str2 = seconds < 10 ? ('0' + seconds) : seconds const str2 = seconds < 10 ? ('0' + seconds) : seconds
return hours + ':' + str1 + ':' + str2 return '剩余' + hours + ':' + str1 + ':' + str2
} else { } else {
return '已超时' return '已超时'
} }
......
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