/*! For license information please see 233de7a0ebb1c14220632cb6761b0fe4.js.LICENSE.txt */
"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([["sub-common/233de7a0ebb1c14220632cb6761b0fe4"],{"./src/components/SelectTimePicker/index.tsx":function(e,a,t){var n=t("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js");var o=t("./node_modules/@babel/runtime/helpers/esm/objectSpread2.js");var d=t("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");var r=t("./node_modules/dayjs/dayjs.min.js");var c=t.n(r);var l=t("./node_modules/react/cjs/react.production.min.js");var u=t("./src/components/dropDown-item/index.tsx");var i=t("./src/components/filterButton/index.tsx");var s=t("./src/components/iconfont/iconfont.tsx");var m=t("./src/components/timePickerPopup/index.tsx");var v=t("./src/components/SelectTimePicker/index.module.scss");var f=t("./node_modules/react/cjs/react-jsx-runtime.production.min.js");var Y={0:{name:"全部",date_min:"",date_max:""},1:{name:"今天",date_min:"".concat(c()(new Date).add(0,"day").format("YYYY-MM-DD")," 00:00:00"),date_max:"".concat(c()(new Date).add(1,"day").format("YYYY-MM-DD")," 00:00:00")},2:{name:"昨日",date_min:"".concat(c()(new Date).add(-1,"day").format("YYYY-MM-DD")," 00:00:00"),date_max:"".concat(c()(new Date).add(0,"day").format("YYYY-MM-DD")," 00:00:00")},3:{name:"近7日",date_min:"".concat(c()(new Date).add(-7,"day").format("YYYY-MM-DD")," 00:00:00"),date_max:"".concat(c()(new Date).add(0,"day").format("YYYY-MM-DD")," 00:00:00")},4:{name:"近30日",date_min:"".concat(c()(new Date).add(-30,"day").format("YYYY-MM-DD")," 00:00:00"),date_max:"".concat(c()(new Date).add(0,"day").format("YYYY-MM-DD")," 00:00:00")},5:{name:"近90日",date_min:"".concat(c()(new Date).add(-90,"day").format("YYYY-MM-DD")," 00:00:00"),date_max:"".concat(c()(new Date).add(0,"day").format("YYYY-MM-DD")," 00:00:00")},custom:{name:"自定义时间",date_min:"",date_max:""}};var p=function SelectTimePicker(e,a){var t=e.onChange,r=e.onCloseOverlay,p=e.defaultValue,D=p===void 0?"0":p,x=e.timeOptions,w=x===void 0?Y:x;var M=(0,l.useRef)((0,o["default"])((0,o["default"])({},w),{},{custom:Y.custom}));M.current=(0,o["default"])((0,o["default"])({},w),{},{custom:Y.custom});var j=(0,l.useState)(D),_=(0,n["default"])(j,2),h=_[0],y=_[1];var b=(0,l.useState)({start:(new Date).toLocaleDateString(),end:""}),k=(0,n["default"])(b,2),C=k[0],P=k[1];var S=(0,l.useState)(false),T=(0,n["default"])(S,2),g=T[0],O=T[1];var R=function handClose(){O(false)};var A=(0,l.useRef)("自定义时间");var B=function handleClick(e){y(e);t===null||t===void 0?void 0:t([M.current[e].date_min,M.current[e].date_max]);A.current="自定义时间"};var F=function onSelectDate(e,a){var n,o,d,r,l,u,i,s;console.log(e===null||e===void 0?void 0:e.value,"event?.value?.start");P({start:e===null||e===void 0?void 0:(n=e.value)===null||n===void 0?void 0:n.start,end:a?e===null||e===void 0?void 0:(o=e.value)===null||o===void 0?void 0:o.start:e===null||e===void 0?void 0:(d=e.value)===null||d===void 0?void 0:d.end});O(false);A.current="".concat(c()(e===null||e===void 0?void 0:(r=e.value)===null||r===void 0?void 0:r.start).format("YYYY年MM月DD日")," 至 ").concat(c()(a?e===null||e===void 0?void 0:(l=e.value)===null||l===void 0?void 0:l.start:e===null||e===void 0?void 0:(u=e.value)===null||u===void 0?void 0:u.end).format("YYYY年MM月DD日"));t===null||t===void 0?void 0:t([e===null||e===void 0?void 0:(i=e.value)===null||i===void 0?void 0:i.start,e===null||e===void 0?void 0:(s=e.value)===null||s===void 0?void 0:s.end])};var J=function handleCustomTime(){y("custom");O(true)};var N=(0,l.useRef)(null);(0,l.useImperativeHandle)(a,(function(){return{show:N.current.show,showPopup:N.current.showPopup,closePopup:N.current.closePopup}}),[N.current]);return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(u["default"],{title:h==="0"?"查询日期":M.current[h].name,direction:"down",value:h,activeColor:"#337fff",ref:N,onCloseOverlay:r,children:(0,f.jsxs)(d.View,{className:v["default"].grid,style:{paddingBottom:"24rpx"},children:[Object.entries(M.current).slice(0,-1).map((function(e,a){var t=(0,n["default"])(e,2),o=t[0],d=t[1];return(0,f.jsx)(i["default"],{circle:true,isActive:o===h,onClick:function onClick(){return B(o)},children:d.name},a)})),(0,f.jsxs)(i["default"],{circle:true,customClassName:v["default"].customFilterTime,isActive:h==="custom",onClick:J,children:[(0,f.jsx)(d.Text,{children:A.current}),(0,f.jsx)(s["default"],{name:"icon-chakanquanbukehu",color:h==="custom"?"#3983ff":"#7f7f7f"})]})]})}),(0,f.jsx)(m["default"],{start:C.start,end:C.end,showTime:g,closePopup:R,onSelectDate:F})]})};a["default"]=(0,l.memo)((0,l.forwardRef)(p))}}]);