LncomingBills.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  1. <template>
  2. <div>
  3. <div class="lncomingbill-all">
  4. <div class="lncomingbill-head">
  5. <div class="lncomingbill-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="lncomingbill-head-li">
  17. <el-button @click="Saveition()" type="primary">保存数据</el-button>
  18. <el-button type="primary">生成收款单(四川)</el-button>
  19. <el-button type="primary">生成收款单(北京)</el-button>
  20. <el-button type="primary">汇款账单</el-button>
  21. </div>
  22. </div>
  23. <div class="lncomingbill-info">
  24. <div class="lncomingbill-info-li">
  25. <label>团 号:</label>
  26. <span>{{groupInfo.tourCode}}</span>
  27. </div>
  28. <div class="lncomingbill-info-li">
  29. <label>客 户:</label>
  30. <span>{{groupInfo.clientName}}</span>
  31. </div>
  32. <div class="lncomingbill-info-li">
  33. <label>出访国家:</label>
  34. <span>{{groupInfo.visitCountry|filter_city}}</span>
  35. </div>
  36. <div class="lncomingbill-info-li">
  37. <label>起止日期:</label>
  38. <span>{{groupInfo.tontractTime|filter_time}}~{{groupInfo.visitDate|filter_time}}</span>
  39. </div>
  40. <div class="lncomingbill-info-li">
  41. <label>天数/人数:</label>
  42. <span>{{groupInfo.visitDays}}天/{{groupInfo.visitPNumber}}人</span>
  43. </div>
  44. </div>
  45. <div class="lncomingbill-checked">
  46. <div class="checked-label">收款账单</div>
  47. <el-button @click="addition" type="primary">添加一行</el-button>
  48. </div>
  49. <div class="lncomingbill-form">
  50. <el-table
  51. :border="true"
  52. ref="multipleTable"
  53. :data="tableData"
  54. style="width: 100%;"
  55. >
  56. <el-table-column
  57. prop="addingModeName"
  58. label="增加方式"
  59. width="100">
  60. </el-table-column>
  61. <el-table-column
  62. prop="createTime"
  63. label="时间"
  64. width="100">
  65. </el-table-column>
  66. <el-table-column
  67. label="费用名称"
  68. width="240">
  69. <template slot-scope="scope">
  70. <el-input v-model="scope.row.priceName"></el-input>
  71. </template>
  72. </el-table-column>
  73. <el-table-column
  74. label="单 价"
  75. width="140">
  76. <template slot-scope="scope">
  77. <el-input-number :controls="false" :precision="2" class="editNum" v-model="scope.row.price"></el-input-number>
  78. </template>
  79. </el-table-column>
  80. <el-table-column
  81. label="数 量"
  82. width="80">
  83. <template slot-scope="scope">
  84. <el-input v-model="scope.row.count"></el-input>
  85. </template>
  86. </el-table-column>
  87. <el-table-column
  88. label="单 位"
  89. width="90">
  90. <template slot-scope="scope">
  91. <el-input v-model="scope.row.unit"></el-input>
  92. </template>
  93. </el-table-column>
  94. <el-table-column
  95. label="币 种"
  96. width="100">
  97. <template slot-scope="scope">
  98. <el-select filterable v-model="scope.row.currency">
  99. <el-option
  100. v-for="item in currencyoptions"
  101. :key="item.id"
  102. :label="item.name"
  103. :value="item.id">
  104. </el-option>
  105. </el-select>
  106. </template>
  107. </el-table-column>
  108. <el-table-column
  109. label="汇 率"
  110. width="100">
  111. <template slot-scope="scope">
  112. <el-input-number :controls="false" :precision="2" v-model="scope.row.rate"></el-input-number>
  113. </template>
  114. </el-table-column>
  115. <el-table-column
  116. label="应收金额"
  117. width="120">
  118. <template slot-scope="scope">
  119. <div class="sub-box">{{scope.row.itemSumPrice=(scope.row.price*scope.row.count*scope.row.rate).toFixed(2)}}</div>
  120. </template>
  121. </el-table-column>
  122. <el-table-column
  123. prop="remark"
  124. label="备注">
  125. <template slot-scope="scope">
  126. <el-input v-model="scope.row.remark" placeholder="请输入内容"></el-input>
  127. </template>
  128. </el-table-column>
  129. <el-table-column
  130. prop="name"
  131. label="操 作"
  132. width="100">
  133. <template slot-scope="scope">
  134. <el-button
  135. size="mini"
  136. type="danger"
  137. @click="handleDelete(scope.$index, scope.row,tableData)"><i class="el-icon-delete"></i></el-button>
  138. </template>
  139. </el-table-column>
  140. </el-table>
  141. </div>
  142. </div>
  143. </div>
  144. </template>
  145. <script>
  146. export default {
  147. data() {
  148. return {
  149. userid:'',
  150. value:"",
  151. options:[],
  152. tableData:[
  153. {
  154. addingModeName:"",
  155. createTime:"",
  156. priceName:"",
  157. price:"",
  158. count:"",
  159. unit:"",
  160. currency:"",
  161. rate:"",
  162. itemSumPrice:"",
  163. remark:"",
  164. }
  165. ],
  166. currencyoptions:[],
  167. groupInfo:{},
  168. }
  169. },
  170. methods:{
  171. //获取团组
  172. GetForeignReceivablesDataSources(){
  173. var url = "/api/Financial/GetForeignReceivablesDataSources"
  174. var that = this
  175. this.$axios({
  176. method: 'post',
  177. url: url,
  178. headers: {
  179. Authorization: 'Bearer ' + that.userid
  180. },
  181. }).then(function (res) {
  182. console.log(res)
  183. that.options=res.data.data.groupNameData;
  184. that.currencyoptions=res.data.data.currencyData;
  185. that.typeoptions=res.data.data.remittanceMethodData;
  186. that.value=res.data.data.groupNameData[0].id;
  187. that.PostGroupReceivablesInfoByDiId();
  188. })
  189. },
  190. //获取收款账单详情
  191. PostGroupReceivablesInfoByDiId(){
  192. var url = "/api/Financial/PostGroupReceivablesInfoByDiId"
  193. var that = this
  194. this.$axios({
  195. method: 'post',
  196. url: url,
  197. headers: {
  198. Authorization: 'Bearer ' + that.userid
  199. },
  200. data:{
  201. portType: 1,
  202. diId: that.value
  203. }
  204. }).then(function (res) {
  205. console.log(res)
  206. that.tableData=res.data.data.groupCollectionStatementData
  207. that.groupInfo=res.data.data.groupInfo
  208. })
  209. },
  210. //切换团组
  211. changediid(){
  212. this.PostGroupReceivablesInfoByDiId()
  213. },
  214. //添加一行
  215. addition(){
  216. var newinif={
  217. id: 0,
  218. priceName: "",//费用名称
  219. price: 0,//费用
  220. count: 0,//数量
  221. unit:'',//单位
  222. itemSumPrice:0,// 单项总和
  223. rate:1,// 汇率
  224. currency:836,//币种
  225. addingWay:0,//添加方式
  226. remark:""//备注
  227. }
  228. var url = "/api/Financial/PostReceivablesSave"
  229. var that = this
  230. this.$axios({
  231. method: 'post',
  232. url: url,
  233. headers: {
  234. Authorization: 'Bearer ' + this.token
  235. },
  236. data:{
  237. portType: 1,
  238. diId: that.value,
  239. userId:that.userid,
  240. foreignReceivablesInfos:[newinif]
  241. }
  242. }).then(function (res) {
  243. if(res.data.code==200){
  244. that.$message({
  245. message: res.data.msg,
  246. type: 'success'
  247. });
  248. console.log(res)
  249. that.PostGroupReceivablesInfoByDiId()
  250. }else{
  251. that.$message.error('添加失败!数据异常');
  252. }
  253. })
  254. },
  255. //对外收款账单删除
  256. handleDelete(index, row,rows) {
  257. this.$confirm('此操作将删除此条数据,是否确认删除?', '提示', {
  258. confirmButtonText: '确定',
  259. cancelButtonText: '取消',
  260. type: 'warning'
  261. }).then(() => {
  262. var url = "/api/Financial/PostGroupReceivablesDel"
  263. var that = this
  264. this.$axios({
  265. method: 'post',
  266. url: url,
  267. headers: {
  268. Authorization: 'Bearer ' + this.token
  269. },
  270. data:{
  271. userId:that.userid,
  272. id:row.id
  273. }
  274. }).then(function (res) {
  275. if(res.data.code==200){
  276. that.$message({
  277. message: res.data.msg,
  278. type: 'success'
  279. });
  280. rows.splice(index, 1);
  281. }else{
  282. that.$message.error('删除失败!数据异常');
  283. }
  284. })
  285. })
  286. },
  287. //保存收款单
  288. Saveition(){
  289. console.log(this.tableData)
  290. //提取参数
  291. var arrnew = this.tableData.map((item,index) => {
  292. return Object.assign({},{
  293. 'id':item.id,
  294. 'priceName':item.priceName,
  295. 'price':item.price,
  296. 'count':item.count,
  297. 'unit':item.unit,
  298. 'itemSumPrice':item.itemSumPrice,
  299. 'rate':item.rate,
  300. 'currency':item.currency,
  301. 'addingWay':item.addingWay,
  302. 'remark':item.remark,
  303. })
  304. })
  305. console.log(arrnew)
  306. var Savedecides=true
  307. for(let g=0;g<arrnew.length;g++){
  308. if(arrnew[g].count==""||arrnew[g].currency==""||arrnew[g].itemSumPrice==""||arrnew[g].price==""||arrnew[g].priceName==""||arrnew[g].rate==""||arrnew[g].unit==""){
  309. Savedecides=false
  310. break
  311. }
  312. }
  313. if(Savedecides==true){
  314. var url = "/api/Financial/PostReceivablesOperate"
  315. var that = this
  316. this.$axios({
  317. method: 'post',
  318. url: url,
  319. headers: {
  320. Authorization: 'Bearer ' + this.token
  321. },
  322. data:{
  323. portType: 1,
  324. diId: that.value,
  325. userId:that.userid,
  326. foreignReceivablesInfos:arrnew
  327. }
  328. }).then(function (res) {
  329. if(res.data.code==200){
  330. that.$message({
  331. message: res.data.msg,
  332. type: 'success'
  333. });
  334. console.log(res)
  335. that.PostGroupReceivablesInfoByDiId()
  336. }else{
  337. that.$message.error('保存失败!数据异常');
  338. }
  339. })
  340. }else{
  341. this.$message.error('请检查数据是否完整!');
  342. }
  343. },
  344. },
  345. mounted(){
  346. this.userid=JSON.parse(localStorage.getItem('userinif')).userInfo.userId;
  347. this.GetForeignReceivablesDataSources();
  348. },
  349. filters:{
  350. filter_time(value){
  351. return value;
  352. },
  353. filter_city(value){
  354. return value
  355. }
  356. },
  357. }
  358. </script>
  359. <style>
  360. .lncomingbill-all{
  361. background-color: #fff;
  362. padding: 10px;
  363. box-shadow: 0 0 5px #0005;
  364. border-radius: 10px;
  365. height: 100%;
  366. min-height: 840px;
  367. }
  368. .lncomingbill-head-li label{
  369. color: #606266;
  370. font-size: 15px;
  371. font-weight: 600;
  372. }
  373. .lncomingbill-head{
  374. display: flex;
  375. justify-content: space-between;
  376. }
  377. .lncomingbill-info{
  378. display: flex;
  379. margin-top: 10px;
  380. }
  381. .lncomingbill-info-li{
  382. margin-right: 30px;
  383. }
  384. .lncomingbill-info-li label{
  385. color: #606266;
  386. font-size: 15px;
  387. font-weight: 600;
  388. }
  389. .lncomingbill-info-li span{
  390. color: #606266;
  391. font-size: 14px;
  392. }
  393. .lncomingbill-all .el-input-number{
  394. width: 100%;
  395. }
  396. .lncomingbill-checked{
  397. margin-top: 10px;
  398. display: flex;
  399. align-items: center;
  400. justify-content: space-between;
  401. }
  402. .lncomingbill-form{
  403. margin-top: 10px;
  404. }
  405. </style>