index.a8cd4725.js 5.2 KB

1
  1. import{d as g,j as e,z as n,by as m,F as c,B as u,w as d,D as h,C,Z as v}from"./index.e6d6174e.js";import{C as A}from"./index.045f03fd.js";import{C as y}from"./index.af99cf22.js";import{C as L}from"./index.4aea64de.js";import{L as O}from"./index.f904775d.js";import"./index.9093bc60.js";import"./index.b4a53c6a.js";import{T as S,a as w}from"./index.54627972.js";import{s as r,I as D}from"./item.c39081aa.js";import{o as B}from"./shop-mall.60cd47e3.js";import{c as p}from"./cart.a845ff4e.js";import{u as I}from"./hooks.00b5b341.js";import"./index.d8c651bf.js";import"./use-height.8140ea04.js";import"./use-tab-status.e9ba8498.js";import"./use-id.f239f36f.js";import"./use-refs.eb803454.js";import"./index.67c54471.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]"&&!v(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(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(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(C,{btnStatus:!1,classImgSize:"SMALL",tips:"\u6682\u65E0\u8BA2\u5355"},null)]})}))?t:{default:()=>[t]})])}});export{W as default};