"use strict";require("./sub-common/77c6c00ee9ac4bfa87e3885cb3a9f4ce.js");require("./sub-common/13c349ec6fe97c02f07716d358f66d11.js");require("./sub-common/b14021f24a99c16a41f3ddce1a2c0358.js");require("./sub-common/a2adaa4f70b80326c7400ed443cd7103.js");require("./sub-common/1da759392e78d572495498b53bc4e2a9.js");(wx.webpackJsonp=wx.webpackJsonp||[]).push([[2443],{877:function(e,n,o){var t=o(2180),r=o(1413),a=o(3433),i=o(4165),s=o(5861),u=o(9439),l=o(1515),c=o(2954),d=o.n(c),_=o(7294),m=o(4184),x=o.n(m),f={common_safe_area_y:"index-module__common_safe_area_y___hG2LL","flex-col":"index-module__flex-col___bdeiq","flex-row":"index-module__flex-row___Favt0","justify-between":"index-module__justify-between___mePhi","justify-center":"index-module__justify-center___vZPv2","items-center":"index-module__items-center___c9edY","flex-item":"index-module__flex-item___Iaiap","full-100":"index-module__full-100___Ge3DL","color-blue":"index-module__color-blue___UOfZu","color-yellow":"index-module__color-yellow___u5Abd","color-green":"index-module__color-green___UZtvD","color-grey":"index-module__color-grey___L6J6t","color-white":"index-module__color-white___B6D6m","s-w":"index-module__s-w___ctKrn","s-e":"index-module__s-e___BnIrf",filter:"index-module__filter___I31N8",bgBox:"index-module__bgBox___kPrZg",goodsBox:"index-module__goodsBox___fPl_X",goodsProduct:"index-module__goodsProduct___QncEO",goodsLine:"index-module__goodsLine___SsIBE",itemGoods:"index-module__itemGoods___lPs9k",itemPic:"index-module__itemPic___hXC12",itemRight:"index-module__itemRight___Plh81",item_right_top:"index-module__item_right_top___v6Dql",itemName:"index-module__itemName___iI_Ke",itemNums:"index-module__itemNums___HDuYn",item_right_Bottom:"index-module__item_right_Bottom___LHIMI",itemMoney:"index-module__itemMoney___kU5vI",itemMoneyOne:"index-module__itemMoneyOne___LNB66",btn:"index-module__btn___E1ddN",btnOne:"index-module__btnOne___VPwWI",inputBox:"index-module__inputBox___MhLAq",redceBox:"index-module__redceBox___OTNis",reduce:"index-module__reduce___HDnB6",inputBig:"index-module__inputBig___W4aDR",addBox:"index-module__addBox___suwT5",hasSelect:"index-module__hasSelect___vsnvt",resonBig:"index-module__resonBig___s4Qeq",reasonItem:"index-module__reasonItem___Qj7eY",reasonLeft:"index-module__reasonLeft___Qx34Q",reasonFont:"index-module__reasonFont___D8URT",xing:"index-module__xing___H0SE4",selectFont:"index-module__selectFont___RAdRp",chakanquanbukehu:"index-module__chakanquanbukehu___ulQlK",picBig:"index-module__picBig___ZYObi",picFont:"index-module__picFont___wxKgc",descBox:"index-module__descBox___Wkj7b",title:"index-module__title___ONbbm",textBox:"index-module__textBox___oHaaT",bottomBox:"index-module__bottomBox___aBhcB",resetBox:"index-module__resetBox___j2_JF",button:"index-module__button___hqgQL",activeButton:"index-module__activeButton___F4ih5",safeBox:"index-module__safeBox___PGLTZ",popupBox:"index-module__popupBox___LiRQp",thirdBox:"index-module__thirdBox___zPFua",thirdTopfont:"index-module__thirdTopfont___Uss8Y",timeBox2:"index-module__timeBox2___Ryq0G",more:"index-module__more___hgOBD",flexModebox:"index-module__flexModebox___dXKBA",activemodeBox:"index-module__activemodeBox___Fc0Sq",modeBox:"index-module__modeBox___A6omV",bottomBox1:"index-module__bottomBox1___ukR0B",resetBox1:"index-module__resetBox1___qqDLr",button1:"index-module__button1___VJ5wT",activeButton1:"index-module__activeButton1___afh_L",safeBoxs:"index-module__safeBoxs___AATh_"},h=o(1251),p=o(5989),N=o(3416),v=o(6028),B=o(2128),G=o(2213),j=o(3407),b=o(5893),g=function GoodsItem(e){var n=e.list,o=void 0===n?[]:n,t=e.obj,r=void 0===t?{}:t,a=e.handTui,i=e.handCancel,s=e.onBlur,u=e.handReduce,c=e.handAdd,d=e.onInputEven,m=(0,_.useCallback)((function(e){return{lab:e.lab,rgb:e.rgb,texture_url:e.texture_url}}),[o]);return(0,b.jsx)(b.Fragment,{children:o.map((function(e,n){return(0,b.jsxs)(l.G7,{className:f.goodsBox,children:[(0,b.jsxs)(l.G7,{className:f.goodsProduct,children:[(0,b.jsxs)(l.xv,{children:[e.product_code,"# ",e.product_name]}),(0,b.jsx)(G.Z,{saleMode:e.sale_mode,size:"small",customStyle:{marginLeft:"5px",padding:"0 5px"}})]}),(0,b.jsx)(B.Z,{direction:"horizontal",customStyles:{margin:"12px 10px"}}),e.av_product_color.map((function(n,o){return(0,b.jsxs)(l.G7,{className:f.itemGoods,children:[(0,b.jsx)(l.G7,{className:f.itemPic,children:(0,b.jsx)(j.Z,{value:m(e)})}),(0,b.jsxs)(l.G7,{className:f.itemRight,children:[(0,b.jsx)(l.G7,{className:f.item_right_top,children:(0,b.jsxs)(l.G7,{className:f.itemName,children:[n.product_color_code," ",n.product_color_name]})}),(0,b.jsxs)(l.G7,{className:f.item_right_Bottom,children:[(0,b.jsxs)(l.G7,{className:f.itemMoney,children:["x",0===(null==r?void 0:r.sale_mode)?n.roll:n.length/100,0===(null==r?void 0:r.sale_mode)?"条":"m"]}),!n.isTui&&(0,b.jsx)(l.G7,{className:f.btn,onClick:function onClick(){return null==a?void 0:a(n)},children:"退货"}),0!=n.sale_mode&&n.isTui&&(0,b.jsx)(l.G7,{className:f.btnOne,onClick:function onClick(){return null==i?void 0:i(n)},children:"已选择退货"}),0==n.sale_mode&&n.isTui&&(0,b.jsxs)(l.G7,{className:f.inputBox,children:[(0,b.jsx)(l.G7,{className:f.redceBox,onClick:function onClick(){return null==u?void 0:u(n)},children:(0,b.jsx)(l.G7,{className:f.reduce})}),(0,b.jsx)(l.G7,{className:f.inputBig,children:(0,b.jsx)(l.II,{type:"number",value:n.nums,onInput:function onInput(e){return null==d?void 0:d(e,n)},maxlength:n.roll,onBlur:function onBlur(e){return null==s?void 0:s(e,n)}})}),(0,b.jsx)(l.G7,{className:f.addBox,onClick:function onClick(){return null==c?void 0:c(n)},children:"+"})]})]})]})]},o)}))]},n)}))})},Z=(0,_.memo)(g),k=function ApplyGoods(){var e=(0,c.useRouter)(),n=(0,h.e1)().fetchData,o=(0,_.useState)({}),t=(0,u.Z)(o,2),m=t[0],B=t[1],G=(0,_.useState)([]),j=(0,u.Z)(G,2),g=j[0],k=j[1],w=function(){var o=(0,s.Z)((0,i.Z)().mark((function _callee(){var o;return(0,i.Z)().wrap((function _callee$(t){for(;;)switch(t.prev=t.next){case 0:return d().showLoading({title:"请稍等...",mask:!0}),t.next=3,n({id:e.params.orderId});case 3:(o=t.sent).data&&(o.data.av_return_product.forEach((function(e){return e.av_product_color.forEach((function(e){e.isTui=!1,e.nums=1})),e})),k(o.data.av_return_product),B(o.data),d().hideLoading());case 5:case"end":return t.stop()}}),_callee)})));return function getDetail(){return o.apply(this,arguments)}}(),S=(0,_.useMemo)((function(){var e=[];return g.forEach((function(n){n.av_product_color.forEach((function(n){n.isTui&&e.push(n)}))})),e.length}),[g]);(0,_.useEffect)((function(){w()}),[]);var T=(0,_.useRef)([]),C=(0,_.useCallback)((function(e){T.current=e}),[]),y=(0,_.useState)(!1),E=(0,u.Z)(y,2),I=E[0],L=E[1],R=(0,_.useRef)({return_reason:1,return_explain:"",reasonName:"请选择",reasonNameTwo:"请选择",GoodStatus:"",GoodStatusName:"请选择"}),M=(0,_.useState)({return_reason:1,reasonName:"请选择",reasonNameTwo:"请选择",return_explain:"",GoodStatus:"",GoodStatusName:"请选择"}),F=(0,u.Z)(M,2),D=F[0],P=F[1],A=(0,_.useMemo)((function(){return!(""!==D.GoodStatus&&""!==D.return_explain&&S>0)}),[D,S]),O=(0,h.$n)().fetchData,q=(0,_.useState)([]),z=(0,u.Z)(q,2),Q=z[0],Y=z[1],$=function(){var e=(0,s.Z)((0,i.Z)().mark((function _callee2(){var e;return(0,i.Z)().wrap((function _callee2$(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,O();case 2:(e=n.sent).data&&Y(e.data.list);case 4:case"end":return n.stop()}}),_callee2)})));return function getReason(){return e.apply(this,arguments)}}(),H=(0,h.Wx)().fetchData,J=(0,_.useState)([]),K=(0,u.Z)(J,2),U=K[0],W=K[1],V=function(){var e=(0,s.Z)((0,i.Z)().mark((function _callee3(){var e;return(0,i.Z)().wrap((function _callee3$(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,H({return_reason:R.current.return_reason});case 2:(e=n.sent).data&&W(e.data.list);case 4:case"end":return n.stop()}}),_callee3)})));return function getReasonTwo(){return e.apply(this,arguments)}}();(0,_.useEffect)((function(){$(),V()}),[]);var X=function resetArr(e){return e.map((function(e){return e.default=!1,e})),e},ee=(0,_.useMemo)((function(){return""===D.return_explain}),[D]),ne=(0,_.useState)(!1),oe=(0,u.Z)(ne,2),te=oe[0],re=oe[1],ae=(0,h.pT)().fetchData,ie=(0,_.useState)([]),se=(0,u.Z)(ie,2),ue=se[0],le=se[1],ce=function(){var e=(0,s.Z)((0,i.Z)().mark((function _callee4(){var e;return(0,i.Z)().wrap((function _callee4$(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,ae();case 2:(e=n.sent).data&&le(e.data.list);case 4:case"end":return n.stop()}}),_callee4)})));return function getGoodStatus(){return e.apply(this,arguments)}}();(0,_.useEffect)((function(){ce()}),[]);var de=(0,_.useMemo)((function(){return""===D.GoodStatus}),[D]),_e=function handCancl(){d().navigateBack({delta:1})},me=(0,_.useState)(""),xe=(0,u.Z)(me,2),fe=xe[0],he=xe[1],pe=(0,h.Gw)().fetchData;(0,_.useEffect)((function(){P(D)}),[D]);return(0,b.jsxs)(l.G7,{className:f.main,children:[(0,b.jsxs)(l.G7,{className:f.bgBox,children:[(0,b.jsx)(Z,{list:g,obj:m,handTui:function handTui(e){return function handTui(e){var n=g;n.forEach((function(n){var o;null===(o=n.av_product_color)||void 0===o||o.map((function(n){return n.sale_order_detail_id==e.sale_order_detail_id&&(n.isTui=!0),n}))})),k((0,a.Z)(n))}(e)},handCancel:function handCancel(e){return function handCancel(e){g.forEach((function(n){n.av_product_color.map((function(n){return n.sale_order_detail_id===e.sale_order_detail_id&&(n.isTui=!1),n}))})),k((0,a.Z)(g))}(e)},onBlur:function onBlur(e,n){return function onBlur(e,n){g.forEach((function(o){o.av_product_color.map((function(o){return o.sale_order_detail_id===n.sale_order_detail_id&&(Number(e.detail.value)<1||""==e.detail.value?(o.isTui=!1,o.nums=1):o.nums=Number(e.detail.value),Number(e.detail.value)>o.roll&&(o.nums=1)),o}))})),k((0,a.Z)(g))}(e,n)},handReduce:function handReduce(e){return function handReduce(e){g.forEach((function(n){n.av_product_color.map((function(n){return n.sale_order_detail_id===e.sale_order_detail_id&&(1==e.nums?(n.isTui=!1,n.nums=1):n.nums--),n}))})),k((0,a.Z)(g))}(e)},handAdd:function handAdd(e){return function handAdd(e){g.forEach((function(n){n.av_product_color.forEach((function(n){n.sale_order_detail_id===e.sale_order_detail_id&&n.numso.roll&&(o.nums=1)),o}))})),k((0,a.Z)(g))}(e,n)}}),(0,b.jsxs)(l.G7,{className:f.hasSelect,children:["汇总:已选",S,"种商品"]})]}),(0,b.jsxs)(l.G7,{className:f.resonBig,children:[(0,b.jsxs)(l.G7,{className:f.reasonItem,onClick:function onClick(){L(!0)},children:[(0,b.jsxs)(l.G7,{className:f.reasonLeft,children:[(0,b.jsx)(l.G7,{className:f.reasonFont,children:"退货原因"}),(0,b.jsx)(l.xv,{className:f.xing,children:"*"}),"请选择"===R.current.reasonName&&(0,b.jsx)(l.G7,{className:f.selectFont,children:"请选择"}),"请选择"!==R.current.reasonName&&(0,b.jsxs)(l.G7,{className:f.selectFont,children:[D.reasonName,"/",D.reasonNameTwo]})]}),(0,b.jsx)(v.Z,{name:"icon-chakanquanbukehu",size:50,color:"#3b3b3b"})]}),(0,b.jsxs)(l.G7,{className:f.reasonItem,onClick:function onClick(){null==re||re(!0)},children:[(0,b.jsxs)(l.G7,{className:f.reasonLeft,children:[(0,b.jsx)(l.G7,{className:f.reasonFont,children:"货物情况"}),(0,b.jsx)(l.xv,{className:f.xing,children:"*"}),"请选择"===R.current.GoodStatusName&&(0,b.jsx)(l.G7,{className:f.selectFont,children:"请选择"}),"请选择"!==R.current.GoodStatusName&&(0,b.jsx)(l.G7,{className:f.selectFont,children:D.GoodStatusName})]}),(0,b.jsx)(v.Z,{name:"icon-chakanquanbukehu",size:50,color:"#3b3b3b"})]}),(0,b.jsxs)(l.G7,{className:f.picBig,children:[(0,b.jsx)(l.G7,{className:f.picFont,children:"拍照上传"}),(0,b.jsx)(N.Z,{onChange:C})]})]}),(0,b.jsxs)(l.G7,{className:f.descBox,children:[(0,b.jsx)(l.G7,{className:f.title,children:"其他说明"}),(0,b.jsx)(l.G7,{className:f.textBox,children:(0,b.jsx)(l.gx,{onInput:function onInput(e){return function getDesc(e){he(e)}(e.detail.value)},value:fe,placeholderStyle:"font-size: 28rpx;font-weight: 400;",placeholder:I&&te?"":"选填/退货原因中选择时(其他问题)必填"})})]}),(0,b.jsx)(l.G7,{className:f.safeBox,children:(0,b.jsxs)(l.G7,{className:f.bottomBox,children:[(0,b.jsx)(l.zx,{className:f.resetBox,onClick:function onClick(){_e()},children:" 取消"}),(0,b.jsx)(l.zx,{className:x()(A?f.button:f.activeButton),disabled:A,onClick:function onClick(){return function handSure(){if("其他问题"==D.reasonNameTwo&&""==fe)return d().showToast({title:"请填写其他说明",icon:"error",duration:3e3}),!1;var e=[];g.forEach((function(n){n.av_product_color.forEach((function(n){n.isTui&&e.push({product_color_id:0==n.sale_mode?n.product_color_id:"",product_id:0==n.sale_mode?n.product_id:"",product_roll:0==n.sale_mode?n.nums:0,sale_order_detail_id:n.sale_order_detail_id})}))}));var n={reason_describe:fe,fabric_piece_accessory_url:T.current,goods_status:D.GoodStatus,return_reason:D.return_reason,return_explain:D.return_explain,roll:0,roll_list:e,sale_order_id:Number(m.id)};d().showModal({content:"确认退货吗?",confirmText:"确认",cancelText:"取消",success:function success(e){return(0,s.Z)((0,i.Z)().mark((function _callee5(){var o;return(0,i.Z)().wrap((function _callee5$(t){for(;;)switch(t.prev=t.next){case 0:if(!e.confirm){t.next=6;break}return d().showLoading({title:"请稍等...",mask:!0}),t.next=4,pe(n);case 4:"success"===(null==(o=t.sent)?void 0:o.msg)?(d().showToast({title:"成功"}),d().hideLoading(),_e()):(d().hideLoading(),d().showToast({title:null==o?void 0:o.msg,icon:"error"}));case 6:case"end":return t.stop()}}),_callee5)})))()}})}()},children:" 确认退货"})]})}),(0,b.jsx)(p.Z,{title:"筛选情况",show:I,onClose:function onClose(){null==L||L(!1)},children:(0,b.jsx)(l.pf,{scrollY:!0,children:(0,b.jsxs)(l.G7,{className:f.popupBox,children:[(0,b.jsxs)(l.G7,{className:f.thirdBox,children:[(0,b.jsx)(l.G7,{className:f.thirdTopfont,children:"退货原因"}),(0,b.jsx)(l.G7,{className:f.flexModebox,children:Q.map((function(e,n){return(0,b.jsx)(l.G7,{onClick:function onClick(){!function handReasonOne(e){Q.map((function(n){return n.id===e.id?n.default=!0:n.default=!1,n})),P((function(n){return(0,r.Z)((0,r.Z)({},n),{},{return_reason:e.id,return_explain:""})})),R.current.return_reason=e.id,R.current.reasonName=e.name,Y((0,a.Z)(Q)),V()}(e)},className:x()(e.default?f.activemodeBox:f.modeBox),children:e.name},n)}))})]}),(0,b.jsxs)(l.G7,{className:f.thirdBox,children:[(0,b.jsx)(l.G7,{className:f.thirdTopfont,children:"退货理由"}),(0,b.jsx)(l.G7,{className:f.flexModebox,children:U.map((function(e,n){return(0,b.jsx)(l.G7,{onClick:function onClick(){!function handReasonTwo(e){U.map((function(n){return n.id===e.id?n.default=!0:n.default=!1,n})),W((0,a.Z)(U)),P((function(n){return(0,r.Z)((0,r.Z)({},n),{},{return_explain:e.id})}))}(e)},className:x()(e.default?f.activemodeBox:f.modeBox),children:e.name},n)}))})]}),(0,b.jsx)(l.G7,{className:f.safeBoxs}),(0,b.jsxs)(l.G7,{className:f.bottomBox1,children:[(0,b.jsx)(l.zx,{className:f.resetBox1,onClick:function onClick(){!function handReset(){R.current.return_reason=1,R.current.return_explain="",R.current.reasonName="请选择",R.current.reasonNameTwo="请选择",P((function(e){return(0,r.Z)((0,r.Z)({},e),{},{return_reason:1,return_explain:"",reasonName:"请选择",reasonNameTwo:"请选择"})})),V();var e=X(Q);Y((0,a.Z)(e));var n=X(U);W((0,a.Z)(n))}()},children:" 重置"}),(0,b.jsx)(l.zx,{className:x()(ee?f.button1:f.activeButton1),disabled:ee,onClick:function onClick(){return function handSlect(){var e,n,o,t,a;if("请选择"==(null===(e=R.current)||void 0===e?void 0:e.reasonName))return d().showToast({title:"请选择完整",icon:"error"}),!1;var i=Q.filter((function(e){return e.default}));R.current.return_reason=null===(n=i[0])||void 0===n?void 0:n.id,R.current.reasonName=null===(o=i[0])||void 0===o?void 0:o.name;var s=U.filter((function(e){return e.default}));R.current.return_explain=null===(t=s[0])||void 0===t?void 0:t.id,R.current.reasonNameTwo=null===(a=s[0])||void 0===a?void 0:a.name,P((function(e){return(0,r.Z)((0,r.Z)({},e),{},{reasonName:R.current.reasonName,reasonNameTwo:R.current.reasonNameTwo})})),L(!1)}()},children:" 确认"})]})]})})}),(0,b.jsx)(p.Z,{title:"筛选说明",show:te,onClose:function onClose(){null==re||re(!1)},children:(0,b.jsx)(l.pf,{scrollY:!0,children:(0,b.jsxs)(l.G7,{className:f.popupBox,children:[(0,b.jsxs)(l.G7,{className:f.thirdBox,children:[(0,b.jsx)(l.G7,{className:f.thirdTopfont,children:"货物情况"}),(0,b.jsx)(l.G7,{className:f.flexModebox,children:ue.map((function(e,n){return(0,b.jsx)(l.G7,{onClick:function onClick(){!function handStatus(e){ue.map((function(n){return n.id===e.id?n.default=!0:n.default=!1,n})),P((function(n){return(0,r.Z)((0,r.Z)({},n),{},{GoodStatus:e.id})})),le((0,a.Z)(ue))}(e)},className:x()(e.default?f.activemodeBox:f.modeBox),children:e.name},n)}))})]}),(0,b.jsx)(l.G7,{className:f.safeBoxs}),(0,b.jsxs)(l.G7,{className:f.bottomBox1,children:[(0,b.jsx)(l.zx,{className:f.resetBox1,onClick:function onClick(){!function handResetStatus(){var e=X(ue);le((0,a.Z)(e)),R.current.GoodStatus="",R.current.GoodStatusName="请选择",P((function(e){return(0,r.Z)((0,r.Z)({},e),{},{GoodStatus:"",GoodStatusName:"请选择"})}))}()},children:" 重置"}),(0,b.jsx)(l.zx,{className:x()(de?f.button1:f.activeButton1),disabled:de,onClick:function onClick(){return function handSlectStatus(){var e=ue.filter((function(e){return e.default}));R.current.GoodStatus=e[0].id,R.current.GoodStatusName=e[0].name,P((function(e){return(0,r.Z)((0,r.Z)({},e),{},{GoodStatus:R.current.GoodStatus,GoodStatusName:R.current.GoodStatusName})})),re(!1)}()},children:" 确认"})]})]})})})]})};k.enableShareAppMessage=!0;Page((0,t.createPageConfig)(k,"pages/applyGoods/index",{root:{cn:[]}},{navigationBarTitleText:"申请退货",enableShareAppMessage:!0}||{}))}},function(e){e.O(0,[3338,3927,750,5508,9652,3039,2107,1216,8592],(function(){return n=877,e(e.s=n);var n}));e.O()}]);