table-new-price-table.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  1. exports.ids = [36];
  2. exports.modules = {
  3. /***/ 167:
  4. /***/ (function(module, exports) {
  5. // Exports
  6. module.exports = {
  7. };
  8. /***/ }),
  9. /***/ 188:
  10. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  11. "use strict";
  12. __webpack_require__.r(__webpack_exports__);
  13. /* 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_NewPriceTable_vue_vue_type_style_index_0_id_8da20436_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(167);
  14. /* 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_NewPriceTable_vue_vue_type_style_index_0_id_8da20436_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_NewPriceTable_vue_vue_type_style_index_0_id_8da20436_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0__);
  15. /* 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_NewPriceTable_vue_vue_type_style_index_0_id_8da20436_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_NewPriceTable_vue_vue_type_style_index_0_id_8da20436_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__));
  16. /***/ }),
  17. /***/ 199:
  18. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19. "use strict";
  20. // ESM COMPAT FLAG
  21. __webpack_require__.r(__webpack_exports__);
  22. // 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/table/NewPriceTable.vue?vue&type=template&id=8da20436&scoped=true
  23. var render = function render() {
  24. var _vm = this,
  25. _c = _vm._self._c;
  26. return _c('div', {
  27. staticClass: "wrap",
  28. style: {
  29. marginBottom: _vm.marginBottom + 'px'
  30. }
  31. }, [_vm._ssrNode((_vm.tableType != 'Addon' ? "<p class=\"tb-title\" data-v-8da20436>" + _vm._s(_vm.comTitle) + "</p>" : "<!---->") + " "), _vm._ssrNode("<div" + _vm._ssrClass(null, _vm.getTableContainerClass) + " data-v-8da20436>", "</div>", [_c('el-table', {
  32. ref: "elTable",
  33. staticStyle: {
  34. "width": "100%"
  35. },
  36. attrs: {
  37. "show-header": _vm.tableType != 'Addon',
  38. "data": _vm.comTableData,
  39. "header-cell-style": {
  40. backgroundColor: '#fff',
  41. fontWeight: 'normal',
  42. fontSize: '14px',
  43. fontFamily: 'Proxima Nova',
  44. color: '#000',
  45. '--comDisplayCss': _vm.comDisplayCss
  46. },
  47. "row-key": "id",
  48. "span-method": _vm.arraySpanMethod,
  49. "row-class-name": _vm.tableRowClassName
  50. },
  51. on: {
  52. "selection-change": _vm.handleSelectionChange,
  53. "select": _vm.dialogCheck
  54. }
  55. }, [_vm.tableType != 'Comparison' ? _c('el-table-column', {
  56. attrs: {
  57. "type": "selection",
  58. "width": "50",
  59. "align": "center",
  60. "reserve-selection": true,
  61. "selectable": _vm.handleSelectable
  62. }
  63. }) : _vm._e(), _vm._v(" "), _vm._l(_vm.tableColumns, function (item) {
  64. return [item.type ? _c('el-table-column', {
  65. key: item.prop,
  66. attrs: {
  67. "align": item.align ? item.align : 'left',
  68. "prop": item.prop,
  69. "label": item.label,
  70. "formatter": item.formatter,
  71. "width": item.width,
  72. "sortable": item.sortable
  73. },
  74. scopedSlots: _vm._u([{
  75. key: "default",
  76. fn: function ({
  77. row
  78. }) {
  79. return [item.type == 'radioInput' ? [_c('div', {
  80. staticClass: "flex between"
  81. }, [_c('span', [_vm._v(_vm._s(row.decName))]), _vm._v(" "), _c('el-input', {
  82. staticClass: "edit-input",
  83. attrs: {
  84. "min": "0",
  85. "max": row.max_num,
  86. "type": "number",
  87. "size": "small"
  88. },
  89. on: {
  90. "input": function ($event) {
  91. return _vm.getNumber($event, row, row.max_num);
  92. }
  93. },
  94. model: {
  95. value: row.num,
  96. callback: function ($$v) {
  97. _vm.$set(row, "num", $$v);
  98. },
  99. expression: "row.num"
  100. }
  101. })], 1)] : _c('div', [row.filter_boolean ? [_c('div', {
  102. staticClass: "triangle"
  103. }), _vm._v(" "), _c('div', {
  104. staticClass: "text"
  105. }, [_vm._v("Eco")])] : _vm._e(), _vm._v("\n " + _vm._s(row[item.prop]) + "\n "), _vm.tableType == 'Undecorated' ? _c('el-popover', {
  106. attrs: {
  107. "placement": "top-start",
  108. "trigger": "hover"
  109. }
  110. }, [_c('i', {
  111. staticClass: "el-icon-warning",
  112. attrs: {
  113. "slot": "reference"
  114. },
  115. slot: "reference"
  116. }), _vm._v(" "), _c('p', {
  117. staticClass: "popover-text"
  118. }, [_vm._v(_vm._s(_vm.comTitle))])]) : _vm._e()], 2)];
  119. }
  120. }], null, true)
  121. }) : _vm._e(), _vm._v(" "), !item.type ? _c('el-table-column', {
  122. key: item.prop,
  123. attrs: {
  124. "align": item.align ? item.align : 'center',
  125. "prop": item.prop,
  126. "label": item.label,
  127. "formatter": item.formatter,
  128. "sortable": item.sortable,
  129. "show-overflow-tooltip": "",
  130. "width": (798 - _vm.tableColumns[0].width - _vm.tableColumns[0].extraWidth) / (_vm.tableColumns.length - 1)
  131. },
  132. scopedSlots: _vm._u([{
  133. key: "default",
  134. fn: function ({
  135. row,
  136. $index
  137. }) {
  138. return [item.prop === 'website_setup' ? _c('div', [$index === 0 && _vm.tableType == 'Decoration' ? _c('div', [row['supplier_setup_id'] < 5 || row['supplier_setup_id'] == 7 ? _c('span', [_vm._v("£ " + _vm._s(row['supplier_setup'] ? parseFloat(row['supplier_setup']).toFixed(2) : "0.00"))]) : _vm._e(), _vm._v(" "), _c('span', [_vm._v(_vm._s(_vm.$_setupPriceFilter(row['supplier_setup_id'])))])]) : _c('div', [row['website_setup_id'] < 5 || row['website_setup_id'] == 7 ? _c('span', [_vm._v("£ " + _vm._s(row['website_setup'] ? parseFloat(row['website_setup']).toFixed(2) : "0.00"))]) : _vm._e(), _vm._v(" "), _c('span', [_vm._v(_vm._s(_vm.$_setupPriceFilter(row['website_setup_id'])))])])]) : _vm.judgeProp(row, item.prop, $index) == '111' || _vm.judgeProp(row, item.prop, $index) == '111.00' ? _c('div', [_vm._v("\n -\n ")]) : _vm.judgeProp(row, item.prop, $index) == '999' || _vm.judgeProp(row, item.prop, $index) === '999.00' ? _c('div', [_vm._v("\n POA\n ")]) : _vm.judgeProp(row, item.prop, $index) === '' ? _c('div', [_vm._v("0")]) : _c('div', [_vm.isNumber(_vm.judgeProp(row, item.prop, $index)) && !item.isFirstColumn ? _c('span', [_vm._v("£")]) : _vm._e(), _vm._v(" "), _c('span', [_vm._v(_vm._s(_vm.judgeProp(row, item.prop, $index)))])])];
  139. }
  140. }], null, true)
  141. }) : _vm._e()];
  142. })], 2)], 1)], 2);
  143. };
  144. var staticRenderFns = [];
  145. // CONCATENATED MODULE: ./components/table/NewPriceTable.vue?vue&type=template&id=8da20436&scoped=true
  146. // EXTERNAL MODULE: external "number-precision"
  147. var external_number_precision_ = __webpack_require__(122);
  148. // 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/table/NewPriceTable.vue?vue&type=script&lang=js
  149. /* harmony default export */ var NewPriceTablevue_type_script_lang_js = ({
  150. filters: {
  151. // Decoration Table:打印价格+附加价格
  152. multiplyPrice(a1, row, prop) {
  153. const rep = /^[0-9]+.?[0-9]*$/;
  154. if (!rep.test(a1)) {
  155. return a1;
  156. } else {
  157. return Object(external_number_precision_["times"])(a1, row.num);
  158. }
  159. },
  160. // Undecorated Table:基础价格+Decoration所选价格(包含附加价格)
  161. plusPrice(a1, a2) {
  162. return a2 ? Object(external_number_precision_["plus"])(a1, a2) : a1;
  163. },
  164. // Decoration Table:计算差价
  165. differencePrice(a1, row, prop, selectRow) {
  166. const rep = /^[0-9]+.?[0-9]*$/;
  167. if (rep.test(a1)) {
  168. const temp = prop.split('_');
  169. const supplier = +row[`supplier_${temp[1]}`];
  170. const suppliers = Object(external_number_precision_["times"])(row.num - 1, supplier);
  171. const noIncludePrice = Object(external_number_precision_["plus"])(a1, suppliers);
  172. const selSupplier = +selectRow[`supplier_${temp[1]}`];
  173. const selSuppliers = Object(external_number_precision_["times"])(selectRow.num - 1, selSupplier);
  174. const isIncludePrice = Object(external_number_precision_["plus"])(+selectRow[prop], selSuppliers);
  175. return noIncludePrice > isIncludePrice ? `+${Object(external_number_precision_["minus"])(noIncludePrice, isIncludePrice)}` : Object(external_number_precision_["minus"])(noIncludePrice, isIncludePrice);
  176. } else {
  177. return a1;
  178. }
  179. }
  180. },
  181. props: {
  182. hasDecAdd: {
  183. type: Number,
  184. default: 0
  185. },
  186. tableData: {
  187. type: Array,
  188. default: () => {
  189. return [];
  190. }
  191. },
  192. tableColumns: {
  193. type: Array,
  194. default: () => {
  195. return [];
  196. }
  197. },
  198. operateWith: {
  199. type: String,
  200. default: '100%'
  201. },
  202. isCheckBox: {
  203. type: Boolean,
  204. default: false
  205. },
  206. tableType: {
  207. type: String,
  208. default: 'Undecorated'
  209. },
  210. decorationObj: {
  211. type: Object,
  212. default: () => {
  213. return {};
  214. }
  215. },
  216. selectId: {
  217. type: Number,
  218. default: null
  219. },
  220. selectRow: {
  221. type: Object,
  222. default: () => {
  223. return {};
  224. }
  225. },
  226. multipleSelection: {
  227. type: Array,
  228. default: () => {
  229. return [];
  230. }
  231. },
  232. selectDecoration: {
  233. type: Object,
  234. default: () => {
  235. return {};
  236. }
  237. },
  238. curPrint: {
  239. type: String,
  240. default: ''
  241. },
  242. curModel: {
  243. type: String,
  244. default: ''
  245. },
  246. marginBottom: {
  247. type: Number,
  248. default: 20
  249. },
  250. decorationMultiple: {
  251. type: Number,
  252. default: 1
  253. },
  254. headerShow: {
  255. type: Boolean,
  256. default: true
  257. }
  258. },
  259. data() {
  260. return {
  261. setupConfigList: [{
  262. id: 1,
  263. name: '/col'
  264. }, {
  265. id: 2,
  266. name: '/desgin'
  267. }, {
  268. id: 3,
  269. name: '/pos'
  270. }, {
  271. id: 4,
  272. name: '/pos desgin'
  273. }, {
  274. id: 5,
  275. name: 'POA'
  276. }, {
  277. id: 6,
  278. name: 'Waived'
  279. }],
  280. setupTitleList: ['1st', '2nd', '3rd']
  281. };
  282. },
  283. computed: {
  284. getTableContainerClass() {
  285. // 根据tableType的值返回不同的class
  286. return {
  287. 'table-container': true,
  288. 'border-Decoration': this.tableType === 'Decoration' && this.hasDecAdd
  289. };
  290. },
  291. comTitle() {
  292. if (this.tableType === 'Undecorated') {
  293. return `Includes ${this.curModel}`;
  294. } else if (this.tableType === 'Decoration') {
  295. return `Add-Ons`;
  296. } else {
  297. return this.curPrint;
  298. }
  299. },
  300. comDisplayCss() {
  301. return this.tableType === 'Comparison' ? '1px solid #efefef' : 'none';
  302. },
  303. comMultipleSelID() {
  304. return this.multipleSelection.map(i => i.id);
  305. },
  306. comTableData() {
  307. if (this.tableType === 'Decoration') {
  308. return this.tableData;
  309. } else {
  310. return this.tableData;
  311. }
  312. }
  313. },
  314. mounted() {
  315. // 初始勾上默认选择打印项
  316. if (JSON.stringify(this.selectRow) !== '{}') {
  317. this.$refs.elTable.toggleRowSelection(this.selectRow);
  318. }
  319. },
  320. methods: {
  321. judgeProp(row, prop, $index) {
  322. if ($index === 0 && this.tableType === 'Decoration') {
  323. const temp = prop.split('_');
  324. return row[`supplier_${temp[1]}`];
  325. } else {
  326. return row[prop];
  327. }
  328. },
  329. $_setupPriceFilter(setupPriceID) {
  330. const result = this.setupConfigList.filter(item => item.id === setupPriceID);
  331. return result.length > 0 ? result[0].name : '';
  332. },
  333. isNumber(val) {
  334. const rep = /^[0-9]+.?[0-9]*$/;
  335. return rep.test(val);
  336. },
  337. /* 暂不实现此功能
  338. //点击table栏时选中按钮
  339. handleCurrentChange(currentRow, oldCurrentRow) {
  340. this.$refs.elTable.clearSelection()
  341. this.$emit('update:selectId', currentRow.id)
  342. this.addCar(currentRow)
  343. },
  344. */
  345. // table全选
  346. handleSelectionChange(val) {
  347. this.$emit('update:multipleSelection', val);
  348. },
  349. dialogCheck(selection, row) {
  350. if (this.isCheckBox) return; // 是多选框返回
  351. this.$refs.elTable.clearSelection();
  352. // 初始化
  353. if (selection.length === 0) {
  354. this.$emit('update:selectId', null);
  355. this.$emit('update:selectRow', {});
  356. return;
  357. }
  358. if (row) {
  359. this.$emit('update:selectId', row.id);
  360. this.$emit('update:selectRow', row);
  361. this.$refs.elTable.toggleRowSelection(row, true);
  362. }
  363. },
  364. addCar(currentRow) {
  365. // 加入购物车需要parentId
  366. const selrow = Object.assign({}, currentRow);
  367. selrow.parentId = this.decorationObj.parentId;
  368. this.$emit('update:selectRow', selrow);
  369. this.$refs.elTable.toggleRowSelection(currentRow);
  370. },
  371. getRowKey(row) {
  372. return row.id;
  373. },
  374. arraySpanMethod({
  375. row,
  376. column,
  377. rowIndex,
  378. columnIndex
  379. }) {
  380. // 隐藏'Decoration'选项框
  381. if (this.tableType === 'Decoration' && columnIndex === 0) {
  382. return [0, 1];
  383. }
  384. if (this.tableType === 'Decoration' && columnIndex === 1) {
  385. return [1, 2];
  386. }
  387. },
  388. tableRowClassName({
  389. row
  390. }) {
  391. if (this.tableType === 'Decoration') {
  392. return this.decorationMultiple ? 'borderNone' : 'hiddenRow';
  393. }
  394. return 'fontBold';
  395. },
  396. handleSelectable(row, index) {
  397. // website_setup_id 5为POA,不可选
  398. return row.website_setup_id !== 5;
  399. },
  400. getNumber(e, row, max) {
  401. if (parseInt(e) > max) {
  402. row.num = max;
  403. }
  404. }
  405. }
  406. });
  407. // CONCATENATED MODULE: ./components/table/NewPriceTable.vue?vue&type=script&lang=js
  408. /* harmony default export */ var table_NewPriceTablevue_type_script_lang_js = (NewPriceTablevue_type_script_lang_js);
  409. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  410. var componentNormalizer = __webpack_require__(2);
  411. // CONCATENATED MODULE: ./components/table/NewPriceTable.vue
  412. function injectStyles (context) {
  413. var style0 = __webpack_require__(188)
  414. if (style0.__inject__) style0.__inject__(context)
  415. }
  416. /* normalize component */
  417. var component = Object(componentNormalizer["a" /* default */])(
  418. table_NewPriceTablevue_type_script_lang_js,
  419. render,
  420. staticRenderFns,
  421. false,
  422. injectStyles,
  423. "8da20436",
  424. "518290f4"
  425. )
  426. /* harmony default export */ var NewPriceTable = __webpack_exports__["default"] = (component.exports);
  427. /***/ })
  428. };;
  429. //# sourceMappingURL=table-new-price-table.js.map