You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

1 lines
15 KiB

{"version":3,"sources":["webpack:///G:/web/中龙小程序/zhonglmini/components/uni-number-box/uni-number-box.vue?cd57","webpack:///G:/web/中龙小程序/zhonglmini/components/uni-number-box/uni-number-box.vue?fbb1","webpack:///G:/web/中龙小程序/zhonglmini/components/uni-number-box/uni-number-box.vue?1d10","webpack:///G:/web/中龙小程序/zhonglmini/components/uni-number-box/uni-number-box.vue?bd7d","uni-app:///components/uni-number-box/uni-number-box.vue","webpack:///G:/web/中龙小程序/zhonglmini/components/uni-number-box/uni-number-box.vue?f52d","webpack:///G:/web/中龙小程序/zhonglmini/components/uni-number-box/uni-number-box.vue?9955"],"names":["name","props","value","type","default","min","max","step","disabled","rowData","clickTime","data","inputValue","addStaus","watch","created","methods","_calcValue","uni","title","icon","setTimeout","that","_getDecimalScale","scale","_onBlur"],"mappings":";;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAuI;AACvI;AACkE;AACL;AACsC;;;AAGnG;AACqL;AACrL,gBAAgB,0LAAU;AAC1B,EAAE,oFAAM;AACR,EAAE,qGAAM;AACR,EAAE,8GAAe;AACjB;AACA;AACA;AACA;AACA;AACA,EAAE,yGAAU;AACZ;AACA;;AAEA;AACe,gF;;;;;;;;;;;;ACvBf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;;;;;;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;ACRA;AAAA;AAAA;AAAA;AAAwrB,CAAgB,yrBAAG,EAAC,C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBCa5sB;EACAA;EACAC;IACAC;MACAC;MACAC;IACA;IACAC;MACAF;MACAC;IACA;IACAE;MACAH;MACAC;IACA;IACAG;MACAJ;MACAC;IACA;IACAI;MACAL;MACAC;IACA;IACAK;MACAN;MACAC;QACA;MACA;IACA;IACAM;MACAP;MACAC;IACA;EAEA;EACAO;IACA;MACAC;MACAC;IACA;EACA;EACAC;IACAZ;MACA;IACA;IACAU;MACA;QACA;MAAA;MAEA;;AAEA;IACA;EACA;EACAG;IACA;EACA;EACAC;IACAC;MACA;MACA;QACA;MACA;MAEA;MACA;MACA;MAGA;QACA;QACAf;QACA;UACA;QACA;QACA;UACAA;QACA;MACA;QACA;UACAgB;YACAC;YACAC;UACA;UACA;QACA;QACA;QACA;UACA;YACA;UACA;YACA;YACAC;cACAC;YACA;UACA;QACA;QACApB;QACA;UACA;QACA;QACA;UACAA;QACA;MACA;MAEA;MACA;IACA;IACAqB;MACA;MACA;MACA;QACAC;MACA;MACA;IACA;IACAC;MACA;MACA;QACA;QACA;MACA;MACAvB;MACA;QACAA;MACA;QACAA;MACA;MACA;IACA;EACA;AACA;AAAA,4B;;;;;;;;;;;;;ACjJA;AAAA;AAAA;AAAA;AAA2zC,CAAgB,ovCAAG,EAAC,C;;;;;;;;;;;ACA/0C;AACA,OAAO,KAAU,EAAE,kBAKd","file":"components/uni-number-box/uni-number-box.js","sourcesContent":["import { render, staticRenderFns, recyclableRender, components } from \"./uni-number-box.vue?vue&type=template&id=15947278&scoped=true&\"\nvar renderjs\nimport script from \"./uni-number-box.vue?vue&type=script&lang=js&\"\nexport * from \"./uni-number-box.vue?vue&type=script&lang=js&\"\nimport style0 from \"./uni-number-box.vue?vue&type=style&index=0&id=15947278&lang=scss&scoped=true&\"\n\n\n/* normalize component */\nimport normalizer from \"!F:\\\\软件\\\\HBuilder X\\\\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 \"15947278\",\n null,\n false,\n components,\n renderjs\n)\n\ncomponent.options.__file = \"components/uni-number-box/uni-number-box.vue\"\nexport default component.exports","export * from \"-!F:\\\\软件\\\\HBuilder X\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\vue-loader\\\\lib\\\\loaders\\\\templateLoader.js??vue-loader-options!F:\\\\软件\\\\HBuilder X\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\webpack-preprocess-loader\\\\index.js??ref--17-0!F:\\\\软件\\\\HBuilder X\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\webpack-uni-mp-loader\\\\lib\\\\template.js!F:\\\\软件\\\\HBuilder X\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\webpack-uni-app-loader\\\\page-meta.js!F:\\\\软件\\\\HBuilder X\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\vue-loader\\\\lib\\\\index.js??vue-loader-options!F:\\\\软件\\\\HBuilder X\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\webpack-uni-mp-loader\\\\lib\\\\style.js!./uni-number-box.vue?vue&type=template&id=15947278&scoped=true&\"","var components\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 \"-!F:\\\\软件\\\\HBuilder X\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\babel-loader\\\\lib\\\\index.js!F:\\\\软件\\\\HBuilder X\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\webpack-preprocess-loader\\\\index.js??ref--13-1!F:\\\\软件\\\\HBuilder X\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\webpack-uni-mp-loader\\\\lib\\\\script.js!F:\\\\软件\\\\HBuilder X\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\vue-loader\\\\lib\\\\index.js??vue-loader-options!F:\\\\软件\\\\HBuilder X\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\webpack-uni-mp-loader\\\\lib\\\\style.js!./uni-number-box.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!F:\\\\软件\\\\HBuilder X\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\babel-loader\\\\lib\\\\index.js!F:\\\\软件\\\\HBuilder X\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\webpack-preprocess-loader\\\\index.js??ref--13-1!F:\\\\软件\\\\HBuilder X\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\webpack-uni-mp-loader\\\\lib\\\\script.js!F:\\\\软件\\\\HBuilder X\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\vue-loader\\\\lib\\\\index.js??vue-loader-options!F:\\\\软件\\\\HBuilder X\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\webpack-uni-mp-loader\\\\lib\\\\style.js!./uni-number-box.vue?vue&type=script&lang=js&\"","<template>\r\n\t<view class=\"hx-numbox\">\r\n\t\t<view @click=\"_calcValue('minus')\" class=\"hx-numbox__minus\" v-if=\"inputValue>0\">\r\n\t\t\t<text class=\"hx-numbox--text\" :class=\"{ 'hx-numbox--disabled': inputValue <= min || disabled }\">-</text>\r\n\t\t</view>\r\n\t\t<input :disabled=\"true\" @blur=\"_onBlur\" class=\"hx-numbox__value\" type=\"number\" v-model=\"inputValue\" v-if=\"inputValue>0\"/>\r\n\t\t\r\n\t\t<view @click=\"_calcValue('plus')\" class=\"hx-numbox__plus\" >\r\n\t\t\t<text class=\"hx-numbox--text\" :class=\"{ 'hx-numbox--disabled': inputValue >= max || disabled }\">+</text>\r\n\t\t</view>\r\n\t</view>\r\n</template>\r\n<script>\r\n\texport default {\r\n\t\tname: \"hxNumberBox\",\r\n\t\tprops: {\r\n\t\t\tvalue: {\r\n\t\t\t\ttype: [Number, String],\r\n\t\t\t\tdefault: 0\r\n\t\t\t},\r\n\t\t\tmin: {\r\n\t\t\t\ttype: Number,\r\n\t\t\t\tdefault: 0\r\n\t\t\t},\r\n\t\t\tmax: {\r\n\t\t\t\ttype: Number,\r\n\t\t\t\tdefault: 100\r\n\t\t\t},\r\n\t\t\tstep: {\r\n\t\t\t\ttype: Number,\r\n\t\t\t\tdefault: 1\r\n\t\t\t},\r\n\t\t\tdisabled: {\r\n\t\t\t\ttype: Boolean,\r\n\t\t\t\tdefault: false\r\n\t\t\t},\r\n\t\t\trowData: {\r\n\t\t\t\ttype: Object,\r\n\t\t\t\tdefault: ()=>{\r\n\t\t\t\t\treturn {}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tclickTime: {\r\n\t\t\t\ttype: Number,\r\n\t\t\t\tdefault: 0\r\n\t\t\t}\r\n\t\t\t\r\n\t\t},\r\n\t\tdata() {\r\n\t\t\treturn {\r\n\t\t\t\tinputValue: 0,\r\n\t\t\t\taddStaus: true,\r\n\t\t\t};\r\n\t\t},\r\n\t\twatch: {\r\n\t\t\tvalue(val) {\r\n\t\t\t\tthis.inputValue = +val;\r\n\t\t\t},\r\n\t\t\tinputValue(newVal, oldVal) {\r\n\t\t\t\tif (+newVal !== +oldVal) {\r\n\t\t\t\t\t//this.$emit(\"change\", newVal,this.rowData);\r\n\t\t\t\t}\r\n\t\t\t\t/* if(+newVal > +oldVal){\r\n\t\t\t\t\t\r\n\t\t\t\t} */\r\n\t\t\t}\r\n\t\t},\r\n\t\tcreated() {\r\n\t\t\tthis.inputValue = +this.value;\r\n\t\t},\r\n\t\tmethods: {\r\n\t\t\t_calcValue(type) {\r\n\t\t\t\tlet that = this;\r\n\t\t\t\tif (this.disabled) {\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\r\n\t\t\t\tconst scale = this._getDecimalScale();\r\n\t\t\t\tlet value = this.inputValue * scale;\r\n\t\t\t\tlet step = this.step * scale;\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\tif (type === \"minus\") {\r\n\t\t\t\t\tthis.$emit(\"lessChange\", this.inputValue,this.rowData);\r\n\t\t\t\t\tvalue -= step;\r\n\t\t\t\t\tif (value < this.min) {\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(value > this.max){\r\n\t\t\t\t\t\tvalue = this.max\r\n\t\t\t\t\t}\r\n\t\t\t\t} else if (type === \"plus\") {\r\n\t\t\t\t\tif(that.rowData.num>=that.rowData.kcnum){\r\n\t\t\t\t\t\tuni.showToast({\r\n\t\t\t\t\t\t\ttitle:'库存不足!',\r\n\t\t\t\t\t\t\ticon:'none'\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.$emit(\"addChange\", this.inputValue,this.rowData);\r\n\t\t\t\t\tif(that.clickTime > 0){\r\n\t\t\t\t\t\tif(!this.addStaus){\r\n\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\tthis.addStaus = false;\r\n\t\t\t\t\t\t\tsetTimeout(()=>{\r\n\t\t\t\t\t\t\t\tthat.addStaus = true;\r\n\t\t\t\t\t\t\t},that.clickTime)\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tvalue += step;\r\n\t\t\t\t\tif (value > this.max) {\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(value < this.min){\r\n\t\t\t\t\t\tvalue = this.min\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis.inputValue = String(value / scale);\r\n\t\t\t\tthis.$emit(\"change\", this.inputValue,this.rowData);\r\n\t\t\t},\r\n\t\t\t_getDecimalScale() {\r\n\t\t\t\tlet scale = 1;\r\n\t\t\t\t// 浮点型\r\n\t\t\t\tif (~~this.step !== this.step) {\r\n\t\t\t\t\tscale = Math.pow(10, (this.step + \"\").split(\".\")[1].length);\r\n\t\t\t\t}\r\n\t\t\t\treturn scale;\r\n\t\t\t},\r\n\t\t\t_onBlur(event) {\r\n\t\t\t\tlet value = event.detail.value;\r\n\t\t\t\tif (!value) {\r\n\t\t\t\t\t// this.inputValue = 0;\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\tvalue = +value;\r\n\t\t\t\tif (value > this.max) {\r\n\t\t\t\t\tvalue = this.max;\r\n\t\t\t\t} else if (value < this.min) {\r\n\t\t\t\t\tvalue = this.min;\r\n\t\t\t\t}\r\n\t\t\t\tthis.inputValue = value;\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n</script>\r\n<style lang=\"scss\" scoped>\r\n\t$box-height: 28px;\r\n\t\r\n\t$box-line-height: 22px;\r\n\t$box-width: 28px;\r\n\r\n\t.hx-numbox {\r\n\t\t/* #ifndef APP-NVUE */\r\n\t\tdisplay: flex;\r\n\t\t/* #endif */\r\n\t\tflex-direction: row;\r\n\t\theight: $box-height;\r\n\t\tline-height: $box-height;\r\n\t\twidth: 85px;\r\n\t\tjustify-content: flex-end;\r\n\t}\r\n\r\n\t.hx-numbox__value {\r\n\t\t\r\n\t\twidth: 28px;\r\n\t\theight: $box-height;\r\n\t\ttext-align: center;\r\n\t\tfont-size: $uni-font-size-lg;\r\n\t\tcolor: #222222;\r\n\t}\r\n\r\n\t.hx-numbox__minus {\r\n\t\t/* #ifndef APP-NVUE */\r\n\t\tdisplay: flex;\r\n\t\t/* #endif */\r\n\t\tflex-direction: row;\r\n\t\talign-items: center;\r\n\t\tjustify-content: center;\r\n\t\twidth: $box-width - 4;\r\n\t\theight: $box-height - 4;\r\n\t\t\r\n\t\tfont-size: 22px;\r\n\t\tcolor: $uni-text-color;\r\n\t\t\r\n\t\tbackground-color: #f8f8f8;\r\n\t\tborder-radius: 50%;\r\n\t\tborder: 2px solid #d8d8d8;\r\n\t\tcolor: #868686;\r\n\t\t\r\n\t}\r\n\r\n\t.hx-numbox__plus {\r\n\t\t/* #ifndef APP-NVUE */\r\n\t\tdisplay: flex;\r\n\t\t/* #endif */\r\n\t\tflex-direction: row;\r\n\t\talign-items: center;\r\n\t\tjustify-content: center;\r\n\t\twidth: $box-width;\r\n\t\theight: $box-height;\r\n\t\tbackground: linear-gradient(100deg, #67C979, #39A74D);\r\n\t\tfont-size: 22px;\r\n\t\tborder-radius: 50%;\r\n\t}\r\n\r\n\t.hx-numbox--text {\r\n\t\tfont-size: 40rpx;\r\n\t\tcolor: #BCBCBC;\r\n\t}\r\n\r\n\t.hx-numbox--disabled {\r\n\t\tcolor: $uni-text-color-disable;\r\n\t}\r\n</style>\r\n","import mod from \"-!F:\\\\软件\\\\HBuilder X\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\mini-css-extract-plugin\\\\dist\\\\loader.js??ref--8-oneOf-1-0!F:\\\\软件\\\\HBuilder X\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\css-loader\\\\dist\\\\cjs.js??ref--8-oneOf-1-1!F:\\\\软件\\\\HBuilder X\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\vue-loader\\\\lib\\\\loaders\\\\stylePostLoader.js!F:\\\\软件\\\\HBuilder X\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\webpack-preprocess-loader\\\\index.js??ref--8-oneOf-1-2!F:\\\\软件\\\\HBuilder X\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\postcss-loader\\\\src\\\\index.js??ref--8-oneOf-1-3!F:\\\\软件\\\\HBuilder X\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\sass-loader\\\\dist\\\\cjs.js??ref--8-oneOf-1-4!F:\\\\软件\\\\HBuilder X\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\webpack-preprocess-loader\\\\index.js??ref--8-oneOf-1-5!F:\\\\软件\\\\HBuilder X\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\vue-loader\\\\lib\\\\index.js??vue-loader-options!F:\\\\软件\\\\HBuilder X\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\webpack-uni-mp-loader\\\\lib\\\\style.js!./uni-number-box.vue?vue&type=style&index=0&id=15947278&lang=scss&scoped=true&\"; export default mod; export * from \"-!F:\\\\软件\\\\HBuilder X\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\mini-css-extract-plugin\\\\dist\\\\loader.js??ref--8-oneOf-1-0!F:\\\\软件\\\\HBuilder X\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\css-loader\\\\dist\\\\cjs.js??ref--8-oneOf-1-1!F:\\\\软件\\\\HBuilder X\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\vue-loader\\\\lib\\\\loaders\\\\stylePostLoader.js!F:\\\\软件\\\\HBuilder X\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\webpack-preprocess-loader\\\\index.js??ref--8-oneOf-1-2!F:\\\\软件\\\\HBuilder X\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\postcss-loader\\\\src\\\\index.js??ref--8-oneOf-1-3!F:\\\\软件\\\\HBuilder X\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\sass-loader\\\\dist\\\\cjs.js??ref--8-oneOf-1-4!F:\\\\软件\\\\HBuilder X\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\webpack-preprocess-loader\\\\index.js??ref--8-oneOf-1-5!F:\\\\软件\\\\HBuilder X\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\vue-loader\\\\lib\\\\index.js??vue-loader-options!F:\\\\软件\\\\HBuilder X\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\webpack-uni-mp-loader\\\\lib\\\\style.js!./uni-number-box.vue?vue&type=style&index=0&id=15947278&lang=scss&scoped=true&\"","// extracted by mini-css-extract-plugin\n if(module.hot) {\n // 1720092621297\n var cssReload = require(\"F:/软件/HBuilder X/HBuilderX/plugins/uniapp-cli/node_modules/mini-css-extract-plugin/dist/hmr/hotModuleReplacement.js\")(module.id, {\"hmr\":true,\"publicPath\":\"/\",\"locals\":false});\n module.hot.dispose(cssReload);\n module.hot.accept(undefined, cssReload);\n }\n "],"sourceRoot":""}