feat: init

This commit is contained in:
admin 2024-09-06 09:53:51 +08:00
commit bb471250d8
72 changed files with 13362 additions and 0 deletions

View File

@ -0,0 +1,67 @@
{
"globals": {
"Component": true,
"ComponentPublicInstance": true,
"ComputedRef": true,
"EffectScope": true,
"ExtractDefaultPropTypes": true,
"ExtractPropTypes": true,
"ExtractPublicPropTypes": true,
"InjectionKey": true,
"PropType": true,
"Ref": true,
"VNode": true,
"WritableComputedRef": true,
"computed": true,
"createApp": true,
"customRef": true,
"defineAsyncComponent": true,
"defineComponent": true,
"effectScope": true,
"getCurrentInstance": true,
"getCurrentScope": true,
"h": true,
"inject": true,
"isProxy": true,
"isReactive": true,
"isReadonly": true,
"isRef": true,
"markRaw": true,
"nextTick": true,
"onActivated": true,
"onBeforeMount": true,
"onBeforeUnmount": true,
"onBeforeUpdate": true,
"onDeactivated": true,
"onErrorCaptured": true,
"onMounted": true,
"onRenderTracked": true,
"onRenderTriggered": true,
"onScopeDispose": true,
"onServerPrefetch": true,
"onUnmounted": true,
"onUpdated": true,
"provide": true,
"reactive": true,
"readonly": true,
"ref": true,
"resolveComponent": true,
"shallowReactive": true,
"shallowReadonly": true,
"shallowRef": true,
"toRaw": true,
"toRef": true,
"toRefs": true,
"toValue": true,
"triggerRef": true,
"unref": true,
"useAttrs": true,
"useCssModule": true,
"useCssVars": true,
"useSlots": true,
"watch": true,
"watchEffect": true,
"watchPostEffect": true,
"watchSyncEffect": true
}
}

11
.eslintrc.js Normal file
View File

@ -0,0 +1,11 @@
module.exports = {
"extends": [
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/eslint-config-typescript',
'@vue/eslint-config-prettier',
'plugin:prettier/recommended', // 添加 prettier 插件,
]
}

21
.gitignore vendored Normal file
View File

@ -0,0 +1,21 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
.DS_Store
dist
*.local
# Editor directories and files
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

16
.hbuilderx/launch.json Normal file
View File

@ -0,0 +1,16 @@
{ // launch.json configurations app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
// launchtypelocalremote, localremote
"version": "0.0",
"configurations": [{
"app-plus" :
{
"launchtype" : "local"
},
"default" :
{
"launchtype" : "local"
},
"type" : "uniCloud"
}
]
}

20
index.html Normal file
View File

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<script>
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
CSS.supports('top: constant(a)'))
document.write(
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
</script>
<title></title>
<!--preload-links-->
<!--app-context-->
</head>
<body>
<div id="app"><!--app-html--></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>

93
package.json Normal file
View File

@ -0,0 +1,93 @@
{
"name": "uni-preset-vue",
"version": "0.0.0",
"scripts": {
"dev:app": "uni -p app",
"dev:app-android": "uni -p app-android",
"dev:app-ios": "uni -p app-ios",
"dev:custom": "uni -p",
"dev:h5": "uni",
"dev:h5:ssr": "uni --ssr",
"dev:mp-alipay": "uni -p mp-alipay",
"dev:mp-baidu": "uni -p mp-baidu",
"dev:mp-jd": "uni -p mp-jd",
"dev:mp-kuaishou": "uni -p mp-kuaishou",
"dev:mp-lark": "uni -p mp-lark",
"dev:mp-qq": "uni -p mp-qq",
"dev:mp-toutiao": "uni -p mp-toutiao",
"dev:mp-weixin": "uni -p mp-weixin",
"dev:quickapp-webview": "uni -p quickapp-webview",
"dev:quickapp-webview-huawei": "uni -p quickapp-webview-huawei",
"dev:quickapp-webview-union": "uni -p quickapp-webview-union",
"build:app": "uni build -p app",
"build:app-android": "uni build -p app-android",
"build:app-ios": "uni build -p app-ios",
"build:custom": "uni build -p",
"build:h5": "uni build",
"build:h5:ssr": "uni build --ssr",
"build:mp-alipay": "uni build -p mp-alipay",
"build:mp-baidu": "uni build -p mp-baidu",
"build:mp-jd": "uni build -p mp-jd",
"build:mp-kuaishou": "uni build -p mp-kuaishou",
"build:mp-lark": "uni build -p mp-lark",
"build:mp-qq": "uni build -p mp-qq",
"build:mp-toutiao": "uni build -p mp-toutiao",
"build:mp-weixin": "uni build -p mp-weixin",
"build:quickapp-webview": "uni build -p quickapp-webview",
"build:quickapp-webview-huawei": "uni build -p quickapp-webview-huawei",
"build:quickapp-webview-union": "uni build -p quickapp-webview-union",
"type-check": "vue-tsc --noEmit"
},
"dependencies": {
"@dcloudio/uni-app": "3.0.0-alpha-4010520240507001",
"@dcloudio/uni-app-plus": "3.0.0-alpha-4010520240507001",
"@dcloudio/uni-components": "3.0.0-alpha-4010520240507001",
"@dcloudio/uni-h5": "3.0.0-alpha-4010520240507001",
"@dcloudio/uni-mp-alipay": "3.0.0-alpha-4010520240507001",
"@dcloudio/uni-mp-baidu": "3.0.0-alpha-4010520240507001",
"@dcloudio/uni-mp-jd": "3.0.0-alpha-4010520240507001",
"@dcloudio/uni-mp-kuaishou": "3.0.0-alpha-4010520240507001",
"@dcloudio/uni-mp-lark": "3.0.0-alpha-4010520240507001",
"@dcloudio/uni-mp-qq": "3.0.0-alpha-4010520240507001",
"@dcloudio/uni-mp-toutiao": "3.0.0-alpha-4010520240507001",
"@dcloudio/uni-mp-weixin": "3.0.0-alpha-4010520240507001",
"@dcloudio/uni-mp-xhs": "3.0.0-alpha-4010520240507001",
"@dcloudio/uni-quickapp-webview": "3.0.0-alpha-4010520240507001",
"@dcloudio/uni-ui": "^1.5.2",
"@esbuild/darwin-x64": "^0.20.2",
"@rollup/rollup-darwin-x64": "^4.17.2",
"amfe-flexible": "^2.2.1",
"clipboard": "^2.0.11",
"dayjs": "^1.11.10",
"echarts": "^5.5.0",
"esbuild": "^0.20.2",
"luch-request": "^3.1.1",
"pinia": "2.0.33",
"pinia-plugin-persistedstate": "^3.2.1",
"postcss-pxtorem": "^6.0.0",
"underscore": "^1.13.6",
"unplugin-auto-import": "^0.17.3",
"uview-plus": "^3.2.14",
"vue": "^3.4.27",
"vue-i18n": "^9.13.1"
},
"devDependencies": {
"@dcloudio/types": "^3.4.8",
"@dcloudio/uni-automator": "3.0.0-alpha-4010520240507001",
"@dcloudio/uni-cli-shared": "3.0.0-alpha-4010520240507001",
"@dcloudio/uni-stacktracey": "3.0.0-alpha-4010520240507001",
"@dcloudio/vite-plugin-uni": "3.0.0-alpha-4010520240507001",
"@types/node": "^20.11.22",
"@types/underscore": "^1.11.15",
"@types/wechat-miniprogram": "^3.4.7",
"@uni-helper/uni-app-types": "^0.5.12",
"@uni-helper/uni-ui-types": "^0.5.11",
"@vue/runtime-core": "^3.4.27",
"@vue/tsconfig": "^0.1.3",
"sass": "^1.69.7",
"sass-loader": "10",
"typescript": "^4.9.4",
"vite": "5.2.8",
"vue-tsc": "^1.0.24"
}
}

7384
pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load Diff

28
project.config.json Normal file
View File

@ -0,0 +1,28 @@
{
"appid": "tt5ff52948c0c236df01",
"compileType": "miniprogram",
"libVersion": "3.5.3",
"packOptions": {
"ignore": [],
"include": []
},
"setting": {
"coverView": true,
"es6": true,
"postcss": true,
"minified": true,
"enhance": true,
"showShadowRootInWxmlPanel": true,
"packNpmRelationList": [],
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
}
},
"condition": {},
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 2
}
}

View File

@ -0,0 +1,7 @@
{
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "freight-ts-web",
"setting": {
"compileHotReLoad": true
}
}

7
readme.md Normal file
View File

@ -0,0 +1,7 @@
## 获取接口字段
```
let c = a.data[22].requestBody.jsonSchema.properties
for (let i = 0; i < Object.keys(c).length; i++) {
console.log(Object.keys(c)[i], + ':',c[Object.keys(c)[i]].type + '; //' + c[Object.keys(c)[i]].description )
}
```

10
shims-uni.d.ts vendored Normal file
View File

@ -0,0 +1,10 @@
/// <reference types='@dcloudio/types' />
import 'vue'
declare module '@vue/runtime-core' {
type Hooks = App.AppInstance & Page.PageInstance;
interface ComponentCustomOptions extends Hooks {
}
}

8
src/.postcssrc.js Normal file
View File

@ -0,0 +1,8 @@
module.exports = {
plugins: {
"postcss-pxtorem": {
rootValue: 37.5,
propList: ["*"],
},
},
};

22
src/App.vue Normal file
View File

@ -0,0 +1,22 @@
<script setup lang="ts">
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
onLaunch(() => {
//tabBar
// uni.hideTabBar();
});
onShow(() => {
console.log("App Show");
});
onHide(() => {
console.log("App Hide");
});
</script>
<style lang="scss">
/* 注意要写在第一行同时给style标签加入lang="scss"属性 */
@import "uview-plus/index.scss";
body {
font-size: 12px;
}
</style>

66
src/auto-import.d.ts vendored Normal file
View File

@ -0,0 +1,66 @@
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// noinspection JSUnusedGlobalSymbols
// Generated by unplugin-auto-import
export {}
declare global {
const EffectScope: typeof import('vue')['EffectScope']
const computed: typeof import('vue')['computed']
const createApp: typeof import('vue')['createApp']
const customRef: typeof import('vue')['customRef']
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
const defineComponent: typeof import('vue')['defineComponent']
const effectScope: typeof import('vue')['effectScope']
const getCurrentInstance: typeof import('vue')['getCurrentInstance']
const getCurrentScope: typeof import('vue')['getCurrentScope']
const h: typeof import('vue')['h']
const inject: typeof import('vue')['inject']
const isProxy: typeof import('vue')['isProxy']
const isReactive: typeof import('vue')['isReactive']
const isReadonly: typeof import('vue')['isReadonly']
const isRef: typeof import('vue')['isRef']
const markRaw: typeof import('vue')['markRaw']
const nextTick: typeof import('vue')['nextTick']
const onActivated: typeof import('vue')['onActivated']
const onBeforeMount: typeof import('vue')['onBeforeMount']
const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
const onDeactivated: typeof import('vue')['onDeactivated']
const onErrorCaptured: typeof import('vue')['onErrorCaptured']
const onMounted: typeof import('vue')['onMounted']
const onRenderTracked: typeof import('vue')['onRenderTracked']
const onRenderTriggered: typeof import('vue')['onRenderTriggered']
const onScopeDispose: typeof import('vue')['onScopeDispose']
const onServerPrefetch: typeof import('vue')['onServerPrefetch']
const onUnmounted: typeof import('vue')['onUnmounted']
const onUpdated: typeof import('vue')['onUpdated']
const provide: typeof import('vue')['provide']
const reactive: typeof import('vue')['reactive']
const readonly: typeof import('vue')['readonly']
const ref: typeof import('vue')['ref']
const resolveComponent: typeof import('vue')['resolveComponent']
const shallowReactive: typeof import('vue')['shallowReactive']
const shallowReadonly: typeof import('vue')['shallowReadonly']
const shallowRef: typeof import('vue')['shallowRef']
const toRaw: typeof import('vue')['toRaw']
const toRef: typeof import('vue')['toRef']
const toRefs: typeof import('vue')['toRefs']
const toValue: typeof import('vue')['toValue']
const triggerRef: typeof import('vue')['triggerRef']
const unref: typeof import('vue')['unref']
const useAttrs: typeof import('vue')['useAttrs']
const useCssModule: typeof import('vue')['useCssModule']
const useCssVars: typeof import('vue')['useCssVars']
const useSlots: typeof import('vue')['useSlots']
const watch: typeof import('vue')['watch']
const watchEffect: typeof import('vue')['watchEffect']
const watchPostEffect: typeof import('vue')['watchPostEffect']
const watchSyncEffect: typeof import('vue')['watchSyncEffect']
}
// for type re-export
declare global {
// @ts-ignore
export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue'
import('vue')
}

View File

@ -0,0 +1,88 @@
<template>
<view style="position: relative">
<swiper
class="swiper"
:circular="false"
:indicator-dots="list.length > 1 ? true : false"
:autoplay="false"
:interval="2000"
:duration="500"
indicator-active-color="#2E53CC"
@change="change"
:current="current"
>
<swiper-item v-for="(item, index) in list" :key="index">
<view class="image-box">
<image :src="`${url}/static/img/${item.imgUrl}`"></image>
</view>
</swiper-item>
</swiper>
<!-- <view class="left" v-if="current > 0" @click="sub">
<up-icon name="arrow-left" color="#2E53CC" :size="'12px'"></up-icon>
</view>
<view class="right" v-if="current < list.length - 1" @click="add">
<up-icon
name="arrow-right"
color="#2E53CC"
:size="'12px'"
></up-icon> </view
> -->
</view>
</template>
<script setup lang="ts">
import { url } from "@/utils/data";
const props = withDefaults(
defineProps<{
list: any;
}>(),
{
list: [
{
imgUrl: "b-a1.png",
},
{
imgUrl: "b-a2.png",
},
{
imgUrl: "b-a3.png",
},
],
}
);
const current = ref(0);
const change = (e: any) => {
current.value = e.detail.current;
};
// const add = () => {
// current.value++
// };
// const sub = () => {
// current.value--;
// };
</script>
<style lang="scss" scoped>
.swiper {
width: 100%;
height: 400rpx;
.image-box {
text-align: center;
cursor: pointer;
image {
width: 100%;
}
}
.title {
font-size: 40rpx;
font-family: Source Han Sans CN;
font-weight: 500;
color: $u-primary;
margin-top: 90rpx;
}
}
</style>

View File

@ -0,0 +1,76 @@
<template>
<view
:style="{
paddingBottom: navbarRect.bottom + 50 + 'px',
}"
class="layout"
>
<slot></slot>
</view>
<!-- background: '#ddd', -->
<view
:style="{
paddingBottom: navbarRect.bottom + 'px',
height: '50px',
}"
class="bottom"
>
<Tabbar :select="select"/>
</view>
</template>
<script setup lang="ts">
import Tabbar from "@/components/TabBar/index.vue";
const props = withDefaults(
defineProps<{
select: string;
}>(),
{
select: "首页",
}
);
const navbarRect = reactive({
bottom: 95,
height: 30,
top: 65,
layoutHeight: 0,
});
const menuButtonInfo = uni.getMenuButtonBoundingClientRect();
navbarRect.height = menuButtonInfo.height;
navbarRect.top = menuButtonInfo.top;
navbarRect.bottom =
uni.getSystemInfoSync().safeAreaInsets?.bottom || menuButtonInfo.bottom;
uni.getSystemInfo({
success: (res) => {
console.log(res);
navbarRect.layoutHeight =
res.windowHeight -
navbarRect.top -
navbarRect.height -
navbarRect.bottom -
50;
},
});
</script>
<style lang="scss" scoped>
.top {
position: fixed;
width: 100%;
top: 0;
left: 0;
right: 0;
background-color: bisque;
}
.layout {
background-color: #FFF;
}
.bottom {
position: fixed;
width: 100%;
bottom: 0px;
background: #fff;
}
</style>

View File

@ -0,0 +1,99 @@
<template>
<!-- 工作台底部菜单 -->
<view class="custom-tabbar">
<view v-for="item in state.list" :key="item.text" @click="handleClick(item)">
<view>
<image
:src="`${url}/static/img/tabbar/${select === item.text ? item.activeIcon : item.icon}`"
class="custom-img"
></image>
</view>
<view :class="{'active': select === item.text}">
{{ item.text }}
</view>
</view>
<!-- <view v-for="item in state.list" :key="item.text">
<image
:src="`${url}/static/110/tabBar/${item.icon}`"
class="custom-img"
></image>
<view>
{{ item.text }}
</view>
</view> -->
</view>
</template>
<script setup lang="ts">
import { onLaunch } from "@dcloudio/uni-app";
import { url } from "@/utils/data";
const props = withDefaults(
defineProps<{
select: string;
}>(),
{
select: "首页",
}
);
type tabBar = {
text: string;
icon: string;
activeIcon: string;
path: string;
};
const state = reactive({
list: [
{
text: "首页",
icon: "home.png",
activeIcon: "home-active.png",
path: "/pagesHome/index",
},
{
text: "我的",
icon: "user.png",
activeIcon: "user-active.png",
// path: "/pagesLogin/profile/index",
path: "/pagesHome/profile",
},
],
});
const handleClick = (item: tabBar) => {
// uni.reLaunch({
// url: item.path, //
// });
uni.switchTab({
url: item.path, //
});
};
onLaunch(() => {
//tabBar
uni.hideTabBar();
});
</script>
<style lang="scss" scoped>
.custom-tabbar {
background: #ffffff;
// box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0, 56, 93, 0.12);
border-radius: 13rpx 13rpx 0rpx 0rpx;
border-top: 1px solid rgba(0,0,0,0.05);
display: flex;
align-items: center;
justify-content: space-around;
font-weight: 500;
font-size: 30rpx;
color: #999;
text-align: center;
padding-top: 20rpx;
.custom-img {
width: 48rpx;
height: 48rpx;
}
.active {
color: $u-primary;
}
}
</style>

View File

