账单报表
This commit is contained in:
151
utils/api.js
151
utils/api.js
@@ -51,42 +51,23 @@ export function fetchPost(url, params, needToken, multiple) {
|
||||
console.log(res);
|
||||
if (response.statusCode == 200) {
|
||||
if (res.err_code == 0) {
|
||||
// wx.hideLoading();
|
||||
wx.hideLoading();
|
||||
resolve(res);
|
||||
} else {
|
||||
if (res.err_code == 10003 || res.err_code == 10006 || res.err_code == 20006) {
|
||||
// wx.removeStorageSync('accessToken');
|
||||
// wx.redirectTo({
|
||||
// url: '/pages/login/index',
|
||||
// })
|
||||
isUnLogin();
|
||||
reject(res);
|
||||
return;
|
||||
} else if (res.err_code == 20005) {
|
||||
wx.removeStorageSync('accessToken');
|
||||
wx.removeStorageSync('history');
|
||||
wx.hideLoading();
|
||||
wx.showToast({
|
||||
title: res.err_msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
reject(res);
|
||||
} else {
|
||||
wx.hideLoading();
|
||||
wx.showToast({
|
||||
title: res.err_msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
reject(res);
|
||||
}
|
||||
wx.hideLoading();
|
||||
wx.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
reject(res);
|
||||
}
|
||||
} else {
|
||||
wx.hideLoading();
|
||||
wx.showToast({
|
||||
title: '网络错误',
|
||||
title: '服务器异常',
|
||||
icon: 'none',
|
||||
duration: 4000
|
||||
})
|
||||
reject(response);
|
||||
}
|
||||
@@ -97,6 +78,7 @@ export function fetchPost(url, params, needToken, multiple) {
|
||||
wx.showToast({
|
||||
title: '网络错误',
|
||||
icon: 'none',
|
||||
duration: 4000
|
||||
})
|
||||
reject(response);
|
||||
},
|
||||
@@ -119,35 +101,13 @@ export function fetchPost(url, params, needToken, multiple) {
|
||||
wx.hideLoading();
|
||||
resolve(res.data);
|
||||
} else {
|
||||
if (res.data.err_code == 10003 || res.data.err_code == 10006 || res.data.err_code == 20006) {
|
||||
// wx.removeStorageSync('accessToken');
|
||||
// wx.redirectTo({
|
||||
// url: '/pages/login/index',
|
||||
// })
|
||||
reject(res);
|
||||
return;
|
||||
} else if (res.data.err_code == 30022) {
|
||||
reject(res);
|
||||
} else if (res.data.err_code == 20005) {
|
||||
wx.removeStorageSync('accessToken');
|
||||
wx.removeStorageSync('history');
|
||||
wx.hideLoading();
|
||||
wx.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
reject(res);
|
||||
} else {
|
||||
wx.hideLoading();
|
||||
wx.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
reject(res);
|
||||
}
|
||||
|
||||
wx.hideLoading();
|
||||
wx.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none',
|
||||
duration: 4000
|
||||
})
|
||||
reject(res);
|
||||
}
|
||||
},
|
||||
fail: function(res) {
|
||||
@@ -155,7 +115,7 @@ export function fetchPost(url, params, needToken, multiple) {
|
||||
wx.showToast({
|
||||
title: '网络错误',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
duration: 4000
|
||||
})
|
||||
reject(res);
|
||||
|
||||
@@ -187,37 +147,15 @@ export function fetchGet(url, params, needToken) {
|
||||
wx.hideLoading();
|
||||
resolve(res.data);
|
||||
} else {
|
||||
if (res.data.err_code == 10003 || res.data.err_code == 10006 || res.data.err_code == 20006) {
|
||||
// isUnLogin();
|
||||
reject(res);
|
||||
return;
|
||||
} else if (res.data.err_code == 20005) {
|
||||
wx.removeStorageSync('accessToken');
|
||||
wx.removeStorageSync('history');
|
||||
wx.hideLoading();
|
||||
wx.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
reject(res);
|
||||
} else {
|
||||
wx.hideLoading();
|
||||
wx.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
reject(res);
|
||||
}
|
||||
reject(res);
|
||||
}
|
||||
} else {
|
||||
wx.hideLoading();
|
||||
reject(res)
|
||||
wx.showToast({
|
||||
title: '网络错误',
|
||||
title: '服务器异常',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
duration: 4000
|
||||
})
|
||||
}
|
||||
},
|
||||
@@ -227,7 +165,7 @@ export function fetchGet(url, params, needToken) {
|
||||
wx.showToast({
|
||||
title: '网络错误',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
duration: 4000
|
||||
})
|
||||
},
|
||||
})
|
||||
@@ -255,19 +193,6 @@ export default {
|
||||
return fetchPost('/user/settings/del/' + params,null,true,false);
|
||||
},
|
||||
getSettings() {
|
||||
// let result;
|
||||
// if (type == 'INCOME_SETTING'){
|
||||
// result = wx.getStorageSync('INCOME_SETTING');
|
||||
// }
|
||||
// if (type == 'EXPEND_SETTING'){
|
||||
// result = wx.getStorageSync('INCOME_SETTING');
|
||||
// }
|
||||
// if (type == 'ACCOUNT_SETTING'){
|
||||
// result = wx.getStorageSync('INCOME_SETTING');
|
||||
// }
|
||||
// if (result){
|
||||
// return result;
|
||||
// }
|
||||
return fetchPost('/user/settings', null, true, false);
|
||||
},
|
||||
|
||||
@@ -286,12 +211,6 @@ export default {
|
||||
listBillsToday() {
|
||||
return fetchPost('/user/bills/today', null,true,false);
|
||||
},
|
||||
listBillByAMonth(params){
|
||||
return fetchPost('/user/bills/month' ,params,true,false);
|
||||
},
|
||||
listBillByAccount(params){
|
||||
return fetchPost('/user/bills/account' ,params,true,false);
|
||||
},
|
||||
editBill(params) {
|
||||
return fetchPost('/user/bill/edit',params,true,false);
|
||||
},
|
||||
@@ -312,5 +231,27 @@ export default {
|
||||
},
|
||||
editBudget(params){
|
||||
return fetchPost('/user/budget/edit',params,true,false);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 账单统计
|
||||
*/
|
||||
listBillByAMonth(params){
|
||||
return fetchPost('/user/bills/month' ,params,true,false);
|
||||
},
|
||||
listExpendOrderBills(params){
|
||||
return fetchPost('/user/bills/expend/order' ,params,true,false);
|
||||
},
|
||||
listIncomeOrderBills(params){
|
||||
return fetchPost('/user/bills/income/order' ,params,true,false);
|
||||
},
|
||||
listBillByAccount(params){
|
||||
return fetchPost('/user/bills/account' ,params,true,false);
|
||||
},
|
||||
listBillGroup(params){
|
||||
return fetchPost('/user/bills/group/list' ,params,true,false);
|
||||
},
|
||||
listBillGroupDetail(params){
|
||||
return fetchPost('/user/bills/group/detail' ,params,true,false);
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user