1 |
- import{C as w}from"./index.47d1b4c8.js";import{d as G,b as n,s as L,T as h,i as e,F as c,B as d,w as u,C as I,ak as A}from"./index.2557005b.js";import{A as m}from"./index.360c4599.js";import{C as p}from"./index.8d2bbd78.js";import{C as f}from"./index.3ec11c25.js";/* empty css *//* empty css */import{F as y}from"./index.633c65ff.js";import{L as C}from"./index.cf7918d9.js";import"./index.148eaba9.js";import"./index.061c46ec.js";import{T as b,a as D}from"./index.80f6d76f.js";import{s as i,I as g}from"./item.cc1e28a9.js";import{D as R}from"./function-call.be2183af.js";import"./use-height.08bcc7e6.js";import"./use-id.5ece45a3.js";import"./use-tab-status.3e57cf68.js";import"./use-refs.0bbf0541.js";import"./index.ba997053.js";import"./cart.b11a2590.js";import"./index.c8c590a2.js";function k(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!A(t)}const S={0:"\u5F85\u5904\u7406",1:"\u9000\u8D27\u4E2D",2:"\u5DF2\u5B8C\u6210",3:"\u5DF2\u62D2\u7EDD"};var Z=G({name:"after-sale",data(){return{active:"0",list:[],dataShow:!0,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 s,a;if(this.dataShow=!0,this.loading&&this.finished)return;this.loading=!0;let t;if(this.active==="0"?t=await this.getIsReturnOrderList():t=await this.getReturnList(),(s=t==null?void 0:t.data)!=null&&s.list||(this.dataShow=!1),t.code===200&&t.data.list){let r=t.data;if(Array.isArray(r.list)){let o=[];for(let l=0;l<r.list.length;l++)r.list[l].orderItemList?r.list[l].orderItemList.findIndex(v=>v.returnStatus<0)>-1&&o.push(r.list[l]):o.push(r.list[l]);this.list=this.list.concat(this.list,o)}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 n.get("/api-mall-portal/order/list",{params:{...this.params,status:"1,2,3"}})}catch{}return{}},async getReturnList(){try{return await n.post("/api-mall-portal/returnApply/list",{data:{...this.params,status:this.active==="1"?"0,1":"2,3"}})}catch{}return{}},setReturnParams(t,s){this.returnGood.memberUsername=L.user.data.username,this.returnGood.orderId=t.id,this.returnGood.orderSn=t.orderSn,this.returnGood.productAttr=s.productAttr,this.returnGood.productBrand=s.productBrand,this.returnGood.productCount=s.productQuantity,this.returnGood.productId=s.productId,this.returnGood.productName=s.productName,this.returnGood.productPic=s.productPic,this.returnGood.productPrice=s.productPrice,this.returnGood.productRealPrice=s.productPrice,this.returnGood.proofPics="",this.returnGood.returnName=t.receiverName,this.returnGood.returnPhone=t.receiverPhone,this.returnGood.orderItemId=s.id,console.log(this.returnGood)},async setReturnShop(){if(!this.reason){h("\u8BF7\u586B\u5199\u9000\u8D27\u539F\u56E0!");return}try{(await n.post("/api-mall-portal/returnApply/create",{data:{...this.returnGood,reason:this.reason}})).code===200&&(h({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){h("\u8BF7\u586B\u5199\u9000\u8D27\u5FEB\u9012\u5355\u53F7");return}try{let{code:t,data:s}=await n.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(){R.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:s}=await n.post("/api-mall-portal/returnApply/delete/"+this.returnGoodId);t===200&&(this.init(),this.getList())}catch{}})}},render(){let t;const s=[{name:"0",title:"\u5168\u90E8"},{name:"1",title:"\u5904\u7406\u4E2D"},{name:"2",title:"\u5DF2\u5904\u7406"}];return e("div",{class:i.shopOrder},[e(w,null,null),e(b,{active:this.active,"onUpdate:active":a=>this.active=a,color:"var(--van-primary)",lineWidth:28,animated:!0,swipeable:!0},k(t=s.map(a=>e(D,{name:a.name,title:a.title},{default:()=>[this.dataShow?e(c,null,[this.list.length?e(C,{loading:this.loading,finished:this.finished,finishedText:" ",class:[i.goodsList],onLoad:this.getList},{default:()=>[this.active===a.name&&this.list.map(r=>e(c,null,[r.orderItemList&&r.orderItemList.length?r.orderItemList.map(o=>e(f,{class:i.cellGroup},{default:()=>[e(g,{item:o},null),e(p,{center:!0},{default:()=>e("div",{class:i.btnList},[this.active==="0"&&(r.status!==0||r.status!==6)&&o.returnStatus<0?e(d,{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,[S[o.returnStatus]]):null])})]})):e(f,{class:i.cellGroup},{default:()=>[e(p,{title:r.createTime,titleClass:i.payTime,value:S[r.status]},null),e(g,{item:r},null),e(p,{center:!0},{default:()=>e("div",{class:i.btnList},[r.status===1&&!r.deliverySn?e(d,{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(d,{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)]):null]})))?t:{default:()=>[t]}),e(m,{show:this.show,"onUpdate:show":a=>this.show=a,title:"\u9000\u8D27\u539F\u56E0"},{default:()=>[e("div",{style:{paddingTop:"15px"}},[e(y,{class:[i.field],placeholder:"\u8BF7\u8F93\u5165\u9000\u8D27\u539F\u56E0",type:"textarea",rows:3,modelValue:this.reason,"onUpdate:modelValue":a=>this.reason=a},null)]),e("div",{class:i["btn-group"]},[e(d,{type:"primary",block:!0,round:!0,onClick:()=>this.setReturnShop()},{default:()=>[u("\u786E\u5B9A")]})])]}),e(m,{show:this.kmsShow,"onUpdate:show":a=>this.kmsShow=a,title:"\u586B\u5199\u9000\u8D27\u5FEB\u9012\u5355\u53F7"},{default:()=>[e(y,{modelValue:this.returnOrderSn,"onUpdate:modelValue":a=>this.returnOrderSn=a,class:[i.field],placeholder:"\u8BF7\u8F93\u5165\u9000\u8D27\u5FEB\u9012\u5355\u53F7"},null),e("div",{class:i["btn-group"]},[e(d,{type:"primary",block:!0,round:!0,onClick:()=>this.setReturnApplySn()},{default:()=>[u("\u786E\u5B9A")]})])]})])}});export{Z as default};
|