@ -0,0 +1 @@
.so-mask{position:fixed;top:0;bottom:0;right:0;left:0;background:rgba(0,0,0,0.5);z-index:998}.so-plate{box-sizing:border-box;position:absolute;bottom:0;width:100%;left:0;background:#fff;padding:25upx 25upx 0 25upx}.so-plate-head{display:-webkit-box;display:flex;-webkit-box-pack:justify;justify-content:space-between;-webkit-box-align:center;align-items:center}.so-plate-type{-webkit-box-flex:1;flex:1;display:block}.so-plate-type label{display:inline-block;min-height:32upx;font-size:26upx;margin-right:10upx}.so-plate-body{box-sizing:border-box;padding:30upx 0;display:-webkit-box;display:flex;-webkit-box-pack:justify;justify-content:space-between;-webkit-box-align:center;align-items:center}.so-plate-word{border:1upx solid #ccc;border-radius:10upx;height:0;margin:0 5upx;box-sizing:border-box;padding-bottom:calc(4.28571429%);width:calc(4.28571429%);position:relative}.so-plate-word.active{border-color:#007aff;box-shadow:0 0 15upx 0 #007aff}.so-plate-word text{position:absolute;top:50%;left:50%;-webkit-transform:translateX(-50%) translateY(-50%);transform:translateX(-50%) translateY(-50%);font-weight:700;font-size:32upx}.so-plate-dot{width:15upx;height:15upx;background:#ccc;border-radius:50%;margin:0 5upx}.so-plate-keyboard{background:#eee;margin-left:-25upx;margin-right:-25upx;padding:20upx 25upx 10upx 25upx;box-sizing:border-box;-webkit-transition:all .3s;transition:all .3s}.so-plate-keyboard>view{display:-webkit-box;display:flex;flex-wrap:wrap;-webkit-box-pack:justify;justify-content:space-between}.so-plate-key{display:block;background:#fff;border-radius:10upx;box-shadow:0 0 8upx 0 #bbb;width:80upx;height:80upx;margin:5upx 0;font-size:32upx;text-align:center;display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;-webkit-box-pack:center;justify-content:center;position:relative}.so-plate-key.hover{background:#efefef}.so-plate-key.fill-block{width:80upx;height:80upx;background:none;box-shadow:none}.so-plate-btn{display:inline-block;background:#fff;border-radius:10upx;box-shadow:0 0 10upx 0 #bbb;font-size:28upx;text-align:center;margin:0 0 0 10upx}.so-plate-btn-group{display:-webkit-box;display:flex;-webkit-box-pack:justify;justify-content:space-between;background:#eee;margin-left:-25upx;margin-right:-25upx;box-sizing:border-box;padding:0 25upx 10upx 25upx}.so-plate-btn--cancel{margin:0}.so-plate-btn--submit{background:#5773f9;color:#fff}.so-plate-btn--delete{color:#fd6b6d}.animation-scale-up{-webkit-animation-duration:.2s;animation-duration:.2s;-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:scale-up;animation-name:scale-up}@-webkit-keyframes scale-up{0%{opacity:.8;-webkit-transform:scale(.8);transform:scale(.8)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@keyframes scale-up{0%{opacity:.8;-webkit-transform:scale(.8);transform:scale(.8)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}

View File

@ -0,0 +1,162 @@
.so-mask {
position: fixed;
top: 0;
bottom: 0;
right: 0;
left: 0;
background: rgba(0, 0, 0, 0.5);
z-index: 998;
}
.main-plate {
// min-height: 370px;
// z-index: 999;
box-sizing: border-box;
// position: absolute;
// bottom: 0;
width: 100%;
left: 0;
background: #fff;
padding: 40upx 25upx 0 25upx;
&-head {
display: flex;
justify-content: space-between;
align-items: center;
}
&-type {
flex: 1;
display: block;
label {
display: inline-block;
min-height: 32upx;
font-size: 26upx;
margin-right: 10upx;
}
}
&-body {
box-sizing: border-box;
padding: 30upx 0;
display: flex;
justify-content: space-between;
align-items: center;
}
&-word {
border: 1upx solid #ccc;
border-radius: 10upx;
height: 0;
margin: 0 5upx;
box-sizing: border-box;
padding-bottom: calc((100% - 70upx) / 7);
width: calc((100% - 70upx) / 7);
position: relative;
&.active {
// border-color: #007aff;
// box-shadow: 0 0 15upx 0 #007aff;
border-color: $u-primary;
box-shadow: 0 0 15upx 0 $u-primary;
// color: $u-primary;
}
text {
position: absolute;
top: 50%;
left: 50%;
transform: translateX(-50%) translateY(-50%);
font-weight: 700;
font-size: 32upx;
}
}
&-dot {
width: 15upx;
height: 15upx;
background: #ccc;
border-radius: 50%;
margin: 0 5upx;
}
&-keyboard {
// background: #eee;
margin-left: -25upx;
margin-right: -25upx;
padding: 20upx 25upx 10upx 25upx;
box-sizing: border-box;
transition: all 0.3s;
& > view {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
}
&-key {
display: block;
background: #fff;
border-radius: 10upx;
box-shadow: 0 0 8upx 0 #bbb;
width: 80upx;
height: 80upx;
margin: 5upx 0;
font-size: 32upx;
text-align: center;
display: flex;
align-items: center;
justify-content: center;
position: relative;
&.hover {
background: #efefef;
}
&.fill-block {
width: 80upx;
height: 80upx;
background: none;
box-shadow: none;
}
}
&-btn {
display: inline-block;
background: #fff;
border-radius: 10upx;
box-shadow: 0 0 10upx 0 #bbb;
font-size: 28upx;
text-align: center;
margin: 0 0 0 10upx;
padding: 0 25upx;
&-group {
display: flex;
justify-content: space-between;
// background: #eee;
margin-left: -25upx;
margin-right: -25upx;
box-sizing: border-box;
padding: 0 25upx 10upx 25upx;
// position: absolute;
// bottom: 0px;
// width: 100%;
}
&--cancel {
margin: 0;
}
&--submit {
// background: #5773f9;
background-color: $u-primary;;
color: #fff;
}
&--delete {
color: #fd6b6d;
}
}
}
.animation-scale-up {
animation-duration: 0.2s;
animation-timing-function: ease-out;
animation-fill-mode: both;
animation-name: scale-up;
}
@keyframes scale-up {
0% {
opacity: 0.8;
transform: scale(0.8);
}
100% {
opacity: 1;
transform: scale(1);
}
}

View File

@ -0,0 +1,260 @@
<template>
<view class="main-mask">
<view class="main-plate animation-scale-up">
<!-- <view class="main-plate-head">
<view class="main-plate-type">
<radio-group @change="Changetype">
<label>
<radio value="1" :checked="type===1" />
普通车牌
</label>
<label>
<radio value="2" :checked="type===2" />
新能源车牌
</label>
</radio-group>
</view>
</view> -->
<view class="main-plate-body">
<view class="main-plate-word" :class="{ active: currenttIndex == 0 }" @tap="inputSwitch"
data-index="0">
<text>{{ currentInputValue[0] }}</text>
</view>
<view class="main-plate-word" :class="{ active: currenttIndex == 1 }" @tap="inputSwitch"
data-index="1">
<text>{{ currentInputValue[1] }}</text>
</view>
<view class="main-plate-dot"></view>
<view class="main-plate-word" :class="{ active: currenttIndex == 2 }" @tap="inputSwitch"
data-index="2">
<text>{{ currentInputValue[2] }}</text>
</view>
<view class="main-plate-word" :class="{ active: currenttIndex == 3 }" @tap="inputSwitch"
data-index="3">
<text>{{ currentInputValue[3] }}</text>
</view>
<view class="main-plate-word" :class="{ active: currenttIndex == 4 }" @tap="inputSwitch"
data-index="4">
<text>{{ currentInputValue[4] }}</text>
</view>
<view class="main-plate-word" :class="{ active: currenttIndex == 5 }" @tap="inputSwitch"
data-index="5">
<text>{{ currentInputValue[5] }}</text>
</view>
<view class="main-plate-word" :class="{ active: currenttIndex == 6 }" @tap="inputSwitch"
data-index="6">
<text>{{ currentInputValue[6] }}</text>
</view>
<view class="main-plate-word" :class="{ active: currenttIndex == 7 }" @tap="inputSwitch"
v-if="type == 2" data-index="7">
<text>{{ currentInputValue[7] }}</text>
</view>
</view>
<view class="main-plate-foot">
<!-- :style="{height:keyboardHeight}" -->
<view class="main-plate-keyboard" >
<view id="keyboard">
<block v-if="inputType == 1">
<view hover-class="hover" class="main-plate-key" v-for="el of provincesText" :key="el"
:data-value="el" @tap="chooseKey">{{ el }}</view>
</block>
<block v-if="inputType == 1">
<text class="main-plate-key fill-block"></text>
<text class="main-plate-key fill-block"></text>
</block>
<block v-if="inputType >= 3">
<view hover-class="hover" class="main-plate-key" v-for="el of numberText" :key="el"
:data-value="el" @tap="chooseKey">{{ el }}</view>
</block>
<block v-if="inputType >= 2">
<view hover-class="hover" class="main-plate-key" v-for="el of wordText" :key="el"
:data-value="el" @tap="chooseKey">{{ el }}</view>
</block>
<block v-if="inputType == 3">
<text v-for="el of fillBlock" :key="el.num" class="main-plate-key fill-block"></text>
</block>
<block v-if="inputType == 4">
<view hover-class="hover" class="main-plate-key" v-for="el of lastWordText" :key="el"
:data-value="el" @tap="chooseKey">{{ el }}</view>
</block>
<text v-if="inputType == 4" class="main-plate-key fill-block"></text>
</view>
</view>
<view class="main-plate-btn-group">
<view>
<button class="main-plate-btn main-plate-btn--cancel" @tap="$emit('close')">取消</button>
</view>
<view>
<button class="main-plate-btn main-plate-btn--delete" @tap="deleteKey">删除</button>
<button class="main-plate-btn main-plate-btn--submit" @tap="exportPlate">确定</button>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'uni-plate-input',
data() {
return {
type: 1, //
currenttIndex: 0, //
currentInputValue: ['', '', '', '', '', '', ''],
fillBlock: [{
num: 11
}, {
num: 12
}, {
num: 13
}, {
num: 14
}, {
num: 15
}, {
num: 16
}],
keyboardHeightInit: false,
keyboardHeight: 'auto',
provincesText: [
'京','冀','沪','津','晋','蒙','辽','吉',
'黑','苏','浙','皖','闽','赣','鲁','豫',
'鄂','湘','桂','琼','渝','川','贵','云',
'粤','藏','陕','甘','青','宁','新'
],
numberText: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'],
wordText: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U',
'V', 'W', 'X', 'Y', 'Z'
],
lastWordText: ['港', '澳','军', '警' , '学', '领']
};
},
props: {
plate: {
type: String
}
},
computed: {
inputType() {
switch (this.currenttIndex) {
case 0:
return 1;
break;
case 1:
return 2;
break;
case 2:
return 3;
break;
case 3:
return 3;
break;
case 4:
return 3;
break;
case 5:
return 3;
break;
case 6:
return this.type == 2 ? 3 : 4;
break;
case 7:
return 4;
break;
default:
return 1;
break;
}
}
},
watch: {
currenttIndex: function(n, o) {
if (!this.keyboardHeightInit) return
this.$nextTick(() => {
this.changeKeyboardHeight()
})
}
},
methods: {
inputSwitch(e) {
const {
index
} = e.currentTarget.dataset;
this.currenttIndex = parseInt(index);
},
Changetype(e) {
const {
value
} = e.detail;
this.type = parseInt(value)
this.currenttIndex = 0
if (value == 1) {
this.currentInputValue = ['', '', '', '', '', '', '']
} else {
this.currentInputValue = ['', '', '', '', '', '', '', '']
}
},
chooseKey(e) {
const {
value
} = e.currentTarget.dataset;
this.$set(this.currentInputValue, this.currenttIndex, value);
if (this.type == 1 && this.currenttIndex < 6) {
this.currenttIndex++
}
if (this.type == 2 && this.currenttIndex < 7) {
this.currenttIndex++
}
},
deleteKey() {
this.$set(this.currentInputValue, this.currenttIndex, '')
if (this.currenttIndex != 0) this.currenttIndex--
},
exportPlate() {
const plate = this.currentInputValue.join('')
let err = false
if (this.type === 1 && plate.length != 7) {
err = true
} else if (this.type === 2 && plate.length != 8) {
err = true
}
if (err) return uni.showToast({
title: '请输入完整的车牌号码!',
icon: 'none'
})
this.$emit('export', plate)
},
changeKeyboardHeight() {
const that = this
const query = uni.createSelectorQuery().in(this);
query.select('#keyboard').boundingClientRect();
query.exec(function(res) {
if (res && res[0]) {
that.keyboardHeight = res[0].height + uni.upx2px(30) + 'px'
that.keyboardHeightInit = true
}
});
}
},
mounted() {
const plateKey = this.plate.split('')
if (plateKey.length === 7) {
this.type = 1
} else if (plateKey.length === 8) {
this.type = 2
}
if (plateKey.length === 7 || plateKey.length === 8) {
this.currentInputValue = plateKey
this.currenttIndex = plateKey.length - 1
}
setTimeout(() => { //
this.$nextTick(() => {
this.changeKeyboardHeight()
})
}, 600);
}
};
</script>
<style scoped lang="scss">
@import './uni-plate-input';
</style>

24
src/config/env.ts Normal file
View File

@ -0,0 +1,24 @@
// 不同的环境变量配置
const development = {
// VITE_APP_BASE_URL: 'http://47.100.31.83:8081',
// VITE_APP_BASE_URL: 'https://47.100.31.83:8081',
// appid: '',
VITE_APP_BASE_URL: 'https://ifanda.52zaisheng.cn/dy',
appid: 'wx9251d74fe0e87028',
}
const test = {
VITE_APP_BASE_URL: 'https://47.100.31.83:8081',
appid: 'wxd5xxxxee0fce1c81',
}
const production = {
VITE_APP_BASE_URL: 'https://ifanda.52zaisheng.cn/dy',
appid: 'wx9251d74fe0e87028',
}
export default {
development,
test,
production
}

25
src/env.d.ts vendored Normal file
View File

@ -0,0 +1,25 @@
/// <reference types="vite/client" />
// declare module '*.vue' {
// import { DefineComponent } from 'vue'
// // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
// const component: DefineComponent<{}, {}, any>
// export default component
// }
declare module "*.vue" {
import { ComponentOptions } from "vue";
const componentOptions: ComponentOptions;
export default componentOptions;
}
interface ImportMetaEnv extends Readonly<Record<string, string>> {
readonly VITE_APP_TITLE: string
}
interface ImportMeta {
readonly env: ImportMetaEnv
}

35
src/main.ts Normal file
View File

@ -0,0 +1,35 @@
import { createSSRApp } from "vue";
import uviewPlus from "uview-plus";
import pinia from './store'
import App from "./App.vue";
import './static/style/common.scss'
import TabBar from "@/components/TabBar/index.vue"//路径根据你的文件修改
export function createApp() {
const app = createSSRApp(App);
app.use(uviewPlus);
app.use(pinia);
app.component('TabBar', TabBar)
uni.$u.setConfig({
// 修改$u.config对象的属性
config: {
// 修改默认单位为rpx相当于执行 uni.$u.config.unit = 'rpx'
unit: 'px'
},
// 修改$u.props对象的属性
props: {
// 修改radio组件的size参数的默认值相当于执行 uni.$u.props.radio.size = 30
// checkbox: {
// size: 15
// }
// 其他组件属性配置
// ......
}
})
return {
app,
pinia
};
}

103
src/manifest.json Normal file
View File

@ -0,0 +1,103 @@
{
"name" : "在生万有",
// DCloud ios
"appid" : "__UNI__898003A",
"description" : "",
"versionName" : "1.0.0",
"versionCode" : 100,
"transformPx" : false,
/* 5+App */
"app-plus" : {
"compatible" : {
"ignoreVersion" : true
},
"usingComponents" : true,
"nvueStyleCompiler" : "uni-app",
"compilerVersion" : 3,
"splashscreen" : {
"alwaysShowBeforeRender" : true,
"waiting" : true,
"autoclose" : true,
"delay" : 0
},
/* */
"modules" : {
"Camera" : {}
},
/* */
"distribute" : {
/* android */
"android" : {
"permissions" : [
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
]
},
/* ios */
"ios" : {
"dSYMs" : false
},
/* SDK */
"sdkConfigs" : {
"ad" : {}
},
"icons" : {
"android" : {
"hdpi" : "/Users/admin/workspace/aifanda/project/在生万有/logo 72 x 72.png",
"xhdpi" : "/Users/admin/workspace/aifanda/project/在生万有/logo 96 x 96.png",
"xxhdpi" : "/Users/admin/workspace/aifanda/project/在生万有/logo 144 x144.png",
"xxxhdpi" : "/Users/admin/workspace/aifanda/project/在生万有/logo 192 x192.png"
}
}
}
},
/* */
"quickapp" : {},
// h5
"h5" : {
"router" : {
"base" : "./"
}
},
/* */
"mp-weixin" : {
"appid" : "wx9251d74fe0e87028",
"logoPath" : "https://backend-common.obs.cn-east-3.myhuaweicloud.com/static/pagesLogin/logo-simple.png",
"setting" : {
"urlCheck" : false
},
"usingComponents" : true,
"optimization" : {
"subPackages" : true //
},
"lazyCodeLoading" : "requiredComponents"
},
"mp-alipay" : {
"usingComponents" : true
},
"mp-baidu" : {
"usingComponents" : true
},
"mp-toutiao" : {
"usingComponents" : true,
"setting" : {
"minified" : true
}
},
"uniStatistics" : {
"enable" : false
},
"vueVersion" : "3"
}

135
src/pages.json Normal file
View File

