#
zhou zhou
5 天以前 ceb57b4c12eb18b32b849edb37f2d63ca2a5d0c5
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<template>
    <view
        class="modal-mask"
        v-if="visible"
        @click="handleCancel"
    >
        <view
            class="modal-container"
            @click.stop
        >
            <view class="modal-header">
                <text
                    :class="'cuIcon-' + icon"
                    :style="{ fontSize: '48rpx', color: iconColor }"
                ></text>
                <text class="modal-title">{{ title }}</text>
            </view>
            <view class="modal-body">
                <text class="modal-message">
                    {{ message }}
                </text>
            </view>
            <view class="modal-footer">
                <button
                    class="modal-btn modal-btn-cancel"
                    @click="handleCancel"
                >
                    {{ cancelText }}
                </button>
                <button
                    class="modal-btn modal-btn-confirm"
                    @click="handleConfirm"
                    :disabled="isconfirm"
                    :loading="isconfirm"
                >
                    {{ confirmText }}
                </button>
            </view>
        </view>
    </view>
</template>
 
<script>
export default {
    name: 'ConfirmModal',
    props: {
        visible: {
            type: Boolean,
            default: false
        },
        title: {
            type: String,
            default: '提示'
        },
        message: {
            type: String,
            default: ''
        },
        icon: {
            type: String,
            default: 'deliver'
        },
        iconColor: {
            type: String,
            default: '#0081ff'
        },
        cancelText: {
            type: String,
            default: '取消'
        },
        confirmText: {
            type: String,
            default: '确定'
        },
        isconfirm: {
            type: Boolean,
            default: false
        }
    },
    methods: {
        handleCancel() {
            this.$emit('update:visible', false)
            this.$emit('cancel')
        },
        handleConfirm() {
            this.$emit('confirm')
        }
    }
}
</script>
 
<style scoped>
/* 弹窗遮罩层 */
.modal-mask {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
}
/* 弹窗容器 */
.modal-container {
    width: 600rpx;
    background-color: #ffffff;
    border-radius: 24rpx;
    overflow: hidden;
    box-shadow: 0 8rpx 40rpx rgba(0, 0, 0, 0.15);
}
 
/* 弹窗头部 */
.modal-header {
    padding: 40rpx 30rpx 20rpx;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, #f0f7ff 0%, #e8f4ff 100%);
}
 
.modal-title {
    font-size: 34rpx;
    font-weight: bold;
    color: #333;
    /* margin-top: 16rpx; */
}
 
/* 弹窗内容 */
.modal-body {
    padding: 30rpx;
}
.modal-message {
    font-size: 30rpx;
    color: #666;
    text-align: center;
    display: block;
}
/* 弹窗底部按钮 */
.modal-footer {
    display: flex;
    border-top: 1rpx solid #eee;
}
.modal-btn {
    flex: 1;
    height: 100rpx;
    line-height: 100rpx;
    font-size: 32rpx;
    border: none;
    border-radius: 0;
    background-color: #fff;
}
 
.modal-btn::after {
    border: none;
}
 
.modal-btn-cancel {
    color: #999;
    border-right: 1rpx solid #eee;
}
 
.modal-btn-confirm {
    color: #fff;
    background: linear-gradient(135deg, #0081ff 0%, #1890ff 100%);
    font-weight: bold;
}
 
.modal-btn-confirm:active {
    background: linear-gradient(135deg, #0070dd 0%, #1480e8 100%);
}
 
.modal-btn-cancel:active {
    background-color: #f5f5f5;
}
</style>