AirTicketRes.vue 13 KB

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