@ -0,0 +1,135 @@
{
"easycom": {
"autoscan": true,
// customhttps://ask.dcloud.net.cn/question/131175
"custom": {
"^u--(.*)": "uview-plus/components/u-$1/u-$1.vue",
"^up-(.*)": "uview-plus/components/u-$1/u-$1.vue",
"^u-([^-].*)": "uview-plus/components/u-$1/u-$1.vue",
// ava
"^Ava(.*)": "@/components/Ava$1/Ava$1.vue",
"^uni-(.*)": "@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue"
}
},
"pages": [
{
"path": "pagesHome/index",
"style": {
"navigationStyle": "custom", //
"navigationBarTitleText": "首页"
}
},
{
"path": "pagesHome/profile",
"style": {
"navigationStyle": "custom", //
"navigationBarTitleText": "我的"
}
}
//pageshttps://uniapp.dcloud.io/collocation/pages
],
"subPackages": [
{
"root": "pagesBattery",
"pages": [
{
"path": "index",
"style": {
"navigationBarTitleText": "电池回收"
}
},
{
"path": "inquiry",
"style": {
"navigationBarTitleText": "我要询价"
}
},
{
"path": "registration",
"style": {
"navigationBarTitleText": "我要登记"
}
}
]
},
{
"root": "pagesScrapSteel",
"pages": [
{
"path": "index",
"style": {
"navigationBarTitleText": "废钢回收"
}
},
{
"path": "registration",
"style": {
"navigationBarTitleText": "我要加入"
}
}
]
},
{
"root": "pagesVehicle",
"pages": [
{
"path": "index",
"style": {
"navigationBarTitleText": "报废车辆回收"
}
},
{
"path": "inquiry",
"style": {
"navigationBarTitleText": "我要询价"
}
},
{
"path": "registration",
"style": {
"navigationBarTitleText": "我要登记"
}
},
{
"path": "recycleFlow",
"style": {
"navigationBarTitleText": "回收流程"
}
},
{
"path": "requiredMaterials",
"style": {
"navigationBarTitleText": "所需材料"
}
}
]
}
],
"tabBar": {
"color": "#7A7E83",
"selectedColor": "#00D2E3",
"custom": true, //
"height": "0px",
"list": [
{
"pagePath": "pagesHome/index",
"text": "工作台"
},
{
"pagePath": "pagesHome/profile",
"text": "我的"
}
]
},
"permissions": {
"scope.userLocation": true,
"scope.userInfo": true,
"scope.snsapi_base": true
},
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "智能回收",
"navigationBarBackgroundColor": "#ffffff",
"backgroundColor": "#ffffff"
},
}

294
src/pagesBattery/index.vue Normal file
View File

@ -0,0 +1,294 @@
<template>
<!-- 轮播图 -->
<CustomSwiper :list="bannerList"> </CustomSwiper>
<!-- 入口 -->
<uni-card
class="entry-card"
:shadow="'0rpx 0rpx 10rpx 0rpx rgba(5,68,37,0.12)'"
:padding="'20px 10px'"
:border="false"
>
<view class="item">
<view
v-for="(item, index) in entryItemList"
:key="index"
@click="handleClick(item)"
class="item"
>
<view>
<view class="text">{{ item.name }}</view>
<view class="desc">{{ item.desc }}</view>
<image :src="`${url}/static/img/battery/${item.path}`"></image>
</view>
</view>
</view>
</uni-card>
<!-- 介绍 -->
<uni-card
class="avatar-card"
:shadow="'0rpx 0rpx 10rpx 0rpx rgba(5,68,37,0.12)'"
:padding="'20px 10px'"
:border="false"
>
<view class="title">回收流程</view>
<view class="flow">
<text class="text">在线登记</text>
<image :src="`${url}/static/img/battery/arrow.png`"></image>
<text class="text">免费上门</text>
<image :src="`${url}/static/img/battery/arrow.png`"></image>
<text class="text">结算打款</text>
<image :src="`${url}/static/img/battery/arrow.png`"></image>
<text class="text">订单完成</text>
</view>
<up-gap height="10" bgColor="#F8F8F8"></up-gap>
<view class="title mt-20">回收物品</view>
<uni-grid :column="2" :showBorder="false" :square="false">
<uni-grid-item
class="item"
v-for="(item, index) in serviceItemList"
:key="index"
>
<uni-card
:shadow="'0rpx 0rpx 10rpx 0rpx rgba(5,68,37,0.12)'"
:padding="'0px'"
:margin="'5px'"
:border="false"
>
<view style="background-color: #e8edff">
<image
mode="aspectFill"
:src="`${url}/static/img/vehicle/${item.path}`"
></image>
</view>
<view class="text-box">
<text class="text">{{ item.name }}</text>
</view>
</uni-card>
</uni-grid-item>
</uni-grid>
<!-- 常见问题 -->
<view class="title mt-20 mb-20">常见问题</view>
<view class="commonQ">
<view v-for="(item, index) in questionList" :key="index">
<view class="question">{{ item.q }}</view>
<view class="answer">
<view v-html="item.a"></view>
</view>
</view>
</view>
<view class="other">
<view>其他问题请咨询客服电话</view>
<view>15150231777</view>
</view>
</uni-card>
</template>
<script setup lang="ts">
import CustomSwiper from "@/components/CustomSwiper/index.vue";
import { url } from "@/utils/data";
const bannerList = [
{
imgUrl: "ba-a1.png",
},
];
const entryItemList = ref([
{
path: "1.png",
name: "我要询价>>",
desc: "极速回复 · 价格透明",
url: "/pagesBattery/inquiry",
},
{
path: "2.png",
name: "我要登记>>",
desc: "免费上门 · 极速打款",
url: "/pagesBattery/registration",
},
]);
const serviceItemList = ref([
{
path: "e1.png",
name: "锂电池包回收",
url: "/pagesVehicle/index",
},
{
path: "e2.png",
name: "锂电模组回收",
url: "/pagesVehicle/index",
},
{
path: "e3.png",
name: "电芯回收",
url: "/pagesVehicle/index",
},
{
path: "e4.png",
name: "极片回收",
url: "/pagesVehicle/index",
},
]);
const questionList = ref([
{
q: "1、为什么我的车无法评估?",
a:
"如若车辆出现以下情况,有概率出现无法评估或信息不完整的情况,您可过段时间后再次进行查询或联系客服进行反馈。<br/>" +
"a、核实车辆型号信息是否正确可在车辆行驶证、合格证、车辆铭牌等资料上进行查询;<br/>" +
"b、该车型出品时间较短如遇此种情况请联系客户反馈我们会及时更新数据库信息;<br/>" +
"c、部分油电混动、增程式及个别特殊车型(如纯进口车型)。",
},
{
q: "2、报告中表显行驶里程和车上实际的里程表数据为什么不一致?",
a:
"1、报告表显行驶里程数据 >车辆里程表的数据分析:疑似调表。<br/>" +
"2、报告表显行驶里程数据=车辆里程表的数据 看是否有疑似调表提醒:<br/>" +
"① 有提示--疑似调表<br/>" +
"② 无提示--需结合充电数据,行驶时间等综合判断是否有调表可能性;<br/>" +
"3、报告表显行驶里程数据小于车辆里程表的数据此时以车辆里程表数据为准 原因分析:<br/>" +
"① 报告每月3日00:00更新本月行驶数据尚未更新。<br/>" +
"② 车辆可能因信号、流量、平台等原因导致行驶数据未及时上传。",
},
{
q: "3、为什么电池健康度数据缺失?",
a:
"首先,如出现该情况,针对数据缺失模块不扣除积分。<br/>" +
"【原因】可能原因是,车辆长时间未行使或充电。车辆若长时间停放,电池化学性能会发生一定变化,从准确性角度考虑,我司不会对电池健康状况做评估。<br/>" +
"【建议】<br/>" +
"① 车辆长时间(超过7天)不使用时尽量保持电池电量40%~60%其它范围有降低动力电池的使用寿命的风险建议每1-2个月对动力电池进行满充后再进行放电至40%~60%不然存在引起动力电池过放、降低电池性能的风,险。<br/>" +
"② 本月充放电后可于下月3日后可再次评估。",
},
{
q: "4、多次查询为何报告数据结果相同?",
a: "新能源车辆电池耐久度设计具有较大冗余空间在行驶里程较短、充放电次数较少时车辆短期内电池各项数据不会出现较大波动建议每次查询时间间隔1个月以上以便查看数据波动。",
},
{
q: "5、为什么表显里程数、健康度评估等数据更新时间不是每月3日?",
a: "新能源车是电子产品,可能会因为信号、硬件传感器等问题导致数据无法传输或上传出现延迟,我们采用最后一次数据上传时间作为数据更新时间。",
},
{
q: "6、为什么检测报告不显示充电次数电池循环次数?",
a: "因为数据传输故障、硬件系统故障、信号缺失等原因,充电数据、循环次数上传不完整,从数据的准确性考虑不做评估展示。",
},
]);
const handleClick = (item: any) => {
uni.navigateTo({
url: item.url, //
});
};
</script>
<style lang="scss" scoped>
.entry-card {
.item {
display: flex;
justify-content: space-evenly;
> view {
background-color: #e8edff;
border-radius: 13rpx;
width: 300rpx;
padding: 20rpx 10rpx;
position: relative;
}
image {
width: 140rpx;
height: 140rpx;
position: absolute;
right: -10rpx;
bottom: -20rpx;
}
.text {
font-weight: 400;
font-size: 28rpx;
color: #294ac7;
line-height: 42rpx;
}
.desc {
font-weight: 400;
font-size: 24rpx;
color: rgba(0, 0, 0, 0.55);
line-height: 42rpx;
position: relative;
z-index: 99;
}
}
.item + .item {
margin-left: 30rpx;
}
}
.avatar-card {
.flow {
display: flex;
justify-content: space-between;
align-items: center;
padding: 40rpx 20rpx;
image {
width: 38rpx;
height: 12rpx;
}
.text {
background: #e8edff;
border-radius: 28rpx;
border: 1px solid rgba(0, 0, 0, 0.35);
font-weight: 400;
font-size: 24rpx;
color: #272727;
padding: 10rpx 10rpx;
}
}
.title {
font-weight: 500;
font-size: 36rpx;
color: #282728;
text-align: center;
line-height: 80rpx;
}
::v-deep .uni-card--shadow {
padding: 0px !important;
}
::v-deep .uni-grid {
justify-content: space-evenly !important;
}
.item {
text-align: center;
image {
width: 100%;
height: 180rpx;
}
.text-box {
background-color: #e8edff;
font-weight: 400;
color: #011b7d;
font-size: 28rpx;
padding-bottom: 20rpx;
margin-top: -10rpx;
}
}
.commonQ {
.question {
font-size: 32rpx;
color: #000;
font-weight: bold;
}
.answer {
font-size: 30rpx;
color: rgba(0, 0, 0, 0.55);
}
}
.other {
font-size: 30rpx;
color: rgba(0, 0, 0, 0.55);
text-align: center;
margin-top: 50rpx;
margin-bottom: 50rpx;
}
}
</style>

View File

@ -0,0 +1,366 @@
<template>
<uni-card
:shadow="'0rpx 0rpx 10rpx 0rpx rgba(5,68,37,0.12)'"
:padding="'0px'"
:margin="'20px'"
:border="false"
>
<view class="title">基础信息</view>
<u-form
labelPosition="left"
:model="model1"
:rules="rules"
ref="form"
:labelWidth="80"
:labelStyle="{ padding: '0rpx 10rpx' }"
:errorType="'border-bottom'"
>
<u-form-item
:prop="`formData.${item.key}`"
:label="item.name"
:required="item.required"
v-for="(item, index) in formAttrList"
:key="index"
@click="item.fn"
>
<u-input
v-if="item.type === 'textarea'"
v-model="(model1.formData as any)[item.key]"
:placeholder="`请输入${item.name}`"
clearable
:customStyle="{}"
border="none"
:disabled="item.disabled"
>
<template #suffix>
<text v-if="item.unit">
{{ item.unit }}
</text>
</template>
</u-input>
<u-input
v-if="item.type === 'input'"
v-model="(model1.formData as any)[item.key]"
:placeholder="`请输入${item.name}`"
clearable
:customStyle="{}"
border="none"
:disabled="item.disabled"
>
<template #suffix>
<text v-if="item.unit">
{{ item.unit }}
</text>
</template>
</u-input>
<u-input
v-if="item.type === 'select'"
:disabled="true"
:disabledColor="'#ffffff'"
v-model="(model1.formData as any)[item.key]"
:placeholder="`请选择${item.name}`"
clearable
:customStyle="{}"
border="none"
>
<template #suffix>
<text v-if="item.unit">
{{ item.unit }}
</text>
</template>
</u-input>
<!-- 上传 -->
<view v-if="item.type === 'upload'">
<view style="padding-left: 20rpx; margin-top: 20rpx">
<image
@click="handleUpload"
v-if="model1.formData.photoUrl"
:src="model1.formData.photoUrl"
mode="widthFix"
style="width: 100%;"
/>
<image
v-else
@click="handleUpload"
:src="`${url}/static/img/battery/upload.png`"
style="width: 48rpx; height: 37rpx"
/>
</view>
</view>
<template #right v-if="item.type === 'select'">
<u-icon name="arrow-right" @click="item.fn"></u-icon>
</template>
</u-form-item>
</u-form>
</uni-card>
<view class="btn-box-fix-btn">
<view
><u-button type="primary" shape="circle" @click="save"
>提交询价</u-button
></view
>
</view>
<block v-for="(item, index) in formAttrList" :key="index">
<u-action-sheet
v-if="item.type === 'select' && item.childKey"
:actions="contrlModalParams[item.childKey].list"
:title="contrlModalParams[item.childKey].title"
:show="contrlModalParams[item.childKey].isShow"
@select="(v: any) => handleSelect(item.childKey, v)"
@close="contrlModalParams[item.childKey].isShow = false"
:closeOnClickAction="true"
></u-action-sheet>
</block>
</template>
<script setup lang="ts">
import { url } from "@/utils/data";
import { PictureApi, BatteryApi, UserApi } from "@/services";
import pinia from "@/store";
import { useMemberStore } from "@/store/index";
const store = useMemberStore(pinia);
const model1 = reactive<any>({
formData: {},
});
const formAttrList = reactive<any>([
{
name: "姓名",
key: "name",
type: "input",
required: true,
unit: "",
},
{
name: "联系方式",
key: "contactInfo",
type: "input",
required: true,
unit: "",
},
{
name: "回收种类",
key: "recyclingType",
type: "select",
childKey: "recyclingType",
required: true,
unit: "",
fn: () => {
contrlModalParams["recyclingType"].isShow = true;
},
},
{
name: "回收重量",
key: "recyclingWeight",
type: "input",
required: true,
unit: "KG",
},
{
name: "上传照片",
key: "photoUrl",
type: "upload",
required: true,
unit: "",
},
{
name: "备注",
key: "remarks",
type: "textarea",
required: false,
unit: "",
},
]);
const rules = reactive({
"formData.name": {
type: "string",
required: true,
message: "请输入姓名",
trigger: ["blur", "change"],
},
"formData.contactInfo": {
type: "string",
required: true,
message: "请输入联系方式",
trigger: ["blur", "change"],
},
"formData.recyclingType": {
type: "string",
required: true,
message: "请选择回收种类",
trigger: ["blur", "change"],
},
"formData.recyclingWeight": {
type: "string",
required: true,
message: "请输入回收重量",
trigger: ["blur", "change"],
},
"formData.photoUrl": {
type: "string",
required: true,
message: "请上传证照片",
trigger: ["blur", "change"],
},
});
const contrlModalParams = reactive<any>({
recyclingType: {
isShow: false,
title: "车辆类型",
list: [
{ name: "锂电池包" },
{ name: "锂电模组" },
{ name: "电芯" },
{ name: "极片" },
],
},
});
const handleSelect = (key: string, v: any) => {
contrlModalParams[key].isShow = false;
if (key === "recyclingType") {
model1.formData.recyclingType = v.name;
}
};
//
const handleUpload = () => {
upload();
// uni.getSetting({success(res){
// if(!res.authSetting['scope.userInfo']) {
// uni.showModal({
// title:'',
// content:'',
// showCancel:false,
// confirmText:'',
// cancelText:'',
// success:(res)=>{
// if(res.confirm) {
// uni.openSetting({success: res => {
// debugger
// if(res.authSetting['scope.userInfo']) {
// upload()
// }
// }})
// }
// },
// })
// }
// }})
};
//
const upload = () => {
uni.chooseImage({
success: (chooseImageRes) => {
const tempFilePaths = chooseImageRes.tempFilePaths;
PictureApi.upload({
files: tempFilePaths[0],
path: tempFilePaths[0],
}).then((res: any) => {
if (res.code === 200) {
model1.formData.photoUrl = res.data.url;
}
});
},
fail: (error) => {
console.log(error);
},
});
};
/**
* 校验
*/
const form = ref();
const check = () => {
return new Promise((resolve) => {
form.value
.validate()
.then((res: boolean) => {
resolve(res);
})
.catch((errors: any) => {
resolve(false);
uni.showToast({
icon: "none",
title: errors[0].message || "校验失败",
});
});
});
};
const save = () => {
check().then((res) => {
if (res) {
startSave();
}
});
// if (store.profile?.token) {
// check().then((res) => {
// if (res) {
// startSave();
// }
// });
// } else {
// uni.login({
// provider: "toutiao",
// success: function (loginRes) {
// UserApi.login({ code: loginRes.code }).then((res: any) => {
// if (res.data) {
// store.setProfile({ token: res.data.token });
// check().then((res) => {
// if (res) {
// startSave();
// }
// });
// } else {
// uni.showToast({ title: "", icon: "none" });
// }
// });
// },
// });
// }
};
const startSave = () => {
BatteryApi.add(model1.formData).then((res) => {
if (res.code === 200) {
uni.showToast({
title: "提交成功",
});
uni.navigateBack();
}
});
};
</script>
<style lang="scss" scoped>
::v-deep .uni-card__content {
padding: 20rpx !important;
height: calc(100vh - 100px);
overflow: auto;
}
::v-deep .uni-card--shadow {
padding: 0px !important;
}
::v-deep .u-form-item {
height: auto;
border-bottom: 1rpx solid rgba(233, 233, 233, 0.76);
margin: 0px 20rpx;
padding: 0px 20rpx;
}
.title {
font-weight: 500;
font-size: 32rpx;
color: #000000;
}
.btn-box-fix-btn {
justify-content: center;
view {
width: 70%;
}
}
</style>

View File

