FeeForm.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template>
  2. <a-spin :spinning="confirmLoading">
  3. <j-form-container :disabled="formDisabled">
  4. <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
  5. <a-row style="display:flex;justify-content:center;">
  6. <a-col :span="12">
  7. <a-form-model-item label="消费项目" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="subjectType">
  8. <a-select v-model="model.subjectType" style="50%" placeholder="消费项目" :allowClear="true">
  9. <a-select-option :value="1">押金</a-select-option>
  10. <a-select-option :value="2">预收房费</a-select-option>
  11. <a-select-option :value="3">每日房费</a-select-option>
  12. <a-select-option :value="6">商品</a-select-option>
  13. <a-select-option :value="7">点餐</a-select-option>
  14. </a-select>
  15. </a-form-model-item>
  16. <a-row>
  17. <a-col :span="24">
  18. <a-form-model-item label="金额" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="money">
  19. <a-input-number :disabled="model.subjectType==6" v-model="model.money" placeholder="请输入金额" :min="0"></a-input-number>
  20. </a-form-model-item>
  21. </a-col>
  22. </a-row>
  23. </a-col>
  24. <a-col v-if="model.subjectType==6" :span="12">
  25. <a-row>
  26. <a-col :span="24">
  27. <a-space>
  28. <a-input v-model="queryParams.name" placeholder="名称" />
  29. <a-button @click="searchQuery" type="primary">搜索</a-button>
  30. </a-space>
  31. </a-col>
  32. </a-row>
  33. <a-table :columns="columns" :loading="loading" :dataSource="dataSource" style="margin-top:10px;">
  34. <template slot="sellingPrice" slot-scope="text, record">
  35. <a-input-number v-model="record.sellingPrice" :min="0"></a-input-number>
  36. </template>
  37. <template slot="number" slot-scope="text, record">
  38. <a-input-number v-model="record.number" :min="0"></a-input-number>
  39. </template>
  40. </a-table>
  41. </a-col>
  42. </a-row>
  43. <!-- <a-row>
  44. <a-col :span="24">
  45. <a-form-model-item label="金额" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="money">
  46. <a-input-number v-model="model.money" placeholder="请输入金额" :min="0"></a-input-number>
  47. </a-form-model-item>
  48. </a-col>
  49. </a-row> -->
  50. </a-form-model>
  51. </j-form-container>
  52. </a-spin>
  53. </template>
  54. <script>
  55. import {
  56. httpAction,
  57. getAction
  58. } from "@/api/manage";
  59. import {
  60. validateDuplicateValue
  61. } from "@/utils/util";
  62. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  63. export default {
  64. name: "BusMemberCardForm",
  65. components: {},
  66. mixins:[JeecgListMixin],
  67. props: {
  68. //表单禁用
  69. disabled: {
  70. type: Boolean,
  71. default: false,
  72. required: false,
  73. },
  74. livingOrderId: {
  75. type: String,
  76. },
  77. },
  78. data() {
  79. return {
  80. dataSource:[],
  81. columns: [{
  82. title: "名称",
  83. align: "center",
  84. dataIndex: "name",
  85. },
  86. {
  87. title: "售价",
  88. align: "center",
  89. dataIndex: "sellingPrice",
  90. scopedSlots: { customRender: 'sellingPrice' },
  91. },
  92. {
  93. title: "数量",
  94. align: "center",
  95. dataIndex: "number",
  96. scopedSlots: { customRender: 'number' },
  97. },
  98. {
  99. title: "剩余库存",
  100. align: "center",
  101. dataIndex: "inventory",
  102. },
  103. ],
  104. model: {
  105. payType: 1,
  106. livingOrderId: "",
  107. certType: 1,
  108. gender: 1
  109. },
  110. queryParams: {},
  111. labelCol: {
  112. xs: {
  113. span: 24
  114. },
  115. sm: {
  116. span: 5
  117. },
  118. },
  119. wrapperCol: {
  120. xs: {
  121. span: 24
  122. },
  123. sm: {
  124. span: 16
  125. },
  126. },
  127. confirmLoading: false,
  128. validatorRules: {
  129. subjectType: [{
  130. required: true,
  131. message: "请输入消费项目!"
  132. }],
  133. money: [{
  134. required: true,
  135. message: "请输入金额!"
  136. }],
  137. },
  138. url: {
  139. list: "/rooms/cesGoods/queryList",
  140. edit: "/business/busMemberCard/edit",
  141. queryById: "/business/busMemberCard/queryById",
  142. },
  143. gradeList: [],
  144. paymentMethodList: [],
  145. staffList: [],
  146. customerList: [],
  147. oldcustomerList: [],
  148. };
  149. },
  150. computed: {
  151. formDisabled() {
  152. return this.disabled;
  153. },
  154. },
  155. created() {
  156. var _info = JSON.parse(localStorage.getItem("storeInfo"));
  157. if (_info) {
  158. this.model.hotelId = _info.id;
  159. }
  160. //备份model原始值
  161. this.modelDefault = JSON.parse(JSON.stringify(this.model));
  162. this.getbusCustomer();
  163. // getAction('/kc/kcGoods/list').then(res=>{
  164. // if (res.success) {
  165. // this.dataSource = res.result.records;
  166. // }
  167. // })
  168. // getAction('/rooms/cesGoods/queryList').then(res=>{
  169. // if (res.success) {
  170. // this.dataSource = res.result.records;
  171. // }
  172. // })
  173. },
  174. methods: {
  175. handleSearch(value) {
  176. let result;
  177. if (!value) {
  178. result = this.oldcustomerList;
  179. } else {
  180. result = this.oldcustomerList.filter((t) => t.name.includes(value));
  181. }
  182. this.customerList = result;
  183. },
  184. handleSelectMember(e) {
  185. var find = this.customerList.find((t) => t.id === e);
  186. this.model.phone = find.phone;
  187. this.model.customerName = find.name;
  188. this.model.customerId = find.id;
  189. },
  190. getbusCustomer() {
  191. getAction("/bus/busCustomer/list", {}).then((res) => {
  192. if (res.success) {
  193. this.customerList = res.result.records;
  194. this.oldcustomerList = JSON.parse(JSON.stringify(this.customerList));
  195. }
  196. });
  197. },
  198. add(livingOrderId, roomId) {
  199. this.modelDefault.livingOrderId = livingOrderId;
  200. this.modelDefault.roomId = roomId;
  201. this.edit(this.modelDefault);
  202. },
  203. edit(record) {
  204. this.model = Object.assign({}, record);
  205. this.visible = true;
  206. },
  207. submitForm() {
  208. const that = this;
  209. // 触发表单验证
  210. this.$refs.form.validate((valid) => {
  211. if (valid) {
  212. that.confirmLoading = true;
  213. var orders = [];
  214. orders.push({
  215. money: this.model.money,
  216. subjectType: this.model.subjectType,
  217. });
  218. this.model.orders = orders;
  219. this.model.livingOrderId = this.livingOrderId;
  220. httpAction("/business/busRoomBookingOrders/set-living-order-fee?livingOrderId=" + this.livingOrderId, orders, "post")
  221. .then((res) => {
  222. if (res.success) {
  223. that.$message.success(res.message);
  224. that.$emit("ok");
  225. } else {
  226. that.$message.warning(res.message);
  227. }
  228. })
  229. .finally(() => {
  230. that.confirmLoading = false;
  231. });
  232. }
  233. });
  234. },
  235. },
  236. };
  237. </script>