index.d5834e9d.js 5.2 KB

1
  1. import{d as g,j as e,A as l,bC as m,F as p,B as u,y as d,D as h,C,$ as v}from"./ResizeObserver.es.39b48a47.js";import{C as A}from"./index.970ad07b.js";import{C as y}from"./index.db115763.js";import{C as L}from"./index.9f5e14d1.js";import{L as O}from"./index.6c529ad4.js";import"./index.608320e9.js";import"./index.0e35d2fb.js";import{T as S,a as w}from"./index.5d4d28cc.js";import{s as r,I as D}from"./item.a47fb7f1.js";import{o as b}from"./shop-mall.eb722a4b.js";import{c}from"./cart.426348e2.js";import{u as B}from"./hooks.6df65925.js";import"./use-tab-status.bcc0c503.js";import"./use-id.b004ff17.js";import"./use-refs.07204da6.js";import"./index.fcbcb027.js";var I=g({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:a,onPayOrder:i,onConfirmReceipt:s,onAginOrder:o}){return()=>e(y,{center:!0},{title:()=>e("div",{class:r.orderPrice},[e("div",null,[l("\u8BA2\u5355\u91D1\u989D"),e("span",{class:r.price,style:{paddingLeft:"5px"}},[e("i",null,[l("\xA5 ")]),m(t.payAmount)])]),!!t.couponAmount&&e("div",{class:r.coupon},[l("\u4F18\u60E0\u5238: -\xA5 "),m(t.couponAmount)])]),default:()=>e("div",{class:r.btnList},[t.status===0||t.status===6?e(p,null,[e(u,{size:"small",round:!0,onClick:n=>{n.stopPropagation(),a(t)}},{default:()=>[l("\u53D6\u6D88\u8BA2\u5355")]}),e(u,{size:"small",round:!0,type:"primary",onClick:n=>{n.stopPropagation(),i(t)}},{default:()=>[l("\u7EE7\u7EED\u652F\u4ED8")]})]):null,t.status===2?e(u,{size:"small",round:!0,type:"primary",onClick:n=>{n.stopPropagation(),s(t)}},{default:()=>[l("\u786E\u8BA4\u6536\u8D27")]}):null,t.status===3?e(p,null,[e("span",{class:r.confirmReceipt},[l("\u5DF2\u786E\u8BA4\u6536\u8D27")]),e(u,{size:"small",round:!0,type:"primary",onClick:n=>{n.stopPropagation(),o(t)}},{default:()=>[l("\u518D\u6765\u4E00\u5355")]})]):null])})}});function f(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!v(t)}var U=g({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()}},mounted(){B("\u8BA2\u5355")},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{const{code:t,data:a}=await d.get("/api-mall-portal/order/list",{params:{...this.page,status:this.active===0?"0,6":this.active===1?"1,2":"3,4"}});t===200&&a.list&&(this.page.pageNum+=1,this.list=[].concat(this.list,a.list)),this.list.length>=a.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 h.confirm({title:"\u63D0\u793A",message:"\u786E\u8BA4\u53D6\u6D88\u8BA2\u5355?",confirmButtonText:"\u53D6\u6D88\u8BA2\u5355",confirmButtonColor:"var(--van-primary)"})==="confirm"){const{code:i,data:s}=await d.post("/api-mall-portal/order/cancelUserOrder",{params:{orderId:t.id}});i===200&&(this.init(),this.getList())}},payOrder(t){c.orderInfo=t,this.$router.push({path:"/cartConfirmAgin"})},async onAginOrder(t){try{const a=await d.post("/api-mall-portal/order/oneOrder",{params:{orderId:t.id}}),{code:i,data:s}=a;i===200&&(c.calcAmount=s.calcAmount,c.cartPromotionItemList=s.cartPromotionItemList,c.memberReceiveAddressList=s.memberReceiveAddressList,this.$router.push({path:"/cartConfirm"})),console.log(a)}catch{}},async onConfirmReceipt(t){await h.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 a=[{name:0,title:"\u5F85\u652F\u4ED8"},{name:1,title:"\u5F85\u6536\u8D27"},{name:2,title:"\u5DF2\u5B8C\u6210"}];return e("div",{class:r.shopOrder},[e(A,{ref:"colHeader",class:"header",rightText:"\u552E\u540E\u670D\u52A1",onClickRight:this.onClickRight},null),e(S,{active:this.active,"onUpdate:active":i=>this.active=i,color:"var(--van-primary)",lineWidth:28,animated:!0,swipeable:!0},f(t=a.map(i=>{let s;return e(w,{name:i.name,title:i.title},{default:()=>[this.active===i.name&&this.dataShow?e(O,{loading:this.loading,finished:this.finished,finishedText:" ",class:[r.goodsList],onLoad:this.getList},f(s=this.list.map(o=>e(p,null,[e(L,{class:r.cellGroup,border:!1,onClick:()=>{this.$router.push({path:"/shopOrderDetail",query:{id:o.id}})}},{default:()=>[e(y,{title:o.createTime,titleClass:r.payTime,value:b[o.status],valueClass:[0,4,5,6].includes(o.status)?r.payStatus:r.paySuccess},null),o.orderItemList&&o.orderItemList.length?o.orderItemList.map(n=>e(D,{item:n},null)):null,e(I,{item:o,onCancelOrder:this.cancelOrder,onPayOrder:this.payOrder,onConfirmReceipt:this.onConfirmReceipt,onAginOrder:this.onAginOrder},null)]})])))?s:{default:()=>[s]}):e(C,{btnStatus:!1,classImgSize:"SMALL",tips:"\u6682\u65E0\u8BA2\u5355"},null)]})}))?t:{default:()=>[t]})])}});export{U as default};