PayReceived.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473
  1. <template>
  2. <div>
  3. <div class="received-all">
  4. <div class="received-head">
  5. <div class="received-head-li">
  6. <label>团组名称:</label>
  7. <el-select style="width: 250px;" @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="received-head-li">
  17. <el-button @click="ysSaveition()" type="primary">保存数据</el-button>
  18. </div>
  19. </div>
  20. <div class="received-info">
  21. <div class="received-info-li">
  22. <label>团 号:</label>
  23. <span>{{groupInfo.tourCode}}</span>
  24. </div>
  25. <div class="received-info-li">
  26. <label>客 户:</label>
  27. <span>{{groupInfo.clientName}}</span>
  28. </div>
  29. <div class="received-info-li">
  30. <label>出访国家:</label>
  31. <span>{{groupInfo.visitCountry}}</span>
  32. </div>
  33. <div class="received-info-li">
  34. <label>起止日期:</label>
  35. <span>{{groupInfo.visitStartDate|filter_time}}~{{groupInfo.visitEndDate|filter_time}}</span>
  36. </div>
  37. <div class="received-info-li">
  38. <label>天数/人数:</label>
  39. <span>{{groupInfo.visitDays+'天/'+groupInfo.visitPNumber+'人'}}</span>
  40. </div>
  41. </div>
  42. <div class="received-checked">
  43. <div class="received-checked-label">已收款项</div>
  44. <el-button size="mini" @click="addUnassignedData()" type="primary">添加一行</el-button>
  45. </div>
  46. <div class="received-form">
  47. <el-table
  48. :border="true"
  49. ref="multipleTable"
  50. :data="UnassignedData"
  51. tooltip-effect="dark"
  52. style="width: 100%"
  53. >
  54. <!-- <el-table-column
  55. label="付款时间"
  56. width="165">
  57. <template slot-scope="scope">
  58. <el-date-picker
  59. style="width: 100%;"
  60. v-model="scope.row.sectionTime"
  61. type="date"
  62. placeholder="选择日期">
  63. </el-date-picker>
  64. </template>
  65. </el-table-column> -->
  66. <el-table-column
  67. label="付款方信息"
  68. >
  69. <template slot-scope="scope">
  70. <el-input v-model="scope.row.client"></el-input>
  71. </template>
  72. </el-table-column>
  73. <el-table-column
  74. label="付款方电话"
  75. width="150">
  76. <template slot-scope="scope">
  77. <el-input v-model="scope.row.customerTel"></el-input>
  78. </template>
  79. </el-table-column>
  80. <el-table-column
  81. label="已收金额"
  82. width="150">
  83. <template slot-scope="scope">
  84. <el-input-number :controls="false" :precision="2" v-model="scope.row.price"></el-input-number>
  85. </template>
  86. </el-table-column>
  87. <el-table-column
  88. label="到款时间"
  89. width="165">
  90. <template slot-scope="scope">
  91. <el-date-picker
  92. value-format="yyyy-MM-dd"
  93. style="width: 100%;"
  94. v-model="scope.row.sectionTime"
  95. type="date"
  96. placeholder="选择日期">
  97. </el-date-picker>
  98. <!-- <el-input v-model="scope.row.customerName"></el-input> -->
  99. </template>
  100. </el-table-column>
  101. <el-table-column
  102. label="币种"
  103. width="100">
  104. <template slot-scope="scope">
  105. <el-select v-model="scope.row.currency">
  106. <el-option
  107. v-for="item in currencyoptions"
  108. :key="item.id"
  109. :label="item.name"
  110. :value="item.id">
  111. </el-option>
  112. </el-select>
  113. </template>
  114. </el-table-column>
  115. <el-table-column
  116. label="收款类型"
  117. width="140">
  118. <template slot-scope="scope">
  119. <el-select v-model="scope.row.receivablesType">
  120. <el-option
  121. v-for="item in typeoptions"
  122. :key="item.id"
  123. :label="item.name"
  124. :value="item.id">
  125. </el-option>
  126. </el-select>
  127. </template>
  128. </el-table-column>
  129. <el-table-column
  130. label="备注"
  131. width="260">
  132. <template slot-scope="scope">
  133. <el-input v-model="scope.row.remark"></el-input>
  134. </template>
  135. </el-table-column>
  136. <el-table-column
  137. label="操作"
  138. width="80">
  139. <template slot-scope="scope">
  140. <el-button
  141. size="mini"
  142. type="danger"
  143. @click="yshandleDelete(scope.$index, scope.row,UnassignedData)"><i class="el-icon-delete"></i></el-button>
  144. </template>
  145. </el-table-column>
  146. </el-table>
  147. </div>
  148. </div>
  149. </div>
  150. </template>
  151. <script>
  152. export default {
  153. data() {
  154. return {
  155. userid:'',
  156. value:'',
  157. options:[],
  158. currencyoptions:[],
  159. UnassignedData:[
  160. // {
  161. // id: 0,
  162. // sectionTime: "",//费用名称
  163. // price: 0,//费用
  164. // currency:836,//币种
  165. // receivablesType:72,//收款类型
  166. // client:'',//收款单位
  167. // customerName:'',//收款单位 负责人 姓名
  168. // customerTel:'',//收款单位 负责人 电话号码
  169. // remark:""//备注
  170. // }
  171. ],
  172. typeoptions:[],
  173. groupInfo:{
  174. // clientName:'',
  175. // id:'',
  176. // tourCode:'',
  177. // visitCountry:'',
  178. // visitDays:'',
  179. // visitEndDate:'',
  180. // visitPNumber:'',
  181. // visitStartDate:'',
  182. },
  183. }
  184. },
  185. methods:{
  186. //获取团组
  187. GetForeignReceivablesDataSources(){
  188. var url = "/api/Financial/GetForeignReceivablesDataSources"
  189. var that = this
  190. this.$axios({
  191. method: 'post',
  192. url: url,
  193. headers: {
  194. Authorization: 'Bearer ' + that.userid
  195. },
  196. data:{
  197. currUserId:that.userid
  198. }
  199. }).then(function (res) {
  200. console.log(res)
  201. if(res.data.code==200){
  202. that.options=res.data.data.groupNameData;
  203. that.currencyoptions=res.data.data.currencyData;
  204. that.typeoptions=res.data.data.remittanceMethodData;
  205. that.value=res.data.data.groupNameData[0].id;
  206. that.PostAmountReceived();
  207. }
  208. })
  209. },
  210. //获取账单详情
  211. PostAmountReceived(){
  212. var url = "/api/Financial/PostAmountReceived"
  213. var that = this
  214. this.$axios({
  215. method: 'post',
  216. url: url,
  217. headers: {
  218. Authorization: 'Bearer ' + that.userid
  219. },
  220. data:{
  221. portType: 1,
  222. diId: that.value
  223. }
  224. }).then(function (res) {
  225. console.log(res)
  226. that.UnassignedData=res.data.data
  227. that.groupInfo=res.data.data.groupInfo
  228. that.PostShareGroupInfo();
  229. })
  230. },
  231. //获取团组详情
  232. PostShareGroupInfo(){
  233. console.log(this.value)
  234. var url = "/api/Business/PostShareGroupInfo"
  235. var that = this
  236. this.$axios({
  237. method: 'post',
  238. url: url,
  239. headers: {
  240. Authorization: 'Bearer ' + that.userid
  241. },
  242. data:{
  243. portType: 1,
  244. id: that.value
  245. }
  246. }).then(function (res) {
  247. console.log(res)
  248. // that.UnassignedData=res.data.data
  249. that.groupInfo=res.data.data
  250. console.log(that.groupInfo)
  251. })
  252. },
  253. //切换团组
  254. changediid(){
  255. this.PostAmountReceived()
  256. },
  257. //已收款项删除
  258. yshandleDelete(index, row,rows) {
  259. this.$confirm('此操作将删除此条数据,是否确认删除?', '提示', {
  260. confirmButtonText: '确定',
  261. cancelButtonText: '取消',
  262. type: 'warning'
  263. }).then(() => {
  264. if(row.id==0){
  265. this.$message({
  266. message: '删除成功',
  267. type: 'success'
  268. });
  269. rows.splice(index, 1);
  270. return
  271. }
  272. var url = "/api/Financial/PostAmountReceived_Del"
  273. var that = this
  274. this.$axios({
  275. method: 'post',
  276. url: url,
  277. headers: {
  278. Authorization: 'Bearer ' + this.token
  279. },
  280. data:{
  281. userId:that.userid,
  282. id:row.id
  283. }
  284. }).then(function (res) {
  285. if(res.data.code==200){
  286. that.$message({
  287. message: res.data.msg,
  288. type: 'success'
  289. });
  290. rows.splice(index, 1);
  291. }else{
  292. that.$message.error(res.data.msg);
  293. }
  294. })
  295. })
  296. },
  297. //添加一行
  298. addUnassignedData(){
  299. var newinif={
  300. id: 0,
  301. sectionTime: "",//费用名称
  302. price: 0,//费用
  303. currency:836,//币种
  304. receivablesType:72,//收款类型
  305. client:'',//收款单位
  306. customerName:'',//收款单位 负责人 姓名
  307. customerTel:'',//收款单位 负责人 电话号码
  308. remark:""//备注
  309. }
  310. this.UnassignedData.push(newinif)
  311. // var url = "/api/Financial/PostAmountReceivedAddOrEdit"
  312. // var that = this
  313. // this.$axios({
  314. // method: 'post',
  315. // url: url,
  316. // headers: {
  317. // Authorization: 'Bearer ' + this.token
  318. // },
  319. // data:{
  320. // portType: 1,
  321. // diId: that.value,
  322. // userId:that.userid,
  323. // _ProceedsReceivedInfos:[newinif]
  324. // }
  325. // }).then(function (res) {
  326. // if(res.data.code==200){
  327. // that.$message({
  328. // message: res.data.msg,
  329. // type: 'success'
  330. // });
  331. // console.log(res)
  332. // that.PostAmountReceived()
  333. // }else{
  334. // that.$message.error('添加失败!数据异常');
  335. // }
  336. // })
  337. },
  338. //处理日期
  339. datetime(val){
  340. var date=new Date(val);
  341. var y=date.getFullYear();
  342. var m=date.getMonth()+1>=10?date.getMonth()+1:'0'+(date.getMonth()+1).toString();
  343. var d=date.getDate()>=10?date.getDate():'0'+(date.getDate()).toString();
  344. return y+'-'+m+'-'+d
  345. },
  346. //保存已收款项
  347. ysSaveition(){
  348. console.log(this.UnassignedData)
  349. //提取参数
  350. var arrnew = this.UnassignedData.map((item,index) => {
  351. return Object.assign({},{
  352. 'id':item.id,
  353. 'sectionTime':this.datetime(item.sectionTime),
  354. 'price':item.price,
  355. 'currency':item.currency,
  356. 'receivablesType':item.receivablesType,
  357. 'client':item.client,
  358. 'customerName':item.customerName,
  359. 'customerTel':item.customerTel,
  360. 'remark':item.remark,
  361. })
  362. })
  363. console.log(arrnew)
  364. var Savedecides=true
  365. for(let g=0;g<arrnew.length;g++){
  366. if(arrnew[g].count==""||arrnew[g].currency==""||arrnew[g].itemSumPrice==""||arrnew[g].price==""||arrnew[g].priceName==""||arrnew[g].rate==""||arrnew[g].unit==""){
  367. Savedecides=false
  368. break
  369. }
  370. }
  371. if(Savedecides==true){
  372. var url = "/api/Financial/PostAmountReceivedAddOrEdit"
  373. var that = this
  374. this.$axios({
  375. method: 'post',
  376. url: url,
  377. headers: {
  378. Authorization: 'Bearer ' + this.token
  379. },
  380. data:{
  381. portType: 1,
  382. diId: that.value,
  383. userId:that.userid,
  384. _ProceedsReceivedInfos:arrnew
  385. }
  386. }).then(function (res) {
  387. if(res.data.code==200){
  388. that.$message({
  389. message: res.data.msg,
  390. type: 'success'
  391. });
  392. console.log(res)
  393. that.PostAmountReceived()
  394. }else{
  395. that.$message.error('保存失败!数据异常');
  396. }
  397. })
  398. }else{
  399. this.$message.error('请检查数据是否完整!');
  400. }
  401. },
  402. },
  403. mounted(){
  404. this.userid=JSON.parse(localStorage.getItem('userinif')).userInfo.userId;
  405. this.GetForeignReceivablesDataSources()
  406. },
  407. filters:{
  408. filter_time(value){
  409. if(value){
  410. return value.split(' ')[0];
  411. }
  412. return value
  413. },
  414. filter_city(value){
  415. return value
  416. }
  417. },
  418. }
  419. </script>
  420. <style>
  421. .received-all{
  422. background-color: #fff;
  423. padding: 10px;
  424. box-shadow: 0 0 5px #0005;
  425. border-radius: 10px;
  426. height: 100%;
  427. min-height: 840px;
  428. }
  429. .received-head-li label{
  430. color: #606266;
  431. font-size: 15px;
  432. font-weight: 600;
  433. }
  434. .received-head{
  435. display: flex;
  436. justify-content: space-between;
  437. }
  438. .received-info{
  439. display: flex;
  440. margin-top: 10px;
  441. }
  442. .received-info-li{
  443. margin-right: 30px;
  444. }
  445. .received-info-li label{
  446. color: #606266;
  447. font-size: 15px;
  448. font-weight: 600;
  449. }
  450. .received-info-li span{
  451. color: #606266;
  452. font-size: 14px;
  453. }
  454. .received-all .el-input-number{
  455. width: 100%;
  456. }
  457. .received-checked{
  458. margin-top: 10px;
  459. display: flex;
  460. align-items: center;
  461. justify-content: space-between;
  462. }
  463. .received-checked-label{
  464. font-size: 17px;
  465. }
  466. .received-form{
  467. margin-top: 10px;
  468. }
  469. </style>