This commit is contained in:
duan 2024-10-16 09:52:41 +08:00
commit 9f2af5cf76
10 changed files with 194 additions and 68 deletions

View File

@ -1,6 +1,6 @@
<!-- 耗材列表 --> <!-- 耗材列表 -->
<template> <template>
<el-dialog title="选择耗材" :visible.sync="dialogVisible" @open="resetHandle()"> <el-dialog title="选择耗材" :visible.sync="dialogVisible">
<el-form :model="searchForm" inline> <el-form :model="searchForm" inline>
<el-form-item> <el-form-item>
<el-input v-model="searchForm.conTypeName" placeholder="耗材类型名称" @input="onInput"></el-input> <el-input v-model="searchForm.conTypeName" placeholder="耗材类型名称" @input="onInput"></el-input>
@ -162,7 +162,6 @@ export default {
this.goods = [] this.goods = []
} }
this.resetHandle() this.resetHandle()
this.getTableData()
}, },
close() { close() {
this.dialogVisible = false this.dialogVisible = false

View File

@ -1,5 +1,5 @@
<template> <template>
<el-dialog title="选择商品" :visible.sync="dialogVisible" @open="resetHandle()" @close="reset" top="5vh"> <el-dialog title="选择商品" :visible.sync="dialogVisible" @close="reset" top="5vh">
<el-form :model="searhForm" inline> <el-form :model="searhForm" inline>
<el-form-item> <el-form-item>
<el-input v-model="searhForm.name" placeholder="商品名称" @input="onInput"></el-input> <el-input v-model="searhForm.name" placeholder="商品名称" @input="onInput"></el-input>
@ -192,9 +192,8 @@ export default {
} else { } else {
this.goods = [] this.goods = []
} }
this.resetHandle()
this.tbShopCategoryGet() this.tbShopCategoryGet()
this.getTableData() this.resetHandle()
}, },
close() { close() {
this.dialogVisible = false this.dialogVisible = false

View File

@ -963,6 +963,7 @@ export default {
shopId: localStorage.getItem("shopId"), shopId: localStorage.getItem("shopId"),
productId: '',//id productId: '',//id
column: this.stockData.column,// column: this.stockData.column,//
conName:this.query.conName,
createdAt: arr//id createdAt: arr//id
}) })
this.stockData.loading = false; this.stockData.loading = false;

View File

@ -56,7 +56,7 @@
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
<div class="head-container"> <!-- <div class="head-container">
<el-row> <el-row>
<el-col> <el-col>
<el-button <el-button
@ -67,7 +67,7 @@
> >
</el-col> </el-col>
</el-row> </el-row>
</div> </div> -->
<div class="head-container" id="table_drag"> <div class="head-container" id="table_drag">
<el-table <el-table
ref="table" ref="table"

View File

@ -68,10 +68,12 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="库存" prop="number"> <el-table-column label="库存" prop="number">
<template v-slot="scope" > <template v-slot="scope">
<span v-if="!scope.row.isStock" :class="[scope.row.stockNumber <= warnLine ? 'colorStyle' : '']"> <span v-if="!scope.row.isStock"
<span v-if="scope.row.stockNumber < 0" style="font-weight: 700;color: #999;font-size: 14px;">-</span> :class="[scope.row.stockNumber <= warnLine ? 'colorStyle' : '']">
<span > <span v-if="scope.row.stockNumber < 0"
style="font-weight: 700;color: #999;font-size: 14px;">-</span>
<span>
<span> {{ Math.abs(scope.row.stockNumber) }}</span> <span> {{ Math.abs(scope.row.stockNumber) }}</span>
<span> {{ scope.row.unitName }}</span> <span> {{ scope.row.unitName }}</span>
</span> </span>
@ -399,6 +401,12 @@ export default {
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
::v-deep .cell {
display: flex;
align-items: center;
/* flex-direction: row-reverse; */
}
.shop_info { .shop_info {
display: flex; display: flex;
align-items: center; align-items: center;
@ -435,10 +443,3 @@ export default {
font-weight: 700; font-weight: 700;
} }
</style> </style>
<style>
.cell {
display: flex;
align-items: center;
/* flex-direction: row-reverse; */
}
</style>

View File

@ -275,7 +275,7 @@ export default {
remark: '', remark: '',
time: dayjs().format('YYYY-MM-DD'), time: dayjs().format('YYYY-MM-DD'),
totalAmount: 0, totalAmount: 0,
type: 'purveyor', type: 'out',
shopId: localStorage.getItem('shopId') shopId: localStorage.getItem('shopId')
}, },
queryRules: { queryRules: {
@ -503,7 +503,7 @@ export default {
item.number = formatDecimal(item.stockNumber - item.stockConsume, 2, true) item.number = formatDecimal(item.stockNumber - item.stockConsume, 2, true)
item.stockNumber = 0 item.stockNumber = 0
item.costPrice = item.price item.costPrice = item.price
item.conInfold = item.id item.conInfoId = item.id
return item return item
}) })
this.tableData.list = [...this.tableData.list, ...arr] this.tableData.list = [...this.tableData.list, ...arr]

