OpDecreasePayments.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  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: "/project/upload?a=1",
  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. Decrease: {},
  156. CreditCard: {},
  157. headers: {
  158. Authorization: JSON.parse(localStorage.getItem('userinif')).token
  159. },
  160. DecreasePaymentsRules: {
  161. price: [
  162. { required: true, message: '请输入费用金额', trigger: 'change' },
  163. { pattern: /^(([1-9]?\d{0,8}(\.\d{1,2})?)|999999999|999999999\.(0){1,2})$/, message: '请输入正确的金额(最多2位小数)' }
  164. ],
  165. priceName: [
  166. { required: true, message: '请输入费用名称', trigger: 'change' },
  167. ],
  168. payee: [
  169. { required: true, message: '请输入收款方姓名', trigger: 'change' },
  170. ],
  171. orbitalPrivateTransfer: [
  172. { required: true, message: '请选择费用标识', trigger: 'change' },
  173. ],
  174. payDId: [
  175. { required: true, message: '请选择支付方式', trigger: 'change' }
  176. ],
  177. }
  178. }
  179. },
  180. computed: {
  181. //文件的上传路径
  182. uploadURL: function () {
  183. //var userId = this.$store.state.userId;
  184. return "http://132.232.92.186:8888/api/Groups/UploadProject";
  185. }
  186. },
  187. methods: {
  188. //团组下拉框
  189. AirTicketResSelect() {
  190. var url = "/api/Groups/DecreasePaymentsSelect"
  191. var that = this
  192. this.$axios({
  193. method: 'post',
  194. url: url,
  195. headers: {
  196. Authorization: 'Bearer ' + this.token
  197. },
  198. data: {
  199. userId: that.userId
  200. }
  201. }).then(function (res) {
  202. if (res.data.code == 200) {
  203. that.delegationInfoList = res.data.data.groupName;
  204. that.DiIdSelect = parseInt(that.DiId)
  205. for (let index = 0; index < that.delegationInfoList.length; index++) {
  206. if (that.delegationInfoList[index].id == that.DiIdSelect) {
  207. that.delegationInfo = that.delegationInfoList[index];
  208. break;
  209. }
  210. }
  211. that.payment = res.data.data.payment
  212. }
  213. })
  214. },
  215. QueryDecreasePaymentsById() {
  216. var url = "/api/Groups/QueryDecreasePaymentsById"
  217. var that = this
  218. this.$axios({
  219. method: 'post',
  220. url: url,
  221. headers: {
  222. Authorization: 'Bearer ' + this.token
  223. },
  224. data: {
  225. Id: that.id
  226. }
  227. }).then(function (res) {
  228. if (res.data.code == 200) {
  229. that.Decrease = res.data.data._Decrease
  230. that.CreditCard = res.data.data._CreditCard
  231. that.DecreasePaymentsData.payDId = that.CreditCard.payDId
  232. that.DecreasePaymentsData.orbitalPrivateTransfer = that.CreditCard.orbitalPrivateTransfer
  233. that.DecreasePaymentsData.payee = that.CreditCard.payee
  234. that.DecreasePaymentsData.id = that.Decrease.id
  235. that.DecreasePaymentsData.diId = that.Decrease.diId
  236. that.DecreasePaymentsData.priceName = that.Decrease.priceName
  237. that.DecreasePaymentsData.price = that.Decrease.price
  238. that.DecreasePaymentsData.currency = that.Decrease.currency
  239. that.DecreasePaymentsData.filePath = that.Decrease.filePath
  240. that.DecreasePaymentsData.remark = that.Decrease.remark
  241. if (that.Decrease.filePath != null && that.Decrease.filePath != undefined && that.Decrease.filePath != "") {
  242. that.uploadFiles.push({
  243. name: that.Decrease.filePath,
  244. url: 'C:\\Server\\File\\OA2023\\Office\\GrpFile\\',
  245. })
  246. }
  247. }
  248. })
  249. },
  250. //点击保存事件
  251. addBtn() {
  252. const that = this;
  253. that.$refs.DecreasePaymentsData.validate((valid) => {
  254. if (valid) {
  255. debugger
  256. if (that.projectName == "") {
  257. that.$axios({
  258. method: 'post',
  259. url: "/api/Groups/DelFile",
  260. headers: {
  261. Authorization: 'Bearer ' + that.token
  262. },
  263. data: {
  264. fileName: that.DelfileName,
  265. id: that.id
  266. }
  267. }).then(function (res) {
  268. if (res.data.code == 200) {
  269. }
  270. })
  271. this.DecreasePaymentsData.filePath = ""
  272. that.DecreasePaymentsData.diId = that.DiIdSelect;
  273. that.DecreasePaymentsData.createUserId = that.userId;
  274. var url = "/api/Groups/OpDecreasePayments"
  275. that.$axios({
  276. method: 'post',
  277. url: url,
  278. headers: {
  279. Authorization: 'Bearer ' + that.token
  280. },
  281. data: that.DecreasePaymentsData
  282. }).then(function (res) {
  283. if (res.data.code == 200) {
  284. that.$message({
  285. message: res.data.msg,
  286. type: 'success'
  287. });
  288. that.loading = true;
  289. setTimeout(() => {
  290. that.$router.push('/home/DecreasePayments')
  291. }, 3000);
  292. } else {
  293. that.$message.error(res.data.msg);
  294. }
  295. })
  296. } else {
  297. that.$refs.upload.submit();//上传文件到服务器
  298. }
  299. } else {
  300. this.$message.error('请完善信息在保存!');
  301. return false;
  302. }
  303. })
  304. // 此时必填完成,做保存后的业务操作
  305. },
  306. DecreasePaymentsChange() {
  307. for (let index = 0; index < this.delegationInfoList.length; index++) {
  308. if (this.delegationInfoList[index].id == parseInt(this.DiIdSelect)) {
  309. this.delegationInfo = this.delegationInfoList[index];
  310. break;
  311. }
  312. }
  313. },
  314. //上传
  315. // 文件超出限制
  316. exceed(files, fileList) {
  317. this.$message.warning(
  318. `当前限制选择 1个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length
  319. } 个文件,请取消要替换的文件`
  320. );
  321. },
  322. //文件上传
  323. // submitUpload() {
  324. // },
  325. //文件上传成功时的钩子
  326. upLoadSuccess(response, file, fileList) {
  327. if (response.code == 200) {
  328. var that = this;
  329. that.$axios({
  330. method: 'post',
  331. url: "/api/Groups/DelFile",
  332. headers: {
  333. Authorization: 'Bearer ' + that.token
  334. },
  335. data: {
  336. fileName: that.DelfileName,
  337. id: that.id
  338. }
  339. }).then(function (res) {
  340. if (res.data.code == 200) {
  341. }
  342. })
  343. this.DecreasePaymentsData.filePath = response.data
  344. that.DecreasePaymentsData.diId = that.DiIdSelect;
  345. that.DecreasePaymentsData.createUserId = that.userId;
  346. var url = "/api/Groups/OpDecreasePayments"
  347. that.$axios({
  348. method: 'post',
  349. url: url,
  350. headers: {
  351. Authorization: 'Bearer ' + that.token
  352. },
  353. data: that.DecreasePaymentsData
  354. }).then(function (res) {
  355. if (res.data.code == 200) {
  356. that.$message({
  357. message: res.data.msg,
  358. type: 'success'
  359. });
  360. that.loading = true;
  361. setTimeout(() => {
  362. that.$router.push('/home/DecreasePayments')
  363. }, 3000);
  364. } else {
  365. that.$message.error(res.data.msg);
  366. }
  367. })
  368. console.log("上传成功");
  369. } else {
  370. console.log("保存失败");
  371. }
  372. },
  373. //文件上传失败时的钩子
  374. upLoadError(response, file, fileList) {
  375. console.log("项目添加失败");
  376. },
  377. beforeRemove(file, fileList) {
  378. console.log(file.name)
  379. let id1 = this.uploadFiles.findIndex(item => {
  380. if (item.name == file.name) {
  381. return true
  382. }
  383. })
  384. this.uploadFiles.splice(id1, 1)
  385. this.projectName = ""
  386. this.DelfileName = file.name
  387. },
  388. onChange(file, fileList) {
  389. this.projectName = file.name
  390. }
  391. },
  392. mounted() {
  393. this.token = JSON.parse(localStorage.getItem('userinif')).token;
  394. this.userId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
  395. this.AirTicketResSelect();
  396. this.id = this.$route.query.id
  397. if (this.id != null && this.id != undefined && this.id != 0) {
  398. this.QueryDecreasePaymentsById();
  399. this.title = "修改团组增减款项费用";
  400. this.DecreasePaymentsData.status = 2
  401. this.isShow = true
  402. } else {
  403. this.DecreasePaymentsData.status = 1
  404. this.title = "新增团组增减款项费用"
  405. this.isShow = false
  406. }
  407. this.DiId = this.$route.query.DiId
  408. }
  409. }
  410. </script>
  411. <style>
  412. .communal-list {
  413. background-color: #fff;
  414. padding: 10px;
  415. box-shadow: 0 0 5px #0005;
  416. border-radius: 10px;
  417. }
  418. .car_add .communal-title {
  419. display: flex;
  420. font-size: 17px;
  421. font-weight: 600;
  422. color: #555;
  423. margin-bottom: 20px;
  424. justify-content: space-between;
  425. align-items: center;
  426. }
  427. .appraise-box {
  428. display: flex;
  429. flex-wrap: wrap;
  430. justify-content: space-between;
  431. margin: 50px 0;
  432. }
  433. .appraise-box>div {
  434. width: 30%;
  435. }
  436. .communal-box {
  437. display: flex;
  438. }
  439. .communal-box>button {
  440. margin-left: 10px;
  441. padding: 8px 20px;
  442. }
  443. .car_add {
  444. background-color: #fff;
  445. padding: 20px;
  446. box-shadow: 0 0 5px #0005;
  447. border-radius: 10px;
  448. }
  449. @media screen and (max-width: 1700px) {
  450. .appraise-box>div {
  451. width: 48%;
  452. }
  453. .appraise-box>div el-form-item__content {
  454. width: 260px !important;
  455. }
  456. }
  457. </style>