tb-invoice-order-list.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>开票订单表-列表</title>
  5. <meta charset="utf-8">
  6. <meta name="viewport"
  7. content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  8. <!-- 所有的 css & js 资源 -->
  9. <link rel="stylesheet" href="../../static/kj/element-ui/theme-chalk/index.css">
  10. <link rel="stylesheet" href="../../static/sa.css">
  11. <script src="../../static/kj/vue.min.js"></script>
  12. <script src="../../static/kj/element-ui/index.js"></script>
  13. <script src="../../static/kj/httpVueLoader.js"></script>
  14. <script src="../../static/kj/jquery.min.js"></script>
  15. <script src="../../static/kj/layer/layer.js"></script>
  16. <script src="../../static/sa.js"></script>
  17. </head>
  18. <style>
  19. .c1-label {
  20. width: 7em;
  21. color: #333;
  22. padding-right: 4px;
  23. display: inline-block;
  24. text-align: right;
  25. vertical-align: top;
  26. }
  27. .el-tooltip__popper {
  28. font-size: 14px;
  29. max-width: 40%
  30. }
  31. /* 设置显示隐藏部分内容,按40%显示 */
  32. </style>
  33. <body>
  34. <div class="vue-box" style="display: none;" :style="'display: block;'">
  35. <div class="c-panel">
  36. <!-- ------------- 检索参数 ------------- -->
  37. <div class="c-title">检索参数</div>
  38. <el-form ref="form" :model='p' @submit.native.prevent>
  39. <div class="c-item">
  40. <label class="c1-label">开票信息编号:</label>
  41. <el-input type="text" v-model="p.infoNo"></el-input>
  42. </div>
  43. <div class="c-item">
  44. <label class="c1-label">车牌号:</label>
  45. <el-input type="text" v-model="p.carNo"></el-input>
  46. </div>
  47. <div class="c-item">
  48. <label class="c1-label">客户名称:</label>
  49. <el-input type="text" v-model="p.customerName"></el-input>
  50. </div>
  51. <div class="c-item">
  52. <label class="c1-label">主体名称:</label>
  53. <el-input type="text" v-model="p.entityName"></el-input>
  54. </div>
  55. <div class="c-item">
  56. <label class="c-label">付款类型:</label>
  57. <el-select v-model="p.payType" placeholder="请选择" @change="f5()">
  58. <el-option label="全部" :value="0"></el-option>
  59. <el-option label="微信支付" :value="1"></el-option>
  60. <el-option label="预存款支付" :value="2"></el-option>
  61. </el-select>
  62. </div>
  63. <div class="c-item">
  64. <label class="c1-label">微信支付订单:</label>
  65. <el-input type="text" v-model="p.transactionId"></el-input>
  66. </div>
  67. <div class="c-item">
  68. <label class="c-label">开票状态:</label>
  69. <el-select v-model="p.status" placeholder="请选择" @change="f5()">
  70. <el-option label="不限" value=""></el-option>
  71. <el-option label="待申请" :value="0"></el-option>
  72. <el-option label="已申请" :value="1"></el-option>
  73. <el-option label="已开票" :value="2"></el-option>
  74. </el-select>
  75. </div>
  76. <el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
  77. <el-button size="mini" type="info" @click="sa.f5()">刷新</el-button>
  78. <br /><br />
  79. </el-form>
  80. <!-- ------------- 快捷按钮 ------------- -->
  81. <el-form ref="form" :model='p' @submit.native.prevent>
  82. <el-button style="display: inline;" type="primary" @click="add()">上传账单截图</el-button>
  83. <el-button style="display: inline;" type="primary" @click="applyFn()">申请开票</el-button>
  84. </el-form>
  85. <!-- ------------- 数据列表 ------------- -->
  86. <el-table class="data-table" ref="data-table" :data="dataList">
  87. <sa-td type="selection"></sa-td>
  88. <sa-td name="业务名称" prop="businessName" width="210px"></sa-td>
  89. <sa-td name="车牌号" prop="carNo" width="150px"></sa-td>
  90. <el-table-column label="业务订单号" width="150px">
  91. <template slot-scope="s">
  92. <el-tooltip :content="s.row.businessNo" placement="top" effect="light">
  93. <el-button class="keyButton">{{ s.row.businessNo }}</el-button>
  94. </el-tooltip>
  95. </template>
  96. </el-table-column>
  97. <el-table-column label="客户名称" width="190px">
  98. <template slot-scope="s">
  99. <el-tooltip :content="s.row.customerName" placement="top" effect="light">
  100. <el-button class="keyButton">{{ s.row.customerName }}</el-button>
  101. </el-tooltip>
  102. </template>
  103. </el-table-column>
  104. <el-table-column label="主体名称" width="190px">
  105. <template slot-scope="s">
  106. <el-tooltip v-if="s.row.entityName" :content="s.row.entityName" placement="top"
  107. effect="light">
  108. <el-button class="keyButton">{{ s.row.entityName }}</el-button>
  109. </el-tooltip>
  110. </template>
  111. </el-table-column>
  112. <sa-td name="微信支付订单号" prop="transactionId" width="210px" v-if="p.payType==0||p.payType==1"></sa-td>
  113. <sa-td name="账单金额" prop="billMoney"></sa-td>
  114. <el-table-column label="支付方式" width="100px">
  115. <template slot-scope="s">
  116. <label v-if="s.row.transactionId">微信支付</label>
  117. <label v-else>预存款支付</label>
  118. </template>
  119. </el-table-column>
  120. <sa-td name="账单截图" prop="billImage" type="img"></sa-td>
  121. <sa-td name="开票状态" prop="status" type="enum" :jv="{0: '待申请', 1: '已申请', 2: '已开票'}"></sa-td>
  122. <sa-td name="开票时间" prop="invoiceTime" width="100px"></sa-td>
  123. <sa-td name="开票信息" prop="infoNo" width="130"></sa-td>
  124. <el-table-column label="操作" fixed="right" width="140px">
  125. <template slot-scope="s">
  126. <el-button class="c-btn" type="success" icon="el-icon-view"
  127. @click="get(s.row)">查看</el-button>
  128. <el-button v-if="s.row.status==0" class="c-btn" type="danger" icon="el-icon-delete"
  129. @click="del(s.row)">删除</el-button>
  130. </template>
  131. </el-table-column>
  132. </el-table>
  133. <!-- ------------- 分页 ------------- -->
  134. <sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount"
  135. @change="f5()"></sa-item>
  136. </div>
  137. <el-dialog title="申请开票" :visible.sync="applyDate.visible" width="38%">
  138. <sa-item name="发票总额" v-model="applyDate.form.totalMoney" type="num" :disabled="true"></sa-item>
  139. <sa-item name="开票种类" v-model="applyDate.form.isElec" type="enum"
  140. :jv="{1: '电子普票', 0: '纸质普票', 2:'纸质专票'}"></sa-item>
  141. <div class="c-item">
  142. <label class="c-label">开票主体:</label>
  143. <el-select :disabled="selectDisabled" v-model="applyDate.form.entityId" placeholder="请选择" filterable @change="changeEntity">
  144. <el-option v-for="item in entityList" :key="item.id" :label="item.name" :value="item.id">
  145. </el-option>
  146. </el-select>
  147. </div>
  148. <sa-item type="text" name="企业名称" v-model="applyDate.entity.name" :disabled="true"></sa-item>
  149. <sa-item type="text" name="税号" v-model="applyDate.entity.taxIdNo" :disabled="true"></sa-item>
  150. <sa-item type="text" name="地址" v-model="applyDate.entity.address" :disabled="true"></sa-item>
  151. <sa-item type="text" name="电话" v-model="applyDate.entity.phone" :disabled="true"></sa-item>
  152. <sa-item type="text" name="开户银行" v-model="applyDate.entity.bank" :disabled="true"></sa-item>
  153. <sa-item type="text" name="银行账号" v-model="applyDate.entity.bankNo" :disabled="true"></sa-item>
  154. <span slot="footer" class="dialog-footer">
  155. <el-button @click="applyDate.visible = false">取 消</el-button>
  156. <el-button type="primary" @click="apply">确 定</el-button>
  157. </span>
  158. </el-dialog>
  159. </div>
  160. <script>
  161. var app = new Vue({
  162. components: {
  163. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
  164. "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
  165. },
  166. el: '.vue-box',
  167. data: {
  168. p: { // 查询参数
  169. id: '', // 主键 、
  170. payType: 0,
  171. customerId: '', // 客户id
  172. businessId: '', // 业务订单id
  173. businessName: '', // 业务名称
  174. customerName: '',
  175. entityName: '',
  176. businessNo: '', // 业务订单号
  177. carNo: '', //车牌号
  178. transactionId: '', // 微信支付订单号
  179. status: '', // 支付状态(0=未开票,1=已开票)
  180. invoiceTime: '', // 开票时间
  181. infoNo: '', // 开票信息no
  182. pageNo: 1, // 当前页
  183. pageSize: 10, // 页大小
  184. sortType: 0 // 排序方式
  185. },
  186. dataCount: 0,
  187. dataList: [], // 数据集合
  188. entityList: [],
  189. applyDate: {
  190. visible: false,
  191. form: {
  192. ids: '',
  193. entityId: '',
  194. isElec: 1,
  195. totalMoney: 0,
  196. customerId: '',
  197. customerName: '',
  198. },
  199. entity: {},
  200. },
  201. currentCustomerId: '1',
  202. currentCustomerName: '',
  203. selectDisabled:false
  204. },
  205. methods: {
  206. apply() {
  207. sa.checkNull(this.applyDate.form.entityId, '请选择 [主体信息]');
  208. sa.checkNull(this.applyDate.form.isElec, '请选择 [电子发票]');
  209. sa.ajax('/TbInvoiceInfo/generate', this.applyDate.form, function(res) {
  210. this.applyDate.visible = false;
  211. sa.alert('成功生成开票信息', this.f5);
  212. }.bind(this));
  213. },
  214. applyFn() {
  215. this.selectDisabled=false;
  216. this.applyDate.form={
  217. ids: '',
  218. entityId: '',
  219. isElec: 1,
  220. totalMoney: 0,
  221. customerId: this.applyDate.form.customerId,
  222. customerName: this.applyDate.form.customerName
  223. }
  224. let selection = this.$refs['data-table'].selection;
  225. if (selection.length == 0) {
  226. return sa.msg('请至少选择一条数据')
  227. }
  228. let ids = sa.getArrayField(selection, 'id');
  229. let entityName=selection[0].entityName;
  230. for (var i = 0; i < selection.length; i++) {
  231. if (selection[i].status == 1 || selection[i].status == 2) {
  232. return sa.msg('请选择待申请的订单')
  233. }
  234. if(selection[i].entityName!=entityName){
  235. return sa.msg('请选择同一个主体的订单进行开票');
  236. }
  237. }
  238. let billMoneys = sa.getArrayField(selection, 'billMoney');
  239. var totalMoney = 0;
  240. for (var i = billMoneys.length - 1; i >= 0; i--) {
  241. totalMoney += billMoneys[i];
  242. }
  243. if(selection[0].entityName){
  244. let entityArry=this.entityList.filter(obj=>obj.name==selection[0].entityName);
  245. if(entityArry.length==0){
  246. return sa.msg('开票主体缺少【'+selection[0].entityName+'】信息,请先录入主体信息');
  247. }
  248. this.applyDate.entity = entityArry[0];
  249. this.applyDate.form.entityId=entityArry[0].id;
  250. this.selectDisabled=true;
  251. }
  252. this.applyDate.form.totalMoney = totalMoney;
  253. this.applyDate.visible = true;
  254. this.applyDate.form.ids = ids.join(',');
  255. },
  256. changeEntity(value) {
  257. let entity = this.entityList.filter(obj => obj.id == value).pop();
  258. this.applyDate.entity = entity;
  259. },
  260. getEntityList() {
  261. sa.ajax('/TbEntity/getList',{pageNo:1,pageSize:100}, function(res) {
  262. this.entityList = res.data; // 数据
  263. }.bind(this));
  264. },
  265. getCustomer() {
  266. sa.ajax('/TbCostomer/getCurrentCustomer', function(resp) {
  267. this.currentCustomerId = resp.data.id;
  268. this.currentCustomerName = resp.data.name;
  269. this.applyDate.form.customerId = resp.data.id;
  270. this.applyDate.form.customerName = resp.data.name;
  271. }.bind(this));
  272. },
  273. // 刷新
  274. f5: function() {
  275. sa.ajax('/TbInvoiceOrder/getList', sa.removeNull(this.p), function(res) {
  276. this.dataList = res.data; // 数据
  277. this.dataCount = res.dataCount; // 数据总数
  278. sa.f5TableHeight(); // 刷新表格高度
  279. }.bind(this));
  280. },
  281. // 查看
  282. get: function(data) {
  283. sa.showIframe('数据详情', 'tb-invoice-order-info.html?id=' + data.id, '1200px', '90%');
  284. },
  285. // 查看 - 根据选中的
  286. getBySelect: function(data) {
  287. var selection = this.$refs['data-table'].selection;
  288. if (selection.length == 0) {
  289. return sa.msg('请选择一条数据')
  290. }
  291. this.get(selection[0]);
  292. },
  293. // 修改
  294. update: function(data) {
  295. sa.showIframe('修改数据', 'tb-invoice-order-add.html?id=' + data.id, '550px', '80%');
  296. },
  297. // 新增
  298. add: function(data) {
  299. sa.showIframe('新增数据', 'tb-invoice-order-add.html?id=-1&customerId=' + this.currentCustomerId,
  300. '550px', '60%');
  301. },
  302. // 删除
  303. del: function(data) {
  304. sa.confirm('是否删除,此操作不可撤销', function() {
  305. sa.ajax('/TbInvoiceOrder/delete?id=' + data.id, function(res) {
  306. sa.arrayDelete(this.dataList, data);
  307. sa.ok('删除成功');
  308. sa.f5TableHeight(); // 刷新表格高度
  309. }.bind(this))
  310. }.bind(this));
  311. },
  312. // 批量删除
  313. deleteByIds: function() {
  314. // 获取选中元素的id列表
  315. let selection = this.$refs['data-table'].selection;
  316. let ids = sa.getArrayField(selection, 'id');
  317. if (selection.length == 0) {
  318. return sa.msg('请至少选择一条数据')
  319. }
  320. // 提交删除
  321. sa.confirm('是否批量删除选中数据?此操作不可撤销', function() {
  322. sa.ajax('/TbInvoiceOrder/deleteByIds', {
  323. ids: ids.join(',')
  324. }, function(res) {
  325. sa.arrayDelete(this.dataList, selection);
  326. sa.ok('删除成功');
  327. sa.f5TableHeight(); // 刷新表格高度
  328. }.bind(this))
  329. }.bind(this));
  330. },
  331. },
  332. created: function() {
  333. this.f5();
  334. this.getCustomer();
  335. this.getEntityList();
  336. sa.onInputEnter();
  337. }
  338. })
  339. </script>
  340. </body>
  341. </html>