index.b2ea0aae.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.b7226882.js";import{C as A}from"./index.969bba7f.js";import{C as y}from"./index.40f703b6.js";import{C as L}from"./index.9269bf1e.js";import{L as O}from"./index.9fec2202.js";import"./index.f6c44874.js";import"./index.cf00521e.js";import{T as S,a as w}from"./index.dc988884.js";import{s as r,I as D}from"./item.c023d9e9.js";import{o as b}from"./shop-mall.727de868.js";import{c}from"./cart.5e5d785e.js";import{u as B}from"./hooks.a4ed20cb.js";import"./use-tab-status.db1f6d2e.js";import"./use-id.5d5e6e63.js";import"./use-refs.428b450a.js";import"./index.20c0f4c5.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};