tb-deduction-bind-add.html 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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="https://unpkg.com/element-ui@2.13.0/lib/theme-chalk/index.css">
  10. <link rel="stylesheet" href="../../static/sa.css">
  11. <script src="https://unpkg.com/vue@2.6.10/dist/vue.js"></script>
  12. <script src="https://unpkg.com/element-ui@2.13.0/lib/index.js"></script>
  13. <script src="https://unpkg.com/http-vue-loader@1.4.2/src/httpVueLoader.js"></script>
  14. <script src="https://unpkg.com/jquery@3.4.1/dist/jquery.js"></script>
  15. <script src="https://www.layuicdn.com/layer-v3.1.1/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, .c-panel .el-form .el-textarea__inner {
  22. width: 250px;
  23. }
  24. </style>
  25. </head>
  26. <body>
  27. <div class="vue-box" style="display: none;" :style="'display: block;'">
  28. <!-- ------- 内容部分 ------- -->
  29. <div class="s-body">
  30. <div class="c-panel" style="text-align:center;">
  31. <div class="c-title" >车辆绑定</div>
  32. <el-form v-if="m">
  33. <!-- <sa-item type="text" name="主键" v-model="m.id" br></sa-item>-->
  34. <!-- <sa-item type="text" name="客户id" v-model="m.customerId" br></sa-item>-->
  35. <sa-item type="text" name="客户名称" v-model="m.customerName" :disabled="true" br></sa-item>
  36. <sa-item id="ast" type="text" name="绑定车辆" v-model="m.bindCar" br></sa-item>
  37. <sa-item type="text" name="绑定时间" v-model="m.bindTime" :disabled="true" br></sa-item>
  38. <sa-item name="" class="s-ok" br>
  39. <el-button type="primary" icon="el-icon-plus" @click="ok()">保存</el-button>
  40. </sa-item>
  41. </el-form>
  42. </div>
  43. </div>
  44. <!-- ------- 底部按钮 ------- -->
  45. <!-- <div class="s-foot">-->
  46. <!-- <el-button type="primary" @click="ok()">确定</el-button>-->
  47. <!-- <el-button @click="sa.closeCurrIframe()">取消</el-button>-->
  48. <!-- </div>-->
  49. </div>
  50. <script>
  51. var app = new Vue({
  52. components: {
  53. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue')
  54. },
  55. el: '.vue-box',
  56. data: {
  57. customerId:sa.p('customerId', 0),
  58. id: sa.p('id', 0), // 获取超链接中的id参数(0=添加,非0=修改)
  59. m: null, // 实体对象
  60. },
  61. methods: {
  62. // 创建一个 默认Model
  63. createModel: function () {
  64. return {
  65. id: '', // 主键
  66. customerId: '', // 客户id
  67. customerName: '', // 客户名称
  68. deductMoney: '', // 扣除金额
  69. bindCar: '', // 绑定车辆
  70. bindTime: sa.forDatetime(new Date()), // 绑定时间
  71. unbindTime: undefined, // 解绑时候
  72. createBy: '', // 创建人
  73. createTime: undefined, // 创建时间
  74. updateTime: undefined, // 更新时间
  75. updateBy: '', // 更新人
  76. }
  77. },
  78. // 提交数据
  79. ok: function () {
  80. // 表单校验
  81. let m = this.m;
  82. // sa.checkNull(m.id, '请输入 [主键]');
  83. // sa.checkNull(m.customerId, '请输入 [客户id]');
  84. // sa.checkNull(m.customerName, '请输入 [客户名称]');
  85. // sa.checkNull(m.deductMoney, '请输入 [扣除金额]');
  86. sa.checkNull(m.bindCar, '请输入 [绑定车辆]');
  87. if(!sa.isCarNo(m.bindCar)){
  88. sa.error("请输入正确的车牌号!");
  89. return;
  90. }
  91. //绑定车辆
  92. sa.ajax('/TbDeductionBind/bindCar', m, function (res) {
  93. sa.alert('绑定成功', this.clean);
  94. }.bind(this));
  95. },
  96. // 添加/修改 完成后的动作
  97. clean: function () {
  98. parent.app.f5(); // 刷新父页面列表
  99. sa.closeCurrIframe();
  100. }
  101. },
  102. mounted: function () {
  103. // 初始化数据
  104. this.m = this.createModel();
  105. this.m.customerId = this.customerId;
  106. sa.ajax('/TbDeductionBind/getList', sa.removeNull(this.m), function (res) {
  107. if(res.data && res.data.length>0){
  108. this.m.customerName = res.data[0].customerName;
  109. }else {
  110. sa.alert('未能查找到客户详细数据,车辆绑定窗口将在5秒后关闭!');
  111. setTimeout(function(){ sa.closeCurrIframe() }, 5000)
  112. }
  113. }.bind(this))
  114. }
  115. })
  116. </script>
  117. </body>
  118. </html>