popUpComponent.vue
3.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<template>
<view>
<u-popup :show="show" mode="bottom" @open="open" :customStyle="{width:'100vw'}" round="6" safeAreaInsetBottom>
<view class="popCss">
<view class="padding-top text-lg text-center">
{{title}}
</view>
<view class="padding">
<u-textarea v-model="textarea" placeholder="请简单描述原因"></u-textarea>
</view>
<view class="flex justify-between">
<view class="w50" @click="close">
<u-button>取消</u-button>
</view>
<view class="w50" @click="confirm">
<u-button :customStyle="{color:'#CF000D'}">确定</u-button>
</view>
</view>
</view>
</u-popup>
</view>
</template>
<script>
import {
submitAuditOne,
submitAuditTwo,
submitModificationOne,
submitModificationTwo
} from '@/api/charge.js'
export default {
name: "popUpComponent",
props: {
title: {
type: String,
default: "同意"
},
publishID: {
type: Number,
},
publishStatus: {
type: String,
default: ""
},
modificationStatus: {
type: String,
default: ""
}
},
data() {
return {
textarea: "",
show: false,
};
},
methods: {
open() {
this.show = true;
},
close() {
this.show = false;
},
async confirm() {
let that = this;
let data = {
"id": this.publishID,
"status": this.title === '同意' ? 'Y' : 'N',
"remarks": this.textarea
}
console.log("审批状态", this.publishStatus);
if (this.publishStatus === 'PENDING_LEVEL_1_AUDIT') {
const result = await submitAuditOne(data);
if (result.code === 200) {
that.$emit('getList');
uni.$u.toast(`${this.title}成功`)
} else {
uni.$u.toast(result.msg)
}
}
if (this.publishStatus === 'PENDING_LEVEL_2_AUDIT') {
const result = await submitAuditTwo(data);
if (result.code === 200) {
that.$emit('getList');
uni.$u.toast(`${this.title}成功`)
} else {
uni.$u.toast(result.msg)
}
}
if (this.publishStatus === 'APPROVED' && this.modificationStatus === 'PENDING_LEVEL_1_AUDIT') {
const result = await submitModificationOne(data);
if (result.code === 200) {
that.$emit('getList');
uni.$u.toast(`${this.title}成功`)
} else {
uni.$u.toast(result.msg)
}
}
if (this.publishStatus === 'APPROVED' && this.modificationStatus === 'PENDING_LEVEL_2_AUDIT') {
const result = await submitModificationTwo(data);
if (result.code === 200) {
that.$emit('getList');
uni.$u.toast(`${this.title}成功`)
} else {
uni.$u.toast(result.msg)
}
}
console.log("审批data", data);
this.show = false;
this.textarea = "";
}
}
}
</script>
<style lang="scss">
.popCss {
// text-align: center;
}
</style>