diff --git a/app.js b/app.js
index f6474b6..634c5cd 100644
--- a/app.js
+++ b/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'},
diff --git a/image/bill/0.png b/image/bill/0.png
new file mode 100644
index 0000000..8b51217
Binary files /dev/null and b/image/bill/0.png differ
diff --git a/image/bill/1.png b/image/bill/1.png
new file mode 100644
index 0000000..ef478a3
Binary files /dev/null and b/image/bill/1.png differ
diff --git a/image/bill/10.png b/image/bill/10.png
new file mode 100644
index 0000000..1ec8b35
Binary files /dev/null and b/image/bill/10.png differ
diff --git a/image/bill/11.png b/image/bill/11.png
new file mode 100644
index 0000000..c114c7d
Binary files /dev/null and b/image/bill/11.png differ
diff --git a/image/bill/12.png b/image/bill/12.png
new file mode 100644
index 0000000..be4d1bd
Binary files /dev/null and b/image/bill/12.png differ
diff --git a/image/bill/15.png b/image/bill/15.png
new file mode 100644
index 0000000..96365fe
Binary files /dev/null and b/image/bill/15.png differ
diff --git a/image/bill/2.png b/image/bill/2.png
new file mode 100644
index 0000000..6b660dd
Binary files /dev/null and b/image/bill/2.png differ
diff --git a/image/bill/3.png b/image/bill/3.png
new file mode 100644
index 0000000..2afdad8
Binary files /dev/null and b/image/bill/3.png differ
diff --git a/image/bill/4.png b/image/bill/4.png
new file mode 100644
index 0000000..6f53057
Binary files /dev/null and b/image/bill/4.png differ
diff --git a/image/bill/5.png b/image/bill/5.png
new file mode 100644
index 0000000..7e1a3fc
Binary files /dev/null and b/image/bill/5.png differ
diff --git a/image/bill/6.png b/image/bill/6.png
new file mode 100644
index 0000000..acdb5b6
Binary files /dev/null and b/image/bill/6.png differ
diff --git a/image/bill/7.png b/image/bill/7.png
new file mode 100644
index 0000000..99c0c1c
Binary files /dev/null and b/image/bill/7.png differ
diff --git a/image/bill/8.png b/image/bill/8.png
new file mode 100644
index 0000000..a7b143d
Binary files /dev/null and b/image/bill/8.png differ
diff --git a/image/bill/9.png b/image/bill/9.png
new file mode 100644
index 0000000..add02fd
Binary files /dev/null and b/image/bill/9.png differ
diff --git a/image/bill/repayment.png b/image/bill/repayment.png
new file mode 100644
index 0000000..631bf97
Binary files /dev/null and b/image/bill/repayment.png differ
diff --git a/image/bill/transfer.png b/image/bill/transfer.png
new file mode 100644
index 0000000..eaa8f69
Binary files /dev/null and b/image/bill/transfer.png differ
diff --git a/pages/settings/account/index.js b/pages/settings/account/index.js
index 11cc7fd..560ff1f 100644
--- a/pages/settings/account/index.js
+++ b/pages/settings/account/index.js
@@ -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({
diff --git a/pages/settings/account/index.wxml b/pages/settings/account/index.wxml
index 1872dc4..08fd53f 100644
--- a/pages/settings/account/index.wxml
+++ b/pages/settings/account/index.wxml
@@ -5,8 +5,8 @@
@@ -16,8 +16,8 @@
diff --git a/pages/settings/edit/index.js b/pages/settings/edit/index.js
index 11c1c1a..c627bcc 100644
--- a/pages/settings/edit/index.js
+++ b/pages/settings/edit/index.js
@@ -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 () {
- 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() {
this.setData({
@@ -50,9 +93,12 @@ Page({
})
},
onConfirm (e) {
- app.$api.deleteSetting();
- wx.navigateBack();
- this.closeDialog();
+ app.$api.deleteSetting(this.data.id).then(res => {
+ if (res){
+ wx.navigateBack();
+ this.closeDialog();
+ }
+ });
},
closeDialog() {
this.setData({
diff --git a/pages/settings/edit/index.wxml b/pages/settings/edit/index.wxml
index fb6e0cc..23fe074 100644
--- a/pages/settings/edit/index.wxml
+++ b/pages/settings/edit/index.wxml
@@ -2,13 +2,13 @@
label="名称"
placeholder="请输入名称"
align="right"
- bindchange="onPriceInput"
- value="{{ '假的名称' }}"
+ bindchange="onNameInput"
+ value="{{name}}"
/>
-
-
-
+
+
+
diff --git a/pages/settings/expend/index.js b/pages/settings/expend/index.js
index 1a85aa4..39ef5fd 100644
--- a/pages/settings/expend/index.js
+++ b/pages/settings/expend/index.js
@@ -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 => {
diff --git a/pages/settings/expend/index.wxml b/pages/settings/expend/index.wxml
index 4a22ce2..7702eaf 100644
--- a/pages/settings/expend/index.wxml
+++ b/pages/settings/expend/index.wxml
@@ -1,7 +1,7 @@
- 年度总支出
+ 年度总支出
{{ 7000.23 }}
@@ -13,9 +13,9 @@
diff --git a/pages/settings/income/index.js b/pages/settings/income/index.js
index 36b1cf1..5f48203 100644
--- a/pages/settings/income/index.js
+++ b/pages/settings/income/index.js
@@ -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 => {
diff --git a/pages/settings/income/index.wxml b/pages/settings/income/index.wxml
index 9d1010b..5fdcb5f 100644
--- a/pages/settings/income/index.wxml
+++ b/pages/settings/income/index.wxml
@@ -1,20 +1,25 @@
- 年度总收入
+ 年度总收入
{{ 89310.23 }}
-
-
-
+
+
+
+
+
+
+
+
diff --git a/utils/api.js b/utils/api.js
index a143a2d..d370219 100644
--- a/utils/api.js
+++ b/utils/api.js
@@ -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;