浏览代码

Fixes on the ToSell Page

master
George Williams 4 年前
父节点
当前提交
bc0a0692b9

+ 658
- 339
src/components/timeshare/sell/contentSection.vue
文件差异内容过多而无法显示
查看文件


+ 34
- 31
src/store/index.js 查看文件

1
-import Vue from 'vue';
2
-import Vuex from 'vuex';
1
+import Vue from "vue";
2
+import Vuex from "vuex";
3
 
3
 
4
-import TimeshareModule from './modules/timeshare/timeshare';
5
-import UsersModule from './modules/users';
6
-import StatusModule from './modules/timeshare/status';
7
-import UnitConfigurationModule from './modules/timeshare/unitConfiguration';
8
-import RegionModule from './modules/timeshare/region';
9
-import SearchTabModule from './modules/searchTab';
10
-import ResortModule from './modules/timeshare/resort';
11
-import PropertyModule from './modules/property/property';
12
-import WeekModule from './modules/timeshare/week';
13
-import PropertyAdminModule from './modules/property/propertyAdmin';
14
-import PropertyList from './modules/property/propertyLists';
15
-import PropertyTypes from './modules/property/propertyTypes';
16
-import Register from './modules/user/register';
17
-import WeekList from './modules/timeshare/weekList';
18
-import MyWeeks from './modules/timeshare/myWeeks';
19
-import Bid from './modules/processFlow/bid';
20
-import Authentication from './modules/user/authentication';
21
-import PropertySearch from './modules/property/propertySearch';
22
-import SearchLog from './modules/logs/searchLog';
23
-import Template from './modules/communication/template';
24
-import Info from './modules/communication/info';
25
-import PropertyEdit from './modules/property/propertyEdit';
26
-import Carousel from './modules/misc/carousel';
27
-import Individual from './modules/user/individual';
28
-import Alert from './modules/misc/alert';
29
-import TenderWeek from './modules/timeshare/tenderWeeks';
30
-import PaymentModule from './modules/financial/payment';
4
+import TimeshareModule from "./modules/timeshare/timeshare";
5
+import UsersModule from "./modules/users";
6
+import StatusModule from "./modules/timeshare/status";
7
+import UnitConfigurationModule from "./modules/timeshare/unitConfiguration";
8
+import RegionModule from "./modules/timeshare/region";
9
+import SearchTabModule from "./modules/searchTab";
10
+import ResortModule from "./modules/timeshare/resort";
11
+import PropertyModule from "./modules/property/property";
12
+import WeekModule from "./modules/timeshare/week";
13
+import PropertyAdminModule from "./modules/property/propertyAdmin";
14
+import PropertyList from "./modules/property/propertyLists";
15
+import PropertyTypes from "./modules/property/propertyTypes";
16
+import Register from "./modules/user/register";
17
+import WeekList from "./modules/timeshare/weekList";
18
+import MyWeeks from "./modules/timeshare/myWeeks";
19
+import Bid from "./modules/processFlow/bid";
20
+import Authentication from "./modules/user/authentication";
21
+import PropertySearch from "./modules/property/propertySearch";
22
+import SearchLog from "./modules/logs/searchLog";
23
+import Template from "./modules/communication/template";
24
+import Info from "./modules/communication/info";
25
+import PropertyEdit from "./modules/property/propertyEdit";
26
+import Carousel from "./modules/misc/carousel";
27
+import Individual from "./modules/user/individual";
28
+import Alert from "./modules/misc/alert";
29
+import TenderWeek from "./modules/timeshare/tenderWeeks";
30
+import PaymentModule from "./modules/financial/payment";
31
 import CampaignModule from "./modules/marketing/campaigns";
31
 import CampaignModule from "./modules/marketing/campaigns";
32
 import CampaignItemModule from "./modules/marketing/campaignItems";
32
 import CampaignItemModule from "./modules/marketing/campaignItems";
33
 import PlaceHolderFormat from "./modules/misc/placeHolderFormat";
33
 import PlaceHolderFormat from "./modules/misc/placeHolderFormat";
34
+import Bank from "./modules/user/bank";
35
+import bank from "./modules/user/bank";
34
 
36
 
35
 Vue.use(Vuex);
37
 Vue.use(Vuex);
36
 /* eslint no-param-reassign: ["error", { "props": false }] */
38
 /* eslint no-param-reassign: ["error", { "props": false }] */
65
     payment: PaymentModule,
67
     payment: PaymentModule,
66
     campaign: CampaignModule,
68
     campaign: CampaignModule,
67
     campaignItem: CampaignItemModule,
69
     campaignItem: CampaignItemModule,
