解决冲突

This commit is contained in:
2021-11-03 18:43:00 +08:00
52 changed files with 49016 additions and 541 deletions

View File

@@ -1,120 +1,25 @@
<template>
<view>
<!-- 状态栏 -->
<nv :config="nvConfig" @nvTabTap="onNvTab" @nvBtnTap="onRightBtn" />
<block v-if="tabIndex === 1">
<!-- 推荐商家 -->
<view class="block-title">
<view class="title">
推荐商家
</view>
<view class="header-back">
<!-- 轮播图 -->
<view class="banner">
<swiper class="banner-swiper" indicator-color="#8b64fd" indicator-active-color="#f8f8f8"
indicator-dots autoplay>
<swiper-item v-for="(item, index) in banners" :key="index">
<image class="cover" :src="item.cover" mode="aspectFill" @click="swiperClick(item.url)" />
</swiper-item>
</swiper>
</view>
<scroll-view scroll-x class="recommended">
<block v-for="(item, index) in recommendBus" :key="index">
<view class="item-box">
<image class="item-cover" :src="item.cover" mode="aspectFill" />
<view class="item-vip">
<view class="item-vip-text">{{item.level.name}}</view>
<view class="item-vip-tips">企业</view>
</view>
<view class="item-title nowrap">{{item.name || '-'}}</view>
<view class="item-trade nowrap">行业{{item.industry.title}}</view>
<view class="item-bar">
<view class="item-bar-color">
<view class="item-bar-strip" :style="{width: item.process + '%'}">
<text class="item-bar-per">{{item.process}}%</text>
</view>
</view>
<image class="item-bar-strip-img" src="../../static/icons/equity_arrow_up.png"
mode="aspectFill"></image>
</view>
<view class="item-url">
<view class="item-credit">
<image class="item-credit-img" src="../../static/icons/equity_arrow_icon.png"
mode="aspectFill"></image>信用值 {{item.integrity}}
</view>
<view class="item-btn" @click="onOpenWechat(item)">进店<image
src="../../static/icons/equity_arrow_right.png" mode="aspectFill"></image>
</view>
</view>
</view>
</block>
</scroll-view>
<!-- 热易商家 -->
<view class="block-title">
<view class="title">
热易商家
<!-- 分类 -->
<view class="classify">
<view class="classify-item" v-for="(item, index) in classify" :key="index"
@click="onClassify(item.category_id)">
<image class="cover" :src="item.cover" mode="aspectFill"></image>
<view class="title">{{item.name}}</view>
</view>
</view>
<swiper class="hot-swiper">
<swiper-item v-for="(item, index) in hotBus" :key="index">
<view class="hot-box" @click="onOpenWechat(item)">
<image class="cover" :src="item.cover" mode="aspectFill" />
<view class="hot-vip">{{item.level.name}}</view>
<view class="hot-content">
<view class="hot-title nowrap">{{item.name || '-'}}</view>
<view class="hot-credit">信誉值 {{item.integrity}}</view>
<view class="hot-trade nowrap">所属行业{{item.industry.title}}</view>
<view class="hot-warrant">
<view class="hot-warrant-text nowrap">
权证数量{{item.goodsCount}}
</view>
<view class="hot-bar">
<view class="hot-bar-color">
<view class="hot-bar-strip" :style="{width: item.process + '%'}"></view>
</view>
<view class="hot-bar-per">{{item.process}}</view>
</view>
</view>
<!-- <view class="credibility">
<uni-rate
:readonly="true"
color="#ddd"
active-color="#e93340"
:value="item.star"
:size="14"
/>
</view>
<view class="trading nowrap">累计交易次</view> -->
</view>
<view class="hot-tool">
<view class="hot-deal">
交易量<text class="hot-deal-number">{{item.saleCount || 0}}</text>
</view>
</view>
</view>
</swiper-item>
</swiper>
<v-tabs v-model="industryIndex" :tabs="industryBus" color="#555555" activeColor="#e93340" fontSize="30rpx"
height="80rpx" lineHeight="6rpx" lineColor="#e93340" bgColor="#f5f5f5" @change="onBusIndustry"></v-tabs>
<!-- 商家 -->
<industry-list :list="busList" @on-industry="onOpenWechat" />
<!-- 分页 -->
<uni-load-more v-if="busList.length > 0" :status="pageStatus" :iconSize="16"></uni-load-more>
</block>
<!-- 易货商城 -->
<block v-if="tabIndex === 0">
<view class="header-back">
<!-- 轮播图 -->
<view class="banner">
<swiper class="banner-swiper" indicator-color="#e93340" indicator-active-color="#f8f8f8"
indicator-dots autoplay>
<swiper-item v-for="(item, index) in banners" :key="index">
<image class="cover" :src="item.cover" mode="aspectFill" @click="swiperClick(item.url)" />
</swiper-item>
</swiper>
</view>
<!-- 分类 -->
<view class="classify">
<view class="classify-item" v-for="(item, index) in classify" :key="index"
@click="onClassify(item.category_id)">
<image class="cover" :src="item.cover" mode="aspectFill"></image>
<view class="title">{{item.name}}</view>
</view>
<view class="classify-item" @click="onClassify('')">
<image class="cover" src="../../static/icons/equity_nav.png" mode="aspectFill"></image>
<view class="title">查看全部</view>
</view>
<view class="classify-item" @click="onClassify('')">
<image class="cover" src="../../static/icons/equity_nav.png" mode="aspectFill"></image>
<view class="title">查看全部</view>
</view>
</view>
<!-- 每日推荐 -->
@@ -147,69 +52,68 @@
<view class="price"><text>¥</text>{{item.original_price}}</view>
</view>
</view>
<view class="price"><text>¥</text>{{position.one.original_price}}</view>
<span class='is_self' v-if='position.one.specal_tags.is_self'>{{position.one.specal_tags.is_self}}</span>
</view>
<!-- 优惠券 -->
<!-- <view class="block-title">
<view class="title">
限时抢购<text>海量商家优惠券</text>
<view class="itme">
<view class="itme-list" v-for="(item, index) in position.two" :key="index" @click="onGoods(item)">
<image class="cover" :src="item.cover" mode="aspectFill"></image>
<view class="title">{{item.name}}</view>
<view class="price"><text>¥</text>{{item.original_price}}</view>
</view>
<view class="more" @click="onCoupons('more')">查看更多</view>
</view> -->
<view class="coupons" v-if="coupons.length < 0">
<view class="coupons-item" v-for="(item, index) in coupons" :key="index">
<view class="content">
<view class="coupons-title">
<view class="coupons-title-tips" v-if="item.type">
<!-- value == 1服务券 value == 2代金券 value == 3提货券 -->
<image v-if="item.type.value == '1'" class="coupons-title-icon"
src="../../static/icons/equity_coupons_01.png" mode="aspectFill"></image>
<image v-else-if="item.type.value == '2'" class="coupons-title-icon"
src="../../static/icons/equity_coupons_02.png" mode="aspectFill"></image>
<image v-else-if="item.type.value == '3'" class="coupons-title-icon"
src="../../static/icons/equity_coupons_03.png" mode="aspectFill"></image>
</view>
<view class="coupons-title-name">
{{item.title}}
</view>
</view>
</view>
<!-- 优惠券 -->
<!-- <view class="block-title">
<view class="title">
限时抢购<text>海量商家优惠券</text>
</view>
<view class="more" @click="onCoupons('more')">查看更多</view>
</view> -->
<view class="coupons" v-if="coupons.length < 0">
<view class="coupons-item" v-for="(item, index) in coupons" :key="index">
<view class="content">
<view class="coupons-title">
<view class="coupons-title-tips" v-if="item.type">
<!-- value == 1服务券 value == 2代金券 value == 3提货券 -->
<image v-if="item.type.value == '1'" class="coupons-title-icon"
src="../../static/icons/equity_coupons_01.png" mode="aspectFill"></image>
<image v-else-if="item.type.value == '2'" class="coupons-title-icon"
src="../../static/icons/equity_coupons_02.png" mode="aspectFill"></image>
<image v-else-if="item.type.value == '3'" class="coupons-title-icon"
src="../../static/icons/equity_coupons_03.png" mode="aspectFill"></image>
</view>
<view class="coupons-title-name">
{{item.title}}
</view>
<view class="sun-text">{{item.title}}</view>
</view>
<view class="logo">
<image class="logo-img" :src="item.cover" mode="aspectFill"></image>
</view>
<button class="btn" :disabled="!item.can.get"
@click="onCoupons('get', item.coupon_id, index)">{{item.can.get ? '立即领取' : '已领取'}}</button>
<view class="sun-text">{{item.title}}</view>
</view>
</view>
<view class="block-title">
<view class="title">
优选商品<text>海量商家商品优选</text>
<view class="logo">
<image class="logo-img" :src="item.cover" mode="aspectFill"></image>
</view>
<button class="btn" :disabled="!item.can.get"
@click="onCoupons('get', item.coupon_id, index)">{{item.can.get ? '立即领取' : '已领取'}}</button>
</view>
<!-- 优选商品 -->
<goods-list :list="goods" priceType="CNY" @on-goods="onGoods" />
<!-- 分页 -->
<uni-load-more :status="pageStatus" :iconSize="16"></uni-load-more>
</block>
</view>
<view class="block-title">
<view class="title">
优选商品<text>海量商家商品优选</text>
</view>
</view>
<!-- 优选商品 -->
<goods-list :list="goods" priceType="CNY" @on-goods="onGoods" />
<!-- 分页 -->
<uni-load-more :status="pageStatus" :iconSize="16"></uni-load-more>
</view>
</template>
<script>
import {
companies,
companiesList
} from '@/apis/interfaces/company'
import {
mall,
list,
managesCoupons
} from '@/apis/interfaces/goods'
import { mall, list, managesCoupons } from '@/apis/interfaces/goods'
import goodsList from '@/components/goods-list/goods-list'
import industryList from '@/components/industry-list/industry-list'
import userAuth from '@/public/userAuth'
import {
config
} from '@/apis/index.js'
import { config } from '@/apis/index.js'
export default {
comments: {
goodsList,
@@ -217,24 +121,6 @@
},
data() {
return {
tabIndex: 0,
nvConfig: {
tabArr: [{
title: '通证商城 - 买你想买',
active: true
},
// {
// title: '企业广场'
// }
],
color: '#FFF',
hideback: true,
bgColor: 'rgb(151, 109, 255)',
btn: [{
icon: '/static/icons/search-icon.png',
style: 'paddingRight: 20rpx;'
}]
},
// 易货部分
banners: [],
classify: [],
@@ -242,13 +128,6 @@
position: {},
goods: [],
goodsPage: 1,
// 广场部分
industryIndex: 0,
recommendBus: [],
hotBus: [],
industryBus: [],
busList: [],
busPage: 1,
// 分页
pageStatus: '',
imgUrl: config.apiUrls
@@ -257,33 +136,12 @@
created() {
this.getMall()
},
onNavigationBarButtonTap() {
this.$Router.push({
name: 'Search'
})
},
methods: {
// tab
onNvTab(e) {
let tabIndex = e.index
for (let i in this.nvConfig.tabArr) {
if (i == tabIndex) this.nvConfig.tabArr[i].active = true
else this.nvConfig.tabArr[i].active = false
}
this.tabIndex = tabIndex
if (tabIndex == 1 && this.recommendBus.length <= 0) this.getCompanies()
},
// 搜索
onRightBtn(e) {
switch (e.index) {
case 0:
// this.$Router.push({
// name: 'Search',
// query: {
// type: this.tabIndex
// }
// })
uni.navigateTo({
url: '/pages/equity/search?type=' + this.tabIndex + ''
})
break
}
},
// 点击轮播图
swiperClick(url) {
if (url === 'goBaoDanList') {
@@ -292,73 +150,6 @@
})
}
},
// 领取,更多优惠券
onCoupons(type, id, index) {
let token = this.$store.getters.getToken
if (token == '') {
let userLogin = new userAuth()
userLogin.Login()
return
}
if (type === 'more') {
this.$Router.push({
name: 'CouponsList'
})
return
}
if (type === 'get') {
managesCoupons(id).then(res => {
this.$set(this.coupons, index, res)
uni.showToast({
title: '领取成功',
type: 'primary',
duration: 3000
})
}).catch(err => {
uni.showToast({
icon: 'none',
title: err.message
})
})
}
},
// 企业广场
getCompanies() {
companies().then(res => {
this.recommendBus = res.positions
this.hotBus = res.hot
this.industryBus = [{
title: '全部',
industry_id: ''
}, ...res.industries]
this.getCompaniesList()
}).catch(err => {
uni.showToast({
title: err.message,
icon: 'none'
})
})
},
// 企业广场行业
onBusIndustry(index) {
this.industryIndex = index
this.busPage = 1
this.getCompaniesList()
},
// 企业列表
getCompaniesList() {
companiesList({
industry_id: this.industryBus[this.industryIndex].industry_id,
page: this.busPage
}).then(res => {
if (res.page.current === 1) {
this.busList = []
}
this.busList = this.busList.concat(res.data)
this.busPage = res.page.current
this.pageStatus = res.page.has_more ? 'more' : 'noMore'
})
},
// 易货首页
getMall() {
mall().then(res => {
@@ -402,55 +193,17 @@
},
// 易货分类
onClassify(id) {
// this.$Router.push({
// name: 'goodsList'
// })
uni.navigateTo({
url: `/pages/goods/lists?type=id&id=${id}`
})
},
// 打开微信小程序
onOpenWechat(e) {
plus.share.getServices(res => {
let sweixin = null;
for (let val of res) {
if (val.id === 'weixin') {
sweixin = val
}
}
/** 以此为例子 显示跳转引导页
* 'index_4'
* index 跳小程序企业首页
* 4 企业id
**/
if (sweixin != null) {
sweixin.launchMiniProgram({
id: e.original_id,
path: 'pages/login/guide?scene=index_' + e.company_id,
})
} else {
uni.showToast({
title: '当前环境不支持打开微信小程序',
icon: 'none'
})
}
})
}
},
// 下拉加载
onReachBottom() {
if (this.pageStatus == 'more') {
this.pageStatus = 'loading'
switch (this.tabIndex) {
case 0:
this.goodsPage += 1
this.getGoods()
break;
case 1:
this.busPage += 1
this.getCompaniesList()
break;
}
this.goodsPage += 1
this.getGoods()
}
}
}
@@ -512,7 +265,7 @@
color: $text-gray;
.is_allow_values {
color: #fff;
background-image: linear-gradient(to left,$main-color,$mian-color-light);
background-image: linear-gradient(to left,$mian-color,$mian-color-light);
padding: 2rpx 14rpx;
font-size: 20rpx;
text-align: center;
@@ -564,7 +317,7 @@
line-height: 50rpx;
.is_allow_values {
color: #fff;
background-image: linear-gradient(to left,$main-color,$mian-color-light);
background-image: linear-gradient(to left,$mian-color,$mian-color-light);
padding: 2rpx 14rpx;
font-size: 20rpx;
text-align: center;