| 123456789101112131415161718192021222324252627282930 |
- /**
- * 作废原因选填弹窗(依赖基础库 editable Modal)。
- * @returns {Promise<string|null>} null=取消;字符串=确认(可空)
- */
- export function promptOptionalCancelReason(options = {}) {
- const {
- title = '作废确认',
- content = '作废原因选填,可直接确认。',
- confirmText = '作废',
- confirmColor = '#ef4444'
- } = options
- return new Promise((resolve) => {
- uni.showModal({
- title,
- content,
- editable: true,
- placeholderText: '选填作废原因',
- confirmText,
- confirmColor,
- success: (res) => {
- if (!res.confirm) {
- resolve(null)
- return
- }
- resolve(String(res.content || '').trim())
- },
- fail: () => resolve(null)
- })
- })
- }
|