confirm.vue
2.5 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
123
124
125
126
127
128
129
130
131
132
<template>
<view class="confirmWrap">
<view class="confirm">
<view class="confirmTitle">
{{title}}
</view>
<view class="inpNumWrap">
<view class="inpNum" v-if="handleType == 'inpNum'">
<input type="number" v-model="price" placeholder="请输入金额"/>
</view>
<view class="inpTxtArea" v-if="handleType == 'inpTxtArea'">
<textarea placeholder="请输入理由" v-model="remark"/>
</view>
</view>
<view class="confirmBtnList">
<view class="confirmBtn" @click="cancel">
取消
</view>
<view class="confirmBtn" @click="confirm" style="color: #35655f;">
确定
</view>
</view>
</view>
</view>
</template>
<script>
export default{
data(){
return{
price:'',
remark:''
}
},
props:{
title:{
type:String
},
handleType:{
type:String
}
},
methods:{
confirm(){
if(this.handleType == 'inpNum'){
if(this.price == ''){
uni.showToast({
title:'请输入金额',
icon:'none'
})
return
}
this.$emit('confirm',{price:this.price})
}
if(this.handleType == 'inpTxtArea'){
if(this.remark == ''){
uni.showToast({
title:'请输入理由',
icon:'none'
})
return
}
this.$emit('confirm',{remark:this.remark})
}
},
cancel(){
this.$emit('cancel')
}
}
}
</script>
<style lang="scss" scoped>
.confirmWrap{
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
z-index: 1;
background: rgba(0,0,0,0.5);
display: flex;
align-items: center;
justify-content: center;
.confirm{
background: #fff;
width: 622rpx;
border-radius: 30rpx;
.confirmTitle{
padding: 50rpx 48rpx;
font-size: 32rpx;
text-align: center;
}
.inpNumWrap{
padding: 16rpx 48rpx 80rpx 48rpx;
.inpNum{
width: 100%;
height: 80rpx;
background: #f7f8fa;
border-radius: 16rpx;
display: flex;
align-items: center;
padding:0 20rpx;
input{width: 100%;}
}
.inpTxtArea{
width: 526rpx;
height: 280rpx;
background: #f7f8fa;
border-radius: 16rpx;
display: flex;
justify-content: center;
align-items: center;
textarea{width: 500rpx;height: 260rpx;}
}
}
.confirmBtnList{
border-top: 2rpx solid #ebedf0;
display: flex;
height: 95rpx;
.confirmBtn{
flex: 1;
text-align: center;
line-height: 95rpx;
border-right: 2rpx solid #ebedf0;
}
.confirmBtn:nth-of-type(2){border-right: none;}
}
}
}
</style>