tb-deduction-bind-unbind.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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" :disabled="true" br></sa-item>
  37. <sa-item id="ast" name="解绑时间" br>
  38. <el-date-picker
  39. v-model="m.unbindTime"
  40. type="datetime"
  41. placeholder="选择日期时间"
  42. align="right"
  43. :picker-options="pickerOptions">
  44. </el-date-picker>
  45. </sa-item>
  46. <sa-item name="" class="s-ok" br>
  47. <el-button type="primary" icon="el-icon-plus" @click="ok()">保存</el-button>
  48. </sa-item>
  49. </el-form>
  50. </div>
  51. </div>
  52. <!-- ------- 底部按钮 ------- -->
  53. <div class="s-foot">
  54. <el-button type="primary" @click="ok()">确定</el-button>
  55. <el-button @click="sa.closeCurrIframe()">取消</el-button>
  56. </div>
  57. </div>
  58. <script>
  59. var app = new Vue({
  60. components: {
  61. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue')
  62. },
  63. el: '.vue-box',
  64. data: {
  65. customerId:sa.p('customerId', 0),
  66. id: sa.p('id', 0), // 获取超链接中的id参数(0=添加,非0=修改)
  67. m: null, // 实体对象
  68. pickerOptions: {
  69. shortcuts: [{
  70. text: '今天',
  71. onClick(picker) {
  72. picker.$emit('pick', new Date());
  73. }
  74. }, {
  75. text: '昨天',
  76. onClick(picker) {
  77. const date = new Date();
  78. date.setTime(date.getTime() - 3600 * 1000 * 24);
  79. picker.$emit('pick', date);
  80. }
  81. }]
  82. }
  83. },
  84. methods: {
  85. // 创建一个 默认Model
  86. createModel: function () {
  87. return {
  88. id: '', // 主键
  89. customerId: '', // 客户id
  90. customerName: '', // 客户名称
  91. deductMoney: '', // 扣除金额
  92. bindCar: '', // 绑定车辆
  93. bindTime: undefined, // 绑定时间
  94. unbindTime: undefined, // 解绑时候
  95. createBy: '', // 创建人
  96. createTime: undefined, // 创建时间
  97. updateTime: undefined, // 更新时间
  98. updateBy: '', // 更新人
  99. }
  100. },
  101. // 提交数据
  102. ok: function () {
  103. // 表单校验
  104. let m = this.m;
  105. sa.checkNull(m.bindCar, '请输入 [绑定车辆]');
  106. sa.checkNull(m.unbindTime, '解绑时间不能为空');
  107. //绑定车辆
  108. sa.ajax('/TbDeductionBind/unbindCar', m, function (res) {
  109. sa.alert('解绑成功', this.clean);
  110. }.bind(this));
  111. },
  112. // 添加/修改 完成后的动作
  113. clean: function () {
  114. parent.app.f5(); // 刷新父页面列表
  115. sa.closeCurrIframe();
  116. },
  117. getTbDeductionBind(){
  118. if(!this.id || this.id=="null" || this.id=="undefined"){
  119. sa.error2("没有车辆绑定信息!")
  120. return false;
  121. }
  122. sa.ajax('/TbDeductionBind/getById?id=' + this.id, function (res) {
  123. this.m = res.data;
  124. this.m.unbindTime = sa.forDatetime(new Date());
  125. if (res.data == null) {
  126. sa.alert('未能查找到 id=' + this.id + " 详细数据");
  127. return false;
  128. }
  129. }.bind(this))
  130. return true;
  131. }
  132. },
  133. mounted: function () {
  134. // 初始化数据
  135. if(!this.getTbDeductionBind()){
  136. setTimeout(function(){ sa.closeCurrIframe() }, 2000)
  137. }
  138. }
  139. })
  140. </script>
  141. </body>
  142. </html>