|
|
@@ -152,7 +152,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref, reactive, watch } from 'vue'
|
|
|
+import { ref, reactive, watch,computed } from 'vue'
|
|
|
import { onLoad, onShow, onPageScroll } from "@dcloudio/uni-app";
|
|
|
import UniIcons from "../../uni_modules/uni-icons/components/uni-icons/uni-icons.vue";
|
|
|
import { HTTP_REQUEST_URL_IMG } from "@/config/app";
|
|
|
@@ -197,27 +197,49 @@ const orderStatus = ref([
|
|
|
{ src: `${HTTP_REQUEST_URL_IMG}setting/tuikuan.png`, name: '退款/换货' ,id:5},
|
|
|
{ src: `${HTTP_REQUEST_URL_IMG}setting/yiwancheng.png`, name: '已完成',id:4 },
|
|
|
])
|
|
|
-
|
|
|
+const merchantZYShow = ref(false)
|
|
|
+const lxsjShow = ref(false);
|
|
|
+const logoutShow = ref(false);
|
|
|
// 常用功能
|
|
|
-const commonFunctions = ref([
|
|
|
- { src: `${HTTP_REQUEST_URL_IMG}setting/zuji.png`, name: '浏览足迹',pageUrl:'/pages/users/browsing_history/index',show:true },
|
|
|
- { src: `${HTTP_REQUEST_URL_IMG}setting/shoucang.png`, name: '我的收藏',pageUrl:'/pages/users/user_goods_collection/index' ,show:true},
|
|
|
- { src: `${HTTP_REQUEST_URL_IMG}setting/dingwei.png`, name: '收货地址',pageUrl:'/pages/users/user_address_list/index' ,show:true},
|
|
|
- { src: `${HTTP_REQUEST_URL_IMG}setting/dianpu.png`, name: '联系商家',pageUrl: '/pages/users/my_merchant/index' ,show:!!(appStore.merchantId || appStore.userInfo?.merchant?.id)},
|
|
|
- { src: `${HTTP_REQUEST_URL_IMG}setting/dianpu.png`, name: '门店主页',pageUrl: '/pages/merchantCenter/index' ,show:!!appStore.userInfo?.merchant?.id},
|
|
|
- // { src: `${HTTP_REQUEST_URL_IMG}setting/yijianjianyi.png`, name: '意见建议' ,show:true},
|
|
|
- { src: `${HTTP_REQUEST_URL_IMG}setting/xiazaiapp.png`, name: '下载APP',pageUrl: 'download',show:true },
|
|
|
- { src: `${HTTP_REQUEST_URL_IMG}setting/lianxikefu.png`, name: '平台客服' ,show:true},
|
|
|
- // { src: \`${HTTP_REQUEST_URL_IMG}setting/lianxikefu.png', name: '资产明细' ,pageUrl:'/pages/users/user_asset/asset_info/asset_info',show:true}
|
|
|
-])
|
|
|
+const commonFunctions = computed(() => {
|
|
|
+ const baseFunctions = [
|
|
|
+ { src: `${HTTP_REQUEST_URL_IMG}setting/zuji.png`, name: '浏览足迹', pageUrl: '/pages/users/browsing_history/index', show: true },
|
|
|
+ { src: `${HTTP_REQUEST_URL_IMG}setting/shoucang.png`, name: '我的收藏', pageUrl: '/pages/users/user_goods_collection/index', show: true },
|
|
|
+ { src: `${HTTP_REQUEST_URL_IMG}setting/dingwei.png`, name: '收货地址', pageUrl: '/pages/users/user_address_list/index', show: true },
|
|
|
+ { src: `${HTTP_REQUEST_URL_IMG}setting/dianpu.png`, name: '联系商家', pageUrl: '/pages/users/my_merchant/index', show: lxsjShow.value },
|
|
|
+ { src: `${HTTP_REQUEST_URL_IMG}setting/dianpu.png`, name: '门店主页', pageUrl: '/pages/merchantCenter/index', show: merchantZYShow.value },
|
|
|
+ { src: `${HTTP_REQUEST_URL_IMG}setting/xiazaiapp.png`, name: '下载APP', pageUrl: 'download', show: true },
|
|
|
+ { src: `${HTTP_REQUEST_URL_IMG}setting/lianxikefu.png`, name: '平台客服', show: true },
|
|
|
+ { src: `${HTTP_REQUEST_URL_IMG}setting/logout.png`, name: '退出登录', pageUrl: 'logout', show: logoutShow.value }
|
|
|
+ ];
|
|
|
+
|
|
|
+ // 根据 show 值过滤
|
|
|
+ return baseFunctions.filter(func => func.show);
|
|
|
+});
|
|
|
const params = ref({
|
|
|
page: 1,
|
|
|
limit: 10,
|
|
|
});
|
|
|
|
|
|
// 页面加载
|
|
|
-onShow(() => {
|
|
|
- console.log(appStore.userInfo)
|
|
|
+onShow(async () => {
|
|
|
+ if(appStore.isLogin){
|
|
|
+ await appStore.USERINFO();
|
|
|
+ logoutShow.value = true;
|
|
|
+ if(appStore.userInfo?.merchant?.id){
|
|
|
+ merchantZYShow.value = true;
|
|
|
+ }else{
|
|
|
+ merchantZYShow.value = false;
|
|
|
+ }
|
|
|
+ if(appStore.merchantId || appStore.userInfo?.merchant?.id){
|
|
|
+ lxsjShow.value = true;
|
|
|
+ }else{
|
|
|
+ lxsjShow.value = false;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ logoutShow.value = false;
|
|
|
+ }
|
|
|
+
|
|
|
fetchMetalBalance()
|
|
|
getHistoryList()
|
|
|
})
|
|
|
@@ -322,23 +344,27 @@ const goDetail = (url) => {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+function handleLogOut() {
|
|
|
+ uni.showModal({
|
|
|
+ title: "提示",
|
|
|
+ content: "确认退出登录吗?",
|
|
|
+ success: function (res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ // 清除全局定时器
|
|
|
+ if (getApp().globalData?.messageTimer) {
|
|
|
+ clearInterval(getApp().globalData.messageTimer);
|
|
|
+ getApp().globalData.messageTimer = null;
|
|
|
+ }
|
|
|
+ appStore.LOGOUT();
|
|
|
+ uni.reLaunch({ url: "/pages/users/login/index" });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ });
|
|
|
+}
|
|
|
// 功能点击
|
|
|
const handleFunctionClick = (url) => {
|
|
|
console.log(url)
|
|
|
- if(url === "download"){
|
|
|
- uni.setClipboardData({
|
|
|
- data: 'https://a.app.qq.com/o/simple.jsp?pkgname=uni.app.UNI9DE338F',
|
|
|
- showToast: false,
|
|
|
- success: function () {
|
|
|
- uni.showToast({
|
|
|
- title: "下载链接复制成功,请打开内置手机浏览器访问下载。",
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
- console.log('success');
|
|
|
- }
|
|
|
- });
|
|
|
- return
|
|
|
- }
|
|
|
+
|
|
|
if (!url) return;
|
|
|
// 买料、卖料、消费需要通过webview跳转
|
|
|
if (
|
|
|
@@ -361,8 +387,24 @@ const handleFunctionClick = (url) => {
|
|
|
},
|
|
|
});
|
|
|
return; // 阻止继续执行后续跳转逻辑
|
|
|
+ }else if(url === "download"){
|
|
|
+ uni.setClipboardData({
|
|
|
+ data: 'https://a.app.qq.com/o/simple.jsp?pkgname=uni.app.UNI9DE338F',
|
|
|
+ showToast: false,
|
|
|
+ success: function () {
|
|
|
+ uni.showToast({
|
|
|
+ title: "下载链接复制成功,请打开内置手机浏览器访问下载。",
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ console.log('success');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }else if(url === "logout"){
|
|
|
+ handleLogOut();
|
|
|
+ }else{
|
|
|
+ uni.navigateTo({ url });
|
|
|
}
|
|
|
- uni.navigateTo({ url });
|
|
|
}
|
|
|
|
|
|
// 查看商家
|