修改耗材绑定商品
This commit is contained in:
commit
2f0006571f
|
|
@ -241,6 +241,16 @@ export function stockStateChange(params) {
|
|||
}
|
||||
});
|
||||
}
|
||||
// 下架
|
||||
export function stockStateChangess(params) {
|
||||
return request({
|
||||
url: `/api/stock/grounding`,
|
||||
method: "put",
|
||||
params: {
|
||||
...params
|
||||
}
|
||||
});
|
||||
}
|
||||
// 警戒设置
|
||||
export function stockStatewarnLine(params) {
|
||||
return request({
|
||||
|
|
|
|||
|
|
@ -103,15 +103,15 @@ export default {
|
|||
methods: {
|
||||
toOrderList(data){
|
||||
console.log(data)
|
||||
if(data.orderId){
|
||||
this.$refs.orderDetail.show({id:data.orderId})
|
||||
}
|
||||
// this.$router.push({
|
||||
// path:'/order_manage/order_list',
|
||||
// query:{
|
||||
// orderNo: data.orderNo||'WX20240717165941120'
|
||||
// }
|
||||
// })
|
||||
// if(data.orderId){
|
||||
// this.$refs.orderDetail.show({id:data.orderId})
|
||||
// }
|
||||
this.$router.push({
|
||||
path:'/order_manage/order_list',
|
||||
query:{
|
||||
orderNo: data.orderNo||'WX20240717165941120'
|
||||
}
|
||||
})
|
||||
},
|
||||
open(query){
|
||||
this.dialogVisible = true;
|
||||
|
|
|
|||
|
|
@ -43,6 +43,13 @@
|
|||
{{ scope.row.leftNumber + scope.row.stockNumber }} {{ scope.row.unitName }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="订单号">
|
||||
<template v-slot="scope">
|
||||
<span @click="goUrl(scope.row.orderNo)" style="color: blue;cursor: pointer">
|
||||
{{ scope.row.orderNo }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作时间" prop="updatedAt">
|
||||
<template v-slot="scope">
|
||||
{{ dayjs(scope.row.updatedAt).format('YYYY-MM-DD HH:mm:ss') }}
|
||||
|
|
@ -112,6 +119,9 @@ export default {
|
|||
this.tableData.page = e - 1
|
||||
this.getTableData()
|
||||
},
|
||||
goUrl(orderNo) {
|
||||
this.$router.push({ path: '/order_manage/order_list', query: { orderNo } })
|
||||
},
|
||||
// 重置查询
|
||||
resetHandle() {
|
||||
this.query.blurry = ''
|
||||
|
|
|
|||
|
|
@ -0,0 +1,250 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-dialog width="60vw" title="选择商品" :visible.sync="dialogVisible" @open="resetHandle()">
|
||||
<el-form :model="searhForm" inline>
|
||||
<el-form-item>
|
||||
<el-input v-model="searhForm.name" placeholder="商品名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-select v-model="searhForm.category" placeholder="商品分类">
|
||||
<el-option :label="item.name" :value="item.id" v-for="item in categoryList"
|
||||
:key="item.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="getTableData">查询</el-button>
|
||||
<el-button @click="resetHandle">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="head-container">
|
||||
<el-table ref="table" height="70vh" :data="tableData.list"
|
||||
row-key="id" :tree-props="{ children: 'children', hasChildren: 'hasChildren' }" lazy :load="load"
|
||||
@select="firstSelectChange" v-loading="tableData.loading">
|
||||
<!-- <el-table-column type="selection" width="55" align="center"></el-table-column> -->
|
||||
<el-table-column width="30">
|
||||
<template v-slot="scope">
|
||||
<i class="" v-if="scope.row.hasChildren == false"></i>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品信息">
|
||||
<template v-slot="scope">
|
||||
<div class="shop_info">
|
||||
<el-image :src="scope.row.coverImg" class="cover" v-if="scope.row.iskaiguans != 1">
|
||||
<div class="img_error" slot="error">
|
||||
<i class="icon el-icon-document-delete"></i>
|
||||
</div>
|
||||
</el-image>
|
||||
<div class="info">
|
||||
<span>{{ scope.row.name }}</span>
|
||||
<div v-if="scope.row.iskaiguans != 1">
|
||||
<el-tag type="primary">{{ scope.row.typeEnum }}</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="规格">
|
||||
<template v-slot="scope">
|
||||
<div v-if="scope.row.iskaiguans">
|
||||
{{ scope.row.specSnap }}
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column> <el-table-column label="是否售罄">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.isPauseSale == 1 ? '是' : '否' }}
|
||||
</template>
|
||||
</el-table-column> <el-table-column label="是否分销">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.isDistribute == 1 ? '是' : '否' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="售价">
|
||||
<template v-slot="scope">
|
||||
¥{{ scope.row.lowPrice }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="销量/库存">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.realSalesNumber }}/{{ scope.row.stockNumber }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="分类名称" prop="categoryName"></el-table-column>
|
||||
<el-table-column label="绑定耗材" >
|
||||
<template v-slot="scope">
|
||||
<div v-if="scope.row.iskaiguans">
|
||||
<el-button type="text" size="mini" @click="showHaocai">绑定耗材</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
|
||||
@current-change="paginationChange" @size-change="sizeChange"
|
||||
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="confirmHandle">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<choose-haocai ref="chooseHaocai"></choose-haocai>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { tbShopCategoryGet, tbProductlist,stocks } from "@/api/invoicing";
|
||||
import chooseHaocai from "../consumable/components/choose_haocai";
|
||||
|
||||
export default {
|
||||
components:{chooseHaocai},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
searhForm: {
|
||||
name: '',
|
||||
category: ''
|
||||
},
|
||||
categoryList: [],
|
||||
tableData: {
|
||||
page: 0,
|
||||
size: 30,
|
||||
total: 0,
|
||||
loading: false,
|
||||
list: []
|
||||
},
|
||||
goods: [],
|
||||
// 是否单选
|
||||
isselect: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
showHaocai(){
|
||||
this.$refs.chooseHaocai.open()
|
||||
},
|
||||
async load(tree, treeNode, resolve) {
|
||||
const res = await stocks({
|
||||
productId: tree.id,
|
||||
})
|
||||
res.forEach(ele => ele.iskaiguans = 1)
|
||||
setTimeout(() => {
|
||||
resolve(res)
|
||||
}, 50);
|
||||
},
|
||||
firstSelectChange() {
|
||||
// console.log(selection)
|
||||
let selection = this.$refs.table.selection
|
||||
if (selection.length > 1 && this.isselect) {
|
||||
const del_row = selection.shift();
|
||||
this.$refs.table.toggleRowSelection(del_row, false);
|
||||
}
|
||||
},
|
||||
// 确定选商品
|
||||
confirmHandle() {
|
||||
let res = this.$refs.table.selection
|
||||
this.$emit('success', res)
|
||||
this.close()
|
||||
},
|
||||
// 是否单选
|
||||
isselectEvent() {
|
||||
this.isselect = true
|
||||
},
|
||||
// 重置查询
|
||||
resetHandle() {
|
||||
this.searhForm.name = ''
|
||||
this.searhForm.category = ''
|
||||
this.tableData.page = 0
|
||||
this.tableData.size = 30
|
||||
this.tableData.list = []
|
||||
this.getTableData()
|
||||
},
|
||||
// 分页大小改变
|
||||
sizeChange(e) {
|
||||
this.tableData.size = e
|
||||
this.getTableData()
|
||||
},
|
||||
// 分页回调
|
||||
paginationChange(e) {
|
||||
this.tableData.page = e - 1
|
||||
this.getTableData()
|
||||
},
|
||||
// 商品列表
|
||||
async getTableData() {
|
||||
this.tableData.loading = true
|
||||
try {
|
||||
const res = await tbProductlist({
|
||||
page: this.tableData.page,
|
||||
size: this.tableData.size,
|
||||
name: this.searhForm.name,
|
||||
categoryId: this.searhForm.category,
|
||||
shopId: localStorage.getItem('shopId'),
|
||||
sort: 'id',
|
||||
})
|
||||
this.tableData.list = res.content.map(v=>{
|
||||
// const hasChildren=v.typeEnum == '多规格' && v.isDistribute == 0
|
||||
const hasChildren=true
|
||||
return{...v,hasChildren}
|
||||
})
|
||||
this.tableData.total = res.totalElements
|
||||
|
||||
if (this.goods.length) {
|
||||
this.$nextTick(() => {
|
||||
this.selection()
|
||||
})
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.tableData.loading = false
|
||||
}, 500);
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
},
|
||||
// 商品分类
|
||||
async tbShopCategoryGet() {
|
||||
try {
|
||||
const res = await tbShopCategoryGet({
|
||||
page: 0,
|
||||
size: 100,
|
||||
sort: 'id',
|
||||
shopId: localStorage.getItem('shopId')
|
||||
})
|
||||
this.categoryList = res.content
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
},
|
||||
show(goods) {
|
||||
this.dialogVisible = true
|
||||
if (goods && goods.length) {
|
||||
this.goods = goods
|
||||
} else {
|
||||
this.goods = []
|
||||
}
|
||||
this.resetHandle()
|
||||
this.tbShopCategoryGet()
|
||||
this.getTableData()
|
||||
},
|
||||
close() {
|
||||
this.dialogVisible = false
|
||||
},
|
||||
selection() {
|
||||
this.goods.forEach(row => {
|
||||
this.tableData.list.forEach((item, index) => {
|
||||
if (row.id == item.id) {
|
||||
this.$refs.table.toggleRowSelection(this.tableData.list[index]);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.shop_info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
span {
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,621 @@
|
|||
<!-- eslint-disable no-empty -->
|
||||
<template>
|
||||
<div class="">
|
||||
<el-dialog title="耗材信息" width="60vw" :visible.sync="informationdialogshow" @close="resetHaocaiTable">
|
||||
<div class="head-container flex">
|
||||
<el-input
|
||||
v-model="queryinformation.conTypeId"
|
||||
size="small"
|
||||
clearable
|
||||
placeholder="请输入类型id"
|
||||
style="width: 100%"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="getTableDatainformation"
|
||||
/>
|
||||
<el-input
|
||||
v-model="queryinformation.conTypeName"
|
||||
size="small"
|
||||
clearable
|
||||
placeholder="请输入类型名称"
|
||||
style="width: 100%"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="getTableDatainformation"
|
||||
/>
|
||||
<el-input
|
||||
v-model="queryinformation.conCode"
|
||||
size="small"
|
||||
clearable
|
||||
placeholder="请输入耗材代码"
|
||||
style="width: 100%"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="getTableDatainformation"
|
||||
/>
|
||||
<el-input
|
||||
v-model="queryinformation.conName"
|
||||
size="small"
|
||||
clearable
|
||||
placeholder="请输入耗材名称"
|
||||
style="width: 100%"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="getTableDatainformation"
|
||||
/>
|
||||
<div style="display: flex; justify-content: flex-end;margin-left: 10px">
|
||||
<el-button
|
||||
style="margin-right: 10px"
|
||||
type="primary"
|
||||
@click="getTableDatainformation"
|
||||
>查询</el-button
|
||||
>
|
||||
<el-button @click="resetHandleinformation">重置</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<el-table
|
||||
ref="haocaiTable"
|
||||
:data="tableDatainformation.data"
|
||||
v-loading="tableDatainformation.loading"
|
||||
@selection-change="haocaiSelectedChange"
|
||||
row-key="id"
|
||||
>
|
||||
<el-table-column
|
||||
type="selection"
|
||||
width="55"
|
||||
align="center"
|
||||
></el-table-column>
|
||||
<el-table-column prop="id" label="ID" width="50px" />
|
||||
<el-table-column label="耗材名称" prop="conName" />
|
||||
<el-table-column label="耗材代码" prop="conCode" />
|
||||
<el-table-column label="类型名称" prop="conTypeName" />
|
||||
<el-table-column label="单位" prop="conUnit" />
|
||||
<el-table-column label="库存数量" prop="stockNumber">
|
||||
<template v-slot="scope">
|
||||
{{ (scope.row.stockNumber - scope.row.stockConsume).toFixed(2) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- <el-table-column label="单位耗材值" prop="surplusStock" /> -->
|
||||
<el-table-column label="" width="200">
|
||||
<template v-slot="scope">
|
||||
<el-button @click="tableDatainformationtable(scope.row)"
|
||||
>确定</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="head-container">
|
||||
<el-pagination
|
||||
:total="tableDatainformation.total"
|
||||
:current-page="tableDatainformation.page + 1"
|
||||
:page-size="tableDatainformation.size"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@current-change="paginationChangeinformation"
|
||||
@size-change="
|
||||
(e) => {
|
||||
tableDatainformation.size = e;
|
||||
tableDatainformation.page = 0;
|
||||
getTableDatainformation();
|
||||
}
|
||||
"
|
||||
/>
|
||||
<div style="display: flex; justify-content: flex-end">
|
||||
<el-button
|
||||
style="margin-right: 20px"
|
||||
@click="haocaiCancel"
|
||||
>取消</el-button
|
||||
>
|
||||
<el-button type="primary" @click="haocaiConfirm">确定</el-button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Sortable from "sortablejs";
|
||||
import dayjs from "dayjs";
|
||||
import { upProSort, tbProduct } from "@/api/shop";
|
||||
import {
|
||||
getviewConSku,
|
||||
gettbProductSpec,
|
||||
gettbConsInfo,
|
||||
posttbProskuCons,
|
||||
puttbProskuCon,
|
||||
deletetbProskuCon,
|
||||
} from "@/api/consumable";
|
||||
//缓存耗材选中的数据
|
||||
let haocaiSelectedMap = {};
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
dayjs,
|
||||
query: {
|
||||
conName: "",
|
||||
specSnap: "",
|
||||
name: "",
|
||||
status: "",
|
||||
},
|
||||
surplusStocks: "",
|
||||
typeEnums: [
|
||||
{
|
||||
label: "正常",
|
||||
value: "1",
|
||||
},
|
||||
{
|
||||
label: "禁用",
|
||||
value: "0",
|
||||
},
|
||||
],
|
||||
dialogshow: false, //弹框显示
|
||||
dialogtitle: "", //文字显示
|
||||
informationdialogshow: false,
|
||||
informationdialogshowedit: false,
|
||||
tableData: {
|
||||
data: [],
|
||||
page: 0,
|
||||
size: 30,
|
||||
loading: false,
|
||||
total: 0,
|
||||
},
|
||||
queryinformation: {
|
||||
conTypeId: "",
|
||||
conTypeName: "",
|
||||
conCode: "",
|
||||
conName: "",
|
||||
},
|
||||
tableDatainformation: {
|
||||
data: [],
|
||||
page: 0,
|
||||
size: 10,
|
||||
loading: false,
|
||||
total: 0,
|
||||
},
|
||||
tableDataskudialogshow: false,
|
||||
querytableDatasku: {
|
||||
specSnap: "",
|
||||
name: "",
|
||||
shopName: "",
|
||||
},
|
||||
tableDatasku: {
|
||||
data: [],
|
||||
page: 0,
|
||||
size: 30,
|
||||
loading: false,
|
||||
total: 0,
|
||||
},
|
||||
rules: {},
|
||||
// 动态新增选择框-所有数据
|
||||
addSelect: [],
|
||||
// 筛选集合
|
||||
commodityArr: [],
|
||||
// 选择耗材的index
|
||||
ALLisDistribute: null,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getTableDatainformation();
|
||||
},
|
||||
methods: {
|
||||
open(){
|
||||
this.informationdialogshow=true
|
||||
},
|
||||
close(){
|
||||
this.informationdialogshow=false
|
||||
},
|
||||
resetCommodityArr(){
|
||||
this.commodityArr=[]
|
||||
this.$refs.addSelect.resetFields();
|
||||
},
|
||||
resetHaocaiTable(){
|
||||
console.log('close')
|
||||
haocaiSelectedMap={}
|
||||
console.log(haocaiSelectedMap)
|
||||
this.$refs.haocaiTable.clearSelection()
|
||||
},
|
||||
delGoodsHaocai(haocais,haocaiIndex){
|
||||
if(haocais.length===1){
|
||||
return
|
||||
}
|
||||
haocais.splice(haocaiIndex,1)
|
||||
},
|
||||
//初始化耗材表单选中状态
|
||||
initTableSelected(){
|
||||
for(let i in haocaiSelectedMap){
|
||||
const index=this.tableDatainformation.data.findIndex(v=>v.id==i)
|
||||
if(index!=-1&&haocaiSelectedMap[i]){
|
||||
//删除缓存里的id
|
||||
delete haocaiSelectedMap[i]
|
||||
requestAnimationFrame(()=>{
|
||||
this.$refs.haocaiTable.toggleRowSelection(this.tableDatainformation.data[index],haocaiSelectedMap[i])
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
haocaiCancel(){
|
||||
this.informationdialogshow = false
|
||||
},
|
||||
haocaiConfirm(){
|
||||
console.log(haocaiSelectedMap)
|
||||
|
||||
this.$emit('confirm',haocaiSelectedMap)
|
||||
this.informationdialogshow = false;
|
||||
return
|
||||
this.commodityArr.forEach((ele) => {
|
||||
if (ele.id == this.ALLisDistribute.id) {
|
||||
ele.haocais=[]
|
||||
let index=-1;
|
||||
for(let key in haocaiSelectedMap){
|
||||
const item=haocaiSelectedMap[key]
|
||||
console.log(item)
|
||||
index++
|
||||
this.$set(ele.haocais,index,{
|
||||
consInfoId:item.id,
|
||||
conInfoId:item.id,
|
||||
conName:item.conName,
|
||||
skuId:ele.id,
|
||||
shopId:ele.shopId,
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
this.informationdialogshow = false;
|
||||
},
|
||||
haocaiSelectedChange(e) {
|
||||
const arr = e.filter((v) => v);
|
||||
console.log(arr);
|
||||
for(let item of this.tableDatainformation.data){
|
||||
//判断缓存队列是否有这个id
|
||||
const hasCacheIncludes=haocaiSelectedMap.hasOwnProperty(item.id)
|
||||
//判断当前选中队列里是否有这个id
|
||||
const hasSelectedIncludes=arr.find(v=>v.id==item.id)
|
||||
if(hasSelectedIncludes){
|
||||
haocaiSelectedMap[item.id] = hasSelectedIncludes;
|
||||
}
|
||||
if(hasCacheIncludes&&!hasSelectedIncludes){
|
||||
delete haocaiSelectedMap[item.id];
|
||||
|
||||
}
|
||||
}
|
||||
console.log(haocaiSelectedMap);
|
||||
},
|
||||
limitInput(value, name) {
|
||||
this.surplusStocks.surplusStock =
|
||||
("" + value) // 第一步:转成字符串
|
||||
// .replace(/[^\d^\.]+/g, '') // 第二步:把不是数字,不是小数点的过滤掉
|
||||
|
||||
.replace(/^0+(\d)/, "$1") // 第三步:第一位0开头,0后面为数字,则过滤掉,取后面的数字
|
||||
|
||||
.replace(/^\./, "0.") // 第四步:如果输入的第一位为小数点,则替换成 0. 实现自动补全
|
||||
|
||||
.match(/^\d*(\.?\d{0,2})/g)[0] || "";
|
||||
},
|
||||
handleKeyUp(value, index) {
|
||||
console.log(value, index, "体哦傲视1");
|
||||
if (value < 0) {
|
||||
this.commodityArr[index].surplusStock = value * -1;
|
||||
}
|
||||
},
|
||||
selectShop(res) {
|
||||
console.log(res)
|
||||
this.$refs.bindHaocai.open(res)
|
||||
return
|
||||
this.commodityArr = [];
|
||||
const haocais= {conName:'',surplusStock:""};
|
||||
const arr=res.map(v=>{
|
||||
return{...v,haocais:v.skuList.map(sku=>{
|
||||
return{...sku,conName:sku.conName||'',surplusStock:sku.surplusStock||''}
|
||||
})}
|
||||
})
|
||||
this.addSelect = res.map(v=>{
|
||||
return {...v,haocais:[{...haocais}]}
|
||||
})
|
||||
this.commodityArr=arr
|
||||
|
||||
this.clickdialogframe("add");
|
||||
|
||||
return
|
||||
res.forEach((ele, i) => {
|
||||
// isDistribute1为共享库存-商品,0不共享是多规格
|
||||
// 判断是否共享拆分数据到商品和规格集合里
|
||||
|
||||
let sname = ele.name;
|
||||
if (ele.isDistribute == 1) {
|
||||
console.log('单规格')
|
||||
ele.specSnap = ele.name;
|
||||
ele.conName = ele.conName;
|
||||
this.commodityArr.push({...ele,haocais:[{...haocais}]});
|
||||
ele.names = sname;
|
||||
} else {
|
||||
// 规格数据处理
|
||||
console.log('多规格')
|
||||
ele.skuList.forEach((element, indexs) => {
|
||||
if (indexs == 0) {
|
||||
element.names = sname;
|
||||
}
|
||||
element.conInfoId = element.id;
|
||||
element.conName = element.conName;
|
||||
if (element.specSnap == null) {
|
||||
element.specSnap = sname;
|
||||
}
|
||||
this.commodityArr.push({...element,haocais:[{...haocais}]});
|
||||
});
|
||||
}
|
||||
});
|
||||
this.clickdialogframe("add");
|
||||
},
|
||||
// 选择耗材
|
||||
selecthaocai(item) {
|
||||
|
||||
this.ALLisDistribute = item;
|
||||
this.commodityArr.forEach((ele) => {
|
||||
if (ele.id == this.ALLisDistribute.id) {
|
||||
console.log(ele.haocais)
|
||||
ele.haocais.map(v=>{
|
||||
if(v.conInfoId){
|
||||
haocaiSelectedMap[v.conInfoId]=v
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
this.initTableSelected()
|
||||
this.informationdialogshow = true;
|
||||
|
||||
},
|
||||
//表格拖拽
|
||||
tableDrag() {
|
||||
const el = document.querySelector(
|
||||
"#table_drag .el-table__body-wrapper tbody"
|
||||
);
|
||||
new Sortable(el, {
|
||||
animation: 150,
|
||||
onEnd: async (e) => {
|
||||
// console.log('拖拽结束===', e);
|
||||
if (e.oldIndex == e.newIndex) return;
|
||||
let oid = this.tableData.data[e.oldIndex].id;
|
||||
let nid = this.tableData.data[e.newIndex].id;
|
||||
let ids = this.tableData.data.map((item) => item.id);
|
||||
try {
|
||||
await upProSort({
|
||||
strId: oid,
|
||||
endId: nid,
|
||||
ids: ids,
|
||||
});
|
||||
await this.getTableData();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
// 重置查询
|
||||
resetHandle() {
|
||||
this.query.conName = "";
|
||||
this.query.specSnap = "";
|
||||
this.query.name = "";
|
||||
this.query.status = "";
|
||||
this.tableData.page = 0;
|
||||
this.getTableData();
|
||||
},
|
||||
resetHandlesku() {
|
||||
this.querytableDatasku.specSnap = "";
|
||||
this.querytableDatasku.name = "";
|
||||
this.querytableDatasku.shopName = "";
|
||||
this.tableDatasku.page = 0;
|
||||
this.getTableDatasku();
|
||||
},
|
||||
resetHandleinformation() {
|
||||
this.queryinformation.conTypeId = "";
|
||||
this.queryinformation.conTypeName = "";
|
||||
this.queryinformation.conCode = "";
|
||||
this.queryinformation.conName = "";
|
||||
this.tableDatainformation.page = 0;
|
||||
this.getTableDatainformation();
|
||||
},
|
||||
// 分页回调
|
||||
paginationChange(e) {
|
||||
this.tableData.page = e - 1;
|
||||
this.getTableData();
|
||||
},
|
||||
// 获取商品列表
|
||||
async getTableData() {
|
||||
this.tableData.loading = true;
|
||||
try {
|
||||
const res = await getviewConSku({
|
||||
page: this.tableData.page,
|
||||
size: this.tableData.size,
|
||||
conName: this.query.conName,
|
||||
specSnap: this.query.specSnap,
|
||||
name: this.query.name,
|
||||
status: this.query.status,
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
});
|
||||
this.tableData.loading = false;
|
||||
this.tableData.data = res.content;
|
||||
this.tableData.total = res.totalElements;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
paginationChangeinformation(e) {
|
||||
this.tableDatainformation.page = e - 1;
|
||||
this.getTableDatainformation();
|
||||
},
|
||||
// 获取信息管理
|
||||
async getTableDatainformation() {
|
||||
this.tableDatainformation.loading = true;
|
||||
try {
|
||||
const res = await gettbConsInfo({
|
||||
page: this.tableDatainformation.page,
|
||||
size: this.tableDatainformation.size,
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
conTypeId: this.queryinformation.conTypeId,
|
||||
conTypeName: this.queryinformation.conTypeName,
|
||||
conCode: this.queryinformation.conCode,
|
||||
conName: this.queryinformation.conName,
|
||||
});
|
||||
this.tableDatainformation.loading = false;
|
||||
this.tableDatainformation.data = res.content;
|
||||
this.tableDatainformation.total = res.totalElements;
|
||||
this.initTableSelected()
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
// 耗材信息的信息
|
||||
tableDatainformationtable(item) {
|
||||
this.commodityArr.forEach((ele) => {
|
||||
|
||||
if (ele.id == this.ALLisDistribute.id) {
|
||||
console.log(ele.haocais)
|
||||
ele.haocais[0].consInfoId = item.id;
|
||||
ele.haocais[0].conInfoId = item.id;
|
||||
ele.haocais[0].conName = item.conName;
|
||||
ele.haocais[0].skuId = ele.id;
|
||||
ele.haocais[0].shopId = ele.shopId;
|
||||
|
||||
}
|
||||
});
|
||||
this.informationdialogshow = false;
|
||||
},
|
||||
// 获取商品规格
|
||||
async getTableDatasku() {
|
||||
this.tableDatasku.loading = true;
|
||||
try {
|
||||
const res = await tbProduct({
|
||||
page: this.tableDatasku.page,
|
||||
size: this.tableDatasku.size,
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
specSnap: this.querytableDatasku.specSnap,
|
||||
name: this.querytableDatasku.name,
|
||||
sort: "id.desc",
|
||||
shopName: this.querytableDatasku.shopName,
|
||||
});
|
||||
this.tableDatasku.loading = false;
|
||||
this.tableDatasku.data = res.content;
|
||||
this.tableDatasku.total = res.totalElements;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
Changeinformationsku(e) {
|
||||
this.tableDatasku.page = e - 1;
|
||||
this.getTableDatasku();
|
||||
},
|
||||
// 弹框修改值 添加 编辑
|
||||
clickdialogframe(type, item) {
|
||||
if (type == "add") {
|
||||
// 添加
|
||||
this.dialogtitle = "添加";
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addSelect.resetFields();
|
||||
});
|
||||
this.dialogshow = true;
|
||||
} else {
|
||||
this.informationdialogshowedit = true;
|
||||
this.dialogtitle = "编辑";
|
||||
this.surplusStocks = item;
|
||||
}
|
||||
},
|
||||
async submitForm(formName) {
|
||||
if (this.dialogtitle == "编辑") {
|
||||
let { id, surplusStock } = this.surplusStocks;
|
||||
await puttbProskuCon({
|
||||
id,
|
||||
surplusStock,
|
||||
});
|
||||
this.$message({
|
||||
message: "修改成功",
|
||||
type: "success",
|
||||
});
|
||||
this.informationdialogshowedit = false;
|
||||
} else {
|
||||
// isDistribute1为共享库存-商品,0不共享是多规格
|
||||
let isgongx = false;
|
||||
this.commodityArr.forEach((ele) => {
|
||||
ele.haocais.forEach(v=>{
|
||||
if (!v.skuId || !v.surplusStock) {
|
||||
isgongx = true;
|
||||
}
|
||||
})
|
||||
});
|
||||
if (isgongx) {
|
||||
this.$message.error("请选择耗材信息与输入耗材值");
|
||||
isgongx = false;
|
||||
return;
|
||||
}
|
||||
|
||||
this.commodityArr.forEach((ele) => {
|
||||
// ele.skuInfos = ele.skuList;
|
||||
console.log(ele)
|
||||
ele.skuInfos = ele.haocais;
|
||||
ele.productId = ele.id; //商品id
|
||||
});
|
||||
await posttbProskuCons(this.commodityArr);
|
||||
|
||||
// this.addSelect.forEach((ele) => {
|
||||
// // ele.skuInfos = ele.skuList;
|
||||
// console.log(ele)
|
||||
// ele.skuInfos = ele.haocais;
|
||||
// ele.productId = ele.id; //商品id
|
||||
// });
|
||||
// await posttbProskuCons(this.addSelect);
|
||||
this.$message({
|
||||
message: "新增成功",
|
||||
type: "success",
|
||||
});
|
||||
this.ALLisDistribute = null;
|
||||
this.dialogshow = false;
|
||||
}
|
||||
this.$refs[formName].resetFields();
|
||||
this.getTableData();
|
||||
},
|
||||
resetForm(formName) {
|
||||
this.$refs[formName].resetFields();
|
||||
},
|
||||
// 删除商品
|
||||
async delTableHandle(ids) {
|
||||
try {
|
||||
await deletetbProskuCon(ids);
|
||||
this.getTableData();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.flex{
|
||||
display: flex;
|
||||
align-content: center;
|
||||
}
|
||||
.handle {
|
||||
font-size: 18px;
|
||||
color: #999;
|
||||
|
||||
&:hover {
|
||||
cursor: grab;
|
||||
}
|
||||
}
|
||||
|
||||
.shop_info {
|
||||
display: flex;
|
||||
|
||||
.info {
|
||||
flex: 1;
|
||||
padding-left: 8px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.tag_wrap {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
}
|
||||
.head-container .filter-item{
|
||||
margin: 0 5px 0 0;;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,105 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-dialog width="60%" :visible.sync="dialogVisible" :title="query.conName">
|
||||
<div class="app-container">
|
||||
<!-- <div class="head-container">
|
||||
<el-form :model="query" inline>
|
||||
<el-form-item>
|
||||
<el-input v-model="query.conName" placeholder="耗材信息名称" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="getTableData">查询</el-button>
|
||||
<el-button @click="resetHandle">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div> -->
|
||||
<div class="head-container">
|
||||
<el-table
|
||||
ref="table"
|
||||
:data="clickseetableData.data"
|
||||
v-loading="clickseetableData.loading"
|
||||
row-key="id"
|
||||
height="50vh"
|
||||
>
|
||||
<el-table-column label="耗材名称" prop="conName" />
|
||||
<el-table-column label="变动库存" prop="amount">
|
||||
<template v-slot="scope">
|
||||
<span :class="{ red: scope.row.bizType == '-' }"
|
||||
>{{ scope.row.bizType }}{{ scope.row.amount }}</span
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="现有库存" prop="balance" />
|
||||
<el-table-column label="业务说明" prop="bizName" />
|
||||
<el-table-column label="商品名称" prop="productName" />
|
||||
<el-table-column label="订单编号" >
|
||||
<template v-slot="scope">
|
||||
<a class="cursor-pointer" @click="toOrderList(scope.row)">{{ scope.row.orderNo||'' }}</a>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
prop="createTime"
|
||||
></el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
query: {
|
||||
conName: "",
|
||||
consId:''
|
||||
},
|
||||
dialogVisible:false,
|
||||
clickseetableData: {
|
||||
data: [],
|
||||
page: 0,
|
||||
size: 10,
|
||||
loading: false,
|
||||
total: 0,
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
open(data){
|
||||
console.log(data)
|
||||
this.dialogVisible = true;
|
||||
this.clickseetableData=data
|
||||
},
|
||||
close(){
|
||||
this.dialogVisible = false;
|
||||
},
|
||||
lookDetail(row) {
|
||||
console.log(row);
|
||||
},
|
||||
resetHandle() {
|
||||
},
|
||||
pageSizeChange(e) {
|
||||
},
|
||||
paginationChangetype(e) {
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.cursor-pointer{
|
||||
cursor: pointer;
|
||||
color: #1890ff;
|
||||
transition: all 0.3s;
|
||||
}
|
||||
.cursor-pointer:hover{
|
||||
opacity: .7;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
@ -140,7 +140,12 @@
|
|||
"
|
||||
/>
|
||||
</div>
|
||||
<el-dialog :title="dialogtitle" :visible.sync="dialogshow" width="1000px" >
|
||||
<el-dialog
|
||||
:title="dialogtitle"
|
||||
:visible.sync="dialogshow"
|
||||
width="1000px"
|
||||
@close="resetCommodityArr"
|
||||
>
|
||||
<el-form ref="addSelect" :inline="true">
|
||||
<!-- <el-form-item label="商品名称" v-for="(ele, index) in addSelect">
|
||||
<template >
|
||||
|
|
@ -148,59 +153,158 @@
|
|||
</template>
|
||||
</el-form-item> -->
|
||||
<template>
|
||||
<div v-for="(ele, index) in commodityArr" :key="ele.id">
|
||||
<template v-if="ele.names">
|
||||
<div>
|
||||
<el-form-item label="商品名称">
|
||||
{{ ele.names }}
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div>
|
||||
<el-form-item label="商品规格">
|
||||
<el-input
|
||||
v-model="ele.specSnap"
|
||||
style="width: 130px"
|
||||
placeholder="请选择商品规格"
|
||||
disabled
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div v-for="(haocai,haocaiIndex) in ele.haocais" :key="haocaiIndex">
|
||||
|
||||
<el-form-item label="耗材信息" prop="conName">
|
||||
<el-input
|
||||
v-model="haocai.conName"
|
||||
style="width: 130px"
|
||||
placeholder="请选择耗材信息"
|
||||
disabled
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="selecthaocai(ele)"
|
||||
>去选择耗材信息</el-button
|
||||
<el-table :span-method="objectSpanMethod" :data="commodityArr">
|
||||
<el-table-column prop="name" label="商品名称"> </el-table-column>
|
||||
<el-table-column label="规格">
|
||||
<template v-slot="scope">
|
||||
<!-- 多规格 -->
|
||||
<template
|
||||
v-if="
|
||||
scope.row.typeEnum == '多规格' &&
|
||||
scope.row.isDistribute == 0
|
||||
"
|
||||
>
|
||||
{{ scope.row.specSnap }}
|
||||
</template>
|
||||
<!-- 单规格 -->
|
||||
<div v-else>
|
||||
{{ scope.row.name }}
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="耗材">
|
||||
<el-table-column label="耗材信息">
|
||||
<template v-slot="scope">
|
||||
<div
|
||||
style="margin-bottom: 10px"
|
||||
v-for="(haocai, index) in scope.row.haocais"
|
||||
:key="index"
|
||||
>
|
||||
<el-input
|
||||
disabled
|
||||
v-model="haocai.conName"
|
||||
style="width: 130px"
|
||||
placeholder="请选择耗材信息"
|
||||
|
||||
></el-input>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单位耗材值" width="180">
|
||||
<template v-slot="scope">
|
||||
<div
|
||||
style="margin-bottom: 10px; display: flex"
|
||||
v-for="(haocai, haocaiIndex) in scope.row.haocais"
|
||||
:key="haocaiIndex"
|
||||
>
|
||||
<el-input
|
||||
v-model="haocai.surplusStock"
|
||||
type="number"
|
||||
placeholder="单位耗材值"
|
||||
@input="handleKeyUp($event, haocaiIndex)"
|
||||
></el-input>
|
||||
<div style="margin-left: 10px">
|
||||
<el-button
|
||||
v-if="scope.row.haocais.length > 1"
|
||||
type="danger"
|
||||
size="mini"
|
||||
@click="delGoodsHaocai(scope.row.haocais, haocaiIndex)"
|
||||
icon="el-icon-delete"
|
||||
circle
|
||||
></el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<template v-slot="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="primary"
|
||||
@click="selecthaocai(scope.row)"
|
||||
>去选择耗材信息</el-button
|
||||
>
|
||||
<!-- <el-button type="primary" @click="addGoodsHaocai(scope.row.haocais, haocaiIndex)">
|
||||
增加耗材
|
||||
</el-button> -->
|
||||
</template>
|
||||
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="操作">
|
||||
<template v-slot="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="primary"
|
||||
@click="selecthaocai(scope.row)"
|
||||
>去选择耗材信息</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
</el-table>
|
||||
|
||||
<!-- <div v-for="(ele, index) in commodityArr" :key="ele.id">
|
||||
<template>
|
||||
<div>
|
||||
<el-form-item label="商品名称">
|
||||
{{ ele.names }}
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div>
|
||||
<el-form-item label="商品规格">
|
||||
<el-input
|
||||
v-model="ele.specSnap"
|
||||
style="width: 130px"
|
||||
placeholder="请选择商品规格"
|
||||
disabled
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div
|
||||
v-for="(haocai, haocaiIndex) in ele.haocais"
|
||||
:key="haocaiIndex"
|
||||
>
|
||||
</el-form-item>
|
||||
<el-form-item label="单位耗材值">
|
||||
<el-input
|
||||
v-model="haocai.surplusStock"
|
||||
type="number"
|
||||
placeholder="请输入单位耗材值"
|
||||
@input="handleKeyUp($event, index)"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="耗材信息" prop="conName">
|
||||
<el-input
|
||||
v-model="haocai.conName"
|
||||
style="width: 130px"
|
||||
placeholder="请选择耗材信息"
|
||||
disabled
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="selecthaocai(ele)"
|
||||
>去选择耗材信息</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
<el-form-item label="单位耗材值">
|
||||
<el-input
|
||||
v-model="haocai.surplusStock"
|
||||
type="number"
|
||||
placeholder="请输入单位耗材值"
|
||||
@input="handleKeyUp($event, index)"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label=" " v-if="haocaiIndex>=1">
|
||||
<el-button type="danger" @click="delGoodsHaocai(ele.haocais,haocaiIndex)" icon="el-icon-delete" circle></el-button>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<el-form-item label=" " v-if="haocaiIndex >= 1">
|
||||
<el-button
|
||||
type="danger"
|
||||
@click="delGoodsHaocai(ele.haocais, haocaiIndex)"
|
||||
icon="el-icon-delete"
|
||||
circle
|
||||
></el-button>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
|
||||
</div> -->
|
||||
</template>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<el-form-item style="display: flex; justify-content: flex-end">
|
||||
<el-form-item
|
||||
style="display: flex; margin-top: 20px; justify-content: flex-end"
|
||||
>
|
||||
<el-button @click="dialogshow = false">取 消</el-button>
|
||||
<el-button type="primary" @click="submitForm('addSelect')"
|
||||
>确 定</el-button
|
||||
|
|
@ -209,7 +313,11 @@
|
|||
</el-form>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="耗材信息" :visible.sync="informationdialogshow" @close="resetHaocaiTable">
|
||||
<el-dialog
|
||||
title="耗材信息"
|
||||
:visible.sync="informationdialogshow"
|
||||
@close="resetHaocaiTable"
|
||||
>
|
||||
<div class="head-container">
|
||||
<el-input
|
||||
v-model="queryinformation.conTypeId"
|
||||
|
|
@ -305,14 +413,11 @@
|
|||
"
|
||||
/>
|
||||
<div style="display: flex; justify-content: flex-end">
|
||||
<el-button
|
||||
style="margin-right: 20px"
|
||||
@click="haocaiCancel"
|
||||
<el-button style="margin-right: 20px" @click="haocaiCancel"
|
||||
>取消</el-button
|
||||
>
|
||||
<el-button type="primary" @click="haocaiConfirm">确定</el-button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</el-dialog>
|
||||
<el-dialog
|
||||
|
|
@ -340,6 +445,8 @@
|
|||
</el-form>
|
||||
</el-dialog>
|
||||
<shopList ref="shopList" @success="selectShop" />
|
||||
|
||||
<bind-haocai ref="bindHaocai"></bind-haocai>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
@ -347,6 +454,7 @@
|
|||
import Sortable from "sortablejs";
|
||||
import dayjs from "dayjs";
|
||||
import shopList from "../components/shopList";
|
||||
import bindHaocai from "./components/specifications_bind_supplies";
|
||||
import { upProSort, tbProduct } from "@/api/shop";
|
||||
import {
|
||||
getviewConSku,
|
||||
|
|
@ -358,8 +466,10 @@ import {
|
|||
} from "@/api/consumable";
|
||||
//缓存耗材选中的数据
|
||||
let haocaiSelectedMap = {};
|
||||
//耗材基础数据
|
||||
const haocaisBasic = { conName: "", surplusStock: "" };
|
||||
export default {
|
||||
components: { shopList },
|
||||
components: { shopList, bindHaocai },
|
||||
data() {
|
||||
return {
|
||||
dayjs,
|
||||
|
|
@ -436,71 +546,99 @@ export default {
|
|||
});
|
||||
},
|
||||
methods: {
|
||||
resetHaocaiTable(){
|
||||
console.log('close')
|
||||
haocaiSelectedMap={}
|
||||
console.log(haocaiSelectedMap)
|
||||
this.$refs.haocaiTable.clearSelection()
|
||||
},
|
||||
delGoodsHaocai(haocais,haocaiIndex){
|
||||
if(haocais.length===1){
|
||||
return
|
||||
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
|
||||
if (columnIndex === 0) {
|
||||
let index = this.commodityArr.findIndex((v) => v.id === row.id);
|
||||
const arr = this.commodityArr.filter((v) => v.id === row.id);
|
||||
if (rowIndex === index) {
|
||||
return { rowspan: arr.length, colspan: 1 };
|
||||
} else {
|
||||
return { rowspan: 0, colspan: 0 };
|
||||
}
|
||||
}
|
||||
haocais.splice(haocaiIndex,1)
|
||||
},
|
||||
resetCommodityArr() {
|
||||
this.commodityArr = [];
|
||||
this.$refs.addSelect.resetFields();
|
||||
},
|
||||
resetHaocaiTable() {
|
||||
console.log("close");
|
||||
haocaiSelectedMap = {};
|
||||
console.log(haocaiSelectedMap);
|
||||
this.$refs.haocaiTable.clearSelection();
|
||||
},
|
||||
delGoodsHaocai(haocais, haocaiIndex) {
|
||||
if (haocais.length === 1) {
|
||||
return;
|
||||
}
|
||||
haocais.splice(haocaiIndex, 1);
|
||||
},
|
||||
addGoodsHaocai(haocais, haocaiIndex) {
|
||||
haocais.push({...haocaisBasic});
|
||||
},
|
||||
//初始化耗材表单选中状态
|
||||
initTableSelected(){
|
||||
for(let i in haocaiSelectedMap){
|
||||
const index=this.tableDatainformation.data.findIndex(v=>v.id==i)
|
||||
if(index!=-1&&haocaiSelectedMap[i]){
|
||||
//删除缓存里的id
|
||||
delete haocaiSelectedMap[i]
|
||||
requestAnimationFrame(()=>{
|
||||
this.$refs.haocaiTable.toggleRowSelection(this.tableDatainformation.data[index],haocaiSelectedMap[i])
|
||||
})
|
||||
}
|
||||
initTableSelected() {
|
||||
for (let i in haocaiSelectedMap) {
|
||||
const index = this.tableDatainformation.data.findIndex(
|
||||
(v) => v.id == i
|
||||
);
|
||||
if (index != -1 && haocaiSelectedMap[i]) {
|
||||
//删除缓存里的id
|
||||
delete haocaiSelectedMap[i];
|
||||
this.$nextTick(() => {
|
||||
this.$refs.haocaiTable.toggleRowSelection(
|
||||
this.tableDatainformation.data[index],
|
||||
haocaiSelectedMap[i]
|
||||
);
|
||||
});
|
||||
// requestAnimationFrame(() => {
|
||||
// this.$refs.haocaiTable.toggleRowSelection(
|
||||
// this.tableDatainformation.data[index],
|
||||
// haocaiSelectedMap[i]
|
||||
// );
|
||||
// });
|
||||
}
|
||||
}
|
||||
},
|
||||
haocaiCancel(){
|
||||
this.informationdialogshow = false
|
||||
haocaiCancel() {
|
||||
this.informationdialogshow = false;
|
||||
},
|
||||
haocaiConfirm(){
|
||||
haocaiConfirm() {
|
||||
if(JSON.stringify(haocaiSelectedMap)!=='{}' ){
|
||||
this.commodityArr.forEach((ele) => {
|
||||
if (ele.id == this.ALLisDistribute.id) {
|
||||
ele.haocais=[]
|
||||
let index=-1;
|
||||
for(let key in haocaiSelectedMap){
|
||||
const item=haocaiSelectedMap[key]
|
||||
console.log(item)
|
||||
index++
|
||||
this.$set(ele.haocais,index,{
|
||||
consInfoId:item.id,
|
||||
conInfoId:item.id,
|
||||
conName:item.conName,
|
||||
skuId:ele.id,
|
||||
shopId:ele.shopId,
|
||||
})
|
||||
if (ele.skuId == this.ALLisDistribute.skuId) {
|
||||
ele.haocais = [];
|
||||
let index = -1;
|
||||
for (let key in haocaiSelectedMap) {
|
||||
const item = haocaiSelectedMap[key];
|
||||
index++;
|
||||
this.$set(ele.haocais, index, {
|
||||
consInfoId: item.id,
|
||||
conInfoId: item.id,
|
||||
conName: item.conName,
|
||||
skuId: ele.skuId,
|
||||
shopId: ele.shopId,
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
this.informationdialogshow = false;
|
||||
},
|
||||
haocaiSelectedChange(e) {
|
||||
const arr = e.filter((v) => v);
|
||||
console.log(arr);
|
||||
for(let item of this.tableDatainformation.data){
|
||||
for (let item of this.tableDatainformation.data) {
|
||||
//判断缓存队列是否有这个id
|
||||
const hasCacheIncludes=haocaiSelectedMap.hasOwnProperty(item.id)
|
||||
const hasCacheIncludes = haocaiSelectedMap.hasOwnProperty(item.id);
|
||||
//判断当前选中队列里是否有这个id
|
||||
const hasSelectedIncludes=arr.find(v=>v.id==item.id)
|
||||
if(hasSelectedIncludes){
|
||||
const hasSelectedIncludes = arr.find((v) => v.id == item.id);
|
||||
if (hasSelectedIncludes) {
|
||||
haocaiSelectedMap[item.id] = hasSelectedIncludes;
|
||||
}
|
||||
if(hasCacheIncludes&&!hasSelectedIncludes){
|
||||
if (hasCacheIncludes && !hasSelectedIncludes) {
|
||||
delete haocaiSelectedMap[item.id];
|
||||
|
||||
}
|
||||
}
|
||||
console.log(haocaiSelectedMap);
|
||||
|
|
@ -523,25 +661,60 @@ export default {
|
|||
}
|
||||
},
|
||||
selectShop(res) {
|
||||
this.commodityArr = [];
|
||||
const haocais= {conName:'',surplusStock:""};
|
||||
const skuArr = [];
|
||||
|
||||
|
||||
this.addSelect = res.map(v=>{
|
||||
return {...v,haocais:[{...haocais}]}
|
||||
})
|
||||
console.log(res, "tiaosjo");
|
||||
res.forEach((ele) => {
|
||||
ele.skuList.forEach((sku) => {
|
||||
skuArr.push({
|
||||
...ele,
|
||||
skuId: sku.id,
|
||||
conName: sku.conName || "",
|
||||
specSnap: sku.specSnap || "",
|
||||
surplusStock: sku.surplusStock || "",
|
||||
haocais: [{ ...haocaisBasic }],
|
||||
});
|
||||
});
|
||||
});
|
||||
this.commodityArr = skuArr;
|
||||
this.clickdialogframe("add");
|
||||
console.log(skuArr);
|
||||
|
||||
return;
|
||||
const arr = res.map((v) => {
|
||||
return {
|
||||
...v,
|
||||
haocais: v.skuList.map((sku) => {
|
||||
return {
|
||||
...sku,
|
||||
conName: sku.conName || "",
|
||||
surplusStock: sku.surplusStock || "",
|
||||
};
|
||||
}),
|
||||
};
|
||||
});
|
||||
this.addSelect = res.map((v) => {
|
||||
return { ...v, haocais: [{ ...haocais }] };
|
||||
});
|
||||
this.commodityArr = arr;
|
||||
|
||||
this.clickdialogframe("add");
|
||||
|
||||
return;
|
||||
res.forEach((ele, i) => {
|
||||
// isDistribute1为共享库存-商品,0不共享是多规格
|
||||
// 判断是否共享拆分数据到商品和规格集合里
|
||||
|
||||
|
||||
let sname = ele.name;
|
||||
if (ele.isDistribute == 1) {
|
||||
console.log("单规格");
|
||||
ele.specSnap = ele.name;
|
||||
ele.conName = ele.conName;
|
||||
this.commodityArr.push({...ele,haocais:[{...haocais}]});
|
||||
this.commodityArr.push({ ...ele, haocais: [{ ...haocais }] });
|
||||
ele.names = sname;
|
||||
} else {
|
||||
// 规格数据处理
|
||||
console.log("多规格");
|
||||
ele.skuList.forEach((element, indexs) => {
|
||||
if (indexs == 0) {
|
||||
element.names = sname;
|
||||
|
|
@ -551,7 +724,7 @@ export default {
|
|||
if (element.specSnap == null) {
|
||||
element.specSnap = sname;
|
||||
}
|
||||
this.commodityArr.push({...element,haocais:[{...haocais}]});
|
||||
this.commodityArr.push({ ...element, haocais: [{ ...haocais }] });
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -559,21 +732,19 @@ export default {
|
|||
},
|
||||
// 选择耗材
|
||||
selecthaocai(item) {
|
||||
|
||||
this.ALLisDistribute = item;
|
||||
this.commodityArr.forEach((ele) => {
|
||||
if (ele.id == this.ALLisDistribute.id) {
|
||||
console.log(ele.haocais)
|
||||
ele.haocais.map(v=>{
|
||||
if(v.conInfoId){
|
||||
haocaiSelectedMap[v.conInfoId]=v
|
||||
console.log(ele.haocais);
|
||||
ele.haocais.map((v) => {
|
||||
if (v.conInfoId) {
|
||||
haocaiSelectedMap[v.conInfoId] = v;
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
});
|
||||
this.initTableSelected()
|
||||
this.initTableSelected();
|
||||
this.informationdialogshow = true;
|
||||
|
||||
},
|
||||
//表格拖拽
|
||||
tableDrag() {
|
||||
|
|
@ -670,24 +841,24 @@ export default {
|
|||
this.tableDatainformation.loading = false;
|
||||
this.tableDatainformation.data = res.content;
|
||||
this.tableDatainformation.total = res.totalElements;
|
||||
this.initTableSelected()
|
||||
|
||||
this.initTableSelected();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
// 耗材信息的信息
|
||||
tableDatainformationtable(item) {
|
||||
haocaiSelectedMap[item.id]=item
|
||||
this.haocaiConfirm()
|
||||
return
|
||||
this.commodityArr.forEach((ele) => {
|
||||
|
||||
if (ele.id == this.ALLisDistribute.id) {
|
||||
console.log(ele.haocais)
|
||||
if (ele.skuId == this.ALLisDistribute.skuId) {
|
||||
console.log(ele.haocais);
|
||||
ele.haocais[0].consInfoId = item.id;
|
||||
ele.haocais[0].conInfoId = item.id;
|
||||
ele.haocais[0].conName = item.conName;
|
||||
ele.haocais[0].skuId = ele.id;
|
||||
ele.haocais[0].skuId = ele.skuId;
|
||||
ele.haocais[0].shopId = ele.shopId;
|
||||
|
||||
}
|
||||
});
|
||||
this.informationdialogshow = false;
|
||||
|
|
@ -747,11 +918,11 @@ export default {
|
|||
// isDistribute1为共享库存-商品,0不共享是多规格
|
||||
let isgongx = false;
|
||||
this.commodityArr.forEach((ele) => {
|
||||
ele.haocais.forEach(v=>{
|
||||
ele.haocais.forEach((v) => {
|
||||
if (!v.skuId || !v.surplusStock) {
|
||||
isgongx = true;
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
if (isgongx) {
|
||||
this.$message.error("请选择耗材信息与输入耗材值");
|
||||
|
|
@ -759,14 +930,20 @@ export default {
|
|||
return;
|
||||
}
|
||||
|
||||
this.commodityArr.forEach((ele) => {
|
||||
// ele.skuInfos = ele.skuList;
|
||||
console.log(ele)
|
||||
ele.skuInfos = ele.haocais;
|
||||
ele.productId = ele.id; //商品id
|
||||
const newArr = this.commodityArr.map((ele) => {
|
||||
return {
|
||||
...ele,
|
||||
consInfoId: ele.consInfoId,
|
||||
productId: ele.id,
|
||||
skuInfos: ele.haocais,
|
||||
surplusStock: ele.surplusStock,
|
||||
status: ele.status,
|
||||
};
|
||||
});
|
||||
await posttbProskuCons(this.commodityArr);
|
||||
|
||||
await posttbProskuCons(newArr);
|
||||
|
||||
// for(let data of newArr){
|
||||
// }
|
||||
// this.addSelect.forEach((ele) => {
|
||||
// // ele.skuInfos = ele.skuList;
|
||||
// console.log(ele)
|
||||
|
|
|
|||
|
|
@ -82,12 +82,19 @@
|
|||
v-if="scope.row.hasChildren || scope.row.hasChildren == false"
|
||||
@change="showChanges($event, scope.row, 'proId', 'distribute')"></el-switch>
|
||||
</template>
|
||||
</el-table-column> <el-table-column label="售罄">
|
||||
</el-table-column>
|
||||
<el-table-column label="售罄">
|
||||
<template v-slot="scope">
|
||||
<el-switch v-model="scope.row.isPauseSale" :active-value="1" :inactive-value="0"
|
||||
@change="showChangess($event, scope.row)"></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="下架">
|
||||
<template v-slot="scope">
|
||||
<el-switch v-model="scope.row.isGrounding" :active-value="true" :inactive-value="false"
|
||||
@change="showChangesss($event, scope.row)"></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="240px">
|
||||
<template v-slot="scope">
|
||||
<el-button type="text" size="mini"
|
||||
|
|
@ -128,7 +135,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { stock, stockdownload, stockdoImport, stockStatewarnLine, stockStateChanges, stocks } from '@/api/invoicing'
|
||||
import { stock, stockdownload, stockdoImport, stockStatewarnLine, stockStateChanges, stocks, stockStateChangess } from '@/api/invoicing'
|
||||
import { tbShopCategoryGet } from '@/api/shop'
|
||||
import settings from '@/settings'
|
||||
import invoicingDetail from './components/invoicingDetail'
|
||||
|
|
@ -280,6 +287,18 @@ export default {
|
|||
}
|
||||
|
||||
},
|
||||
// 下架
|
||||
async showChangesss(e, row) {
|
||||
await stockStateChangess({
|
||||
"isGrounding": row.isGrounding,
|
||||
skuId: row.skuId,
|
||||
shopId: localStorage.getItem('shopId')
|
||||
})
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "修改成功"
|
||||
})
|
||||
},
|
||||
async getTableData() {
|
||||
this.tableData.loading = true
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -10,11 +10,7 @@
|
|||
<el-form-item label="订单状态">
|
||||
<el-radio-group v-model="query.status">
|
||||
<el-radio-button label="">全部</el-radio-button>
|
||||
<el-radio-button
|
||||
:label="item.key"
|
||||
v-for="item in orderEnum.status"
|
||||
:key="item.key"
|
||||
>
|
||||
<el-radio-button :label="item.key" v-for="item in orderEnum.status" :key="item.key">
|
||||
{{ item.label }}
|
||||
</el-radio-button>
|
||||
</el-radio-group>
|
||||
|
|
@ -22,11 +18,7 @@
|
|||
<el-form-item label="支付方式">
|
||||
<el-radio-group v-model="query.payType">
|
||||
<el-radio-button label="">全部</el-radio-button>
|
||||
<el-radio-button
|
||||
:label="item.payType"
|
||||
v-for="item in payTypes"
|
||||
:key="item.payType"
|
||||
>
|
||||
<el-radio-button :label="item.payType" v-for="item in payTypes" :key="item.payType">
|
||||
{{ item.payName }}
|
||||
</el-radio-button>
|
||||
</el-radio-group>
|
||||
|
|
@ -42,16 +34,9 @@
|
|||
<el-radio-button label="month">本月</el-radio-button>
|
||||
<el-radio-button label="custom">自定义</el-radio-button>
|
||||
</el-radio-group>
|
||||
<el-date-picker
|
||||
v-model="query.createdAt"
|
||||
type="daterange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:default-time="['00:00:00', '23:59:59']"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
v-if="timeValue == 'custom'"
|
||||
>
|
||||
<el-date-picker v-model="query.createdAt" type="daterange" range-separator="至" start-placeholder="开始日期"
|
||||
end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" value-format="yyyy-MM-dd HH:mm:ss"
|
||||
v-if="timeValue == 'custom'">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
|
||||
|
|
@ -71,11 +56,7 @@
|
|||
></el-input>
|
||||
<el-button type="primary" @click="getTableData">查询</el-button>
|
||||
<el-button @click="resetHandle">重置</el-button>
|
||||
<el-button
|
||||
icon="el-icon-download"
|
||||
v-loading="downloadLoading"
|
||||
@click="downloadHandle"
|
||||
>
|
||||
<el-button icon="el-icon-download" v-loading="downloadLoading" @click="downloadHandle">
|
||||
<span v-if="!downloadLoading">导出Excel</span>
|
||||
<span v-else>下载中...</span>
|
||||
</el-button>
|
||||
|
|
@ -123,20 +104,12 @@
|
|||
<el-table-column label="商品信息">
|
||||
<template v-slot="scope">
|
||||
<div class="goods_info">
|
||||
<div
|
||||
class="row"
|
||||
v-for="item in scope.row.detailList"
|
||||
:key="item.id"
|
||||
>
|
||||
<div class="row" v-for="item in scope.row.detailList" :key="item.id">
|
||||
<el-image :src="item.productImg" class="cover" lazy></el-image>
|
||||
<div class="info">
|
||||
<div class="name">
|
||||
{{ item.productName }}
|
||||
<span
|
||||
class="refund"
|
||||
v-if="item.refundNumber"
|
||||
>(退 - {{ item.refundNumber }})</span
|
||||
>
|
||||
<span class="refund" v-if="item.refundNumber">(退 - {{ item.refundNumber }})</span>
|
||||
</div>
|
||||
<div class="sku">{{ item.productSkuName }}</div>
|
||||
</div>
|
||||
|
|
@ -145,15 +118,12 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="台桌号" prop="tableName"></el-table-column>
|
||||
<el-table-column label="订单金额">
|
||||
<el-table-column label="订单金额">
|
||||
<template v-slot="scope">
|
||||
<div>{{ scope.row.orderType | orderTypeFilter }}</div>
|
||||
<div
|
||||
class="refund"
|
||||
v-if="
|
||||
scope.row.orderType == 'return'
|
||||
"
|
||||
>
|
||||
<div class="refund" v-if="
|
||||
scope.row.orderType == 'return'
|
||||
">
|
||||
退款:-¥{{ scope.row.orderAmount }}
|
||||
</div>
|
||||
<div v-else>¥{{ scope.row.orderAmount }}</div>
|
||||
|
|
@ -161,11 +131,9 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="状态">
|
||||
<template v-slot="scope">
|
||||
<template
|
||||
v-if="
|
||||
scope.row.status == 'refund' && scope.row.orderType != 'return'
|
||||
"
|
||||
>
|
||||
<template v-if="
|
||||
scope.row.status == 'refund' && scope.row.orderType != 'return'
|
||||
">
|
||||
<el-tag type="primary">已完成</el-tag>
|
||||
</template>
|
||||
<template v-else>
|
||||
|
|
@ -185,22 +153,15 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="操作" width="100">
|
||||
<template v-slot="scope">
|
||||
<el-button type="text" @click="$refs.orderDetail.show(scope.row)"
|
||||
>详情</el-button
|
||||
>
|
||||
<el-button type="text" @click="$refs.orderDetail.show(scope.row)">详情</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-pagination
|
||||
:total="tableData.total"
|
||||
:current-page="tableData.page + 1"
|
||||
:page-size="tableData.size"
|
||||
@current-change="paginationChange"
|
||||
@size-change="sizeChange"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
></el-pagination>
|
||||
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
|
||||
@current-change="paginationChange" @size-change="sizeChange"
|
||||
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
</div>
|
||||
<orderDetail ref="orderDetail" />
|
||||
</div>
|
||||
|
|
@ -244,6 +205,7 @@ export default {
|
|||
payCountTotal: 0
|
||||
};
|
||||
},
|
||||
|
||||
filters: {
|
||||
orderTypeFilter(t) {
|
||||
if (t) {
|
||||
|
|
@ -271,7 +233,7 @@ export default {
|
|||
}
|
||||
},
|
||||
mounted() {
|
||||
if(this.$route.query.tableName){
|
||||
if (this.$route.query.tableName) {
|
||||
this.query.tableName = this.$route.query.tableName
|
||||
}
|
||||
if(this.$route.query.orderNo){
|
||||
|
|
@ -280,6 +242,13 @@ export default {
|
|||
this.resetQuery = { ...this.query };
|
||||
this.tbShopPayTypeGet();
|
||||
this.getTableData();
|
||||
// 从商品库存-库存记录-点击订单号跳转过来
|
||||
if (this.$route.query.orderNo) {
|
||||
this.query.orderNo = this.$route.query.orderNo
|
||||
setTimeout(() => {
|
||||
this.getTableData();
|
||||
}, 200);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 获取订单汇总
|
||||
|
|
|
|||
Loading…
Reference in New Issue