@ -0,0 +1,418 @@
<template>
<uni-card
:shadow="'0rpx 0rpx 10rpx 0rpx rgba(5,68,37,0.12)'"
:padding="'0px'"
:margin="'20px'"
:border="false"
>
<view class="title">基础信息</view>
<u-form
labelPosition="left"
:model="model1"
:rules="rules"
ref="form"
:labelWidth="80"
:labelStyle="{ padding: '0rpx 10rpx' }"
:errorType="'border-bottom'"
>
<u-form-item
:prop="`formData.${item.key}`"
:label="item.name"
:required="item.required"
v-for="(item, index) in formAttrList"
:key="index"
@click="item.fn"
>
<u-input
v-if="item.type === 'textarea'"
v-model="(model1.formData as any)[item.key]"
:placeholder="`请输入${item.name}`"
clearable
:customStyle="{}"
border="none"
:disabled="item.disabled"
>
<template #suffix>
<text v-if="item.unit">
{{ item.unit }}
</text>
</template>
</u-input>
<u-input
v-if="item.type === 'input'"
v-model="(model1.formData as any)[item.key]"
:placeholder="`请输入${item.name}`"
clearable
:customStyle="{}"
border="none"
:disabled="item.disabled"
>
<template #suffix>
<text v-if="item.unit">
{{ item.unit }}
</text>
</template>
</u-input>
<u-input
v-if="item.type === 'select'"
:disabled="true"
:disabledColor="'#ffffff'"
v-model="(model1.formData as any)[item.key]"
:placeholder="`请选择${item.name}`"
clearable
:customStyle="{}"
border="none"
>
<template #suffix>
<text v-if="item.unit">
{{ item.unit }}
</text>
</template>
</u-input>
<!-- 上传 -->
<view v-if="item.type === 'upload'">
<view style="padding-left: 20rpx; margin-top: 20rpx">
<image
@click="handleUpload"
v-if="model1.formData.photoUrl"
:src="model1.formData.photoUrl"
mode="widthFix"
style="width: 100%;"
/>
<image
v-else
@click="handleUpload"
:src="`${url}/static/img/battery/upload.png`"
style="width: 48rpx; height: 37rpx"
/>
</view>
</view>
<template #right v-if="item.type === 'select'">
<u-icon name="arrow-right" @click="item.fn"></u-icon>
</template>
</u-form-item>
</u-form>
</uni-card>
<view class="btn-box-fix-btn">
<view
><u-button type="primary" shape="circle" @click="save"
>提交登记</u-button
></view
>
</view>
<u-datetime-picker
:show="contrlModalParams.isShowTime"
v-model="contrlModalParams.time"
mode="datetime"
@confirm="(v: any) => {handleTime(v)}"
@cancel="contrlModalParams.isShowTime = false"
:closeOnClickOverlay="true"
@close="contrlModalParams.isShowTime = false"
></u-datetime-picker>
<block v-for="(item, index) in formAttrList" :key="index">
<u-action-sheet
v-if="item.type === 'select' && item.childKey"
:actions="contrlModalParams[item.childKey].list"
:title="contrlModalParams[item.childKey].title"
:show="contrlModalParams[item.childKey].isShow"
@select="(v: any) => handleSelect(item.childKey, v)"
@close="contrlModalParams[item.childKey].isShow = false"
:closeOnClickAction="true"
></u-action-sheet>
</block>
</template>
<script setup lang="ts">
import { url } from "@/utils/data";
import { PictureApi, BatteryApi, UserApi } from "@/services";
import {
formatDate
} from "@/utils";
import pinia from "@/store";
import { useMemberStore } from "@/store/index";
const store = useMemberStore(pinia);
const model1 = reactive<any>({
formData: {
preferredVisitTime: formatDate(new Date(), "{y}-{m}-{d}"),
},
});
const formAttrList = reactive<any>([
{
name: "姓名",
key: "name",
type: "input",
required: true,
unit: "",
},
{
name: "联系方式",
key: "contactInfo",
type: "input",
required: true,
unit: "",
},
{
name: "联系地址",
key: "contactAddress",
type: "input",
required: true,
unit: "",
},
{
name: "期望上门时间",
key: "preferredVisitTime",
type: "input",
required: true,
unit: "",
fn: () => {
contrlModalParams.isShowTime = true;
},
},
{
name: "回收种类",
key: "recyclingType",
type: "select",
childKey: "recyclingType",
required: true,
unit: "",
fn: () => {
contrlModalParams["recyclingType"].isShow = true;
},
},
{
name: "回收重量",
key: "recyclingWeight",
type: "input",
required: true,
unit: "KG",
},
{
name: "上传照片",
key: "photoUrl",
type: "upload",
required: true,
unit: "",
},
{
name: "备注",
key: "remarks",
type: "textarea",
required: false,
unit: "",
},
]);
const rules = reactive({
"formData.name": {
type: "string",
required: true,
message: "请输入姓名",
trigger: ["blur", "change"],
},
"formData.contactInfo": {
type: "string",
required: true,
message: "请输入联系方式",
trigger: ["blur", "change"],
},
"formData.contactAddress": {
type: "string",
required: true,
message: "请输入联系地址",
trigger: ["blur", "change"],
},
"formData.preferredVisitTime": {
type: "string",
required: true,
message: "请输入期望上门时间",
trigger: ["blur", "change"],
},
"formData.recyclingType": {
type: "string",
required: true,
message: "请选择回收种类",
trigger: ["blur", "change"],
},
"formData.recyclingWeight": {
type: "string",
required: true,
message: "请输入回收重量",
trigger: ["blur", "change"],
},
"formData.photoUrl": {
type: "string",
required: true,
message: "请上传照片",
trigger: ["blur", "change"],
},
});
const contrlModalParams = reactive<any>({
isShowTime: false,
time: formatDate(new Date(), "{y}-{m}-{d}"),
recyclingType: {
isShow: false,
title: "车辆类型",
list: [
{ name: "锂电池包" },
{ name: "锂电模组" },
{ name: "电芯" },
{ name: "极片" },
],
},
});
const handleSelect = (key: string, v: any) => {
contrlModalParams[key].isShow = false;
if (key === "recyclingType") {
model1.formData.recyclingType = v.name;
}
};
//
const handleUpload = () => {
upload();
// uni.getSetting({success(res){
// if(!res.authSetting['scope.userInfo']) {
// uni.showModal({
// title:'',
// content:'',
// showCancel:false,
// confirmText:'',
// cancelText:'',
// success:(res)=>{
// if(res.confirm) {
// uni.openSetting({success: res => {
// debugger
// if(res.authSetting['scope.userInfo']) {
// upload()
// }
// }})
// }
// },
// })
// }
// }})
};
//
const upload = () => {
uni.chooseImage({
success: (chooseImageRes) => {
const tempFilePaths = chooseImageRes.tempFilePaths;
PictureApi.upload({
files: tempFilePaths[0],
path: tempFilePaths[0],
}).then((res: any) => {
if (res.code === 200) {
model1.formData.photoUrl = res.data.url;
}
});
},
fail: (error) => {
console.log(error);
},
});
};
/**
* 校验
*/
const form = ref();
const check = () => {
return new Promise((resolve) => {
form.value
.validate()
.then((res: boolean) => {
resolve(res);
})
.catch((errors: any) => {
resolve(false);
uni.showToast({
icon: "none",
title: errors[0].message || "校验失败",
});
});
});
};
const save = () => {
check().then((res) => {
if (res) {
startSave();
}
});
// if (store.profile?.token) {
// check().then((res) => {
// if (res) {
// startSave();
// }
// });
// } else {
// uni.login({
// provider: "toutiao",
// success: function (loginRes) {
// UserApi.login({ code: loginRes.code }).then((res: any) => {
// if (res.data) {
// store.setProfile({ token: res.data.token });
// check().then((res) => {
// if (res) {
// startSave();
// }
// });
// } else {
// uni.showToast({ title: "", icon: "none" });
// }
// });
// },
// });
// }
};
const startSave = () => {
BatteryApi.addRegis(model1.formData).then((res) => {
if (res.code === 200) {
uni.showToast({
title: "提交成功",
});
uni.navigateBack();
}
});
};
const handleTime = (v: any) => {
model1.formData.preferredVisitTime = formatDate(v.value, "{y}-{m}-{d} {h}:{i}:{s}");
contrlModalParams.isShowTime = false;
};
</script>
<style lang="scss" scoped>
::v-deep .uni-card__content {
padding: 20rpx !important;
height: calc(100vh - 100px);
overflow: auto;
}
::v-deep .uni-card--shadow {
padding: 0px !important;
}
::v-deep .u-form-item {
height: auto;
border-bottom: 1rpx solid rgba(233, 233, 233, 0.76);
margin: 0px 20rpx;
padding: 0px 20rpx;
}
.title {
font-weight: 500;
font-size: 32rpx;
color: #000000;
}
.btn-box-fix-btn {
justify-content: center;
view {
width: 70%;
}
}
</style>

142
src/pagesHome/index.vue Normal file
View File

@ -0,0 +1,142 @@
<template>
<Layout>
<!-- 轮播图 -->
<CustomSwiper> </CustomSwiper>
<!-- 入口 -->
<uni-card
class="entry-card"
:shadow="'0rpx 0rpx 10rpx 0rpx rgba(5,68,37,0.12)'"
:padding="'20px 10px'"
:border="false"
>
<uni-grid :column="3" :showBorder="false" :square="false">
<uni-grid-item
class="item"
v-for="(item, index) in entryItemList"
:key="index"
>
<view @click="handleClick(item)">
<view>
<image :src="`${url}/static/img/${item.path}`"></image>
</view>
<view>
<text class="text">{{ item.name }}</text>
</view>
</view>
</uni-grid-item>
</uni-grid>
</uni-card>
<!-- 介绍 -->
<uni-card
class="avatar-card"
:shadow="'0rpx 0rpx 10rpx 0rpx rgba(5,68,37,0.12)'"
:padding="'10px 10px'"
:border="false"
>
<view class="title">爱梵达</view>
<image
:src="`/static/avatar/1.jpg`"
:mode="'widthFix'"
style="width: 100%"
/>
<image
:src="`/static/avatar/2.jpg`"
:mode="'widthFix'"
style="width: 100%"
/>
<image
:src="`/static/avatar/3.jpg`"
:mode="'widthFix'"
style="width: 100%"
/>
<image
:src="`/static/avatar/4.jpg`"
:mode="'widthFix'"
style="width: 100%"
/>
<image
:src="`/static/avatar/5.jpg`"
:mode="'widthFix'"
style="width: 100%"
/>
</uni-card>
</Layout>
</template>
<script setup lang="ts">
import CustomSwiper from "@/components/CustomSwiper/index.vue";
import Layout from "@/components/Layout/index.vue";
import { url } from "@/utils/data";
const bannerList = [
{
imgUrl: "v-a1.png",
},
];
const entryItemList = ref([
{
path: "1.png",
name: "报废车辆回收",
url: "/pagesVehicle/index",
},
{
path: "2.png",
name: "电池回收",
url: "/pagesBattery/index",
},
{
path: "3.png",
name: "废钢回收",
url: "/pagesScrapSteel/index",
},
]);
const handleClick = (item: any) => {
uni.navigateTo({
url: item.url, //
});
};
</script>
<style lang="scss" scoped>
.entry-card {
.item {
text-align: center;
image {
width: 74rpx;
height: 76rpx;
}
.text {
font-size: 28rpx;
font-weight: 400;
line-height: 42rpx;
}
}
}
.avatar-card {
.title {
font-weight: 500;
font-size: 34rpx;
color: #282728;
line-height: 80rpx;
padding-left: 30rpx;
&::before {
content: " ";
width: 6rpx;
background: #ff782b;
border-radius: 3rpx;
position: absolute;
height: 32rpx;
top: 46rpx;
left: 20rpx;
}
}
::v-deep .uni-card--shadow {
padding: 0px !important;
}
image + image {
margin-top: -12rpx;
}
}
</style>

141
src/pagesHome/profile.vue Normal file
View File

@ -0,0 +1,141 @@
<template>
<Layout :select="'我的'">
<view class="profile">
<view class="baseinfo">
<view class="head">
<image :src="`${url}/static/img/profile/user.png`" class="user"></image>
<view>
<view>
<text class="name">{{ '抖音用户' || "-" }}</text>
</view>
<view>
<text class="company">{{ '-' || "-" }}</text>
</view>
</view>
</view>
<view class="content">
<u-list :height="'200px'">
<u-list-item v-for="(item, index) in list" :key="index">
<u-cell
:title="item.name"
arrow-direction="right"
isLink
:url="item.path"
:border="false"
@click="hanldeClick(item)"
>
<template #icon>
<view style="width: 40rpx">
<image
:src="`${url}/static/img/profile/${item.icon}`"
mode="widthFix"
/>
</view>
</template>
</u-cell>
</u-list-item>
</u-list>
</view>
</view>
</view>
</Layout>
</template>
<script setup lang="ts">
import Layout from "@/components/Layout/index.vue";
import { url } from "@/utils/data";
const list = reactive([
{
name: "用户协议",
icon: "4.png",
},
{
name: "隐私政策",
icon: "5.png",
},
]);
const hanldeClick = (item: any) => {
if (item.name === "用户协议") {
openDoc("在生万有用户协议");
} else if (item.name === "隐私政策") {
openDoc("在生万有隐私政策");
}
};
const openDoc = (item: string) => {
//
uni.downloadFile({
url: `${url}/static/${item}.docx`,
success: function (res) {
setTimeout(
() =>
uni.openDocument({
filePath: res.tempFilePath,
showMenu: false,
success: function () {
console.log("打开文档成功");
},
fail: function () {
uni.showToast({
title: "暂不支持此类型",
duration: 2000,
icon: "none",
});
},
}),
100
);
},
fail: function (res) {
console.log(res); //
},
});
};
</script>
<style lang="scss" scoped>
.profile {
.bg {
width: 100%;
position: absolute;
top: 0rpx;
z-index: -1;
}
.baseinfo {
padding: 25.64rpx;
.head {
display: flex;
align-items: center;
margin-left: 41rpx;
.user {
width: 110.9rpx;
height: 110.9rpx;
margin-right: 20.51rpx;
}
.name {
font-size: 27rpx;
font-family: Source Han Sans CN;
font-weight: 500;
color: #000000;
}
.company {
font-size: 21rpx;
font-family: Source Han Sans CN;
font-weight: 400;
color: #000000;
}
}
.content {
background: #ffffff;
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(5, 68, 37, 0.12);
border-radius: 13rpx;
padding: 28.21rpx 21.15rpx;
margin-top: 24.36rpx;
image:nth-child(1) {
width: 100%;
}
}
}
}
</style>

View File

@ -0,0 +1,164 @@
<template>
<!-- 轮播图 -->
<CustomSwiper :list="bannerList"> </CustomSwiper>
<!-- 介绍 -->
<uni-card
class="avatar-card"
:shadow="'0rpx 0rpx 10rpx 0rpx rgba(5,68,37,0.12)'"
:padding="'20px 10px'"
:border="false"
>
<view class="title">优质货场</view>
<view class="freight">
<view v-for="(item, index) in list" :key="index">
<view>
<image
mode="aspectFill"
:src="`${url}/static/img/steel/${item.path}`"
></image>
</view>
<view class="text">
<view>主营业务{{ item.business }}</view>
<view>货场名称{{ item.name }}</view>
<view>货场地址{{ item.address }}</view>
<view>联系电话{{ item.phone }}</view>
</view>
</view>
</view>
<view style="margin: 60rpx 0rpx 30rpx 0rpx">
<up-gap height="10" bgColor="#F8F8F8"></up-gap>
</view>
<view class="title">合作方案</view>
<view class="mt-30 mb-30">
<uni-grid :column="2" :showBorder="false" :square="false">
<uni-grid-item
class="item"
v-for="(item, index) in serviceItemList"
:key="index"
>
<view>
<image
mode="aspectFill"
:src="`${url}/static/img/steel/${item.path}`"
></image>
</view>
</uni-grid-item>
<view class="mt-30 mb-30" style="width: 60%">
<view
><u-button type="primary" shape="circle" @click="handleJoin"
>我要加入</u-button
></view
>
</view>
</uni-grid>
</view>
</uni-card>
</template>
<script setup lang="ts">
import { url } from "@/utils/data";
import CustomSwiper from "@/components/CustomSwiper/index.vue";
const bannerList = [
{
imgUrl: "s-a1.png",
},
];
const list = ref([
{
path: "f1.png",
business:
"长期回收废钢(轻一、轻二、轻三、重废、钢板料等)、废纸、泡沫、塑料等,量大价优,欢迎来电咨询。",
name: "在生万有-中悦犇站",
address: "上海市奉贤区川南奉公路8598号",
phone: "刘女士 13341778368",
},
{
path: "f2.png",
business:
"长期回收重废、中废、轻废、小废、岩棉板、花盒等,量大价优,欢迎来电咨询。",
name: "上海宽钢公司",
address: "上海市宝山区兰岗路2号门",
phone: "李女士 13601647155",
},
]);
const serviceItemList = ref([
{
path: "c1.png",
name: "锂电池包",
url: "/pagesVehicle/index",
},
{
path: "c2.png",
name: "锂电模组",
url: "/pagesVehicle/index",
},
{
path: "c3.png",
name: "极片",
url: "/pagesVehicle/index",
},
{
path: "c4.png",
name: "电芯",
url: "/pagesVehicle/index",
},
]);
const handleJoin = () => {
uni.navigateTo({
url: "/pagesScrapSteel/registration", //
});
};
</script>
<style lang="scss" scoped>
.avatar-card {
.freight {
margin-top: 30rpx;
> view {
background: #f3faff;
box-shadow: 0rpx 7rpx 12rpx 0rpx rgba(0, 0, 0, 0.2);
border-radius: 13rpx;
image {
width: 100%;
border-radius: 20rpx;
}
.text {
font-size: 28rpx;
color: #000000;
line-height: 42rpx;
padding: 0px 10px 10px 10px;
}
}
> view + view {
margin-top: 30rpx;
}
}
.title {
font-weight: 500;
font-size: 36rpx;
color: #282728;
text-align: center;
line-height: 80rpx;
}
::v-deep .uni-card--shadow {
padding: 0px !important;
}
::v-deep .uni-grid {
justify-content: space-evenly !important;
}
.item {
text-align: center;
image {
width: 100%;
height: 180rpx;
}
}
}
</style>

View File

