index.d595d4ed.js 5.2 KB

1
  1. import{C}from"./index.c5bf3ab5.js";import{d as g,i as e,A as n,by as m,F as c,B as u,e as d,D as h,C as v,$ as A}from"./index.7994470a.js";import{C as y}from"./index.777f4790.js";import{C as L}from"./index.9cdb5783.js";import{L as O}from"./index.ec643df3.js";import"./index.6449f9de.js";import"./index.889feca1.js";import{T as S,a as w}from"./index.a28173c9.js";import{s as r,I as D}from"./item.c10c7cae.js";import{o as B}from"./shop-mall.8049f9da.js";import{c as p}from"./cart.d2ad347e.js";import{u as I}from"./hooks.04c1f931.js";import"./index.0a2aeb2c.js";import"./use-height.ffa5a0f3.js";import"./use-tab-status.00d7316c.js";import"./use-id.117b75b2.js";import"./use-refs.ad5f4144.js";import"./index.2fbdc579.js";var R=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,[n("\u8BA2\u5355\u91D1\u989D"),e("span",{class:r.price,style:{paddingLeft:"5px"}},[e("i",null,[n("\xA5 ")]),m(t.payAmount)])]),!!t.couponAmount&&e("div",{class:r.coupon},[n("\u4F18\u60E0\u5238: -\xA5 "),m(t.couponAmount)])]),default:()=>e("div",{class:r.btnList},[t.status===0||t.status===6?e(c,null,[e(u,{size:"small",round:!0,onClick:l=>{l.stopPropagation(),a(t)}},{default:()=>[n("\u53D6\u6D88\u8BA2\u5355")]}),e(u,{size:"small",round:!0,type:"primary",onClick:l=>{l.stopPropagation(),i(t)}},{default:()=>[n("\u7EE7\u7EED\u652F\u4ED8")]})]):null,t.status===2?e(u,{size:"small",round:!0,type:"primary",onClick:l=>{l.stopPropagation(),s(t)}},{default:()=>[n("\u786E\u8BA4\u6536\u8D27")]}):null,t.status===3?e(c,null,[e("span",{class:r.confirmReceipt},[n("\u5DF2\u786E\u8BA4\u6536\u8D27")]),e(u,{size:"small",round:!0,type:"primary",onClick:l=>{l.stopPropagation(),o(t)}},{default:()=>[n("\u518D\u6765\u4E00\u5355")]})]):null])})}});function f(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!A(t)}var W=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(){I("\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{let{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"){let{code:i,data:s}=await d.post("/api-mall-portal/order/cancelUserOrder",{params:{orderId:t.id}});i===200&&(this.init(),this.getList())}},payOrder(t){p.orderInfo=t,this.$router.push({path:"/cartConfirmAgin"})},async onAginOrder(t){try{let a=await d.post("/api-mall-portal/order/oneOrder",{params:{orderId:t.id}}),{code:i,data:s}=a;i===200&&(p.calcAmount=s.calcAmount,p.cartPromotionItemList=s.cartPromotionItemList,p.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(C,{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(c,null,[e(L,{class:r.cellGroup,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(l=>e(D,{item:l},null)):null,e(R,{item:o,onCancelOrder:this.cancelOrder,onPayOrder:this.payOrder,onConfirmReceipt:this.onConfirmReceipt,onAginOrder:this.onAginOrder},null)]})])))?s:{default:()=>[s]}):e(v,{btnStatus:!1,classImgSize:"SMALL",tips:"\u6682\u65E0\u8BA2\u5355"},null)]})}))?t:{default:()=>[t]})])}});export{W as default};