This commit is contained in:
PQZ 2024-10-23 17:59:56 +08:00
parent cce35c630f
commit a66d3bfb6a
3 changed files with 166 additions and 98 deletions

View File

@ -27,7 +27,7 @@
<script>
import request from '../../utils/request';
import {
getToken
getToken,getUserInfo
} from '@/utils/auth'
let innerAudioContext ='';
// #ifdef APP || H5
@ -43,6 +43,7 @@
msgNum: null,
identity: 'user',
nowPageInterval: null,
userInfo:{},
arr: [{
text: '首页'
},
@ -59,8 +60,8 @@
msg: String|Number
},
onLoad() {
this.userInfo = getUserInfo();
console.log('tabbag', uni.getStorageSync('identity'));
},
onUnload() {
if (this.nowPageInterval) {
@ -172,11 +173,19 @@
}
},
getgogo(index) {
if (index == 1) {
const userInfo = getUserInfo()
if (index == 1) {
this.aindex = index
uni.reLaunch({
url: '/pages-home/home/home'
})
if (userInfo.roleCodes.includes("repair_warehouse")){
//
uni.navigateTo({
url: '/pages-warehouse/home/home'
})
} else {
uni.reLaunch({
url: '/pages-home/home/home'
})
}
}
if (index == 2) {
this.aindex = index
@ -192,7 +201,6 @@
}
}
}
}
</script>

View File

