diff --git a/src/api/account.js b/src/api/account.js
index c972f62d..20bb1426 100644
--- a/src/api/account.js
+++ b/src/api/account.js
@@ -30,7 +30,9 @@ export function createAccount(data) {
'country': data.address.country,
'postCode': data.address.postCode,
'fuelRestrictions': data.restrictions.fuels,
- 'terminalRestrictions': data.restrictions.terminals
+ 'terminalRestrictions': data.restrictions.terminals,
+ 'paymentTermsRestrictions': data.restrictions.paymentTerms,
+ 'liftingPeriodRestrictions': data.restrictions.liftingPeriods
}
return axios.post(`${apiUrl}/account/create`, dto)
@@ -52,7 +54,9 @@ export function updateAccount(data) {
'country': data.address.country,
'postCode': data.address.postCode,
'fuelRestrictions': data.restrictions.fuels,
- 'terminalRestrictions': data.restrictions.terminals
+ 'terminalRestrictions': data.restrictions.terminals,
+ 'paymentTermsRestrictions': data.restrictions.paymentTerms,
+ 'liftingPeriodRestrictions': data.restrictions.liftingPeriods
}
return axios.put(`${apiUrl}/account/${data.id}`, dto)
diff --git a/src/views/accounts/components/AccountDetail.vue b/src/views/accounts/components/AccountDetail.vue
index dfbd0191..6e696a55 100644
--- a/src/views/accounts/components/AccountDetail.vue
+++ b/src/views/accounts/components/AccountDetail.vue
@@ -115,6 +115,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -140,6 +162,8 @@ import Sticky from '@/components/Sticky' // 粘性header组件
import { fetchAccount, updateAccount, createAccount } from '@/api/account'
const fetchFuelList = require('@/api/product').fetchList
const fetchTerminalList = require('@/api/terminal').fetchList
+const fetchLiftingPeriodsList = require('@/api/liftingPeriod').fetchList
+const fetchPaymentTermsList = require('@/api/paymentTerm').fetchList
const defaultForm = {
id: '',
@@ -149,7 +173,9 @@ const defaultForm = {
orderConfirmationEmail: '',
restrictions: {
fuels: [],
- terminals: []
+ terminals: [],
+ liftingPeriods: [],
+ paymentTerms: []
},
address: {
addressLine1: '',
@@ -194,6 +220,8 @@ export default {
tempRoute: {},
terminals: [],
fuels: [],
+ paymentTerms: [],
+ liftingPeriods: [],
fuelRestrictions: []
}
},
@@ -235,6 +263,32 @@ export default {
set(value) {
this.postForm.restrictions.terminals = value
}
+ },
+ liftingPeriodsAvailable: {
+ get() {
+ return this.liftingPeriods.map(f => {
+ return {
+ label: f.name,
+ key: f._id
+ }
+ })
+ },
+ set(value) {
+ this.postForm.restrictions.liftingPeriods = value
+ }
+ },
+ paymentTermsAvailable: {
+ get() {
+ return this.paymentTerms.map(f => {
+ return {
+ label: f.name,
+ key: f._id
+ }
+ })
+ },
+ set(value) {
+ this.postForm.restrictions.paymentTerms = value
+ }
}
},
created() {
@@ -246,10 +300,18 @@ export default {
}
// Fetch the fuels and terminals, to be used as part of the restriction process
- const requestPromises = [fetchFuelList({ platform: 'OLFDE' }), fetchTerminalList({ platform: 'OLFDE' })]
+ const requestPromises = [
+ fetchFuelList({ platform: 'OLFDE' }),
+ fetchTerminalList({ platform: 'OLFDE' }),
+ fetchLiftingPeriodsList({ platform: 'OLFDE' }),
+ fetchPaymentTermsList({ platform: 'OLFDE' })
+ ]
+
Promise.all(requestPromises).then((responses) => {
this.fuels = responses[0].data.fuels
this.terminals = responses[1].data.terminals
+ this.liftingPeriods = responses[2].data.liftingPeriods
+ this.paymentTerms = responses[3].data.paymentTerms
})
// Why need to make a copy of this.$route here?
@@ -264,17 +326,28 @@ export default {
if (!account.restrictions) {
account.restrictions = {
fuels: [],
- terminals: []
+ terminals: [],
+ paymentTerms: [],
+ liftingPeriods: []
}
}
if (account.restrictions.fuels.length === 0) {
account.restrictions.fuels = this.fuels.map(f => f._id)
}
+
if (account.restrictions.terminals.length === 0) {
account.restrictions.terminals = this.terminals.map(f => f._id)
}
+ if (account.restrictions.paymentTerms != null && account.restrictions.paymentTerms.length === 0) {
+ account.restrictions.paymentTerms = this.paymentTerms.map(f => f._id)
+ }
+
+ if (account.restrictions.liftingPeriods != null && account.restrictions.liftingPeriods.length === 0) {
+ account.restrictions.liftingPeriods = this.liftingPeriods.map(f => f._id)
+ }
+
this.postForm = account
// // set tagsview title
@@ -303,15 +376,6 @@ export default {
// Make a clone of the object
const accountToSave = Object.assign({}, this.postForm)
- // If we have selected *all* the fuels/terminals available, then send an empty array back. As this means we want *everything*
- if (accountToSave.restrictions.fuels.length === this.fuels.length) {
- accountToSave.restrictions.fuels = []
- }
-
- if (accountToSave.restrictions.terminals.length === this.terminals.length) {
- accountToSave.restrictions.terminals = []
- }
-
// Save the account
const methodToCall = this.isEdit ? updateAccount : createAccount
methodToCall(accountToSave).then((r) => {
diff --git a/src/views/accounts/relationships.vue b/src/views/accounts/relationships.vue
index 9eb95497..d7b55ea6 100644
--- a/src/views/accounts/relationships.vue
+++ b/src/views/accounts/relationships.vue
@@ -15,7 +15,7 @@
B: Enabled
- S: Enabled
+ S: Enabled
S: Disabled