1 line
13 KiB
JavaScript
1 line
13 KiB
JavaScript
"use strict";require("./sub-common/db6cc8fba2c34d36042a60bcf5f10485.js");require("./sub-common/510d0e7078f44d770a0720344fb06369.js");require("./sub-common/0762d0d2445fe1200cae192cedb39f4b.js");require("./sub-common/cf216475951e5960bcea5b5b9d46933b.js");require("./sub-common/b15a59e62f0de52477cd87cdc0559eda.js");require("./sub-common/3eb47fe15c5dbf2a4a5aef0734c8dda2.js");require("./sub-common/60effc84a668f58f5526ecbcbd4fa1de.js");(wx.webpackJsonp=wx.webpackJsonp||[]).push([[8079],{219:function(e,n,t){var o=t(2180),i=t(4942),l=t(1413),c=t(4165),s=t(5861),a=t(9439),r=t(2954),d=t.n(r),u=t(1515),_=t(4184),m=t.n(_),x=t(7294),h="index-module__products_item___iVZn0",f="index-module__checkbox___gclIR",p="index-module__item___GVATe",g="index-module__item_img___wQcfH",j="index-module__num___M9C72",C="index-module__item_con___IcAwW",v="index-module__title___x0MJH",N="index-module__tag_list___zIwiB",Z="index-module__tag___GDXka",k="index-module__tag_g___CuiK8",S="index-module__introduce___JN7Ns",G=t(1115),b=t(4158),w=t(6599),y=t(4456),M=t(4123),D=t(5893),z=function ProductItem(e){var n=e.item,t=e.openCheckBox,o=e.event,i=e.metaDataId,l=e.onCheckedChange,c=e.checked;return(0,D.jsxs)(u.G7,{onClick:function handleClickItem(e){e.stopPropagation(),o.trigger("updateCurrentSelection",i),t?l(i,n.product_id,!c):(0,G.jD)("/pages/details/index?id=".concat(n.product_id))},children:[(0,D.jsx)(M.Z,{direction:"horizontal",customStyles:{margin:"0"}}),(0,D.jsxs)(u.G7,{className:h,children:[t&&(0,D.jsx)(u.G7,{className:f,onClick:function noop(e){e.stopPropagation()},children:(0,D.jsx)(y.Z,{round:!0,size:"normal",status:c,onSelect:function handleSelect(){console.log(n),l(i,n.product_id,!0)},onClose:function handleClose(){l(i,n.product_id,!1)}})}),(0,D.jsxs)(u.G7,{className:p,children:[(0,D.jsxs)(u.G7,{className:g,children:[(0,D.jsx)(w.Z,{value:{lab:n.lab,rgb:n.rgb,texture_url:n.texture_url}}),(0,D.jsxs)(u.G7,{className:j,children:[n.enable_product_color_count,"色"]})]}),(0,D.jsxs)(u.G7,{className:C,children:[(0,D.jsxs)(u.G7,{className:v,children:[(0,D.jsxs)("text",{children:[(0,b.W7)(n.product_code,"")," "]}),n.product_name]}),(0,D.jsxs)(u.G7,{className:N,children:[(0,D.jsx)(u.G7,{className:Z,children:n.width}),(0,D.jsx)(u.G7,{className:k,children:n.weight_density})]}),(0,D.jsx)(u.G7,{className:S,children:n.component})]})]})]})]})},B="index-module__collection_main___wbTms",I="index-module__collection_content___kz6tl",O="index-module__search___ORpEy",A="index-module__layout___pd2Uy",T="index-module__layoutBlock___N4uIu",E="index-module__icon___fDRJx",R="index-module__content___FZQRh",J="index-module__scrollContent___lFVQ4",P="index-module__class_item___IhsAt",F="index-module__class_title___nYcAm",L="index-module__class_prefix___tl6BP",U="index-module__class_prefix_top___UYjsV",V="index-module__class_prefix_bottom___OT_ws",H="index-module__title___emrpe",Q="index-module__iconfont_show___wfUin",Y="index-module__iconfont_hide___e6sCG",q="index-module__fg___OC4gi",K="index-module__num___GwilZ",W="index-module__class_con___F1CUi",$="index-module__products_list____12cM",X="index-module__flexBox___bRNRO",ee="index-module__icon--manage--cancel___bAfYO",ne="index-module__bottomBar___vUHq8",te="index-module__bottomLeft___bFLO8",oe="index-module__bottomRight___zTAEj",ie="index-module__showBottomBar___RqUCj",le="index-module__multipleCheckbox___jj2GV",ce="index-module__multipleCheckbox__text___VX23J",se="index-module__collection_con___iKeAb",ae="index-module__collection_item___MJq3h",re="index-module__collectionImage___FKjQ1",de="index-module__text___wgxLN",ue="index-module__scrollStyle___pTlcu",_e=t(5679),me=t(7082),xe=t(6028),he=function MoveCollectionPopup(e){var n=e.show,t=void 0!==n&&n,o=e.onClose,i=e.collectionList,l=e.ids,a=e.sourceId,r=e.onSuccess,d=(0,me.Wf)().fetchData,_=function(){var e=(0,s.Z)((0,c.Z)().mark((function _callee(e){return(0,c.Z)().wrap((function _callee$(n){for(;;)switch(n.prev=n.next){case 0:if(0!=(null==l?void 0:l.length)){n.next=2;break}return n.abrupt("return",G.Z9.none("请选择要移动面料"));case 2:return n.next=4,d({source_favorite_id:a,target_favorite_id:e.id,product_id:Array.from(l)});case 4:n.sent.success?(null==o||o(),null==r||r(),G.Z9.success("移动成功")):G.Z9.error("移动失败");case 6:case"end":return n.stop()}}),_callee)})));return function handleMove(n){return e.apply(this,arguments)}}();return(0,D.jsxs)(_e.Z,{show:t,onClose:o,showTitle:!0,title:"移动收藏夹",children:[(0,D.jsx)(M.Z,{direction:"horizontal",customStyles:{marginTop:"0px",marginBottom:"12px"}}),(0,D.jsx)(u.pf,{className:ue,scrollY:!0,children:(0,D.jsxs)(u.G7,{className:se,children:[i.map((function(e,n){return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(u.G7,{className:ae,onClick:function onClick(){return _(e)},children:[(0,D.jsx)(u.G7,{className:re}),(0,D.jsx)(u.xv,{className:de,children:e.name})]},n),(0,D.jsx)(M.Z,{direction:"horizontal",customStyles:{margin:"12px 0"}})]})})),(0,D.jsxs)(u.G7,{className:ae,onClick:function handleNewCollection(){(0,G.jD)("/pages/collection/collectionDetail/index",{title:"新建收藏夹",isEdit:!1,editData:null})},children:[(0,D.jsx)(u.G7,{className:re,children:(0,D.jsx)(xe.Z,{name:"icon-xinzengshoucangjia",size:40})}),(0,D.jsx)(u.xv,{className:de,children:"新建收藏夹"})]}),(0,D.jsx)(M.Z,{direction:"horizontal",customStyles:{margin:"12px 0"}})]})})]})},fe=(0,x.memo)(he),pe=t(2711),ge=t(5795),je=t(8093),Ce=t(4408),ve=t(3856),Ne=t(519),Ze=t(9179),ke=t(1027),Se=t(2495),Ge=t(9498),be=new r.Events,we=function CollectionItem(e){var n,t,o=e.item,i=e.isManageStatus,l=e.selectId,c=e.onCheckedChange,s=e.filterChecked,r=e.checkedMap,d=(0,x.useState)(!1),_=(0,a.Z)(d,2),h=_[0],f=_[1];return(0,x.useEffect)((function(){console.log("selectId && item.id",l,o.id,i),l!==o.id&&i&&f(!1)}),[i,l]),(0,D.jsx)(Ne.Z,{circle:!0,customClassName:A,onClick:function changeOpenCon(){be.trigger("updateCurrentSelection",o.id),f((function(e){return!e}))},children:(0,D.jsxs)(u.G7,{className:P,children:[(0,D.jsxs)(u.G7,{className:F,children:[(0,D.jsxs)(u.G7,{className:L,children:[(0,D.jsxs)(u.G7,{className:U,children:[(0,D.jsxs)(u.G7,{className:H,children:[o.name,(0,D.jsx)(u.xv,{className:q,children:"("}),(0,D.jsx)(u.xv,{className:K,children:(null===(n=o.product_color_list)||void 0===n?void 0:n.length)||0}),(0,D.jsx)(u.xv,{className:q,children:")"})]}),3!==o.is_top&&(0,D.jsx)(u.G7,{onClick:function onClick(e){return function handleEditCollection(e,n){e.stopPropagation();var t={id:n.id,name:n.name,remark:n.remark,is_top:n.is_top};(0,G.jD)("/pages/collection/collectionDetail/index",{title:"编辑收藏夹",isEdit:!0,editData:JSON.stringify(t)})}(e,o)},children:(0,D.jsx)(xe.Z,{name:"icon-bianji",size:36})})]}),(0,D.jsx)(u.G7,{className:V,children:(0,D.jsx)(u.xv,{children:o.remark})})]}),(0,D.jsx)(xe.Z,{name:"icon-shangla",size:36,customClassName:m()(h?Q:Y)}),(0,D.jsx)(xe.Z,{name:"icon-xiala",size:36,customClassName:m()(h?Y:Q)})]},o.id),(0,D.jsx)(u.G7,{className:W,style:h?{maxHeight:"".concat(2600,"rpx")}:{maxHeight:0},children:(0,D.jsx)(u.G7,{className:$,children:null===(t=o.product_color_list)||void 0===t?void 0:t.map((function(e){var n;return(0,D.jsx)(z,{checked:null==r||null===(n=r[o.id])||void 0===n?void 0:n[e.product_id],onCheckedChange:c,filterChecked:s,metaDataId:o.id,event:be,item:e,openCheckBox:i},e.product_id)}))})})]})})},ye=(0,x.memo)(we),Me=function Collection(){var e;(0,Ce.Z)(),(0,Ge.av)("pages/collection/index");var n=(0,x.useState)(""),t=(0,a.Z)(n,2),o=t[0],_=t[1],h=(0,x.useRef)(!0),f=(0,x.useCallback)((0,je.Ds)((function(e){_((function(){return e}))}),400),[]),p=(0,me._P)(),g=p.fetchData,j=p.state,C=(0,x.useState)({list:[],total:0}),v=(0,a.Z)(C,2),N=v[0],Z=v[1],k=function(){var e=(0,s.Z)((0,c.Z)().mark((function _callee(){var e;return(0,c.Z)().wrap((function _callee$(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,g((0,je.mB)({name:o}));case 2:e=n.sent,Z({list:e.data.list,total:e.data.total});case 4:case"end":return n.stop()}}),_callee)})));return function getFavoriteList(){return e.apply(this,arguments)}}(),S=(0,x.useState)(0),b=(0,a.Z)(S,2),w=b[0],M=b[1],z=function updateCurrentSelection(e){console.log("updateCurrentSelection current",e),M(e)},P=(0,x.useState)({}),F=(0,a.Z)(P,2),L=F[0],U=F[1],V=function onCheckedChange(e,n,t){console.log("onCheckedChange",n,t);var o=Object.assign({},L,(0,i.Z)({},e,(0,l.Z)((0,l.Z)({},L[e]),{},(0,i.Z)({},n,t))));U(o)},H=function filterChecked(e,n){var t;if(e){L[e]||(L[e]={}),console.log("filterChecked",L[e]);var o=Object.entries(L[e]).filter((function(e){return Boolean(e[1])})).map((function(e){var n=(0,a.Z)(e,1)[0];return Number(n)})),i=N.list.find((function(n){return n.id===e}));console.log(o,i);var l=(null===(t=i.product_color_list)||void 0===t?void 0:t.filter((function(e){var n=e.product_id;return o.includes(n)})))||[];return n?l.filter(n):l}};(0,r.useDidShow)((function(){k(),h.current=!1})),(0,x.useEffect)((function(){h.current||k()}),[o,h.current]);var Q=(0,x.useRef)("auto"),Y=(0,x.useState)({height:"auto"}),q=(0,a.Z)(Y,2),K=q[0],W=q[1];(0,x.useEffect)((function(){!function handleLayout(){var e=d().createSelectorQuery();e.select("#bottomBar").boundingClientRect(),e.select("#scrollContent").boundingClientRect(),e.exec((function(e){console.log("res",e);var n=e[0].height,t=e[1].height;Q.current="".concat(t-n,"px")}))}()}),[]),(0,x.useEffect)((function(){return be.on("updateCurrentSelection",z),function(){be.off("updateCurrentSelection",z)}}));var $=(0,x.useMemo)((function(){var e=H(w);return console.log("selections",e),e&&0!==e.length?e.map((function(e){return e.product_id})):[]}),[L,H]),se=(0,me.NJ)().fetchData,ae=function(){var e=(0,s.Z)((0,c.Z)().mark((function _callee2(){return(0,c.Z)().wrap((function _callee2$(e){for(;;)switch(e.prev=e.next){case 0:if(0!=$.length){e.next=2;break}return e.abrupt("return",G.Z9.none("请选择要取消面料"));case 2:return e.next=4,d().showModal({title:"是否要取消收藏",confirmText:"是",cancelText:"否"});case 4:if(!e.sent.confirm){e.next=10;break}return e.next=8,se({favorite_id:w,product_id:$});case 8:e.sent.success&&(k(),G.Z9.none("已取消收藏"));case 10:case"end":return e.stop()}}),_callee2)})));return function onDelCollection(){return e.apply(this,arguments)}}(),re=(0,x.useState)(!1),de=(0,a.Z)(re,2),ue=de[0],_e=de[1],he=(0,x.useMemo)((function(){var e,n=(null===(e=N.list.find((function(e){return e.id===w})))||void 0===e?void 0:e.product_color_list)||[];return 0!==n.length&&H(w).length===n.length}),[w,N.list,H]),we=function onCheckedAllChange(e){var n=N.list.find((function(e){return e.id===w})).product_color_list,t=JSON.parse(JSON.stringify(L));n.forEach((function(n){t[w][n.product_id]=e})),console.log("newCheckedMap==+>",t),U(t)},Me=(0,x.useState)(!1),De=(0,a.Z)(Me,2),ze=De[0],Be=De[1],Ie=(0,x.useCallback)((function(){Be(!1)}),[]),Oe=(0,x.useMemo)((function(){return(0,je.rA)({list:N.list,total:N.total,status:j.loading})}),[j,N]);return(0,D.jsxs)(u.G7,{className:B,children:[(0,D.jsxs)(u.G7,{className:I,children:[(0,D.jsx)(u.G7,{className:O,children:(0,D.jsx)(ge.Z,{showBtn:!1,changeOnSearch:f,placeholder:"请输入面料关键词",children:(0,D.jsx)(u.G7,{className:X,onClick:function onStartToManage(){_e((function(e){return W(e?{height:"auto",flex:"1 1 auto"}:{flex:"unset",height:"".concat(Q.current)}),!e}))},children:ue?(0,D.jsx)(ve.Z,{svg:!0,iconName:"icon-guanli",text:"退出",color:"#4581ff",customClass:ee}):(0,D.jsx)(ve.Z,{svg:!0,iconName:"icon-guanli",text:"管理"})})})}),(0,D.jsx)(Ne.Z,{circle:!0,customClassName:A,onClick:function handleAddNewCollection(){(0,G.jD)("/pages/collection/collectionDetail/index",{title:"新建收藏夹",isEdit:!1,editData:null})},children:(0,D.jsxs)(u.G7,{className:T,children:[(0,D.jsx)(xe.Z,{customClassName:E,name:"icon-shoucangjia",size:60}),(0,D.jsx)(u.xv,{className:R,children:"点击新建收藏夹"})]})}),(0,D.jsx)(u.G7,{className:J,id:"scrollContent",style:K,children:(0,D.jsx)(pe.Z,{statusMore:Oe,emptySlot:(0,D.jsx)(ke.Z,{picUrl:Se.ck,text:"暂无数据"}),children:null===(e=N.list)||void 0===e?void 0:e.map((function(e,n){return(0,D.jsx)(ye,{checkedMap:L,onCheckedChange:V,filterChecked:H,selectId:w,item:e,isManageStatus:ue},n)}))})})]}),(0,D.jsxs)(u.G7,{className:m()(ne,ue?ie:""),id:"bottomBar",children:[(0,D.jsx)(u.G7,{className:te,children:(0,D.jsx)(y.Z,{status:he,round:!0,size:"small",onSelect:function onSelect(){return we(!0)},onClose:function onClose(){return we(!1)},customClassName:le,customTextClass:ce,children:"全选"})}),(0,D.jsxs)(u.G7,{className:oe,children:[(0,D.jsx)(Ze.Z,{type:"danger",plain:!0,round:!0,size:"normal",onClick:function handleMultipleMove(){Be(!0)},customStyles:{padding:"0 50rpx",margin:"0 40rpx"},children:(0,D.jsx)(u.xv,{style:{fontSize:"30rpx"},children:"移动到"})}),(0,D.jsx)(Ze.Z,{type:"danger",round:!0,size:"normal",onClick:function handleMultipleDelete(){ae()},customStyles:{padding:"0 60rpx"},children:(0,D.jsx)(u.xv,{style:{fontSize:"30rpx"},children:"删除"})})]})]}),(0,D.jsx)(fe,{onSuccess:k,collectionList:N.list,show:ze,onClose:Ie,ids:$,sourceId:w})]})};Me.enableShareAppMessage=!0;Page((0,o.createPageConfig)(Me,"pages/collection/index",{root:{cn:[]}},{navigationBarTitleText:"收藏夹",enableShareAppMessage:!0}||{}))}},function(e){e.O(0,[4634,6878,3560,9315,4271,635,6391,8576,9284,56,2107,1216,8592],(function(){return n=219,e(e.s=n);var n}));e.O()}]); |