2 lines
17 KiB
JavaScript
Vendored
2 lines
17 KiB
JavaScript
Vendored
(self["webpackChunkerp"]=self["webpackChunkerp"]||[]).push([[990],{9651:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return m}});var a=function(){var t=this,e=t._self._c;return e("div",[e("div",{staticClass:"cardBox"},[e("div",{staticClass:"searchBox"},[e("div",{staticClass:"row",staticStyle:{width:"100%"}},[e("span",[t._v("统计时间:")]),e("el-select",{staticStyle:{width:"100px","margin-right":"5px"},on:{change:t.changeTimeType},model:{value:t.time_type,callback:function(e){t.time_type=e},expression:"time_type"}},t._l(t.timeTypeList,(function(t){return e("el-option",{key:t.value,attrs:{label:t.label,value:t.value}})})),1),"week"==t.time_type||"seven"==t.time_type||"thirty"==t.time_type?e("el-date-picker",{attrs:{clearable:!1,type:"date",placeholder:"选择日期",format:"yyyy-MM-dd","value-format":"yyyy-MM-dd"},on:{change:t.changeDayTime},model:{value:t.dayValue,callback:function(e){t.dayValue=e},expression:"dayValue"}}):"month"==t.time_type?e("el-date-picker",{attrs:{type:"month",clearable:!1,format:"yyyy-MM","value-format":"yyyy-MM",placeholder:"选择月"},on:{change:t.changeMonthTime},model:{value:t.monthValue,callback:function(e){t.monthValue=e},expression:"monthValue"}}):"custom"==t.time_type?e("el-date-picker",{staticStyle:{width:"250px"},attrs:{type:"datetimerange","range-separator":"-","start-placeholder":"开始时间","end-placeholder":"结束时间",format:"yyyy-MM-dd","value-format":"yyyy-MM-dd",clearable:!1},on:{change:t.changeCustomTime},model:{value:t.customValue,callback:function(e){t.customValue=e},expression:"customValue"}}):"day"==t.time_type?e("el-time-picker",{staticStyle:{width:"200px"},attrs:{"is-range":"","value-format":"HH:mm:ss",format:"HH:mm:ss","range-separator":"至",clearable:!1,"start-placeholder":"开始时间","end-placeholder":"结束时间",placeholder:"选择时间范围"},on:{change:t.changeTimePicker},model:{value:t.dayTimeList,callback:function(e){t.dayTimeList=e},expression:"dayTimeList"}}):t._e(),e("div",{staticClass:"time"},[e("span",[t._v("当前统计时间:")]),t.startTime==t.endTime?e("span",[t._v(t._s(t.startTime))]):e("span",[t._v(t._s(t.startTime)+"~"+t._s(t.endTime))])])],1),e("div",{staticClass:"row"},[e("span",[t._v("规格:")]),e("el-select",{attrs:{filterable:"",remote:"",clearable:"","reserve-keyword":"",placeholder:"请选择具体规格","remote-method":t.remoteMethod,loading:t.remoteLoading},model:{value:t.sku_id,callback:function(e){t.sku_id=e},expression:"sku_id"}},t._l(t.skusList,(function(t){return e("el-option",{key:t.id,attrs:{label:t.title,value:t.id}})})),1)],1),e("div",{staticClass:"row"},[e("el-button",{attrs:{type:"primary",icon:"el-icon-search"},on:{click:function(e){return t.handleSearch()}}},[t._v("筛选")])],1)])]),e("el-card",[e("div",{staticClass:"opaBox"},[e("el-button",{attrs:{type:"success",icon:"el-icon-download",loading:t.downloadLoading},on:{click:t.handleExport}},[t._v("导出")])],1),e("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}],attrs:{border:"",data:t.saleList}},[e("el-table-column",{attrs:{label:"类型名称",prop:"type_name"}}),e("el-table-column",{attrs:{label:"库存",prop:"stock"}}),e("el-table-column",{attrs:{label:"可售库存",prop:"sale_stock"}}),"day"==t.time_type?e("el-table-column",{attrs:{label:"已发货数",prop:"shipping_num"}}):t._e(),"day"==t.time_type?e("el-table-column",{attrs:{label:"未发货数",prop:"unshipping_num"}}):t._e(),e("el-table-column",{attrs:{label:"总销量",prop:"goods_total"}}),e("el-table-column",{attrs:{label:"总销售金额",prop:"goods_total_amount"}})],1)],1)],1)},n=[],s=i(1808),r=i(9036),o=i(7484),u=i.n(o),l={data(){return{loading:!1,time_type:"day",timeTypeList:[{label:"今日",value:"day"},{label:"自然周",value:"week"},{label:"自然月",value:"month"},{label:"近7天",value:"seven"},{label:"近30天",value:"thirty"},{label:"自定义",value:"custom"}],TIMETYPE:{day:"今日",week:"自然周",month:"自然月",seven:"近7天",thirty:"近30天",custom:"自定义"},dayValue:"",monthValue:"",customValue:[],startTime:"",endTime:"",saleList:[],downloadLoading:!1,autoWidth:!0,bookType:"xlsx",dayTimeList:[],sku_id:"",skusList:[],remoteLoading:!1}},mounted(){this.getInitList()},methods:{getInitList(){let t=this.getDayTime();this.startTime=t+" 00:00:00",this.endTime=t+" 23:59:59",this.dayTimeList=["00:00:00","23:59:59"],this.fetchData()},changeTimeType(){if("day"==this.time_type){let t=this.getDayTime();this.startTime=t+" 00:00:00",this.endTime=t+" 23:59:59",this.dayTimeList=["00:00:00","23:59:59"]}else"week"==this.time_type?(this.dayValue=this.endTime=u()().format("YYYY-MM-DD"),this.startTime=u()(this.getFirstDay(this.dayValue)).format("YYYY-MM-DD")):"month"==this.time_type?(this.monthValue=u()().format("YYYY-MM"),this.startTime=this.monthValue+"-01",this.endTime=this.monthValue+"-"+this.getDaysInMonth(this.monthValue)):"seven"==this.time_type?(this.dayValue=this.endTime=u()().format("YYYY-MM-DD"),this.startTime=u()().subtract(7,"day").format("YYYY-MM-DD")):"thirty"==this.time_type?(this.dayValue=this.endTime=u()().format("YYYY-MM-DD"),this.startTime=u()().subtract(30,"day").format("YYYY-MM-DD")):"custom"==this.time_type&&(this.startTime=this.endTime=u()().format("YYYY-MM-DD"),this.customValue=[this.startTime,this.startTime]);this.fetchData()},fetchData(){this.loading=!0;let t={type:"day"==this.time_type?1:2,sku_id:this.sku_id};1==t.type?(t.start_time=this.startTime,t.end_time=this.endTime):(t.start_day=this.startTime,t.end_day=this.endTime),(0,s.E0)(t).then((t=>{this.saleList=t.data.data,this.loading=!1})).catch((()=>{this.loading=!1}))},getDayTime(){let t=u()().format("YYYY-MM-DD");return t},getFirstDay(t){let e=new Date(t).getDay()||7;return new Date(new Date(t).getFullYear(),new Date(t).getMonth(),new Date(t).getDate()+1-e)},getDaysInMonth(t){let e=1*t.split("-")[0],i=1*t.split("-")[1];const a=u()(new Date(e,i-1,1)),n=a.endOf("month");return n.date()},changeDayTime(){if("day"==this.time_type){let t=this.getDayTime();this.startTime=t+" 00:00:00",this.endTime=t+" 23:59:59",this.dayTimeList=["00:00:00","23:59:59"]}else"week"==this.time_type?(this.endTime=this.dayValue,this.startTime=u()(this.getFirstDay(this.dayValue)).format("YYYY-MM-DD")):"seven"==this.time_type?(this.endTime=this.dayValue,this.startTime=u()(this.dayValue).subtract(7,"day").format("YYYY-MM-DD")):"thirty"==this.time_type&&(this.endTime=this.dayValue,this.startTime=u()(this.dayValue).subtract(30,"day").format("YYYY-MM-DD"));this.fetchData()},changeMonthTime(){this.startTime=this.monthValue+"-01",this.endTime=this.monthValue+"-"+this.getDaysInMonth(this.monthValue),this.fetchData()},changeCustomTime(){this.startTime=this.customValue[0],this.endTime=this.customValue[1],this.fetchData()},changeTimePicker(){let t=this.getDayTime();this.startTime=t+" "+this.dayTimeList[0],this.endTime=t+" "+this.dayTimeList[1],this.fetchData()},handleSearch(){this.fetchData()},handleExport(){this.saleList.length?(this.downloadLoading=!0,Promise.all([i.e(301),i.e(283)]).then(i.bind(i,6283)).then((t=>{const e=["类型名称","库存","可售库存","总销量","总销售金额"],i=["type_name","stock","sale_stock","goods_total","goods_total_amount"];"day"==this.time_type&&(e.splice(3,0,"已发货数","未发货数"),i.splice(3,0,"shipping_num","unshipping_num"));const a=this.saleList;let n=this.startTime==this.endTime?this.startTime:this.startTime+"-"+this.endTime;const s=this.formatJson(i,a);t.export_json_to_excel({header:e,data:s,filename:"sku销售统计数据【"+this.TIMETYPE[this.time_type]+n+"】",autoWidth:this.autoWidth,bookType:this.bookType}),this.downloadLoading=!1})).catch((()=>{this.downloadLoading=!1}))):this.$message({message:"暂无数据",type:"error"})},formatJson(t,e){return e.map((e=>t.map((t=>e[t]))))},remoteMethod(t){t?(this.remoteLoading=!0,(0,r.no)(t).then((t=>{this.skusList=t.data.data,this.remoteLoading=!1}))):this.skusList=[]}}},c=l,h=i(1001),d=(0,h.Z)(c,a,n,!1,null,"13a451d4",null),m=d.exports},7484:function(t){!function(e,i){t.exports=i()}(0,(function(){"use strict";var t=1e3,e=6e4,i=36e5,a="millisecond",n="second",s="minute",r="hour",o="day",u="week",l="month",c="quarter",h="year",d="date",m="Invalid Date",f=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,p=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,y={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],i=t%100;return"["+t+(e[(i-20)%10]||e[i]||e[0])+"]"}},g=function(t,e,i){var a=String(t);return!a||a.length>=e?t:""+Array(e+1-a.length).join(i)+t},_={s:g,z:function(t){var e=-t.utcOffset(),i=Math.abs(e),a=Math.floor(i/60),n=i%60;return(e<=0?"+":"-")+g(a,2,"0")+":"+g(n,2,"0")},m:function t(e,i){if(e.date()<i.date())return-t(i,e);var a=12*(i.year()-e.year())+(i.month()-e.month()),n=e.clone().add(a,l),s=i-n<0,r=e.clone().add(a+(s?-1:1),l);return+(-(a+(i-n)/(s?n-r:r-n))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:l,y:h,w:u,d:o,D:d,h:r,m:s,s:n,ms:a,Q:c}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},T="en",M={};M[T]=y;var D="$isDayjsObject",v=function(t){return t instanceof Y||!(!t||!t[D])},$=function t(e,i,a){var n;if(!e)return T;if("string"==typeof e){var s=e.toLowerCase();M[s]&&(n=s),i&&(M[s]=i,n=s);var r=e.split("-");if(!n&&r.length>1)return t(r[0])}else{var o=e.name;M[o]=e,n=o}return!a&&n&&(T=n),n||!a&&T},b=function(t,e){if(v(t))return t.clone();var i="object"==typeof e?e:{};return i.date=t,i.args=arguments,new Y(i)},k=_;k.l=$,k.i=v,k.w=function(t,e){return b(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var Y=function(){function y(t){this.$L=$(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[D]=!0}var g=y.prototype;return g.parse=function(t){this.$d=function(t){var e=t.date,i=t.utc;if(null===e)return new Date(NaN);if(k.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var a=e.match(f);if(a){var n=a[2]-1||0,s=(a[7]||"0").substring(0,3);return i?new Date(Date.UTC(a[1],n,a[3]||1,a[4]||0,a[5]||0,a[6]||0,s)):new Date(a[1],n,a[3]||1,a[4]||0,a[5]||0,a[6]||0,s)}}return new Date(e)}(t),this.init()},g.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},g.$utils=function(){return k},g.isValid=function(){return!(this.$d.toString()===m)},g.isSame=function(t,e){var i=b(t);return this.startOf(e)<=i&&i<=this.endOf(e)},g.isAfter=function(t,e){return b(t)<this.startOf(e)},g.isBefore=function(t,e){return this.endOf(e)<b(t)},g.$g=function(t,e,i){return k.u(t)?this[e]:this.set(i,t)},g.unix=function(){return Math.floor(this.valueOf()/1e3)},g.valueOf=function(){return this.$d.getTime()},g.startOf=function(t,e){var i=this,a=!!k.u(e)||e,c=k.p(t),m=function(t,e){var n=k.w(i.$u?Date.UTC(i.$y,e,t):new Date(i.$y,e,t),i);return a?n:n.endOf(o)},f=function(t,e){return k.w(i.toDate()[t].apply(i.toDate("s"),(a?[0,0,0,0]:[23,59,59,999]).slice(e)),i)},p=this.$W,y=this.$M,g=this.$D,_="set"+(this.$u?"UTC":"");switch(c){case h:return a?m(1,0):m(31,11);case l:return a?m(1,y):m(0,y+1);case u:var T=this.$locale().weekStart||0,M=(p<T?p+7:p)-T;return m(a?g-M:g+(6-M),y);case o:case d:return f(_+"Hours",0);case r:return f(_+"Minutes",1);case s:return f(_+"Seconds",2);case n:return f(_+"Milliseconds",3);default:return this.clone()}},g.endOf=function(t){return this.startOf(t,!1)},g.$set=function(t,e){var i,u=k.p(t),c="set"+(this.$u?"UTC":""),m=(i={},i[o]=c+"Date",i[d]=c+"Date",i[l]=c+"Month",i[h]=c+"FullYear",i[r]=c+"Hours",i[s]=c+"Minutes",i[n]=c+"Seconds",i[a]=c+"Milliseconds",i)[u],f=u===o?this.$D+(e-this.$W):e;if(u===l||u===h){var p=this.clone().set(d,1);p.$d[m](f),p.init(),this.$d=p.set(d,Math.min(this.$D,p.daysInMonth())).$d}else m&&this.$d[m](f);return this.init(),this},g.set=function(t,e){return this.clone().$set(t,e)},g.get=function(t){return this[k.p(t)]()},g.add=function(a,c){var d,m=this;a=Number(a);var f=k.p(c),p=function(t){var e=b(m);return k.w(e.date(e.date()+Math.round(t*a)),m)};if(f===l)return this.set(l,this.$M+a);if(f===h)return this.set(h,this.$y+a);if(f===o)return p(1);if(f===u)return p(7);var y=(d={},d[s]=e,d[r]=i,d[n]=t,d)[f]||1,g=this.$d.getTime()+a*y;return k.w(g,this)},g.subtract=function(t,e){return this.add(-1*t,e)},g.format=function(t){var e=this,i=this.$locale();if(!this.isValid())return i.invalidDate||m;var a=t||"YYYY-MM-DDTHH:mm:ssZ",n=k.z(this),s=this.$H,r=this.$m,o=this.$M,u=i.weekdays,l=i.months,c=i.meridiem,h=function(t,i,n,s){return t&&(t[i]||t(e,a))||n[i].slice(0,s)},d=function(t){return k.s(s%12||12,t,"0")},f=c||function(t,e,i){var a=t<12?"AM":"PM";return i?a.toLowerCase():a};return a.replace(p,(function(t,a){return a||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return k.s(e.$y,4,"0");case"M":return o+1;case"MM":return k.s(o+1,2,"0");case"MMM":return h(i.monthsShort,o,l,3);case"MMMM":return h(l,o);case"D":return e.$D;case"DD":return k.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(i.weekdaysMin,e.$W,u,2);case"ddd":return h(i.weekdaysShort,e.$W,u,3);case"dddd":return u[e.$W];case"H":return String(s);case"HH":return k.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return f(s,r,!0);case"A":return f(s,r,!1);case"m":return String(r);case"mm":return k.s(r,2,"0");case"s":return String(e.$s);case"ss":return k.s(e.$s,2,"0");case"SSS":return k.s(e.$ms,3,"0");case"Z":return n}return null}(t)||n.replace(":","")}))},g.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},g.diff=function(a,d,m){var f,p=this,y=k.p(d),g=b(a),_=(g.utcOffset()-this.utcOffset())*e,T=this-g,M=function(){return k.m(p,g)};switch(y){case h:f=M()/12;break;case l:f=M();break;case c:f=M()/3;break;case u:f=(T-_)/6048e5;break;case o:f=(T-_)/864e5;break;case r:f=T/i;break;case s:f=T/e;break;case n:f=T/t;break;default:f=T}return m?f:k.a(f)},g.daysInMonth=function(){return this.endOf(l).$D},g.$locale=function(){return M[this.$L]},g.locale=function(t,e){if(!t)return this.$L;var i=this.clone(),a=$(t,e,!0);return a&&(i.$L=a),i},g.clone=function(){return k.w(this.$d,this)},g.toDate=function(){return new Date(this.valueOf())},g.toJSON=function(){return this.isValid()?this.toISOString():null},g.toISOString=function(){return this.$d.toISOString()},g.toString=function(){return this.$d.toUTCString()},y}(),w=Y.prototype;return b.prototype=w,[["$ms",a],["$s",n],["$m",s],["$H",r],["$W",o],["$M",l],["$y",h],["$D",d]].forEach((function(t){w[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),b.extend=function(t,e){return t.$i||(t(e,Y,b),t.$i=!0),b},b.locale=$,b.isDayjs=v,b.unix=function(t){return b(1e3*t)},b.en=M[T],b.Ls=M,b.p={},b}))},1808:function(t,e,i){"use strict";i.d(e,{E0:function(){return r},E4:function(){return s},ei:function(){return u},sF:function(){return o},v3:function(){return n}});var a=i(8430);function n(t){return(0,a.Z)({url:"/api/data_center/sales_report",method:"get",params:t})}function s(t){return(0,a.Z)({url:"/api/data_center/sale_statistics",method:"get",params:t})}function r(t){return(0,a.Z)({url:"/api/data_center/spu_sale_statistics",method:"get",params:t})}function o(t){return(0,a.Z)({url:"/api/data_center/gmv_statistics",method:"get",params:t})}function u(t){return(0,a.Z)({url:"/api/data_center/loss_record_statistics",method:"get",params:t})}},9036:function(t,e,i){"use strict";i.d(e,{CD:function(){return _},JS:function(){return T},K1:function(){return c},NR:function(){return f},Rq:function(){return s},Vx:function(){return l},b9:function(){return M},cM:function(){return h},e3:function(){return u},gM:function(){return g},lO:function(){return n},no:function(){return y},od:function(){return d},rQ:function(){return r},sx:function(){return p},t5:function(){return o},zl:function(){return m}});var a=i(8430);function n(t){return(0,a.Z)({url:"/api/goods_skus",method:"get",params:t})}function s(t){return(0,a.Z)({url:"/api/goods",method:"post",data:t})}function r(t){return(0,a.Z)({url:`/api/goods_skus/${t}`,method:"get"})}function o(t){return(0,a.Z)({url:"/api/goods",method:"get",params:t})}function u(t,e){return(0,a.Z)({url:`/api/goods_skus/${t}`,method:"patch",data:e})}function l(t){return(0,a.Z)({url:"/api/batch/goods_skus",method:"patch",data:t})}function c(t,e){return(0,a.Z)({url:`/api/single/goods_skus/${t}`,method:"patch",data:e})}function h(t,e){return(0,a.Z)({url:"/api/upload",Headers:e,method:"post",data:t})}function d(t){return(0,a.Z)({url:"/api/goodsList",method:"get",params:t})}function m(t){return(0,a.Z)({url:"/api/goods_sku_location",method:"get",params:t})}function f(t){return(0,a.Z)({url:"/api/goodsSkusList",method:"get",params:{title:t}})}function p(){return(0,a.Z)({url:"/api/stock/goods_skus",method:"get"})}function y(t){return(0,a.Z)({url:"/api/goods/filter/"+t,method:"get"})}function g(t){return(0,a.Z)({url:"/api/goods_combination",method:"post",data:t})}function _(t){return(0,a.Z)({url:"/api/goods_combination",method:"get",params:t})}function T(t){return(0,a.Z)({url:"/api/goods_combination/"+t,method:"get"})}function M(t){return(0,a.Z)({url:"/api/batch/goods_skus",method:"patch",data:t})}}}]);
|
|
//# sourceMappingURL=990.e354f872.js.map
|