| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578 |
- <template>
- <view class="sidebar-wrap">
- <up-popup
- mode="left"
- :show="show"
- :safeAreaInsetTop="false"
- :safeAreaInsetBottom="false"
- @close="close"
- @open="open"
- zIndex="99999"
- :customStyle="{ backgroundColor: '#fafafa' }"
- >
- <view class="list-wrap">
- <up-list height="100%">
- <up-list-item
- height="50"
- v-for="(item, index) in indexList"
- :key="index"
- >
- <view :class="['navigator-box', item.open ? 'open' : '']">
- <!-- 跳转链接行 -->
- <navigator
- v-if="item.type === 'navigator'"
- :render-link="false"
- class="navigator-link"
- hover-class="none"
- :url="item.url"
- >
- <view class="title">
- <uni-icons
- customPrefix="iconfont"
- :class="[item.icon, 'item-icon']"
- size="20"
- color="#f8c007"
- ></uni-icons>
- <text class="item-text">{{ item.name }}</text>
- </view>
- <view v-if="item.type === 'collapse'" class="arrow-icon">
- <uni-icons type="down" size="20"></uni-icons>
- </view>
- </navigator>
- <!-- 折叠行 -->
- <view
- v-else
- class="navigator-link collapse-row"
- @click="handleCollapse(item)"
- >
- <view class="title">
- <uni-icons
- customPrefix="iconfont"
- :class="[item.icon, 'item-icon']"
- size="20"
- color="#f8c007"
- ></uni-icons>
- <text class="item-text">{{ item.name }}</text>
- </view>
- <view v-if="item.type === 'collapse'" class="arrow-icon">
- <uni-icons type="down" size="20"></uni-icons>
- </view>
- </view>
- <!-- 折叠内容 -->
- <view class="collapse-content" v-if="item.type === 'collapse'">
- <navigator
- v-for="subItem in item.child"
- :render-link="false"
- class="navigator-link sub-link"
- hover-class="none"
- :url="subItem.url"
- :key="subItem.url"
- >
- <view class="title">
- <text class="item-text subItem-text">{{
- subItem.name
- }}</text>
- </view>
- </navigator>
- </view>
- </view>
- </up-list-item>
- <view class="white-box"></view>
- </up-list>
- </view>
- <view class="footer-box">
- <navigator
- :url="item.url"
- class="item-box"
- v-for="item in footerList"
- :key="item.url"
- >
- <view class="icon-box">
- <uni-icons
- :size="item.size"
- color="#ffffff"
- customPrefix="iconfont"
- :type="item.icon"
- ></uni-icons>
- </view>
- <view class="name">{{ item.label }}</view>
- </navigator>
- </view>
- </up-popup>
- </view>
- </template>
- <script setup>
- import { ref, nextTick, computed, watchEffect, onMounted, watch } from "vue";
- // import { onHide } from "@dcloudio/uni-app";
- import { useAppStore } from "@/stores/app";
- import { useSliderStore } from "@/stores/slider";
- const appStore = useAppStore();
- // 获取slider 的状态
- const sliderStore = useSliderStore();
- const indexList = ref([]);
- const isSvip = computed(() => {
- return appStore.isLogin && appStore?.$userInfo?.svip;
- });
- watchEffect(() => {
- getIndexList();
- });
- let timer = null;
- // slider显示逻辑
- const show = ref(sliderStore.sidebarShow);
- onMounted(() => {
- show.value = sliderStore.sidebarShow;
- });
- watch(
- show,
- (newVal) => {
- sliderStore.updateSidebarShow(newVal);
- },
- { immediate: true }
- );
- watch(
- () => sliderStore.sidebarShow,
- (newVal) => {
- show.value = newVal;
- }
- );
- const emit = defineEmits(["open", "close"]);
- const footerList = [
- {
- url: "/pages/users/customer_service_message/index",
- icon: "icon-kefu2",
- label: "客服",
- size: 30,
- },
- {
- url: "/pages/users/setting/index",
- icon: "icon-shezhi",
- label: "设置",
- size: 24,
- },
- ];
- function getIndexList() {
- indexList.value = [
- // {
- // name: "设置主题色",
- // icon: "icon-wodedingdan",
- // type: "navigator",
- // url: "/pages/user/themeDebug",
- // },
- // {
- // name: "新商城",
- // icon: "icon-gouwuche",
- // type: "navigator",
- // url: "/pages/mall/index",
- // },
- {
- name: "我的订单",
- type: "collapse",
- icon: "icon-changyonggongneng",
- open: false,
- child: [
- {
- name: "商城订单",
- icon: "",
- type: "navigator",
- url: "/pages/order_list/index",
- },
- {
- name: "邮寄存金",
- icon: "",
- type: "navigator",
- url: "/pages/users/vault/storeMetal/order",
- },
- {
- name: "约价回收",
- icon: "",
- type: "navigator",
- url: "/pages/users/vault/recycle/recyle_order",
- },
- {
- name: "秒杀订单",
- icon: "",
- type: "navigator",
- url: "/pages/users/utils/flashSale/order",
- },
- {
- name: "定制订单",
- icon: "",
- type: "navigator",
- url: "/pages/users/utils/factory/orderList",
- },
- // {
- // name: "换款订单",
- // icon: "",
- // type: "navigator",
- // url: "/pages/users/new_live_exchange/tradeOrderFormOrder",
- // },
- // {
- // name: "团购订单",
- // icon: "",
- // type: "navigator",
- // url: "/pages/group_buying/order",
- // },
- ],
- },
- {
- name: "购物车",
- icon: "icon-gouwuche1",
- type: "navigator",
- url: "/pages/order_addcart/order_addcart",
- },
- {
- name: "买卖料",
- icon: "icon-jinku",
- type: "collapse",
- open: false,
- child: [
- {
- name: "充值",
- icon: "",
- type: "navigator",
- url: "/pages/users/vault/recharge",
- },
- {
- name: "提现",
- icon: "",
- type: "navigator",
- url: "/pages/users/vault/withdraw",
- },
- {
- name: "买料",
- icon: "",
- type: "navigator",
- url: "/pages/users/vault/buy",
- },
- {
- name: "卖料",
- icon: "",
- type: "navigator",
- url: "/pages/users/vault/storeMetal/index",
- },
- {
- name: "存料",
- icon: "",
- type: "navigator",
- url: "/pages/users/vault/storeMetal/goldBullionStock",
- },
- {
- name: "提料",
- icon: "",
- type: "navigator",
- url: "/pages/users/vault/storeMetal/metalExchange",
- },
- ],
- },
- {
- name: "钱包",
- icon: "icon-licai",
- type: "navigator",
- url: "/pages/users/vault/index",
- },
- // {
- // name: "钱包",
- // icon: "icon-licai",
- // type: "navigator",
- // url: "/pages/users/vault/newIndex",
- // },
- // {
- // name: "金价预警",
- // icon: "icon-yujing",
- // type: "navigator",
- // url: "/pages/users/gold_price_warning/index",
- // },
- {
- name: "常用功能",
- type: "collapse",
- icon: "icon-changyonggongneng",
- open: false,
- child: [
- // {
- // name: "每日一攒",
- // icon: "",
- // type: "navigator",
- // url: "/pages/users/accumulate_gold/index",
- // },
- // {
- // name: "直播换款",
- // icon: "",
- // type: "navigator",
- // url: "/pages/users/new_live_exchange/index",
- // },
- {
- name: "每日一攒",
- icon: "",
- type: "navigator",
- url: "/pages/users/accumulate_gold/newIndex",
- },
- // {
- // name: "福利秒杀",
- // icon: "",
- // type: "navigator",
- // url: "/pages/users/utils/flashSale/newIndex",
- // },
- ],
- },
- {
- name: "超级工具",
- type: "collapse",
- icon: "icon-chaojigongju",
- open: false,
- child: [
- {
- name: "金价预警",
- icon: "",
- type: "navigator",
- url: "/pages/users/gold_price_warning/index",
- },
- {
- name: "黄金算盘",
- icon: "",
- type: "navigator",
- url: "/pages/users/record_note/index",
- },
- {
- name: "自动买卖",
- icon: "",
- type: "navigator",
- url: "/pages/users/auto_buy/index",
- },
- ],
- },
- // {
- // name: "排行榜",
- // icon: "icon-a-ziyuan87",
- // type: "navigator",
- // url: "/pages/users/ranking_list/index",
- // },
- // {
- // name: "每日一攒",
- // icon: "icon-jicunjinxianxing",
- // type: "navigator",
- // url: "/pages/users/accumulate_gold/index",
- // },
- // {
- // name: "VIP会员",
- // icon: "icon-viphuiyuan1",
- // type: "navigator",
- // url: "/pages/VIP/VIP",
- // },
- // {
- // name: "SVIP会员",
- // icon: "icon-viphuiyuan1",
- // type: "navigator",
- // url: "/pages/SVIP/SVIP",
- // },
- // {
- // name: "贝币商城",
- // icon: "icon-beibishangcheng",
- // type: "navigator",
- // url: "/pages/bb_mall/index",
- // },
- // {
- // name: "客服消息",
- // icon: "icon-kefu2",
- // type: "navigator",
- // url: "/pages/message_create/message_create",
- // },
- // {
- // name: "加盟我们",
- // icon: "icon-jiamengwomen",
- // type: "navigator",
- // url: "/pages/join_us/index",
- // },
- // {
- // name: "找款订单",
- // icon: "icon-zhaokuan",
- // type: "navigator",
- // url: "/pages/find_funds/fundsOrder",
- // },
- ];
- }
- function open() {
- show.value = true;
- uni.hideTabBar();
- emit("open");
- }
- // onHide(() => {
- // show.value = false;
- // hideTabBar();
- // });
- defineExpose({
- open,
- close,
- show,
- });
- function close() {
- show.value = false;
- // hideTabBar();
- emit("close");
- }
- function hideTabBar() {
- // uni.showTabBar({
- // async complete() {
- // await nextTick()
- // fixTabBarGap()
- // }
- // });
- // timer && clearTimeout(timer)
- // timer = setTimeout(() => {
- // uni.showTabBar();
- // }, 250)
- }
- function fixTabBarGap() {
- const info = uni.getSystemInfoSync();
- // 页面真实高度 = windowHeight + tabBar 高度
- const page = uni.createSelectorQuery().select(".page-container");
- page
- .boundingClientRect((rect) => {
- const gap = info.screenHeight - rect.height;
- if (gap > 0) {
- // 用 CSS 动态修正底部多余空白
- document.body.style.height = `${info.windowHeight}px`;
- }
- })
- .exec();
- }
- function handleCollapse(item) {
- item.open = !item.open;
- }
- </script>
- <style lang="scss" scoped>
- .sidebar-wrap {
- position: relative;
- }
- ::v-deep .u-popup__content {
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- align-items: space-between;
- height: 100vh;
- }
- .navigator-box {
- overflow: hidden;
- &.open {
- .arrow-icon {
- transform: rotate(-180deg);
- }
- .collapse-content {
- max-height: 500px !important;
- }
- }
- .collapse-row {
- &:active {
- background-color: #f8f8f8;
- }
- }
- }
- .list-wrap {
- width: 70vw;
- height: 88%;
- background-color: #fafafa;
- padding: 30rpx 20rpx 0;
- overflow: auto;
- margin: var(--status-bar-height) 0 0;
- // ::v-deep .u-list-item {
- // height: 95rpx;
- // }
- .navigator-link {
- padding: 0 20rpx 0 25rpx;
- width: 100%;
- display: flex;
- justify-content: space-between;
- line-height: 100rpx;
- &.sub-link {
- line-height: 70rpx;
- .title {
- padding-left: 54rpx;
- }
- }
- }
- .arrow-icon {
- transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
- }
- .collapse-content {
- // background-color: #FAFAFA;
- transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
- max-height: 0;
- }
- .u-list-item {
- background-color: #fff;
- margin-bottom: 15rpx;
- border-radius: 15rpx;
- overflow: hidden;
- .item-icon {
- vertical-align: middle;
- margin-right: 20rpx;
- }
- .item-text {
- font-size: 32rpx;
- vertical-align: middle;
- }
- }
- .white-box {
- min-height: 30rpx;
- background-color: #fafafa;
- }
- }
- .footer-box {
- position: absolute;
- bottom: 0;
- left: 0;
- z-index: 1000;
- width: 100%;
- display: flex;
- align-items: center;
- justify-content: center;
- padding: 0 0.9375rem;
- gap: 1.25rem;
- margin-bottom: 0.9375rem;
- .item-box {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- .icon-box {
- width: 80rpx;
- height: 80rpx;
- border-radius: 100rpx;
- background-color: $header-color;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .name {
- margin: 10rpx 0 0;
- font-size: 28rpx;
- text-align: center;
- }
- }
- }
- .uni-cover-view {
- width: 100vw;
- height: 100vh;
- background-color: #000;
- }
- </style>
|