123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682 |
- <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" @click="searchButton" :animation="false"
- :disabled="true" :showAction="false">
- </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 imgMode='scaleToFill'></u-swiper>
- </view>
- <view style="background-color: #fff;margin-bottom: 20rpx;">
- <view class="cardBox classification">
- <view class="classificationBox" v-for="(item,index) in brandList" :key="item.id" @click="click(index)">
- <view class="classificationBox_img">
- <image :src="item.brandFilesList[0].url" mode=""></image>
- </view>
- <view class="classificationBox_text" :style="PPindex == index?'color:#3c9cff':''">{{item.cname}}
- </view>
- </view>
- <view class="classificationBox" @click="Moreprojectsfun" v-if="brandList.length >= 7 && gengduofalse">
- <view class="classificationBox_img">
- <image src="../../static/images/view/buyGoods/gengduo.png" style="width: 60rpx;height: 60rpx;"
- mode=""></image>
- </view>
- <view class="classificationBox_text">更多项目</view>
- </view>
- <view class="classificationBox" @click="shohuifun"
- v-if="brandList.length >= zsbrandList.length && zsbrandList.length > 8">
- <view class="classificationBox_img">
- <image src="../../static/images/view/buyGoods/fanhui.png" style="width: 60rpx;height: 60rpx;"
- mode=""></image>
- </view>
- <view class="classificationBox_text">收回项目</view>
- </view>
- <!-- <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 @click="inIntegralMall">
- <image src="../../static/images/tabBar/JFStop.png" style="width: 100%;height: 220rpx;"
- mode="scaleToFill"></image>
- </view>
- <view style="margin-top: 10rpx;display: flex;justify-content: space-between;width: 100%;">
- <u-tabs :list="dianjiqielist" v-model="groupModel" @click="groupChange"></u-tabs>
- <!-- <view style="display: flex;margin-right: 20rpx;" @click="inIntegralMall">
- <u-icon name="grid" size="24"></u-icon>
- <span style="display: flex;align-items: center;">积分商城</span>
- </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"
- mode='aspectFit'
- 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;">
- ¥{{checkStatus == '通过'?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;">
- ¥{{checkStatus == '通过'?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 v-if="userInfo.tenant_id != '000000'" class="suspensionBox" @click="salesmanShow=true">
- <u-icon name="server-fill" color="#2979ff" size="30"></u-icon>
- </view>
- <u-modal :show="salesmanShow" title="业务员联系方式" showCancelButton confirmText="拨号" cancelText="关闭"
- @confirm="clickCall" @cancel="salesmanShow=false">
- <view class="slot-content">
- <view style="margin-bottom: 10rpx;">业务员:{{salesmanName?salesmanName:''}}</view>
- <view>电话:{{phoneNumber?phoneNumber:''}}</view>
- </view>
- </u-modal>
- </view>
- </template>
- <script>
- import {
- appList,
- appListNew,
- userDept,
- validationCorpEmpty,
- isProcurement,
- brandDescList,
- brandDescDetail
- } from '@/api/tabBar/homeNew.js'
- import {
- shoppingCartList
- } from '@/api/tabBar/shoppingCart.js'
- import {
- listAll
- } from '@/api/tabBar/classification.js'
- import {
- details,
- nameDetail
- } from '@/api/views/personalInformation/index.js'
- import {
- activityList
- } from '@/api/tabBar/activity.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,
- // 品牌
- zsbrandList: [],
- brandDescfor: 7,
- gengduofalse: true,
- // 审核状态
- checkStatus: '',
- enableOrNot: '',
- salesmanName: '', // 业务员姓名
- phoneNumber: '', // 业务员联系电话
- salesmanShow: false, // 联系业务员弹窗
- userInfo: {}, // 当前用户数据
- }
- },
- onReachBottom() {
- this.status = 'loading'
- if (this.dataList.length < this.page.total) {
- this.page.current++
- this.onSearch()
- } else {
- this.status = 'nomore'
- }
- },
- onLoad(e) {},
- onShow() {
- activityList({
- current: 1,
- size: 10,
- status: 1
- }).then(res => {
- uni.setTabBarBadge({
- index: 2, // tabIndex,tabBar的哪一项,从0开始
- text: res.data.total.toString() // 显示的文本,超过 99 显示成 “…”
- })
- })
- shoppingCartList({
- whetherIntegral: '0'
- }).then(res => {
- let num = 0
- res.data.forEach(e => {
- num = num + e.list.length
- })
- uni.setTabBarBadge({
- index: 3, // tabIndex,tabBar的哪一项,从0开始
- text: num.toString() // 显示的文本,超过 99 显示成 “…”
- })
- })
- this.userInfo = uni.getStorageSync('userInfo')
- if (uni.getStorageSync('cname')) {
- this.$set(this.search, 'cname', JSON.parse(JSON.stringify(uni.getStorageSync('cname'))))
- uni.removeStorageSync('cname')
- }
- // 获取审核状态
- details().then(res => {
- this.checkStatus = res.data.checkStatus
- this.enableOrNot = res.data.enableOrNot
- uni.setStorageSync('checkStatus', res.data.checkStatus);
- uni.setStorageSync('enableOrNot', res.data.enableOrNot);
- // 查询业务员详情拿取手机号
- this.salesmanName = res.data.salesmanName
- if (!this.phoneNumber) {
- nameDetail({
- id: res.data.salesmanId
- }).then(res => {
- this.phoneNumber = res.data.phone
- })
- }
- })
- // 轮播图
- brandDescList({
- type: 'LBT',
- whetherIntegral: "0"
- }).then(res => {
- brandDescDetail({
- id: res.data.records[0].id
- }).then(res => {
- this.list3 = res.data.brandFilesList.map(item => {
- return item.url
- })
- })
- })
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- // 判断是怎么登录的
- if (JSON.parse(JSON.stringify(uni.getStorageSync('userInfo'))).tenant_id != '000000') {
- // 查看是否有客户信息
- validationCorpEmpty().then(res => {
- uni.hideLoading();
- //获取公司名称
- userDept().then(res => {
- uni.setNavigationBarTitle({
- title: res.data.fullName
- })
- })
- //获取所有品牌
- listAll({
- type: 'PP',
- enableOrNot: '1',
- whetherIntegral: '0'
- }).then(res => {
- this.zsbrandList = []
- this.brandList = []
- // this.zsbrandList = res.data
- this.zsbrandList = res.data.sort(this.compare('sort'))
- if (this.zsbrandList.length <= 8) {
- this.gengduofalse = false
- this.brandList = this.zsbrandList
- } else {
- for (let i in res.data) {
- if (i < this.brandDescfor) {
- this.brandList.push(res.data[i])
- }
- }
- }
- })
- this.page = {
- total: 0,
- size: 10,
- current: 1
- }
- this.dataList = []
- this.onSearch()
- }).catch(err => {
- uni.hideLoading();
- uni.$u.route('/pages/views/personalInformation/index');
- })
- } else {
- uni.setNavigationBarTitle({
- title: '青岛途宝'
- })
- //获取所有品牌
- listAll({
- type: 'PP',
- enableOrNot: '1',
- whetherIntegral: '0'
- }).then(res => {
- this.zsbrandList = []
- this.brandList = []
- // this.zsbrandList = res.data
- this.zsbrandList = res.data.sort(this.compare('sort'))
- if (this.zsbrandList.length <= 8) {
- this.gengduofalse = false
- this.brandList = this.zsbrandList
- } else {
- for (let i in res.data) {
- if (i < this.brandDescfor) {
- this.brandList.push(res.data[i])
- }
- }
- }
- })
- this.page = {
- total: 0,
- size: 10,
- current: 1
- }
- this.dataList = []
- this.onSearch()
- }
- uni.hideLoading();
- },
- methods: {
- // 点击联系业务员
- clickCall() {
- uni.makePhoneCall({
- phoneNumber: this.phoneNumber,
- success: function() {
- console.log('拨打电话成功');
- this.salesmanShow = false
- },
- fail() {
- console.log('打电话失败了');
- this.salesmanShow = false
- }
- })
- },
- // 数组排序 property:根据什么属性排序
- compare(property) {
- return function(a, b) {
- var value1 = a[property]
- var value2 = b[property]
- return value1 - value2
- }
- },
- // 更多项目盒子
- Moreprojectsfun() {
- this.brandDescfor += 4
- this.brandList = []
- console.log(123);
- for (let i in this.zsbrandList) {
- if (i < this.brandDescfor) {
- this.brandList.push(this.zsbrandList[i])
- }
- }
- if (this.brandDescfor >= this.zsbrandList.length) {
- this.gengduofalse = false
- }
- },
- // 收回项目
- shohuifun() {
- this.brandDescfor = 7
- this.brandList = []
- for (let i in this.zsbrandList) {
- if (i < this.brandDescfor) {
- this.brandList.push(this.zsbrandList[i])
- }
- }
- this.gengduofalse = true
- // if (this.brandDescfor >= this.zsbrandList.length) {
- // this.gengduofalse = false
- // }
- },
- 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
- }
- if (uni.getStorageSync('whether_openShare') == 1) {
- appListNew({
- size: this.page.size,
- current: this.page.current,
- ...obj,
- ...this.search,
- whetherIntegral: 0
- }).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();
- })
- } else {
- appList({
- size: this.page.size,
- current: this.page.current,
- ...obj,
- ...this.search,
- whetherIntegral: 0
- }).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()
- uni.setStorageSync('homeSearch', this.search);
- this.search.cname = null
- uni.switchTab({
- url: '/pages/tabBar/classification',
- })
- },
- //打开明细
- choice(item, index) {
- if (this.checkStatus != '通过') {
- uni.showToast({
- title: "当前用户未授权,请联系客服",
- icon: "none",
- mask: true
- });
- return
- }
- uni.$u.route('/pages/views/buyGoods/commodityDetails', {
- id: item.id
- });
- },
- inIntegralMall() {
- uni.$u.route('/pages/integralMall/index');
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .suspensionBox {
- width: 80rpx;
- height: 80rpx;
- background: #fff;
- border-radius: 50%;
- position: fixed;
- top: 92%;
- right: 2%;
- box-shadow: 4px 4px 8px 1px rgba(0, 0, 0, .5);
- display: flex;
- align-items: center;
- justify-content: center;
- }
- ::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;
- }
- .cardBox {
- margin-top: 20rpx;
- background: #fff;
- border-radius: 12rpx;
- width: 100%;
- padding: 20rpx 20rpx 0 20rpx;
- box-sizing: border-box;
- .classificationBox {
- width: 25%;
- display: flex;
- flex-direction: column;
- align-items: center;
- margin: 10rpx 0;
- .classificationBox_img {
- width: 70rpx;
- height: 70rpx;
- // filter: grayscale(100%) hue-rotate(180deg) brightness(0.5) contrast(200%);
- // mix-blend-mode: screen;
- // background-color: #FF00FF;
- }
- .classificationBox_text {
- margin-top: 10rpx;
- font-size: 28rpx;
- color: #101010;
- }
- .brandDescColor {
- color: #92c3fd;
- // border: 2rpx solid;
- }
- }
- }
- .classification {
- display: flex;
- flex-wrap: wrap;
- min-height: 180rpx;
- }
- image {
- width: 100%;
- height: 100%;
- }
- </style>
|