Refund.vue 9.6 KB

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