采购单、入库

This commit is contained in:
许允枞 2024-10-26 17:07:36 +08:00
parent d7c5f60db8
commit 9bc739b7af
3 changed files with 431 additions and 49 deletions

247
components/repairSoCard.vue Normal file
View File

@ -0,0 +1,247 @@
<template>
<view class="orderCard">
<view class="order-top">
<view class="orderNo">
采购单号{{ order.soNo }}
</view>
<!-- <view :style="{ color: getFlagColor(order.flag) }" class="flag">-->
<!-- {{ order.flagStr }}-->
<!-- </view>-->
</view>
<view class="order-body">
<view class="baseInfo">
<view>
数量{{ order.itemCount }}
</view>
<view v-if="order.totalPrice">
金额{{ order.totalPrice }}
</view>
<view>
状态{{ soStatusText }}
</view>
<view>
采购员{{ order.userName }}
</view>
</view>
<view class="footer">
<view @click="gotoDetail" class="btn pg" style="margin-right: 40rpx">
<!-- 在什么都不能操作的情况下可以查看详情-->
查看入库单
</view>
<view @click="gotoDetail" class="btn pg">
<!-- 在什么都不能操作的情况下可以查看详情-->
入库
</view>
</view>
</view>
</view>
</template>
<script>
import {
getUserInfo,
getStrData
} from '@/utils/auth';
import request from '@/utils/request';
import {getDictTextByCodeAndValue} from "@/utils/utils";
export default {
name: "repairSoCard",
props: {
order: {
type: Object,
default: () => {
return {}
}
}
},
computed: {
// projectName() {
// if (this.order && this.order.projectList && this.order.projectList.length > 0) {
// return this.order.projectList.map(m => m.name).join(',')
// }
// return ''
// }
},
data() {
return {
soStatusText:''
}
},
mounted() {
this.getDictTextByCodeAndValue(this.order.soStatus); //
},
onLoad() {
},
methods: {
getDictTextByCodeAndValue(soStatus) {
getDictTextByCodeAndValue('repair_so_status', soStatus)
.then(value => {
this.soStatusText = value; // data
})
.catch(error => {
this.soStatusText = "未知";
console.error(error);
});
},
/**
* 查看详情
*/
gotoDetail() {
uni.navigateTo({
url: '/pages-warehouse/inOutWarehouse/part?soId=' + this.order.id
})
},
/**
* 项目派工
*/
projectDis() {
uni.navigateTo({
url: '/pages-order/choosePeople/choosePeople?id=' + this.order.id
})
}
},
getStatus() {
}
}
</script>
<style lang="less" scoped>
.orderCard {
background: #FFFFFF;
border-radius: 8rpx 8rpx 8rpx 8rpx;
border-left: 4rpx solid #FFB323;
padding: 0 30rpx;
margin: 15rpx 0;
}
.order-top {
padding: 20rpx 0;
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 1px solid #F3F5F7;
.orderNo {
font-weight: 500;
font-size: 24rpx;
color: #858BA0;
}
.flag {
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 24rpx;
}
}
.order-body {
.carNum {
margin: 20rpx 0;
}
.carModel {
margin: 20rpx 0;
font-weight: 500;
font-size: 28rpx;
color: #858BA0;
}
.project {
padding: 20rpx 10rpx;
background: #F2F2F7;
border-radius: 4rpx 4rpx 4rpx 4rpx;
display: flex;
align-items: center;
.project-left {
flex: 1;
width: 0;
}
.project-right {
padding: 0 16rpx;
display: flex;
flex-direction: column;
align-items: center;
border-left: 1rpx solid #DDDDDD;
.rightIcon {
width: 40rpx;
height: 40rpx;
}
.rightText {
font-weight: 500;
font-size: 24rpx;
color: #17DBB1;
}
}
.title {
font-weight: 500;
font-size: 24rpx;
color: #0174F6;
display: flex;
align-items: center;
column-gap: 8rpx;
}
.titleIcon {
width: 24rpx;
height: 24rpx;
}
.desc {
font-weight: 500;
font-size: 24rpx;
color: #333333;
margin-top: 10rpx;
}
}
.baseInfo {
font-weight: 500;
font-size: 28rpx;
color: #858BA0;
//padding-bottom: 10rpx;
& > view {
margin: 30rpx 0;
}
}
.footer {
display: flex;
align-items: center;
justify-content: flex-end;
column-gap: 10rpx;
padding-bottom: 30rpx;
.btn {
width: 172rpx;
height: 60rpx;
border-radius: 30rpx 30rpx 30rpx 30rpx;
border: 2rpx solid #0174F6;
display: flex;
align-items: center;
justify-content: center;
font-weight: 500;
font-size: 28rpx;
color: #0174F6;
&.qc {
background: #0174F6;
color: #fff;
}
}
}
}
</style>

