tabletOrdering.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template>
  2. <!-- <a-spin :spinning="confirmLoading"> -->
  3. <j-form-container :disabled="false">
  4. <a-form-model ref="form" :model="model" layout="horizontal" slot="detail">
  5. <!-- 1 -->
  6. <div class="item-wrapper">
  7. <div class="wrapper-content">结账模式:</div>
  8. <div class="wrapper-form-item">
  9. <a-form-model-item label="" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="">
  10. <a-radio-group :options="options" v-model="model.type" @change="onChangeType" />
  11. </a-form-model-item>
  12. </div>
  13. <div class="wrapper-content">
  14. </div>
  15. </div>
  16. <!-- 2 -->
  17. <div class="item-wrapper">
  18. <div class="wrapper-content">验证场景:</div>
  19. <div class="wrapper-form-item">
  20. <a-form-model-item label="" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="leaveTime">
  21. <a-checkbox-group v-model="model.value" name="checkboxgroup" :options="plainOptions" @change="onChangeCJ" />
  22. </a-form-model-item>
  23. </div>
  24. </div>
  25. <!-- 3 -->
  26. <div class="item-wrapper">
  27. <div class="wrapper-content">验证方式:动态码验证</div>
  28. </div>
  29. <div class="buttons">
  30. <a-button style="margin-right: 10px" @click="reload">刷新</a-button>
  31. <a-button type="primary" @click="save">保存</a-button>
  32. </div>
  33. </a-form-model>
  34. </j-form-container>
  35. <!-- </a-spin> -->
  36. </template>
  37. <script>
  38. import {
  39. fetch,
  40. save
  41. } from "@/api/allDaysPriceRuleApi";
  42. import {
  43. getAllLayouts
  44. } from "@/api/roomLayout";
  45. import moment from 'moment'
  46. let hotelInfo = JSON.parse(localStorage.getItem("storeInfo"))
  47. export default {
  48. data() {
  49. return {
  50. labelCol: {
  51. xs: {
  52. span: 0
  53. },
  54. sm: {
  55. span: 0
  56. },
  57. },
  58. wrapperCol: {
  59. xs: {
  60. span: 24
  61. },
  62. sm: {
  63. span: 24
  64. },
  65. },
  66. options: [{
  67. label: '前台结账',
  68. value: 0
  69. },
  70. {
  71. label: '平板结账',
  72. value: 1
  73. }
  74. ],
  75. plainOptions: ['顾客切换至服务员', '顾客下单需服务员确认'],
  76. model: {
  77. type: 0,
  78. },
  79. confirmLoading:true,
  80. };
  81. },
  82. mounted() {
  83. },
  84. methods: {
  85. onChangeType(e){
  86. console.log(e);
  87. },
  88. onChangeCJ(e){
  89. console.log(e);
  90. },
  91. reload() {
  92. this.confirmLoading = true
  93. // this.loadLayouts()
  94. setTimeout(_ => {
  95. this.$message.success('刷新成功')
  96. this.confirmLoading = false
  97. }, 800)
  98. },
  99. save() {
  100. return
  101. const that = this;
  102. // 触发表单验证
  103. this.$refs.form.validate((valid) => {
  104. if (valid) {
  105. that.confirmLoading = true;
  106. let layoutRules = []
  107. if (this.model.timeOutRule == 1 && this.model.ruleType == 2) {
  108. this.layouts.forEach(s => {
  109. let pushItem = {
  110. hotelId: hotelInfo.id,
  111. roomLayoutId: s.id,
  112. minute: s.minute,
  113. price: s.price,
  114. moreThenMinute: s.moreThenMinute,
  115. moreThenPrice: s.moreThenPrice,
  116. }
  117. if (s.mId) {
  118. pushItem['id'] = s.mId
  119. }
  120. layoutRules.push(pushItem)
  121. })
  122. }
  123. let param = {
  124. hotelId: hotelInfo.id,
  125. enterTime: moment(this.model.enterTime, "HH:mm").utcOffset(8).format("HH:mm"),
  126. leaveTime: moment(this.model.leaveTime, "HH:mm").utcOffset(8).format("HH:mm"),
  127. timeOutRule: this.model.timeOutRule,
  128. ruleType: this.model.ruleType,
  129. minute: this.model.minute,
  130. price: this.model.price,
  131. moreThenMinute: this.model.moreThenMinute,
  132. moreThenPrice: this.model.moreThenPrice,
  133. endTime: moment(this.model.endTime, "HH:mm").utcOffset(8).format("HH:mm"),
  134. dayTime: this.model.dayTime,
  135. roomLayoutRules: layoutRules
  136. }
  137. if (this.model.id) {
  138. param['id'] = this.model.id
  139. }
  140. save(param).then(res => {
  141. if (res.code == 200) {
  142. this.$message.success("保存成功")
  143. this.loadRules()
  144. }
  145. }).finally(_ => {
  146. that.confirmLoading = false;
  147. })
  148. }
  149. });
  150. },
  151. },
  152. };
  153. </script>
  154. <style lang="css" scoped>
  155. /deep/ .ant-form-explain {
  156. width: 300% !important;
  157. }
  158. .item-wrapper {
  159. display: flex;
  160. align-items: center;
  161. height: 50px;
  162. margin-top: 22px;
  163. margin-bottom: 22px;
  164. }
  165. .wrapper-form-item {
  166. height: 38px;
  167. /* margin-top: 22px; */
  168. }
  169. .item-data-wrapper {
  170. margin-top: 0 !important;
  171. border-top: 2px solid #1890ff;
  172. width: fit-content;
  173. padding: 0 40px;
  174. background-color: #1890ff;
  175. border-top-right-radius: 4px;
  176. color: white;
  177. }
  178. .header-title {
  179. font-weight: 600;
  180. width: fit-content;
  181. padding: 10px 20px;
  182. background-color: #1890ff;
  183. color: white;
  184. border-top-left-radius: 4px;
  185. border-top-right-radius: 4px;
  186. }
  187. </style>