This commit is contained in:
YeMingfei666 2024-08-20 16:47:42 +08:00
commit 977b2e5cd7
26 changed files with 1321 additions and 663 deletions

View File

@ -39,6 +39,7 @@
"js-md5": "^0.8.3", "js-md5": "^0.8.3",
"jsencrypt": "^3.0.0-rc.1", "jsencrypt": "^3.0.0-rc.1",
"jszip": "^3.7.1", "jszip": "^3.7.1",
"lodash": "^4.17.21",
"material-components-vue": "^1.2.0", "material-components-vue": "^1.2.0",
"mavon-editor": "^2.9.1", "mavon-editor": "^2.9.1",
"normalize.css": "7.0.0", "normalize.css": "7.0.0",

View File

@ -39,12 +39,19 @@ export function puttbConsType(data) {
* @returns * @returns
*/ */
export function gettbConsInfo(params) { export function gettbConsInfo(params) {
// return request({
// url: '/api/tbConsInfo',
// method: "get",
// params
// });
return request({ return request({
url: '/api/tbConsInfo', url: "/api/viewConInfoFlow",
method: "get", method: "get",
params params
}); });
} }
/** /**
* 耗材入库 * 耗材入库
* @returns * @returns

42
src/api/notifications.js Normal file
View File

@ -0,0 +1,42 @@
import request from "@/utils/request";
// 推送店铺消息开关
export function shopState(data) {
return request({
url: "/api/msg/shopState",
method: "put",
data
});
}
export function msgall(params) {
return request({
url: "/api/msg/all",
method: "get",
params
});
}
export function msginfo(data) {
return request({
url: '/api/msg/info',
method: 'put',
data
})
}
export function state(params) {
return request({
url: "/api/msg/state",
method: "get",
params
});
}
export function delmsg(ids) {
return request({
url: '/api/msg',
method: 'delete',
data: ids
})
}

View File

@ -428,7 +428,14 @@ export function findActivate(params) {
params params
}); });
} }
// 获取店铺会员二维码
export function getwxacode(data) {
return request({
url: `/shop/storage/getwxacode`,
method: "post",
data
});
}
/** /**
* 商家用户列表 * 商家用户列表
* @returns * @returns

View File

@ -214,7 +214,9 @@ export default {
try { try {
const res = await daycount({ const res = await daycount({
startTime: this.query.createdAt[0], startTime: this.query.createdAt[0],
endTime: this.query.createdAt[1] endTime: this.query.createdAt[1],
cateId: this.query.cateId,
proName: this.query.proName
}); });
this.payCountList = res; this.payCountList = res;
} catch (error) { } catch (error) {

View File

@ -13,7 +13,8 @@
<el-radio-button label="custom">自定义</el-radio-button> <el-radio-button label="custom">自定义</el-radio-button>
</el-radio-group> </el-radio-group>
<el-date-picker v-model="query.createdAt" type="daterange" range-separator="" start-placeholder="开始日期" <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="yyyyMMdd"> end-placeholder="结束日期" :clearable="false" :default-time="['00:00:00', '23:59:59']"
value-format="yyyyMMdd">
</el-date-picker> </el-date-picker>
<el-form-item> <el-form-item>
<el-button type="primary" @click="getTableData">查询</el-button> <el-button type="primary" @click="getTableData">查询</el-button>
@ -27,7 +28,6 @@
<el-table-column type="index" width="50"> <el-table-column type="index" width="50">
</el-table-column> </el-table-column>
<el-table-column label="商户名称" prop="merchantName"> </el-table-column> <el-table-column label="商户名称" prop="merchantName"> </el-table-column>
<el-table-column label="打印机编号" prop="printNo"></el-table-column>
<el-table-column label="职员名称" prop="staffName"></el-table-column> <el-table-column label="职员名称" prop="staffName"></el-table-column>
<el-table-column label="订单数量" prop="orderNum"></el-table-column> <el-table-column label="订单数量" prop="orderNum"></el-table-column>
<el-table-column label="应交金额" prop="payable"></el-table-column> <el-table-column label="应交金额" prop="payable"></el-table-column>
@ -50,9 +50,10 @@
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label=""> <el-table-column label="" width='120px'>
<template v-slot="scope"> <template v-slot="scope">
<el-button type="primary" @click="clicksee(scope.row)">查看</el-button> <el-button type="text" @click="clicksee(scope.row)">查看</el-button>
<el-button type="text" @click="clickexport(scope.row)">导出</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -63,9 +64,9 @@
layout="total, sizes, prev, pager, next, jumper"></el-pagination> layout="total, sizes, prev, pager, next, jumper"></el-pagination>
</div> </div>
<el-dialog title="商品销量" :visible.sync="dialogshow"> <el-dialog title="商品销量" :visible.sync="dialogshow">
<el-table :data="tableDatainfo.data" style="width: 100%"> <el-table :data="tableDatainfo.data" style="width: 100%;height: 500px;overflow: auto;">
<el-table-column prop="productName" label="商品名称"/> <el-table-column prop="productName" label="商品名称" />
<el-table-column prop="num" label="数量"/> <el-table-column prop="num" label="数量" />
<el-table-column prop="amount" label="金额" /> <el-table-column prop="amount" label="金额" />
</el-table> </el-table>
</el-dialog> </el-dialog>
@ -74,6 +75,7 @@
<script> <script>
import { tbHandoverGet } from '@/api/homes/record.js' import { tbHandoverGet } from '@/api/homes/record.js'
import XLSX from 'xlsx';
import dayjs from "dayjs"; import dayjs from "dayjs";
export default { export default {
data() { data() {
@ -240,8 +242,23 @@ export default {
// //
clicksee(e) { clicksee(e) {
this.dialogshow = true this.dialogshow = true
console.log(JSON.parse(e.productInfos)) // console.log(JSON.parse(e.productInfos))
this.tableDatainfo.data = JSON.parse(e.productInfos) this.tableDatainfo.data = JSON.parse(e.productInfos)
},
clickexport(e) {
const arr = JSON.parse(e.productInfos)
let data = [
['商品名称', '数量', '金额'],
]
arr.forEach(element => {
data.push([element.productName, element.num, element.amount])
});
const ws = XLSX.utils.aoa_to_sheet(data);
const wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
XLSX.writeFile(wb, 'data.xlsx');
} }
} }
}; };

View File

@ -87,11 +87,11 @@
</el-table-column> </el-table-column>
</el-table> --> </el-table> -->
</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" @size-change="sizeChange" @current-change="paginationChange" @size-change="sizeChange"
layout="total, sizes, prev, pager, next, jumper"></el-pagination> layout="total, sizes, prev, pager, next, jumper"></el-pagination>
</div> </div> -->
</div> </div>
</template> </template>

View File

@ -1,33 +1,36 @@
<!-- 新增耗材盘点 --> <!-- 耗材列表的新增耗材盘点 -->
<template> <template>
<el-dialog title="耗材盘点" :visible.sync="dialogVisible" width="80%" @open="form.note = ''"> <el-dialog title="耗材盘点" :visible.sync="dialogVisible" width="80%" @open="form.note = ''">
<el-form ref="form" :model="form" :rules="rules" label-position="left" inline> <el-form ref="form" :model="form" :rules="rules" label-position="left" inline>
<el-form-item label="账存数量"> <el-form-item label="账存数量">
<el-input :value="detail.num" readonly style="width: 180px;"></el-input> <el-input v-model="form.balance" readonly style="width: 180px;"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="实际数量"> <el-form-item label="实际数量">
<el-input-number v-model="form.lpNum" :min="0" :step="1" step-strictly style="width: 180px;"></el-input-number> <el-input-number v-model="form.stocktakinNum" :min="0" :step="1" step-strictly
</el-form-item> style="width: 180px;"></el-input-number>
<el-form-item label="盈亏数量"> </el-form-item>
<el-input :value="profitNumber" readonly :class="{ lose: profitNumber < 0 }" style="width: 180px;"></el-input> <el-form-item label="盈亏数量">
</el-form-item> <el-input v-model="profitNumber" readonly :class="{ lose: profitNumber < 0 }"
<el-form-item label="单价"> style="width: 180px;"></el-input>
<el-input v-model="detail.price" readonly></el-input> </el-form-item>
</el-form-item> <el-form-item label="单价">
<el-form-item label="盈亏金额"> <el-input v-model="form.price" readonly></el-input>
<el-input :value="profitPrice" readonly :class="{ lose: profitNumber < 0 }" style="width: 180px;"></el-input> </el-form-item>
</el-form-item> <el-form-item label="盈亏金额">
<el-form-item label="备注"> <el-input v-model="profitPrice" readonly :class="{ lose: profitNumber < 0 }"
<el-input v-model="form.remark" placeholder="请输入备注" style="width: 180px;"></el-input> style="width: 180px;"></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item label="备注">
<el-button @click="dialogVisible = false; form.remark = ''"> </el-button> <el-input v-model="form.remark" placeholder="请输入备注" style="width: 300px;"></el-input>
<el-button type="primary" :loading="loading" @click="onSubmitHandle"> </el-button> </el-form-item>
</el-form-item> <el-form-item>
</el-form> <el-button @click="dialogVisible = false"> </el-button>
<div class="head-container"> <el-button type="primary" :loading="loading" @click="onSubmitHandle"> </el-button>
<el-table ref="table" :data="tableData.list" v-loading="tableData.loading" border stripe> </el-form-item>
<!-- <el-table-column label="商品信息" width="150px"> </el-form>
<div class="head-container">
<el-table ref="table" :data="tableData.list" v-loading="tableData.loading" border stripe>
<el-table-column label="商品信息" width="150px">
<template v-slot="scope"> <template v-slot="scope">
<div class="shop_info"> <div class="shop_info">
<el-image :src="scope.row.coverImg" style="width: 30px;height: 30px;"> <el-image :src="scope.row.coverImg" style="width: 30px;height: 30px;">
@ -35,183 +38,165 @@
<i class="icon el-icon-document-delete"></i> <i class="icon el-icon-document-delete"></i>
</div> </div>
</el-image> </el-image>
<span>{{ scope.row.name }}</span> <span>{{ scope.row.conName }}</span>
</div> </div>
</template> </template>
</el-table-column> --> </el-table-column>
<el-table-column label="售价" prop="price"> <el-table-column label="售价" prop="price">
<template v-slot="scope"> <template v-slot="scope">
{{ formatDecimal(scope.row.price) }} {{ scope.row.price }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="帐存库存" prop="stockNumber"></el-table-column> <el-table-column label="账存数量" prop="stockNumber"></el-table-column>
<el-table-column label="盈亏数量" prop="lpNum"></el-table-column> <el-table-column label="盈亏数量" prop="lpNum"></el-table-column>
<el-table-column label="盈亏金额" prop="lpAmount"> <el-table-column label="盈亏金额" prop="lpAmount">
<template v-slot="scope"> <template v-slot="scope">
{{ formatDecimal(scope.row.lpAmount) }} {{ scope.row.lpAmount }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="实际库存" prop="acStockNumber"></el-table-column> <el-table-column label="实际库存" prop="acStockNumber"></el-table-column>
<el-table-column label="备注" prop="remark"></el-table-column> <el-table-column label="盘点时间" prop="createTime"></el-table-column>
<el-table-column label="盘点时间" prop="createTime"></el-table-column> <el-table-column label="盘点备注" prop="remark"></el-table-column>
<!-- <el-table-column label="盘点备注" prop="note"></el-table-column> --> </el-table>
</el-table> </div>
</div> <el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-sizes="[5, 10, 30, 50]"
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-sizes="[5, 10, 30, 50]" :page-size="tableData.size" @current-change="paginationChange" @size-change="sizeChange"
:page-size="tableData.size" @current-change="paginationChange" @size-change="sizeChange" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
layout="total, sizes, prev, pager, next, jumper"></el-pagination> </el-dialog>
</el-dialog>
</template> </template>
<script> <script>
import { formatDecimal } from "@/utils"; import { formatDecimal } from '@/utils'
import { tbConCheck, tbConCheckGet } from "@/api/invoicing"; import { tbConCheck, tbConCheckGet } from '@/api/invoicing'
export default { export default {
data() { data() {
return { return {
formatDecimal, dialogVisible: false,
dialogVisible: false, loading: false,
loading: false, form: {
detail: "", skuId: '', // sku
form: { productId: '', //
conInfoId: "", stocktakinNum: '', //
lpNum: 0 price: '', //
}, note: "" //
rules: { },
stocktakinNum: [ rules: {
{ stocktakinNum: [
required: true, {
message: "请输入盘点数量", required: true,
trigger: "blur" message: '请输入盘点数量',
} trigger: 'blur'
] }
}, ]
resetForm: "", },
searhForm: { resetForm: '',
name: "", searhForm: {
skuId: "", name: '',
productId: "" skuId: '',
}, productId: ''
tableData: { },
page: 0, tableData: {
size: 5, page: 0,
total: 0, size: 5,
loading: false, total: 0,
list: [] loading: false,
} list: []
}; }
},
mounted() {
this.resetForm = { ...this.form };
},
computed: {
profitNumber() {
return formatDecimal(this.form.lpNum - this.detail.num, 2, true);
},
profitPrice() {
return formatDecimal(
(this.form.lpNum - this.detail.num) * this.detail.price
);
}
},
methods: {
onSubmitHandle() {
this.$refs.form.validate(async valid => {
if (valid) {
try {
this.loading = true;
let res = await tbConCheck({
conInfoId: this.form.conInfoId,
lpNum: this.profitNumber,
remark: this.form.remark,
stockNumber: this.form.lpNum
});
this.detail.num = this.form.lpNum;
this.form.lpNum = 0;
this.form.lpNum = this.detail.num;
this.$emit("success", res);
this.loading = false;
this.$message({
title: "注意",
message: `添加成功`,
type: "success"
});
this.form.remark = ''
this.getTableData();
} catch (error) {
this.loading = false;
console.log(error);
}
} }
});
}, },
show(obj) { mounted() {
// console.log(obj); this.resetForm = { ...this.form }
this.detail = { ...obj }; },
this.detail.num = formatDecimal( computed: {
obj.stockNumber - obj.stockConsume, profitNumber() {
2, return this.form.stocktakinNum - this.form.balance
false },
); profitPrice() {
this.dialogVisible = true; return formatDecimal(this.profitNumber * this.form.price && 0)
this.form.conInfoId = obj.id; }
this.form.lpNum = this.detail.num; },
methods: {
onSubmitHandle() {
this.$refs.form.validate(async valid => {
if (valid) {
try {
this.form.lpNum = this.profitNumber
this.loading = true
let res = await tbConCheck(this.form)
this.$emit('success', res)
// this.dialogVisible = false
this.loading = false
this.$notify({
title: '注意',
message: `添加成功`,
type: 'success'
});
this.getTableData()
} catch (error) {
this.loading = false
console.log(error)
}
}
})
},
show(obj) {
this.form = Object.assign(this.form, obj)
this.dialogVisible = true
this.form.conInfoId = obj.consId
this.form.stockNumber = obj.balance
this.searhForm.skuId = obj.productId; this.searhForm.skuId = obj.productId
this.searhForm.productId = obj.proId; this.searhForm.productId = obj.consId
this.getTableData()
this.tableData.page = 0; },
this.tableData.total = 0; //
this.tableData.list = []; sizeChange(e) {
this.getTableData(); this.tableData.size = e
}, this.getTableData()
// },
sizeChange(e) { //
this.tableData.size = e; paginationChange(e) {
this.getTableData(); this.tableData.page = e - 1
}, this.getTableData()
// },
paginationChange(e) { //
this.tableData.page = e - 1; async getTableData() {
this.getTableData(); try {
}, this.tableData.loading = true
// const res = await tbConCheckGet({
async getTableData() { page: this.tableData.page,
try { size: this.tableData.size,
this.tableData.loading = true; name: this.searhForm.name,
const res = await tbConCheckGet({ skuId: this.searhForm.category,
page: this.tableData.page, productId: this.searhForm.productId,
size: this.tableData.size, sort: 'id,desc',
conInfoId: this.form.conInfoId, })
sort: "id,desc" this.tableData.list = res.content
}); this.tableData.total = res.totalElements
this.tableData.list = res.content; setTimeout(() => {
this.tableData.total = res.totalElements; this.tableData.loading = false
setTimeout(() => { }, 500);
this.tableData.loading = false; } catch (error) {
}, 500); console.log(error)
} catch (error) { }
console.log(error); },
}
} }
} }
};
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.lose { .lose {
&::v-deep .el-input__inner { &::v-deep .el-input__inner {
color: rgb(238, 29, 29); color: rgb(238, 29, 29);
} }
} }
.shop_info { .shop_info {
display: flex; display: flex;
align-items: center; align-items: center;
span { span {
margin-left: 10px; margin-left: 10px;
} }
} }
</style> </style>

View File

@ -3,13 +3,13 @@
<el-dialog title="选择耗材" :visible.sync="dialogVisible" @open="resetHandle()"> <el-dialog title="选择耗材" :visible.sync="dialogVisible" @open="resetHandle()">
<el-form :model="searchForm" inline> <el-form :model="searchForm" inline>
<el-form-item> <el-form-item>
<el-input v-model="searchForm.conTypeName" placeholder="耗材类型名称"></el-input> <el-input v-model="searchForm.conTypeName" placeholder="耗材类型名称" @input="onInput"></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-input v-model="searchForm.conCode" placeholder="耗材代码"></el-input> <el-input v-model="searchForm.conCode" placeholder="耗材代码" @input="onInput"></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-input v-model="searchForm.conName" placeholder="耗材名称"></el-input> <el-input v-model="searchForm.conName" placeholder="耗材名称" @input="onInput"></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="getTableData">查询</el-button> <el-button type="primary" @click="getTableData">查询</el-button>
@ -17,7 +17,8 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<div class="head-container"> <div class="head-container">
<el-table ref="table" :data="tableData.list" v-loading="tableData.loading" @select="firstSelectChange"> <el-table ref="table" :data="tableData.list" v-loading="tableData.loading" @select="firstSelectChange"
:row-key="getRowKey" @selection-change="onSelectionChange">
<el-table-column type="selection" width="55" align="center"></el-table-column> <el-table-column type="selection" width="55" align="center"></el-table-column>
<el-table-column label="耗材名称" prop="conName"></el-table-column> <el-table-column label="耗材名称" prop="conName"></el-table-column>
<el-table-column label="价格" prop="price"></el-table-column> <el-table-column label="价格" prop="price"></el-table-column>
@ -50,6 +51,8 @@
<script> <script>
import { formatDecimal } from '@/utils' import { formatDecimal } from '@/utils'
import { tbConsInfoGet } from "@/api/invoicing"; import { tbConsInfoGet } from "@/api/invoicing";
import _ from 'lodash'
export default { export default {
data() { data() {
return { return {
@ -69,13 +72,23 @@ export default {
loading: false, loading: false,
list: [] list: []
}, },
goods: [] goods: [],
stayselection: []
} }
}, },
mounted() { mounted() {
this.resetSearchForm = { ...this.searchForm } this.resetSearchForm = { ...this.searchForm }
}, },
methods: { methods: {
onInput: _.debounce(function (event) { //
this.getTableData()
}, 500),
onSelectionChange(selection) {
this.stayselection = selection
},
getRowKey(row) {
return row.id
},
firstSelectChange() { firstSelectChange() {
// console.log(selection) // console.log(selection)
let selection = this.$refs.table.selection let selection = this.$refs.table.selection
@ -84,10 +97,16 @@ export default {
this.$refs.table.toggleRowSelection(del_row, false); this.$refs.table.toggleRowSelection(del_row, false);
} }
}, },
// //
confirmHandle() { confirmHandle() {
let res = this.$refs.table.selection // let res = this.$refs.table.selection
this.$emit('success', res) // let res = this.stayselection
// this.$emit('success', res)
var uniqueArray = this.stayselection.filter(item1 =>
!this.goods.some(item2 => item2.productId == item1.id)
);
this.$emit('success', uniqueArray)
this.close() this.close()
}, },
// //

View File

@ -2,7 +2,7 @@
<el-dialog title="选择商品" :visible.sync="dialogVisible" @open="resetHandle()"> <el-dialog title="选择商品" :visible.sync="dialogVisible" @open="resetHandle()">
<el-form :model="searhForm" inline> <el-form :model="searhForm" inline>
<el-form-item> <el-form-item>
<el-input v-model="searhForm.name" placeholder="商品名称"></el-input> <el-input v-model="searhForm.name" placeholder="商品名称" @input="onInput"></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-select v-model="searhForm.category" placeholder="商品分类"> <el-select v-model="searhForm.category" placeholder="商品分类">
@ -16,8 +16,9 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<div class="head-container"> <div class="head-container">
<el-table ref="table" :data="tableData.list" @select="firstSelectChange" v-loading="tableData.loading"> <el-table ref="table" :data="tableData.list" @select="firstSelectChange" v-loading="tableData.loading"
<el-table-column type="selection" width="55" align="center"></el-table-column> :row-key="getRowKey" @selection-change="onSelectionChange">
<el-table-column type="selection" width="55" align="center" :reserve-selection="true"></el-table-column>
<el-table-column label="商品信息"> <el-table-column label="商品信息">
<template v-slot="scope"> <template v-slot="scope">
<div class="shop_info"> <div class="shop_info">
@ -68,7 +69,7 @@
<script> <script>
import { tbShopCategoryGet, tbProductlist } from "@/api/invoicing"; import { tbShopCategoryGet, tbProductlist } from "@/api/invoicing";
import _ from 'lodash'
export default { export default {
data() { data() {
return { return {
@ -80,19 +81,28 @@ export default {
categoryList: [], categoryList: [],
tableData: { tableData: {
page: 0, page: 0,
size: 30, size: 10,
total: 0, total: 0,
loading: false, loading: false,
list: [] list: []
}, },
goods: [], goods: [],
// //
isselect: false isselect: false,
stayselection: []//
} }
}, },
methods: { methods: {
onInput: _.debounce(function (event) {//
this.getTableData()
}, 500),
onSelectionChange(selection) {
this.stayselection = selection
},
getRowKey(row) {
return row.id
},
firstSelectChange() { firstSelectChange() {
// console.log(selection)
let selection = this.$refs.table.selection let selection = this.$refs.table.selection
if (selection.length > 1 && this.isselect) { if (selection.length > 1 && this.isselect) {
const del_row = selection.shift(); const del_row = selection.shift();
@ -101,8 +111,11 @@ export default {
}, },
// //
confirmHandle() { confirmHandle() {
let res = this.$refs.table.selection // let res = this.$refs.table.selection
this.$emit('success', res) var uniqueArray = this.stayselection.filter(item1 =>
!this.goods.some(item2 => item2.productId == item1.id)
);
this.$emit('success', uniqueArray)
this.close() this.close()
}, },
// //
@ -114,7 +127,7 @@ export default {
this.searhForm.name = '' this.searhForm.name = ''
this.searhForm.category = '' this.searhForm.category = ''
this.tableData.page = 0 this.tableData.page = 0
this.tableData.size = 30 this.tableData.size = 10
this.tableData.list = [] this.tableData.list = []
this.getTableData() this.getTableData()
}, },

View File

@ -13,139 +13,116 @@
@keyup.enter.native="getTableData" @keyup.enter.native="getTableData"
/> --> /> -->
<div style="width: 150px"> <div style="width: 150px">
<el-select <el-select v-model="query.conTypeId" placeholder="请选择耗材分类" style="width: 100%">
v-model="query.conTypeId" <el-option :label="item.conTypeName" :value="item.id" v-for="item in consTypeList"
placeholder="请选择耗材分类" :key="item.conTypeId" />
style="width: 100%"
>
<el-option
:label="item.conTypeName"
:value="item.id"
v-for="item in consTypeList"
:key="item.conTypeId"
/>
</el-select> </el-select>
</div> </div>
<el-input <el-input v-model="query.conTypeName" size="small" clearable placeholder="请输入类型名称" style="width: 150px"
v-model="query.conTypeName" @keyup.enter.native="getTableData" />
size="small" <el-input v-model="query.conCode" size="small" clearable placeholder="请输入耗材代码" style="width: 150px"
clearable @keyup.enter.native="getTableData" />
placeholder="请输入类型名称" <el-input v-model="query.conName" size="small" clearable placeholder="请输入耗材名称" style="width: 150px"
style="width: 150px" @keyup.enter.native="getTableData" />
@keyup.enter.native="getTableData"
/>
<el-input
v-model="query.conCode"
size="small"
clearable
placeholder="请输入耗材代码"
style="width: 150px"
@keyup.enter.native="getTableData"
/>
<el-input
v-model="query.conName"
size="small"
clearable
placeholder="请输入耗材名称"
style="width: 150px"
@keyup.enter.native="getTableData"
/>
<div style="width: 150px"> <div style="width: 150px">
<el-select <el-select v-model="query.status" placeholder="请选择商品规格" style="width: 100%">
v-model="query.status" <el-option :label="item.label" :value="item.value" v-for="item in typeEnums" :key="item.label" />
placeholder="请选择商品规格" </el-select>
style="width: 100%" </div>
> <div style="width: 300px;">
<el-option <el-select clearable v-model="query.sort" placeholder="排序">
:label="item.label" <el-option label="按数量排序" value="balance,desc" />
:value="item.value"
v-for="item in typeEnums"
:key="item.label"
/>
</el-select> </el-select>
</div> </div>
<el-button type="primary" @click="getTableData">查询</el-button> <el-button type="primary" @click="getTableData">查询</el-button>
<el-button @click="resetHandle">重置</el-button> <el-button @click="resetHandle">重置</el-button>
</div> </div>
<div class="row"> <div class="row">
<el-button <el-button icon="el-icon-download" :loading="downloadLoading" @click="protHandle">导出耗材</el-button>
icon="el-icon-download" <el-button icon="el-icon-upload2" :loading="uploadLoading" @click="dialogVisible = true">导入耗材</el-button>
:loading="downloadLoading"
@click="protHandle"
>导出耗材</el-button
>
<el-button
icon="el-icon-upload2"
:loading="uploadLoading"
@click="dialogVisible = true"
>导入耗材</el-button
>
</div> </div>
</div> </div>
</div> </div>
<div class="head-container"> <div class="head-container">
<el-row> <el-row>
<el-col> <el-col>
<el-button <el-button type="primary" icon="el-icon-plus" @click="clickdialogframe('add')">添加</el-button>
type="primary"
icon="el-icon-plus"
@click="clickdialogframe('add')"
>添加</el-button
>
</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" :data="tableData.data" v-loading="tableData.loading" row-key="id">
ref="table" <!-- <el-table-column prop="id" label="ID" width="50px" /> -->
:data="tableData.data" <el-table-column label="耗材名称" prop="conName" align="center" />
v-loading="tableData.loading" <!-- <el-table-column label="耗材代码" prop="conCode" /> -->
row-key="id" <el-table-column label="分类名称" prop="conTypeName" align="center" />
> <el-table-column label="单位" prop="conUnit" align="center" />
<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="现有库存" align="center">
<!-- <el-table-column label="类型id" prop="conTypeId" /> -->
<el-table-column label="分类名称" prop="conTypeName" />
<el-table-column label="单位" prop="conUnit" />
<el-table-column label="创建时间" prop="createTime" width="200">
<template v-slot="scope"> <template v-slot="scope">
{{ dayjs(scope.row.createTime).format("YYYY-MM-DD HH:mm:ss") }} <span :class="[computedClass(scope.row.balance)]"> {{ scope.row.balance }}</span>
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column label="最近入库量" prop="lasterInStock" /> --> <el-table-column label="耗材消耗" prop="conConsume" align="center" />
<el-table-column label="库存数量" prop="stockNumber"> <el-table-column label="耗材入库" prop="conIn" align="center" />
<el-table-column label="耗材出库" prop="conOut" align="center" />
<el-table-column label="耗材反还" prop="conReturn" align="center" />
<el-table-column label="库存开关" prop="conReturn" align="center">
<template v-slot="scope"> <template v-slot="scope">
{{ (scope.row.stockNumber - scope.row.stockConsume).toFixed(2) }} <el-switch v-model="scope.row.isCheck" active-value="1" inactive-value="0"
@change="showChange($event, scope.row)"></el-switch>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="预警值" prop="conWarning" /> <!-- <el-table-column label="业务编码" prop="bizCode" /> -->
<!-- <el-table-column label="业务说明" prop="bizName" /> -->
<!-- <el-table-column label="商品名称" prop="productName" /> -->
<!-- <el-table-column label="正负号标识" prop="bizType" /> -->
<!-- <el-table-column label="耗材id" prop="consId" /> -->
<!-- <el-table-column label="创建时间" prop="createTime"></el-table-column> -->
<!-- <el-table-column label="所属商品" width="320" align="center">
<template v-slot="scope">
<el-button v-for="(item) in scope.row.product" @click="toGoods(item)" :key="item.productId" type="text">{{
item.productName }}</el-button>
{{ scope.row.productId }}
</template>
</el-table-column> -->
<el-table-column label="所属商品" width="320" align="center">
<template v-slot="scope">
<el-button v-for="(item) in scope.row.product" @click="toGoods(item)" :key="item.productId" type="text">{{
item.productName }}</el-button>
</template>
</el-table-column>
<!-- <el-table-column label="最近入库量" prop="lasterInStock" /> -->
<el-table-column label="库存数量" align="center" prop="stockNumber">
<template v-slot="scope">
{{ (scope.row.balance).toFixed(2) }}
<!-- {{ (scope.row.stockNumber - scope.row.stockConsume).toFixed(2) }} -->
</template>
</el-table-column>
<el-table-column label="预警值" align="center" prop="conWarning" />
<!-- <el-table-column label="单位耗材值" prop="surplusStock" /> --> <!-- <el-table-column label="单位耗材值" prop="surplusStock" /> -->
<!-- <el-table-column label="排序" prop="sort" sortable /> --> <!-- <el-table-column label="排序" prop="sort" sortable /> -->
<el-table-column label="更新时间" prop="updateTime" width="200"> <el-table-column label="创建时间" align="center" prop="createTime" width="200">
<!-- <template v-slot="scope"> <!-- <template v-slot="scope">
{{ dayjs(scope.row.createdAt).format('YYYY-MM-DD HH:mm:ss') }} {{ dayjs(scope.row.createTime).format("YYYY-MM-DD HH:mm:ss") }}
</template> --> </template> -->
</el-table-column> </el-table-column>
<el-table-column label="操作" width="180" fixed="right"> <!-- <el-table-column label="更新时间" prop="updateTime" width="200"> -->
<!-- <template v-slot="scope">
{{ dayjs(scope.row.createdAt).format('YYYY-MM-DD HH:mm:ss') }}
</template> -->
<!-- </el-table-column> -->
<el-table-column label="操作" width="250" fixed="right">
<template v-slot="scope"> <template v-slot="scope">
<el-button type="text" @click="editorHandle(scope.row)" <el-button type="text" @click="editorHandle(scope.row)">编辑</el-button>
>编辑</el-button <el-button type="text" @click="clicksee(scope.row)" style="margin-left: 10px !important">耗材记录</el-button>
> <el-button type="text" size="mini" style="margin-left: 10px !important"
<el-button @click="$refs.AddConsTakin.show(scope.row)">耗材盘点</el-button>
type="text" <el-button style="margin-left: 10px !important" type="text" @click="lookDetail(scope.row)">查看详情</el-button>
@click="clicksee(scope.row)"
style="margin-left: 10px !important"
>耗材记录</el-button
>
<el-button
type="text"
size="mini"
style="margin-left: 10px !important"
@click="$refs.AddConsTakin.show(scope.row)"
>耗材盘点</el-button
>
<!-- <el-button type="text" icon="el-icon-rank">排序</el-button> --> <!-- <el-button type="text" icon="el-icon-rank">排序</el-button> -->
<!-- <el-button type="text" @click="clickdialogfadd(scope.row)" <!-- <el-button type="text" @click="clickdialogfadd(scope.row)"
style="margin-left: 10px !important;">入库</el-button> --> style="margin-left: 10px !important;">入库</el-button> -->
@ -159,44 +136,23 @@
</el-table> </el-table>
</div> </div>
<div class="head-container"> <div class="head-container">
<el-pagination <el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
:total="tableData.total" layout="total, sizes, prev, pager, next, jumper" @current-change="paginationChange" @size-change="(e) => {
:current-page="tableData.page + 1" tableData.size = e;
:page-size="tableData.size" tableData.page = 0;
layout="total, sizes, prev, pager, next, jumper" getTableData();
@current-change="paginationChange" }
@size-change=" " />
(e) => {
tableData.size = e;
tableData.page = 0;
getTableData();
}
"
/>
</div> </div>
<!-- 耗材入库 --> <!-- 耗材入库 -->
<el-dialog title="耗材入库" :visible.sync="libraryshow"> <el-dialog title="耗材入库" :visible.sync="libraryshow">
<el-form <el-form :inline="true" ref="reflibrary" :model="libraryshowdata" :rules="ruleslibrary" class="demo-form-inline">
:inline="true"
ref="reflibrary"
:model="libraryshowdata"
:rules="ruleslibrary"
class="demo-form-inline"
>
<el-form-item label="耗材入库数量" prop="stockNumber"> <el-form-item label="耗材入库数量" prop="stockNumber">
<el-input <el-input v-model.number="libraryshowdata.stockNumber" type="number" placeholder="请输入单位"></el-input>
v-model.number="libraryshowdata.stockNumber"
type="number"
placeholder="请输入单位"
></el-input>
</el-form-item> </el-form-item>
<el-form-item style="display: flex; justify-content: flex-end"> <el-form-item style="display: flex; justify-content: flex-end">
<el-button @click="libraryshow = false"> </el-button> <el-button @click="libraryshow = false"> </el-button>
<el-button <el-button type="primary" @click="clickdialoglibraryshow('reflibrary')"> </el-button>
type="primary"
@click="clickdialoglibraryshow('reflibrary')"
> </el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-dialog> </el-dialog>
@ -205,33 +161,18 @@
<el-dialog :title="dialogtitle" :visible.sync="dialogshow" width="80%"> <el-dialog :title="dialogtitle" :visible.sync="dialogshow" width="80%">
<template v-if="dialogtitle != '编辑'"> <template v-if="dialogtitle != '编辑'">
<div v-for="(item, index) in ruleForms" :key="index"> <div v-for="(item, index) in ruleForms" :key="index">
<el-form <el-form :inline="true" :ref="'refruleForm' + index" :model="item" :rules="rules" class="demo-form-inline">
:inline="true"
:ref="'refruleForm'+index"
:model="item"
:rules="rules"
class="demo-form-inline"
>
<el-form-item label=" "> <el-form-item label=" ">
<i <i class="el-icon-remove-outline color-danger" @click="ruleFormsReduce(index)"></i>
class="el-icon-remove-outline color-danger"
@click="ruleFormsReduce(index)"
></i>
</el-form-item> </el-form-item>
<el-form-item label="单位" prop="conUnit"> <el-form-item label="单位" prop="conUnit">
<el-input <el-input v-model="item.conUnit" placeholder="请输入单位"></el-input>
v-model="item.conUnit"
placeholder="请输入单位"
></el-input>
</el-form-item> </el-form-item>
<el-form-item label="耗材类型" prop="conTypeId"> <el-form-item label="耗材类型" prop="conTypeId">
<el-select v-model="item.conTypeId" placeholder="请选择" @change="selectChange($event,'refruleForm'+index,'conTypeId')" > <el-select v-model="item.conTypeId" placeholder="请选择"
<el-option @change="selectChange($event, 'refruleForm' + index, 'conTypeId')">
v-for="option in consTypeList" <el-option v-for="option in consTypeList" :key="option.conTypeId" :label="option.conTypeName"
:key="option.conTypeId" :value="option.id">
:label="option.conTypeName"
:value="option.id"
>
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -252,10 +193,7 @@
> >
</el-form-item> --> </el-form-item> -->
<el-form-item label="耗材信息名称" prop="conName"> <el-form-item label="耗材信息名称" prop="conName">
<el-input <el-input v-model="item.conName" placeholder="请输入耗材信息名称"></el-input>
v-model="item.conName"
placeholder="请输入耗材信息名称"
></el-input>
</el-form-item> </el-form-item>
<!-- <el-form-item label="耗材信息代码" prop="conCode"> <!-- <el-form-item label="耗材信息代码" prop="conCode">
<el-input <el-input
@ -264,23 +202,14 @@
></el-input> ></el-input>
</el-form-item> --> </el-form-item> -->
<el-form-item label="耗材价格"> <el-form-item label="耗材价格">
<el-input <el-input v-model="item.price" placeholder="请输入耗材价格"></el-input>
v-model="item.price"
placeholder="请输入耗材价格"
></el-input>
</el-form-item> </el-form-item>
<el-form-item label="预警值"> <el-form-item label="预警值">
<el-input <el-input v-model="item.conWarning" placeholder="请输入耗材预警值"></el-input>
v-model="item.conWarning"
placeholder="请输入耗材预警值"
></el-input>
</el-form-item> </el-form-item>
<el-form-item label=" "> <el-form-item label=" ">
<i <i class="el-icon-circle-plus-outline color-success" @click="ruleFormsAdd(index)"></i>
class="el-icon-circle-plus-outline color-success"
@click="ruleFormsAdd(index)"
></i>
</el-form-item> </el-form-item>
<!-- <el-form-item label="单位耗材值" prop="surplusStock"> <!-- <el-form-item label="单位耗材值" prop="surplusStock">
<el-input v-model="ruleForm.surplusStock" placeholder="请输入单位耗材值"></el-input> <el-input v-model="ruleForm.surplusStock" placeholder="请输入单位耗材值"></el-input>
@ -297,16 +226,10 @@
</template> </template>
<template v-else> <template v-else>
<el-form <el-form :inline="true" ref="refruleForm" :model="ruleForm" :rules="rules" class="demo-form-inline">
:inline="true" <el-form-item label="单位" prop="conUnit">
ref="refruleForm" <el-input v-model="ruleForm.conUnit" placeholder="请输入单位"></el-input>
:model="ruleForm" </el-form-item>
:rules="rules"
class="demo-form-inline"
>
<el-form-item label="单位" prop="conUnit" >
<el-input v-model="ruleForm.conUnit" placeholder="请输入单位"></el-input>
</el-form-item>
<!-- <el-form-item label="单位" prop="conUnit" v-if="dialogtitle == '添加'"> <!-- <el-form-item label="单位" prop="conUnit" v-if="dialogtitle == '添加'">
<el-input v-model="ruleForm.conUnit" placeholder="请输入单位"></el-input> <el-input v-model="ruleForm.conUnit" placeholder="请输入单位"></el-input>
</el-form-item> </el-form-item>
@ -333,10 +256,7 @@
> >
</el-form-item> --> </el-form-item> -->
<el-form-item label="耗材信息名称" prop="conName"> <el-form-item label="耗材信息名称" prop="conName">
<el-input <el-input v-model="ruleForm.conName" placeholder="请输入耗材信息名称"></el-input>
v-model="ruleForm.conName"
placeholder="请输入耗材信息名称"
></el-input>
</el-form-item> </el-form-item>
<!-- <el-form-item label="耗材信息代码" prop="conCode"> <!-- <el-form-item label="耗材信息代码" prop="conCode">
<el-input <el-input
@ -345,23 +265,13 @@
></el-input> ></el-input>
</el-form-item> --> </el-form-item> -->
<el-form-item label="耗材价格"> <el-form-item label="耗材价格">
<el-input <el-input v-model="ruleForm.price" placeholder="请输入耗材价格"></el-input>
v-model="ruleForm.price"
placeholder="请输入耗材价格"
></el-input>
</el-form-item> </el-form-item>
<el-form-item label="预警值"> <el-form-item label="预警值">
<el-input <el-input v-model="ruleForm.conWarning" placeholder="请输入耗材预警值"></el-input>
v-model="ruleForm.conWarning"
placeholder="请输入耗材预警值"
></el-input>
</el-form-item> </el-form-item>
<el-form-item label="状态" v-if="dialogtitle == '编辑'"> <el-form-item label="状态" v-if="dialogtitle == '编辑'">
<el-switch <el-switch v-model="ruleForm.status" active-value="1" inactive-value="0"></el-switch>
v-model="ruleForm.status"
active-value="1"
inactive-value="0"
></el-switch>
</el-form-item> </el-form-item>
<!-- <el-form-item label="单位耗材值" prop="surplusStock"> <!-- <el-form-item label="单位耗材值" prop="surplusStock">
<el-input v-model="ruleForm.surplusStock" placeholder="请输入单位耗材值"></el-input> <el-input v-model="ruleForm.surplusStock" placeholder="请输入单位耗材值"></el-input>
@ -378,47 +288,19 @@
<el-dialog title="选择类型" :visible.sync="typedialogshow"> <el-dialog title="选择类型" :visible.sync="typedialogshow">
<div class="head-container"> <div class="head-container">
<el-input <el-input v-model="querytypedialogshowquery.conTypeName" size="small" clearable placeholder="请输入耗材类型名称"
v-model="querytypedialogshowquery.conTypeName" style="width: 100%" class="filter-item" @keyup.enter.native="getTableDatatype" />
size="small" <el-input v-model="querytypedialogshowquery.conTypeCode" size="small" clearable placeholder="请输入耗材类型代码"
clearable style="width: 100%" class="filter-item" @keyup.enter.native="getTableDatatype" />
placeholder="请输入耗材类型名称" <el-select v-model="querytypedialogshowquery.status" placeholder="请选择商品规格" style="width: 100%">
style="width: 100%" <el-option :label="item.label" :value="item.value" v-for="item in typeEnums" :key="item.label" />
class="filter-item"
@keyup.enter.native="getTableDatatype"
/>
<el-input
v-model="querytypedialogshowquery.conTypeCode"
size="small"
clearable
placeholder="请输入耗材类型代码"
style="width: 100%"
class="filter-item"
@keyup.enter.native="getTableDatatype"
/>
<el-select
v-model="querytypedialogshowquery.status"
placeholder="请选择商品规格"
style="width: 100%"
>
<el-option
:label="item.label"
:value="item.value"
v-for="item in typeEnums"
:key="item.label"
/>
</el-select> </el-select>
<div style="margin-top: 10px"> <div style="margin-top: 10px">
<el-button type="primary" @click="getTableDatatype">查询</el-button> <el-button type="primary" @click="getTableDatatype">查询</el-button>
<el-button @click="resetHandletype">重置</el-button> <el-button @click="resetHandletype">重置</el-button>
</div> </div>
</div> </div>
<el-table <el-table ref="table" :data="tableDatatype.data" v-loading="tableDatatype.loading" row-key="id">
ref="table"
:data="tableDatatype.data"
v-loading="tableDatatype.loading"
row-key="id"
>
<el-table-column label="耗材类型名称" prop="conTypeName" /> <el-table-column label="耗材类型名称" prop="conTypeName" />
<el-table-column label="耗材类型代码" prop="conTypeCode" /> <el-table-column label="耗材类型代码" prop="conTypeCode" />
<el-table-column label="店铺ID" prop="shopId" /> <el-table-column label="店铺ID" prop="shopId" />
@ -435,30 +317,19 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
<div class="head-container"> <div class="head-container">
<el-pagination <el-pagination :total="tableDatatype.total" :current-page="tableDatatype.page + 1"
:total="tableDatatype.total" :page-size="tableDatatype.size" layout="total, sizes, prev, pager, next, jumper"
:current-page="tableDatatype.page + 1" @current-change="paginationChangetype" />
:page-size="tableDatatype.size"
layout="total, sizes, prev, pager, next, jumper"
@current-change="paginationChangetype"
/>
</div> </div>
</el-dialog> </el-dialog>
<el-dialog title="耗材信息" :visible.sync="clickseetypedialogshow"> <el-dialog title="耗材信息" :visible.sync="clickseetypedialogshow">
<div class="head-container"> <div class="head-container">
<el-table <el-table ref="table" :data="clickseetableData.data" v-loading="clickseetableData.loading" row-key="id"
ref="table" height="450">
:data="clickseetableData.data"
v-loading="clickseetableData.loading"
row-key="id"
height="450"
>
<el-table-column label="耗材名称" prop="conName" /> <el-table-column label="耗材名称" prop="conName" />
<el-table-column label="变动库存" prop="amount"> <el-table-column label="变动库存" prop="amount">
<template v-slot="scope"> <template v-slot="scope">
<span :class="{ red: scope.row.bizType == '-' }" <span :class="{ red: scope.row.bizType == '-' }">{{ scope.row.bizType }}{{ scope.row.amount }}</span>
>{{ scope.row.bizType }}{{ scope.row.amount }}</span
>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="现有库存" prop="balance" /> <el-table-column label="现有库存" prop="balance" />
@ -466,10 +337,7 @@
<el-table-column label="业务说明" prop="bizName" /> <el-table-column label="业务说明" prop="bizName" />
<!-- <el-table-column label="正负号标识" prop="bizType" /> --> <!-- <el-table-column label="正负号标识" prop="bizType" /> -->
<!-- <el-table-column label="耗材id" prop="consId" /> --> <!-- <el-table-column label="耗材id" prop="consId" /> -->
<el-table-column <el-table-column label="商品信息" prop="productName"></el-table-column>
label="商品信息"
prop="productName"
></el-table-column>
<el-table-column label="创建时间" prop="createTime"></el-table-column> <el-table-column label="创建时间" prop="createTime"></el-table-column>
<!-- <el-table-column label="更新时间" prop="updateTime"> <!-- <el-table-column label="更新时间" prop="updateTime">
<template v-slot="scope"> <template v-slot="scope">
@ -479,24 +347,20 @@
</el-table> </el-table>
</div> </div>
<div class="head-container"> <div class="head-container">
<el-pagination <el-pagination :total="clickseetableData.total" :current-page="clickseetableData.page + 1"
:total="clickseetableData.total" :page-size="clickseetableData.size" layout="total, sizes, prev, pager, next, jumper"
:current-page="clickseetableData.page + 1" @current-change="paginationChangetype" @size-change="(e) => {
:page-size="clickseetableData.size" clickseetableData.size = e;
layout="total, sizes, prev, pager, next, jumper" clickseetableData.page = 0;
@current-change="paginationChangetype" getConsRecord();
@size-change=" }
(e) => { " />
clickseetableData.size = e;
clickseetableData.page = 0;
getConsRecord();
}
"
/>
</div> </div>
</el-dialog> </el-dialog>
<!-- 耗材盘点 --> <!-- 耗材盘点 -->
<AddConsTakin ref="AddConsTakin" @success="resetHandle" /> <AddConsTakin ref="AddConsTakin" @success="resetHandle" />
<!-- 查看详情 -->
<cons-record-detail ref="recodeDetail"></cons-record-detail>
<!-- 导入耗材 --> <!-- 导入耗材 -->
<el-dialog title="导入库存" :visible.sync="dialogVisible"> <el-dialog title="导入库存" :visible.sync="dialogVisible">
<UploadExcel :beforeUpload="excelSuccessUpload" /> <UploadExcel :beforeUpload="excelSuccessUpload" />
@ -508,19 +372,18 @@
import Sortable from "sortablejs"; import Sortable from "sortablejs";
import dayjs from "dayjs"; import dayjs from "dayjs";
import settings from "@/settings"; import settings from "@/settings";
import { upProSort } from "@/api/shop";
function returnPromise(index,prosise){ function returnPromise(index, prosise) {
return new Promise((resolve,reject)=>{ return new Promise((resolve, reject) => {
prosise.then(res=>{ prosise.then(res => {
console.log(res); console.log(res);
resolve({sucees:true}) resolve({ sucees: true })
}).catch(err=>{ }).catch(err => {
console.log(err); console.log(err);
resolve({sucees:false}) resolve({ sucees: false })
}) })
}) })
} }
import { import {
gettbConsType, gettbConsType,
gettbConsInfo, gettbConsInfo,
@ -533,8 +396,10 @@ import AddConsTakin from "../components/addConsTakin";
import { tbConsInfodownload, tbConsInfoinputStock } from '@/api/invoicing' import { tbConsInfodownload, tbConsInfoinputStock } from '@/api/invoicing'
import { downloadFile } from "@/utils"; import { downloadFile } from "@/utils";
import UploadExcel from '@/components/UploadExcel' import UploadExcel from '@/components/UploadExcel'
import consRecordDetail from "../components/cons_record_detail";
export default { export default {
components: { AddConsTakin, UploadExcel }, components: { AddConsTakin, UploadExcel, consRecordDetail },
data() { data() {
return { return {
dayjs, dayjs,
@ -599,7 +464,7 @@ export default {
total: 0 total: 0
}, },
ruleFormLoading: false, ruleFormLoading: false,
ruleForms:[], ruleForms: [],
ruleForm: { ruleForm: {
conCode: "", conCode: "",
conName: "", conName: "",
@ -652,27 +517,42 @@ export default {
this.gettbConsType() this.gettbConsType()
}, },
methods: { methods: {
lookDetail(row) {
this.$refs.recodeDetail.open({
"consId": row.consId,
"conName": row.conName
})
},
//selectc //selectc
selectChange($event,ref,type){ selectChange($event, ref, type) {
this.$refs[ref][0].validateField(type) this.$refs[ref][0].validateField(type)
}, },
// //
resetRuleForms(){ resetRuleForms() {
this.ruleForms=[{...this.ruleForm}] this.ruleForms = [{ ...this.ruleForm }]
this.$refs['refruleForm0']&&this.$refs['refruleForm0'][0].resetFields() this.$refs['refruleForm0'] && this.$refs['refruleForm0'][0].resetFields()
}, },
// //
ruleFormsReduce(index){ ruleFormsReduce(index) {
if(this.ruleForms.length>1){ if (this.ruleForms.length > 1) {
this.ruleForms.splice(index,1) this.ruleForms.splice(index, 1)
}else{ } else {
this.$message({ type: "error", message: "至少保留一种耗材" }); this.$message({ type: "error", message: "至少保留一种耗材" });
} }
}, },
toGoods(data) {
this.$router.push({
path: '/product/product',
query: {
productId: data.productId
}
})
},
// //
ruleFormsAdd(){ ruleFormsAdd() {
console.log('add') console.log('add')
this.ruleForms.push({...this.ruleForm}) this.ruleForms.push({ ...this.ruleForm })
}, },
// //
async excelSuccessUpload(file) { async excelSuccessUpload(file) {
@ -689,6 +569,22 @@ export default {
console.log(error); console.log(error);
} }
}, },
computedClass(num) {
if (num > 0) {
return 'green'
} else {
return 'red'
}
},
//
async showChange(e, row) {
await postapitbConsInfo([{
id: row.consId,
"isCheck": row.isCheck,
shopId: localStorage.getItem('shopId')
}])
this.$message.success('修改成功')
},
// //
async protHandle() { async protHandle() {
try { try {
@ -707,7 +603,8 @@ export default {
for (let key in this.ruleForm) { for (let key in this.ruleForm) {
this.ruleForm[key] = row[key]; this.ruleForm[key] = row[key];
} }
this.ruleForm.id = row.id; console.log(row, '调试1')
this.ruleForm.id = row.consId;
this.dialogshow = true; this.dialogshow = true;
}, },
// //
@ -736,9 +633,24 @@ export default {
shopId: localStorage.getItem("shopId") shopId: localStorage.getItem("shopId")
}); });
this.tableData.loading = false; this.tableData.loading = false;
this.tableData.data = res.content; // this.tableData.data = res.content;
this.tableData.total = res.totalElements; this.tableData.total = res.totalElements;
this.tableData.data = res.content.map(v => {
const productIds = v.productId ? v.productId.split(',') : []
return {
...v,
product: productIds.map((str, index) => {
const startIndex = str.indexOf('_')
const productId = str.slice(0, startIndex)
const productName = str.slice(startIndex + 1, str.length)
return {
productId,
productName: productName + `${(index == productIds.length - 1) ? '' : ','}`
}
})
}
});
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }
@ -822,7 +734,7 @@ export default {
}); });
} else { } else {
this.dialogtitle = "编辑"; this.dialogtitle = "编辑";
this.ruleForm.id = item.id; this.ruleForm.id = item.consId;
this.ruleForm.conTypeId = item.conTypeId; this.ruleForm.conTypeId = item.conTypeId;
this.ruleForm.conCode = item.conCode; this.ruleForm.conCode = item.conCode;
this.ruleForm.conName = item.conName; this.ruleForm.conName = item.conName;
@ -832,17 +744,17 @@ export default {
} }
this.dialogshow = true; this.dialogshow = true;
}, },
// //
async submitForms() { async submitForms() {
let isAllPassForm=0 let isAllPassForm = 0
for(let i in this.ruleForms){ for (let i in this.ruleForms) {
const res=await returnPromise(i,this.$refs['refruleForm'+i][0].validate()) const res = await returnPromise(i, this.$refs['refruleForm' + i][0].validate())
console.log(res) console.log(res)
isAllPassForm+=res.sucees?1:0 isAllPassForm += res.sucees ? 1 : 0
} }
// //
if(isAllPassForm===this.ruleForms.length){ if (isAllPassForm === this.ruleForms.length) {
await posttbConsInfo( this.ruleForms) await posttbConsInfo(this.ruleForms)
this.$message({ type: "success", message: "添加成功" }); this.$message({ type: "success", message: "添加成功" });
// for(let i of this.ruleForms){ // for(let i of this.ruleForms){
@ -850,9 +762,9 @@ export default {
// this.$message({ type: "success", message: "" }); // this.$message({ type: "success", message: "" });
// } // }
this.dialogshow = false; this.dialogshow = false;
this.resetRuleForms() this.resetRuleForms()
this.ruleFormLoading = false; this.ruleFormLoading = false;
this.getTableData(); this.getTableData();
} }
}, },
// //
@ -862,6 +774,7 @@ export default {
if (valid) { if (valid) {
this.ruleFormLoading = true; this.ruleFormLoading = true;
if (this.dialogtitle == "编辑") { if (this.dialogtitle == "编辑") {
console.log(this.ruleForm, '调试 ')
await postapitbConsInfo([this.ruleForm]); await postapitbConsInfo([this.ruleForm]);
this.$message({ type: "success", message: "编辑成功" }); this.$message({ type: "success", message: "编辑成功" });
this.dialogshow = false; this.dialogshow = false;
@ -876,7 +789,7 @@ export default {
// this.$message({ type: "success", message: "" }); // this.$message({ type: "success", message: "" });
// } // }
} }
this.dialogshow = false; this.dialogshow = false;
this.$refs[formName].resetFields(); this.$refs[formName].resetFields();
@ -934,11 +847,13 @@ export default {
cursor: pointer; cursor: pointer;
font-weight: 700; font-weight: 700;
} }
.color-danger { .color-danger {
color: #f56c6c; color: #f56c6c;
font-weight: 700; font-weight: 700;
cursor: pointer; cursor: pointer;
} }
.row_wrap { .row_wrap {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;

View File

@ -17,6 +17,11 @@
<el-option label="关" :value="0"></el-option> <el-option label="关" :value="0"></el-option>
</el-select> </el-select>
</div> </div>
<div style="width: 300px;">
<el-select clearable v-model="query.sort" placeholder="排序">
<el-option label="按数量排序" value="1" />
</el-select>
</div>
<el-button type="primary" @click="getTableData">查询</el-button> <el-button type="primary" @click="getTableData">查询</el-button>
<el-button @click="resetHandle">重置</el-button> <el-button @click="resetHandle">重置</el-button>
<el-button @click="Uppop()">库存预警:{{ warnLine }}</el-button> <el-button @click="Uppop()">库存预警:{{ warnLine }}</el-button>
@ -155,6 +160,7 @@ export default {
montey: "", montey: "",
categorys: [], categorys: [],
query: { query: {
sort: "", //
name: '', name: '',
isStock: '', isStock: '',
num: '', num: '',
@ -233,7 +239,7 @@ export default {
const file = await stockdownload({ const file = await stockdownload({
name: this.query.name, name: this.query.name,
isStock: this.query.isStock, isStock: this.query.isStock,
num: this.query.num num: this.query.num,
}) })
downloadFile(file, "商品库存", "xlsx"); downloadFile(file, "商品库存", "xlsx");
this.downloadLoading = false; this.downloadLoading = false;
@ -309,6 +315,7 @@ export default {
isStock: this.query.isStock, isStock: this.query.isStock,
num: this.query.num, num: this.query.num,
categoryId: this.query.categoryId, categoryId: this.query.categoryId,
sort:this.query.sort,
shopId: localStorage.getItem('shopId') shopId: localStorage.getItem('shopId')
}) })
this.tableData.loading = false this.tableData.loading = false

View File

@ -13,7 +13,7 @@
</div> </div>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="入库类型" v-if="inTabValue == 'goods'"> <!-- <el-form-item label="入库类型" v-if="inTabValue == 'goods'">
<div class="shop_type_box"> <div class="shop_type_box">
<div class="item" v-for="(item, index) in shopTypes" :key="index" <div class="item" v-for="(item, index) in shopTypes" :key="index"
:class="{ active: shopTypesActive == index }" @click="changeTypeEnum(index)"> :class="{ active: shopTypesActive == index }" @click="changeTypeEnum(index)">
@ -34,11 +34,12 @@
</div> </div>
</div> </div>
</div> </div>
</el-form-item> </el-form-item> -->
<el-row> <el-row>
<el-col :span="8" v-if="shopTypes[shopTypesActive].value == 'purveyor'"> <el-col :span="8">
<el-form-item label="供应商"> <el-form-item label="供应商">
<el-select v-model="queryForm.purveyorId" placeholder="请选择供应商" style="width: 220px;"> <el-select v-model="queryForm.purveyorId" placeholder="请选择供应商" clearable
style="width: 220px;" @change="changeTypeEnum">
<el-option :label="item.purveyorName" :value="item.id" v-for="item in purveyorList" <el-option :label="item.purveyorName" :value="item.id" v-for="item in purveyorList"
:key="item.id"></el-option> :key="item.id"></el-option>
</el-select> </el-select>
@ -93,6 +94,10 @@
v-if="inTabValue == 'consumable'">选择耗材</el-button> v-if="inTabValue == 'consumable'">选择耗材</el-button>
<el-button type="primary" @click="$refs.shopList.show(tableData.list)" v-else>选择商品</el-button> <el-button type="primary" @click="$refs.shopList.show(tableData.list)" v-else>选择商品</el-button>
</el-form-item> </el-form-item>
<el-autocomplete v-model="autocompletename" :fetch-suggestions="querySearchAsync"
:value-key="inTabValue == 'goods' ? 'name' : 'conName'"
:placeholder="inTabValue == 'goods' ? '商品搜索' : '耗材搜索'" @select="handleSelect"
style="width: 500px;"></el-autocomplete>
</el-form> </el-form>
</div> </div>
<div class="head-container"> <div class="head-container">
@ -141,7 +146,8 @@
</el-table-column> --> </el-table-column> -->
<el-table-column label="操作" width="80"> <el-table-column label="操作" width="80">
<template v-slot="scope"> <template v-slot="scope">
<el-button type="text" @click="tableData.list.splice(scope.$index, 1)">删除</el-button> <el-button type="text"
@click="tableData.list.splice(scope.$index, 1), spliceclick()">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -185,7 +191,8 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" width="80"> <el-table-column label="操作" width="80">
<template v-slot="scope"> <template v-slot="scope">
<el-button type="text" @click="tableData.list.splice(scope.$index, 1)">删除</el-button> <el-button type="text"
@click="tableData.list.splice(scope.$index, 1), spliceclick()">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -215,6 +222,7 @@
import dayjs from 'dayjs' import dayjs from 'dayjs'
import shopList from './components/shopList' import shopList from './components/shopList'
import ConsumableList from './components/consumableList' import ConsumableList from './components/consumableList'
import { tbConsInfoGet, tbProductlist } from "@/api/invoicing";
import { tbShopPurveyorGet, tbProductStockOperateOutAndOn, stockInOut } from '@/api/invoicing' import { tbShopPurveyorGet, tbProductStockOperateOutAndOn, stockInOut } from '@/api/invoicing'
import { formatDecimal } from '@/utils' import { formatDecimal } from '@/utils'
export default { export default {
@ -238,7 +246,7 @@ export default {
type: 'in' type: 'in'
} }
], ],
shopTypesActive: 0, shopTypesActive: 1,
shopTypes: [ shopTypes: [
{ {
label: '供应商入库', label: '供应商入库',
@ -290,7 +298,10 @@ export default {
tableData: { tableData: {
list: [] list: []
}, },
showResult: false showResult: false,
autocompletename: '',
restaurants: [],
timeout: null
} }
}, },
mounted() { mounted() {
@ -298,12 +309,84 @@ export default {
this.tbShopPurveyorGet() this.tbShopPurveyorGet()
}, },
methods: { methods: {
async querySearchAsync(queryString, cb) {//
let res = null
if (this.inTabValue == 'goods') {
res = await tbProductlist({
page: 0,
size: 20,
name: queryString ? queryString : '',
shopId: localStorage.getItem('shopId'),
sort: 'id',
})
} else {
res = await tbConsInfoGet({
page: 0,
size: 20,
shopId: localStorage.getItem('shopId'),
conName: queryString ? queryString : ''
})
}
this.restaurants = res.content
if (res.content.length == 0) {//
this.$message('无此商品');
return false
}
var uniqueArray = this.restaurants.filter(item1 =>
!this.tableData.list.some(item2 => item2.productId == item1.id)
);
clearTimeout(this.timeout);
this.timeout = setTimeout(() => {
cb(uniqueArray);
}, 1000 * Math.random());
},
handleSelect(item) {//
this.autocompletename = ''
if (this.inTabValue == 'goods') {
this.selectShop([item])
} else {
this.selectConsumable([item])
}
},
//
spliceclick() {
var zong = 0
if (this.inTabValue == 'goods') {
this.tableData.list.forEach(ele => {
zong += ele.costPrice * ele.number
})
} else {
this.tableData.list.forEach(ele => {
zong += ele.price * ele.stockNumber
})
}
this.queryForm.totalAmount = formatDecimal(zong)
},
//
selectShop(res) {
let arr = []
res.forEach(item => {
item.skuList.forEach(i => {
arr.push({
name: item.name,
unitName: item.unitName,
productId: item.id,
number: 0,
totalAmount: '',
...i
})
})
})
this.tableData.list = [...this.tableData.list, ...arr]
},
// //
tabChange(value, type) { tabChange(value, type) {
console.log(type); this.shopTypesActive = type == 'in' ? 0 : 1
this.inTabValue = value this.inTabValue = value
this.shopTypesActive = 0
this.resetHandle() this.resetHandle()
this.$refs.shopList.clearSelection()//
this.$refs.ConsumableList.clearSelection()//
}, },
// //
consCountTotal(cvalue, row, key1, key2 = undefined) { consCountTotal(cvalue, row, key1, key2 = undefined) {
@ -343,7 +426,6 @@ export default {
} else { } else {
row[key1] = cvalue row[key1] = cvalue
row[key2] = cvalue row[key2] = cvalue
let zong = 0 let zong = 0
this.tableData.list.forEach(ele => { this.tableData.list.forEach(ele => {
zong += ele.costPrice * ele.number zong += ele.costPrice * ele.number
@ -353,6 +435,19 @@ export default {
}, },
// //
submitHandle() { submitHandle() {
if (this.tableData.list.length == 0) {
switch (this.inTabValue) {
case 'goods':
this.$message('请先选择商品!');
break;
case 'consumable':
this.$message('请先选择耗材!');
break;
default:
break;
}
return false
}
this.$refs.queryForm.validate(async valid => { this.$refs.queryForm.validate(async valid => {
if (valid) { if (valid) {
try { try {
@ -375,6 +470,8 @@ export default {
} }
this.queryFormLoading = false this.queryFormLoading = false
this.showResult = true this.showResult = true
this.$refs.shopList.clearSelection()//
this.$refs.ConsumableList.clearSelection()//
} catch (error) { } catch (error) {
console.log(error) console.log(error)
this.queryFormLoading = false this.queryFormLoading = false
@ -384,32 +481,16 @@ export default {
}, },
// //
selectConsumable(res) { selectConsumable(res) {
this.tableData.list = res.map(item => { let arr = res.map(item => {
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.conInfold = item.id
return item return item
}) })
this.tableData.list = [...this.tableData.list, ...arr]
}, },
//
selectShop(res) {
let arr = []
res.forEach(item => {
item.skuList.forEach(i => {
arr.push({
name: item.name,
unitName: item.unitName,
productId: item.id,
number: 0,
totalAmount: '',
...i
})
})
})
console.log(arr)
this.tableData.list = arr
},
// //
resetHandle() { resetHandle() {
this.showResult = false this.showResult = false
@ -421,11 +502,23 @@ export default {
} }
this.tableData.list = [] this.tableData.list = []
this.$refs.queryForm.resetFields() this.$refs.queryForm.resetFields()
this.$refs.queryForm.resetFields()
}, },
// //
changeTypeEnum(index) { changeTypeEnum(index) {
this.shopTypesActive = index console.log(this.inTabValue)
this.queryForm.type = this.shopTypes[index].value if (this.inTabValue == 'consumable') {
return false
}
if (this.queryForm.purveyorId) {
this.shopTypesActive = 0
} else {
this.shopTypesActive = 1
}
this.queryForm.type = this.shopTypes[this.shopTypesActive].value
// console.log(index)
// this.shopTypesActive = index
// this.queryForm.type = this.shopTypes[index].value
}, },
// //
async tbShopPurveyorGet() { async tbShopPurveyorGet() {

View File

@ -13,7 +13,7 @@
</div> </div>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="出库类型" v-if="inTabValue == 'goods'"> <!-- <el-form-item label="出库类型" v-if="inTabValue == 'goods'">
<div class="shop_type_box"> <div class="shop_type_box">
<div class="item" v-for="(item, index) in shopTypes" :key="index" <div class="item" v-for="(item, index) in shopTypes" :key="index"
:class="{ active: shopTypesActive == index }" @click="changeTypeEnum(index)"> :class="{ active: shopTypesActive == index }" @click="changeTypeEnum(index)">
@ -34,11 +34,12 @@
</div> </div>
</div> </div>
</div> </div>
</el-form-item> </el-form-item> -->
<el-row> <el-row>
<el-col :span="8" v-if="shopTypes[shopTypesActive].value == 'reject'"> <el-col :span="8">
<el-form-item label="供应商"> <el-form-item label="供应商">
<el-select v-model="queryForm.purveyorId" placeholder="请选择供应商" style="width: 220px;"> <el-select clearable v-model="queryForm.purveyorId" placeholder="请选择供应商"
style="width: 220px;" @change="changeTypeEnum">
<el-option :label="item.purveyorName" :value="item.id" v-for="item in purveyorList" <el-option :label="item.purveyorName" :value="item.id" v-for="item in purveyorList"
:key="item.id"></el-option> :key="item.id"></el-option>
</el-select> </el-select>
@ -93,6 +94,11 @@
v-if="inTabValue == 'consumable'">选择耗材</el-button> v-if="inTabValue == 'consumable'">选择耗材</el-button>
<el-button type="primary" @click="$refs.shopList.show(tableData.list)" v-else>选择商品</el-button> <el-button type="primary" @click="$refs.shopList.show(tableData.list)" v-else>选择商品</el-button>
</el-form-item> </el-form-item>
<el-autocomplete v-model="autocompletename" :fetch-suggestions="querySearchAsync"
:value-key="inTabValue == 'goods' ? 'name' : 'conName'"
:placeholder="inTabValue == 'goods' ? '商品搜索' : '耗材搜索'" @select="handleSelect"
style="width: 500px;"></el-autocomplete>
</el-form> </el-form>
</div> </div>
<div class="head-container"> <div class="head-container">
@ -137,7 +143,8 @@
</el-table-column> --> </el-table-column> -->
<el-table-column label="操作" width="80"> <el-table-column label="操作" width="80">
<template v-slot="scope"> <template v-slot="scope">
<el-button type="text" @click="tableData.list.splice(scope.$index, 1)">删除</el-button> <el-button type="text"
@click="tableData.list.splice(scope.$index, 1), spliceclick()">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -179,7 +186,8 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" width="80"> <el-table-column label="操作" width="80">
<template v-slot="scope"> <template v-slot="scope">
<el-button type="text" @click="tableData.list.splice(scope.$index, 1)">删除</el-button> <el-button type="text"
@click=" tableData.list.splice(scope.$index, 1), spliceclick()">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -209,7 +217,8 @@
import dayjs from 'dayjs' import dayjs from 'dayjs'
import shopList from './components/shopList' import shopList from './components/shopList'
import ConsumableList from './components/consumableList' import ConsumableList from './components/consumableList'
import { tbShopPurveyorGet, tbProductStockOperateOutAndOn, stockInOut } from '@/api/invoicing' import { tbShopPurveyorGet, tbProductStockOperateOutAndOn, stockInOut, tbConsInfoGet, tbProductlist } from '@/api/invoicing'
import { formatDecimal } from '@/utils' import { formatDecimal } from '@/utils'
export default { export default {
components: { components: {
@ -232,7 +241,7 @@ export default {
type: 'out' type: 'out'
} }
], ],
shopTypesActive: 0, shopTypesActive: 1,
shopTypes: [ shopTypes: [
{ {
label: '供应商退货', label: '供应商退货',
@ -284,7 +293,10 @@ export default {
tableData: { tableData: {
list: [] list: []
}, },
showResult: false showResult: false,
autocompletename: '',
restaurants: [],
timeout: null
} }
}, },
mounted() { mounted() {
@ -292,12 +304,68 @@ export default {
this.tbShopPurveyorGet() this.tbShopPurveyorGet()
}, },
methods: { methods: {
async querySearchAsync(queryString, cb) {//
let res = null
if (this.inTabValue == 'goods') {
res = await tbProductlist({
page: 0,
size: 20,
name: queryString ? queryString : '',
shopId: localStorage.getItem('shopId'),
sort: 'id',
})
} else {
res = await tbConsInfoGet({
page: 0,
size: 20,
shopId: localStorage.getItem('shopId'),
conName: queryString ? queryString : ''
})
}
this.restaurants = res.content
if (res.content.length == 0) {//
this.$message('无此商品');
return false
}
var uniqueArray = this.restaurants.filter(item1 =>
!this.tableData.list.some(item2 => item2.productId == item1.id)
);
clearTimeout(this.timeout);
this.timeout = setTimeout(() => {
cb(uniqueArray);
}, 1000 * Math.random());
},
handleSelect(item) {//
this.autocompletename = ''
if (this.inTabValue == 'goods') {
this.selectShop([item])
} else {
this.selectConsumable([item])
}
},
// //
tabChange(value, type) { tabChange(value, type) {
this.inTabValue = value this.inTabValue = value
this.shopTypesActive = 0 this.shopTypesActive = 1
this.resetHandle() this.resetHandle()
this.queryForm.type = type this.queryForm.type = type
this.$refs.shopList.clearSelection()//
this.$refs.ConsumableList.clearSelection()//
},
//
spliceclick() {
var zong = 0
if (this.inTabValue == 'goods') {
this.tableData.list.forEach(ele => {
zong += ele.costPrice * ele.number
})
} else {
this.tableData.list.forEach(ele => {
zong += ele.price * ele.stockNumber
})
}
this.queryForm.totalAmount = formatDecimal(zong)
}, },
// //
consCountTotal(cvalue, row, key1, key2 = undefined) { consCountTotal(cvalue, row, key1, key2 = undefined) {
@ -347,6 +415,19 @@ export default {
}, },
// //
submitHandle() { submitHandle() {
if (this.tableData.list.length == 0) {
switch (this.inTabValue) {
case 'goods':
this.$message('请先选择商品入!');
break;
case 'consumable':
this.$message('请先选择耗材!');
break;
default:
break;
}
return false
}
this.$refs.queryForm.validate(async valid => { this.$refs.queryForm.validate(async valid => {
if (valid) { if (valid) {
try { try {
@ -370,6 +451,8 @@ export default {
} }
this.queryFormLoading = false this.queryFormLoading = false
this.showResult = true this.showResult = true
this.$refs.shopList.clearSelection()//
this.$refs.ConsumableList.clearSelection()//
} catch (error) { } catch (error) {
console.log(error) console.log(error)
this.queryFormLoading = false this.queryFormLoading = false
@ -379,13 +462,14 @@ export default {
}, },
// //
selectConsumable(res) { selectConsumable(res) {
this.tableData.list = res.map(item => { let arr = res.map(item => {
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.conInfold = item.id
return item return item
}) })
this.tableData.list = [...this.tableData.list, ...arr]
}, },
// //
selectShop(res) { selectShop(res) {
@ -402,8 +486,7 @@ export default {
}) })
}) })
}) })
console.log(arr) this.tableData.list = [...this.tableData.list, ...arr]
this.tableData.list = arr
}, },
// //
resetHandle() { resetHandle() {
@ -419,8 +502,14 @@ export default {
}, },
// //
changeTypeEnum(index) { changeTypeEnum(index) {
this.shopTypesActive = index if (this.queryForm.purveyorId) {
this.queryForm.type = this.shopTypes[index].value this.shopTypesActive = 0
} else {
this.shopTypesActive = 1
}
this.queryForm.type = this.shopTypes[this.shopTypesActive].value
// this.shopTypesActive = index
// this.queryForm.type = this.shopTypes[index].value
}, },
// //
async tbShopPurveyorGet() { async tbShopPurveyorGet() {

View File

@ -2,7 +2,8 @@
<div class="app-container"> <div class="app-container">
<el-form ref="formRef" :model="form" :rules="rules" label-width="140px" label-position="left"> <el-form ref="formRef" :model="form" :rules="rules" label-width="140px" label-position="left">
<el-form-item label="商品类型" prop="typeEnum"> <el-form-item label="商品类型" prop="typeEnum">
<div class="shop_type_box" :class="{ disabled: form.id }"> <div class="shop_type_box" :class="{}">
<!-- <div class="shop_type_box" :class="{ disabled: form.id }"> -->
<div class="item" v-for="(item, index) in shopTypes" :key="index" <div class="item" v-for="(item, index) in shopTypes" :key="index"
:class="{ active: shopTypesActive == index }" @click="changeTypeEnum(index)"> :class="{ active: shopTypesActive == index }" @click="changeTypeEnum(index)">
<div class="s_title">{{ item.label }}</div> <div class="s_title">{{ item.label }}</div>
@ -152,9 +153,9 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div class="tips" v-if="form.isShowMall"> <!-- <div class="tips" v-if="form.isShowMall">
小程序商城必须设置库存数量大于0 小程序商城必须设置库存数量大于0
</div> </div> -->
</el-form-item> </el-form-item>
<template v-if="form.typeEnum == 'group'"> <template v-if="form.typeEnum == 'group'">
<el-form-item label="使用日期说明" prop="notices.dateUsed"> <el-form-item label="使用日期说明" prop="notices.dateUsed">
@ -216,6 +217,7 @@
<uploadImg type="text" :limit="1" @success="res => (scope.row.coverImg = res[0])" <uploadImg type="text" :limit="1" @success="res => (scope.row.coverImg = res[0])"
v-if="!scope.row.coverImg" /> v-if="!scope.row.coverImg" />
<el-image style="width:30px;height:30px;" :src="scope.row.coverImg" v-else /> <el-image style="width:30px;height:30px;" :src="scope.row.coverImg" v-else />
<i class="el-icon-error " v-if="scope.row.coverImg" @click="scope.row.coverImg = ''"></i>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="售价" prop="salePrice"> <el-table-column label="售价" prop="salePrice">
@ -307,9 +309,9 @@
</template> </template>
</el-table-column> --> </el-table-column> -->
</el-table> </el-table>
<div class="tips" v-if="form.isShowMall"> <!-- <div class="tips" v-if="form.isShowMall">
小程序商城必须设置库存数量大于0 小程序商城必须设置库存数量大于0
</div> </div> -->
</el-form-item> </el-form-item>
<template v-if="form.typeEnum != 'group'"> <template v-if="form.typeEnum != 'group'">
<el-form-item label="上架区域"> <el-form-item label="上架区域">
@ -600,6 +602,7 @@ export default {
} }
}) })
}, },
deleteEvent(d) { deleteEvent(d) {
let index = this.imgList.findIndex(ele => ele.url == d.url) let index = this.imgList.findIndex(ele => ele.url == d.url)
this.imgList.splice(index, 1); this.imgList.splice(index, 1);
@ -652,7 +655,6 @@ export default {
); );
this.specTableHeaders = JSON.parse(res.specTableHeaders); this.specTableHeaders = JSON.parse(res.specTableHeaders);
this.selectSpec = JSON.parse(res.selectSpec); this.selectSpec = JSON.parse(res.selectSpec);
console.log(res, '调试11111')
// //
// this.$refs.uploadImg.fileList = res.images.map(item => { // this.$refs.uploadImg.fileList = res.images.map(item => {
// return { // return {
@ -690,12 +692,16 @@ export default {
}, },
// //
submitHandle() { submitHandle() {
console.log("form", this.form); let arr = []
this.imgList.forEach(ele => {
arr.push(ele.url)
})
this.$refs.formRef.validate(async faild => { this.$refs.formRef.validate(async faild => {
try { try {
if (faild) { if (faild) {
this.loading = true; this.loading = true;
this.form.lowPrice = this.form.skuList[0].salePrice; this.form.images = arr
this.form.lowPrice = this.form.skuList.length && this.form.skuList[0].salePrice;
this.form.coverImg = this.form.images[0]; this.form.coverImg = this.form.images[0];
this.form.selectSpec = JSON.stringify(this.selectSpec); this.form.selectSpec = JSON.stringify(this.selectSpec);
this.form.specTableHeaders = JSON.stringify(this.specTableHeaders); this.form.specTableHeaders = JSON.stringify(this.specTableHeaders);
@ -745,12 +751,12 @@ export default {
}, },
// //
changeTypeEnum(index) { changeTypeEnum(index) {
if (this.form.id) return; // if (this.form.id) return;
this.shopTypesActive = index; this.shopTypesActive = index;
const typeEnum = this.shopTypes[index].typeEnum; const typeEnum = this.shopTypes[index].typeEnum;
this.form.typeEnum = typeEnum; this.form.typeEnum = typeEnum;
if (typeEnum == "sku") { if (typeEnum == "sku") {
this.form.skuList = [];
this.tbProductSpecGet(); this.tbProductSpecGet();
} else { } else {
this.specId = ""; this.specId = "";

View File

@ -26,13 +26,38 @@
<el-radio :label="1">启用</el-radio> <el-radio :label="1">启用</el-radio>
<el-radio :label="0">禁用</el-radio> <el-radio :label="0">禁用</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item>
<el-form-item label="售卖时间管控" v-if="form.id">
<el-radio-group v-model="form.useTime">
<el-radio :label="1">启用</el-radio>
<el-radio :label="0">禁用</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="" v-if="form.useTime == 1">
<!-- <el-time-picker is-range v-model="form.saleTime" value-format="HH:mm" format="HH:mm"
:picker-options="pickerOptions" range-separator="至" start-placeholder="开始时间"
end-placeholder="结束时间" placeholder="选择时间范围">
</el-time-picker> -->
<el-time-picker placeholder="起始时间" v-model="form.saleStartTime" :picker-options="{
selectableRange: '00:00:00 - 23:59:59',
format: 'HH:mm'
}" format="HH:mm" value-format="HH:mm">
</el-time-picker>
<el-time-picker placeholder="结束时间" v-model="form.saleEndTime" :picker-options="{
selectableRange: '00:00:00 - 23:59:59',
}" format="HH:mm" value-format="HH:mm">
</el-time-picker>
</el-form-item> </el-form-item>
<el-form-item label="分组排序" v-if="form.id"> <el-form-item label="分组排序" v-if="form.id">
<el-input-number v-model="form.sort" controls-position="right" :min="0"></el-input-number> <el-input-number v-model="form.sort" controls-position="right" :min="0"></el-input-number>
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button> <el-button @click="quxiaodialogVisible"> </el-button>
<el-button type="primary" :loading="loading" @click="onSubmitHandle"> </el-button> <el-button type="primary" :loading="loading" @click="onSubmitHandle"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
@ -57,8 +82,19 @@ export default {
isShow: 1, isShow: 1,
sort: 0, sort: 0,
productIds: [], productIds: [],
saleTime: [],
useTime: 0,
shopId: localStorage.getItem('shopId') shopId: localStorage.getItem('shopId')
}, },
pickerOptions: {
selectableRange: '00:00:00 - 23:59:59'
// disabledDate(time) {
// // return time.getTime() < Date.now() - 8.64e7;//-8.64e7
// // return time.getTime() < Date.now(); //
// return time.getTime() < Date.now() - 8.64e7;//
// }
},
rules: { rules: {
name: [ name: [
{ {
@ -66,12 +102,24 @@ export default {
message: ' ', message: ' ',
trigger: 'blur' trigger: 'blur'
} }
] ],
saleTime: [
{
required: true,
message: '请选择',
trigger: 'blur'
}
],
}, },
productIds: [] productIds: []
} }
}, },
methods: { methods: {
quxiaodialogVisible() {
this.dialogVisible = false
this.$emit('success', null)
},
slectShop(res) { slectShop(res) {
if (this.productIds.length) { if (this.productIds.length) {
res.map(async item => { res.map(async item => {
@ -99,6 +147,7 @@ export default {
this.loading = true this.loading = true
try { try {
this.form.productIds = this.productIds.map(item => item.id); this.form.productIds = this.productIds.map(item => item.id);
let res = null let res = null
if (!this.form.id) { if (!this.form.id) {
await tbProductGroupPost(this.form) await tbProductGroupPost(this.form)
@ -128,12 +177,18 @@ export default {
} }
}, },
show(obj) { show(obj) {
// if()
this.form.useTime = 0
if (obj && obj.id) { if (obj && obj.id) {
this.form = obj
this.form.id = obj.id this.form.id = obj.id
this.form.isShow = obj.isShow this.form.isShow = obj.isShow
this.form.name = obj.name this.form.name = obj.name
this.form.sort = obj.sort this.form.sort = obj.sort
this.form.productIds = obj.productIds this.form.productIds = obj.productIds
// if (obj.saleStartTime != null) {
// this.$set(this.form, 'saleTime', [obj.saleStartTime, obj.saleEndTime])
// }
this.getProduts() this.getProduts()
} }
this.dialogVisible = true this.dialogVisible = true

View File

@ -1,29 +1,31 @@
<template> <template>
<div v-if="dialogVisible"> <div >
<el-dialog title="选择" :visible.sync="dialogVisible" width="1000px"> <el-dialog title="选择图片" :visible.sync="dialogVisible" width="1000px">
<el-container> <el-container>
<el-aside style="background-color: #fff;" width="150px"> <el-aside style="background-color: #fff;" width="150px">
<ul style="padding-left: 0;"> <ul style="padding-left: 0;margin: 0;">
<li style="cursor: pointer;" v-for="item in options" :key="item.id" <li style="cursor: pointer;" v-for="item in options" :key="item.id"
:class="[activedata == item.id ? 'activedata' : '']" @click="changeEvent(item.id)">{{ :class="[activedata == item.id ? 'activedata' : '']" @click="changeEvent(item.id)">
item.name }}</li> {{ item.name }} <span style="font-size: 12px;">({{ item.count }})</span>
</li>
</ul> </ul>
<div class="uplocation" :class="[activedata == -1 ? 'activedata' : '']" @click="uplocation">本地上传 <div class="uplocation" :class="[activedata == -1 ? 'activedata' : '']" @click="uplocation">我的图片
</div> </div>
</el-aside> </el-aside>
<el-main> <el-main>
<imageComponent @onSelectImage="onSelectImage" @getList="getList" :activedata="activedata" <imageComponent @onSelectImage="onSelectImage" @getList="getList" :activedata="activedata"
:list='dataImages'> :list='dataImages'>
</imageComponent> </imageComponent>
<el-pagination layout="prev, pager, next" :total="total" :page-size="20" <mypagination :total="total" @gopageEvent="handleCurrentChange"></mypagination>
<!-- <el-pagination style="position: absolute;right: 60px;" layout="prev, pager, next ,jumper" background :total="total" :page-size="pageSize"
@current-change="handleCurrentChange"> @current-change="handleCurrentChange">
</el-pagination> </el-pagination> -->
</el-main> </el-main>
</el-container> </el-container>
<span slot="footer" class="dialog-footer"> <div style="text-align: center">
<el-button type="success" @click="sumbit"> </el-button>
<el-button @click="dialogVisible = false"> </el-button> <el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="sumbit"> </el-button> </div>
</span>
</el-dialog> </el-dialog>
<!-- <el-select v-model="value" placeholder="请选择" @change="changeEvent"> <!-- <el-select v-model="value" placeholder="请选择" @change="changeEvent">
@ -71,12 +73,13 @@ import { getcommonCategor, getcommonpicture, storeAddcategory, addImg, delcate }
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import { getToken } from "@/utils/auth"; import { getToken } from "@/utils/auth";
import imageComponent from './imageComponent.vue' import imageComponent from './imageComponent.vue'
import mypagination from './mypagination'
export default { export default {
computed: { computed: {
...mapGetters(["qiNiuUploadApi"]) ...mapGetters(["qiNiuUploadApi"])
}, },
components: { components: {
imageComponent imageComponent,mypagination
}, },
data() { data() {
return { return {
@ -95,6 +98,7 @@ export default {
showUpload: false, showUpload: false,
page: 1, page: 1,
total: 0, total: 0,
// pageSize: 18,
activedata: '681' activedata: '681'
} }
}, },
@ -106,11 +110,12 @@ export default {
this.activedata = -1 this.activedata = -1
this.page = 1 this.page = 1
this.dataImages = [] this.dataImages = []
this.total = 0 // this.pageSize = 17
this.getList() this.getList()
}, },
changeEvent(id) { changeEvent(id) {
this.page = 1 this.page = 1
// this.pageSize = 18
this.activedata = id this.activedata = id
this.getList() this.getList()
}, },
@ -194,7 +199,7 @@ export default {
let obj = { let obj = {
category: this.activedata == -1 ? '' : this.activedata, category: this.activedata == -1 ? '' : this.activedata,
page: this.page, page: this.page,
size: this.activedata == -1 ? 17:18, size: 18,
store_id: localStorage.getItem("shopId"), store_id: localStorage.getItem("shopId"),
} }
const res = await getcommonpicture(obj); const res = await getcommonpicture(obj);
@ -218,11 +223,12 @@ export default {
<style scoped> <style scoped>
.activedata { .activedata {
color: #1890ff; color: #1890ff;
/* background-color: #f6f7f8; */
} }
.uplocation { .uplocation {
cursor: pointer; cursor: pointer;
position: absolute; /* position: absolute; */
bottom: 20px; /* bottom: 20px; */
} }
</style> </style>

