"use strict";(wx.webpackJsonp=wx.webpackJsonp||[]).push([[6853],{9552:function(e,n,r){var t=r(2180),l=r(3433),o=r(4165),c=r(5861),a=r(1413),i=r(9439),u=r(1515),s=r(2954),d=r.n(s),_=r(7294),m=r(4184),x=r.n(m),p="index-module__main___TpODG",h="index-module__search___w08mN",f="index-module__search__cancel___Kr9Nr",g="index-module__context___TuJU9",b="index-module__bottomBar___thxB7",v="index-module__bottomBar__button___AgX3M",C="index-module__colorCard___i4qz1",Z="index-module__colorCard__image___Z8Sl3",j="index-module__colorCard__title___fBQxW",S="index-module__colorCard__code___V75tx",N="index-module__colorCard__content___CuXy1",k="index-module__addButton___Zn6Hq",y="index-module__imageTag___NKkCZ",G="index-module__collection_con___n2IoA",w="index-module__header___qpWBB",z="index-module__title___UXAQI",B="index-module__sub_title___KUDuP",A="index-module__productList___pE2IG",I="index-module__item___7RPdO",R="index-module__item_color___oPTYG",L="index-module__item_name____M7xl",T="index-module__popup_bottom___Vbqak",D="index-module__productColorActive___Jbc9o",E="index-module__activeIcon___hLEJg",P=r(4489),J=r(9742),O=r(2997),W="index-module__labAndImg_main___nk5zi",F="index-module__boxColor____iFPh",M="index-module__labAndImg_image___h5aD3",U="index-module__labAndImg_name___JWldn",q=r(4812),K=r(5893),X=function LabAndImg(e){var n=e.value,r=e.onClick,t=e.showStatus,l=void 0!==t&&t,o=e.round,c=void 0!==o&&o,s=e.name,d=void 0===s?"":s,m=e.customImageStyle,x=void 0===m?{}:m,p=(0,_.useState)(""),h=(0,i.Z)(p,2),f=h[0],g=h[1],b=(0,_.useMemo)((function(){var e,r,t;return null!=n&&n.lab&&(null!=n&&n.lab.l||null!=n&&n.lab.a||null!=n&&n.lab.b)?{backgroundColor:"rgb(".concat(null===(e=n.rgb)||void 0===e?void 0:e.r," ").concat(null===(r=n.rgb)||void 0===r?void 0:r.g," ").concat(null===(t=n.rgb)||void 0===t?void 0:t.b,")")}:null}),[n]);(0,_.useEffect)((function(){if(null!=n&&n.texture_url){var e=n.texture_url.split(",").map((function(e){return(0,q.z)(e)}));g((function(){return e[0]}))}}),[n]);var v=(0,_.useState)(!1),C=(0,i.Z)(v,2),Z=C[0],j=C[1],S=(0,_.useCallback)((function(){j(!1)}),[]);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(u.G7,{className:W,style:{borderRadius:c?"50%":""},onClick:function onShowLabAndImg(e){if(null==r||r(n),!l)return!1;j(!0)},children:[n.texture_url&&(0,K.jsx)(u.Ee,{lazyLoad:!0,mode:"aspectFill",src:f,onError:function onError(e){return function checkLoad(e){g((function(){return(0,q.z)("")}))}()},className:M,style:(0,a.Z)({borderRadius:c?"50%":""},x)}),!n.texture_url&&b&&(0,K.jsx)(u.G7,{className:F,style:(0,a.Z)((0,a.Z)({},b),{},{borderRadius:c?"50%":""},x)}),!n.texture_url&&!b&&(0,K.jsx)(u.Ee,{mode:"aspectFill",src:(0,q.z)(""),className:M,style:(0,a.Z)({borderRadius:c?"50%":""},x),lazyLoad:!0}),d&&(0,K.jsx)(u.G7,{className:U,children:d})]}),(0,K.jsx)(O.Z,{value:n,show:Z,onClose:S})]})},$=(0,_.memo)(X),H=r(9579),Q=r(9335),V=r(7227),Y=r(1115),ee=r(5989),ne=r(6028),re=r(146),te=r(8939),le=function SampleCuttingList(){var e,n=(0,s.useRouter)(),r=null==n||null===(e=n.params)||void 0===e?void 0:e.isAddSampleCutIdList,t=(0,re.jW)(),m=t.fetchData,O=t.state,W=(0,_.useState)({list:[],total:0}),F=(0,i.Z)(W,2),M=F[0],U=F[1],X=(0,_.useRef)([]),le=(0,V.Ds)((function(e){console.log("search",e),se((function(n){return(0,a.Z)((0,a.Z)({},n),{},{product_code_and_name:e,page:1,size:10})}))}),300),oe=!1,ce=(0,_.useCallback)((function(e){return{lab:null==e?void 0:e.lab,rgb:null==e?void 0:e.rgb,texture_url:null==e?void 0:e.texture_url}}),[]),ae=(0,_.useState)({product_code_and_name:"",product_ids:"",page:1,size:10}),ie=(0,i.Z)(ae,2),ue=ie[0],se=ie[1],de=function(){var e=(0,c.Z)((0,o.Z)().mark((function _callee(){var e;return(0,o.Z)().wrap((function _callee$(n){for(;;)switch(n.prev=n.next){case 0:return console.log("searchField==>",ue),n.next=3,m((0,V.mB)(ue));case 3:if((e=n.sent).success){n.next=6;break}return n.abrupt("return",Y.Z9.error(e.msg));case 6:U({list:e.data.list,total:e.data.total}),he(!1);case 8:case"end":return n.stop()}}),_callee)})));return function getData(){return e.apply(this,arguments)}}();(0,_.useEffect)((function(){de()}),[ue]),(0,s.useDidShow)((function(){var e=d().getStorageSync("sampleCuttingCache");e&&(X.current=JSON.parse(e)),r&&(console.log("isAdd",r),se((function(e){return(0,a.Z)((0,a.Z)({},e),{},{product_ids:r})})))}));var _e=(0,_.useRef)({size:ue.size,page:ue.page}),me=(0,_.useState)(!1),xe=(0,i.Z)(me,2),pe=xe[0],he=xe[1],fe=function(){var e=(0,c.Z)((0,o.Z)().mark((function _callee2(){return(0,o.Z)().wrap((function _callee2$(e){for(;;)switch(e.prev=e.next){case 0:_e.current.page=1,he(!0),se((function(e){return(0,a.Z)((0,a.Z)({},e),{},{size:10})}));case 3:case"end":return e.stop()}}),_callee2)})));return function getRefresherRefresh(){return e.apply(this,arguments)}}(),ge=(0,_.useMemo)((function(){return(0,V.rA)({list:M.list,total:M.total,status:O.loading})}),[M,O.loading]),be=(0,_.useCallback)((function(){if(M.list.length",X.current),ke(!1),Le([])},Ge=(0,_.useState)([]),we=(0,i.Z)(Ge,2),ze=we[0],Be=we[1],Ae=(0,_.useState)([]),Ie=(0,i.Z)(Ae,2),Re=Ie[0],Le=Ie[1];return(0,K.jsxs)(u.G7,{className:p,children:[(0,K.jsx)(u.G7,{className:h,children:(0,K.jsx)(P.Z,{placeholder:"请输入搜索面料剪样",showBtn:!1,changeOnSearch:le,children:(0,K.jsx)(u.G7,{className:f,onClick:function handleCancel(){d().navigateBack()},children:"取消"})})}),(0,K.jsx)(u.G7,{className:g,children:(0,K.jsx)(Q.Z,{statusMore:ge,selfonScrollToLower:be,refresherEnabled:!0,refresherTriggered:pe,selfOnRefresherRefresh:fe,safeAreaInsetBottom:!1,children:M.list.map((function(e){var n;return(0,K.jsx)(u.G7,{style:{padding:"0 16px",backgroundColor:"white"},children:(0,K.jsxs)(u.G7,{className:C,children:[(0,K.jsx)(u.G7,{style:{minWidth:"24%"},children:(0,K.jsxs)(u.G7,{className:Z,children:[(0,K.jsx)($,{value:ce(e)}),e.is_multiple_product?(0,K.jsx)(u.G7,{className:y,children:"24色"}):null]})}),(0,K.jsxs)(u.G7,{className:N,children:[(0,K.jsx)(u.G7,{className:j,children:(0,q.W7)(e.code,e.name)}),(0,K.jsxs)(u.G7,{className:S,children:[(0,K.jsx)(H.Z,{customStyle:{marginRight:"5px",marginBottom:"2px",padding:"5px",background:"#e3ecff",color:"#558cff",borderColor:"#e3ecff"},size:"small",circle:!0,children:e.width}),(0,K.jsx)(H.Z,{customStyle:{marginRight:"5px",marginBottom:"2px",padding:"5px",background:"#e3ecff",color:"#558cff",borderColor:"#e3ecff"},size:"small",circle:!0,children:e.weight_density})]}),(0,K.jsx)(u.G7,{className:S,children:e.component})]}),(0,K.jsx)(u.G7,{className:k,children:(0,K.jsx)(J.Z,{type:"primary",size:"small",customStyles:{padding:"0 40rpx"},plain:!0,round:!0,onClick:function onClick(){return Ze(e)},children:null!==(n=X.current.find((function(n){return n.product_id===e.id})))&&void 0!==n&&n.multipleSelection.length?"继续添加":"添加"})})]})},e.id)}))})}),(0,K.jsx)(u.G7,{className:b,children:(0,K.jsx)(J.Z,{customClassName:v,type:"primary",round:!0,disabled:0===X.current.length,onClick:function handleSubmit(){d().setStorageSync("sampleCuttingCache",JSON.stringify(X.current)),null!=n&&n.params.isGoBack?(oe=!0,d().navigateBack({delta:1})):(oe=!0,(0,Y.jD)("/pages/sampleCutting/addSampleCutting/index",null,"redirectTo"))},children:X.current.length?"确认(已选 ".concat(X.current.length," 个)"):"确认"})}),(0,K.jsxs)(ee.Z,{show:Ne,onClose:ye,showTitle:!1,children:[(0,K.jsxs)(u.G7,{className:G,children:[(0,K.jsxs)(u.G7,{className:w,children:[(0,K.jsxs)(u.G7,{className:z,children:[(0,q.W7)(Ce.current.code,Ce.current.name),"( ",ze.length," )"]}),(0,K.jsx)(u.G7,{className:B,children:"剪样大小为A4,大约22cm*30cm"})]}),ze.length?(0,K.jsx)(u.pf,{scrollY:!0,style:{flex:"1 1 auto",overflow:"hidden",maxHeight:"60vh"},children:(0,K.jsx)(u.G7,{className:A,children:null==ze?void 0:ze.map((function(e,n){var r=Re.some((function(n){return n.product_color_id===e.product_color_id}));return(0,K.jsxs)(u.G7,{className:I,onClick:function onClick(){return function handleClickProductColor(e){var n=Re.findIndex((function(n){return n.product_color_id===e.product_color_id}));console.log(n,Re),Le(-1!==n?function(e){return e.splice(n,1),(0,l.Z)(e)}:function(n){return[].concat((0,l.Z)(n),[{product_color_id:e.product_color_id,product_color_code:e.product_color_code,product_color_name:e.product_color_name,lab:e.lab,rgb:e.rgb,texture_url:e.texture_url,count:1}])})}(e)},children:[(0,K.jsxs)(u.G7,{className:x()(R,r?D:null),children:[r?(0,K.jsx)(u.G7,{className:E,children:(0,K.jsx)(ne.Z,{name:"icon-xuanzhongyanse",size:32})}):null,(0,K.jsx)($,{value:e,round:!0,name:(0,q.ZK)(e.product_color_code)})]}),(0,K.jsx)(u.G7,{className:L,children:e.product_color_name})]},n)}))})}):(0,K.jsx)(te.Z,{text:"暂无数据"})]}),(0,K.jsxs)(u.G7,{className:x()(b,T),children:[(0,K.jsx)(J.Z,{customClassName:v,type:"primary",round:!0,plain:!0,customStyles:{width:"48%"},onClick:ye,children:"取消"}),(0,K.jsxs)(J.Z,{customClassName:v,type:"primary",round:!0,customStyles:{width:"48%"},disabled:0===Re.length,onClick:function handleAddProduct(){var e=X.current.findIndex((function(e){return e.product_id===Ce.current.id}));-1!==e?X.current[e].multipleSelection=Re:X.current.push({product_id:Ce.current.id,product_code_and_name:(0,q.W7)(Ce.current.code,Ce.current.name),multipleSelection:Re}),ke(!1),Le([])},children:["领取剪样(",Re.length,")"]})]})]})]})};Page((0,t.createPageConfig)(le,"pages/sampleCutting/sampleCuttingList/index",{root:{cn:[]}},{navigationBarTitleText:"添加剪样"}||{}))}},function(e){e.O(0,[2107,1216,8592],(function(){return n=9552,e(e.s=n);var n}));e.O()}]);