index.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. <template>
  2. <div class="stat">
  3. <el-card class="box-card" style="width: 1612px; height: 950px">
  4. <!-- 标题区域 -->
  5. <div slot="header" class="clearfix">
  6. <div class="stat-title">系统设置</div>
  7. </div>
  8. <!-- 主体内容区域 -->
  9. <div class="stat-body">
  10. <!-- 预付款区域 -->
  11. <div>
  12. 预付款每晚不得少于
  13. <el-input
  14. class="input-new-tag"
  15. v-if="imprestShow"
  16. v-model="inputValue_imprest"
  17. v-fo
  18. size="small"
  19. @blur="handleInputConfirm('imprestShow', 'inputValue_imprest')"
  20. ></el-input>
  21. <el-button
  22. v-else
  23. class="button-new-tag"
  24. size="small"
  25. @click="showInput('imprestShow', 'inputValue_imprest')"
  26. >{{ inputValue_imprest }}</el-button>元
  27. </div>
  28. <!-- 预定天数区域 -->
  29. <div>
  30. 设置预定/续住天数提前
  31. <el-input
  32. class="input-new-tag"
  33. v-if="reserveShow"
  34. v-model="inputValue_reserve"
  35. size="small"
  36. @blur="handleInputConfirm('reserveShow', 'inputValue_reserve')"
  37. ></el-input>
  38. <el-button
  39. v-else
  40. class="button-new-tag"
  41. size="small"
  42. @click="showInput('reserveShow', 'inputValue_reserve')"
  43. >{{ inputValue_reserve }}</el-button>天
  44. </div>
  45. <!-- 补助区域 -->
  46. <div>
  47. 每人补助水量为
  48. <el-input
  49. class="input-new-tag"
  50. v-if="subsidyWaterShow"
  51. v-model="inputValue_subsidyWater"
  52. v-fo
  53. size="small"
  54. @blur="
  55. handleInputConfirm('subsidyWaterShow', 'inputValue_subsidyWater')
  56. "
  57. ></el-input>
  58. <el-button
  59. v-else
  60. class="button-new-tag"
  61. size="small"
  62. @click="showInput('subsidyWaterShow', 'inputValue_subsidyWater')"
  63. >{{ inputValue_subsidyWater }}</el-button>吨,每人补助电量为
  64. <el-input
  65. class="input-new-tag"
  66. v-if="subsidyElectricityShow"
  67. v-model="inputValue_subsidyElectricity"
  68. v-fo
  69. size="small"
  70. @blur="
  71. handleInputConfirm(
  72. 'subsidyElectricityShow',
  73. 'inputValue_subsidyElectricity'
  74. )
  75. "
  76. ></el-input>
  77. <el-button
  78. v-else
  79. class="button-new-tag"
  80. size="small"
  81. @click="
  82. showInput(
  83. 'subsidyElectricityShow',
  84. 'inputValue_subsidyElectricity'
  85. )
  86. "
  87. >{{ inputValue_subsidyElectricity }}</el-button>度
  88. </div>
  89. <!-- 通知人区域 -->
  90. <!-- <div>
  91. 设置清扫/查房通知人<el-input
  92. class="input-new-tag"
  93. v-if="informShow"
  94. v-model="inputValue_inform"
  95. v-fo
  96. size="small"
  97. @blur="handleInputConfirm('informShow', 'inputValue_inform')"
  98. >
  99. </el-input>
  100. <el-button
  101. v-else
  102. class="button-new-tag"
  103. size="small"
  104. @click="showInput('informShow', 'inputValue_inform')"
  105. >
  106. {{ inputValue_inform }}
  107. </el-button>
  108. </div>-->
  109. <!-- 退房区域 -->
  110. <div>
  111. 设置退房后
  112. <el-input
  113. class="input-new-tag"
  114. v-if="refundShow"
  115. v-model="inputValue_refund"
  116. v-fo
  117. size="small"
  118. @blur="handleInputConfirm('refundShow', 'inputValue_refund')"
  119. ></el-input>
  120. <el-button
  121. v-else
  122. class="button-new-tag"
  123. size="small"
  124. @click="showInput('refundShow', 'inputValue_refund')"
  125. >{{ inputValue_refund }}</el-button>分钟,断水断电
  126. </div>
  127. </div>
  128. </el-card>
  129. </div>
  130. </template>
  131. <script>
  132. export default {
  133. name: "system",
  134. data() {
  135. return {
  136. // 预付款输入框按钮框切换控制
  137. imprestShow: false,
  138. // 预付款绑定数据
  139. inputValue_imprest: 20,
  140. // 预定天数输入框按钮框切换控制
  141. reserveShow: false,
  142. // 预定天数绑定数据
  143. inputValue_reserve: 10,
  144. // 补助区域水量输入框按钮框切换控制
  145. subsidyWaterShow: false,
  146. // 补助区域水量绑定数据
  147. inputValue_subsidyWater: 5,
  148. // 补助区域电量输入框按钮框切换控制
  149. subsidyElectricityShow: false,
  150. // 补助区域电量绑定数据
  151. inputValue_subsidyElectricity: 9,
  152. // 通知人输入框按钮框切换控制
  153. // informShow: false,
  154. // // 通知人绑定数据
  155. // inputValue_inform: 7,
  156. priceOfWater: 5, // 水费单价
  157. priceOfElectric: 5, // 电费单价
  158. // 退房输入框按钮框切换控制
  159. refundShow: false,
  160. // 退房绑定数据
  161. inputValue_refund: 8,
  162. id: ""
  163. };
  164. },
  165. mounted() {
  166. this.getData();
  167. },
  168. methods: {
  169. // 获取系统设置页面数据
  170. async getData() {
  171. let res = await this.API.systemSetup.systemSettingInfo();
  172. // console.log(res);
  173. if (res.success) {
  174. this.inputValue_imprest = res.data.deposit;
  175. this.inputValue_reserve = res.data.preDay;
  176. this.inputValue_subsidyWater = res.data.freeQuotaOfWater;
  177. this.inputValue_subsidyElectricity = res.data.freeQuotaOfElectric;
  178. // this.inputValue_inform = res.data.deposit;
  179. // console.log(res.data.priceOfWater);
  180. this.priceOfWater = res.data.priceOfWater;
  181. this.priceOfElectric = res.data.priceOfElectric;
  182. this.inputValue_refund = res.data.turnOffTime;
  183. this.id = res.data.id;
  184. } else {
  185. this.$message.error(res.message);
  186. }
  187. },
  188. // 点击按钮 切换输入框 并聚焦
  189. showInput(show, value) {
  190. this[show] = true;
  191. this[value] = null;
  192. },
  193. // 失去焦点 切换回按钮 并更新数据
  194. async handleInputConfirm(show) {
  195. this[show] = false;
  196. let data = {
  197. id: this.id,
  198. deposit: this.inputValue_imprest,
  199. preDay: this.inputValue_reserve,
  200. priceOfWater: this.priceOfWater,
  201. priceOfElectric: this.priceOfElectric,
  202. freeQuotaOfWater: this.inputValue_subsidyWater,
  203. freeQuotaOfElectric: this.inputValue_subsidyElectricity,
  204. freeTotal:
  205. this.priceOfWater * this.inputValue_subsidyWater +
  206. this.priceOfElectric * this.inputValue_subsidyElectricity,
  207. turnOffTime: this.inputValue_refund
  208. };
  209. let res = await this.API.systemSetup.systemnoticeUpdate(data);
  210. // console.log(res);
  211. if (res.success) {
  212. this.$message.success("修改成功");
  213. this.getData();
  214. } else {
  215. this.$message.error(res.message);
  216. }
  217. }
  218. }
  219. };
  220. </script>
  221. <style lang="scss" scoped>
  222. .stat /deep/ .el-card {
  223. width: 1612px;
  224. height: 950px;
  225. box-shadow: 0px 3px 10px rgba(0, 97, 255, 0.2);
  226. border-radius: 8px;
  227. .clearfix {
  228. height: 96px;
  229. width: 100%;
  230. border-bottom: 1px solid rgba(204, 204, 204, 1);
  231. box-sizing: border-box;
  232. display: flex;
  233. justify-content: space-between;
  234. align-items: center;
  235. .stat-title {
  236. width: 96px;
  237. height: 36px;
  238. color: rgba(0, 0, 0, 1);
  239. font-size: 24px;
  240. font-weight: 500;
  241. margin-left: 33px;
  242. }
  243. }
  244. .stat-body {
  245. padding: 30px 0 0 30px;
  246. div {
  247. height: 40px;
  248. margin-bottom: 28px;
  249. .input-new-tag {
  250. margin: 0 10px;
  251. width: 90px;
  252. }
  253. .button-new-tag {
  254. margin: 0 10px;
  255. width: 90px;
  256. height: 32px;
  257. vertical-align: middle;
  258. }
  259. }
  260. }
  261. }
  262. .box-card {
  263. /deep/ .el-card__header {
  264. padding: 0;
  265. }
  266. /deep/ .el-card__body {
  267. padding: 0;
  268. }
  269. }
  270. </style>