Refund.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  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="billRefund"
  17. >
  18. <a-input
  19. style="width: 100px"
  20. disabled
  21. v-model="model.billRefund"
  22. placeholder="请输入结账应退"
  23. ></a-input
  24. >元
  25. </a-form-model-item>
  26. </a-col>
  27. <a-col :span="24">
  28. <a-form-model-item
  29. label="押金应退"
  30. :labelCol="labelCol"
  31. :wrapperCol="wrapperCol"
  32. prop="deposit"
  33. >
  34. <a-input
  35. style="width: 100px"
  36. disabled
  37. v-model="model.deposit"
  38. placeholder="请输入押金应退"
  39. ></a-input
  40. >元
  41. <a-select
  42. v-model="model.payType"
  43. style="width: 200px"
  44. placeholder="支付类型"
  45. >
  46. <a-select-option
  47. :value="item.id"
  48. v-for="item in payTypeList"
  49. :key="item.id"
  50. :disabled="item.delFlag == 99"
  51. >{{ item.name }}</a-select-option
  52. >
  53. </a-select>
  54. </a-form-model-item>
  55. </a-col>
  56. <a-col :span="24">
  57. <a-form-model-item
  58. label="房费应退"
  59. :labelCol="labelCol"
  60. :wrapperCol="wrapperCol"
  61. prop="roomFee"
  62. >
  63. <a-input
  64. style="width: 100px"
  65. disabled
  66. v-model="model.roomFee"
  67. placeholder="请输入房费应退"
  68. ></a-input
  69. >元
  70. <a-select
  71. v-model="model.payType"
  72. style="width: 200px"
  73. placeholder="支付类型"
  74. >
  75. <a-select-option
  76. :value="item.id"
  77. v-for="item in payTypeList"
  78. :key="item.id"
  79. :disabled="item.delFlag == 99"
  80. >{{ item.name }}</a-select-option
  81. >
  82. </a-select>
  83. </a-form-model-item>
  84. </a-col>
  85. <a-col :span="24">
  86. <a-form-model-item
  87. label="实退合计"
  88. :labelCol="labelCol"
  89. :wrapperCol="wrapperCol"
  90. prop="money"
  91. >
  92. <a-input
  93. style="width: 100px"
  94. disabled
  95. v-model="model.money"
  96. placeholder="请输入实退合计"
  97. ></a-input>
  98. </a-form-model-item>
  99. </a-col>
  100. </a-row>
  101. </a-form-model>
  102. </j-form-container>
  103. </a-spin>
  104. </template>
  105. <script>
  106. import { httpAction, getAction } from "@/api/manage";
  107. import { validateDuplicateValue } from "@/utils/util";
  108. export default {
  109. name: "Refund",
  110. components: {},
  111. props: {
  112. //表单禁用
  113. disabled: {
  114. type: Boolean,
  115. default: false,
  116. required: false,
  117. },
  118. },
  119. data() {
  120. return {
  121. model: {
  122. payType: "",
  123. payType2: "",
  124. livingOrderId: "",
  125. certType: 1,
  126. gender: 1,
  127. bookingOrderId: "",
  128. },
  129. labelCol: {
  130. xs: { span: 24 },
  131. sm: { span: 5 },
  132. },
  133. wrapperCol: {
  134. xs: { span: 24 },
  135. sm: { span: 16 },
  136. },
  137. confirmLoading: false,
  138. validatorRules: {
  139. mobile: [
  140. {
  141. required: true,
  142. pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
  143. message: "请输入手机号!",
  144. },
  145. ],
  146. cardNo: [{ required: true, message: "请输入会员卡号!" }],
  147. gradeId: [{ required: true, message: "请输入等级类型!" }],
  148. payType: [{ required: true, message: "请输入付款类型!" }],
  149. paymentMethod: [{ required: true, message: "请输入付款方式!" }],
  150. customerName: [{ required: true, message: "请输入会员姓名!" }],
  151. sex: [{ required: true, message: "请输入性别!" }],
  152. certificateType: [{ required: true, message: "请输入证件类型!" }],
  153. validity: [{ required: true, message: "请输入有效期!" }],
  154. },
  155. url: {
  156. add: "/business/busRoomBookingOrders/booking-to-live",
  157. edit: "/business/busMemberCard/edit",
  158. queryById: "/business/busMemberCard/queryById",
  159. },
  160. gradeList: [],
  161. paymentMethodList: [],
  162. staffList: [],
  163. customerList: [],
  164. oldcustomerList: [],
  165. payTypeList: [],
  166. };
  167. },
  168. computed: {
  169. formDisabled() {
  170. return this.disabled;
  171. },
  172. },
  173. created() {
  174. var _info = JSON.parse(localStorage.getItem("storeInfo"));
  175. if (_info) {
  176. this.model.hotelId = _info.id;
  177. }
  178. //备份model原始值
  179. this.modelDefault = JSON.parse(JSON.stringify(this.model));
  180. this.getbusCustomer();
  181. },
  182. methods: {
  183. getbusRoomPayType() {
  184. getAction("/business/busRoomPayType/list", {
  185. pageSize: 99999,
  186. pageNo: 1,
  187. }).then((res) => {
  188. if (res.success) {
  189. this.payTypeList = res.result.records;
  190. if (this.payTypeList && this.payTypeList.length > 0) {
  191. if (
  192. !this.model.vipCustomerId ||
  193. this.model.vipCustomerId.length == 0
  194. ) {
  195. var index = this.payTypeList.findIndex((t) =>
  196. t.name.includes("会员")
  197. );
  198. if (index >= 0) {
  199. this.payTypeList[index].delFlag = 99;
  200. }
  201. }
  202. if (
  203. !this.model.contractTeamId ||
  204. this.model.contractTeamId.length == 0 ||
  205. !this.model.contractTeamProtocolId ||
  206. this.model.contractTeamProtocolId.length == 0
  207. ) {
  208. var index = this.payTypeList.findIndex((t) =>
  209. t.name.includes("单位")
  210. );
  211. if (index >= 0) {
  212. this.payTypeList[index].delFlag = 99;
  213. }
  214. }
  215. this.$set(this.model, "payType", this.payTypeList[0].id);
  216. }
  217. }
  218. });
  219. },
  220. handleSearch(value) {
  221. let result;
  222. if (!value) {
  223. result = this.oldcustomerList;
  224. } else {
  225. result = this.oldcustomerList.filter((t) => t.name.includes(value));
  226. }
  227. this.customerList = result;
  228. },
  229. handleSelectMember(e) {
  230. var find = this.customerList.find((t) => t.id === e);
  231. this.model.phone = find.phone;
  232. this.model.customerName = find.name;
  233. this.model.customerId = find.id;
  234. },
  235. getbusCustomer() {
  236. getAction("/bus/busCustomer/list", {}).then((res) => {
  237. if (res.success) {
  238. this.customerList = res.result.records;
  239. this.oldcustomerList = JSON.parse(JSON.stringify(this.customerList));
  240. }
  241. });
  242. },
  243. add(livingOrderId, roomId) {
  244. this.modelDefault.livingOrderId = livingOrderId;
  245. this.modelDefault.roomId = roomId;
  246. this.edit(this.modelDefault);
  247. },
  248. edit(record) {
  249. this.model = Object.assign({}, record);
  250. this.getbusRoomPayType();
  251. this.visible = true;
  252. },
  253. submitForm() {
  254. const that = this;
  255. // 触发表单验证
  256. this.$refs.form.validate((valid) => {
  257. if (valid) {
  258. that.confirmLoading = true;
  259. var fees = [];
  260. fees.push({
  261. feeType: this.model.feeType,
  262. money: this.model.money,
  263. payType: this.model.payType,
  264. custorerOrderRemark: "结账退款",
  265. isPreferential: false,
  266. livingOrderId: this.model.livingOrderId,
  267. });
  268. var url =
  269. "/business/busRoomBookingOrders/settle-checkout?bookingOrderId=" +
  270. this.model.bookingOrderId;
  271. if (this.model.livingOrderId) {
  272. url =
  273. "/business/busRoomBookingOrders/living-settle-checkout?livingOrderId=" +
  274. this.model.livingOrderId;
  275. }
  276. httpAction(url, fees, "post")
  277. .then((res) => {
  278. if (res.success) {
  279. that.$message.success("结账成功");
  280. that.$emit("ok");
  281. } else {
  282. that.$message.warning(res.message);
  283. }
  284. })
  285. .finally(() => {
  286. that.confirmLoading = false;
  287. });
  288. }
  289. });
  290. },
  291. },
  292. };
  293. </script>