TicketBlackCode.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  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;justify-content: space-between;">
  9. <div style="width: 60%;">
  10. <el-select v-model="DiId" placeholder="团组选择" clearable filterable
  11. @change="AirTicketResSelectChange">
  12. <el-option v-for="item in DelegationSelect" :key="item.id" :label="item.groupName"
  13. :value="item.id">
  14. </el-option>
  15. </el-select>
  16. </div>
  17. <div style="width: 20%;">
  18. <el-button type="primary" style="margin-left: 10px;" @click="addIf">新增</el-button>
  19. </div>
  20. </div>
  21. <div style="margin:10px 0;color:#606266;">
  22. <span style="font-weight: bold;font-size:17px;">团队名称:</span>
  23. <span style="color:#606266;">{{ DelegationInfo.teamName }}&nbsp;&nbsp;&nbsp;</span>
  24. <span style="font-weight: bold;font-size:17px;">客户:</span>
  25. <span style="color:#606266;">{{ DelegationInfo.clientName }}&nbsp;&nbsp;&nbsp;</span>
  26. <span style="font-weight: bold;font-size:17px;">出访国家:</span>
  27. <span style="color:#606266;">{{ DelegationInfo.visitCountry }}&nbsp;&nbsp;&nbsp;</span>
  28. <span style="font-weight: bold;font-size:17px;">起止日期:</span>
  29. <span style="color:#606266;">{{ DelegationInfo.visitStartDate }}—{{ DelegationInfo.visitEndDate
  30. }}&nbsp;&nbsp;&nbsp;</span>
  31. <span style="font-weight: bold;font-size:17px;">天数/人数:</span>
  32. <span style="color:#606266;">{{ DelegationInfo.visitDays }}天/{{ DelegationInfo.visitPNumber }}人</span>
  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="blackCode" label="黑屏代码">
  44. </el-table-column>
  45. <el-table-column prop="price" label="全价费用">
  46. </el-table-column>
  47. <el-table-column prop="nowPrice" label="现价费用">
  48. </el-table-column>
  49. <el-table-column prop="createName" label="录入人">
  50. </el-table-column>
  51. <el-table-column label="操作">
  52. <template slot-scope="scope">
  53. <el-button size="mini" @click="upDate(scope.$index, scope.row)">编辑</el-button>
  54. <el-button size="mini" type="danger" @click="del(scope.$index, scope.row)">删除</el-button>
  55. </template>
  56. </el-table-column>
  57. </el-table>
  58. </template>
  59. <div class="block">
  60. <el-pagination align='center' @size-change="handleSizeChange" @current-change="handleCurrentChange"
  61. :current-page="currentPage" :page-sizes="[10, 12, 15, 20]" :page-size="pageSize"
  62. layout="total, sizes, prev, pager, next" :total="tableDatas.length">
  63. </el-pagination>
  64. </div>
  65. </div>
  66. </div>
  67. </template>
  68. <script>
  69. export default {
  70. beforeRouteLeave(to, from, next) {
  71. if(to.name!='OpTicketBlackCode'){
  72. from.meta.keepAlive = false;
  73. }
  74. next()
  75. },
  76. data() {
  77. return {
  78. loading: false,
  79. tableDatas: [],
  80. tableData: [],
  81. currentPage: 1, // 当前页码
  82. pageSize: 12,// 每页的数据条数
  83. token: '',
  84. userId: 0,
  85. DiId: '',
  86. DelegationSelect: [],
  87. DelegationInfo: {}
  88. }
  89. },
  90. methods: {
  91. //每页条数改变时触发 选择一页显示多少行
  92. handleSizeChange(val) {
  93. this.currentPage = 1;
  94. this.pageSize = val;
  95. },
  96. //当前页改变时触发 跳转其他页
  97. handleCurrentChange(val) {
  98. this.currentPage = val;
  99. },
  100. //下拉框数据绑定
  101. DelegationSelectFun() {
  102. var url = "/api/Business/GetGroupNameList"
  103. var that = this
  104. this.$axios({
  105. method: 'post',
  106. url: url,
  107. headers: {
  108. Authorization: 'Bearer ' + this.token
  109. },
  110. data: {
  111. "portType": 1,
  112. "pageIndex": 0,
  113. "pageSize": 0
  114. }
  115. }).then(function (res) {
  116. if (res.data.code == 200) {
  117. that.DelegationSelect = res.data.data;
  118. that.DiId = that.DelegationSelect[0].id
  119. that.QueryTicketBlackCodeByDiId();
  120. }
  121. }).catch(function (error) {
  122. that.$message.error("网络错误,请稍后重试");
  123. });
  124. },
  125. //团组下拉框值改变事件
  126. AirTicketResSelectChange() {
  127. this.QueryTicketBlackCodeByDiId();
  128. },
  129. QueryTicketBlackCodeByDiId() {
  130. var url = "/api/Resource/QueryTicketBlackCodeByDiId"
  131. var that = this
  132. this.$axios({
  133. method: 'post',
  134. url: url,
  135. headers: {
  136. Authorization: 'Bearer ' + this.token
  137. },
  138. data: {
  139. diId: that.DiId
  140. }
  141. }).then(function (res) {
  142. console.log(res)
  143. if (res.data.code == 200) {
  144. that.tableData = res.data.data.ticketBlackCodes;
  145. that.DelegationInfo = res.data.data.delegationInfo
  146. that.tableDatas = that.tableData;
  147. if (that.tableDatas.slice((that.currentPage - 1) * that.pageSize, that.currentPage * that.pageSize).length == 0) {
  148. if (that.currentPage > 1) {
  149. that.currentPage = that.currentPage - 1;
  150. }
  151. }
  152. }
  153. that.loading = false
  154. }).catch(function (error) {
  155. that.loading = false
  156. that.$message.error("网络错误,请稍后重试");
  157. });
  158. },
  159. upDate(index, row) {
  160. this.$router.push({
  161. path: "/home/OpTicketBlackCode",
  162. query: {
  163. DiId: this.DiId,
  164. id: row.id
  165. }
  166. })
  167. },
  168. addIf() {
  169. if (this.DiId != 0 && this.DiId != '' && this.DiId != undefined) {
  170. this.$router.push({
  171. path: "/home/OpTicketBlackCode",
  172. query: {
  173. DiId: this.DiId,
  174. }
  175. })
  176. } else {
  177. this.$message('请选择团组在进行添加');
  178. }
  179. },
  180. del(index, row) {
  181. this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
  182. confirmButtonText: '确定',
  183. cancelButtonText: '取消',
  184. type: 'warning'
  185. }).then(() => {
  186. var url = "/api/Resource/DelTicketBlackCode"
  187. var that = this
  188. this.$axios({
  189. method: 'post',
  190. url: url,
  191. headers: {
  192. Authorization: 'Bearer ' + this.token
  193. },
  194. data: {
  195. Id: row.id,
  196. DeleteUserId: that.userId
  197. }
  198. }).then(function (res) {
  199. console.log(res)
  200. if (res.data.code == 200) {
  201. that.$message({
  202. message: '删除成功',
  203. type: 'success'
  204. });
  205. that.QueryTicketBlackCodeByDiId();
  206. } else {
  207. that.$message.error('删除失败!');
  208. }
  209. that.loading = false
  210. }).catch(function (error) {
  211. that.loading = false
  212. that.$message.error("网络错误,请稍后重试");
  213. });
  214. }).catch(() => {
  215. this.$message({
  216. type: 'info',
  217. message: '操作已取消!'
  218. });
  219. });
  220. },
  221. },
  222. mounted() {
  223. this.token = JSON.parse(localStorage.getItem('userinif')).token;
  224. this.userId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
  225. this.DelegationSelectFun()
  226. // var did = parseInt(this.$route.query.DiId)
  227. // if (did != null && did != undefined && did != '' && !isNaN(did)) {
  228. // this.DiId = did
  229. // }
  230. }
  231. }
  232. </script>
  233. <style>
  234. .communal-list {
  235. background-color: #fff;
  236. padding: 10px;
  237. box-shadow: 0 0 5px #0005;
  238. border-radius: 10px;
  239. min-height: 830px;
  240. }
  241. .communal-title {
  242. display: flex;
  243. font-size: 17px;
  244. font-weight: 600;
  245. color: #555;
  246. margin-top: 8px;
  247. margin-bottom: 10px;
  248. justify-content: space-between;
  249. align-items: center;
  250. }
  251. .communal-box {
  252. display: flex;
  253. }
  254. .communal-box>button {
  255. margin-left: 10px;
  256. padding: 8px 20px;
  257. }
  258. </style>