This commit is contained in:
Vinjor 2024-10-25 18:52:01 +08:00
parent 2973b7c1a5
commit d7c5f60db8
9 changed files with 469 additions and 194 deletions

View File

@ -494,7 +494,7 @@ export default {
title: '操作成功', title: '操作成功',
icon: 'none' icon: 'none'
}) })
if("done"==this.nowChooseOperate || "check"==this.nowChooseOperate || "callCus"==this.nowChooseOperate){ if("done"==this.nowChooseOperate || "check"==this.nowChooseOperate || "callCus"==this.nowChooseOperate || "out"==this.nowChooseOperate){
//| //|
setTimeout(() => { setTimeout(() => {
uni.navigateBack() uni.navigateBack()

View File

@ -95,7 +95,8 @@ import {
getToken, getToken,
getUserInfo, getUserInfo,
getStrData, getStrData,
getTenantId getTenantId,
setJSONData
} from '@/utils/auth' } from '@/utils/auth'
import {getDictTextByCodeAndValue,formatDate,formatTimestamp} from "@/utils/utils"; import {getDictTextByCodeAndValue,formatDate,formatTimestamp} from "@/utils/utils";
@ -167,10 +168,7 @@ export default {
}) })
} else { } else {
// //
this.userInfo = getUserInfo() || { this.userInfo = getUserInfo()
nickname: '用户',
roleNames: '角色'
}
this.onRefresherrefresh() this.onRefresherrefresh()
this.getNoReadNum() this.getNoReadNum()
this.getNoticeList() this.getNoticeList()
@ -255,10 +253,11 @@ export default {
/** /**
* 配件出库 * 配件出库
*/ */
inOutWareHouse(formData,isBack){ inOutWareHouse(formData,isReceive){
formData.isBack = isBack formData.isReceive = isReceive
setJSONData("applyWaresForm",formData)
uni.navigateTo({ uni.navigateTo({
url: '/pages-warehouse/inOutWarehouse/inOutWarehouse?formData='+encodeURIComponent(JSON.stringify(formData)) url: '/pages-warehouse/inOutWarehouse/inOutWarehouse'
}) })
}, },
@ -658,7 +657,7 @@ export default {
background: #FFFFFF; background: #FFFFFF;
border-radius: 8rpx 8rpx 8rpx 8rpx; border-radius: 8rpx 8rpx 8rpx 8rpx;
padding: 0 30rpx 30rpx; padding: 0 30rpx 30rpx;
margin-bottom: 20rpx;
.order-top { .order-top {
padding: 30rpx 0; padding: 30rpx 0;
display: flex; display: flex;

View File

@ -12,25 +12,34 @@
<view class="repairName">{{ item.waresName }}</view> <view class="repairName">{{ item.waresName }}</view>
<view class="repairBottom"> <view class="repairBottom">
<text class="repairDesc">单位 <text class="repairDesc">单位
<text class="repairUnit">{{ item.unitStr }}</text> <text class="repairUnit">{{ item.wares.unit }}</text>
</text> </text>
<text class="repairDesc">库存 <text class="repairDesc">申请数量
<text class="repairUnit">{{ item.wares.stock }}</text> <text class="repairUnit">{{ item.waresCount }}</text>
</text> </text>
<view class="repairBtns"> <view class="repairBtns">
<u-icon name="minus-circle-fill" size="24" @click="delNum(item)"></u-icon> <u-icon name="minus-circle-fill" size="24" @click="delNum(item)"></u-icon>
<text class="repairNum">{{ item.waresCount }}</text> <text class="repairNum">{{ item.thisNum }}</text>
<u-icon color="#0174F6" name="plus-circle-fill" size="24" @click="addNum(item)"></u-icon> <u-icon color="#0174F6" name="plus-circle-fill" size="24" @click="addNum(item)"></u-icon>
</view> </view>
</view> </view>
<view class="repairBottom">
<text class="repairDesc">库存
<text class="repairUnit">{{ item.wares.stock }}</text>
</text>
<text class="repairDesc">已领取
<text class="repairUnit">{{ item.waresAlreadyCount }}</text>
</text>
<view class="repairBtns"></view>
</view>
</view> </view>
</view> </view>
</view> </view>
<view class="footer"> <view class="footer">
<text class="label"></text> <text class="label"></text>
<text class="repairNum"></text> <text class="repairNum"></text>
<view class="submit" v-if="type" @click="toPart">采购</view> <view class="submit" @click="toPart">采购</view>
<view class="submit" @click="submit">{{type?'通知领料':'通知退料'}}</view> <view class="submit" @click="submit">{{isReceive?'通知领料':'通知退料'}}</view>
</view> </view>
</view> </view>
</template> </template>
@ -38,6 +47,9 @@
<script> <script>
import VNavigationBar from "@/components/VNavigationBar.vue"; import VNavigationBar from "@/components/VNavigationBar.vue";
import request from '@/utils/request'; import request from '@/utils/request';
import {
getJSONData,setJSONData
} from '@/utils/auth'
import {getDictTextByCodeAndValue,createUniqueCodeByHead} from "@/utils/utils"; import {getDictTextByCodeAndValue,createUniqueCodeByHead} from "@/utils/utils";
export default { export default {
@ -48,24 +60,20 @@ export default {
twId:'', twId:'',
// //
wares:[], wares:[],
//0102退 //true false 退
type:true, isReceive:true,
// //
formData:{}, formData:{},
repairList: [],
selectedRepairList: [
{name: '炫驰全合成机油S7 4L/ALL', num: 3, unit: '桶', id: 3}
],
active: '' active: ''
}; };
}, },
onLoad(data) { onLoad(data) {
if (data.formData){ if(getJSONData("applyWaresForm")){
this.formData = JSON.parse(decodeURIComponent(data.formData)) this.formData = getJSONData("applyWaresForm")
this.type = this.formData.isBack this.isReceive = this.formData.isReceive
this.twId = this.formData.id this.twId = this.formData.id
this.init()
} }
this.init()
}, },
computed: {}, computed: {},
@ -82,28 +90,44 @@ export default {
method: 'get', method: 'get',
params: params params: params
}).then((res)=>{ }).then((res)=>{
const items = res.data; res.data.map((item)=>{
items.map((item)=>{ if(!item.waresAlreadyCount){
const count = item.waresAlreadyCount ? parseInt(item.waresCount) - parseInt(item.waresAlreadyCount) : item.waresCount item.waresAlreadyCount = 0
item.waresCount = this.type ? count : item.waresAlreadyCount }
item.isStock = this.type ? count <= item.wares.stock : true if(!item.wares.stock){
getDictTextByCodeAndValue("repair_unit",item.wares.unit).then(value => { item.wares.stock=0
item.unitStr = value }
}).catch(error => { if(this.isReceive){
item.unitStr = "未知" //-
}); item.maxNum = parseInt(item.waresCount) - parseInt(item.waresAlreadyCount)
if(item.maxNum >item.wares.stock){
item.maxNum = item.wares.stock
}
item.thisNum = item.maxNum
}else{
//退0,0
item.maxNum = item.waresAlreadyCount
item.thisNum = 0
}
}) })
this.wares = items; this.wares = res.data;
}) })
}, },
/** /**
* *
*/ */
addNum(repair) { addNum(repair) {
this.$set(repair, 'waresCount', repair.waresCount + 1) if((repair.thisNum+1) > repair.maxNum){
const find = this.wares.find(f => f.id === repair.id) uni.showToast({
title: '超过库存数量或最大申请数量!',
icon: 'none'
})
return
}
this.$set(repair, 'thisNum', repair.thisNum + 1)
const find = this.wares.find(f => f.id == repair.id)
if (find) { if (find) {
find.waresCount = repair.waresCount find.thisNum = repair.thisNum
} else { } else {
this.wares.push(JSON.parse(JSON.stringify(repair))) this.wares.push(JSON.parse(JSON.stringify(repair)))
} }
@ -113,15 +137,16 @@ export default {
* *
*/ */
delNum(repair) { delNum(repair) {
if (repair.waresCount <= 0) { if (repair.thisNum == 0) {
//0
return return
} }
this.$set(repair, 'waresCount', repair.waresCount - 1) this.$set(repair, 'thisNum', repair.thisNum - 1)
const findIndex = this.wares.findIndex(f => f.id === repair.id) const find = this.wares.find(f => f.id == repair.id)
if (findIndex > -1 && repair.num <= 0) { if (find) {
this.wares.splice(findIndex, 1) find.thisNum = repair.thisNum
} else if (repair.num > 0) { } else {
this.$set(this.wares[findIndex], 'waresCount', repair.waresCount) this.wares.push(JSON.parse(JSON.stringify(repair)))
} }
}, },
/** /**
@ -129,20 +154,20 @@ export default {
*/ */
submit() { submit() {
this.formData.repairSo = { this.formData.repairSo = {
soType:this.type?'02':'04', soType:this.isReceive?'02':'04',
soNo:createUniqueCodeByHead(this.type?'LL':'TL'), soNo:createUniqueCodeByHead(this.isReceive?'LL':'TL'),
userId:this.formData.repairId, userId:this.formData.repairId,
userName:this.formData.repairName, userName:this.formData.repairName,
soStatus:this.type?'04':'07' soStatus:this.isReceive?'04':'07'
} }
this.formData.repairSois = [...this.wares.map(item =>{ this.formData.repairSois = [...this.wares.map(item =>{
return { return {
soiType: this.type ? '02' : "04", soiType: this.isReceive ? '02' : "04",
goodsId: item.waresId, goodsId: item.waresId,
goodsCount: item.waresCount, goodsCount: item.thisNum,
} }
})] })]
if (this.type){ if (this.isReceive){
this.formData.items = [...this.wares.map(item => { this.formData.items = [...this.wares.map(item => {
return { return {
id: item.id, id: item.id,
@ -172,8 +197,9 @@ export default {
toPart(){ toPart(){
const formData = this.formData; const formData = this.formData;
formData.items = this.wares; formData.items = this.wares;
setJSONData("applyWaresForm",formData)
uni.navigateTo({ uni.navigateTo({
url: '/pages-warehouse/inOutWarehouse/part?formData='+encodeURIComponent(JSON.stringify(formData)) url: '/pages-warehouse/inOutWarehouse/part'
}) })
} }
@ -278,6 +304,7 @@ export default {
} }
.repairBtns { .repairBtns {
width: 65px;
display: flex; display: flex;
align-items: center; align-items: center;
column-gap: 10rpx; column-gap: 10rpx;
@ -306,6 +333,7 @@ export default {
line-height: 72rpx; line-height: 72rpx;
font-size: 32rpx; font-size: 32rpx;
color: #FFFFFF; color: #FFFFFF;
margin-left: 20rpx;
} }
} }
</style> </style>

View File

@ -1,56 +1,36 @@
<template> <template>
<view class="container"> <view class="container">
<VNavigationBar background-color="#fff" title="采购单" title-color="#333"></VNavigationBar> <VNavigationBar background-color="#fff" title="采购单" title-color="#333"></VNavigationBar>
<view class="listBox"> <view class="listBox">
<view class="list"> <view class="list">
<view v-for="(item, index) in partList" :key="index" class="listItem"> <view class="formItem">
<view class="repairName">{{ item.name }}</view> <text class="formLabel">供应商</text>
<view class="repairBottom"> <input type="text" style="text-align: right" v-model="serviceName" placeholder="请选择供应商"/>
<text class="repairDesc">上次价格 <view @click="searchService">查询</view>
<text class="repairUnit">{{ item.purPrice }}</text>
</text>
<text class="repairDesc">单价
<text class="repairUnit">
<u--input type="number"
placeholder="请输入内容"
border="surround"
v-model="item.newPrice"/>
</text>
</text>
<text class="repairDesc">数量
<text class="repairUnit">
<u--input
type="number"
placeholder="请输入内容"
border="surround"
v-model="item.count"/>
</text>
</text>
<!--<view class="repairBtns">-->
<!-- <u-icon name="minus-circle-fill" size="24" @click="delNum(item)"></u-icon>-->
<!-- <text class="repairNum">{{ item.waresCount }}</text>-->
<!-- <u-icon color="#0174F6" name="plus-circle-fill" size="24" @click="addNum(item)"></u-icon>-->
<!-- </view>-->
</view>
</view> </view>
<u--input <view class="formItem">
placeholder="备注" <text class="formLabel">备注</text>
border="surround" <text class="formValue"></text>
type="text" </view>
v-model="remark" <view style="padding-bottom: 60rpx;border-bottom: 1px solid #ddd;" class="formItem">
clearable <textarea style="height: 50px" auto-height placeholder="请输入备注" v-model="remark" />
></u--input> </view>
<uni-card v-for="(item, index) in partList" :key="index" :title="item.name" :extra="'上次价格:'+item.purPrice">
<view class="formItem">
<text class="formLabel">单价</text>
<input type="number" style="text-align: right" v-model="item.newPrice" placeholder="请输入单价"/>
</view>
<view class="formItem">
<text class="formLabel">数量</text>
<input type="number" style="text-align: right" v-model="item.count" placeholder="请输入数量"/>
</view>
</uni-card>
</view> </view>
</view> </view>
<view class="footer"> <view class="footer">
<text class="label"></text> <text class="label"></text>
<text class="repairNum"></text> <text class="repairNum"></text>
<view class="submit" @click="submit">结算</view> <view class="submit" @click="submit">保存</view>
</view> </view>
</view> </view>
</template> </template>
@ -59,7 +39,7 @@
import VNavigationBar from "@/components/VNavigationBar.vue"; import VNavigationBar from "@/components/VNavigationBar.vue";
import request from '@/utils/request'; import request from '@/utils/request';
import {getDictTextByCodeAndValue,createUniqueCodeByHead} from "@/utils/utils"; import {getDictTextByCodeAndValue,createUniqueCodeByHead} from "@/utils/utils";
import {getUserInfo} from '@/utils/auth.js' import {getUserInfo,getJSONData} from '@/utils/auth.js'
export default { export default {
components: {VNavigationBar}, components: {VNavigationBar},
@ -80,12 +60,16 @@ export default {
selectedRepairList: [ selectedRepairList: [
{name: '炫驰全合成机油S7 4L/ALL', num: 3, unit: '桶', id: 3} {name: '炫驰全合成机油S7 4L/ALL', num: 3, unit: '桶', id: 3}
], ],
active: '' active: '',
//
serviceName:"",
//id
serviceId:"",
}; };
}, },
onLoad(data) { onLoad() {
if (data.formData){ if (getJSONData("applyWaresForm")){
this.formData = JSON.parse(decodeURIComponent(data.formData)) this.formData = getJSONData("applyWaresForm")
this.wares = this.formData.items this.wares = this.formData.items
} }
this.init() this.init()
@ -95,6 +79,41 @@ export default {
}, },
methods: { methods: {
/**
* 查询供应商
*/
searchService(){
if(""==this.serviceName){
uni.showToast({
title: '请输入供应商名称!',
icon: 'none'
})
return
}
//
request({
url: '/admin-api/supplier/baseSupplier/searchList',
method: 'get',
params: {name:this.serviceName}
}).then((res) => {
console.log(res)
if (res.code == 200 && res.data.length>0) {
uni.showActionSheet({
itemList: res.data.map(m => m.name),
success: ({ tapIndex }) => {
this.serviceName = res.data[tapIndex].name
this.serviceId = res.data[tapIndex].id
}
})
}else{
//
uni.showToast({
title: '未查询到符合条件的供应商,您可以直接使用,系统将自动保存为新供应商!',
icon: 'none'
})
}
})
},
/** /**
* 初始化配件数据 * 初始化配件数据
*/ */
@ -150,7 +169,9 @@ export default {
itemCount:this.partList.length, itemCount:this.partList.length,
totalPrice:this.partList.reduce((x, y) => {return x + y.totalPrice}, 0), totalPrice:this.partList.reduce((x, y) => {return x + y.totalPrice}, 0),
soStatus:'03', soStatus:'03',
remark:this.remark remark:this.remark,
supplierId:this.serviceId,
supplierName:this.serviceName
} }
data.goodsList = [...this.partList.map(item => { data.goodsList = [...this.partList.map(item => {
return { return {
@ -163,6 +184,8 @@ export default {
remark: item.remark remark: item.remark
} }
})] })]
console.log(data)
debugger
request({ request({
url: '/admin-api/repair/so/create', url: '/admin-api/repair/so/create',
method: 'post', method: 'post',
@ -191,101 +214,55 @@ export default {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
.search {
padding: 0 40rpx;
background-color: #fff;
& > .searchBox {
height: 84rpx;
background: #F3F5F7;
border-radius: 12rpx 12rpx 12rpx 12rpx;
margin: 0 auto;
padding: 0 30rpx;
font-size: 28rpx;
color: #0174F6;
display: flex;
align-items: center;
}
.searchInput {
flex: 1;
width: 0;
color: #333;
}
}
.tabs {
background-color: #fff;
padding: 30rpx 40rpx;
margin: 0 auto;
display: flex;
align-items: center;
column-gap: 30rpx;
overflow: auto;
.tab-item {
flex-shrink: 0;
padding: 16rpx 30rpx;
font-size: 28rpx;
color: #113A68;
background: #F2F2F7;
border-radius: 30rpx 30rpx 30rpx 30rpx;
&.active {
background: #0174F6;
color: #fff;
}
}
}
.listBox { .listBox {
padding: 30rpx 32rpx; padding: 30 rpx 32 rpx;
flex: 1; flex: 1;
height: 0; height: 0;
}
.list {
background-color: #fff;
padding: 0 30rpx;
height: 100%;
overflow: auto;
}
.formItem {
box-sizing: border-box;
margin: 0 auto;
padding: 20rpx;
.list { display: flex;
background-color: #fff; align-items: center;
padding: 0 30rpx; justify-content: space-between;
height: 100%; column-gap: 20rpx;
overflow: auto;
}
.listItem { border-bottom: 1rpx solid #DDDDDD;
padding: 30rpx 0; }
border-bottom: 2rpx solid #DDDDDD;
&:last-child {
border-bottom: none;
}
.repairName {
font-size: 32rpx;
color: #333333;
margin-bottom: 20rpx;
}
.repairBottom { .formLabel {
display: flex; font-size: 32rpx;
align-items: center; color: #333333;
justify-content: space-between; }
}
.repairDesc { .formValue {
font-size: 28rpx; flex: 1;
color: #858BA0; width: 0;
} text-align: right;
font-size: 32rpx;
color: #999999;
}
.repairBottom {
display: flex;
align-items: center;
justify-content: space-between;
}
.repairUnit { .repairDesc {
color: #333333; font-size: 28rpx;
} color: #858BA0;
}
.repairBtns { .repairUnit {
display: flex; color: #333333;
align-items: center;
column-gap: 10rpx;
}
}
} }
.footer { .footer {

View File

@ -5,9 +5,7 @@
</template> </template>
<script> <script>
import { import {getToken,getUserInfo} from "@/utils/auth";
getToken
} from "@/utils/auth";
export default { export default {
data() { data() {
@ -18,9 +16,18 @@
onLoad() { onLoad() {
if(getToken()){ if(getToken()){
// //
uni.navigateTo({ //
url: '/pages-home/home/home' let userInfo = getUserInfo()
}) if(userInfo.roleCodes.includes('repair_warehouse')){
//
uni.navigateTo({
url: '/pages-warehouse/home/home'
})
}else{
uni.navigateTo({
url: '/pages-home/home/home'
})
}
}else{ }else{
uni.navigateTo({ uni.navigateTo({
url: '/pages/login/login' url: '/pages/login/login'

View File

@ -0,0 +1,2 @@
## 0.0.12022-07-22
- 初始化

View File

@ -0,0 +1,167 @@
<template>
<view class="uni-section">
<view class="uni-section-header" @click="onClick">
<view class="uni-section-header__decoration" v-if="type" :class="type" />
<slot v-else name="decoration"></slot>
<view class="uni-section-header__content">
<text :style="{'font-size':titleFontSize,'color':titleColor}" class="uni-section__content-title" :class="{'distraction':!subTitle}">{{ title }}</text>
<text v-if="subTitle" :style="{'font-size':subTitleFontSize,'color':subTitleColor}" class="uni-section-header__content-sub">{{ subTitle }}</text>
</view>
<view class="uni-section-header__slot-right">
<slot name="right"></slot>
</view>
</view>
<view class="uni-section-content" :style="{padding: _padding}">
<slot />
</view>
</view>
</template>
<script>
/**
* Section 标题栏
* @description 标题栏
* @property {String} type = [line|circle|square] 标题装饰类型
* @value line 竖线
* @value circle 圆形
* @value square 正方形
* @property {String} title 主标题
* @property {String} titleFontSize 主标题字体大小
* @property {String} titleColor 主标题字体颜色
* @property {String} subTitle 副标题
* @property {String} subTitleFontSize 副标题字体大小
* @property {String} subTitleColor 副标题字体颜色
* @property {String} padding 默认插槽 padding
*/
export default {
name: 'UniSection',
emits:['click'],
props: {
type: {
type: String,
default: ''
},
title: {
type: String,
required: true,
default: ''
},
titleFontSize: {
type: String,
default: '14px'
},
titleColor:{
type: String,
default: '#333'
},
subTitle: {
type: String,
default: ''
},
subTitleFontSize: {
type: String,
default: '12px'
},
subTitleColor: {
type: String,
default: '#999'
},
padding: {
type: [Boolean, String],
default: false
}
},
computed:{
_padding(){
if(typeof this.padding === 'string'){
return this.padding
}
return this.padding?'10px':''
}
},
watch: {
title(newVal) {
if (uni.report && newVal !== '') {
uni.report('title', newVal)
}
}
},
methods: {
onClick() {
this.$emit('click')
}
}
}
</script>
<style lang="scss" >
$uni-primary: #2979ff !default;
.uni-section {
background-color: #fff;
.uni-section-header {
position: relative;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
align-items: center;
padding: 12px 10px;
font-weight: normal;
&__decoration{
margin-right: 6px;
background-color: $uni-primary;
&.line {
width: 4px;
height: 12px;
border-radius: 10px;
}
&.circle {
width: 8px;
height: 8px;
border-top-right-radius: 50px;
border-top-left-radius: 50px;
border-bottom-left-radius: 50px;
border-bottom-right-radius: 50px;
}
&.square {
width: 8px;
height: 8px;
}
}
&__content {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
flex: 1;
color: #333;
.distraction {
flex-direction: row;
align-items: center;
}
&-sub {
margin-top: 2px;
}
}
&__slot-right{
font-size: 14px;
}
}
.uni-section-content{
font-size: 14px;
}
}
</style>

View File

@ -0,0 +1,87 @@
{
"id": "uni-section",
"displayName": "uni-section 标题栏",
"version": "0.0.1",
"description": "标题栏组件",
"keywords": [
"uni-ui",
"uniui",
"标题栏"
],
"repository": "https://github.com/dcloudio/uni-ui",
"engines": {
"HBuilderX": ""
},
"directories": {
"example": "../../temps/example_temps"
},
"dcloudext": {
"category": [
"前端组件",
"通用组件"
],
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "无",
"permissions": "无"
},
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
},
"uni_modules": {
"dependencies": [
"uni-scss"
],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
},
"client": {
"App": {
"app-vue": "y",
"app-nvue": "y"
},
"H5-mobile": {
"Safari": "y",
"Android Browser": "y",
"微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y"
},
"H5-pc": {
"Chrome": "y",
"IE": "y",
"Edge": "y",
"Firefox": "y",
"Safari": "y"
},
"小程序": {
"微信": "y",
"阿里": "y",
"百度": "y",
"字节跳动": "y",
"QQ": "y"
},
"快应用": {
"华为": "u",
"联盟": "u"
},
"Vue": {
"vue2": "y",
"vue3": "y"
}
}
}
}
}

View File

@ -0,0 +1,8 @@
## Section 标题栏
> **组件名uni-section**
> 代码块: `uSection`
uni-section 组件主要用于文章、列表详情等标题展示
### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-section)
#### 如使用过程中有任何问题或者您对uni-ui有一些好的建议欢迎加入 uni-ui 交流群871950839