Files
supplier-dispatch-h5/node_modules/.cache/babel-loader/4e73ff04104bd4d007c0a36df954a53a4a08f2f22999f4d3409ea2163f2c2d92.json
2023-08-11 10:45:20 +08:00

1 line
11 KiB
JSON

{"ast":null,"code":"import { createNamespace } from '../utils';\nimport { RED } from '../utils/constant';\nimport { padZero } from '../utils/format/string';\nimport Checkbox from '../checkbox';\nvar _createNamespace = createNamespace('coupon'),\n createComponent = _createNamespace[0],\n bem = _createNamespace[1],\n t = _createNamespace[2];\nfunction formatTimeStamp(timeStamp) {\n // compatible when the timestamp is seconds\n if (timeStamp < Math.pow(10, 12)) {\n return timeStamp * 1000;\n }\n return +timeStamp;\n}\nfunction getDate(timeStamp) {\n var date = new Date(formatTimeStamp(timeStamp));\n return date.getFullYear() + \".\" + padZero(date.getMonth() + 1) + \".\" + padZero(date.getDate());\n}\nfunction formatDiscount(discount) {\n return (discount / 10).toFixed(discount % 10 === 0 ? 0 : 1);\n}\nfunction formatAmount(amount) {\n return (amount / 100).toFixed(amount % 100 === 0 ? 0 : amount % 10 === 0 ? 1 : 2);\n}\nexport default createComponent({\n props: {\n coupon: Object,\n chosen: Boolean,\n disabled: Boolean,\n currency: {\n type: String,\n default: '¥'\n }\n },\n computed: {\n validPeriod: function validPeriod() {\n var _this$coupon = this.coupon,\n startAt = _this$coupon.startAt,\n endAt = _this$coupon.endAt,\n customValidPeriod = _this$coupon.customValidPeriod;\n return customValidPeriod || getDate(startAt) + \" - \" + getDate(endAt);\n },\n faceAmount: function faceAmount() {\n var coupon = this.coupon;\n if (coupon.valueDesc) {\n return coupon.valueDesc + \"<span>\" + (coupon.unitDesc || '') + \"</span>\";\n }\n if (coupon.denominations) {\n var denominations = formatAmount(coupon.denominations);\n return \"<span>\" + this.currency + \"</span> \" + denominations;\n }\n if (coupon.discount) {\n return t('discount', formatDiscount(coupon.discount));\n }\n return '';\n },\n conditionMessage: function conditionMessage() {\n var condition = formatAmount(this.coupon.originCondition);\n return condition === '0' ? t('unlimited') : t('condition', condition);\n }\n },\n render: function render() {\n var h = arguments[0];\n var coupon = this.coupon,\n disabled = this.disabled;\n var description = disabled && coupon.reason || coupon.description;\n return h(\"div\", {\n \"class\": bem({\n disabled: disabled\n })\n }, [h(\"div\", {\n \"class\": bem('content')\n }, [h(\"div\", {\n \"class\": bem('head')\n }, [h(\"h2\", {\n \"class\": bem('amount'),\n \"domProps\": {\n \"innerHTML\": this.faceAmount\n }\n }), h(\"p\", {\n \"class\": bem('condition')\n }, [this.coupon.condition || this.conditionMessage])]), h(\"div\", {\n \"class\": bem('body')\n }, [h(\"p\", {\n \"class\": bem('name')\n }, [coupon.name]), h(\"p\", {\n \"class\": bem('valid')\n }, [this.validPeriod]), !this.disabled && h(Checkbox, {\n \"attrs\": {\n \"size\": 18,\n \"value\": this.chosen,\n \"checkedColor\": RED\n },\n \"class\": bem('corner')\n })])]), description && h(\"p\", {\n \"class\": bem('description')\n }, [description])]);\n }\n});","map":{"version":3,"names":["createNamespace","RED","padZero","Checkbox","_createNamespace","createComponent","bem","t","formatTimeStamp","timeStamp","Math","pow","getDate","date","Date","getFullYear","getMonth","formatDiscount","discount","toFixed","formatAmount","amount","props","coupon","Object","chosen","Boolean","disabled","currency","type","String","default","computed","validPeriod","_this$coupon","startAt","endAt","customValidPeriod","faceAmount","valueDesc","unitDesc","denominations","conditionMessage","condition","originCondition","render","h","arguments","description","reason","name"],"sources":["E:/work/sino/sino-h5/node_modules/vant/es/coupon/index.js"],"sourcesContent":["import { createNamespace } from '../utils';\nimport { RED } from '../utils/constant';\nimport { padZero } from '../utils/format/string';\nimport Checkbox from '../checkbox';\n\nvar _createNamespace = createNamespace('coupon'),\n createComponent = _createNamespace[0],\n bem = _createNamespace[1],\n t = _createNamespace[2];\n\nfunction formatTimeStamp(timeStamp) {\n // compatible when the timestamp is seconds\n if (timeStamp < Math.pow(10, 12)) {\n return timeStamp * 1000;\n }\n\n return +timeStamp;\n}\n\nfunction getDate(timeStamp) {\n var date = new Date(formatTimeStamp(timeStamp));\n return date.getFullYear() + \".\" + padZero(date.getMonth() + 1) + \".\" + padZero(date.getDate());\n}\n\nfunction formatDiscount(discount) {\n return (discount / 10).toFixed(discount % 10 === 0 ? 0 : 1);\n}\n\nfunction formatAmount(amount) {\n return (amount / 100).toFixed(amount % 100 === 0 ? 0 : amount % 10 === 0 ? 1 : 2);\n}\n\nexport default createComponent({\n props: {\n coupon: Object,\n chosen: Boolean,\n disabled: Boolean,\n currency: {\n type: String,\n default: '¥'\n }\n },\n computed: {\n validPeriod: function validPeriod() {\n var _this$coupon = this.coupon,\n startAt = _this$coupon.startAt,\n endAt = _this$coupon.endAt,\n customValidPeriod = _this$coupon.customValidPeriod;\n return customValidPeriod || getDate(startAt) + \" - \" + getDate(endAt);\n },\n faceAmount: function faceAmount() {\n var coupon = this.coupon;\n\n if (coupon.valueDesc) {\n return coupon.valueDesc + \"<span>\" + (coupon.unitDesc || '') + \"</span>\";\n }\n\n if (coupon.denominations) {\n var denominations = formatAmount(coupon.denominations);\n return \"<span>\" + this.currency + \"</span> \" + denominations;\n }\n\n if (coupon.discount) {\n return t('discount', formatDiscount(coupon.discount));\n }\n\n return '';\n },\n conditionMessage: function conditionMessage() {\n var condition = formatAmount(this.coupon.originCondition);\n return condition === '0' ? t('unlimited') : t('condition', condition);\n }\n },\n render: function render() {\n var h = arguments[0];\n var coupon = this.coupon,\n disabled = this.disabled;\n var description = disabled && coupon.reason || coupon.description;\n return h(\"div\", {\n \"class\": bem({\n disabled: disabled\n })\n }, [h(\"div\", {\n \"class\": bem('content')\n }, [h(\"div\", {\n \"class\": bem('head')\n }, [h(\"h2\", {\n \"class\": bem('amount'),\n \"domProps\": {\n \"innerHTML\": this.faceAmount\n }\n }), h(\"p\", {\n \"class\": bem('condition')\n }, [this.coupon.condition || this.conditionMessage])]), h(\"div\", {\n \"class\": bem('body')\n }, [h(\"p\", {\n \"class\": bem('name')\n }, [coupon.name]), h(\"p\", {\n \"class\": bem('valid')\n }, [this.validPeriod]), !this.disabled && h(Checkbox, {\n \"attrs\": {\n \"size\": 18,\n \"value\": this.chosen,\n \"checkedColor\": RED\n },\n \"class\": bem('corner')\n })])]), description && h(\"p\", {\n \"class\": bem('description')\n }, [description])]);\n }\n});"],"mappings":"AAAA,SAASA,eAAe,QAAQ,UAAU;AAC1C,SAASC,GAAG,QAAQ,mBAAmB;AACvC,SAASC,OAAO,QAAQ,wBAAwB;AAChD,OAAOC,QAAQ,MAAM,aAAa;AAElC,IAAIC,gBAAgB,GAAGJ,eAAe,CAAC,QAAQ,CAAC;EAC5CK,eAAe,GAAGD,gBAAgB,CAAC,CAAC,CAAC;EACrCE,GAAG,GAAGF,gBAAgB,CAAC,CAAC,CAAC;EACzBG,CAAC,GAAGH,gBAAgB,CAAC,CAAC,CAAC;AAE3B,SAASI,eAAeA,CAACC,SAAS,EAAE;EAClC;EACA,IAAIA,SAAS,GAAGC,IAAI,CAACC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE;IAChC,OAAOF,SAAS,GAAG,IAAI;EACzB;EAEA,OAAO,CAACA,SAAS;AACnB;AAEA,SAASG,OAAOA,CAACH,SAAS,EAAE;EAC1B,IAAII,IAAI,GAAG,IAAIC,IAAI,CAACN,eAAe,CAACC,SAAS,CAAC,CAAC;EAC/C,OAAOI,IAAI,CAACE,WAAW,CAAC,CAAC,GAAG,GAAG,GAAGb,OAAO,CAACW,IAAI,CAACG,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,GAAGd,OAAO,CAACW,IAAI,CAACD,OAAO,CAAC,CAAC,CAAC;AAChG;AAEA,SAASK,cAAcA,CAACC,QAAQ,EAAE;EAChC,OAAO,CAACA,QAAQ,GAAG,EAAE,EAAEC,OAAO,CAACD,QAAQ,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC7D;AAEA,SAASE,YAAYA,CAACC,MAAM,EAAE;EAC5B,OAAO,CAACA,MAAM,GAAG,GAAG,EAAEF,OAAO,CAAC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