"use strict";const e=require("../../common/vendor.js"),t=require("../../common/assets.js"),i={components:{GuideNavBar:()=>"../../components/guide-nav-bar/guide-nav-bar.js"},data:()=>({data:{todayEarnings:0,monthEarnings:0,records:[]},orderTypes:[{label:"订单类型",value:""},{label:"拼团快讲",value:"GROUP_QUICK"},{label:"拼团精讲",value:"GROUP_PREMIUM"},{label:"包团快讲",value:"PRIVATE_QUICK"},{label:"包团精讲",value:"PRIVATE_PREMIUM"}],scenicOptions:["景区选择"],orderTypeIndex:0,scenicIndex:0,selectedDate:"",loading:!1,isLeaving:!1}),computed:{orderTypeLabels(){return this.orderTypes.map(e=>e.label)},visibleRows(){return this.data.records.map(e=>({...e,scenicName:e.scenicName||"",serviceName:e.serviceName||this.serviceName(e.orderType),time:this.formatDateTime(e.completedAt)}))}},onShow(){this.loadData()},methods:{goBack(){this.isLeaving||(this.isLeaving=!0,setTimeout(()=>{e.backOrHome()},280))},goWithdraw(){e.routeTo("/pages/withdrawal/index")},loadData(){this.loading||(this.loading=!0,e.getEarnings({serviceType:this.orderTypes[this.orderTypeIndex].value,scenicName:this.scenicIndex>0?this.scenicOptions[this.scenicIndex]:"",date:this.selectedDate}).then(e=>{this.data=e;const t=this.scenicIndex>0?this.scenicOptions[this.scenicIndex]:"";this.scenicOptions=["景区选择",...e.scenicOptions||[]],this.scenicIndex=t?Math.max(this.scenicOptions.indexOf(t),0):0}).catch(t=>{e.index.showToast({title:t.message||"业绩数据加载失败",icon:"none"})}).finally(()=>{this.loading=!1}))},moneyNumber(e=0){const t=Number(e);return(Number.isFinite(t)?t:0).toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g,",")},serviceName:e=>({GROUP_QUICK:"拼团 · 快讲",GROUP_PREMIUM:"拼团 · 精讲",PRIVATE_QUICK:"包团 · 快讲",PRIVATE_PREMIUM:"包团 · 精讲"}[e]||"-"),formatDateTime:e=>e?e.replace("T"," ").slice(0,19):"-",changeOrderType(e){this.orderTypeIndex=Number(e.detail.value),this.loadData()},changeScenic(e){this.scenicIndex=Number(e.detail.value),this.loadData()},changeDate(e){this.selectedDate=e.detail.value,this.loadData()}}};if(!Array){e.resolveComponent("guide-nav-bar")()}Math;const a=e._export_sfc(i,[["render",function(i,a,n,s,c,o){return e.e({a:e.o(o.goBack,"46"),b:e.o(o.goWithdraw,"7a"),c:e.p({title:"业绩明细","action-text":"提现"}),d:e.t(o.moneyNumber(c.data.todayEarnings)),e:e.t(o.moneyNumber(c.data.monthEarnings)),f:e.t(o.orderTypeLabels[c.orderTypeIndex]),g:t._imports_0$4,h:o.orderTypeLabels,i:c.orderTypeIndex,j:e.o((...e)=>o.changeOrderType&&o.changeOrderType(...e),"e9"),k:e.t(c.scenicOptions[c.scenicIndex]),l:t._imports_0$4,m:c.scenicOptions,n:c.scenicIndex,o:e.o((...e)=>o.changeScenic&&o.changeScenic(...e),"36"),p:e.t(c.selectedDate||"选择日期"),q:t._imports_0$5,r:c.selectedDate,s:e.o((...e)=>o.changeDate&&o.changeDate(...e),"86"),t:e.f(o.visibleRows,(t,i,a)=>({a:e.t(t.scenicName),b:e.t(t.serviceName),c:e.t(t.time),d:e.t(o.moneyNumber(null==t.earningAmount?t.orderAmount:t.earningAmount)),e:t.id})),v:!o.visibleRows.length},(o.visibleRows.length,{}),{w:c.isLeaving?1:""})}]]);wx.createPage(a);