DESKTOP-GMUNQ1B\k 5dc6764eb2 搜索框添加
2024-02-23 14:39:44 +08:00

565 lines
12 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="container" :style="viewColor">
<view class='flash-sale'>
<view class="fixed-head">
<view class="tool-bar">
<view class='iconfont icon-xiangzuo' @tap='goBack'></view>
<view class="v-input" style="width: 90%;margin-right: 40rpx;">
<u--input v-model="keyword" placeholder="搜索商品名称" prefixIcon="search" shape="circle"
:custom-style="{'background-color':'#fff',width:'100%',height:'70rpx'}"
prefixIconStyle="font-size: 22px;color: #909399" @input="search">
<template slot="suffix">
<u-button type="success" text="搜索" size="mini" shape="circle"
color="linear-gradient(to right, #F84221, #FF6C20)"
:customStyle="{height:'50rpx','font-size':'32rpx!important'}"
@click="search"></u-button>
</template>
</u--input>
</view>
</view>
</view>
<view class='header'>
<!-- <image mode="widthFix" class="presellBg" :src="domain+'/static/diy/presell_title'+keyColor+'.png'" alt=""> -->
<image mode="widthFix" class="presellBg"
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/home_img/nongzinongju_bg.webp"
alt="">
</view>
<view class="main_count">
<view class='list' v-if="presellList.length != 0">
<block v-for="(item,index) in presellList" :key='index'>
<view class='item acea-row row-between-wrapper' @tap='goDetails(item)'>
<view class='pictrue'>
<image :src='item.product.image'></image>
</view>
<view class='text acea-row row-column-around'
style="justify-content: space-between;display: flex;flex-direction: column;height: 100%;padding: 20rpx 0;">
<view class='name line1'>{{item.store_name}}</view>
<view class="card_price">
<text class="card_small">¥</text>
<text>{{item.price}}</text>
</view>
<view class="card_bottom">
<view class="card_left" style="white-space: pre-wrap;" v-html="item.store_info">
</view>
<view class="card_right">立即采购</view>
</view>
</view>
</view>
</block>
</view>
<block v-if="presellList.length == 0">
<emptyPage title="暂无记录~" color="#f1f1f1"></emptyPage>
</block>
</view>
</view>
<uni-popup ref="tipspopupRef">
<view class="popup_ref">
<image class="p_icon" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/7b63620240205163923734.png">
</image>
<view class="p_item1">非常抱歉</view>
<view class="p_item2">供销农资春节期间暂停发货年后恢复购买~</view>
</view>
</uni-popup>
<!-- <home></home> -->
<!-- #ifndef H5 -->
<passwordPopup></passwordPopup>
<!-- #endif -->
</view>
</template>
<script>
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import emptyPage from '@/components/emptyPage.vue';
import {
getSeckillIndexTime,
getPresellList
} from '../../../api/activity.js';
import home from '@/components/home/index.vue'
// #ifndef H5
import passwordPopup from '@/components/passwordPopup';
// #endif
import {
configMap
} from "@/utils";
import {
mapGetters
} from "vuex";
import {
HTTP_REQUEST_URL
} from '@/config/app';
import {
Toast
} from '../../../libs/uniApi.js';
export default {
computed: configMap({
statusBarHeight: 0
}, mapGetters(['viewColor', 'keyColor'])),
components: {
// #ifndef H5
passwordPopup,
// #endif
home,
emptyPage
},
data() {
return {
keyword: '', //搜索关键字
domain: HTTP_REQUEST_URL,
topImage: '',
presellList: [],
timeList: [
'未开始',
'正在进行',
'已结束'
],
active: 0,
type: 0,
scrollLeft: 0,
interval: 0,
status: 1,
page: 1,
limit: 8,
loading: false,
loadend: false,
pageloading: false,
}
},
/**
* 用户点击右上角分享
*/
// #ifdef MP
onShareAppMessage: function() {
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
return {
title: '预售活动',
path: 'pages/activity/presell/index',
}
},
onShareTimeline: function() {
return {
title: '预售活动',
query: {
key: ''
},
imageUrl: ''
}
},
// #endif
onLoad() {
this.getPresellProductList();
},
methods: {
goBack: function() {
uni.navigateBack();
},
// 搜索商品
search() {
var that = this;
that.loadend = false;
that.page = 1;
that.presellList = [];
that.getPresellProductList();
},
getPresellProductList: function() {
var that = this;
var data = {
page: that.page,
limit: that.limit,
keyword: that.keyword
};
if (that.loadend) return;
if (that.pageloading) return;
this.pageloading = true
getPresellList(data).then(res => {
var presellList = res.data.list;
var loadend = presellList.length < that.limit;
that.page++;
that.presellList = that.presellList.concat(presellList),
that.page = that.page;
that.pageloading = false;
that.loadend = loadend;
}).catch(err => {
that.pageloading = false
});
},
settimeList: function(item, index) {
var that = this;
that.active = index
that.type = that.active;
that.loadend = false;
that.page = 1;
that.presellList = [];
// wxh.time(e.currentTarget.dataset.stop, that);
that.getPresellProductList();
},
goDetails(item) {
// if(!item.type) return this.$refs.tipspopupRef.open(); // type表示该活动是否能点击
uni.navigateTo({
url: '/pages/activity/presell_details/index?id=' + item.product_presell_id
})
}
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
this.getPresellProductList();
}
}
</script>
<style lang="scss" scoped>
.container {
min-height: 100vh;
// background-color: var(--view-theme);
background-color: #fd552a;
}
.noCommodity {
border-top: none;
}
.flash-sale .header {
width: 100%;
position: relative;
}
.flash-sale .main_count {
position: relative;
// top: -150rpx;
top: -50rpx;
}
.flash-sale .header .presellBg {
width: 750rpx;
}
.flash-sale .presellList {
padding: 0 20rpx;
bottom: 0;
margin: 0 30rpx;
width: 690rpx;
background: #fff;
border-radius: 16rpx;
line-height: 80rpx;
height: 80rpx;
}
.flash-sale .presellList .priceTag {
width: 75rpx;
height: 70rpx;
}
.flash-sale .presellList .priceTag image {
opacity: 1;
}
.flash-sale .presellList .priceTag image {
width: 100%;
height: 100%;
}
.flash-sale .timeList {
display: flex;
justify-content: center;
align-items: center;
margin: 0 auto;
}
.flash-sale .timeList .item {
font-size: 20rpx;
color: #666;
text-align: center;
box-sizing: border-box;
width: 224rpx;
}
.flash-sale .timeList .item .time {
font-size: 26rpx;
color: #AAAAAA;
}
.flash-sale .timeList .item.on .time {
color: var(--view-theme);
font-weight: 700;
span {
position: relative;
&::after {
content: '';
display: inline-block;
width: 100%;
height: 5rpx;
background: var(--view-theme);
position: absolute;
left: 0;
bottom: -8rpx;
border-radius: 2rpx;
}
}
}
.activity {
padding: 0 20rpx;
border: 1px solid var(--view-theme);
color: var(--view-theme);
font-size: 24rpx;
line-height: 40rpx;
position: relative;
}
.activity:before {
content: ' ';
position: absolute;
width: 7rpx;
height: 10rpx;
border-radius: 0 7rpx 7rpx 0;
border: 1px solid var(--view-theme);
background-color: #fff;
bottom: 50%;
left: -3rpx;
margin-bottom: -6rpx;
border-left-color: #fff;
}
.activity:after {
content: ' ';
position: absolute;
width: 7rpx;
height: 10rpx;
border-radius: 7rpx 0 0 7rpx;
border: 1px solid var(--view-theme);
background-color: #fff;
right: -3rpx;
bottom: 50%;
margin-bottom: -6rpx;
border-right-color: #fff;
}
.flash-sale .list {
margin-top: 24rpx;
}
.flash-sale .list .item {
height: 238rpx;
position: relative;
width: 690rpx;
margin: 0 auto 20rpx auto;
background-color: #fff;
border-radius: 20rpx;
padding: 0 25rpx;
}
.flash-sale .list .item .pictrue {
width: 200rpx;
height: 200rpx;
border-radius: 10rpx;
}
.flash-sale .list .item .pictrue image {
width: 100%;
height: 100%;
border-radius: 10rpx;
}
.flash-sale .list .item .text {
width: 420rpx;
font-size: 30rpx;
color: #333;
}
.flash-sale .list .item .text .name {
width: 100%;
color: #282828;
font-weight: bold;
font-size: 28rpx;
}
.flash-sale .list .item .text .booking {
font-size: 30rpx;
color: #E93323;
}
.flash-sale .list .item .text .booking .count {
font-size: 24rpx;
color: #E93323;
}
.flash-sale .list .item .text .limit {
font-size: 22rpx;
color: #999;
margin-bottom: 5rpx;
}
.flash-sale .list .item .text .limit .limitPrice {
margin-left: 10rpx;
}
.flash-sale .list .item .text .progress {
width: 392rpx;
height: 74rpx;
background-size: 100%;
margin-top: 16rpx;
.presell_price {
float: left;
width: 50%;
text-align: center;
line-height: 15px;
padding: 8rpx 0;
.presell_text {
display: block;
color: #FF4F00;
font-size: 20rpx;
}
.price {
font-size: 26rpx;
color: #FF4F00;
text {
font-weight: bold;
}
}
}
.order_btn {
float: left;
width: 50%;
text-align: center;
color: #FFFFFF;
font-size: 26rpx;
line-height: 76rpx;
}
.unStartBtn {
float: left;
width: 50%;
text-align: center;
color: #FFFFFF;
font-size: 20rpx;
padding: 8rpx 0;
text {
font-size: 22rpx;
}
}
}
.tool-bar {
display: flex;
align-items: center;
height: 40px;
.v-input /deep/.u-button__text {
font-size: 28rpx !important;
}
}
.fixed-head {
position: absolute;
left: 0;
top: var(--status-bar-height);
width: 100%;
z-index: 10;
.icon-xiangzuo {
margin-right: 40rpx;
margin-left: 20rpx;
font-size: 40rpx;
color: #fff;
}
}
.card_price {
font-size: 32rpx;
color: #FF8056;
.card_small {
font-size: 26rpx;
}
}
.card_bottom {
display: flex;
justify-content: space-between;
align-items: flex-end;
overflow: hidden;
width: 100%;
// height: 140rpx;
.card_left {
font-size: 24rpx;
color: #616161;
width: 240rpx;
// height: 96rpx;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
/* 指定显示三行 */
overflow: hidden;
text-overflow: ellipsis;
}
.card_right {
flex-shrink: 0;
background-color: #FF593C;
width: 160rpx;
height: 80rpx;
background: #FF593C;
box-shadow: 0rpx 4rpx 8rpx 0rpx #FF5435;
border-radius: 84rpx;
margin-bottom: 8rpx;
display: flex;
justify-content: center;
align-items: center;
color: #fff;
}
}
.popup_ref {
width: 583rpx;
height: 393rpx;
background: #fff;
border-radius: 30rpx 30rpx 30rpx 30rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
color: #FF8056;
.p_icon {
width: 250rpx;
height: 140rpx;
}
.p_item1 {
font-size: 30rpx;
padding: 30rpx 0;
}
.p_item2 {
font-size: 28rpx;
width: 380rpx;
text-align: center;
}
}
</style>