TicketBlackCode.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  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 style="width:300px" 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%;text-align: right;">
  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. DiIdSelect:'',
  86. DiId: '',
  87. DelegationSelect: [],
  88. DelegationInfo: {}
  89. }
  90. },
  91. methods: {
  92. //每页条数改变时触发 选择一页显示多少行
  93. handleSizeChange(val) {
  94. this.currentPage = 1;
  95. this.pageSize = val;
  96. },
  97. //当前页改变时触发 跳转其他页
  98. handleCurrentChange(val) {
  99. this.currentPage = val;
  100. },
  101. //下拉框数据绑定
  102. DelegationSelectFun() {
  103. var url = "/api/Business/GetGroupNameList"
  104. var that = this
  105. this.$axios({
  106. method: 'post',
  107. url: url,
  108. headers: {
  109. Authorization: 'Bearer ' + this.token
  110. },
  111. data: {
  112. "portType": 1,
  113. "pageIndex": 0,
  114. "pageSize": 0
  115. }
  116. }).then(function (res) {
  117. if (res.data.code == 200) {
  118. that.DelegationSelect = res.data.data;
  119. if(that.DiId==''){
  120. that.DiId = that.DelegationSelect[0].id
  121. }
  122. // console.log(that.DiId)
  123. that.QueryTicketBlackCodeByDiId();
  124. }
  125. }).catch(function (error) {
  126. that.$message.error("网络错误,请稍后重试");
  127. });
  128. },
  129. //团组下拉框值改变事件
  130. AirTicketResSelectChange() {
  131. this.DiIdSelect='';
  132. this.QueryTicketBlackCodeByDiId();
  133. },
  134. QueryTicketBlackCodeByDiId() {
  135. var url = "/api/Resource/QueryTicketBlackCodeByDiId"
  136. var that = this
  137. this.$axios({
  138. method: 'post',
  139. url: url,
  140. headers: {
  141. Authorization: 'Bearer ' + this.token
  142. },
  143. data: {
  144. diId: that.DiIdSelect?that.DiIdSelect:that.DiId
  145. }
  146. }).then(function (res) {
  147. console.log(res)
  148. if (res.data.code == 200) {
  149. that.tableData = res.data.data.ticketBlackCodes;
  150. that.DelegationInfo = res.data.data.delegationInfo
  151. that.tableDatas = that.tableData;
  152. if (that.tableDatas.slice((that.currentPage - 1) * that.pageSize, that.currentPage * that.pageSize).length == 0) {
  153. if (that.currentPage > 1) {
  154. that.currentPage = that.currentPage - 1;
  155. }
  156. }
  157. }
  158. that.loading = false
  159. }).catch(function (error) {
  160. that.loading = false
  161. that.$message.error("网络错误,请稍后重试");
  162. });
  163. },
  164. upDate(index, row) {
  165. this.$router.push({
  166. path: "/home/OpTicketBlackCode",
  167. query: {
  168. DiId: this.DiIdSelect?this.DiIdSelect:this.DiId,
  169. id: row.id
  170. }
  171. })
  172. },
  173. addIf() {
  174. if (this.DiId != 0 && this.DiId != '' && this.DiId != undefined) {
  175. this.$router.push({
  176. path: "/home/OpTicketBlackCode",
  177. query: {
  178. DiId: this.DiIdSelect?this.DiIdSelect:this.DiId,
  179. }
  180. })
  181. } else {
  182. this.$message('请选择团组在进行添加');
  183. }
  184. },
  185. del(index, row) {
  186. this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
  187. confirmButtonText: '确定',
  188. cancelButtonText: '取消',
  189. type: 'warning'
  190. }).then(() => {
  191. var url = "/api/Resource/DelTicketBlackCode"
  192. var that = this
  193. this.$axios({
  194. method: 'post',
  195. url: url,
  196. headers: {
  197. Authorization: 'Bearer ' + this.token
  198. },
  199. data: {
  200. Id: row.id,
  201. DeleteUserId: that.userId
  202. }
  203. }).then(function (res) {
  204. console.log(res)
  205. if (res.data.code == 200) {
  206. that.$message({
  207. message: '删除成功',
  208. type: 'success'
  209. });
  210. that.QueryTicketBlackCodeByDiId();
  211. } else {
  212. that.$message.error('删除失败!');
  213. }
  214. that.loading = false
  215. }).catch(function (error) {
  216. that.loading = false
  217. that.$message.error("网络错误,请稍后重试");
  218. });
  219. }).catch(() => {
  220. this.$message({
  221. type: 'info',
  222. message: '操作已取消!'
  223. });
  224. });
  225. },
  226. },
  227. mounted() {
  228. this.DiIdSelect = parseInt(this.$route.query.DiId)
  229. if(this.DiIdSelect){
  230. this.DiId = parseInt(this.$route.query.DiId)
  231. }
  232. console.log(this.DiId,this.DiIdSelect)
  233. this.token = JSON.parse(localStorage.getItem('userinif')).token;
  234. this.userId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
  235. this.DelegationSelectFun()
  236. // var did = parseInt(this.$route.query.DiId)
  237. // if (did != null && did != undefined && did != '' && !isNaN(did)) {
  238. // this.DiId = did
  239. // }
  240. }
  241. }
  242. </script>
  243. <style>
  244. .communal-list {
  245. background-color: #fff;
  246. padding: 10px;
  247. box-shadow: 0 0 5px #0005;
  248. border-radius: 10px;
  249. min-height: 830px;
  250. }
  251. .communal-title {
  252. display: flex;
  253. font-size: 17px;
  254. font-weight: 600;
  255. color: #555;
  256. margin-top: 8px;
  257. margin-bottom: 10px;
  258. justify-content: space-between;
  259. align-items: center;
  260. }
  261. .communal-box {
  262. display: flex;
  263. }
  264. .communal-box>button {
  265. margin-left: 10px;
  266. padding: 8px 20px;
  267. }
  268. </style>