mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-22 02:34:26 +08:00
fix bug
This commit is contained in:
@@ -12,7 +12,7 @@
|
|||||||
<f7-card v-for="categoryInfo in allCategories" :key="categoryInfo.type">
|
<f7-card v-for="categoryInfo in allCategories" :key="categoryInfo.type">
|
||||||
<f7-card-header>
|
<f7-card-header>
|
||||||
<small :style="{ opacity: 0.6 }">
|
<small :style="{ opacity: 0.6 }">
|
||||||
<span>{{ categoryInfo.type | categoryTypeName | t }}</span>
|
<span>{{ categoryInfo.type | categoryTypeName($constants.category.allCategoryTypes) | t }}</span>
|
||||||
</small>
|
</small>
|
||||||
</f7-card-header>
|
</f7-card-header>
|
||||||
<f7-card-content class="no-safe-areas" :padding="false">
|
<f7-card-content class="no-safe-areas" :padding="false">
|
||||||
@@ -68,7 +68,7 @@ export default {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
currentLocale: self.$i18n.locale,
|
currentLocale: self.$i18n.locale,
|
||||||
categoryType: '',
|
categoryType: 0,
|
||||||
allCategories: [],
|
allCategories: [],
|
||||||
submitting: false,
|
submitting: false,
|
||||||
showMoreActionSheet: false,
|
showMoreActionSheet: false,
|
||||||
@@ -85,22 +85,22 @@ export default {
|
|||||||
const query = self.$f7route.query;
|
const query = self.$f7route.query;
|
||||||
const router = self.$f7router;
|
const router = self.$f7router;
|
||||||
|
|
||||||
if (query.type !== '0' &&
|
self.categoryType = parseInt(query.type);
|
||||||
query.type !== this.$constants.category.allCategoryTypes.Income &&
|
|
||||||
query.type !== this.$constants.category.allCategoryTypes.Expense &&
|
if (self.categoryType !== 0 &&
|
||||||
query.type !== this.$constants.category.allCategoryTypes.Transfer) {
|
self.categoryType !== this.$constants.category.allCategoryTypes.Income &&
|
||||||
|
self.categoryType !== this.$constants.category.allCategoryTypes.Expense &&
|
||||||
|
self.categoryType !== this.$constants.category.allCategoryTypes.Transfer) {
|
||||||
self.$toast('Parameter Invalid');
|
self.$toast('Parameter Invalid');
|
||||||
router.back();
|
router.back();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.categoryType = query.type;
|
if (self.categoryType === 0) {
|
||||||
|
|
||||||
if (query.type === '0') {
|
|
||||||
for (let i = 1; i <= 3; i++) {
|
for (let i = 1; i <= 3; i++) {
|
||||||
self.allCategories.push({
|
self.allCategories.push({
|
||||||
type: i.toString(),
|
type: i,
|
||||||
categories: self.$utilities.copyArrayTo(self.getDefaultCategories(i.toString()), [])
|
categories: self.$utilities.copyArrayTo(self.getDefaultCategories(i), [])
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -139,7 +139,7 @@ export default {
|
|||||||
const category = categoryInfo.categories[j];
|
const category = categoryInfo.categories[j];
|
||||||
const submitCategory = {
|
const submitCategory = {
|
||||||
name: self.$t('category.' + category.name, self.currentLocale),
|
name: self.$t('category.' + category.name, self.currentLocale),
|
||||||
type: parseInt(categoryInfo.type),
|
type: categoryInfo.type,
|
||||||
icon: category.categoryIconId,
|
icon: category.categoryIconId,
|
||||||
color: category.color,
|
color: category.color,
|
||||||
subCategories: []
|
subCategories: []
|
||||||
@@ -149,7 +149,7 @@ export default {
|
|||||||
const subCategory = category.subCategories[k];
|
const subCategory = category.subCategories[k];
|
||||||
submitCategory.subCategories.push({
|
submitCategory.subCategories.push({
|
||||||
name: self.$t('category.' + subCategory.name, self.currentLocale),
|
name: self.$t('category.' + subCategory.name, self.currentLocale),
|
||||||
type: parseInt(categoryInfo.type),
|
type: categoryInfo.type,
|
||||||
icon: subCategory.categoryIconId,
|
icon: subCategory.categoryIconId,
|
||||||
color: subCategory.color
|
color: subCategory.color
|
||||||
});
|
});
|
||||||
@@ -188,13 +188,13 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
filters: {
|
filters: {
|
||||||
categoryTypeName(categoryType) {
|
categoryTypeName(categoryType, allCategoryTypes) {
|
||||||
switch (categoryType) {
|
switch (categoryType) {
|
||||||
case this.$constants.category.allCategoryTypes.Income:
|
case allCategoryTypes.Income:
|
||||||
return 'Income Categories';
|
return 'Income Categories';
|
||||||
case this.$constants.category.allCategoryTypes.Expense:
|
case allCategoryTypes.Expense:
|
||||||
return 'Expense Categories';
|
return 'Expense Categories';
|
||||||
case this.$constants.category.allCategoryTypes.Transfer:
|
case allCategoryTypes.Transfer:
|
||||||
return 'Transfer Categories';
|
return 'Transfer Categories';
|
||||||
default:
|
default:
|
||||||
return 'Transaction Categories';
|
return 'Transaction Categories';
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ export default {
|
|||||||
editCategoryId: null,
|
editCategoryId: null,
|
||||||
loading: false,
|
loading: false,
|
||||||
category: {
|
category: {
|
||||||
type: query.type,
|
type: parseInt(query.type),
|
||||||
name: '',
|
name: '',
|
||||||
parentId: query.parentId,
|
parentId: query.parentId,
|
||||||
icon: self.$constants.icons.defaultCategoryIconId,
|
icon: self.$constants.icons.defaultCategoryIconId,
|
||||||
@@ -158,7 +158,7 @@ export default {
|
|||||||
|
|
||||||
const category = data.result;
|
const category = data.result;
|
||||||
self.category.id = category.id;
|
self.category.id = category.id;
|
||||||
self.category.type = category.type.toString();
|
self.category.type = category.type;
|
||||||
self.category.parentId = category.type.parentId;
|
self.category.parentId = category.type.parentId;
|
||||||
self.category.name = category.name;
|
self.category.name = category.name;
|
||||||
self.category.icon = category.icon;
|
self.category.icon = category.icon;
|
||||||
@@ -179,9 +179,11 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (query.parentId) {
|
} else if (query.parentId) {
|
||||||
if (query.type !== this.$constants.category.allCategoryTypes.Income &&
|
const categoryType = parseInt(query.type);
|
||||||
query.type !== this.$constants.category.allCategoryTypes.Expense &&
|
|
||||||
query.type !== this.$constants.category.allCategoryTypes.Transfer) {
|
if (categoryType !== this.$constants.category.allCategoryTypes.Income &&
|
||||||
|
categoryType !== this.$constants.category.allCategoryTypes.Expense &&
|
||||||
|
categoryType !== this.$constants.category.allCategoryTypes.Transfer) {
|
||||||
self.$toast('Parameter Invalid');
|
self.$toast('Parameter Invalid');
|
||||||
router.back();
|
router.back();
|
||||||
return;
|
return;
|
||||||
@@ -206,7 +208,7 @@ export default {
|
|||||||
self.$showLoading(() => self.submitting);
|
self.$showLoading(() => self.submitting);
|
||||||
|
|
||||||
const submitCategory = {
|
const submitCategory = {
|
||||||
type: parseInt(self.category.type),
|
type: self.category.type,
|
||||||
name: self.category.name,
|
name: self.category.name,
|
||||||
parentId: self.category.parentId,
|
parentId: self.category.parentId,
|
||||||
icon: self.category.icon,
|
icon: self.category.icon,
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
categories: [],
|
categories: [],
|
||||||
hasSubCategories: false,
|
hasSubCategories: false,
|
||||||
categoryType: '',
|
categoryType: 0,
|
||||||
categoryId: '',
|
categoryId: '',
|
||||||
loading: true,
|
loading: true,
|
||||||
showHidden: false,
|
showHidden: false,
|
||||||
@@ -145,16 +145,16 @@ export default {
|
|||||||
const query = self.$f7route.query;
|
const query = self.$f7route.query;
|
||||||
const router = self.$f7router;
|
const router = self.$f7router;
|
||||||
|
|
||||||
if (query.type !== this.$constants.category.allCategoryTypes.Income &&
|
self.categoryType = parseInt(query.type);
|
||||||
query.type !== this.$constants.category.allCategoryTypes.Expense &&
|
|
||||||
query.type !== this.$constants.category.allCategoryTypes.Transfer) {
|
if (self.categoryType !== this.$constants.category.allCategoryTypes.Income &&
|
||||||
|
self.categoryType !== this.$constants.category.allCategoryTypes.Expense &&
|
||||||
|
self.categoryType !== this.$constants.category.allCategoryTypes.Transfer) {
|
||||||
self.$toast('Parameter Invalid');
|
self.$toast('Parameter Invalid');
|
||||||
router.back();
|
router.back();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.categoryType = query.type;
|
|
||||||
|
|
||||||
if (query.id && query.id !== '0') {
|
if (query.id && query.id !== '0') {
|
||||||
self.categoryId = query.id;
|
self.categoryId = query.id;
|
||||||
self.hasSubCategories = false;
|
self.hasSubCategories = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user