tb-two-market-orders-list.html 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  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="../../static/kj/element-ui/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. </head>
  17. <body>
  18. <div class="vue-box" style="display: none;" :style="'display: block;'">
  19. <div class="c-panel">
  20. <!-- ------------- 检索参数 ------------- -->
  21. <div class="c-title">检索参数</div>
  22. <el-form ref="form" :model='p' @submit.native.prevent>
  23. <sa-item type="text" name="订单编号" v-model="p.orderNo"></sa-item>
  24. <sa-item type="text" name="商品名称" v-model="p.goodsName"></sa-item>
  25. <el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
  26. <el-button type="info" icon="el-icon-refresh" @click="sa.f5()">重置</el-button>
  27. </el-form>
  28. <div class="fast-btn">
  29. <el-button v-if="sa.isAuth('tb-orders-add')" size="mini" type="primary" @click="add()">新增</el-button>
  30. <el-button size="mini" type="success" @click="getBySelect()">查看</el-button>
  31. </div>
  32. <!-- ------------- 数据列表 ------------- -->
  33. <el-table class="data-table" ref="data-table" :data="dataList" >
  34. <sa-td type="selection"></sa-td>
  35. <sa-td name="订单编号" prop="orderNo" ></sa-td>
  36. <!-- <sa-td name="商品id" prop="goodsId" ></sa-td> -->
  37. <sa-td name="商品名称" prop="goodsName" ></sa-td>
  38. <sa-td name="商品来源" prop="goodsFrom" ></sa-td>
  39. <sa-td name="发货商电话" prop="shipperPhone" ></sa-td>
  40. <sa-td name="发货商名称" prop="shipperName" ></sa-td>
  41. <!-- <sa-td name="司机ID" prop="driverId" ></sa-td> -->
  42. <sa-td name="司机名称" prop="driverName" ></sa-td>
  43. <sa-td name="司机电话" prop="driverPhone" ></sa-td>
  44. <!-- <sa-td name="车型ID" prop="carId" ></sa-td> -->
  45. <sa-td name="车型名称" prop="carType" ></sa-td>
  46. <sa-td name="收货人名称" prop="consigneeName" ></sa-td>
  47. <sa-td name="收货人电话号码" prop="consigneePhone" ></sa-td>
  48. <sa-td name="申报订单号" prop="declarationNumber" ></sa-td>
  49. <sa-td name="订单状态已完成" prop="orderFinish" type="switch" :jv="{0: '禁用', 1: '启用'}" @change="s => updateOrderFinish(s.row)"></sa-td>
  50. <sa-td name="装货地址" prop="loadingAddress" ></sa-td>
  51. <sa-td name="卸货地址" prop="unloadingAddress" ></sa-td>
  52. <sa-td name="备注" prop="comment" ></sa-td>
  53. <!-- <sa-td name="贸易区域id" prop="tradeAreaId" ></sa-td> -->
  54. <sa-td name="贸易区域名称" prop="tradeAreaName" ></sa-td>
  55. <el-table-column label="操作" fixed="right" width="240px">
  56. <template slot-scope="s">
  57. <el-button class="c-btn" type="success" icon="el-icon-view" @click="get(s.row)">查看</el-button>
  58. <el-button v-if="sa.isAuth('tb-orders-edit')" class="c-btn" type="primary" icon="el-icon-edit" @click="update(s.row)">修改</el-button>
  59. <el-button v-if="sa.isAuth('tb-orders-del')" class="c-btn" type="danger" icon="el-icon-delete" @click="del(s.row)">删除</el-button>
  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. // goodsId: '', // 商品id
  78. goodsName: '', // 商品名称
  79. goodsFrom: '', // 商品来源(国家)
  80. shipperPhone: '', // 发货商电话
  81. shipperName: '', // 发货商名称
  82. // driverId: '', // 司机ID
  83. driverName: '', // 司机名称
  84. driverPhone: '', // 司机电话
  85. // carId: '', // 车型ID
  86. carType: '', // 车型名称
  87. consigneeName: '', // 收货人名称
  88. consigneePhone: '', // 收货人电话号码
  89. declarationNumber: '', // (预留字段) 申报订单号
  90. orderFinish: '', // 订单状态已完成 (0=禁用,1=启用)
  91. loadingAddress: '', // 装货地址
  92. unloadingAddress: '', // 卸货地址
  93. comment: '', // 备注
  94. // tradeAreaId: '', // 贸易区域id
  95. tradeAreaName: '', // 贸易区域名称
  96. pageNo: 1, // 当前页
  97. pageSize: 10, // 页大小
  98. sortType: 0 // 排序方式
  99. },
  100. dataCount: 0,
  101. dataList: [], // 数据集合
  102. },
  103. methods: {
  104. // 刷新
  105. f5: function() {
  106. sa.ajax('/TbOrders/getList', sa.removeNull(this.p), function(res) {
  107. this.dataList = res.data; // 数据
  108. this.dataCount = res.dataCount; // 数据总数
  109. sa.f5TableHeight(); // 刷新表格高度
  110. }.bind(this));
  111. },
  112. // 查看
  113. get: function(data) {
  114. sa.showIframe('数据详情', 'tb-orders-info.html?id=' + data.id, '1050px', '90%');
  115. },
  116. // 查看 - 根据选中的
  117. getBySelect: function(data) {
  118. var selection = this.$refs['data-table'].selection;
  119. if(selection.length == 0) {
  120. return sa.msg('请选择一条数据')
  121. }
  122. this.get(selection[0]);
  123. },
  124. // 修改
  125. update: function(data) {
  126. sa.showIframe('修改数据', 'tb-orders-add.html?id=' + data.id, '1000px', '90%');
  127. },
  128. // 新增
  129. add: function(data) {
  130. sa.showIframe('新增数据', 'tb-orders-add.html?id=-1', '1000px', '90%');
  131. },
  132. // 删除
  133. del: function(data) {
  134. sa.confirm('是否删除,此操作不可撤销', function() {
  135. sa.ajax('/TbOrders/delete?id=' + data.id, function(res) {
  136. sa.arrayDelete(this.dataList, data);
  137. sa.ok('删除成功');
  138. sa.f5TableHeight(); // 刷新表格高度
  139. }.bind(this))
  140. }.bind(this));
  141. },
  142. // 批量删除
  143. deleteByIds: function() {
  144. // 获取选中元素的id列表
  145. let selection = this.$refs['data-table'].selection;
  146. let ids = sa.getArrayField(selection, 'id');
  147. if(selection.length == 0) {
  148. return sa.msg('请至少选择一条数据')
  149. }
  150. // 提交删除
  151. sa.confirm('是否批量删除选中数据?此操作不可撤销', function() {
  152. sa.ajax('/TbOrders/deleteByIds', {ids: ids.join(',')}, function(res) {
  153. sa.arrayDelete(this.dataList, selection);
  154. sa.ok('删除成功');
  155. sa.f5TableHeight(); // 刷新表格高度
  156. }.bind(this))
  157. }.bind(this));
  158. },
  159. // 改 - 订单状态已完成 (0=禁用,1=启用)
  160. updateOrderFinish: function(data) {
  161. // 声明变量记录是否成功
  162. var isOk = false;
  163. var oldValue = data.orderFinish;
  164. var ajax = sa.ajax('/TbOrders/updateOrderFinish', {id: data.id, value: data.orderFinish}, function(res) {
  165. isOk = true;
  166. sa.msg('修改成功');
  167. }.bind(this));
  168. // 如果未能修改成功, 则回滚
  169. $.when(ajax).done(function() {
  170. if(isOk == false) {
  171. data.status = oldValue;
  172. }
  173. })
  174. },
  175. // 改 - 删除状态(0=禁用,1=启用)
  176. updateDeleteStatus: function(data) {
  177. // 声明变量记录是否成功
  178. var isOk = false;
  179. var oldValue = data.deleteStatus;
  180. var ajax = sa.ajax('/TbOrders/updateDeleteStatus', {id: data.id, value: data.deleteStatus}, function(res) {
  181. isOk = true;
  182. sa.msg('修改成功');
  183. }.bind(this));
  184. // 如果未能修改成功, 则回滚
  185. $.when(ajax).done(function() {
  186. if(isOk == false) {
  187. data.status = oldValue;
  188. }
  189. })
  190. },
  191. },
  192. created: function() {
  193. this.f5();
  194. sa.onInputEnter();
  195. }
  196. })
  197. </script>
  198. </body>
  199. </html>