CountryFeeCost.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. <template>
  2. <div>
  3. <div class="communal-list">
  4. <div class="communal-title">
  5. <div>签证费用</div>
  6. <div class="communal-box">
  7. <el-input @input="Inquireclick()" placeholder="国家" v-model="input" clearable style="width: 350px;">
  8. </el-input>
  9. <router-link to="/home/CountryFeeCostOperation">
  10. <el-button type="primary" style="margin-left: 10px;">新增</el-button>
  11. </router-link>
  12. </div>
  13. </div>
  14. <template>
  15. <el-table :data="tableDatas.slice((currentPage - 1) * pageSize, currentPage * pageSize)" border
  16. style="width: 100%" v-loading="loading" element-loading-text="拼命加载中...">
  17. <el-table-column prop="num" label="序 号" width="55">
  18. <template slot-scope="scope">
  19. {{ (currentPage - 1) * pageSize + scope.$index + 1 }}
  20. </template>
  21. </el-table-column>
  22. <el-table-column prop="visaContinent" label="洲" width="80">
  23. </el-table-column>
  24. <el-table-column prop="visaCountry" label="国家" width="150">
  25. </el-table-column>
  26. <el-table-column prop="isVisaExemption" label="是否对美免签">
  27. <template slot-scope="is">
  28. <span v-if="is.row.isVisaExemption == 1">否</span>
  29. <span v-else>是</span>
  30. </template>
  31. </el-table-column>
  32. <el-table-column prop="isVisaOnArrival" label="是否落地签">
  33. <template slot-scope="is">
  34. <span v-if="is.row.isVisaOnArrival == 1">否</span>
  35. <span v-else>是</span>
  36. </template>
  37. </el-table-column>
  38. <el-table-column prop="isElectronicSignature" label="是否电子签">
  39. <template slot-scope="is">
  40. <span v-if="is.row.isElectronicSignature == 1">否</span>
  41. <span v-else>是</span>
  42. </template>
  43. </el-table-column>
  44. <el-table-column prop="visaTime" label="一般签证时间(天)">
  45. </el-table-column>
  46. <el-table-column prop="visaPrice" label="费用(元)" :formatter="rounding">
  47. </el-table-column>
  48. <el-table-column prop="visaPriceDesc" label="费用描述">
  49. <template slot-scope="visaPriceDesc">
  50. <el-popover placement="top-start" title="费用描述" trigger="hover" width="200"
  51. :content="visaPriceDesc.row.visaPriceDesc">
  52. <el-button slot="reference" size="mini">移上查看</el-button>
  53. </el-popover>
  54. </template>
  55. </el-table-column>
  56. <!-- <el-table-column prop="urgentTime" label="加急签证时间" width="50">
  57. </el-table-column>
  58. <el-table-column prop="urgentPrice" label="加急费用" width="80">
  59. </el-table-column>
  60. <el-table-column prop="urgentPriceDesc" label="加急费用描述" width="180">
  61. <template slot-scope="urgentPriceDesc">
  62. <el-popover placement="top-start" title="加急费用描述" width="200" trigger="hover"
  63. :content="urgentPriceDesc.row.urgentPriceDesc">
  64. <el-button slot="reference">移上查看</el-button>
  65. </el-popover>
  66. </template>
  67. </el-table-column>
  68. <el-table-column prop="remark" label="签证描述" width="180">
  69. <template slot-scope="remark">
  70. <el-popover placement="top-start" title="加急费用描述" width="200" trigger="hover"
  71. :content="remark.row.remark">
  72. <el-button slot="reference">移上查看</el-button>
  73. </el-popover>
  74. </template>
  75. </el-table-column> -->
  76. <el-table-column label="操作">
  77. <template slot-scope="scope">
  78. <el-button size="mini" @click="upDate(scope.$index, scope.row)">编辑</el-button>
  79. <el-button size="mini" type="danger" @click="del(scope.$index, scope.row)">删除</el-button>
  80. </template>
  81. </el-table-column>
  82. </el-table>
  83. </template>
  84. <div class="block">
  85. <el-pagination align='center' @size-change="handleSizeChange" @current-change="handleCurrentChange"
  86. :current-page="currentPage" :page-sizes="[10, 12, 15, 20]" :page-size="pageSize"
  87. layout="total, sizes, prev, pager, next" :total="tableDatas.length">
  88. </el-pagination>
  89. </div>
  90. </div>
  91. </div>
  92. </template>
  93. <script>
  94. export default {
  95. beforeRouteLeave(to, from, next) {
  96. if(to.name!='CountryFeeCostOperation'){
  97. localStorage.removeItem('qzfyval');
  98. }
  99. next()
  100. },
  101. data() {
  102. return {
  103. loading: false,
  104. tableDatas: [],
  105. tableData: [],
  106. currentPage: 1, // 当前页码
  107. pageSize: 12,// 每页的数据条数
  108. input: '',
  109. token: '',
  110. userId: 0
  111. }
  112. },
  113. methods: {
  114. //每页条数改变时触发 选择一页显示多少行
  115. handleSizeChange(val) {
  116. this.currentPage = 1;
  117. this.pageSize = val;
  118. },
  119. //当前页改变时触发 跳转其他页
  120. handleCurrentChange(val) {
  121. this.currentPage = val;
  122. },
  123. HotelData() {
  124. this.loading = true
  125. var url = "/api/Resource/QueryCountryFeeCost"
  126. var that = this
  127. this.$axios({
  128. method: 'post',
  129. url: url,
  130. headers: {
  131. Authorization: 'Bearer ' + this.token
  132. },
  133. data: {
  134. portType: 1,
  135. }
  136. }).then(function (res) {
  137. console.log(res)
  138. if (res.data.code == 200) {
  139. that.tableData = res.data.data;
  140. that.tableDatas = that.tableData;
  141. if (that.tableDatas.slice((that.currentPage - 1) * that.pageSize, that.currentPage * that.pageSize).length == 0) {
  142. if (that.currentPage > 1) {
  143. that.currentPage = that.currentPage - 1;
  144. }
  145. }
  146. if(JSON.parse(localStorage.getItem('qzfyval'))){
  147. that.currentPage=JSON.parse(localStorage.getItem('qzfyval')).currentPage;
  148. that.input=JSON.parse(localStorage.getItem('qzfyval')).input;
  149. var newarr = [];
  150. if (that.input == "") {
  151. newarr = that.tableData;
  152. } else {
  153. for (var i = 0; i < that.tableData.length; i++) {
  154. if (that.tableData[i].visaCountry.indexOf(that.input) != -1) {
  155. newarr.push(that.tableData[i]);
  156. }
  157. }
  158. }
  159. that.tableDatas = newarr;
  160. }
  161. }
  162. that.loading = false
  163. }).catch(function (error) {
  164. that.loading = false
  165. that.$message.error("网络错误,请稍后重试");
  166. });
  167. },
  168. //搜索框处理
  169. Inquireclick() {
  170. var newarr = [];
  171. if (this.input == "") {
  172. newarr = this.tableData;
  173. } else {
  174. for (var i = 0; i < this.tableData.length; i++) {
  175. if (this.tableData[i].visaCountry.indexOf(this.input) != -1) {
  176. newarr.push(this.tableData[i]);
  177. }
  178. }
  179. }
  180. this.tableDatas = newarr;
  181. this.currentPage = 1;
  182. },
  183. rounding(row, column) {
  184. return parseFloat(row[column.property]).toFixed(2)
  185. },
  186. upDate(index, row) {
  187. var qzfyval={
  188. currentPage:this.currentPage,
  189. input:this.input,
  190. }
  191. localStorage.setItem('qzfyval', JSON.stringify(qzfyval));
  192. this.$router.push({
  193. path: "/home/CountryFeeCostOperation",
  194. query: { id: row.id }
  195. })
  196. },
  197. del(index, row) {
  198. this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
  199. confirmButtonText: '确定',
  200. cancelButtonText: '取消',
  201. type: 'warning'
  202. }).then(() => {
  203. var url = "/api/Resource/DelCountryFeeCost"
  204. var that = this
  205. this.$axios({
  206. method: 'post',
  207. url: url,
  208. headers: {
  209. Authorization: 'Bearer ' + this.token
  210. },
  211. data: {
  212. Id: row.id,
  213. DeleteUserId: this.userId
  214. }
  215. }).then(function (res) {
  216. console.log(res)
  217. if (res.data.code == 200) {
  218. that.$message({
  219. message: '删除成功',
  220. type: 'success'
  221. });
  222. that.HotelData();
  223. } else {
  224. that.$message.error('删除失败!');
  225. }
  226. that.loading = false
  227. }).catch(function (error) {
  228. that.loading = false
  229. that.$message.error("网络错误,请稍后重试");
  230. });
  231. }).catch(() => {
  232. this.$message({
  233. type: 'info',
  234. message: '操作已取消!'
  235. });
  236. });
  237. }
  238. },
  239. mounted() {
  240. this.token = JSON.parse(localStorage.getItem('userinif')).token;
  241. this.userId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
  242. this.HotelData();
  243. }
  244. }
  245. </script>
  246. <style>
  247. .communal-list {
  248. background-color: #fff;
  249. padding: 10px;
  250. box-shadow: 0 0 5px #0005;
  251. border-radius: 10px;
  252. }
  253. .communal-title {
  254. display: flex;
  255. font-size: 17px;
  256. font-weight: 600;
  257. color: #555;
  258. margin-top: 8px;
  259. margin-bottom: 10px;
  260. justify-content: space-between;
  261. align-items: center;
  262. }
  263. .communal-box {
  264. display: flex;
  265. }
  266. .communal-box>button {
  267. margin-left: 10px;
  268. padding: 8px 20px;
  269. }
  270. </style>