logistics_sy/public/mobile/assets/packages-pages-user_wallet-...

2 lines
6.4 KiB
JavaScript

import{G as t,P as e,r as a,a as l,o as i,c as s,w as r,h as u,b as n,s as o,e as d,f as c,x as h,l as f,t as p,F as m,k as b,U as y,d as g,z as x,V as _,aa as v,aY as S,i as w}from"./index.26a6cf84.js";import{_ as I}from"./u-badge.f4477090.js";import{_ as k}from"./plugin-vue_export-helper.21dcd24c.js";import{_ as B}from"./z-paging.dba6931f.js";import{r as $}from"./recharge.ff7c9ddf.js";var C=k({name:"u-tabs",emits:["update:modelValue","input","change"],props:{value:{type:[Number,String],default:0},modelValue:{type:[Number,String],default:0},current:{type:[Number,String],default:0},isScroll:{type:Boolean,default:!0},list:{type:Array,default:()=>[]},height:{type:[String,Number],default:80},fontSize:{type:[String,Number],default:30},duration:{type:[String,Number],default:.5},activeColor:{type:String,default:"#2979ff"},inactiveColor:{type:String,default:"#303133"},barWidth:{type:[String,Number],default:40},barHeight:{type:[String,Number],default:6},gutter:{type:[String,Number],default:30},bgColor:{type:String,default:"#ffffff"},name:{type:String,default:"name"},count:{type:String,default:"count"},offset:{type:Array,default:()=>[5,20]},bold:{type:Boolean,default:!0},activeItemStyle:{type:Object,default:()=>({})},showBar:{type:Boolean,default:!0},barStyle:{type:Object,default:()=>({})},itemWidth:{type:[Number,String],default:"auto"}},data(){return{scrollLeft:0,tabQueryInfo:[],componentWidth:0,scrollBarLeft:0,parentLeft:0,id:this.$u.guid(),currentIndex:this.current,barFirstTimeMove:!0}},watch:{list:{immediate:!0,handler(t,e){e&&t.length!==e.length&&(this.currentIndex=0),setTimeout((()=>{this.init()}),200)}},current:{immediate:!0,handler(t,e){this.$nextTick((()=>{this.currentIndex=t,this.scrollByIndex()}))}},valueCom:{immediate:!0,handler(t,e){this.$nextTick((()=>{this.currentIndex=t,this.scrollByIndex()}))}}},computed:{valueCom(){return this.modelValue},tabBarStyle(){let t={width:this.barWidth+"rpx",transform:`translate(${this.scrollBarLeft}px, -100%)`,"transition-duration":`${this.barFirstTimeMove?0:this.duration}s`,"background-color":this.activeColor,height:this.barHeight+"rpx","border-radius":this.barHeight/2+"px"};return Object.assign(t,this.barStyle),t},tabItemStyle(){return t=>{let e={height:this.height+"rpx","line-height":this.height+"rpx","font-size":this.fontSize+"rpx","transition-duration":`${this.duration}s`,padding:this.isScroll?`0 ${this.gutter}rpx`:"",flex:this.isScroll?"auto":"1",width:this.$u.addUnit(this.itemWidth)};return t==this.currentIndex&&this.bold&&(e.fontWeight="bold"),t==this.currentIndex?(e.color=this.activeColor,e=Object.assign(e,this.activeItemStyle)):e.color=this.inactiveColor,e}}},methods:{async init(){let t=await this.$uGetRect("#"+this.id);this.parentLeft=t.left,this.componentWidth=t.width,this.getTabRect()},clickTab(t){t!=this.currentIndex&&(this.$emit("change",t),this.$emit("input",t),this.$emit("update:modelValue",t))},getTabRect(){let e=t().in(this);for(let t=0;t<this.list.length;t++)e.select(`#u-tab-item-${t}`).fields({id:!0,size:!0,rect:!0});e.exec(function(t){this.tabQueryInfo=t,this.scrollByIndex()}.bind(this))},scrollByIndex(){let t=this.tabQueryInfo[this.currentIndex];if(!t)return;let a=t.width,l=t.left-this.parentLeft-(this.componentWidth-a)/2;this.scrollLeft=l<0?0:l;let i=t.left+t.width/2-this.parentLeft;this.scrollBarLeft=i-e(this.barWidth)/2,1==this.barFirstTimeMove&&setTimeout((()=>{this.barFirstTimeMove=!1}),100)}},mounted(){this.init()}},[["render",function(t,e,g,x,_,v){const S=a(l("u-badge"),I),w=b,k=y;return i(),s(w,{class:"u-tabs",style:h({background:g.bgColor})},{default:r((()=>[u(" $u.getRect()对组件根节点无效,因为写了.in(this),故这里获取内层接点尺寸 "),n(w,{id:_.id},{default:r((()=>[n(k,{"scroll-x":"",class:"u-scroll-view","scroll-left":_.scrollLeft,"scroll-with-animation":""},{default:r((()=>[n(w,{class:o(["u-scroll-box",{"u-tabs-scorll-flex":!g.isScroll}])},{default:r((()=>[(i(!0),d(m,null,c(g.list,((t,e)=>(i(),s(w,{class:"u-tab-item u-line-1",id:"u-tab-item-"+e,key:e,onClick:t=>v.clickTab(e),style:h([v.tabItemStyle(e)])},{default:r((()=>[n(S,{count:t[g.count]||t.count||0,offset:g.offset,size:"mini"},null,8,["count","offset"]),f(" "+p(t[g.name]||t.name),1)])),_:2},1032,["id","onClick","style"])))),128)),g.showBar?(i(),s(w,{key:0,class:"u-tab-bar",style:h([v.tabBarStyle])},null,8,["style"])):u("v-if",!0)])),_:1},8,["class"])])),_:1},8,["scroll-left"])])),_:1},8,["id"])])),_:1},8,["style"])}],["__scopeId","data-v-41960a88"]]);const T=g({__name:"user_wallet",setup(t){const e=x([{name:"全部",type:""},{name:"收入",type:1},{name:"支出",type:2}]),h=_(),y=x([]),g=x(0),I=t=>{g.value=t,h.value.reload()},k=async(t,a)=>{try{const l=e.value[g.value].type,i=await S({action:l,type:"um",page_no:t,page_size:a});h.value.complete(i.lists)}catch(l){h.value.complete(!1)}},T=x({});return v((()=>{(async()=>{T.value=await $()})()})),(t,x)=>{const _=b,v=w,S=a(l("u-tabs"),C),$=a(l("z-paging"),B);return i(),s($,{ref_key:"paging",ref:h,modelValue:y.value,"onUpdate:modelValue":x[1]||(x[1]=t=>y.value=t),onQuery:k,"show-loading-more-when-reload":!0},{default:r((()=>[n(_,{class:"user-wallet"},{default:r((()=>[n(_,{class:"p-[20rpx]"},{default:r((()=>[n(_,{class:"bg-primary rounded-[14rpx] flex items-center justify-between pl-[44rpx] py-[54rpx] text-white"},{default:r((()=>[n(_,null,{default:r((()=>[n(_,{class:"text-sm"},{default:r((()=>[f("钱包余额")])),_:1}),n(_,{class:"text-[60rpx]"},{default:r((()=>[f(p(T.value.user_money),1)])),_:1})])),_:1}),T.value.status?(i(),s(v,{key:0,url:"/packages/pages/recharge/recharge","hover-class":"none"},{default:r((()=>[n(_,{class:"text-primary px-[30rpx] py-[15rpx] bg-white rounded-l-full"},{default:r((()=>[f(" 去充值 ")])),_:1})])),_:1})):u("v-if",!0)])),_:1})])),_:1}),n(S,{list:e.value,"is-scroll":!1,modelValue:g.value,"onUpdate:modelValue":x[0]||(x[0]=t=>g.value=t),onChange:I},null,8,["list","modelValue"]),n(_,{class:"pt-2.5"},{default:r((()=>[(i(!0),d(m,null,c(y.value,(t=>(i(),s(_,{key:t.id,class:"bg-white border-solid border-b border-0 border-light px-[26rpx] py-[24rpx]"},{default:r((()=>[n(_,{class:"flex justify-between"},{default:r((()=>[n(_,{class:"mr-2"},{default:r((()=>[f(p(t.type_desc),1)])),_:2},1024),n(_,{class:o(["text-lg",{"text-primary":1==t.action}])},{default:r((()=>[f(p(t.change_amount_desc),1)])),_:2},1032,["class"])])),_:2},1024),n(_,{class:"text-sm text-muted mr-1"},{default:r((()=>[f(p(t.create_time),1)])),_:2},1024)])),_:2},1024)))),128))])),_:1})])),_:1})])),_:1},8,["modelValue"])}}});export{T as default};