123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- <template>
- <view class='uni-page'>
- <u-popup v-model="modelshow" @close="close" :closeable="closeable" border-radius="20" :mode="mode"
- :closeOnClickOverlay="closeOnClickOverlay" :customStyle="{width:width}">
- <view class="dis f-c ">
- <view class="header header-padding dis a-c j-c" v-if="!headerSlot" :class="{borderBottom:border}"
- :style="headerStyle">
- <text>{{headerTitle}}</text>
- </view>
- <view v-else class="header-padding " :class="{borderBottom:border}">
- <slot name="header"></slot>
- </view>
- <view class="content" :style="{overflow:overflow,maxHeight:maxHeight}">
- <slot name="content" v-if="contentType!='status'">
- </slot>
- <view class="quickOptions dis f-c" v-else>
- <view class=" dis a-c j-s f-wrap">
- <view class="tab dis a-c j-c " :class="{tabactive:OptionsTabIndex==index}"
- v-for="(item,index) in statusList" :key="index" @click="OptionsTabSelect(item,index)">
- <text>{{item.label}}</text>
- </view>
- </view>
- <view class="custom-footer dis j-s a-c ">
- <view class="dis a-c j-c" @tap="close">取消</view>
- <view class="dis a-c j-c" @tap="statusConfirm">确定</view>
- </view>
- </view>
- </view>
- </view>
- </u-popup>
- </view>
- </template>
- <script>
- export default {
- props: {
- // 状态数据
- statusList: {
- type: Array,
- default: () => []
- },
- // 当前激活标签
- show: {
- type: Boolean,
- default: false
- },
- //头部插槽
- headerSlot: {
- type: Boolean,
- default: false,
- },
- headerTitle: {
- //头部标题
- type: String,
- default: '请选择',
- },
- bgColor: {
- type: String,
- default: '#FFF'
- },
- overflow: {
- //是否局部滚动
- type: String,
- default: '',
- },
- //最大高度
- maxHeight: {
- type: String,
- default: ''
- },
- border: {
- //是否边框
- type: Boolean,
- default: true,
- },
- headerStyle: Object,
- closeable: {
- //是否显示右上角叉号
- type: Boolean,
- default: true,
- },
- //弹出方向
- mode: {
- type: String,
- default: 'bottom' //top / right / bottom / center
- },
- //弹窗宽度
- width: {
- type: String,
- default: '100%'
- },
- //插槽内容类型
- contentType: {
- type: String,
- default: 'list' //list :列表选择 / custom :自定义 / status :状态筛选 /
- },
- //点击遮罩是否关闭弹窗
- closeOnClickOverlay: {
- type: Boolean,
- default: true,
- }
- },
- data() {
- return {
- modelshow: this.show,
- OptionsTabIndex: null, //切换下标
- OptionsTabInfo: {},
- }
- },
- onShow() {
- },
- onLoad() {
- },
- watch: {
- show(newVal) {
- this.modelshow = newVal
- }
- },
- methods: {
- //状态切换回调
- statusConfirm() {
- this.$emit('statusConfirm', this.OptionsTabInfo)
- },
- //状态切换
- OptionsTabSelect(item, index) {
- this.OptionsTabInfo = item;
- this.OptionsTabIndex = index;
- },
- //关闭事件
- close() {
- this.$emit('close')
- }
- }
- }
- </script>
- <style lang='scss' scoped>
- .header {
- color: #333;
- font-size: 32rpx;
- font-weight: bold;
- }
- .header-padding {
- padding: 27rpx 30rpx;
- }
- .borderBottom {
- border-bottom: 1px solid #EEEEEE;
- }
- .quickOptions {
- padding: 42rpx 42rpx 0;
- box-sizing: border-box;
- margin-bottom: 20rpx;
- .tab {
- width: 180rpx;
- padding: 9rpx 24rpx;
- box-sizing: border-box;
- font-size: 30rpx;
- color: #666;
- border-radius: 4rpx 4rpx 4rpx 4rpx;
- border: 1rpx solid #EEEEEE;
- margin-right: 30rpx;
- margin-bottom: 30rpx;
- }
- .tabactive {
- background: #EAF0FF;
- color: #2D6DFF;
- border: 1rpx solid #EAF0FF;
- }
- }
- .custom-footer {
- padding: 40rpx 0 0;
- box-sizing: border-box;
- view {
- font-size: 30rpx;
- padding: 18rpx;
- box-sizing: border-box;
- flex: 1;
- }
- view:first-child {
- background: rgba(45, 109, 255, 0.1);
- border-radius: 4rpx 4rpx 4rpx 4rpx;
- font-size: 32rpx;
- color: #2D6DFF;
- margin-right: 36rpx;
- }
- view:last-child {
- background: linear-gradient(132deg, #2DD9FF 0%, #2D6DFF 100%);
- border-radius: 4rpx 4rpx 4rpx 4rpx;
- font-size: 32rpx;
- color: #fff;
- }
- }
- </style>
|