var L=Object.defineProperty,S=Object.defineProperties;var b=Object.getOwnPropertyDescriptors;var p=Object.getOwnPropertySymbols;var j=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable;var m=(t,e,a)=>e in t?L(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a,h=(t,e)=>{for(var a in e||(e={}))j.call(e,a)&&m(t,a,e[a]);if(p)for(var a of p(e))x.call(e,a)&&m(t,a,e[a]);return t},f=(t,e)=>S(t,b(e));import{C as w}from"./index.8f85fe36.js";import{m as g,r as d,C as I}from"./index.f45ba589.js";import{d as y,b as i,j as l,F as v,B as c,p as C,D as A,y as B,z as D,t as P,m as F,v as R}from"./vendor.2bcdc9cf.js";/* empty css *//* empty css *//* empty css *//* empty css */import{s as r,I as T}from"./item.241684db.js";import{o as E}from"./shop-mall.789d0e66.js";import{c as u}from"./cart.2a3b730f.js";/* empty css */var z=y({name:"AfterSaleBtns",props:{item:{type:Object,default:{}},onCancelOrder:{type:Function,default:t=>{}},onPayOrder:{type:Function,default:t=>{}},onConfirmReceipt:{type:Function,default:t=>{}},onAginOrder:{type:Function,default:t=>{}}},setup({item:t,onCancelOrder:e,onPayOrder:a,onConfirmReceipt:s,onAginOrder:o}){return()=>i(C,{center:!0},{title:()=>i("div",{class:r.orderPrice},[i("div",null,[l("\u8BA2\u5355\u91D1\u989D"),i("span",{class:r.price,style:{paddingLeft:"5px"}},[i("i",null,[l("\xA5 ")]),g(t.payAmount+t.integrationAmount)])]),!!t.couponAmount&&i("div",{class:r.coupon},[l("\u4F18\u60E0\u5238: -\xA5 "),g(t.couponAmount)])]),default:()=>i("div",{class:r.btnList},[t.status===0||t.status===6?i(v,null,[i(c,{size:"small",round:!0,onClick:n=>{n.stopPropagation(),e(t)}},{default:()=>[l("\u53D6\u6D88\u8BA2\u5355")]}),i(c,{size:"small",round:!0,type:"primary",onClick:n=>{n.stopPropagation(),a(t)}},{default:()=>[l("\u7EE7\u7EED\u652F\u4ED8")]})]):null,t.status===2?i(c,{size:"small",round:!0,type:"primary",onClick:n=>{n.stopPropagation(),s(t)}},{default:()=>[l("\u786E\u8BA4\u6536\u8D27")]}):null])})}});function O(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!R(t)}var J=y({name:"shop-order",data(){return{active:0,list:[],dataShow:!0,loading:!1,finished:!1,params:{search:"",groupStatus:"APPLY",page:1,rows:20},page:{pageNum:1,pageSize:20}}},watch:{active(t){this.init(),this.getList()}},methods:{init(){this.page.pageNum=1,this.finished=!1,this.list=[],this.dataShow=!0},async getList(){if(!(this.loading||this.finished)){this.loading=!0;try{let{code:t,data:e}=await d.get("/api-mall-portal/order/list",{params:f(h({},this.page),{status:this.active===0?"0,6":this.active===1?"1,2":"3,4"})});t===200&&e.list&&(this.page.pageNum+=1,this.list=[].concat(this.list,e.list)),this.list.length>=e.total&&(this.finished=!0),this.list.length===0&&(this.dataShow=!1)}catch{this.finished=!0,this.dataShow=!1}this.loading=!1}},onClickRight(){this.$router.push("/afterSale")},async cancelOrder(t){if(await A.confirm({title:"\u63D0\u793A",message:"\u786E\u8BA4\u53D6\u6D88\u8BA2\u5355?",confirmButtonText:"\u53D6\u6D88\u8BA2\u5355",confirmButtonColor:"var(--van-primary)"})==="confirm"){let{code:a,data:s}=await d.post("/api-mall-portal/order/cancelUserOrder",{params:{orderId:t.id}});a===200&&(this.init(),this.getList())}},payOrder(t){u.orderInfo=t,this.$router.push({path:"/cartConfirmAgin"})},async onAginOrder(t){try{let e=await d.post("/api-mall-portal/order/oneOrder",{params:{orderId:t.id}}),{code:a,data:s}=e;a===200&&(u.calcAmount=s.calcAmount,u.cartPromotionItemList=s.cartPromotionItemList,u.memberReceiveAddressList=s.memberReceiveAddressList,this.$router.push({path:"/cartConfirm"})),console.log(e)}catch{}},async onConfirmReceipt(t){await A.confirm({title:"\u63D0\u793A",message:"\u786E\u8BA4\u6536\u8D27?",confirmButtonText:"\u6536\u8D27",confirmButtonColor:"var(--van-primary)"})==="confirm"&&(await d.post("/api-mall-portal/order/confirmReceiveOrder",{params:{orderId:t.id}})).code===200&&(this.init(),this.getList())}},render(){let t;const e=[{name:0,title:"\u5F85\u652F\u4ED8"},{name:1,title:"\u5F85\u6536\u8D27"},{name:2,title:"\u5DF2\u5B8C\u6210"}];return i("div",{class:r.shopOrder},[i(w,{ref:"colHeader",class:"header"},null),i(B,{active:this.active,"onUpdate:active":a=>this.active=a,color:"var(--van-primary)",lineWidth:28,animated:!0,swipeable:!0},O(t=e.map(a=>{let s;return i(D,{name:a.name,title:a.title},{default:()=>[this.active===a.name&&this.dataShow?i(P,{loading:this.loading,finished:this.finished,finishedText:" ",class:[r.goodsList],onLoad:this.getList},O(s=this.list.map(o=>i(v,null,[i(F,{class:r.cellGroup,border:!1,onClick:()=>{this.$router.push({path:"/shopOrderDetail",query:{id:o.id}})}},{default:()=>[i(C,{title:o.createTime,titleClass:r.payTime,value:E[o.status],valueClass:[0,4,5,6].includes(o.status)?r.payStatus:r.paySuccess},null),o.orderItemList&&o.orderItemList.length?o.orderItemList.map(n=>i(T,{item:n},null)):null,i(z,{item:o,onCancelOrder:this.cancelOrder,onPayOrder:this.payOrder,onConfirmReceipt:this.onConfirmReceipt,onAginOrder:this.onAginOrder},null)]})])))?s:{default:()=>[s]}):i(I,{btnStatus:!1,classImgSize:"SMALL",tips:"\u6682\u65E0\u8BA2\u5355"},null)]})}))?t:{default:()=>[t]})])}});export{J as default};