| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 | <!DOCTYPE html><html>	<head>		<title>边民收益设置-添加/修改</title>		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">		<meta name="viewport"			content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />		<!-- 所有的 css js 资源 -->		<link rel="stylesheet" href="../../static/kj/element-ui/theme-chalk/index.css">		<link rel="stylesheet" href="../../static/sa.css">		<script src="../../static/kj/vue.min.js"></script>		<script src="../../static/kj/element-ui/index.js"></script>		<script src="../../static/kj/httpVueLoader.js"></script>		<script src="../../static/kj/jquery.min.js"></script>		<script src="../../static/kj/layer/layer.js"></script>		<script src="../../static/sa.js"></script>		<style type="text/css">			.c-panel .el-form .c-label {				width: 7em !important;			}			.c-panel .el-form .el-input,			.c-panel .el-form .el-textarea__inner {				width: 250px;			}		</style>	</head>	<body>		<div class="vue-box" :class="{sbot: null}" style="display: none;" :style="'display: block;'">			<!-- ------- 内容部分 ------- -->			<div class="s-body">				<div class="c-panel">					<div class="c-title">边民收益设置</div>					<el-form size="mini" v-if="m">						<div class="c-item br">							<label class="c-label"></label>							<el-radio-group v-model="m.type" size="mini">								<div style="height: 40px"></div>								<el-radio :label=1>每笔交易收益(元)</el-radio>								<div v-if="m.type == 1" style="float: right">									<el-input size="mini" type='number' v-model="n.num1"></el-input>								</div>								<br>								<div style="height: 40px"></div>								<el-radio :label=2>交易额比例计算收益(%)</el-radio>								<div v-if="m.type == 2" style="float: right">									<el-input size="mini" type='number' v-model="n.num2"></el-input>								</div>							</el-radio-group>						</div>						<div class="c-item br s-ok">							<label class="c-label"></label>							<el-button size="mini" type="primary" icon="" @click="save()">保存设置</el-button>						</div>					</el-form>				</div>			</div>		</div>		<script>			var app = new Vue({				el: '.vue-box',				data: {					m: {						id: '', // 主键						type: 0, // 类型(0=均分,1=按笔数算,2=交易比例)						typeName: '', // 类型名称						status: '', // 状态(0=启用,1=禁用)						num: '', // 数值					}, // 实体对象					n: {						num1: '',						num2: '',					}				},				methods: {					f5: function() {						sa.ajax('/level-two-server/TbPeopleProfit/getOne', function(res) {							if (res.data) {								this.m = res.data; // 数据								if (this.m.type == 1) {									this.n.num1 = this.m.num;								}								if (this.m.type == 2) {									this.n.num2 = this.m.num * 100;								}							}						}.bind(this));					},					// 创建一个 默认Model					createModel: function() {						return {							id: '', // 主键							type: '', // 类型(0=均分,1=按笔数算,2=交易比例)							typeName: '', // 类型名称							status: '', // 状态(0=启用,1=禁用)							num: '', // 数值						}					},					save() {						if (this.m.type == 0) {							this.m.typeName = '均分';							this.m.status = 0;							this.m.num = null;						}						if (this.m.type == 1) {							this.m.typeName = '按笔数算';							this.m.status = 0;							this.m.num = this.n.num1;						}						if (this.m.type == 2) {							this.m.typeName = '交易比例';							this.m.status = 0;							this.m.num = this.n.num2 / 100;						}						if (this.m.id <= 0) { // 添加							sa.ajax('/level-two-server/TbPeopleProfit/add', this.m, function(res) {								sa.alert('保存成功', this.f5);							}.bind(this));						} else { // 修改							sa.ajax('/level-two-server/TbPeopleProfit/update', this.m, function(res) {								sa.alert('保存成功', this.f5);							}.bind(this));						}					},					// 表单验证					submitCheck: function() {						try {							var m = this.m; // 获取 m对象							// sa.checkNull(m.id, '请输入 [主键]');							sa.checkNull(m.type, '请输入 [类型]');							sa.checkNull(m.typeName, '请输入 [类型名称]');							sa.checkNull(m.status, '请输入 [状态]');							// sa.checkNull(m.num, '请输入 [数值]');							return 'ok'; // 全部通过验证,返回ok 表示正确						} catch (e) {							sa.error(e);						}					},				},				mounted: function() {					// 初始化数据					this.f5();				}			})		</script>	</body></html>
 |