EditCustomerSourceForm.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <a-spin :spinning="confirmLoading">
  3. <j-form-container :disabled="formDisabled">
  4. <a-form-model
  5. ref="form"
  6. :model="model"
  7. :rules="validatorRules"
  8. slot="detail"
  9. >
  10. <a-row>
  11. <a-col :span="24">
  12. <a-form-model-item
  13. label="订单来源"
  14. :labelCol="labelCol"
  15. :wrapperCol="wrapperCol"
  16. prop="customerSource"
  17. >
  18. <a-select placeholder="订单来源" v-model="model.customerSource">
  19. <a-select-option
  20. :value="item.id"
  21. v-for="(item, index) in customerSourceList"
  22. :key="item.id"
  23. >
  24. {{ item.itemText }}
  25. </a-select-option>
  26. </a-select>
  27. </a-form-model-item>
  28. </a-col>
  29. </a-row>
  30. </a-form-model>
  31. </j-form-container>
  32. </a-spin>
  33. </template>
  34. <script>
  35. import { httpAction, getAction } from "@/api/manage";
  36. import { validateDuplicateValue } from "@/utils/util";
  37. export default {
  38. name: "BusMemberCardForm",
  39. components: {},
  40. props: {
  41. //表单禁用
  42. disabled: {
  43. type: Boolean,
  44. default: false,
  45. required: false,
  46. },
  47. },
  48. data() {
  49. return {
  50. model: { payType: 1, livingOrderId: "", certType: 1, gender: 1 },
  51. labelCol: {
  52. xs: { span: 24 },
  53. sm: { span: 5 },
  54. },
  55. wrapperCol: {
  56. xs: { span: 24 },
  57. sm: { span: 16 },
  58. },
  59. confirmLoading: false,
  60. validatorRules: {
  61. mobile: [
  62. {
  63. required: true,
  64. pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
  65. message: "请输入手机号!",
  66. },
  67. ],
  68. cardNo: [{ required: true, message: "请输入会员卡号!" }],
  69. gradeId: [{ required: true, message: "请输入等级类型!" }],
  70. payType: [{ required: true, message: "请输入付款类型!" }],
  71. paymentMethod: [{ required: true, message: "请输入付款方式!" }],
  72. cusName: [{ required: true, message: "请输入会员姓名!" }],
  73. sex: [{ required: true, message: "请输入性别!" }],
  74. certificateType: [{ required: true, message: "请输入证件类型!" }],
  75. validity: [{ required: true, message: "请输入有效期!" }],
  76. },
  77. url: {
  78. add: "/business/busRoomBookingOrders/booking-to-live",
  79. edit: "/business/busMemberCard/edit",
  80. queryById: "/business/busMemberCard/queryById",
  81. },
  82. gradeList: [],
  83. paymentMethodList: [],
  84. staffList: [],
  85. customerList: [],
  86. oldcustomerList: [],
  87. customerSourceList: [],
  88. };
  89. },
  90. computed: {
  91. formDisabled() {
  92. return this.disabled;
  93. },
  94. },
  95. created() {
  96. var _info = JSON.parse(localStorage.getItem("storeInfo"));
  97. if (_info) {
  98. this.model.hotelId = _info.id;
  99. }
  100. //备份model原始值
  101. this.modelDefault = JSON.parse(JSON.stringify(this.model));
  102. getAction("/business/busDictItem/list", {
  103. hotelId: _info.id,
  104. dictId: "1639538915239743490",
  105. }).then((res) => {
  106. if (res.success) {
  107. this.customerSourceList = res.result.records;
  108. }
  109. });
  110. },
  111. methods: {
  112. handleSearch(value) {
  113. let result;
  114. if (!value) {
  115. result = this.oldcustomerList;
  116. } else {
  117. result = this.oldcustomerList.filter((t) => t.name.includes(value));
  118. }
  119. this.customerList = result;
  120. },
  121. handleSelectMember(e) {
  122. var find = this.customerList.find((t) => t.id === e);
  123. this.model.cusPhone = find.phone;
  124. this.model.cusName = find.name;
  125. this.model.cusId = find.id;
  126. },
  127. getbusCustomer() {
  128. getAction("/bus/busCustomer/list", {}).then((res) => {
  129. if (res.success) {
  130. this.customerList = res.result.records;
  131. this.oldcustomerList = JSON.parse(JSON.stringify(this.customerList));
  132. }
  133. });
  134. },
  135. add(livingOrderId, roomId) {
  136. this.modelDefault.livingOrderId = livingOrderId;
  137. this.modelDefault.roomId = roomId;
  138. this.edit(this.modelDefault);
  139. },
  140. edit(record) {
  141. this.model = Object.assign({}, record);
  142. this.visible = true;
  143. },
  144. submitForm() {
  145. const that = this;
  146. // 触发表单验证
  147. this.$refs.form.validate((valid) => {
  148. if (valid) {
  149. that.confirmLoading = true;
  150. // var customers = [];
  151. // customers.push({
  152. // certNo: this.model.certNo,
  153. // certType: this.model.certType,
  154. // customerId: this.model.customerId,
  155. // customerName: this.model.customerName,
  156. // gender: this.model.gender,
  157. // phone: this.model.phone,
  158. // roomId: this.model.roomId,
  159. // });
  160. httpAction(
  161. "/business/busRoomBookingOrders/update-orders?type=2",
  162. this.model,
  163. "post"
  164. )
  165. .then((res) => {
  166. if (res.success) {
  167. that.$message.success("修改成功");
  168. that.$emit("ok");
  169. } else {
  170. that.$message.warning(res.message);
  171. }
  172. })
  173. .finally(() => {
  174. that.confirmLoading = false;
  175. });
  176. }
  177. });
  178. },
  179. },
  180. };
  181. </script>