123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- <template>
- <view class="modal-box">
- <u-popup v-model="isShow" @close="isShow=false" mode="right" length="85%" >
- <view class="modal-con u-flex u-flex-wrap u-row-between" :style="{height:toggle? 'auto':'180rpx'}">
- <view class="list" :class="selectNum==i?'selectBox':''" v-for="(item,i) in list" :key="item.id" @click="handleChoole(i)">{{item.dispName}}</view>
- </view>
- <view class="showMore" :style="{color:$config('primaryColor')}" @click="toggle=!toggle">
- <text>{{toggle?'收起':'更多选项'}}</text>
- <u-icon :name="toggle?'arrow-up':'arrow-down'" :color="$config('primaryColor')" size="28"></u-icon>
- </view>
- <view class="form-footer-btn">
- <u-button class="handle-btn" shape="circle" size="medium" hover-class="none" @click="handleClear">重置</u-button>
- <u-button class="handle-btn" shape="circle" size="medium" hover-class="none" :custom-style="customBtnStyle" @click="handleSearch">查询</u-button>
- </view>
- </u-popup>
- </view>
- </template>
- <script>
- import { getLookUpDatas } from '@/api/data';
- export default{
- props:{
- showModal:{
- type: Boolean,
- default: false
- }
- },
- data(){
- return{
- customBtnStyle: { // 自定义按钮样式
- borderColor: this.$config('primaryColor'),
- backgroundColor: this.$config('primaryColor'),
- color: '#fff'
- },
- isShow:this.showModal,
- toggle:false,
- selectNum:-1,
- list:[]
- }
- },
- methods:{
- getList() {
- getLookUpDatas({
- lookupCode: 'SETTLE_STYLE',
- pageNo: 1,
- pageSize: 1000
- }).then(result => {
- if (result && result.status == 200) {
- this.list = result.data.list;
- }
- });
- },
- handleChoole(e){
- if(this.selectNum == e){
- this.selectNum = -1;
- }else{
- this.selectNum = e
- }
- },
- handleSearch(){
- if(this.selectNum != -1){
- this.$emit('refresh',this.list[this.selectNum]);
- }
- this.isShow = false
- },
- handleClear(){
- this.selectNum=-1;
- this.isShow = false
- this.$emit('refresh','reSet');
- }
- },
- watch:{
- // 父页面传过来的弹框状态
- showModal (newValue, oldValue) {
- this.isShow = newValue
- },
- // 重定义的弹框状态
- isShow (newValue, oldValue) {
- if (!newValue) {
- this.$emit('close')
- }else{
- this.getList();
- }
- }
- }
- }
- </script>
- <style lang="scss">
- .modal-box{
- width: 100%;
- .modal-con{
- padding:20upx;
- overflow: hidden;
- .list{
- width: 46%;
- text-align: center;
- line-height: 70rpx;
- height: 70rpx;
- border-radius: 38rpx;
- margin-bottom: 20rpx;
- background:#f0f0f0;
- font-size: 26rpx;
- }
- .selectBox{
- background:#007aff;
- color:#fff;
- }
- }
- .showMore{
- text-align: center;
- margin-top: 30rpx;
- text{
- margin-right: 10rpx;
- }
- }
-
- .form-footer-btn {
- display: flex;
- padding: 20upx;
- margin-top: 180upx;
- .handle-btn {
- font-size: 28upx;
- margin: 0 30upx;
- width: 100%;
- flex: 1;
- }
- }
- }
- </style>
|