exports.ids = [29,27];
exports.modules = {

/***/ 178:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);

// 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/product-builder/stepMixin.vue?vue&type=template&id=bbcc9c86&scoped=true
var render = function render() {
  var _vm = this,
    _c = _vm._self._c;
  return _c('div', {}, []);
};
var staticRenderFns = [];

// CONCATENATED MODULE: ./components/product-builder/stepMixin.vue?vue&type=template&id=bbcc9c86&scoped=true

// 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/product-builder/stepMixin.vue?vue&type=script&lang=js
/* 仅用于本目录3个step表单组件的共享逻辑 */
/* harmony default export */ var stepMixinvue_type_script_lang_js = ({
  name: 'StepMixin',
  components: {},
  props: {
    loading: {
      type: Boolean,
      default: false
    },
    priceData: {
      type: Object,
      default: function () {
        return {
          priceList: [],
          attributeList: {},
          additionList: {}
        };
      }
    },
    detail: {
      type: Object,
      default: function () {
        return {
          info: {
            images: []
          }
        };
      }
    },
    preData: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {};
  },
  computed: {},
  watch: {
    form: {
      deep: true,
      handler: function () {
        if (this.loaded) {
          this.$_emitFormData();
        }
      }
    }
  },
  mounted() {},
  methods: {
    // 将this.form 自动传递给父组件
    $_emitFormData() {
      this.$emit('update-form', JSON.parse(JSON.stringify(this.form)));
    }
  }
});
// CONCATENATED MODULE: ./components/product-builder/stepMixin.vue?vue&type=script&lang=js
 /* harmony default export */ var product_builder_stepMixinvue_type_script_lang_js = (stepMixinvue_type_script_lang_js); 
// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
var componentNormalizer = __webpack_require__(2);

// CONCATENATED MODULE: ./components/product-builder/stepMixin.vue



function injectStyles (context) {
  
  
}

/* normalize component */

var component = Object(componentNormalizer["a" /* default */])(
  product_builder_stepMixinvue_type_script_lang_js,
  render,
  staticRenderFns,
  false,
  injectStyles,
  "bbcc9c86",
  "c0513676"
  
)

/* harmony default export */ var stepMixin = __webpack_exports__["default"] = (component.exports);

/***/ }),

/***/ 225:
/***/ (function(module, exports) {

// Exports
module.exports = {

};


/***/ }),

/***/ 254:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* 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_step_2_vue_vue_type_style_index_0_id_165fd52f_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(225);
/* 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_step_2_vue_vue_type_style_index_0_id_165fd52f_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_step_2_vue_vue_type_style_index_0_id_165fd52f_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0__);
/* 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_step_2_vue_vue_type_style_index_0_id_165fd52f_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_step_2_vue_vue_type_style_index_0_id_165fd52f_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__));


/***/ }),

/***/ 321:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);

