2023-05-12 11:43:37 +08:00

2 lines
19 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"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");/*! For license information please see index.js.LICENSE.txt */
(wx.webpackJsonp=wx.webpackJsonp||[]).push([["pages/collection/index"],{"./node_modules/babel-loader/lib/index.js??ruleSet[1].rules[5].use[0]!./src/pages/collection/index.tsx":function(e,t,o){var n=o("./node_modules/@babel/runtime/helpers/esm/defineProperty.js"),l=o("./node_modules/@babel/runtime/helpers/esm/objectSpread2.js"),c=o("./node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js"),s=o("./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js"),i=o("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),a=o("./node_modules/@tarojs/taro/index.js"),d=o.n(a),u=o("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),r=o("./node_modules/classnames/index.js"),_=o.n(r),m=o("./node_modules/react/cjs/react.production.min.js"),f=o("./src/pages/collection/components/productItem/index.tsx"),x=o("./src/pages/collection/index.module.scss"),p=o("./src/pages/collection/components/moveCollectionPopup/index.tsx"),h=o("./src/components/infiniteScroll/index.tsx"),g=o("./src/components/checkbox/index.tsx"),j=o("./src/components/searchBar/index.tsx"),b=o("./src/common/util.ts"),C=o("./src/common/common.ts"),v=o("./src/api/favorite.ts"),w=o("./src/use/useLogin.ts"),k=o("./src/components/iconText/index.tsx"),N=o("./src/components/layoutBlock/index.tsx"),S=o("./src/components/iconfont/iconfont.tsx"),y=o("./src/components/normalButton/index.tsx"),V=o("./src/components/empty/index.tsx"),B=o("./src/common/constant.ts"),T=o("./src/use/useCommon.ts"),I=o("./node_modules/react/cjs/react-jsx-runtime.production.min.js"),M=new a.Events,z=function CollectionItem(e){var t,o,n=e.item,l=e.isManageStatus,c=e.selectId,s=e.onCheckedChange,a=e.filterChecked,d=e.checkedMap,r=(0,m.useState)(!1),p=(0,i.default)(r,2),h=p[0],g=p[1];return(0,m.useEffect)((function(){console.log("selectId && item.id",c,n.id,l),c!==n.id&&l&&g(!1)}),[l,c]),(0,I.jsx)(N.default,{circle:!0,customClassName:x.default.layout,onClick:function changeOpenCon(){M.trigger("updateCurrentSelection",n.id),g((function(e){return!e}))},children:(0,I.jsxs)(u.View,{className:x.default.class_item,children:[(0,I.jsxs)(u.View,{className:x.default.class_title,children:[(0,I.jsxs)(u.View,{className:x.default.class_prefix,children:[(0,I.jsxs)(u.View,{className:x.default.class_prefix_top,children:[(0,I.jsxs)(u.View,{className:x.default.title,children:[n.name,(0,I.jsx)(u.Text,{className:x.default.fg,children:""}),(0,I.jsx)(u.Text,{className:x.default.num,children:(null===(t=n.product_color_list)||void 0===t?void 0:t.length)||0}),(0,I.jsx)(u.Text,{className:x.default.fg,children:""})]}),3!==n.is_top&&(0,I.jsx)(u.View,{onClick:function onClick(e){return function handleEditCollection(e,t){e.stopPropagation();var o={id:t.id,name:t.name,remark:t.remark,is_top:t.is_top};(0,C.goLink)("/pages/collection/collectionDetail/index",{title:"编辑收藏夹",isEdit:!0,editData:JSON.stringify(o)})}(e,n)},children:(0,I.jsx)(S.default,{name:"icon-bianji",size:36})})]}),(0,I.jsx)(u.View,{className:x.default.class_prefix_bottom,children:(0,I.jsx)(u.Text,{children:n.remark})})]}),(0,I.jsx)(S.default,{name:"icon-shangla",size:36,customClassName:_()(h?x.default.iconfont_show:x.default.iconfont_hide)}),(0,I.jsx)(S.default,{name:"icon-xiala",size:36,customClassName:_()(h?x.default.iconfont_hide:x.default.iconfont_show)})]},n.id),(0,I.jsx)(u.View,{className:x.default.class_con,style:h?{maxHeight:"".concat(2600,"rpx")}:{maxHeight:0},children:(0,I.jsx)(u.View,{className:x.default.products_list,children:null===(o=n.product_color_list)||void 0===o?void 0:o.map((function(e){var t;return(0,I.jsx)(f.ProductItem,{checked:null==d||null===(t=d[n.id])||void 0===t?void 0:t[e.product_id],onCheckedChange:s,filterChecked:a,metaDataId:n.id,event:M,item:e,openCheckBox:l},e.product_id)}))})})]})})},L=(0,m.memo)(z);t.default=function Collection(){var e;(0,w.default)(),(0,T.useBuriedDataPoint)("pages/collection/index");var t=(0,m.useState)(""),o=(0,i.default)(t,2),r=o[0],f=o[1],z=(0,m.useRef)(!0),P=(0,m.useCallback)((0,b.debounce)((function(e){f((function(){return e}))}),400),[]),A=(0,v.FavoriteListApi)(),D=A.fetchData,O=A.state,R=(0,m.useState)({list:[],total:0}),E=(0,i.default)(R,2),F=E[0],J=E[1],U=function(){var e=(0,s.default)((0,c.default)().mark((function _callee(){var e;return(0,c.default)().wrap((function _callee$(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,D((0,b.getFilterData)({name:r}));case 2:e=t.sent,J({list:e.data.list,total:e.data.total});case 4:case"end":return t.stop()}}),_callee)})));return function getFavoriteList(){return e.apply(this,arguments)}}(),G=(0,m.useState)(0),H=(0,i.default)(G,2),Q=H[0],Y=H[1],Z=function updateCurrentSelection(e){console.log("updateCurrentSelection current",e),Y(e)},q=(0,m.useState)({}),K=(0,i.default)(q,2),$=K[0],X=K[1],W=function onCheckedChange(e,t,o){console.log("onCheckedChange",t,o);var c=Object.assign({},$,(0,n.default)({},e,(0,l.default)((0,l.default)({},$[e]),{},(0,n.default)({},t,o))));X(c)},ee=function filterChecked(e,t){var o;if(e){$[e]||($[e]={}),console.log("filterChecked",$[e]);var n=Object.entries($[e]).filter((function(e){return Boolean(e[1])})).map((function(e){var t=(0,i.default)(e,1)[0];return Number(t)})),l=F.list.find((function(t){return t.id===e}));console.log(n,l);var c=(null===(o=l.product_color_list)||void 0===o?void 0:o.filter((function(e){var t=e.product_id;return n.includes(t)})))||[];return t?c.filter(t):c}};(0,a.useDidShow)((function(){U(),z.current=!1})),(0,m.useEffect)((function(){z.current||U()}),[r,z.current]);var te=(0,m.useRef)("auto"),oe=(0,m.useState)({height:"auto"}),ne=(0,i.default)(oe,2),le=ne[0],ce=ne[1];(0,m.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 t=e[0].height,o=e[1].height;te.current="".concat(o-t,"px")}))}()}),[]),(0,m.useEffect)((function(){return M.on("updateCurrentSelection",Z),function(){M.off("updateCurrentSelection",Z)}}));var se=(0,m.useMemo)((function(){var e=ee(Q);return console.log("selections",e),e&&0!==e.length?e.map((function(e){return e.product_id})):[]}),[$,ee]),ie=(0,v.DelFavoriteProductApi)().fetchData,ae=function(){var e=(0,s.default)((0,c.default)().mark((function _callee2(){return(0,c.default)().wrap((function _callee2$(e){for(;;)switch(e.prev=e.next){case 0:if(0!=se.length){e.next=2;break}return e.abrupt("return",C.alert.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,ie({favorite_id:Q,product_id:se});case 8:e.sent.success&&(U(),C.alert.none("已取消收藏"));case 10:case"end":return e.stop()}}),_callee2)})));return function onDelCollection(){return e.apply(this,arguments)}}(),de=(0,m.useState)(!1),ue=(0,i.default)(de,2),re=ue[0],_e=ue[1],me=(0,m.useMemo)((function(){var e,t=(null===(e=F.list.find((function(e){return e.id===Q})))||void 0===e?void 0:e.product_color_list)||[];return 0!==t.length&&ee(Q).length===t.length}),[Q,F.list,ee]),fe=function onCheckedAllChange(e){var t=F.list.find((function(e){return e.id===Q})).product_color_list,o=JSON.parse(JSON.stringify($));t.forEach((function(t){o[Q][t.product_id]=e})),console.log("newCheckedMap==+>",o),X(o)},xe=(0,m.useState)(!1),pe=(0,i.default)(xe,2),he=pe[0],ge=pe[1],je=(0,m.useCallback)((function(){ge(!1)}),[]),be=(0,m.useMemo)((function(){return(0,b.dataLoadingStatus)({list:F.list,total:F.total,status:O.loading})}),[O,F]);return(0,I.jsxs)(u.View,{className:x.default.collection_main,children:[(0,I.jsxs)(u.View,{className:x.default.collection_content,children:[(0,I.jsx)(u.View,{className:x.default.search,children:(0,I.jsx)(j.default,{showBtn:!1,changeOnSearch:P,placeholder:"请输入面料关键词",children:(0,I.jsx)(u.View,{className:x.default.flexBox,onClick:function onStartToManage(){_e((function(e){return ce(e?{height:"auto",flex:"1 1 auto"}:{flex:"unset",height:"".concat(te.current)}),!e}))},children:re?(0,I.jsx)(k.default,{svg:!0,iconName:"icon-guanli",text:"退出",color:"#4581ff",customClass:x.default["icon--manage--cancel"]}):(0,I.jsx)(k.default,{svg:!0,iconName:"icon-guanli",text:"管理"})})})}),(0,I.jsx)(N.default,{circle:!0,customClassName:x.default.layout,onClick:function handleAddNewCollection(){(0,C.goLink)("/pages/collection/collectionDetail/index",{title:"新建收藏夹",isEdit:!1,editData:null})},children:(0,I.jsxs)(u.View,{className:x.default.layoutBlock,children:[(0,I.jsx)(S.default,{customClassName:x.default.icon,name:"icon-shoucangjia",size:60}),(0,I.jsx)(u.Text,{className:x.default.content,children:"点击新建收藏夹"})]})}),(0,I.jsx)(u.View,{className:x.default.scrollContent,id:"scrollContent",style:le,children:(0,I.jsx)(h.default,{statusMore:be,emptySlot:(0,I.jsx)(V.default,{picUrl:B.COLLECTION_EMPTY_IMAGE,text:"暂无数据"}),children:null===(e=F.list)||void 0===e?void 0:e.map((function(e,t){return(0,I.jsx)(L,{checkedMap:$,onCheckedChange:W,filterChecked:ee,selectId:Q,item:e,isManageStatus:re},t)}))})})]}),(0,I.jsxs)(u.View,{className:_()(x.default.bottomBar,re?x.default.showBottomBar:""),id:"bottomBar",children:[(0,I.jsx)(u.View,{className:x.default.bottomLeft,children:(0,I.jsx)(g.default,{status:me,round:!0,size:"small",onSelect:function onSelect(){return fe(!0)},onClose:function onClose(){return fe(!1)},customClassName:x.default.multipleCheckbox,customTextClass:x.default.multipleCheckbox__text,children:"全选"})}),(0,I.jsxs)(u.View,{className:x.default.bottomRight,children:[(0,I.jsx)(y.default,{type:"danger",plain:!0,round:!0,size:"normal",onClick:function handleMultipleMove(){ge(!0)},customStyles:{padding:"0 50rpx",margin:"0 40rpx"},children:(0,I.jsx)(u.Text,{style:{fontSize:"30rpx"},children:"移动到"})}),(0,I.jsx)(y.default,{type:"danger",round:!0,size:"normal",onClick:function handleMultipleDelete(){ae()},customStyles:{padding:"0 60rpx"},children:(0,I.jsx)(u.Text,{style:{fontSize:"30rpx"},children:"删除"})})]})]}),(0,I.jsx)(p.default,{onSuccess:U,collectionList:F.list,show:he,onClose:je,ids:se,sourceId:Q})]})}},"./src/pages/collection/components/moveCollectionPopup/index.tsx":function(e,t,o){var n=o("./node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js"),l=o("./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js"),c=o("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),s=o("./node_modules/react/cjs/react.production.min.js"),i=o("./src/pages/collection/components/moveCollectionPopup/index.module.scss"),a=o("./src/components/popup/index.tsx"),d=o("./src/api/favorite.ts"),u=o("./src/common/common.ts"),r=o("./src/components/iconfont/iconfont.tsx"),_=o("./src/components/divider/index.tsx"),m=o("./node_modules/react/cjs/react-jsx-runtime.production.min.js"),f=function MoveCollectionPopup(e){var t=e.show,o=void 0!==t&&t,s=e.onClose,f=e.collectionList,x=e.ids,p=e.sourceId,h=e.onSuccess,g=(0,d.MoveFavoriteProductApi)().fetchData,j=function(){var e=(0,l.default)((0,n.default)().mark((function _callee(e){return(0,n.default)().wrap((function _callee$(t){for(;;)switch(t.prev=t.next){case 0:if(0!=(null==x?void 0:x.length)){t.next=2;break}return t.abrupt("return",u.alert.none("请选择要移动面料"));case 2:return t.next=4,g({source_favorite_id:p,target_favorite_id:e.id,product_id:Array.from(x)});case 4:t.sent.success?(null==s||s(),null==h||h(),u.alert.success("移动成功")):u.alert.error("移动失败");case 6:case"end":return t.stop()}}),_callee)})));return function handleMove(t){return e.apply(this,arguments)}}();return(0,m.jsxs)(a.default,{show:o,onClose:s,showTitle:!0,title:"移动收藏夹",children:[(0,m.jsx)(_.default,{direction:"horizontal",customStyles:{marginTop:"0px",marginBottom:"12px"}}),(0,m.jsx)(c.ScrollView,{className:i.default.scrollStyle,scrollY:!0,children:(0,m.jsxs)(c.View,{className:i.default.collection_con,children:[f.map((function(e,t){return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(c.View,{className:i.default.collection_item,onClick:function onClick(){return j(e)},children:[(0,m.jsx)(c.View,{className:i.default.collectionImage}),(0,m.jsx)(c.Text,{className:i.default.text,children:e.name})]},t),(0,m.jsx)(_.default,{direction:"horizontal",customStyles:{margin:"12px 0"}})]})})),(0,m.jsxs)(c.View,{className:i.default.collection_item,onClick:function handleNewCollection(){(0,u.goLink)("/pages/collection/collectionDetail/index",{title:"新建收藏夹",isEdit:!1,editData:null})},children:[(0,m.jsx)(c.View,{className:i.default.collectionImage,children:(0,m.jsx)(r.default,{name:"icon-xinzengshoucangjia",size:40})}),(0,m.jsx)(c.Text,{className:i.default.text,children:"新建收藏夹"})]}),(0,m.jsx)(_.default,{direction:"horizontal",customStyles:{margin:"12px 0"}})]})})]})};t.default=(0,s.memo)(f)},"./src/pages/collection/components/productItem/index.tsx":function(e,t,o){o.d(t,{ProductItem:function(){return r}});var n=o("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),l=o("./src/pages/collection/components/productItem/index.module.scss"),c=o("./src/common/common.ts"),s=o("./src/common/format.ts"),i=o("./src/components/LabAndImg/index.tsx"),a=o("./src/components/checkbox/index.tsx"),d=o("./src/components/divider/index.tsx"),u=o("./node_modules/react/cjs/react-jsx-runtime.production.min.js"),r=function ProductItem(e){var t=e.item,o=e.openCheckBox,r=e.event,_=e.metaDataId,m=e.onCheckedChange,f=e.checked;return(0,u.jsxs)(n.View,{onClick:function handleClickItem(e){e.stopPropagation(),r.trigger("updateCurrentSelection",_),o?m(_,t.product_id,!f):(0,c.goLink)("/pages/details/index?id=".concat(t.product_id))},children:[(0,u.jsx)(d.default,{direction:"horizontal",customStyles:{margin:"0"}}),(0,u.jsxs)(n.View,{className:l.default.products_item,children:[o&&(0,u.jsx)(n.View,{className:l.default.checkbox,onClick:function noop(e){e.stopPropagation()},children:(0,u.jsx)(a.default,{round:!0,size:"normal",status:f,onSelect:function handleSelect(){console.log(t),m(_,t.product_id,!0)},onClose:function handleClose(){m(_,t.product_id,!1)}})}),(0,u.jsxs)(n.View,{className:l.default.item,children:[(0,u.jsxs)(n.View,{className:l.default.item_img,children:[(0,u.jsx)(i.default,{value:{lab:t.lab,rgb:t.rgb,texture_url:t.texture_url}}),(0,u.jsxs)(n.View,{className:l.default.num,children:[t.enable_product_color_count,"色"]})]}),(0,u.jsxs)(n.View,{className:l.default.item_con,children:[(0,u.jsxs)(n.View,{className:l.default.title,children:[(0,u.jsxs)("text",{children:[(0,s.formatHashTag)(t.product_code,"")," "]}),t.product_name]}),(0,u.jsxs)(n.View,{className:l.default.tag_list,children:[(0,u.jsx)(n.View,{className:l.default.tag,children:t.width}),(0,u.jsx)(n.View,{className:l.default.tag_g,children:t.weight_density})]}),(0,u.jsx)(n.View,{className:l.default.introduce,children:t.component})]})]})]})]})}},"./src/pages/collection/index.tsx":function(e,t,o){var n=o("./node_modules/@tarojs/runtime/dist/runtime.esm.js"),l=o("./node_modules/babel-loader/lib/index.js??ruleSet[1].rules[5].use[0]!./src/pages/collection/index.tsx");l.default.enableShareAppMessage=!0;Page((0,n.createPageConfig)(l.default,"pages/collection/index",{root:{cn:[]}},{navigationBarTitleText:"收藏夹",enableShareAppMessage:!0}||{})),l.default},"./src/pages/collection/components/moveCollectionPopup/index.module.scss":function(e,t){t.default={common_safe_area_y:"index-module__common_safe_area_y___tTZgp",hoverClass:"index-module__hoverClass___sJHUM","full-100":"index-module__full-100___n1x67",collection_con:"index-module__collection_con___iKeAb",collection_item:"index-module__collection_item___MJq3h",collectionImage:"index-module__collectionImage___FKjQ1",miconfont:"index-module__miconfont___bmRC8",text:"index-module__text___wgxLN",scrollStyle:"index-module__scrollStyle___pTlcu"}},"./src/pages/collection/components/productItem/index.module.scss":function(e,t){t.default={common_safe_area_y:"index-module__common_safe_area_y___ea4gv",hoverClass:"index-module__hoverClass___FSgUh","full-100":"index-module__full-100___k_Qzw",products_list:"index-module__products_list___Bmlg5",products_item:"index-module__products_item___iVZn0",checkbox:"index-module__checkbox___gclIR",item:"index-module__item___GVATe",item_img:"index-module__item_img___wQcfH",num:"index-module__num___M9C72",item_con:"index-module__item_con___IcAwW",title:"index-module__title___x0MJH",tag_list:"index-module__tag_list___zIwiB",tag:"index-module__tag___GDXka",tag_g:"index-module__tag_g___CuiK8",introduce:"index-module__introduce___JN7Ns",des:"index-module__des___vTlN1"}},"./src/pages/collection/index.module.scss":function(e,t){t.default={common_safe_area_y:"index-module__common_safe_area_y___z0PAb",hoverClass:"index-module__hoverClass___iaCg4","full-100":"index-module__full-100___V6sfB",collection_main:"index-module__collection_main___wbTms",collection_content:"index-module__collection_content___kz6tl",search:"index-module__search___ORpEy",miconfont_con:"index-module__miconfont_con___u7ttx",miconfont:"index-module__miconfont___LJLM8",layout:"index-module__layout___pd2Uy",layoutBlock:"index-module__layoutBlock___N4uIu",icon:"index-module__icon___fDRJx",content:"index-module__content___FZQRh",scrollContent:"index-module__scrollContent___lFVQ4",class_item:"index-module__class_item___IhsAt",class_title:"index-module__class_title___nYcAm",class_prefix:"index-module__class_prefix___tl6BP",class_prefix_top:"index-module__class_prefix_top___UYjsV",class_prefix_bottom:"index-module__class_prefix_bottom___OT_ws",title:"index-module__title___emrpe",iconfont_show:"index-module__iconfont_show___wfUin",iconfont_hide:"index-module__iconfont_hide___e6sCG",fg:"index-module__fg___OC4gi",num:"index-module__num___GwilZ",class_con:"index-module__class_con___F1CUi",products_list:"index-module__products_list____12cM",flexBox:"index-module__flexBox___bRNRO","icon--manage--cancel":"index-module__icon--manage--cancel___bAfYO",bottomBar:"index-module__bottomBar___vUHq8",bottomLeft:"index-module__bottomLeft___bFLO8",bottomRight:"index-module__bottomRight___zTAEj",showBottomBar:"index-module__showBottomBar___RqUCj",multipleCheckbox:"index-module__multipleCheckbox___jj2GV",multipleCheckbox__text:"index-module__multipleCheckbox__text___VX23J"}}},function(e){e.O(0,["sub-common/f7c2016e1fc8045300ee51e652beb947","sub-common/db6cc8fba2c34d36042a60bcf5f10485","sub-common/510d0e7078f44d770a0720344fb06369","sub-common/0762d0d2445fe1200cae192cedb39f4b","sub-common/31c2143408a2e4f5735ccb6e07aa07fc","sub-common/cf216475951e5960bcea5b5b9d46933b","sub-common/b15a59e62f0de52477cd87cdc0559eda","sub-common/3eb47fe15c5dbf2a4a5aef0734c8dda2","sub-common/56ed246005e61258235018a565f4216a","sub-common/60effc84a668f58f5526ecbcbd4fa1de","taro","vendors","common"],(function(){return t="./src/pages/collection/index.tsx",e(e.s=t);var t}));e.O()}]);