index.php 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <div id="app" v-cloak>
  2. <el-card shadow="never" style="border:0;" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  3. <div slot="header">
  4. <div>
  5. <span>订单列表</span>
  6. </div>
  7. </div>
  8. <div class="table-body">
  9. <el-form :inline="true" :model="searchData" class="demo-form-inline">
  10. <el-col :span="24">
  11. <el-form-item label="供应链名称">
  12. <el-input v-model="searchData.name" placeholder="供应链名称"></el-input>
  13. </el-form-item>
  14. </el-col>
  15. <el-form-item>
  16. <el-button type="primary" size="small" @click="onSubmit">查询</el-button>
  17. <el-button type="success" size="small" @click="edit(0)">新增</el-button>
  18. </el-form-item>
  19. </el-form>
  20. <!-- 订单信息 -->
  21. <template>
  22. <el-table ref="multipleTable" :data="list" @selection-change="handleSelectionChange">
  23. <!-- 空数据 -->
  24. <template slot="empty">
  25. <el-empty description="暂无订单"></el-empty>
  26. </template>
  27. <el-table-column type="selection">
  28. </el-table-column>
  29. <el-table-column prop="id" align="center" label="ID">
  30. </el-table-column>
  31. <el-table-column prop="app_name" align="center" label="供应链名称">
  32. </el-table-column>
  33. <el-table-column prop="app_key" align="center" label="APP KEY">
  34. </el-table-column>
  35. <el-table-column prop="created_at" label="创建时间" align="center">
  36. <template slot-scope="scope">
  37. {{ scope.row.created_at|dateTimeFormat('Y-m-d H:i:s') }}
  38. </template>
  39. </el-table-column>
  40. <el-table-column prop="right_btn" label="操作" align="center">
  41. <template slot-scope="scope">
  42. <el-button @click="edit(scope.row.id)" type="text">编辑</el-button>
  43. <el-button @click="copy(scope.row.callback_url)" type="text" class="copy_btn">复制回调地址</el-button>
  44. </template>
  45. </el-table-column>
  46. </el-table>
  47. </template>
  48. <!-- 分页 -->
  49. <el-row type="flex" class="page" justify="end">
  50. <el-pagination @current-change="pagination" background layout="prev, pager, next" :page-count="pageCount" v-if="list"></el-pagination>
  51. </el-row>
  52. </div>
  53. </el-card>
  54. </div>
  55. <script>
  56. const app = new Vue({
  57. el: '#app',
  58. data() {
  59. return {
  60. searchData: {
  61. name: '',
  62. },
  63. list: [],
  64. pageCount: 0,
  65. page: 1,
  66. currentPage: null,
  67. listLoading: false,
  68. btnLoading: false,
  69. checked: false,
  70. type: '',
  71. sort: '',
  72. };
  73. },
  74. methods: {
  75. handleSelectionChange(val) {
  76. this.select_order = val
  77. },
  78. // 全选
  79. allSelect() {
  80. if (this.checked) {
  81. this.goods_list.forEach(function(item, index) {
  82. if (!item.storage) {
  83. item.is_select = true
  84. }
  85. })
  86. } else {
  87. this.goods_list.forEach(function(item, index) {
  88. item.is_select = false
  89. })
  90. }
  91. },
  92. //搜索
  93. onSubmit() {
  94. this.page = 1
  95. this.getOrderList()
  96. },
  97. pagination(currentPage) {
  98. this.page = currentPage
  99. this.getOrderList()
  100. },
  101. getOrderList() {
  102. this.listLoading = true;
  103. var param = {
  104. r: 'qi-juhe/supplys/index',
  105. page: this.page,
  106. limit: 20
  107. }
  108. Object.assign(param, param, this.searchData)
  109. request({
  110. params: param,
  111. }).then(e => {
  112. if (e.data.code === 0) {
  113. this.list = e.data.data.list
  114. this.pageCount = e.data.data.page_count
  115. this.currentPage = e.data.data.pagination.current_page
  116. } else {
  117. this.$message.error(e.data.msg)
  118. }
  119. this.listLoading = false
  120. }).catch(e => {
  121. this.listLoading = false
  122. })
  123. },
  124. // 编辑
  125. edit(id) {
  126. navigateTo({
  127. r: 'qi-juhe/supplys/edit',
  128. id: id
  129. })
  130. },
  131. // 复制回调地址
  132. copy (url) {
  133. var clipboard = new ClipboardJS('.copy_btn', {
  134. text: function() {
  135. return url;
  136. }
  137. });
  138. clipboard.on('success', (e) => {
  139. this.$message.success('复制成功!');
  140. clipboard.destroy()
  141. });
  142. clipboard.on('error', (e) => {
  143. this.$message.error('复制失败!');
  144. this.clipboard.destroy()
  145. });
  146. },
  147. },
  148. mounted: function() {
  149. this.page = getQuery('page') ? getQuery('page') : 1
  150. this.getOrderList()
  151. }
  152. });
  153. </script>
  154. <style>
  155. </style>