feat:体验版发版
@@ -4,11 +4,15 @@
|
||||
<view class="ID_card_msg">(请务必上传本人证件照,生活照、艺术照将会被驳回)</view>
|
||||
<view class="ID_card_upload">
|
||||
<view class="upload_item" @click="phoneFun('Z')">
|
||||
<up-image :src="fileListZ && Object.keys(fileListZ).length !==0 ? fileListZ.accessUrl : '/static/common/ID_rx.png'" width="100%" height="90" bgColor="#f1f6ff00"></up-image>
|
||||
<up-image
|
||||
:src="fileListZ && Object.keys(fileListZ).length !== 0 ? fileListZ.accessUrl : 'https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/ID_rx.png'"
|
||||
width="100%" height="90" bgColor="#f1f6ff00"></up-image>
|
||||
<view class="upload_msg">点击上传身份证人像面</view>
|
||||
</view>
|
||||
<view class="upload_item" @click="phoneFun('F')">
|
||||
<up-image :src="fileListF && Object.keys(fileListF).length !==0 ? fileListF.accessUrl : '/static/common/ID_gq.png'" width="100%" height="90" bgColor="#f1f6ff00"></up-image>
|
||||
<up-image
|
||||
:src="fileListF && Object.keys(fileListF).length !== 0 ? fileListF.accessUrl : 'https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/ID_gq.png'"
|
||||
width="100%" height="90" bgColor="#f1f6ff00"></up-image>
|
||||
<view class="upload_msg">点击上传身份国旗面</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -18,8 +22,9 @@
|
||||
<view class="templ_img_item" v-for="item in uploadTemplList" :key="item.id">
|
||||
<up-image :src="item.url" width="100%" height="50" bgColor="#f1f6ff00"></up-image>
|
||||
<view class="templ_img_item_msg">
|
||||
<up-image :src="item.isOk ? '/static/common/ID_ok_1.png' :'/static/common/ID_error.png'" width="10" height="10" bgColor="#f1f6ff00"></up-image>
|
||||
<view class="templ_img_item_msg_title">{{item.title}}</view>
|
||||
<up-image :src="item.isOk ? '/static/common/ID_ok_1.png' : '/static/common/ID_error.png'" width="10"
|
||||
height="10" bgColor="#f1f6ff00"></up-image>
|
||||
<view class="templ_img_item_msg_title">{{ item.title }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -28,135 +33,133 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { uploadImage,uploadImg } from '@/api/common.js';
|
||||
import { IMG_TYPE } from '@/utils/enumUtils.js';
|
||||
import { BASE_URL,Authorization } from '@/utils/config.js';
|
||||
import {getStorageFun,TOKEN_NAME} from '@/utils/auth.js';
|
||||
|
||||
export default {
|
||||
name:"common_card",
|
||||
data() {
|
||||
return {
|
||||
uploadTemplList:[
|
||||
{
|
||||
id:1,
|
||||
title:"标准",
|
||||
isOk:true,
|
||||
url:"/static/common/ID_ok.png",
|
||||
},{
|
||||
id:2,
|
||||
title:"边框缺失",
|
||||
isOk:false,
|
||||
url:"/static/common/ID_error_1.png",
|
||||
},{
|
||||
id:3,
|
||||
title:"照片模糊",
|
||||
isOk:false,
|
||||
url:"/static/common/ID_error_2.png",
|
||||
},{
|
||||
id:4,
|
||||
title:"闪光强烈",
|
||||
isOk:false,
|
||||
url:"/static/common/ID_error_3.png",
|
||||
}
|
||||
],
|
||||
fileListZ:{},// 身份正面照
|
||||
fileListF:{},// 身份反面照片
|
||||
};
|
||||
|
||||
import { uploadImage, uploadImg } from '@/api/common.js';
|
||||
import { IMG_TYPE } from '@/utils/enumUtils.js';
|
||||
import { BASE_URL, Authorization } from '@/utils/config.js';
|
||||
import { getStorageFun, TOKEN_NAME } from '@/utils/auth.js';
|
||||
|
||||
export default {
|
||||
name: "common_card",
|
||||
data() {
|
||||
return {
|
||||
uploadTemplList: [
|
||||
{
|
||||
id: 1,
|
||||
title: "标准",
|
||||
isOk: true,
|
||||
url: "https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/ID_ok.png",
|
||||
}, {
|
||||
id: 2,
|
||||
title: "边框缺失",
|
||||
isOk: false,
|
||||
url: "https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/ID_error_1.png",
|
||||
}, {
|
||||
id: 3,
|
||||
title: "照片模糊",
|
||||
isOk: false,
|
||||
url: "https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/ID_error_2.png",
|
||||
}, {
|
||||
id: 4,
|
||||
title: "闪光强烈",
|
||||
isOk: false,
|
||||
url: "https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/ID_error_3.png",
|
||||
}
|
||||
],
|
||||
fileListZ: {},// 身份正面照
|
||||
fileListF: {},// 身份反面照片
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
deletePic(event) {
|
||||
this.fileListZ.splice(event.index, 1);
|
||||
},
|
||||
methods: {
|
||||
deletePic(event){
|
||||
this.fileListZ.splice(event.index, 1);
|
||||
},
|
||||
phoneFun(type){
|
||||
let that = this;
|
||||
/*#ifdef MP*/
|
||||
uni.chooseMedia({
|
||||
count: 1, // 默认为1,摄像头拍照为1,录像为10,录音为1
|
||||
mediaType: ['image'], // 可以指定是摄像头还是录像,这里两者都支持
|
||||
sourceType: ['camera'], // 可以指定来源是相册还是相机,这里只选相机
|
||||
camera: 'back', // 可以指定使用前置还是后置摄像头,默认后置
|
||||
success: (imgRes) => {
|
||||
// 成功则返回文件的本地临时文件路径
|
||||
const filePath = imgRes.tempFiles[0].tempFilePath; // 获取文件路径
|
||||
that.uploadFile(filePath,type);
|
||||
},
|
||||
fail: (err) => {
|
||||
// 处理错误
|
||||
console.error(err);
|
||||
phoneFun(type) {
|
||||
let that = this;
|
||||
/*#ifdef MP*/
|
||||
uni.chooseMedia({
|
||||
count: 1, // 默认为1,摄像头拍照为1,录像为10,录音为1
|
||||
mediaType: ['image'], // 可以指定是摄像头还是录像,这里两者都支持
|
||||
sourceType: ['camera'], // 可以指定来源是相册还是相机,这里只选相机
|
||||
camera: 'back', // 可以指定使用前置还是后置摄像头,默认后置
|
||||
success: (imgRes) => {
|
||||
// 成功则返回文件的本地临时文件路径
|
||||
const filePath = imgRes.tempFiles[0].tempFilePath; // 获取文件路径
|
||||
that.uploadFile(filePath, type);
|
||||
},
|
||||
fail: (err) => {
|
||||
// 处理错误
|
||||
console.error(err);
|
||||
}
|
||||
});
|
||||
/*#endif*/
|
||||
/*#ifdef APP-PLUS*/
|
||||
uni.chooseImage({
|
||||
count: 1, // 默认9,设置图片的数量
|
||||
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
||||
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
|
||||
success: function (res) {
|
||||
// 成功选择图片后
|
||||
const filePath = res.tempFilePaths[0]; // 获取文件路径
|
||||
that.uploadFile(filePath, type);
|
||||
}
|
||||
});
|
||||
/*#endif*/
|
||||
|
||||
},
|
||||
uploadFile(url, type) {
|
||||
uni.showLoading({
|
||||
title: '图片上传中...',
|
||||
})
|
||||
const that = this;
|
||||
const token = getStorageFun(TOKEN_NAME); // 获取token, 根据实际情况调整获取方式
|
||||
// 成功则返回文件的本地临时文件路径
|
||||
uni.uploadFile({
|
||||
url: BASE_URL + uploadImg, // 替换为你的上传接口URL
|
||||
filePath: url,
|
||||
name: 'file',
|
||||
formData: {
|
||||
'type': IMG_TYPE.COMMON,
|
||||
},
|
||||
header: {
|
||||
"Authorization": Authorization,
|
||||
'HSM-AUTH': token ? token : '',
|
||||
},
|
||||
success: (uploadFileRes) => {
|
||||
const data = JSON.parse(uploadFileRes.data);
|
||||
if (data.bizcode === 100) {
|
||||
if (type === "Z") {
|
||||
that.fileListZ = data.data;
|
||||
this.$emit("valueFunc", "Z", data.data.dbUrl);
|
||||
} else if (type === "F") {
|
||||
that.fileListF = data.data;
|
||||
this.$emit("valueFunc", "F", data.data.dbUrl);
|
||||
}
|
||||
});
|
||||
/*#endif*/
|
||||
/*#ifdef APP-PLUS*/
|
||||
uni.chooseImage({
|
||||
count: 1, // 默认9,设置图片的数量
|
||||
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
||||
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
|
||||
success: function (res) {
|
||||
// 成功选择图片后
|
||||
const filePath = res.tempFilePaths[0]; // 获取文件路径
|
||||
that.uploadFile(filePath,type);
|
||||
}
|
||||
});
|
||||
/*#endif*/
|
||||
|
||||
},
|
||||
uploadFile(url,type){
|
||||
uni.showLoading({
|
||||
title: '图片上传中...',
|
||||
})
|
||||
const that = this;
|
||||
const token = getStorageFun(TOKEN_NAME); // 获取token, 根据实际情况调整获取方式
|
||||
// 成功则返回文件的本地临时文件路径
|
||||
uni.uploadFile({
|
||||
url: BASE_URL+uploadImg, // 替换为你的上传接口URL
|
||||
filePath:url,
|
||||
name: 'file',
|
||||
formData: {
|
||||
'type': IMG_TYPE.COMMON,
|
||||
},
|
||||
header:{
|
||||
"Authorization":Authorization,
|
||||
'HSM-AUTH': token ? token : '',
|
||||
},
|
||||
success: (uploadFileRes) => {
|
||||
const data = JSON.parse(uploadFileRes.data);
|
||||
if(data.bizcode === 100){
|
||||
if(type === "Z"){
|
||||
that.fileListZ =data.data;
|
||||
this.$emit("valueFunc", "Z", data.data.dbUrl);
|
||||
}else if(type === "F"){
|
||||
that.fileListF=data.data;
|
||||
this.$emit("valueFunc", "F", data.data.dbUrl);
|
||||
}
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: '图片上传失败',
|
||||
icon: 'none',
|
||||
mask: true,
|
||||
duration:3000,
|
||||
})
|
||||
}
|
||||
},
|
||||
fail: (uploadFileErr) => {
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '图片上传失败',
|
||||
icon: 'none',
|
||||
mask: true,
|
||||
duration:3000,
|
||||
duration: 3000,
|
||||
})
|
||||
},
|
||||
complete: (res) => {
|
||||
// 请求完成以后做一些事情
|
||||
uni.hideLoading();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: (uploadFileErr) => {
|
||||
uni.showToast({
|
||||
title: '图片上传失败',
|
||||
icon: 'none',
|
||||
mask: true,
|
||||
duration: 3000,
|
||||
})
|
||||
},
|
||||
complete: (res) => {
|
||||
// 请求完成以后做一些事情
|
||||
uni.hideLoading();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
<style></style>
|
||||
@@ -8,8 +8,8 @@
|
||||
style="width: 100%; height: 100%" />
|
||||
</template>
|
||||
<template v-slot:pointer>
|
||||
<up-image src="/static/turntable/zz.png" width="40" height="40" mode="widthFix"
|
||||
@click="startWheel"></up-image>
|
||||
<up-image src="https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/zz.png" width="40" height="40"
|
||||
mode="widthFix" @click="startWheel"></up-image>
|
||||
</template>
|
||||
</dengbo-lotteryWheel>
|
||||
</view>
|
||||
@@ -20,7 +20,7 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
lightImages: ['/static/turntable/zz.png', 'https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/turntable.png'],
|
||||
lightImages: ['https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/zz.png', 'https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/turntable.png'],
|
||||
prizes: [{
|
||||
name: '积分',
|
||||
image: '/static/turntable/record.png',
|
||||
|
||||
@@ -76,22 +76,22 @@ export default {
|
||||
id: 1,
|
||||
title: "标准",
|
||||
isOk: true,
|
||||
url: "/static/common/ID_ok.png",
|
||||
url: "https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/ID_ok.png",
|
||||
}, {
|
||||
id: 2,
|
||||
title: "边框缺失",
|
||||
isOk: false,
|
||||
url: "/static/common/ID_error_1.png",
|
||||
url: "https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/ID_error_1.png",
|
||||
}, {
|
||||
id: 3,
|
||||
title: "照片模糊",
|
||||
isOk: false,
|
||||
url: "/static/common/ID_error_2.png",
|
||||
url: "https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/ID_error_2.png",
|
||||
}, {
|
||||
id: 4,
|
||||
title: "闪光强烈",
|
||||
isOk: false,
|
||||
url: "/static/common/ID_error_3.png",
|
||||
url: "https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/ID_error_3.png",
|
||||
}
|
||||
],
|
||||
certShow: false,
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
style="width: 100%; height: 100%;" />
|
||||
</template>
|
||||
<template v-slot:pointer>
|
||||
<image src="/static/turntable/zz.png" style="width: 50px; height: 50px;" mode="widthFix"
|
||||
@click="startClick(1)" />
|
||||
<image src="https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/zz.png"
|
||||
style="width: 50px; height: 50px;" mode="widthFix" @click="startClick(1)" />
|
||||
</template>
|
||||
</dengbo-lotteryWheel>
|
||||
</view>
|
||||
@@ -71,7 +71,7 @@ import { getActivityList, raffleExecute } from '@/api/raffle.js';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
lightImages: ['/static/turntable/bg_bs.png', '/static/turntable/bg_hs.png'],
|
||||
lightImages: ['https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/bg_bs.png', 'https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/bg_hs.png'],
|
||||
prizesObj: {},
|
||||
prizes: [],
|
||||
lotteryList: [],// 中奖的列表ID
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<template>
|
||||
<view>
|
||||
<view :style="{ 'height': isDataNull ? 'calc(100vh - 134rpx)' : 'calc(100vh - 410rpx)' }" class="shopping_cart_warp">
|
||||
<view :style="{ 'height': isDataNull ? 'calc(100vh - 134rpx)' : 'calc(100vh - 410rpx)' }"
|
||||
class="shopping_cart_warp">
|
||||
<view class="shopping_cart_header">
|
||||
<view class="cart">购物车({{ shoppingTotal }})</view>
|
||||
<view class="enit_but" @click="isEdit = true" v-if="!isEdit" v-show="!isDataNull">编辑</view>
|
||||
@@ -9,10 +10,12 @@
|
||||
<!-- 购物车列表 -->
|
||||
<up-loading-page :loading="listLoading"></up-loading-page>
|
||||
<view class="shopping_cart_content">
|
||||
<view v-if="!isDataNull" class="shopping_cart_content_item" v-for="(item, index) in shoppingList" :key="item.id">
|
||||
<view v-if="!isDataNull" class="shopping_cart_content_item" v-for="(item, index) in shoppingList"
|
||||
:key="item.id">
|
||||
<!-- 店铺头部 -->
|
||||
<up-checkbox :customStyle="{ marginBottom: '8px' }" name="isCheck" usedAlone v-model:checked="item.isCheck"
|
||||
shape="circle" activeColor="#7934F6" size="19" iconSize="18" @change="(event) => shoppingChange(event, index)">
|
||||
shape="circle" activeColor="#7934F6" size="19" iconSize="18"
|
||||
@change="(event) => shoppingChange(event, index)">
|
||||
<template #label>
|
||||
<view class="content_item_header">
|
||||
<up-image :src="item.shopLogo ? item.shopLogo : '/static/shopping/store.png'" width="22" height="22"
|
||||
@@ -25,8 +28,8 @@
|
||||
<view>
|
||||
<view class="content_item_info" v-for="(pItem, pIndex) in item.product" :key="pItem.id">
|
||||
<!-- 单个商品 -->
|
||||
<up-checkbox :customStyle="{ marginBottom: '8px' }" name="isCheck" usedAlone v-model:checked="pItem.isCheck"
|
||||
shape="circle" activeColor="#7934F6" size="19" iconSize="18"
|
||||
<up-checkbox :customStyle="{ marginBottom: '8px' }" name="isCheck" usedAlone
|
||||
v-model:checked="pItem.isCheck" shape="circle" activeColor="#7934F6" size="19" iconSize="18"
|
||||
:disabled="!isEdit && [1, 2].includes(pItem.goodsStatus)"
|
||||
@change="(event) => productChange(event, index, pIndex)">
|
||||
</up-checkbox>
|
||||
@@ -62,7 +65,8 @@
|
||||
</view>
|
||||
</view>
|
||||
<view v-else class="not_order_warp">
|
||||
<up-image src="/static/common/not_shopping.png" width="80" height="80" bgColor="#f1f6ff00"></up-image>
|
||||
<up-image src="https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/not_shopping.png" width="80" height="80"
|
||||
bgColor="#f1f6ff00"></up-image>
|
||||
<view class="not_order_msg_warp">购物车是空的</view>
|
||||
</view>
|
||||
<choiceness />
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<view class="sort_header">
|
||||
<!-- 分类切换 -->
|
||||
<view class="sort_category_header">
|
||||
<view :class="selCategory === 1 ? 'category_item category_item_sel':'category_item'" @click="checkCategory(1)">
|
||||
<view :class="selCategory === 1 ? 'category_item category_item_sel' : 'category_item'" @click="checkCategory(1)">
|
||||
<view>分类</view>
|
||||
<view v-if="selCategory === 1" class="category_item_sel_but"></view>
|
||||
</view>
|
||||
@@ -14,335 +14,329 @@
|
||||
</view>
|
||||
<!-- 搜索 -->
|
||||
<view style="width: 200rpx;" @click="jumpSearch">
|
||||
<up-search
|
||||
shape="square"
|
||||
bgColor="#EEEEEEFF"
|
||||
color="#666666FF"
|
||||
:showAction="false"
|
||||
placeholder="搜索"
|
||||
></up-search>
|
||||
<up-search shape="square" bgColor="#EEEEEEFF" color="#666666FF" :showAction="false"
|
||||
placeholder="搜索"></up-search>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-menu-wrap">
|
||||
<!-- 左侧类别 -->
|
||||
<scroll-view scroll-y scroll-with-animation class="u-tab-view menu-scroll-view" :scroll-top="scrollTop">
|
||||
<view v-for="(item,index) in tabbarList" :key="index" class="u-tab-item" :class="[current==index ? 'u-tab-item-active' : '']"
|
||||
:data-current="index" @tap.stop="swichMenu(item,index)">
|
||||
<text class="u-line-1">{{item.name}}</text>
|
||||
<view v-for="(item, index) in tabbarList" :key="index" class="u-tab-item"
|
||||
:class="[current == index ? 'u-tab-item-active' : '']" :data-current="index" @tap.stop="swichMenu(item, index)">
|
||||
<text class="u-line-1">{{ item.name }}</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<!-- 商品类别数据 -->
|
||||
<scroll-view scroll-y class="right-box">
|
||||
<!-- banner图 -->
|
||||
<view style="padding: 0rpx 20rpx;">
|
||||
<up-swiper
|
||||
:list="bannerList"
|
||||
height="80px"
|
||||
></up-swiper>
|
||||
<up-swiper :list="bannerList" height="80px"></up-swiper>
|
||||
</view>
|
||||
<view class="page-view">
|
||||
<!-- 这里还有一层循环 -->
|
||||
<up-loading-page :loading="tabbarContentLoading"></up-loading-page>
|
||||
<view class="class-item" v-for="(item,index) in tabbarContentList" :key="index">
|
||||
<view class="class-item" v-for="(item, index) in tabbarContentList" :key="index">
|
||||
<view class="item-title">
|
||||
<text>{{item.name}}</text>
|
||||
<text>{{ item.name }}</text>
|
||||
</view>
|
||||
<view class="item-container" v-if="item.foods && item.foods.length !==0">
|
||||
<view
|
||||
class="thumb-box"
|
||||
v-for="(item1, index1) in item.foods"
|
||||
:key="index1"
|
||||
@click="jumpSearch(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 class="item-container" v-if="item.foods && item.foods.length !== 0">
|
||||
<view class="thumb-box" v-for="(item1, index1) in item.foods" :key="index1" @click="jumpSearch(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="/static/common/not_shopping.png" width="100" height="100" bgColor="#f1f6ff00"></up-image></view>
|
||||
<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>
|
||||
<CustomTabBar :tabIndex="1"/>
|
||||
<CustomTabBar :tabIndex="1" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getCascadeCategory,getCarouselImage } from '@/api/common.js';
|
||||
import CustomTabBar from '@/components/custom-tab-bar.vue';
|
||||
import { APP_PAGE_TYPE } from '@/utils/enumUtils.js'
|
||||
import { getCascadeCategory, getCarouselImage } from '@/api/common.js';
|
||||
import CustomTabBar from '@/components/custom-tab-bar.vue';
|
||||
import { APP_PAGE_TYPE } from '@/utils/enumUtils.js'
|
||||
|
||||
export default {
|
||||
components:{CustomTabBar},
|
||||
data() {
|
||||
return {
|
||||
selCategory:1,
|
||||
scrollTop: 0, //tab标题的滚动条位置
|
||||
current: null, // 预设当前项的值
|
||||
menuHeight: 0, // 左边菜单的高度
|
||||
menuItemHeight: 0, // 左边菜单item的高度
|
||||
bannerList:[],
|
||||
tabbarList:[],// 左侧的主分类
|
||||
tabbarContentList:[],// 右侧内容的分类
|
||||
tabbarContentLoading:false,
|
||||
export default {
|
||||
components: { CustomTabBar },
|
||||
data() {
|
||||
return {
|
||||
selCategory: 1,
|
||||
scrollTop: 0, //tab标题的滚动条位置
|
||||
current: null, // 预设当前项的值
|
||||
menuHeight: 0, // 左边菜单的高度
|
||||
menuItemHeight: 0, // 左边菜单item的高度
|
||||
bannerList: [],
|
||||
tabbarList: [],// 左侧的主分类
|
||||
tabbarContentList: [],// 右侧内容的分类
|
||||
tabbarContentLoading: false,
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
/*#ifdef APP-PLUS*/
|
||||
uni.hideTabBar({
|
||||
animation: false
|
||||
})
|
||||
/*#endif*/
|
||||
const then = this;
|
||||
this.getSort(0).then(resp => {
|
||||
if (resp && resp.length !== 0) {
|
||||
this.tabbarList = resp;
|
||||
const sortId = uni.getStorageSync('sortId');
|
||||
// 如果有默认的参数就默认选中参数
|
||||
if (sortId && sortId !== 0) {
|
||||
let fData = {};
|
||||
let currentIndex = 0;
|
||||
resp.map((item, index) => {
|
||||
if (item.id === sortId) {
|
||||
fData = item;
|
||||
currentIndex = index;
|
||||
return;
|
||||
}
|
||||
})
|
||||
this.swichMenu(fData, currentIndex);
|
||||
} else {
|
||||
const fData = resp[0];
|
||||
// 否则就选中第一个
|
||||
this.swichMenu(fData, 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
this.getCarouselImage();
|
||||
},
|
||||
methods: {
|
||||
checkCategory(val) {
|
||||
this.selCategory = val;
|
||||
},
|
||||
// 查询轮播图
|
||||
async getCarouselImage() {
|
||||
const params = {
|
||||
pageUi: APP_PAGE_TYPE.SORT,
|
||||
}
|
||||
const resp = await getCarouselImage(params);
|
||||
if (resp && resp.bizcode === 100) {
|
||||
const data = resp.data || [];
|
||||
this.bannerList = data.length !== 0 ? data.map(obj => obj.carouselImage) : [];
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
/*#ifdef APP-PLUS*/
|
||||
uni.hideTabBar({
|
||||
animation: false
|
||||
})
|
||||
/*#endif*/
|
||||
const then = this;
|
||||
this.getSort(0).then(resp=>{
|
||||
if(resp && resp.length !==0){
|
||||
this.tabbarList = resp;
|
||||
const sortId = uni.getStorageSync('sortId');
|
||||
// 如果有默认的参数就默认选中参数
|
||||
if(sortId && sortId !==0){
|
||||
let fData = {};
|
||||
let currentIndex = 0;
|
||||
resp.map((item,index)=>{
|
||||
if(item.id === sortId){
|
||||
fData = item;
|
||||
currentIndex = index;
|
||||
return;
|
||||
}
|
||||
})
|
||||
this.swichMenu(fData,currentIndex);
|
||||
}else{
|
||||
const fData = resp[0];
|
||||
// 否则就选中第一个
|
||||
this.swichMenu(fData,0);
|
||||
}
|
||||
}
|
||||
});
|
||||
this.getCarouselImage();
|
||||
jumpSearch(item) {
|
||||
let path = "/pages/other_package/search/search";
|
||||
if (item && Object.keys(item).length !== 0) {
|
||||
path = path + "?keyword=" + item.name;
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: path,
|
||||
})
|
||||
},
|
||||
// 查询分类
|
||||
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;
|
||||
},
|
||||
methods: {
|
||||
checkCategory(val){
|
||||
this.selCategory = val;
|
||||
},
|
||||
// 查询轮播图
|
||||
async getCarouselImage(){
|
||||
const params={
|
||||
pageUi:APP_PAGE_TYPE.SORT,
|
||||
}
|
||||
const resp = await getCarouselImage(params);
|
||||
if(resp && resp.bizcode === 100){
|
||||
const data = resp.data || [];
|
||||
this.bannerList = data.length !== 0 ? data.map(obj=>obj.carouselImage) : [];
|
||||
}
|
||||
},
|
||||
jumpSearch(item){
|
||||
let path = "/pages/other_package/search/search";
|
||||
if(item && Object.keys(item).length !==0){
|
||||
path = path+"?keyword="+item.name;
|
||||
}
|
||||
uni.navigateTo({
|
||||
url:path,
|
||||
})
|
||||
},
|
||||
// 查询分类
|
||||
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;
|
||||
},
|
||||
|
||||
// 获取一个目标元素的高度
|
||||
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();
|
||||
})
|
||||
},
|
||||
// 获取一个目标元素的高度
|
||||
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>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.sort_warp{
|
||||
padding: 130rpx 0rpx 0rpx;
|
||||
height: calc(100vh - 270rpx);// 130 上边的导航栏,140下边的导航栏
|
||||
}
|
||||
.sort_header{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 0 30rpx;
|
||||
.sort_category_header{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.category_item{
|
||||
width: 140rpx;
|
||||
font-weight: bold;
|
||||
font-size: 36rpx;
|
||||
color: #999999;
|
||||
}
|
||||
.category_item_sel{
|
||||
font-size: 44rpx;
|
||||
color: #1A1A1A;
|
||||
}
|
||||
.category_item_sel_but{
|
||||
height: 8rpx;
|
||||
width: 50rpx;
|
||||
background: $app-bt-bj;
|
||||
margin-top: 4rpx;
|
||||
margin-left: 12%;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
}
|
||||
.sort_warp {
|
||||
padding: 130rpx 0rpx 0rpx;
|
||||
height: calc(100vh - 270rpx); // 130 上边的导航栏,140下边的导航栏
|
||||
}
|
||||
|
||||
.sort_content{
|
||||
.sort_header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 0 30rpx;
|
||||
|
||||
}
|
||||
.u-menu-wrap {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
overflow: hidden;
|
||||
margin-top: 20rpx;
|
||||
height: calc(100vh - 356rpx);
|
||||
}
|
||||
|
||||
.u-search-inner {
|
||||
background-color: rgb(234, 234, 234);
|
||||
border-radius: 100rpx;
|
||||
.sort_category_header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 10rpx 16rpx;
|
||||
}
|
||||
|
||||
.u-search-text {
|
||||
font-size: 26rpx;
|
||||
color: $u-tips-color;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
|
||||
.u-tab-view {
|
||||
width: 200rpx;
|
||||
height: 100%;
|
||||
background: #f6f6f6;
|
||||
}
|
||||
|
||||
.u-tab-item {
|
||||
height: 110rpx;
|
||||
// background: #f6f6f6;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 26rpx;
|
||||
color: #444;
|
||||
font-weight: 400;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.u-tab-item-active {
|
||||
position: relative;
|
||||
color: #000;
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.u-tab-item-active::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
border-left: 4px solid $app-bt-bj;
|
||||
height: 32rpx;
|
||||
left: 0;
|
||||
top: 39rpx;
|
||||
}
|
||||
|
||||
.u-tab-view {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.right-box {
|
||||
background-color: rgb(250, 250, 250);
|
||||
}
|
||||
|
||||
.page-view {
|
||||
padding: 16rpx;
|
||||
}
|
||||
|
||||
.class-item {
|
||||
margin-bottom: 30rpx;
|
||||
background-color: #fff;
|
||||
padding: 16rpx;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.item-title {
|
||||
font-size: 26rpx;
|
||||
color: $u-main-color;
|
||||
.category_item {
|
||||
width: 140rpx;
|
||||
font-weight: bold;
|
||||
font-size: 36rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.item-menu-name {
|
||||
font-weight: normal;
|
||||
font-size: 24rpx;
|
||||
color: $u-main-color;
|
||||
margin-top: 10rpx;
|
||||
.category_item_sel {
|
||||
font-size: 44rpx;
|
||||
color: #1A1A1A;
|
||||
}
|
||||
|
||||
.item-container {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
.category_item_sel_but {
|
||||
height: 8rpx;
|
||||
width: 50rpx;
|
||||
background: $app-bt-bj;
|
||||
margin-top: 4rpx;
|
||||
margin-left: 12%;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.thumb-box {
|
||||
width: 33.333333%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
.sort_content {}
|
||||
|
||||
.item-menu-image {
|
||||
width: 110rpx;
|
||||
height: 110rpx;
|
||||
}
|
||||
.u-menu-wrap {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
overflow: hidden;
|
||||
margin-top: 20rpx;
|
||||
height: calc(100vh - 356rpx);
|
||||
}
|
||||
|
||||
.u-search-inner {
|
||||
background-color: rgb(234, 234, 234);
|
||||
border-radius: 100rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 10rpx 16rpx;
|
||||
}
|
||||
|
||||
.u-search-text {
|
||||
font-size: 26rpx;
|
||||
color: $u-tips-color;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
|
||||
.u-tab-view {
|
||||
width: 200rpx;
|
||||
height: 100%;
|
||||
background: #f6f6f6;
|
||||
}
|
||||
|
||||
.u-tab-item {
|
||||
height: 110rpx;
|
||||
// background: #f6f6f6;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 26rpx;
|
||||
color: #444;
|
||||
font-weight: 400;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.u-tab-item-active {
|
||||
position: relative;
|
||||
color: #000;
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.u-tab-item-active::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
border-left: 4px solid $app-bt-bj;
|
||||
height: 32rpx;
|
||||
left: 0;
|
||||
top: 39rpx;
|
||||
}
|
||||
|
||||
.u-tab-view {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.right-box {
|
||||
background-color: rgb(250, 250, 250);
|
||||
}
|
||||
|
||||
.page-view {
|
||||
padding: 16rpx;
|
||||
}
|
||||
|
||||
.class-item {
|
||||
margin-bottom: 30rpx;
|
||||
background-color: #fff;
|
||||
padding: 16rpx;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.item-title {
|
||||
font-size: 26rpx;
|
||||
color: $u-main-color;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.item-menu-name {
|
||||
font-weight: normal;
|
||||
font-size: 24rpx;
|
||||
color: $u-main-color;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
|
||||
.item-container {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.thumb-box {
|
||||
width: 33.333333%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.item-menu-image {
|
||||
width: 110rpx;
|
||||
height: 110rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
Before Width: | Height: | Size: 7.4 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 99 KiB |