tb-people-profit-set.html 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>边民收益设置-添加/修改</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  6. <meta name="viewport"
  7. content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  8. <!-- 所有的 css js 资源 -->
  9. <link rel="stylesheet" href="../../static/kj/element-ui/theme-chalk/index.css">
  10. <link rel="stylesheet" href="../../static/sa.css">
  11. <script src="../../static/kj/vue.min.js"></script>
  12. <script src="../../static/kj/element-ui/index.js"></script>
  13. <script src="../../static/kj/httpVueLoader.js"></script>
  14. <script src="../../static/kj/jquery.min.js"></script>
  15. <script src="../../static/kj/layer/layer.js"></script>
  16. <script src="../../static/sa.js"></script>
  17. <style type="text/css">
  18. .c-panel .el-form .c-label {
  19. width: 7em !important;
  20. }
  21. .c-panel .el-form .el-input,
  22. .c-panel .el-form .el-textarea__inner {
  23. width: 250px;
  24. }
  25. </style>
  26. </head>
  27. <body>
  28. <div class="vue-box" :class="{sbot: null}" style="display: none;" :style="'display: block;'">
  29. <!-- ------- 内容部分 ------- -->
  30. <div class="s-body">
  31. <div class="c-panel">
  32. <div class="c-title">边民收益设置</div>
  33. <el-form size="mini" v-if="m">
  34. <div class="c-item br">
  35. <label class="c-label"></label>
  36. <el-radio-group v-model="m.type" size="mini">
  37. <div style="height: 40px"></div>
  38. <el-radio :label=1>每笔交易收益(元)</el-radio>
  39. <div v-if="m.type == 1" style="float: right">
  40. <el-input size="mini" type='number' v-model="n.num1"></el-input>
  41. </div>
  42. <br>
  43. <div style="height: 40px"></div>
  44. <el-radio :label=2>交易额比例计算收益(%)</el-radio>
  45. <div v-if="m.type == 2" style="float: right">
  46. <el-input size="mini" type='number' v-model="n.num2"></el-input>
  47. </div>
  48. </el-radio-group>
  49. </div>
  50. <div class="c-item br s-ok">
  51. <label class="c-label"></label>
  52. <el-button size="mini" type="primary" icon="" @click="save()">保存设置</el-button>
  53. </div>
  54. </el-form>
  55. </div>
  56. </div>
  57. </div>
  58. <script>
  59. var app = new Vue({
  60. el: '.vue-box',
  61. data: {
  62. m: {
  63. id: '', // 主键
  64. type: 0, // 类型(0=均分,1=按笔数算,2=交易比例)
  65. typeName: '', // 类型名称
  66. status: '', // 状态(0=启用,1=禁用)
  67. num: '', // 数值
  68. }, // 实体对象
  69. n: {
  70. num1: '',
  71. num2: '',
  72. }
  73. },
  74. methods: {
  75. f5: function() {
  76. sa.ajax('/level-two-server/TbPeopleProfit/getOne', function(res) {
  77. if (res.data) {
  78. this.m = res.data; // 数据
  79. if (this.m.type == 1) {
  80. this.n.num1 = this.m.num;
  81. }
  82. if (this.m.type == 2) {
  83. this.n.num2 = this.m.num * 100;
  84. }
  85. }
  86. }.bind(this));
  87. },
  88. // 创建一个 默认Model
  89. createModel: function() {
  90. return {
  91. id: '', // 主键
  92. type: '', // 类型(0=均分,1=按笔数算,2=交易比例)
  93. typeName: '', // 类型名称
  94. status: '', // 状态(0=启用,1=禁用)
  95. num: '', // 数值
  96. }
  97. },
  98. save() {
  99. if (this.m.type == 0) {
  100. this.m.typeName = '均分';
  101. this.m.status = 0;
  102. this.m.num = null;
  103. }
  104. if (this.m.type == 1) {
  105. this.m.typeName = '按笔数算';
  106. this.m.status = 0;
  107. this.m.num = this.n.num1;
  108. }
  109. if (this.m.type == 2) {
  110. this.m.typeName = '交易比例';
  111. this.m.status = 0;
  112. this.m.num = this.n.num2 / 100;
  113. }
  114. if (this.m.id <= 0) { // 添加
  115. sa.ajax('/level-two-server/TbPeopleProfit/add', this.m, function(res) {
  116. sa.alert('保存成功', this.f5);
  117. }.bind(this));
  118. } else { // 修改
  119. sa.ajax('/level-two-server/TbPeopleProfit/update', this.m, function(res) {
  120. sa.alert('保存成功', this.f5);
  121. }.bind(this));
  122. }
  123. },
  124. // 表单验证
  125. submitCheck: function() {
  126. try {
  127. var m = this.m; // 获取 m对象
  128. // sa.checkNull(m.id, '请输入 [主键]');
  129. sa.checkNull(m.type, '请输入 [类型]');
  130. sa.checkNull(m.typeName, '请输入 [类型名称]');
  131. sa.checkNull(m.status, '请输入 [状态]');
  132. // sa.checkNull(m.num, '请输入 [数值]');
  133. return 'ok'; // 全部通过验证,返回ok 表示正确
  134. } catch (e) {
  135. sa.error(e);
  136. }
  137. },
  138. },
  139. mounted: function() {
  140. // 初始化数据
  141. this.f5();
  142. }
  143. })
  144. </script>
  145. </body>
  146. </html>