商品列表筛选,贡献值筛选,贡献值图标,区块链证书信息完善,商品溯源信息新增接口,时间轴处理等细节完善

This commit is contained in:
2021-11-03 18:36:04 +08:00
parent 416fc09bab
commit 1df114459c
10 changed files with 192 additions and 65 deletions

View File

@@ -1,21 +1,30 @@
<template>
<view>
<view v-if="loaded">
<view class="top">
<view class="search">
<input class="search-input" type="text" focus @input="onInput" :placeholder="nameVal" />
<view class="search-btn" @click="searchClick">搜索</view>
</view>
<view class="tabs">
<view class="tabs-item" @click="onType">
{{goodsType[goodsTypeIndex].name || ''}}
<image class="tabs-item-arrow" src="@/static/icons/search_row.png" mode="" />
</view>
<view class="tabs-item" @click="onTabs">
{{searchType == 0 ? '价格' : '信用值'}}
<span :class="marketType === ''?'':'activess'">{{searchType == 0 ? '价格' : '信用值'}}</span>
<image class="icon" mode="widthFix"
:src="require(marketType == 'asc' ? '@/static/icons/market_icon_low.png': '@/static/icons/market_icon_high.png')" />
</view>
<view class="tabs-item" v-if="searchType == 0" @click="pageUrl">全部分类 <image class="tabs-item-arrow"
src="@/static/icons/search_row.png" mode=""></image>
<view class="tabs-item" @click="onPv">
<span :class="pvType === ''?'':'activess'">贡献值</span>
<image class="icon" mode="widthFix"
:src="require(pvType == 'asc' ? '@/static/icons/market_icon_low.png': '@/static/icons/market_icon_high.png')" />
</view>
<view class="tabs-item" v-if="searchType == 0" @click="pageUrl">全部分类
<image class="tabs-item-arrow" src="@/static/icons/search_row.png" mode="" />
</view>
<view class="tabs-item" v-if="searchType == 1" @click="companyOpne">{{companyName}}
<image class="tabs-item-arrow" src="@/static/icons/search_row.png" mode=""></image>
<image class="tabs-item-arrow" src="@/static/icons/search_row.png" mode="" />
</view>
</view>
</view>
@@ -45,7 +54,8 @@
import {
searchUrl,
companyCategory,
randgoodsUrl
randgoodsUrl,
shopself
} from '@/apis/interfaces/goods'
export default {
data() {
@@ -54,18 +64,22 @@
searchArr: [],
searchType: '0', // 分类 0位商品 1为企业
marketType: 'asc', // 排序
pvType:'asc',
categoryArr: [], // 分类数组--企业
companyId: '', // 分类数组--企业id
companyName: '选择行业',
companyShow: false,
goodsType: [],
goodsTypeIndex: 0,
// 分页
pageStatus: '',
page: 1
page: 1,
loaded:false
}
},
onLoad() {
this.searchType = this.$Route.query.type
this.getShopSelf()
// 商品分类默认关键字 type=0为商品列表; type=1为企业列表
let wechaUrl = '' // 定义接口来源名称
if (this.searchType == '0') wechaUrl = 'mall/randgoods' //商品关键字
@@ -82,8 +96,27 @@
this.categoryArr = res
})
}
},
methods: {
getShopSelf(){
shopself().then(res => {
this.goodsType = res
this.loaded = true
})
},
// 筛选自营和合作企业等条件
onType(e) {
uni.showActionSheet({
itemList: this.goodsType.map((item) => item.name),
success: e => {
if(this.goodsTypeIndex !== e.tapIndex){
this.goodsTypeIndex = e.tapIndex
this.getList()
}
}
});
},
// 商品详情
onGoods(e) {
this.$Router.push({
@@ -131,7 +164,9 @@
page: this.goodsPage,
order_by: this.marketType,
industry_id: this.companyId,
name: this.nameVal
name: this.nameVal,
is_self:this.goodsType[this.goodsTypeIndex].id,
pv:this.pvType
}).then(res => {
if (res.page.current === 1) {
this.searchArr = []
@@ -156,6 +191,13 @@
// 筛选产品
onTabs(e) {
this.marketType = this.marketType == 'asc' ? 'desc' : 'asc'
this.pvType = ''
this.getList()
},
onPv(){
this.pvType = this.pvType == 'asc' ? 'desc' : 'asc'
this.marketType = ''
this.getList()
},
@@ -242,7 +284,9 @@
.tabs-item {
font-size: $title-size-m;
color: $text-gray;
.activess{
color: $main-color;
}
.icon {
width: 32rpx;
height: 32rpx;