|
@@ -23,6 +23,12 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="main4 flex-col">
|
|
|
+ <van-tabs v-model:active="active" @click-tab="clickLabel" class="tabs2 o-pb-15" v-if="user.type < 2">
|
|
|
+ <van-tab title="商户" name="2">
|
|
|
+ </van-tab>
|
|
|
+ <van-tab title="子账号" name="3">
|
|
|
+ </van-tab>
|
|
|
+ </van-tabs>
|
|
|
<div class="bd1 flex-col" v-for="(item, index) in adminList" :key="index">
|
|
|
<div class="outer2 flex-col">
|
|
|
<div class="box2 flex-row justify-between">
|
|
@@ -40,16 +46,17 @@
|
|
|
<span class="txt2"
|
|
|
v-html="`${$t('merchantManage.managementSystemId')}:` + (item.managerId == null ? '' : item.managerId)"></span>
|
|
|
<div class="box3 flex-col">
|
|
|
- <span class="txt3" v-html="`${$t('merchantManage.creationTime')}:` + Format_time(item.createDate)"></span>
|
|
|
+ <span class="txt3"
|
|
|
+ v-html="`${$t('merchantManage.creationTime')}:` + Format_time(item.createDate)"></span>
|
|
|
</div>
|
|
|
<div class="button-container">
|
|
|
<van-button v-if="user.type < 2" class="btn1" round type="success"
|
|
|
@click="autoLogin(item.id)">切换登陆</van-button>
|
|
|
- <van-button class="btn1" round type="primary" @click="merchantSet(item)">详细信息</van-button>
|
|
|
+ <van-button v-if="active == 2" class="btn1" round type="primary" @click="merchantSet(item)">详细信息</van-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <van-back-top right="3vw" bottom="5vh" />
|
|
|
+ <van-back-top @click="backTop" right="3vw" bottom="5vh" />
|
|
|
</div>
|
|
|
</van-list>
|
|
|
</div>
|
|
@@ -57,13 +64,13 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import { onMounted, reactive, ref } from "vue";
|
|
|
+import { onMounted, reactive, ref, onActivated } from "vue";
|
|
|
import sHeader from "../../components/SimpleHeader";
|
|
|
import { getAdminList, autoLoginMerchant } from '../../service/merchantManage';
|
|
|
import { getLoginUser, Format_time, styleUrl, setLocal } from "../../common/js/utils";
|
|
|
import { showFailToast, showSuccessToast, showConfirmDialog } from 'vant';
|
|
|
import merchantSearch from './merchantSearch.vue';
|
|
|
-import { useRouter } from "vue-router";
|
|
|
+import { useRouter, onBeforeRouteLeave } from "vue-router";
|
|
|
import { useI18n } from "vue-i18n";
|
|
|
|
|
|
|
|
@@ -79,10 +86,36 @@ export default {
|
|
|
const loading = ref(false); // 加载状态
|
|
|
const error = ref(false); // 错误状态
|
|
|
const finished = ref(false); // 结束翻页状态
|
|
|
+ const verticalScrollPosition = ref(0);
|
|
|
+ // 点击标签
|
|
|
+ const active = ref("");
|
|
|
+
|
|
|
+ // 返回顶部
|
|
|
+ const backTop = () => {
|
|
|
+ window.scrollY = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ onActivated(() => {
|
|
|
+ // 当组件被激活时,可能是从 keep-alive 缓存中激活的
|
|
|
+ // 这时重新添加滚动事件监听器
|
|
|
+ // console.log("进入时的位置", verticalScrollPosition.value);
|
|
|
+ document.documentElement.scrollTop = verticalScrollPosition.value;
|
|
|
+ document.body.scrollTop = verticalScrollPosition.value;
|
|
|
+ window.scrollY = verticalScrollPosition.value;
|
|
|
+ // window.addEventListener('scroll', handleScroll);
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ onBeforeRouteLeave(() => {
|
|
|
+ verticalScrollPosition.value = document.documentElement.scrollTop || document.body.scrollTop || window.scrollY;
|
|
|
+ // console.log("离开时的位置", verticalScrollPosition.value);
|
|
|
+ })
|
|
|
+
|
|
|
let searchParams = reactive({
|
|
|
id: user.id,
|
|
|
current: 1, // 页数
|
|
|
size: 20, // 页大小
|
|
|
+ type: "2",
|
|
|
});
|
|
|
onMounted(async () => {
|
|
|
// 加载样式
|
|
@@ -95,6 +128,13 @@ export default {
|
|
|
searchParams.current = 1;
|
|
|
getList();
|
|
|
}
|
|
|
+
|
|
|
+ const clickLabel = (item) => {
|
|
|
+ adminList.value = [];
|
|
|
+ searchParams.current = 1;
|
|
|
+ searchParams.type = item.name;
|
|
|
+ getList();
|
|
|
+ }
|
|
|
// 滚动加载
|
|
|
const onLoad = () => { if (!finished.value) { searchParams.current = searchParams.current + 1; getList(); } };
|
|
|
// 获取设备列表数据
|
|
@@ -165,6 +205,9 @@ export default {
|
|
|
autoLogin,
|
|
|
Format_time,
|
|
|
user,
|
|
|
+ backTop,
|
|
|
+ active,
|
|
|
+ clickLabel,
|
|
|
};
|
|
|
},
|
|
|
};
|