tb-business-item-supplement.html 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5. <meta name="viewport"
  6. content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  7. <!-- 所有的 css js 资源 -->
  8. <link rel="stylesheet" href="../../static/kj/element-ui/theme-chalk/index.css">
  9. <link rel="stylesheet" href="../../static/sa.css">
  10. <script src="../../static/kj/vue.min.js"></script>
  11. <script src="../../static/kj/element-ui/index.js"></script>
  12. <script src="../../static/kj/httpVueLoader.js"></script>
  13. <script src="../../static/kj/jquery.min.js"></script>
  14. <script src="../../static/kj/layer/layer.js"></script>
  15. <script src="../../static/sa.js"></script>
  16. <style type="text/css">
  17. .c-panel .el-form .c-label {
  18. width: 8em !important;
  19. }
  20. .c-panel .el-form .el-input,
  21. .c-panel .el-form .el-textarea__inner {
  22. width: 250px;
  23. }
  24. .item-num .el-input__inner {
  25. width: 130px;
  26. display: inline;
  27. }
  28. </style>
  29. </head>
  30. <body>
  31. <div class="vue-box sbot" style="display: none;" :style="'display: block;'">
  32. <!-- ------- 内容部分 ------- -->
  33. <div class="s-body">
  34. <div class="c-panel">
  35. <el-form>
  36. <div style="margin-top: 20px;">
  37. <div>
  38. <div class="c-item">
  39. <label class="c-label"><span style="color: red;">*</span>业务类型:</label>
  40. <el-select v-model="m.itemTypeId" placeholder="请选择" filterable @change="itemTypeChange">
  41. <el-option :label="type.name" :value="type.id"
  42. v-for="(type,index) in businessTypeList">
  43. </el-option>
  44. </el-select>
  45. <div>
  46. <label class="c-label"><span style="color: red;">*</span>车型:</label>
  47. <el-select v-model="m.itemId" placeholder="请选择">
  48. <el-option :label="detail.itemName+'('+detail.price+'/'+detail.unit+')'" :value="detail.id"
  49. v-for="(detail,i) in items">
  50. </el-option>
  51. </el-select>
  52. </div>
  53. <label class="c-label" style="width: 160px;">数量:</label>
  54. <el-input-number v-model="m.num" class="item-num " v-model="item.num" :step="1"
  55. :min="1" :max="999">
  56. </el-input-number>
  57. </div>
  58. <div class="c-item" v-if="totalMoney>0">
  59. <label class="c-label"><span style="color: red;font-weight: 500;">总金额:¥{{totalMoney}}</span></label>
  60. </div>
  61. </div>
  62. </div>
  63. </el-form>
  64. </div>
  65. </div>
  66. <!-- ------- 底部按钮 ------- -->
  67. <div class="s-foot">
  68. <el-button type="primary" @click="ok()">确定</el-button>
  69. <el-button @click="sa.closeCurrIframe()">取消</el-button>
  70. </div>
  71. </div>
  72. <script>
  73. var app = new Vue({
  74. components: {
  75. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue')
  76. },
  77. el: '.vue-box',
  78. data: {
  79. m: {
  80. itemTypeId: '', // 名称
  81. itemId: '',
  82. businessId:sa.p('id', 0),
  83. num: 1,
  84. }, // 实体对象
  85. list: [],
  86. businessTypeList :[],
  87. items: [],
  88. },
  89. computed:{
  90. totalMoney(){
  91. let itemId=this.m.itemId;
  92. if(itemId){
  93. let items=this.items;
  94. let item= items.filter(item=>item.id==itemId)[0];
  95. return item.price*this.m.num;
  96. }
  97. return 0;
  98. }
  99. },
  100. methods: {
  101. getBusinessType() {
  102. sa.ajax('/TbItemType/getList', {
  103. sortType: 0,
  104. pageSize: 50
  105. }, function(resp) {
  106. let list = resp.data;
  107. this.businessTypeList = list;
  108. }.bind(this))
  109. },
  110. itemTypeChange(itemTypeId) {
  111. sa.ajax('/TbItem/getByItemTypeId', {
  112. itemTypeId: itemTypeId
  113. }, function(resp) {
  114. let list = resp.data;
  115. if (list.length > 0) {
  116. this.m.itemId = list[0].id;
  117. }
  118. this.items = list;
  119. }.bind(this))
  120. },
  121. // 提交数据
  122. ok: function() {
  123. // 表单校验
  124. let m = this.m;
  125. if(!m.itemTypeId){
  126. sa.error('请选择业务类型')
  127. return;
  128. }
  129. if(!m.itemId){
  130. sa.error('请选择车型')
  131. return;
  132. }
  133. sa.confirm('是否确认添加该缴费补录?', function () {
  134. sa.ajax('/TbBusinessItem/add', m, function(res) {
  135. sa.alert('补录成功', this.clean);
  136. }.bind(this));
  137. }.bind(this));
  138. },
  139. // 添加/修改 完成后的动作
  140. clean: function() {
  141. parent.app.getInfo(); // 刷新父页面列表
  142. sa.closeCurrIframe();
  143. }
  144. },
  145. mounted: function() {
  146. this.getBusinessType();
  147. }
  148. })
  149. </script>
  150. </body>
  151. </html>