Commit a27263a1 by 施宇

1

parent d27e397e
Showing with 3 additions and 3 deletions
......@@ -372,8 +372,8 @@ export default {
if(this.navInit == i){
return
}
console.log(this.goodDetail)
if(this.goodDetail.ac_type == 6 && this.goodDetail.allow_presale == 1 && this.goodDetail.aggregateNum>this.goodDetail.stockNum){
console.log(this)
if(this.goodDetail.ac_type == 6 && this.goodDetail.allow_presale == 1 && this.aggregateNum>this.stockNum){
this.$toast("想要购买更多,请联系客服");
return
}
......
......@@ -8,7 +8,7 @@
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core_js_modules_es6_number_constructor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es6.number.constructor */ \"./node_modules/_core-js@2.6.11@core-js/modules/es6.number.constructor.js\");\n/* harmony import */ var core_js_modules_es6_number_constructor__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_number_constructor__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es6.regexp.replace */ \"./node_modules/_core-js@2.6.11@core-js/modules/es6.regexp.replace.js\");\n/* harmony import */ var core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _util_index__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../util/index */ \"./src/util/index.js\");\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! vue */ \"./node_modules/_vue@2.6.11@vue/dist/vue.runtime.esm.js\");\n/* harmony import */ var vant__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! vant */ \"./node_modules/_vant@2.8.4@vant/es/index.js\");\n\n\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\n\n\nvue__WEBPACK_IMPORTED_MODULE_3__[\"default\"].use(vant__WEBPACK_IMPORTED_MODULE_4__[\"ImagePreview\"]);\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n props: {\n goodDetail: {\n type: Object,\n default: function _default() {\n return {};\n }\n }\n },\n data: function data() {\n return {\n images: [],\n isShowMore: false,\n ypNum: 0,\n //组\n singlePrice: 0,\n //单价\n tipText: \"\",\n btnText: \"\",\n navInit: 0,\n startNum: 0,\n //起订量\n multipleNum: 0,\n //倍数\n aggregateNum: 0,\n //一组的数量\n stockNum: 0,\n //库存,\n zyladderArr: [],\n //阶梯价\n zySingleInit: 0,\n //自营数量初始值\n goodsNum: 0,\n //商品数量\n isYushou: false\n };\n },\n computed: {\n total: function total() {\n return (this.goodsNum * this.singlePrice).toFixed(4);\n }\n },\n watch: {\n goodDetail: function goodDetail(res) {\n //处理力创数据库存为0\n if (_util_index__WEBPACK_IMPORTED_MODULE_2__[\"default\"].aggxde(res.stock) == 0 && res.self_supplier_type == 2) {\n res.isLcKc0 = true;\n } else {\n res.isLcKc0 = false;\n }\n },\n ypNum: function ypNum(now) {\n if (String(now).indexOf(\".\") > 0) this.ypNum = \"\";\n this.ypNum = String(now).replace(/\\D/g, \"\");\n this.goodsNum = now * this.aggregateNum;\n },\n \"goodDetail.goods_id\": function goodDetailGoods_id() {\n var data = this.goodDetail;\n\n if (JSON.stringify(data) != \"{}\") {\n if (this.goodDetail.goods_type == 3 || this.goodDetail.goods_type == 4) {\n if (data.min_buy) {\n this.startNum = _util_index__WEBPACK_IMPORTED_MODULE_2__[\"default\"].aggxde(data.min_buy);\n }\n\n if (data.mpl) {\n this.multipleNum = _util_index__WEBPACK_IMPORTED_MODULE_2__[\"default\"].aggxde(data.mpl);\n }\n\n if (data.min_mpq) {\n this.aggregateNum = _util_index__WEBPACK_IMPORTED_MODULE_2__[\"default\"].aggxde(data.min_mpq);\n }\n\n if (data.goods_number) {\n this.stockNum = _util_index__WEBPACK_IMPORTED_MODULE_2__[\"default\"].aggxde(data.goods_number);\n }\n\n if (this.startNum == this.multipleNum) {\n //倍数和起订量相等\n this.zySingleInit = this.startNum;\n } else if (this.startNum > this.multipleNum) {\n //起订量大于倍数\n if (this.startNum % this.multipleNum) {\n //起订量跟倍数的比值为小数\n this.zySingleInit = Math.ceil(this.startNum / this.multipleNum) * this.multipleNum;\n } else {\n //起订量跟倍数的比值为整数时取起订量\n this.zySingleInit = this.startNum;\n }\n } else {\n //起订量小于倍数\n this.zySingleInit = this.multipleNum;\n }\n\n if (data.tiered) {\n for (var i = 0; i < data.tiered.length; i++) {\n var singleData = data.tiered[i];\n this.zyladderArr.push({\n price: Number(singleData.price_cn).toFixed(4),\n num: _util_index__WEBPACK_IMPORTED_MODULE_2__[\"default\"].aggxde(singleData.purchases)\n });\n }\n }\n }\n }\n },\n goodsNum: function goodsNum(now) {\n if (String(now).indexOf(\".\") > 0) this.goodsNum = \"\";\n this.goodsNum = String(now).replace(/\\D/g, \"\");\n this.ladderComputer(now);\n\n if (Number(now) > this.stockNum) {\n this.isYushou = true;\n this.tipText = \"库存不足,下单后我们将帮您订货\";\n console.log(this.goodDetail);\n\n if (this.goodDetail.ac_type == 6 && this.goodDetail.allow_presale == 1) {\n this.$toast(\"想要购买更多,请联系客服\");\n var maxNum;\n var inputVal;\n\n if (this.navInit == 1) {\n inputVal = this.ypNum || 0;\n\n if (inputVal !== 0 || inputVal !== 1) {\n maxNum = inputVal - 1;\n } else {\n maxNum = inputVal;\n }\n\n this.ypNum = maxNum;\n } else {\n inputVal = this.goodsNum || 0;\n\n if (inputVal !== 0 || inputVal !== (this.multipleNum || this.startNum)) {\n maxNum = Math.floor(this.stockNum / (this.multipleNum || this.startNum)) * (this.multipleNum || this.startNum);\n } else {\n maxNum = inputVal;\n }\n\n this.goodsNum = maxNum;\n }\n } else {\n this.btnText = \"预售订货\";\n }\n } else {\n this.isYushou = false;\n this.tipText = \"想要购买更多?直接下单,我们帮您订货\";\n this.btnText = \"立即购买\";\n }\n },\n zySingleInit: function zySingleInit(now) {\n this.goodsNum = now;\n }\n },\n methods: {\n showImagePreview: function showImagePreview(position, timer) {\n var images = [this.goodDetail.brand_logo || 'https://www.ichunt.com/v3/dist/res/m/images/materiel_img_3.png'];\n var instance = Object(vant__WEBPACK_IMPORTED_MODULE_4__[\"ImagePreview\"])({\n images: images,\n asyncClose: !!timer,\n showIndex: false\n });\n\n if (timer) {\n setTimeout(function () {\n instance.close();\n }, timer);\n }\n },\n imgErr: function imgErr() {\n this.goodDetail.brand_logo = \"https://www.ichunt.com/v3/dist/res/m/images/materiel_img_3.png\";\n },\n changeNav: function changeNav(i) {\n if (this.navInit == i) {\n return;\n }\n\n console.log(this.goodDetail);\n\n if (this.goodDetail.ac_type == 6 && this.goodDetail.allow_presale == 1 && this.goodDetail.aggregateNum > this.goodDetail.stockNum) {\n this.$toast(\"想要购买更多,请联系客服\");\n return;\n }\n\n this.navInit = i;\n\n if (i == 1) {\n if (this.goodsNum % this.aggregateNum) {\n //如果商品数量除以组数不为整数\n this.ypNum = Math.ceil(this.goodsNum / this.aggregateNum);\n } else {\n //如果商品数量除以组数为整数\n this.ypNum = Number(this.goodsNum) / this.aggregateNum;\n }\n }\n },\n ladderComputer: function ladderComputer(v) {\n //阶梯价计算价格v\n var length = this.zyladderArr.length;\n\n if (!length) {\n //阶梯价的数据为空\n this.singlePrice = 0;\n return;\n } else {\n //阶梯价的数据不为空\n if (length == 1) {\n //阶梯价的数据为1\n this.singlePrice = this.zyladderArr[0].price;\n return;\n } else {\n //阶梯价的数据不为1\n if (v <= this.zyladderArr[0].num) {\n //输入数量小于等于最小值\n this.singlePrice = this.zyladderArr[0].price;\n return;\n } else if (v >= this.zyladderArr[length - 1].num) {\n //输入数量大于等于最大值\n this.singlePrice = this.zyladderArr[length - 1].price;\n return;\n } else {\n for (var i = 0; i < this.zyladderArr.length; i++) {\n if (v >= this.zyladderArr[i].num && v < this.zyladderArr[i + 1].num) {\n this.singlePrice = this.zyladderArr[i].price;\n break;\n }\n }\n }\n }\n }\n },\n blurSingle: function blurSingle() {\n //购买数量为0\n if (!Number(this.goodsNum)) {\n this.$toast(\"购买数量不能少于起订量!\");\n this.goodsNum = this.zySingleInit;\n } else {\n //购买数量不为0\n if (Number(this.goodsNum) % this.multipleNum) {\n //当购买数量不是倍数的整数倍\n var num = Math.ceil(Number(this.goodsNum) / this.multipleNum) * this.multipleNum;\n\n if (num < this.startNum) {\n //取倍数的整数后小于起订量\n this.$toast(\"\\u8D2D\\u4E70\\u6570\\u91CF\\u5FC5\\u987B\\u4E3A\".concat(this.multipleNum, \"\\u7684\\u6574\\u6570\\u500D\\u4E14\\u4E0D\\u80FD\\u5C11\\u4E8E\\u8D77\\u8BA2\\u91CF\\uFF01\"));\n this.goodsNum = this.zySingleInit;\n } else {\n //取倍数的整数后不小于起订量\n this.$toast(\"\\u8D2D\\u4E70\\u6570\\u91CF\\u5FC5\\u987B\\u4E3A\".concat(this.multipleNum, \"\\u7684\\u6574\\u6570\\u500D\\uFF0C\\u6211\\u4EEC\\u5DF2\\u4E3A\\u60A8\\u8C03\\u6574\\u8D2D\\u4E70\\u6570\\u91CF\\u3002\"));\n this.goodsNum = num;\n }\n } else {\n if (Number(this.goodsNum) < this.zySingleInit) {\n this.$toast(\"\\u8D2D\\u4E70\\u6570\\u91CF\\u5FC5\\u987B\\u4E3A\".concat(this.multipleNum, \"\\u7684\\u6574\\u6570\\u500D\\u4E14\\u4E0D\\u80FD\\u5C11\\u4E8E\\u8D77\\u8BA2\\u91CF\\uFF01\"));\n this.goodsNum = this.zySingleInit;\n }\n }\n }\n },\n blurZu: function blurZu() {\n if (Number(this.goodsNum) * Number(this.aggregateNum) < this.startNum) {\n this.$toast(\"购买数量不能少于起订量!\");\n this.ypNum = Math.ceil(this.startNum / this.aggregateNum);\n }\n },\n reduceSingle: function reduceSingle() {\n if (Number(this.goodsNum) <= this.startNum) {\n //购买数量小于等于起订量\n this.$toast(\"购买数量不能少于起订量!\");\n } else {\n //购买数量大于起订量\n if (Number(this.goodsNum) - this.multipleNum < this.startNum) {\n //购买数量减倍数小于起订量\n this.$toast(\"\\u8D2D\\u4E70\\u6570\\u91CF\\u5FC5\\u987B\\u4E3A\".concat(this.multipleNum, \"\\u7684\\u6574\\u6570\\u500D\\u4E14\\u4E0D\\u80FD\\u5C11\\u4E8E\\u8D77\\u8BA2\\u91CF\\uFF01\"));\n } else {\n this.goodsNum = Number(this.goodsNum) - this.multipleNum;\n }\n }\n },\n addSingle: function addSingle() {\n this.goodsNum = Number(this.goodsNum) + this.multipleNum;\n },\n reduceZu: function reduceZu() {\n if (Number(this.goodsNum) <= this.startNum) {\n return;\n } else {\n this.ypNum = Number(this.ypNum) - 1;\n }\n },\n addZu: function addZu() {\n this.ypNum = Number(this.ypNum) + 1;\n },\n xdOrAdd: function xdOrAdd(type) {\n var datax = {\n id: this.goodDetail.goods_id,\n num: this.goodsNum,\n buy: type == 1 ? 1 : -1,\n searchModel: this.$route.query.k || \"\",\n module_name: this.goodDetail.module_name || \"\",\n click_adtag: this.$route.query.adtag || this.$route.query.ptag || \"\",\n click_ptag: _util_index__WEBPACK_IMPORTED_MODULE_2__[\"default\"].getCookie(\"ptag\") || \"\"\n };\n _util_index__WEBPACK_IMPORTED_MODULE_2__[\"default\"].setCookie(\"ptag\", \"pop-\" + window.location.href, 1);\n\n if (type == 1) {\n //立即购买\n try {\n sensors.track(\"brandList\", {\n click_ptag: this.goodDetail.module_name || \"\",\n click_adtag: this.$route.query.adtag || this.$route.query.ptag || \"\",\n element_name: \"立即购买\",\n click_account: this.goodDetail.account_name || \"\",\n brand_id: this.goodDetail.brand_id || \"\",\n class_id: this.goodDetail.class_id || \"\",\n supplier_id: this.goodDetail.supplier_id || \"\"\n });\n } catch (e) {}\n } else {\n //加入购物车\n try {\n sensors.track(\"brandList\", {\n click_ptag: this.goodDetail.module_name || \"\",\n click_adtag: this.$route.query.adtag || this.$route.query.ptag || \"\",\n element_name: \"加入购物车\",\n click_account: this.goodDetail.account_name || \"\",\n brand_id: this.goodDetail.brand_id || \"\",\n class_id: this.goodDetail.class_id || \"\",\n supplier_id: this.goodDetail.supplier_id || \"\"\n });\n } catch (e) {}\n }\n\n this.$store.dispatch({\n type: \"addGoods\",\n data: {\n datax: datax,\n type: 1,\n k: this.$route.query.k || \"\"\n } //1表示自营 2表示联营\n\n });\n }\n }\n});\n\n//# sourceURL=webpack:///./src/views/common/zyDetail.vue?./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--12-0!./node_modules/_babel-loader@8.1.0@babel-loader/lib!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.9.2@vue-loader/lib??vue-loader-options");
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core_js_modules_es6_number_constructor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es6.number.constructor */ \"./node_modules/_core-js@2.6.11@core-js/modules/es6.number.constructor.js\");\n/* harmony import */ var core_js_modules_es6_number_constructor__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_number_constructor__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es6.regexp.replace */ \"./node_modules/_core-js@2.6.11@core-js/modules/es6.regexp.replace.js\");\n/* harmony import */ var core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _util_index__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../util/index */ \"./src/util/index.js\");\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! vue */ \"./node_modules/_vue@2.6.11@vue/dist/vue.runtime.esm.js\");\n/* harmony import */ var vant__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! vant */ \"./node_modules/_vant@2.8.4@vant/es/index.js\");\n\n\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\n\n\nvue__WEBPACK_IMPORTED_MODULE_3__[\"default\"].use(vant__WEBPACK_IMPORTED_MODULE_4__[\"ImagePreview\"]);\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n props: {\n goodDetail: {\n type: Object,\n default: function _default() {\n return {};\n }\n }\n },\n data: function data() {\n return {\n images: [],\n isShowMore: false,\n ypNum: 0,\n //组\n singlePrice: 0,\n //单价\n tipText: \"\",\n btnText: \"\",\n navInit: 0,\n startNum: 0,\n //起订量\n multipleNum: 0,\n //倍数\n aggregateNum: 0,\n //一组的数量\n stockNum: 0,\n //库存,\n zyladderArr: [],\n //阶梯价\n zySingleInit: 0,\n //自营数量初始值\n goodsNum: 0,\n //商品数量\n isYushou: false\n };\n },\n computed: {\n total: function total() {\n return (this.goodsNum * this.singlePrice).toFixed(4);\n }\n },\n watch: {\n goodDetail: function goodDetail(res) {\n //处理力创数据库存为0\n if (_util_index__WEBPACK_IMPORTED_MODULE_2__[\"default\"].aggxde(res.stock) == 0 && res.self_supplier_type == 2) {\n res.isLcKc0 = true;\n } else {\n res.isLcKc0 = false;\n }\n },\n ypNum: function ypNum(now) {\n if (String(now).indexOf(\".\") > 0) this.ypNum = \"\";\n this.ypNum = String(now).replace(/\\D/g, \"\");\n this.goodsNum = now * this.aggregateNum;\n },\n \"goodDetail.goods_id\": function goodDetailGoods_id() {\n var data = this.goodDetail;\n\n if (JSON.stringify(data) != \"{}\") {\n if (this.goodDetail.goods_type == 3 || this.goodDetail.goods_type == 4) {\n if (data.min_buy) {\n this.startNum = _util_index__WEBPACK_IMPORTED_MODULE_2__[\"default\"].aggxde(data.min_buy);\n }\n\n if (data.mpl) {\n this.multipleNum = _util_index__WEBPACK_IMPORTED_MODULE_2__[\"default\"].aggxde(data.mpl);\n }\n\n if (data.min_mpq) {\n this.aggregateNum = _util_index__WEBPACK_IMPORTED_MODULE_2__[\"default\"].aggxde(data.min_mpq);\n }\n\n if (data.goods_number) {\n this.stockNum = _util_index__WEBPACK_IMPORTED_MODULE_2__[\"default\"].aggxde(data.goods_number);\n }\n\n if (this.startNum == this.multipleNum) {\n //倍数和起订量相等\n this.zySingleInit = this.startNum;\n } else if (this.startNum > this.multipleNum) {\n //起订量大于倍数\n if (this.startNum % this.multipleNum) {\n //起订量跟倍数的比值为小数\n this.zySingleInit = Math.ceil(this.startNum / this.multipleNum) * this.multipleNum;\n } else {\n //起订量跟倍数的比值为整数时取起订量\n this.zySingleInit = this.startNum;\n }\n } else {\n //起订量小于倍数\n this.zySingleInit = this.multipleNum;\n }\n\n if (data.tiered) {\n for (var i = 0; i < data.tiered.length; i++) {\n var singleData = data.tiered[i];\n this.zyladderArr.push({\n price: Number(singleData.price_cn).toFixed(4),\n num: _util_index__WEBPACK_IMPORTED_MODULE_2__[\"default\"].aggxde(singleData.purchases)\n });\n }\n }\n }\n }\n },\n goodsNum: function goodsNum(now) {\n if (String(now).indexOf(\".\") > 0) this.goodsNum = \"\";\n this.goodsNum = String(now).replace(/\\D/g, \"\");\n this.ladderComputer(now);\n\n if (Number(now) > this.stockNum) {\n this.isYushou = true;\n this.tipText = \"库存不足,下单后我们将帮您订货\";\n console.log(this.goodDetail);\n\n if (this.goodDetail.ac_type == 6 && this.goodDetail.allow_presale == 1) {\n this.$toast(\"想要购买更多,请联系客服\");\n var maxNum;\n var inputVal;\n\n if (this.navInit == 1) {\n inputVal = this.ypNum || 0;\n\n if (inputVal !== 0 || inputVal !== 1) {\n maxNum = inputVal - 1;\n } else {\n maxNum = inputVal;\n }\n\n this.ypNum = maxNum;\n } else {\n inputVal = this.goodsNum || 0;\n\n if (inputVal !== 0 || inputVal !== (this.multipleNum || this.startNum)) {\n maxNum = Math.floor(this.stockNum / (this.multipleNum || this.startNum)) * (this.multipleNum || this.startNum);\n } else {\n maxNum = inputVal;\n }\n\n this.goodsNum = maxNum;\n }\n } else {\n this.btnText = \"预售订货\";\n }\n } else {\n this.isYushou = false;\n this.tipText = \"想要购买更多?直接下单,我们帮您订货\";\n this.btnText = \"立即购买\";\n }\n },\n zySingleInit: function zySingleInit(now) {\n this.goodsNum = now;\n }\n },\n methods: {\n showImagePreview: function showImagePreview(position, timer) {\n var images = [this.goodDetail.brand_logo || 'https://www.ichunt.com/v3/dist/res/m/images/materiel_img_3.png'];\n var instance = Object(vant__WEBPACK_IMPORTED_MODULE_4__[\"ImagePreview\"])({\n images: images,\n asyncClose: !!timer,\n showIndex: false\n });\n\n if (timer) {\n setTimeout(function () {\n instance.close();\n }, timer);\n }\n },\n imgErr: function imgErr() {\n this.goodDetail.brand_logo = \"https://www.ichunt.com/v3/dist/res/m/images/materiel_img_3.png\";\n },\n changeNav: function changeNav(i) {\n if (this.navInit == i) {\n return;\n }\n\n console.log(this);\n\n if (this.goodDetail.ac_type == 6 && this.goodDetail.allow_presale == 1 && this.aggregateNum > this.stockNum) {\n this.$toast(\"想要购买更多,请联系客服\");\n return;\n }\n\n this.navInit = i;\n\n if (i == 1) {\n if (this.goodsNum % this.aggregateNum) {\n //如果商品数量除以组数不为整数\n this.ypNum = Math.ceil(this.goodsNum / this.aggregateNum);\n } else {\n //如果商品数量除以组数为整数\n this.ypNum = Number(this.goodsNum) / this.aggregateNum;\n }\n }\n },\n ladderComputer: function ladderComputer(v) {\n //阶梯价计算价格v\n var length = this.zyladderArr.length;\n\n if (!length) {\n //阶梯价的数据为空\n this.singlePrice = 0;\n return;\n } else {\n //阶梯价的数据不为空\n if (length == 1) {\n //阶梯价的数据为1\n this.singlePrice = this.zyladderArr[0].price;\n return;\n } else {\n //阶梯价的数据不为1\n if (v <= this.zyladderArr[0].num) {\n //输入数量小于等于最小值\n this.singlePrice = this.zyladderArr[0].price;\n return;\n } else if (v >= this.zyladderArr[length - 1].num) {\n //输入数量大于等于最大值\n this.singlePrice = this.zyladderArr[length - 1].price;\n return;\n } else {\n for (var i = 0; i < this.zyladderArr.length; i++) {\n if (v >= this.zyladderArr[i].num && v < this.zyladderArr[i + 1].num) {\n this.singlePrice = this.zyladderArr[i].price;\n break;\n }\n }\n }\n }\n }\n },\n blurSingle: function blurSingle() {\n //购买数量为0\n if (!Number(this.goodsNum)) {\n this.$toast(\"购买数量不能少于起订量!\");\n this.goodsNum = this.zySingleInit;\n } else {\n //购买数量不为0\n if (Number(this.goodsNum) % this.multipleNum) {\n //当购买数量不是倍数的整数倍\n var num = Math.ceil(Number(this.goodsNum) / this.multipleNum) * this.multipleNum;\n\n if (num < this.startNum) {\n //取倍数的整数后小于起订量\n this.$toast(\"\\u8D2D\\u4E70\\u6570\\u91CF\\u5FC5\\u987B\\u4E3A\".concat(this.multipleNum, \"\\u7684\\u6574\\u6570\\u500D\\u4E14\\u4E0D\\u80FD\\u5C11\\u4E8E\\u8D77\\u8BA2\\u91CF\\uFF01\"));\n this.goodsNum = this.zySingleInit;\n } else {\n //取倍数的整数后不小于起订量\n this.$toast(\"\\u8D2D\\u4E70\\u6570\\u91CF\\u5FC5\\u987B\\u4E3A\".concat(this.multipleNum, \"\\u7684\\u6574\\u6570\\u500D\\uFF0C\\u6211\\u4EEC\\u5DF2\\u4E3A\\u60A8\\u8C03\\u6574\\u8D2D\\u4E70\\u6570\\u91CF\\u3002\"));\n this.goodsNum = num;\n }\n } else {\n if (Number(this.goodsNum) < this.zySingleInit) {\n this.$toast(\"\\u8D2D\\u4E70\\u6570\\u91CF\\u5FC5\\u987B\\u4E3A\".concat(this.multipleNum, \"\\u7684\\u6574\\u6570\\u500D\\u4E14\\u4E0D\\u80FD\\u5C11\\u4E8E\\u8D77\\u8BA2\\u91CF\\uFF01\"));\n this.goodsNum = this.zySingleInit;\n }\n }\n }\n },\n blurZu: function blurZu() {\n if (Number(this.goodsNum) * Number(this.aggregateNum) < this.startNum) {\n this.$toast(\"购买数量不能少于起订量!\");\n this.ypNum = Math.ceil(this.startNum / this.aggregateNum);\n }\n },\n reduceSingle: function reduceSingle() {\n if (Number(this.goodsNum) <= this.startNum) {\n //购买数量小于等于起订量\n this.$toast(\"购买数量不能少于起订量!\");\n } else {\n //购买数量大于起订量\n if (Number(this.goodsNum) - this.multipleNum < this.startNum) {\n //购买数量减倍数小于起订量\n this.$toast(\"\\u8D2D\\u4E70\\u6570\\u91CF\\u5FC5\\u987B\\u4E3A\".concat(this.multipleNum, \"\\u7684\\u6574\\u6570\\u500D\\u4E14\\u4E0D\\u80FD\\u5C11\\u4E8E\\u8D77\\u8BA2\\u91CF\\uFF01\"));\n } else {\n this.goodsNum = Number(this.goodsNum) - this.multipleNum;\n }\n }\n },\n addSingle: function addSingle() {\n this.goodsNum = Number(this.goodsNum) + this.multipleNum;\n },\n reduceZu: function reduceZu() {\n if (Number(this.goodsNum) <= this.startNum) {\n return;\n } else {\n this.ypNum = Number(this.ypNum) - 1;\n }\n },\n addZu: function addZu() {\n this.ypNum = Number(this.ypNum) + 1;\n },\n xdOrAdd: function xdOrAdd(type) {\n var datax = {\n id: this.goodDetail.goods_id,\n num: this.goodsNum,\n buy: type == 1 ? 1 : -1,\n searchModel: this.$route.query.k || \"\",\n module_name: this.goodDetail.module_name || \"\",\n click_adtag: this.$route.query.adtag || this.$route.query.ptag || \"\",\n click_ptag: _util_index__WEBPACK_IMPORTED_MODULE_2__[\"default\"].getCookie(\"ptag\") || \"\"\n };\n _util_index__WEBPACK_IMPORTED_MODULE_2__[\"default\"].setCookie(\"ptag\", \"pop-\" + window.location.href, 1);\n\n if (type == 1) {\n //立即购买\n try {\n sensors.track(\"brandList\", {\n click_ptag: this.goodDetail.module_name || \"\",\n click_adtag: this.$route.query.adtag || this.$route.query.ptag || \"\",\n element_name: \"立即购买\",\n click_account: this.goodDetail.account_name || \"\",\n brand_id: this.goodDetail.brand_id || \"\",\n class_id: this.goodDetail.class_id || \"\",\n supplier_id: this.goodDetail.supplier_id || \"\"\n });\n } catch (e) {}\n } else {\n //加入购物车\n try {\n sensors.track(\"brandList\", {\n click_ptag: this.goodDetail.module_name || \"\",\n click_adtag: this.$route.query.adtag || this.$route.query.ptag || \"\",\n element_name: \"加入购物车\",\n click_account: this.goodDetail.account_name || \"\",\n brand_id: this.goodDetail.brand_id || \"\",\n class_id: this.goodDetail.class_id || \"\",\n supplier_id: this.goodDetail.supplier_id || \"\"\n });\n } catch (e) {}\n }\n\n this.$store.dispatch({\n type: \"addGoods\",\n data: {\n datax: datax,\n type: 1,\n k: this.$route.query.k || \"\"\n } //1表示自营 2表示联营\n\n });\n }\n }\n});\n\n//# sourceURL=webpack:///./src/views/common/zyDetail.vue?./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--12-0!./node_modules/_babel-loader@8.1.0@babel-loader/lib!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.9.2@vue-loader/lib??vue-loader-options");
/***/ }),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment