OpDecreasePayments.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566
  1. <template>
  2. <div class="car_add">
  3. <div>
  4. <div class="communal-title">
  5. <div>{{ title }}</div>
  6. </div>
  7. </div>
  8. <hr style='background-color:#5555; height:1px; border:none;' />
  9. <div>
  10. <el-form :model="delegationInfo" label-width="100px" class="demo-ruleForm">
  11. <div style="display: flex;">
  12. <div style="width: 25%;">
  13. <el-form-item label="团组名称:" label-width="160px">
  14. <el-select v-model="DiIdSelect" clearable filterable placeholder="团组选择"
  15. @change="DecreasePaymentsChange" :disabled="isShow" style="width: 100%;">
  16. <el-option v-for="item in delegationInfoList" :key="item.id" :label="item.teamName"
  17. :value="item.id">
  18. </el-option>
  19. </el-select>
  20. </el-form-item>
  21. </div>
  22. <div style="width: 25%;">
  23. <el-form-item label="团 号:" prop="tourCode" label-width="160px">
  24. <el-input placeholder="团号" v-model="delegationInfo.tourCode" :disabled="true">
  25. </el-input>
  26. </el-form-item>
  27. </div>
  28. <div style="width: 25%;">
  29. <el-form-item label="客户:" prop="clientName" label-width="160px">
  30. <el-input placeholder="客户" v-model="delegationInfo.clientName" :disabled="true">
  31. </el-input>
  32. </el-form-item>
  33. </div>
  34. <div style="width: 25%;">
  35. <el-form-item label="出访国家:" prop="visitCountry" label-width="160px">
  36. <el-input placeholder="出访国家" v-model="delegationInfo.visitCountry" :disabled="true">
  37. </el-input>
  38. </el-form-item>
  39. </div>
  40. </div>
  41. </el-form>
  42. <el-form :model="DecreasePaymentsData" ref="DecreasePaymentsData" :rules="DecreasePaymentsRules"
  43. label-width="100px" class="demo-ruleForm">
  44. <div style="display:flex ;flex-wrap: wrap;">
  45. <div style="width: 25%;">
  46. <el-form-item label="费用名称:" prop="priceName" label-width="160px">
  47. <el-input placeholder="费用名称" v-model="DecreasePaymentsData.priceName">
  48. </el-input>
  49. </el-form-item>
  50. </div>
  51. <div style="width: 25%;">
  52. <el-form-item label="费用金额:" prop="price" label-width="160px">
  53. <el-input placeholder="费用金额" v-model="DecreasePaymentsData.price" style="width: 58%;">
  54. </el-input>
  55. <el-select v-model="DecreasePaymentsData.currency" style="width: 40%;">
  56. <el-option v-for="item in rateList" :key="item.currencyId" :label="item.currencyCode"
  57. :value="item.currencyId"></el-option>
  58. </el-select>
  59. </el-form-item>
  60. </div>
  61. <div style="width: 25%;">
  62. <el-form-item label="收款方:" prop="payee" label-width="160px">
  63. <el-input placeholder="收款方" v-model="DecreasePaymentsData.payee">
  64. </el-input>
  65. </el-form-item>
  66. </div>
  67. <div style="width: 25%;">
  68. <el-form-item label="费用标识:" prop="orbitalPrivateTransfer" label-width="160px">
  69. <el-select v-model="DecreasePaymentsData.orbitalPrivateTransfer" placeholder="费用标识"
  70. style="width: 100%;">
  71. <el-option key="0" label="公转" :value=0>
  72. </el-option>
  73. <el-option key="1" label="私转" :value=1>
  74. </el-option>
  75. </el-select>
  76. </el-form-item>
  77. </div>
  78. <div style="width: 25%;">
  79. <el-form-item label="支付方式:" prop="payDId" label-width="160px">
  80. <el-select v-model="DecreasePaymentsData.payDId" placeholder="支付方式" style="width: 100%;">
  81. <el-option v-for="item in payment" :key="item.id" :label="item.name" :value="item.id">
  82. </el-option>
  83. </el-select>
  84. </el-form-item>
  85. </div>
  86. </div>
  87. <div style="display: flex;">
  88. <div>
  89. <el-form-item label="附件:" prop="fileUrl" label-width="160px">
  90. <el-upload :file-list="uploadFiles" ref="upload" :on-success="upLoadSuccess"
  91. :on-error="upLoadError" :before-remove="beforeRemove" :on-change="onChange" :limit="1"
  92. :on-exceed="exceed" :action="uploadURL" :headers="headers" :auto-upload="false">
  93. <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
  94. <!-- <el-button style="margin-left: 10px;" size="small" type="success"
  95. @click="submitUpload">上传到服务器</el-button> -->
  96. </el-upload>
  97. </el-form-item>
  98. </div>
  99. </div>
  100. <div style="display: flex;">
  101. <div style="width: 100%;">
  102. <el-form-item label="备 注:" prop="remark" label-width="160px">
  103. <el-input type="textarea" :rows="5" placeholder="备注"
  104. v-model="DecreasePaymentsData.remark"></el-input>
  105. </el-form-item>
  106. </div>
  107. </div>
  108. <el-form-item>
  109. <div style="margin-left: 60%;">
  110. <el-button type="primary" @click="addBtn">保存</el-button>
  111. <router-link to='/home/DecreasePayments'>
  112. <el-button>取消</el-button>
  113. </router-link>
  114. </div>
  115. </el-form-item>
  116. </el-form>
  117. </div>
  118. </div>
  119. </template>
  120. <script>
  121. export default {
  122. data() {
  123. return {
  124. projectName: "",
  125. uploadURL: "http://132.232.92.186:8888/api/Groups/UploadProject",
  126. uploadFiles: [],//上传的文件列表
  127. DelfileName: "",
  128. title: "新增团组增减款项费用",
  129. token: '',
  130. userId: 0,
  131. id: '',
  132. DiId: '',
  133. isShow: false,
  134. DiIdSelect: '',
  135. delegationInfo: {},
  136. delegationInfoList: [],//团组下拉框
  137. payment: [],//支付方式下拉框
  138. DecreasePaymentsData: {
  139. status: 0,
  140. payDId: 72,
  141. orbitalPrivateTransfer: 0,
  142. payee: "",
  143. id: 0,
  144. diId: 0,
  145. priceName: "",
  146. price: 0,
  147. currency: '',
  148. filePath: "",
  149. createUserId: 0,
  150. remark: ""
  151. },
  152. IsAuditGM: 0,
  153. Decrease: {},
  154. CreditCard: {},
  155. headers: {
  156. Authorization: JSON.parse(localStorage.getItem('userinif')).token,
  157. TypeName: "A"
  158. },
  159. DecreasePaymentsRules: {
  160. price: [
  161. { required: true, message: '请输入费用金额', trigger: 'change' },
  162. { pattern: /^(([1-9]?\d{0,8}(\.\d{1,2})?)|999999999|999999999\.(0){1,2})$/, message: '请输入正确的金额(最多2位小数)' }
  163. ],
  164. priceName: [
  165. { required: true, message: '请输入费用名称', trigger: 'change' },
  166. ],
  167. payee: [
  168. { required: true, message: '请输入收款方姓名', trigger: 'change' },
  169. ],
  170. orbitalPrivateTransfer: [
  171. { required: true, message: '请选择费用标识', trigger: 'change' },
  172. ],
  173. payDId: [
  174. { required: true, message: '请选择支付方式', trigger: 'change' }
  175. ],
  176. },
  177. rateList: [],
  178. }
  179. },
  180. methods: {
  181. //团组下拉框
  182. AirTicketResSelect() {
  183. var url = "/api/Groups/DecreasePaymentsSelect"
  184. var that = this
  185. this.$axios({
  186. method: 'post',
  187. url: url,
  188. headers: {
  189. Authorization: 'Bearer ' + this.token
  190. },
  191. data: {
  192. userId: that.userId,
  193. CTId: 98
  194. }
  195. }).then(function (res) {
  196. if (res.data.code == 200) {
  197. that.delegationInfoList = res.data.data.groupName;
  198. that.DiIdSelect = parseInt(that.DiId)
  199. for (let index = 0; index < that.delegationInfoList.length; index++) {
  200. if (that.delegationInfoList[index].id == that.DiIdSelect) {
  201. that.delegationInfo = that.delegationInfoList[index];
  202. break;
  203. }
  204. }
  205. that.payment = res.data.data.payment
  206. }
  207. })
  208. },
  209. QueryDecreasePaymentsById() {
  210. var url = "/api/Groups/QueryDecreasePaymentsById"
  211. var that = this
  212. this.$axios({
  213. method: 'post',
  214. url: url,
  215. headers: {
  216. Authorization: 'Bearer ' + this.token
  217. },
  218. data: {
  219. Id: that.id
  220. }
  221. }).then(function (res) {
  222. if (res.data.code == 200) {
  223. that.Decrease = res.data.data._Decrease
  224. that.CreditCard = res.data.data._CreditCard
  225. that.DecreasePaymentsData.payDId = that.CreditCard.payDId
  226. that.DecreasePaymentsData.orbitalPrivateTransfer = that.CreditCard.orbitalPrivateTransfer
  227. that.DecreasePaymentsData.payee = that.CreditCard.payee
  228. that.DecreasePaymentsData.id = that.Decrease.id
  229. that.DecreasePaymentsData.diId = that.Decrease.diId
  230. that.DecreasePaymentsData.priceName = that.Decrease.priceName
  231. that.DecreasePaymentsData.price = that.Decrease.price
  232. that.DecreasePaymentsData.currency = that.Decrease.currency
  233. that.DecreasePaymentsData.filePath = that.Decrease.filePath
  234. that.projectName = that.Decrease.filePath
  235. that.DecreasePaymentsData.remark = that.Decrease.remark
  236. that.IsAuditGM = that.CreditCard.isAuditGM
  237. if (that.Decrease.filePath != null && that.Decrease.filePath != undefined && that.Decrease.filePath != "") {
  238. that.uploadFiles.push({
  239. name: that.Decrease.filePath,
  240. url: 'http://132.232.92.186:24/Office/GrpFile/团组增减款项相关文件/',
  241. })
  242. }
  243. }
  244. })
  245. },
  246. //点击保存事件
  247. addBtn() {
  248. if (this.IsAuditGM == 1) {
  249. this.$message.error('已通过审核,不可修改!');
  250. } else {
  251. if (this.DiId == null && this.DiId == undefined && this.DiId == "") {
  252. this.$message.error("请选择团组名称");
  253. return;
  254. }
  255. const that = this;
  256. that.$refs.DecreasePaymentsData.validate((valid) => {
  257. if (valid) {
  258. if (that.DecreasePaymentsData.filePath == that.projectName) {
  259. if (that.DelfileName != null && that.DelfileName != "" && that.DelfileName != undefined) {
  260. that.$axios({
  261. method: 'post',
  262. url: "/api/Groups/DelFile",
  263. headers: {
  264. Authorization: 'Bearer ' + that.token
  265. },
  266. data: {
  267. fileName: that.DelfileName,
  268. id: that.id
  269. }
  270. }).then(function (res) {
  271. if (res.data.code == 200) {
  272. }
  273. })
  274. }
  275. that.DecreasePaymentsData.filePath = that.projectName
  276. that.DecreasePaymentsData.diId = that.DiIdSelect;
  277. that.DecreasePaymentsData.createUserId = that.userId;
  278. var url = "/api/Groups/OpDecreasePayments"
  279. that.$axios({
  280. method: 'post',
  281. url: url,
  282. headers: {
  283. Authorization: 'Bearer ' + that.token
  284. },
  285. data: that.DecreasePaymentsData
  286. }).then(function (res) {
  287. if (res.data.code == 200) {
  288. that.$message({
  289. message: res.data.msg,
  290. type: 'success'
  291. });
  292. that.loading = true;
  293. setTimeout(() => {
  294. that.$router.push('/home/DecreasePayments')
  295. }, 3000);
  296. } else {
  297. that.$message.error(res.data.msg);
  298. }
  299. })
  300. } else {
  301. if (that.DelfileName != null && that.DelfileName != "" && that.DelfileName != undefined) {
  302. that.$axios({
  303. method: 'post',
  304. url: "/api/Groups/DelFile",
  305. headers: {
  306. Authorization: 'Bearer ' + that.token
  307. },
  308. data: {
  309. fileName: that.DelfileName,
  310. id: that.id
  311. }
  312. }).then(function (res) {
  313. if (res.data.code == 200) {
  314. }
  315. })
  316. }
  317. if (that.projectName != "" && that.projectName != null && that.projectName != undefined) {
  318. that.$refs.upload.submit();//上传文件到服务器
  319. } else {
  320. that.DecreasePaymentsData.filePath = that.projectName
  321. that.DecreasePaymentsData.diId = that.DiIdSelect;
  322. that.DecreasePaymentsData.createUserId = that.userId;
  323. var url = "/api/Groups/OpDecreasePayments"
  324. that.$axios({
  325. method: 'post',
  326. url: url,
  327. headers: {
  328. Authorization: 'Bearer ' + that.token
  329. },
  330. data: that.DecreasePaymentsData
  331. }).then(function (res) {
  332. if (res.data.code == 200) {
  333. that.$message({
  334. message: res.data.msg,
  335. type: 'success'
  336. });
  337. that.loading = true;
  338. setTimeout(() => {
  339. that.$router.push('/home/DecreasePayments')
  340. }, 3000);
  341. } else {
  342. that.$message.error(res.data.msg);
  343. }
  344. })
  345. }
  346. }
  347. } else {
  348. this.$message.error('请完善信息在保存!');
  349. return false;
  350. }
  351. })
  352. }
  353. // 此时必填完成,做保存后的业务操作
  354. },
  355. DecreasePaymentsChange() {
  356. this.QueryRate();
  357. for (let index = 0; index < this.delegationInfoList.length; index++) {
  358. if (this.delegationInfoList[index].id == parseInt(this.DiIdSelect)) {
  359. this.delegationInfo = this.delegationInfoList[index];
  360. break;
  361. }
  362. }
  363. },
  364. //上传
  365. // 文件超出限制
  366. exceed(files, fileList) {
  367. this.$message.warning(
  368. `当前限制选择 1个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length
  369. } 个文件,请取消要替换的文件`
  370. );
  371. },
  372. //文件上传成功时的钩子
  373. upLoadSuccess(response, file, fileList) {
  374. if (response.code == 200) {
  375. var that = this;
  376. that.$axios({
  377. method: 'post',
  378. url: "/api/Groups/DelFile",
  379. headers: {
  380. Authorization: 'Bearer ' + that.token,
  381. TypeName: "A"
  382. },
  383. data: {
  384. fileName: that.DelfileName,
  385. id: that.id
  386. }
  387. }).then(function (res) {
  388. if (res.data.code == 200) {
  389. }
  390. })
  391. that.DecreasePaymentsData.filePath = response.data
  392. that.DecreasePaymentsData.diId = that.DiIdSelect;
  393. that.DecreasePaymentsData.createUserId = that.userId;
  394. var url = "/api/Groups/OpDecreasePayments"
  395. that.$axios({
  396. method: 'post',
  397. url: url,
  398. headers: {
  399. Authorization: 'Bearer ' + that.token
  400. },
  401. data: that.DecreasePaymentsData
  402. }).then(function (res) {
  403. if (res.data.code == 200) {
  404. that.$message({
  405. message: res.data.msg,
  406. type: 'success'
  407. });
  408. that.loading = true;
  409. setTimeout(() => {
  410. that.$router.push('/home/DecreasePayments')
  411. }, 3000);
  412. } else {
  413. that.$message.error(res.data.msg);
  414. }
  415. })
  416. console.log("上传成功");
  417. } else {
  418. console.log("保存失败");
  419. }
  420. },
  421. //文件上传失败时的钩子
  422. upLoadError(response, file, fileList) {
  423. console.log("项目添加失败");
  424. },
  425. beforeRemove(file, fileList) {
  426. console.log(file.name)
  427. let id1 = this.uploadFiles.findIndex(item => {
  428. if (item.name == file.name) {
  429. return true
  430. }
  431. })
  432. this.uploadFiles.splice(id1, 1)
  433. this.projectName = ""
  434. this.DelfileName = file.name
  435. },
  436. onChange(file, fileList) {
  437. this.projectName = file.name
  438. },
  439. QueryRate() {
  440. var url = "/api/Business/PostGroupTeamRateByDiIdAndCTableId"
  441. var that = this
  442. this.$axios({
  443. method: 'post',
  444. url: url,
  445. headers: {
  446. Authorization: 'Bearer ' + that.token
  447. },
  448. data: {
  449. "portType": 1,
  450. "diId": this.DiIdSelect ? this.DiIdSelect : this.DiId,
  451. "cTable": 98
  452. }
  453. }).then(function (res) {
  454. if (res.data.code == 200) {
  455. //汇率
  456. console.log("汇率--", res.data.data);
  457. that.rateList = res.data.data.teamRates;
  458. }
  459. })
  460. }
  461. },
  462. mounted() {
  463. this.DiId = this.$route.query.DiId
  464. this.QueryRate();
  465. this.token = JSON.parse(localStorage.getItem('userinif')).token;
  466. this.userId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
  467. this.AirTicketResSelect();
  468. this.id = this.$route.query.id
  469. if (this.id != null && this.id != undefined && this.id != 0) {
  470. this.QueryDecreasePaymentsById();
  471. this.title = "修改团组增减款项费用";
  472. this.DecreasePaymentsData.status = 2
  473. this.isShow = true
  474. } else {
  475. this.DecreasePaymentsData.status = 1
  476. this.title = "新增团组增减款项费用"
  477. this.isShow = false
  478. }
  479. }
  480. }
  481. </script>
  482. <style>
  483. .communal-list {
  484. background-color: #fff;
  485. padding: 10px;
  486. box-shadow: 0 0 5px #0005;
  487. border-radius: 10px;
  488. }
  489. .car_add .communal-title {
  490. display: flex;
  491. font-size: 17px;
  492. font-weight: 600;
  493. color: #555;
  494. margin-bottom: 20px;
  495. justify-content: space-between;
  496. align-items: center;
  497. }
  498. .appraise-box {
  499. display: flex;
  500. flex-wrap: wrap;
  501. justify-content: space-between;
  502. margin: 50px 0;
  503. }
  504. .appraise-box>div {
  505. width: 30%;
  506. }
  507. .communal-box {
  508. display: flex;
  509. }
  510. .communal-box>button {
  511. margin-left: 10px;
  512. padding: 8px 20px;
  513. }
  514. .car_add {
  515. background-color: #fff;
  516. padding: 20px;
  517. box-shadow: 0 0 5px #0005;
  518. border-radius: 10px;
  519. }
  520. @media screen and (max-width: 1700px) {
  521. .appraise-box>div {
  522. width: 48%;
  523. }
  524. .appraise-box>div el-form-item__content {
  525. width: 260px !important;
  526. }
  527. }
  528. </style>