View File

@ -466,7 +466,7 @@ export default {
item.number = formatDecimal(item.stockNumber - item.stockConsume, 2, true) item.number = formatDecimal(item.stockNumber - item.stockConsume, 2, true)
item.stockNumber = 0 item.stockNumber = 0
item.costPrice = item.price item.costPrice = item.price
item.conInfold = item.id item.conInfoId = item.id
return item return item
}) })
this.tableData.list = [...this.tableData.list, ...arr] this.tableData.list = [...this.tableData.list, ...arr]

View File

@ -47,7 +47,7 @@
<div class="item"> <div class="item">
<div class="t">支付时间</div> <div class="t">支付时间</div>
<div class="b"> <div class="b">
{{ detail.createdAt | paidTime | timeFilter }} {{ detail.createdAt | timeFilter }}
</div> </div>
</div> </div>
</div> </div>

View File

@ -50,7 +50,12 @@
</div> </div>
<div class="head-container"> <div class="head-container">
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size" <el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
@current-change="paginationChange" layout="total, sizes, prev, pager, next, jumper"></el-pagination> @current-change="paginationChange" layout="total, sizes, prev, pager, next, jumper" @size-change="(e) => {
tableData.size = e;
tableData.page = 0;
getTableData();
}
"></el-pagination>
</div> </div>
</div> </div>
</template> </template>

View File

@ -16,10 +16,10 @@
<div class="name_wrap"> <div class="name_wrap">
<div class="name">商品名{{ goodsDetail.name }}</div> <div class="name">商品名{{ goodsDetail.name }}</div>
</div> </div>
<el-table :data="tableData.cons"> <!-- 绑定到商品 -->
<el-table :data="tableData.cons" border v-show="type == 1">
<el-table-column label="序号" type="index" width="50"></el-table-column> <el-table-column label="序号" type="index" width="50"></el-table-column>
<el-table-column label="规格名称" prop="specSnap" v-if="type == 2"></el-table-column> <el-table-column label="耗材名称" prop="conInfoId">
<el-table-column label="耗材名称">
<template v-slot="scope"> <template v-slot="scope">
<el-select v-model="scope.row.conInfoId" filterable remote reserve-keyword placeholder="请输入关键词" <el-select v-model="scope.row.conInfoId" filterable remote reserve-keyword placeholder="请输入关键词"
:remote-method="remoteMethod" :loading="loading" @change="selectionChange($event, scope.row)"> :remote-method="remoteMethod" :loading="loading" @change="selectionChange($event, scope.row)">
@ -30,21 +30,21 @@
<div class="tips" v-if="scope.row.stockNumber">库存{{ scope.row.stockNumber }}</div> <div class="tips" v-if="scope.row.stockNumber">库存{{ scope.row.stockNumber }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="单位"> <el-table-column label="单位" prop="conUnit">
<template v-slot="scope"> <template v-slot="scope">
<span v-if="scope.row.conInfoId">{{ scope.row.conUnit }}</span> <span v-if="scope.row.conInfoId">{{ scope.row.conUnit }}</span>
<span v-else>请选择耗材</span> <span v-else>请选择耗材</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="使用数量"> <el-table-column label="使用数量" prop="surplusStock">
<template v-slot="scope"> <template v-slot="scope">
<el-input-number v-model="scope.row.surplusStock" :min="0" /> <el-input-number v-model="scope.row.surplusStock" :min="0" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" width="100px"> <el-table-column label="操作">
<template v-slot="scope"> <template v-slot="scope">
<div class="table_btn_wrap"> <div class="table_btn_wrap">
<div class="btn sub" @click="tableData.cons.splice(scope.$index, 1)"> <div class="btn sub" v-if="scope.$index > 0" @click="tableData.cons.splice(scope.$index, 1)">
<i class="el-icon-remove-outline"></i> <i class="el-icon-remove-outline"></i>
</div> </div>
<div class="btn add" @click="createItem(scope.row)"> <div class="btn add" @click="createItem(scope.row)">
@ -54,6 +54,58 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- 绑定到规格 -->
<el-table :data="tableData.cons" border v-show="type == 2">
<el-table-column label="序号" type="index" width="100"></el-table-column>
<el-table-column label="规格名称" prop="specSnap"></el-table-column>
<el-table-column label="耗材" width="600">
<el-table-column label="耗材信息">
<template v-slot="scope">
<div class="sku_table_item" v-for="(item, index) in scope.row.consList" :key="index">
<el-select v-model="item.conInfoId" filterable remote reserve-keyword placeholder="请输入关键词"
:remote-method="remoteMethod" :loading="loading"
@change="skuSelectionChange($event, item)">
<el-option v-for="item in options" :key="item.consId" :label="item.conName"
:value="item.consId">
</el-option>
</el-select>
<div class="tips" v-if="scope.row.stockNumber">库存{{ scope.row.stockNumber }}</div>
</div>
</template>
</el-table-column>
<el-table-column label="耗材单位">
<template v-slot="scope">
<div class="sku_table_item" v-for="(item, index) in scope.row.consList" :key="index">
<div class="t">
<span v-if="item.conInfoId">{{ item.conUnit }}</span>
<span v-else>请选择耗材</span>
</div>
</div>
</template>
</el-table-column>
<el-table-column label="消耗量">
<template v-slot="scope">
<div class="sku_table_item" v-for="(item, index) in scope.row.consList" :key="index">
<el-input-number v-model="item.surplusStock" :min="0" />
</div>
</template>
</el-table-column>
<el-table-column label="操作">
<template v-slot="scope">
<div class="sku_table_item" v-for="(item, index) in scope.row.consList" :key="index">
<div class="table_btn_wrap t">
<div class="btn sub" v-if="index > 0" @click="scope.row.consList.splice(index, 1)">
<i class="el-icon-remove-outline"></i>
</div>
<div class="btn add" @click="skuCreateItem(scope.$index)">
<i class="el-icon-circle-plus-outline"></i>
</div>
</div>
</div>
</template>
</el-table-column>
</el-table-column>
</el-table>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button> <el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" :loading=formLoading @click="onSubmitHandle"> </el-button> <el-button type="primary" :loading=formLoading @click="onSubmitHandle"> </el-button>
@ -98,8 +150,33 @@ export default {
// this.$message.error('') // this.$message.error('')
// return // return
// } // }
let res = null
this.formLoading = true this.formLoading = true
const res = await tbProskuConV2(this.tableData) if (this.type == 1) {
res = await tbProskuConV2(this.tableData)
} else if (this.type == 2) {
let data = { ...this.tableData }
let arr = []
data.cons.map(item => {
item.consList.map(val => {
if (val.name) {
let obj = { ...item }
obj.id = val.id
obj.name = val.name
obj.productSkuId = item.productSkuId
obj.conInfoId = val.conInfoId
obj.surplusStock = val.surplusStock
arr.push(obj)
}
})
})
data.cons = arr
res = await tbProskuConV2(data)
}
this.formLoading = false this.formLoading = false
this.$message.success('编辑成功') this.$message.success('编辑成功')
this.dialogVisible = false this.dialogVisible = false
@ -109,12 +186,18 @@ export default {
this.formLoading = false this.formLoading = false
} }
}, },
// //
selectionChange(e, row) { selectionChange(e, row) {
let item = this.options.find(item => item.consId == e) let item = this.options.find(item => item.consId == e)
row.name = item.conName row.name = item.conName
row.conUnit = item.conUnit row.conUnit = item.conUnit
}, },
//
skuSelectionChange(e, row) {
let item = this.options.find(item => item.consId == e)
row.name = item.conName
row.conUnit = item.conUnit
},
// //
remoteMethod(query) { remoteMethod(query) {
if (query !== '') { if (query !== '') {
@ -202,9 +285,6 @@ export default {
} }
} else { } else {
// //
if (this.goodsDetail.conInfos.length) {
this.tableData.cons = [...this.goodsDetail.conInfos]
}
this.goodsDetail.skuList.map(val => { this.goodsDetail.skuList.map(val => {
let item = {} let item = {}
@ -219,14 +299,37 @@ export default {
item.status = 1 item.status = 1
item.specSnap = val.name item.specSnap = val.name
item.consList = [
{
surplusStock: 0,
conInfoId: '',
name: '',
conUnit: ''
}
]
this.tableData.cons.push(item) this.tableData.cons.push(item)
}) })
if (this.goodsDetail.conInfos.length) {
this.tableData.cons.map(val => {
this.goodsDetail.conInfos.map(item => {
if (item.productSkuId == val.productSkuId) {
val.consList.unshift({
id: item.id,
surplusStock: item.surplusStock,
conInfoId: item.conInfoId,
name: item.conName,
conUnit: item.conUnit
})
}
})
})
}
} }
}, },
// //
createItem(val) { createItem(val) {
if (this.type == 1) {
let item = {} let item = {}
item.id = '' item.id = ''
@ -240,22 +343,15 @@ export default {
item.status = 1 item.status = 1
this.tableData.cons.push(item) this.tableData.cons.push(item)
} else { },
let item = {} //
skuCreateItem($index) {
item.id = '' this.tableData.cons[$index].consList.push({
item.shopId = localStorage.getItem('shopId') conInfoId: '',
item.productId = this.goodsDetail.id name: '',
item.productSkuId = val.productSkuId conUnit: '',
item.conInfoId = '' surplusStock: 0
item.name = '' })
item.conUnit = ''
item.surplusStock = 0
item.status = 1
item.specSnap = val.specSnap
this.tableData.cons.push(item)
}
}, },
reset() { reset() {
this.goodsDetail = '' this.goodsDetail = ''
@ -321,4 +417,29 @@ export default {
} }
} }
} }
.cons_list_wrap {
.row {
display: flex;
padding: 10px 0;
align-items: center;
gap: 10px;
.item {
flex: 1;
display: flex;
align-items: center;
}
}
}
.sku_table_item {
padding: 10px 0;
.t {
height: 32px;
display: flex;
align-items: center;
}
}
</style> </style>