// 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/product-builder/step-2.vue?vue&type=template&id=165fd52f&scoped=true
var render = function render() {
  var _vm = this,
    _c = _vm._self._c;
  return _c('el-card', {
    staticClass: "step-card"
  }, [_c('div', {
    staticClass: "flex between",
    attrs: {
      "slot": "header"
    },
    slot: "header"
  }, [_c('div', {
    staticClass: "step-card-title"
  }, [_vm._v("Step2 Choose options")]), _vm._v(" "), _c('div', [_vm._v(">>")])]), _vm._v(" "), _c('div', {
    directives: [{
      name: "loading",
      rawName: "v-loading",
      value: _vm.loading,
      expression: "loading"
    }]
  }, [_vm.computedPrintPriceData.length ? _c('div', [_c('div', {
    staticClass: "card-sub-title"
  }, [_vm._v("Decoration")]), _vm._v(" "), _c('el-form', {
    ref: "form",
    attrs: {
      "model": _vm.form,
      "rules": _vm.rules,
      "label-width": "0"
    }
  }, _vm._l(_vm.computedPrintPriceData, function (item) {
    return _c('div', {
      key: item.id
    }, [_c('div', {
      staticClass: "divider"
    }), _vm._v(" "), _c('el-form-item', [_c('div', {
      staticClass: "flex"
    }, [_c('el-switch', {
      attrs: {
        "active-color": "#13ce66",
        "inactive-color": "#ff4949"
      },
      model: {
        value: _vm.form[`${item.id}`].enable,
        callback: function ($$v) {
          _vm.$set(_vm.form[`${item.id}`], "enable", $$v);
        },
        expression: "form[`${item.id}`].enable"
      }
    }), _vm._v(" "), _c('div', {
      staticClass: "form-item-label",
      staticStyle: {
        "margin-left": "12px"
      }
    }, [_vm._v("\n                " + _vm._s(item.point) + "\n              ")])], 1)]), _vm._v(" "), _c('el-form-item', [_c('div', {
      staticClass: "custom-checkbox-wrap"
    }, _vm._l(item.decorationList, function (decoration) {
      return _c('div', {
        key: decoration.id,
        staticClass: "custom-checkbox",
        class: {
          active: _vm.form[`${item.id}`].printService === decoration.id,
          disable: !_vm.form[`${item.id}`].enable
        },
        on: {
          "click": function ($event) {
            return _vm.printServiceClick(decoration, item);
          }
        }
      }, [_vm._v("\n                " + _vm._s(decoration.dec_code) + "\n              ")]);
    }), 0), _vm._v(" "), _c('el-radio-group', {
      staticStyle: {
        "display": "none"
      },
      attrs: {
        "disabled": !_vm.form[`${item.id}`].enable
      },
      model: {
        value: _vm.form[`${item.id}`].printService,
        callback: function ($$v) {
          _vm.$set(_vm.form[`${item.id}`], "printService", $$v);
        },
        expression: "form[`${item.id}`].printService"
      }
    }, _vm._l(item.decorationList, function (decoration, index) {
      return _c('el-radio', {
        key: index,
        attrs: {
          "label": decoration.id
        }
      }, [_vm._v(_vm._s(decoration.dec_code) + "\n              ")]);
    }), 1)], 1), _vm._v(" "), _vm._l(item.decorationList, function (decoration, index) {
      return _c('div', {
        directives: [{
          name: "show",
          rawName: "v-show",
          value: decoration.id === _vm.form[`${item.id}`].printService,
          expression: "decoration.id === form[`${item.id}`].printService"
        }],
        key: index,
        staticClass: "flex start"
      }, [_c('div', {
        directives: [{
          name: "show",
          rawName: "v-show",
          value: decoration.max_color_count,
          expression: "decoration.max_color_count"
        }],
        staticClass: "flex-auto"
      }, [_c('div', {
        staticClass: "form-item-label"
      }, [_vm._v("Numbers of colours")]), _vm._v(" "), _c('div', {
        staticClass: "flex",
        staticStyle: {
          "height": "35px"
        }
      }, [_c('el-radio-group', {
        attrs: {
          "disabled": !_vm.form[`${item.id}`].enable
        },
        model: {
          value: _vm.form[`${item.id}`].colorForm[index].colorNumber,
          callback: function ($$v) {
            _vm.$set(_vm.form[`${item.id}`].colorForm[index], "colorNumber", $$v);
          },
          expression: "form[`${item.id}`].colorForm[index].colorNumber"
        }
      }, _vm._l(decoration.max_color_count, function (n) {
        return _c('el-radio', {
          key: n,
          attrs: {
            "label": n
          }
        });
      }), 1)], 1)]), _vm._v(" "), _c('div', {
        staticClass: "flex-auto",
        staticStyle: {
          "max-width": "50%"
        }
      }, [_c('div', {
        staticClass: "form-item-label"
      }, [_vm._v("PMS Colours")]), _vm._v(" "), _c('el-form-item', {
        attrs: {
          "prop": "pmsColor",
          "label-width": "0"
        }
      }, [_c('el-input', {
        attrs: {
          "disabled": !_vm.form[`${item.id}`].enable,
          "size": "small",
          "placeholder": "PMS"
        },
        model: {
          value: _vm.form[`${item.id}`].colorForm[index].pmsColorText,
          callback: function ($$v) {
            _vm.$set(_vm.form[`${item.id}`].colorForm[index], "pmsColorText", $$v);
          },
          expression: "form[`${item.id}`].colorForm[index].pmsColorText"
        }
      })], 1)], 1)]);
    })], 2);
  }), 0)], 1) : _vm._e(), _vm._v(" "), _vm.hasAddition ? _c('div', [_c('div', {
    staticClass: "divider"
  }), _vm._v(" "), _c('br'), _vm._v(" "), _c('div', {
    staticClass: "addition-title"
  }, [_vm._v("Centre Back")]), _vm._v(" "), _vm._l(_vm.priceData.additionList, function (addition, keyName, index) {
    return _c('div', {
      key: index,
      staticClass: "flex"
    }, [_c('div', {
      staticClass: "addition-title flex"
    }, [_vm._v(_vm._s(keyName))]), _vm._v(" "), _c('div', {
      staticClass: "flex-auto flex wrap"
    }, _vm._l(addition, function (item) {
      return _c('div', {
        key: item.id,
        staticClass: "addition-item",
        class: [{
          selected: _vm.additionForm[`${keyName}`].includes(item.id)
        }],
        on: {
          "click": function ($event) {
            return _vm.selectAddition(item, keyName);
          }
        }
      }, [_c('div', {
        staticClass: "background"
      }), _vm._v(" "), _c('div', {
        staticClass: "name"
      }, [_vm._v(_vm._s(item.name))])]);
    }), 0)]);
  })], 2) : _vm._e()])]);
};
var staticRenderFns = [];

// CONCATENATED MODULE: ./components/product-builder/step-2.vue?vue&type=template&id=165fd52f&scoped=true

// EXTERNAL MODULE: ./components/product-builder/stepMixin.vue + 4 modules
var stepMixin = __webpack_require__(178);

