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