import{C as S}from"./index.33f0ddb9.js";import{d as v,e as l,s as G,T as d,D as w,i as e,F as L,B as n,A as u,C as I,$ as A}from"./index.6b776f4b.js";import{A as p}from"./index.1d37754d.js";import{C as h}from"./index.7486196c.js";import{C as c}from"./index.aa464e80.js";import{F as m}from"./index.ef17e812.js";import{L as C}from"./index.9b1da5d2.js";import"./index.998c3386.js";import"./index.570314c1.js";import{T as D,a as R}from"./index.21339447.js";import{s as i,I as f}from"./item.73511c98.js";import"./index.f0306d29.js";import"./use-height.c83159bc.js";import"./use-id.40b6af6b.js";import"./use-tab-status.ad41a764.js";import"./use-refs.a68d4385.js";import"./index.7cc0b0e7.js";import"./cart.b81c0cf4.js";function b(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!A(t)}const y={0:"\u5F85\u5904\u7406",1:"\u9000\u8D27\u4E2D",2:"\u5DF2\u5B8C\u6210",3:"\u5DF2\u62D2\u7EDD"};var $=v({name:"after-sale",data(){return{active:"0",list:[],dataShow:!1,loading:!1,finished:!1,show:!1,kmsShow:!1,params:{pageNum:1,pageSize:20},returnGood:{},reason:"",returnOrderSn:"",returnGoodId:0}},watch:{active(){this.init(),this.getList()}},mounted(){this.getList()},methods:{init(){this.params.pageNum=1,this.finished=!1,this.list=[]},async getList(){var a;if(console.log(this.loading,this.finished),this.loading&&this.finished)return;this.loading=!0;let t;if(this.active==="0"?t=await this.getIsReturnOrderList():t=await this.getReturnList(),t&&t.code===200&&t.data.list){let s=t.data;if(Array.isArray(s.list)){let r=[];for(let o=0;og.returnStatus<0)>-1&&r.push(s.list[o]):r.push(s.list[o]);this.list=this.list.concat(this.list,r)}this.params.pageNum=t.data.pageNum+1}this.finished=this.params.pageNum>=((a=t==null?void 0:t.data)==null?void 0:a.totalPage),this.loading=!1},async getIsReturnOrderList(){try{return await l.get("/api-mall-portal/order/list",{params:{...this.params,status:"1,2,3"}})}catch{}return{}},async getReturnList(){try{return await l.post("/api-mall-portal/returnApply/list",{data:{...this.params,status:this.active==="1"?"0,1":"2,3"}})}catch{}return{}},setReturnParams(t,a){this.returnGood.memberUsername=G.user.data.username,this.returnGood.orderId=t.id,this.returnGood.orderSn=t.orderSn,this.returnGood.productAttr=a.productAttr,this.returnGood.productBrand=a.productBrand,this.returnGood.productCount=a.productQuantity,this.returnGood.productId=a.productId,this.returnGood.productName=a.productName,this.returnGood.productPic=a.productPic,this.returnGood.productPrice=a.productPrice,this.returnGood.productRealPrice=a.productPrice,this.returnGood.proofPics="",this.returnGood.returnName=t.receiverName,this.returnGood.returnPhone=t.receiverPhone,this.returnGood.orderItemId=a.id,console.log(this.returnGood)},async setReturnShop(){if(!this.reason){d("\u8BF7\u586B\u5199\u9000\u8D27\u539F\u56E0!");return}try{(await l.post("/api-mall-portal/returnApply/create",{data:{...this.returnGood,reason:this.reason}})).code===200&&(d({message:"\u9000\u8D27\u7533\u8BF7\u6210\u529F",icon:"success"}),setTimeout(()=>{this.show=!1,this.reason="",this.returnOrderSn="",this.active="1"},500))}catch{}this.returnGood={}},async setReturnApplySn(){if(!this.returnOrderSn){d("\u8BF7\u586B\u5199\u9000\u8D27\u5FEB\u9012\u5355\u53F7");return}try{let{code:t,data:a}=await l.post("/api-mall-portal/returnApply/deliverySn",{data:{deliverySn:this.returnOrderSn,id:this.returnGoodId}});t===200&&(this.returnOrderSn="",this.kmsShow=!1,this.init(),this.getList())}catch{}},deleteReturnApply(){w.confirm({title:"\u63D0\u793A",message:"\u662F\u5426\u64A4\u9500\u9000\u8D27\u7533\u8BF7?",confirmButtonText:"\u64A4\u9500",confirmButtonColor:"var(--van-primary)"}).then(async()=>{try{let{code:t,data:a}=await l.post("/api-mall-portal/returnApply/delete/"+this.returnGoodId);t===200&&(this.init(),this.getList())}catch{}})}},render(){let t;const a=[{name:"0",title:"\u5168\u90E8"},{name:"1",title:"\u5904\u7406\u4E2D"},{name:"2",title:"\u5DF2\u5904\u7406"}];return e("div",{class:i.shopOrder},[e(S,null,null),e(D,{active:this.active,"onUpdate:active":s=>this.active=s,color:"var(--van-primary)",lineWidth:28,animated:!0,swipeable:!0},b(t=a.map(s=>e(R,{name:s.name,title:s.title},{default:()=>[this.list.length?e(C,{loading:this.loading,finished:this.finished,finishedText:" ",class:[i.goodsList],onLoad:this.getList},{default:()=>[this.active===s.name&&this.list.map(r=>e(L,null,[r.orderItemList&&r.orderItemList.length?r.orderItemList.map(o=>e(c,{class:i.cellGroup},{default:()=>[e(f,{item:o},null),e(h,{center:!0},{default:()=>e("div",{class:i.btnList},[this.active==="0"&&o.returnStatus<0&&(r.status==3?r.afterSale==0:!0)?e(n,{size:"small",round:!0,type:"primary",onClick:()=>{this.show=!0,this.setReturnParams(r,o)}},{default:()=>[u("\u9000\u8D27\u7533\u8BF7")]}):null,o.returnStatus>=0?e("div",null,[y[o.returnStatus]]):null])})]})):e(c,{class:i.cellGroup},{default:()=>[e(h,{title:r.createTime,titleClass:i.payTime,value:y[r.status]},null),e(f,{item:r},null),e(h,{center:!0},{default:()=>e("div",{class:i.btnList},[r.status===1&&!r.deliverySn?e(n,{size:"small",round:!0,onClick:()=>{this.returnGoodId=r.id,this.kmsShow=!0}},{default:()=>[u("\u586B\u5199\u9000\u8D27\u5FEB\u9012\u5355\u53F7")]}):null,r.status<=1?e(n,{size:"small",round:!0,type:"primary",onClick:()=>{this.returnGoodId=r.id,this.deleteReturnApply()}},{default:()=>[u("\u64A4\u9500\u7533\u8BF7")]}):null,r.status===2?e("div",{class:i.returnDes},[u("\u8BE5\u5546\u54C1\u91D1\u989D\u5DF2\u4E8E "),r.handleTime," ",u("\u539F\u8DEF\u9000\u8FD8")]):r.status===3?e("div",{class:i.returnDes},[u("\u62D2\u7EDD\u539F\u56E0: "),r.handleNote]):null])})]})]))]}):e(I,{btnStatus:!1,classImgSize:"SMALL",tips:"\u6682\u65E0\u6570\u636E"},null)]})))?t:{default:()=>[t]}),e(p,{show:this.show,"onUpdate:show":s=>this.show=s,title:"\u9000\u8D27\u539F\u56E0"},{default:()=>[e("div",{style:{paddingTop:"15px"}},[e(m,{class:[i.field],placeholder:"\u8BF7\u8F93\u5165\u9000\u8D27\u539F\u56E0",type:"textarea",rows:3,modelValue:this.reason,"onUpdate:modelValue":s=>this.reason=s},null)]),e("div",{class:i["btn-group"]},[e(n,{type:"primary",block:!0,round:!0,onClick:()=>this.setReturnShop()},{default:()=>[u("\u786E\u5B9A")]})])]}),e(p,{show:this.kmsShow,"onUpdate:show":s=>this.kmsShow=s,title:"\u586B\u5199\u9000\u8D27\u5FEB\u9012\u5355\u53F7"},{default:()=>[e(m,{modelValue:this.returnOrderSn,"onUpdate:modelValue":s=>this.returnOrderSn=s,class:[i.field],placeholder:"\u8BF7\u8F93\u5165\u9000\u8D27\u5FEB\u9012\u5355\u53F7"},null),e("div",{class:i["btn-group"]},[e(n,{type:"primary",block:!0,round:!0,onClick:()=>this.setReturnApplySn()},{default:()=>[u("\u786E\u5B9A")]})])]})])}});export{$ as default};