add-address-dialog.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. exports.ids = [1];
  2. exports.modules = {
  3. /***/ 166:
  4. /***/ (function(module, exports) {
  5. // Exports
  6. module.exports = {
  7. };
  8. /***/ }),
  9. /***/ 182:
  10. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  11. "use strict";
  12. // ESM COMPAT FLAG
  13. __webpack_require__.r(__webpack_exports__);
  14. // CONCATENATED MODULE: ./node_modules/babel-loader/lib??ref--2-0!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/@nuxt/components/dist/loader.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./components/addAddressDialog.vue?vue&type=template&id=443741dd&scoped=true
  15. var render = function render() {
  16. var _vm = this,
  17. _c = _vm._self._c;
  18. return _c('div', [_c('el-dialog', {
  19. attrs: {
  20. "lock-scroll": false,
  21. "title": "Add address",
  22. "visible": _vm.dialogFormVisible,
  23. "width": "700px"
  24. },
  25. on: {
  26. "update:visible": function ($event) {
  27. _vm.dialogFormVisible = $event;
  28. }
  29. }
  30. }, [_c('el-form', {
  31. ref: "ruleForm",
  32. attrs: {
  33. "model": _vm.data,
  34. "rules": _vm.rules
  35. }
  36. }, [_c('el-form-item', {
  37. attrs: {
  38. "prop": "country"
  39. }
  40. }, [_c('label', [_vm._v("Country/Region")]), _vm._v(" "), _c('el-input', {
  41. model: {
  42. value: _vm.data.country,
  43. callback: function ($$v) {
  44. _vm.$set(_vm.data, "country", $$v);
  45. },
  46. expression: "data.country"
  47. }
  48. })], 1), _vm._v(" "), _c('el-form-item', {
  49. attrs: {
  50. "prop": "name"
  51. }
  52. }, [_c('label', [_vm._v("Full name")]), _vm._v(" "), _c('el-input', {
  53. model: {
  54. value: _vm.data.name,
  55. callback: function ($$v) {
  56. _vm.$set(_vm.data, "name", $$v);
  57. },
  58. expression: "data.name"
  59. }
  60. })], 1), _vm._v(" "), _c('el-form-item', {
  61. attrs: {
  62. "prop": "phone"
  63. }
  64. }, [_c('label', [_vm._v("Phone number")]), _vm._v(" "), _c('el-input', {
  65. model: {
  66. value: _vm.data.phone,
  67. callback: function ($$v) {
  68. _vm.$set(_vm.data, "phone", $$v);
  69. },
  70. expression: "data.phone"
  71. }
  72. })], 1), _vm._v(" "), _c('el-form-item', {
  73. attrs: {
  74. "prop": "address"
  75. }
  76. }, [_c('label', [_vm._v("Address")]), _vm._v(" "), _c('el-input', {
  77. attrs: {
  78. "placeholder": "Street address,P.O.box,company name,c/o"
  79. },
  80. model: {
  81. value: _vm.data.address,
  82. callback: function ($$v) {
  83. _vm.$set(_vm.data, "address", $$v);
  84. },
  85. expression: "data.address"
  86. }
  87. })], 1), _vm._v(" "), _c('el-form-item', {
  88. attrs: {
  89. "prop": "post_code"
  90. }
  91. }, [_c('label', [_vm._v("Postcode")]), _vm._v(" "), _c('el-input', {
  92. model: {
  93. value: _vm.data.post_code,
  94. callback: function ($$v) {
  95. _vm.$set(_vm.data, "post_code", $$v);
  96. },
  97. expression: "data.post_code"
  98. }
  99. })], 1), _vm._v(" "), _c('el-form-item', {
  100. attrs: {
  101. "prop": "city"
  102. }
  103. }, [_c('label', [_vm._v("City/Suburb")]), _vm._v(" "), _c('el-input', {
  104. attrs: {
  105. "placeholder": "Choose city by suburb"
  106. },
  107. model: {
  108. value: _vm.data.city,
  109. callback: function ($$v) {
  110. _vm.$set(_vm.data, "city", $$v);
  111. },
  112. expression: "data.city"
  113. }
  114. })], 1), _vm._v(" "), _c('el-form-item', {
  115. attrs: {
  116. "prop": "state"
  117. }
  118. }, [_c('label', [_vm._v("State/Territory")]), _vm._v(" "), _c('el-input', {
  119. attrs: {
  120. "placeholder": "Choose state by territory"
  121. },
  122. model: {
  123. value: _vm.data.state,
  124. callback: function ($$v) {
  125. _vm.$set(_vm.data, "state", $$v);
  126. },
  127. expression: "data.state"
  128. }
  129. })], 1), _vm._v(" "), _c('el-form-item', {
  130. attrs: {
  131. "prop": "is_default"
  132. }
  133. }, [_c('el-checkbox', {
  134. model: {
  135. value: _vm.data.is_default,
  136. callback: function ($$v) {
  137. _vm.$set(_vm.data, "is_default", $$v);
  138. },
  139. expression: "data.is_default"
  140. }
  141. }, [_vm._v("\n Make this my default address\n ")])], 1), _vm._v(" "), _c('el-form-item', [_c('label', [_vm._v("Delivery instruction(optional)")]), _vm._v(" "), _c('div', {
  142. staticStyle: {
  143. "color": "#86d4e9",
  144. "line-height": "14px"
  145. }
  146. }, [_c('i', {
  147. staticClass: "el-icon-arrow-down",
  148. staticStyle: {
  149. "color": "#a2a2a2"
  150. }
  151. }), _vm._v("\n And preferences,notes,access codes and more\n ")])])], 1), _vm._v(" "), _c('div', {
  152. staticClass: "dialog-footer",
  153. attrs: {
  154. "slot": "footer"
  155. },
  156. slot: "footer"
  157. }, [_c('el-button', {
  158. on: {
  159. "click": function ($event) {
  160. return _vm.submit('ruleForm');
  161. }
  162. }
  163. }, [_vm._v("Add address")])], 1)], 1)], 1);
  164. };
  165. var staticRenderFns = [];
  166. // CONCATENATED MODULE: ./components/addAddressDialog.vue?vue&type=template&id=443741dd&scoped=true
  167. // CONCATENATED MODULE: ./node_modules/babel-loader/lib??ref--2-0!./node_modules/@nuxt/components/dist/loader.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./components/addAddressDialog.vue?vue&type=script&lang=js
  168. /* harmony default export */ var addAddressDialogvue_type_script_lang_js = ({
  169. props: {
  170. dialogVisible: {
  171. type: Boolean,
  172. default: false
  173. },
  174. componentVisible: {
  175. type: Number,
  176. default: 2
  177. },
  178. data: {
  179. type: Object,
  180. default: () => {
  181. return {
  182. country: "Australia",
  183. name: "",
  184. phone: "",
  185. address: "",
  186. post_code: "",
  187. city: "",
  188. state: "",
  189. is_default: null
  190. };
  191. }
  192. }
  193. },
  194. data() {
  195. return {
  196. value: [],
  197. options: [],
  198. rules: {
  199. country: [{
  200. required: true,
  201. message: "Please enter your country",
  202. trigger: "blur"
  203. }],
  204. name: [{
  205. required: true,
  206. message: "Please enter your name",
  207. trigger: "blur"
  208. }],
  209. phone: [{
  210. required: true,
  211. message: "Please enter your phone number",
  212. trigger: "blur"
  213. }],
  214. address: [{
  215. required: true,
  216. message: "Please enter your address",
  217. trigger: "blur"
  218. }],
  219. post_code: [{
  220. required: true,
  221. message: "Please enter post_code",
  222. trigger: "blur"
  223. }],
  224. city: [{
  225. required: true,
  226. message: "Please enter city",
  227. trigger: "blur"
  228. }],
  229. state: [{
  230. required: true,
  231. message: "Please enter state",
  232. trigger: "blur"
  233. }]
  234. },
  235. cityList: [{
  236. id: 1,
  237. name: "Sydney"
  238. }, {
  239. id: 2,
  240. name: "Adelaide Mail Centre"
  241. }, {
  242. id: 3,
  243. name: "Melbourne"
  244. }, {
  245. id: 4,
  246. name: "Eastern Suburbs Mc"
  247. }, {
  248. id: 5,
  249. name: "Hobart"
  250. }, {
  251. id: 6,
  252. name: "Perth"
  253. }, {
  254. id: 7,
  255. name: "Launceston"
  256. }, {
  257. id: 8,
  258. name: "Brisbane"
  259. }, {
  260. id: 9,
  261. name: "Northern Suburbs Mc"
  262. }, {
  263. id: 10,
  264. name: "Strawberry Hills"
  265. }, {
  266. id: 11,
  267. name: "Springfield"
  268. }, {
  269. id: 12,
  270. name: "Waterloo"
  271. }, {
  272. id: 13,
  273. name: "Richmond"
  274. }, {
  275. id: 14,
  276. name: "Haymarket"
  277. }, {
  278. id: 15,
  279. name: "Red Hill"
  280. }, {
  281. id: 16,
  282. name: "Brisbane GPO Boxes"
  283. }, {
  284. id: 17,
  285. name: "Mayfield"
  286. }, {
  287. id: 18,
  288. name: "Australia Square"
  289. }, {
  290. id: 19,
  291. name: "Woodstock"
  292. }, {
  293. id: 20,
  294. name: "Sydney South"
  295. }, {
  296. id: 21,
  297. name: "The Gap"
  298. }, {
  299. id: 22,
  300. name: "Kingston"
  301. }, {
  302. id: 23,
  303. name: "Kensington"
  304. }, {
  305. id: 24,
  306. name: "Darlington"
  307. }],
  308. stateList: [{
  309. id: 1,
  310. name: "Australian Capital Territory"
  311. }, {
  312. id: 2,
  313. name: "New South Wales"
  314. }, {
  315. id: 3,
  316. name: "Northern Territory"
  317. }, {
  318. id: 4,
  319. name: "Queensland"
  320. }, {
  321. id: 5,
  322. name: "South Australia"
  323. }, {
  324. id: 6,
  325. name: "Tasmania"
  326. }, {
  327. id: 7,
  328. name: "Victoria"
  329. }, {
  330. id: 8,
  331. name: "Western Australia"
  332. }]
  333. };
  334. },
  335. computed: {
  336. dialogFormVisible: {
  337. get: function () {
  338. return this.dialogVisible;
  339. },
  340. set: function (val) {
  341. this.$emit("update:dialogVisible", val);
  342. }
  343. }
  344. },
  345. methods: {
  346. submit(ruleForm) {
  347. this.$refs[ruleForm].validate(valid => {
  348. if (valid) {
  349. if (this.componentVisible == 2) {
  350. this.addAddress();
  351. if (this.$route.fullPath.includes('product-builder')) return;
  352. this.$router.push({
  353. path: '/home/myDetail',
  354. query: {
  355. type: "third"
  356. }
  357. });
  358. } else if (this.componentVisible == 3) {
  359. this.editAddress();
  360. this.$router.push({
  361. path: '/home/myDetail',
  362. query: {
  363. type: "third"
  364. }
  365. });
  366. }
  367. } else {
  368. console.log("error submit!!");
  369. return false;
  370. }
  371. });
  372. },
  373. addAddress() {
  374. this.$axios.post("/address/add", this.data).then(res => {
  375. if (res.code === 1) {
  376. this.$notify({
  377. title: "success",
  378. message: "Submitted successfully",
  379. type: "success",
  380. duration: 3000
  381. });
  382. this.dialogFormVisible = false;
  383. this.update();
  384. }
  385. }).catch(error => {
  386. this.$message.error(error.response.data.msg);
  387. });
  388. },
  389. editAddress() {
  390. this.$axios.post("/address/edit", this.data).then(res => {
  391. if (res.code === 1) {
  392. this.$notify({
  393. title: "success",
  394. message: "Submitted successfully",
  395. type: "success",
  396. duration: 3000
  397. });
  398. this.dialogFormVisible = false;
  399. this.update();
  400. }
  401. }).catch(error => {
  402. this.$message.error(error.response.data.msg);
  403. });
  404. },
  405. update() {
  406. this.$emit("update", true);
  407. }
  408. }
  409. });
  410. // CONCATENATED MODULE: ./components/addAddressDialog.vue?vue&type=script&lang=js
  411. /* harmony default export */ var components_addAddressDialogvue_type_script_lang_js = (addAddressDialogvue_type_script_lang_js);
  412. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  413. var componentNormalizer = __webpack_require__(2);
  414. // CONCATENATED MODULE: ./components/addAddressDialog.vue
  415. function injectStyles (context) {
  416. var style0 = __webpack_require__(194)
  417. if (style0.__inject__) style0.__inject__(context)
  418. }
  419. /* normalize component */
  420. var component = Object(componentNormalizer["a" /* default */])(
  421. components_addAddressDialogvue_type_script_lang_js,
  422. render,
  423. staticRenderFns,
  424. false,
  425. injectStyles,
  426. "443741dd",
  427. "72c5b0ae"
  428. )
  429. /* harmony default export */ var addAddressDialog = __webpack_exports__["default"] = (component.exports);
  430. /***/ }),
  431. /***/ 194:
  432. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  433. "use strict";
  434. __webpack_require__.r(__webpack_exports__);
  435. /* harmony import */ var _node_modules_css_loader_dist_cjs_js_ref_7_oneOf_1_0_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_dist_cjs_js_ref_7_oneOf_1_1_node_modules_sass_loader_dist_cjs_js_ref_7_oneOf_1_2_node_modules_nuxt_components_dist_loader_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_addAddressDialog_vue_vue_type_style_index_0_id_443741dd_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(166);
  436. /* harmony import */ var _node_modules_css_loader_dist_cjs_js_ref_7_oneOf_1_0_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_dist_cjs_js_ref_7_oneOf_1_1_node_modules_sass_loader_dist_cjs_js_ref_7_oneOf_1_2_node_modules_nuxt_components_dist_loader_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_addAddressDialog_vue_vue_type_style_index_0_id_443741dd_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_cjs_js_ref_7_oneOf_1_0_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_dist_cjs_js_ref_7_oneOf_1_1_node_modules_sass_loader_dist_cjs_js_ref_7_oneOf_1_2_node_modules_nuxt_components_dist_loader_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_addAddressDialog_vue_vue_type_style_index_0_id_443741dd_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0__);
  437. /* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _node_modules_css_loader_dist_cjs_js_ref_7_oneOf_1_0_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_dist_cjs_js_ref_7_oneOf_1_1_node_modules_sass_loader_dist_cjs_js_ref_7_oneOf_1_2_node_modules_nuxt_components_dist_loader_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_addAddressDialog_vue_vue_type_style_index_0_id_443741dd_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0__) if(["default"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _node_modules_css_loader_dist_cjs_js_ref_7_oneOf_1_0_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_dist_cjs_js_ref_7_oneOf_1_1_node_modules_sass_loader_dist_cjs_js_ref_7_oneOf_1_2_node_modules_nuxt_components_dist_loader_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_addAddressDialog_vue_vue_type_style_index_0_id_443741dd_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__));
  438. /***/ })
  439. };;
  440. //# sourceMappingURL=add-address-dialog.js.map