View File

@ -1,6 +1,6 @@
<template>
<view class="container">
<view class="header">
<view class="header" v-if="!isRepairWarehouse">
<view class="searchBox">
<input class="searchInput" type="text" v-model="searchText" placeholder="工单号、车牌号、手机号、客户姓名" placeholder-style="font-size: 28rpx">
<text class="searchBtn" @click="onRefresherrefresh">搜索</text>
@ -15,7 +15,7 @@
<view v-if="activeKey === item.id" class="activeLine"></view>
</view>
</view>
<view class="orderList">
<view class="orderList" v-if="!isRepairWarehouse">
<scroll-view scroll-y="true" style="height: 100%" class="itemContent" @scrolltolower="onReachBottomCus"
refresher-enabled @refresherrefresh="onRefresherrefresh" :refresher-triggered="isTriggered">
<order-card v-for="(item, index) in orderList" :key="index" :order="item" @childEvent="onRefresherrefresh" @startWork="startWork"></order-card>
@ -24,6 +24,15 @@
</view>
</scroll-view>
</view>
<view class="orderList" v-else>
<scroll-view scroll-y="true" style="height: 100%" class="itemContent" @scrolltolower="onReachBottomCus"
refresher-enabled @refresherrefresh="onRefresherrefresh" :refresher-triggered="isTriggered">
<repair-so-card v-for="(item, index) in repairSoList" :key="index" :order="item" @childEvent="onRefresherrefresh" @startWork="startWork"></repair-so-card>
<view style="text-align: center" v-if="repairSoList.length==0">
<image class="" src="@/static/images/nothing.png" ></image>
</view>
</scroll-view>
</view>
</view>
<tabBarVue msg="2"></tabBarVue>
</view>
@ -41,12 +50,14 @@ import {
getStrData,
getTenantId
} from '@/utils/auth'
import RepairSoCard from "@/components/repairSoCard.vue";
export default {
components: {
OrderCard,
tabBarVue,
VNavigationBar
VNavigationBar,
RepairSoCard
},
data() {
return {
@ -56,6 +67,7 @@ export default {
pageNo: 1,
pageSize: 10,
total: 0,
isRepairWarehouse : false, //
//
isTriggered:false,
imageUrl: '',
@ -71,6 +83,7 @@ export default {
],
orderList: [
],
repairSoList: [],
}
},
onShow() {
@ -81,6 +94,15 @@ export default {
}else{
//
this.userInfo = getUserInfo()
if (this.userInfo.roleCodes.includes("repair_warehouse")){
this.tabList = [
{
id: 0,
title: '采购单'
},
]
this.isRepairWarehouse = true
}
this.onRefresherrefresh()
}
},
@ -97,7 +119,11 @@ export default {
//+1,
this.pageNo++
//
this.getOrderList()
if (this.isRepairWarehouse) {
this.getRepairSoList()
}else{
this.getOrderList()
}
},
/**
* 下拉刷新数据
@ -106,8 +132,13 @@ export default {
this.isTriggered = true
this.pageNo = 1
this.total = 0
this.orderList = []
this.getOrderList()
if (this.isRepairWarehouse) {
this.getRepairSoList()
this.repairSoList = []
}else{
this.getOrderList()
this.orderList = []
}
},
/**
* 清空
@ -230,6 +261,33 @@ export default {
})
}
},
/**
* 获取采购单
*/
getRepairSoList(){
const paramsObj = {
pageNo: this.pageNo,
pageSize: this.pageSize,
userId: this.userInfo.id,
soType: "01"
}
request({
url: '/admin-api/repair/so/page',
method: 'get',
params: paramsObj
}).then((res) => {
// concat n
if (this.pageNo != 1) {
this.repairSoList = this.repairSoList.concat(res.data.records)
} else {
this.repairSoList = res.data.records
}
//
this.total = res.data.total
this.isTriggered = false
})
},
}
}
</script>

