OpDecreasePayments.vue 22 KB

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