You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
2.4 KiB
76 lines
2.4 KiB
1 week ago
|
|
||
|
<view class="type-tabs">
|
||
|
<view class="tab {{activeType === 'expense' ? 'active' : ''}}" bindtap="setActiveType" data-type="expense">支出分类</view>
|
||
|
<view class="tab {{activeType === 'income' ? 'active' : ''}}" bindtap="setActiveType" data-type="income">收入分类</view>
|
||
|
</view>
|
||
|
|
||
|
|
||
|
<view class="category-list">
|
||
|
<view wx:for="{{filteredCategories}}" wx:key="id" class="category-item">
|
||
|
<view class="category-info">
|
||
|
<view class="category-icon">
|
||
|
<text class="iconfont icon-{{item.icon}}"></text>
|
||
|
</view>
|
||
|
<text class="category-name">{{item.name}}</text>
|
||
|
</view>
|
||
|
<view class="category-actions">
|
||
|
<button class="edit-btn" bindtap="editCategory" data-id="{{item.id}}">编辑</button>
|
||
|
<button
|
||
|
class="delete-btn"
|
||
|
bindtap="deleteCategory"
|
||
|
data-id="{{item.id}}"
|
||
|
wx:if="{{filteredCategories.length > 1}}"
|
||
|
>
|
||
|
删除
|
||
|
</button>
|
||
|
</view>
|
||
|
</view>
|
||
|
|
||
|
<view wx:if="{{filteredCategories.length === 0}}" class="no-categories">
|
||
|
<text>暂无分类,请添加</text>
|
||
|
</view>
|
||
|
</view>
|
||
|
|
||
|
<button class="add-btn" bindtap="addCategory">
|
||
|
<text class="iconfont icon-plus"></text>
|
||
|
添加分类
|
||
|
</button>
|
||
|
|
||
|
<!-- 添加/编辑分类弹窗 -->
|
||
|
<view class="modal-mask" wx:if="{{showModal}}" bindtap="hideModal"></view>
|
||
|
<view class="modal-dialog" wx:if="{{showModal}}">
|
||
|
<view class="modal-title">{{isEditing ? '编辑分类' : '添加分类'}}</view>
|
||
|
|
||
|
<view class="modal-content">
|
||
|
<view class="form-item">
|
||
|
<text class="form-label">分类名称</text>
|
||
|
<input
|
||
|
type="text"
|
||
|
placeholder="请输入分类名称"
|
||
|
value="{{categoryName}}"
|
||
|
bindinput="onNameChange"
|
||
|
/>
|
||
|
</view>
|
||
|
|
||
|
<view class="form-item">
|
||
|
<text class="form-label">选择图标</text>
|
||
|
<view class="icon-selector">
|
||
|
<view
|
||
|
wx:for="{{icons}}"
|
||
|
wx:key="*this"
|
||
|
class="icon-item {{selectedIcon === item ? 'selected' : ''}}"
|
||
|
bindtap="selectIcon"
|
||
|
data-icon="{{item}}"
|
||
|
>
|
||
|
<text class="iconfont icon-{{item}}"></text>
|
||
|
</view>
|
||
|
</view>
|
||
|
</view>
|
||
|
</view>
|
||
|
|
||
|
<view class="modal-footer">
|
||
|
<button class="cancel-btn" bindtap="hideModal">取消</button>
|
||
|
<button class="confirm-btn" bindtap="saveCategory">确认</button>
|
||
|
</view>
|
||
|
</view>
|