PayReceived.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450
  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 v-if="this.groupInfo.tourCode!=''">{{groupInfo=={}?'暂无':groupInfo.tourCode==""?'暂无':groupInfo.tourCode}}</span>
  24. <!-- <span>{{groupInfo?'暂无':groupInfo.tourCode}}</span> -->
  25. </div>
  26. <div class="received-info-li">
  27. <label>客 户:</label>
  28. <span>{{groupInfo=={}?'暂无':groupInfo.clientName==""?'暂无':groupInfo.clientName}}</span>
  29. </div>
  30. <div class="received-info-li">
  31. <label>出访国家:</label>
  32. <span>{{groupInfo=={}?'暂无':groupInfo.visitCountry==""?'暂无':groupInfo.visitCountry}}</span>
  33. </div>
  34. <div class="received-info-li">
  35. <label>起止日期:</label>
  36. <span>{{groupInfo.visitStartDate|filter_time}}~{{groupInfo.visitEndDate|filter_time}}</span>
  37. </div>
  38. <div class="received-info-li">
  39. <label>天数/人数:</label>
  40. <span>{{groupInfo=={}?'暂无':groupInfo.visitDays+'天/'+groupInfo.visitPNumber+'人'}}</span>
  41. </div>
  42. </div>
  43. <div class="received-checked">
  44. <div class="received-checked-label">已收款项</div>
  45. <el-button size="mini" @click="addUnassignedData()" type="primary">添加一行</el-button>
  46. </div>
  47. <div class="received-form">
  48. <el-table
  49. :border="true"
  50. ref="multipleTable"
  51. :data="UnassignedData"
  52. tooltip-effect="dark"
  53. style="width: 100%"
  54. >
  55. <el-table-column
  56. label="付款时间"
  57. width="155">
  58. <template slot-scope="scope">
  59. <el-date-picker
  60. style="width: 100%;"
  61. v-model="scope.row.sectionTime"
  62. type="date"
  63. placeholder="选择日期">
  64. </el-date-picker>
  65. <!-- <el-input v-model="scope.row.sectionTime"></el-input> -->
  66. </template>
  67. </el-table-column>
  68. <el-table-column
  69. label="付款方信息"
  70. >
  71. <template slot-scope="scope">
  72. <el-input v-model="scope.row.client"></el-input>
  73. </template>
  74. </el-table-column>
  75. <el-table-column
  76. label="付款方电话"
  77. width="150">
  78. <template slot-scope="scope">
  79. <el-input v-model="scope.row.customerTel"></el-input>
  80. </template>
  81. </el-table-column>
  82. <el-table-column
  83. label="已收金额"
  84. width="120">
  85. <template slot-scope="scope">
  86. <el-input-number :controls="false" :precision="2" v-model="scope.row.price"></el-input-number>
  87. </template>
  88. </el-table-column>
  89. <el-table-column
  90. label="到款时间"
  91. width="155">
  92. <template slot-scope="scope">
  93. <el-date-picker
  94. style="width: 100%;"
  95. v-model="scope.row.customerName"
  96. type="date"
  97. placeholder="选择日期">
  98. </el-date-picker>
  99. <!-- <el-input v-model="scope.row.customerName"></el-input> -->
  100. </template>
  101. </el-table-column>
  102. <el-table-column
  103. label="币种"
  104. width="100">
  105. <template slot-scope="scope">
  106. <el-select v-model="scope.row.currency">
  107. <el-option
  108. v-for="item in currencyoptions"
  109. :key="item.id"
  110. :label="item.name"
  111. :value="item.id">
  112. </el-option>
  113. </el-select>
  114. </template>
  115. </el-table-column>
  116. <el-table-column
  117. label="收款类型"
  118. width="140">
  119. <template slot-scope="scope">
  120. <el-select v-model="scope.row.receivablesType">
  121. <el-option
  122. v-for="item in typeoptions"
  123. :key="item.id"
  124. :label="item.name"
  125. :value="item.id">
  126. </el-option>
  127. </el-select>
  128. </template>
  129. </el-table-column>
  130. <el-table-column
  131. label="备注"
  132. width="260">
  133. <template slot-scope="scope">
  134. <el-input v-model="scope.row.remark"></el-input>
  135. </template>
  136. </el-table-column>
  137. <el-table-column
  138. label="操作"
  139. width="80">
  140. <template slot-scope="scope">
  141. <el-button
  142. size="mini"
  143. type="danger"
  144. @click="yshandleDelete(scope.$index, scope.row,UnassignedData)"><i class="el-icon-delete"></i></el-button>
  145. </template>
  146. </el-table-column>
  147. </el-table>
  148. </div>
  149. </div>
  150. </div>
  151. </template>
  152. <script>
  153. export default {
  154. data() {
  155. return {
  156. userid:'',
  157. value:'',
  158. options:[],
  159. currencyoptions:[],
  160. UnassignedData:[
  161. {
  162. sectionTime:'',
  163. client:'',
  164. price:'',
  165. customerName:'',
  166. currency:'',
  167. receivablesType:'',
  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. var url = "/api/Financial/PostAmountReceived_Del"
  261. var that = this
  262. this.$axios({
  263. method: 'post',
  264. url: url,
  265. headers: {
  266. Authorization: 'Bearer ' + this.token
  267. },
  268. data:{
  269. userId:that.userid,
  270. id:row.id
  271. }
  272. }).then(function (res) {
  273. if(res.data.code==200){
  274. that.$message({
  275. message: res.data.msg,
  276. type: 'success'
  277. });
  278. rows.splice(index, 1);
  279. }else{
  280. that.$message.error('删除失败!数据异常');
  281. }
  282. })
  283. })
  284. },
  285. //添加一行
  286. addUnassignedData(){
  287. var newinif={
  288. id: 0,
  289. sectionTime: "",//费用名称
  290. price: 0,//费用
  291. currency:836,//币种
  292. receivablesType:72,//收款类型
  293. client:'',//收款单位
  294. customerName:'',//收款单位 负责人 姓名
  295. customerTel:'',//收款单位 负责人 电话号码
  296. remark:""//备注
  297. }
  298. var url = "/api/Financial/PostAmountReceivedAddOrEdit"
  299. var that = this
  300. this.$axios({
  301. method: 'post',
  302. url: url,
  303. headers: {
  304. Authorization: 'Bearer ' + this.token
  305. },
  306. data:{
  307. portType: 1,
  308. diId: that.value,
  309. userId:that.userid,
  310. _ProceedsReceivedInfos:[newinif]
  311. }
  312. }).then(function (res) {
  313. if(res.data.code==200){
  314. that.$message({
  315. message: res.data.msg,
  316. type: 'success'
  317. });
  318. console.log(res)
  319. that.PostAmountReceived()
  320. }else{
  321. that.$message.error('添加失败!数据异常');
  322. }
  323. })
  324. },
  325. //保存已收款项
  326. ysSaveition(){
  327. console.log(this.UnassignedData)
  328. //提取参数
  329. var arrnew = this.UnassignedData.map((item,index) => {
  330. return Object.assign({},{
  331. 'id':item.id,
  332. 'sectionTime':item.sectionTime,
  333. 'price':item.price,
  334. 'currency':item.currency,
  335. 'receivablesType':item.receivablesType,
  336. 'client':item.client,
  337. 'customerName':item.customerName,
  338. 'customerTel':item.customerTel,
  339. 'remark':item.remark,
  340. })
  341. })
  342. console.log(arrnew)
  343. var Savedecides=true
  344. for(let g=0;g<arrnew.length;g++){
  345. if(arrnew[g].count==""||arrnew[g].currency==""||arrnew[g].itemSumPrice==""||arrnew[g].price==""||arrnew[g].priceName==""||arrnew[g].rate==""||arrnew[g].unit==""){
  346. Savedecides=false
  347. break
  348. }
  349. }
  350. if(Savedecides==true){
  351. var url = "/api/Financial/PostAmountReceivedAddOrEdit"
  352. var that = this
  353. this.$axios({
  354. method: 'post',
  355. url: url,
  356. headers: {
  357. Authorization: 'Bearer ' + this.token
  358. },
  359. data:{
  360. portType: 1,
  361. diId: that.value,
  362. userId:that.userid,
  363. _ProceedsReceivedInfos:arrnew
  364. }
  365. }).then(function (res) {
  366. if(res.data.code==200){
  367. that.$message({
  368. message: res.data.msg,
  369. type: 'success'
  370. });
  371. console.log(res)
  372. that.PostAmountReceived()
  373. }else{
  374. that.$message.error('保存失败!数据异常');
  375. }
  376. })
  377. }else{
  378. this.$message.error('请检查数据是否完整!');
  379. }
  380. },
  381. },
  382. mounted(){
  383. this.userid=JSON.parse(localStorage.getItem('userinif')).userInfo.userId;
  384. this.GetForeignReceivablesDataSources()
  385. },
  386. filters:{
  387. filter_time(value){
  388. if(value){
  389. return value.split(' ')[0];
  390. }
  391. return value
  392. },
  393. filter_city(value){
  394. return value
  395. }
  396. },
  397. }
  398. </script>
  399. <style>
  400. .received-all{
  401. background-color: #fff;
  402. padding: 10px;
  403. box-shadow: 0 0 5px #0005;
  404. border-radius: 10px;
  405. height: 100%;
  406. min-height: 840px;
  407. }
  408. .received-head-li label{
  409. color: #606266;
  410. font-size: 15px;
  411. font-weight: 600;
  412. }
  413. .received-head{
  414. display: flex;
  415. justify-content: space-between;
  416. }
  417. .received-info{
  418. display: flex;
  419. margin-top: 10px;
  420. }
  421. .received-info-li{
  422. margin-right: 30px;
  423. }
  424. .received-info-li label{
  425. color: #606266;
  426. font-size: 15px;
  427. font-weight: 600;
  428. }
  429. .received-info-li span{
  430. color: #606266;
  431. font-size: 14px;
  432. }
  433. .received-all .el-input-number{
  434. width: 100%;
  435. }
  436. .received-checked{
  437. margin-top: 10px;
  438. display: flex;
  439. align-items: center;
  440. justify-content: space-between;
  441. }
  442. .received-checked-label{
  443. font-size: 17px;
  444. }
  445. .received-form{
  446. margin-top: 10px;
  447. }
  448. </style>