tb-invoice-order-list.html 11 KB

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