after-sale.641ef75b.js 7.1 KB

1
  1. import{d as v,y as l,g as F,T as h,D as A,j as t,F as c,A as u,B as n,C as G,$ as w}from"./ResizeObserver.es.f28023e0.js";import{C as L}from"./index.bd375ca9.js";import{A as p}from"./index.f1def79c.js";import{C as d}from"./index.3b2e70c8.js";import{C as m}from"./index.2a22730e.js";import{F as f}from"./index.975e8f79.js";import{L as C}from"./index.79f59946.js";import"./index.b0753b8c.js";import"./index.966d1893.js";import{T as I,a as B}from"./index.aa87c0e3.js";import{s,I as S}from"./item.3867acd7.js";import"./use-id.cc14bbe9.js";import"./use-tab-status.653933d8.js";import"./use-refs.b4f9d723.js";import"./index.7a1af785.js";import"./cart.6c277712.js";function T(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!w(e)}const g={0:"\u5F85\u5904\u7406",1:"\u9000\u8D27\u4E2D",2:"\u5DF2\u5B8C\u6210",3:"\u5DF2\u62D2\u7EDD"};var Q=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 i;if(console.log(this.loading,this.finished),this.loading&&this.finished)return;this.loading=!0;let e;if(this.active==="0"?e=await this.getIsReturnOrderList():e=await this.getReturnList(),e&&e.code===200&&e.data.list){const a=e.data;if(Array.isArray(a.list)){const r=[];for(let o=0;o<a.list.length;o++)a.list[o].orderItemList?a.list[o].orderItemList.findIndex(y=>y.returnStatus<0)>-1&&r.push(a.list[o]):r.push(a.list[o]);this.list=this.list.concat(this.list,r)}this.params.pageNum=e.data.pageNum+1}this.finished=this.params.pageNum>=((i=e==null?void 0:e.data)==null?void 0:i.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(e,i){this.returnGood.memberUsername=F.user.data.username,this.returnGood.orderId=e.id,this.returnGood.orderSn=e.orderSn,this.returnGood.productAttr=i.productAttr,this.returnGood.productBrand=i.productBrand,this.returnGood.productCount=i.productQuantity,this.returnGood.productId=i.productId,this.returnGood.productName=i.productName,this.returnGood.productPic=i.productPic,this.returnGood.productPrice=i.productPrice,this.returnGood.productRealPrice=i.productPrice,this.returnGood.proofPics="",this.returnGood.returnName=e.receiverName,this.returnGood.returnPhone=e.receiverPhone,this.returnGood.orderItemId=i.id,console.log(this.returnGood)},async setReturnShop(){if(!this.reason){h("\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&&(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{const{code:e,data:i}=await l.post("/api-mall-portal/returnApply/deliverySn",{data:{deliverySn:this.returnOrderSn,id:this.returnGoodId}});e===200&&(this.returnOrderSn="",this.kmsShow=!1,this.init(),this.getList())}catch{}},deleteReturnApply(){A.confirm({title:"\u63D0\u793A",message:"\u662F\u5426\u64A4\u9500\u9000\u8D27\u7533\u8BF7?",confirmButtonText:"\u64A4\u9500",confirmButtonColor:"var(--van-primary)"}).then(async()=>{try{const{code:e,data:i}=await l.post("/api-mall-portal/returnApply/delete/"+this.returnGoodId);e===200&&(this.init(),this.getList())}catch{}})}},render(){let e;const i=[{name:"0",title:"\u53EF\u9000\u5546\u54C1"},{name:"1",title:"\u5904\u7406\u4E2D"},{name:"2",title:"\u5DF2\u5904\u7406"}];return t("div",{class:s.shopOrder},[t(L,null,null),t(I,{active:this.active,"onUpdate:active":a=>this.active=a,color:"var(--van-primary)",lineWidth:28,animated:!0,swipeable:!0},T(e=i.map(a=>t(B,{name:a.name,title:a.title},{default:()=>[this.list.length?t(C,{loading:this.loading,finished:this.finished,finishedText:" ",class:[s.goodsList],onLoad:this.getList},{default:()=>[this.active===a.name&&this.list.map(r=>t(c,null,[r.orderItemList&&r.orderItemList.length?r.orderItemList.map(o=>t(m,{class:s.cellGroup},{default:()=>[t(d,{title:r.createTime,titleClass:s.payTime},null),t(S,{item:o},null),t(d,{center:!0,class:s.bottomCell},{title:()=>t(c,null,[u("\u8BA2\u5355\u7F16\u53F7\uFF1A"),o.orderSn]),default:()=>t("div",{class:s.btnList},[this.active==="0"&&o.returnStatus<0&&(r.status==3?r.afterSale==0:!0)?t(n,{size:"small",round:!0,onClick:()=>{this.show=!0,this.setReturnParams(r,o)}},{default:()=>[u("\u9000\u8D27\u7533\u8BF7")]}):null,o.returnStatus>=0?t("div",null,[g[o.returnStatus]]):null])})]})):t(m,{class:s.cellGroup},{default:()=>[t(d,{title:r.createTime,titleClass:s.payTime,value:g[r.status]},null),t(S,{item:r},null),t(d,{center:!0},{default:()=>t("div",{class:s.sectionCell},[r.status!==2&&r.status!==3&&t("div",{class:s.orderSn},[u("\u8BA2\u5355\u7F16\u53F7\uFF1A"),r.orderSn]),t("div",{class:s.btnList},[r.status===1&&!r.deliverySn?t(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?t(n,{size:"small",round:!0,type:"primary",onClick:()=>{this.returnGoodId=r.id,this.deleteReturnApply()}},{default:()=>[u("\u64A4\u9500\u7533\u8BF7")]}):null,r.status===2?t("div",{class:s.returnSection},[t("div",{class:s.orderSn},[u("\u8BA2\u5355\u7F16\u53F7\uFF1A"),r.orderSn]),t("div",{class:s.returnDes},[t("i",{class:s.iconChecked},null),u("\u8BE5\u5546\u54C1\u91D1\u989D\u5DF2\u4E8E "),r.handleTime," ",u("\u539F\u8DEF\u9000\u8FD8")])]):r.status===3?t("div",{class:s.returnSection},[t("div",{class:s.orderSn},[u("\u8BA2\u5355\u7F16\u53F7\uFF1A"),r.orderSn]),t("div",{class:s.returnDes},[u("\u62D2\u7EDD\u539F\u56E0: "),r.handleNote])]):null])])})]})]))]}):t(G,{btnStatus:!1,classImgSize:"SMALL",tips:"\u6682\u65E0\u6570\u636E"},null)]})))?e:{default:()=>[e]}),t(p,{show:this.show,"onUpdate:show":a=>this.show=a,title:"\u9000\u8D27\u539F\u56E0"},{default:()=>[t("div",{style:{paddingTop:"15px"}},[t(f,{class:[s.field],placeholder:"\u8BF7\u8F93\u5165\u9000\u8D27\u539F\u56E0",type:"textarea",rows:3,modelValue:this.reason,"onUpdate:modelValue":a=>this.reason=a},null)]),t("div",{class:s["btn-group"]},[t(n,{type:"primary",block:!0,round:!0,onClick:()=>this.setReturnShop()},{default:()=>[u("\u786E\u5B9A")]})])]}),t(p,{show:this.kmsShow,"onUpdate:show":a=>this.kmsShow=a,title:"\u586B\u5199\u9000\u8D27\u5FEB\u9012\u5355\u53F7"},{default:()=>[t(f,{modelValue:this.returnOrderSn,"onUpdate:modelValue":a=>this.returnOrderSn=a,class:[s.field],placeholder:"\u8BF7\u8F93\u5165\u9000\u8D27\u5FEB\u9012\u5355\u53F7"},null),t("div",{class:s["btn-group"]},[t(n,{type:"primary",block:!0,round:!0,onClick:()=>this.setReturnApplySn()},{default:()=>[u("\u786E\u5B9A")]})])]})])}});export{Q as default};