Sendack.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
  1. <template>
  2. <div>
  3. <div class="sendack-all">
  4. <div class="sendack-head">
  5. <div class="sendack-head-li">
  6. <label>团组名称:</label>
  7. <el-select @change="changediid()" v-model="value" filterable placeholder="请选择">
  8. <el-option
  9. v-for="item in options"
  10. :key="item.id"
  11. :label="item.groupName"
  12. :value="item.id">
  13. </el-option>
  14. </el-select>
  15. </div>
  16. <div class="sendack-head-li">
  17. <el-button @click="dialogFormVisible=true;" type="primary">新增数据</el-button>
  18. </div>
  19. </div>
  20. <div class="sendack-info">
  21. <div class="sendack-info-li">
  22. <label>团 号:</label>
  23. <span v-if="this.groupInfo.tourCode!=''">{{groupInfo=={}?'暂无':groupInfo.tourCode==""?'暂无':groupInfo.tourCode}}</span>
  24. <!-- <span>{{groupInfo?'暂无':groupInfo.tourCode}}</span> -->
  25. </div>
  26. <div class="sendack-info-li">
  27. <label>客 户:</label>
  28. <span>{{groupInfo=={}?'暂无':groupInfo.clientName==""?'暂无':groupInfo.clientName}}</span>
  29. </div>
  30. <div class="sendack-info-li">
  31. <label>出访国家:</label>
  32. <span>{{groupInfo=={}?'暂无':groupInfo.visitCountry==""?'暂无':groupInfo.visitCountry}}</span>
  33. </div>
  34. <div class="sendack-info-li">
  35. <label>起止日期:</label>
  36. <span>{{groupInfo.visitStartDate|filter_time}}~{{groupInfo.visitEndDate|filter_time}}</span>
  37. </div>
  38. <div class="sendack-info-li">
  39. <label>天数/人数:</label>
  40. <span>{{groupInfo=={}?'暂无':groupInfo.visitDays+'天/'+groupInfo.visitPNumber+'人'}}</span>
  41. </div>
  42. </div>
  43. <template>
  44. <el-table
  45. :data="groupsendData"
  46. border
  47. style="width: 100%">
  48. <el-table-column
  49. type="index"
  50. label="序 号"
  51. width="55">
  52. </el-table-column>
  53. <el-table-column
  54. prop="priceName"
  55. label="费用名称">
  56. </el-table-column>
  57. <el-table-column
  58. width="120"
  59. prop="price"
  60. label="费用">
  61. </el-table-column>
  62. <el-table-column
  63. prop="createUserName"
  64. label="操作人"
  65. width="80">
  66. </el-table-column>
  67. <el-table-column
  68. prop="createTime"
  69. label="操作时间"
  70. width="160">
  71. </el-table-column>
  72. <el-table-column
  73. prop="remark"
  74. label="备注"
  75. width="600">
  76. </el-table-column>
  77. <el-table-column label="操作" width="110">
  78. <template slot-scope="scope">
  79. <el-button
  80. type="text"
  81. size="mini"
  82. @click="Complete(scope.$index, scope.row)">编辑</el-button>
  83. <el-button
  84. type="text"
  85. size="mini"
  86. @click="Delete(scope.$index, scope.row)"
  87. >删除</el-button>
  88. </template>
  89. </el-table-column>
  90. </el-table>
  91. </template>
  92. <el-dialog width="900px" title="新增数据" :visible.sync="dialogFormVisible">
  93. <el-form :model="form" :rules="rules" ref="form">
  94. <div style="display: flex;flex-wrap:wrap;">
  95. <el-form-item label="费用名称" prop="priceName" :label-width="formLabelWidth">
  96. <el-input v-model="form.priceName" autocomplete="off"></el-input>
  97. </el-form-item>
  98. <el-form-item label="费用金额" prop="price" :label-width="formLabelWidth">
  99. <el-input-number class="fyjeinput" :controls="false" :precision="2" v-model="form.price"></el-input-number>
  100. <el-select filterable class="fyjeselect" v-model="form.currencyId" placeholder="请选择币种">
  101. <el-option v-for="(item,index) in currencyDatas" :key="index" :label="item.name" :value="item.id"></el-option>
  102. </el-select>
  103. </el-form-item>
  104. <el-form-item label="收款方" prop="payee" :label-width="formLabelWidth">
  105. <el-input v-model="form.payee" autocomplete="off"></el-input>
  106. </el-form-item>
  107. <el-form-item label="支付方式" prop="payDId" :label-width="formLabelWidth">
  108. <el-select v-model="form.payDId" placeholder="请选择活动区域">
  109. <el-option v-for="(item,index) in payTypeDatas" :key="index" :label="item.name" :value="item.id"></el-option>
  110. </el-select>
  111. </el-form-item>
  112. <el-form-item label="费用标识" prop="orbitalPrivateTransfer" :label-width="formLabelWidth">
  113. <el-select v-model="form.orbitalPrivateTransfer" placeholder="请选择活动区域">
  114. <el-option v-for="(item,index) in orbitalPrivateTransferDatas" :key="index" :label="item.name" :value="item.id"></el-option>
  115. </el-select>
  116. </el-form-item>
  117. <el-form-item label="消费方式" prop="consumptionPatterns" :label-width="formLabelWidth">
  118. <el-input v-model="form.consumptionPatterns" autocomplete="off"></el-input>
  119. </el-form-item>
  120. <el-form-item label="费用类型" prop="payType" :label-width="formLabelWidth">
  121. <el-select v-model="form.payType" placeholder="请选择活动区域">
  122. <el-option v-for="(item,index) in priceTypeDatas" :key="index" :label="item.name" :value="item.id"></el-option>
  123. </el-select>
  124. </el-form-item>
  125. </div>
  126. <el-form-item style="width:97%" label="备 注" :label-width="formLabelWidth">
  127. <el-input style="width:100%" :rows="4" type="textarea" v-model="form.remark" autocomplete="off"></el-input>
  128. </el-form-item>
  129. </el-form>
  130. <div slot="footer" class="dialog-footer">
  131. <el-button @click="dialogFormVisible = false">取 消</el-button>
  132. <el-button type="primary" @click="submitForm('form','保存')">确 定</el-button>
  133. <el-button type="primary" @click="submitForm('form','修改')">修 改</el-button>
  134. </div>
  135. </el-dialog>
  136. </div>
  137. </div>
  138. </template>
  139. <script>
  140. export default {
  141. data() {
  142. return {
  143. userid:'',
  144. value:'',
  145. options:[],
  146. groupInfo:{},
  147. groupsendData:[],
  148. pageId:0,
  149. dialogFormVisible:false,
  150. form:{
  151. id:0,
  152. ccpId:0,
  153. priceName:'',//费用名称
  154. price:0,//费用
  155. currencyId:807,//币种Id
  156. currencyCode:'',//币种Code
  157. payee:'',//收款方
  158. payDId:72,//支付方式Id
  159. orbitalPrivateTransfer:0,//费用标识
  160. consumptionPatterns:'',//消费方式
  161. payType:0,//费用类型 0 其他 1 退多付款
  162. remark:'',//备注
  163. },
  164. rules: {
  165. priceName: [
  166. { required: true, message: '请输入费用名称', trigger: 'blur' },
  167. ],
  168. price: [
  169. { required: true, message: '请填写完此项', trigger: 'blur' }
  170. ],
  171. payee: [
  172. { required: true, message: '请填写完此项', trigger: 'blur' }
  173. ],
  174. payDId: [
  175. { required: true, message: '请选择', trigger: 'change' }
  176. ],
  177. orbitalPrivateTransfer: [
  178. { required: true, message: '请选择', trigger: 'change' }
  179. ],
  180. consumptionPatterns: [
  181. { required: true, message: '请填写完此项', trigger: 'blur' }
  182. ],
  183. payType: [
  184. { required: true, message: '请选择', trigger: 'change' }
  185. ]
  186. },
  187. formLabelWidth:'100px',
  188. currencyDatas:[],
  189. payTypeDatas:[],
  190. priceTypeDatas:[],
  191. orbitalPrivateTransferDatas:[],
  192. }
  193. },
  194. methods:{
  195. filteryear(val){
  196. let gstime=val.visitDate.split(' ')[0]
  197. return gstime;
  198. },
  199. //获取团组
  200. GetForeignReceivablesDataSources(){
  201. var url = "/api/Financial/GetForeignReceivablesDataSources"
  202. var that = this
  203. this.$axios({
  204. method: 'post',
  205. url: url,
  206. headers: {
  207. Authorization: 'Bearer ' + that.userid
  208. },
  209. }).then(function (res) {
  210. console.log(res)
  211. if(res.data.code==200){
  212. that.options=res.data.data.groupNameData;
  213. that.value=res.data.data.groupNameData[0].id;
  214. that.PostShareGroupInfo();
  215. that.PostPaymentRefundAndOtherMoneyItemByDiId();
  216. }else{
  217. that.$message.error('获取数据源失败!');
  218. }
  219. })
  220. },
  221. //获取数据源
  222. PostPaymentRefundAndOtherMoneyInfoDataSource(){
  223. var url = "/api/Financial/PostPaymentRefundAndOtherMoneyInfoDataSource"
  224. var that = this
  225. this.$axios({
  226. method: 'post',
  227. url: url,
  228. headers: {
  229. Authorization: 'Bearer ' + that.userid
  230. },
  231. data:{
  232. portType: 1
  233. }
  234. }).then(function (res) {
  235. console.log(res)
  236. if(res.data.code==200){
  237. that.currencyDatas=res.data.data.currencyDatas;
  238. that.payTypeDatas=res.data.data.payTypeDatas;
  239. that.priceTypeDatas=res.data.data.priceTypeDatas;
  240. that.orbitalPrivateTransferDatas=res.data.data.orbitalPrivateTransferDatas;
  241. }else{
  242. that.$message.error('获取数据源失败!');
  243. }
  244. })
  245. },
  246. //获取团组详情
  247. PostShareGroupInfo(){
  248. var url = "/api/Business/PostShareGroupInfo"
  249. var that = this
  250. this.$axios({
  251. method: 'post',
  252. url: url,
  253. headers: {
  254. Authorization: 'Bearer ' + that.userid
  255. },
  256. data:{
  257. portType:1,
  258. id: that.value
  259. }
  260. }).then(function (res) {
  261. console.log(res)
  262. if(res.data.code==200){
  263. that.groupInfo=res.data.data;
  264. }else{
  265. that.$message.error('获取数据源失败!');
  266. }
  267. })
  268. },
  269. //获取团组收款退还与其他款项
  270. PostPaymentRefundAndOtherMoneyItemByDiId(){
  271. var url = "/api/Financial/PostPaymentRefundAndOtherMoneyItemByDiId"
  272. var that = this
  273. this.$axios({
  274. method: 'post',
  275. url: url,
  276. headers: {
  277. Authorization: 'Bearer ' + that.userid
  278. },
  279. data:{
  280. portType:1,
  281. userId:that.userid,
  282. pageId:that.pageId,
  283. diId: that.value
  284. }
  285. }).then(function (res) {
  286. console.log(res)
  287. if(res.data.code==200){
  288. that.groupsendData=res.data.data.data
  289. }else{
  290. that.$message.error('获取数据源失败!');
  291. }
  292. })
  293. },
  294. //保存修改
  295. submitForm(formName,text) {
  296. this.$refs[formName].validate((valid) => {
  297. if (valid) {
  298. var status
  299. var id
  300. var ccpId
  301. for(var i=0;i<this.currencyDatas.length;i++){
  302. if(this.currencyDatas[i].id==this.form.currencyId){
  303. this.form.currencyCode=this.currencyDatas[i].name
  304. }
  305. }
  306. if(text=='保存'){
  307. status=1
  308. this.PostPaymentRefundAndOtherMoneyAddOrEdit(status)
  309. }
  310. if(text=='修改'){
  311. status=2
  312. this.PostPaymentRefundAndOtherMoneyAddOrEdit(status)
  313. }
  314. console.log(this.form)
  315. } else {
  316. console.log('error submit!!');
  317. return false;
  318. }
  319. });
  320. },
  321. //保存修改api
  322. PostPaymentRefundAndOtherMoneyAddOrEdit(status){
  323. var url = "/api/Financial/PostPaymentRefundAndOtherMoneyAddOrEdit"
  324. var that = this
  325. var data={
  326. portType:1,
  327. userId:that.userid,
  328. status:status,//1 添加 2 修改
  329. diId:that.value,
  330. id:that.form.id,
  331. ccpId:that.form.ccpId,
  332. priceName:that.form.priceName,
  333. price:that.form.price,
  334. currencyId:that.form.price,
  335. currencyCode:that.form.currencyCode,
  336. payee:that.form.payee,
  337. payDId:that.form.payDId,
  338. orbitalPrivateTransfer:that.form.orbitalPrivateTransfer,
  339. consumptionPatterns:that.form.consumptionPatterns,
  340. payType:that.form.payType,
  341. remark:that.form.remark,
  342. }
  343. console.log(JSON.stringify(data))
  344. this.$axios({
  345. method: 'post',
  346. url: url,
  347. headers: {
  348. Authorization: 'Bearer ' + that.userid
  349. },
  350. data:{
  351. portType:1,
  352. userId:that.userid,
  353. status:status,//1 添加 2 修改
  354. diId:that.value,
  355. id:that.form.id,
  356. ccpId:that.form.ccpId,
  357. priceName:that.form.priceName,
  358. price:that.form.price,
  359. currencyId:that.form.currencyId,
  360. currencyCode:that.form.currencyCode,
  361. payee:that.form.payee,
  362. payDId:that.form.payDId,
  363. orbitalPrivateTransfer:that.form.orbitalPrivateTransfer,
  364. consumptionPatterns:that.form.consumptionPatterns,
  365. payType:that.form.payType,
  366. remark:that.form.remark,
  367. }
  368. }).then(function (res) {
  369. console.log(res)
  370. if(res.data.code==200){
  371. that.$message({
  372. message: res.data.msg,
  373. type: 'success'
  374. });
  375. }else{
  376. that.$message.error(res.data.msg);
  377. }
  378. })
  379. },
  380. //编辑
  381. Complete(index,row){
  382. if (this.$refs.form){
  383. this.$nextTick(() => {
  384. this.$refs['form'].clearValidate();
  385. })
  386. }
  387. //弹框
  388. this.dialogFormVisible=true;
  389. //初始化数据
  390. this.form={
  391. id:0,
  392. ccpId:0,
  393. priceName:'',//费用名称
  394. price:0,//费用
  395. currencyId:807,//币种Id
  396. currencyCode:'',//币种Code
  397. payee:'',//收款方
  398. payDId:72,//支付方式Id
  399. orbitalPrivateTransfer:0,//费用标识
  400. consumptionPatterns:'',//消费方式
  401. payType:0,//费用类型 0 其他 1 退多付款
  402. remark:'',//备注
  403. }
  404. var formobject={}
  405. var url = "/api/Financial/PostPaymentRefundAndOtherMoneyInfo"
  406. var that = this
  407. this.$axios({
  408. method: 'post',
  409. url: url,
  410. headers: {
  411. Authorization: 'Bearer ' + that.userid
  412. },
  413. data:{
  414. portType:1,
  415. id: row.id,
  416. }
  417. }).then(function (res) {
  418. console.log(res)
  419. if(res.data.code==200){
  420. formobject=res.data.data[0];
  421. that.form.id=formobject.id;
  422. that.form.ccpId=formobject.ccpId;
  423. that.form.priceName=formobject.priceName;
  424. that.form.price=formobject.price;
  425. that.form.currencyId=formobject.currencyId;
  426. that.form.payee=formobject.payee;
  427. that.form.payDId=formobject.payDId;
  428. that.form.orbitalPrivateTransfer=formobject.orbitalPrivateTransfer;
  429. that.form.consumptionPatterns=formobject.consumptionPatterns;
  430. that.form.payType=formobject.payType;
  431. that.form.remark=formobject.remark;
  432. }else{
  433. that.$message.error('获取数据源失败!');
  434. }
  435. })
  436. },
  437. //删除
  438. Delete(index,row){
  439. this.$confirm('此操作将删除此条数据,是否确认删除?', '提示', {
  440. confirmButtonText: '确定',
  441. cancelButtonText: '取消',
  442. type: 'warning'
  443. }).then(() => {
  444. var url = "/api/Financial/PostPaymentRefundAndOtherMoneyItemByDiId"
  445. var that = this
  446. this.$axios({
  447. method: 'post',
  448. url: url,
  449. headers: {
  450. Authorization: 'Bearer ' + that.userid
  451. },
  452. data:{
  453. portType:1,
  454. id: row.id
  455. }
  456. }).then(function (res) {
  457. console.log(res)
  458. if(res.data.code==200){
  459. that.$message({
  460. message: res.data.msg,
  461. type: 'success'
  462. });
  463. that.PostPaymentRefundAndOtherMoneyItemByDiId()
  464. }else{
  465. that.$message.error('获取数据源失败!');
  466. }
  467. })
  468. })
  469. },
  470. changediid(){
  471. this.PostShareGroupInfo();
  472. this.PostPaymentRefundAndOtherMoneyItemByDiId();
  473. }
  474. },
  475. filters:{
  476. filter_time(value){
  477. if(value){
  478. return value.split(' ')[0];
  479. }
  480. return value
  481. },
  482. filter_city(value){
  483. return value
  484. }
  485. },
  486. mounted(){
  487. this.userid=JSON.parse(localStorage.getItem('userinif')).userInfo.userId;
  488. this.pageId=localStorage.getItem('indexs').split('-')[1];//页面id
  489. console.log(this.pageId)
  490. this.GetForeignReceivablesDataSources();
  491. this.PostPaymentRefundAndOtherMoneyInfoDataSource();
  492. }
  493. }
  494. </script>
  495. <style>
  496. .sendack-all{
  497. background-color: #fff;
  498. padding: 10px;
  499. box-shadow: 0 0 5px #0005;
  500. border-radius: 10px;
  501. height: 100%;
  502. min-height: 840px;
  503. }
  504. .sendack-head-li label{
  505. color: #606266;
  506. font-size: 15px;
  507. font-weight: 600;
  508. }
  509. .sendack-head{
  510. display: flex;
  511. justify-content: space-between;
  512. }
  513. .sendack-info{
  514. display: flex;
  515. margin-top: 10px;
  516. margin-bottom: 10px;
  517. }
  518. .sendack-info-li{
  519. margin-right: 30px;
  520. }
  521. .sendack-info-li label{
  522. color: #606266;
  523. font-size: 15px;
  524. font-weight: 600;
  525. }
  526. .sendack-info-li span{
  527. color: #606266;
  528. font-size: 14px;
  529. }
  530. .sendack-all .el-form-item{
  531. width: 50%;
  532. }
  533. .sendack-all .el-form-item input{
  534. width: 300px;
  535. }
  536. .sendack-all .fyjeinput{
  537. width: 148px;
  538. }
  539. .sendack-all .fyjeinput input{
  540. width: 100%;
  541. }
  542. .sendack-all .fyjeselect{
  543. width: 148px;
  544. }
  545. .sendack-all .fyjeselect input{
  546. width: 100%;
  547. }
  548. </style>