DecreasePayments.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. <template>
  2. <div>
  3. <div class="communal-list">
  4. <div>
  5. <div class="communal-title">
  6. <div>其他款项</div>
  7. </div>
  8. <div style="display: flex;">
  9. <div style="width: 90%;">
  10. <el-select style="width:300px" v-model="DiId" placeholder="团组选择" clearable filterable @change="DecreasePaymentsChange">
  11. <el-option v-for="item in delegationInfoList" :key="item.id" :label="item.teamName"
  12. :value="item.id">
  13. </el-option>
  14. </el-select>
  15. </div>
  16. <div style="width: 10%;text-align: right;">
  17. <router-link :to="{ path: '/home/OpDecreasePayments', query: { DiId } }">
  18. <el-button type="primary" style="margin-left: 10px;">新增</el-button>
  19. </router-link>
  20. </div>
  21. </div>
  22. <div class="communal-box-title">
  23. <span>团队名称:</span>
  24. {{ delegationInfo.teamName }}&nbsp;&nbsp;&nbsp;
  25. <span>客户:</span>
  26. {{ delegationInfo.clientName }}&nbsp;&nbsp;&nbsp;
  27. <span>出访国家:</span>
  28. {{ delegationInfo.visitCountry |filter_city}}&nbsp;&nbsp;&nbsp;
  29. <span>起止日期:</span>
  30. {{ delegationInfo.visitStartDate|filter_time }}—{{ delegationInfo.visitEndDate|filter_time }}&nbsp;&nbsp;&nbsp;
  31. <span>天数/人数:</span>
  32. {{ delegationInfo.visitDays }}天/{{ delegationInfo.visitPNumber }}人
  33. </div>
  34. </div>
  35. <template>
  36. <el-table :data="tableDatas.slice((currentPage - 1) * pageSize, currentPage * pageSize)" border
  37. style="width: 100%" v-loading="loading" element-loading-text="拼命加载中...">
  38. <el-table-column prop="num" label="序 号" width="55">
  39. <template slot-scope="scope">
  40. {{ (currentPage - 1) * pageSize + scope.$index + 1 }}
  41. </template>
  42. </el-table-column>
  43. <el-table-column prop="priceName" label="费用名称" width="260">
  44. </el-table-column>
  45. <el-table-column prop="price,currency" label="费用" sortable>
  46. <template slot-scope="scope">
  47. {{ townum(scope.row.price) }}({{ scope.row.currency }})
  48. </template>
  49. </el-table-column>
  50. <el-table-column prop="filePath" label="附件">
  51. </el-table-column>
  52. <el-table-column prop="createUserName" label="操作人" width="100">
  53. </el-table-column>
  54. <el-table-column prop="createTime" label="操作时间">
  55. </el-table-column>
  56. <el-table-column prop="isAudit" label="是否审核" width="90">
  57. <template slot-scope="isAudit">
  58. <span v-if="isAudit.row.isAudit == 1">已通过</span>
  59. <span v-else-if="isAudit.row.isAudit == 0">未审核</span>
  60. <span v-else-if="isAudit.row.isAudit == 2">未通过</span>
  61. <span v-else>自动审核通过</span>
  62. </template>
  63. </el-table-column>
  64. <el-table-column prop="isPay" label="是否支付" width="90">
  65. <template slot-scope="isPay">
  66. <span v-if="isPay.row.isPay == 1">已支付</span>
  67. <span v-else-if="isPay.row.isPay == 0">未支付</span>
  68. </template>
  69. </el-table-column>
  70. <el-table-column label="操作" width="280">
  71. <template slot-scope="scope">
  72. <el-button size="mini" @click="download(scope.$index, scope.row)">下载</el-button>
  73. <el-button size="mini" @click="upDate(scope.$index, scope.row)">编辑</el-button>
  74. <el-button size="mini" type="danger" @click="del(scope.$index, scope.row)">删除</el-button>
  75. </template>
  76. </el-table-column>
  77. </el-table>
  78. </template>
  79. <div class="block">
  80. <el-pagination align='center' @size-change="handleSizeChange" @current-change="handleCurrentChange"
  81. :current-page="currentPage" :page-sizes="[10, 12, 15, 20]" :page-size="pageSize"
  82. layout="total, sizes, prev, pager, next" :total="tableDatas.length">
  83. </el-pagination>
  84. </div>
  85. </div>
  86. </div>
  87. </template>
  88. <script>
  89. export default {
  90. data() {
  91. return {
  92. loading: false,
  93. tableDatas: [],
  94. tableData: [],
  95. currentPage: 1, // 当前页码
  96. pageSize: 12,// 每页的数据条数
  97. input: '',
  98. token: '',
  99. userId: 0,
  100. DiId: '',
  101. delegationInfoList: [],
  102. delegationInfo: {}
  103. }
  104. },
  105. methods: {
  106. //保留两位小数
  107. townum(val){
  108. return val.toFixed(2)
  109. },
  110. //每页条数改变时触发 选择一页显示多少行
  111. handleSizeChange(val) {
  112. this.currentPage = 1;
  113. this.pageSize = val;
  114. },
  115. //当前页改变时触发 跳转其他页
  116. handleCurrentChange(val) {
  117. this.currentPage = val;
  118. },
  119. //团组下拉框
  120. DecreasePaymentsSelect() {
  121. var url = "/api/Groups/DecreasePaymentsSelect"
  122. var that = this
  123. this.$axios({
  124. method: 'post',
  125. url: url,
  126. headers: {
  127. Authorization: 'Bearer ' + this.token
  128. },
  129. data: {
  130. UserId: that.userId,
  131. CTId: 98
  132. }
  133. }).then(function (res) {
  134. if (res.data.code == 200) {
  135. console.log(that.DiId)
  136. that.delegationInfoList = res.data.data.groupName;
  137. if(that.DiId!=that.DiId){
  138. that.DiId = that.delegationInfoList[0].id;
  139. that.delegationInfo = that.delegationInfoList[0];
  140. }
  141. that.DecreasePaymentsList();
  142. that.DecreasePaymentsChange();
  143. }else{
  144. console.log("400")
  145. }
  146. }).catch(function (error) {
  147. that.$message.error(error);
  148. });
  149. },
  150. DecreasePaymentsChange() {
  151. for (let index = 0; index < this.delegationInfoList.length; index++) {
  152. if (this.delegationInfoList[index].id == this.DiId) {
  153. this.delegationInfo = this.delegationInfoList[index];
  154. break;
  155. }
  156. }
  157. this.DecreasePaymentsList();
  158. },
  159. //团组信息绑定
  160. DecreasePaymentsList() {
  161. var url = "/api/Groups/DecreasePaymentsList"
  162. var that = this
  163. this.$axios({
  164. method: 'post',
  165. url: url,
  166. headers: {
  167. Authorization: 'Bearer ' + this.token
  168. },
  169. data: {
  170. userId:that.userId,
  171. diId: that.DiId
  172. }
  173. }).then(function (res) {
  174. if (res.data.code == 200) {
  175. that.tableDatas = res.data.data;
  176. that.tableData = that.tableDatas
  177. if (that.tableDatas.length != 0) {
  178. if (that.tableDatas.slice((that.currentPage - 1) * that.pageSize, that.currentPage * that.pageSize).length == 0) {
  179. if (that.currentPage > 1) {
  180. that.currentPage = that.currentPage - 1;
  181. }
  182. }
  183. }
  184. }
  185. }).catch(function (error) {
  186. //that.$message.error("网络错误,请稍后重试");
  187. });
  188. },
  189. upDate(index, row) {
  190. this.$router.push({
  191. path: "/home/OpDecreasePayments",
  192. query: {
  193. DiId: this.DiId,
  194. id: row.id
  195. }
  196. })
  197. },
  198. del(index, row) {
  199. this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
  200. confirmButtonText: '确定',
  201. cancelButtonText: '取消',
  202. type: 'warning'
  203. }).then(() => {
  204. var url = "/api/Groups/DelDecreasePayments"
  205. var that = this
  206. this.$axios({
  207. method: 'post',
  208. url: url,
  209. headers: {
  210. Authorization: 'Bearer ' + this.token
  211. },
  212. data: {
  213. Id: row.id,
  214. DeleteUserId: this.userId
  215. }
  216. }).then(function (res) {
  217. console.log(res)
  218. if (res.data.code == 200) {
  219. that.$message({
  220. message: '删除成功',
  221. type: 'success'
  222. });
  223. that.DecreasePaymentsSelect();
  224. } else {
  225. that.$message.error('删除失败!');
  226. }
  227. that.loading = false
  228. }).catch(function (error) {
  229. that.loading = false
  230. that.$message.error("网络错误,请稍后重试");
  231. });
  232. }).catch(() => {
  233. this.$message({
  234. type: 'info',
  235. message: '操作已取消!'
  236. });
  237. });
  238. },
  239. download(index, row) {
  240. if (row.filePath != "") {
  241. window.location.href = "http://132.232.92.186:24/Office/GrpFile/团组增减款项相关文件/" + row.filePath
  242. } else {
  243. this.$message.error("暂未上传附件");
  244. }
  245. }
  246. },
  247. filters:{
  248. filter_city(value){
  249. if(value){
  250. return value.replaceAll('|','、')
  251. }
  252. },
  253. filter_time(value){
  254. if(value){
  255. return value.split(" ")[0]
  256. }
  257. }
  258. },
  259. mounted() {
  260. this.DiId = Number(this.$route.query.DiId);
  261. this.token = JSON.parse(localStorage.getItem('userinif')).token;
  262. this.userId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
  263. this.DecreasePaymentsSelect();
  264. //this.AirTicketResList()
  265. }
  266. }
  267. </script>
  268. <style>
  269. .communal-list {
  270. background-color: #fff;
  271. padding: 10px;
  272. box-shadow: 0 0 5px #0005;
  273. border-radius: 10px;
  274. min-height: 830px;
  275. }
  276. .communal-title {
  277. display: flex;
  278. font-size: 17px;
  279. font-weight: 600;
  280. color: #555;
  281. margin-top: 8px;
  282. margin-bottom: 10px;
  283. justify-content: space-between;
  284. align-items: center;
  285. }
  286. .communal-box {
  287. display: flex;
  288. }
  289. .communal-box>button {
  290. margin-left: 10px;
  291. padding: 8px 20px;
  292. }
  293. .communal-box-title{
  294. font-size: 15px;
  295. margin: 10px 0;
  296. }
  297. .communal-box-title span{
  298. font-size: 16px;
  299. font-weight: 600;
  300. color: #555;
  301. }
  302. </style>