68
-    placeHolderFormat: PlaceHolderFormat
69
-  },
70
+    placeHolderFormat: PlaceHolderFormat,
71
+    bank: bank
72
+  }
70
 });
73
 });

+ 77
- 82
src/store/modules/timeshare/timeshare.js 查看文件

1
 /* eslint-disable guard-for-in */
1
 /* eslint-disable guard-for-in */
2
 /* eslint-disable no-restricted-syntax */
2
 /* eslint-disable no-restricted-syntax */
3
-import axios from 'axios';
4
-import _ from 'lodash';
5
-import MyData from '../../../assets/myData';
6
-import MaritalStatus from '../../../assets/staticData/maritalStatus';
3
+import axios from "axios";
4
+import _ from "lodash";
5
+import MyData from "../../../assets/myData";
6
+import MaritalStatus from "../../../assets/staticData/maritalStatus";
7
 
7
 
8
 export default {
8
 export default {
9
   namespaced: true,
9
   namespaced: true,
50
       status: undefined,
50
       status: undefined,
51
       owner: {
51
       owner: {
52
         address: {},
52
         address: {},
53
-        bankingDetails: {},
54
-      },
55
-    },
53
+        bankingDetails: {}
54
+      }
55
+    }
56
   },
56
   },
57
   mutations: {
57
   mutations: {
58
     setUnitConfigurationList(state, list) {
58
     setUnitConfigurationList(state, list) {
97
       state.sellItem.resortName = resort.resortName;
97
       state.sellItem.resortName = resort.resortName;
98
     },
98
     },
99
     displayResult(state) {
99
     displayResult(state) {
100
-      state.result = 'Week has been added ^-^';
100
+      state.result = "Week has been added ^-^";
101
     },
101
     },
102
     setWeekDetail(state, week) {
102
     setWeekDetail(state, week) {
103
       state.sellItem = week;
103
       state.sellItem = week;
104
-    },
104
+    }
105
   },
105
   },
106
   getters: {
106
   getters: {
107
     getRegionCode(state) {
107
     getRegionCode(state) {
108
-      return (value) => {
109
-        const reg = state.detailedRegion.find(region => region.children.some(resort => resort
110
-          .resortCode === value));
108
+      return value => {
109
+        const reg = state.detailedRegion.find(region =>
110
+          region.children.some(resort => resort.resortCode === value)
111
+        );
111
         if (reg && reg.region) {
112
         if (reg && reg.region) {
112
           return reg.region.regionCode;
113
           return reg.region.regionCode;
113
         }
114
         }
114
-        return '';
115
+        return "";
115
       };
116
       };
116
     },
117
     },
117
     getResortName(state) {
118
     getResortName(state) {
118
-      return (value) => {
119
+      return value => {
119
         const res = state.resorts.find(resort => resort.resortCode === value);
120
         const res = state.resorts.find(resort => resort.resortCode === value);
120
         if (res) {
121
         if (res) {
121
           return res.resortName;
122
           return res.resortName;
122
         }
123
         }
123
       };
124
       };
124
-    },
125
+    }
125
   },
126
   },
