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",
"jsencrypt": "^3.0.0-rc.1",
"jszip": "^3.7.1",
"lodash": "^4.17.21",
"material-components-vue": "^1.2.0",
"mavon-editor": "^2.9.1",
"normalize.css": "7.0.0",

View File

@ -39,12 +39,19 @@ export function puttbConsType(data) {
* @returns
*/
export function gettbConsInfo(params) {
// return request({
// url: '/api/tbConsInfo',
// method: "get",
// params
// });
return request({
url: '/api/tbConsInfo',
url: "/api/viewConInfoFlow",
method: "get",
params
});
params
});
}
/**
* 耗材入库
* @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
});
}
// 获取店铺会员二维码
export function getwxacode(data) {
return request({
url: `/shop/storage/getwxacode`,
method: "post",
data
});
}
/**
* 商家用户列表
* @returns

View File

@ -214,7 +214,9 @@ export default {
try {
const res = await daycount({
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;
} catch (error) {

View File

@ -13,7 +13,8 @@
<el-radio-button label="custom">自定义</el-radio-button>
</el-radio-group>
<el-date-picker v-model="query.createdAt" type="daterange" range-separator="" start-placeholder="开始日期"
end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" value-format="yyyyMMdd">
end-placeholder="结束日期" :clearable="false" :default-time="['00:00:00', '23:59:59']"
value-format="yyyyMMdd">
</el-date-picker>
<el-form-item>
<el-button type="primary" @click="getTableData">查询</el-button>
@ -27,7 +28,6 @@
<el-table-column type="index" width="50">
</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="orderNum"></el-table-column>
<el-table-column label="应交金额" prop="payable"></el-table-column>
@ -50,9 +50,10 @@
</div>
</template>
</el-table-column>
<el-table-column label="">
<el-table-column label="" width='120px'>
<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>
</el-table-column>
</el-table>
@ -63,9 +64,9 @@
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
</div>
<el-dialog title="商品销量" :visible.sync="dialogshow">
<el-table :data="tableDatainfo.data" style="width: 100%">
<el-table-column prop="productName" label="商品名称"/>
<el-table-column prop="num" label="数量"/>
<el-table :data="tableDatainfo.data" style="width: 100%;height: 500px;overflow: auto;">
<el-table-column prop="productName" label="商品名称" />
<el-table-column prop="num" label="数量" />
<el-table-column prop="amount" label="金额" />
</el-table>
</el-dialog>
@ -74,6 +75,7 @@
<script>
import { tbHandoverGet } from '@/api/homes/record.js'
import XLSX from 'xlsx';
import dayjs from "dayjs";
export default {
data() {
@ -240,8 +242,23 @@ export default {
//
clicksee(e) {
this.dialogshow = true
console.log(JSON.parse(e.productInfos))
// console.log(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> -->
</div>
<div class="head-container">
<!-- <div class="head-container">
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
@current-change="paginationChange" @size-change="sizeChange"
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
</div>
</div> -->
</div>
</template>

View File

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

View File

@ -3,13 +3,13 @@
<el-dialog title="选择耗材" :visible.sync="dialogVisible" @open="resetHandle()">
<el-form :model="searchForm" inline>
<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-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-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-button type="primary" @click="getTableData">查询</el-button>
@ -17,7 +17,8 @@
</el-form-item>
</el-form>
<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 label="耗材名称" prop="conName"></el-table-column>
<el-table-column label="价格" prop="price"></el-table-column>
@ -50,6 +51,8 @@
<script>
import { formatDecimal } from '@/utils'
import { tbConsInfoGet } from "@/api/invoicing";
import _ from 'lodash'
export default {
data() {
return {
@ -69,13 +72,23 @@ export default {
loading: false,
list: []
},
goods: []
goods: [],
stayselection: []
}
},
mounted() {
this.resetSearchForm = { ...this.searchForm }
},
methods: {
onInput: _.debounce(function (event) { //
this.getTableData()
}, 500),
onSelectionChange(selection) {
this.stayselection = selection
},
getRowKey(row) {
return row.id
},
firstSelectChange() {
// console.log(selection)
let selection = this.$refs.table.selection
@ -84,10 +97,16 @@ export default {
this.$refs.table.toggleRowSelection(del_row, false);
}
},
//
confirmHandle() {
let res = this.$refs.table.selection
this.$emit('success', res)
// let res = this.$refs.table.selection
// 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()
},
//

View File

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

View File

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

View File

@ -17,6 +17,11 @@
<el-option label="关" :value="0"></el-option>
</el-select>
</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 @click="resetHandle">重置</el-button>
<el-button @click="Uppop()">库存预警:{{ warnLine }}</el-button>
@ -155,6 +160,7 @@ export default {
montey: "",
categorys: [],
query: {
sort: "", //
name: '',
isStock: '',
num: '',
@ -233,7 +239,7 @@ export default {
const file = await stockdownload({
name: this.query.name,
isStock: this.query.isStock,
num: this.query.num
num: this.query.num,
})
downloadFile(file, "商品库存", "xlsx");
this.downloadLoading = false;
@ -309,6 +315,7 @@ export default {
isStock: this.query.isStock,
num: this.query.num,
categoryId: this.query.categoryId,
sort:this.query.sort,
shopId: localStorage.getItem('shopId')
})
this.tableData.loading = false

View File

@ -13,7 +13,7 @@
</div>
</div>
</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="item" v-for="(item, index) in shopTypes" :key="index"
:class="{ active: shopTypesActive == index }" @click="changeTypeEnum(index)">
@ -34,11 +34,12 @@
</div>
</div>
</div>
</el-form-item>
</el-form-item> -->
<el-row>
<el-col :span="8" v-if="shopTypes[shopTypesActive].value == 'purveyor'">
<el-col :span="8">
<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"
:key="item.id"></el-option>
</el-select>
@ -93,6 +94,10 @@
v-if="inTabValue == 'consumable'">选择耗材</el-button>
<el-button type="primary" @click="$refs.shopList.show(tableData.list)" v-else>选择商品</el-button>
</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>
</div>
<div class="head-container">
@ -141,7 +146,8 @@
</el-table-column> -->
<el-table-column label="操作" width="80">
<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>
</el-table-column>
</el-table>
@ -185,7 +191,8 @@
</el-table-column>
<el-table-column label="操作" width="80">
<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>
</el-table-column>
</el-table>
@ -215,6 +222,7 @@
import dayjs from 'dayjs'
import shopList from './components/shopList'
import ConsumableList from './components/consumableList'
import { tbConsInfoGet, tbProductlist } from "@/api/invoicing";
import { tbShopPurveyorGet, tbProductStockOperateOutAndOn, stockInOut } from '@/api/invoicing'
import { formatDecimal } from '@/utils'
export default {
@ -238,7 +246,7 @@ export default {
type: 'in'
}
],
shopTypesActive: 0,
shopTypesActive: 1,
shopTypes: [
{
label: '供应商入库',
@ -290,7 +298,10 @@ export default {
tableData: {
list: []
},
showResult: false
showResult: false,
autocompletename: '',
restaurants: [],
timeout: null
}
},
mounted() {
@ -298,12 +309,84 @@ export default {
this.tbShopPurveyorGet()
},
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) {
console.log(type);
this.shopTypesActive = type == 'in' ? 0 : 1
this.inTabValue = value
this.shopTypesActive = 0
this.resetHandle()
this.$refs.shopList.clearSelection()//
this.$refs.ConsumableList.clearSelection()//
},
//
consCountTotal(cvalue, row, key1, key2 = undefined) {
@ -343,7 +426,6 @@ export default {
} else {
row[key1] = cvalue
row[key2] = cvalue
let zong = 0
this.tableData.list.forEach(ele => {
zong += ele.costPrice * ele.number
@ -353,6 +435,19 @@ export default {
},
//
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 => {
if (valid) {
try {
@ -375,6 +470,8 @@ export default {
}
this.queryFormLoading = false
this.showResult = true
this.$refs.shopList.clearSelection()//
this.$refs.ConsumableList.clearSelection()//
} catch (error) {
console.log(error)
this.queryFormLoading = false
@ -384,32 +481,16 @@ export default {
},
//
selectConsumable(res) {
this.tableData.list = res.map(item => {
let arr = res.map(item => {
item.number = formatDecimal(item.stockNumber - item.stockConsume, 2, true)
item.stockNumber = 0
item.costPrice = item.price
item.conInfold = item.id
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() {
this.showResult = false
@ -421,11 +502,23 @@ export default {
}
this.tableData.list = []
this.$refs.queryForm.resetFields()
this.$refs.queryForm.resetFields()
},
//
changeTypeEnum(index) {
this.shopTypesActive = index
this.queryForm.type = this.shopTypes[index].value
console.log(this.inTabValue)
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() {

View File

@ -13,7 +13,7 @@
</div>
</div>
</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="item" v-for="(item, index) in shopTypes" :key="index"
:class="{ active: shopTypesActive == index }" @click="changeTypeEnum(index)">
@ -34,11 +34,12 @@
</div>
</div>
</div>
</el-form-item>
</el-form-item> -->
<el-row>
<el-col :span="8" v-if="shopTypes[shopTypesActive].value == 'reject'">
<el-col :span="8">
<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"
:key="item.id"></el-option>
</el-select>
@ -93,6 +94,11 @@
v-if="inTabValue == 'consumable'">选择耗材</el-button>
<el-button type="primary" @click="$refs.shopList.show(tableData.list)" v-else>选择商品</el-button>
</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>
</div>
<div class="head-container">
@ -137,7 +143,8 @@
</el-table-column> -->
<el-table-column label="操作" width="80">
<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>
</el-table-column>
</el-table>
@ -179,7 +186,8 @@
</el-table-column>
<el-table-column label="操作" width="80">
<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>
</el-table-column>
</el-table>
@ -209,7 +217,8 @@
import dayjs from 'dayjs'
import shopList from './components/shopList'
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'
export default {
components: {
@ -232,7 +241,7 @@ export default {
type: 'out'
}
],
shopTypesActive: 0,
shopTypesActive: 1,
shopTypes: [
{
label: '供应商退货',
@ -284,7 +293,10 @@ export default {
tableData: {
list: []
},
showResult: false
showResult: false,
autocompletename: '',
restaurants: [],
timeout: null
}
},
mounted() {
@ -292,12 +304,68 @@ export default {
this.tbShopPurveyorGet()
},
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) {
this.inTabValue = value
this.shopTypesActive = 0
this.shopTypesActive = 1
this.resetHandle()
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) {
@ -347,6 +415,19 @@ export default {
},
//
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 => {
if (valid) {
try {
@ -370,6 +451,8 @@ export default {
}
this.queryFormLoading = false
this.showResult = true
this.$refs.shopList.clearSelection()//
this.$refs.ConsumableList.clearSelection()//
} catch (error) {
console.log(error)
this.queryFormLoading = false
@ -379,13 +462,14 @@ export default {
},
//
selectConsumable(res) {
this.tableData.list = res.map(item => {
let arr = res.map(item => {
item.number = formatDecimal(item.stockNumber - item.stockConsume, 2, true)
item.stockNumber = 0
item.costPrice = item.price
item.conInfold = item.id
return item
})
this.tableData.list = [...this.tableData.list, ...arr]
},
//
selectShop(res) {
@ -402,8 +486,7 @@ export default {
})
})
})
console.log(arr)
this.tableData.list = arr
this.tableData.list = [...this.tableData.list, ...arr]
},
//
resetHandle() {
@ -419,8 +502,14 @@ export default {
},
//
changeTypeEnum(index) {
this.shopTypesActive = index
this.queryForm.type = this.shopTypes[index].value
if (this.queryForm.purveyorId) {
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() {

View File

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

View File

@ -26,13 +26,38 @@
<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.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 label="分组排序" v-if="form.id">
<el-input-number v-model="form.sort" controls-position="right" :min="0"></el-input-number>
</el-form-item>
</el-form>
<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>
</span>
</el-dialog>
@ -57,8 +82,19 @@ export default {
isShow: 1,
sort: 0,
productIds: [],
saleTime: [],
useTime: 0,
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: {
name: [
{
@ -66,12 +102,24 @@ export default {
message: ' ',
trigger: 'blur'
}
]
],
saleTime: [
{
required: true,
message: '请选择',
trigger: 'blur'
}
],
},
productIds: []
}
},
methods: {
quxiaodialogVisible() {
this.dialogVisible = false
this.$emit('success', null)
},
slectShop(res) {
if (this.productIds.length) {
res.map(async item => {
@ -99,6 +147,7 @@ export default {
this.loading = true
try {
this.form.productIds = this.productIds.map(item => item.id);
let res = null
if (!this.form.id) {
await tbProductGroupPost(this.form)
@ -128,12 +177,18 @@ export default {
}
},
show(obj) {
// if()
this.form.useTime = 0
if (obj && obj.id) {
this.form = obj
this.form.id = obj.id
this.form.isShow = obj.isShow
this.form.name = obj.name
this.form.sort = obj.sort
this.form.productIds = obj.productIds
// if (obj.saleStartTime != null) {
// this.$set(this.form, 'saleTime', [obj.saleStartTime, obj.saleEndTime])
// }
this.getProduts()
}
this.dialogVisible = true

View File

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

View File

@ -1,28 +1,26 @@
<template>
<div>
<ul class="ulStyle">
<li class="upImgStyles" @click="showUpload = true" v-if="activedata == -1">
<div style="">
<div style="text-align: right;" 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' : '']"
@click="clickEvent(item)">
<img :src="item.url" style="width: 100px;height: 100px;" alt="">
<!-- <el-popconfirm title="确定删除吗?" class="show" @confirm="deleteEvent(item.id)">
<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> -->
<!-- {{ item.name.substring(0, 6) }} -->
</li>
</ul>
<template v-if="showUpload">
<el-dialog :visible.sync="showUpload" :close-on-click-modal="false" append-to-body width="1000px"
@close="showUpload = false">
<el-upload :before-remove="handleBeforeRemove" list-type="picture-card" :on-success="handleSuccess"
:file-list="fileList" :headers="headers" :action="qiNiuUploadApi" class="upload-demo" multiple>
<el-upload :before-remove="handleBeforeRemove" :before-upload="beforeUpload" list-type="picture-card"
:on-success="handleSuccess" :file-list="fileList" :headers="headers" :action="qiNiuUploadApi"
class="upload-demo" multiple>
<i class="el-icon-plus"></i>
</el-upload>
<div slot="footer" class="dialog-footer">
@ -91,6 +89,15 @@ export default {
let index = this.files.findIndex(ele => ele.name == file.name)
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) {
this.selectList = d
this.$emit('onSelectImage', d)
@ -137,9 +144,14 @@ li {
display: flex;
flex-wrap: wrap;
overflow: auto;
height: 400px;
height: 402px;
}
.heightStyle {
height: 402px;
}
.listyle {
width: 110px;
height: 110px;
@ -147,6 +159,11 @@ li {
margin-top: 10px;
border: 5px solid #fff;
position: relative;
text-align: center;
}
.listyle:last-child {
margin-right: auto;
}
.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-column label="排序" sortable prop="sort"></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="状态">
<template v-slot="scope">
<el-switch v-model="scope.row.isShow" :active-value="1" :inactive-value="0"
@ -61,8 +71,22 @@ export default {
this.tableDrag()
})
}
},
filters: {
},
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() {
const el = document.querySelector('#table_drag .el-table__body-wrapper tbody')

View File

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

View File

@ -69,7 +69,7 @@
}" format="HH:mm" value-format="HH:mm">
</el-time-picker>
<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">
</el-time-picker>
</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>
<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 class="head-container">
<el-table :data="tableData.data" v-loading="tableData.loading">
@ -51,17 +57,20 @@
@current-change="paginationChange" layout="total"></el-pagination>
</div>
<addActive ref="addActive" @success="getTableData" />
<QR ref="downloadQR"></QR>
</div>
</template>
<script>
import handselTypes from './handselTypes'
import addActive from './components/addActive'
import QR from './components/downloadQR.vue'
import { findActivate, modityActivate } from '@/api/shop'
import { tbShopInfo, tbShopInfoPut } from "@/api/user";
import dayjs from 'dayjs'
export default {
components: {
addActive
addActive, QR
},
data() {
return {
@ -74,6 +83,9 @@ export default {
size: 10,
loading: false,
total: 0
},
shopInfo: {
isCustom: '0',
}
}
},
@ -87,6 +99,7 @@ export default {
},
mounted() {
this.getTableData()
this.getShopInfo()
},
methods: {
//
@ -126,7 +139,29 @@ export default {
} catch (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">
<el-form :model="query" inline>
<el-form-item label="搜索">
<el-input
v-model="query.name"
placeholder="请输入昵称或手机号"
></el-input>
<el-input v-model="query.name" placeholder="请输入昵称或手机号"></el-input>
</el-form-item>
<el-form-item label="是否为会员">
<el-select v-model="query.isVip" placeholder="是否是会员">
@ -43,9 +40,7 @@
<div class="n">{{ shopInfo.chageTotal || 0 }}</div>
</div>
<div class="item">
<el-button type="success" @click="toPage('charge')"
>充值记录</el-button
>
<el-button type="success" @click="toPage('charge')">充值记录</el-button>
<!-- <el-button type="danger" @click="toPage('cost')">消费记录</el-button> -->
</div>
</div>
@ -57,10 +52,7 @@
<el-table-column label="用户" prop="headImg" width="200px">
<template v-slot="scope">
<div class="user_info">
<el-image
:src="scope.row.headImg"
style="width: 40px;height: 40px;flex-shrink: 0;"
>
<el-image :src="scope.row.headImg" style="width: 40px;height: 40px;flex-shrink: 0;">
<div slot="error" class="image-slot">
<i class="el-icon-user"></i>
</div>
@ -76,24 +68,16 @@
</el-table-column>
<el-table-column label="会员" prop="isVip">
<template v-slot="scope">
<el-tag type="warning" v-if="scope.row.isVip"
>会员等级{{ scope.row.isVip }}</el-tag
>
<el-tag type="warning" v-if="scope.row.isVip">会员等级{{ scope.row.isVip }}</el-tag>
<span v-else></span>
</template>
</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="telephone"
width="160"
></el-table-column>
<el-table-column
label="生日"
prop="birthDay"
width="200"
></el-table-column>
<el-table-column label="手机号" 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">
<template v-slot="scope">
{{ scope.row.createAt | timeFilter }}
@ -104,26 +88,24 @@
{{ scope.row.lastLoginAt | timeFilter }}
</template>
</el-table-column>
<!-- <el-table-column label="操作" width="90" fixed="right">
<template v-slot="scope">
<el-button type="text" @click="$refs.addActive.show(scope.row)">编辑</el-button>
<el-popconfirm title="确定删除吗?" @confirm="delTableHandle([scope.row.id])">
<!-- <el-table-column label="操作" width="200"> -->
<!-- <template v-slot="scope">
<el-button type="text" @click="">历史订单</el-button>
<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;"
slot="reference">删除</el-button>
</el-popconfirm>
</template>
</el-table-column> -->
</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"
@size-change="sizeChange"
@current-change="paginationChange"
layout="total, sizes, prev, pager, next, jumper"
></el-pagination>
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
@size-change="sizeChange" @current-change="paginationChange"
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
</div>
</div>
</template>