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