View File

@ -1,19 +1,19 @@
<template>
<view class="container">
<VNavigationBar background-color="#fff" title="采购单" title-color="#333"></VNavigationBar>
<VNavigationBar background-color="#fff" :title="title" title-color="#333"></VNavigationBar>
<view class="listBox">
<view class="list">
<view class="formItem">
<view class="formItem" v-if="!isInput">
<text class="formLabel">供应商</text>
<input type="text" style="text-align: right" v-model="serviceName" placeholder="请选择供应商"/>
<view @click="searchService">查询</view>
</view>
<view class="formItem">
<view class="formItem" v-if="!isInput">
<text class="formLabel">备注</text>
<text class="formValue"></text>
</view>
<view style="padding-bottom: 60rpx;border-bottom: 1px solid #ddd;" class="formItem">
<textarea style="height: 50px" auto-height placeholder="请输入备注" v-model="remark" />
<view style="padding-bottom: 60rpx;border-bottom: 1px solid #ddd;" class="formItem" v-if="!isInput">
<textarea style="height: 50px" auto-height placeholder="请输入备注" v-model="remark"/>
</view>
<uni-card v-for="(item, index) in partList" :key="index" :title="item.name" :extra="'上次价格:'+item.purPrice">
<view class="formItem">
@ -30,7 +30,8 @@
<view class="footer">
<text class="label"></text>
<text class="repairNum"></text>
<view class="submit" @click="submit">保存</view>
<view class="submit" @click="submit" v-if="!isInput">保存</view>
<view class="submit" @click="inWare" v-else>入库</view>
</view>
</view>
</template>
@ -38,52 +39,62 @@
<script>
import VNavigationBar from "@/components/VNavigationBar.vue";
import request from '@/utils/request';
import {getDictTextByCodeAndValue,createUniqueCodeByHead} from "@/utils/utils";
import {getUserInfo,getJSONData} from '@/utils/auth.js'
import {getDictTextByCodeAndValue, createUniqueCodeByHead} from "@/utils/utils";
import {getUserInfo, getJSONData} from '@/utils/auth.js'
export default {
components: {VNavigationBar},
data() {
return {
//id
twId:'',
twId: '',
//
wares:[],
wares: [],
//
partList:[],
partList: [],
//0102退
type:true,
type: true,
//
formData:{},
formData: {},
repairList: [],
remark:"",
isInput: false, //
remark: "",
title: '采购单',
selectedRepairList: [
{name: '炫驰全合成机油S7 4L/ALL', num: 3, unit: '桶', id: 3}
],
active: '',
//
serviceName:"",
serviceName: "",
//id
serviceId:"",
serviceId: "",
soId: "",
soiIds: []
};
},
onLoad() {
if (getJSONData("applyWaresForm")){
this.formData = getJSONData("applyWaresForm")
this.wares = this.formData.items
onLoad(data) {
if (data.soId) {
this.soId = data.soId
this.isInput = true
this.title = '配件入库'
this.getSoiId()
}else {
if (getJSONData("applyWaresForm")) {
this.formData = getJSONData("applyWaresForm")
this.wares = this.formData.items
this.init()
}
}
this.init()
},
computed: {
},
computed: {},
methods: {
/**
* 查询供应商
*/
searchService(){
if(""==this.serviceName){
searchService() {
if ("" == this.serviceName) {
uni.showToast({
title: '请输入供应商名称!',
icon: 'none'
@ -94,18 +105,18 @@ export default {
request({
url: '/admin-api/supplier/baseSupplier/searchList',
method: 'get',
params: {name:this.serviceName}
params: {name: this.serviceName}
}).then((res) => {
console.log(res)
if (res.code == 200 && res.data.length>0) {
if (res.code == 200 && res.data.length > 0) {
uni.showActionSheet({
itemList: res.data.map(m => m.name),
success: ({ tapIndex }) => {
success: ({tapIndex}) => {
this.serviceName = res.data[tapIndex].name
this.serviceId = res.data[tapIndex].id
}
})
}else{
} else {
//
uni.showToast({
title: '未查询到符合条件的供应商,您可以直接使用,系统将自动保存为新供应商!',
@ -118,7 +129,7 @@ export default {
* 初始化配件数据
*/
init() {
this.partList = [...this.wares.map(item =>{
this.partList = [...this.wares.map(item => {
return {
...item.wares,
count: item.waresCount,
@ -166,12 +177,14 @@ export default {
soNo: createUniqueCodeByHead("CG"),
userId: userInfo.id,
userName: userInfo.nickname,
itemCount:this.partList.length,
totalPrice:this.partList.reduce((x, y) => {return x + y.totalPrice}, 0),
soStatus:'03',
remark:this.remark,
supplierId:this.serviceId,
supplierName:this.serviceName
itemCount: this.partList.length,
totalPrice: this.partList.reduce((x, y) => {
return x + y.totalPrice
}, 0),
soStatus: '03',
remark: this.remark,
supplierId: this.serviceId,
supplierName: this.serviceName
}
data.goodsList = [...this.partList.map(item => {
return {
@ -189,20 +202,80 @@ export default {
request({
url: '/admin-api/repair/so/create',
method: 'post',
data:data
}).then((res)=>{
if (res.code == 200){
data: data
}).then((res) => {
if (res.code == 200) {
uni.showToast({
title: '创建成功!',
icon: 'none'
})
setTimeout(()=>{
setTimeout(() => {
uni.navigateBack()
},700)
}, 700)
}
})
},
getSoiId() {
request({
url: '/admin-api/repair/so/get',
method: 'get',
params: {
id: this.soId
}
}).then((res) => { // `.then`
console.log(res)
res.data.goodsList.forEach(item => {
this.soiIds.push(item.id)
})
console.log('返回',res.data)
request({
url: '/admin-api/repair/soi/get',
method: 'get',
params: {
ids: this.soiIds.join(',')
}
}).then((res) => { //
console.log('配件信息', res.data)
res.data.map(item => {
item.wares = item.repairWares
item.waresCount = 0
})
this.wares = res.data
this.init()
})
})
},
/**
* 入库
*/
inWare(){
console.log('partList',this.partList)
this.partList.forEach(item => {
item.inCount = item.count
item.id = this.soiIds[0]
})
request({
url: '/admin-api/repair/so/inWare',
method: 'post',
data: {
id: this.soId,
soiList: this.partList
}
}).then((res) => {
if (res.code == 200) {
uni.showToast({
title: '入库成功!',
icon: 'none'
})
setTimeout(() => {
uni.navigateBack()
}, 700)
}
})
}
}
}
</script>
@ -214,17 +287,20 @@ export default {
display: flex;
flex-direction: column;
}
.listBox {
padding: 30 rpx 32 rpx;
padding: 30rpx 32rpx;
flex: 1;
height: 0;
}
.list {
background-color: #fff;
padding: 0 30rpx;
height: 100%;
overflow: auto;
}
.formItem {
box-sizing: border-box;
margin: 0 auto;
@ -250,6 +326,7 @@ export default {
font-size: 32rpx;
color: #999999;
}
.repairBottom {
display: flex;
align-items: center;