123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527 |
- <template>
- <div class="app-container">
- <!-- 筛选条件 -->
- <div>
- <el-form
- ref="screenForm"
- :model="screenForm"
- label-width="70px"
- size="mini"
- label-position="left"
- >
- <el-row :gutter="20">
- <el-col :xs="24" :sm="12" :lg="6">
- <el-form-item label="经销商名称" prop="customerName">
- <el-input
- placeholder="请输入经销商名称"
- v-model="screenForm.customerName"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="12" :lg="18" class="tr">
- <el-form-item label="">
- <el-button size="mini" @click="resetScreenForm">清空</el-button>
- <el-button size="mini" type="primary" @click="submitScreenForm"
- >搜索</el-button
- >
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- </div>
- <!-- 按钮 -->
- <div class="btn-group clearfix">
- <div class="fl">
- <el-button
- type="primary"
- size="mini"
- v-if="$checkBtnRole('add', $route.meta.roles)"
- icon="el-icon-plus"
- @click="(showDialog = true), (type = 1)"
- >新增</el-button
- >
- <el-popconfirm
- v-if="$checkBtnRole('del', $route.meta.roles)"
- confirm-button-text="好的"
- cancel-button-text="不用了"
- icon="el-icon-info"
- icon-color="red"
- title="内容确定删除吗?"
- @onConfirm="hanleDelete"
- >
- <el-button
- type="primary"
- size="mini"
- icon="el-icon-delete"
- slot="reference"
- class="el-popover-left"
- >批量删除</el-button
- >
- </el-popconfirm>
- </div>
- <div class="fr">
- <el-upload
- class="import-btn"
- :action="baseURL + 'student/import'"
- :http-request="handleImport"
- :file-list="importFileList"
- >
- <el-button type="primary" size="mini">导入</el-button>
- </el-upload>
- <el-button type="primary" size="mini" @click="handleExport"
- >导出</el-button
- >
- <!-- <el-button type="primary" size="mini" @click="hanlePrint"
- >打印</el-button
- > -->
- </div>
- </div>
- <div class="mymain-container">
- <!-- 列表 -->
- <div class="table">
- <!-- startprint -->
- <el-table
- v-loading="listLoading"
- :data="dataList"
- element-loading-text="Loading"
- border
- fit
- highlight-current-row
- stripe
- @select-all="hanleSelectAll"
- @select="hanleSelectAll"
- >
- <el-table-column type="selection" align="left" min-width="100" />
- <el-table-column
- align="left"
- label="经销商编码"
- prop="customerNumber"
- min-width="200"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- <CopyButton :copyText="scope.row.customerNumber" />
- <span>{{scope.row.customerNumber}}</span>
- </template>
- </el-table-column>
- <el-table-column
- align="left"
- label="经销商名称"
- prop="customerName"
- min-width="200"
- show-overflow-tooltip
- > <template slot-scope="scope">
- <CopyButton :copyText="scope.row.customerName" />
- <span>{{scope.row.customerName}}</span>
- </template>
- </el-table-column>
- <el-table-column
- align="right"
- label="存放免费天数"
- prop="freeDay"
- min-width="160"
- show-overflow-tooltip
- />
- <el-table-column
- align="right"
- label="收费规则(每立方米)"
- prop="toll"
- min-width="160"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="创建人"
- prop="createBy"
- min-width="200"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="创建时间"
- prop="createTime"
- min-width="200"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="更新人"
- prop="updateBy"
- min-width="200"
- show-overflow-tooltip
- />
- <el-table-column
- align="left"
- label="更新时间"
- prop="updateTime"
- min-width="200"
- show-overflow-tooltip
- />
- <el-table-column
- align="center"
- label="操作"
- fixed="right"
- min-width="160"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- <el-button
- type="text"
- v-if="$checkBtnRole('edit', $route.meta.roles)"
- class="textColor"
- @click="editFn(scope.row.id, scope.row)"
- >编辑</el-button
- >
- <el-popconfirm
- v-if="$checkBtnRole('del', $route.meta.roles)"
- confirm-button-text="好的"
- cancel-button-text="不用了"
- icon="el-icon-info"
- icon-color="red"
- title="内容确定删除吗?"
- @onConfirm="hanleDelete(scope.row.id)"
- >
- <el-button
- slot="reference"
- type="text"
- class="textColor el-popover-left"
- >删除</el-button
- >
- </el-popconfirm>
- </template>
- </el-table-column>
- </el-table>
- <!-- endprint -->
- </div>
- <!-- 分页 -->
- <div class="fr">
- <el-pagination
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :current-page="currentPage"
- :page-sizes="[10, 20, 30, 50]"
- :page-size="10"
- layout="total, sizes, prev, pager, next, jumper"
- :total="listTotal"
- >
- </el-pagination>
- </div>
- </div>
- <!-- 弹窗 -->
- <el-dialog
- title="仓库费规则配置"
- :visible.sync="showDialog"
- width="50%"
- :show-close="false"
- :close-on-click-modal="false"
- >
- <el-form :model="dialogForm" label-width="100px" label-position="right">
- <el-form-item label="经销商编码" prop="customerNumber">
- <el-select
- v-model="dialogForm.customerNumber"
- placeholder="请选择活动区域"
- filterable
- class="inputStyle"
- v-el-select-loadmore="loadmore"
- >
- <!-- v-el-select-loadmore="loadMore" -->
- <el-option
- v-for="(item, index) in customerList"
- :key="index"
- :label="item.number"
- :value="item.id"
- ></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="经销商名称" prop="customerName">
- <el-input
- v-model="dialogForm.customerName"
- class="inputStyle"
- ></el-input>
- </el-form-item>
- <el-form-item label="仓库存放" class="sty" prop="freeDay">
- <el-input
- type="number" @mousewheel.native.prevent
- v-model="dialogForm.freeDay"
- class="inputStyle"
- />天内可免费受存储管理费用.
- <br/>
- 当超过
- <el-input
- type="number" @mousewheel.native.prevent
- v-model="dialogForm.freeDay"
- class="inputStyle"
- />天后,按每立方米
- <el-input
- v-model="dialogForm.toll"
- type="number" @mousewheel.native.prevent
- class="inputStyle"
- />
- 元/天计算
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click="(showDialog = false), kong()">取 消</el-button>
- <el-button type="primary" @click="hanleInfo(dialogForm)"
- >确 定</el-button
- >
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import Mixin from '@/mixin/index'
- import { downloadFiles, handleImport } from '@/utils/util'
- import { addToll, deleteToll, getCustomerList, getListToll, updateToll } from '@/api/basic_data/warehouse'
- export default {
- mixins: [Mixin],
- data() {
- return {
- dialogForm: {
- id: null,
- customerName: "",
- customerNumber: "",
- freeDay: 0,
- toll: 0,
- },
- sleectBox: {
- currentPage: 1, // 当前页码
- pageSize: 10, // 每页数量
- listTotal: 0, // 列表总数
- },
- baseURL: "",
- currentPage: 1, // 当前页码
- pageSize: 10, // 每页数量
- listTotal: 0, // 列表总数
- importLoading: false, // 导入加载loading
- importFileList: [], // 导入列表
- customerList: [],
- showDialog: false,
- dataList: [],
- screenForm: {
- customerName: "",
- freeDay: "",
- toll: "",
- },
- type: null, // 1 新增 2 修改 null 详情
- };
- },
- created() {
- this.getList();
- this.getCustomerList();
- },
- directives: {
- "el-select-loadmore": {
- bind(el, binding) {
- // 获取element-ui定义好的scroll盒⼦
- const SELECTWRAP_DOM = el.querySelector(
- ".el-select-dropdown .el-select-dropdown__wrap"
- );
- SELECTWRAP_DOM.addEventListener("scroll", function () {
- /**
- * scrollHeight 获取元素内容⾼度(只读)
- * scrollTop 获取或者设置元素的偏移值,常⽤于, 计算滚动条的位置, 当⼀个元素的容器没有产⽣垂直⽅向的滚动条, 那它的scrollTop的值默认为0.
- * clientHeight 读取元素的可见⾼度(只读)
- * 如果元素滚动到底, 下⾯等式返回true, 没有则返回false:
- * ele.scrollHeight - ele.scrollTop === ele.clientHeight;
- */
- const condition =
- this.scrollHeight - this.scrollTop <= this.clientHeight;
- if (condition) {
- binding.value();
- }
- });
- },
- },
- },
- methods: {
- editFn(id, row) {
- (this.dialogForm = {
- id: id,
- customerName: row.customerName,
- customerNumber: row.customerNumber,
- freeDay: row.freeDay,
- toll: row.toll,
- }),
- (this.type = 2);
- this.showDialog = true;
- },
- hanleInfo(dialogForm) {
- if (this.type === 1) {
- const params = {
- ...dialogForm,
- };
- console.log(params, 78798);
- addToll(params).then((res) => {
- this.getList();
- this.$successMsg("保存成功");
- this.kong();
- });
- } else if (this.type === 2) {
- const paramss = {
- ...this.dialogForm,
- };
- updateToll(paramss).then((res) => {
- this.$successMsg("编辑成功");
- this.getList();
- this.kong();
- this.diaLogForm.id = null;
- });
- }
- this.showDialog = false;
- },
- getList() {
- this.listLoading = true;
- let params = {
- pageNum: this.currentPage,
- pageSize: this.pageSize,
- customerName: this.screenForm.customerName,
- freeDay: this.screenForm.freeDay,
- toll: this.screenForm.toll,
- };
- getListToll(params).then((res) => {
- this.dataList = res.data.records;
- this.listTotal = res.data.total;
- this.listLoading = false;
- });
- },
- loadmore() {
- this.sleectBox.currentPage++;
- this.getCustomerList();
- },
- getCustomerList() {
- let params = {
- pageNum:1,
- pageSize: -1,
- keyword: "",
- };
- getCustomerList(params).then((res) => {
- if (res.data.records.length) {
- this.customerList = [...this.customerList, ...res.data.records];
- }
- // this.listTotal = res.data.total;
- });
- },
- // hanleDetail(detail) {
- // this.type = null;
- // this.showDialog = true;
- // this.diaLogForm = detail;
- // },
- handleExport() {
- let screenData = {
- customerName: this.screenForm.customerName,
- freeDay: this.screenForm.freeDay,
- toll: this.screenForm.toll,
- };
- downloadFiles("/stock/exportToll", screenData);
- },
- // 删除数据
- hanleDelete(id) {
- deleteToll({ id }).then((res) => {
- this.$successMsg("删除成功");
- this.getList();
- });
- },
- // 导入
- async handleImport(param) {
- this.importLoading = true;
- const file = param.file;
- console.log(file, 123);
- const formData = new FormData();
- formData.append("file", file);
- let result = await handleImport("/stock/importToll", formData);
- this.importLoading = false;
- this.importFileList = [];
- if (result.code == 200) {
- this.$alert(result.message, "导入成功", {
- confirmButtonText: "确定",
- });
- this.getList();
- } else {
- this.$alert(result.message, "导入失败", {
- confirmButtonText: "确定",
- });
- }
- },
- kong() {
- this.dialogForm = {
- customerName: "",
- customerNumber: "",
- freeDay: 0,
- toll: 0,
- };
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- ::v-deep .sty {
- width: 85%;
- .el-form-item__content .el-input {
- width: 22%;
- margin: 0px 10px 16px 0;
- }
- }
- .zhu {
- padding-top: 18px;
- }
- .import-btn {
- display: inline-block;
- margin-right: 10px;
- }
- .set {
- margin-bottom: 30px;
- }
- .inputs {
- margin: 0 18px;
- }
- ::v-deep .el-form {
- .inputStyle {
- width: 80%;
- }
- }
- ::v-deep .dialog-footer {
- display: flex;
- justify-content: center;
- }
- ::v-deep .el-dialog__header {
- background-color: #dddddd;
- }
- .inp {
- margin: 0 12px;
- }
- .right {
- margin-top: 12px;
- float: right;
- }
- .table {
- margin-top: 12px;
- }
- .search {
- display: flex;
- margin-top: 12px;
- ::v-deep .el-input {
- width: 50%;
- margin-right: 12px;
- }
- }
- .main {
- padding: 12px;
- }
- </style>
- >
|