goodsPayInfo.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  1. <template>
  2. <div class="m-container1">
  3. <el-page-header @back="goback" style="padding: 20px" :content="'学校缴费'">
  4. </el-page-header>
  5. <div class="payInfoWrap">
  6. <div class="left">
  7. <div class="m-core1">
  8. <el-form :inline="true" :model="form" label-width="120px" ref="form">
  9. <div class="coreList">
  10. <payGoodsInfo
  11. :form="form"
  12. :courseViewType="courseViewType"
  13. :organId="organId"
  14. />
  15. <payFeeInfo :form="form" @setAllTotal="setAllTotal" />
  16. <payAddressInfo :form="form" />
  17. <payBackMoney :form="form" :educationList="educationList" />
  18. </div>
  19. </el-form>
  20. <div style="text-align: center;padding-bottom: 12px">
  21. <el-button class="submitBtn" @click="onSubmit">确认</el-button>
  22. </div>
  23. </div>
  24. </div>
  25. </div>
  26. </div>
  27. </template>
  28. <script>
  29. import { getMusicGroupPaymentCalenderDetail } from "@/api/buildTeam";
  30. import { queryEmployByOrganId } from "@/api/systemManage";
  31. import { musicGroupcreateCalender } from "../api";
  32. import payGoodsInfo from "../goodsModal/payGoodsInfo";
  33. import payFeeInfo from "../goodsModal/payFeeInfo";
  34. import payAddressInfo from "../goodsModal/payAddressInfo";
  35. import payBackMoney from "../goodsModal/payBackMoney";
  36. export default {
  37. components: {
  38. payGoodsInfo,
  39. payFeeInfo,
  40. payAddressInfo,
  41. payBackMoney
  42. },
  43. data() {
  44. return {
  45. baseInfo: null,
  46. organId: null,
  47. courseViewType: null,
  48. educationList: [],
  49. form: {
  50. calenderGoodsList: [], // 添加商品
  51. currentTotalAmount: null, // 付款金额
  52. calenderFeeJson: {
  53. discountTotal: 0 // 优惠金额
  54. },
  55. contractUrl: "", // 合同链接
  56. memo: "", // 备注
  57. calenderAddress: {
  58. address: "", // 详情地址
  59. phone: "", // 手机号
  60. name: "", // 收货人
  61. province: null,
  62. city: null,
  63. region: null
  64. },
  65. responsiblePerson: null, // 责任人
  66. musicGroupCalenderRefundPeriods: [{ refundDate: "", refundAmount: "" }] // 回款周期
  67. }
  68. };
  69. },
  70. mounted() {
  71. this.baseInfo = JSON.parse(localStorage.getItem("payMusicBase"));
  72. this.init();
  73. },
  74. methods: {
  75. async init() {
  76. this.organId = this.musicGroup?.organId;
  77. this.courseViewType = this.baseInfo?.musicGroup?.courseViewType;
  78. this.getEmploy();
  79. if (this.$route.query.calenderId) {
  80. // 说明是修改 查缴项目详情
  81. this.initDetail = true;
  82. await getMusicGroupPaymentCalenderDetail({
  83. id: this.$route.query.calenderId
  84. }).then(res => {
  85. if (res.code == 200) {
  86. const result = res.data || {};
  87. this.$set(this.form, "calenderGoodsList", result.goods || []);
  88. this.$set(
  89. this.form,
  90. "musicGroupCalenderRefundPeriods",
  91. result.calenderRefundPeriods
  92. );
  93. // 设置责任人
  94. if (
  95. result.calenderRefundPeriods &&
  96. result.calenderRefundPeriods.length > 0
  97. ) {
  98. this.$set(
  99. this.form,
  100. "responsiblePerson",
  101. result.calenderRefundPeriods[0].responsiblePerson
  102. );
  103. }
  104. let calenderFeeJson = result.calender?.calenderFeeJson;
  105. if (calenderFeeJson) {
  106. calenderFeeJson = JSON.parse(calenderFeeJson);
  107. this.$set(this.form, "calenderFeeJson", calenderFeeJson);
  108. }
  109. this.$set(this.form, "contractUrl", result.calender?.contractUrl);
  110. this.$set(this.form, "memo", result.calender?.memo);
  111. this.$set(this.form, "calenderAddress", result.address);
  112. }
  113. });
  114. }
  115. },
  116. setAllTotal(val) {
  117. this.form.calenderFeeJson.allTotal = val;
  118. if (this.form.calenderFeeJson.discountTotal) {
  119. this.form.currentTotalAmount =
  120. this.form.calenderFeeJson.allTotal -
  121. this.form.calenderFeeJson.discountTotal;
  122. } else {
  123. this.form.currentTotalAmount = this.form.calenderFeeJson.allTotal;
  124. }
  125. this.$set(this.form, "currentTotalAmount", this.form.currentTotalAmount);
  126. },
  127. getEmploy() {
  128. try {
  129. queryEmployByOrganId({
  130. organId: this.organId,
  131. rows: 99999,
  132. demissionflag: 0
  133. }).then(res => {
  134. this.educationList = res.data?.rows || [];
  135. });
  136. } catch (e) {
  137. conosle.log(res, "res");
  138. }
  139. },
  140. goback() {
  141. let query = { ...this.$route.query };
  142. query.calenderId = null;
  143. if (query.type == "resetTeam") {
  144. this.$store.dispatch("delVisitedViews", this.$route);
  145. this.$router.push({
  146. path: "/business/resetTeaming",
  147. query
  148. });
  149. } else if (query.type == "look") {
  150. this.$store.dispatch("delVisitedViews", this.$route);
  151. this.$router.push({
  152. path: "/business/resetTeaming",
  153. query
  154. });
  155. } else if (
  156. query.type == "teamDraft" ||
  157. query.type == "feeAudit" ||
  158. query.type == "FEE_AUDIT_FAILED"
  159. ) {
  160. this.$store.dispatch("delVisitedViews", this.$route);
  161. this.$router.push({
  162. path: "/business/resetTeaming",
  163. query
  164. });
  165. }
  166. },
  167. onSubmit() {
  168. console.log(this.formatData());
  169. this.$refs.form.validate(async isok => {
  170. if (!isok) return;
  171. let obj = this.formatData();
  172. if (this.form.calenderGoodsList.length <= 0) {
  173. this.$message.error("请至少选择一个采购商品");
  174. return;
  175. }
  176. let total = 0;
  177. this.form.musicGroupCalenderRefundPeriods.forEach(item => {
  178. total += item.refundAmount * 1;
  179. });
  180. if (total != this.form.currentTotalAmount) {
  181. this.$message.error("付款金额与回款金额不一致,请重新设置");
  182. return;
  183. }
  184. try {
  185. const res = await musicGroupcreateCalender(obj);
  186. if (res.code == 200) {
  187. this.$message.success("创建缴费成功");
  188. this.goback();
  189. }
  190. if (res.code == 207) {
  191. await this.$confirm(
  192. res.msg || `当前乐团存在未排课的缴费项目,请再次确认操作`,
  193. "提示",
  194. {
  195. type: "warning"
  196. }
  197. );
  198. obj.confirmCreate = true;
  199. await musicGroupcreateCalender(obj);
  200. this.$message.success("创建缴费成功");
  201. this.goback();
  202. }
  203. } catch (e) {
  204. console.log(e);
  205. }
  206. });
  207. },
  208. formatData() {
  209. let calenderFeeJson = this.form.calenderFeeJson;
  210. const musicGroupCalenderRefundPeriods =
  211. this.form.musicGroupCalenderRefundPeriods || [];
  212. musicGroupCalenderRefundPeriods.forEach(period => {
  213. period.responsiblePerson = this.form.responsiblePerson;
  214. });
  215. return {
  216. payUserType: "SCHOOL",
  217. memo: this.form.memo,
  218. musicGroupId: this.$route.query.id,
  219. calenderFeeJson: JSON.stringify(calenderFeeJson),
  220. musicGroupCalenderRefundPeriods,
  221. currentTotalAmount: this.form.currentTotalAmount,
  222. contractUrl: this.form.contractUrl,
  223. calenderAddress: this.form.calenderAddress,
  224. calenderGoodsList: this.form.calenderGoodsList
  225. };
  226. },
  227. scrollView(object) {
  228. console.log(object);
  229. for (const i in object) {
  230. let dom = this.$refs[i];
  231. // 这里是针对遍历的情况(多个输入框),取值为数组
  232. if (Object.prototype.toString.call(dom) !== "[object Object]") {
  233. if (dom) {
  234. dom = dom[0];
  235. }
  236. }
  237. // 第一种方法(包含动画效果)
  238. dom.$el.scrollIntoView({
  239. // 滚动到指定节点
  240. // 值有start,center,end,nearest,当前显示在视图区域中间
  241. block: "center",
  242. // 值有auto、instant,smooth,缓动动画(当前是慢速的)
  243. behavior: "smooth"
  244. });
  245. break; // 跳出循环了
  246. }
  247. }
  248. },
  249. computed: {
  250. musicGroup() {
  251. return this.baseInfo?.musicGroup;
  252. }
  253. }
  254. };
  255. </script>
  256. <style lang="scss" scoped>
  257. @import "~@/views/resetTeaming/modals/pay.scss";
  258. .memoWrap {
  259. // width: calc(100% - 860px);
  260. width: 860px;
  261. .memoWrapItem {
  262. display: block;
  263. ::v-deep .el-form-item__content {
  264. display: inline-block;
  265. width: calc(100% - 140px);
  266. }
  267. }
  268. }
  269. .Wall {
  270. height: 15px;
  271. background-color: #f2f2f2;
  272. }
  273. ::v-deep .el-form-item__label:before {
  274. content: "" !important;
  275. position: absolute;
  276. color: transparent;
  277. margin-right: 4px;
  278. }
  279. .payInfoWrap {
  280. .submitBtn {
  281. // width: 121px;
  282. // height: 41px;
  283. background: var(--color-primary);
  284. border-radius: 7px;
  285. // margin: 20px auto;
  286. // line-height: 40px;
  287. color: #fff;
  288. text-align: center;
  289. cursor: pointer;
  290. }
  291. .baseWrap {
  292. padding: 20px;
  293. background-color: #fff;
  294. }
  295. .baseWrapFixed {
  296. top: 105px;
  297. left: 215px; // 205
  298. position: fixed;
  299. background-color: #fff;
  300. width: calc(100% - 220px);
  301. z-index: 100;
  302. padding: 20px;
  303. box-shadow: rgba(0, 0, 0, 0.05) 0px 2px 3px 3px;
  304. }
  305. .left {
  306. ::v-deep .el-checkbox {
  307. padding: 8px 10px 7px 10px;
  308. border-radius: 4px;
  309. }
  310. ::v-deep .el-checkbox .el-checkbox__inner {
  311. border-radius: 50%;
  312. border: 1px solid var(--color-primary);
  313. width: 16px;
  314. height: 16px;
  315. &:after {
  316. height: 8px;
  317. left: 5px;
  318. }
  319. }
  320. ::v-deep .el-checkbox__inner:hover {
  321. background-color: var(--color-primary);
  322. }
  323. ::v-deep .el-checkbox.is-checked {
  324. border-color: #fff;
  325. color: #fff;
  326. }
  327. .payTitle {
  328. display: flex;
  329. flex-direction: row;
  330. align-items: center;
  331. font-size: 18px;
  332. font-weight: 600;
  333. color: #1a1a1a;
  334. height: 25px;
  335. margin-bottom: 15px;
  336. p {
  337. line-height: 25px;
  338. }
  339. .squrt {
  340. width: 3px;
  341. height: 16px;
  342. background: var(--color-primary);
  343. margin-right: 8px;
  344. position: relative;
  345. top: -1px;
  346. border-radius: 2px;
  347. }
  348. .payContext {
  349. color: var(--color-primary);
  350. border: 1px solid var(--color-primary);
  351. font-size: 14px;
  352. line-height: 22px;
  353. border-radius: 3px;
  354. padding: 0 5px;
  355. margin-left: 12px;
  356. }
  357. }
  358. .checkWrap {
  359. display: flex;
  360. flex-direction: row;
  361. justify-content: flex-start;
  362. align-items: center;
  363. .checkBtn.active {
  364. border: 1px solid var(--color-primary);
  365. }
  366. .checkBtn {
  367. position: relative;
  368. background-color: #fefefe;
  369. margin-right: 12px;
  370. padding: 0 22px;
  371. display: flex;
  372. flex-direction: row;
  373. align-items: center;
  374. border-radius: 6px;
  375. border: 1px solid #dfe8ec;
  376. cursor: pointer;
  377. height: 84px;
  378. width: 251px;
  379. overflow: hidden;
  380. &:hover {
  381. border: 1px solid var(--color-primary);
  382. }
  383. p {
  384. height: 41px;
  385. line-height: 41px;
  386. }
  387. .checkLeft {
  388. width: 60px;
  389. height: 60px;
  390. margin-right: 16px;
  391. img {
  392. width: 100%;
  393. }
  394. }
  395. .checkRight {
  396. p {
  397. height: 26px;
  398. font-size: 19px;
  399. font-weight: 600;
  400. color: #1a1a1a;
  401. line-height: 26px;
  402. }
  403. .checkSubTitle {
  404. font-size: 14px;
  405. font-weight: 400;
  406. color: var(--color-primary);
  407. line-height: 20px;
  408. }
  409. }
  410. .checTriangle {
  411. border-bottom: 44px solid var(--color-primary);
  412. border-left: 44px solid transparent;
  413. position: absolute;
  414. right: 0;
  415. bottom: 0;
  416. width: 0;
  417. height: 0;
  418. img {
  419. width: 19px;
  420. height: 16px;
  421. position: absolute;
  422. top: 22px;
  423. right: 5px;
  424. }
  425. }
  426. }
  427. // .checkBtn.disabled {
  428. // cursor: not-allowed;
  429. // color: #d9d9d9;
  430. // background-color: #f2f2f2 !important;
  431. // ::v-deep .el-checkbox__inner {
  432. // background-color: #fff !important;
  433. // border-color: #d9d9d9;
  434. // color: #fff;
  435. // &::after {
  436. // border-color: #d9d9d9;
  437. // }
  438. // }
  439. // &:hover {
  440. // background-color: #f2f2f2 !important;
  441. // color: #d9d9d9;
  442. // ::v-deep .el-checkbox__inner {
  443. // background-color: #fff !important;
  444. // }
  445. // }
  446. // }
  447. }
  448. }
  449. }
  450. .coreList {
  451. // margin: 14px;
  452. }
  453. </style>
  454. <style lang="less" scoped>
  455. ::v-deep .el-dialog__body {
  456. padding: 15px 0 0;
  457. }
  458. .empty {
  459. background-color: #fff;
  460. padding-bottom: 20px;
  461. }
  462. </style>