<!doctype html>
|
<html>
|
<head>
|
<meta charset="utf-8"><meta http-equiv="Expires" content="0"><meta http-equiv="Pragma" content="no-cache"><meta http-equiv="Cache-control" content="no-cache"><meta http-equiv="Cache" content="no-cache">
|
<title>分步返还</title>
|
|
<script src="../../../jsnew/elementDefault.js?v=20220425"></script>
|
<script src="../../../jsnew/vue/vue.js"></script>
|
<script src="../../../jsnew/vue/element-ui/element-ui_15/index.js"></script>
|
<script src="../../../jsnew/myelement.js?v=20220425"></script>
|
<script src="../../../jsnew/page.js?v=20220425"></script>
|
<!-- <script src="../../../setting.js"></script> -->
|
|
<link href="../../../jsnew/vue/element-ui/element-ui_15/theme-chalk/index.css" rel="stylesheet">
|
<link href="../../../jsnew/myelement.css?v=20220426" rel="stylesheet">
|
<link href="../../../jsnew/theme.css?v=20220426" rel="stylesheet">
|
<link href="../../../css/iconfont.css" rel="stylesheet">
|
<link href="../../../jsnew/page.css?v=20220425" rel="stylesheet">
|
<link href="//at.alicdn.com/t/font_2374495_13ltsxm2eor.css" rel="stylesheet">
|
</head>
|
|
<body style="margin: 0px;">
|
<div v-cloak id="vbody">
|
<div id="page_root">
|
<div ref="popup_body" style="padding: 0 20px;">
|
<!-- 标题 -->
|
<div class="el-dialog__header">
|
<div class="dialog-title">
|
<i class="iconfont icon-customermanagement"></i>
|
<span>{{title}}</span>
|
</div>
|
</div>
|
<!-- 主体 -->
|
<div style="width: 100%;">
|
<div style="width: 80%; margin: 0 auto;">
|
<el-steps :direction= "direction" :active="activestep" align-center>
|
<el-step v-for="(step, k) in steps" :key="k" :title="step.name" :icon="step.icon" :description="step.description"></el-step>
|
</el-steps>
|
</div>
|
</div>
|
|
<div class="h_dialog__body">
|
<div v-if="activestep == 0 && selectTabObj.formAttr">
|
<!-- <div class="block">
|
<span class="demonstration">请选择协议类型</span>
|
<el-cascader
|
v-model="value"
|
:options="options"
|
@change="handleChange">
|
</el-cascader>
|
</div> -->
|
<h-form
|
ref="form_mould"
|
:form-attr="selectTabObj.formAttr"
|
:table-fields="selectTabObj.formFields"
|
:form-data="selectTabObj.formData"
|
:table-field-click="selectTabObj.formfieldClick"
|
>
|
</h-form>
|
</div>
|
<div v-if="activestep == 1">
|
<div>
|
<!-- <h-form
|
ref="form_customer"
|
:form-attr="selectTabObj.formAttr"
|
:table-fields="selectTabObj.formFields"
|
:form-data="selectTabObj.formData"
|
:table-field-click="selectTabObj.formfieldClick"
|
>
|
</h-form> -->
|
<div style=" text-align: right; padding: 5px 30px 0px 0px;">
|
<el-button size="small" type="primary" @click="returnDefault">一键返还</el-button>
|
<el-button size="small" type="primary" @click="returnBySelf">手动返还</el-button>
|
</div>
|
|
<h-table
|
v-if="isRefresh && selectTabObj.tableFields.length"
|
ref="table1"
|
:table-fields="selectTabObj.tableFields"
|
:table-data="selectTabObj.tableData"
|
:is-edit-table-data="false"
|
:is-within-edit-table-data="true"
|
:is-pagination="true"
|
:table-field-click="selectTabObj.tablefieldClick"
|
:is-show-index="true"
|
:table-height="selectTabObj.tableHeight"
|
:isdraggableorder="false"
|
|
v-on:get-data="getData"
|
v-on:del-data="delData"
|
>
|
</h-table>
|
</div>
|
</div>
|
</div>
|
|
<!-- 底部工具栏 -->
|
<div class="el-dialog__footer">
|
<el-button size="small" type="default" @click="closeDialog">取 消</el-button>
|
<el-button v-if="activestep > 0" size="small" @click="upStepClick">上一步</el-button>
|
<el-button v-if="activestep < steps.length" size="small" @click="nextStepClick" >{{activestep == (steps.length - 1) ? '完 成' : '下一步'}}</el-button>
|
|
<!-- <el-button size="small" type="primary" @click="saveAfter">确 定</el-button> -->
|
</div>
|
</div>
|
</div>
|
</div>
|
|
<div id="page_loading" style="position: absolute; top:0px; width: 100vw; height: 50vh;">
|
<div class="spinner">
|
<div class="cube1"></div>
|
<div class="cube2"></div>
|
</div>
|
</div>
|
|
</body>
|
|
<script type="text/javascript">
|
function initVue() {
|
new StepsTableVue({
|
el: "#vbody",
|
data: {
|
title: "分步协议模板",
|
//step项设置
|
steps: [
|
{
|
name: "客户选择", type: "form", dataurl: "",
|
formAttr: {
|
columnnumber: 1,
|
labelwidth: "140px",
|
labelposition: "top",//"left",// right//top
|
size: "mini",
|
border: "10px solid #c6c6c600"
|
},
|
formFields: [
|
{isshow: "T", required: true, field: "customer_name", name: "商业名称", inputtype: "popup"},
|
{
|
isshow: "T", required: true, field: "type_code", name: "折让类型", inputtype: "select",
|
options:[
|
{code: "1", value: "商业回笼"},
|
{code: "2", value: "商业当期"},
|
{code: "3", value: "商业调拨"},
|
{code: "4", value: "终端补差"},
|
{code: "5", value: "终端货抵"},
|
{code: "6", value: "年度任务计算"},
|
{code: "7", value: "OTC经销折让"},
|
{code: "8", value: "前台费用—前台"},
|
{code: "9", value: "前台费用—年"},
|
{code: "10", value: "前台费用—季"},
|
{code: "11", value: "前台费用—月"},
|
{code: "12", value: "任务折让—前台"},
|
{code: "13", value: "任务折让—年"},
|
{code: "14", value: "任务折让—季"},
|
{code: "15", value: "任务折让—月"},
|
{code: "16", value: "净销任务—前台"},
|
{code: "17", value: "净销任务—年"},
|
{code: "18", value: "净销任务—季"},
|
{code: "19", value: "净销任务—月"},
|
],
|
},
|
{isshow: "F", required: false, field: "type_name", name: "折让类型", inputtype: "span"},
|
{isshow: "T", required: true, field: "return_amount_sum", name: "返还总金额", inputtype: "input", pattern: '^[0-9]+(/.[0-9]{0,4})?$'},
|
]
|
},
|
{
|
name: "返还数据", type: "table", dataurl: "",
|
tableFields: [
|
// {isshow: "T", field: "customer_code", name: "商业编码", width: "150", type: "span", isminwidth: true,},
|
// {isshow: "T", field: "customer_name", name: "商业名称", width: "200", type:"span", isminwidth: true,},
|
{isshow: "T", field: "create_time", name: "创建时间", type: "span", formatter: "formatter_date", width: "150",},
|
{isshow: "T", field: "return_amount_need", name: "应返还金额", width: "200", type:"span", formatter: "formatter_money", align: "right", isminwidth: true,},
|
{isshow: "T", field: "return_amount_real", name: "实际返还金额", width: "200", type:"span", formatter: "formatter_money", align: "right", isminwidth: true,},
|
],
|
tableData: [
|
{
|
id: "08",
|
create_time: "2022-11-11",
|
return_amount_need: "1100",
|
return_amount_real: "",
|
},
|
{
|
id: "01",
|
create_time: "2022-12-12",
|
return_amount_need: "1200",
|
return_amount_real: "",
|
},
|
{
|
// customer_code: "10010064",
|
// customer_name: "云南博泰药业有限公司",
|
id: "02",
|
create_time: "2023-01-01",
|
return_amount_need: "100",
|
return_amount_real: "",
|
},
|
{
|
// customer_code: "10010058",
|
// customer_name: "合肥亿帆医药有限公司",
|
id: "03",
|
create_time: "2023-02-02",
|
return_amount_need: "200",
|
return_amount_real: "",
|
},
|
{
|
id: "04",
|
create_time: "2023-03-03",
|
return_amount_need: "300",
|
return_amount_real: "",
|
},
|
{
|
id: "05",
|
create_time: "2023-04-04",
|
return_amount_need: "400",
|
return_amount_real: "",
|
},
|
{
|
id: "06",
|
create_time: "2023-05-05",
|
return_amount_need: "500",
|
return_amount_real: "",
|
},
|
{
|
id: "07",
|
create_time: "2023-06-06",
|
return_amount_need: "600",
|
return_amount_real: "",
|
},
|
],
|
},
|
],
|
dataRequest: [
|
// {
|
// isClientMode: false,
|
// name: "agm_category",
|
// //url: "root/front/getOneDictionary",
|
// //paramsobj: { code: "OrgType", },
|
// isnotoption: false, //true:不是选项
|
// code:"id",//是下拉选项时设置
|
// label:"name",//是下拉选项时设置
|
// },
|
],
|
dataRequestObj: {},
|
|
popupParames: {},
|
|
agm_category: [],
|
deepistCategory: "",
|
returnSum: "",
|
},
|
created() {
|
this.popupParames = clone(Root.popupParames);
|
this.title = this.popupParames.title || this.popupParames.text;
|
if (this.popupParames.filter) {
|
this.filterTxt = this.popupParames.filter;
|
}
|
},
|
|
mounted() {
|
var me = this;
|
this.activestep = 0;
|
//预加载数据
|
if (this.dataRequest.length) {
|
var result = {};
|
this.loadRequestData(this.dataRequest, result, function(data) {
|
me.dataRequestObj = data;
|
|
//获取数据
|
me.initStepsPage(function() {
|
me.initData();
|
});
|
});
|
}
|
else {
|
//获取数据
|
this.initStepsPage(function() {
|
me.initData();
|
});
|
}
|
|
this.$nextTick(() => { // 以服务的方式调用的 Loading 需要异步关闭
|
hideLoading();
|
});
|
},
|
|
methods:{
|
//关闭弹窗
|
closeDialog() {
|
this.docloseDialog(true);
|
},
|
|
//关闭前调回调
|
saveAfter() {
|
var me = this;
|
if(this.popupParames.callback) {
|
let obj = {
|
form0: clone(me.stepspageobj[0].formData),
|
form1: clone(me.stepspageobj[1].tableData),
|
}
|
this.popupParames.callback(obj, function() {
|
me.docloseDialog();
|
});
|
}
|
else {
|
me.docloseDialog();
|
}
|
},
|
|
onsaveAfter() {
|
var me = this;
|
|
//必填项校验
|
var bo1 = this.$refs.form_customer.checkForm();
|
if(!bo1){
|
Root.message({
|
type: 'error',
|
message: '请填写必填项'
|
});
|
return;
|
}
|
|
me.saveAfter();
|
},
|
|
initData() {
|
var me = this;
|
this.doQueryByStep(function(result, callback) {//查询后的回调,用于获取字段的
|
if (result && result.meta && result.meta[me.selectTabObj.dataname]) {
|
var metas = clone(result.meta[me.selectTabObj.dataname].fields);
|
var filterFields_ = [];
|
var tableFields_ = [];
|
|
metas.map(f=>{
|
f.isshow = "T";
|
})
|
if (!me.selectTabObj.formFields || (me.selectTabObj.formFields && me.selectTabObj.formFields.length == 0)) {
|
//字段数组转字段obj
|
// me.fieldsToFieldsObj();
|
|
//设置字段事件
|
me.tableFieldClick();
|
}
|
}
|
else {
|
//设置字段事件
|
me.tableFieldClick();
|
}
|
|
if (callback) {
|
callback();
|
}
|
});
|
},
|
|
onStepClick() {
|
this.initData();
|
},
|
|
//下一步
|
onNextStepClick() {
|
var me = this;
|
if (this.activestep == 0) {
|
//必填项校验
|
var bo1 = this.$refs.form_mould.checkForm();
|
if(!bo1){
|
Root.message({
|
type: 'error',
|
message: '请填写必填项或检查数据格式'
|
});
|
return;
|
}
|
|
else {
|
// if (me.stepspageobj[0].formData.category_id && me.stepspageobj[0].formData.template_name) {
|
this.activestep += 1;
|
// me.agm_category.map( a=> {
|
// if (a.id == me.stepspageobj[0].formData.category_id) {
|
// me.stepspageobj[0].formData.category_name = a.name;
|
// }
|
// })
|
if (this.activestep == 1) {
|
this.steps[0].name = me.stepspageobj[0].formData.customer_name;
|
this.steps[0].description = me.stepspageobj[0].formData.type_name;
|
}
|
this.returnSum = me.stepspageobj[0].formData.return_amount_sum;
|
this.selectTabObj = this.stepspageobj[this.activestep];
|
// this.stepspageobj[1].filterTxt = " customer_name='" + me.stepspageobj[0].formData.customer_name + "' and state_code='Open'"
|
this.onStepClick();
|
// }
|
}
|
}
|
else if (this.activestep == 1) {
|
// me.onsaveAfter();
|
me.returnData();
|
}
|
},
|
|
//上一步
|
onUpStepClick() {
|
this.activestep -= 1;
|
if (this.activestep == 0) {
|
this.steps[0].name = "客户选择";
|
this.steps[0].description = "";
|
}
|
this.selectTabObj = this.stepspageobj[this.activestep];
|
this.onStepClick();
|
},
|
|
returnBySelf() {
|
var me = this;
|
var tableFields_ = clone(me.stepspageobj[1].tableFields);
|
tableFields_.map( t=> {
|
if (t.field == "return_amount_real") {
|
t.type = "input";
|
// t.inputkeys = "number";
|
}
|
})
|
me.stepspageobj[1].tableFields = clone(tableFields_);
|
},
|
|
returnDefault() {
|
var me = this;
|
var sum = clone(me.returnSum);
|
|
for (var td in me.stepspageobj[1].tableData) {
|
if (sum * 1 >= me.stepspageobj[1].tableData[td].return_amount_need * 1) {
|
me.stepspageobj[1].tableData[td].return_amount_real = me.stepspageobj[1].tableData[td].return_amount_need;
|
sum = sum * 1 - me.stepspageobj[1].tableData[td].return_amount_need * 1;
|
} else {
|
me.stepspageobj[1].tableData[td].return_amount_real = sum;
|
sum = 0;
|
break;
|
}
|
}
|
|
// me.stepspageobj[1].tableData.map ( td => {
|
// if (sum * 1 >= td.return_amount_need * 1) {
|
// td.return_amount_real = td.return_amount_need;
|
// sum = sum * 1 - td.return_amount_need * 1;
|
// } else {
|
// td.return_amount_real = sum;
|
// sum = 0;
|
// }
|
// })
|
},
|
|
returnData() {
|
var me = this;
|
var sum_ = 0;
|
me.stepspageobj[1].tableData.map( td => {
|
sum_ += td.return_amount_real*1;
|
})
|
if (sum_ != me.returnSum) {
|
Root.message({
|
type: 'error',
|
message: '输入的总返还金额为:' + me.returnSum + ', 与实际的返还总金额:' + sum_ + '不相等。请重新调整'
|
});
|
return;
|
} else {
|
Root.message({
|
type: 'success',
|
message: '已成功返还'
|
});
|
me.saveAfter();
|
}
|
},
|
|
tableFieldClick() {
|
var me = this;
|
var tablefieldClick = [];
|
//表格字段事件设置
|
tablefieldClick[0] = {
|
return_amount_sum: {
|
input: {
|
onchange: function(obj) {
|
me.stepspageobj[1].tableData.map( td => {
|
td.return_amount_real = "";
|
})
|
}
|
}
|
},
|
type_code: {
|
select: {
|
onchange: function(obj) {
|
me.stepspageobj[0].formData.type_name = obj.selectoption.value;
|
}
|
}
|
},
|
customer_name: {
|
popup: {
|
onclick: function(obj) {//弹窗点击事件
|
//打开
|
me.open_customerlist(obj);
|
}
|
},
|
},
|
};
|
tablefieldClick[1] = {
|
return_amount_real: {
|
input: {
|
onchange: function(obj) {
|
console.log(obj);
|
if (obj.row.return_amount_real && obj.row.return_amount_need) {
|
if (obj.row.return_amount_real * 1 > obj.row.return_amount_need * 1) {
|
Root.message({
|
type: 'warning',
|
message: '输入的实际返还金额大于应返还金额'
|
});
|
obj.row.return_amount_real = "";
|
}
|
}
|
}
|
}
|
}
|
};
|
|
//根据不同的类型设置字段事件
|
this.selectTabObj.formfieldClick = tablefieldClick[this.activestep];
|
this.selectTabObj.tablefieldClick = tablefieldClick[this.activestep];
|
},
|
|
//客户选择
|
open_customerlist(obj) {
|
var me = this;
|
|
var config = {
|
totab: false, //true: 以Tab导航的方式打开
|
width: "900px",
|
height: "450px",
|
icon: "icon-product",
|
text: "选择客户",
|
id: "popup_return_customer_info",//totab: true时需设置,用于判断是否已打开此页面
|
url: "../tradeDiscount/discount/popup_return_customer_info.html",
|
data: {},
|
delta: {},
|
filter: "1 = 1",
|
sceneCode: "add", //"add"//"browse",
|
callback: function(obj, callback) {
|
let formData_ = clone(me.stepspageobj[0].formData);
|
|
formData_.customer_id = obj.row.id;
|
formData_.customer_name = obj.row.name;
|
formData_.customer_code = obj.row.code;
|
me.stepspageobj[0].formData = formData_;
|
|
if (callback) {
|
callback();
|
}
|
}
|
};
|
me.doPopupByPublic(config);
|
},
|
|
onRowClick(obj) {
|
this.stepspageobj[1].selectedrow = obj.row;
|
},
|
|
onRowDblClick(obj) {
|
this.stepspageobj[1].selectedrow = obj.row;
|
this.onsaveAfter();
|
},
|
}
|
});
|
};
|
|
// loadJsCss(function () {
|
initVue();
|
// });
|
</script>
|
<style>
|
/* 在vue.js中 v-cloak 这个指令是防止页面加载时出现 vuejs 的变量名而设计的 */
|
[v-cloak] {
|
display: none !important;
|
}
|
|
.el-dialog__footer {
|
position: absolute;
|
bottom: 0;
|
left: 20px;
|
right: 20px;
|
}
|
|
</style>
|
</html>
|