import{_ as e}from"./u-tabs.ea263673.js";import{q as a,u as t,o as s,c as o,w as l,n,i,a as r,b as u,d,F as c,f as m,e as p,y as _,g as f,t as h,l as y}from"./index-4ddb689d.js";import{r as g}from"./uni-app.es.24af5d4f.js";import{M as v,_ as C}from"./mescroll-mixins.a7931123.js";import{_ as E}from"./u-popup.37b3343e.js";import{a as T,D as k,b,P as R,R as S}from"./OrderType.16ab6c02.js";import{l as D,c as I,r as L,e as P}from"./order.42b61037.js";import{_ as x}from"./_plugin-vue_export-helper.1b428a4d.js";import"./u-icon.e981d1c2.js";const w=[{name:"全部",value:"all"},{name:"待支付",value:"payment"},{name:"待发货",value:"delivery"},{name:"待收货",value:"received"},{name:"待评价",value:"comment"}];const O=x({mixins:[v],data:()=>({DeliveryStatusEnum:T,DeliveryTypeEnum:k,OrderStatusEnum:b,PayStatusEnum:R,ReceiptStatusEnum:S,options:{dataType:"all"},tabs:w,curTab:0,list:a(),upOption:{auto:!0,page:{size:15},noMoreSize:4,empty:{tip:"亲,暂无订单记录"}},canReset:!1,showQRCodePopup:!1,qrcodeImage:""}),onLoad(e){this.initCurTab(e),uni.$on("syncRefresh",(e=>{this.canReset=e}))},onShow(){this.canReset&&this.onRefreshList(),this.canReset=!1},onUnload(){uni.$off("syncRefresh")},methods:{initCurTab(e){const a=this;if(e.dataType){const t=a.tabs.findIndex((a=>a.value==e.dataType));a.curTab=t>-1?t:0}},upCallback(e){const a=this;a.getOrderList(e.num).then((e=>{const t=e.data.length,s=e.data.total;a.mescroll.endBySize(t,s)})).catch((()=>a.mescroll.endErr()))},getOrderList(e=1){const a=this;return new Promise(((s,o)=>{D({dataType:a.getTabValue(),page:e},{load:!1}).then((o=>{const l=a.initList(o.data.list);a.list.data=t(l,a.list,e),s(l)}))}))},initList:e=>(e.data.forEach((e=>{e.total_num=0,e.goods.forEach((a=>{e.total_num+=a.total_num}))})),e),getTabValue(){return this.tabs[this.curTab].value},onChangeTab(e){this.curTab=e,this.onRefreshList()},onRefreshList(){this.list=a(),setTimeout((()=>{this.mescroll.resetUpScroll()}),120)},onCancel(e){const a=this;uni.showModal({title:"友情提示",content:"确认要取消该订单吗?",success(t){t.confirm&&I(e).then((e=>{a.$toast(e.message),a.onRefreshList()}))}})},onReceipt(e){const a=this;uni.showModal({title:"友情提示",content:"确认收到商品了吗?",success(t){t.confirm&&L(e).then((e=>{a.$success(e.message),a.onRefreshList()}))}})},onExtractQRCode(e){const a=this;P(e,{channel:a.platform}).then((e=>{a.qrcodeImage=e.data.qrcode,a.showQRCodePopup=!0}))},onPay(e){this.$navTo("pages/checkout/cashier/index",{orderId:e})},handleTargetDetail(e){this.$navTo("pages/order/detail",{orderId:e})},handleTargetComment(e){this.$navTo("pages/order/comment/index",{orderId:e})}}},[["render",function(a,t,v,T,k,b){const R=g(_("u-tabs"),e),S=y,D=i,I=f,L=g(_("mescroll-body"),C),P=g(_("u-popup"),E);return s(),o(D,{class:"container",style:n(a.appThemeStyle)},{default:l((()=>[r(L,{ref:"mescrollRef",sticky:!0,onInit:a.mescrollInit,down:{native:!0},onDown:a.downCallback,up:k.upOption,onUp:b.upCallback},{default:l((()=>[r(R,{list:k.tabs,"is-scroll":!1,current:k.curTab,"active-color":a.appTheme.mainBg,duration:.2,onChange:b.onChangeTab},null,8,["list","current","active-color","duration","onChange"]),r(D,{class:"order-list"},{default:l((()=>[(s(!0),u(c,null,d(k.list.data,((e,a)=>(s(),o(D,{class:"order-item",key:a},{default:l((()=>[r(D,{class:"item-top"},{default:l((()=>[r(D,{class:"item-top-left"},{default:l((()=>[r(S,{class:"order-time"},{default:l((()=>[m(h(e.create_time),1)])),_:2},1024)])),_:2},1024),r(D,{class:"item-top-right"},{default:l((()=>[r(S,{class:"state-text"},{default:l((()=>[m(h(e.state_text),1)])),_:2},1024)])),_:2},1024)])),_:2},1024),r(D,{class:"goods-list",onClick:a=>b.handleTargetDetail(e.order_id)},{default:l((()=>[(s(!0),u(c,null,d(e.goods,((e,a)=>(s(),o(D,{class:"goods-item",key:a},{default:l((()=>[r(D,{class:"goods-image"},{default:l((()=>[r(I,{class:"image",src:e.goods_image,mode:"scaleToFill"},null,8,["src"])])),_:2},1024),r(D,{class:"goods-content"},{default:l((()=>[r(D,{class:"goods-title"},{default:l((()=>[r(S,{class:"twoline-hide"},{default:l((()=>[m(h(e.goods_name),1)])),_:2},1024)])),_:2},1024),r(D,{class:"goods-props clearfix"},{default:l((()=>[(s(!0),u(c,null,d(e.goods_props,((e,a)=>(s(),o(D,{class:"goods-props-item",key:a},{default:l((()=>[r(S,null,{default:l((()=>[m(h(e.value.name),1)])),_:2},1024)])),_:2},1024)))),128))])),_:2},1024)])),_:2},1024),r(D,{class:"goods-trade"},{default:l((()=>[r(D,{class:"goods-price"},{default:l((()=>[r(S,{class:"unit"},{default:l((()=>[m("¥")])),_:1}),r(S,{class:"value"},{default:l((()=>[m(h(e.is_user_grade?e.grade_goods_price:e.goods_price),1)])),_:2},1024)])),_:2},1024),r(D,{class:"goods-num"},{default:l((()=>[r(S,null,{default:l((()=>[m("×"+h(e.total_num),1)])),_:2},1024)])),_:2},1024)])),_:2},1024)])),_:2},1024)))),128))])),_:2},1032,["onClick"]),r(D,{class:"order-total"},{default:l((()=>[r(S,null,{default:l((()=>[m("共"+h(e.total_num)+"件商品,总金额",1)])),_:2},1024),r(S,{class:"unit"},{default:l((()=>[m("¥")])),_:1}),r(S,{class:"money"},{default:l((()=>[m(h(e.pay_price),1)])),_:2},1024)])),_:2},1024),e.order_status!=k.OrderStatusEnum.CANCELLED.value?(s(),o(D,{key:0,class:"order-handle"},{default:l((()=>[r(D,{class:"btn-group clearfix"},{default:l((()=>[e.pay_status==k.PayStatusEnum.PENDING.value?(s(),o(D,{key:0,class:"btn-item",onClick:a=>b.onCancel(e.order_id)},{default:l((()=>[m("取消")])),_:2},1032,["onClick"])):p("",!0),e.order_status!=k.OrderStatusEnum.APPLY_CANCEL.value?(s(),u(c,{key:1},[e.pay_status==k.PayStatusEnum.SUCCESS.value&&e.delivery_status==k.DeliveryStatusEnum.NOT_DELIVERED.value?(s(),o(D,{key:0,class:"btn-item",onClick:a=>b.onCancel(e.order_id)},{default:l((()=>[m("申请取消")])),_:2},1032,["onClick"])):p("",!0),e.pay_status==k.PayStatusEnum.SUCCESS.value&&e.delivery_type==k.DeliveryTypeEnum.EXTRACT.value&&e.delivery_status==k.DeliveryStatusEnum.NOT_DELIVERED.value?(s(),o(D,{key:1,class:"btn-item active",onClick:a=>b.onExtractQRCode(e.order_id)},{default:l((()=>[r(S,{class:"iconfont icon-qr-extract"}),r(S,{class:"m-l-10"},{default:l((()=>[m("核销码")])),_:1})])),_:2},1032,["onClick"])):p("",!0)],64)):(s(),o(D,{key:2,class:"f-28 col-8"},{default:l((()=>[m("取消申请中")])),_:1})),e.pay_status==k.PayStatusEnum.PENDING.value?(s(),o(D,{key:3,class:"btn-item active",onClick:a=>b.onPay(e.order_id)},{default:l((()=>[m("去支付")])),_:2},1032,["onClick"])):p("",!0),e.delivery_status==k.DeliveryStatusEnum.DELIVERED.value&&e.receipt_status==k.ReceiptStatusEnum.NOT_RECEIVED.value?(s(),o(D,{key:4,class:"btn-item active",onClick:a=>b.onReceipt(e.order_id)},{default:l((()=>[m("确认收货")])),_:2},1032,["onClick"])):p("",!0),e.order_status==k.OrderStatusEnum.COMPLETED.value&&0==e.is_comment?(s(),o(D,{key:5,class:"btn-item",onClick:a=>b.handleTargetComment(e.order_id)},{default:l((()=>[m("评价")])),_:2},1032,["onClick"])):p("",!0)])),_:2},1024)])),_:2},1024)):p("",!0)])),_:2},1024)))),128))])),_:1})])),_:1},8,["onInit","onDown","up","onUp"]),r(P,{modelValue:k.showQRCodePopup,"onUpdate:modelValue":t[0]||(t[0]=e=>k.showQRCodePopup=e),mode:"center","border-radius":"26",closeable:!0},{default:l((()=>[r(D,{class:"qrcode-popup"},{default:l((()=>[r(D,{class:"title"},{default:l((()=>[m("自提核销二维码")])),_:1}),r(D,{class:"pop-content"},{default:l((()=>[k.qrcodeImage?(s(),o(I,{key:0,class:"image",src:k.qrcodeImage},null,8,["src"])):p("",!0)])),_:1})])),_:1})])),_:1},8,["modelValue"])])),_:1},8,["style"])}],["__scopeId","data-v-df35aac2"]]);export{O as default};