feat: batch update - gift card breakdown spec, backend APIs, miniprogram pages, ETL finance recharge, docs & migrations

This commit is contained in:
Neo
2026-03-20 01:43:48 +08:00
parent 075caf067f
commit 79f9a0e1da
437 changed files with 118603 additions and 976 deletions

View File

@@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"t-icon": "tdesign-miniprogram/icon/icon"
}
}

View File

@@ -0,0 +1,84 @@
Component({
properties: {
visible: {
type: Boolean,
value: false,
},
customerName: {
type: String,
value: '',
},
},
data: {
content: '',
error: false,
keyboardHeight: 0,
canSave: false,
},
observers: {
visible(val: boolean) {
if (val) {
// 打开弹窗时重置
this.setData({
content: '',
error: false,
keyboardHeight: 0,
canSave: false,
})
} else {
// 关闭时重置键盘高度
this.setData({ keyboardHeight: 0 })
}
},
// 内容变化时重新计算 canSave
content(val: string) {
this.setData({
canSave: val.trim().length > 0,
})
},
},
methods: {
/** 文本输入 */
onContentInput(e: WechatMiniprogram.CustomEvent<{ value: string }>) {
this.setData({ content: e.detail.value, error: false })
},
/** 键盘弹出 */
onTextareaFocus(e: WechatMiniprogram.InputEvent) {
let height = (e as any).detail?.height ?? 0
// 修复首次激活时键盘高度可能为0需要设置最小值确保弹窗移动
if (height === 0) {
height = 260 // 微信小程序默认键盘高度约 260px
}
this.setData({ keyboardHeight: height })
},
/** 键盘收起 */
onTextareaBlur() {
this.setData({ keyboardHeight: 0 })
},
/** 确认放弃 */
onConfirm() {
if (!this.data.canSave) {
this.setData({ error: true })
return
}
this.triggerEvent('confirm', {
reason: this.data.content.trim(),
})
},
/** 取消 */
onCancel() {
this.triggerEvent('cancel')
},
/** 阻止冒泡 */
noop() {},
},
})

View File

@@ -0,0 +1,53 @@
<view class="modal-overlay {{keyboardHeight > 0 ? 'modal-overlay--keyboard-open' : ''}}" wx:if="{{visible}}" catchtap="onCancel" catchtouchmove="noop">
<view class="modal-container" catchtap="noop">
<!-- 头部 -->
<view class="modal-header">
<view class="header-left">
<text class="modal-emoji">⚠️</text>
<text class="modal-title">放弃 <text class="modal-name">{{customerName}}</text></text>
</view>
<view class="modal-close" bindtap="onCancel" hover-class="modal-close--hover">
<t-icon name="close" size="40rpx" color="#8b8b8b" />
</view>
</view>
<!-- 描述 -->
<view class="modal-desc-wrap">
<text class="modal-desc">确定放弃该客户的维护任务?请填写原因:</text>
</view>
<!-- 文本输入 -->
<view class="textarea-section">
<textarea
class="abandon-textarea"
placeholder="请输入放弃原因(必填)"
value="{{content}}"
bindinput="onContentInput"
bindfocus="onTextareaFocus"
bindblur="onTextareaBlur"
maxlength="200"
auto-height
adjust-position="{{false}}"
placeholder-class="textarea-placeholder"
/>
</view>
<!-- 错误提示 -->
<view class="error-wrap" wx:if="{{error}}">
<text class="error-text">请输入放弃原因后再提交</text>
</view>
<!-- 键盘弹出时的占位,防止内容被遮挡 -->
<view wx:if="{{keyboardHeight > 0}}" style="height: {{keyboardHeight}}px;"></view>
<!-- 保存按钮 -->
<view class="modal-footer {{keyboardHeight > 0 ? 'modal-footer--float' : ''}}" style="{{keyboardHeight > 0 ? 'bottom: ' + keyboardHeight + 'px;' : ''}}">
<view class="confirm-btn {{!canSave ? 'disabled' : ''}}" bindtap="onConfirm" hover-class="{{canSave ? 'confirm-btn--hover' : ''}}">
<text class="confirm-text">确认放弃</text>
</view>
<view class="cancel-btn" bindtap="onCancel" hover-class="cancel-btn--hover">
<text class="cancel-text">取消</text>
</view>
</view>
</view>
</view>

