2023-05-15 14:13:36 +08:00

1 line
6.7 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/b0deadd786ac48f22d299d1bc3b02f4a.js");require("./sub-common/8919209ac5faab92b678fcb20d9a2155.js");require("./sub-common/932400230807213391bf842279a6e498.js");(wx.webpackJsonp=wx.webpackJsonp||[]).push([[43],{9017:function(e,n,t){var l=t(2180),i=t(3433),r=t(4165),c=t(1413),a=t(5861),u=t(9439),o=t(1515),s=t(2954),d=t.n(s),_=t(7294),f=t(4184),m=t.n(f),x="index-module__main___wzD_R",p="index-module__search___dT1NF",v="index-module__btn_reset___ObhMK",h="index-module__get_card_con___gJFKi",g="index-module__get_card_list___Ux2mj",S="index-module__get_card_btn___CjjSA",Z="index-module__selected___P8E7Z",j="index-module__get_card_item___jUbax",b="index-module__image___Ku5R9",N="index-module__card_info___bpIUe",C="index-module__card_info_name___F7LnN",G="index-module__card_info_label___K2xc7",k="index-module__desc___qc4qO",w="index-module__checkBox___TtzFP",O="index-module__add_btn____V3A7",z=t(6599),R=t(4158),y=t(5893),T=(0,_.memo)((function(e){var n=e.productItem,t=void 0===n?null:n,l=e.selected,i=void 0!==l&&l,r=(0,_.useState)(!1),c=(0,u.Z)(r,2),a=c[0],s=c[1],d=(0,_.useMemo)((function(){return{lab:null==t?void 0:t.lab,rgb:null==t?void 0:t.rgb,texture_url:null==t?void 0:t.texture_url}}),[t]);return(0,y.jsxs)(o.G7,{className:j,onClick:function changeSelect(){var n;s(!a),null===(n=e.onSelect)||void 0===n||n.call(e,t)},children:[(0,y.jsxs)(o.G7,{className:b,children:[(0,y.jsx)(z.Z,{value:d}),(0,y.jsxs)(o.xv,{children:[null==t?void 0:t.product_color_count,"色"]})]}),(0,y.jsxs)(o.G7,{className:N,children:[(0,y.jsx)(o.G7,{className:C,children:(0,R.W7)(null==t?void 0:t.code,null==t?void 0:t.name)}),(0,y.jsxs)(o.G7,{className:G,children:[(0,y.jsx)(o.xv,{children:null==t?void 0:t.width}),(0,y.jsx)(o.xv,{children:null==t?void 0:t.weight_density})]}),(0,y.jsx)(o.G7,{className:k,children:null==t?void 0:t.component})]}),(0,y.jsx)(o.G7,{className:w,onClick:function onClick(e){return e.stopPropagation()},children:(0,y.jsx)(o.G7,{className:O,onClick:function onClick(){return function onSelect(){var n;null===(n=e.onSelect)||void 0===n||n.call(e,t),s(!0)}()},children:i?"继续添加":"添加"})})]})})),L=t(8186),M=t(2711),P=t(7317),A=t(8093),I=t(1875),J=t(1115),B=t(9498),cutSampleList=function(){var e;(0,B.av)("pages/cutSampleList/index");var n=(0,I.no)(),t=n.fetchData,l=n.state,f=(0,_.useState)({list:[],total:0}),j=(0,u.Z)(f,2),b=j[0],N=j[1],C=(0,_.useState)({page:1,size:10}),G=(0,u.Z)(C,2),k=G[0],w=G[1],O=((0,_.useRef)([]),function(){var e=(0,a.Z)((0,r.Z)().mark((function _callee(){var e,n;return(0,r.Z)().wrap((function _callee$(l){for(;;)switch(l.prev=l.next){case 0:return l.next=2,t((0,A.mB)((0,c.Z)({},k)));case 2:e=l.sent,n=e.data,N((function(){return{list:n.list,total:n.total}})),U((function(){return!1}));case 6:case"end":return l.stop()}}),_callee)})));return function getGetColorCard(){return e.apply(this,arguments)}}());(0,_.useEffect)((function(){O()}),[k]),(0,_.useEffect)((function(){if(d().getStorageSync("cutSample")){var e=d().getStorageSync("cutSample")?JSON.parse(d().getStorageSync("cutSample")):[],n=[];e.map((function(e){n.push(e.id)})),oe(n),re(e),n.length>0&&w((function(e){return(0,c.Z)((0,c.Z)({},e),{},{product_ids:n.join(",")})}))}}),[]);var z=(0,_.useMemo)((function(){return(0,A.rA)({list:b.list,total:l.total,status:l.loading})}),[b,l]),R=(0,_.useRef)({size:k.size,page:k.page}),E=(0,_.useCallback)((function(){if(b.list.length<b.total){R.current.page++;var e=R.current.size*R.current.page;w((function(n){return(0,c.Z)((0,c.Z)({},n),{},{size:e})}))}}),[b]),F=(0,_.useState)(!1),K=(0,u.Z)(F,2),D=K[0],U=K[1],V=function(){var e=(0,a.Z)((0,r.Z)().mark((function _callee2(){return(0,r.Z)().wrap((function _callee2$(e){for(;;)switch(e.prev=e.next){case 0:R.current.size=10,R.current.page=1,U(!0),w((function(e){return(0,c.Z)((0,c.Z)({},e),{},{size:10})}));case 4:case"end":return e.stop()}}),_callee2)})));return function getRefresherRefresh(){return e.apply(this,arguments)}}(),q=(0,_.useState)(!1),$=(0,u.Z)(q,2),W=$[0],H=$[1],Q=(0,_.useState)(),X=(0,u.Z)(Q,2),Y=X[0],ee=X[1],ne=function onSelectData(e){H(!0),ee(e),fe([]);var n=ue.indexOf(e.id);if(-1!==n){var t,l=[];null===(t=ie[n].colors)||void 0===t||t.map((function(e){l.push(e.id)})),fe(l)}},te=(0,_.useState)([]),le=(0,u.Z)(te,2),ie=le[0],re=le[1],ce=(0,_.useState)([]),ae=(0,u.Z)(ce,2),ue=ae[0],oe=ae[1],se=(0,_.useState)([]),de=(0,u.Z)(se,2),_e=de[0],fe=de[1];return(0,y.jsxs)(o.G7,{className:x,children:[(0,y.jsxs)(o.G7,{className:p,children:[(0,y.jsx)(P.Z,{defaultValue:null==k?void 0:k.product_code_and_name,placeholder:"请输入搜索面料",changeOnSearch:function getSearch(e){w((function(n){return(0,c.Z)((0,c.Z)({},n),{},{product_code_and_name:e})}))},debounceTime:500}),(0,y.jsx)(o.G7,{className:v,onClick:function onReset(){w((function(e){return(0,c.Z)((0,c.Z)({},e),{},{product_code_and_name:""})}))},children:"取消"})]}),(0,y.jsx)(o.G7,{className:h,children:(0,y.jsx)(M.Z,{selfonScrollToLower:E,refresherTriggered:D,statusMore:z,refresherEnabled:!0,selfOnRefresherRefresh:V,children:null===(e=b.list)||void 0===e?void 0:e.map((function(e){return(0,y.jsx)(o.G7,{className:g,children:(0,y.jsx)(T,{selected:ue.includes(e.id),productItem:e,onSelect:ne})},e.id)}))})}),(0,y.jsx)(o.G7,{className:S,onClick:function onSubmit(){if(ie.length<=0)return J.Z9.none("请选择剪样");d().setStorageSync("cutSample",JSON.stringify((0,i.Z)(ie)));var e=(0,s.getCurrentPages)(),n=e[e.length-2];"pages/cutSampleListOrder/index"===(null==n?void 0:n.route)?d().navigateBack():d().redirectTo({url:"/pages/cutSampleListOrder/index"})},children:(0,y.jsx)(o.xv,{className:m()(ue.length>0?Z:""),children:"确认"})}),(0,y.jsx)(L.Z,{defaultValueIds:_e,onSelected:function onSelected(e){e.map((function(e){e.count||(e.count=1)}));var n=null==ie?void 0:ie.findIndex((function(e){return e.id===(null==Y?void 0:Y.id)}));if(-1===n){var t=(0,c.Z)({},Y);t.colors=e,ie.unshift(t)}else ie[n].colors=e;null!=Y&&Y.id&&!ue.includes(null==Y?void 0:Y.id)&&(ue.unshift(null==Y?void 0:Y.id),oe(ue)),re(ie),H(!1)},show:W,product_id:(null==Y?void 0:Y.id)||0,onClose:function onClose(e){if(!e){var n=null==ie?void 0:ie.filter((function(e){return e.id!==(null==Y?void 0:Y.id)})),t=null==ue?void 0:ue.filter((function(e){return e!==(null==Y?void 0:Y.id)}));re((function(){return n})),oe((function(){return t}))}H(!1)}})]})};cutSampleList.enableShareAppMessage=!0;Page((0,l.createPageConfig)(cutSampleList,"pages/cutSampleList/index",{root:{cn:[]}},{navigationBarTitleText:"添加剪样",enableShareAppMessage:!0}||{}))}},function(e){e.O(0,[4634,6878,3560,9315,4271,635,1812,14,1983,985,2107,1216,8592],(function(){return n=9017,e(e.s=n);var n}));e.O()}]);