Skip to content

Commit

Permalink
refactor: update Subscription Period sort
Browse files Browse the repository at this point in the history
  • Loading branch information
cn-xufei committed Dec 20, 2023
1 parent 41cef46 commit b88b170
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 9 deletions.
13 changes: 10 additions & 3 deletions apps/dfs/src/components/guide/Spec.vue
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,16 @@ export default {
.sort((a, b) => {
const aType = a.type === 'recurring' ? 1 : 2
const bType = b.type === 'recurring' ? 1 : 2
const aOrder = a.order
const bOrder = b.order
return aType + aOrder - (bType + bOrder)
const aOrder = a.periodUnit === 'month' ? 1 : 2
const bOrder = b.periodUnit === 'month' ? 1 : 2
if (aType < bType) {
return -1
} else if (aType > bType) {
return 1
} else {
return aOrder - bOrder
}
})
//不显示订购一年
if (specification?.chargeProvider !== 'FreeTier') {
Expand Down
13 changes: 10 additions & 3 deletions apps/dfs/src/views/order/Change.vue
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,16 @@ export default {
.sort((a, b) => {
const aType = a.type === 'recurring' ? 1 : 2
const bType = b.type === 'recurring' ? 1 : 2
const aOrder = a.order
const bOrder = b.order
return aType + aOrder - (bType + bOrder)
const aOrder = a.periodUnit === 'month' ? 1 : 2
const bOrder = b.periodUnit === 'month' ? 1 : 2
if (aType < bType) {
return -1
} else if (aType > bType) {
return 1
} else {
return aOrder - bOrder
}
})
},
//切换规格
Expand Down
13 changes: 10 additions & 3 deletions packages/business/src/views/order/Change.vue
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,16 @@ export default {
.sort((a, b) => {
const aType = a.type === 'recurring' ? 1 : 2
const bType = b.type === 'recurring' ? 1 : 2
const aOrder = a.order
const bOrder = b.order
return aType + aOrder - (bType + bOrder)
const aOrder = a.periodUnit === 'month' ? 1 : 2
const bOrder = b.periodUnit === 'month' ? 1 : 2
if (aType < bType) {
return -1
} else if (aType > bType) {
return 1
} else {
return aOrder - bOrder
}
})
},
//切换规格
Expand Down

0 comments on commit b88b170

Please sign in to comment.