|
|
@@ -55,7 +55,7 @@ import AppWrapperEmpty from '@/components/app-wrapper-empty'
|
|
|
import ModalModule from '@/components/plugin/modal'
|
|
|
import { list } from '@/mixins'
|
|
|
// api
|
|
|
-import { getList, del, off } from '@/api/ad'
|
|
|
+import { getList, del, updateStatus } from '@/api/ad'
|
|
|
export default {
|
|
|
name: 'ad-list',
|
|
|
components: {
|
|
|
@@ -77,11 +77,17 @@ export default {
|
|
|
}
|
|
|
],
|
|
|
// 操作菜单
|
|
|
- operateData: null,
|
|
|
+ operateData: {},
|
|
|
operateShow: false,
|
|
|
operateIndex: null,
|
|
|
operateTop: 0,
|
|
|
- btnData: [
|
|
|
+ // 删除弹窗
|
|
|
+ delModal: false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ btnData() {
|
|
|
+ return [
|
|
|
{
|
|
|
text: '编辑',
|
|
|
icon: 'iconbianji',
|
|
|
@@ -96,14 +102,10 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
- text: '下架',
|
|
|
- icon: 'iconxiajia',
|
|
|
+ text: this.operateData.status == 1 ? '下架' : '启用',
|
|
|
+ icon: this.operateData.status == 1 ? 'iconxiajia' : 'iconqiyong',
|
|
|
click: () => {
|
|
|
- off({ id: this.operateData.id }).then(res => {
|
|
|
- this.operateCloseFn()
|
|
|
- this.list.data[this.operateData.index].status = 0
|
|
|
- this.$msg('下架成功!')
|
|
|
- })
|
|
|
+ this.changeStatusFn()
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
@@ -113,9 +115,7 @@ export default {
|
|
|
this.delModal = true
|
|
|
}
|
|
|
}
|
|
|
- ],
|
|
|
- // 删除弹窗
|
|
|
- delModal: false
|
|
|
+ ]
|
|
|
}
|
|
|
},
|
|
|
onPullDownRefresh() {
|
|
|
@@ -169,7 +169,7 @@ export default {
|
|
|
},
|
|
|
// 关闭操作按钮
|
|
|
operateCloseFn() {
|
|
|
- this.operateData = null
|
|
|
+ this.operateData = {}
|
|
|
this.operateIndex = null
|
|
|
this.operateShow = false
|
|
|
},
|
|
|
@@ -190,6 +190,14 @@ export default {
|
|
|
this._list()
|
|
|
})
|
|
|
}
|
|
|
+ },
|
|
|
+ changeStatusFn() {
|
|
|
+ let status = this.operateData.status == 1 ? 0 : 1
|
|
|
+ updateStatus({ id: this.operateData.id, status: status }).then(res => {
|
|
|
+ this.list.data[this.operateData.index].status = status
|
|
|
+ this.operateCloseFn()
|
|
|
+ this.$msg('操作成功!')
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|