tb-invoice-order-list.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  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. <style>
  18. .c1-label{width: 7em; color: #333; padding-right: 4px; display: inline-block; text-align: right; vertical-align: top;}
  19. </style>
  20. <body>
  21. <div class="vue-box" style="display: none;" :style="'display: block;'">
  22. <div class="c-panel">
  23. <!-- ------------- 检索参数 ------------- -->
  24. <div class="c-title">检索参数</div>
  25. <el-form ref="form" :model='p' @submit.native.prevent>
  26. <div class="c-item">
  27. <label class="c1-label">开票信息编号:</label>
  28. <el-input type="text" v-model="p.infoNo"></el-input>
  29. </div>
  30. <div class="c-item">
  31. <label class="c1-label">车牌号:</label>
  32. <el-input type="text" v-model="p.carNo"></el-input>
  33. </div>
  34. <div class="c-item">
  35. <label class="c1-label">微信支付订单:</label>
  36. <el-input type="text" v-model="p.transactionId"></el-input>
  37. </div>
  38. <div class="c-item">
  39. <label class="c-label">开票状态:</label>
  40. <el-select v-model="p.status" placeholder="请选择">
  41. <el-option label="不限" value=""></el-option>
  42. <el-option label="待申请" :value="0"></el-option>
  43. <el-option label="已申请" :value="1"></el-option>
  44. <el-option label="已开票" :value="2"></el-option>
  45. </el-select>
  46. </div>
  47. <el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
  48. <el-button size="mini" type="info" @click="sa.f5()">刷新</el-button>
  49. <br /><br />
  50. </el-form>
  51. <!-- ------------- 快捷按钮 ------------- -->
  52. <el-form ref="form" :model='p' @submit.native.prevent>
  53. <el-button style="display: inline;" type="primary" @click="add()">上传账单截图</el-button>
  54. <el-button style="display: inline;" type="primary" @click="applyFn()">申请开票</el-button>
  55. </el-form>
  56. <!-- ------------- 数据列表 ------------- -->
  57. <el-table class="data-table" ref="data-table" :data="dataList" >
  58. <sa-td type="selection"></sa-td>
  59. <sa-td name="业务名称" prop="businessName" width="150px" ></sa-td>
  60. <sa-td name="车牌号" prop="carNo" width="150px"></sa-td>
  61. <el-table-column label="业务订单号" width="150px">
  62. <template slot-scope="s">
  63. <el-tooltip :content="s.row.businessNo"placement="bottom"effect="light">
  64. <el-button class="keyButton">{{ s.row.businessNo }}</el-button>
  65. </el-tooltip>
  66. </template>
  67. </el-table-column>
  68. <!-- <sa-td name="业务订单号" prop="businessNo" width="150" ></sa-td>-->
  69. <sa-td name="微信支付订单号" prop="transactionId" width="210px"></sa-td>
  70. <sa-td name="账单金额" prop="billMoney" ></sa-td>
  71. <sa-td name="账单截图" prop="billImage" type="img"></sa-td>
  72. <sa-td name="开票状态" prop="status" type="enum" :jv="{0: '待申请', 1: '已申请', 2: '已开票'}"></sa-td>
  73. <sa-td name="开票时间" prop="invoiceTime" width="100px"></sa-td>
  74. <sa-td name="开票信息" prop="infoNo" width="130"></sa-td>
  75. <el-table-column label="操作" fixed="right" width="240px">
  76. <template slot-scope="s">
  77. <el-button class="c-btn" type="success" icon="el-icon-view" @click="get(s.row)">查看</el-button>
  78. <el-button v-if="s.row.status==0" class="c-btn" type="danger" icon="el-icon-delete" @click="del(s.row)">删除</el-button>
  79. </template>
  80. </el-table-column>
  81. </el-table>
  82. <!-- ------------- 分页 ------------- -->
  83. <sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()"></sa-item>
  84. </div>
  85. <el-dialog title="申请开票" :visible.sync="applyDate.visible" width="38%">
  86. <sa-item name="发票总额" v-model="applyDate.form.totalMoney" type="num" :disabled="true"></sa-item>
  87. <sa-item name="开票种类" v-model="applyDate.form.isElec" type="enum" :jv="{1: '电子普票', 0: '纸质普票', 2:'纸质专票'}"></sa-item>
  88. <div class="c-item">
  89. <label class="c-label">开票主体:</label>
  90. <el-select v-model="applyDate.form.entityId" placeholder="请选择" filterable @change="changeEntity">
  91. <el-option v-for="item in entityList" :key="item.id"
  92. :label="item.name" :value="item.id">
  93. </el-option>
  94. </el-select>
  95. </div>
  96. <sa-item type="text" name="企业名称" v-model="applyDate.entity.name":disabled="true"></sa-item>
  97. <sa-item type="text" name="税号" v-model="applyDate.entity.taxIdNo" :disabled="true"></sa-item>
  98. <sa-item type="text" name="地址" v-model="applyDate.entity.address" :disabled="true"></sa-item>
  99. <sa-item type="text" name="电话" v-model="applyDate.entity.phone" :disabled="true"></sa-item>
  100. <sa-item type="text" name="开户银行" v-model="applyDate.entity.bank" :disabled="true"></sa-item>
  101. <sa-item type="text" name="银行账号" v-model="applyDate.entity.bankNo" :disabled="true"></sa-item>
  102. <span slot="footer" class="dialog-footer">
  103. <el-button @click="applyDate.visible = false">取 消</el-button>
  104. <el-button type="primary" @click="apply">确 定</el-button>
  105. </span>
  106. </el-dialog>
  107. </div>
  108. <script>
  109. var app = new Vue({
  110. components: {
  111. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
  112. "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
  113. },
  114. el: '.vue-box',
  115. data: {
  116. p: { // 查询参数
  117. id: '', // 主键 、
  118. customerId: '', // 客户id
  119. businessId: '', // 业务订单id
  120. businessName: '', // 业务名称
  121. businessNo: '', // 业务订单号
  122. carNo: '', //车牌号
  123. transactionId: '', // 微信支付订单号
  124. billMoney: '', // 账单金额
  125. status: '', // 支付状态(0=未开票,1=已开票)
  126. invoiceTime: '', // 开票时间
  127. createTime: '', // 创建时间
  128. infoId: '', // 开票信息id
  129. infoNo: '', // 开票信息no
  130. pageNo: 1, // 当前页
  131. pageSize: 10, // 页大小
  132. sortType: 0 // 排序方式
  133. },
  134. dataCount: 0,
  135. dataList: [], // 数据集合
  136. entityList: [],
  137. applyDate: {
  138. visible: false,
  139. form: {
  140. ids: '',
  141. entityId: '',
  142. isElec: 1,
  143. totalMoney: 0,
  144. customerId: '',
  145. customerName: '',
  146. },
  147. entity:{},
  148. },
  149. currentCustomerId: '1',
  150. currentCustomerName: '',
  151. },
  152. methods: {
  153. apply(){
  154. sa.checkNull(this.applyDate.form.entityId, '请选择 [主体信息]');
  155. sa.checkNull(this.applyDate.form.isElec, '请选择 [电子发票]');
  156. sa.ajax('/TbInvoiceInfo/generate', this.applyDate.form, function(res){
  157. this.applyDate.visible = false;
  158. sa.alert('成功生成开票信息',this.f5);
  159. }.bind(this));
  160. },
  161. applyFn(){
  162. let selection = this.$refs['data-table'].selection;
  163. if(selection.length == 0) {
  164. return sa.msg('请至少选择一条数据')
  165. }
  166. let ids = sa.getArrayField(selection, 'id');
  167. for(var i=0; i<selection.length; i++){
  168. if(selection[i].status == 1 || selection[i].status == 2){
  169. return sa.msg('请选择待申请的订单')
  170. }
  171. }
  172. let billMoneys = sa.getArrayField(selection, 'billMoney');
  173. var totalMoney = 0;
  174. for (var i=billMoneys.length-1; i>=0; i--) {
  175. totalMoney += billMoneys[i];
  176. }
  177. this.applyDate.form.totalMoney = totalMoney;
  178. this.applyDate.visible = true;
  179. this.applyDate.form.ids = ids.join(',');
  180. this.getEntityList();
  181. },
  182. changeEntity(value){
  183. let entity = this.entityList.filter(obj => obj.id == value).pop();
  184. this.applyDate.entity = entity;
  185. },
  186. getEntityList(){
  187. sa.ajax('/TbEntity/getList', function(res) {
  188. this.entityList = res.data; // 数据
  189. }.bind(this));
  190. },
  191. getCustomer() {
  192. sa.ajax('/TbCostomer/getCurrentCustomer', function(resp) {
  193. this.currentCustomerId = resp.data.id;
  194. this.currentCustomerName = resp.data.name;
  195. this.applyDate.form.customerId = resp.data.id;
  196. this.applyDate.form.customerName = resp.data.name;
  197. }.bind(this));
  198. },
  199. // 刷新
  200. f5: function() {
  201. sa.ajax('/TbInvoiceOrder/getList', sa.removeNull(this.p), function(res) {
  202. this.dataList = res.data; // 数据
  203. this.dataCount = res.dataCount; // 数据总数
  204. sa.f5TableHeight(); // 刷新表格高度
  205. }.bind(this));
  206. },
  207. // 查看
  208. get: function(data) {
  209. sa.showIframe('数据详情', 'tb-invoice-order-info.html?id=' + data.id, '1200px', '90%');
  210. },
  211. // 查看 - 根据选中的
  212. getBySelect: function(data) {
  213. var selection = this.$refs['data-table'].selection;
  214. if(selection.length == 0) {
  215. return sa.msg('请选择一条数据')
  216. }
  217. this.get(selection[0]);
  218. },
  219. // 修改
  220. update: function(data) {
  221. sa.showIframe('修改数据', 'tb-invoice-order-add.html?id=' + data.id, '550px', '80%');
  222. },
  223. // 新增
  224. add: function(data) {
  225. sa.showIframe('新增数据', 'tb-invoice-order-add.html?id=-1&customerId=' + this.currentCustomerId, '550px', '60%');
  226. },
  227. // 删除
  228. del: function(data) {
  229. sa.confirm('是否删除,此操作不可撤销', function() {
  230. sa.ajax('/TbInvoiceOrder/delete?id=' + data.id, function(res) {
  231. sa.arrayDelete(this.dataList, data);
  232. sa.ok('删除成功');
  233. sa.f5TableHeight(); // 刷新表格高度
  234. }.bind(this))
  235. }.bind(this));
  236. },
  237. // 批量删除
  238. deleteByIds: function() {
  239. // 获取选中元素的id列表
  240. let selection = this.$refs['data-table'].selection;
  241. let ids = sa.getArrayField(selection, 'id');
  242. if(selection.length == 0) {
  243. return sa.msg('请至少选择一条数据')
  244. }
  245. // 提交删除
  246. sa.confirm('是否批量删除选中数据?此操作不可撤销', function() {
  247. sa.ajax('/TbInvoiceOrder/deleteByIds', {ids: ids.join(',')}, function(res) {
  248. sa.arrayDelete(this.dataList, selection);
  249. sa.ok('删除成功');
  250. sa.f5TableHeight(); // 刷新表格高度
  251. }.bind(this))
  252. }.bind(this));
  253. },
  254. },
  255. created: function() {
  256. this.f5();
  257. this.getCustomer();
  258. sa.onInputEnter();
  259. }
  260. })
  261. </script>
  262. </body>
  263. </html>