菜大王uniapp开发
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

564 lines
15 KiB

<script setup>
import { onLoad } from "@dcloudio/uni-app";
import { ref } from "vue";
import customTabBar from "@/components/custom-tab-bar/my-tab-bar.vue";
import navv from "@/components/nav/nav.vue";
// import navigation from "@/components/navigation/navigation.vue";
import { getUserInfoApi, yesterdayOrderApi } from "@/libs/api";
import { increaseFontScale } from "@/libs/utils";
/**
* 判断登录状态
*/
const isLogin = ref(false);
/**
* 用户信息
*/
const userInfo = ref({});
/**
* 公司信息
*/
const company = ref(undefined);
/**
* 订单位置信息
*/
const position = ref(false);
/**
* 昨日下单订单号
*/
const orderId = ref("");
/**
* 常用订单
*/
const commonOrders = ref([
{
title: "dfk",
text: "待付款",
url: "/static/personalInformation/order1.png",
path: "../../normalOrder/pages/waitPay/waitPay",
index: 1,
},
{
title: "dfh",
text: "待发货",
url: "/static/personalInformation/order2.png",
path: "../../normalOrder/pages/waitDelivery/waitDelivery",
index: 2,
},
{
title: "dsh",
text: "待收货",
url: "/static/personalInformation/order3.png",
path: "../../normalOrder/pages/waitTaking/waitTaking",
index: 3,
},
{
title: "wddd",
text: "我的订单",
url: "/static/personalInformation/order4.png",
path: "../../normalOrder/pages/myOrder/myOrder",
index: 0,
},
]);
/**
* 菜单工具
*/
const commonTools = ref([
[
{
title: "tjzzh",
text: "添加子账号",
url: "/static/personalInformation/company.png",
path: "../../enterprise/pages/storeManage/storeManage",
type: "navigate",
auth: true,
},
{
title: "shdz",
text: "收货地址",
url: "/static/personalInformation/shdz.png",
path: "../../address/pages/addressLists/addressLists",
type: "navigate",
},
{
title: "xgmm",
text: "修改密码",
url: "/static/personalInformation/changePassword.png",
path: "../../login/pages/setPassword/setPassword",
type: "navigate",
},
{
title: "jl",
text: "我的简历",
url: "/static/personalInformation/resume.png",
path: "../../normalTools/pages/resume/resume",
type: "navigate",
},
{
title: "zw",
text: "招聘求职",
url: "/static/personalInformation/position.png",
path: "../../normalTools/pages/position/position",
type: "navigate",
},
{
title: "fjdr",
text: "附近企业",
url: "/static/personalInformation/fjdr.png",
path: "../../normalTools/pages/nearby/nearby",
type: "navigate",
},
{
title: "fx",
text: "分享",
url: "/static/personalInformation/share.png",
type: "share",
},
],
[
{
title: "hycz",
text: "零钱充值",
url: "/static/personalInformation/pre_recharge.png",
path: "preRecharge",
type: "other",
},
{
title: "yecz",
text: "钱包充值",
url: "/static/personalInformation/recharge.png",
path: "../../normalTools/pages/recharge/recharge",
type: "navigate",
},
],
[
{
title: "shd",
text: "送货单",
url: "/static/personalInformation/shd.png",
path: "../../normalTools/pages/deliveryNote/deliveryNote",
type: "navigate",
},
{
title: "zd",
text: "对账单",
url: "/static/personalInformation/bill.png",
path: "../../normalTools/pages/bill/bill",
type: "navigate",
},
{
title: "cxbb",
text: "下单明细报表", // 包含隔天减退
url: "/static/personalInformation/reportForm.png",
path: "../../normalTools/pages/reportForm/reportForm",
type: "navigate",
},
{
title: "fpxx",
text: "开票须知",
url: "/static/personalInformation/fapiao.png",
path: "../../normalTools/pages/invoiceInfo/invoiceInfo",
type: "navigate",
},
{
title: "kpsq",
text: "开票申请",
url: "/static/personalInformation/InvoicingApplication.png",
path: "../../normalTools/pages/application/application",
type: "navigate",
},
{
title: "kpjl",
text: "开票记录",
url: "/static/personalInformation/InvoicingRecords.png",
path: "../../normalTools/pages/record/record",
type: "navigate",
},
{
title: "shxx",
text: "送货信息",
url: "/static/personalInformation/deliverGoods.png",
path: "../../normalOrder/pages/myOrder/myOrder",
type: "navigate",
},
],
[
{
title: "kpjl",
text: "蔬菜检测报告",
url: "/static/personalInformation/testReport.png",
path: "../../normalTools/pages/testReport/testReport",
type: "navigate",
},
{
title: "jcbgzs",
text: "检测报告证书",
url: "/static/personalInformation/certificate.png",
path: "certificate",
type: "other",
},
{
title: "cpxd",
text: "菜谱下单",
url: "/static/personalInformation/cyqd.png",
path: "../menus/menus",
type: "switchTab",
},
{
title: "yyxd",
text: "语音下单",
url: "/static/personalInformation/voice1.png",
path: "../alls/alls",
type: "switchTab",
},
// {
// title: 'tpxd',
// text: '图片下单',
// url: '/static/personalInformation/tpxd.png',
// path: "../alls/alls",
// type: "switchTab"
// },
{
title: "wdfk",
text: "我的反馈",
url: "/static/personalInformation/wodefankui.png",
path: "../../normalTools/pages/myFeedback/myFeedback",
type: "navigate",
},
{
title: "xpxq",
text: "新品需求",
url: "/static/personalInformation/xpxq.png",
path: "../../normalTools/pages/newNeeds/newNeeds",
type: "navigate",
},
{
title: "dfb",
text: "豆腐板",
url: "/static/personalInformation/dfb.png",
path: "../../normalTools/pages/tofuBoard/tofuBoard",
type: "navigate",
},
{
title: "zzk",
text: "周转筐",
url: "/static/personalInformation/zzk.png",
path: "../../normalTools/pages/turnoverBasket/turnoverBasket",
type: "navigate",
},
{
title: "shgl",
text: "商户信息",
url: "/static/personalInformation/Merchant.png",
path: "../../normalTools/pages/merchant/merchant",
type: "navigate",
},
{
title: "bj",
text: "比价",
url: "/static/personalInformation/bj.png",
path: "priceComparison",
type: "other",
},
],
]);
const dfkDataLength = ref("");
function onJoinEnterprise() { }
/**
* 登录
*/
function onGotoLogin() {
if (!isLogin.value) {
uni.showModal({
title: "提示",
content: "请先登录",
complete(res) {
if (res.confirm) {
uni.navigateTo({
url: "/pages/login/login",
});
}
},
});
}
}
function onOpenFriends() {}
function onOpenMyInfo() {}
function onGotoOrder() {}
function onGetPosition() {}
/**
* 获取用户信息
*/
async function getUserInfo() {
const res = await getUserInfoApi();
if (res.code === "0") {
isLogin.value = true;
res.data.walletMoney = (res.data.walletMoney || 0).toFixed(2);
company.value = res.data.company ? res.data.company : undefined;
userInfo.value = res.data;
}
else if (res.code === "4") {
// 后期更换到进入微信用户登录
isLogin.value = false;
userInfo.value = "";
company.value = "";
}
}
/**
* 获取热线
*/
function getHotLines() { }
/**
* 获取地址
*/
function getMyArea() { }
/**
* 获取仓库列表
*/
// function getWarehouse() { }
async function getYesterdayOrder() {
const res = await yesterdayOrderApi();
if (res.code === "0" && res.data) {
position.value = true;
orderId.value = res.data;
}
}
function openSwitchTab() { }
function handleOther() {}
onLoad(() => {
// #ifdef APP
uni.hideTabBar();
// #endif
getUserInfo(); // 获取用户信息
getHotLines();
getMyArea();
getYesterdayOrder();
});
</script>
<template>
<navv>
<template #default="{ status, menu }">
<!-- 登录 头像 -->
<view class="header-box">
<image class="back-img" src="/static/personalInformation/juxing.png" mode="widthFix" />
<view
class="title"
:style="{
paddingTop: `${status}px`,
height: menu ? `${menu}px` : 'auto',
}"
>
个人中心
</view>
<!-- <navigation
title="个人中心"
background="#05b259"
:title-style="{ color: 'white' }"
:icon-style="{ display: 'none' }"
/> -->
<!-- <uv-navbar title="个人中心" /> -->
<view class="userinfo">
<view class="left">
<image
class="avatar"
:src="userInfo.image ? userInfo.image : '/static/personalInformation/touxiang1.png'"
mode="aspectFill"
/>
<!-- telephone true -->
<view v-if="userInfo.telephone" class="information">
<view class="name">
{{ userInfo.username }}
</view>
<view v-if="company" class="company">
{{ company.name }}
</view>
<view v-else class="add-company" @click="onJoinEnterprise">
<text>加入企业</text>
<uv-icon color="white" name="arrow-right" size="28rpx" />
</view>
</view>
<!-- telephone false -->
<view v-else class="btns">
<view v-if="isLogin" class="add-company" @click="onJoinEnterprise">
<text>加入企业</text>
<uv-icon color="white" name="arrow-right" size="28rpx" />
</view>
<view v-else class="login-btn" @click="onGotoLogin">
<text> 登录 </text>
<uv-icon color="white" name="arrow-right" size="28rpx" />
</view>
</view>
</view>
<view v-if="userInfo.telephone" class="right">
<image
class="icon-one"
src="/static/personalInformation/fujingqiy.png"
mode="widthFix"
@click="onOpenFriends"
/>
<image
class="icon-two"
src="/static/personalInformation/shezhi.png"
mode="widthFix"
@click="onOpenMyInfo"
/>
</view>
</view>
</view>
<view class="order-cart-box">
<text class="title">
常用订单
</text>
<view class="order-list-box">
<view
v-for="item in commonOrders"
:key="item.title"
class="order-list"
@click="onGotoOrder"
>
<view v-if="item.title === 'dfk'" class="order-tag">
{{ dfkDataLength }}
</view>
<image class="icon" :src="item.url" mode="aspectFit" />
<text class="name">
{{ item.text }}
</text>
</view>
</view>
<view v-if="position" class="order-list-box-position" @click="onGetPosition">
<text class="text">
你有订单正在配送,点击查看位置
</text>
<image class="icon" src="/static/personalInformation/arrow-two.png" mode="" />
</view>
</view>
<view class="tool-box">
<view>
<uv-button @click="() => increaseFontScale(0.1)">
加大字体
</uv-button>
<uv-button @click="() => increaseFontScale(-0.1)">
减小字体
</uv-button>
</view>
<block
v-for="(parent, parentIndex) in commonTools"
:key="parentIndex"
>
<text v-if="parentIndex === 0" class="title">
账号管理
</text>
<text v-if="parentIndex === 1" class="title">
充值管理
</text>
<text v-if="parentIndex === 2" class="title">
财务管理
</text>
<text v-if="parentIndex === 3" class="title">
常用工具
</text>
<view class="tool-list-box">
<template v-for="(item) in parent" :key="item.title">
<block
v-if="(item.auth && userInfo.comBoss) || !item.auth"
>
<button
v-if="item.type === 'tap'"
class="tool-list"
@click="exportDeliveryNote"
>
<image class="icon" :src="item.url" mode="aspectFit" />
<text class="name">
{{ item.text }}
</text>
</button>
<button
v-if="item.type === 'other'"
class="tool-list"
data-item="{{item}}"
@click="handleOther"
>
<image class="icon" :src="item.url" mode="aspectFit" />
<text class="name">
{{ item.text }}
</text>
</button>
<navigator
v-if="
item.type !== 'tap'
&& item.type !== 'share'
&& item.type !== 'switchTab'
&& item.type !== 'other'
"
style="display: flex;flex-direction: column;width: 25%;margin-bottom: 48rpx;"
url="{{item.path}}"
:open-type="item.type"
hover-class="other-navigator-hover"
>
<button class="tool-list" style="width: 100%;margin-bottom: 0;">
<image class="icon" :src="item.url" mode="aspectFit" />
<text class="name">
{{ item.text }}
</text>
</button>
</navigator>
<button
v-if="item.type === 'switchTab'"
class="tool-list"
@click="openSwitchTab"
>
<image class="icon" :src="item.url" mode="aspectFit" />
<text class="name">
{{ item.text }}
</text>
</button>
<button
v-if="item.type === 'share'"
class="tool-list"
data-name="shareBtn"
open-type="share"
>
<image class="icon" :src="item.url" mode="aspectFit" />
<text class="name">
{{ item.text }}
</text>
</button>
</block>
</template>
</view>
</block>
</view>
<customTabBar tab-index="4" />
</template>
</navv>
</template>
<style lang="scss" scoped>
// @import '../../uni.scss';
@import './personallInformation.scss';
</style>