"use strict";(wx.webpackJsonp=wx.webpackJsonp||[]).push([[5425],{2880:function(e,t,n){var o=n(9975),r=n(2982),i=n(4165),l=n(5861),c=n(1413),s=n(885),u=n(5032),_=n(1515),d=n(2535),a=n.n(d),m=n(9792),h=n.n(m),f="index-module__shopping___rSsIK",x="index-module__shopping--topBar___NgzyU",p="index-module__shopping--context___wd0NG",g="index-module__shopping__list__container___eQIei",v="index-module__flexBox___XHnXI",w="index-module__icon--manage--cancel___EBDNt",k=n(6408),b=n.n(k),C=n(1329),j=n(4909),y=n(4942),N={common_safe_area_y:"index-module__common_safe_area_y___hMeQP","flex-col":"index-module__flex-col___u4mqJ","flex-row":"index-module__flex-row___QF4Xz","justify-between":"index-module__justify-between___SVnXc","items-center":"index-module__items-center___TeRak","flex-item":"index-module__flex-item___JP4fE","full-100":"index-module__full-100___sMWPr","color-blue":"index-module__color-blue___M3nPu","color-yellow":"index-module__color-yellow___wQhTc","color-green":"index-module__color-green___ymSO3","color-grey":"index-module__color-grey___Rpf81","color-white":"index-module__color-white___U5GdE",layout:"index-module__layout___xCsni",checkbox:"index-module__checkbox___h99C7","checkbox--text":"index-module__checkbox--text___f_Yes",selected:"index-module__selected___jo7LR",line:"index-module__line___kat2C",topItem:"index-module__topItem___yYKWx",topTitle:"index-module__topTitle___FdpQH",summary:"index-module__summary___b0i6I",detailBox:"index-module__detailBox___Ug3IB",orderTitle:"index-module__orderTitle___FfbyX",orderType:"index-module__orderType___hlmst",orderTypeDetail:"index-module__orderTypeDetail___aDmtP",orderColor:"index-module__orderColor___rxtLi",bottomBox:"index-module__bottomBox____9Lf7",drawerButton:"index-module__drawerButton___l8Rgq",drawerOpen:"index-module__drawerOpen___xkch1",drawerClose:"index-module__drawerClose___XfbvG",saleModeButton:"index-module__saleModeButton___Y9vCc","saleModeButton--text":"index-module__saleModeButton--text___mrVBc","saleModeButton--active":"index-module__saleModeButton--active___mrbjn",noList:"index-module__noList___FELw0"},S=n(4812),Z=n(4365),I=n(6574),B=n(9943),M=n(2407),K=1e6,E=1e6,T="[big.js] ",G=T+"Invalid ",D=G+"decimal places",P=T+"Division by zero",O={},A=void 0,R=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function round(e,t,n,o){var r=e.c;if(n===A&&(n=e.constructor.RM),0!==n&&1!==n&&2!==n&&3!==n)throw Error("[big.js] Invalid rounding mode");if(t<1)o=3===n&&(o||!!r[0])||0===t&&(1===n&&r[0]>=5||2===n&&(r[0]>5||5===r[0]&&(o||r[1]!==A))),r.length=1,o?(e.e=e.e-t+1,r[0]=1):r[0]=e.e=0;else if(t=5||2===n&&(r[t]>5||5===r[t]&&(o||r[t+1]!==A||1&r[t-1]))||3===n&&(o||!!r[0]),r.length=t,o)for(;++r[--t]>9;)if(r[t]=0,0===t){++e.e,r.unshift(1);break}for(t=r.length;!r[--t];)r.pop()}return e}function stringify(e,t,n){var o=e.e,r=e.c.join(""),i=r.length;if(t)r=r.charAt(0)+(i>1?"."+r.slice(1):"")+(o<0?"e":"e+")+o;else if(o<0){for(;++o;)r="0"+r;r="0."+r}else if(o>0)if(++o>i)for(o-=i;o--;)r+="0";else o1&&(r=r.charAt(0)+"."+r.slice(1));return e.s<0&&n?"-"+r:r}O.abs=function(){var e=new this.constructor(this);return e.s=1,e},O.cmp=function(e){var t,n=this,o=n.c,r=(e=new n.constructor(e)).c,i=n.s,l=e.s,c=n.e,s=e.e;if(!o[0]||!r[0])return o[0]?i:r[0]?-l:0;if(i!=l)return i;if(t=i<0,c!=s)return c>s^t?1:-1;for(l=(c=o.length)<(s=r.length)?c:s,i=-1;++ir[i]^t?1:-1;return c==s?0:c>s^t?1:-1},O.div=function(e){var t=this,n=t.constructor,o=t.c,r=(e=new n(e)).c,i=t.s==e.s?1:-1,l=n.DP;if(l!==~~l||l<0||l>K)throw Error(D);if(!r[0])throw Error(P);if(!o[0])return e.s=i,e.c=[e.e=0],e;var c,s,u,_,d,a=r.slice(),m=c=r.length,h=o.length,f=o.slice(0,c),x=f.length,p=e,g=p.c=[],v=0,w=l+(p.e=t.e-e.e)+1;for(p.s=i,i=w<0?0:w,a.unshift(0);x++x?1:-1;else for(d=-1,_=0;++df[d]?1:-1;break}if(!(_<0))break;for(s=x==c?r:a;x;){if(f[--x]w&&round(p,w,n.RM,f[0]!==A),p},O.eq=function(e){return 0===this.cmp(e)},O.gt=function(e){return this.cmp(e)>0},O.gte=function(e){return this.cmp(e)>-1},O.lt=function(e){return this.cmp(e)<0},O.lte=function(e){return this.cmp(e)<1},O.minus=O.sub=function(e){var t,n,o,r,i=this,l=i.constructor,c=i.s,s=(e=new l(e)).s;if(c!=s)return e.s=-s,i.plus(e);var u=i.c.slice(),_=i.e,d=e.c,a=e.e;if(!u[0]||!d[0])return d[0]?e.s=-s:u[0]?e=new l(i):e.s=1,e;if(c=_-a){for((r=c<0)?(c=-c,o=u):(a=_,o=d),o.reverse(),s=c;s--;)o.push(0);o.reverse()}else for(n=((r=u.length0)for(;s--;)u[t++]=0;for(s=t;n>c;){if(u[--n]0?(s=l,o=u):(t=-t,o=c),o.reverse();t--;)o.push(0);o.reverse()}for(c.length-u.length<0&&(o=u,u=c,c=o),t=u.length,n=0;t;c[t]%=10)n=(c[--t]=c[t]+u[t]+n)/10|0;for(n&&(c.unshift(n),++s),t=c.length;0===c[--t];)c.pop();return e.c=c,e.e=s,e},O.pow=function(e){var t=this,n=new t.constructor("1"),o=n,r=e<0;if(e!==~~e||e<-1e6||e>E)throw Error(G+"exponent");for(r&&(e=-e);1&e&&(o=o.times(t)),e>>=1;)t=t.times(t);return r?n.div(o):o},O.prec=function(e,t){if(e!==~~e||e<1||e>K)throw Error(G+"precision");return round(new this.constructor(this),e,t)},O.round=function(e,t){if(e===A)e=0;else if(e!==~~e||e<-K||e>K)throw Error(D);return round(new this.constructor(this),e+this.e+1,t)},O.sqrt=function(){var e,t,n,o=this,r=o.constructor,i=o.s,l=o.e,c=new r("0.5");if(!o.c[0])return new r(o);if(i<0)throw Error(T+"No square root");0===(i=Math.sqrt(o+""))||i===1/0?((t=o.c.join("")).length+l&1||(t+="0"),l=((l+1)/2|0)-(l<0||1&l),e=new r(((i=Math.sqrt(t))==1/0?"5e":(i=i.toExponential()).slice(0,i.indexOf("e")+1))+l)):e=new r(i+""),l=e.e+(r.DP+=4);do{n=e,e=c.times(n.plus(o.div(n)))}while(n.c.slice(0,l).join("")!==e.c.slice(0,l).join(""));return round(e,(r.DP-=4)+e.e+1,r.RM)},O.times=O.mul=function(e){var t,n=this,o=n.constructor,r=n.c,i=(e=new o(e)).c,l=r.length,c=i.length,s=n.e,u=e.e;if(e.s=n.s==e.s?1:-1,!r[0]||!i[0])return e.c=[e.e=0],e;for(e.e=s+u,ls;)c=t[u]+i[s]*r[u-s-1]+c,t[u--]=c%10,c=c/10|0;t[u]=c}for(c?++e.e:t.shift(),s=t.length;!t[--s];)t.pop();return e.c=t,e},O.toExponential=function(e,t){var n=this,o=n.c[0];if(e!==A){if(e!==~~e||e<0||e>K)throw Error(D);for(n=round(new n.constructor(n),++e,t);n.c.lengthK)throw Error(D);for(e=e+(n=round(new n.constructor(n),e+n.e+1,t)).e+1;n.c.length=t.PE,!!e.c[0])},O.toNumber=function(){var e=Number(stringify(this,!0,!0));if(!0===this.constructor.strict&&!this.eq(e.toString()))throw Error(T+"Imprecise conversion");return e},O.toPrecision=function(e,t){var n=this,o=n.constructor,r=n.c[0];if(e!==A){if(e!==~~e||e<1||e>K)throw Error(G+"precision");for(n=round(new o(n),e,t);n.c.length=o.PE,!!r)},O.valueOf=function(){var e=this,t=e.constructor;if(!0===t.strict)throw Error(T+"valueOf disallowed");return stringify(e,e.e<=t.NE||e.e>=t.PE,!0)};var z=function _Big_(){function Big(e){var t=this;if(!(t instanceof Big))return e===A?_Big_():new Big(e);if(e instanceof Big)t.s=e.s,t.e=e.e,t.c=e.c.slice();else{if("string"!=typeof e){if(!0===Big.strict&&"bigint"!=typeof e)throw TypeError(G+"value");e=0===e&&1/e<0?"-0":String(e)}!function parse(e,t){var n,o,r;if(!R.test(t))throw Error(G+"number");e.s="-"==t.charAt(0)?(t=t.slice(1),-1):1,(n=t.indexOf("."))>-1&&(t=t.replace(".",""));(o=t.search(/e/i))>0?(n<0&&(n=o),n+=+t.slice(o+1),t=t.substring(0,o)):n<0&&(n=t.length);for(r=t.length,o=0;o0&&"0"==t.charAt(--r););for(e.e=n-o-1,e.c=[],n=0;o<=r;)e.c[n++]=+t.charAt(o++)}return e}(t,e)}t.constructor=Big}return Big.prototype=O,Big.DP=20,Big.RM=1,Big.NE=-7,Big.PE=21,Big.strict=false,Big.roundDown=0,Big.roundHalfUp=1,Big.roundHalfEven=2,Big.roundUp=3,Big}(),L=z,F="index-module__main___qhaDe",q="index-module__plus___Z8nKa",J="index-module__reduce___Z9T6S",Q="index-module__input___JUf5U",U="index-module__unit___ThR6I",V=n(5513),counter=function(e){var t=e.minNum,n=void 0===t?0:t,o=e.maxNum,r=void 0===o?1e4:o,i=e.step,l=void 0===i?1:i,u=e.digits,d=void 0===u?0:u,a=e.defaultNum,h=void 0===a?0:a,f=e.onChange,x=e.onBlue,p=e.onClickBtn,g=e.unit,v=void 0===g?"":g,w=e.disable,k=void 0!==w&&w,b=(0,m.useState)({count:h}),C=(0,s.Z)(b,2),j=C[0],y=C[1],N=function formatDigits(e){if((e+="").includes(".")&&d>0){var t=e.split("."),n=t[1].substr(0,d);return t[0]+"."+n}return parseFloat(e)},S=function checkData(e){var t=parseFloat(e);return t>r?r:t=r?r:n),y((0,c.Z)((0,c.Z)({},j),{},{count:n})),null==f||f(parseFloat(n)),null==p||p(parseFloat(n))},children:"+"})]})},W={common_safe_area_y:"index-module__common_safe_area_y___fWsCw","flex-col":"index-module__flex-col___Ra0HZ","flex-row":"index-module__flex-row___a2x9u","justify-between":"index-module__justify-between___CfLIX","items-center":"index-module__items-center___px4zj","flex-item":"index-module__flex-item____aoyw","full-100":"index-module__full-100___hA5V5","color-blue":"index-module__color-blue___Dxo4G","color-yellow":"index-module__color-yellow___lCuXN","color-green":"index-module__color-green___dJNqM","color-grey":"index-module__color-grey___cK2Om","color-white":"index-module__color-white___QbWlK",colorKindItem:"index-module__colorKindItem___unIT2",colorKindItem__left:"index-module__colorKindItem__left___T53SU","colorKindItem__left--image":"index-module__colorKindItem__left--image___mmuUp",colorKindItem__center:"index-module__colorKindItem__center___ejsbq","colorKindItem__center--title":"index-module__colorKindItem__center--title___z6WQr","colorKindItem__center--ID":"index-module__colorKindItem__center--ID___vq6as","colorKindItem__center--description":"index-module__colorKindItem__center--description___obrWy",colorKindItem__right:"index-module__colorKindItem__right___jp_VV","colorKindItem__right--price":"index-module__colorKindItem__right--price___Fu6Pv",checkbox:"index-module__checkbox___IxTs9",selected:"index-module__selected___DiFAO"},X=n(7227),$=n(8703),H={0:{title:"大货",unit:"条",eunit:"kg",step:1,digits:0,minNum:1,maxNum:1e5,defaultNum:1},1:{title:"剪板",unit:"米",eunit:"m",step:1,digits:2,minNum:.5,maxNum:9.99,defaultNum:1},2:{title:"散剪",unit:"米",eunit:"kg",step:1,digits:2,minNum:3,maxNum:1e5,defaultNum:3}},Y=h().createContext(null);function useShoppingContext(){var e=(0,m.useContext)(Y);if(!e)throw new Error("没有获取到shopping context");return e}function throwError(){throw new Error("有没有用 ref 这个props?")}var ee,te=(0,m.memo)((function(e){var t=e.purchaserId,n=e.itemData,o=e.orderType,r=void 0===o?$.p.Bulk:o,s=useShoppingContext(),u=s.setChangedCheckbox,d=s.colorStore,a=function useWatch(e,t){var n=useShoppingContext().colorStore;return t?n[e].goodsKind[t]:n[e].goodsKind}(t,null==n?void 0:n.id),h=a.checked,f=(0,m.useCallback)((function(e){return Number((0,S.yb)(e))}),[]),x=(0,m.useCallback)((function(e){return e.sale_mode==$.p.Bulk?e.roll:e.length/100}),[]),p=(0,m.useCallback)((function(e){return e.sale_mode==$.p.Bulk?"条":"米"}),[]),g=(0,X.Ds)(function(){var e=(0,l.Z)((0,i.Z)().mark((function _callee(e,t){return(0,i.Z)().wrap((function _callee$(n){for(;;)switch(n.prev=n.next){case 0:t.sale_mode===$.p.Bulk?t.roll=e:t.length=e;case 1:case"end":return n.stop()}}),_callee)})));return function(t,n){return e.apply(this,arguments)}}(),300);return(0,V.jsxs)(I.Z,{status:h,onSelect:function handleSelect(){var e;u({purchaserId:t,goodsKind:(0,y.Z)({},n.id,(0,c.Z)((0,c.Z)({},null===(e=d[t].goodsKind)||void 0===e?void 0:e[n.id]),{},{checked:!0})),checked:d[t].checked})},onClose:function handleClose(){var e;u({purchaserId:t,goodsKind:(0,y.Z)({},n.id,(0,c.Z)((0,c.Z)({},null===(e=d[t].goodsKind)||void 0===e?void 0:e[n.id]),{},{checked:!1})),checked:d[t].checked})},customClassName:b()(W.checkbox,h?W.selected:""),customTextClass:W.colorKindItem,children:[(0,V.jsx)(_.G7,{className:W.colorKindItem__left,children:(0,V.jsx)(_.Ee,{className:W["colorKindItem__left--image"],mode:"aspectFill",src:(0,S.z)(n.product_color_texture_url)})}),(0,V.jsxs)(_.G7,{className:W.colorKindItem__center,children:[(0,V.jsxs)(_.xv,{className:W["colorKindItem__center--title"],children:[n.product_code,"# ",n.product_name]}),(0,V.jsxs)(_.G7,{className:W["colorKindItem__center--detail"],children:[(0,V.jsx)(_.xv,{className:W["colorKindItem__center--ID"],children:n.product_color_code}),(0,V.jsx)(_.xv,{className:W["colorKindItem__center--description"],children:n.product_color_name})]})]}),(0,V.jsxs)(_.G7,{className:W.colorKindItem__right,children:[(0,V.jsxs)(_.G7,{className:W["colorKindItem__right--price"],children:["¥ ",f(n.sale_price),"/kg"]}),(0,V.jsx)(_.G7,{className:W["colorKindItem__right--counter"],children:(0,V.jsx)(counter,{onBlue:function onBlue(e){return g(e,n)},defaultNum:x(n),step:H[r].step,digits:H[r].digits,onClickBtn:function onClickBtn(e){return g(e,n)},unit:p(n),minNum:H[r].minNum,maxNum:H[r].maxNum})})]})]})}),(function(e,t){var n=JSON.stringify(e.itemData),o=JSON.stringify(t.itemData),r=!0;return e.purchaserId!==t.purchaserId&&(r=!1),e.orderType!==t.orderType&&(r=!1),n!==o&&(r=!1),r})),ne=te,oe=n(9498),re=n(6028),ie=n(1115),le=(0,m.memo)((function(e){var t=e.isOpen;return(0,V.jsx)(_.G7,{className:N.drawerButton,children:t?(0,V.jsx)(re.Z,{name:"icon-shouqi",size:52}):(0,V.jsx)(re.Z,{name:"icon-zhankai",size:52})})}));!function(e){e[e.bulk_color_list=0]="bulk_color_list",e[e.length_cut_color_list=1]="length_cut_color_list",e[e.weight_cut_color_list=2]="weight_cut_color_list"}(ee||(ee={}));var ce=(0,m.memo)((function(e){var t,n=e.itemData,o=useShoppingContext().setCurrentCheckedSaleMode,i=(0,m.useState)(!1),l=(0,s.Z)(i,2),c=l[0],u=l[1],d=(0,m.useState)(0),a=(0,s.Z)(d,2),h=a[0],f=a[1],x=function onSelectOrderType(e){f(e),o(e),C(0)};(0,m.useRef)({bulk_color_list:null==n?void 0:n.bulk_color_list,length_cut_color_list:null==n?void 0:n.length_cut_color_list,weight_cut_color_list:null==n?void 0:n.weight_cut_color_list}).current={bulk_color_list:null==n?void 0:n.bulk_color_list,length_cut_color_list:null==n?void 0:n.length_cut_color_list,weight_cut_color_list:null==n?void 0:n.weight_cut_color_list};var p=useShoppingContext(),g=p.setChangedCheckbox,v=p.currentCheckedPurchaserId,w=p.setCurrentCheckedPurchaserId,k=p.isManageStatus,C=p.setSelectedAmount,j=p.colorStore,K=(p.currentCheckedSaleMode,(0,m.useMemo)((function(){return(0!==(null==n?void 0:n[ee[h]].length)?null==n?void 0:n[ee[h]]:[{}]).forEach((function(){g({purchaserId:null==n?void 0:n.purchaser_id,checked:!1})})),0!==(null==n?void 0:n[ee[h]].length)?null==n?void 0:n[ee[h]].map((function(e){return g({purchaserId:null==n?void 0:n.purchaser_id,goodsKind:(0,y.Z)({},null==e?void 0:e.id,{id:null==e?void 0:e.id,estimate_amount:e.estimate_amount,checked:!1,product_code:e.product_code,product_color_code:e.product_color_code,sale_mode:e.sale_mode,count:h===$.p.Bulk?e.roll:Number((0,S.N6)(e.length))}),checked:!1}),(0,V.jsx)(ne,{purchaserId:n.purchaser_id,itemData:e,orderType:h},e.id)})):(0,V.jsx)(_.G7,{className:N.noList,children:"暂无数据"})}),[n,h])),E=function handleClickLayout(){v!==(null==n?void 0:n.purchaser_id)&&(C(0),o(h),w(null==n?void 0:n.purchaser_id))},T=(0,m.useMemo)((function(){var e,t,o=null==j||null===(e=j[null==n?void 0:n.purchaser_id])||void 0===e?void 0:e.goodsKind;return!o||(0,ie.Qr)(o)?0:new Set(null===(t=Object.values(o))||void 0===t?void 0:t.reduce((function(e,t){return t.checked&&t.sale_mode===h?[].concat((0,r.Z)(e),[t.product_code]):e}),[])).size}),[j,v,h,n]),G=(0,m.useMemo)((function(){var e,t=null==j||null===(e=j[null==n?void 0:n.purchaser_id])||void 0===e?void 0:e.goodsKind;return!t||(0,ie.Qr)(t)?0:new Set(Object.values(t).reduce((function(e,t){return t.checked&&t.sale_mode===h?[].concat((0,r.Z)(e),[t.product_color_code]):e}),[])).size}),[j,v,h,n]),D=(0,m.useMemo)((function(){var e,t=null==j||null===(e=j[null==n?void 0:n.purchaser_id])||void 0===e?void 0:e.goodsKind;return!t||(0,ie.Qr)(t)?0:Object.values(t).reduce((function(e,t){return t.checked&&t.sale_mode===h?e+t.count:e}),0)||0}),[j,v,h,n]);return(0,V.jsxs)(Z.Z,{circle:!0,customClassName:b()(N.layout,(null==n?void 0:n.purchaser_id)===v?N.selected:""),onClick:E,children:[(0,V.jsx)(I.Z,{hiddenCheckboxIcon:!k,onSelect:function handleChecked(){g({purchaserId:null==n?void 0:n.purchaser_id,checked:!0})},onClose:function handleUnchecked(){g({purchaserId:null==n?void 0:n.purchaser_id,checked:!1})},status:null===(t=j[null==n?void 0:n.purchaser_id])||void 0===t?void 0:t.checked,customClassName:N.checkbox,customTextClass:N["checkbox--text"],triggerLabel:!1,children:(0,V.jsxs)(_.G7,{className:"flex-row justify-between",onClick:function handleOpenDetail(){u((function(e){return!e})),E()},children:[(0,V.jsxs)(_.G7,{className:N.topItem,children:[(0,V.jsxs)(_.G7,{className:"flex-row items-center",children:[(0,V.jsx)(_.G7,{className:N.topTitle,children:null==n?void 0:n.purchaser_name}),(0,V.jsx)(B.Z,{type:"info",size:"normal",circle:!0,plain:!0,children:null==n?void 0:n.sale_user_name})]}),(0,V.jsx)(_.G7,{className:N.summary,children:(0,V.jsxs)(_.xv,{children:["已选 ",T," 种面料,",G," 个颜色,共"," ",h===$.p.Bulk?"".concat(D," 条"):"".concat(D," 米")]})})]}),(0,V.jsx)(le,{isOpen:c})]})}),c&&(0,V.jsxs)(_.G7,{className:b()(N.detailBox,c?N.drawerOpen:N.drawerClose),children:[(0,V.jsxs)(_.G7,{className:N.orderType,children:[(0,V.jsx)(M.Z,{customClassName:N.line}),(0,V.jsx)(_.G7,{className:N.orderTitle,children:"订单类型"}),(0,V.jsxs)(_.G7,{className:N.orderTypeDetail,children:[(0,V.jsx)(se,{customStyle:{padding:"0 50rpx"},isActive:h===$.p.Bulk,onClick:function onClick(){return x($.p.Bulk)},children:"大货"}),(0,V.jsx)(se,{customStyle:{padding:"0 50rpx"},isActive:h===$.p.Plate,onClick:function onClick(){return x($.p.Plate)},children:"剪板"}),(0,V.jsx)(se,{customStyle:{padding:"0 50rpx"},isActive:h===$.p.BulkCut,onClick:function onClick(){return x($.p.BulkCut)},children:"散剪"})]})]}),(0,V.jsxs)(_.G7,{className:N.orderColor,children:[(0,V.jsx)(M.Z,{customClassName:N.line}),(0,V.jsxs)(_.G7,{className:b()(N.orderTitle,"justify-between"),children:[(0,V.jsx)(_.xv,{children:"布料颜色"}),(0,V.jsxs)(B.Z,{type:"danger",size:"normal",circle:!0,plain:!1,children:[H[h].title,"单位:",H[h].unit]})]})]}),(0,V.jsx)(_.G7,{className:N.orderContainer,children:K})]})]})}),(0,oe.t)()),se=function SaleModeButton(e){var t=e.onClick,n=e.children,o=e.isActive,r=void 0!==o&&o,i=e.customStyle;return(0,V.jsx)(_.G7,{className:b()(N.saleModeButton,r&&N["saleModeButton--active"]),style:i,onClick:function handleClick(){null==t||t()},children:(0,V.jsx)(_.G7,{className:b()(N["saleModeButton--text"]),children:n})})},ue=n(7594),_e={common_safe_area_y:"index-module__common_safe_area_y___ywkBM","flex-col":"index-module__flex-col___de8wP","flex-row":"index-module__flex-row___gDspD","justify-between":"index-module__justify-between___VoVh6","items-center":"index-module__items-center___ozCp3","flex-item":"index-module__flex-item___gVEzn","full-100":"index-module__full-100___jvGKu","color-blue":"index-module__color-blue___c4cFd","color-yellow":"index-module__color-yellow___fKrs3","color-green":"index-module__color-green___yIx6k","color-grey":"index-module__color-grey___oGnEl","color-white":"index-module__color-white___bN0GE",bottomBar:"index-module__bottomBar___s1C3T",bottomLeft:"index-module__bottomLeft___CXaSe",moneyText:"index-module__moneyText___HI_B_",moneyNumber:"index-module__moneyNumber___adzn0",unit:"index-module__unit___Yo7zI"},de=(0,m.memo)((function(e){var t=e.onSettleAccount,n=e.amount,o=void 0===n?0:n;return(0,V.jsxs)(_.G7,{className:_e.bottomBar,children:[(0,V.jsxs)(_.G7,{className:_e.bottomLeft,children:[(0,V.jsx)(_.xv,{className:_e.moneyText,children:"预估金额:"}),(0,V.jsxs)(_.xv,{className:_e.moneyNumber,children:[(0,V.jsx)(_.xv,{className:_e.unit,children:"¥"}),o]})]}),(0,V.jsx)(_.G7,{className:_e.bottomRight,children:(0,V.jsx)(ue.Z,{plain:!0,type:"primary",round:!0,size:"normal",onClick:function handleSettle(){t&&t()},children:(0,V.jsx)(_.xv,{style:{fontSize:"32rpx"},children:"结算"})})})]})})),ae={common_safe_area_y:"index-module__common_safe_area_y___eNJSZ","flex-col":"index-module__flex-col___PhLMD","flex-row":"index-module__flex-row___d_wkz","justify-between":"index-module__justify-between___zRtwG","items-center":"index-module__items-center___AJIf7","flex-item":"index-module__flex-item___w_MjE","full-100":"index-module__full-100___IkB6L","color-blue":"index-module__color-blue___J24Mw","color-yellow":"index-module__color-yellow___kGAM0","color-green":"index-module__color-green___aWfB5","color-grey":"index-module__color-grey___LVlhS","color-white":"index-module__color-white___qLZgT",bottomBar:"index-module__bottomBar___hWO3j",bottomLeft:"index-module__bottomLeft___UsLb7",moneyText:"index-module__moneyText___C4ulT",moneyNumber:"index-module__moneyNumber___fMs_5"},me=(0,m.memo)((function(e){var t=e.onDelete,n=e.onSelectCheckbox,o=(0,m.useState)(!1),r=(0,s.Z)(o,2),i=r[0],l=r[1];return(0,V.jsxs)(_.G7,{className:ae.bottomBar,children:[(0,V.jsx)(_.G7,{className:ae.bottomLeft,children:(0,V.jsx)(I.Z,{status:i,round:!0,size:"small",onSelect:function selectCallBack(){l(!0),n&&n(!0)},onClose:function closeCallBack(){l(!1),n&&n(!1)},customStyles:{color:"$color: #000000, $alpha: 0.6"},children:"全选"})}),(0,V.jsx)(_.G7,{className:ae.bottomRight,children:(0,V.jsx)(ue.Z,{plain:!0,round:!0,type:"danger",size:"normal",onClick:function handleSettle(){t&&t()},customStyles:{backgroundColor:"#F44761"},children:(0,V.jsx)(_.xv,{style:{fontSize:"32rpx"},children:"删除"})})})]})})),he=n(7835),fe=function ShoppingCart(e){var t=e.children,n=e.onTriggerCheckbox,o=e.initialValues,r=e.ref,i=function useShoppingCart(){var e=(0,m.useRef)(null);return{__INTERNAL__:e,setManageStatus:function setManageStatus(t){var n=e.current;n||throwError(),n.setManageStatus(t)},getManageStatus:function getManageStatus(){var t=e.current;return t||throwError(),t.getManageStatus()}}}(),l=r||i,u=(0,m.useRef)(n);u.current=n;var _=(0,m.useState)((function(){return o||{}})),d=(0,s.Z)(_,2),a=d[0],h=d[1],f=(0,m.useState)({}),x=(0,s.Z)(f,2),p=x[0],g=x[1],v=(0,m.useState)(-1),w=(0,s.Z)(v,2),k=w[0],b=w[1],C=(0,m.useState)(0),j=(0,s.Z)(C,2),N=j[0],S=j[1],Z=(0,m.useState)(!1),I=(0,s.Z)(Z,2),B=I[0],M=I[1],K=(0,m.useState)(0),E=(0,s.Z)(K,2),T=E[0],G=E[1],D=(0,m.useMemo)((function(){return{isManageStatus:B,setManageStatus:M,currentCheckedPurchaserId:k,setCurrentCheckedPurchaserId:b,currentCheckedSaleMode:N,setCurrentCheckedSaleMode:S,colorStore:a,setChangedCheckbox:function setChangedCheckbox(e){h((function(t){var n,o=(0,c.Z)((0,c.Z)({},null===(n=t[e.purchaserId])||void 0===n?void 0:n.goodsKind),e.goodsKind);return(0,c.Z)((0,c.Z)({},t),{},(0,y.Z)({},e.purchaserId,{purchaserId:e.purchaserId,goodsKind:o,checked:e.checked}))})),g(e)},setColorStore:h,selectedAmount:T,setSelectedAmount:G}}),[a,k,B,T]);return(0,m.useImperativeHandle)(l.__INTERNAL__,(function(){return{getManageStatus:function getManageStatus(){return D.isManageStatus},setManageStatus:D.setManageStatus}}),[D.isManageStatus,D.setManageStatus]),(0,m.useEffect)((function(){var e;null===(e=u.current)||void 0===e||e.call(u,{colorStore:a,changedCheckbox:p,currentCheckedPurchaserId:k,setSelectedAmount:G})}),[a,p,k]),(0,V.jsx)(Y.Provider,{value:D,children:t})},xe=(0,m.memo)((function(){var e=(0,m.useCallback)((function(e){var t,n=e.colorStore,o=(e.changedCheckbox,e.currentCheckedPurchaserId),r=e.setSelectedAmount,i=null==n||null===(t=n[o])||void 0===t?void 0:t.goodsKind;i?r(Object.values(i).reduce((function(e,t){return t.checked?e+Number((0,S.yb)(t.estimate_amount)):e}),0)):r(0)}),[]);return(0,V.jsx)(fe,{onTriggerCheckbox:e,children:(0,V.jsx)(pe,{})})})),pe=function ShoppingCartContainer(){var e,t,n=useShoppingContext(),o=n.isManageStatus,d=n.setManageStatus,h=n.selectedAmount,k=n.currentCheckedPurchaserId,y=n.currentCheckedSaleMode,N=n.colorStore,S=n.setColorStore,Z=(0,m.useState)("auto"),I=(0,s.Z)(Z,2),B=I[0],M=I[1],K=(0,he.kM)(),E=K.fetchData,T=K.state,G=(0,m.useState)({short_name_or_phone:""}),D=(0,s.Z)(G,2),P=D[0],O=D[1];(0,m.useEffect)((function(){E(P)}),[P]);var A=(0,m.useCallback)((function(e){O((function(t){return(0,c.Z)((0,c.Z)({},t),{},{short_name_or_phone:e})}))}),[]),R=(0,m.useState)({list:[],total:0}),z=(0,s.Z)(R,2),L=z[0],F=z[1],q=(0,m.useMemo)((function(){return(0,X.rA)({list:L.list,total:L.total,status:T.loading})}),[L,T]);(0,m.useLayoutEffect)((function(){(0,l.Z)((0,i.Z)().mark((function _callee(){var e;return(0,i.Z)().wrap((function _callee$(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,E();case 2:(e=a().createSelectorQuery()).select("#shoppingContainer").boundingClientRect(),e.select("#topBar").boundingClientRect(),e.select("#bottomBar").boundingClientRect(),e.exec((function(e){var t=e[0].height,n=e[1].height,o=e[2].height;M(t-n-o+"px")}));case 8:case"end":return t.stop()}}),_callee)})))()}),[]),(0,m.useEffect)((function(){F({list:T.data,total:T.data.length})}),[T]);var J=(0,X.Ds)((function(){var e,t=null==N||null===(e=N[k])||void 0===e?void 0:e.goodsKind;if(!t)return a().showToast({title:"请先选择客户",icon:"error"});var n=Object.values(t).reduce((function(e,t){return t.checked?[].concat((0,r.Z)(e),[t.id]):e}),[]);if(0===n.length)return a().showToast({title:"请先选择商品",icon:"error"});(0,ie.jD)("/pages/submitOrder/index",{purchaser_id:k,sale_mode:y,shopping_cart_product_color_list:JSON.stringify(n)})}),400),Q=(0,he.iN)().fetchData,U=function(){var e=(0,l.Z)((0,i.Z)().mark((function _callee3(){var e,t;return(0,i.Z)().wrap((function _callee3$(n){for(;;)switch(n.prev=n.next){case 0:if(!(t=null==N||null===(e=N[k])||void 0===e?void 0:e.goodsKind)||!Object.values(t).every((function(e){return!e.checked}))){n.next=3;break}return n.abrupt("return",a().showToast({title:"请选择商品",icon:"error"}));case 3:a().showModal({title:"要取消这些商品吗?",success:function(){var e=(0,l.Z)((0,i.Z)().mark((function _callee2(e){var t;return(0,i.Z)().wrap((function _callee2$(n){for(;;)switch(n.prev=n.next){case 0:if(!e.confirm){n.next=5;break}return n.next=3,Q();case 3:(t=n.sent).success?(ie.Z9.success("取消成功"),E()):ie.Z9.none(t.msg);case 5:case"end":return n.stop()}}),_callee2)})));return function success(t){return e.apply(this,arguments)}}()});case 4:case"end":return n.stop()}}),_callee3)})));return function handleDelete(){return e.apply(this,arguments)}}(),W=(0,m.useState)(!1),$=(0,s.Z)(W,2),H=$[0],Y=$[1],ee=function(){var e=(0,l.Z)((0,i.Z)().mark((function _callee4(){return(0,i.Z)().wrap((function _callee4$(e){for(;;)switch(e.prev=e.next){case 0:return Y(!0),e.next=3,E(P);case 3:e.sent.success?(Y(!1),a().showToast({title:"刷新成功",icon:"success"})):(a().showToast({title:"刷新失败",icon:"error"}),Y(!1));case 5:case"end":return e.stop()}}),_callee4)})));return function handleRefresh(){return e.apply(this,arguments)}}();return(0,V.jsxs)(_.G7,{className:b()("flex-col",f),id:"shoppingContainer",children:[(0,V.jsx)(_.G7,{className:x,id:"topBar",children:(0,V.jsx)(u.Z,{placeholder:"请输入客户名称",showBtn:!1,changeOnSearch:A,debounceTime:300,children:(0,V.jsx)(_.G7,{className:v,onClick:function onStartToManage(){d(!o)},children:o?(0,V.jsx)(C.Z,{svg:!0,iconName:"icon-guanlidingdan",text:"取消",color:"#4581ff",customClass:w}):(0,V.jsx)(C.Z,{svg:!0,iconName:"icon-guanlidingdan",text:"管理"})})})}),(0,V.jsx)(_.G7,{className:b()("flex-item","flex-col",p),children:(0,V.jsx)(_.G7,{className:b()(g,"flex-item"),style:{height:B},children:(0,V.jsx)(j.Z,{statusMore:q,refresherEnabled:!0,selfOnRefresherRefresh:ee,refresherTriggered:H,children:!(null==L||null===(e=L.list)||void 0===e||!e.length)&&(null==L||null===(t=L.list)||void 0===t?void 0:t.map((function(e,t){return(0,V.jsx)(ce,{itemData:e},t)})))})})}),(0,V.jsx)(_.G7,{id:"bottomBar",children:o?(0,V.jsx)(me,{onDelete:U,onSelectCheckbox:function onSelectCheckbox(e){return function handleSelectAllCheckbox(e){var t={};Object.entries(N).forEach((function(n){var o=(0,s.Z)(n,2),r=o[0],i=o[1];t[r]=(0,c.Z)((0,c.Z)({},i),{},{checked:e})})),S((function(){return t}))}(e)}}):(0,V.jsx)(de,{onSettleAccount:J,amount:h})})]})},ge=xe;Page((0,o.createPageConfig)(ge,"pages/shopping/index",{root:{cn:[]}},{navigationBarTitleText:"购物页面"}||{}))}},function(e){e.O(0,[2107,1216,8592],(function(){return t=2880,e(e.s=t);var t}));e.O()}]);