serviceDialog.html 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <title>服务数据对话框</title>
  7. <link rel="stylesheet" type="text/css" href="../../../css/bootstrap.min.css" />
  8. <link rel="stylesheet" type="text/css" href="../../../css/style.min.css" />
  9. <link rel="stylesheet" type="text/css" href="../../../css/cross.css" />
  10. <link rel="stylesheet" href="../../../plugins/toastr/toastr.min.css" />
  11. <link rel="stylesheet" href="../../../plugins/element-ui/element-ui.css" />
  12. <link rel="stylesheet" type="text/css" href="../css/date.css" />
  13. <link rel="stylesheet" href="../css/common.css" />
  14. <style>
  15. #app{
  16. padding: 8px 16px;
  17. }
  18. .plus-icon{
  19. border: 1px solid rgba(0, 0, 0, .1);
  20. font-size: 16px;
  21. padding: 7px;
  22. }
  23. .list-box{
  24. height: 630px;
  25. overflow: auto;
  26. }
  27. .item{
  28. padding: 8px;
  29. border-bottom: 1px solid rgba(0, 0, 0, .1);
  30. }
  31. .item .title{
  32. font-weight: bold;
  33. font-size: 16px;
  34. }
  35. .item .bottom{
  36. display: flex;
  37. justify-content: space-between;
  38. align-items: center;
  39. }
  40. .expense{
  41. color: #17b3ec;
  42. }
  43. .submit-btn{
  44. display: block;
  45. margin: 10px auto 0;
  46. }
  47. </style>
  48. </head>
  49. <body>
  50. <div id="app" v-cloak>
  51. <el-tabs v-model="active" type="card" @tab-click="handleClick">
  52. <el-tab-pane :label="tab.type" :name="tab.code" v-for="tab in tabList">
  53. <div class="list-box" >
  54. <div class="item" v-for="item in list[active]" :key="item.code">
  55. <div class="title">{{item.title}}</div>
  56. <div class="bottom">
  57. <div class="expense">¥{{item.expense}}</div>
  58. <div>
  59. <el-input-number v-model="checkList[item.code].num" size="small" v-if="checkList[item.code]&&checkList[item.code].num>0" :min="0"></el-input-number>
  60. <i class="el-icon-plus plus-icon" v-else @click="addService(item)"></i>
  61. </div>
  62. </div>
  63. </div>
  64. </div>
  65. </el-tab-pane>
  66. </el-tabs>
  67. <el-button type="primary" @click="submit" class="submit-btn">{{setBtnText()}}</el-button>
  68. </div>
  69. <script type="text/javascript" src="../../../js/vue.js"></script>
  70. <script type="text/javascript" src="../../../js/jquery-2.2.4.js"></script>
  71. <script type="text/javascript" src="../../../js/es6-promise.js" charset="utf-8"></script>
  72. <script type="text/javascript" src="../../../plugins/toastr/toastr.min.js"></script>
  73. <script type="text/javascript" src="../../../plugins/element-ui/element-ui.js"></script>
  74. <script type="text/javascript" src="../../../api/http-request.js"></script>
  75. <script type="text/javascript" src="../../../plugins/layer/layer.min.js"></script>
  76. <script type="text/javascript" src="../../../api/rehabilitation-api.js"></script>
  77. <script type="text/javascript" src="../../../api/recover_api.js"></script>
  78. <script type="text/javascript" src="../../../js/underscore-1.9.1.js"></script>
  79. <script type="text/javascript" src="../../../js/util.js" charset="utf-8"></script>
  80. <script>
  81. new Vue({
  82. el: '#app',
  83. data() {
  84. return {
  85. tabList: [],
  86. active: "",
  87. list: {},
  88. checkList: {},
  89. btnText: ""
  90. }
  91. },
  92. methods: {
  93. getServiceType() {
  94. const vm = this
  95. httpRequest.post('doctor/serviceOrder/selectServiceTypes', {}).then(function (res) {
  96. vm.tabList = res.data
  97. if(res.data.length>0){
  98. vm.active = res.data[0].code
  99. vm.getServiceList()
  100. }
  101. })
  102. },
  103. getServiceList(){
  104. const vm = this
  105. if(this.list[this.active]){
  106. return
  107. }
  108. var params = {
  109. type: this.active,
  110. hospital: JSON.parse(localStorage.getItem("wlyyAgent")).hospital,
  111. }
  112. httpRequest.get('doctor/serviceOrder/selectServiceByHospital', {data:params}).then(function (res) {
  113. vm.$set(vm.list, vm.active, res.dara)
  114. })
  115. },
  116. handleClick(){
  117. this.getServiceList()
  118. },
  119. addService(item){
  120. this.$set(this.checkList,item.code,{
  121. ...item,
  122. num: 1
  123. })
  124. // this.checkList[item.code] = {
  125. // ...item,
  126. // num: 1
  127. // }
  128. // this.$forceUpdate()
  129. console.log(this.checkList);
  130. },
  131. setBtnText(){
  132. let count = 0
  133. for(let i in this.checkList){
  134. count += this.checkList[i].num
  135. }
  136. return `确认(已选${count}项)`
  137. },
  138. submit(){
  139. const arr = []
  140. for(let i in this.checkList){
  141. arr.push(this.checkList[i])
  142. }
  143. if(arr.length == 0){
  144. this.$message.warning("请选择服务")
  145. return
  146. }
  147. sessionStorage.setItem("serviceList", JSON.stringify(arr))
  148. var index = parent.layer.getFrameIndex(window.name)
  149. parent.layer.close(index)
  150. },
  151. },
  152. mounted() {
  153. this.getServiceType()
  154. const checkList = JSON.parse(sessionStorage.getItem("serviceList"))
  155. for(let i of checkList){
  156. this.$set(this.checkList,i.code,i)
  157. }
  158. }
  159. })
  160. </script>
  161. </body>
  162. </html>