{
'title': '状态',
'key': 'status',
render: (h, params) => {
return h(
'i-switch',
{
props: {
trueValue: 1,
falseValue: 0,
beforeChange: () => {
// if (status === 0)
console.log(params.row.status)
if (params.row.status === 1) {
console.log('000')
return new Promise((resolve) => {
this.$Modal.confirm({
title: '确认停用',
content: '停用商品后,该商品将不允许继续被选择,但不影响当前售卖。如果希望取消商品售卖,请在售货机详情中进行操作。',
onOk: () => {
this.changeStatus(params.row.status, params.row.id)
}
})
})
} else {
console.log('111')
this.changeStatus(params.row.status, params.row.id)
}
},
value: Number(params.row.status),
size: 'large'
}
},
[
h('span', {
slot: 'open'
}, '启用'),
h('span', {
slot: 'close'
}, '停用')
]
)
}
},
render:(h,params)=>{
return h('i-switch',{
props:{
value:params.row.status
size:'large'
},
scopedSlots:{
open:()=>h('span','开启'),
close:()=>h('span','停用')
}
})
}