123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391 |
- <template>
- <view>
- <view class="search">
- <view style="margin: 10rpx 20rpx;margin-top: 20rpx;">
- <u-search placeholder="请输入商品名称" inputAlign="center" bgColor="#fff" shape="square" v-model="search.cname"
- @search="searchButton" @custom="searchButton" :animation="true"></u-search>
- </view>
- <view v-if="false" style="margin: -15rpx auto 10rpx auto;display: flex;padding: 0 20rpx;z-index: 999;" >
- <u-tag :text="search.brandNmae" borderColor="#FD4B09" color="#FD4B09" plain size="medium" closable
- :show="false" @close="close" @click="close"></u-tag>
- <!-- <u-tag text="原厂" borderColor="#FD4B09" color="#FD4B09" plain size="medium" closable v-if="originalFactory"
- :show="originalFactory" @close="yuanchangclose('originalFactory')" @click="yuanchangclose('originalFactory')"></u-tag>
- <u-tag text="自修补" borderColor="#FD4B09" color="#FD4B09" plain size="medium" closable v-if="selfRecovery"
- :show="selfRecovery" @close="yuanchangclose('selfRecovery')" @click="yuanchangclose('selfRecovery')"></u-tag>
- <u-tag text="防爆" borderColor="#FD4B09" color="#FD4B09" plain size="medium" closable v-if="explosionProof"
- :show="explosionProof" @close="yuanchangclose('explosionProof')" @click="yuanchangclose('explosionProof')"></u-tag> -->
- </view>
- </view>
- <view :style="{marginTop:show == true?'108rpx':'108rpx'}">
- <u-swiper :list="list3" indicator indicatorMode="dot" circular></u-swiper>
- </view>
- <view style="background-color: #fff;margin-bottom: 20rpx;">
- <view style="padding: 20rpx 0 0 0;">
- <u-grid :border="false" @click="click" col="4">
- <u-grid-item v-for="(item,index) in brandList" :key="index">
- <view v-if="item.brandFilesList.length>0" style="text-align: center;">
- <view v-for="(li,i) in item.brandFilesList" :key="i" :src="li.url">
- <image :src="li.url" style="width: 80rpx;height: 80rpx;"></image>
- <view style="font-size: 28rpx;" :style="PPindex == index?'color:#3c9cff':''" >{{item.cname}}</view>
- </view>
- </view>
- <view v-else style="text-align: center;">
- <u-icon :customStyle="{paddingBottom:8+'rpx'}" labelPos="bottom" name="error-circle"
- :size="40"></u-icon>
- <view style="font-size: 28rpx;">{{item.cname}}</view>
- </view>
- </u-grid-item>
- </u-grid>
- </view>
-
-
- <view style="margin-top: 10rpx;display: flex;">
- <u-tabs :list="dianjiqielist" v-model="groupModel" @click="groupChange"></u-tabs>
- <!-- <u-radio-group
- v-model="groupModel"
- placement="row"
- @change="groupChange"
- >
- <u-radio
- :customStyle="{margin: '0 10px'}"
- v-for="(item, index) in dianjiqielist"
- :key="index"
- :label="item.name"
- :name="item.name" >
- </u-radio>
- </u-radio-group> -->
- <!-- <view style="display: flex;align-items: center;" @click="dianjiqiehuan('')">
- <view style="margin-right: 10rpx;"
- :style="originalFactory?'color:#4070fc':''">全部</view>
- </view>
- <view style="display: flex;align-items: center;" @click="dianjiqiehuan('originalFactory')">
- <view style="margin-right: 10rpx;"
- :style="originalFactory?'color:#4070fc':''">静音棉</view>
- </view>
- <view style="display: flex;align-items: center;" @click="dianjiqiehuan('selfRecovery')">
- <view style="margin-right: 10rpx;" :style="selfRecovery?'color:#4070fc':''">自修补</view>
- </view>
- <view style="display: flex;align-items: center;" @click="dianjiqiehuan('explosionProof')">
- <view style="margin-right: 10rpx;" :style="explosionProof?'color:#4070fc':''">防爆</view>
- </view> -->
- </view>
-
-
- <view style="padding: 20rpx 20rpx;">
- <u-divider text="爆品推荐"></u-divider>
- </view>
- </view>
- <view style="margin-top: 0rpx;" class="content">
- <view class="left">
- <block v-for="(item,index) in dataList" :key="index" v-if="index%2==0">
- <view class="item" @click="choice(item,index)">
- <image v-for="(ite,ind) in item.filesList" :key="ind" v-if="ite.version === '0'" :src="ite.url"
- style="width: 100%;height: 340rpx;border-top-left-radius: 20rpx;border-top-right-radius: 20rpx;">
- </image>
- <view style="width: calc(100% - 20rpx);margin: 0 auto;">
- <u--text :text="item.cname" size="12"></u--text>
- <view style="display: flex;justify-content: space-between;margin: 5rpx auto;">
- <view style="padding-top: 12rpx;">
- <view v-if="item.billType == 0"
- style="font-size: 16rpx;background-color: #FD4B09;color: #fff;padding: 6rpx;border-radius: 6rpx;">
- 今日达</view>
- <view v-else
- style="font-size: 16rpx;background-color: #5ac725;color: #fff;padding: 6rpx;border-radius: 6rpx;">
- 次日达</view>
- </view>
- <view style="color: #FD4B09;font-size: 40rpx;">¥{{item.mallPrice}}</view>
- </view>
- </view>
- </view>
- </block>
- </view>
- <view class="right">
- <block v-for="(item,index) in dataList" :key="index" v-if="index%2==1">
- <view class="item" @click="choice(item,index)">
- <image v-for="(ite,ind) in item.filesList" :key="ind" v-if="ite.version === '0'" :src="ite.url"
- style="width: 100%;height: 340rpx;border-top-left-radius: 20rpx;border-top-right-radius: 20rpx;">
- </image>
- <view style="width: calc(100% - 20rpx);margin: 0 auto;">
- <u--text :text="item.cname" size="12"></u--text>
- <view style="display: flex;justify-content: space-between;margin: 5rpx auto;">
- <view style="padding-top: 12rpx;">
- <view v-if="item.billType == 0"
- style="font-size: 16rpx;background-color: #FD4B09;color: #fff;padding: 6rpx;border-radius: 6rpx;">
- 今日达</view>
- <view v-else
- style="font-size: 16rpx;background-color: #5ac725;color: #fff;padding: 6rpx;border-radius: 6rpx;">
- 次日达</view>
- </view>
- <view style="color: #FD4B09;font-size: 40rpx;">¥{{item.mallPrice}}</view>
- </view>
- </view>
- </view>
- </block>
- </view>
- </view>
- <u-empty v-if="dataList.length == 0" mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png" />
- <u-loadmore v-if="page.total !== 0 && dataList.length != 0" :status="status" />
- </view>
- </template>
- <script>
- import {
- appList,
- userDept,
- validationCorpEmpty,
-
- brandDescList,
- brandDescDetail
- } from '@/api/tabBar/home.js'
- import {
- listAll
- } from '@/api/tabBar/classification.js'
- export default {
- data() {
- return {
- show:false,
- search: {},
- page: {
- total: 0,
- size: 10,
- current: 1
- },
- status: 'loadmore',
- dataList: [],
- list3: [],
- brandList: [],
- // 静音棉
- originalFactory:0,
- // 自修补
- selfRecovery:0,
- // 防爆
- explosionProof:0,
- dianjiqielist:[
- {
- name: '全部',
- },
- {
- name: '静音棉',
- },
- {
- name: '自修补',
- },
- {
- name: '防爆',
- }
- ],
- groupModel:null,
- PPindex:null,
- }
- },
- onReachBottom() {
- this.status = 'loading'
- if (this.dataList.length < this.page.total) {
- this.page.current++
- this.onSearch()
- } else {
- this.status = 'nomore'
- }
- },
- onShow() {
- // 轮播图
- brandDescList({type:'LBT'}).then(res=>{
- brandDescDetail({id:res.data.records[0].id}).then(res=>{
- // this.list3 = res.data.brandFilesList
- this.list3 = res.data.brandFilesList.map(item=>{
- return item.url
- })
- })
- })
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- validationCorpEmpty().then(res => {
- uni.hideLoading();
- //获取公司名称
- userDept().then(res => {
- uni.setNavigationBarTitle({
- title: res.data.fullName
- })
- })
- //获取所有品牌
- listAll({type:'PP', enableOrNot:'1'}).then(res => {
- this.brandList = res.data
- })
- this.page = {
- total: 0,
- size: 10,
- current: 1
- }
- this.dataList = []
- this.onSearch()
- }).catch(err => {
- uni.hideLoading();
- uni.$u.route('/pages/views/personalInformation/index');
- })
- },
- methods: {
- groupChange(e){
- console.log(e,228);
- if (e.name == '静音棉') {
- this.originalFactory = 1
- this.selfRecovery = 0
- this.explosionProof = 0
- }else if (e.name == '自修补') {
- this.originalFactory = 0
- this.selfRecovery = 1
- this.explosionProof = 0
- }else if (e.name == '防爆') {
- this.originalFactory = 0
- this.selfRecovery = 0
- this.explosionProof = 1
- }else {
- this.originalFactory = 0
- this.selfRecovery = 0
- this.explosionProof = 0
- }
- this.page.current = 1
- this.dataList = []
- this.onSearch()
-
- },
- // 点击筛选条件
- dianjiqiehuan(name){
- if (this[name] == 0) {
- this[name] = 1
- }else {
- this[name] = 0
- }
- this.click()
- },
- // 获取列表数据
- onSearch() {
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- let obj = {}
- if(this.originalFactory){
- obj.originalFactory = 1
- }
- if (this.selfRecovery){
- obj.selfRecovery = 1
- }
- if (this.explosionProof) {
- obj.explosionProof = 1
- }
- appList({
- size: this.page.size,
- current: this.page.current,
- ...obj,
- ...this.search
- }).then(res => {
- this.dataList = this.dataList.concat(res.data.records)
- this.page.total = res.data.total
- if (this.dataList.length == res.data.total) {
- this.status = 'nomore'
- }
- uni.hideLoading();
- }).catch(err => {
- uni.hideLoading();
- })
- },
- close(){
- this.show = false
- this.search.brandId = ''
- this.search.brandName = ''
- },
- // 原厂点击差号
- yuanchangclose(type){
- if (type == 'originalFactory') {
- this.originalFactory = false
- }else if (type == 'selfRecovery') {
- this.selfRecovery = false
- }else {
- this.explosionProof = false
- }
- this.click()
- },
-
- click(name) {
- if (name != undefined) {
- this.page = {
- total: 0,
- size: 10,
- current: 1,
- }
- this.dataList = []
- if (this.PPindex == name) {
- this.PPindex = null
- delete this.search.brandId
- delete this.search.brandNmae
- }else {
- this.PPindex = name
-
- this.search = {
- ...this.search,
- brandId: this.brandList[this.PPindex].id,
- brandNmae: this.brandList[this.PPindex].cname,
- }
- }
-
- }
- this.show = true
-
- this.onSearch()
- },
- searchButton(value) {
- this.dataList = []
- this.page = {
- total: 0,
- size: 10,
- current: 1
- }
- this.search = {
- ...this.search,
- cname: value,
- }
- this.onSearch()
- },
- //打开明细
- choice(item, index) {
- uni.$u.route('/pages/views/buyGoods/commodityDetails', {
- id: item.id
- });
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- ::v-deep .u-divider {
- margin: 0 !important;
- }
- .content {
- text-align: justify;
- }
- .left,
- .right {
- display: inline-block;
- vertical-align: top;
- width: 50%;
- }
- .item {
- width: calc(100% - 20rpx);
- margin: 0 auto;
- background-color: #FFFFFF;
- border-radius: 10rpx;
- break-inside: avoid;
- margin-bottom: 20rpx;
- }
- .search {
- width: 100%;
- position: fixed;
- top: 0;
- z-index: 8;
- background-color: #f2f2f2;
- }
- </style>
|