<template>
|
<view class="searchResult wrapperLayer">
|
<view class="backTitlebar-wrapper colCen borderBox">
|
<view class="fixedBox">
|
<view class="topbarbox"></view>
|
<view>
|
<view class="headerNavigationbar rowCenBet borderBox">
|
<view class="leftContent rowCen">
|
<view class="backIcon rowCenSta" @click="backUrl()">
|
<image src="@/static/images/home/return.png" mode=""></image>
|
</view>
|
<view class="search-container rowCenCen borderBox" @click="gosearch()">
|
<input class="searchInput" type="text" v-model="searchText"
|
placeholder-class='searchplaceHolder' />
|
</view>
|
</view>
|
<view class="typeSetting-btn defIcon" @click="changeSet()">
|
<image v-if="rowset" src="../../static/images/goods/row.png" mode=""></image>
|
<image v-else src="../../static/images/goods/col.png" mode=""></image>
|
</view>
|
</view>
|
</view>
|
<view class="onlineStore-container rowCen">
|
<view class="onlineStoreList rowSta" v-if="!showtar || platform!='iOS'">
|
<block v-for="(items,index) in onlineStoreList" :key="index">
|
<view class="store-items colCen" :class="storeCurrent==items.inde?'store-items-active':''"
|
@click="checkstore(items.inde)">
|
<view class="store-name">
|
{{items.name}}
|
</view>
|
<view class="bordercontent"></view>
|
</view>
|
</block>
|
</view>
|
</view>
|
<view class="sortbar-container rowCenBet borderBox">
|
<block v-for="(items,index) in sortList" :key="index">
|
<view class="sortItems-container rowCenCen"
|
:class="sortCurrent==index?'sortItems-container-active':''" @click="selectSort(index)">
|
<view class="sortname">
|
{{items.sortname}}
|
</view>
|
<view class="defIcon directionbox" v-if="index==2">
|
<image v-if="sortCurrent!=2 "
|
src="https://cmsstatic.ffquan.cn//wap_new/search/images/sort.svg" mode=""></image>
|
<block v-else>
|
<image v-if="saleUp"
|
src="https://cmsstatic.ffquan.cn//wap_new/search/images/asce.svg" mode="">
|
</image>
|
<image v-else src="https://cmsstatic.ffquan.cn//wap_new/search/images/desc.svg"
|
mode=""></image>
|
</block>
|
</view>
|
</view>
|
</block>
|
<view class="couponSort colCen" v-if="storeCurrent>0 && storeCurrent < 3">
|
<view class="leftContent rowCen" @click="couponClick()">
|
<view v-if="selectCoupon" class="defIcon icon-box">
|
<image src="../../static/images/home/select.png" mode="aspectFill"></image>
|
</view>
|
<view class="nocoupon" v-else></view>
|
<view class="textContent">
|
优惠券
|
</view>
|
</view>
|
</view>
|
<view class="couponSort colCen" v-if="storeCurrent==1">
|
<view class="leftContent rowCen" @click="selfsupportClick()">
|
<view v-if="selfsupport" class="defIcon icon-box">
|
<image src="../../static/images/home/select.png" mode="aspectFill"></image>
|
</view>
|
<view class="nocoupon" v-else></view>
|
<view class="textContent">
|
自营
|
</view>
|
</view>
|
</view>
|
</view>
|
</view>
|
<view class="placeBox">
|
<view class="topbarbox"></view>
|
<view class="placeemptybox"></view>
|
</view>
|
</view>
|
|
|
<view class="pageContent-container colCen">
|
<view class="advert-container colCenCen borderBox" v-if="advertList.length>0">
|
<swiper class="picbox" :autoplay="true" :interval="3000" :duration="1000">
|
<swiper-item v-for="(items,index) in advertList" :key="index">
|
<view class="picbox defIcon" @tap='goUrl(items)'>
|
<image :src="items.image" mode="aspectFill"></image>
|
</view>
|
</swiper-item>
|
</swiper>
|
</view>
|
|
<view class="goodsList-container" :style="'background-color:'+(rowset?'':'#fff')">
|
|
<!-- 竖排版 -->
|
<view class="goods-content rowStaBet" v-if="rowset">
|
<block v-for="(items,index) in goodsList" :key='index'>
|
<view class="goods-items" @click="goDetail(items)">
|
<colGoods :items="items"></colGoods>
|
</view>
|
</block>
|
</view>
|
|
<!-- 横排版 -->
|
<view class="colSetting-container colCen" v-else>
|
<view class="listbox colCen borderBox">
|
<block v-for="(items,index) in goodsList" :key="index">
|
<view class="goods-items" @click="goDetail(items)">
|
<rowGoods :items="items"></rowGoods>
|
</view>
|
</block>
|
</view>
|
</view>
|
</view>
|
|
<aLoadMore :status="loadstatus" mode="loading3" :showTitle='true' color="#999999"></aLoadMore>
|
</view>
|
<!-- pdd -->
|
<u-popup v-model="pddempowerModel" mode="center" border-radius="12">
|
<pddEmpower @closemodel='closeMdl'></pddEmpower>
|
</u-popup>
|
</view>
|
</template>
|
|
<script>
|
import utils from '../../utils/utils.js'
|
import colGoods from '../../components/colGoods.vue'
|
import rowGoods from '../../components/rowGoods.vue'
|
import pddEmpower from '../../components/pddempower.vue'
|
export default {
|
components: {
|
colGoods,
|
rowGoods,
|
pddEmpower
|
},
|
data() {
|
return {
|
memberId: '',
|
showtar: false,
|
pddempowerModel: false,
|
|
searchText: '',
|
storeCurrent: '',
|
sortCurrent: '',
|
rowset: false,
|
advertPic: '',
|
onlineStoreList: [{
|
name: '淘宝',
|
type: 'tb',
|
inde:0
|
},
|
{
|
name: '京东',
|
type: 'jd',
|
inde:1
|
},
|
{
|
name: '拼多多',
|
type: 'pdd',
|
inde:2
|
},
|
{
|
name: '抖音',
|
type: 'dy',
|
inde:4
|
},
|
{
|
name: '唯品会',
|
type: 'wph',
|
inde:3
|
}
|
|
],
|
|
sortList: [{
|
sortname: '人气',
|
},
|
{
|
sortname: '销量',
|
},
|
{
|
sortname: '价格',
|
}
|
],
|
saleUp: false,
|
sortType: 'renqi',
|
selectCoupon: false,
|
selfsupport: false,
|
goodsList: [],
|
advertList: [],
|
loadstatus: 'loading',
|
canloadmore: false,
|
platform: '',
|
currentPage: 1,
|
user:{}
|
}
|
},
|
onShow() {
|
if (this.storeCurrent == 2 && this.memberId == '') {
|
this.storeCurrent = 0;
|
this.getTbData()
|
}
|
},
|
onLoad(options) {
|
const value = uni.getStorageSync('userInfo');
|
if (value) {
|
this.memberId = value.memberId
|
} else {
|
this.memberId = ''
|
}
|
// #ifdef APP-PLUS
|
this.showtar = getApp().globalData.ifwt == 1 ? false : true;
|
this.platform = plus.os.name
|
// #endif
|
this.searchText = options.searchText
|
if (options.storetype) {
|
if (options.storetype == 2) {
|
this.checkstore(2)
|
} else {
|
this.storeCurrent = options.storetype
|
this.$nextTick(() => {
|
if (this.storeCurrent == 0) {
|
this.getTbData()
|
} else if (this.storeCurrent == 1) {
|
this.getJdData()
|
} else if (this.storeCurrent == 2) {
|
this.getPddData()
|
} else if(this.storeCurrent == 3){
|
this.getWphData()
|
} else {
|
this.getDyData()
|
}
|
})
|
}
|
}
|
this.getbanner()
|
},
|
|
onReachBottom() {
|
if (this.canloadmore) {
|
if (this.storeCurrent == 0) {
|
this.getTbData()
|
} else if (this.storeCurrent == 1) {
|
this.getJdData()
|
} else if (this.storeCurrent == 2) {
|
this.getPddData()
|
} else if(this.storeCurrent == 3){
|
this.getWphData()
|
} else {
|
this.getDyData()
|
|
}
|
}
|
},
|
|
methods: {
|
getTbData() {
|
var that = this;
|
this.$u.api.goodsSearch({
|
type: 'tb',
|
keyword: this.searchText,
|
pageId: this.currentPage,
|
pageSize: 10,
|
sort: this.sortType
|
}).then(e => {
|
if (e.code != 0) return that.$alert(e.msg)
|
uni.stopPullDownRefresh();
|
console.log(e.data)
|
var res = e.data;
|
if (res.list.length < 10) {
|
that.canloadmore = false
|
that.loadstatus = 'nomarl'
|
} else {
|
that.currentPage++
|
that.canloadmore = true
|
that.loadstatus = 'loading'
|
}
|
if (that.currentPage > 1) {
|
that.goodsList = that.goodsList.concat(res.list)
|
} else {
|
that.goodsList = res.list
|
}
|
}).catch(function(err) {})
|
},
|
|
getJdData() {
|
var that = this;
|
this.$u.api.goodsSearch({
|
type: 'jd',
|
keyword: this.searchText,
|
pageId: this.currentPage,
|
pageSize: 10,
|
sort: this.sortType,
|
owner: this.selfsupport ? 'g' : '',
|
selectCoupon: this.selectCoupon == true ? 1 : 0
|
}).then(e => {
|
if (e.code != 0) return that.$alert(e.msg)
|
var res = e.data;
|
uni.stopPullDownRefresh();
|
if (res.list.length < 10) {
|
that.canloadmore = false
|
that.loadstatus = 'nomarl'
|
} else {
|
that.currentPage++
|
that.canloadmore = true
|
that.loadstatus = 'loading'
|
}
|
if (that.currentPage > 1) {
|
that.goodsList = that.goodsList.concat(res.list)
|
} else {
|
that.goodsList = res.list;
|
}
|
}).catch(function(err) {})
|
},
|
getDyData() {
|
var that = this;
|
this.$u.api.goodsSearch({
|
type: 'dy',
|
keyword: this.searchText,
|
pageId: this.currentPage,
|
pageSize: 10,
|
sort: this.sortType,
|
owner: this.selfsupport ? 'g' : '',
|
selectCoupon: this.selectCoupon == true ? 1 : 0
|
}).then(e => {
|
if (e.code != 0) return that.$alert(e.msg)
|
var res = e.data;
|
uni.stopPullDownRefresh();
|
if (res.list.length < 10) {
|
that.canloadmore = false
|
that.loadstatus = 'nomarl'
|
} else {
|
that.currentPage++
|
that.canloadmore = true
|
that.loadstatus = 'loading'
|
}
|
if (that.currentPage > 1) {
|
that.goodsList = that.goodsList.concat(res.list)
|
} else {
|
that.goodsList = res.list;
|
}
|
}).catch(function(err) {})
|
},
|
gosearch() {
|
uni.redirectTo({
|
url: './search?type=' + this.storeCurrent + '&searchText=' + this.searchText
|
})
|
},
|
|
goUrl(info) {
|
utils.goUrl(info, this)
|
},
|
getPddData() {
|
if (this.memberId == '') {
|
uni.navigateTo({
|
url: "../login/wxlogin"
|
})
|
return false;
|
}
|
var that = this;
|
this.$u.api.goodsSearch({
|
type: 'pdd',
|
keyword: this.searchText,
|
pageId: this.currentPage,
|
pageSize: 10,
|
sort: this.sortType,
|
selectCoupon: this.selectCoupon == true ? 1 : 0
|
}).then(e => {
|
if (e.code != 0) return that.$alert(e.msg)
|
var res = e.data;
|
uni.stopPullDownRefresh();
|
if (res.list.length < 10) {
|
that.canloadmore = false
|
that.loadstatus = 'nomarl'
|
} else {
|
that.currentPage++
|
that.canloadmore = true
|
that.loadstatus = 'loading'
|
}
|
if (that.currentPage > 1) {
|
that.goodsList = this.goodsList.concat(res.list)
|
} else {
|
that.goodsList = res.list
|
}
|
}).catch(function(err) {})
|
},
|
|
getWphData() {
|
var that = this;
|
this.$u.api.goodsSearch({
|
type: 'wph',
|
keyword: this.searchText,
|
pageId: this.currentPage,
|
pageSize: 10,
|
sort: this.sortType,
|
owner: this.selfsupport ? 'g' : '',
|
selectCoupon: this.selectCoupon == true ? 1 : 0
|
}).then(e => {
|
if (e.code != 0) return that.$alert(e.msg)
|
var res = e.data;
|
uni.stopPullDownRefresh();
|
if (res.list.length < 10) {
|
that.canloadmore = false
|
that.loadstatus = 'nomarl'
|
} else {
|
that.currentPage++
|
that.canloadmore = true
|
that.loadstatus = 'loading'
|
}
|
if (that.currentPage > 1) {
|
that.goodsList = that.goodsList.concat(res.list)
|
} else {
|
that.goodsList = res.list;
|
}
|
}).catch(function(err) {})
|
},
|
|
goUrl(info) {
|
utils.goUrl(info)
|
},
|
|
couponClick() {
|
this.currentPage = 1
|
this.goodsList = []
|
this.selectCoupon = !this.selectCoupon
|
if (this.storeCurrent == 0) {
|
this.getTbData()
|
} else if (this.storeCurrent == 1) {
|
this.getJdData()
|
} else if (this.storeCurrent == 2) {
|
this.getPddData()
|
} else if(this.storeCurrent == 3){
|
this.getWphData()
|
} else {
|
this.getDyData()
|
}
|
},
|
|
selfsupportClick() {
|
this.currentPage = 1
|
this.goodsList = []
|
this.selfsupport = !this.selfsupport
|
this.getJdData()
|
},
|
|
getbanner() {
|
// banner数据
|
var that = this;
|
this.$u.api.getBanner({
|
type: '0'
|
}).then(e => {
|
console.log(e)
|
if (e.code == 1) return that.$alert(e.msg);
|
var res = e.data.info;
|
that.advertList = res
|
that.advertPic = res[0].image
|
|
}).catch(function(err) {})
|
},
|
|
selectSort(idx) {
|
this.sortCurrent = idx
|
this.currentPage = 1
|
this.goodsList = []
|
if (idx == 0) {
|
this.sortType = 'renqi'
|
} else if (idx == 1) {
|
this.sortType = 'total_sales_des'
|
} else if (idx == 2) {
|
this.saleUp = !this.saleUp
|
if (this.saleUp) {
|
this.sortType = 'price_asc'
|
} else {
|
this.sortType = 'price_des'
|
}
|
}
|
|
|
this.$nextTick(() => {
|
if (this.storeCurrent == 0) {
|
this.getTbData()
|
} else if (this.storeCurrent == 1) {
|
this.getJdData()
|
} else if (this.storeCurrent == 2) {
|
this.getPddData()
|
}else if(this.storeCurrent == 3){
|
this.getWphData()
|
} else {
|
this.getDyData()
|
}
|
})
|
},
|
|
checkstore(idx) {
|
if (idx == 2) {
|
const value = uni.getStorageSync('userInfo');
|
console.log(value)
|
if (value) {
|
this.updataUser(idx)
|
} else {
|
uni.navigateTo({
|
url: '../login/wxlogin'
|
})
|
}
|
} else {
|
this.storeCurrent = idx
|
this.loadstatus = 'loading'
|
this.canloadmore = false
|
this.sortType = 'renqi'
|
this.currentPage = 1
|
this.sortCurrent = 0
|
this.selectCoupon = false
|
this.selfsupport = false
|
this.goodsList = []
|
this.$nextTick(() => {
|
if (this.storeCurrent == 0) {
|
this.getTbData()
|
} else if (this.storeCurrent == 1) {
|
this.getJdData()
|
} else if (this.storeCurrent == 2) {
|
this.getPddData()
|
}else if(this.storeCurrent == 3){
|
this.getWphData()
|
}else{
|
this.getDyData()
|
}
|
})
|
}
|
},
|
closeMdl() {
|
this.pddempowerModel = false
|
},
|
updataUser(idx) {
|
this.user = utils.getCacheSync('userInfo')
|
var that = this;
|
|
this.$u.api.getUserInfo({}).then(e => {
|
utils.setCache('userInfo', e.data.userinfo)
|
that.user = e.data.userinfo;
|
if(e.data.userinfo.pdd_authority == 1){
|
that.storeCurrent = idx
|
that.loadstatus = 'loading'
|
that.canloadmore = false
|
that.sortType = 'renqi'
|
that.currentPage = 1
|
that.sortCurrent = 0
|
that.selectCoupon = false
|
that.selfsupport = false
|
that.goodsList = []
|
that.$nextTick(() => {
|
that.getPddData()
|
})
|
}else{
|
that.$u.api.checkPddAuth({}).then(e => {
|
var res = e.data;
|
if (res.bind == 1) {
|
that.storeCurrent = idx
|
that.sortType = 'renqi'
|
that.currentPage = 1
|
that.sortCurrent = 0
|
that.selectCoupon = false
|
that.selfsupport = false
|
that.goodsList = []
|
that.$nextTick(() => {
|
that.getPddData()
|
})
|
} else {
|
that.pddempowerModel = true
|
that.storeCurrent = 0
|
that.loadstatus = 'loading'
|
that.canloadmore = false
|
that.sortType = 'renqi'
|
that.currentPage = 1
|
that.sortCurrent = 0
|
that.selectCoupon = false
|
that.selfsupport = false
|
that.goodsList = []
|
that.getTbData()
|
}
|
|
}).catch(function (err) {
|
})
|
}
|
}).catch(function(err) {})
|
},
|
|
changeSet() {
|
// 切换排版
|
this.rowset = !this.rowset
|
this.currentPage = 1
|
},
|
|
backUrl() {
|
uni.navigateBack({
|
delta: 1
|
})
|
},
|
goDetail(info) {
|
uni.navigateTo({
|
url: '../goods/goodsDetail?info=' + encodeURIComponent(JSON.stringify(info))
|
})
|
}
|
},
|
onPullDownRefresh() {
|
this.currentPage = 1
|
this.goodsList = []
|
if (this.storeCurrent == 0) {
|
this.getTbData()
|
} else if (this.storeCurrent == 1) {
|
this.getJdData()
|
} else if (this.storeCurrent == 2) {
|
this.getPddData()
|
} else {
|
this.getWphData()
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss">
|
@-webkit-keyframes fadeInOut {
|
0% {
|
opacity: 0;
|
}
|
|
25% {
|
opacity: 0.5;
|
}
|
|
50% {
|
opacity: 1;
|
}
|
|
75% {
|
opacity: 1;
|
}
|
}
|
|
.juan {
|
height: 28rpx;
|
background: linear-gradient(90deg, #ff8873 0, #ff4f4f 100%);
|
border-radius: 4rpx;
|
padding: 0 10rpx 0 2rpx;
|
font-size: 19rpx;
|
font-weight: 400;
|
color: #fff;
|
line-height: 28rpx;
|
}
|
|
.juan text {
|
background: #fff;
|
border-radius: 2rpx 0 0 2rpx;
|
font-size: 20rpx;
|
color: #FE3A33;
|
margin: auto 10rpx auto 0;
|
min-width: 24rpx;
|
max-width: 24rpx;
|
min-height: 24rpx;
|
max-height: 24rpx;
|
display: inline-block;
|
line-height: 24rpx;
|
text-align: center;
|
vertical-align: middle;
|
margin-top: -4rpx;
|
}
|
|
.searchResult {
|
.backTitlebar-wrapper {
|
.placeBox {
|
.placeemptybox {
|
height: 230rpx;
|
}
|
}
|
.searchInput{
|
font-size: 28rpx;
|
width:100%;
|
}
|
.fixedBox {
|
width: 100%;
|
position: fixed;
|
top: 0;
|
left: 0;
|
z-index: 100;
|
background-color: #FFFFFF;
|
|
.headerNavigationbar {
|
width: 100%;
|
height: 90rpx;
|
padding: 0 32rpx;
|
|
.leftContent {
|
.backIcon {
|
width: 40rpx;
|
height: 32rpx;
|
z-index: 1;
|
|
image {
|
width: 17rpx;
|
height: 32rpx;
|
}
|
}
|
|
.search-container {
|
width: 554rpx;
|
height: 60rpx;
|
border-radius: 30rpx;
|
background: #F7F7F7;
|
justify-content: left;
|
padding-left: 30rpx;
|
view {
|
width: 554rpx;
|
font-size: 28rpx;
|
padding: 0 32rpx;
|
font-weight: 400;
|
text-overflow: ellipsis;
|
white-space: nowrap;
|
overflow: hidden;
|
}
|
}
|
}
|
|
.typeSetting-btn {
|
width: 65rpx;
|
height: 35rpx;
|
|
image {
|
width: 35rpx;
|
height: 35rpx;
|
}
|
}
|
}
|
|
.onlineStore-container {
|
width: 100%;
|
height: 80rpx;
|
background-color: #FFFFFF;
|
padding: 0 32rpx;
|
|
.onlineStoreList {
|
width: 100%;
|
height: 100%;
|
|
.store-items {
|
margin-right: 60rpx;
|
|
.store-name {
|
font-size: 28rpx;
|
font-weight: 500;
|
color: #999999;
|
margin-top: 20rpx;
|
}
|
|
.bordercontent {
|
width: 30rpx;
|
height: 4rpx;
|
margin-top: 10rpx;
|
border-radius: 2rpx;
|
background-color: transparent;
|
}
|
}
|
|
.store-items-active {
|
.store-name {
|
font-size: 32rpx;
|
font-weight: 500;
|
color: #FF4242;
|
}
|
|
.bordercontent {
|
width: 30rpx;
|
height: 4rpx;
|
background-color: #FF4242;
|
}
|
}
|
}
|
}
|
|
.sortbar-container {
|
z-index: 10;
|
position: fixed;
|
left: 0;
|
width: 100%;
|
height: 80rpx;
|
background-color: #FFFFFF;
|
padding: 0 50rpx;
|
|
.sortItems-container {
|
width: 90rpx;
|
|
.sortname {
|
font-size: 28rpx;
|
font-weight: 400;
|
color: #333333;
|
}
|
|
.directionbox {
|
width: 25rpx;
|
height: 35rpx;
|
margin-left: 5rpx;
|
}
|
}
|
|
.sortItems-container-active {
|
.sortname {
|
color: #FF4242;
|
}
|
}
|
|
.couponSort {
|
.leftContent {
|
.nocoupon {
|
width: 30rpx;
|
height: 30rpx;
|
background: #FFFFFF;
|
border: 1rpx solid #BFBFBF;
|
border-radius: 50%;
|
margin-right: 10rpx;
|
}
|
|
.icon-box {
|
width: 30rpx;
|
height: 30rpx;
|
margin-right: 10rpx;
|
}
|
|
.textContent {
|
font-size: 28rpx;
|
font-weight: 400;
|
color: #333333;
|
}
|
}
|
}
|
}
|
}
|
}
|
|
.pageContent-container {
|
width: 100%;
|
|
.advert-container {
|
width: 100%;
|
height: 200rpx;
|
background-color: #FFFFFF;
|
box-shadow: 0px -1rpx 0px 0px #EFF1F7;
|
padding: 0 32rpx;
|
|
.picbox {
|
width: 100%;
|
height: 160rpx;
|
border-radius: 12rpx;
|
overflow: hidden;
|
}
|
}
|
|
.goodsList-container {
|
width: 100%;
|
margin-top: 20rpx;
|
// background-color: #FFFFFF;
|
|
.goods-content {
|
width: 100%;
|
padding: 0 20rpx;
|
flex-wrap: wrap;
|
|
.goods-items {
|
width: 346rpx;
|
height: 546rpx;
|
margin-bottom: 20rpx;
|
}
|
}
|
|
.colSetting-container {
|
width: 100%;
|
|
.listbox {
|
width: 100%;
|
|
.goods-items {
|
width: 100%;
|
}
|
}
|
}
|
}
|
}
|
}
|
</style>
|