预算配置

This commit is contained in:
2023-02-09 22:46:38 +08:00
parent 7a7884abf5
commit 432b4f9815
8 changed files with 79 additions and 43 deletions

View File

@@ -31,12 +31,14 @@ Page({
},
changeBudget(e) {
let {type,id} = e.currentTarget.dataset
console.log(id);
console.log(type);
let tCurrentMoney = 0.00;
if (type == 'count'){
tCurrentMoney = this.data.sumBudget
}else {
this.data.payTypeList.forEach(item => {
if (item.id == id){
if (item.expendId == id){
tCurrentMoney = item.budget
}
})
@@ -68,11 +70,16 @@ Page({
})
return;
}
let expendId = this.data.currentId
if (this.data.changeType == 'count'){
expendId = -1
}
app.$api.editBudget({
expendId:this.data.currentId,
expendId:expendId,
budget:this.data.currentMoney
}).then(res=>{
if(res){
this.updateBudget();
this.closeDialog();
}
})

View File

@@ -1,7 +1,7 @@
<view class="main_look">
<view class="look_content">
<view class="pay_look">
<view bind:tap="changeBudget" data-type="count" class="inline_box font_big">总预算<t-icon name="tools"/></view>
<view bind:tap="changeBudget" data-id="-1" data-type="count" class="inline_box font_big">总预算<t-icon name="tools"/></view>
</view>
<view class="pay_look">
<text class="center_look font_big">{{ sumBudget }}</text>
@@ -19,10 +19,10 @@
note="{{item.budget}}"
bind:tap="changeBudget"
data-type="item"
data-id="{{item.id}}"
data-id="{{item.expendId}}"
>
<view wx:if="{{item.money}}" slot="description">
<t-progress percentage="{{25}}" />
<view wx:if="{{item.id}}" slot="description">
<t-progress percentage="{{item.progress}}" />
<text>已使用:{{item.used}}</text>
</view>
<text class="error_msg" wx:else slot="description">未设置预算</text>