1 line
11 KiB
Plaintext
1 line
11 KiB
Plaintext
{"version":3,"sources":["webpack:////Users/yovinchen/Desktop/project/xlcs/xlcs-user/components/AddToCart/AddToCart.vue?74d1","webpack:////Users/yovinchen/Desktop/project/xlcs/xlcs-user/components/AddToCart/AddToCart.vue?0e54","webpack:////Users/yovinchen/Desktop/project/xlcs/xlcs-user/components/AddToCart/AddToCart.vue?adc8","webpack:////Users/yovinchen/Desktop/project/xlcs/xlcs-user/components/AddToCart/AddToCart.vue?fece","uni-app:///components/AddToCart/AddToCart.vue"],"names":["name","data","id","isCart","showConfirmModal","props","shopDetail","type","default","skuId","computed","getCheckProductExists","skuNumValue","get","set","getMax","perLimit","methods","addShopCart","changeSkuNumMinus","value","currentBuyNum","changeSkuNumPlus","modalConfirm","modalCancel","watch","handler","immediate"],"mappings":";;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAsH;AACtH;AAC6D;AACL;;;AAGxD;AACmN;AACnN,gBAAgB,iNAAU;AAC1B,EAAE,+EAAM;AACR,EAAE,oFAAM;AACR,EAAE,6FAAe;AACjB;AACA;AACA;AACA;AACA;AACA,EAAE,wFAAU;AACZ;AACA;;AAEA;AACe,gF;;;;;;;;;;;;ACtBf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;;;;;;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA,aAAa,2OAEN;AACP,KAAK;AACL;AACA,aAAa,mQAEN;AACP,KAAK;AACL;AACA,aAAa,qOAEN;AACP,KAAK;AACL;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;AC3CA;AAAA;AAAA;AAAA;AAAs1B,CAAgB,uyBAAG,EAAC,C;;;;;;;;;;;;;;;;;;;;AC6B12B;AAAA;AAAA;AAAA,gBAEA;EACAA;EACAC;IACA;MACAC;MACAC;MACAC;IACA;EACA;EACAC;IACAC;MACAC;MACAC;QACA;MACA;IACA;IACA;IACA;IACAC;MACAF;MACAC;IACA;EACA;EACAE,0CACA;IACA;IACAC;MACA;IACA;IACA;IACAC;MACAC;QACA;MACA;MACAC,0BACA;IACA;IACA;IACAC;MACA;MACA;MACA;QACAC;MACA;MACA;IACA;EAAA,EACA;EACAC,yCACA;IACA;IACAC;MACA;QACA;MACA;MACA;IACA;IACA;IACAC;MACA;MACA;QACA;MACA;QACA;UAAAV;UAAAW;UAAAC;UAAAlB;QAAA;MACA;IAEA;IACA;IACAmB;MACA;QAAAb;QAAAW;QAAAC;QAAAlB;MAAA;IACA;IACA;IACAoB;MACA;MACA;QAAAd;QAAAW;QAAAC;QAAAlB;MAAA;IACA;IACA;IACAqB;MACA;MACA;MACA;IACA;EAAA,EACA;EACAC;IACA;IACAhB;MACAiB;QACA;UACA;UACA;QACA;UACA;UACA;QACA;MACA;MACAC;IACA;EACA;AACA;AAAA,4B","file":"components/AddToCart/AddToCart.js","sourcesContent":["import { render, staticRenderFns, recyclableRender, components } from \"./AddToCart.vue?vue&type=template&id=ae471b04&\"\nvar renderjs\nimport script from \"./AddToCart.vue?vue&type=script&lang=js&\"\nexport * from \"./AddToCart.vue?vue&type=script&lang=js&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null,\n false,\n components,\n renderjs\n)\n\ncomponent.options.__file = \"components/AddToCart/AddToCart.vue\"\nexport default component.exports","export * from \"-!../../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--17-0!../../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/template.js!../../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/page-meta.js!../../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./AddToCart.vue?vue&type=template&id=ae471b04&\"","var components\ntry {\n components = {\n uButton: function () {\n return import(\n /* webpackChunkName: \"node-modules/uview-ui/components/u-button/u-button\" */ \"uview-ui/components/u-button/u-button.vue\"\n )\n },\n uNumberBox: function () {\n return import(\n /* webpackChunkName: \"node-modules/uview-ui/components/u-number-box/u-number-box\" */ \"uview-ui/components/u-number-box/u-number-box.vue\"\n )\n },\n uModal: function () {\n return import(\n /* webpackChunkName: \"node-modules/uview-ui/components/u-modal/u-modal\" */ \"uview-ui/components/u-modal/u-modal.vue\"\n )\n },\n }\n} catch (e) {\n if (\n e.message.indexOf(\"Cannot find module\") !== -1 &&\n e.message.indexOf(\".vue\") !== -1\n ) {\n console.error(e.message)\n console.error(\"1. 排查组件名称拼写是否正确\")\n console.error(\n \"2. 排查组件是否符合 easycom 规范,文档:https://uniapp.dcloud.net.cn/collocation/pages?id=easycom\"\n )\n console.error(\n \"3. 若组件不符合 easycom 规范,需手动引入,并在 components 中注册该组件\"\n )\n } else {\n throw e\n }\n}\nvar render = function () {\n var _vm = this\n var _h = _vm.$createElement\n var _c = _vm._self._c || _h\n}\nvar recyclableRender = false\nvar staticRenderFns = []\nrender._withStripped = true\n\nexport { render, staticRenderFns, recyclableRender, components }","import mod from \"-!../../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/babel-loader/lib/index.js!../../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--13-1!../../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/script.js!../../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./AddToCart.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/babel-loader/lib/index.js!../../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--13-1!../../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/script.js!../../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./AddToCart.vue?vue&type=script&lang=js&\"","<template>\n <view>\n <!-- 如果商品没有加入购物车 -->\n <block v-if=\"getCheckProductExists\">\n <u-button size=\"mini\" type=\"warning\" @click=\"addShopCart\">加入购物车</u-button>\n </block>\n <block v-else>\n <u-number-box\n ref=\"uNumber\"\n v-model=\"skuNumValue\"\n :disabled-input=\"true\"\n :input-height=\"40\"\n :input-width=\"60\"\n :max=\"getMax\"\n :min=\"0\"\n :size=\"20\"\n @minus=\"changeSkuNumMinus\"\n @plus=\"changeSkuNumPlus\"\n ></u-number-box>\n </block>\n\n <u-modal ref=\"confirmModal\" v-model=\"showConfirmModal\" :async-close=\"true\" :show-cancel-button=\"true\"\n @cancel=\"modalCancel\" @confirm=\"modalConfirm\">\n <view class=\"u-flex u-row-center u-m-20\">确认删除该商品?</view>\n </u-modal>\n </view>\n</template>\n\n<script>\nimport {mapGetters, mapActions} from 'vuex';\n\nexport default {\n name: 'AddToCart',\n data() {\n return {\n id: 0,\n isCart: false,\n showConfirmModal: false\n };\n },\n props: {\n shopDetail: {\n type: Object,\n default: () => {\n return {};\n }\n },\n // 在购物车页面的时候,使用带活动的购物车将传递的不再是商品的id\n // 商品详情信息中没有id,而是skuId\n skuId: {\n type: Number,\n default: null\n }\n },\n computed: {\n ...mapGetters('cartModule', ['checkProductExists', 'getProductSkuNum']),\n // 检查是否存在商品于购物车\n getCheckProductExists() {\n return !this.checkProductExists(this.id);\n },\n // 商品加入购物车的数量\n skuNumValue: {\n get() {\n return this.getProductSkuNum(this.id);\n },\n set(value) {\n }\n },\n // 最大可加入购物车的数量\n getMax() {\n let perLimit = this.shopDetail.perLimit;\n // 秒杀商品与普通商品购买上限判断字段不同\n if (this.shopDetail.skuType === 1) {\n perLimit = this.shopDetail.seckillSkuVo && this.shopDetail.seckillSkuVo.seckillLimit\n }\n return perLimit;\n }\n },\n methods: {\n ...mapActions('cartModule', ['addShopAction', 'changeSkuNumAction']),\n // 添加到购物车\n addShopCart() {\n if (this.skuId) {\n this.shopDetail.id = this.skuId;\n }\n this.addShopAction(this.shopDetail);\n },\n // 购物车数量递减\n changeSkuNumMinus(e) {\n // 如果是购物车中进行递减操作,并且购物车数量为0,那么需要弹出确认框\n if (e.value < 1 && this.isCart) {\n this.showConfirmModal = true;\n } else {\n this.changeSkuNumAction({skuId: this.id, value: -1, currentBuyNum: e.value, isCart: this.isCart});\n }\n\n },\n // 购物车数量递增\n changeSkuNumPlus(e) {\n this.changeSkuNumAction({skuId: this.id, value: 1, currentBuyNum: e.value, isCart: this.isCart});\n },\n // 确认删除商品模态框\n modalConfirm() {\n this.showConfirmModal = false;\n this.changeSkuNumAction({skuId: this.id, value: -1, currentBuyNum: 0, isCart: this.isCart});\n },\n // 取消删除商品模态框,只需要将商品购买数修改回初始值\n modalCancel() {\n this.showConfirmModal = false;\n // 重新设置u-number-box的初始值\n this.$refs.uNumber.$data.inputVal = 1;\n },\n },\n watch: {\n // skuId是在购物车频道使用,如果是商品列表,是id\n skuId: {\n handler(newVal, oldVal) {\n if (newVal) {\n this.id = newVal;\n this.isCart = true;\n } else {\n this.id = this.shopDetail.id;\n this.isCart = false;\n }\n },\n immediate: true\n }\n }\n};\n</script>\n\n<style lang=\"scss\"></style>\n"],"sourceRoot":""} |