This commit is contained in:
weipengfei 2024-03-15 14:45:43 +08:00
parent 3c828dd8ac
commit 29cb63a4f2
10 changed files with 264 additions and 88 deletions

View File

@ -13,15 +13,15 @@ import request from "@/utils/request.js";
* 获取购物车列表
* @param numType boolean true 购物车数量,false=购物车产品数量
*/
export function getCartCounts() {
return request.get("user/cart/count");
export function getCartCounts(data) {
return request.get("user/cart/count", data);
}
/**
* 获取购物车列表
*
*/
export function getCartList() {
return request.get("user/cart/lst");
export function getCartList(data) {
return request.get("user/cart/lst", data);
}
/**

View File

@ -65,9 +65,9 @@ export default{
if (that.loadImg || that.isLoadError) return;
const id = that.uid
const query = uni.createSelectorQuery().in(that);
let t = 0;
query.select('#' + id).boundingClientRect(data => {
if (!data) return;
if (data.top - that.viewHeight < 0) {
that.loadImg = !!that.imageSrc;
that.isLoadError = !that.loadImg;
@ -102,7 +102,7 @@ export default{
mounted() {
this.init()
uni.$on('scroll', this.scrollFn);
this.onScroll()
this.onScroll();
},
beforeDestroy() {
uni.$off('scroll', this.scrollFn);

View File

@ -316,6 +316,9 @@
},
onReachBottom() {
this.getProductslist();
},
onPageScroll() {
uni.$emit('scroll');
},
methods: {
navBack(){

View File

@ -452,6 +452,9 @@
onReachBottom() {
this.storeMerchantList();
},
onPageScroll() {
uni.$emit('scroll');
},
methods: {
navBack() {
uni.navigateBack();

View File

@ -314,6 +314,9 @@
},
onReachBottom() {
this.getProductslist();
},
onPageScroll() {
uni.$emit('scroll');
},
methods: {
navBack(){

View File

@ -157,14 +157,13 @@
<!--轮播图-->
<view class="swiperBg">
<view class="swiper page_swiper">
<swiper :autoplay="false" :circular="circular" :interval="intervals" :duration="duration"
<swiper :autoplay="true" loop
indicator-color="rgba(255,255,255,0.6)" indicator-active-color="#fff" :current="swiperCur"
style="height:330rpx;margin: 0 auto;width:710rpx;" @change="swiperChange"
:class="{ scalex:isScale }">
style="height:330rpx;margin: 0 auto;width:710rpx;">
<block v-for="(item,index) in imgUrls" :key="index">
<swiper-item :class="{ active: index == swiperCur,scalex:isScale }">
<view @click="goDetail(item)" class='slide-navigator acea-row row-between-wrapper'>
<image src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/e2f0520240203154207556.png"
<swiper-item :class="{ active: index == swiperCur }">
<view class='slide-navigator acea-row row-between-wrapper'>
<image :src="item.img"
class="slide-image aa" style="height:330rpx;" mode="aspectFill">
</image>
</view>
@ -224,6 +223,9 @@
</view>
</view>
<Loading></Loading>
<!--自定义底部tab栏-->
<customTab :newData="newData" :activeRouter="activeRouter"></customTab>
</view>
</template>
@ -242,16 +244,25 @@
import {
applet
} from '@/api/public.js';
import customTab from '@/components/customTab';
import {
getVersion,
getNavigation
} from "@/api/public";
// #ifdef APP-PLUS
import uniMP from '@/utils/uniMP.js';
// #endif
export default {
components:{
customTab
},
data() {
return {
imgUrls: [{
img: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/e2f0520240203154207556.png'
}],
swiperCur: 0,
locationArr: ({}),
isshow: false,
emptyText: '暂无可用应用',
@ -275,7 +286,9 @@
showPicker: false,
columnData: [],
isFshow: false,
backColor: 'rgba(252, 252, 252, 0)'
backColor: 'rgba(252, 252, 252, 0)',
newData: {},
activeRouter: '',
};
},
computed: {
@ -284,6 +297,7 @@
created() {},
onLoad() {},
onShow() {
this.getNav();
if (this.isLogin) {
this.emptyText = '暂无可用应用'
this.jurisdiction = false
@ -293,6 +307,7 @@
this.jurisdiction = true
}
this.getUserInfo();
this.imgUrls = uni.getStorageSync('swiperImgList');
},
onPullDownRefresh() {
this.getUserInfo()
@ -321,6 +336,16 @@
uni.$emit('showLoading', false);
},
methods: {
getNav() {
getNavigation().then(res => {
this.newData = res.data
if (this.newData.status && this.newData.status.status) {
uni.hideTabBar()
} else {
uni.showTabBar()
}
})
},
initAllAppLet() {
applet().then(res => {
this.AllMenuList = res.data;

View File

@ -25,7 +25,7 @@
<!--轮播图-->
<view class="swiperBg" :style="{ marginTop: (swiperTop + 15)+'px'}">
<view class="swiper page_swiper" v-if="imgUrls.length">
<swiper :autoplay="false" :circular="circular" :interval="intervals" :duration="duration"
<swiper :autoplay="true" :circular="circular" :interval="intervals" :duration="duration"
indicator-color="rgba(255,255,255,0.6)" indicator-active-color="#fff" :current="swiperCur"
style="height:330rpx;margin: 0 auto;width:710rpx;" @change="swiperChange"
:class="{ scalex:isScale }">

View File

@ -760,7 +760,8 @@
if (item.name == 'headerSerch' || item.name == 'homeComb') {
that.isHeaderSerch = true
if (item.name == 'homeComb') {
that.$set(that, 'homeCombData', item)
that.$set(that, 'homeCombData', item);
uni.setStorageSync('swiperImgList', item.swiperConfig.list);
that.smallPage = true;
}
}

View File

@ -2,38 +2,40 @@
<view :style="viewColor">
<view class='shoppingCart'>
<!-- 头部 -->
<view class="shoppingCart-head">
<view style="height: var(--status-bar-height);"></view>
<!-- 滚动tab -->
<scroll-view scroll-x="true">
<view class="scrollview">
<block v-for="(item,indx) in tabsArr" :key="indx">
<view class="scrollview-item" :class="{'scrollview-active':tabsCurr == item.val}"
@click="tabsChange(item.val)">
{{item.name}}
</view>
</block>
</view>
</scroll-view>
</view>
<view class="func">
<!-- 分段器 -->
<view class="subsection">
<u-subsection :list="['综合云市场','商户购物车']" activeColor="#40AE36" :current="subsecCurr"
mode="subsection" @change="subsecChange"></u-subsection>
</view>
<view class='nav acea-row row-between-wrapper'>
<view>购物数量<text class='num t-color'>{{cartTotalCount}}</text></view>
<view v-if="cartList.valid.length > 0 || cartList.invalid.length > 0"
class='administrate acea-row row-center-wrapper' @click='manage'>{{ footerswitch ? '管理' : '取消'}}
</view>
</view>
</view>
<view style="position: fixed;top: 0;left: 0;width: 100%;z-index: 999;">
<!-- 头部 -->
<view class="shoppingCart-head">
<view style="height: var(--status-bar-height);"></view>
<!-- 滚动tab -->
<scroll-view scroll-x="true">
<view class="scrollview">
<block v-for="(item,indx) in tabsArr" :key="indx">
<view class="scrollview-item" :class="{'scrollview-active':tabsCurr == item.val}"
@click="tabsChange(item.val)">
{{item.name}}
</view>
</block>
</view>
</scroll-view>
</view>
<view class="func" style="padding-top: 0;">
<!-- 分段器 -->
<!-- <view class="subsection">
<u-subsection :list="['综合云市场','商户购物车']" activeColor="#40AE36" :current="subsecCurr"
mode="subsection" @change="subsecChange"></u-subsection>
</view> -->
<view class='nav acea-row row-between-wrapper'>
<view>购物数量<text class='num t-color'>{{cartTotalCount}}</text></view>
<view v-if="cartList.valid.length > 0 || cartList.invalid.length > 0"
class='administrate acea-row row-center-wrapper' @click='manage'>{{ footerswitch ? '管理' : '取消'}}
</view>
</view>
</view>
</view>
<view style="height: calc(var(--status-bar-height) + 180rpx);"></view>
<view v-if="cartList.valid.length > 0 || cartList.invalid.length > 0">
<view class='list'>
<block v-for="(item,index) in cartList.valid" :key="index">
@ -125,7 +127,7 @@
</view>
</view>
<view class='noCart' v-if="recommend"
:style="{marginTop:cartList.invalid.length ==0 && cartList.invalid.length ==0?'170rpx':'' }">
:style="{paddingTop:cartList.invalid.length ==0 && cartList.invalid.length ==0?'170rpx':'' }">
<view class='pictrue'>
<image :src="`${domain}/static/images/noCart.png`"></image>
<view>暂无商品去添加点什么吧</view>
@ -236,9 +238,6 @@
tabsArr: [{
name: '用户购物车',
val: 1
}, {
name: '商户购物车',
val: 2
}],
tabsCurr: 1,
subsecCurr: 0,
@ -297,7 +296,10 @@
onReady() {},
mounted: function() {},
onLoad: function(options) {
if(this.$store.state.app.userInfo.mer_info.mer_settlement_agree_status) this.tabsArr.push({
name: '商户购物车',
val: 2
})
},
onShow: function() {
let that = this
@ -326,10 +328,20 @@
methods: {
tabsChange(e) {
this.tabsCurr = e;
this.getCartList();
this.getCartNum();
this.goodsHidden = true;
this.footerswitch = true;
this.isAllSelect = true; //
this.selectValue = []; //
uni.setStorage({
key: 'invoice_Data',
data: {},
success: function() {}
})
},
subsecChange(e) {
console.log(e);
this.subsecCurr = e;
},
@ -379,12 +391,12 @@
}).then(res => {
this.getCartList();
this.getCartNum();
return that.$util.Tips({
return this.$util.Tips({
title: res.message,
icon: 'success'
});
}).catch(err => {
return that.$util.Tips({
return this.$util.Tips({
title: err
});
});
@ -710,14 +722,18 @@
},
getCartNum: function() {
let that = this;
getCartCounts().then(res => {
getCartCounts({
sale_type: this.tabsCurr
}).then(res => {
that.cartTotalCount = res.data[0].count || 0;
});
},
//
getCartList: function(isChange) {
let that = this;
getCartList().then(res => {
getCartList({
sale_type: this.tabsCurr
}).then(res => {
res.data.list.forEach((item, index) => {
item.allCheck = true
item.list.forEach((goods, j) => {

View File

@ -82,7 +82,7 @@
.category {
width: 100%;
overflow: auto;
margin-bottom: 70rpx;
// margin-bottom: 70rpx;
.category-wrap {
display: flex;
@ -152,7 +152,7 @@
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 50rpx;
padding: 20rpx 50rpx;
[class^=comprehensive-] {
display: flex;
@ -182,7 +182,7 @@
<view class="wholeSale">
<!-- 顶部 -->
<view class="wholeSale-header">
<view class="wholeSale-header" style="position: fixed;top: 0;left: 0;width: 100%;z-index: 999;">
<!-- 适配不同机 -->
<view style="height: var(--status-bar-height);"></view>
@ -200,67 +200,74 @@
</view>
<!-- 内容 -->
<view class="wholeSale-con">
<!-- 搜索 -->
<navigator url="/pages/columnGoods/goods_search/index" hover-class="none"
class="search_content flex_a_c_j_sb">
<view class="flex_a_c search_content_wrap">
<view class="iconfont icon-sousuo" style="font-size: 39rpx;"></view>
<input type="text" placeholder="搜索您需要批发进货的产品名称" placeholder-style="font-size: 30rpx;color:#999;"
disabled>
</view>
<button class="search_btn">搜索</button>
</navigator>
<view class="wholeSale-con" style="padding-top: calc(var(--status-bar-height) + 120rpx);">
<view class="wholeSale-nav">
<!-- <u-icon class="icon" name="arrow-left" size="20" @click="navBack"></u-icon> -->
<!-- 搜索 -->
<navigator url="/pages/columnGoods/goods_search/index" hover-class="none"
class="search_content flex_a_c_j_sb">
<view class="flex_a_c search_content_wrap">
<view class="iconfont icon-sousuo" style="font-size: 39rpx;"></view>
<input type="text" placeholder="搜索您需要批发进货的产品名称" placeholder-style="font-size: 30rpx;color:#999;"
disabled style="pointer-events: none;">
</view>
<!-- <button class="search_btn">搜索</button> -->
</navigator>
</view>
<!-- 商品大分类 -->
<view class="category">
<scroll-view scroll-x="true">
<view class="category-wrap">
<block v-for="(item,index) in 10" :key="index">
<view class="category-item category-item-active">
<u-image width="108rpx" height="108rpx" shape="circle" :lazy-load="true">
<block v-for="(item,index) in store_category" :key="index">
<view class="category-item" :class="{'category-item-active': index==cate_change}" @click="changeCate(index)">
<u--image class="category-item-img" width="108rpx" :src="item.pic" height="108rpx" shape="circle">
<template v-slot:loading>
<u-loading-icon color="#999" size="15" />
</template>
</u-image>
<text>水果蔬菜</text>
</u--image>
<text class="category-item-text">{{item.cate_name}}</text>
</view>
</block>
</view>
</scroll-view>
</view>
<!-- 商品小分类 -->
<view class="cate">
<view class="cate" v-if="store_category_children.length>1">
<scroll-view scroll-x="true">
<view class="cate-wrap">
<block v-for="(item,index) in 10" :key="index">
<view class="cate-item" :class="{'cate-item-active':index == 0}">
<text>水果</text>
<block v-for="(item,index) in store_category_children" :key="index">
<view class="cate-item" :class="{'cate-item-active':index == cate_change_children}" @click="changeChildrenCate(index)">
<text>{{item.cate_name}}</text>
</view>
</block>
</view>
</scroll-view>
</view>
<!-- 综合查询 -->
<view class="comprehensive">
<view class="comprehensive-price">
<text>价格</text>
<image src="../../static/new_define/priceChange.png"></image>
<image src="@/static/new_define/priceChange.png"></image>
</view>
<view class="comprehensive-sales_num">
<text>销量</text>
</view>
<view class="comprehensive-discount">
<text>抵扣</text>
<image class="loudou" src="../../static/new_define/loudou.png"></image>
<image class="loudou" src="@/static/new_define/loudou.png"></image>
</view>
</view>
<!-- 流水瀑布 -->
<WaterfallsFlow :wfList='hostProduct' @itemTap="goDetail" :type="0" />
<loadmore :type="isLoading" style="padding: 40rpx 0 150rpx; 0"></loadmore>
</view>
<!--自定义底部tab栏-->
<customTab :newData="newData" :activeRouter="activeRouter"></customTab>
</view>
</template>
@ -268,10 +275,21 @@
import {
goShopDetail
} from '@/libs/order.js'
import {
getStoreCategory,
getProductslist,
getCategoryIndexList
} from "@/api/store.js"
import customTab from '@/components/customTab';
import {
getVersion,
getNavigation
} from "@/api/public";
import WaterfallsFlow from '@/components/WaterfallsFlow/WaterfallsFlow.vue'
export default {
components: {
WaterfallsFlow
WaterfallsFlow,
customTab
},
data() {
return {
@ -285,13 +303,120 @@
name: '名优特产批发',
val: 3
}],
tabsCurr: 1
tabsCurr: 1,
newData: {},
activeRouter: '',
hostProduct: [],
store_category: [], //
store_category_children: [], //
cate_change: 0,
cate_change_children: 0,
isLoading: 0,
where:{
page: 1,
limit: 20,
sale_type: 2, //1, 2
mer_id: 259,
mer_cate_id: '', //
cate_id: '',
keyword: '',
deduction_rate: '', //
}
}
},
onLoad() {
this.getNav();
this.getStoreCategory();
this.getProductslist(true);
},
onPageScroll() {
uni.$emit('scroll');
},
methods: {
getNav() {
getNavigation().then(res => {
this.newData = res.data
if (this.newData.status && this.newData.status.status) {
uni.hideTabBar()
} else {
uni.showTabBar()
}
})
},
tabsChange(e) {
this.tabsCurr = e;
this.where = {
page: 1,
limit: 20,
sale_type: 1
}
this.cate_change = 0;
this.cate_change_children = 0;
if(e==1) {
this.where.mer_id = 259;
}
if(e==3){
this.where.label_name = '名优特产';
}
this.getStoreCategory();
this.getProductslist(true);
},
changeCate(e){
this.cate_change = e;
this.store_category_children = [];
if(this.store_category[e].children) this.store_category_children = [...this.store_category[e].children];
this.store_category_children.unshift({
cate_name: '全部',
store_category_id: ''
})
this.cate_change_children = 0;
if(this.tabsCurr==1) this.where.mer_cate_id = this.store_category[e].store_category_id;
else this.where.cate_id = this.store_category[e].store_category_id
this.getProductslist(true);
},
changeChildrenCate(e){
this.cate_change_children = e;
let key = 'mer_cate_id';
if(this.tabsCurr!=1) key = 'cate_id';
this.where[key] = this.store_category_children[e].store_category_id;
if(e==0) this.where[key] = this.store_category[this.cate_change].store_category_id; // , id
this.getProductslist(true);
},
getStoreCategory(){
if(this.tabsCurr==1) getStoreCategory(259).then(res=>{
this.initStoreCate(res);
})
else getCategoryIndexList().then(res=>{
this.initStoreCate(res);
})
},
initStoreCate(res){
this.store_category = [{
cate_name: '全部',
pic: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/de2be202312151001024597.png',
store_category_id: ''
}, ...res.data];
this.store_category_children = this.store_category[0].children || [];
this.store_category_children.unshift({
cate_name: '全部',
store_category_id: ''
})
},
getProductslist(reLoad=false){
if(reLoad){
this.where.page = 1;
this.hostProduct = [];
this.isLoading = 0;
}
if(this.isLoading==-1)return;
this.isLoading = 1;
getProductslist(this.where).then(res=>{
this.hostProduct = [...this.hostProduct, ...res.data.list];
this.where.page++;
this.isLoading = 0;
if(res.data.list.length<this.where.limit) this.isLoading = -1;
})
},
goDetail(item) {
goShopDetail(item, this.uid).then(res => {
if (this.isLogin) {