View File

@ -1,28 +1,26 @@
<template> <template>
<div> <div style="">
<ul class="ulStyle"> <div style="text-align: right;" v-if="activedata == -1">
<li class="upImgStyles" @click="showUpload = true" v-if="activedata == -1"> <span style="color: #aaa;">只能上传pngjgp图片</span>
<el-button @click="showUpload = true" style="background-color: #f6f7f8;">上传文件</el-button>
</div>
<ul class="ulStyle" :class="[activedata == -1 ? '' : 'heightStyle']">
<!-- <li class="upImgStyles" @click="showUpload = true" v-if="activedata == -1">
+ +
</li> </li> -->
<li v-for="item in list" :key="item.id" class="listyle" :class="[selectList.id == item.id ? 'actives' : '']" <li v-for="item in list" :key="item.id" class="listyle" :class="[selectList.id == item.id ? 'actives' : '']"
@click="clickEvent(item)"> @click="clickEvent(item)">
<img :src="item.url" style="width: 100px;height: 100px;" alt=""> <img :src="item.url" style="width: 100px;height: 100px;" alt="">
<!-- <el-popconfirm title="确定删除吗?" class="show" @confirm="deleteEvent(item.id)"> <!-- {{ item.name.substring(0, 6) }} -->
<template v-if="item.pid != '681'">
<template v-if="item.pid != '682'">
<template v-if="item.pid != '699'">
<i class="el-icon-error buttonstyle" slot="reference"></i>
</template>
</template>
</template>
</el-popconfirm> -->
</li> </li>
</ul> </ul>
<template v-if="showUpload"> <template v-if="showUpload">
<el-dialog :visible.sync="showUpload" :close-on-click-modal="false" append-to-body width="1000px" <el-dialog :visible.sync="showUpload" :close-on-click-modal="false" append-to-body width="1000px"
@close="showUpload = false"> @close="showUpload = false">
<el-upload :before-remove="handleBeforeRemove" list-type="picture-card" :on-success="handleSuccess" <el-upload :before-remove="handleBeforeRemove" :before-upload="beforeUpload" list-type="picture-card"
:file-list="fileList" :headers="headers" :action="qiNiuUploadApi" class="upload-demo" multiple> :on-success="handleSuccess" :file-list="fileList" :headers="headers" :action="qiNiuUploadApi"
class="upload-demo" multiple>
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
</el-upload> </el-upload>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
@ -91,6 +89,15 @@ export default {
let index = this.files.findIndex(ele => ele.name == file.name) let index = this.files.findIndex(ele => ele.name == file.name)
this.files.splice(index, 1); this.files.splice(index, 1);
}, },
beforeUpload(file) {
if (file.type == 'image/png') {
} else if (file.type == 'image/jpeg') {
} else {
this.$message.error('只能上传图片')
return false
}
},
clickEvent(d) { clickEvent(d) {
this.selectList = d this.selectList = d
this.$emit('onSelectImage', d) this.$emit('onSelectImage', d)
@ -137,9 +144,14 @@ li {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
overflow: auto; overflow: auto;
height: 400px; height: 402px;
} }
.heightStyle {
height: 402px;
}
.listyle { .listyle {
width: 110px; width: 110px;
height: 110px; height: 110px;
@ -147,6 +159,11 @@ li {
margin-top: 10px; margin-top: 10px;
border: 5px solid #fff; border: 5px solid #fff;
position: relative; position: relative;
text-align: center;
}
.listyle:last-child {
margin-right: auto;
} }
.upImgStyles { .upImgStyles {

View File

@ -0,0 +1,79 @@
<template>
<div class="mypagination">
<i class="el-icon-arrow-left istyle" @click="minuspage" v-show="pgae != 1"></i>
<div>
<span style="color: #42d885;">
{{ pgae }}
</span> / {{ totals }}
</div>
<i class="el-icon-arrow-right istyle" @click="gopage" v-if="pgae != totals"></i>
<div style="width: 26px;" v-else></div>
<el-input v-model='pagego' class="inputStyle" @input="oninputEvent" />
<el-button type="text" @click="gopages">跳转</el-button>
</div>
</template>
<script>
export default {
props: ['total'],
watch: {
totals() {
this.pgae = 1
this.pagego = 1
}
},
computed: {
totals() {
let pagedata = this.total / 18
return pagedata < 0 ? 1 : Math.ceil(pagedata)
}
},
data() {
return { pgae: 1, pagego: 1 }
},
methods: {
oninputEvent(d) {
let a = d.replace(/[^\d]/g, '')
if (a < (this.totals + 1)) {
this.pagego = a
} else {
this.pagego = this.totals
}
},
gopage() {
this.$emit('gopageEvent', ++this.pgae)
this.pagego = this.pgae
},
minuspage() {
this.$emit('gopageEvent', --this.pgae)
this.pagego = this.pgae
},
gopages() {
this.pgae = this.pagego
this.$emit('gopageEvent', this.pagego)
}
}
}
</script>
<style scoped>
.mypagination {
display: flex;
align-items: center;
justify-content: flex-end
}
.istyle {
background-color: #f6f7f8;
width: 26px;
height: 26px;
line-height: 26px;
text-align: center;
}
.inputStyle {
width: 50px;
margin-right: 10px;
}
</style>

View File

@ -10,6 +10,16 @@
<el-table :data="tableData.list" v-loading="tableData.loading" row-key="id"> <el-table :data="tableData.list" v-loading="tableData.loading" row-key="id">
<el-table-column label="排序" sortable prop="sort"></el-table-column> <el-table-column label="排序" sortable prop="sort"></el-table-column>
<el-table-column label="分组名称" prop="name"></el-table-column> <el-table-column label="分组名称" prop="name"></el-table-column>
<el-table-column label="售卖时间管控" prop="useTime">
<template v-slot="scope">
<template v-if="scope.row.useTime == 1">
<!-- {{ scope.row.saleStartTime + '-' + (scope.row.saleEndTime) }} -->
{{ saleEndTimeFilter(scope.row.saleStartTime, scope.row.saleEndTime) }}
<!-- {{ new Date(scope.row.saleEndTime+'').getTime() }} -->
</template>
</template>
</el-table-column>
<el-table-column label="状态"> <el-table-column label="状态">
<template v-slot="scope"> <template v-slot="scope">
<el-switch v-model="scope.row.isShow" :active-value="1" :inactive-value="0" <el-switch v-model="scope.row.isShow" :active-value="1" :inactive-value="0"
@ -61,8 +71,22 @@ export default {
this.tableDrag() this.tableDrag()
}) })
} }
},
filters: {
}, },
methods: { methods: {
saleEndTimeFilter: (a, b) => {
var currentDate = new Date(); //
var dateString = currentDate.toDateString(); //
var dateTimeString = dateString + ' ' + a; //
var dateTimeStringb = dateString + ' ' + b; //
var timestamp = Date.parse(dateTimeString); //
var timestamp2 = Date.parse(dateTimeStringb); //
let ciri = timestamp > timestamp2 ? '次日' : ''
return a + ' - ' + ciri + b
},
// //
tableDrag() { tableDrag() {
const el = document.querySelector('#table_drag .el-table__body-wrapper tbody') const el = document.querySelector('#table_drag .el-table__body-wrapper tbody')

View File

@ -53,6 +53,9 @@
<template v-slot="scope"> <template v-slot="scope">
<span>{{ scope.row.lowPrice }}</span> <span>{{ scope.row.lowPrice }}</span>
</template> </template>
</el-table-column>
<el-table-column label="商品规格" prop="typeEnum">
</el-table-column> </el-table-column>
<el-table-column label="销量/库存"> <el-table-column label="销量/库存">
<template v-slot="scope"> <template v-slot="scope">
@ -127,6 +130,7 @@ export default {
} }
}, },
async mounted() { async mounted() {
console.log(this.$route.query.productId,'tiaoshi1')
if (this.$route.query.productId) { if (this.$route.query.productId) {
this.query.productId = this.$route.query.productId this.query.productId = this.$route.query.productId
} }
@ -203,11 +207,11 @@ export default {
try { try {
let localQuery = JSON.parse(localStorage.getItem('shopIndexQuery')) let localQuery = JSON.parse(localStorage.getItem('shopIndexQuery'))
if (localQuery != null && localQuery.hasOwnProperty('productId')) { if (localQuery != null && localQuery.hasOwnProperty('productId')) {
this.query = localQuery // this.query = localQuery
} }
this.tableData.loading = true this.tableData.loading = true
console.log(this.query) console.log(this.query,'调试2')
const res = await tbProduct({ const res = await tbProduct({
page: this.tableData.page, page: this.tableData.page,
size: this.tableData.size, size: this.tableData.size,

View File

@ -69,7 +69,7 @@
}" format="HH:mm" value-format="HH:mm"> }" format="HH:mm" value-format="HH:mm">
</el-time-picker> </el-time-picker>
<el-time-picker placeholder="结束时间" v-model="endTime" :picker-options="{ <el-time-picker placeholder="结束时间" v-model="endTime" :picker-options="{
selectableRange: `${startTime}:00 - 23:59:59` selectableRange:'00:00:00 - 23:59:59',
}" format="HH:mm" value-format="HH:mm"> }" format="HH:mm" value-format="HH:mm">
</el-time-picker> </el-time-picker>
</el-form-item> </el-form-item>

View File

@ -0,0 +1,177 @@
<template>
<div class="app-container">
<div class="head-container">
<el-row :gutter="20">
<el-col :span="3">
店铺推送 <el-switch v-model="alldata.allState" :active-value="1" :inactive-value="0"
@change="changeEvent(alldata.allState, '')"></el-switch>
</el-col>
<el-col :span="3">
耗材: <el-switch v-model="alldata.conState" :active-value="1" :inactive-value="0"
@change="changeEvent(alldata.conState, 1)"></el-switch>
</el-col>
<el-col :span="3">
操作商品: <el-switch v-model="alldata.opeState" :active-value="1" :inactive-value="0"
@change="changeEvent(alldata.opeState, 2)"></el-switch>
</el-col>
<el-col :span="3">
商品库存 <el-switch v-model="alldata.stockState" :active-value="1" :inactive-value="0"
@change="changeEvent(alldata.stockState, 0)"></el-switch>
</el-col>
</el-row>
</div>
<div class="head-container" id="table_drag">
<el-table ref="table" :data="tableData.data" v-loading="tableData.loading" row-key="id">
<el-table-column label="头像">
<template v-slot="scope">
<div class="shop_info">
<el-image :src="scope.row.avatar"
style="width: 50px;height: 50px;border-radius: 4px;background-color: #efefef;">
<div class="img_error" slot="error">
<i class="icon el-icon-document-delete"></i>
</div>
</el-image>
</div>
</template>
</el-table-column>
<el-table-column label="昵称" prop="nickname"> </el-table-column>
<el-table-column label="商品库存" prop="createdAt">
<template v-slot="scope">
<el-switch v-model="scope.row.proState" :active-value="1" :inactive-value="0"
@change="changeHot(scope.row.proState, 0, scope.row.openId)"></el-switch>
</template>
</el-table-column>
<el-table-column label="耗材" prop="createdAt">
<template v-slot="scope">
<el-switch v-model="scope.row.conState" :active-value="1" :inactive-value="0"
@change="changeHot(scope.row.conState, 1, scope.row.openId)"></el-switch>
</template>
</el-table-column>
<el-table-column label="操作商品" prop="createdAt">
<template v-slot="scope">
<el-switch v-model="scope.row.opeState" :active-value="1" :inactive-value="0"
@change="changeHot(scope.row.opeState, 2, scope.row.openId)"></el-switch>
</template>
</el-table-column>
<el-table-column label="操作" width="200">
<template v-slot="scope">
<el-popconfirm title="确定解绑吗?" @confirm="delTableHandle(scope.row.openId)">
<el-button type="text" slot="reference">解绑</el-button>
</el-popconfirm>
</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" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
</div>
</div>
</template>
<script>
import { msgall, msginfo, shopState, state, delmsg } from '@/api/notifications'
export default {
data() {
return {
test: "1",
tableData: {
data: [],
page: 1,
size: 30,
loading: false,
total: 0
},
alldata: {
allState: 0,
conState: 0,
opeState: 0,
stockState: 0,
}
}
},
mounted() {
this.getTableData()
this.getlist()
},
methods: {
async getlist() {
let res = await state({
shopId: localStorage.getItem('shopId'),
})
this.alldata = res
},
async changeEvent(state, type) {
let res = await shopState({
shopId: localStorage.getItem('shopId'),
type,
state
})
},
//
async changeHot(row, index, openId) {
// index 0 1 2
let obj = {
shopId: localStorage.getItem('shopId'),
type: index,
state: row, openId
}
let res = await msginfo(obj)
this.$message.success('修改成功!')
this.getTableData()
},
//
paginationChange(e) {
this.tableData.page = e - 1
this.getTableData()
},
//
async getTableData() {
try {
this.tableData.loading = true
const res = await msgall({
page: this.tableData.page,
size: this.tableData.size,
shopId: localStorage.getItem('shopId')
})
this.tableData.loading = false
this.tableData.data = res.records
this.tableData.total = res.total
} catch (error) {
console.log(error)
}
},
//
async delTableHandle(ids) {
try {
await delmsg({
shopId: localStorage.getItem('shopId'),
openId: ids
})
this.getTableData()
} catch (error) {
console.log(error)
}
},
}
}
</script>
<style scoped lang="scss">
.shop_info {
display: flex;
.info {
flex: 1;
padding-left: 8px;
display: flex;
flex-direction: column;
.tag_wrap {
display: flex;
}
}
}
</style>

View File

@ -15,6 +15,12 @@
<el-button type="primary" icon="el-icon-plus" @click="$refs.addActive.show()"> <el-button type="primary" icon="el-icon-plus" @click="$refs.addActive.show()">
添加活动 添加活动
</el-button> </el-button>
<el-button type="primary" icon="el-icon-plus" @click="$refs.downloadQR.show()">
下载会员充值二维码
</el-button>
<div style="margin-top: 35px; font-size: 16px; color: #333;">
允许充值自定义金额<el-switch v-model="shopInfo.isCustom" active-value="1" inactive-value="0" size="large" @change="customStatusChange"></el-switch>
</div>
</div> </div>
<div class="head-container"> <div class="head-container">
<el-table :data="tableData.data" v-loading="tableData.loading"> <el-table :data="tableData.data" v-loading="tableData.loading">
@ -51,17 +57,20 @@
@current-change="paginationChange" layout="total"></el-pagination> @current-change="paginationChange" layout="total"></el-pagination>
</div> </div>
<addActive ref="addActive" @success="getTableData" /> <addActive ref="addActive" @success="getTableData" />
<QR ref="downloadQR"></QR>
</div> </div>
</template> </template>
<script> <script>
import handselTypes from './handselTypes' import handselTypes from './handselTypes'
import addActive from './components/addActive' import addActive from './components/addActive'
import QR from './components/downloadQR.vue'
import { findActivate, modityActivate } from '@/api/shop' import { findActivate, modityActivate } from '@/api/shop'
import { tbShopInfo, tbShopInfoPut } from "@/api/user";
import dayjs from 'dayjs' import dayjs from 'dayjs'
export default { export default {
components: { components: {
addActive addActive, QR
}, },
data() { data() {
return { return {
@ -74,6 +83,9 @@ export default {
size: 10, size: 10,
loading: false, loading: false,
total: 0 total: 0
},
shopInfo: {
isCustom: '0',
} }
} }
}, },
@ -87,6 +99,7 @@ export default {
}, },
mounted() { mounted() {
this.getTableData() this.getTableData()
this.getShopInfo()
}, },
methods: { methods: {
// //
@ -126,7 +139,29 @@ export default {
} catch (error) { } catch (error) {
console.log(error) console.log(error)
} }
},
//
async getShopInfo() {
try {
const res = await tbShopInfo(localStorage.getItem('shopId'))
this.shopInfo = res
if (this.shopInfo.isCustom == null) {
this.shopInfo.isCustom = '0'
}
console.log(this.shopInfo);
} catch (error) {
console.log(error)
}
},
customStatusChange() {
this.updateShopInfo()
},
async updateShopInfo() {
await tbShopInfoPut(this.shopInfo)
} }
} }
} }
</script> </script>

View File

@ -0,0 +1,76 @@
<template>
<div class="downloadQR" v-show="isshow">
<div class="box">
<img :src="imgUrl" style="width: 300px;height: 300px;" alt="">
<div class="btnStyle">
<el-button type="primary" @click="isshow = false">取消</el-button>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a :href="imgUrl"><el-button type="primary" @click="downImg">下载</el-button></a>
</div>
</div>
</div>
</template>
<script>
import { getwxacode } from '@/api/shop'
export default {
data() {
return {
isshow: false,
imgUrl: ""
}
},
mounted() {
this.getlist()
},
methods: {
show() {
this.isshow = true
},
async getlist() {
let res = await getwxacode({
shopId: localStorage.getItem('shopId')
})
this.imgUrl = res
}, downImg() {
// window.location.href()
window.URL.revokeObjectURL(this.imgUrl)
}
}
}
</script>
<style scoped lang="scss">
.downloadQR {
display: flex;
justify-content: center;
align-items: center;
background-color: rgba($color: #000000, $alpha: .6);
width: 100%;
height: 100%;
position: fixed;
left: 0;
top: 0;
z-index: 9999;
.box {
padding: 20px;
border-radius: 3px;
height: 400px;
width: 340px;
background-color: #fff;
display: flex;
// align-items: center;
// justify-content: center;
flex-direction: column;
}
.btnStyle {
margin-top: 20px;
text-align: center;
}
}
</style>

View File

@ -3,10 +3,7 @@
<div class="head-container"> <div class="head-container">
<el-form :model="query" inline> <el-form :model="query" inline>
<el-form-item label="搜索"> <el-form-item label="搜索">
<el-input <el-input v-model="query.name" placeholder="请输入昵称或手机号"></el-input>
v-model="query.name"
placeholder="请输入昵称或手机号"
></el-input>
</el-form-item> </el-form-item>
<el-form-item label="是否为会员"> <el-form-item label="是否为会员">
<el-select v-model="query.isVip" placeholder="是否是会员"> <el-select v-model="query.isVip" placeholder="是否是会员">
@ -43,9 +40,7 @@
<div class="n">{{ shopInfo.chageTotal || 0 }}</div> <div class="n">{{ shopInfo.chageTotal || 0 }}</div>
</div> </div>
<div class="item"> <div class="item">
<el-button type="success" @click="toPage('charge')" <el-button type="success" @click="toPage('charge')">充值记录</el-button>
>充值记录</el-button
>
<!-- <el-button type="danger" @click="toPage('cost')">消费记录</el-button> --> <!-- <el-button type="danger" @click="toPage('cost')">消费记录</el-button> -->
</div> </div>
</div> </div>
@ -57,10 +52,7 @@
<el-table-column label="用户" prop="headImg" width="200px"> <el-table-column label="用户" prop="headImg" width="200px">
<template v-slot="scope"> <template v-slot="scope">
<div class="user_info"> <div class="user_info">
<el-image <el-image :src="scope.row.headImg" style="width: 40px;height: 40px;flex-shrink: 0;">
:src="scope.row.headImg"
style="width: 40px;height: 40px;flex-shrink: 0;"
>
<div slot="error" class="image-slot"> <div slot="error" class="image-slot">
<i class="el-icon-user"></i> <i class="el-icon-user"></i>
</div> </div>
@ -76,24 +68,16 @@
</el-table-column> </el-table-column>
<el-table-column label="会员" prop="isVip"> <el-table-column label="会员" prop="isVip">
<template v-slot="scope"> <template v-slot="scope">
<el-tag type="warning" v-if="scope.row.isVip" <el-tag type="warning" v-if="scope.row.isVip">会员等级{{ scope.row.isVip }}</el-tag>
>会员等级{{ scope.row.isVip }}</el-tag
>
<span v-else></span> <span v-else></span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="余额" prop="amount"></el-table-column> <el-table-column label="余额" prop="amount"></el-table-column>
<el-table-column label="充值金额" prop="inMoney"></el-table-column>
<el-table-column label="订单数量" prop="orderNumber"></el-table-column>
<el-table-column label="积分" prop="totalScore"></el-table-column> <el-table-column label="积分" prop="totalScore"></el-table-column>
<el-table-column <el-table-column label="手机号" prop="telephone" width="160"></el-table-column>
label="手机号" <el-table-column label="生日" prop="birthDay" width="200"></el-table-column>
prop="telephone"
width="160"
></el-table-column>
<el-table-column
label="生日"
prop="birthDay"
width="200"
></el-table-column>
<el-table-column label="注册时间" prop="createAt" width="200"> <el-table-column label="注册时间" prop="createAt" width="200">
<template v-slot="scope"> <template v-slot="scope">
{{ scope.row.createAt | timeFilter }} {{ scope.row.createAt | timeFilter }}
@ -104,26 +88,24 @@
{{ scope.row.lastLoginAt | timeFilter }} {{ scope.row.lastLoginAt | timeFilter }}
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column label="操作" width="90" fixed="right"> <!-- <el-table-column label="操作" width="200"> -->
<template v-slot="scope"> <!-- <template v-slot="scope">
<el-button type="text" @click="$refs.addActive.show(scope.row)">编辑</el-button> <el-button type="text" @click="">历史订单</el-button>
<el-popconfirm title="确定删除吗?" @confirm="delTableHandle([scope.row.id])"> <el-button type="text" @click="">充值记录</el-button>
<el-button type="text" @click="">余额</el-button> -->
<!-- <el-popconfirm title="确定删除吗?" @confirm="delTableHandle([scope.row.id])">
<el-button type="text" icon="el-icon-delete" style="margin-left: 20px !important;" <el-button type="text" icon="el-icon-delete" style="margin-left: 20px !important;"
slot="reference">删除</el-button> slot="reference">删除</el-button>
</el-popconfirm> </el-popconfirm> -->
</template> <!-- </template> -->
</el-table-column> --> <!-- </el-table-column> -->
</el-table> </el-table>
</div> </div>
<div class="head-container"> <div class="head-container">
<el-pagination <el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
:total="tableData.total" @size-change="sizeChange" @current-change="paginationChange"
:current-page="tableData.page + 1" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
:page-size="tableData.size"
@size-change="sizeChange"
@current-change="paginationChange"
layout="total, sizes, prev, pager, next, jumper"
></el-pagination>
</div> </div>
</div> </div>
</template> </template>