// 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/product-builder/step-2.vue?vue&type=script&lang=js

/* harmony default export */ var step_2vue_type_script_lang_js = ({
  name: 'Step2',
  mixins: [stepMixin["default"]],
  props: {
    // 步骤1中选中的周期. 不能直接拿form1来取form1.cycle, 否则步骤1变更时,  涉及到form1的computed会全部重新计算, 可能会导致其他异常
    cycle: {
      type: Number,
      default: function () {
        return 0;
      }
    }
  },
  data() {
    return {
      form: {},
      additionForm: {},
      rules: {},
      // 标志符，用于控制监听是否启用
      loaded: false
    };
  },
  computed: {
    // 商品 当前选中周期的 基础价格和打印价格数据
    computedPriceData() {
      return this.priceData.priceList.filter(item => item.cycle_id === this.cycle);
    },
    /**
     * 当前选中周期下, 商品对应的各型号打印价格.
     */
    computedPrintPriceData() {
      const model = this.computedPriceData.length ? this.computedPriceData[0] : {};
      // 属性‘1’里面是基础价格数据, 属性 ’2‘是打印价格数据
      if (model['2']) {
        return model['2'].slice();
      } else {
        return [];
      }
    },
    // 计算是否存在附加项
    hasAddition() {
      if (!this.loaded) return false;
      let result = false;
      const target = this.priceData.additionList;
      for (const key in target) {
        if (Array.isArray(target[key]) && target[key].length) {
          result = true;
        }
      }
      return result;
    }
  },
  watch: {
    computedPrintPriceData: {
      deep: true,
      handler: function () {
        if (!this.loaded) return;
        const temp = {};
        for (const item of this.computedPrintPriceData) {
          let pId = 0;
          // 从 product 页面来的用户选过的打印服务数据
          if (this.preData.printService && this.preData.printService[`${item.id}`] && this.preData.printService[`${item.id}`].id) {
            pId = this.preData.printService[`${item.id}`].id;
          }
          temp[`${item.id}`] = {
            // ...item直接把所有数据一起堆进去, 方便后续的价格计算, 不然计算需要各种遍历, 逻辑会非常难懂.
            ...item,
            enable: pId !== 0,
            // 打印服务. 如果选过的打印服务在这个周期的商品里面有, 则选上. 否则选当前打印服务项的第一个
            printService: item.decorationList.map(i => i.id).includes(pId) ? pId : item.decorationList[0].id,
            colorForm: item.decorationList.map(decoration => {
              return {
                id: decoration.id,
                // 默认是1, 后台数据允许留空成0, 但既然计算打印价格, 肯定会是1, 不然怎么打印、怎么计算价格
                colorNumber: pId === decoration.id ? Number(this.preData.printService[`${item.id}`].num) : 1,
                pmsColorText: ''
              };
            })
          };
        }
        this.form = Object.assign(temp, this.additionForm);
      }
    },
    additionForm: {
      deep: true,
      handler: function () {
        if (!this.loaded) return;
        Object.assign(this.form, this.additionForm);
      }
    }
  },
  mounted() {
    for (const key in this.priceData.additionList) {
      this.$set(this.additionForm, `${key}`, this.preData[`${key}`] ? this.preData[`${key}`].slice() : []);
    }
    this.loaded = true;
  },
  methods: {
    checkForm() {
      return new Promise((resolve, reject) => {
        this.$refs.form.validate(valid => {
          if (valid) {
            resolve(JSON.parse(JSON.stringify(this.form)));
          } else {
            reject(new Error('validate step2 form error'));
          }
        });
      });
    },
    selectAddition(item, key) {
      if (this.additionForm[`${key}`].includes(item.id)) {
        // 选中清除
        this.$set(this.additionForm, `${key}`, this.additionForm[`${key}`].filter(i => i !== item.id));
      } else {
        this.$set(this.additionForm, `${key}`, this.additionForm[`${key}`].concat([item.id]));
      }
    },
    printServiceClick(decoration, item) {
      if (!this.form[`${item.id}`].enable) return;
      this.form[`${item.id}`].printService = decoration.id;
    }
  }
});
// CONCATENATED MODULE: ./components/product-builder/step-2.vue?vue&type=script&lang=js
 /* harmony default export */ var product_builder_step_2vue_type_script_lang_js = (step_2vue_type_script_lang_js); 
// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
var componentNormalizer = __webpack_require__(2);

// CONCATENATED MODULE: ./components/product-builder/step-2.vue



function injectStyles (context) {
  
  var style0 = __webpack_require__(254)
if (style0.__inject__) style0.__inject__(context)

}

/* normalize component */

var component = Object(componentNormalizer["a" /* default */])(
  product_builder_step_2vue_type_script_lang_js,
  render,
  staticRenderFns,
  false,
  injectStyles,
  "165fd52f",
  "4673b2f1"
  
)

/* harmony default export */ var step_2 = __webpack_exports__["default"] = (component.exports);

/***/ })

};;
//# sourceMappingURL=product-builder-step2.js.map