126
   actions: {
127
   actions: {
127
-    initTimeshare({
128
-      commit,
129
-      dispatch,
130
-    }, timeshareId) {
131
-      commit('setResortBedrooms', MyData.resortBedrooms);
132
-      commit('setMaxSleep', MyData.maxBedrooms);
133
-      commit('setBankedEntities', MyData.bankedEntities);
134
-      dispatch('getSeasons');
135
-      dispatch('getAgents');
136
-      dispatch('getAgencies');
137
-      dispatch('getResorts');
138
-      dispatch('getRegions');
128
+    initTimeshare({ commit, dispatch }, timeshareId) {
129
+      commit("setResortBedrooms", MyData.resortBedrooms);
130
+      commit("setMaxSleep", MyData.maxBedrooms);
131
+      commit("setBankedEntities", MyData.bankedEntities);
132
+      dispatch("getSeasons");
133
+      dispatch("getAgents");
134
+      dispatch("getAgencies");
135
+      dispatch("getResorts");
136
+      dispatch("getRegions");
139
       if (timeshareId && timeshareId !== 0) {
137
       if (timeshareId && timeshareId !== 0) {
140
-        dispatch('getWeekDetail', timeshareId);
138
+        dispatch("getWeekDetail", timeshareId);
141
       }
139
       }
142
     },
140
     },
143
-    getWeekDetail({
144
-      commit,
145
-    }, timeshareId) {
141
+    getWeekDetail({ commit }, timeshareId) {
146
       axios
142
       axios
147
         .get(`api/timeshareweek/${timeshareId}`)
143
         .get(`api/timeshareweek/${timeshareId}`)
148
-        .then((result) => {
144
+        .then(result => {
149
           console.log(result.data);
145
           console.log(result.data);
150
-          commit('setWeekDetail', result.data);
146
+          commit("setWeekDetail", result.data);
151
         })
147
         })
152
         .catch(console.error);
148
         .catch(console.error);
153
     },
149
     },
154
-    getSeasons({
155
-      commit,
156
-    }) {
150
+    getSeasons({ commit }) {
157
       axios
151
       axios
158
-        .get('/api/season')
159
-        .then(result => commit('setSeason', result.data))
152
+        .get("/api/season")
153
+        .then(result => commit("setSeason", result.data))
160
         .catch(console.error);
154
         .catch(console.error);
161
     },
155
     },
162
-    getAgencies({
163
-      commit,
164
-    }) {
156
+    getAgencies({ commit }) {
165
       axios
157
       axios
166
-        .get('/api/agency')
167
-        .then(result => commit('setAgency', result.data))
158
+        .get("/api/agency")
159
+        .then(result => commit("setAgency", result.data))
168
         .catch(console.error);
160
         .catch(console.error);
169
     },
161
     },
170
-    getAgents({
171
-      commit,
172
-    }) {
162
+    getAgents({ commit }) {
173
       axios
163
       axios
174
-        .get('/api/agent')
175
-        .then(result => commit('setAgent', result.data))
164
+        .get("/api/agent")
165
+        .then(result => commit("setAgent", result.data))
176
         .catch(console.error);
166
         .catch(console.error);
177
     },
167
     },
178
-    getResorts({
179
-      commit,
180
-    }) {
168
+    getResorts({ commit }) {
181
       axios
169
       axios
182
-        .get('https://www.tradeunipoint.com/unibackend/seam/resource/rest/products/resorts/list/')
183
-        .then(result => commit('addResort', result.data))
170
+        .get("https://www.tradeunipoint.com/unibackend/seam/resource/rest/products/resorts/list/")
171
+        .then(result => commit("addResort", result.data))
184
         .catch(console.error);
172
         .catch(console.error);
185
     },
173
     },
186
-    getRegions({
187
-      dispatch,
188
-      commit,
189
-    }) {
174
+    getRegions({ dispatch, commit }) {
190
       axios
175
       axios
191
-        .get('https://www.tradeunipoint.com/unibackend/seam/resource/rest/products/regions/list/ZA')
192
-        .then((result) => {
193
-          commit('addRegion', result.data);
194
-          dispatch('getDetailedRegion', result.data);
176
+        .get("https://www.tradeunipoint.com/unibackend/seam/resource/rest/products/regions/list/ZA")
177
+        .then(result => {
178
+          commit("addRegion", result.data);
179
+          dispatch("getDetailedRegion", result.data);
195
         })
180
         })
196
         .catch(console.error);
181
         .catch(console.error);
197
     },
182
     },
198
-    getDetailedRegion({
199
-      commit,
200
-    }, data) {
183
+    getDetailedRegion({ commit }, data) {
201
       if (data) {
184
       if (data) {
202
         for (const r in Object.keys(data)) {
185
         for (const r in Object.keys(data)) {
203
           const region = data[r];
186
           const region = data[r];
204
           if (region !== undefined) {
187
           if (region !== undefined) {
205
             axios
188
             axios
206
               .get(
189
               .get(
207
-                `https://www.tradeunipoint.com/unibackend/seam/resource/rest/products/resorts/${
208
-                  region.regionCode
209
-                }/`,
190
+                `https://www.tradeunipoint.com/unibackend/seam/resource/rest/products/resorts/${region.regionCode}/`
191
+              )
192
+              .then(result =>
193
+                commit("addDetailedRegion", {
194
+                  region,
195
+                  children: result.data
196
+                })
210
               )
197
               )
211
-              .then(result => commit('addDetailedRegion', {
212
-                region,
213
-                children: result.data,
214
-              }))
215
               .catch(console.error);
198
               .catch(console.error);
216
           }
199
           }
217
         }
200
         }
218
       }
201
       }
219
     },
202
     },
220
-    onResortChange({
221
-      commit,
222
-    }, resort) {
223
-      commit('changeResort', resort);
203
+    onResortChange({ commit }, resort) {
204
+      commit("changeResort", resort);
205
+    },
206
+    saveWeek({ commit }, week) {
207
+      return new Promise((resolve, reject) => {
208
+        axios
209
+          .post("/api/timeshareweek", week)
210
+          .then(result => {
211
+            commit("setWeekDetail", result.data);
212
+            resolve();
213
+          })
214
+          .catch(error => reject(new Error(error.message)));
215
+      });
216
+
217
+      // axios
218
+      //   .post('/api/timeshareweek', week)
219
+      //   .then(result => commit('displayResult'))
220
+      //   .catch(console.error);
224
     },
221
     },
225
-    saveWeek({
226
-      commit,
227
-    }, week) {
222
+    getBlankWeek({ commit }) {
228
       axios
223
       axios
229
-        .post('/api/timeshareweek', week)
230
-        .then(result => commit('displayResult'))
224
+        .get("/api/timeshareweek/gettemplate")
225
+        .then(result => commit("setWeekDetail", result.data))
231
         .catch(console.error);
226
         .catch(console.error);
232
-    },
233
-  },
227
+    }
228
+  }
234
 };
