log.blade.php 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. @extends('layouts.base')
  2. @section('content')
  3. @section('title', trans('开票记录'))
  4. @include('Yunshop\Invoice::admin.mixins')
  5. <style scoped>
  6. .search-box{
  7. display: flex;
  8. flex-wrap: wrap;
  9. }
  10. .search-item{
  11. width: 240px;
  12. margin: 10px;
  13. }
  14. .fixed{
  15. /* width: calc(100% - 274px);
  16. margin-left: 0; */
  17. }
  18. </style>
  19. <div class="all">
  20. <div id="app" v-cloak>
  21. <box-item text="开票记录筛选">
  22. <div class="search-box">
  23. <template v-for="item in searchTag">
  24. <el-input class="search-item" v-model="search[item.model]" :placeholder="item.p" clearable v-if="item.type=='input'"></el-input>
  25. <el-select class="search-item" v-model="search[item.model]" :placeholder="item.p" clearable v-else>
  26. <el-option v-for="(select,i) in item.options" :key="i" :label="select.label" :value="select.value"></el-option>
  27. </el-select>
  28. </template>
  29. <el-date-picker style="margin: 10px;" v-model="elDate" type="datetimerange" :picker-options="pickerOptions" range-separator="至"
  30. start-placeholder="开始日期" end-placeholder="结束日期" align="right" @change="pickerDate" value-format="timestamp"><!--yyyy-MM-dd HH-mm-ss-->
  31. </el-date-picker>
  32. <el-button type="primary" style="margin: 10px;" icon="el-icon-search" @click="searchVal">搜索</el-button>
  33. </div>
  34. </box-item>
  35. <box-item text="开票记录列表">
  36. <el-table :data="tableData" style="width: 100%" align="center" v-loading="tableLoading">
  37. <el-table-column prop="order_sn" label="订单编号" width="180"></el-table-column>
  38. <el-table-column prop="invoice_number" label="发票号码" width="180"></el-table-column>
  39. <el-table-column prop="invoice_no" label="发票编号" width="180"></el-table-column>
  40. <el-table-column prop="invoice_type" label="发票类型">
  41. <template slot-scope="scope">
  42. [[scope.row.invoice_type==0?"电子发票":scope.row.invoice_type==1?"纸质发票":"专用发票"]]
  43. </template>
  44. </el-table-column>
  45. <el-table-column prop="collect_name" label="发票抬头"></el-table-column>
  46. <el-table-column prop="price" label="开票金额"></el-table-column>
  47. <el-table-column prop="invoicing_time" label="开票时间"></el-table-column>
  48. <el-table-column prop="member" label="开票会员">
  49. <template slot-scope="scope">
  50. <div v-if="scope.row.has_one_member">
  51. <img :src="scope.row.has_one_member.avatar" style="width:30px;height:30px;">
  52. <p>[[scope.row.has_one_member.nickname]]</p>
  53. </div>
  54. </template>
  55. </el-table-column>
  56. <el-table-column prop="status" label="发票状态">
  57. <template slot-scope="scope">开票[[scope.row.status==1?"成功":scope.row.status==0?"失败":"中" ]]</template>
  58. </el-table-column>
  59. <el-table-column fixed="right" label="操作" width="160">
  60. <template slot-scope="scope">
  61. <el-button @click.native.prevent="confirm('下载',scope.row)" type="text" size="small" v-if="scope.row.status==1">下载</el-button>
  62. <el-button @click.native.prevent="reason(scope.row)" type="text" size="small" v-if="scope.row.status==0">查看原因</el-button>
  63. <el-button @click.native.prevent="toOrderDetail(scope.row)" type="text" size="small">查看订单</el-button>
  64. <el-button @click.native.prevent="confirm('冲红',scope.row)" type="text" size="small" v-if="scope.row.status==1">冲红</el-button>
  65. </template>
  66. </el-table-column>
  67. </el-table>
  68. </box-item>
  69. <div class="fixed" v-if="tableTotal>0">
  70. <div class="fixed_box">
  71. <!-- :page-sizes="tablePageSizes" layout="total, sizes, prev, pager, next, jumper" -->
  72. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="tablePage" :page-size="tablePageSize"
  73. layout="total, prev, pager, next, jumper" :total="tableTotal" >
  74. </el-pagination>
  75. </div>
  76. </div>
  77. </div>
  78. </div>
  79. <script>
  80. const vm = new Vue({
  81. mixins:[tableMixins],
  82. data(){
  83. function onClick(day){
  84. return (picker)=>{
  85. const end = new Date();
  86. const start = new Date();
  87. start.setTime(start.getTime() - 3600 * 1000 * 24 * day);
  88. picker.$emit('pick', [start, end]);
  89. }
  90. }
  91. return {
  92. elDate:[],
  93. tableUrl:"{!!yzWebFullUrl('plugin.invoice.admin.invoicing-log.get-list')!!}",
  94. pickerOptions:{
  95. shortcuts:[
  96. {text: '最近一周',onClick:onClick(7)},
  97. {text: '最近一个月',onClick:onClick(30)},
  98. {text: '最近三个月',onClick:onClick(91)},
  99. {text: '最近半年',onClick:onClick(183)},
  100. ]},
  101. search:{
  102. member_id:"",
  103. member:"",
  104. invoice_number:"",
  105. order_sn:"",
  106. invoice_type:"",
  107. collect_name:"",
  108. status:"",
  109. start:"",
  110. end:""
  111. },
  112. searchTag:[
  113. {p:"会员Id",model:"member_id",type:"input"},
  114. {p:"会员昵称/姓名/手机号",model:"member",type:"input"},
  115. {p:"发票号码",model:"invoice_number",type:"input"},
  116. {p:"订单编号",model:"order_sn",type:"input"},
  117. {p:"发票类型",model:"invoice_type",type:"select",options:[{label:"电子发票",value:'-1'},{label:"纸质发票",value:1},{label:"专用发票",value:2}]},
  118. {p:"发票抬头",model:"collect_name",type:"input"},
  119. {p:"发票状态",model:"status",type:"select",options:[{label:"开票成功",value:1},{label:"开票失败",value:'-1'},{label: "开票中", value: 2}]},
  120. ],
  121. }
  122. },
  123. methods:{
  124. confirm(type,row){
  125. this.$confirm(`确定要${type}此条数据吗`, '提示', {
  126. confirmButtonText: '确定',
  127. cancelButtonText: '取消',
  128. type: 'warning'
  129. }).then(() => {
  130. if(type=="下载")this.download(row.invoice_no);
  131. else if(type=="冲红") this.rushRed(row.order_id)
  132. }).catch(()=>{})
  133. },
  134. pickerDate(data){
  135. if (data===null) {
  136. this.search.start = "";
  137. this.search.end = "";
  138. }else{
  139. this.search.start = parseInt(data[0] / 1000);
  140. this.search.end = parseInt(data[1] / 1000);
  141. }
  142. },
  143. rushRed(order_id){
  144. this.$http.post("{!!yzWebFullUrl('plugin.invoice.admin.invoicing-log.rush-red')!!}",{order_id}).then(({data:{result,msg="",data}})=>{
  145. if(result==1){
  146. this.$message.success(msg);
  147. this.last_page = "";
  148. this.tablePage = 1;
  149. this.getTableData();
  150. }
  151. else this.$message.error(msg)
  152. })
  153. },
  154. download(invoice_sn){
  155. console.log(invoice_sn);
  156. this.$http.post("{!!yzWebFullUrl('plugin.invoice.admin.invoicing-log.go-download')!!}",{invoice_sn}).then(({data:{result,msg="",data}})=>{
  157. if(result==1){
  158. // this.$message.success("下载成功");
  159. window.location.href=data.pdf
  160. this.last_page = "";
  161. this.tablePage = 1;
  162. this.getTableData();
  163. }
  164. else this.$message.error(msg)
  165. })
  166. },
  167. reason({error_msg}){
  168. this.$alert(error_msg, '查看原因', {
  169. confirmButtonText: '确定',
  170. callback: action => {
  171. // this.$message({
  172. // type: 'info',
  173. // message: `action: ${ action }`
  174. // });
  175. }
  176. });
  177. },
  178. toOrderDetail({order_id}){
  179. let url = "{!!yzWebFullUrl('order.detail.vue-index')!!}";
  180. url += "&order_id=" + order_id;
  181. url += "&id=" + order_id;
  182. window.location.href = url;
  183. },
  184. }
  185. })
  186. </script>
  187. @endsection('content')