@ -17,9 +17,9 @@
</view>
<view class="body-top">
<view class="body-top-search">
<input class="body-top-search-input" placeholder="查询审批单" placeholder-style="font-size: 28rpx"
<input class="body-top-search-input" v-model="queryParams.query" placeholder="工单号、车牌号、联系电话" placeholder-style="font-size: 28rpx"
type="text">
<text>搜索</text>
<text @click="onRefresherrefresh">搜索</text>
</view>
<view class="body-top-tab">
<view v-for="(item, index) in tabList" @click="activeTab(index)" :key="index" :class="{ active: active === index }"
@ -30,6 +30,7 @@
</view>
</view>
<view class="todoListBox">
<scroll-view :refresher-triggered="isTriggered" @scrolltolower="onReachBottomCus" class="itemContent"
refresher-enabled
@ -37,14 +38,14 @@
<view v-for="(item, index) in ticketWares" :key="index" class="orderItem">
<view class="order-top">
<view class="order-top-left">
<text class="order-top-name">{{ item.repairName+'的配件申请单' }}</text>
<text class="order-top-name">{{ item.repairName}}{{'配件申请单'}}</text>
<text class="order-top-date">{{ item.createTimeStr }}</text>
</view>
<text class="order-status">{{ item.statusStr }}</text>
</view>
<view class="order-content">
<view>
申请人{{ item.repairName }}
车牌号{{ item.licenseNumber }}
</view>
<view>
服务顾问{{ item.adviserName }}
@ -52,13 +53,12 @@
</view>
<view class="order-footer">
<template>
<view class="order-btn no">拒绝审批</view>
<view class="order-btn yes">审批出库</view>
<template v-if="!queryParams.isBack">
<view @click="inOutWareHouse(item,true)" class="order-btn yes">通知领料</view>
<!-- <view class="order-btn yes">采购</view>-->
</template>
<template>
<view class="order-btn">配件出库</view>
<view class="order-btn">配件入库</view>
<template v-else>
<view @click="inOutWareHouse(item,false)" class="order-btn yes">通知退料</view>
</template>
</view>
</view>
@ -78,14 +78,13 @@ import VNavigationBar from '@/components/VNavigationBar.vue'
import OrderCard from "@/components/orderCard.vue";
import config from '@/config'
import request from '@/utils/request';
import {builderOrder, formatTimestamp, saveTicketsRecords} from "@/utils/utils";
import {
getToken,
getUserInfo,
getStrData,
getTenantId
} from '@/utils/auth'
import {getDictTextByCodeAndValue,formatDate} from "@/utils/utils";
import {getDictTextByCodeAndValue,formatDate,formatTimestamp} from "@/utils/utils";
export default {
components: {
@ -129,26 +128,6 @@ export default {
shopList: [],
bannerList: [],
richTextHtml: null,
pageNo: 1,
pageSize: 10,
orderList: [
{
orderNo: '1209840149750105501',
flag: 1, flagStr: '待处理', carNum: '川A 184AO1',
carModel: '一汽奥迪 2024款 A6L',
projectList: [
{name: '清洗内饰', id: 1},
{name: '内饰精洗除臭', id: 2},
{name: '烘干底板胶及脚垫', id: 3}
],
userName: '张三',
userPhone: '157****6879',
appointDate: '2024-10-20 12:00',
counselorName: '李相东'
},
],
defaultAvatar: require('@/static/icons/avatar.png')
}
},
@ -179,9 +158,17 @@ export default {
}
},
methods: {
/**
* 领配件退配件Tab页
*/
activeTab(index){
this.active = index
this.queryParams.type = 1==index?'01':'02'
if (index == 1){
this.queryParams.isBack = true
} else {
this.queryParams.isBack = undefined
}
this.onRefresherrefresh()
},
@ -204,7 +191,6 @@ export default {
method: 'get',
params: this.queryParams
}).then((res)=>{
console.log(res,187)
if (res.code == 200){
res.rows.map((item) => {
getDictTextByCodeAndValue("ticket_wares_status",item.status).then(value => {
@ -213,10 +199,10 @@ export default {
item.statusStr = "未知"
console.error(error);
});
item.createTimeStr = formatDate(item.createTime)
item.createTimeStr = formatTimestamp(item.createTime)
})
this.total = res.total
if (this.pageNo != 1) {
if (this.queryParams.pageNo != 1) {
this.ticketWares = this.ticketWares.concat(res.rows)
} else {
this.ticketWares = res.rows
@ -242,7 +228,24 @@ export default {
this.getTicketWares()
},
/**
* 配件出库
*/
inOutWareHouse(formData,isBack){
formData.isBack = isBack
uni.navigateTo({
url: '/pages-warehouse/inOutWarehouse/inOutWarehouse?formData='+encodeURIComponent(JSON.stringify(formData))
})
},
/**
* 配件出库操作
*/
handlePass(row){
//
const formData = {...row}
},
gotoPage(menu) {
uni.navigateTo({

View File

@ -1,28 +1,25 @@
<template>
<view class="container">
<VNavigationBar background-color="#fff" title="配件出库" title-color="#333"></VNavigationBar>
<view class="search">
<view class="searchBox">
<input class="searchInput" placeholder="查询配件名称" placeholder-style="font-size: 28rpx" type="text">
<text>搜索</text>
</view>
</view>
<view class="tabs">
<view v-for="(item, index) in tabs" :key="index" :class="{'active': item.value === active}" class="tab-item">
{{ item.name }}
</view>
</view>
<VNavigationBar background-color="#fff" title="单据处理" title-color="#333"></VNavigationBar>
<!-- <view class="tabs">-->
<!-- <view v-for="(item, index) in tabs" :key="index" :class="{'active': item.value === active}" class="tab-item">-->
<!-- {{ item.name }}-->
<!-- </view>-->
<!-- </view>-->
<view class="listBox">
<view class="list">
<view v-for="(item, index) in repairList" :key="index" class="listItem">
<view class="repairName">{{ item.name }}</view>
<view v-for="(item, index) in wares" :key="index" class="listItem">
<view class="repairName">{{ item.waresName }}</view>
<view class="repairBottom">
<text class="repairDesc">单位
<text class="repairUnit">{{ item.unit }}</text>
<text class="repairUnit">{{ item.unitStr }}</text>
</text>
<text class="repairDesc">库存
<text class="repairUnit">{{ item.wares.stock }}</text>
</text>
<view class="repairBtns">
<u-icon name="minus-circle-fill" size="24" @click="delNum(item)"></u-icon>
<text class="repairNum">{{ item.num }}</text>
<text class="repairNum">{{ item.waresCount }}</text>
<u-icon color="#0174F6" name="plus-circle-fill" size="24" @click="addNum(item)"></u-icon>
</view>
</view>
@ -30,31 +27,30 @@
</view>
</view>
<view class="footer">
<text class="label">共选择</text>
<text class="repairNum">{{ repairCount }}个配件</text>
<view class="submit" @click="submit">确认出库</view>
<text class="label"></text>
<text class="repairNum"></text>
<view class="submit" @click="submit">{{type?'通知领料':'通知退料'}}</view>
</view>
</view>
</template>
<script>
import VNavigationBar from "@/components/VNavigationBar.vue";
import request from '@/utils/request';
import {getDictTextByCodeAndValue,createUniqueCodeByHead} from "@/utils/utils";
export default {
components: {VNavigationBar},
onLoad() {
this.init()
},
data() {
return {
tabs: [
{name: '全部', value: ''},
{name: '机油', value: '1'},
{name: '机油', value: '2'},
{name: '机油', value: '3'},
{name: '机油', value: '4'},
{name: '机油', value: '5'},
],
//id
twId:'',
//
wares:[],
//0102退
type:true,
//
formData:{},
repairList: [],
selectedRepairList: [
{name: '炫驰全合成机油S7 4L/ALL', num: 3, unit: '桶', id: 3}
@ -62,6 +58,15 @@ export default {
active: ''
};
},
onLoad(data) {
if (data.formData){
this.formData = JSON.parse(decodeURIComponent(data.formData))
this.type = this.formData.isBack
this.twId = this.formData.id
}
this.init()
},
computed: {
repairCount() {
return this.selectedRepairList.reduce((val, item) => {
@ -70,48 +75,100 @@ export default {
}
},
methods: {
/**
* 初始化配件数据
*/
init() {
//
const result = [{name: '炫驰全合成机油S7 4L/ALL', num: 0, unit: '桶', id: 1},
{name: '炫驰全合成机油S7 4L/ALL', num: 0, unit: '桶', id: 2},
{name: '炫驰全合成机油S7 4L/ALL', num: 0, unit: '桶', id: 3},
{name: '炫驰全合成机油S7 4L/ALL', num: 0, unit: '桶', id: 4},
{name: '炫驰全合成机油S7 4L/ALL', num: 0, unit: '桶', id: 5}]
//
this.repairList = result.map(m => {
if (this.selectedRepairList && this.selectedRepairList.length > 0) {
const find = this.selectedRepairList.find(f => f.id === m.id)
if (find) {
m.num = find.num
}
}
return m
const params = {
twId:this.formData.id
}
request({
url: '/admin-api/repair/twi/list',
method: 'get',
params: params
}).then((res)=>{
const items = res.data;
items.map((item)=>{
const count = item.waresAlreadyCount ? parseInt(item.waresCount) - parseInt(item.waresAlreadyCount) : item.waresCount
item.waresCount = this.type ? count : item.waresAlreadyCount
item.isStock = this.type ? count <= item.wares.stock : true
getDictTextByCodeAndValue("repair_unit",item.wares.unit).then(value => {
item.unitStr = value
}).catch(error => {
item.unitStr = "未知"
});
})
this.wares = items;
})
},
/**
*
*/
addNum(repair) {
this.$set(repair, 'num', repair.num + 1)
const find = this.selectedRepairList.find(f => f.id === repair.id)
this.$set(repair, 'waresCount', repair.waresCount + 1)
const find = this.wares.find(f => f.id === repair.id)
if (find) {
find.num = repair.num
find.waresCount = repair.waresCount
} else {
this.selectedRepairList.push(JSON.parse(JSON.stringify(repair)))
this.wares.push(JSON.parse(JSON.stringify(repair)))
}
console.log('repair', repair)
},
/**
*
*/
delNum(repair) {
if (repair.num <= 0) {
if (repair.waresCount <= 0) {
return
}
this.$set(repair, 'num', repair.num - 1)
const findIndex = this.selectedRepairList.findIndex(f => f.id === repair.id)
this.$set(repair, 'waresCount', repair.waresCount - 1)
const findIndex = this.wares.findIndex(f => f.id === repair.id)
if (findIndex > -1 && repair.num <= 0) {
this.selectedRepairList.splice(findIndex, 1)
this.wares.splice(findIndex, 1)
} else if (repair.num > 0) {
this.$set(this.selectedRepairList[findIndex], 'num', repair.num)
this.$set(this.wares[findIndex], 'waresCount', repair.waresCount)
}
},
/**
* 出库
*/
submit() {
console.log('this.selectedRepairList', this.selectedRepairList)
this.formData.repairSo = {
soType:this.type?'02':'04',
soNo:createUniqueCodeByHead(this.type?'LL':'TL'),
userId:this.formData.repairId,
userName:this.formData.repairName,
soStatus:this.type?'04':'07'
}
this.formData.repairSois = [...this.wares.map(item =>{
return {
soiType: this.type ? '02' : "04",
goodsId: item.waresId,
goodsCount: item.waresCount,
}
})]
if (this.type){
this.formData.items = [...this.wares.map(item => {
return {
id: item.id,
}
})]
}
request({
url: '/admin-api/repair/tw/pass',
method: 'post',
data:this.formData
}).then((res)=>{
if (res.code === 200){
uni.showToast({
title: '通知成功!',
icon: 'none'
})
setTimeout(()=>{
uni.navigateBack()
},700)
}
})
}
}
}