tb-orders-list.html 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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.veNo" width="80px"></sa-item>
  25. <sa-item type="text" name="订单编号" v-model="p.orderNo" width="90px"></sa-item>
  26. <sa-item type="text" name="商品名称" v-model="p.goodsName" width="90px"></sa-item>
  27. <el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
  28. <el-button type="info" icon="el-icon-refresh" @click="sa.f5()">重置</el-button>
  29. <!-- <el-button v-if="sa.isAuth('tb-orders-add')" size="mini" type="primary" @click="add()">新增</el-button> -->
  30. </el-form>
  31. <!-- ------------- 数据列表 ------------- -->
  32. <el-table class="data-table" ref="data-table" :data="dataList" >
  33. <sa-td type="index" width="30px"></sa-td>
  34. <sa-td name="车牌号" prop="veNo" width="80px"></sa-td>
  35. <sa-td name="订单编号" prop="orderNo" width="180px"></sa-td>
  36. <sa-td name="商品名称" prop="goodsName" ></sa-td>
  37. <sa-td name="买家" prop="purchaserName" width="100px"></sa-td>
  38. <sa-td name="卖家" prop="leaderName" width="100px"></sa-td>
  39. <sa-td name="转售金额" prop="resalePrice" width="80px"></sa-td>
  40. <sa-td name="互市区" prop="tradeAreaName" width="120px"></sa-td>
  41. <sa-td name="订单状态" prop="orderFinish" type="enum" :jv="{0: '未完成[#ff910a]', 1: '已完成[green]'}" @change="s => updateOrderFinish(s.row)" width="80px"></sa-td>
  42. <sa-td name="支付状态" prop="isPay" type="enum" :jv="{0: '未支付[#ff910a]', 1: '支付成功[green]', 2: '支付失败[red]', 3: '支付中[blue]'}" width="80px"></sa-td>
  43. <sa-td name="补扣次数" prop="deductionCount" width="80px">
  44. <template slot-scope="s">
  45. <div v-if="s.row.deductionCount==0">0</div>
  46. <div v-else>{{s.row.deductionCount}}</div>
  47. </template>
  48. </sa-td>
  49. <sa-td name="补扣时间" prop="deductionTime" width="140px"></sa-td>
  50. <sa-td name="创建时间" prop="createTime" width="140px"></sa-td>
  51. <el-table-column label="操作" fixed="right" width="190px">
  52. <template slot-scope="s">
  53. <el-button class="c-btn" type="success" icon="el-icon-view" @click="get(s.row)">查看</el-button>
  54. <span>
  55. <el-button v-if="s.row.isPay==2&&sa.isAuth('tb-orders-deduction')"
  56. class="c-btn" type="warning" icon="el-icon-view" @click="deduction(s.row)">采购补扣款</el-button>
  57. <el-button v-else :disabled="true" class="c-btn" type="warning" icon="el-icon-view">采购补扣款</el-button>
  58. </span>
  59. <el-button class="c-btn" type="primary" icon="el-icon-printer" @click="subPrint(s.row)">交易凭证</el-button>
  60. <el-button class="c-btn" type="info" icon="el-icon-info" @click="subEmail(s.row)">电子协议</el-button>
  61. </template>
  62. </el-table-column>
  63. </el-table>
  64. <!-- ------------- 分页 ------------- -->
  65. <sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()"></sa-item>
  66. </div>
  67. </div>
  68. <script>
  69. var app = new Vue({
  70. components: {
  71. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
  72. "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
  73. },
  74. el: '.vue-box',
  75. data: {
  76. p: { // 查询参数
  77. orderNo: '', // 订单编号
  78. goodsName: '', // 商品名称
  79. pageNo: 1, // 当前页
  80. pageSize: 10, // 页大小
  81. sortType: 0 // 排序方式
  82. },
  83. dataCount: 0,
  84. dataList: [], // 数据集合
  85. },
  86. methods: {
  87. // 刷新
  88. f5: function() {
  89. sa.ajax('/level-two-server/TbOrders/getList', sa.removeNull(this.p), function(res) {
  90. this.dataList = res.data; // 数据
  91. this.dataCount = res.dataCount; // 数据总数
  92. sa.f5TableHeight(); // 刷新表格高度
  93. }.bind(this));
  94. },
  95. // 查看
  96. get: function(data) {
  97. sa.showIframe('数据详情', 'tb-orders-info.html?id=' + data.id, '950px', '60%');
  98. },
  99. // 交易凭证
  100. subPrint: function(data) {
  101. sa.showIframe('交易凭证', 'tb-orders-print.html?id=' + data.id, '1200px', '80%');
  102. },
  103. // 电子协议
  104. subEmail: function(data) {
  105. sa.showIframe('电子协议', 'tb-orders-email.html?id=' + data.id, '1000px', '90%');
  106. },
  107. deduction(data) {
  108. sa.confirm('是否执行补扣款操作', function() {
  109. sa.ajax('/level-two-server/TbOrders/deduction?id=' + data.id, function(res) {
  110. sa.ok('操作成功');
  111. sa.f5TableHeight(); // 刷新表格高度
  112. }.bind(this))
  113. }.bind(this));
  114. },
  115. // 修改
  116. update: function(data) {
  117. sa.showIframe('修改数据', 'tb-orders-add.html?id=' + data.id, '1000px', '90%');
  118. },
  119. // 新增
  120. add: function(data) {
  121. sa.showIframe('新增数据', 'tb-orders-add.html?id=-1', '1000px', '90%');
  122. },
  123. // 删除
  124. del: function(data) {
  125. sa.confirm('是否删除,此操作不可撤销', function() {
  126. sa.ajax('/level-two-server/TbOrders/delete?id=' + data.id, function(res) {
  127. sa.arrayDelete(this.dataList, data);
  128. sa.ok('删除成功');
  129. sa.f5TableHeight(); // 刷新表格高度
  130. }.bind(this))
  131. }.bind(this));
  132. },
  133. // 批量删除
  134. deleteByIds: function() {
  135. // 获取选中元素的id列表
  136. let selection = this.$refs['data-table'].selection;
  137. let ids = sa.getArrayField(selection, 'id');
  138. if(selection.length == 0) {
  139. return sa.msg('请至少选择一条数据')
  140. }
  141. // 提交删除
  142. sa.confirm('是否批量删除选中数据?此操作不可撤销', function() {
  143. sa.ajax('/level-two-server/TbOrders/deleteByIds', {ids: ids.join(',')}, function(res) {
  144. sa.arrayDelete(this.dataList, selection);
  145. sa.ok('删除成功');
  146. sa.f5TableHeight(); // 刷新表格高度
  147. }.bind(this))
  148. }.bind(this));
  149. },
  150. // 改 - 订单状态已完成 (0=禁用,1=启用)
  151. updateOrderFinish: function(data) {
  152. // 声明变量记录是否成功
  153. var isOk = false;
  154. var oldValue = data.orderFinish;
  155. var ajax = sa.ajax('/level-two-server/TbOrders/updateOrderFinish', {id: data.id, value: data.orderFinish}, function(res) {
  156. isOk = true;
  157. sa.msg('修改成功');
  158. }.bind(this));
  159. // 如果未能修改成功, 则回滚
  160. $.when(ajax).done(function() {
  161. if(isOk == false) {
  162. data.status = oldValue;
  163. }
  164. })
  165. }
  166. },
  167. created: function() {
  168. this.f5();
  169. sa.onInputEnter();
  170. }
  171. })
  172. </script>
  173. </body>
  174. </html>