tb-orders-list.html 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>二级市场订单表-列表</title>
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  7. <!-- 所有的 css & js 资源 -->
  8. <link rel="stylesheet" href="https://unpkg.com/element-ui@2.13.0/lib/theme-chalk/index.css">
  9. <link rel="stylesheet" href="../../static/sa.css">
  10. <script src="../../static/kj/vue.min.js"></script>
  11. <script src="../../static/kj/element-ui/index.js"></script>
  12. <script src="../../static/kj/httpVueLoader.js"></script>
  13. <script src="../../static/kj/jquery.min.js"></script>
  14. <script src="../../static/kj/layer/layer.js"></script>
  15. <script src="../../static/sa.js"></script>
  16. <script src="../../static/kj/upload-util.js"></script>
  17. </head>
  18. <body>
  19. <div class="vue-box" style="display: none;" :style="'display: block;'">
  20. <div class="c-panel">
  21. <!-- ------------- 检索参数 ------------- -->
  22. <div class="c-title">检索参数</div>
  23. <el-form ref="form" :model='p' @submit.native.prevent>
  24. <sa-item type="text" name="订单编号" v-model="p.orderNo" width="90px"></sa-item>
  25. <sa-item type="text" name="商品名称" v-model="p.goodsName" width="90px"></sa-item>
  26. <el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
  27. <el-button type="info" icon="el-icon-refresh" @click="sa.f5()">重置</el-button>
  28. <!-- <el-button v-if="sa.isAuth('tb-orders-add')" size="mini" type="primary" @click="add()">新增</el-button> -->
  29. </el-form>
  30. <!-- ------------- 数据列表 ------------- -->
  31. <el-table class="data-table" ref="data-table" :data="dataList" >
  32. <sa-td type="index" width="30px"></sa-td>
  33. <sa-td name="订单编号" prop="orderNo" width="180px"></sa-td>
  34. <sa-td name="商品名称" prop="goodsName" ></sa-td>
  35. <sa-td name="商品来源" prop="goodsFrom" ></sa-td>
  36. <sa-td name="互市区" prop="tradeAreaName" ></sa-td>
  37. <sa-td name="买家" prop="purchaserName" ></sa-td>
  38. <sa-td name="卖家" prop="shipperName" ></sa-td>
  39. <sa-td name="转售金额" prop="resalePrice" ></sa-td>
  40. <sa-td name="车牌号" prop="veNo" ></sa-td>
  41. <sa-td name="订状态" prop="orderFinish" type="enum" :jv="{0: '未完成[#ff910a]', 1: '已完成[green]'}" @change="s => updateOrderFinish(s.row)"></sa-td>
  42. <el-table-column label="操作" width="100px">
  43. <template slot-scope="s">
  44. <el-button class="c-btn" type="success" icon="el-icon-view" @click="get(s.row)">查看</el-button>
  45. <!-- <el-button v-if="sa.isAuth('tb-orders-edit')" class="c-btn" type="primary" icon="el-icon-edit" @click="update(s.row)">修改</el-button>
  46. <el-button v-if="sa.isAuth('tb-orders-del')" class="c-btn" type="danger" icon="el-icon-delete" @click="del(s.row)">删除</el-button> -->
  47. </template>
  48. </el-table-column>
  49. </el-table>
  50. <!-- ------------- 分页 ------------- -->
  51. <sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()"></sa-item>
  52. </div>
  53. </div>
  54. <script>
  55. var app = new Vue({
  56. components: {
  57. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
  58. "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
  59. },
  60. el: '.vue-box',
  61. data: {
  62. p: { // 查询参数
  63. orderNo: '', // 订单编号
  64. goodsName: '', // 商品名称
  65. pageNo: 1, // 当前页
  66. pageSize: 10, // 页大小
  67. sortType: 0 // 排序方式
  68. },
  69. dataCount: 0,
  70. dataList: [], // 数据集合
  71. },
  72. methods: {
  73. // 刷新
  74. f5: function() {
  75. sa.ajax('/level-two-server/TbOrders/getList', sa.removeNull(this.p), function(res) {
  76. this.dataList = res.data; // 数据
  77. this.dataCount = res.dataCount; // 数据总数
  78. sa.f5TableHeight(); // 刷新表格高度
  79. }.bind(this));
  80. },
  81. // 查看
  82. get: function(data) {
  83. sa.showIframe('数据详情', 'tb-orders-info.html?id=' + data.id, '950px', '60%');
  84. },
  85. // 修改
  86. update: function(data) {
  87. sa.showIframe('修改数据', 'tb-orders-add.html?id=' + data.id, '1000px', '90%');
  88. },
  89. // 新增
  90. add: function(data) {
  91. sa.showIframe('新增数据', 'tb-orders-add.html?id=-1', '1000px', '90%');
  92. },
  93. // 删除
  94. del: function(data) {
  95. sa.confirm('是否删除,此操作不可撤销', function() {
  96. sa.ajax('/level-two-server/TbOrders/delete?id=' + data.id, function(res) {
  97. sa.arrayDelete(this.dataList, data);
  98. sa.ok('删除成功');
  99. sa.f5TableHeight(); // 刷新表格高度
  100. }.bind(this))
  101. }.bind(this));
  102. },
  103. // 批量删除
  104. deleteByIds: function() {
  105. // 获取选中元素的id列表
  106. let selection = this.$refs['data-table'].selection;
  107. let ids = sa.getArrayField(selection, 'id');
  108. if(selection.length == 0) {
  109. return sa.msg('请至少选择一条数据')
  110. }
  111. // 提交删除
  112. sa.confirm('是否批量删除选中数据?此操作不可撤销', function() {
  113. sa.ajax('/level-two-server/TbOrders/deleteByIds', {ids: ids.join(',')}, function(res) {
  114. sa.arrayDelete(this.dataList, selection);
  115. sa.ok('删除成功');
  116. sa.f5TableHeight(); // 刷新表格高度
  117. }.bind(this))
  118. }.bind(this));
  119. },
  120. // 改 - 订单状态已完成 (0=禁用,1=启用)
  121. updateOrderFinish: function(data) {
  122. // 声明变量记录是否成功
  123. var isOk = false;
  124. var oldValue = data.orderFinish;
  125. var ajax = sa.ajax('/level-two-server/TbOrders/updateOrderFinish', {id: data.id, value: data.orderFinish}, function(res) {
  126. isOk = true;
  127. sa.msg('修改成功');
  128. }.bind(this));
  129. // 如果未能修改成功, 则回滚
  130. $.when(ajax).done(function() {
  131. if(isOk == false) {
  132. data.status = oldValue;
  133. }
  134. })
  135. }
  136. },
  137. created: function() {
  138. this.f5();
  139. sa.onInputEnter();
  140. }
  141. })
  142. </script>
  143. </body>
  144. </html>