356 行
15 KiB
HTML
可执行文件
356 行
15 KiB
HTML
可执行文件
<!--[1.6.48]-->
|
|
<style>
|
|
.el-pagination {
|
|
padding: 8px;
|
|
}
|
|
|
|
.el-table__row > td:last-child > .cell {
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.center-content {
|
|
margin: 0 0 20px;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
}
|
|
|
|
.center-content .el-input__inner {
|
|
padding: 0 15px;
|
|
text-align: left;
|
|
}
|
|
|
|
#supplier .center-content .el-input {
|
|
width: 200px;
|
|
}
|
|
</style>
|
|
<div class="supplier" id="supplier" v-cloak>
|
|
<div class="center-content">
|
|
<div>
|
|
<el-input placeholder="编码/名称"
|
|
type="text"
|
|
clearable
|
|
size="small"
|
|
oninput="value=this.value.trim(' ')"
|
|
@keydown.enter.exact.native.prevent="searchData"
|
|
v-model="text"></el-input>
|
|
<el-button type="primary" plain @click="searchData" size="small">搜索</el-button>
|
|
<if condition="$authArr['supplierSet'] eq true">
|
|
<el-button type="primary" plain @click="supplierSet()" size="small">新增</el-button>
|
|
</if>
|
|
<if condition="$authArr['exportOperation'] eq true">
|
|
<el-button type="primary" plain @click="exportOperation" size="small">导出</el-button>
|
|
</if>
|
|
</div>
|
|
<div>
|
|
<if condition="$authArr['batch'] eq true">
|
|
<el-select
|
|
style="width: 190px;"
|
|
size="small"
|
|
v-model="store_id"
|
|
filterable
|
|
remote
|
|
clearable
|
|
multiple
|
|
collapse-tags
|
|
v-load-more="getStoreList"
|
|
reserve-keyword
|
|
@change="changeSelectStore"
|
|
placeholder="请选择同步的门店"
|
|
:remote-method="searchStore">
|
|
<el-option
|
|
v-for="item in storeList"
|
|
:key="item.id"
|
|
:label="item.store_name"
|
|
:value="item.id">
|
|
</el-option>
|
|
</el-select>
|
|
|
|
<el-button type="primary" style="margin-left: 10px" plain @click="syncSupplier" size="small">同步</el-button>
|
|
</if>
|
|
</div>
|
|
|
|
</div>
|
|
<div style="border: 1px solid #e6e6e6;max-width: calc(100vw - 208px);">
|
|
<el-table border :data="SupplierList" style="width: calc(100vw - 208px);border: none;"
|
|
size="mini"
|
|
max-height="500"
|
|
v-loading="loading"
|
|
@selection-change="handleSelectionChange"
|
|
element-loading-text="数据获取中"
|
|
element-loading-spinner="el-icon-loading">
|
|
<el-table-column align="center" type="selection" width="50"></el-table-column>
|
|
<el-table-column align="center" prop="index" label="序号" width="60px" show-overflow-tooltip></el-table-column>
|
|
<el-table-column align="center" prop="code" label="编码" show-overflow-tooltip></el-table-column>
|
|
<el-table-column align="center" prop="supplier_name" label="供货商名称" show-overflow-tooltip></el-table-column>
|
|
<el-table-column align="center" prop="linkman" label="联系人" show-overflow-tooltip></el-table-column>
|
|
<el-table-column align="center" prop="phone" label="联系方式" show-overflow-tooltip></el-table-column>
|
|
<el-table-column align="center" prop="place" label="地址信息" show-overflow-tooltip></el-table-column>
|
|
<el-table-column align="center" prop="operation_mode" label="经营方式" show-overflow-tooltip></el-table-column>
|
|
<el-table-column align="center" prop="settlement_method" label="结算方式" show-overflow-tooltip></el-table-column>
|
|
<el-table-column align="center" prop="settlement_days" label="结算天数" show-overflow-tooltip></el-table-column>
|
|
<el-table-column align="center" prop="bank_card" label="银行卡号" show-overflow-tooltip></el-table-column>
|
|
<el-table-column align="center" fixed="right" label="操作" width="100px" style="border-right: none;">
|
|
<template slot-scope="scope">
|
|
<if condition="$authArr['supplierSet'] eq true">
|
|
<el-button @click="supplierSet(scope.row.id)" type="text" size="small">编辑</el-button>
|
|
</if>
|
|
<if condition="$authArr['delete'] eq true">
|
|
<el-button @click="del(scope.row.id)" type="text" size="small">删除</el-button>
|
|
</if>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<el-pagination
|
|
@size-change="handleSizeChange"
|
|
@current-change="handleCurrentChange"
|
|
:current-page="currentPage"
|
|
:page-sizes="[10, 15, 20, 25, 30, 35, 40, 45, 50]"
|
|
:page-size="100"
|
|
layout="total, sizes, prev, pager, next, jumper"
|
|
:total="currentLen">
|
|
</el-pagination>
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
Vue.directive('load-more', {
|
|
bind(el, binding) {
|
|
// 获取element-ui定义好的scroll盒子
|
|
const SELECTWRAP_DOM = el.querySelector('.el-select-dropdown .el-select-dropdown__wrap');
|
|
SELECTWRAP_DOM.addEventListener('scroll', function () {
|
|
const CONDITION = this.scrollHeight - this.scrollTop <= this.clientHeight;
|
|
if (CONDITION) {
|
|
binding.value();
|
|
}
|
|
})
|
|
}
|
|
});
|
|
var supplier = new Vue({
|
|
el: "#supplier",
|
|
data: function () {
|
|
return {
|
|
text: "",
|
|
currentPage: 1,
|
|
currentLimit: 10,
|
|
currentLen: 0,
|
|
loading: true,
|
|
SupplierList: [],
|
|
Selection: [],
|
|
storeList: [],
|
|
store_id: [],
|
|
store_loading: false,//是否正在获取门店
|
|
store_page: 1,//门店分页页数
|
|
store_limit: 10,//每页获取门店数量
|
|
store_name: '',//门店搜索关键词
|
|
store_canLoad: true,//是否还有更多门店
|
|
errorList: [],
|
|
outerVisible: false,
|
|
}
|
|
},
|
|
methods: {
|
|
handleSizeChange: function (val) {
|
|
this.currentLimit = val;//切换每页数量
|
|
this.currentPage = 1;
|
|
this.getData();
|
|
},
|
|
handleCurrentChange: function (val) {
|
|
this.currentPage = val;
|
|
this.getData();//切换页数
|
|
},
|
|
searchData: function () {
|
|
//搜索
|
|
this.currentPage = 1;
|
|
this.getData();
|
|
},
|
|
//查询
|
|
getData: function () {
|
|
this.loading = true;
|
|
var page = this.currentPage;
|
|
var limit = this.currentLimit;
|
|
var text = this.text;
|
|
$.ajax({
|
|
url: "{:U('supplierList')}",
|
|
type: "post",
|
|
data: {
|
|
page: page,
|
|
limit: limit,
|
|
text: text,
|
|
},
|
|
success: (res) => {
|
|
this.loading = false;
|
|
this.SupplierList = res.data;
|
|
this.$nextTick(function () {
|
|
this.currentLen = parseInt(res.count);
|
|
})
|
|
}
|
|
})
|
|
},
|
|
//编辑、新增
|
|
supplierSet(id) {
|
|
MenuApp.pathData.push({
|
|
name: id ? '编辑供货商' : '新增供货商',
|
|
path: "{:U('supplierSet')}?id=" + id,
|
|
onClose: () => {
|
|
this.getData();
|
|
}
|
|
})
|
|
},
|
|
//删除
|
|
del: function (id) {
|
|
this.$confirm('此操作将永久删除, 是否继续?', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
}).then(() => {
|
|
$.ajax({
|
|
url: "{:U('delete')}",
|
|
type: "POST",
|
|
data: {id: id},
|
|
success: (res) => {
|
|
if (res.status == 1) {
|
|
this.$message({
|
|
type: "success",
|
|
message: res.msg,
|
|
duration: 1000,
|
|
onClose: () => {
|
|
this.getData();
|
|
}
|
|
})
|
|
} else {
|
|
this.$message({
|
|
type: "error",
|
|
message: res.msg,
|
|
duration: 1000
|
|
})
|
|
}
|
|
}
|
|
})
|
|
}).catch(() => {
|
|
this.$message({
|
|
type: 'info',
|
|
message: '已取消删除'
|
|
});
|
|
});
|
|
},
|
|
handleSelectionChange(val) {
|
|
this.Selection = val;
|
|
},
|
|
syncSupplier: function () {
|
|
var store_id = this.store_id;
|
|
var Selection = this.Selection;
|
|
if (!store_id || store_id.length == 0) {
|
|
this.$message({type: "warning", message: "请选择要同步供货商的门店", duration: 1000});
|
|
return;
|
|
}
|
|
if (!Selection || Selection.length == 0) {
|
|
this.$message({type: "warning", message: "请选择要同步的供货商", duration: 1000});
|
|
return;
|
|
}
|
|
this.$confirm('确认将供货商同步至门店, 是否继续?', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
}).then(() => {
|
|
$.ajax({
|
|
url: "{:U('batch')}",
|
|
type: "post",
|
|
data: {store_id: store_id, Selection: Selection},
|
|
success: (res) => {
|
|
if (res.status == 1) {
|
|
this.$message({
|
|
type: "success",
|
|
message: res.msg,
|
|
duration: 1000,
|
|
})
|
|
} else {
|
|
this.$message({
|
|
type: "warning",
|
|
message: res.msg,
|
|
duration: 1000,
|
|
onClose: () => {
|
|
this.outerVisible = true;
|
|
}
|
|
})
|
|
}
|
|
}
|
|
})
|
|
}).catch(() => {
|
|
this.$message({
|
|
type: 'info',
|
|
message: '已取消删除'
|
|
});
|
|
});
|
|
},
|
|
//导出
|
|
exportOperation: function () {
|
|
this.$confirm("确定要导出当前列表供应信息吗?", "温馨提示", {
|
|
confirmButtonText: '导出',
|
|
cancelButtonText: '取消',
|
|
type: 'info'
|
|
}).then(() => {
|
|
window.location.href = "{:U('exportList')}?text=" + this.text;
|
|
}).catch(() => {
|
|
})
|
|
},
|
|
//修改门店
|
|
changeSelectStore(val) {
|
|
if (!val) {
|
|
this.searchStore();
|
|
}
|
|
},
|
|
//准备查询门店
|
|
searchStore: function (keyword) {
|
|
console.log(keyword);
|
|
this.store_name = keyword;
|
|
this.store_page = 1;
|
|
this.store_canLoad = true;
|
|
this.getStoreList();
|
|
},
|
|
//获取分门店列表
|
|
getStoreList() {
|
|
if (!this.store_canLoad) {
|
|
return;
|
|
}
|
|
this.store_loading = true;
|
|
this.store_canLoad = false;
|
|
$.ajax({
|
|
url: "/index.php/Retail/Store/getStoreLimitList",
|
|
type: 'post',
|
|
data: {
|
|
page: this.store_page,
|
|
limit: this.store_limit,
|
|
store_name: this.store_name,
|
|
},
|
|
success: (res) => {
|
|
this.store_loading = false;
|
|
if (res.status == 1) {
|
|
if (this.store_page == 1) {
|
|
this.storeList = res.data;
|
|
} else {
|
|
this.storeList.push.apply(this.storeList, res.data);
|
|
}
|
|
this.store_page++;
|
|
if (this.store_limit == res.data.length) {
|
|
this.store_canLoad = true;
|
|
}
|
|
}
|
|
},
|
|
error: (data) => {
|
|
console.log(data);
|
|
this.store_loading = false;
|
|
this.$alert('请求发生错误,请稍后重试!', '错误提示', {
|
|
confirmButtonText: '确定',
|
|
callback: action => {
|
|
|
|
}
|
|
});
|
|
}
|
|
})
|
|
},
|
|
},
|
|
created: function () {
|
|
this.getData();
|
|
this.getStoreList();
|
|
}
|
|
})
|
|
</script> |