123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280 |
- <template>
- <mobile-frame>
- <view class="main">
- <view class="one">
- <input type="text" v-model="searchInfo.name" @input="toInput" placeholder="搜索商品">
- </view>
- <view class="two">
- <scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage">
- <view class="list-scroll-view">
- <view class="two_1">
- <view :class="['list',condActive==index?'activeList':'']" v-for="(item,index) in condList" :key="index" @tap="toCond(index,item)">
- <view class="name">
- {{item.name}}
- </view>
- <view class="icon">
- <view class="icon_1">
- <text :class="['iconfont',item.shangActive]" v-if="condActive==index&&shang==true"></text>
- <text :class="['iconfont',item.shang]" v-else></text>
- </view>
- <view class="icon_1">
- <text :class="['iconfont', item.xiaActive]" v-if="condActive==index&&xia==true"></text>
- <text :class="['iconfont', item.xia]" v-else></text>
- </view>
- </view>
- </view>
- </view>
- <view class="two_2">
- <view class="list" v-for="(item,index) in list" :key="index">
- <image class="image" :src="item.url" mode=""></image>
- <view class="sale" v-if="item.is_sale==true">
- <text>已售尽</text>
- </view>
- <view class="name">
- {{item.name}}
- </view>
- <view class="other">
- <view class="money">
- <text>¥</text>
- <text>{{item.money}}</text>
- </view>
- <view class="btn" v-if="item.is_sale==false">
- <text class="iconfont icon-gouwuche"></text>
- </view>
- </view>
- </view>
- </view>
- </view>
- </scroll-view>
- </view>
- </view>
- </mobile-frame>
- </template>
- <script>
- export default {
- data() {
- return {
- searchInfo: {},
- list: [ //商品列表
- {
- url: require('@/static/test.png'),
- name: '商品名称',
- money: '10.00',
- is_sale: false
- },
- {
- url: require('@/static/test.png'),
- name: '商品名称',
- money: '10.00',
- is_sale: false
- },
- {
- url: require('@/static/test.png'),
- name: '商品名称',
- money: '10.00',
- is_sale: true
- },
- ],
- condActive: 0,
- shang: false,
- xia: false,
- condList: [ // 筛选
- {
- name: '默认',
- },
- {
- name: '销量',
- shang: 'icon-shangjiantou',
- shangActive: 'icon-shangjiantou-copy',
- xia: 'icon-xiajiantou',
- xiaActive: 'icon-xiajiantou-copy'
- },
- {
- name: '价格',
- shang: 'icon-shangjiantou',
- shangActive: 'icon-shangjiantou-copy',
- xia: 'icon-xiajiantou',
- xiaActive: 'icon-xiajiantou-copy'
- },
- {
- name: '浏览量',
- shang: 'icon-shangjiantou',
- shangActive: 'icon-shangjiantou-copy',
- xia: 'icon-xiajiantou',
- xiaActive: 'icon-xiajiantou-copy'
- }
- ]
- };
- },
- onShow: function() {},
- methods: {
- // 分页
- toPage(e) {
- },
- // 输入框
- toInput(e) {
- const that = this;
- that.$set(that.searchInfo, `name`, e.detail.value)
- },
- // 筛选
- toCond(index, e) {
- const that = this;
- that.$set(that, `condActive`, index);
- if (that.xia == false) {
- that.$set(that, `shang`, false);
- that.$set(that, `xia`, true);
- } else if (that.xia == true) {
- that.$set(that, `shang`, true);
- that.$set(that, `xia`, false);
- }
- }
- }
- }
- </script>
- <style lang="scss">
- .main {
- display: flex;
- flex-direction: column;
- width: 100vw;
- height: 100vh;
- .one {
- border-bottom: 1px solid var(--f85Color);
- padding: 2vw;
- input {
- padding: 2vw;
- background-color: var(--f1Color);
- font-size: var(--font14Size);
- border-radius: 5px;
- }
- }
- .two {
- position: relative;
- flex-grow: 1;
- .two_1 {
- background-color: var(--fffColor);
- padding: 2vw;
- display: flex;
- flex-direction: row;
- justify-content: space-around;
- .list {
- display: flex;
- flex-direction: row;
- .icon {
- position: relative;
- top: -5px;
- left: 2px;
- .icon_1 {
- height: 10px;
- .iconfont {
- font-size: 12px;
- }
- }
- }
- }
- .activeList {
- .name {
- color: #ff0000;
- }
- }
- }
- .two_2 {
- display: flex;
- flex-direction: row;
- flex-wrap: wrap;
- padding: 2vw 2vw 0 2vw;
- background-color: var(--f1Color);
- .list {
- position: relative;
- width: 43vw;
- margin: 0 2vw 2vw 0;
- padding: 2vw;
- border-radius: 9px;
- background-color: var(--fffColor);
- .image {
- width: 100%;
- height: 40vw;
- }
- .sale {
- position: absolute;
- top: 18vw;
- text-align: center;
- width: 43vw;
- text {
- background-color: #0000005f;
- border-radius: 90px;
- display: inline-block;
- width: 15vw;
- height: 15vw;
- color: var(--fffColor);
- text-align: center;
- line-height: 15vw;
- }
- }
- .name {
- font-size: var(--font16Size);
- margin: 0 0 1vw 0;
- }
- .other {
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- .money {
- font-size: var(--font14Size);
- text:nth-child(1) {
- font-size: var(--font12Size);
- }
- }
- .btn {
- button {
- font-size: var(--font20Size);
- }
- }
- }
- }
- .list:nth-child(2n) {
- margin: 0 0 2vw 0;
- }
- }
- }
- }
- .scroll-view {
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- .list-scroll-view {
- display: flex;
- flex-direction: column;
- }
- }
- </style>
|