after-sale.3e33cf26.js 6.8 KB

1
  1. var L=Object.defineProperty,I=Object.defineProperties;var A=Object.getOwnPropertyDescriptors;var m=Object.getOwnPropertySymbols;var b=Object.prototype.hasOwnProperty,j=Object.prototype.propertyIsEnumerable;var f=(t,s,e)=>s in t?L(t,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[s]=e,d=(t,s)=>{for(var e in s||(s={}))b.call(s,e)&&f(t,e,s[e]);if(m)for(var e of m(s))j.call(s,e)&&f(t,e,s[e]);return t},h=(t,s)=>I(t,A(s));import{C as x}from"./index.6e7075da.js";import{r as u,s as C,C as D}from"./index.3619a7ff.js";import{d as R,T as p,D as B,b as r,y as N,z as k,t as F,F as O,m as y,p as c,B as n,j as l,v as P,A as g,l as S}from"./vendor.2bcdc9cf.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import{s as i,I as v}from"./item.fde3cf4e.js";/* empty css */import"./cart.2a3b730f.js";function T(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!P(t)}const G={0:"\u5F85\u5904\u7406",1:"\u9000\u8D27\u4E2D",2:"\u5DF2\u5B8C\u6210",3:"\u5DF2\u62D2\u7EDD"};var Z=R({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 s;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 e=t.data;if(Array.isArray(e.list)){let a=[];for(let o=0;o<e.list.length;o++)e.list[o].orderItemList?e.list[o].orderItemList.findIndex(w=>w.returnStatus<0)>-1&&a.push(e.list[o]):a.push(e.list[o]);this.list=this.list.concat(this.list,a)}this.params.pageNum=t.data.pageNum+1}this.finished=this.params.pageNum>=((s=t==null?void 0:t.data)==null?void 0:s.totalPage),this.loading=!1},async getIsReturnOrderList(){try{return await u.get("/api-mall-portal/order/list",{params:h(d({},this.params),{status:"1,2,3"})})}catch{}return{}},async getReturnList(){try{return await u.post("/api-mall-portal/returnApply/list",{data:h(d({},this.params),{status:this.active==="1"?"0,1":"2,3"})})}catch{}return{}},setReturnParams(t,s){this.returnGood.memberUsername=C.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){p("\u8BF7\u586B\u5199\u9000\u8D27\u539F\u56E0!");return}try{(await u.post("/api-mall-portal/returnApply/create",{data:h(d({},this.returnGood),{reason:this.reason})})).code===200&&(p({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){p("\u8BF7\u586B\u5199\u9000\u8D27\u5FEB\u9012\u5355\u53F7");return}try{let{code:t,data:s}=await u.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(){B.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 u.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 r("div",{class:i.shopOrder},[r(x,null,null),r(N,{active:this.active,"onUpdate:active":e=>this.active=e,color:"var(--van-primary)",lineWidth:28,animated:!0,swipeable:!0},T(t=s.map(e=>r(k,{name:e.name,title:e.title},{default:()=>[this.list.length?r(F,{loading:this.loading,finished:this.finished,finishedText:" ",class:[i.goodsList],onLoad:this.getList},{default:()=>[this.active===e.name&&this.list.map(a=>r(O,null,[a.orderItemList&&a.orderItemList.length?a.orderItemList.map(o=>r(y,{class:i.cellGroup},{default:()=>[r(v,{item:o},null),r(c,{center:!0},{default:()=>r("div",{class:i.btnList},[this.active==="0"&&o.returnStatus<0&&(a.status==3?a.afterSale==0:!0)?r(n,{size:"small",round:!0,type:"primary",onClick:()=>{this.show=!0,this.setReturnParams(a,o)}},{default:()=>[l("\u9000\u8D27\u7533\u8BF7")]}):null,o.returnStatus>=0?r("div",null,[G[o.returnStatus]]):null])})]})):r(y,{class:i.cellGroup},{default:()=>[r(c,{title:a.createTime,titleClass:i.payTime,value:G[a.status]},null),r(v,{item:a},null),r(c,{center:!0},{default:()=>r("div",{class:i.btnList},[a.status===1&&!a.deliverySn?r(n,{size:"small",round:!0,onClick:()=>{this.returnGoodId=a.id,this.kmsShow=!0}},{default:()=>[l("\u586B\u5199\u9000\u8D27\u5FEB\u9012\u5355\u53F7")]}):null,a.status<=1?r(n,{size:"small",round:!0,type:"primary",onClick:()=>{this.returnGoodId=a.id,this.deleteReturnApply()}},{default:()=>[l("\u64A4\u9500\u7533\u8BF7")]}):null,a.status===2?r("div",{class:i.returnDes},[l("\u8BE5\u5546\u54C1\u91D1\u989D\u5DF2\u4E8E "),a.handleTime," ",l("\u539F\u8DEF\u9000\u8FD8")]):a.status===3?r("div",{class:i.returnDes},[l("\u62D2\u7EDD\u539F\u56E0: "),a.handleNote]):null])})]})]))]}):r(D,{btnStatus:!1,classImgSize:"SMALL",tips:"\u6682\u65E0\u6570\u636E"},null)]})))?t:{default:()=>[t]}),r(g,{show:this.show,"onUpdate:show":e=>this.show=e,title:"\u9000\u8D27\u539F\u56E0"},{default:()=>[r("div",{style:{paddingTop:"15px"}},[r(S,{class:[i.field],placeholder:"\u8BF7\u8F93\u5165\u9000\u8D27\u539F\u56E0",type:"textarea",rows:3,modelValue:this.reason,"onUpdate:modelValue":e=>this.reason=e},null)]),r("div",{class:i["btn-group"]},[r(n,{type:"primary",block:!0,round:!0,onClick:()=>this.setReturnShop()},{default:()=>[l("\u786E\u5B9A")]})])]}),r(g,{show:this.kmsShow,"onUpdate:show":e=>this.kmsShow=e,title:"\u586B\u5199\u9000\u8D27\u5FEB\u9012\u5355\u53F7"},{default:()=>[r(S,{modelValue:this.returnOrderSn,"onUpdate:modelValue":e=>this.returnOrderSn=e,class:[i.field],placeholder:"\u8BF7\u8F93\u5165\u9000\u8D27\u5FEB\u9012\u5355\u53F7"},null),r("div",{class:i["btn-group"]},[r(n,{type:"primary",block:!0,round:!0,onClick:()=>this.setReturnApplySn()},{default:()=>[l("\u786E\u5B9A")]})])]})])}});export{Z as default};