2023-05-16 13:02:46 +08:00

1 line
24 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";(wx.webpackJsonp=wx.webpackJsonp||[]).push([[8076],{1486:function(e,n,t){var c=t(2180),l=t(1413),o=t(4165),s=t(5861),r=t(9439),a=t(1515),i=t(2954),u=t.n(i),_=t(7294),d=t(3012),m=t(4456),x=t(5893);var f=function createCtx(){var e=_.createContext(void 0);return[function useCtx(){var n=(0,_.useContext)(e);if(void 0===n)throw new Error("useCtx must be inside a Provider with a value");return n},e.Provider]}(),h=(0,r.Z)(f,2),p=h[0],v=h[1],ContextShop=function(e){var n=(0,_.useReducer)((function reducer(e,n){switch(n.type){case"setInitData":return j(e,n);case"updateProduct":return b(e,n);case"setRecommendId":return(0,l.Z)((0,l.Z)({},e),{},{recommendId:n.data.recommendId});case"setDelCommendId":return(0,l.Z)((0,l.Z)({},e),{},{delCommendId:n.data.delCommendId});default:return e}}),{list:[],statistics:{product_number:0,color_number:0,roll_number:0,length_number:0,price_number:0},recommendId:0,delCommendId:0}),t=(0,r.Z)(n,2),c=t[0],o=t[1];return(0,x.jsx)(v,{value:{state:c,dispatch:o},children:e.children})},j=function onInitData(e,n){var t,c=n.data;return null===(t=c.list)||void 0===t||t.map((function(e,n){var t;e.index_str=n.toString(),e.checked=!1,null===(t=e.color_list)||void 0===t||t.map((function(e,t){e.index_str="".concat(n,",").concat(t),e.checked=!1}))})),(0,l.Z)((0,l.Z)({},e),{},{list:c.list,sale_mode:c.sale_mode,recommendId:0,statistics:{product_number:0,color_number:0,roll_number:0,length_number:0,price_number:0},delCommendId:0})},b=function onUpdateData(e,n){var t,c=n.data,o={product_number:0,color_number:0,roll_number:0,length_number:0,price_number:0};return null===(t=c.list)||void 0===t||t.map((function(e,n){var t;null===(t=e.color_list)||void 0===t||t.map((function(e){e.checked&&(o.color_number+=1,o.price_number+=e.estimate_amount,o.roll_number+=e.roll,o.length_number+=e.length)})),e.checked&&(o.product_number+=1)})),console.log("data:::",c.list),(0,l.Z)((0,l.Z)({},e),{},{list:c.list,statistics:o})},k=(0,_.memo)((0,_.forwardRef)((function(e,n){var t=e.colorItem,c=p(),l=c.state,o=c.dispatch,s=t.index_str.split(","),r=(0,_.useCallback)((function(e){l.list[s[0]].color_list[s[1]].checked=!l.list[s[0]].color_list[s[1]].checked;var n=l.list[s[0]].color_list.some((function(e){return e.checked}));l.list[s[0]].checked=n,o({type:"updateProduct",data:{list:l.list}})}),[l.list[s[0]].color_list[s[1]].checked]);return(0,_.useImperativeHandle)(n,(function(){return{onSelect:r}})),(0,x.jsx)(Z,{checkStatus:l.list[s[0]].color_list[s[1]].checked,onSelect:r})}))),Z=(0,_.memo)((function(e){var n=e.checkStatus,t=e.onSelect,c=function setSelect(e){null==t||t(e)};return(0,x.jsx)(m.Z,{status:n,onSelect:function onSelect(){return c(!0)},onClose:function onClose(){return c(!1)}})})),g="index-module__recommended_main___WIzv4",C="index-module__recommended___BoUnb",N="index-module__icon___uf2F3",S=t(6028),G=(0,_.memo)((function(e){var n=e.onClick;return(0,x.jsx)(a.G7,{className:g,children:(0,x.jsxs)(a.G7,{className:C,onClick:n,children:[(0,x.jsx)(a.xv,{children:"选择专属一对一配套螺纹推荐"}),(0,x.jsx)(a.G7,{className:N,children:(0,x.jsx)(S.Z,{name:"icon-xiala",size:30})})]})})})),w="index-module__shop_product_item_con___rztuO",I="index-module__shop_product_item___WlGlj",y="index-module__item_con___cAPTN",F="index-module__img___n35HX",D="index-module__item_name_price_count___sZP7R",M="index-module__name_price___u7zsh",B="index-module__price___u9uYc",P="index-module__count_con___rr5hg",E="index-module__recommend_title___su2GQ",R="index-module__count___pkmyz",z=t(6599),O=t(6312),T=t(4158),L=t(9612),V=t(8093),J=t(8629),U=(0,_.memo)((function(e){var n=(0,L.au)().fetchData,t=(0,L.Lb)().fetchData,c=(0,L.Lf)().fetchData,r=e.colorItem,a=p(),i=a.state,d=a.dispatch,m=r.index_str.split(","),f=i.list[m[0]].color_list[m[1]],h=(0,_.useCallback)(function(){var e=(0,s.Z)((0,o.Z)().mark((function _callee2(e){var a;return(0,o.Z)().wrap((function _callee2$(_){for(;;)switch(_.prev=_.next){case 0:if(0!=e.roll||0!=e.length){_.next=4;break}u().showModal({content:"确定删除该商品?",confirmText:"删除",success:function success(e){return(0,s.Z)((0,o.Z)().mark((function _callee(){return(0,o.Z)().wrap((function _callee$(n){for(;;)switch(n.prev=n.next){case 0:if(!e.confirm){n.next=7;break}return n.next=3,c({id:[f.id]});case 3:n.sent.success&&d({type:"setDelCommendId",data:{list:i.list,delCommendId:f.id}}),n.next=8;break;case 7:e.cancel&&(i.list[m[0]].color_list[m[1]]=(0,l.Z)({},i.list[m[0]].color_list[m[1]]),d({type:"updateProduct",data:{list:i.list}}));case 8:case"end":return n.stop()}}),_callee)})))()}}),_.next=10;break;case 4:return _.next=6,n(e);case 6:return _.next=8,t({id:r.id});case 8:(a=_.sent).success&&(i.list[m[0]].color_list[m[1]]=(0,l.Z)((0,l.Z)({},i.list[m[0]].color_list[m[1]]),a.data.color_list[0]),d({type:"updateProduct",data:{list:i.list}}));case 10:case"end":return _.stop()}}),_callee2)})));return function(n){return e.apply(this,arguments)}}(),[f]),v=(0,_.useCallback)((function(){d({type:"setRecommendId",data:{list:i.list,recommendId:f.id}})}),[f]);return(0,x.jsx)($,{colorItem:i.list[m[0]].color_list[m[1]],onChangeNum:h,onSubmitSuccess:v})})),$=(0,_.memo)((function(e){var n=e.colorItem,t=e.onChangeNum,c=e.onSubmitSuccess,l=(0,_.useMemo)((function(){return{lab:n.lab,rgb:n.rgb,texture_url:n.texture_url,title:n.product_color_code}}),[n]),i=(0,_.useState)(0),u=(0,r.Z)(i,2),m=u[0],f=u[1];(0,_.useEffect)((function(){f((function(){return 0===n.sale_mode?n.roll:n.length/100}))}),[n]);var h=(0,V.Ds)(function(){var e=(0,s.Z)((0,o.Z)().mark((function _callee3(e){var c;return(0,o.Z)().wrap((function _callee3$(l){for(;;)switch(l.prev=l.next){case 0:f(e),c={id:n.id,length:0,roll:0},0===n.sale_mode?c.roll=e:c.length=(0,d.Z)(e).times(100).toNumber(),null==t||t(c);case 4:case"end":return l.stop()}}),_callee3)})));return function(n){return e.apply(this,arguments)}}(),300),p=J.L_,v=(0,_.useMemo)((function(){return p[n.sale_mode]}),[n]);console.log("colorItem::",n);var j=(0,_.useRef)(null);return(0,x.jsx)(x.Fragment,{children:(0,x.jsxs)(a.G7,{className:w,children:[(0,x.jsxs)(a.G7,{className:I,children:[(0,x.jsx)(k,{colorItem:n,ref:j}),(0,x.jsxs)(a.G7,{className:y,onClick:function onClick(){return j.current.onSelect()},children:[(0,x.jsx)(a.G7,{className:F,children:(0,x.jsx)(z.Z,{value:l})}),(0,x.jsxs)(a.G7,{className:D,children:[(0,x.jsxs)(a.G7,{className:M,children:[(0,x.jsx)(a.xv,{children:n.product_color_code+n.product_color_name}),(0,x.jsxs)(a.G7,{className:B,children:[(0,x.jsx)(a.xv,{}),(0,x.jsxs)(a.xv,{children:["¥",(0,T.yb)(n.sale_price),"/kg"]})]})]}),(0,x.jsxs)(a.G7,{className:P,children:[(0,x.jsx)(a.G7,{className:E,children:n.is_screw_recommend&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(a.xv,{children:"推荐"}),(0,x.jsx)(a.xv,{children:"配套螺纹"})]})}),(0,x.jsx)(a.G7,{className:R,children:(0,x.jsx)(a.fV,{children:(0,x.jsx)(O.Z,{onClickBtn:h,minNum:v.minNum,maxNum:v.maxNum,onBlue:h,defaultNum:m,unit:0===n.sale_mode?"条":"米",digits:v.digits,returnZero:!0})})})]})]})]})]}),n.has_screw_recommend&&(0,x.jsx)(G,{onClick:c})]})})})),H=(0,_.memo)((function(e){var n=e.productItem,t=p(),c=t.state,l=t.dispatch,o=n.index_str.split(",")[0],s=(0,_.useCallback)((function(e){var n;c.list[o].checked=e,null===(n=c.list[o].color_list)||void 0===n||n.map((function(n,t){return n.checked=e})),l({type:"updateProduct",data:{list:c.list}})}),[c.list[o].checked]);return(0,x.jsx)(W,{checkStatus:c.list[o].checked,onSelect:s})})),W=(0,_.memo)((function(e){var n=e.checkStatus,t=e.onSelect,c=function setSelect(e){null==t||t(e)};return(0,x.jsx)(m.Z,{status:n,onSelect:function onSelect(){return c(!0)},onClose:function onClose(){return c(!1)}})})),K="index-module__shop_product___pTpMG",q="index-module__shop_product_title___Jp7zd",X="index-module__title_desc___aXuC0",Y="index-module__model___IziQM",A="index-module__name___Rf6mj",Q="index-module__label___dhWvL",ee=(0,_.memo)((function(e){var n=e.productItem;return(0,_.useEffect)((function(){console.log("productItem66:::",n)}),[n]),(0,x.jsx)(ne,{productItem:n,sale_mode:0})})),ne=(0,_.memo)((function(e){var n,t=e.productItem,c=(e.onSelect,e.sale_mode),l=(0,_.useMemo)((function(){return["大货","剪版","删剪"][c]}),[c]);return console.log("productItem22::",t),(0,x.jsxs)(a.G7,{className:K,children:[(0,x.jsxs)(a.G7,{className:q,children:[(0,x.jsx)(H,{productItem:t}),(0,x.jsx)(a.G7,{className:X,children:(0,x.jsxs)(a.G7,{className:Y,children:[(0,x.jsx)(a.xv,{className:A,children:(0,T.W7)(null==t?void 0:t.product_code,null==t?void 0:t.product_name)}),(0,x.jsx)(a.xv,{className:Q,children:l})]})})]}),null==t||null===(n=t.color_list)||void 0===n?void 0:n.map((function(e){return(0,x.jsx)(U,{colorItem:e},e.product_color_id)}))]})})),te=t(4184),ce=t.n(te),le="index-module__Settlement_btn___fTHki",oe="index-module__select_text___zTQjs",se="index-module__price_count___GpC2T",re="index-module__price___MEOVU",ae="index-module__count___Aussa",ie="index-module__btn___dBTVw",ue="index-module__del___iwMk8",bottomBtn=function(e){var n=e.onSelect,t=e.model,c=e.onBtnClick,l=p(),o=l.state;l.dispatch;return(0,x.jsx)(_e,{onSelect:n,statistics:o.statistics,model:t,onBtnClick:c,sale_mode:o.sale_mode})},_e=(0,_.memo)((function(e){var n=e.onSelect,t=e.statistics,c=e.model,l=e.sale_mode,o=(0,_.useState)(!1),s=(0,r.Z)(o,2),i=s[0],u=s[1],d=function getSelect(e){u((function(){return e})),null==n||n(e)};(0,_.useEffect)((function(){u(!1)}),[l]);var f=(0,_.useMemo)((function(){return 0===l?"已选".concat(null==t?void 0:t.product_number,"种面料,").concat(null==t?void 0:t.color_number,"个颜色,共").concat(null==t?void 0:t.roll_number,"条"):"已选".concat(null==t?void 0:t.product_number,"种面料,").concat(null==t?void 0:t.color_number,"个颜色,共").concat(((null==t?void 0:t.length_number)||0)/100,"米")}),[t]);return(0,x.jsxs)(a.G7,{className:le,children:[(0,x.jsx)(m.Z,{status:i,onSelect:function onSelect(){return d(!0)},onClose:function onClose(){return d(!1)}}),(0,x.jsx)(a.xv,{className:oe,children:"全选"}),(0,x.jsx)(a.G7,{className:se,children:!c&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(a.G7,{className:re,children:[(0,x.jsx)(a.xv,{children:"预估金额:"}),(0,x.jsxs)(a.xv,{children:["¥",(0,T.yb)(null==t?void 0:t.price_number)]})]}),(0,x.jsx)(a.G7,{className:ae,children:f})]})}),(0,x.jsx)(a.G7,{onClick:function onBtnClick(){var n;null===(n=e.onBtnClick)||void 0===n||n.call(e,c)},className:ce()(ie,c&&ue),children:c?"删除":"结算"})]})})),de="index-module__shop_header_sort_main___Ki_a1",me="index-module__shop_header_sort___FHXag",xe="index-module__sort___coeeb",fe="index-module__edit___g1QL_",he="index-module__sort_list___YmsqR",pe="index-module__item_sort___YSKxM",ve="index-module__search_item_select___jO8xk",je="index-module__sort_list_selected___P1rrS",be="index-module__mask___JAm1V",ke=(0,_.memo)((function(e){var n=e.onSelect,t=(0,_.useState)(!1),c=(0,r.Z)(t,2),l=c[0],o=c[1],s=(0,_.useState)({value:-1,title:"添加时间降序"}),i=(0,r.Z)(s,2),u=i[0],d=i[1],m=(0,_.useState)(!1),f=(0,r.Z)(m,2),h=f[0],p=f[1];return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(a.G7,{className:de,children:[(0,x.jsxs)(a.G7,{className:me,children:[(0,x.jsxs)(a.G7,{className:xe,onClick:function onClick(){return o(!0)},children:[(0,x.jsx)(S.Z,{name:"icon-paixu1",size:30,color:"#337FFFFF"}),(0,x.jsx)(a.xv,{children:u.title}),(0,x.jsx)(S.Z,{name:"icon-zhankai",size:30,color:"#337FFFFF"})]}),(0,x.jsxs)(a.G7,{className:fe,onClick:function onChange(){var n;p(!h),null===(n=e.onChange)||void 0===n||n.call(e,!h)},children:[(0,x.jsx)(S.Z,{name:"icon-guanli",size:43,color:"".concat(h?"#337FFFFF":"#000000FF")}),(0,x.jsx)(a.xv,{style:{color:"".concat(h?"#337FFFFF":"#000000FF")},children:h?"取消":"管理"})]})]}),(0,x.jsx)(a.G7,{className:ce()(he,l&&je),children:[{value:-1,title:"添加时间降序"},{value:1,title:"添加时间升序"},{value:-2,title:"面料编号降序"},{value:2,title:"面料编号升序"}].map((function(e){return(0,x.jsx)(a.G7,{onClick:function onClick(){return function getSelect(e){o(!1),n(e),d(e)}(e)},className:ce()(pe,u.value===e.value&&ve),children:e.title},e.value)}))})]}),l&&(0,x.jsx)(a.G7,{className:be,onClick:function onClick(){return o(!1)}})]})})),Ze="index-module__shop_search___RfTT0",ge="index-module__search_item___Bdsmv",Ce="index-module__search_item_select___CBw_o",Ne=(0,_.memo)((function(e){var n=e.numberStatus,t=void 0===n||n,c=J.L_,l=e.defaultIndex,o=void 0===l?0:l,s=e.onSelect,i=e.numberObj,u=(0,_.useState)(0),d=(0,r.Z)(u,2),m=d[0],f=d[1];(0,_.useEffect)((function(){o!==m&&f(o)}),[o]);var h=function getName(e){return e.title+(t?"".concat(null==i?void 0:i[e.field],""):"")};return(0,x.jsx)(a.G7,{className:Ze,children:null==c?void 0:c.map((function(e){return(0,x.jsx)(a.G7,{onClick:function onClick(){return null==s?void 0:s(e)},className:ce()(ge,m===e.value&&Ce),children:h(e)},e.value)}))})})),Se="index-module__empty___GbJms",Ge="index-module__title___MDyY5",we="index-module__btn___V85Ma",Ie=t(1115),ye=(0,_.memo)((function(){return(0,x.jsxs)(a.G7,{className:Se,onClick:function onClick(){return(0,Ie.jD)("/pages/index/index",{},"switchTab")},children:[(0,x.jsx)(a.G7,{className:Ge,children:"暂未选择商品"}),(0,x.jsx)(a.G7,{className:we,children:"去选购"})]})})),Fe={common_safe_area_y:"index-module__common_safe_area_y___n16wo",hoverClass:"index-module__hoverClass___kc1Ni","full-100":"index-module__full-100___lkU0H",shop_product_item_con:"index-module__shop_product_item_con___XqSrn",shop_product_item:"index-module__shop_product_item___rFxc2",title_desc:"index-module__title_desc___noweV",model:"index-module__model___q3qEH",label:"index-module__label___j3KZ2",item_con:"index-module__item_con___RP4Va",img:"index-module__img___YfAJ5",item_name_price_count:"index-module__item_name_price_count___Letv2",name_price:"index-module__name_price___wF3H1",price:"index-module__price___K8SyH",count:"index-module__count___KWI2i",recommended:"index-module__recommended___jUOjp",icon:"index-module__icon___CwOq7"},De=(0,_.memo)((function(e){return(0,x.jsx)(Me,(0,l.Z)({},e))})),Me=(0,_.memo)((function(e){var n=e.colorItem,t=e.onChangeNum,c=(0,_.useMemo)((function(){return{lab:null==n?void 0:n.lab,rgb:null==n?void 0:n.rgb,texture_url:null==n?void 0:n.texture_url,title:null==n?void 0:n.screw_color_code}}),[n]),l=(0,V.Ds)((function(e){m(e)}),300),o=J.L_,s=(0,_.useMemo)((function(){return console.log("colorItem123123::",n),n&&o[n.sale_mode_type]}),[null==n?void 0:n.sale_mode_type]),i=(0,_.useState)(0),u=(0,r.Z)(i,2),d=u[0],m=u[1];return(0,_.useEffect)((function(){n&&m(o[n.sale_mode_type].defaultNum)}),[null==n?void 0:n.sale_mode_type]),(0,_.useEffect)((function(){null==t||t(d)}),[d]),(0,x.jsx)(x.Fragment,{children:(0,x.jsx)(a.G7,{className:Fe.shop_product_item_con,children:(0,x.jsxs)(a.G7,{className:Fe.shop_product_item,children:[(0,x.jsx)(a.G7,{className:Fe.title_desc,children:(0,x.jsxs)(a.G7,{className:Fe.model,children:[(0,x.jsx)(a.xv,{className:Fe.name,children:(0,T.W7)(null==n?void 0:n.screw_code,null==n?void 0:n.screw_name)}),(0,x.jsx)(a.xv,{className:Fe.label,children:null==s?void 0:s.title})]})}),(0,x.jsxs)(a.G7,{className:Fe.item_con,children:[(0,x.jsx)(a.G7,{className:Fe.img,children:(0,x.jsx)(z.Z,{value:c})}),(0,x.jsxs)(a.G7,{className:Fe.item_name_price_count,children:[(0,x.jsxs)(a.G7,{className:Fe.name_price,children:[(0,x.jsx)(a.xv,{children:(null==n?void 0:n.screw_color_code)+(null==n?void 0:n.screw_color_name)}),(0,x.jsxs)(a.G7,{className:Fe.price,children:[(0,x.jsx)(a.xv,{children:(null==n?void 0:n.standard_price)>(null==n?void 0:n.sale_price)&&0===n.sale_mode_type&&"¥".concat((0,T.yb)(null==n?void 0:n.standard_price))}),(0,x.jsxs)(a.xv,{children:["¥",(0,T.yb)(null==n?void 0:n.sale_price),"/kg"]})]})]}),(0,x.jsx)(a.G7,{className:Fe.count,children:(0,x.jsx)(a.fV,{children:(0,x.jsx)(O.Z,{onClickBtn:l,minNum:null==s?void 0:s.minNum,maxNum:null==s?void 0:s.maxNum,onBlue:l,defaultNum:d,unit:null==s?void 0:s.unit,digits:null==s?void 0:s.digits})})})]})]})]})})})})),Be="index-module__recommended_open___evO2G",Pe="index-module__search___zZaex",Ee="index-module__onSubmit___W0GV7",Re="index-module__mask___oNOBP",ze=(0,_.memo)((function(e){var n=e.shopId,t=e.submitSuccess,c=e.onShow,i=void 0!==c&&c,u=e.onClose,m=(0,_.useState)({id:0,sale_mode:0}),f=(0,r.Z)(m,2),h=f[0],p=f[1],v=(0,_.useRef)({sale_mode:0,color_list:[],is_screw_recommend:!0});(0,_.useEffect)((function(){h.id!==n&&p((function(e){return(0,l.Z)((0,l.Z)({},e),{},{id:n})}))}),[n]);var j=(0,_.useState)(),b=(0,r.Z)(j,2),k=b[0],Z=b[1],g=(0,L.QM)().fetchData,C=function(){var e=(0,s.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 n.next=2,g({id:h.id,sale_mode:h.sale_mode});case 2:(e=n.sent).success&&(e.data=(0,l.Z)((0,l.Z)({},e.data),{},{sale_mode_type:h.sale_mode}),F(J.L_[h.sale_mode].defaultNum,e.data.screw_color_id),Z(e.data));case 4:case"end":return n.stop()}}),_callee)})));return function getScrewProduct(){return e.apply(this,arguments)}}(),N=(0,_.useState)(!1),S=(0,r.Z)(N,2),G=S[0],w=S[1];(0,_.useEffect)((function(){w((function(){return i}))}),[i]),(0,_.useEffect)((function(){G&&C()}),[G,h]);var I=(0,_.useCallback)((function(e){v.current.sale_mode=e.value,p((function(n){return(0,l.Z)((0,l.Z)({},n),{},{sale_mode:e.value})}))}),[]),y=(0,_.useCallback)((function(e){F(e,null==k?void 0:k.screw_color_id)}),[k]),F=function onSubmitData(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n={product_color_id:arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,length:0,roll:0};console.log("num::::",e),0===h.sale_mode?n.roll=e:n.length=(0,d.Z)(e).times(100).toNumber(),v.current.color_list=[n]},D=(0,L.RX)().fetchData,M=(0,_.useCallback)((0,s.Z)((0,o.Z)().mark((function _callee2(){return(0,o.Z)().wrap((function _callee2$(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,D(v.current);case 2:e.sent.success&&(null==t||t());case 4:case"end":return e.stop()}}),_callee2)}))),[]);return(0,x.jsxs)(x.Fragment,{children:[G&&(0,x.jsxs)(a.G7,{className:Be,children:[(0,x.jsx)(a.G7,{className:Pe,children:(0,x.jsx)(Ne,{onSelect:I,numberStatus:!1,defaultIndex:h.sale_mode})}),(0,x.jsx)(De,{colorItem:k,onChangeNum:y}),(0,x.jsx)(a.G7,{className:Ee,onClick:M,children:"确认添加"})]}),G&&(0,x.jsx)(a.G7,{catchMove:!0,className:Re,onClick:function onCloseEven(){null==u||u(),w((function(){return!1}))}})]})})),Oe="index-module__shop_main___VJEk3",Te="index-module__shop_con___X4IBn",Le="index-module__scroll_view___obDmI",Ve="index-module__shop_header___P54q_",Je="index-module__search_title___VtWaz",Ue="index-module__loading_card___mu6JK",$e=t(4508),He=t(8106),We=t(2890),Ke=t(515),qe=t(9194),Xe=t(9714),Ye=t(4408),Ae=t(7380),Qe=t(6353),en=t(1341),nn=t(9498),main=function(){var e,n=p(),t=n.state,c=n.dispatch,d=(0,_.useState)({abstract_sort_key:-1,sale_mode:0}),m=(0,r.Z)(d,2),f=m[0],h=m[1];(0,nn.av)("pages/shopCar/index");var v=(0,qe.v)((function(e){return e.userInfo})),j=(0,_.useTransition)(),b=(0,r.Z)(j,2),k=b[0],Z=b[1],g=(0,L.wk)(),C=g.fetchData,N=g.state,S=function(){var e=(0,s.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 n.next=2,C(f);case 2:(e=n.sent).success&&Z((function(){var n;c({type:"setInitData",data:{list:JSON.parse(JSON.stringify(null==e||null===(n=e.data)||void 0===n?void 0:n.product_list)),sale_mode:f.sale_mode}})}));case 4:case"end":return n.stop()}}),_callee)})));return function getShoppingCart(){return e.apply(this,arguments)}}(),G=(0,_.useState)({bulk_number:0,length_length:0,weight_number:0}),w=(0,r.Z)(G,2),I=w[0],y=w[1],F=(0,L.Bw)().fetchData,D=function(){var e=(0,s.Z)((0,o.Z)().mark((function _callee2(){var e;return(0,o.Z)().wrap((function _callee2$(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,F();case 2:(e=n.sent).success&&y(e.data);case 4:case"end":return n.stop()}}),_callee2)})));return function getProductColorNum(){return e.apply(this,arguments)}}(),M=(0,_.useRef)(!1);(0,i.useDidShow)((function(){D(),M.current&&S(),M.current=!0}));var B=(0,_.useCallback)((function(e){var n;null===(n=t.list)||void 0===n||n.map((function(n){var t;n.checked=e,null===(t=n.color_list)||void 0===t||t.map((function(n){n.checked=e}))})),c({type:"updateProduct",data:{list:t.list}})}),[t.list]);(0,_.useEffect)((function(){S()}),[f]);var P=(0,_.useCallback)((function(e){h((function(n){return(0,l.Z)((0,l.Z)({},n),{},{abstract_sort_key:e.value})}))}),[]),E=(0,_.useCallback)((function(e){h((function(n){return(0,l.Z)((0,l.Z)({},n),{},{sale_mode:e.value})}))}),[]),R=(0,_.useMemo)((function(){return N.loading||k}),[N.loading,k]),z=(0,_.useState)(!1),O=(0,r.Z)(z,2),U=O[0],$=O[1],H=(0,_.useCallback)((function(e){$((function(){return e}))}),[]),W=(0,L.Lf)().fetchData,K=(0,_.useRef)(null),q=(0,_.useState)(!1),X=(0,r.Z)(q,2),Y=X[0],A=X[1],Q=(0,He.K9)().fetchData,ne=(0,He.Dd)().fetchData,te=(0,V.P2)((0,s.Z)((0,o.Z)().mark((function _callee3(){var e,n,c,l,s;return(0,o.Z)().wrap((function _callee3$(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,Q();case 2:if(3===(e=o.sent).data.order_access_status){o.next=7;break}return 1==e.data.order_access_status&&ne(),null===(n=K.current)||void 0===n||n.handleChange(!0),o.abrupt("return");case 7:if(!v.adminUserInfo.first_change_name){o.next=10;break}return A(!0),o.abrupt("return");case 10:0==(c=le()).length?Ie.Z9.error("请选择面料"):(s=c.join("-"),(0,We.t4)({ids:s,sale_mode:t.sale_mode}),console.log("state",t),(0,en.l_)({order_type:(null===(l=Object.values(J.ar).find((function(e){return e.value===t.sale_mode})))||void 0===l?void 0:l.label)||"",trigger_time:(0,T.o0)(new Date),purchaser_name:v.adminUserInfo.user_name||"未知用户",purchaser_id:v.adminUserInfo.user_id||0}),(0,Ie.jD)("/pages/order/comfirm"));case 12:case"end":return o.stop()}}),_callee3)}))),500),ce=function delShop(){u().showModal({content:"删除所选商品?",success:function success(e){return(0,s.Z)((0,o.Z)().mark((function _callee4(){var n;return(0,o.Z)().wrap((function _callee4$(t){for(;;)switch(t.prev=t.next){case 0:if(!e.confirm){t.next=9;break}return n=le(),console.log("ids:::",n),t.next=5,W({id:n});case 5:t.sent.success&&(S(),D()),t.next=10;break;case 9:e.cancel&&console.log("用户点击取消");case 10:case"end":return t.stop()}}),_callee4)})))()}})},le=function getSelectIds(){var e=[];return t.list.map((function(n){n.color_list.map((function(n){n.checked&&e.push(n.id)}))})),e},oe=(0,_.useCallback)((function(){A(!1)}),[]),se=(0,_.useCallback)((function(e){A(e)}),[]),re=(0,Ye.Z)().getAdminUserInfo,ae=(0,Ae.h)().fetchData,ie=(0,Ae.S)().fetchData,ue=(0,_.useCallback)(function(){var e=(0,s.Z)((0,o.Z)().mark((function _callee5(e){var n,t;return(0,o.Z)().wrap((function _callee5$(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,ie();case 2:return n=c.sent,c.next=5,ae((0,l.Z)((0,l.Z)({},n.data),{},{company_name:e}));case 5:(t=c.sent).success?(re(),oe(),Ie.Z9.success("保存成功")):Ie.Z9.none(t.msg);case 7:case"end":return c.stop()}}),_callee5)})));return function(n){return e.apply(this,arguments)}}(),[]),_e=(0,_.useCallback)((function(){c({type:"setRecommendId",data:{list:t.list,recommendId:0}})}),[]),de=(0,_.useCallback)((function(){D(),S()}),[]);return(0,_.useEffect)((function(){t.delCommendId&&(S(),D())}),[t.delCommendId]),(0,x.jsx)(Qe.Z,{pageName:"pages/shopCar/index",showList:["order"],customStyles:{overflow:"scroll"},children:(0,x.jsxs)(a.G7,{className:Oe,children:[(0,x.jsxs)(a.G7,{className:Ve,children:[(0,x.jsx)(ke,{onSelect:P,onChange:H}),(0,x.jsx)(a.G7,{className:Je,children:(0,x.jsx)(Ne,{numberObj:I,defaultIndex:f.sale_mode,onSelect:E})})]}),(0,x.jsxs)(a.G7,{className:Te,children:[R&&(0,x.jsx)(a.G7,{className:Ue,children:(0,x.jsx)($e.Z,{})}),!R&&t.list&&t.list.length>0&&(0,x.jsx)(a.pf,{scrollY:!0,className:Le,children:null===(e=t.list)||void 0===e?void 0:e.map((function(e){return(0,x.jsx)(ee,{productItem:e},e.product_id)}))}),!R&&!t.list&&(0,x.jsx)(ye,{})]}),(0,x.jsx)(bottomBtn,{onSelect:B,model:U,onBtnClick:function onBtnClick(e){e?ce():te()}}),(0,x.jsx)(a.G7,{children:(0,x.jsx)(Ke.Z,{ref:K,onSuccess:function handleBindSalesManSuccess(){v.adminUserInfo.first_change_name&&A(!0)}})}),(0,x.jsx)(a.G7,{children:(0,x.jsx)(Xe.Z,{showModal:Y,onClose:oe,onShowModalChange:se,onConfirm:ue})}),(0,x.jsx)(a.G7,{children:(0,x.jsx)(ze,{shopId:t.recommendId||0,onShow:!!t.recommendId,onClose:_e,submitSuccess:de})})]})})},tn=t(2522);Page((0,c.createPageConfig)((function(){return(0,x.jsxs)(ContextShop,{children:[(0,x.jsx)(tn.Z,{}),(0,x.jsx)(main,{})]})}),"pages/shopCar/index",{root:{cn:[]}},{navigationBarTitleText:"购物车"}||{}))}},function(e){e.O(0,[2107,1216,8592],(function(){return n=1486,e(e.s=n);var n}));e.O()}]);