feat:改造地址和首页
@@ -2,7 +2,7 @@
|
|||||||
"version" : "1.0",
|
"version" : "1.0",
|
||||||
"configurations" : [
|
"configurations" : [
|
||||||
{
|
{
|
||||||
"playground" : "custom",
|
"playground" : "standard",
|
||||||
"type" : "uni-app:app-android"
|
"type" : "uni-app:app-android"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,114 +1,146 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="choiceness_warp">
|
<view class="choiceness_warp">
|
||||||
<view class="choiceness_title">
|
<view class="choiceness_title">
|
||||||
<up-image src="/static/common/jingxuan_left.png" width="24" height="8" bgColor="#f1f6ff00"></up-image>
|
<up-image
|
||||||
<view class="choiceness_title_msg">为您精选</view>
|
src="/static/common/jingxuan_left.png"
|
||||||
<up-image src="/static/common/jingxuan_right.png" width="24" height="8" bgColor="#f1f6ff00"></up-image>
|
width="24"
|
||||||
</view>
|
height="8"
|
||||||
<view class="choiceness_product">
|
bgColor="#f1f6ff00"
|
||||||
<view v-for="item in productList" :key="item.id" class="choiceness_product_item" @click="jumpInfo(item)">
|
></up-image>
|
||||||
<up-image :src="item.url" width="100%" height="140" bgColor="#f1f6ff00"></up-image>
|
<view class="choiceness_title_msg">为您精选</view>
|
||||||
<view class="product_item_name">{{ item.title }}</view>
|
<up-image
|
||||||
<view class="product_item_price">
|
src="/static/common/jingxuan_right.png"
|
||||||
<view class="price_">
|
width="24"
|
||||||
<text>¥</text>
|
height="8"
|
||||||
<text style="color:36rpx;">{{ item.price }}</text>
|
bgColor="#f1f6ff00"
|
||||||
</view>
|
></up-image>
|
||||||
<view class="price_sell">已售{{ item.sales }}件</view>
|
</view>
|
||||||
</view>
|
<view
|
||||||
</view>
|
class="choiceness_product"
|
||||||
</view>
|
:class="platformType ? '' : 'iosplatformType'"
|
||||||
</view>
|
>
|
||||||
|
<view
|
||||||
|
v-for="item in productList"
|
||||||
|
:key="item.id"
|
||||||
|
class="choiceness_product_item"
|
||||||
|
@click="jumpInfo(item)"
|
||||||
|
>
|
||||||
|
<up-image
|
||||||
|
:src="item.url"
|
||||||
|
width="100%"
|
||||||
|
height="140"
|
||||||
|
bgColor="#f1f6ff00"
|
||||||
|
></up-image>
|
||||||
|
<view class="product_item_name">{{ item.title }}</view>
|
||||||
|
<view class="product_item_price">
|
||||||
|
<view class="price_">
|
||||||
|
<text>¥</text>
|
||||||
|
<text style="color: 36rpx">{{ item.price }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="price_sell">已售{{ item.sales }}件</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { searchList } from '@/api/product.js';
|
import { searchList } from "@/api/product.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "choiceness",
|
name: "choiceness",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
productList: []
|
productList: [],
|
||||||
};
|
platformType: true,
|
||||||
},
|
};
|
||||||
mounted() {
|
},
|
||||||
this.getSearchList();
|
mounted() {
|
||||||
},
|
/*#ifdef APP-PLUS*/
|
||||||
methods: {
|
const appUpdate = uni.getStorageSync("platform");
|
||||||
//
|
this.platformType = appUpdate == "android" ? "ANDROID" : "IOS";
|
||||||
jumpInfo(item) {
|
/*#endif*/
|
||||||
uni.navigateTo({
|
this.getSearchList();
|
||||||
url: '/pages/other_package/productInfo/productInfo?id=' + item.id,
|
},
|
||||||
})
|
methods: {
|
||||||
},
|
//
|
||||||
async getSearchList() {
|
jumpInfo(item) {
|
||||||
const params = {
|
uni.navigateTo({
|
||||||
isRecomm: true,
|
url: "/pages/other_package/productInfo/productInfo?id=" + item.id,
|
||||||
page: 1,
|
});
|
||||||
pageSize: 66,
|
},
|
||||||
}
|
async getSearchList() {
|
||||||
const resp = await searchList(params);
|
const params = {
|
||||||
if (resp && resp.bizcode === 100) {
|
isRecomm: true,
|
||||||
this.productList = resp.data
|
page: 1,
|
||||||
}
|
pageSize: 66,
|
||||||
}
|
};
|
||||||
}
|
const resp = await searchList(params);
|
||||||
}
|
if (resp && resp.bizcode === 100) {
|
||||||
|
this.productList = resp.data;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.choiceness_warp {
|
.choiceness_warp {
|
||||||
margin-top: 50rpx;
|
margin-top: 50rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.choiceness_title {
|
.choiceness_title {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
||||||
.choiceness_title_msg {
|
.choiceness_title_msg {
|
||||||
margin: 0 18rpx;
|
margin: 0 18rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.choiceness_product {
|
.choiceness_product {
|
||||||
margin-top: 40rpx;
|
margin-top: 40rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
padding-bottom: calc(env(safe-area-inset-bottom) + 100rpx);
|
||||||
|
&.iosplatformType {
|
||||||
|
padding-bottom: 100rpx;
|
||||||
|
}
|
||||||
|
|
||||||
.choiceness_product_item {
|
.choiceness_product_item {
|
||||||
background: #FFFFFF;
|
background: #ffffff;
|
||||||
box-shadow: 0rpx 0rpx 10rpx 0rpx #EEEEEE;
|
box-shadow: 0rpx 0rpx 10rpx 0rpx #eeeeee;
|
||||||
border-radius: 24rpx;
|
border-radius: 24rpx;
|
||||||
width: 43%;
|
width: 43%;
|
||||||
margin-bottom: 20rpx;
|
margin-bottom: 20rpx;
|
||||||
padding: 20rpx;
|
padding: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.product_item_name {
|
.product_item_name {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
margin-top: 20rpx;
|
margin-top: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.product_item_price {
|
.product_item_price {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-top: 10rpx;
|
margin-top: 10rpx;
|
||||||
|
|
||||||
.price_ {
|
.price_ {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
color: $app-bt-bj;
|
color: $app-bt-bj;
|
||||||
}
|
}
|
||||||
|
|
||||||
.price_sell {
|
.price_sell {
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-size: 18rpx;
|
font-size: 18rpx;
|
||||||
color: #999999;
|
color: #999999;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,99 +1,124 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="custom-tab-bar">
|
<view class="custom-tab-bar" :class="platformType ? '' : 'iosplatformType'">
|
||||||
<view v-for="(item, index) in tabs" :key="index" class="tab-item" @click="switchTab(index)">
|
<view
|
||||||
<image :src="tabIndex === index ? item.selectedIconPath : item.iconPath" class="tab-icon"></image>
|
v-for="(item, index) in tabs"
|
||||||
<text :class="tabIndex === index ? 'tab-text tab-text-sel' : 'tab-text'">{{ item.text }}</text>
|
:key="index"
|
||||||
</view>
|
class="tab-item"
|
||||||
</view>
|
@click="switchTab(index)"
|
||||||
|
>
|
||||||
|
<image
|
||||||
|
:src="tabIndex === index ? item.selectedIconPath : item.iconPath"
|
||||||
|
class="tab-icon"
|
||||||
|
></image>
|
||||||
|
<text
|
||||||
|
:class="tabIndex === index ? 'tab-text tab-text-sel' : 'tab-text'"
|
||||||
|
>{{ item.text }}</text
|
||||||
|
>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: "custom-tab-bar",
|
name: "custom-tab-bar",
|
||||||
props: {
|
props: {
|
||||||
tabIndex: { //当前选中的tab项
|
tabIndex: {
|
||||||
type: Number,
|
//当前选中的tab项
|
||||||
default: 0
|
type: Number,
|
||||||
}
|
default: 0,
|
||||||
},
|
platformType: 0,
|
||||||
data() {
|
},
|
||||||
return {
|
},
|
||||||
tabs: [
|
data() {
|
||||||
{
|
return {
|
||||||
"pagePath": "/pages/home/home",
|
tabs: [
|
||||||
"text": "首页",
|
{
|
||||||
"iconPath": "/static/column/home.png",
|
pagePath: "/pages/home/home",
|
||||||
"selectedIconPath": "/static/column/home_sel.png"
|
text: "首页",
|
||||||
},
|
iconPath: "/static/column/home.png",
|
||||||
{
|
selectedIconPath: "/static/column/home_sel.png",
|
||||||
"pagePath": "/pages/sort/sort",
|
},
|
||||||
"text": "分类",
|
{
|
||||||
"iconPath": "/static/column/sort.png",
|
pagePath: "/pages/sort/sort",
|
||||||
"selectedIconPath": "/static/column/sort_sel.png"
|
text: "分类",
|
||||||
},
|
iconPath: "/static/column/sort.png",
|
||||||
{
|
selectedIconPath: "/static/column/sort_sel.png",
|
||||||
"pagePath": "/pages/supply_chain/supply_chain",
|
},
|
||||||
"text": "平价专区",
|
{
|
||||||
"iconPath": "/static/column/supply_chain.png",
|
pagePath: "/pages/supply_chain/supply_chain",
|
||||||
"selectedIconPath": "/static/column/supply_chain_sel.png"
|
text: "平价",
|
||||||
},
|
iconPath: "/static/column/supply_chain.png",
|
||||||
{
|
selectedIconPath: "/static/column/supply_chain_sel.png",
|
||||||
"pagePath": "/pages/shopping_cart/shopping_cart",
|
},
|
||||||
"text": "购物车",
|
{
|
||||||
"iconPath": "/static/column/shopping.png",
|
pagePath: "/pages/shopping_cart/shopping_cart",
|
||||||
"selectedIconPath": "/static/column/shopping_sel.png"
|
text: "购物车",
|
||||||
}, {
|
iconPath: "/static/column/shopping.png",
|
||||||
"pagePath": "/pages/mine/mine",
|
selectedIconPath: "/static/column/shopping_sel.png",
|
||||||
"text": "我的",
|
},
|
||||||
"iconPath": "/static/column/mine.png",
|
{
|
||||||
"selectedIconPath": "/static/column/mine_sel.png"
|
pagePath: "/pages/mine/mine",
|
||||||
}
|
text: "我的",
|
||||||
]
|
iconPath: "/static/column/mine.png",
|
||||||
};
|
selectedIconPath: "/static/column/mine_sel.png",
|
||||||
},
|
},
|
||||||
methods: {
|
],
|
||||||
switchTab(index) {
|
};
|
||||||
const pagePath = this.tabs[index].pagePath;
|
},
|
||||||
uni.switchTab({ url: pagePath });
|
created() {
|
||||||
}
|
/*#ifdef APP-PLUS*/
|
||||||
}
|
const appUpdate = uni.getStorageSync("platform");
|
||||||
}
|
this.platformType = appUpdate == "android" ? "ANDROID" : "IOS";
|
||||||
|
/*#endif*/
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
switchTab(index) {
|
||||||
|
const pagePath = this.tabs[index].pagePath;
|
||||||
|
uni.switchTab({ url: pagePath });
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.custom-tab-bar {
|
.custom-tab-bar {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-around;
|
justify-content: space-around;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
//height: 140rpx;
|
height: calc(100rpx + env(safe-area-inset-bottom));
|
||||||
/* 根据需要调整 */
|
/* 根据需要调整 */
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
/* 背景颜色 */
|
/* 背景颜色 */
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
padding-bottom: calc(env(safe-area-inset-bottom));
|
||||||
|
&.iosplatformType {
|
||||||
|
height: 100rpx;
|
||||||
|
padding-bottom: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab-item {
|
.tab-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab-icon {
|
.tab-icon {
|
||||||
margin-top: 5rpx;
|
margin-top: 5rpx;
|
||||||
width: 44rpx;
|
width: 44rpx;
|
||||||
/* 图标大小 */
|
/* 图标大小 */
|
||||||
height: 44rpx;
|
height: 44rpx;
|
||||||
/* 图标大小 */
|
/* 图标大小 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab-text {
|
.tab-text {
|
||||||
font-size: 24rpx
|
font-size: 24rpx;
|
||||||
/* 文字大小 */
|
/* 文字大小 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab-text-sel {
|
.tab-text-sel {
|
||||||
color: $app-bt-bj;
|
color: $app-bt-bj;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -532,7 +532,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"pagePath": "pages/supply_chain/supply_chain",
|
"pagePath": "pages/supply_chain/supply_chain",
|
||||||
"text": "平价商品",
|
"text": "平价",
|
||||||
"iconPath": "/static/column/supply_chain.png",
|
"iconPath": "/static/column/supply_chain.png",
|
||||||
"selectedIconPath": "/static/column/supply_chain_sel.png"
|
"selectedIconPath": "/static/column/supply_chain_sel.png"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="home_warp">
|
<view class="home_warp" :class="platformType ? '' :'iosplatformType'">
|
||||||
<!-- 带背景的头部 -->
|
<!-- 带背景的头部 -->
|
||||||
<view class="home_header_warp"></view>
|
<view class="home_header_warp"></view>
|
||||||
<view class="home_content_z_warp">
|
<view class="home_content_z_warp">
|
||||||
@@ -496,6 +496,9 @@ export default {
|
|||||||
height: calc(100vh - env(safe-area-inset-bottom)); // 是底部的导航栏高度
|
height: calc(100vh - env(safe-area-inset-bottom)); // 是底部的导航栏高度
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
&.iosplatformType{
|
||||||
|
height:100vh;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.home_header_warp {
|
.home_header_warp {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<view style="margin-left: 20rpx;">{{ item.phone }}</view>
|
<view style="margin-left: 20rpx;">{{ item.phone }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="address_item_address">
|
<view class="address_item_address">
|
||||||
{{ item.countryName }} {{ item.provinceName }} {{ item.cityName }} {{ item.areaName }} {{ item.address }}
|
{{ item.countryName }} {{ item.provinceName }} {{ item.cityName }} {{ item.areaName }} {{ item.address }}{{ item.townshipName }}
|
||||||
</view>
|
</view>
|
||||||
<view class="address_operate">
|
<view class="address_operate">
|
||||||
<up-checkbox :customStyle="{}" label="已默认" name="agree" usedAlone :checked="item.isDefault" shape="circle"
|
<up-checkbox :customStyle="{}" label="已默认" name="agree" usedAlone :checked="item.isDefault" shape="circle"
|
||||||
|
|||||||
@@ -121,6 +121,9 @@ export default {
|
|||||||
if (data.areaName) {
|
if (data.areaName) {
|
||||||
regionStr.push(data.areaName);
|
regionStr.push(data.areaName);
|
||||||
}
|
}
|
||||||
|
if (data.townshipName) {
|
||||||
|
regionStr.push(data.townshipName);
|
||||||
|
}
|
||||||
|
|
||||||
this.form.regionStr = regionStr;// 所属地区
|
this.form.regionStr = regionStr;// 所属地区
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,354 +1,416 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="sort_warp">
|
<view class="sort_warp" :class="platformType ? '' : 'iosplatformType'">
|
||||||
<view class="sort_header">
|
<view class="sort_header">
|
||||||
<!-- 分类切换 -->
|
<!-- 分类切换 -->
|
||||||
<view class="sort_category_header">
|
<view class="sort_category_header">
|
||||||
<view :class="selCategory === 1 ? 'category_item category_item_sel' : 'category_item'"
|
<view
|
||||||
@click="checkCategory(1)">
|
:class="
|
||||||
<view>分类</view>
|
selCategory === 1
|
||||||
<view v-if="selCategory === 1" class="category_item_sel_but"></view>
|
? 'category_item category_item_sel'
|
||||||
</view>
|
: 'category_item'
|
||||||
<!-- <view :class="selCategory === 2 ? 'category_item category_item_sel':'category_item'" @click="checkCategory(2)">
|
"
|
||||||
|
@click="checkCategory(1)"
|
||||||
|
>
|
||||||
|
<view>分类</view>
|
||||||
|
<view v-if="selCategory === 1" class="category_item_sel_but"></view>
|
||||||
|
</view>
|
||||||
|
<!-- <view :class="selCategory === 2 ? 'category_item category_item_sel':'category_item'" @click="checkCategory(2)">
|
||||||
<view>品牌</view>
|
<view>品牌</view>
|
||||||
<view v-if="selCategory === 2" class="category_item_sel_but"></view>
|
<view v-if="selCategory === 2" class="category_item_sel_but"></view>
|
||||||
</view> -->
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
<!-- 搜索 -->
|
<!-- 搜索 -->
|
||||||
<view style="width: 200rpx;" @click="jumpSearch">
|
<view style="width: 200rpx" @click="jumpSearch">
|
||||||
<up-search shape="square" bgColor="#EEEEEEFF" color="#666666FF" :showAction="false"
|
<up-search
|
||||||
placeholder="搜索"></up-search>
|
shape="square"
|
||||||
</view>
|
bgColor="#EEEEEEFF"
|
||||||
</view>
|
color="#666666FF"
|
||||||
<view class="u-menu-wrap">
|
:showAction="false"
|
||||||
<!-- 左侧类别 -->
|
placeholder="搜索"
|
||||||
<scroll-view scroll-y scroll-with-animation class="u-tab-view menu-scroll-view" :scroll-top="scrollTop">
|
></up-search>
|
||||||
<view v-for="(item, index) in tabbarList" :key="index" class="u-tab-item"
|
</view>
|
||||||
:class="[current == index ? 'u-tab-item-active' : '']" :data-current="index"
|
</view>
|
||||||
@tap.stop="swichMenu(item, index)">
|
<view class="u-menu-wrap">
|
||||||
<text class="u-line-1">{{ item.name }}</text>
|
<!-- 左侧类别 -->
|
||||||
</view>
|
<scroll-view
|
||||||
</scroll-view>
|
scroll-y
|
||||||
<!-- 商品类别数据 -->
|
scroll-with-animation
|
||||||
<scroll-view scroll-y class="right-box">
|
class="u-tab-view menu-scroll-view"
|
||||||
<!-- banner图 -->
|
:scroll-top="scrollTop"
|
||||||
<view style="padding: 0rpx 20rpx;">
|
>
|
||||||
<up-swiper :list="bannerList" height="80px"></up-swiper>
|
<view
|
||||||
</view>
|
v-for="(item, index) in tabbarList"
|
||||||
<view class="page-view">
|
:key="index"
|
||||||
<!-- 这里还有一层循环 -->
|
class="u-tab-item"
|
||||||
<up-loading-page :loading="tabbarContentLoading"></up-loading-page>
|
:class="[current == index ? 'u-tab-item-active' : '']"
|
||||||
<view class="class-item" v-for="(item, index) in tabbarContentList" :key="index">
|
:data-current="index"
|
||||||
<view class="item-title">
|
@tap.stop="swichMenu(item, index)"
|
||||||
<text>{{ item.name }}</text>
|
>
|
||||||
</view>
|
<text class="u-line-1">{{ item.name }}</text>
|
||||||
<view class="item-container" v-if="item.foods && item.foods.length !== 0">
|
</view>
|
||||||
<view class="thumb-box" v-for="(item1, index1) in item.foods" :key="index1" @click="jumpInfo(item1)">
|
</scroll-view>
|
||||||
<image class="item-menu-image" :src="item1.icon ? item1.icon : '/static/common/def_img.jpg'" mode="">
|
<!-- 商品类别数据 -->
|
||||||
</image>
|
<scroll-view scroll-y class="right-box">
|
||||||
<view class="item-menu-name">{{ item1.name }}</view>
|
<!-- banner图 -->
|
||||||
</view>
|
<view style="padding: 0rpx 20rpx">
|
||||||
</view>
|
<up-swiper :list="bannerList" height="80px"></up-swiper>
|
||||||
<view v-else class="not_order_warp">
|
</view>
|
||||||
<view class="not_order_warp_img"><up-image
|
<view class="page-view">
|
||||||
src="https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/not_shopping.png" width="100" height="100"
|
<!-- 这里还有一层循环 -->
|
||||||
bgColor="#f1f6ff00"></up-image></view>
|
<up-loading-page :loading="tabbarContentLoading"></up-loading-page>
|
||||||
<view class="not_order_msg_warp">暂无分类,快去添加吧~</view>
|
<view
|
||||||
</view>
|
class="class-item"
|
||||||
</view>
|
v-for="(item, index) in tabbarContentList"
|
||||||
</view>
|
:key="index"
|
||||||
</scroll-view>
|
>
|
||||||
</view>
|
<view class="item-title">
|
||||||
<!-- #ifndef H5 -->
|
<text>{{ item.name }}</text>
|
||||||
<CustomTabBar :tabIndex="1" />
|
</view>
|
||||||
<!-- #endif -->
|
<view
|
||||||
|
class="item-container"
|
||||||
</view>
|
v-if="item.foods && item.foods.length !== 0"
|
||||||
|
>
|
||||||
|
<view
|
||||||
|
class="thumb-box"
|
||||||
|
v-for="(item1, index1) in item.foods"
|
||||||
|
:key="index1"
|
||||||
|
@click="jumpInfo(item1)"
|
||||||
|
>
|
||||||
|
<image
|
||||||
|
class="item-menu-image"
|
||||||
|
:src="item1.icon ? item1.icon : '/static/common/def_img.jpg'"
|
||||||
|
mode=""
|
||||||
|
>
|
||||||
|
</image>
|
||||||
|
<view class="item-menu-name">{{ item1.name }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view v-else class="not_order_warp">
|
||||||
|
<view class="not_order_warp_img"
|
||||||
|
><up-image
|
||||||
|
src="https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/not_shopping.png"
|
||||||
|
width="100"
|
||||||
|
height="100"
|
||||||
|
bgColor="#f1f6ff00"
|
||||||
|
></up-image
|
||||||
|
></view>
|
||||||
|
<view class="not_order_msg_warp">暂无分类,快去添加吧~</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
</view>
|
||||||
|
<!-- #ifndef H5 -->
|
||||||
|
<CustomTabBar :tabIndex="1" />
|
||||||
|
<!-- #endif -->
|
||||||
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getCascadeCategory, getCarouselImage } from '@/api/common.js';
|
import { getCascadeCategory, getCarouselImage } from "@/api/common.js";
|
||||||
import CustomTabBar from '@/components/custom-tab-bar.vue';
|
import CustomTabBar from "@/components/custom-tab-bar.vue";
|
||||||
import { APP_PAGE_TYPE } from '@/utils/enumUtils.js'
|
import { APP_PAGE_TYPE } from "@/utils/enumUtils.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { CustomTabBar },
|
components: { CustomTabBar },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
selCategory: 1,
|
selCategory: 1,
|
||||||
scrollTop: 0, //tab标题的滚动条位置
|
scrollTop: 0, //tab标题的滚动条位置
|
||||||
current: null, // 预设当前项的值
|
current: null, // 预设当前项的值
|
||||||
menuHeight: 0, // 左边菜单的高度
|
menuHeight: 0, // 左边菜单的高度
|
||||||
menuItemHeight: 0, // 左边菜单item的高度
|
menuItemHeight: 0, // 左边菜单item的高度
|
||||||
bannerList: [],
|
bannerList: [],
|
||||||
tabbarList: [],// 左侧的主分类
|
tabbarList: [], // 左侧的主分类
|
||||||
tabbarContentList: [],// 右侧内容的分类
|
tabbarContentList: [], // 右侧内容的分类
|
||||||
tabbarContentLoading: false,
|
tabbarContentLoading: false,
|
||||||
}
|
platformType: true,
|
||||||
},
|
};
|
||||||
onShow() {
|
},
|
||||||
/*#ifdef APP-PLUS*/
|
onShow() {
|
||||||
uni.hideTabBar({
|
/*#ifdef APP-PLUS*/
|
||||||
animation: false
|
uni.hideTabBar({
|
||||||
})
|
animation: false,
|
||||||
/*#endif*/
|
});
|
||||||
const then = this;
|
const appUpdate = uni.getStorageSync("platform");
|
||||||
this.getSort(0).then(resp => {
|
this.platformType = appUpdate == "android" ? "ANDROID" : "IOS";
|
||||||
if (resp && resp.length !== 0) {
|
/*#endif*/
|
||||||
this.tabbarList = resp;
|
const then = this;
|
||||||
const sortId = uni.getStorageSync('sortId');
|
this.getSort(0).then((resp) => {
|
||||||
// 如果有默认的参数就默认选中参数
|
if (resp && resp.length !== 0) {
|
||||||
if (sortId && sortId !== 0) {
|
this.tabbarList = resp;
|
||||||
let fData = {};
|
const sortId = uni.getStorageSync("sortId");
|
||||||
let currentIndex = 0;
|
// 如果有默认的参数就默认选中参数
|
||||||
resp.map((item, index) => {
|
if (sortId && sortId !== 0) {
|
||||||
if (item.id === sortId) {
|
let fData = {};
|
||||||
fData = item;
|
let currentIndex = 0;
|
||||||
currentIndex = index;
|
resp.map((item, index) => {
|
||||||
return;
|
if (item.id === sortId) {
|
||||||
}
|
fData = item;
|
||||||
})
|
currentIndex = index;
|
||||||
this.swichMenu(fData, currentIndex);
|
return;
|
||||||
} else {
|
}
|
||||||
const fData = resp[0];
|
});
|
||||||
// 否则就选中第一个
|
this.swichMenu(fData, currentIndex);
|
||||||
this.swichMenu(fData, 0);
|
} else {
|
||||||
}
|
const fData = resp[0];
|
||||||
}
|
// 否则就选中第一个
|
||||||
});
|
this.swichMenu(fData, 0);
|
||||||
this.getCarouselImage();
|
}
|
||||||
},
|
}
|
||||||
methods: {
|
});
|
||||||
checkCategory(val) {
|
this.getCarouselImage();
|
||||||
this.selCategory = val;
|
},
|
||||||
},
|
methods: {
|
||||||
// 查询轮播图
|
checkCategory(val) {
|
||||||
async getCarouselImage() {
|
this.selCategory = val;
|
||||||
const params = {
|
},
|
||||||
pageUi: APP_PAGE_TYPE.SORT,
|
// 查询轮播图
|
||||||
}
|
async getCarouselImage() {
|
||||||
const resp = await getCarouselImage(params);
|
const params = {
|
||||||
if (resp && resp.bizcode === 100) {
|
pageUi: APP_PAGE_TYPE.SORT,
|
||||||
const data = resp.data || [];
|
};
|
||||||
this.bannerList = data.length !== 0 ? data.map(obj => obj.carouselImage) : [];
|
const resp = await getCarouselImage(params);
|
||||||
}
|
if (resp && resp.bizcode === 100) {
|
||||||
},
|
const data = resp.data || [];
|
||||||
jumpSearch(item) {
|
this.bannerList =
|
||||||
|
data.length !== 0 ? data.map((obj) => obj.carouselImage) : [];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
jumpSearch(item) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/rwa_package/dongjian/search",
|
||||||
|
});
|
||||||
|
},
|
||||||
|
jumpInfo(item) {
|
||||||
|
console.log(item, "item");
|
||||||
|
// uni.navigateTo({
|
||||||
|
// url: `/pages/other_package/productInfo/productInfo?id=${item.id}`,
|
||||||
|
// })
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/rwa_package/shop/sort-shop?id=${item.id}&name=${item.name}`,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 查询分类
|
||||||
|
async getSort(pId) {
|
||||||
|
const params = {
|
||||||
|
parentId: pId,
|
||||||
|
};
|
||||||
|
const resp = await getCascadeCategory(params);
|
||||||
|
if (resp && resp.bizcode === 100) {
|
||||||
|
return resp.data;
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
},
|
||||||
|
getImg() {
|
||||||
|
return Math.floor(Math.random() * 35);
|
||||||
|
},
|
||||||
|
// 点击左边的栏目切换
|
||||||
|
async swichMenu(item, index) {
|
||||||
|
if (index == this.current) return;
|
||||||
|
this.tabbarContentLoading = true;
|
||||||
|
const firstData = await this.getSort(item.id);
|
||||||
|
for (let fItem of firstData) {
|
||||||
|
const twoData = await this.getSort(fItem.id);
|
||||||
|
fItem.foods = twoData;
|
||||||
|
}
|
||||||
|
this.tabbarContentList = firstData;
|
||||||
|
this.current = index;
|
||||||
|
// 如果为0,意味着尚未初始化
|
||||||
|
if (this.menuHeight == 0 || this.menuItemHeight == 0) {
|
||||||
|
await this.getElRect("menu-scroll-view", "menuHeight");
|
||||||
|
await this.getElRect("u-tab-item", "menuItemHeight");
|
||||||
|
}
|
||||||
|
// 将菜单菜单活动item垂直居中
|
||||||
|
this.scrollTop =
|
||||||
|
index * this.menuItemHeight +
|
||||||
|
this.menuItemHeight / 2 -
|
||||||
|
this.menuHeight / 2;
|
||||||
|
this.tabbarContentLoading = false;
|
||||||
|
},
|
||||||
|
|
||||||
uni.navigateTo({
|
// 获取一个目标元素的高度
|
||||||
url: '/pages/rwa_package/dongjian/search',
|
getElRect(elClass, dataVal) {
|
||||||
})
|
new Promise((resolve, reject) => {
|
||||||
|
const query = uni.createSelectorQuery().in(this);
|
||||||
},
|
query
|
||||||
jumpInfo(item) {
|
.select("." + elClass)
|
||||||
console.log(item,'item');
|
.fields({ size: true }, (res) => {
|
||||||
// uni.navigateTo({
|
// 如果节点尚未生成,res值为null,循环调用执行
|
||||||
// url: `/pages/other_package/productInfo/productInfo?id=${item.id}`,
|
if (!res) {
|
||||||
// })
|
setTimeout(() => {
|
||||||
uni.navigateTo({
|
this.getElRect(elClass);
|
||||||
url:`/pages/rwa_package/shop/sort-shop?id=${item.id}&name=${item.name}`
|
}, 10);
|
||||||
})
|
return;
|
||||||
},
|
}
|
||||||
// 查询分类
|
this[dataVal] = res.height;
|
||||||
async getSort(pId) {
|
})
|
||||||
const params = {
|
.exec();
|
||||||
parentId: pId,
|
});
|
||||||
}
|
},
|
||||||
const resp = await getCascadeCategory(params);
|
},
|
||||||
if (resp && resp.bizcode === 100) {
|
};
|
||||||
return resp.data;
|
|
||||||
}
|
|
||||||
return [];
|
|
||||||
},
|
|
||||||
getImg() {
|
|
||||||
return Math.floor(Math.random() * 35);
|
|
||||||
},
|
|
||||||
// 点击左边的栏目切换
|
|
||||||
async swichMenu(item, index) {
|
|
||||||
if (index == this.current) return;
|
|
||||||
this.tabbarContentLoading = true;
|
|
||||||
const firstData = await this.getSort(item.id);
|
|
||||||
for (let fItem of firstData) {
|
|
||||||
const twoData = await this.getSort(fItem.id);
|
|
||||||
fItem.foods = twoData;
|
|
||||||
}
|
|
||||||
this.tabbarContentList = firstData;
|
|
||||||
this.current = index;
|
|
||||||
// 如果为0,意味着尚未初始化
|
|
||||||
if (this.menuHeight == 0 || this.menuItemHeight == 0) {
|
|
||||||
await this.getElRect('menu-scroll-view', 'menuHeight');
|
|
||||||
await this.getElRect('u-tab-item', 'menuItemHeight');
|
|
||||||
}
|
|
||||||
// 将菜单菜单活动item垂直居中
|
|
||||||
this.scrollTop = index * this.menuItemHeight + this.menuItemHeight / 2 - this.menuHeight / 2;
|
|
||||||
this.tabbarContentLoading = false;
|
|
||||||
},
|
|
||||||
|
|
||||||
// 获取一个目标元素的高度
|
|
||||||
getElRect(elClass, dataVal) {
|
|
||||||
new Promise((resolve, reject) => {
|
|
||||||
const query = uni.createSelectorQuery().in(this);
|
|
||||||
query.select('.' + elClass).fields({ size: true }, res => {
|
|
||||||
// 如果节点尚未生成,res值为null,循环调用执行
|
|
||||||
if (!res) {
|
|
||||||
setTimeout(() => {
|
|
||||||
this.getElRect(elClass);
|
|
||||||
}, 10);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this[dataVal] = res.height;
|
|
||||||
}).exec();
|
|
||||||
})
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.sort_warp {
|
.sort_warp {
|
||||||
padding: 130rpx 0rpx 0rpx;
|
padding: 130rpx 0rpx 0rpx;
|
||||||
height: calc(100vh - 270rpx); // 130 上边的导航栏,140下边的导航栏
|
height: calc(100vh - 270rpx); // 130 上边的导航栏,140下边的导航栏
|
||||||
|
&.iosplatformType {
|
||||||
|
.u-menu-wrap {
|
||||||
|
height: calc(100vh - 216rpx) !important;
|
||||||
|
}
|
||||||
|
.right-box {
|
||||||
|
padding-bottom: 100rpx !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.sort_header {
|
.sort_header {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding: 0 30rpx;
|
padding: 0 30rpx;
|
||||||
|
|
||||||
.sort_category_header {
|
.sort_category_header {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.category_item {
|
.category_item {
|
||||||
width: 140rpx;
|
width: 140rpx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 36rpx;
|
font-size: 36rpx;
|
||||||
color: #999999;
|
color: #999999;
|
||||||
}
|
}
|
||||||
|
|
||||||
.category_item_sel {
|
.category_item_sel {
|
||||||
font-size: 44rpx;
|
font-size: 44rpx;
|
||||||
color: #1A1A1A;
|
color: #1a1a1a;
|
||||||
}
|
}
|
||||||
|
|
||||||
.category_item_sel_but {
|
.category_item_sel_but {
|
||||||
height: 8rpx;
|
height: 8rpx;
|
||||||
width: 50rpx;
|
width: 50rpx;
|
||||||
background: $app-bt-bj;
|
background: $app-bt-bj;
|
||||||
margin-top: 4rpx;
|
margin-top: 4rpx;
|
||||||
margin-left: 12%;
|
margin-left: 12%;
|
||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.sort_content {}
|
.sort_content {
|
||||||
|
}
|
||||||
|
|
||||||
.u-menu-wrap {
|
.u-menu-wrap {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
margin-top: 20rpx;
|
margin-top: 20rpx;
|
||||||
height: calc(100vh - 216rpx - env(safe-area-inset-bottom));
|
height: calc(100vh - 216rpx - env(safe-area-inset-bottom));
|
||||||
}
|
}
|
||||||
|
|
||||||
.u-search-inner {
|
.u-search-inner {
|
||||||
background-color: rgb(234, 234, 234);
|
background-color: rgb(234, 234, 234);
|
||||||
border-radius: 100rpx;
|
border-radius: 100rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 10rpx 16rpx;
|
padding: 10rpx 16rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.u-search-text {
|
.u-search-text {
|
||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
color: $u-tips-color;
|
color: $u-tips-color;
|
||||||
margin-left: 10rpx;
|
margin-left: 10rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.u-tab-view {
|
.u-tab-view {
|
||||||
width: 200rpx;
|
width: 200rpx;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background: #f6f6f6;
|
background: #f6f6f6;
|
||||||
}
|
}
|
||||||
|
|
||||||
.u-tab-item {
|
.u-tab-item {
|
||||||
height: 110rpx;
|
height: 110rpx;
|
||||||
// background: #f6f6f6;
|
// background: #f6f6f6;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
color: #444;
|
color: #444;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.u-tab-item-active {
|
.u-tab-item-active {
|
||||||
position: relative;
|
position: relative;
|
||||||
color: #000;
|
color: #000;
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.u-tab-item-active::before {
|
.u-tab-item-active::before {
|
||||||
content: "";
|
content: "";
|
||||||
position: absolute;
|
position: absolute;
|
||||||
border-left: 4px solid $app-bt-bj;
|
border-left: 4px solid $app-bt-bj;
|
||||||
height: 32rpx;
|
height: 32rpx;
|
||||||
left: 0;
|
left: 0;
|
||||||
top: 39rpx;
|
top: 39rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.u-tab-view {
|
.u-tab-view {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.right-box {
|
.right-box {
|
||||||
background-color: rgb(250, 250, 250);
|
padding-bottom: calc(100rpx + env(safe-area-inset-bottom));
|
||||||
|
background-color: rgb(250, 250, 250);
|
||||||
}
|
}
|
||||||
|
|
||||||
.page-view {
|
.page-view {
|
||||||
padding: 16rpx;
|
padding: 16rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.class-item {
|
.class-item {
|
||||||
margin-bottom: 30rpx;
|
margin-bottom: 30rpx;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
padding: 16rpx;
|
padding: 16rpx;
|
||||||
border-radius: 8rpx;
|
border-radius: 8rpx;
|
||||||
|
&:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-title {
|
.item-title {
|
||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
color: $u-main-color;
|
color: $u-main-color;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-menu-name {
|
.item-menu-name {
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: $u-main-color;
|
color: $u-main-color;
|
||||||
margin-top: 10rpx;
|
margin-top: 10rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-container {
|
.item-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.thumb-box {
|
.thumb-box {
|
||||||
width: 33.333333%;
|
width: 33.333333%;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
margin-top: 20rpx;
|
margin-top: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-menu-image {
|
.item-menu-image {
|
||||||
width: 110rpx;
|
width: 110rpx;
|
||||||
height: 110rpx;
|
height: 110rpx;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 914 B After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 953 B After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 1.3 KiB |