2023-10-19 13:05:47 +08:00
|
|
|
|
<template>
|
2023-10-25 18:20:42 +08:00
|
|
|
|
<div class="app-container">
|
|
|
|
|
<el-card style="margin-top: 20px;">
|
|
|
|
|
<!-- 查询类别 -->
|
|
|
|
|
<el-form :inline="true" :model="queryParams">
|
2024-02-02 18:02:17 +08:00
|
|
|
|
<el-form-item label="品类名称" prop="name">
|
|
|
|
|
<el-input v-model="queryParams.name" placeholder="请输入品类名称" clearable @keyup.enter.native="handleQuery"></el-input>
|
2023-10-25 18:20:42 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="状态">
|
2024-02-02 18:02:17 +08:00
|
|
|
|
<el-select v-model="queryParams.status" placeholder="请选择品类状态" clearable >
|
2023-10-25 18:20:42 +08:00
|
|
|
|
<el-option
|
|
|
|
|
v-for="dict in dict.type.zhzt"
|
|
|
|
|
:key="dict.value"
|
|
|
|
|
:label="dict.label"
|
|
|
|
|
:value="dict.value"/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<!-- <el-form-item>-->
|
|
|
|
|
<!-- <el-button type="primary" icon="el-icon-search" @click="onQuery">搜索</el-button>-->
|
|
|
|
|
<!-- <el-button @click="resetForm" icon="el-icon-refresh" >重置</el-button>-->
|
|
|
|
|
<!-- </el-form-item>-->
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
</el-card>
|
2023-10-19 13:05:47 +08:00
|
|
|
|
|
2023-10-25 18:20:42 +08:00
|
|
|
|
<el-card style="margin-top: 15px;">
|
|
|
|
|
<el-button
|
|
|
|
|
type="primary"
|
|
|
|
|
icon="el-icon-plus"
|
|
|
|
|
@click="handleAdd"
|
2024-02-02 18:02:17 +08:00
|
|
|
|
>添加品类</el-button>
|
|
|
|
|
<!-- <div class="tTop">品类列表-->
|
|
|
|
|
<!-- <el-button type="primary" @click="insertGoods" >添加品类</el-button>-->
|
2023-10-25 18:20:42 +08:00
|
|
|
|
<!-- </div>-->
|
|
|
|
|
<!-- default-expand-all二级菜单默认展开 -->
|
2024-02-02 18:02:17 +08:00
|
|
|
|
<!-- 品类列表 -->
|
|
|
|
|
<!-- :tree-props="{children: 'children', hasChildren: 'hasChildren'}"-->
|
2024-02-03 13:47:34 +08:00
|
|
|
|
<el-table ref="tables" v-loading="loading" :data="list" row-key="id">
|
2024-02-02 18:02:17 +08:00
|
|
|
|
<!-- @selection-change="handleSelectionChange" :default-sort="defaultSort"-->
|
|
|
|
|
<!-- @sort-change="handleSortChange">-->
|
2024-02-03 13:47:34 +08:00
|
|
|
|
<el-table-column type="expand" >
|
2024-02-02 18:02:17 +08:00
|
|
|
|
<template slot-scope="props">
|
2024-02-03 13:47:34 +08:00
|
|
|
|
<el-table ref="tables" :data="props.row.goodsVoList">
|
2024-02-02 18:02:17 +08:00
|
|
|
|
<el-table-column type="index" width="80" align="center" label="序号"/>
|
2024-02-03 13:47:34 +08:00
|
|
|
|
<el-table-column label="商品名称" prop="name" align="center"/>
|
|
|
|
|
<el-table-column label="供应商" prop="supplierName" align="center"/>
|
|
|
|
|
<el-table-column label="条码" prop="goodsNo" align="center" width="250"/>
|
|
|
|
|
<el-table-column label="拼音码" prop="pinyinCode" align="center"/>
|
|
|
|
|
<el-table-column label="货架号" prop="shelfNumber" align="center" />
|
|
|
|
|
<el-table-column label="库存" prop="stock" align="center"/>
|
|
|
|
|
<el-table-column label="单位" prop="unit" align="center"/>
|
2024-02-02 18:02:17 +08:00
|
|
|
|
<el-table-column label="状态" align="center" prop="status">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-tag v-if="scope.row.status=='qy'">上架</el-tag>
|
|
|
|
|
<el-tag type="info" v-if="scope.row.status=='jy'">下架</el-tag>
|
|
|
|
|
<!-- <dict-tag :options="dict.type.zhzt" :value="scope.row.status"/>-->
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="创建时间" align="center" width="160" prop="createTime"/>
|
|
|
|
|
</el-table>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
2024-01-31 17:05:12 +08:00
|
|
|
|
<el-table-column type="index" width="80" align="center" label="序号"/>
|
2024-02-02 18:02:17 +08:00
|
|
|
|
<el-table-column label="品类名称" align="center" prop="name"/>
|
2023-10-25 18:20:42 +08:00
|
|
|
|
<el-table-column label="商品编号" align="center" prop="code"/>
|
|
|
|
|
<el-table-column label="排序" align="center" prop="sorted" />
|
|
|
|
|
<el-table-column label="状态" align="center" prop="status">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<dict-tag :options="dict.type.zhzt" :value="scope.row.status"/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="创建时间" align="center" prop="createTime">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="创建人" align="center" prop="createBy">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<span>{{ getName(scope.row.createBy) }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
2024-02-03 13:47:34 +08:00
|
|
|
|
<el-table-column label="操作" align="center" width="300" fixed='right'>
|
2023-10-25 18:20:42 +08:00
|
|
|
|
<template slot-scope="scope">
|
2024-02-03 13:47:34 +08:00
|
|
|
|
<el-button
|
|
|
|
|
size="mini"
|
|
|
|
|
type="text"
|
|
|
|
|
icon="el-icon-plus"
|
|
|
|
|
@click="addGoods(scope.row)"
|
|
|
|
|
>添加商品信息</el-button>
|
2023-10-25 18:20:42 +08:00
|
|
|
|
<el-button
|
|
|
|
|
size="mini"
|
|
|
|
|
type="text"
|
|
|
|
|
icon="el-icon-edit"
|
|
|
|
|
@click="handleUpdate(scope.row)"
|
2024-02-03 13:47:34 +08:00
|
|
|
|
>修改品类信息</el-button>
|
2023-10-25 18:20:42 +08:00
|
|
|
|
<el-button
|
|
|
|
|
size="mini"
|
|
|
|
|
type="text"
|
|
|
|
|
icon="el-icon-delete"
|
|
|
|
|
@click="handleDelete(scope.row)"
|
|
|
|
|
>删除</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
2023-10-19 13:05:47 +08:00
|
|
|
|
|
2023-10-25 18:20:42 +08:00
|
|
|
|
<pagination
|
|
|
|
|
v-show="total>0"
|
|
|
|
|
:total="total"
|
|
|
|
|
:page.sync="queryParams.page"
|
|
|
|
|
:limit.sync="queryParams.pageSize"
|
|
|
|
|
@pagination="getList"
|
|
|
|
|
/>
|
2023-10-19 13:05:47 +08:00
|
|
|
|
|
2023-10-25 18:20:42 +08:00
|
|
|
|
</el-card>
|
2023-11-25 18:08:20 +08:00
|
|
|
|
|
|
|
|
|
<!-- 添加类别对话框 -->
|
|
|
|
|
<el-dialog :title="title" :visible.sync="open" class="roll-dialog"
|
|
|
|
|
:close-on-click-modal="false" append-to-body width="500px">
|
|
|
|
|
<el-form :model="form" :inline="true" :rules="rules" ref="form" >
|
2024-02-02 18:02:17 +08:00
|
|
|
|
<!-- <el-form-item label="上级品类" >-->
|
|
|
|
|
<!-- <el-select v-model="form.pid" placeholder="请选择上级品类">-->
|
|
|
|
|
<!-- <el-option label="无上级" :value="0">无上级</el-option>-->
|
|
|
|
|
<!-- <el-option-->
|
|
|
|
|
<!-- v-for="item in goodsOptions"-->
|
|
|
|
|
<!-- :label="item.name"-->
|
|
|
|
|
<!-- :value="item.id">-->
|
|
|
|
|
<!-- </el-option>-->
|
|
|
|
|
<!-- </el-select>-->
|
|
|
|
|
<!-- </el-form-item>-->
|
|
|
|
|
<el-form-item label="品类名称" prop="name" style="margin-left: -8px;">
|
2023-11-25 18:08:20 +08:00
|
|
|
|
<el-input v-model="form.name" style="width: 300px;"></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="排序规则">
|
|
|
|
|
<el-input-number v-model="form.sorted" @change="handleChange" :min="0" :max="10" style="width: 300px;"></el-input-number>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item >
|
|
|
|
|
<el-radio-group v-model="form.status">
|
|
|
|
|
<el-radio v-for="dict in dict.type.zhzt" :label="dict.value">{{ dict.label }}</el-radio>
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
|
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
|
|
<el-button @click="cancel">取 消</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</el-dialog>
|
2023-10-19 13:05:47 +08:00
|
|
|
|
|
2024-02-03 13:47:34 +08:00
|
|
|
|
<!-- 添加或修改对话框 -->
|
|
|
|
|
<el-dialog :close-on-click-modal="false" :title="title" :visible.sync="openGoods" append-to-body>
|
|
|
|
|
<el-form ref="form1" :model="form1" :rules="rules1" label-width="90px">
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<el-form-item label="商品条码" prop="goodsNo">
|
|
|
|
|
<el-input v-model="form1.goodsNo"
|
|
|
|
|
@keydown.enter.native="getGoods(form1)"
|
|
|
|
|
:disabled="title == '编辑商品'"
|
|
|
|
|
|
|
|
|
|
clearable
|
|
|
|
|
placeholder="商品的条码信息">
|
|
|
|
|
<el-button slot="append" @click="getGoods(form1)">查询</el-button>
|
|
|
|
|
</el-input>
|
|
|
|
|
<div style="text-align: right;color: grey;font-size: 12px">
|
|
|
|
|
商品无条码?您可以<span style="color: #00afff" @click="createGoodNo">生成条码</span>
|
|
|
|
|
</div>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="商品名称" prop="name">
|
|
|
|
|
<el-input v-model="form1.name" @input="pinyin" placeholder="请输入商品名称"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="所属分类" prop="cvsGoodId">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="form1.cvsGoodId"
|
|
|
|
|
placeholder="全部"
|
|
|
|
|
clearable
|
|
|
|
|
style="width: 300px"
|
|
|
|
|
>
|
|
|
|
|
<el-option v-for="item in goodsOptions" :key="item.id" :label="item.name" :value="item.id"/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item label="拼音码" prop="pinyinCode">
|
|
|
|
|
<el-input v-model="form1.pinyinCode" placeholder="输入商品名称自动回填"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item label="单位" prop="unit">
|
|
|
|
|
<el-input v-model="form1.unit" placeholder="如:个、瓶、包"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item label="货架号" prop="shelfNumber">
|
|
|
|
|
<el-input v-model="form1.shelfNumber" placeholder="如:1-2-2"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
2024-02-04 18:08:43 +08:00
|
|
|
|
<!-- <el-row>-->
|
|
|
|
|
<!-- <el-col :span="8">-->
|
|
|
|
|
<!-- <el-form-item label="是否使用积分抵扣" prop="canUsePoint" label-width="110">-->
|
|
|
|
|
<!-- <el-radio-group v-model="form1.canUsePoint">-->
|
|
|
|
|
<!-- <el-radio v-for="dict in dict.type.yes_or_no" :label="dict.value">{{ dict.label }}</el-radio>-->
|
|
|
|
|
<!-- </el-radio-group>-->
|
|
|
|
|
<!-- </el-form-item>-->
|
|
|
|
|
<!-- </el-col>-->
|
|
|
|
|
<!-- </el-row>-->
|
2024-02-03 13:47:34 +08:00
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<el-form-item label="供应商" prop="supplierId">
|
|
|
|
|
<el-autocomplete
|
|
|
|
|
popper-class="my-autocomplete"
|
|
|
|
|
style="width: 94%"
|
|
|
|
|
v-model="supplier"
|
|
|
|
|
:fetch-suggestions="querySearch"
|
|
|
|
|
placeholder="供应商名称,如果是未添加的供应商,输完名称点回车即可自动添加"
|
|
|
|
|
@change="addSupplier"
|
|
|
|
|
@select="selectSupplier">
|
|
|
|
|
<template slot-scope="{ item }">
|
|
|
|
|
<div style="display: flex;justify-content: space-between">
|
|
|
|
|
<span class="name">{{ item.name }}</span>
|
|
|
|
|
<!-- <span class="addr">{{ item.memberPrice }}</span>-->
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-autocomplete>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="排序" prop="sort">
|
|
|
|
|
<el-input-number v-model="form1.sort" :min="0" label="0"></el-input-number>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="状态" prop="status">
|
|
|
|
|
<el-radio-group v-model="form1.status">
|
|
|
|
|
<!-- <el-radio v-for="dict in dict.type.zhzt" :label="dict.value">{{ dict.label }}</el-radio>-->
|
|
|
|
|
<el-radio label="qy" value="qy">上架</el-radio>
|
|
|
|
|
<el-radio label="jy" value="jy">下架</el-radio>
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</el-form>
|
|
|
|
|
<el-alert
|
|
|
|
|
type="error"
|
|
|
|
|
style="margin-top: 15px"
|
|
|
|
|
:closable="false">
|
|
|
|
|
<p v-for="(item,index) in stockType" :id="index">
|
|
|
|
|
{{item}}
|
|
|
|
|
</p>
|
|
|
|
|
</el-alert>
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
|
|
<el-button type="primary" @click="submitForm1">确 定</el-button>
|
|
|
|
|
<el-button @click="cancel1">取 消</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</el-dialog>
|
2023-10-25 18:20:42 +08:00
|
|
|
|
|
|
|
|
|
</div>
|
2023-10-19 13:05:47 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2023-10-25 18:20:42 +08:00
|
|
|
|
import {
|
|
|
|
|
selectTree,
|
|
|
|
|
list,
|
|
|
|
|
insertCvsGoods,
|
|
|
|
|
deleteBYId,
|
|
|
|
|
selectParentById,
|
|
|
|
|
updateCevGood
|
|
|
|
|
} from "@/api/convenienceStore/goods.js";
|
2024-02-03 13:47:34 +08:00
|
|
|
|
import {getAccount} from "@/api/system/account";
|
|
|
|
|
import {addLJGoods, createGoodsNo, queryGoodsVoList, queryLJGoods, scanCode} from "@/api/convenienceStore/ljgoods";
|
|
|
|
|
import pinyin from "js-pinyin";
|
|
|
|
|
import {getSysConfig} from "@/api/staff/user/sysconfig";
|
|
|
|
|
import {addSupplier, listSupplier} from "@/api/convenienceStore/supplier";
|
2023-10-19 13:05:47 +08:00
|
|
|
|
export default {
|
2024-02-03 13:47:34 +08:00
|
|
|
|
dicts:['zhzt','yes_or_no'],
|
2023-10-25 18:20:42 +08:00
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
creatName:'',
|
|
|
|
|
// 标题
|
|
|
|
|
title: "",
|
|
|
|
|
// 是否显示弹出层
|
|
|
|
|
open: false,
|
2024-02-03 13:47:34 +08:00
|
|
|
|
openGoods: false,
|
2023-10-25 18:20:42 +08:00
|
|
|
|
// 遮罩层
|
|
|
|
|
loading: true,
|
2024-02-03 13:47:34 +08:00
|
|
|
|
supplier: "",
|
2023-10-25 18:20:42 +08:00
|
|
|
|
// 总条数
|
|
|
|
|
total: 0,
|
|
|
|
|
// 表格数据
|
|
|
|
|
list: [],
|
2024-02-02 18:02:17 +08:00
|
|
|
|
goodsList: [],
|
2024-02-03 13:47:34 +08:00
|
|
|
|
stockType: [],
|
2023-10-25 18:20:42 +08:00
|
|
|
|
//是否修改一二级菜单
|
|
|
|
|
isShow:false,
|
|
|
|
|
// 默认排序
|
|
|
|
|
defaultSort: {prop: 'updateTime', order: 'descending'},
|
|
|
|
|
//编辑表单
|
|
|
|
|
editForm:{
|
|
|
|
|
pid:'',
|
2023-10-26 14:53:44 +08:00
|
|
|
|
name:'',
|
2023-10-25 18:20:42 +08:00
|
|
|
|
status:'qy',
|
|
|
|
|
sorted:0,
|
2023-10-19 13:05:47 +08:00
|
|
|
|
},
|
2023-10-25 18:20:42 +08:00
|
|
|
|
//父级菜单列表
|
|
|
|
|
goodsOptions:[],
|
|
|
|
|
//查询表单
|
|
|
|
|
goodsQueryForm: {
|
2023-10-26 14:53:44 +08:00
|
|
|
|
name: '',
|
2023-10-25 18:20:42 +08:00
|
|
|
|
status: '',
|
|
|
|
|
pid:"",
|
|
|
|
|
pageNum:'1',
|
|
|
|
|
pageSize:'5'
|
2023-10-19 13:05:47 +08:00
|
|
|
|
},
|
2023-10-25 18:20:42 +08:00
|
|
|
|
// 添加对话框
|
|
|
|
|
dialogFormVisible:false,
|
|
|
|
|
//修改对话框
|
|
|
|
|
editDialogFormVisible:false,
|
|
|
|
|
//对话框表单
|
|
|
|
|
form:{
|
|
|
|
|
pid:'',
|
2023-10-26 14:53:44 +08:00
|
|
|
|
name:'',
|
2023-10-25 18:20:42 +08:00
|
|
|
|
status:'qy',
|
|
|
|
|
sorted:0,
|
2023-10-19 13:05:47 +08:00
|
|
|
|
},
|
2024-02-03 13:47:34 +08:00
|
|
|
|
//对话框表单
|
|
|
|
|
form1:{
|
|
|
|
|
status:'jy',
|
|
|
|
|
canUsePoint:'no',
|
|
|
|
|
stock:0,
|
|
|
|
|
sort:0,
|
|
|
|
|
buyingPrice:0,retailPrice:0,memberPrice:0
|
|
|
|
|
},
|
2023-10-25 18:20:42 +08:00
|
|
|
|
tableData: [{
|
|
|
|
|
id: '',
|
|
|
|
|
pid:'',
|
2023-10-26 14:53:44 +08:00
|
|
|
|
name: '',
|
2023-10-25 18:20:42 +08:00
|
|
|
|
sorted: '',
|
|
|
|
|
status:'',
|
|
|
|
|
createdTime:'',
|
|
|
|
|
children: []
|
|
|
|
|
}],
|
|
|
|
|
// 查询参数
|
|
|
|
|
queryParams: {
|
2023-10-28 13:33:42 +08:00
|
|
|
|
page: 1,
|
|
|
|
|
pageSize: 10,
|
2023-10-26 14:53:44 +08:00
|
|
|
|
name:'',
|
2023-10-25 18:20:42 +08:00
|
|
|
|
status: '',
|
2023-10-19 13:05:47 +08:00
|
|
|
|
},
|
2023-10-25 18:20:42 +08:00
|
|
|
|
aa:[],
|
2024-02-03 13:47:34 +08:00
|
|
|
|
supplierList:[],
|
2023-10-25 18:20:42 +08:00
|
|
|
|
//校验规则
|
|
|
|
|
rules: {
|
2023-10-26 14:53:44 +08:00
|
|
|
|
name: [
|
2024-02-02 18:02:17 +08:00
|
|
|
|
{ required: true, message: '请输入品类名称', trigger: 'blur' },
|
2023-10-25 18:20:42 +08:00
|
|
|
|
],
|
2023-10-19 13:05:47 +08:00
|
|
|
|
},
|
2024-02-03 13:47:34 +08:00
|
|
|
|
//校验规则
|
|
|
|
|
rules1: {
|
|
|
|
|
goodsNo: [
|
|
|
|
|
{ required: true, message: "商品条码不能为空", trigger: "blur" },
|
|
|
|
|
],
|
|
|
|
|
name: [
|
|
|
|
|
{ required: true, message: "商品名称不能为空", trigger: "blur" },
|
|
|
|
|
],
|
|
|
|
|
cvsGoodId: [
|
|
|
|
|
{ required: true, message: "请选择商品分类", trigger: "blur" },
|
|
|
|
|
],
|
|
|
|
|
pinyinCode: [
|
|
|
|
|
{ required: true, message: "商品拼音码不能为空", trigger: "blur" },
|
|
|
|
|
],
|
|
|
|
|
unit: [
|
|
|
|
|
{ required: true, message: "请输入商品单位", trigger: "blur" },
|
|
|
|
|
],
|
|
|
|
|
canUsePoint: [
|
|
|
|
|
{ required: true, message: "请选择是否能使用积分抵扣", trigger: "blur" },
|
|
|
|
|
],
|
|
|
|
|
supplierId: [
|
|
|
|
|
{ required: true, message: "请选择供应商", trigger: "change" },
|
|
|
|
|
],
|
|
|
|
|
status: [
|
|
|
|
|
{ required: true, message: "请选择商品状态", trigger: "blur" },
|
|
|
|
|
],
|
|
|
|
|
},
|
2023-10-19 13:05:47 +08:00
|
|
|
|
|
2023-10-23 15:17:08 +08:00
|
|
|
|
|
2023-10-25 18:20:42 +08:00
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
created(){
|
|
|
|
|
this.getList();
|
|
|
|
|
this.getFirstMenu();
|
2024-02-03 13:47:34 +08:00
|
|
|
|
this.getType();
|
|
|
|
|
this.getSuppilers();
|
2023-10-25 18:20:42 +08:00
|
|
|
|
},
|
|
|
|
|
methods: {
|
2024-02-03 13:47:34 +08:00
|
|
|
|
getSuppilers(val){
|
|
|
|
|
listSupplier().then(response => {
|
|
|
|
|
this.supplierList = response.data.records
|
|
|
|
|
if (val){
|
|
|
|
|
this.supplierList.forEach(item => {
|
|
|
|
|
if (item.name = val){
|
|
|
|
|
this.form.supplierId = item.id
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 获取分类名称
|
|
|
|
|
getType(){
|
|
|
|
|
getSysConfig('stock_type').then(response => {
|
|
|
|
|
this.stockType = response.data.split(";")
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 扫描识别商品信息
|
|
|
|
|
getGoods(form1){
|
|
|
|
|
if (form1.goodsNo!=""){
|
|
|
|
|
scanCode(form1.goodsNo).then(response => {
|
|
|
|
|
if (response.data!=null && response.data!=""){
|
|
|
|
|
this.form1.goodsNo = response.data.barcode;
|
|
|
|
|
this.form1.name = response.data.goodsName;
|
|
|
|
|
this.pinyin();
|
|
|
|
|
this.$forceUpdate()
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 生成13位数字条码信息
|
|
|
|
|
createGoodNo(){
|
|
|
|
|
createGoodsNo().then(response => {
|
|
|
|
|
this.form1.goodsNo = response.data
|
|
|
|
|
this.$forceUpdate()
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 获取中文首字母拼音
|
|
|
|
|
pinyin(){
|
|
|
|
|
let pinyin = require("js-pinyin");
|
|
|
|
|
pinyin.setOptions({ checkPolyphone: false, charCase: 1 });
|
|
|
|
|
this.form1.pinyinCode = pinyin.getCamelChars(this.form1.name)
|
|
|
|
|
},
|
|
|
|
|
// 模糊查询商品信息
|
|
|
|
|
querySearch(queryString, cb) {
|
|
|
|
|
let _this = this;
|
|
|
|
|
let results = _this.supplierList;
|
|
|
|
|
if (queryString != ""){
|
|
|
|
|
results = [];
|
|
|
|
|
let falg = false;
|
|
|
|
|
_this.supplierList.forEach(item => {
|
|
|
|
|
if(item.name.includes(queryString)){
|
|
|
|
|
results.push(item)
|
|
|
|
|
falg = true
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
if (!falg){
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
cb(results);
|
|
|
|
|
},
|
|
|
|
|
// 查询供应商信息
|
|
|
|
|
selectSupplier(data){
|
|
|
|
|
this.supplier = data.name;
|
|
|
|
|
this.form1.supplierId = data.id
|
|
|
|
|
this.$forceUpdate()
|
|
|
|
|
},
|
|
|
|
|
addSupplier(val){
|
|
|
|
|
// console.log(val,222)
|
|
|
|
|
if (!val){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
addSupplier({name:val,remark:"添加商品自动添加"}).then(res => {
|
|
|
|
|
// console.log(res)
|
|
|
|
|
if (res.data==1){
|
2024-02-23 18:00:16 +08:00
|
|
|
|
this.supplier = val;
|
2024-02-03 13:47:34 +08:00
|
|
|
|
this.$modal.msgSuccess("已为您自动添加此供应商")
|
|
|
|
|
this.getSuppilers(val)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 提交按钮
|
|
|
|
|
submitForm1: function() {
|
|
|
|
|
this.$refs["form1"].validate(valid => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
if (this.form1) {
|
|
|
|
|
queryLJGoods({goodsNo: this.form1.goodsNo}).then(response => {
|
|
|
|
|
if (response.data != null) {
|
|
|
|
|
this.$modal.msgError("商品已存在");
|
|
|
|
|
} else {
|
|
|
|
|
addLJGoods(this.form1).then(response => {
|
|
|
|
|
if (response.data == 1) {
|
|
|
|
|
this.$modal.msgSuccess("商品信息新增成功");
|
|
|
|
|
this.openGoods = false;
|
|
|
|
|
this.getList();
|
|
|
|
|
} else {
|
|
|
|
|
this.$message.error("商品信息新增失败")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 取消按钮
|
|
|
|
|
cancel1() {
|
|
|
|
|
this.openGoods = false;
|
|
|
|
|
this.reset1();
|
|
|
|
|
},
|
|
|
|
|
// 表单重置
|
|
|
|
|
reset1() {
|
|
|
|
|
this.form1 = {
|
|
|
|
|
status:'jy',
|
|
|
|
|
canUsePoint:'no',
|
|
|
|
|
stock:0,
|
|
|
|
|
sort:0,
|
|
|
|
|
}
|
|
|
|
|
},
|
2023-10-25 18:20:42 +08:00
|
|
|
|
// 表单重置
|
|
|
|
|
reset() {
|
|
|
|
|
this.form = {
|
|
|
|
|
pid:'',
|
2023-10-26 14:53:44 +08:00
|
|
|
|
name:'',
|
2023-10-25 18:20:42 +08:00
|
|
|
|
status:'qy',
|
|
|
|
|
sorted:0,
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 获取添加者姓名
|
|
|
|
|
getName(id){
|
|
|
|
|
getAccount(id).then(response=>{
|
|
|
|
|
this.creatName = response.data.account.realName
|
|
|
|
|
})
|
|
|
|
|
return this.creatName;
|
|
|
|
|
},
|
|
|
|
|
// 新增按钮操作
|
|
|
|
|
handleAdd() {
|
2023-10-28 13:33:42 +08:00
|
|
|
|
this.reset()
|
2023-10-25 18:20:42 +08:00
|
|
|
|
this.open = true;
|
2024-02-02 18:02:17 +08:00
|
|
|
|
this.title = "新增品类";
|
2023-10-25 18:20:42 +08:00
|
|
|
|
},
|
|
|
|
|
//获取父类
|
|
|
|
|
getFirstMenu(){
|
|
|
|
|
list(this.form).then(response=>{
|
|
|
|
|
this.goodsOptions = response.data
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 搜索按钮操作
|
|
|
|
|
handleQuery() {
|
|
|
|
|
this.queryParams.page = 1;
|
|
|
|
|
this.getList();
|
|
|
|
|
},
|
|
|
|
|
handleChange(){
|
|
|
|
|
},
|
|
|
|
|
//提交商品类别
|
|
|
|
|
dooSubmit(){
|
|
|
|
|
this.$refs['form'].validate(valid => {
|
|
|
|
|
if (valid) {
|
2024-02-02 18:02:17 +08:00
|
|
|
|
//新增一级品类
|
2023-10-25 18:20:42 +08:00
|
|
|
|
if(this.form.pid == '' || this.form.pid == undefined ){
|
|
|
|
|
this.form.pid = 0
|
|
|
|
|
}
|
|
|
|
|
//新增二级
|
|
|
|
|
insertCvsGoods(this.form).then(response=>{
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
this.rest()
|
|
|
|
|
this.$message('新增成功');
|
2023-10-19 13:05:47 +08:00
|
|
|
|
}else{
|
2023-10-25 18:20:42 +08:00
|
|
|
|
this.$message('新增失败 请联系管理员');
|
2023-10-19 13:05:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-10-25 18:20:42 +08:00
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
rest(){
|
|
|
|
|
this.dialogFormVisible = false
|
|
|
|
|
this.resetForm();
|
|
|
|
|
this.goodsOptions = []
|
|
|
|
|
},
|
|
|
|
|
// 取消提交
|
|
|
|
|
cancelSubmit(){
|
|
|
|
|
this.$refs.form.resetFields();//清空
|
2023-10-26 14:53:44 +08:00
|
|
|
|
this.form.name = ''
|
2023-10-25 18:20:42 +08:00
|
|
|
|
this.form.pid = ''
|
|
|
|
|
this.form.status = ''
|
|
|
|
|
this.form.sorted = 0
|
|
|
|
|
this.dialogFormVisible = false
|
|
|
|
|
},
|
|
|
|
|
// 分页查询
|
|
|
|
|
getList(){
|
|
|
|
|
this.loading = true;
|
|
|
|
|
selectTree(this.queryParams).then(response => {
|
2023-11-25 18:08:20 +08:00
|
|
|
|
if (response.data!=null){
|
|
|
|
|
this.list = response.data.records;
|
|
|
|
|
this.total = response.data.total;
|
|
|
|
|
}else {
|
|
|
|
|
this.list = [];
|
|
|
|
|
this.total = 0;
|
|
|
|
|
}
|
2023-10-25 18:20:42 +08:00
|
|
|
|
this.loading = false;
|
|
|
|
|
});
|
|
|
|
|
},
|
2024-02-03 13:47:34 +08:00
|
|
|
|
onExpand(row){
|
2024-02-02 18:02:17 +08:00
|
|
|
|
// 判断当前展开行
|
|
|
|
|
// debugger
|
2024-02-03 13:47:34 +08:00
|
|
|
|
// this.getGoodsList(row.id) // 获取列表
|
2024-02-02 18:02:17 +08:00
|
|
|
|
},
|
|
|
|
|
getGoodsList(cvsGoodsId){
|
|
|
|
|
queryGoodsVoList({cvsGoodId:cvsGoodsId}).then(res => {
|
|
|
|
|
this.goodsList = res.data
|
|
|
|
|
})
|
|
|
|
|
},
|
2023-10-25 18:20:42 +08:00
|
|
|
|
// 取消查询
|
|
|
|
|
resetForm(){
|
2023-10-26 14:53:44 +08:00
|
|
|
|
this.goodsQueryForm.name = ''
|
2023-10-25 18:20:42 +08:00
|
|
|
|
this.goodsQueryForm.status = ''
|
|
|
|
|
this.getList()
|
|
|
|
|
},
|
|
|
|
|
// 提交按钮
|
|
|
|
|
submitForm: function() {
|
|
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
|
|
if (valid) {
|
2023-10-28 13:33:42 +08:00
|
|
|
|
if(this.form.pid==""){
|
|
|
|
|
this.form.pid = 0
|
|
|
|
|
}
|
2023-10-25 18:20:42 +08:00
|
|
|
|
if (this.form.id) {
|
|
|
|
|
updateCevGood(this.form).then(response => {
|
2024-01-10 11:06:41 +08:00
|
|
|
|
if (response.data==1){
|
2024-02-02 18:02:17 +08:00
|
|
|
|
this.$modal.msgSuccess("品类更新成功");
|
2024-01-10 11:06:41 +08:00
|
|
|
|
this.open = false;
|
|
|
|
|
this.getList();
|
|
|
|
|
this.getFirstMenu();
|
|
|
|
|
}else {
|
2024-02-02 18:02:17 +08:00
|
|
|
|
this.$modal.msgError("品类名称已存在,修改失败");
|
2024-01-10 11:06:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-10-25 18:20:42 +08:00
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
insertCvsGoods(this.form).then(response => {
|
2023-10-31 18:18:30 +08:00
|
|
|
|
if (response.data == -1){
|
2024-02-02 18:02:17 +08:00
|
|
|
|
this.$modal.msgError("品类名称已存在,添加失败");
|
2023-10-31 18:18:30 +08:00
|
|
|
|
}else {
|
2024-02-02 18:02:17 +08:00
|
|
|
|
this.$modal.msgSuccess("品类添加成功");
|
2023-10-31 18:18:30 +08:00
|
|
|
|
this.open = false;
|
|
|
|
|
this.getList();
|
2023-11-25 18:08:20 +08:00
|
|
|
|
this.getFirstMenu();
|
2023-10-31 18:18:30 +08:00
|
|
|
|
}
|
2023-10-25 18:20:42 +08:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 取消按钮
|
|
|
|
|
cancel() {
|
|
|
|
|
this.open = false;
|
|
|
|
|
this.reset();
|
|
|
|
|
},
|
2024-02-03 13:47:34 +08:00
|
|
|
|
// 添加商品信息
|
|
|
|
|
addGoods(data){
|
|
|
|
|
this.openGoods = true
|
|
|
|
|
this.form1.cvsGoodId = data.id
|
|
|
|
|
this.supplier = ""
|
|
|
|
|
this.title = "添加商品信息"
|
|
|
|
|
},
|
2023-10-25 18:20:42 +08:00
|
|
|
|
// 修改按钮操作
|
|
|
|
|
handleUpdate(row) {
|
|
|
|
|
this.reset();
|
|
|
|
|
const id = row.id || this.ids;
|
|
|
|
|
selectParentById(id).then(response => {
|
|
|
|
|
this.form = response.data;
|
|
|
|
|
this.open = true;
|
2024-02-23 18:00:16 +08:00
|
|
|
|
this.title = "修改品类信息";
|
2023-10-25 18:20:42 +08:00
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 删除按钮操作
|
|
|
|
|
handleDelete(row) {
|
2023-10-26 14:53:44 +08:00
|
|
|
|
const name = row.name
|
2024-02-02 18:02:17 +08:00
|
|
|
|
this.$modal.confirm('确定删除"' + name + '"的品类信息?').then(function() {
|
2023-10-25 18:20:42 +08:00
|
|
|
|
// return deleteMember(row.id);
|
|
|
|
|
return deleteBYId(row.id);
|
|
|
|
|
}).then(() => {
|
2023-10-28 13:33:42 +08:00
|
|
|
|
this.queryParams.page = 1
|
2023-10-25 18:20:42 +08:00
|
|
|
|
this.getList();
|
2023-11-25 18:08:20 +08:00
|
|
|
|
this.getFirstMenu();
|
2023-10-25 18:20:42 +08:00
|
|
|
|
this.$modal.msgSuccess("删除成功");
|
|
|
|
|
}).catch(() => {});
|
|
|
|
|
},
|
|
|
|
|
// 多选框选中数据
|
|
|
|
|
handleSelectionChange(selection) {
|
|
|
|
|
this.ids = selection.map(item => item.id)
|
|
|
|
|
this.multiple = !selection.length
|
|
|
|
|
},
|
|
|
|
|
// 排序触发事件
|
|
|
|
|
handleSortChange(column, prop, order) {
|
|
|
|
|
this.queryParams.orderByColumn = column.prop;
|
|
|
|
|
this.queryParams.isAsc = column.order;
|
|
|
|
|
this.getList();
|
|
|
|
|
},
|
2023-11-25 18:08:20 +08:00
|
|
|
|
},
|
2023-10-19 13:05:47 +08:00
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2023-10-25 18:20:42 +08:00
|
|
|
|
.tTop{
|
2023-10-19 13:05:47 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
align-items: center;
|
|
|
|
|
margin-bottom: 10px;
|
2023-10-25 18:20:42 +08:00
|
|
|
|
}
|
|
|
|
|
.pageSty{
|
2023-10-19 13:05:47 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
margin-left: 250px;
|
2023-10-25 18:20:42 +08:00
|
|
|
|
}
|
|
|
|
|
.app-container{
|
|
|
|
|
width: 100%;
|
2024-02-23 18:00:16 +08:00
|
|
|
|
height: 100%;
|
2023-10-25 18:20:42 +08:00
|
|
|
|
background: #f6f8f9;
|
|
|
|
|
}
|
2023-10-23 15:17:08 +08:00
|
|
|
|
</style>
|