1 |
- import{d as S,w as l,g as v,T as d,D as G,j as e,F as w,B as n,z as u,C as L,Z as I}from"./index.e6d6174e.js";import{C as A}from"./index.045f03fd.js";import{A as p}from"./index.8ec5fd1e.js";import{C as h}from"./index.af99cf22.js";import{C as c}from"./index.4aea64de.js";import{F as m}from"./index.17d70acf.js";import{L as C}from"./index.f904775d.js";import"./index.9093bc60.js";import"./index.b4a53c6a.js";import{T as D,a as R}from"./index.54627972.js";import{s as i,I as f}from"./item.c39081aa.js";import"./index.d8c651bf.js";import"./use-height.8140ea04.js";import"./use-id.f239f36f.js";import"./use-tab-status.e9ba8498.js";import"./use-refs.eb803454.js";import"./index.67c54471.js";import"./cart.a845ff4e.js";function b(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!I(t)}const g={0:"\u5F85\u5904\u7406",1:"\u9000\u8D27\u4E2D",2:"\u5DF2\u5B8C\u6210",3:"\u5DF2\u62D2\u7EDD"};var Z=S({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;o<s.list.length;o++)s.list[o].orderItemList?s.list[o].orderItemList.findIndex(y=>y.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=v.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(){G.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(A,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(w,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,[g[o.returnStatus]]):null])})]})):e(c,{class:i.cellGroup},{default:()=>[e(h,{title:r.createTime,titleClass:i.payTime,value:g[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(L,{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{Z as default};
|