配置
3
app.js
@@ -7,7 +7,8 @@ App({
|
||||
globalData: {
|
||||
INCOME_SETTING: 'INCOME_SETTING',
|
||||
EXPEND_SETTING: 'EXPEND_SETTING',
|
||||
ACCOUNT_SETTING: 'ACCOUNT_SETTING',
|
||||
CASH_SETTING: 'CASH_SETTING',
|
||||
OWE_SETTING: 'OWE_SETTING',
|
||||
billIcon : [
|
||||
{label: '度假', icon: '/image/bill/0.png'},
|
||||
{label: '电影', icon: '/image/bill/1.png'},
|
||||
|
||||
BIN
image/bill/0.png
Normal file
|
After Width: | Height: | Size: 8.4 KiB |
BIN
image/bill/1.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
image/bill/10.png
Normal file
|
After Width: | Height: | Size: 8.9 KiB |
BIN
image/bill/11.png
Normal file
|
After Width: | Height: | Size: 7.4 KiB |
BIN
image/bill/12.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
image/bill/15.png
Normal file
|
After Width: | Height: | Size: 9.9 KiB |
BIN
image/bill/2.png
Normal file
|
After Width: | Height: | Size: 8.3 KiB |
BIN
image/bill/3.png
Normal file
|
After Width: | Height: | Size: 8.0 KiB |
BIN
image/bill/4.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
image/bill/5.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
image/bill/6.png
Normal file
|
After Width: | Height: | Size: 8.5 KiB |
BIN
image/bill/7.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
image/bill/8.png
Normal file
|
After Width: | Height: | Size: 8.2 KiB |
BIN
image/bill/9.png
Normal file
|
After Width: | Height: | Size: 9.7 KiB |
BIN
image/bill/repayment.png
Normal file
|
After Width: | Height: | Size: 7.9 KiB |
BIN
image/bill/transfer.png
Normal file
|
After Width: | Height: | Size: 8.0 KiB |
@@ -1,3 +1,4 @@
|
||||
const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
cashAccountList : [
|
||||
@@ -8,8 +9,14 @@ Page({
|
||||
{"name":"信用卡","money":"-200.00"},
|
||||
],
|
||||
},
|
||||
onLoad: function (options) {
|
||||
|
||||
onShow: function () {
|
||||
app.$api.getSettings().then(setting => {
|
||||
if (setting.data){
|
||||
let cashAccountList = setting.data.CASH_SETTING
|
||||
let oweAccountList = setting.data.OWE_SETTING
|
||||
this.setData({cashAccountList,oweAccountList})
|
||||
}
|
||||
})
|
||||
},
|
||||
handleClick() {
|
||||
wx.navigateTo({
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
<t-cell wx:for="{{cashAccountList}}" wx:key="index"
|
||||
title="{{item.name}}"
|
||||
align="top"
|
||||
image="/image/account/11.png"
|
||||
url="../edit/index?isAccount=true"
|
||||
image="{{item.icon}}"
|
||||
url="../edit/index?isAccount=1&isIncome=0&isAdd=0&id={{item.id}}"
|
||||
/>
|
||||
</t-cell-group>
|
||||
<view class="padding_box">
|
||||
@@ -16,8 +16,8 @@
|
||||
<t-cell wx:for="{{oweAccountList}}" wx:key="index"
|
||||
title="{{item.name}}"
|
||||
align="top"
|
||||
image="/image/account/4.png"
|
||||
url="../edit/index?isAccount=1&isIncome=0&isAdd=0"
|
||||
image="{{item.icon}}"
|
||||
url="../edit/index?isAccount=1&isIncome=0&isAdd=0&id={{item.id}}"
|
||||
/>
|
||||
</t-cell-group>
|
||||
<t-fab icon="add" bind:click="handleClick" aria-label="新增账户"/>
|
||||
|
||||
@@ -7,8 +7,10 @@ Page({
|
||||
isIncome: 0,
|
||||
isAdd: 0,
|
||||
showDeleteConfirm: false,
|
||||
id : -1,
|
||||
icon : null,
|
||||
accType: null
|
||||
settingType: null,
|
||||
name: null,
|
||||
},
|
||||
onLoad: function (options) {
|
||||
this.setData({
|
||||
@@ -16,6 +18,26 @@ Page({
|
||||
isIncome : options.isIncome,
|
||||
isAdd : options.isAdd
|
||||
})
|
||||
if (options.isAdd == 0){
|
||||
this.setData({
|
||||
id : options.id
|
||||
})
|
||||
app.$api.getSetting(options.id).then(res => {
|
||||
if (res.data){
|
||||
let name = res.data.name
|
||||
let icon = res.data.icon
|
||||
let settingType = res.data.settingType
|
||||
this.setData({name,icon,settingType})
|
||||
}
|
||||
})
|
||||
}
|
||||
if (options.isAdd == 1 && options.isAccount == 0){
|
||||
let settingType = 'EXPEND_SETTING';
|
||||
if (options.isIncome == 1){
|
||||
settingType = 'INCOME_SETTING'
|
||||
}
|
||||
this.setData({settingType})
|
||||
}
|
||||
},
|
||||
handleMultiAction(e) {
|
||||
if (this.data.isAccount == 1) {
|
||||
@@ -41,8 +63,29 @@ Page({
|
||||
let {icon} = e.detail.selected
|
||||
this.setData({icon})
|
||||
},
|
||||
changeItem(e) {
|
||||
this.setData({ settingType : e.detail.value})
|
||||
},
|
||||
onNameInput(e) {
|
||||
this.setData({ name : e.detail.value})
|
||||
},
|
||||
saveSetting () {
|
||||
let param = {
|
||||
id : this.data.id,
|
||||
name : this.data.name,
|
||||
icon : this.data.icon,
|
||||
settingType : this.data.settingType
|
||||
}
|
||||
app.$api.editSetting(param).then(res => {
|
||||
if (res){
|
||||
wx.showToast({
|
||||
title: '保存成功!',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
wx.navigateBack();
|
||||
}
|
||||
})
|
||||
},
|
||||
deleteSetting() {
|
||||
this.setData({
|
||||
@@ -50,9 +93,12 @@ Page({
|
||||
})
|
||||
},
|
||||
onConfirm (e) {
|
||||
app.$api.deleteSetting();
|
||||
app.$api.deleteSetting(this.data.id).then(res => {
|
||||
if (res){
|
||||
wx.navigateBack();
|
||||
this.closeDialog();
|
||||
}
|
||||
});
|
||||
},
|
||||
closeDialog() {
|
||||
this.setData({
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
label="名称"
|
||||
placeholder="请输入名称"
|
||||
align="right"
|
||||
bindchange="onPriceInput"
|
||||
value="{{ '假的名称' }}"
|
||||
bindchange="onNameInput"
|
||||
value="{{name}}"
|
||||
/>
|
||||
<t-input wx:if="{{ isAccount == 1 }}" label="分类" disabled>
|
||||
<t-radio-group slot="suffix" default-value="{{accType}}" borderless t-class="box">
|
||||
<t-radio block="{{ false }}" label="资产账户" value="0" />
|
||||
<t-radio block="{{ false }}" label="负债账户" value="1" />
|
||||
<t-radio-group slot="suffix" default-value="CASH_SETTING" value="{{settingType}}" bind:change="changeItem" borderless t-class="box">
|
||||
<t-radio block="{{ false }}" label="资产账户" value="CASH_SETTING" />
|
||||
<t-radio block="{{ false }}" label="负债账户" value="OWE_SETTING" />
|
||||
</t-radio-group>
|
||||
</t-input>
|
||||
<t-input label="图标" disabled >
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
payList: null
|
||||
payList: [
|
||||
{"name":"薪资","money":"89310.00","icon":"/image/bill/0.png"},
|
||||
{"name":"红包","money":"0.23","icon":"/image/bill/2.png"}
|
||||
]
|
||||
},
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
onShow() {
|
||||
app.$api.getSettings().then(setting => {
|
||||
let payList = setting.data.EXPEND_SETTING;
|
||||
app.$api.getSettingsExpend().then(res => {
|
||||
|
||||
@@ -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">年度总支出</view>
|
||||
<view data-type="count" class="inline_box font_big">年度总支出</view>
|
||||
</view>
|
||||
<view class="pay_look">
|
||||
<text class="center_look font_big">{{ 7000.23 }}</text>
|
||||
@@ -13,9 +13,9 @@
|
||||
<t-cell wx:for="{{payList}}" wx:key="index"
|
||||
title="{{item.name}}"
|
||||
align="top"
|
||||
image="/image/bill/7.png"
|
||||
image="{{item.icon}}"
|
||||
note="{{item.money}}"
|
||||
url="../edit/index?isAccount=0&isIncome=0&isAdd=0"
|
||||
url="../edit/index?isAccount=0&isIncome=0&isAdd=0&id={{item.id}}"
|
||||
/>
|
||||
</t-cell-group>
|
||||
</view>
|
||||
|
||||
@@ -2,11 +2,11 @@ const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
incomeList: [
|
||||
{"name":"薪资","money":"89310.00"},
|
||||
{"name":"红包","money":"0.23"}
|
||||
{"name":"薪资","money":"89310.00","icon":"/image/bill/0.png"},
|
||||
{"name":"红包","money":"0.23","icon":"/image/bill/2.png"}
|
||||
]
|
||||
},
|
||||
onLoad: function (options) {
|
||||
onShow() {
|
||||
app.$api.getSettings().then(setting => {
|
||||
let incomeList = setting.data.INCOME_SETTING;
|
||||
app.$api.getSettingsIncome().then(res => {
|
||||
|
||||
@@ -1,20 +1,25 @@
|
||||
<view class="main_look">
|
||||
<view class="look_content">
|
||||
<view class="pay_look">
|
||||
<view bind:tap="changeBudget" data-type="count" class="inline_box font_big">年度总收入</view>
|
||||
<view data-type="count" class="inline_box font_big">年度总收入</view>
|
||||
</view>
|
||||
<view class="pay_look">
|
||||
<text class="center_look font_big">{{ 89310.23 }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<t-cell-group theme="card">
|
||||
<view wx:if="{{incomeList != null && incomeList.length > 0}}">
|
||||
<t-cell-group theme="card">
|
||||
<t-cell wx:for="{{incomeList}}" wx:key="index"
|
||||
title="{{item.name}}"
|
||||
align="top"
|
||||
image="/image/bill/11.png"
|
||||
note="{{item.money}}"
|
||||
url="../edit/index?isAccount=0&isIncome=1&isAdd=0"
|
||||
url="../edit/index?isAccount=0&isIncome=1&isAdd=0&id={{item.id}}"
|
||||
/>
|
||||
</t-cell-group>
|
||||
</t-cell-group>
|
||||
</view>
|
||||
<view wx:else class="empty-view" >
|
||||
<t-empty icon="chart-bubble" description="暂无收入分类" />
|
||||
</view>
|
||||
<t-fab icon="add" bind:click="handleClick" aria-label="新增收入类型"/>
|
||||
|
||||
@@ -242,13 +242,13 @@ export default {
|
||||
return fetchPost('/user/login',params,true,false);
|
||||
},
|
||||
getSetting(params) {
|
||||
return fetchPost('user/setting/' + params,true,false);
|
||||
return fetchPost('/user/setting/' + params,true,false);
|
||||
},
|
||||
addSetting(params) {
|
||||
return fetchPost('user/settings/add',params,true,false);
|
||||
editSetting(params) {
|
||||
return fetchPost('/user/settings/edit',params,true,false);
|
||||
},
|
||||
deleteSetting(params) {
|
||||
return fetchPost('user/settings/delete' + params,true,false);
|
||||
return fetchPost('/user/settings/del/' + params,true,false);
|
||||
},
|
||||
getSettings() {
|
||||
// let result;
|
||||
|
||||