PayReceived.vue 17 KB

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