【类 型】:feat

【原  因】:徽标组件  用于标识选项内列表记录总数
【过  程】:
【影  响】:

# 类型 包含:
# feat:新功能(feature)
# fix:修补bug
# docs:文档(documentation)
# style: 格式(不影响代码运行的变动)
# refactor:重构(即不是新增功能,也不是修改bug的代码变动)
# test:增加测试
# chore:构建过程或辅助工具的变动
This commit is contained in:
sszdot 2024-12-20 17:06:09 +08:00
parent 0f1b65a384
commit 65d8ebad40
4 changed files with 62 additions and 10 deletions

View File

@ -55,6 +55,10 @@
float: right; float: right;
} }
.pr{
position: relative;
}
.fc { .fc {
text-align: center; text-align: center;
} }

View File

@ -0,0 +1,38 @@
<template>
<view v-if="cou!==0" class="badge bg-m fci flex mac mc rad-c" :style="{ right: offset[0] + 'rpx', top: offset[1] + 'rpx' }">
{{cou>99?99:cou}}
</view>
</template>
<script>
export default {
name: "badge",
data() {
return {};
},
computed: {
},
props: {
offset: {
type: Array,
default () {
return [-16, -10] // [-16, -10]
}
},
cou: {
type: Number,
require: true
}
}
}
</script>
<style lang="scss" scoped>
.badge {
position: absolute;
width: 24rpx;
height: 24rpx;
font-size: 14rpx;
font-weight: normal;
}
</style>

View File

@ -23,7 +23,9 @@
<view class="numberBut bg-m fci rad8 fz28 fb flex mac mc" :key="foodSn"> <view class="numberBut bg-m fci rad8 fz28 fb flex mac mc" :key="foodSn">
{{ foodSn }} {{ foodSn }}
</view> </view>
<view class="nullBut border fcb rad8 fz28 flex mac mc m-l-24">申请售后</view> <view class="nullBut border fcb rad8 fz28 flex mac mc m-l-24" style="">
申请售后
</view>
</view> </view>
</view> </view>
</template> </template>

View File

@ -7,10 +7,13 @@
</view> </view>
</u-navbar> </u-navbar>
<!-- tab --> <!-- tab -->
<view class="tabListBox m-l-24 m-r-24 m-t-24 flex msb"> <view class="tabListBox m-l-24 m-r-24 m-t-24 flex msb pr">
<view class="tabBox flex mac mc fz32" v-for="(tab,index) in tabList" :key="index" @click="handlerTab(index)" <view class="tabBox flex mac mc fz32" v-for="(tab,index) in tabList" :key="index" @click="handlerTab(index)"
:class="current===index?'fb':''"> :class="current===index?'fb':''">
{{tab}} <view class="pr">
<badge :cou="orderCouArr[index]"></badge>
{{tab}}
</view>
</view> </view>
</view> </view>
<!-- tabLine --> <!-- tabLine -->
@ -59,7 +62,7 @@
tabLineLeft: 24 //tabLine left tabLineLeft: 24 //tabLine left
} }
}, },
onLoad(){ onLoad() {
// tapline // tapline
this.lineOffset(this.current) this.lineOffset(this.current)
}, },
@ -69,12 +72,17 @@
return this.$store.state.orderList.filter(item => item.main_status === '未付款') return this.$store.state.orderList.filter(item => item.main_status === '未付款')
}, },
// 退 // 退
orderList_paid(){ orderList_paid() {
return this.$store.state.orderList.filter(item => item.main_status === '已付款' && item.refund_status === '未申请') return this.$store.state.orderList.filter(item => item.main_status === '已付款' && item.refund_status ===
'未申请')
}, },
//退 // 退 退
orderList_refund(){ orderList_refund() {
return this.$store.state.orderList.filter(item => item.refund_status !== '未申请') return this.$store.state.orderList.filter(item => item.refund_status !== '未申请')
},
// [,退, 退 退]
orderCouArr() {
return [this.orderList_unpaid.length, this.orderList_paid.length, this.orderList_refund.length]
} }
}, },
methods: { methods: {
@ -87,7 +95,7 @@
this.current = e.detail.current this.current = e.detail.current
}, },
// tabLine left // tabLine left
lineOffset(val){ lineOffset(val) {
// tabLine left // tabLine left
const tabWidth = 200 const tabWidth = 200
const spacing = (750 - tabWidth * this.tabList.length - 48) / (this.tabList.length - const spacing = (750 - tabWidth * this.tabList.length - 48) / (this.tabList.length -