View File

@@ -0,0 +1,192 @@
/* 放弃弹窗样式 */
.modal-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
display: flex;
align-items: flex-end;
z-index: 1000;
transition: align-items 0.3s ease;
}
/* 键盘弹出时,弹窗移到顶部 */
.modal-overlay--keyboard-open {
align-items: flex-start;
}
.modal-container {
width: 100%;
background: #fff;
border-radius: 48rpx 48rpx 0 0;
padding: 40rpx 40rpx 60rpx;
max-height: 80vh;
overflow-y: auto;
transition: border-radius 0.3s ease;
}
/* 键盘弹出时,改为全圆角 */
.modal-overlay--keyboard-open .modal-container {
border-radius: 0 0 48rpx 48rpx;
max-height: none;
}
/* 头部 */
.modal-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 32rpx;
}
.header-left {
display: flex;
align-items: center;
gap: 16rpx;
}
.modal-emoji {
font-size: 32rpx;
}
.modal-title {
font-size: 32rpx;
line-height: 44rpx;
font-weight: 600;
color: #242424;
}
.modal-name {
color: #e34d59;
}
.modal-close {
width: 64rpx;
height: 64rpx;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
background: transparent;
}
.modal-close--hover {
background: #f3f3f3;
}
/* 描述 */
.modal-desc-wrap {
margin-bottom: 32rpx;
}
.modal-desc {
font-size: 26rpx;
line-height: 36rpx;
color: #8b8b8b;
}
/* 文本输入 */
.textarea-section {
margin-bottom: 32rpx;
}
.abandon-textarea {
width: 100%;
min-height: 240rpx;
padding: 24rpx;
background: #f3f3f3;
border-radius: 24rpx;
font-size: 28rpx;
line-height: 40rpx;
color: #242424;
border: 2rpx solid #f3f3f3;
transition: border-color 0.2s;
box-sizing: border-box;
}
.abandon-textarea:focus {
border-color: #0052d9;
background: #fff;
}
.textarea-placeholder {
color: #a6a6a6;
}
/* 错误提示 */
.error-wrap {
margin-bottom: 16rpx;
}
.error-text {
font-size: 22rpx;
line-height: 32rpx;
color: #e34d59;
}
/* 底部按钮 */
.modal-footer {
display: flex;
flex-direction: column;
gap: 16rpx;
}
/* 键盘弹出时固定在键盘上方 */
.modal-footer--float {
position: fixed;
left: 0;
right: 0;
padding: 12rpx 40rpx 16rpx;
background: #fff;
box-shadow: 0 -2rpx 16rpx rgba(0, 0, 0, 0.06);
z-index: 1001;
}
.confirm-btn {
height: 96rpx;
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(135deg, #e34d59, #f87171);
border-radius: 24rpx;
box-shadow: 0 8rpx 24rpx rgba(227, 77, 89, 0.3);
}
.confirm-btn.disabled {
background: #e7e7e7;
box-shadow: none;
}
.confirm-text {
font-size: 32rpx;
line-height: 44rpx;
font-weight: 600;
color: #fff;
}
.confirm-btn.disabled .confirm-text {
color: #a6a6a6;
}
.confirm-btn--hover {
opacity: 0.85;
}
.cancel-btn {
height: 72rpx;
display: flex;
align-items: center;
justify-content: center;
}
.cancel-text {
font-size: 28rpx;
line-height: 40rpx;
color: #a6a6a6;
}
.cancel-btn--hover .cancel-text {
color: #5e5e5e;
}