1 line
24 KiB
JavaScript
1 line
24 KiB
JavaScript
"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.n(_),m=t(3012),x=t(4456),f=t(5893);var h=function createCtx(){var e=d().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]}(),p=(0,r.Z)(h,2),v=p[0],j=p[1],ContextShop=function(e){var n=(0,_.useReducer)((function reducer(e,n){switch(n.type){case"setInitData":return b(e,n);case"updateProduct":return k(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,f.jsx)(j,{value:{state:c,dispatch:o},children:e.children})},b=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})},k=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})},Z=(0,_.memo)((0,_.forwardRef)((function(e,n){var t=e.colorItem,c=v(),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,f.jsx)(g,{checkStatus:l.list[s[0]].color_list[s[1]].checked,onSelect:r})}))),g=(0,_.memo)((function(e){var n=e.checkStatus,t=e.onSelect,c=function setSelect(e){null==t||t(e)};return(0,f.jsx)(x.Z,{status:n,onSelect:function onSelect(){return c(!0)},onClose:function onClose(){return c(!1)}})})),C="index-module__recommended_main___WIzv4",N="index-module__recommended___BoUnb",S="index-module__icon___uf2F3",G=t(6028),w=(0,_.memo)((function(e){var n=e.onClick;return(0,f.jsx)(a.G7,{className:C,children:(0,f.jsxs)(a.G7,{className:N,onClick:n,children:[(0,f.jsx)(a.xv,{children:"选择专属一对一配套螺纹推荐"}),(0,f.jsx)(a.G7,{className:S,children:(0,f.jsx)(G.Z,{name:"icon-xiala",size:30})})]})})})),I="index-module__shop_product_item_con___rztuO",y="index-module__shop_product_item___WlGlj",F="index-module__item_con___cAPTN",D="index-module__img___n35HX",M="index-module__item_name_price_count___sZP7R",B="index-module__name_price___u7zsh",P="index-module__price___u9uYc",E="index-module__count_con___rr5hg",R="index-module__recommend_title___su2GQ",z="index-module__count___pkmyz",O=t(6599),T=t(6312),L=t(4158),V=t(9612),J=t(8093),U=t(8629),$=(0,_.memo)((function(e){var n=(0,V.au)().fetchData,t=(0,V.Lb)().fetchData,c=(0,V.Lf)().fetchData,r=e.colorItem,a=v(),i=a.state,d=a.dispatch,m=r.index_str.split(","),x=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:[x.id]});case 3:n.sent.success&&d({type:"setDelCommendId",data:{list:i.list,delCommendId:x.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)}}(),[x]),p=(0,_.useCallback)((function(){d({type:"setRecommendId",data:{list:i.list,recommendId:x.id}})}),[x]);return(0,f.jsx)(H,{colorItem:i.list[m[0]].color_list[m[1]],onChangeNum:h,onSubmitSuccess:p})})),H=(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),d=u[0],x=u[1];(0,_.useEffect)((function(){x((function(){return 0===n.sale_mode?n.roll:n.length/100}))}),[n]);var h=(0,J.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:x(e),c={id:n.id,length:0,roll:0},0===n.sale_mode?c.roll=e:c.length=(0,m.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=U.L_,v=(0,_.useMemo)((function(){return p[n.sale_mode]}),[n]);console.log("colorItem::",n);var j=(0,_.useRef)(null);return(0,f.jsx)(f.Fragment,{children:(0,f.jsxs)(a.G7,{className:I,children:[(0,f.jsxs)(a.G7,{className:y,children:[(0,f.jsx)(Z,{colorItem:n,ref:j}),(0,f.jsxs)(a.G7,{className:F,onClick:function onClick(){return j.current.onSelect()},children:[(0,f.jsx)(a.G7,{className:D,children:(0,f.jsx)(O.Z,{value:l})}),(0,f.jsxs)(a.G7,{className:M,children:[(0,f.jsxs)(a.G7,{className:B,children:[(0,f.jsx)(a.xv,{children:n.product_color_code+n.product_color_name}),(0,f.jsxs)(a.G7,{className:P,children:[(0,f.jsx)(a.xv,{}),(0,f.jsxs)(a.xv,{children:["¥",(0,L.yb)(n.sale_price),"/kg"]})]})]}),(0,f.jsxs)(a.G7,{className:E,children:[(0,f.jsx)(a.G7,{className:R,children:n.is_screw_recommend&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(a.xv,{children:"推荐"}),(0,f.jsx)(a.xv,{children:"配套螺纹"})]})}),(0,f.jsx)(a.G7,{className:z,children:(0,f.jsx)(a.fV,{children:(0,f.jsx)(T.Z,{onClickBtn:h,minNum:v.minNum,maxNum:v.maxNum,onBlue:h,defaultNum:d,unit:0===n.sale_mode?"条":"米",digits:v.digits,returnZero:!0})})})]})]})]})]}),n.has_screw_recommend&&(0,f.jsx)(w,{onClick:c})]})})})),W=(0,_.memo)((function(e){var n=e.productItem,t=v(),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,f.jsx)(K,{checkStatus:c.list[o].checked,onSelect:s})})),K=(0,_.memo)((function(e){var n=e.checkStatus,t=e.onSelect,c=function setSelect(e){null==t||t(e)};return(0,f.jsx)(x.Z,{status:n,onSelect:function onSelect(){return c(!0)},onClose:function onClose(){return c(!1)}})})),q="index-module__shop_product___pTpMG",X="index-module__shop_product_title___Jp7zd",Y="index-module__title_desc___aXuC0",A="index-module__model___IziQM",Q="index-module__name___Rf6mj",ee="index-module__label___dhWvL",ne=(0,_.memo)((function(e){var n=e.productItem;return(0,_.useEffect)((function(){console.log("productItem66:::",n)}),[n]),(0,f.jsx)(te,{productItem:n,sale_mode:0})})),te=(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,f.jsxs)(a.G7,{className:q,children:[(0,f.jsxs)(a.G7,{className:X,children:[(0,f.jsx)(W,{productItem:t}),(0,f.jsx)(a.G7,{className:Y,children:(0,f.jsxs)(a.G7,{className:A,children:[(0,f.jsx)(a.xv,{className:Q,children:(0,L.W7)(null==t?void 0:t.product_code,null==t?void 0:t.product_name)}),(0,f.jsx)(a.xv,{className:ee,children:l})]})})]}),null==t||null===(n=t.color_list)||void 0===n?void 0:n.map((function(e){return(0,f.jsx)($,{colorItem:e},e.product_color_id)}))]})})),ce=t(4184),le=t.n(ce),oe="index-module__Settlement_btn___fTHki",se="index-module__select_text___zTQjs",re="index-module__price_count___GpC2T",ae="index-module__price___MEOVU",ie="index-module__count___Aussa",ue="index-module__btn___dBTVw",_e="index-module__del___iwMk8",bottomBtn=function(e){var n=e.onSelect,t=e.model,c=e.onBtnClick,l=v(),o=l.state;l.dispatch;return(0,f.jsx)(de,{onSelect:n,statistics:o.statistics,model:t,onBtnClick:c,sale_mode:o.sale_mode})},de=(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 m=(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,f.jsxs)(a.G7,{className:oe,children:[(0,f.jsx)(x.Z,{status:i,onSelect:function onSelect(){return d(!0)},onClose:function onClose(){return d(!1)}}),(0,f.jsx)(a.xv,{className:se,children:"全选"}),(0,f.jsx)(a.G7,{className:re,children:!c&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(a.G7,{className:ae,children:[(0,f.jsx)(a.xv,{children:"预估金额:"}),(0,f.jsxs)(a.xv,{children:["¥",(0,L.yb)(null==t?void 0:t.price_number)]})]}),(0,f.jsx)(a.G7,{className:ie,children:m})]})}),(0,f.jsx)(a.G7,{onClick:function onBtnClick(){var n;null===(n=e.onBtnClick)||void 0===n||n.call(e,c)},className:le()(ue,c&&_e),children:c?"删除":"结算"})]})})),me="index-module__shop_header_sort_main___Ki_a1",xe="index-module__shop_header_sort___FHXag",fe="index-module__sort___coeeb",he="index-module__edit___g1QL_",pe="index-module__sort_list___YmsqR",ve="index-module__item_sort___YSKxM",je="index-module__search_item_select___jO8xk",be="index-module__sort_list_selected___P1rrS",ke="index-module__mask___JAm1V",Ze=(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),x=(0,r.Z)(m,2),h=x[0],p=x[1];return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(a.G7,{className:me,children:[(0,f.jsxs)(a.G7,{className:xe,children:[(0,f.jsxs)(a.G7,{className:fe,onClick:function onClick(){return o(!0)},children:[(0,f.jsx)(G.Z,{name:"icon-paixu1",size:30,color:"#337FFFFF"}),(0,f.jsx)(a.xv,{children:u.title}),(0,f.jsx)(G.Z,{name:"icon-zhankai",size:30,color:"#337FFFFF"})]}),(0,f.jsxs)(a.G7,{className:he,onClick:function onChange(){var n;p(!h),null===(n=e.onChange)||void 0===n||n.call(e,!h)},children:[(0,f.jsx)(G.Z,{name:"icon-guanli",size:43,color:"".concat(h?"#337FFFFF":"#000000FF")}),(0,f.jsx)(a.xv,{style:{color:"".concat(h?"#337FFFFF":"#000000FF")},children:h?"取消":"管理"})]})]}),(0,f.jsx)(a.G7,{className:le()(pe,l&&be),children:[{value:-1,title:"添加时间降序"},{value:1,title:"添加时间升序"},{value:-2,title:"面料编号降序"},{value:2,title:"面料编号升序"}].map((function(e){return(0,f.jsx)(a.G7,{onClick:function onClick(){return function getSelect(e){o(!1),n(e),d(e)}(e)},className:le()(ve,u.value===e.value&&je),children:e.title},e.value)}))})]}),l&&(0,f.jsx)(a.G7,{className:ke,onClick:function onClick(){return o(!1)}})]})})),ge="index-module__shop_search___RfTT0",Ce="index-module__search_item___Bdsmv",Ne="index-module__search_item_select___CBw_o",Se=(0,_.memo)((function(e){var n=e.numberStatus,t=void 0===n||n,c=U.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],x=d[1];(0,_.useEffect)((function(){o!==m&&x(o)}),[o]);var h=function getName(e){return e.title+(t?"(".concat(null==i?void 0:i[e.field],")"):"")};return(0,f.jsx)(a.G7,{className:ge,children:null==c?void 0:c.map((function(e){return(0,f.jsx)(a.G7,{onClick:function onClick(){return null==s?void 0:s(e)},className:le()(Ce,m===e.value&&Ne),children:h(e)},e.value)}))})})),Ge="index-module__empty___GbJms",we="index-module__title___MDyY5",Ie="index-module__btn___V85Ma",ye=t(1115),Fe=(0,_.memo)((function(){return(0,f.jsxs)(a.G7,{className:Ge,onClick:function onClick(){return(0,ye.jD)("/pages/index/index",{},"switchTab")},children:[(0,f.jsx)(a.G7,{className:we,children:"暂未选择商品"}),(0,f.jsx)(a.G7,{className:Ie,children:"去选购"})]})})),De={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"},Me=(0,_.memo)((function(e){return(0,f.jsx)(Be,(0,l.Z)({},e))})),Be=(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,J.Ds)((function(e){m(e)}),300),o=U.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,f.jsx)(f.Fragment,{children:(0,f.jsx)(a.G7,{className:De.shop_product_item_con,children:(0,f.jsxs)(a.G7,{className:De.shop_product_item,children:[(0,f.jsx)(a.G7,{className:De.title_desc,children:(0,f.jsxs)(a.G7,{className:De.model,children:[(0,f.jsx)(a.xv,{className:De.name,children:(0,L.W7)(null==n?void 0:n.screw_code,null==n?void 0:n.screw_name)}),(0,f.jsx)(a.xv,{className:De.label,children:null==s?void 0:s.title})]})}),(0,f.jsxs)(a.G7,{className:De.item_con,children:[(0,f.jsx)(a.G7,{className:De.img,children:(0,f.jsx)(O.Z,{value:c})}),(0,f.jsxs)(a.G7,{className:De.item_name_price_count,children:[(0,f.jsxs)(a.G7,{className:De.name_price,children:[(0,f.jsx)(a.xv,{children:(null==n?void 0:n.screw_color_code)+(null==n?void 0:n.screw_color_name)}),(0,f.jsxs)(a.G7,{className:De.price,children:[(0,f.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,L.yb)(null==n?void 0:n.standard_price))}),(0,f.jsxs)(a.xv,{children:["¥",(0,L.yb)(null==n?void 0:n.sale_price),"/kg"]})]})]}),(0,f.jsx)(a.G7,{className:De.count,children:(0,f.jsx)(a.fV,{children:(0,f.jsx)(T.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})})})]})]})]})})})})),Pe="index-module__recommended_open___evO2G",Ee="index-module__search___zZaex",Re="index-module__onSubmit___W0GV7",ze="index-module__mask___oNOBP",Oe=(0,_.memo)((function(e){var n=e.shopId,t=e.submitSuccess,c=e.onShow,i=void 0!==c&&c,u=e.onClose,d=(0,_.useState)({id:0,sale_mode:0}),x=(0,r.Z)(d,2),h=x[0],p=x[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,V.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(U.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,m.Z)(e).times(100).toNumber(),v.current.color_list=[n]},D=(0,V.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,f.jsxs)(f.Fragment,{children:[G&&(0,f.jsxs)(a.G7,{className:Pe,children:[(0,f.jsx)(a.G7,{className:Ee,children:(0,f.jsx)(Se,{onSelect:I,numberStatus:!1,defaultIndex:h.sale_mode})}),(0,f.jsx)(Me,{colorItem:k,onChangeNum:y}),(0,f.jsx)(a.G7,{className:Re,onClick:M,children:"确认添加"})]}),G&&(0,f.jsx)(a.G7,{catchMove:!0,className:ze,onClick:function onCloseEven(){null==u||u(),w((function(){return!1}))}})]})})),Te="index-module__shop_main___VJEk3",Le="index-module__shop_con___X4IBn",Ve="index-module__scroll_view___obDmI",Je="index-module__shop_header___P54q_",Ue="index-module__search_title___VtWaz",$e="index-module__loading_card___mu6JK",He=t(4508),We=t(8106),Ke=t(2890),qe=t(515),Xe=t(9194),Ye=t(9714),Ae=t(4408),Qe=t(7380),en=t(6353),nn=t(1341),tn=t(9498),main=function(){var e,n=v(),t=n.state,c=n.dispatch,d=(0,_.useState)({abstract_sort_key:-1,sale_mode:0}),m=(0,r.Z)(d,2),x=m[0],h=m[1];(0,tn.av)("pages/shopCar/index");var p=(0,Xe.v)((function(e){return e.userInfo})),j=(0,_.useTransition)(),b=(0,r.Z)(j,2),k=b[0],Z=b[1],g=(0,V.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(x);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:x.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,V.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()}),[x]);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),T=O[0],$=O[1],H=(0,_.useCallback)((function(e){$((function(){return e}))}),[]),W=(0,V.Lf)().fetchData,K=(0,_.useRef)(null),q=(0,_.useState)(!1),X=(0,r.Z)(q,2),Y=X[0],A=X[1],Q=(0,We.K9)().fetchData,ee=(0,We.Dd)().fetchData,te=(0,J.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&&ee(),null===(n=K.current)||void 0===n||n.handleChange(!0),o.abrupt("return");case 7:if(!p.adminUserInfo.first_change_name){o.next=10;break}return A(!0),o.abrupt("return");case 10:0==(c=le()).length?ye.Z9.error("请选择面料"):(s=c.join("-"),(0,Ke.t4)({ids:s,sale_mode:t.sale_mode}),console.log("state",t),(0,nn.l_)({order_type:(null===(l=Object.values(U.ar).find((function(e){return e.value===t.sale_mode})))||void 0===l?void 0:l.label)||"",trigger_time:(0,L.o0)(new Date),purchaser_name:p.adminUserInfo.user_name||"未知用户",purchaser_id:p.adminUserInfo.user_id||0}),(0,ye.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,Ae.Z)().getAdminUserInfo,ae=(0,Qe.h)().fetchData,ie=(0,Qe.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(),ye.Z9.success("保存成功")):ye.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,f.jsx)(en.Z,{pageName:"pages/shopCar/index",showList:["order"],customStyles:{overflow:"scroll"},children:(0,f.jsxs)(a.G7,{className:Te,children:[(0,f.jsxs)(a.G7,{className:Je,children:[(0,f.jsx)(Ze,{onSelect:P,onChange:H}),(0,f.jsx)(a.G7,{className:Ue,children:(0,f.jsx)(Se,{numberObj:I,defaultIndex:x.sale_mode,onSelect:E})})]}),(0,f.jsxs)(a.G7,{className:Le,children:[R&&(0,f.jsx)(a.G7,{className:$e,children:(0,f.jsx)(He.Z,{})}),!R&&t.list&&t.list.length>0&&(0,f.jsx)(a.pf,{scrollY:!0,className:Ve,children:null===(e=t.list)||void 0===e?void 0:e.map((function(e){return(0,f.jsx)(ne,{productItem:e},e.product_id)}))}),!R&&!t.list&&(0,f.jsx)(Fe,{})]}),(0,f.jsx)(bottomBtn,{onSelect:B,model:T,onBtnClick:function onBtnClick(e){e?ce():te()}}),(0,f.jsx)(a.G7,{children:(0,f.jsx)(qe.Z,{ref:K,onSuccess:function handleBindSalesManSuccess(){p.adminUserInfo.first_change_name&&A(!0)}})}),(0,f.jsx)(a.G7,{children:(0,f.jsx)(Ye.Z,{showModal:Y,onClose:oe,onShowModalChange:se,onConfirm:ue})}),(0,f.jsx)(a.G7,{children:(0,f.jsx)(Oe,{shopId:t.recommendId||0,onShow:!!t.recommendId,onClose:_e,submitSuccess:de})})]})})},cn=t(2522);Page((0,c.createPageConfig)((function(){return(0,f.jsxs)(ContextShop,{children:[(0,f.jsx)(cn.Z,{}),(0,f.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()}]); |