This commit is contained in:
郭飞 2025-05-13 13:08:01 +08:00
commit ff2baf4d26
4 changed files with 471 additions and 60 deletions

View File

@ -1,11 +1,12 @@
<template>
<view class="uni-numbox">
<view @click="_calcValue('minus')" class="uni-numbox__minus">
<text class="uni-numbox--text" :class="{ 'uni-numbox--disabled': inputValue <= min || disabled }">-</text>
<view @click="_calcValue('minus')" class="uni-numbox__minus uni-numbox-btns" :style="{background}">
<text class="uni-numbox--text" :class="{ 'uni-numbox--disabled': inputValue <= min || disabled }" :style="{color}">-</text>
</view>
<input :disabled="disabled" @blur="_onBlur" class="uni-numbox__value" type="number" v-model="inputValue" />
<view @click="_calcValue('plus')" class="uni-numbox__plus">
<text class="uni-numbox--text" :class="{ 'uni-numbox--disabled': inputValue >= max || disabled }">+</text>
<input :disabled="disabled" @focus="_onFocus" @blur="_onBlur" class="uni-numbox__value" type="number"
v-model="inputValue" :style="{background, color}" />
<view @click="_calcValue('plus')" class="uni-numbox__plus uni-numbox-btns" :style="{background}">
<text class="uni-numbox--text" :class="{ 'uni-numbox--disabled': inputValue >= max || disabled }" :style="{color}">+</text>
</view>
</view>
</template>
@ -18,17 +19,26 @@
* @property {Number} min 最小值
* @property {Number} max 最大值
* @property {Number} step 每次点击改变的间隔大小
* @property {String} background 背景色
* @property {String} color 字体颜色前景色
* @property {Boolean} disabled = [true|false] 是否为禁用状态
* @event {Function} change 输入框值改变时触发的事件参数为输入框当前的 value
* @event {Function} focus 输入框聚焦时触发的事件参数为 event 对象
* @event {Function} blur 输入框失焦时触发的事件参数为 event 对象
*/
export default {
name: "UniNumberBox",
emits: ['change', 'input', 'update:modelValue', 'blur', 'focus'],
props: {
value: {
type: [Number, String],
default: 1
},
modelValue: {
type: [Number, String],
default: 1
},
min: {
type: Number,
default: 0
@ -41,6 +51,14 @@
type: Number,
default: 1
},
background: {
type: String,
default: '#f5f5f5'
},
color: {
type: String,
default: '#333'
},
disabled: {
type: Boolean,
default: false
@ -55,14 +73,17 @@
value(val) {
this.inputValue = +val;
},
inputValue(newVal, oldVal) {
if (+newVal !== +oldVal) {
this.$emit("change", newVal);
}
modelValue(val) {
this.inputValue = +val;
}
},
created() {
this.inputValue = +this.value;
if (this.value === 1) {
this.inputValue = +this.modelValue;
}
if (this.modelValue === 1) {
this.inputValue = +this.value;
}
},
methods: {
_calcValue(type) {
@ -80,7 +101,9 @@
if (value > (this.max * scale)) {
value = this.max * scale
}
} else if (type === "plus") {
}
if (type === "plus") {
value += step;
if (value > (this.max * scale)) {
return;
@ -90,17 +113,24 @@
}
}
this.inputValue = String(value / scale);
this.inputValue = (value / scale).toFixed(String(scale).length - 1);
this.$emit("change", +this.inputValue);
// TODO vue2
this.$emit("input", +this.inputValue);
// TODO vue3
this.$emit("update:modelValue", +this.inputValue);
},
_getDecimalScale() {
let scale = 1;
//
if (~~this.step !== this.step) {
scale = Math.pow(10, (this.step + "").split(".")[1].length);
scale = Math.pow(10, String(this.step).split(".")[1].length);
}
return scale;
},
_onBlur(event) {
this.$emit('blur', event)
let value = event.detail.value;
if (!value) {
// this.inputValue = 0;
@ -112,14 +142,23 @@
} else if (value < this.min) {
value = this.min;
}
this.inputValue = value;
const scale = this._getDecimalScale();
this.inputValue = value.toFixed(String(scale).length - 1);
this.$emit("change", +this.inputValue);
this.$emit("input", +this.inputValue);
},
_onFocus(event) {
this.$emit('focus', event)
}
}
};
</script>
<style scoped>
/* #ifdef APP-NVUE */
/* #endif */
<style lang="scss" >
$box-height: 35px;
$bg: #f5f5f5;
$br: 2px;
$color: #333;
.uni-numbox {
/* #ifndef APP-NVUE */
display: flex;
@ -130,63 +169,55 @@
width: 120px;
}
.uni-numbox-btns {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
align-items: center;
justify-content: center;
padding: 0 8px;
background-color: $bg;
/* #ifdef H5 */
cursor: pointer;
/* #endif */
}
.uni-numbox__value {
background-color: #ffffff;
margin: 0 2px;
background-color: $bg;
width: 40px;
height: 35px;
height: $box-height;
text-align: center;
font-size: 16px;
border-width: 1rpx;
border-style: solid;
border-color: #e5e5e5;
font-size: 14px;
border-left-width: 0;
border-right-width: 0;
color: $color;
}
.uni-numbox__minus {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
align-items: center;
justify-content: center;
width: 35px;
height: 35px;
font-size: 20px;
color: #333;
background-color: #f8f8f8;
border-width: 1rpx;
border-style: solid;
border-color: #e5e5e5;
border-top-left-radius: 3px;
border-bottom-left-radius: 3px;
border-right-width: 0;
border-top-left-radius: $br;
border-bottom-left-radius: $br;
}
.uni-numbox__plus {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
align-items: center;
justify-content: center;
width: 35px;
height: 35px;
border-width: 1rpx;
border-style: solid;
border-color: #e5e5e5;
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
background-color: #f8f8f8;
border-left-width: 0;
border-top-right-radius: $br;
border-bottom-right-radius: $br;
}
.uni-numbox--text {
font-size: 40rpx;
color: #333;
// fix nvue
line-height: 20px;
font-size: 20px;
font-weight: 300;
color: $color;
}
.uni-numbox--disabled {
color: #c0c0c0;
.uni-numbox .uni-numbox--disabled {
color: #c0c0c0 !important;
/* #ifdef H5 */
cursor: not-allowed;
/* #endif */
}
</style>

View File

@ -42,6 +42,13 @@
"enablePullDownRefresh": false
}
},
{
"path": "pages/tms/index",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/account/index",
"style": {
@ -639,6 +646,14 @@
"enablePullDownRefresh": false
}
},{
"path" : "pages/tms/features/VehicleInOut/index",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
],
"globalStyle": {
@ -681,6 +696,12 @@
"text": "库内",
"pagePath": "pages/checkplan/index"
},
{
"iconPath": "static/img/material.png",
"selectedIconPath": "static/img/material_selected.png",
"text": "运输",
"pagePath": "pages/tms/index"
},
{
"iconPath": "static/img/account.png",
"selectedIconPath": "static/img/account_selected.png",

View File

@ -0,0 +1,160 @@
<template>
<view>
<u-navbar back-text="返回" title="车辆出入厂" :background="background"></u-navbar>
<u-form ref="testForm">
<u-form-item :border-bottom="false">
<label>选择车牌:</label>&nbsp;&nbsp;&nbsp;&nbsp;
<zxzUniDataSelect filterable v-model="carNum" :localdata="carNumList" @change="change">
</zxzUniDataSelect>
</u-form-item>
<u-form-item :border-bottom="false">
<label>入厂地磅:</label>
<uni-number-box :max="999999999" :step="0.1" v-model="enterWeight"/>
</u-form-item>
<u-form-item :border-bottom="false">
<label>出厂地磅:</label>
<uni-number-box :max="999999999" :step="0.1" v-model="exitWeight"/>
</u-form-item>
</u-form>
<u-row>
<u-col span="3"><label>入厂类型</label> </u-col>
<u-col span="3"><label>{{model.efType_dictText}}</label> </u-col>
<u-col span="3"><label>排队数</label> </u-col>
<u-col span="3"><label>{{model.lineUpCount}}</label> </u-col>
</u-row>
<u-row>
<u-col span="3"><label>物流公司</label> </u-col>
<u-col span="3"><label>{{model.logistics}}</label> </u-col>
<u-col span="3"><label>司机姓名</label> </u-col>
<u-col span="3"><label>{{model.driverName}}</label> </u-col>
</u-row>
<u-row>
<u-col span="3"><label>司机电话</label> </u-col>
<u-col span="3"><label>{{model.driverTel}}</label> </u-col>
<u-col span="3"><label>司机身份证</label> </u-col>
<u-col span="2"><label>{{model.driverIdCard}}</label> </u-col>
</u-row>
<u-row>
<u-col span="3"><label>进厂门</label> </u-col>
<u-col span="3"><label>{{model.enterFactoryDoor}}</label> </u-col>
<u-col span="3"><label>出厂门</label> </u-col>
<u-col span="2"><label>{{model.exitFactoryDoor}}</label> </u-col>
</u-row>
<u-row>
<u-col span="3"><label>当前状态</label> </u-col>
<u-col span="3"><label>{{model.currentStatus_dictText}}</label> </u-col>
</u-row>
<br />
<u-row>
<u-col span="3"><u-button @click="handleConfirm('1')" type="primary" size="mini">对接人确认</u-button></u-col>
<u-col span="3"><u-button @click="handleConfirm('3')" type="primary" size="mini">审核入厂</u-button></u-col>
<u-col span="3"><u-button @click="handleConfirm('4')" type="primary" size="mini">审核出厂</u-button></u-col>
<u-col span="3"><u-button @click="handleConfirm('5')" type="primary" size="mini">地磅确认</u-button></u-col>
</u-row>
</view>
</template>
<script>
import zxzUniDataSelect from "@/components/zxz-uni-data-select/zxz-uni-data-select.vue"
import uniNumberBox from "@/components/uni-number-box/uni-number-box.vue"
export default {
components: {
zxzUniDataSelect,
uniNumberBox
},
data() {
return {
title: 'Hello',
background: {
backgroundImage: 'linear-gradient(45deg, rgb(28, 187, 180), rgb(141, 198, 63))'
},
model:{},
carNum: '',
enterWeight: '',
exitWeight: '',
carNumList: [],
vehicleList: [],
baseUrl: 'http://114.215.188.164:9001/jeecg-boot',
url: {
getCarNum: '/vehicleinout/vehicleInOut/getCarNum',
handleConfirm: '/vehicleinout/vehicleInOut/handleConfirm'
}
}
},
mounted() {
this.getCarNum();
},
methods: {
getCarNum(){
this.getRequest(this.url.getCarNum,{},'GET').then(res => {
if (res.success) {
this.vehicleList = res.result.records;
this.carNumList = res.result.records.map(item => ({
text: item.carNum,
value: item.id,
}));
}
})
},
change(){
this.model = this.vehicleList.filter(item => item.id == this.carNum)[0]
},
handleConfirm(currentStatus){
if (this.carNum == '') {
this.$showMessage('请选择车牌');
return;
}
let param = {
id: this.model.id,
}
if (currentStatus != '5') {
param.currentStatus = currentStatus;
} else {
param.enterWeight = this.enterWeight;
param.exitWeight = this.exitWeight;
}
this.getRequest(this.url.handleConfirm,param).then(res => {
if (res.success) {
this.$showMessage(res.result);
this.model = {}
this.carNum = ''
this.enterWeight = ''
this.exitWeight = ''
} else {
this.$showMessage(res.message);
}
})
},
getRequest(url='',data={},method='',){
return new Promise((resolve, reject) => {
uni.request({
url: this.baseUrl + url, //
method: method||'POST',
header: {
'Content-type': 'application/json;charset=utf-8',
}, //Json
'timeout': 600000,
data:data,//
success:(res)=>{
// console.log(res)
resolve(res.data)//
},
fail:(err)=>{
// console.log(res)
resolve(err)
}
})
})
}
}
}
</script>
<style scoped>
::v-deep .uni-numbox__value{
width: 80px;
}
</style>

199
pages/tms/index.vue Normal file
View File

@ -0,0 +1,199 @@
<template>
<view>
<u-navbar :is-back="false" title="WMS PDA" :background="background"></u-navbar>
<scroll-view scroll-y class="page">
<view class="nav-list">
<view class="row-flex">
<view v-for="(item, i) in elements" :key="i" class="nav-view" v-if="$menuLimit(item.id)">
<navigator hover-class="none" :url="'/pages/tms/features/' + item.name" class="nav-a nav-li" navigateTo
:class="'bg-'+item.color">
<view class="nav-title">{{item.title}}</view>
<view class="nav-name">{{item.en_name}}</view>
<text :class="'cuIcon-' + item.cuIcon"></text>
</navigator>
</view>
</view>
</view>
</scroll-view>
<u-gap height="70"></u-gap>
</view>
</template>
<script>
export default {
data() {
return {
title: 'Hello',
background: {
backgroundImage: 'linear-gradient(45deg, rgb(28, 187, 180), rgb(141, 198, 63))'
},
elements: [{
title: '车辆审核',
name: 'VehicleInOut/index',
en_name: 'VehicleInOut',
color: 'cyan',
cuIcon: 'shop',
label: '车辆审核',
id:'500001'
},
],
}
},
computed: {
tabbar() {
return store.vuex_tabbar
}
},
}
</script>
<style lang="scss" scoped>
.demo-layout {
height: 80rpx;
border-radius: 8rpx;
}
.bg-purple {
background: #d3dce6;
}
.mt-10 {
margin-top: 10px;
}
.nav-view {
width: 45%;
margin: 2.5%;
// display: contents;
}
.row-flex {
width: 100%;
display: flex;
flex-wrap: wrap;
}
.nav-li {
// width: 45%;
width: 100%;
// margin: 0 2.5% 40upx;
background-image: url('../../static/img/background.png');
background-size: cover;
background-position: center;
position: relative;
z-index: 1;
}
.nav-a {
padding: 30upx;
border-radius: 12upx;
}
.nav-li::after {
content: "";
position: absolute;
z-index: -1;
background-color: inherit;
width: 100%;
height: 100%;
left: 0;
bottom: -10%;
border-radius: 10upx;
opacity: 0.2;
transform: scale(0.9, 0.9);
}
.nav-li.cur {
color: #fff;
background: rgb(94, 185, 94);
box-shadow: 4upx 4upx 6upx rgba(94, 185, 94, 0.4);
}
.nav-title {
font-size: 32upx;
font-weight: 300;
}
.nav-title::first-letter {
font-size: 40upx;
margin-right: 4upx;
}
.nav-name {
font-size: 28upx;
text-transform: Capitalize;
margin-top: 20upx;
position: relative;
}
.nav-name::before {
content: "";
position: absolute;
display: block;
width: 40upx;
height: 6upx;
background: #fff;
bottom: 0;
right: 0;
opacity: 0.5;
}
.nav-name::after {
content: "";
position: absolute;
display: block;
width: 100upx;
height: 1px;
background: #fff;
bottom: 0;
right: 40upx;
opacity: 0.3;
}
.nav-name::first-letter {
font-weight: bold;
font-size: 36upx;
margin-right: 1px;
}
.nav-li text {
position: absolute;
right: 30upx;
top: 30upx;
font-size: 52upx;
width: 60upx;
height: 60upx;
text-align: center;
line-height: 60upx;
}
.text-light {
font-weight: 300;
}
@keyframes show {
0% {
transform: translateY(-50px);
}
60% {
transform: translateY(40upx);
}
100% {
transform: translateY(0px);
}
}
@-webkit-keyframes show {
0% {
transform: translateY(-50px);
}
60% {
transform: translateY(40upx);
}
100% {
transform: translateY(0px);
}
}
</style>