229
 };

+ 24
- 0
src/store/modules/user/bank.js 查看文件

1
+/* eslint-disable no-restricted-syntax */
2
+/* eslint-disable guard-for-in */
3
+import axios from "axios";
4
+
5
+export default {
6
+  namespaced: true,
7
+  state: {
8
+    banks: []
9
+  },
10
+  mutations: {
11
+    setBanks(state, items) {
12
+      state.banks = items;
13
+    }
14
+  },
15
+  getters: {},
16
+  actions: {
17
+    getBanks({ commit }) {
18
+      axios
19
+        .get("/api/banks")
20
+        .then(result => commit("setBanks", result.data))
21
+        .catch(error => alert(error.message));
22
+    }
23
+  }
24
+};

+ 22
- 17
src/store/modules/user/individual.js 查看文件

1
 /* eslint-disable no-restricted-syntax */
1
 /* eslint-disable no-restricted-syntax */
2
 /* eslint-disable guard-for-in */
2
 /* eslint-disable guard-for-in */
3
-import axios from 'axios';
3
+import axios from "axios";
4
 
4
 
5
 export default {
5
 export default {
6
   namespaced: true,
6
   namespaced: true,
7
   state: {
7
   state: {
8
     items: [],
8
     items: [],
9
-    indiv: undefined,
9
+    indiv: undefined
10
   },
10
   },
11
   mutations: {
11
   mutations: {
12
     addItem(state, item) {
12
     addItem(state, item) {
14
     },
14
     },
15
     setItem(state, item) {
15
     setItem(state, item) {
16
       state[item.name] = item.value;
16
       state[item.name] = item.value;
17
-    },
17
+    }
18
   },
18
   },
19
   getters: {},
19
   getters: {},
20
   actions: {
20
   actions: {
21
     getIndividual({ commit, rootGetters }, userId) {
21
     getIndividual({ commit, rootGetters }, userId) {
22
       let id = 0;
22
       let id = 0;
23
       if (!userId || userId === 0) {
23
       if (!userId || userId === 0) {
24
-        const rootItem = rootGetters['authentication/getUser'];
24
+        const rootItem = rootGetters["authentication/getUser"];
25
         id = rootItem ? rootItem.id : 0;
25
         id = rootItem ? rootItem.id : 0;
26
       } else id = userId;
26
       } else id = userId;
27
+
28
+      if (!id) {
29
+        id = 0;
30
+      }
31
+
27
       axios
32
       axios
28
         .get(`/api/individual/getIndividual/${id}`)
33
         .get(`/api/individual/getIndividual/${id}`)
29
-        .then((r) => {
34
+        .then(r => {
30
           console.log(JSON.stringify(r));
35
           console.log(JSON.stringify(r));
31
-          commit('setItem', {
32
-            name: 'indiv',
33
-            value: r.data,
36
+          commit("setItem", {
37
+            name: "indiv",
38
+            value: r.data
34
           });
39
           });
35
         })
40
         })
36
         .catch(console.error);
41
         .catch(console.error);
37
     },
42
     },
38
     getAllIndividuals({ commit }) {
43
     getAllIndividuals({ commit }) {
39
       axios
44
       axios
40
-        .get('/api/individual/getAllIndividuals')
41
-        .then((x) => {
42
-          commit('setItem', {
43
-            name: 'items',
44
-            value: x.data,
45
+        .get("/api/individual/getAllIndividuals")
46
+        .then(x => {
47
+          commit("setItem", {
48
+            name: "items",
49
+            value: x.data
45
           });
50
           });
46
         })
51
         })
47
         .catch(console.error);
52
         .catch(console.error);
48
     },
53
     },
49
     updateIndividual({ commit }, item) {
54
     updateIndividual({ commit }, item) {
50
       axios
55
       axios
51
-        .put('/api/individual', item)
52
-        .then(result => commit('setItem', item))
56
+        .put("/api/individual", item)
57
+        .then(result => commit("setItem", item))
53
         .catch(console.error);
58
         .catch(console.error);
54
-    },
55
-  },
59
+    }
60
+  }
56
 };
61
 };

正在加载...
取消
保存