@ -0,0 +1,222 @@
<template>
<uni-card
:shadow="'0rpx 0rpx 10rpx 0rpx rgba(5,68,37,0.12)'"
:padding="'0px'"
:margin="'20px'"
:border="false"
>
<view class="title">申请试用</view>
<u-form
labelPosition="left"
:model="model1"
:rules="rules"
ref="form"
:labelWidth="80"
:labelStyle="{ padding: '0rpx 10rpx' }"
:errorType="'border-bottom'"
>
<u-form-item
:prop="`formData.${item.key}`"
:label="item.name"
:required="item.required"
v-for="(item, index) in formAttrList"
:key="index"
@click="item.fn"
>
<u-input
v-if="item.type === 'input'"
v-model="(model1.formData as any)[item.key]"
:placeholder="`请输入${item.name}`"
clearable
:customStyle="{}"
border="none"
:disabled="item.disabled"
>
<template #suffix>
<text v-if="item.unit">
{{ item.unit }}
</text>
</template>
</u-input>
<u-input
v-if="item.type === 'select'"
:disabled="true"
:disabledColor="'#ffffff'"
v-model="(model1.formData as any)[item.key]"
:placeholder="`请选择${item.name}`"
clearable
:customStyle="{}"
border="none"
>
<template #suffix>
<text v-if="item.unit">
{{ item.unit }}
</text>
</template>
</u-input>
<template #right v-if="item.type === 'select'">
<u-icon name="arrow-right" @click="item.fn"></u-icon>
</template>
</u-form-item>
</u-form>
</uni-card>
<view class="btn-box-fix-btn">
<view
><u-button type="primary" shape="circle" @click="save"
>提交试用</u-button
></view
>
</view>
</template>
<script setup lang="ts">
import { SteelApi, UserApi } from "@/services";
import pinia from "@/store";
import { useMemberStore } from "@/store/index";
const store = useMemberStore(pinia);
const model1 = reactive<any>({
formData: {},
});
const formAttrList = reactive<any>([
{
name: "公司名称",
key: "companyName",
type: "input",
required: true,
unit: "",
},
{
name: "联系人",
key: "contactPerson",
type: "input",
required: true,
unit: "",
},
{
name: "联系电话",
key: "contactPhone",
type: "input",
required: true,
unit: "",
},
{
name: "地址",
key: "address",
type: "input",
required: true,
unit: "",
},
]);
const rules = reactive({
"formData.companyName": {
type: "string",
required: true,
message: "请输入公司名称",
trigger: ["blur", "change"],
},
"formData.contactPerson": {
type: "string",
required: true,
message: "请输入联系人",
trigger: ["blur", "change"],
},
"formData.contactPhone": {
type: "string",
required: true,
message: "请输入联系电话",
trigger: ["blur", "change"],
},
"formData.address": {
type: "string",
required: true,
message: "请输入地址",
trigger: ["blur", "change"],
},
});
/**
* 校验
*/
const form = ref();
const check = () => {
return new Promise((resolve) => {
form.value
.validate()
.then((res: boolean) => {
resolve(res);
})
.catch((errors: any) => {
resolve(false);
uni.showToast({
icon: "none",
title: errors[0].message || "校验失败",
});
});
});
};
const save = () => {
check().then((res) => {
if (res) {
startSave();
}
});
// if (store.profile?.token) {
// check().then((res) => {
// if (res) {
// startSave();
// }
// });
// } else {
// uni.login({
// provider: "toutiao",
// success: function (loginRes) {
// UserApi.login({ code: loginRes.code }).then((res) => {
// });
// },
// });
// }
};
const startSave = () => {
SteelApi.add(model1.formData).then((res) => {
if (res.code === 200) {
uni.showToast({
title: "提交成功",
});
uni.navigateBack();
}
});
};
</script>
<style lang="scss" scoped>
::v-deep .uni-card__content {
padding: 20rpx !important;
height: calc(100vh - 200px);
overflow: auto;
}
::v-deep .uni-card--shadow {
padding: 0px !important;
}
::v-deep .u-form-item {
height: auto;
border-bottom: 1rpx solid rgba(233, 233, 233, 0.76);
margin: 0px 20rpx;
padding: 0px 20rpx;
}
.title {
font-weight: 500;
font-size: 32rpx;
color: #000000;
}
.btn-box-fix-btn {
justify-content: center;
view {
width: 70%;
}
}
</style>

247
src/pagesVehicle/index.vue Normal file
View File

@ -0,0 +1,247 @@
<template>
<!-- 轮播图 -->
<CustomSwiper :list="bannerList"> </CustomSwiper>
<!-- 入口 -->
<uni-card
class="entry-card"
:shadow="'0rpx 0rpx 10rpx 0rpx rgba(5,68,37,0.12)'"
:padding="'20px 10px'"
:border="false"
>
<uni-grid :column="4" :showBorder="false" :square="false">
<uni-grid-item
class="item"
v-for="(item, index) in entryItemList"
:key="index"
>
<view @click="handleClick(item)">
<view>
<image :src="`${url}/static/img/vehicle/${item.path}`"></image>
</view>
<view>
<text class="text">{{ item.name }}</text>
</view>
</view>
</uni-grid-item>
</uni-grid>
</uni-card>
<!-- 介绍 -->
<uni-card
class="avatar-card"
:shadow="'0rpx 0rpx 10rpx 0rpx rgba(5,68,37,0.12)'"
:padding="'20px 10px'"
:border="false"
>
<view class="title">服务项目</view>
<uni-grid :column="2" :showBorder="false" :square="false">
<uni-grid-item
class="item"
v-for="(item, index) in serviceItemList"
:key="index"
>
<uni-card
:shadow="'0rpx 0rpx 10rpx 0rpx rgba(5,68,37,0.12)'"
:padding="'0px'"
:margin="'5px'"
:border="false"
>
<view style="background-color: #e8edff">
<image
mode="aspectFill"
:src="`${url}/static/img/vehicle/${item.path}`"
></image>
</view>
<view class="text-box">
<text class="text">{{ item.name }}</text>
</view>
</uni-card>
</uni-grid-item>
</uni-grid>
<!-- 常见问题 -->
<view class="title mt-20 mb-20">常见问题</view>
<view class="commonQ">
<view v-for="(item, index) in questionList" :key="index">
<view class="question">{{ item.q }}</view>
<view class="answer">{{ item.a }}</view>
</view>
</view>
<view class="other">
<view>其他问题请咨询客服电话</view>
<view>15150231777</view>
</view>
</uni-card>
</template>
<script setup lang="ts">
import CustomSwiper from "@/components/CustomSwiper/index.vue";
import { url } from "@/utils/data";
const bannerList = [
{
imgUrl: "v-a1.png",
},
];
const entryItemList = ref([
{
path: "1.png",
name: "回收流程",
url: "/pagesVehicle/recycleFlow",
},
{
path: "2.png",
name: "所需材料",
url: "/pagesVehicle/requiredMaterials",
},
{
path: "3.png",
name: "我要询价",
url: "/pagesVehicle/inquiry",
},
{
path: "4.png",
name: "我要登记",
url: "/pagesVehicle/registration",
},
]);
const serviceItemList = ref([
{
path: "e1.png",
name: "报废车辆回收",
url: "/pagesVehicle/index",
},
{
path: "e2.png",
name: "报废工程车回收",
url: "/pagesVehicle/index",
},
{
path: "e3.png",
name: "报废校车回收",
url: "/pagesVehicle/index",
},
{
path: "e4.png",
name: "报废中巴回收",
url: "/pagesVehicle/index",
},
{
path: "e5.png",
name: "报废大巴车回收",
url: "/pagesVehicle/index",
},
{
path: "e6.png",
name: "报废货车回收",
url: "/pagesVehicle/index",
},
{
path: "e7.png",
name: "报废油罐车回收",
url: "/pagesVehicle/index",
},
{
path: "e8.png",
name: "报废事故车回收",
url: "/pagesVehicle/index",
},
]);
const questionList = ref([
{
q: "1、车辆达到报废标准后还能继续使用吗",
a: "不能。驾驶已达报废标准的机动车在道路上行驶的处500-2000元罚款收缴车辆强制报废并吊销驾驶证。",
},
{
q: "2、车辆是否可以当作破烂直接卖掉",
a: "不可以,机动车报废需到正规的机动车回收拆解企业办理。",
},
{
q: "3、如果车辆在外地无法开回本地进行报废应该如何处理",
a: "车主持身份证明、行驶证、登记证书及车辆到当地符合资质的机动车回收拆解企业办理。车辆拆解后,注册地车辆管理所在一个工作日内受理并出具《机动车注销证明》。",
},
{
q: "4.如果车辆存在违法或事故信息,可以申请报废吗?",
a: "存过车辆存在违法或事故信息,需要先处理完毕,才能进一步申请报废。",
},
{
q: "5、如果车主无法联系上车辆可以如何申请报废",
a: "如果车主无法联系上可以由机动车所有人提出注销申请并填写承担相关法律责任承诺书公安交管部门经系统核查2年以内车辆无运行轨迹、无违法信息、无事故信息的按照灭失情形办理注销登记。",
},
]);
const handleClick = (item: any) => {
uni.navigateTo({
url: item.url, //
});
};
</script>
<style lang="scss" scoped>
.entry-card {
.item {
text-align: center;
image {
width: 74rpx;
height: 76rpx;
}
.text {
font-size: 28rpx;
font-weight: 400;
line-height: 42rpx;
}
}
}
.avatar-card {
.title {
font-weight: 500;
font-size: 36rpx;
color: #282728;
text-align: center;
line-height: 80rpx;
}
::v-deep .uni-card--shadow {
padding: 0px !important;
}
::v-deep .uni-grid {
justify-content: space-evenly !important;
}
.item {
text-align: center;
image {
width: 100%;
height: 180rpx;
}
.text-box {
background-color: #e8edff;
font-weight: 400;
color: #011b7d;
font-size: 28rpx;
padding-bottom: 20rpx;
margin-top: -10rpx;
}
}
.commonQ {
.question {
font-size: 32rpx;
color: #000;
font-weight: bold;
}
.answer {
font-size: 30rpx;
color: rgba(0, 0, 0, 0.55);
}
}
.other {
font-size: 30rpx;
color: rgba(0, 0, 0, 0.55);
text-align: center;
margin-top: 50rpx;
margin-bottom: 50rpx;
}
}
</style>

View File

@ -0,0 +1,446 @@
<template>
<uni-card
:shadow="'0rpx 0rpx 10rpx 0rpx rgba(5,68,37,0.12)'"
:padding="'0px'"
:margin="'20px'"
:border="false"
>
<view class="title">车辆信息</view>
<u-form
labelPosition="left"
:model="model1"
:rules="rules"
ref="form"
:labelWidth="80"
:labelStyle="{ padding: '0rpx 10rpx' }"
:errorType="'border-bottom'"
>
<u-form-item
:prop="`formData.${item.key}`"
:label="item.name"
:required="item.required"
v-for="(item, index) in formAttrList"
:key="index"
@click="item.fn"
>
<u-input
v-if="item.type === 'input'"
v-model="(model1.formData as any)[item.key]"
:placeholder="`请输入${item.name}`"
clearable
:customStyle="{}"
border="none"
:disabled="item.disabled"
>
<template #suffix>
<text v-if="item.unit">
{{ item.unit }}
</text>
</template>
</u-input>
<u-input
v-if="item.type === 'select'"
:disabled="true"
:disabledColor="'#ffffff'"
v-model="(model1.formData as any)[item.key]"
:placeholder="`请选择${item.name}`"
clearable
:customStyle="{}"
border="none"
>
<template #suffix>
<text v-if="item.unit">
{{ item.unit }}
</text>
</template>
</u-input>
<!-- 上传 -->
<view v-if="item.type === 'upload'">
<view>拍照上传后自动识别车辆信息</view>
<view style="padding-left: 20rpx; margin-top: 20rpx">
<image
@click="handleUpload"
:src="
model1.formData.licensePhotoUrl ||
`${url}/static/img/vehicle/upload.png`
"
style="width: 203rpx; height: 133rpx"
/>
</view>
<view style="padding-left: 20rpx; margin-top: 10rpx"
>点击上传行驶证主页</view
>
</view>
<template #right v-if="item.type === 'select'">
<u-icon name="arrow-right" @click="item.fn"></u-icon>
</template>
</u-form-item>
</u-form>
</uni-card>
<view class="btn-box-fix-btn">
<view
><u-button type="primary" shape="circle" @click="save"
>提交询价</u-button
></view
>
</view>
<block v-for="(item, index) in formAttrList" :key="index">
<u-action-sheet
v-if="item.type === 'select' && item.childKey"
:actions="contrlModalParams[item.childKey].list"
:title="contrlModalParams[item.childKey].title"
:show="contrlModalParams[item.childKey].isShow"
@select="(v: any) => handleSelect(item.childKey, v)"
@close="contrlModalParams[item.childKey].isShow = false"
:closeOnClickAction="true"
></u-action-sheet>
</block>
</template>
<script setup lang="ts">
import { url } from "@/utils/data";
import { PictureApi, VehicleApi, UserApi } from "@/services";
import pinia from "@/store";
import { useMemberStore } from "@/store/index";
const store = useMemberStore(pinia);
const model1 = reactive<any>({
formData: {},
});
const formAttrList = reactive<any>([
{
name: "姓名",
key: "name",
type: "input",
required: true,
unit: "",
},
{
name: "联系方式",
key: "contactInfo",
type: "input",
required: true,
unit: "",
},
{
name: "行驶证",
key: "",
type: "upload",
required: true,
unit: "",
},
{
name: "车辆类型",
key: "vehicleType",
type: "select",
childKey: "vehicleType",
required: true,
unit: "",
fn: () => {
contrlModalParams["vehicleType"].isShow = true;
},
},
{
name: "燃油类别",
key: "fuelType",
type: "select",
childKey: "fuelType",
required: true,
unit: "",
fn: () => {
contrlModalParams["fuelType"].isShow = true;
},
},
{
name: "钢圈材质",
key: "wheelMaterial",
type: "select",
childKey: "material",
required: true,
unit: "",
fn: () => {
contrlModalParams["material"].isShow = true;
},
},
{
name: "整备质量",
key: "curbWeight",
type: "input",
required: true,
unit: "KG",
},
{
name: "车架号",
key: "vin",
type: "input",
required: false,
unit: "",
},
{
name: "品牌型号",
key: "brandModel",
type: "input",
required: false,
unit: "",
},
{
name: "系列",
key: "series",
type: "input",
required: false,
unit: "",
},
]);
const rules = reactive({
"formData.name": {
type: "string",
required: true,
message: "请输入姓名",
trigger: ["blur", "change"],
},
"formData.contactInfo": {
type: "string",
required: true,
message: "请输入联系方式",
trigger: ["blur", "change"],
},
"formData.licensePhotoUrl": {
type: "string",
required: true,
message: "请上传行驶证照片",
trigger: ["blur", "change"],
},
"formData.vehicleType": {
type: "string",
required: true,
message: "请选择车辆类型",
trigger: ["blur", "change"],
},
"formData.fuelType": {
type: "string",
required: true,
message: "请选择燃油类型",
trigger: ["blur", "change"],
},
"formData.wheelMaterial": {
type: "string",
required: true,
message: "请选择钢圈材质",
trigger: ["blur", "change"],
},
"formData.curbWeight": {
type: "string",
required: true,
message: "请输入整备质量",
trigger: ["blur", "change"],
},
});
const contrlModalParams = reactive<any>({
vehicleType: {
isShow: false,
title: "车辆类型",
list: [
{ name: "轿车含MPV" },
{ name: "面包车" },
{ name: "中型客车" },
{ name: "大型客车" },
{ name: "轻型载货汽车" },
{ name: "中型载货汽车" },
{ name: "重型载货汽车" },
{ name: "越野汽车SUV" },
{ name: "农用运输车" },
{ name: "牵引汽车" },
{ name: "挂车" },
{ name: "农用机械" },
{ name: "摩托车" },
{ name: "电瓶摩托车" },
],
},
fuelType: {
isShow: false,
title: "燃油类别",
list: [
{ name: "汽油" },
{ name: "柴油" },
{ name: "油气" },
{ name: "纯电" },
{ name: "油电" },
{ name: "无动力" },
{ name: "天然气" },
],
},
material: {
isShow: false,
title: "钢圈材质",
list: [{ name: "铝质" }, { name: "铁质" }],
},
});
const handleSelect = (key: string, v: any) => {
contrlModalParams[key].isShow = false;
if (key === "vehicleType") {
model1.formData.vehicleType = v.name;
} else if (key === "fuelType") {
model1.formData.fuelType = v.name;
} else if (key === "material") {
model1.formData.wheelMaterial = v.name;
}
};
//
const handleUpload = () => {
upload();
// uni.getSetting({success(res){
// if(!res.authSetting['scope.userInfo']) {
// uni.showModal({
// title:'',
// content:'',
// showCancel:false,
// confirmText:'',
// cancelText:'',
// success:(res)=>{
// if(res.confirm) {
// uni.openSetting({success: res => {
// debugger
// if(res.authSetting['scope.userInfo']) {
// upload()
// }
// }})
// }
// },
// })
// }
// }})
};
//
const upload = () => {
uni.chooseImage({
success: (chooseImageRes) => {
const tempFilePaths = chooseImageRes.tempFilePaths;
PictureApi.upload({
files: tempFilePaths[0],
path: tempFilePaths[0],
}).then((res: any) => {
if (res.code === 200) {
model1.formData.licensePhotoUrl = res.data.url;
const ocr = JSON.parse(res.data.ocr);
if (ocr.error_code) {
uni.showToast({
icon: "none",
title: "未识别出相关信息",
});
model1.formData.licensePhotoUrl = "";
model1.formData.ascription = "";
model1.formData.licenseNumber = "";
model1.formData.vin = "";
model1.formData.brandModel = "";
} else {
model1.formData.ascription = ocr.words_result["所有人"].words;
model1.formData.licenseNumber = ocr.words_result["号牌号码"].words;
model1.formData.vin = ocr.words_result["车辆识别代号"].words;
model1.formData.brandModel = ocr.words_result["品牌型号"].words;
}
}
});
},
fail: (error) => {
console.log(error);
},
});
};
/**
* 校验
*/
const form = ref();
const check = () => {
return new Promise((resolve) => {
form.value
.validate()
.then((res: boolean) => {
resolve(res);
})
.catch((errors: any) => {
resolve(false);
uni.showToast({
icon: "none",
title: errors[0].message || "校验失败",
});
});
});
};
const save = () => {
check().then((res) => {
if (res) {
startSave();
}
});
// if (store.profile?.token) {
// check().then((res) => {
// if (res) {
// startSave();
// }
// });
// } else {
// uni.login({
// provider: "toutiao",
// success: function (loginRes) {
// UserApi.login({ code: loginRes.code }).then((res: any) => {
// if (res.data) {
// store.setProfile({ token: res.data.token });
// check().then((res) => {
// if (res) {
// startSave();
// }
// });
// } else {
// uni.showToast({ title: "", icon: "none" });
// }
// });
// },
// });
// }
};
const startSave = () => {
VehicleApi.add(model1.formData).then((res) => {
if (res.code === 200) {
uni.showToast({
title: "提交成功",
});
uni.navigateBack();
}
});
};
</script>
<style lang="scss" scoped>
::v-deep .uni-card__content {
padding: 20rpx !important;
height: calc(100vh - 100px);
overflow: auto;
}
::v-deep .uni-card--shadow {
padding: 0px !important;
}
::v-deep .u-form-item {
height: auto;
border-bottom: 1rpx solid rgba(233, 233, 233, 0.76);
margin: 0px 20rpx;
padding: 0px 20rpx;
}
.title {
font-weight: 500;
font-size: 32rpx;
color: #000000;
}
.btn-box-fix-btn {
justify-content: center;
view {
width: 70%;
}
}
</style>

View File

