新增搜索出的产品列表

This commit is contained in:
clay
2022-12-25 16:49:38 +08:00
parent fd6f5b5390
commit d3c83c4c7d
8 changed files with 87 additions and 19 deletions

View File

@@ -35,10 +35,6 @@
</template>
<script>
// import {
// simpleDateFormat,
// simpleDateFormatByMoreLine
// } from '@/utills/util.js'
export default {
data() {
return {
@@ -76,11 +72,7 @@
// time: '2022-12-04'
// }
],
query: {
sortType: 1,
pageSize: 4,
pageNum: 1
}
}
},
created() {
@@ -91,7 +83,7 @@
//获取产品列表
getProducts() {
// console.log("子组件的获取产品列表方法====");
this.$apiServe.getProducts(this.query).then(res => {
this.$apiServe.getProducts().then(res => {
// console.log(res.data.data)
this.productList = res.data.data

View File

@@ -105,14 +105,14 @@
//修改我的需求
editNeeds() {
console.log('修改需求');
uni.redirectTo({
uni.reLaunch({
url: '/pages/ideasAndNeeds/ideasAndNeeds?index=' + 0
})
},
//修改我的创意
editIdeas() {
console.log('修改创意');
uni.redirectTo({
uni.reLaunch({
// id=' + ideaId + '&
url: '/pages/ideasAndNeeds/ideasAndNeeds?index=' + 1
})

View File

@@ -63,7 +63,7 @@
methods: {
//获取认证厂家详情
getCertifiedCjDetail() {
this.$apiServe.getCertifiedCjDetail().then(res => {
this.$apiServe.getCertifiedCjDetail(this.id).then(res => {
console.log('认证厂家详情页', res)
// this.detailList = res.data.data

View File

@@ -0,0 +1,59 @@
<template>
<view>
<view class="products_box">
<u-grid :border="false" col="2">
<u-grid-item v-for="(item,index) in productList" :key="index" @click="toDetailPage(item)">
<u-image src="/static/products/sy_bb.png" width="354rpx" height="539rpx" :lazy-load="true">
</u-image>
<view class="bgContent">
<view>
<u-image :src="item.cover" width="346rpx" height="320rpx" :lazy-load="true">
</u-image>
<view class="img_tag">{{item.cate_name}}</view>
</view>
<view style="padding: 14rpx 22rpx;">
<view class="title_box">
<text class="title">{{item.name}}</text>
<u-tag :text="item.tag" type="warning" shape="circle"></u-tag>
</view>
<view class="product_desc">
{{item.title}}
</view>
<view class="releaseDate">
<u-image src="/static/products/xp_icon_sjf.png" width="22rpx" height="22rpx"
:lazy-load="true">
</u-image>
<text class="release">发布日期</text>
<text>{{item.pub_time}}</text>
</view>
</view>
</view>
</u-grid-item>
</u-grid>
</view>
</view>
</template>
<script>
export default {
data() {
return {
productList: [{
cover: '/static/products/zhanwei_dg.png',
name: '锅巴',
tag: '无添加剂',
cate_name: '零食铺子',
title: '糯米蟹黄锅巴散装,非油炸绿色健康食品',
pub_time: '2022-12-04'
}, ]
}
},
methods: {
}
}
</script>
<style>
</style>

View File

@@ -32,7 +32,8 @@
</view>
<view class="found-record">
<view v-for="(item, index) in foundList" :key="index" class="tag-item">
<u-tag bg-color="#eee" borderColor="#eee" color="#666" :text="item.name" @click="recentSearch(item.name)" />
<u-tag bg-color="#eee" borderColor="#eee" color="#666" :text="item.name"
@click="recentSearch(item.name)" />
</view>
</view>
</view>
@@ -81,6 +82,9 @@
} catch (e) {
// error
}
uni.navigateTo({
url: '../search-products/search-products'
})
},
goBack() {
uni.navigateBack()

View File

@@ -122,6 +122,15 @@
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}, {
"path": "search-products/search-products",
"style": {
"navigationBarTitleText": "产品列表",
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#12CA64",
"enablePullDownRefresh": false
}
}
]
},

View File

@@ -139,7 +139,11 @@
},
onLoad(options) {
console.log(options)
this.tabCurrent = options.index
if (options.index == 0) {
this.tabCurrent = 0
} else if (options.index == 1) {
this.tabCurrent = 1
}
},
methods: {
tabChange(data) {

View File

@@ -196,10 +196,10 @@ const apiService = {
})
},
// 获取产品列表
getProducts(data) {
const url = `/home/product`
getProducts() {
const url = `/home/product?sortType=1&pageSize=4&pageNum=1`
return new Promise((resolve, reject) => {
resolve(service.get(url, data))
resolve(service.get(url))
})
},
// 获取产品详情
@@ -232,7 +232,7 @@ const apiService = {
},
// 获取认证厂家详情
getCertifiedCjDetail(id) {
const url = `/news/fdetail?fId=1`
const url = `/news/fdetail?fId=${id}`
return new Promise((resolve, reject) => {
resolve(service.get(url, id))
})