| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- <template>
- <view class="search_box_all">
- <view class="zw"></view>
- <view class="search_box">
- <template v-for="(item,index) in list">
- <view class="input_style box_style" v-if="!item.scope">
- <img class="search_icon" src="@/static/images/icon_search@2x.png" alt="">
- <input type="text" v-model="formData[item.prop]" :placeholder="item.placeholder">
- </view>
- <view class="select_style box_style" v-if="item.scope === 'select'">
- <text> {{textOverflow(item)}}</text>
- <img class="zk_icon" src="@/static/images/icon_zk@2x.png" alt="">
- </view>
- </template>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- list: [{
- placeholder: "输入手机号码/会员卡号",
- prop: "searchKey"
- },
- {
- placeholder: "所属店铺",
- prop: "cid",
- scope: "select"
- },
- {
- placeholder: "日期",
- prop: "time",
- scope: "select"
- }
- ],
- formData: {}
- };
- },
- computed: {
- textOverflow: function() {
- return function(item) {
- if (this.formData[item.prop]) {
- return this.formData[item.prop].slice(0, 5) + '...'
- } else {
- return item.placeholder || ''
- }
- }
- }
- },
- }
- </script>
- <style lang="scss" scoped>
- .search_box_all {
- background-color: #fff;
- flex-shrink: 0;
- border-bottom: 1rpx solid #eee;
- &>.zw {
- height: 99rpx;
- }
- &>.search_box {
- position: fixed;
- top: 0rpx;
- left: 0rpx;
- right: 0rpx;
- height: 99rpx;
- padding: 0rpx 20rpx;
- display: flex;
- align-items: center;
- .input_style {
- flex: 1;
- &>input {
- padding: 0rpx 14rpx;
- }
- }
- .box_style {
- flex-shrink: 0;
- margin: 0rpx 12rpx;
- height: 72rpx;
- padding: 0rpx 24rpx;
- border-radius: 100rpx;
- background-color: #f7f7f7;
- display: flex;
- align-items: center;
- font-size: 28rpx;
- color: #828282;
- &>text {
- flex: 1;
- // width: 100rpx;
- // white-space: nowrap;text-overflow:ellipsis;overflow:hidden;
- margin-right: 12rpx;
- }
- &>.search_icon {
- width: 30rpx;
- height: 30rpx;
- flex-shrink: 0;
- }
- &>.zk_icon {
- flex-shrink: 0;
- width: 24rpx;
- height: 24rpx;
- }
- }
- }
- }
- </style>
|