Files
nuttyreading-master-html/src/views/modules/order/orderbeizhu-add-or-update.vue
悠悠小鹿 d41d5d1015 20230303
2023-03-03 11:36:00 +08:00

88 lines
2.6 KiB
Vue

<template>
<el-dialog title="订单备注" :visible.sync="visible" width="30%" :before-close="beforeCloseDialog">
<el-form :model="dataForm">
<el-form-item label="备注内容">
<el-input type="textarea" v-model="dataForm.remark"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="updateBeizhu"> </el-button>
</span>
</el-dialog>
</template>
<script>
import internal from 'events'
export default {
props: {
visible: {
type: Boolean,
value: true
},
orderId:{
type: Number,
value: null
},
},
data() {
return {
dataForm:{
remark: ''
}
}
},
methods:{
// 关闭前
beforeCloseDialog() {
this.$emit('closeDialog', false)
},
init (id) {
this.orderId = id || 0
this.visible = true
this.$nextTick(() => {
if (this.orderId) {
this.$http({
url: this.$http.adornUrl(`/book/buyorder/info/${this.orderId}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
console.log(data.buyOrder)
this.dataForm.remark = data.buyOrder.remark
// console.log(this.dataForm.remark)
}
})
}
})
},
updateBeizhu(){
// console.log(this.orderId)
// console.log('执行更新备注操作')
this.$http({
url: this.$http.adornUrl(`/book/buyorder/update`),
method: 'post',
data: this.$http.adornData({
'orderId': this.orderId,
'remark': this.dataForm.remark
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
this.beforeCloseDialog()
}
}
}
</script>