@ -0,0 +1,26 @@
<template>
<uni-card
:shadow="'0rpx 0rpx 10rpx 0rpx rgba(5,68,37,0.12)'"
:padding="'0px'"
:margin="'20px'"
:border="false"
:cover="'cover'"
>
<image
slot="cover"
style="height: 680rpx"
:src="`${url}/static/img/vehicle/flow.png`"
mode="'aspectFit'"
></image>
</uni-card>
</template>
<script setup >
import { url } from "@/utils/data";
</script>
<style lang="scss" scoped>
::v-deep .uni-card--shadow {
padding: 0px !important;
background: linear-gradient(0deg, #EAF6FF, #FFFFFF);
text-align: center;
}
</style>

View File

@ -0,0 +1,254 @@
<template>
<uni-card
:shadow="'0rpx 0rpx 10rpx 0rpx rgba(5,68,37,0.12)'"
:padding="'0px'"
:margin="'20px'"
:border="false"
>
<view class="title">车辆信息</view>
<u-form
labelPosition="left"
:model="model1"
:rules="rules"
ref="form"
:labelWidth="80"
:labelStyle="{ padding: '0rpx 10rpx' }"
:errorType="'border-bottom'"
>
<u-form-item
:prop="`formData.${item.key}`"
:label="item.name"
:required="item.required"
v-for="(item, index) in formAttrList"
:key="index"
@click="item.fn"
>
<u-input
v-if="item.type === 'input'"
v-model="(model1.formData as any)[item.key]"
:placeholder="`请输入${item.name}`"
clearable
:customStyle="{}"
border="none"
:disabled="item.disabled"
>
<template #suffix>
<text v-if="item.unit">
{{ item.unit }}
</text>
</template>
</u-input>
<u-input
v-if="item.type === 'select'"
:disabled="true"
:disabledColor="'#ffffff'"
v-model="(model1.formData as any)[item.key]"
:placeholder="`请选择${item.name}`"
clearable
:customStyle="{}"
border="none"
>
<template #suffix>
<text v-if="item.unit">
{{ item.unit }}
</text>
</template>
</u-input>
<template #right v-if="item.type === 'select'">
<u-icon name="arrow-right" @click="item.fn"></u-icon>
</template>
</u-form-item>
</u-form>
</uni-card>
<view class="btn-box-fix-btn">
<view
><u-button type="primary" shape="circle" @click="save"
>提交登记</u-button
></view
>
</view>
<block v-for="(item, index) in formAttrList" :key="index">
<u-action-sheet
v-if="item.type === 'select' && item.childKey"
:actions="contrlModalParams[item.childKey].list"
:title="contrlModalParams[item.childKey].title"
:show="contrlModalParams[item.childKey].isShow"
@select="(v: any) => handleSelect(item.childKey, v)"
@close="contrlModalParams[item.childKey].isShow = false"
:closeOnClickAction="true"
></u-action-sheet>
</block>
</template>
<script setup lang="ts">
import { VehicleApi, UserApi } from "@/services";
import pinia from "@/store";
import { useMemberStore } from "@/store/index";
const store = useMemberStore(pinia);
const model1 = reactive<any>({
formData: {},
});
const formAttrList = reactive<any>([
{
name: "车辆所属",
key: "ownerType",
type: "select",
childKey: "ownerType",
required: true,
unit: "",
fn: () => {
contrlModalParams["ownerType"].isShow = true;
},
},
{
name: "联系方式",
key: "contactInfo",
type: "input",
required: true,
unit: "",
},
{
name: "车牌号",
key: "licensePlate",
type: "input",
required: true,
unit: "",
},
{
name: "所在地",
key: "location",
type: "input",
required: true,
unit: "",
},
]);
const rules = reactive({
"formData.ownerType": {
type: "string",
required: true,
message: "请选择车辆所属",
trigger: ["blur", "change"],
},
"formData.contactInfo": {
type: "string",
required: true,
message: "请输入联系方式",
trigger: ["blur", "change"],
},
"formData.licensePlate": {
type: "string",
required: true,
message: "请输入车牌号",
trigger: ["blur", "change"],
},
"formData.location": {
type: "string",
required: true,
message: "请输入所在地",
trigger: ["blur", "change"],
},
});
const contrlModalParams = reactive<any>({
ownerType: {
isShow: false,
title: "车辆所属",
list: [{ name: "个人" }, { name: "单位" }],
},
});
const handleSelect = (key: string, v: any) => {
contrlModalParams[key].isShow = false;
if (key === "ownerType") {
model1.formData.ownerType = v.name;
}
};
/**
* 校验
*/
const form = ref();
const check = () => {
return new Promise((resolve) => {
form.value
.validate()
.then((res: boolean) => {
resolve(res);
})
.catch((errors: any) => {
resolve(false);
uni.showToast({
icon: "none",
title: errors[0].message || "校验失败",
});
});
});
};
const save = () => {
check().then((res) => {
if (res) {
startSave();
}
});
// if (store.profile?.token) {
// check().then((res) => {
// if (res) {
// startSave();
// }
// });
// } else {
// uni.login({
// provider: "toutiao",
// success: function (loginRes) {
// UserApi.login({ code: loginRes.code }).then((res) => {
// });
// },
// });
// }
};
const startSave = () => {
VehicleApi.addRegis({
...model1.formData,
ownerType: model1.formData.ownerType === "个人" ? 0 : 1,
}).then((res) => {
if (res.code === 200) {
uni.showToast({
title: "提交成功",
});
uni.navigateBack();
}
});
};
</script>
<style lang="scss" scoped>
::v-deep .uni-card__content {
padding: 20rpx !important;
height: calc(100vh - 200px);
overflow: auto;
}
::v-deep .uni-card--shadow {
padding: 0px !important;
}
::v-deep .u-form-item {
height: auto;
border-bottom: 1rpx solid rgba(233, 233, 233, 0.76);
margin: 0px 20rpx;
padding: 0px 20rpx;
}
.title {
font-weight: 500;
font-size: 32rpx;
color: #000000;
}
.btn-box-fix-btn {
justify-content: center;
view {
width: 70%;
}
}
</style>

View File

@ -0,0 +1,132 @@
<template>
<uni-card
:shadow="'0rpx 0rpx 10rpx 0rpx rgba(5,68,37,0.12)'"
:padding="'0px'"
:margin="'20px'"
:border="false"
>
<view class="card-content">
<view class="title"
><text class="circle"></text
><text class="text">个人车所需材料</text></view
>
<view class="content">
<view v-for="(item, index) in list" :key="index"
><image :src="`${url}/static/img/vehicle/tip.png`" />{{ item }}</view
>
</view>
</view>
<view> </view>
</uni-card>
<uni-card
class="company"
:shadow="'0rpx 0rpx 10rpx 0rpx rgba(5,68,37,0.12)'"
:padding="'0px'"
:margin="'20px'"
:border="false"
>
<view class="card-content">
<view class="title"
><text class="circle"></text
><text class="text">单位车所需材料</text></view
>
<view class="content">
<view v-for="(item, index) in list1" :key="index"
><image :src="`${url}/static/img/vehicle/tip1.png`" />{{ item }}</view
>
</view>
</view>
<view> </view>
</uni-card>
</template>
<script setup lang="ts">
import { url } from "@/utils/data";
const list = ref([
"1、车主身份证复印件1份",
"2、机动车行驶证原件",
"3、机动车登记证原件大绿本",
"4、车辆牌照前、后两块",
]);
const list1 = ref([
"1、组织机构代码或营业执照1份加盖公章",
"2、机动车行驶证原件",
"3、机动车登记证原件大绿本",
"4、经办人身份证复印件1份",
"5、车辆牌照前、后两块",
"6、机动车业务办理授权委托书加盖公章",
]);
</script>
<style lang="scss" scoped>
::v-deep .uni-card--shadow {
padding: 0px !important;
background: linear-gradient(0deg, #ecfff8, #ffffff);
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(5, 68, 37, 0.12);
border-radius: 13rpx;
}
.card-content {
padding: 40rpx;
.title {
display: flex;
.circle {
width: 42rpx;
height: 42rpx;
background-color: #22d594;
border-radius: 50%;
display: inline-block;
margin-right: 20rpx;
}
.text {
font-weight: 500;
font-size: 36rpx;
color: #000000;
line-height: 42rpx;
background: linear-gradient(
175deg,
#0fc480 0%,
#73f4ad 55.2734375%,
#0fc480 100%
);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
}
.content {
padding: 10rpx;
image {
width: 60rpx;
height: 46rpx;
margin-right: 20rpx;
}
view {
font-weight: 400;
font-size: 26rpx;
color: #000000;
line-height: 90rpx;
display: flex;
align-items: center;
}
}
}
.company {
.card-content {
.title {
.circle {
background: #E8BB32;
}
.text {
background: linear-gradient(
175deg,
#d9ac25 0%,
#f4d26c 55.2734375%,
#d9ac25 100%
);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
}
}
}
</style>

28
src/services/battery.ts Normal file
View File

@ -0,0 +1,28 @@
import { http } from "@/utils/http";
// 新增咨询
export const add = (data: any) => {
return http({
method: "POST",
url: "/api/v1/batteryInquiry/add",
data,
});
};
// 新增登记
export const addRegis = (data: any) => {
return http({
method: "POST",
url: "/api/v1/batteryRegistration/add",
data,
});
};

6
src/services/index.ts Normal file
View File

@ -0,0 +1,6 @@
export * as BatteryApi from './battery'
export * as SteelApi from './steel'
export * as UserApi from './user'
export * as VehicleApi from './vehicle'
export * as PictureApi from './picture'

19
src/services/picture.ts Normal file
View File

@ -0,0 +1,19 @@
import { http } from "@/utils/http";
// 新增咨询
export const upload = (data: any) => {
return http({
method: "POST",
header: {type: 'UPLOAD'},
url: "/api/v1/upload/file/upload",
data,
});
};

20
src/services/steel.ts Normal file
View File

@ -0,0 +1,20 @@
import { http } from "@/utils/http";
// 新增咨询
export const add = (data: any) => {
return http({
method: "POST",
url: "/api/v1/trialApplication/add",
data,
});
};

16
src/services/user.ts Normal file
View File

@ -0,0 +1,16 @@
import { http } from "@/utils/http";
// 单个上传
export const login = (data: any) => {
return http({
method: "POST",
url: "/api/dy/v1/login",
data,
});
};

28
src/services/vehicle.ts Normal file
View File

@ -0,0 +1,28 @@
import { http } from "@/utils/http";
// 新增咨询
export const add = (data: any) => {
return http({
method: "POST",
url: "/api/v1/vehicleInfo/add",
data,
});
};
// 新增登记
export const addRegis = (data: any) => {
return http({
method: "POST",
url: "/api/v1/vehicleRegistration/add",
data,
});
};

6
src/shime-uni.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
export {}
declare module "vue" {
type Hooks = App.AppInstance & Page.PageInstance;
interface ComponentCustomOptions extends Hooks {}
}

BIN
src/static/avatar/1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 722 KiB

BIN
src/static/avatar/2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 954 KiB

BIN
src/static/avatar/3.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 550 KiB

BIN
src/static/avatar/4.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 548 KiB

BIN
src/static/avatar/5.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

View File

@ -0,0 +1,74 @@
body {
}
.c-layout {
padding: 30rpx 25rpx;
}
.uni-toast {
width: 200px;
}
.u-form-item {
height: 70px;
}
.u-input {
padding: 6px 12px !important;
}
.input-placeholder {
font-size: 14px;
}
.c-text-center {
text-align: center;
}
.f-s-12 {
font-size: 12px;
}
.f-s-15 {
font-size: 15px;
}
.l-h-28 {
line-height: 28px;
}
.ml-20 {
margin-left: 20rpx;
}
.mt-30 {
margin-top: 30rpx;
}
.u-action-sheet > view:nth-child(2) {
max-height: 600rpx;
overflow-y: auto;
}
.app-container {
height: calc(100vh - 70px);
overflow: scroll;
position: relative;
}
.btn-box-fix-btn {
margin-top: 60rpx;
display: flex;
background: #ffffff;
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0, 56, 93, 0.12);
border-radius: 13rpx 13rpx 0rpx 0rpx;
padding: 25rpx 50rpx;
position: fixed;
width: calc(100vw - 100rpx);
bottom: 0rpx;
z-index: 999;
}
.uni-calendar-item--multiple .uni-calendar-item--before-checked,
.uni-calendar-item--multiple .uni-calendar-item--after-checked,
.uni-calendar-item__weeks-box .uni-calendar-item--checked,
.uni-datetime-picker--btn {
background-color: #00d2e3 !important;
}
.uni-datetime-picker-btn-text {
color: #00d2e3 !important;
}
.uni-date__x-input {
font-size: 12px;
color: #999;
}
.u-empty {
margin-bottom: 10px !important;
}

View File

@ -0,0 +1,44 @@
// 此文件为uView的主题变量这些变量目前只能通过uni.scss引入才有效另外由于
// uni.scss中引入的样式会同时混入到全局样式文件和单独每一个页面的样式中造成微信程序包太大
// 故uni.scss只建议放scss变量名相关样式其他的样式可以通过main.js或者App.vue引入
$u-main-color: #303133;
$u-content-color: #606266;
$u-tips-color: #909193;
$u-light-color: #c0c4cc;
$u-border-color: #dadbde;
$u-bg-color: #f3f4f6;
$u-disabled-color: #c8c9cc;
$u-primary: #00D2E3;
$u-primary-dark: #398ade;
$u-primary-disabled: #9acafc;
$u-primary-light: #ecf5ff;
$u-warning: #f9ae3d;
$u-warning-dark: #f1a532;
$u-warning-disabled: #f9d39b;
$u-warning-light: #fdf6ec;
$u-success: #5ac725;
$u-success-dark: #53c21d;
$u-success-disabled: #a9e08f;
$u-success-light: #f5fff0;
$u-error: #f56c6c;
$u-error-dark: #e45656;
$u-error-disabled: #f7b2b2;
$u-error-light: #fef0f0;
$u-info: #909399;
$u-info-dark: #767a82;
$u-info-disabled: #c4c6c9;
$u-info-light: #f4f4f5;
// scss混入为了少写几行#ifndef
@mixin flex($direction: row) {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: $direction;
}

22
src/store/counter.ts Normal file
View File

@ -0,0 +1,22 @@
import { defineStore } from 'pinia'
export const useStore = defineStore('counter', {
state: () => {
return {
someState: '你好 pinia',
}
},
// persist: true,
// 配置持久化
persist: {
// 调整为兼容多端的API
storage: {
setItem(key, value) {
uni.setStorageSync(key, value)
},
getItem(key) {
return uni.getStorageSync(key)
},
},
}
})

9
src/store/index.ts Normal file
View File

@ -0,0 +1,9 @@
import { createPinia } from 'pinia'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
// 创建pinia实例imp
const pinia = createPinia()
// 导出pinia实例给main使用
pinia.use(piniaPluginPersistedstate)
export default pinia
export * from './modules/member'

View File

@ -0,0 +1,12 @@
import { defineStore } from 'pinia'
import { ref } from 'vue'
export const useAddressStore = defineStore('address', () => {
const selectedAddress = ref()
const changeSelectedAddress = (val:any) => {
selectedAddress.value = val
}
return { selectedAddress, changeSelectedAddress }
})

View File

@ -0,0 +1,81 @@
import { defineStore } from "pinia";
import { ref } from "vue";
import _ from "underscore";
import type { LoginResult } from "@/types/user";
// 定义 Store
export const useMemberStore = defineStore(
"member",
() => {
// 会员信息
const profile = ref<LoginResult>({
token: "",
userInfo: {
userName: "",
factoryName: "",
},
menusList: [],
menusNameList: [],
err: null,
});
const mechanism = ref<any>({
mechanismCode: "",
mechanismName: "",
});
// 保存会员信息,登录时使用
const setProfile = (val: any) => {
profile.value = { ...profile.value, ...val };
profile.value.menusNameList = _.pluck(val.menusList, "name");
};
const setErr = (v: any) => {
profile.value.err = v;
};
// 清理会员信息,退出时使用
const clearProfile = () => {
profile.value = {
token: "",
userInfo: {
userName: "",
factoryName: "",
},
menusList: [],
menusNameList: [],
};
mechanism.value.mechanismCode = ""
mechanism.value.mechanismName = ""
};
const setMechanism = (v: { mechanismCode: ""; mechanismName: "" }) => {
mechanism.value = v;
};
// 记得 return
return {
profile,
setProfile,
setErr,
clearProfile,
mechanism,
setMechanism,
};
},
{
// 配置持久化
persist: {
// 调整为兼容多端的API
storage: {
setItem(key, value) {
uni.setStorageSync(key, value);
},
getItem(key) {
return uni.getStorageSync(key);
},
},
},
}
);

10
src/types/baseInfo.d.ts vendored Normal file
View File

@ -0,0 +1,10 @@
type SupplierType = {
id: number,
name: string
}
type Supplier = {
id: number,
name: string,
cardCode: string,
}

10
src/types/components.d.ts vendored Normal file
View File

@ -0,0 +1,10 @@
import NavBar from '@/components/NavBar/NavBar.vue'
import NavBarLayout from '@/components/NavBar/NavBarLayout.vue'
declare module '@vue/runtime-core' {
export interface GlobalComponents {
NavBar: typeof NavBar;
NavBarLayout: typeof NavBarLayout
}
}
// 定义组件实例类型 一般用于获取子节点的对象 (父调子

7
src/types/dto.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
import type { DeviceType } from "@/utils/enum"
export type DeviceItem = {
id: number
deviceName: string,
deviceType: DeviceType
}

34
src/types/global.d.ts vendored Normal file
View File

@ -0,0 +1,34 @@
declare var wx: any;
declare var $_: any;
export type PageResult<T> = {
items: T[],
counts: number,
page: number,
pages: number,
pageSize: number
}
export type PageParams = {
page?: number,
pageSize?: number
}
export type Result = {
code: number,
data: T,
message: string,
time: string
}
export type ComType = {[attrName: string]: any }
export type BaseField = {
updateTime: string;
createTime: string;
createUserId: number;
createUserName: string;
updateUserId: number;
updateUserName: string;
isDeleted: boolean;
}

5
src/types/home.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
export type BannerItem = {
imgUrl: string,
id: number,
herfUrl: string
}

218
src/types/order.d.ts vendored Normal file
View File

@ -0,0 +1,218 @@
interface PageResult<T> {
isLoading?: boolean
noMoreData?: boolean,
total: number;
list: T[];
pageNum: number;
pageSize: number;
}
interface Order {
id?: number;
deviceId?: number; //设备id
deviceName?: string; // 设备名称
userId?: number | string; //供应商id
cardId?: number; //库存卡id
cardNumber?: string; //undefined
userName?: string; //undefined
productId?: number | string; //产品id
productName?: string; //undefined
imagesId?: number | undefined; //弃用
imageUrls?: string; //弃用
carNumber: string; //车牌号
receiptNumber?: string; //收货单号
grossWeight?: number; //毛重
tare?: string; //皮重
grossTime?: string; //过毛日期
tareTime?: string; //过皮日期
netWeight?: number; //净重
buttonType?: number; //扣杂状态0扣杂1扣点
points?: number; //扣点
buckleMiscellaneous?: number; //扣杂
price?: number; //单价
balanceTotalPrice?: number; //结算总价 实际付款
totalPrice?: number; //实际总价 预估价格
weighingMethod?: number; //称重方式0有皮重 1零皮重
multiCategory?: number; //多品类0单品类 1多品类
notes?: string; //备注
scaleStatus?: number; // 磅单状态:0待定价1待过皮2待审核3已审核待支付4已支付
paymentMethod?: string; //支付方式0:未支付,1:现金支付2银行卡支付3线上支付微信4支付宝
updateTime?: string; //修改时间
repairTime?: string; //补单时间
createTime?: string; //创建时间
updateUserId?: number; //修改人
createUserId?: number; //创建人
reviewerUserId?: string; //审核人
reviewerUserName?: string; // 审核人名称
pricingUserId?: string; //定价人
pricingUserName?: string; //定价人名称
fileList?: array;
subtractNum?: number; // input 扣杂扣点参数
isChecked?: boolean;
[attrName: string]: any;
}
interface ReceiveSummaryCount {
totalAmount?: number; // 审核过的收货订单
totalPaid?: number; // 已支付的收货总量
totalUnpaid?: number; // 未支付的收货总量
totalPayment?: number; // 总支付金额
totalPaidPrice?: number; // 已经支付的金额
totalUnpaidPrice?: number; // 未支付的金额
totalReceipt?: number; // 收货单数量已审核的
averagePrice?: number; // 平均单价
rankings?: Array;
}
interface ShipmentSummaryCount {
totalAmount?: number; // 收货汇总:审核过收货总量
totalPayShipment?: number; // 已支付的出货总
totalUnPayShipment?: number; // 未支付的出货总量
totalCollection?: number; // 总收款
totalPayCollection?: number; // 已经收到的收款
totalUnPayCollection?: number; // 未收到的收款
totalReceipt?: number; // 收货单数量已审核的
averagePrice?: number; // 平均单价
rankings?: Array;
}
// 分页结构
interface OrderPage<T> {
total: number;
list: T;
pageNum: number;
pageSize: number;
}
interface ReceiveSummary {
totalReceipt: number; // 本月总出货
totalExpenditure: number; // 本月总收入
toBePriced: number; // 待收货
toBeTare: number; // 待过皮重
audit: number; // 付款审核
toBePaid: number; // 待支付
}
type PageParams = {
pageNum: number;
pageSize: number;
pricingUserId?: string; // 定价人
userId?: string; // 供应商id
productId?: string; // 产品id
repairFlag?: boolean; // 是否为补单,true 是未补单false是补单
scaleStatus?: number; // 磅单状态:0待定价1待过皮2待审核3已审核待支付4已支付
isDeleted?: boolean;
userName?: string; // 供应商名称
receiptNumber?: string;
startTime?:string;
endTime?:string;
};
interface Shipment {
id: string;
userId?: number; //供应商id
productId?: number; //产品id
cardId?: number; //库存卡id
imagesId?: number; //图片表id
deviceId?: number; //设备id
carNumber?: string; //车牌号
scaleStatus?: number; //出库单状态
orderNumber?: string; //订单编号
grossWeight: number; //毛重
grossTime?: string; //过毛时间
tare: number; //皮重
tareTime?: string; //过皮时间
netWeight?: number; //净重
number?: number; //数量
notes?: string; //备注
settlementNotes?: string; //结算备注
deliveryMethod?: number; //提货方式:0:送货1:自提
phone?: string; //手机号
box?: string; //箱号
title?: string; //封号
freight?: number; //运费
incidentals?: number; //杂费
pricingPerson?: string; //定价人
reviewerId?: string; //审核人
buttonType: number; //扣点状态默认0扣杂1扣点
points?: string; //扣点
buckleMiscellaneous?: string; //扣杂
unitPrice?: number; //结算单价
estimatePrice?: number; //预估金额 结算总价
totalPrice?: number; //结算金额 实际金额
realIncome?: number; //实际收入 实际收入 实收金额
errorPrice?: string; //误差金额
repairTime?: string; //补单时间
createTime?: string; //undefined
createUserId?: string; //undefined
updateUserId?: string; //undefined
updateTime?: string; //undefined
isDeleted?: string; //删除标识true删除false未删除
settlementWeight?: number; // 结算重量
settlementGross: number; // 结算毛重
settlementTare: number; // 结算皮重
settlementNet?: number; // 结算净重
signTime?: string; // 签收时间
paymentMethod?: string; //支付方式0:未支付,1:现金支付2银行卡支付3线上支付微信4支付宝
userType?: number; //用户类型0刷脸1刷卡
[attrName: string]: any;
}
// 出货单排行
interface ShipmentRank {
userId: number;
userName: string;
productId: number;
productName: string; // 产品名称
totalAmount: number; // 总收货量
totalPayment: number; //总应付总额
totalOrderNumber: number; // 收货单数量
averagePrice: number; // 均价
}
// 出库分类
interface ShipmentTypeCount {
totalAmount: number; // 收货汇总:审核过收货总量
totalPayShipment: number; // 已支付的出货总量
totalUnPayShipment: number; // 未支付的出货总量
totalCollection: number; // 总收款
totalPayCollection: number; // 已经收到的收款
totalUnPayCollection: number; // 未收到的收款
totalReceipt: number; // 收货单数量已审核的
averagePrice: number; // 平均单价
rankings: ShipmentRank[]; // 出货产品汇总
}
// 收货产品
interface ReceiveProduct {
id?: string; // 收货产品id
reProductsName?: string; //收货产品名称
reCategoryId?: string; //收货分类id
reCategoryName?: string;
//收货分类名称
substationName?: string;
//分站名称
minPrice?: string;
//产品的最低价格
maxPrice?: string;
//产品的最高价格
commonPrice?: string;
//产品的常用价格
isDeleted?: boolean; //逻辑删除 TRUE=是 FALSE=否
}
// 库存卡
interface StockCard {
id: number
cardCode?: string,
type?: number, // 库存卡类型1=出库2=入库
cardCode?: string,
name?: string,
customUserName?:string
}

8
src/types/resouce.d.ts vendored Normal file
View File

@ -0,0 +1,8 @@
interface Resource {
businessId: number,
orderType: number, // 1入库单 2出库单
imagesType: number, // 0:普通资源1皮重 2毛重
url: string,
urlName: string,
urlSuffix: string, // 附件后缀
}

39
src/types/user.d.ts vendored Normal file
View File

@ -0,0 +1,39 @@
export type User = {
name: string;
gender: number; // 性别1=男2=女
phone: string;
factoryName: string; // 货场名称
factoryAddress: string; //货场详细地址
provinceId: number;
areaId: number;
citiyId: number;
userType: number;
userName: string;
password: string;
state: number; // 状态 1=有效 0=无效
cardCode?: string; // 卡号
roleVos?: array
} & BaseField;
interface Customer {
id: number,
name?: string,
stockCardId?: number,
contacts?:string,
cardCode?: string,
}
export type MenusItem = {
id: number,
name: string,
[attrName: string]: any;
}
export type LoginResult = {
menusList: array<MenusItem>
token: string,
userId?:string,
userInfo: User,
userName?: string,
[attrName: string]: any;
}

9
src/types/uview.d.ts vendored Normal file
View File

@ -0,0 +1,9 @@
declare module "uview-plus"
declare module "uview-plus" {
global {
interface Uni {
$u: any;
}
}
}

80
src/uni.scss Normal file
View File

@ -0,0 +1,80 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量同时无需 import 这个文件
*/
/* 颜色变量 */
/* uni.scss */
@import 'uview-plus/theme.scss';
$u-primary: #294AC7 !important;
/* 行为相关颜色 */
$uni-color-primary: #294AC7; // #007aff
$uni-color-success: #4cd964;
$uni-color-warning: #f0ad4e;
$uni-color-error: #302423;
/* 文字基本颜色 */
$uni-text-color: #333; // 基本色
$uni-text-color-inverse: #fff; // 反色
$uni-text-color-grey: #999; // 辅助灰色如加载更多的提示信息
$uni-text-color-placeholder: #808080;
$uni-text-color-disable: #c0c0c0;
/* 背景颜色 */
$uni-bg-color: #fff;
$uni-bg-color-grey: #f8f8f8;
$uni-bg-color-hover: #f1f1f1; // 点击状态颜色
$uni-bg-color-mask: rgba(0, 0, 0, 0.4); // 遮罩颜色
/* 边框颜色 */
$uni-border-color: #c8c7cc;
/* 尺寸变量 */
/* 文字尺寸 */
$uni-font-size-sm: 12px;
$uni-font-size-base: 14px;
$uni-font-size-lg: 16;
/* 图片尺寸 */
$uni-img-size-sm: 20px;
$uni-img-size-base: 26px;
$uni-img-size-lg: 40px;
/* Border Radius */
$uni-border-radius-sm: 2px;
$uni-border-radius-base: 3px;
$uni-border-radius-lg: 6px;
$uni-border-radius-circle: 50%;
/* 水平间距 */
$uni-spacing-row-sm: 5px;
$uni-spacing-row-base: 10px;
$uni-spacing-row-lg: 15px;
/* 垂直间距 */
$uni-spacing-col-sm: 4px;
$uni-spacing-col-base: 8px;
$uni-spacing-col-lg: 12px;
/* 透明度 */
$uni-opacity-disabled: 0.3; // 组件禁用态的透明度
/* 文章场景相关 */
$uni-color-title: #2c405a; // 文章标题颜色
$uni-font-size-title: 20px;
$uni-color-subtitle: #555; // 二级标题颜色
$uni-font-size-subtitle: 18px;
$uni-color-paragraph: #3f536e; // 文章段落颜色
$uni-font-size-paragraph: 15px;

115
src/utils/data.ts Normal file
View File

@ -0,0 +1,115 @@
import {ScaleStatus} from './enum'
export const url = 'https://tiktok-common.obs.cn-east-3.myhuaweicloud.com'
export const timeList = [
{
id: 2,
name: "昨日",
},
{
id: 1,
name: "今日",
},
{
id: 6,
name: "本周",
},
{
id: 3,
name: "本月",
},
{
id: 4,
name: "本年",
},
];
export const homeInitData = {
receiveList: [
{
id: 1,
title: "待定价",
icon: "1.png",
num: 0,
path: `/pagesReceive/pricing?scaleStatus=${ScaleStatus.ToBePriced}`,
},
{
id: 2,
title: "待过皮重",
icon: "2.png",
num: 0,
path: `/pagesReceive/pricing?scaleStatus=${ScaleStatus.ToBeTare}`,
},
{
id: 3,
title: "待审核",
icon: "3.png",
num: 0,
path: `/pagesReceive/payReview?scaleStatus=${ScaleStatus.ToBeReview}`,
},
{
id: 4,
title: "待付款",
icon: "4.png",
num: 0,
path: `/pagesReceive/payReview?scaleStatus=${ScaleStatus.ToBePay}`,
},
{
id: 5,
title: "已付款",
icon: "5.png",
num: 0,
path: `/pagesReceive/payList?scaleStatus=${ScaleStatus.Paid}`,
},
{
id: 5,
title: "收货补单",
icon: "6.png",
num: 0,
path: "/pagesApp/receiveSpl",
},
],
shipmentList: [
{
id: 1,
title: "待出货",
icon: "7.png",
num: 0,
path: "/pagesShipment/shipmenting?scaleStatus=0",
},
{
id: 2,
title: "待过毛重",
icon: "8.png",
num: 0,
path: "/pagesShipment/shipmenting?scaleStatus=1",
},
{
id: 3,
title: "待结算",
icon: "9.png",
num: 0,
path: "/pagesShipment/shipmentSettlement?scaleStatus=2",
},
{
id: 4,
title: "待收款",
icon: "10.png",
num: 0,
path: "/pagesShipment/pendingPayment",
},
{
id: 5,
title: "已收款",
icon: "11.png",
num: 0,
path: "/pagesShipment/receivedPayment",
},
{
id: 5,
title: "出货补单",
icon: "12.png",
num: 0,
path: "/pagesApp/shipmentSpl",
},
],
};

117
src/utils/enum.ts Normal file
View File

@ -0,0 +1,117 @@
// 1收货2出货
export enum OrderType {
Receive = 1,
Shipment = 2,
Pay = 3,
Income = 4
}
// 扣杂状态0扣杂1扣点
export enum ButtonType {
BuckleMiscellaneous = 0,
Points = 1,
}
// 称重方式0有皮重 1零皮重
export enum WeighingMethod {
Yes = 0,
No = 1,
}
// 多品类0单品类 1多品类
export enum MultiCategory {
Single = 0,
Multiple = 1,
}
// 0:普通资源1皮/毛 传参只有0,1
export enum ImagesType {
NORMARL = 0,
Tare = 1,
GROSSWEIGHT = 2,
// Settlement = 3,
// Payment = 4
}
//磅单状态:0待定价1待过皮2待审核3已审核待支付4已支付
// 磅单状态0待出货1:待过毛2待审核3已审未付4已审已付
export enum ScaleStatus {
ToBePriced = 0,
ToBeTare = 1,
ToBeReview = 2,
ToBePay = 3,
Paid = 4,
ToBeShipment = 0,
ToBeGrossWeight = 1,
ToBeShipmentReview = 2,
ToBeShipmentPay = 3,
ShipmentPaid = 4
}
// 1 出货结算 2 暂不收款 3 立即收款
export enum ScaleStatusBtnType {
ShipmentSettlement = 1,
ShipmentNoPay = 2,
ShipmentPay = 3
}
// 支付方式0:未支付,1:现金支付2银行卡支付3线上支付微信4支付宝
export enum PaymentMethod {
NoPay = 0,
Cash = 1,
BankCard = 2,
WeChat = 3,
Alipay = 4
}
//用户类型0刷脸1刷卡
export enum UserType {
Face = 0,
Card = 1,
}
export enum UsersType {
Staff = 1,
Purchaser = 2,
Customer = 3,
}
// 提货方式:0:送货1:自提
export enum DeliveryMethod {
Deliver = 0,
SelfPickup = 1
}
export enum DeviceType {
Printer = 0,
Weighbridge = 1
}
// 1=出库客户2=入库(供应商)
export enum StockCardType {
Shipment = 1,
Receive = 2
}
// 今日 昨日 本月 本年 自定义
export enum TimeRange {
Today = 1,
Yesterday = 2,
Month = 3,
Year = 4,
Custom = 5,
Week = 6
}
// 消息跳转类型 0=收货待定价1=收货待审核2=待出库3=出库审核
export enum MsgType {
ToBePriced = 0,
ToBeReview = 1,
ToBeShipment = 2,
ToBeShipmentReview = 3
}
export enum settlementConfig {
// 正常计算、抹分、抹角分、抹元、分位四舍五入、角位四舍五入、元位四舍五入
NORMAL = 1,
REMOVEF = 2,
REMOVEJ = 3,
REMOVEY = 4,
HALFF = 5,
HALFJ = 6,
HALFY = 7
}

150
src/utils/http.ts Normal file
View File

@ -0,0 +1,150 @@
import { useMemberStore } from "@/store/modules/member";
import ENV_CONFIG from "../config/env";
import pinia from "@/store";
// 基础地址
let baseUrl = "";
// #ifdef H5
(process.env as any).config = ENV_CONFIG;
// #endif
const store = useMemberStore(pinia);
baseUrl = (process.env as any).config[(process.env as any).NODE_ENV]
.VITE_APP_BASE_URL;
const obj = {
// 拦截前触发
invoke(options: UniApp.RequestOptions) {
// 超时时间
options.timeout = 10000;
options.url = baseUrl + '' + options.url;
// 请求头标识
// 1.小程序唯一标识
// 'source-client' 'miniapp'
options.header = { ...options.header };
options.header["source-client"] = "miniapp";
// 2.注入token
// 2.1 获取token
const token = store.profile?.token;
if (token) {
options.header["x-userToken"] = token;
}
if (options.url.indexOf("/api/db/getCommonDbPhone") === -1) {
options.header["mechanismCode"] = store.mechanism.mechanismCode;
// options.header["mechanismName"] = store.mechanism.mechanismName;
}
},
};
// 请求拦截器
uni.addInterceptor("request", obj);
uni.addInterceptor("uploadFile", obj);
interface Data<T> {
code: string | number;
data: T;
msg: string;
result: T;
message: string;
}
// 响应拦截器
/***
* 1001
* 1002
*/
export const http = <T>(options: UniApp.RequestOptions) => {
return new Promise<Data<T>>((resolve, reject) => {
if ((options as any).header?.type === "UPLOAD") {
// 压缩图片
uni.compressImage({
src: (options as any).data.path,
quality: 80, // 压缩质量
success: (compressRes) => {
const compressedTempFilePath = compressRes.tempFilePath;
uni.uploadFile({
header: {
"x-userToken": store.profile?.token,
// #ifdef H5
"Content-Type": "multipart/form-data",
// #endif
},
timeout: 1800000,
url: options.url, //仅为示例,非真实的接口地址
fileType: "image",
// #ifdef H5
files: (options as any).data.files,
// #endif
// #ifdef MP-WEIXIN || MP-TOUTIAO
filePath: compressedTempFilePath,
// #endif
name: "file",
formData: {
file: (options as any).data.files,
}, // HTTP 请求中其他额外的 form data
success: (res) => {
resolve(JSON.parse(res.data) as Data<T>);
},
fail(err) {
console.log("上传失败了", err);
resolve(err as any);
},
});
},
fail: (compressErr) => {
console.error("compress fail:", compressErr);
},
});
} else {
uni.request({
...options,
dataType: "string", //1.先将dataType设置为string
success(res) {
var json = (res.data as any).replace(
/:s*([0-9]{15,})s*(,?)/g,
': "$1" $2'
);
//2.根据后端返回的数据调用一次或者两次replace替换
var json1 = json.replace(/:s*([0-9]{15,})s*(,?)/g, ': "$1" $2');
//3.手动转换回json数据即可
let res1: any = JSON.parse(json1);
console.log(res1);
if (res.statusCode >= 200 && res.statusCode < 300) {
if ([1001, 1002, 1003, 1004].indexOf(res1.code) > -1) {
uni.showToast({
icon: "none",
title: (res1 as Data<T>).message || "请求失败",
});
store.clearProfile();
uni.reLaunch({
url: "/pagesLogin/login/index",
});
return;
} else if ([500, 5001, 10001].indexOf(res1.code) > -1) {
uni.showToast({
icon: "none",
title: (res1 as Data<T>).message || "请求失败",
});
return;
}
resolve(res1 as Data<T>);
} else {
uni.showToast({
icon: "none",
title: (res1 as any).msg || "请求失败",
});
reject(res1);
}
},
fail(err) {
uni.showToast({
icon: "none",
// title: JSON.stringify(err),
title: "网络错误,请检查网络",
});
reject(err);
},
});
}
});
};

443
src/utils/index.ts Normal file
View File

@ -0,0 +1,443 @@
import { OrderType, TimeRange } from "./enum";
export function formatDate(time: any, cFormat: string) {
const format = cFormat || "{y}-{m}-{d}";
const date = new Date(time);
const formatObj: any = {
//年
y: date.getFullYear(),
//月
m: date.getMonth() + 1,
//日
d: date.getDate(),
//小时
h: date.getHours(),
//分钟
i: date.getMinutes(),
//秒
s: date.getSeconds(),
//星期
a: date.getDay(),
};
const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
const value = formatObj[key];
// Note: getDay() returns 0 on Sunday
if (key === "a") {
//如果key是a就是星期格式化成一~日
//例如formatDate(new Date(), '{y}-{m}-{d}-{h}-{i}-{s}-{a}');
//会输出2021-10-29-00-00-00-五
//星期的value会返回0-6['日', '一', '二', '三', '四', '五', '六'][2]代表周二
return ["日", "一", "二", "三", "四", "五", "六"][value];
}
//padStart用于字符串头部补全2个字符如果不够前面补0
return value.toString().padStart(2, "0");
});
return time_str;
}
export function getCurrentMonthStartAndEnd() {
let now = new Date();
let currentMonthStart = new Date(now.getFullYear(), now.getMonth(), 1);
let currentMonthEnd = new Date(now.getFullYear(), now.getMonth() + 1, 0);
return {
start: currentMonthStart,
end: currentMonthEnd,
};
}
export function getCurrentYearStartAndEnd() {
let now = new Date();
let currentYearStart = new Date(now.getFullYear(), 0, 1); // 0 代表一月
let currentYearEnd = (new Date(now.getFullYear() + 1, 0, 1) as any) - 1; // 下一年的一月一日减一毫秒
return {
start: currentYearStart,
end: currentYearEnd,
};
}
export function getCurrentWeekStartAndEnd() {
let startTime = getMonday("s", 0);
let endTime = getMonday("e", 0);
let time1 = new Date(getMonday("s", 0)).getTime();
let time2 = new Date(new Date(new Date().setHours(0, 0, 0))).getTime();
if (time1 > time2) {
startTime = getMonday("s", -1);
endTime = getMonday("e", -1);
}
return {
start: startTime,
end: endTime,
};
}
function getMonday(type: string, dates: number) {
var now = new Date();
var nowTime = now.getTime();
var day = now.getDay();
var longTime = 24 * 60 * 60 * 1000;
var n = longTime * 7 * (dates || 0);
let dd: any = null;
if (type == "s") {
dd = nowTime - (day - 1) * longTime + n;
}
if (type == "e") {
dd = nowTime + (7 - day) * longTime + n;
}
dd = new Date(dd);
var y = dd.getFullYear();
var m = dd.getMonth() + 1;
var d = dd.getDate();
m = m < 10 ? "0" + m : m;
d = d < 10 ? "0" + d : d;
return y + "-" + m + "-" + d;
}
export function deleteBaseKey(obj: any) {
delete obj.createTime;
delete obj.createUserId;
delete obj.createUserName;
delete obj.updateTime;
delete obj.updateUserId;
delete obj.updateUserName;
return obj;
}
export function moneyFormat(num: number, decimal = 2, split = ",") {
/*
parameter
num
decimal2
split,
moneyFormat(123456789.87654321, 2, ',') // 123,456,789.88
*/
if (isFinite(num)) {
// num是数字
if (num === 0) {
// 为0
return num.toFixed(decimal);
} else {
// 非0
var res = "";
var dotIndex = String(num).indexOf(".");
if (dotIndex === -1) {
// 整数
if (decimal === 0) {
res = String(num).replace(/(\d)(?=(?:\d{3})+$)/g, `$1${split}`);
} else {
res =
String(num).replace(/(\d)(?=(?:\d{3})+$)/g, `$1${split}`) +
"." +
"0".repeat(decimal);
}
} else {
// 非整数
// js四舍五入 Math.round()正数时4舍5入负数时5舍6入
// Math.round(1.5) = 2
// Math.round(-1.5) = -1
// Math.round(-1.6) = -2
// 保留decimals位小数
const numStr = String(
(
Math.round(num * Math.pow(10, decimal)) / Math.pow(10, decimal)
).toFixed(decimal)
); // 四舍五入然后固定保留2位小数
const decimals = numStr.slice(dotIndex, dotIndex + decimal + 1); // 截取小数位
res =
String(numStr.slice(0, dotIndex)).replace(
/(\d)(?=(?:\d{3})+$)/g,
`$1${split}`
) + decimals;
}
return res;
}
} else {
return "--";
}
}
// 分页内容重置
export function pageListInit() {
return {
noMoreData: false,
total: 0,
list: [],
pageNum: 1,
pageSize: 100,
};
}
// 过滤掉属性值为null的
export function filterNullUndefined(obj: Object) {
return Object.entries(obj).reduce((acc: any, [key, value]) => {
if (value !== null && value !== undefined && value !== "") {
acc[key] = value;
}
return acc;
}, {});
}
export function timeRange(id: number) {
const today = new Date();
const yesterday = new Date((today as any) - 24 * 60 * 60 * 1000);
let startTime = "";
let endTime = "";
if (id === TimeRange.Today) {
startTime = formatDate(today, "{y}-{m}-{d}");
endTime = formatDate(today, "{y}-{m}-{d}");
} else if (id === TimeRange.Yesterday) {
startTime = formatDate(yesterday, "{y}-{m}-{d}");
endTime = formatDate(yesterday, "{y}-{m}-{d}");
} else if (id === TimeRange.Month) {
startTime = formatDate(getCurrentMonthStartAndEnd().start, "{y}-{m}-{d}");
endTime = formatDate(getCurrentMonthStartAndEnd().end, "{y}-{m}-{d}");
} else if (id === TimeRange.Year) {
startTime = formatDate(getCurrentYearStartAndEnd().start, "{y}-{m}-{d}");
endTime = formatDate(getCurrentYearStartAndEnd().end, "{y}-{m}-{d}");
} else if (id === TimeRange.Week) {
startTime = formatDate(getCurrentWeekStartAndEnd().start, "{y}-{m}-{d}");
endTime = formatDate(getCurrentWeekStartAndEnd().end, "{y}-{m}-{d}");
}
return { startTime: startTime, endTime: endTime };
}
// 格式化金额
export function formatMoney(
number: any,
decimals?: any,
dec_point?: any,
thousands_sep?: any,
roundtag?: any
) {
/*
*
* number
* decimals
* dec_point
* thousands_sep
* roundtag:舍入参数 "ceil" ,"floor","round"
* */
if (!number) {
number = 0;
}
if (!decimals) {
decimals = 0; //默认保留2位小数
}
if (!dec_point) {
dec_point = ".";
}
if (!thousands_sep) {
thousands_sep = ",";
}
if (!roundtag) {
roundtag = "round";
}
number = (number + "").replace(/[^0-9+-Ee.]/g, "");
roundtag = roundtag || "ceil"; //"ceil","floor","round"
var n = !isFinite(+number) ? 0 : +number,
prec = !isFinite(+decimals) ? 0 : Math.abs(decimals),
sep = typeof thousands_sep === "undefined" ? "," : thousands_sep,
dec = typeof dec_point === "undefined" ? "." : dec_point,
s: any = "",
toFixedFix = function (n: any, prec: any) {
var k = Math.pow(10, prec);
return (
"" +
parseFloat(
(Math as any)
[roundtag](parseFloat((n * k).toFixed(prec * 2)))
.toFixed(prec * 2)
) /
k
);
};
s = (prec ? toFixedFix(n, prec) : "" + Math.round(n)).split(".");
var re = /(-?\d+)(\d{3})/;
while (re.test(s[0])) {
s[0] = s[0].replace(re, "$1" + sep + "$2");
}
if ((s[1] || "").length < prec) {
s[1] = s[1] || "";
s[1] += new Array(prec - s[1].length + 1).join("0");
}
return s.join(dec);
}
// 判断字符串中有几个.
export function countDots(str: any) {
if (str) {
return (str.toString().match(/\./g) || []).length;
} else {
return 0;
}
}
export function isTwoDecimalPlaces(num: any) {
// 转换为字符串并移除可能的符号
const str = num.toString().replace(/[-]+/g, "");
// 分割整数部分和小数部分
const parts = str.split(".");
// 如果小数点后有两位数字返回true
return parts.length === 2 && parts[1].length > 2;
}
export function validateRegex(regexValue: string, value: string) {
const regex = new RegExp(regexValue);
return regex.test(value);
}
/***
*
*/
export function getScaleStatus(type: number, value: number) {
if (type === OrderType.Receive) {
if (value === -1) {
return "全部";
} else if (value === 4) {
return "已支付";
} else if (value === 3) {
return "已审未付";
} else if (value === 2) {
return "未审核";
}
} else if (type === OrderType.Shipment) {
if (value === -1) {
return "全部";
} else if (value === 4) {
return "已结算";
} else if (value === 3) {
return "未结算";
}
}
}
// 判断是否是时间格式
export function isDateTimePicker(str: any) {
return str.split(" ").length === 2;
}
// 格式化开始时间和结束时间
export function formatStartAndEndTime(str: string, type: string) {
if (type === "s") {
return str ? (isDateTimePicker(str) ? str : str + " 00:00:00") : "";
} else if (type === "e") {
return str ? (isDateTimePicker(str) ? str : str + " 23:59:59") : "";
}
}
// 两个浮点数求和
export function num_add(num1: number, num2: number) {
var r1, r2, m;
try {
r1 = num1.toString().split(".")[1].length;
} catch (e) {
r1 = 0;
}
try {
r2 = num2.toString().split(".")[1].length;
} catch (e) {
r2 = 0;
}
m = Math.pow(10, Math.max(r1, r2));
return Math.round(num1 * m + num2 * m) / m;
}
// 两个浮点数相减
export function num_subtract(num1: number, num2: number) {
var r1, r2, m, n;
try {
r1 = num1.toString().split(".")[1].length;
} catch (e) {
r1 = 0;
}
try {
r2 = num2.toString().split(".")[1].length;
} catch (e) {
r2 = 0;
}
m = Math.pow(10, Math.max(r1, r2));
n = r1 >= r2 ? r1 : r2;
return Number((Math.round(num1 * m - num2 * m) / m).toFixed(n));
}
// 两个浮点数相乘
export function num_multiply(num1: number, num2: number) {
var m = 0,
s1 = num1.toString(),
s2 = num2.toString();
try {
m += s1.split(".")[1].length;
} catch (e) {}
try {
m += s2.split(".")[1].length;
} catch (e) {}
return (
(Number(s1.replace(".", "")) * Number(s2.replace(".", ""))) /
Math.pow(10, m)
);
}
// 两个浮点数相除
export function num_divide(num1: number, num2: number) {
var t1, t2, r1, r2;
try {
t1 = num1.toString().split(".")[1].length;
} catch (e) {
t1 = 0;
}
try {
t2 = num2.toString().split(".")[1].length;
} catch (e) {
t2 = 0;
}
r1 = Number(num1.toString().replace(".", ""));
r2 = Number(num2.toString().replace(".", ""));
return (r1 / r2) * Math.pow(10, t2 - t1);
}
export function isNullV(item: any) {
return item === null ? "-" : item;
}
// 四舍五入到指定的小数位数
export function roundToDecimalPlace(number: number, decimalPlaces: number) {
const factor = Math.pow(10, decimalPlaces);
return Math.round(number * factor) / factor;
}
export function floorToDecimalPlace(number: number, decimalPlaces: number) {
const factor = Math.pow(10, decimalPlaces);
return Math.floor(number * factor) / factor;
}
// { id: 1, name: "正常计算" },
// { id: 2, name: "抹分" },
// { id: 3, name: "抹角分" },
// { id: 4, name: "抹元" },
// { id: 5, name: "分位四舍五入" },
// { id: 6, name: "角位四舍五入" },
// { id: 7, name: "元位四舍五入" },
export function getNumberValue(
settlementConfig: number,
tempTotalPrice: string
) {
let totalPrice = 0;
if (settlementConfig === 1) {
totalPrice = parseFloat(tempTotalPrice);
} else if (settlementConfig === 2) {
totalPrice = floorToDecimalPlace(parseFloat(tempTotalPrice), 1);
} else if (settlementConfig === 3) {
totalPrice = floorToDecimalPlace(parseFloat(tempTotalPrice), 0);
} else if (settlementConfig === 4) {
totalPrice = floorToDecimalPlace(parseFloat(tempTotalPrice), -1);
} else if (settlementConfig === 5) {
totalPrice = roundToDecimalPlace(parseFloat(tempTotalPrice), 1);
} else if (settlementConfig === 6) {
totalPrice = roundToDecimalPlace(parseFloat(tempTotalPrice), 0);
} else if (settlementConfig === 7) {
totalPrice = roundToDecimalPlace(parseFloat(tempTotalPrice), -1);
} else {
totalPrice = parseFloat(tempTotalPrice);
}
return totalPrice;
}

63
src/utils/validate.ts Normal file
View File

@ -0,0 +1,63 @@
const valid = {
mobile: {
pattern: /^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/,
message: "请输入正确的手机号码",
},
password: {
pattern:
/^((?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!;:@#$%?^&*_-]))([a-zA-Z0-9!;:@#$%?^&*_-]){6,16}$/,
message: "密码必须包含大小写字母、数字、特殊字符",
},
username: /^[a-zA-Z]{4,12}$/, //长度4~12英文大小写字母
email: /^(\w+(_|-|.)*)+@(\w+(-)?)+(.\w{2,})+$/, //用户名 @ 域名域名后缀至少2个字符
valid_number: /[^\d]/g,
// valid_password: /^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\\W_]+$)(?![a-z0-9]+$)(?![a-z\\W_]+$)(?![0-9\\W_]+$)[A-Za-z\d`~!@#$%^&*()_+<>?:"{},.\/\\;'[\]]{6,20}$/, // 8位 大小写 数字 和下划线
valid_no_space: /\s+/g, //不可输入空格
valid_no_cn: /[\u4E00-\u9FA5]/g, // 不可输入中文
valid_number_en: /^[a-zA-Z0-9]+$/, // 只能输入数字和英文
carNo: {
// /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$/
// /^[\x{4e00}-\x{9fa5}]{1}[A-Z]{1}[A-Z0-9]{5}$/u
pattern:
/^([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[a-zA-Z](([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼ABCDEFGHJK]((?![IO])[a-zA-Z0-9](?![IO]))[0-9]{4})|([0-9]{5}[ABCDEFGHJK]))|[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z0-9]{1}[A-Z0-9]{1}[A-Z0-9应]{4,5}[A-Z0-9挂学警港澳领使急]{1})$/,
message: "请输入正确的车牌号",
},
valid_decimal: {
pattern: /[^0-9.]/g,
message: "请输入正确的数字",
},
valid_decimal2: {
pattern: /([1-9]+[\d]*(\.[0-9]{0,2})?)/,
message: "请输入正确的数字",
},
valid_id_card: {
pattern:
/^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
message: "请输入正确的身份证号码",
},
/**
* 8
*/
valid_passwordTemp: {
pattern:
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[$@$!%*?&])[A-Za-z\\d$@$!%*?&]{8,}$/,
message: "密码由字母、数字组成,且至少8位",
},
valid_password: {
pattern: /^(?=.*[a-z])(?=.*\d)[a-zA-Z\d]{8,}$/,
message: "密码由字母、数字组成,且至少8位",
},
valid_password1: {
pattern: "^(?=.*[a-z])(?=.*\d)[a-zA-Z\d]{8,}$",
message: "密码必须由字母、数字组成, 且至少8位",
},
};
export default valid;

27
tsconfig.json Normal file
View File

@ -0,0 +1,27 @@
{
"extends": "@vue/tsconfig/tsconfig.json",
"compilerOptions": {
"ignoreDeprecations": "5.0",
"sourceMap": true,
"baseUrl": "./",
"paths": {
"@/*": ["src/*"]
},
"lib": ["esnext", "dom"],
"types": [
"@dcloudio/types", // uni-app API
// "miniprogram-api-typings", //
"@types/wechat-miniprogram",
"@uni-helper/uni-app-types", // uni-app
"@uni-helper/uni-ui-types",
"node" // process
]
},
// vue
"vueCompilerOptions": {
"nativeTags": ["block","component","template","slot"],
// "experimentalRuntimeMode": "runtime-uni-app"
},
"include": ["src/*.ts","src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue", "src/auto-import.d.ts"],
"moduleResolution":"node"
}

42
vite.config.ts Normal file
View File

@ -0,0 +1,42 @@
import { defineConfig } from "vite";
import uni from "@dcloudio/vite-plugin-uni";
import AutoImport from "unplugin-auto-import/vite";
import path from "path"; // 引入pnpm install @types/node --save-dev
import ENV_CONFIG from "./src/config/env";
// https://vitejs.dev/config/
// process.env.NODE_ENV === "development"
export default defineConfig({
build: {
sourcemap: false,
},
define: {
"process.env.config": ENV_CONFIG,
'process.env': process.env, //配置二
},
plugins: [
uni(),
AutoImport({
// 目标文件
include: [
/\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
/\.vue$/,
/\.vue\?vue/, // .vue
/\.md$/, // .md
],
// 使用
imports: ["vue"],
dts: "src/auto-import.d.ts",
// 如有用到eslint记得加上写段没有用到可以忽略
eslintrc: {
enabled: false,
filepath: "./.eslintrc-auto-import.json", // Default `./.eslintrc-auto-import.json`
globalsPropValue: true, // Default `true`, (true | false | 'readonly' | 'readable' | 'writable' | 'writeable')
},
}),
],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
});