文件

335 行
13 KiB
HTML
可执行文件

<!--[1.6.48]-->
<style>
th {
background-color: #f5f7fa !important;
}
th > .cell {
white-space: nowrap !important;
text-align: center;
}
th, td {
text-align: center;
line-height: 30px;
padding: 0;
}
th > .cell, td > .cell {
text-align: center;
}
.el-pagination {
padding: 8px;
}
.el-input {
width: 200px;
}
.el-table__row > td:last-child > .cell {
white-space: nowrap;
}
.center-content {
margin: 20px 0;
display: flex;
justify-content: space-between;
align-items: center;
}
.center-content .el-input__inner {
padding: 0 15px;
text-align: left;
}
.small-dialog-content {
margin-left: calc(7% + 40px);
}
.goods_title {
padding: 10px 0;
}
.el-input {
margin-bottom: 10px;
}
</style>
<div class="purchaseBox" id="advance" v-cloak>
<div class="goods_title">
<div class="goods_title_inner">
预付款管理
</div>
</div>
<div class="center-content">
<div>
<el-input placeholder="供货商名称/联系人"
type="text"
size="small"
clearable
v-model="supplier_name"></el-input>
<el-button type="primary" plain @click="search" size="small">搜索</el-button>
<if condition="$global_store_jurisdiction && ($global_store_jurisdiction['data_export'] eq '2') && $identity eq 2">
<else/>
<if condition="$authArr['exportOperation'] eq true">
<el-button type="primary" plain @click="exportOperation" size="small">导出</el-button>
</if>
</if>
</div>
</div>
<div style="border: 1px solid #e6e6e6;max-width: calc(100vw - 208px);">
<el-table border :data="AdvanceList" style="width: calc(100vw - 208px);border: none;"
size="mini"
max-height="500"
v-loading="loading"
element-loading-text="数据获取中"
element-loading-spinner="el-icon-loading">
<el-table-column prop="index" label="序号" show-overflow-tooltip></el-table-column>
<el-table-column prop="supplier_name" label="供货商" show-overflow-tooltip></el-table-column>
<el-table-column prop="linkman" label="联系人" show-overflow-tooltip></el-table-column>
<el-table-column prop="phone" label="手机号" show-overflow-tooltip></el-table-column>
<el-table-column prop="address" label="地址" show-overflow-tooltip></el-table-column>
<el-table-column prop="advance_money" label="预付款余额" show-overflow-tooltip></el-table-column>
<el-table-column fixed="right" label="操作" width="150px" style="border-right: none;">
<template slot-scope="scope">
<if condition="$authArr['AdvanceInfo'] eq true">
<el-button @click="AdvanceInfo(scope.row.id)" type="text" size="small">记录</el-button>
</if>
<if condition="$authArr['AdvanceOperation'] eq true">
<el-button @click="AdvanceOperation(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>
<el-dialog title="预付款" :modal-append-to-body="false" :visible.sync="outerVisible">
<div>
<template>
<el-select v-model="type" placeholder="请选择">
<el-option label="增加" value="1"></el-option>
<el-option label="减少" value="2"></el-option>
</el-select>
<el-input v-model="money" placeholder="请输入金额(元)"></el-input>
</template>
<div style="display: flex;justify-content: flex-end">
<el-button type="info" @click="Cancel">取消</el-button>
<el-button type="primary" @click="Submit">确定</el-button>
</div>
</div>
</el-dialog>
</div>
<!--记录-->
<el-dialog title="记录" :modal-append-to-body="false" :visible.sync="infoVisible">
<div style="border: 1px solid #e6e6e6;max-width: calc(100vw - 208px);">
<el-table border :data="recordList" style="width: calc(100vw - 208px);border: none;"
size="mini"
max-height="500"
v-loading="loading2"
element-loading-text="数据获取中"
element-loading-spinner="el-icon-loading">
<el-table-column prop="index" label="序号" show-overflow-tooltip></el-table-column>
<el-table-column prop="supplier_name" label="供货商" show-overflow-tooltip></el-table-column>
<el-table-column prop="operator_name" label="操作人" show-overflow-tooltip></el-table-column>
<el-table-column prop="type_name" label="类型" show-overflow-tooltip></el-table-column>
<el-table-column prop="money" label="金额" show-overflow-tooltip></el-table-column>
<el-table-column prop="add_time" label="操作时间" show-overflow-tooltip></el-table-column>
</el-table>
<el-pagination
@size-change="handleSizeChange2"
@current-change="handleCurrentChange2"
:current-page="currentPage2"
:page-sizes="[10, 15, 20, 25, 30, 35, 40, 45, 50]"
:page-size="100"
layout="total, sizes, prev, pager, next, jumper"
:total="currentLen2">
</el-pagination>
</div>
</el-dialog>
</div>
<script type="text/javascript">
var purchase = new Vue({
el: "#advance",
data: function () {
return {
supplier_name: "",
AdvanceList: [],
currentPage: 1,
currentLimit: 10,
currentLen: 0,
loading: true,
outerVisible: false,
type: "",
money: "",
supplier_id: "",
infoVisible: false,
loading2: true,
recordList: [],
currentPage2: 1,
currentLimit2: 10,
currentLen2: 0,
}
},
methods: {
handleSizeChange: function (val) {
this.currentLimit = val;//切换每页数量
this.currentPage = 1;
this.getData();
},
handleCurrentChange: function (val) {
this.currentPage = val;
this.getData();//切换页数
},
//搜索
search: function () {
this.currentPage = 1;
this.getData();
},
//查询
getData: function () {
var that = this;
that.loading = true;
var page = that.currentPage;
var limit = that.currentLimit;
var supplier_name = that.supplier_name;
$.ajax({
url: "{:U('AdvanceList')}",
type: "post",
data: {
page: page,
limit: limit,
supplier_name: supplier_name
},
success: function (res) {
that.AdvanceList = res.data;
that.loading = false;
that.$nextTick(function () {
that.currentLen = parseInt(res.count);
})
}
})
},
//导出
exportOperation: function () {
var that = this;
var supplier_name = that.supplier_name;
window.location.href = "{:U('export')}?supplier_name=" + supplier_name
},
AdvanceOperation: function (id) {
this.outerVisible = true;
this.type = "";
this.money = "";
this.supplier_id = id;
},
Cancel: function () {
//取消
this.outerVisible = false;
},
Submit: function () {
//提交
var that = this;
var type = that.type;
var money = that.money;
var supplier_id = that.supplier_id;
var reg = /^(([0-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/;
if (!type) {
that.$message({
message: '请选择预付款类型',
type: 'warning',
duration: 1000,
})
return;
}
if (!money || !reg.test(money)) {
that.$message({
message: '请输入正确金额,最多保留两位小数',
type: 'warning',
duration: 1000,
})
return;
}
if (parseFloat(money) > 100000) {
that.$message({
message: '请输入正确金额,最多10万元',
type: 'warning',
duration: 1000,
})
return;
}
$.ajax({
url: "{:U('AdvanceOperation')}",
type: "post",
data: {type: type, money: money, supplier_id: supplier_id},
success: function (res) {
if (res.status == 1) {
that.$message({
message: res.msg,
type: 'success',
duration: 500,
onClose: function () {
that.outerVisible = false;
that.getData();
}
})
} else {
that.$message({
message: res.msg,
type: 'error',
duration: 1000,
})
}
}
})
},
handleSizeChange2: function (val) {
this.currentLimit2 = val;//切换每页数量
this.currentPage2 = 1;
this.record();
},
handleCurrentChange2: function (val) {
this.currentPage2 = val;
this.record();//切换页数
},
AdvanceInfo: function (id) {
//记录
var that = this;
that.infoVisible = true;
that.loading2 = true;
that.supplier_id = id;
that.currentPage2 = 1;
that.record();
},
record: function () {
var that = this;
var supplier_id = that.supplier_id;
var page = that.currentPage2;
var limit = that.currentLimit2;
$.ajax({
url: "{:U('record')}",
type: "post",
data: {supplier_id: supplier_id, page: page, limit: limit},
success: function (res) {
that.recordList = res.data;
that.loading2 = false;
that.$nextTick(function () {
that.currentLen2 = parseInt(res.count);
})
}
})
}
},
created: function () {
this.getData();
}
})
</script>