parent
65b63027e3
commit
df6ea3050d
@ -0,0 +1,121 @@
|
||||
<script>
|
||||
import {itemAction,itemPreAction} from '@/api/order'
|
||||
import { Message } from 'element-ui'
|
||||
export default {
|
||||
props:{
|
||||
row:Object
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
icons:{
|
||||
follow:'ios-chatbubbles-outline',
|
||||
assign:'ios-paper-plane-outline',
|
||||
recover:'md-redo',
|
||||
cancel:'ios-close',
|
||||
confirm_merchant_cancel:'ios-close-circle',
|
||||
confirm_member_cancel:'md-close-circle'
|
||||
},
|
||||
isShow:false,
|
||||
action:'',
|
||||
content:'',
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
view(e){
|
||||
this.isShow = e
|
||||
},
|
||||
actionRender(){
|
||||
if(!this.row?.admin_actions) return
|
||||
|
||||
let keys = Object.keys(this.row.admin_actions)
|
||||
|
||||
return keys.map(item => {
|
||||
return (
|
||||
<Button
|
||||
icon={this.icons[item]}
|
||||
type="primary"
|
||||
style="margin-left: 10px;margin-bottom: 6px;"
|
||||
size="small"
|
||||
ghost
|
||||
on-click={()=>this.actionPreClick(item)}>
|
||||
{this.row.admin_actions[item]}
|
||||
</Button>
|
||||
)
|
||||
})
|
||||
},
|
||||
contentRender(){
|
||||
return (
|
||||
<div>
|
||||
<div style={{'display':'flex'}}>
|
||||
<div>产品名称</div>
|
||||
<div>{this.content.vo?.order?.order_name}</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
},
|
||||
|
||||
actionPreClick(action){
|
||||
this.action = action
|
||||
itemPreAction({
|
||||
item_id:this.row.id,
|
||||
action
|
||||
}).then(res => {
|
||||
this.content = res
|
||||
console.log(this.content)
|
||||
this.isShow = true
|
||||
})
|
||||
},
|
||||
actionClick(){
|
||||
itemAction({
|
||||
item_id:this.row.id,
|
||||
action:this.action
|
||||
}).then(res => {
|
||||
console.log(res)
|
||||
Message({
|
||||
type:'success',
|
||||
message:res.msg || '操作成功'
|
||||
})
|
||||
this.isShow = false
|
||||
})
|
||||
}
|
||||
},
|
||||
render(h) {
|
||||
let {actionRender,contentRender} = this
|
||||
return (
|
||||
<div>
|
||||
{ actionRender() }
|
||||
<Button
|
||||
icon="ios-clipboard-outline"
|
||||
type="primary"
|
||||
style="margin-left: 10px;margin-bottom: 6px;"
|
||||
size="small"
|
||||
ghost
|
||||
on-click={()=>{
|
||||
this.$emit('log')
|
||||
}}>日志</Button>
|
||||
|
||||
<xy-dialog
|
||||
width={40}
|
||||
title={this.row.admin_actions[this.action] || '操作'}
|
||||
is-show={this.isShow}
|
||||
type="normal"
|
||||
on={{
|
||||
['update:isShow']: this.view,
|
||||
['on-ok']:this.actionClick
|
||||
}}
|
||||
scopedSlots={{
|
||||
default:contentRender
|
||||
}}>
|
||||
|
||||
</xy-dialog>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
</style>
|
||||
Loading…
Reference in new issue