index.44dde8cd.js 5.2 KB

1
  1. import{C}from"./index.33f0ddb9.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.6b776f4b.js";import{C as y}from"./index.7486196c.js";import{C as L}from"./index.aa464e80.js";import{L as O}from"./index.9b1da5d2.js";import"./index.998c3386.js";import"./index.570314c1.js";import{T as S,a as w}from"./index.21339447.js";import{s as r,I as D}from"./item.73511c98.js";import{o as B}from"./shop-mall.043fc5f6.js";import{c as p}from"./cart.b81c0cf4.js";import{u as I}from"./hooks.ad006126.js";import"./index.f0306d29.js";import"./use-height.c83159bc.js";import"./use-tab-status.ad41a764.js";import"./use-id.40b6af6b.js";import"./use-refs.a68d4385.js";import"./index.7cc0b0e7.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};