invoiceManagement.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426
  1. <template>
  2. <view >
  3. <ujp-navbar title="收款账户">
  4. <text class="management" @click="gotoUrl('pages/MyInvoice/invoiceTitleManagement')">抬头管理</text>
  5. </ujp-navbar>
  6. <u-tabs inactive-color="#888888" active-color="#101010" :list="list" :is-scroll="true"
  7. :current="current" @change="change"></u-tabs>
  8. <view class="carNone" v-if="list[current].list.length == 0">
  9. <img src="static/img/暂无数据-缺省页.png" alt="">
  10. <p class="oldTextjp2" oldstyle="font-size: 18px;">暂无记录</p>
  11. </view>
  12. <!-- 未开票 -->
  13. <view class="not-invoiced" v-show="current==0">
  14. <view class="not-invoiced-item flex" v-for="(item,index) in list[0].list" :key="index">
  15. <view class="radio">
  16. <u-checkbox v-model="item.ck" @change="changeitem($event,item)" ></u-checkbox>
  17. </view>
  18. <view class="content oldTextjp2"
  19. oldstyle="font-size: 14px;"
  20. @click="submit(item.id)">
  21. <view class="title">
  22. {{item.stationName}} <text class="price">{{item.actualFee?item.actualFee.toFixed(2):'0.00'}}元</text>
  23. </view>
  24. <p><text class="text-1">充电电量</text> <text class="text-2">{{item.electricQuantity/10000}}度</text></p>
  25. <p><text class="text-1">开始时间</text> <text class="text-2">{{item.startTime?item.startTime:item.endTime}}</text></p>
  26. <p><text class="text-1">结束时间</text> <text class="text-2">{{item.endTime}}</text></p>
  27. <p><text class="text-1">车牌号</text> <text class="text-2">{{item.carNumber}}</text></p>
  28. </view>
  29. </view>
  30. <p class="tips" v-if="list[current].list.length == list[current].recordsTotal && list[current].recordsTotal != 0" > 已经到底了</p>
  31. <view class="bottom">
  32. <view class="radio">
  33. <u-checkbox v-model="allck" @change="allckBtn"></u-checkbox>
  34. </view>
  35. <view class="check-all">
  36. 全选
  37. </view>
  38. <view class="total">
  39. <p class="total-price">共<text style="color: #FF7300;" >{{sumActualFee.toFixed(2)}}元</text></p>
  40. <p class="order">{{selectcount}}个订单</p>
  41. </view>
  42. <u-button type="success" @click="submit()" shape="circle">去开票</u-button>
  43. </view>
  44. </view>
  45. <!-- 已开票 -->
  46. <view class="invoiced" v-show="current==1">
  47. <view class="invoiced-item" v-for="(item,index) in list[1].list" :key="index" @click="view(item.id)" >
  48. <view class="content oldTextjp2"
  49. oldstyle="font-size: 14px;" >
  50. <view class="title">
  51. {{item.stationName}} <text :class="{
  52. invoice:item.status==1,
  53. 'have-invoiced':item.status==2
  54. }">{{item.statusText}}</text>
  55. </view>
  56. <p><text class="text-1">发票金额</text> <text class="text-2">{{item.amount?item.amount.toFixed(2):0}}元</text></p>
  57. <p><text class="text-1">发票抬头</text><text class="text-2">{{item.title}}</text></p>
  58. <p><text class="text-1">申请时间</text> <text class="text-2">{{item.createTime}}</text></p>
  59. </view>
  60. </view>
  61. <!-- <view class="invoiced-item">
  62. <view class="content">
  63. <view class="title">
  64. 玉桥公园充电站 <text class="have-invoiced">开票成功</text>
  65. </view>
  66. <p><text>发票抬头</text> <text class="text-2">50.00元</text></p>
  67. <p><text class="text-1">发票抬头</text> <text class="text-2">刘德华</text></p>
  68. <p><text class="text-1">申请时间</text> <text class="text-2">2022-06-23 16:00:00</text></p>
  69. </view>
  70. </view> -->
  71. <p class="tips"> 仅展示最近12个月的发票信息</p>
  72. </view>
  73. </view>
  74. </template>
  75. <script>
  76. import * as API from '@/apis/invoiceApi.js'
  77. export default {
  78. data() {
  79. return {
  80. allck:false,
  81. list: [{
  82. value:0,
  83. name: '未开发票',
  84. pageIndex: 1,
  85. recordsTotal: 0,
  86. list:[],
  87. }, {
  88. value:1,
  89. name: '已开发票',
  90. pageIndex: 1,
  91. recordsTotal: 0,
  92. list:[],
  93. }],
  94. current: 0,
  95. }
  96. },
  97. onReachBottom() {
  98. var list=this.list[this.current].list;
  99. var recordsTotal=this.list[this.current].recordsTotal;
  100. if (list.length < recordsTotal) {
  101. this.myLoadmore();
  102. }
  103. },
  104. onShow(){
  105. this.getlist(true);
  106. },
  107. computed:{
  108. sumActualFee(){
  109. var list=this.list[0].list;
  110. var sum=0;
  111. for(var i in list ){
  112. var obj=list[i];
  113. if(obj.ck){
  114. sum+=obj.actualFee*100
  115. }
  116. }
  117. return sum/100
  118. },
  119. selectIds(){
  120. var list=this.list[0].list;
  121. var sz=[]
  122. for(var i in list ){
  123. var obj=list[i];
  124. if(obj.ck){
  125. sz.push(obj.id);
  126. }
  127. }
  128. return sz.join();
  129. },
  130. selectcount(){
  131. var list=this.list[0].list;
  132. var count=0
  133. for(var i in list ){
  134. var obj=list[i];
  135. if(obj.ck){
  136. count++;
  137. }
  138. }
  139. return count;
  140. }
  141. },
  142. methods: {
  143. view(id){
  144. uni.navigateTo({
  145. url:"/pages/MyInvoice/invoiceDetail?id="+id
  146. })
  147. },
  148. changeitem(e,item){
  149. item.ck=e.value
  150. if(!e.value){
  151. this.allck=false
  152. }
  153. },
  154. allckBtn(e){
  155. console.log(e.value)
  156. var list=this.list[0].list;
  157. if(e.value){
  158. for(var i in list ){
  159. var obj=list[i];
  160. if(obj.ck){
  161. }else{
  162. obj.ck=true
  163. }
  164. }
  165. this.$forceUpdate()
  166. }
  167. },
  168. getlist(bl) {
  169. uni.showLoading({
  170. title: "加载中",
  171. mask: true,
  172. })
  173. var current=this.current;
  174. var pageIndex=this.list[current].pageIndex;
  175. var list=this.list[current].list;
  176. if (bl) {
  177. list = [];
  178. this.list[current].pageIndex=1;
  179. pageIndex = 1;
  180. }
  181. API.invoiceList({
  182. pageIndex: pageIndex,
  183. status:current,
  184. }).then((res) => {
  185. uni.hideLoading();
  186. var datalist=[]
  187. // if(current==0){
  188. // datalist=res.data.station;
  189. // }
  190. // if(current==1){
  191. // datalist=res.data.data;
  192. // }
  193. datalist=res.data.data;
  194. for(var i in datalist){
  195. var obj=datalist[i]
  196. obj.ck=false;
  197. this.allck=false;
  198. }
  199. this.list[current].list = [
  200. ...list,
  201. ...datalist
  202. ];
  203. this.list[current].recordsTotal = res.data.recordsTotal;
  204. }).catch(error => {
  205. uni.showToast({
  206. title: error,
  207. icon: "none"
  208. })
  209. })
  210. },
  211. myLoadmore() {
  212. var pageIndex=this.list[this.current].pageIndex;
  213. pageIndex += 1;
  214. this.list[this.current].pageIndex=pageIndex;
  215. this.getlist()
  216. },
  217. change(index) {
  218. this.current = index;
  219. var list =this.list[this.current].list
  220. this.getlist(true);
  221. },
  222. submit(id){
  223. if(!id){
  224. id=this.selectIds
  225. }
  226. if(!id){
  227. uni.showToast({
  228. title:"请至少勾选一条记录"
  229. })
  230. return
  231. }
  232. uni.navigateTo({
  233. url:'/pages/MyInvoice/issueInvoice?ids='+id
  234. })
  235. }
  236. },
  237. }
  238. </script>
  239. <style lang="scss" scoped>
  240. .carNone{
  241. display: flex;
  242. flex-direction: column;
  243. justify-content: center;
  244. align-items: center;
  245. img{
  246. width: 100%;
  247. height: 100%;
  248. }
  249. p{
  250. margin-top: -60px;
  251. }
  252. }
  253. page{
  254. padding-bottom: 100px;
  255. }
  256. .management{
  257. position: absolute;
  258. right: 16px;
  259. font-size: 12px
  260. }
  261. /deep/.u-scroll-box{
  262. width: 65.8% !important;
  263. margin: 0 auto;
  264. display: flex;
  265. }
  266. /deep/.u-tab-bar{
  267. width: 24% !important;
  268. left: -8% !important;
  269. background-color: #00B962 !important; }
  270. // 未开票
  271. .flex{
  272. display: flex;
  273. }
  274. .not-invoiced-item,.invoiced-item{
  275. width: 91.4%;
  276. border-radius: 12px;
  277. background-color: rgba(255, 255, 255, 100);
  278. border: 1px solid rgba(235, 235, 235, 100);
  279. padding: 16px 0;
  280. padding-left: 18px;
  281. margin:12px auto;
  282. }
  283. .content{
  284. width: 100%;
  285. margin-left: 4px;
  286. .title{
  287. line-height: 18px;
  288. color: rgba(16, 16, 16, 100);
  289. font-size: 16px;
  290. margin-bottom: 12px;
  291. padding-right: 12px;
  292. display: flex;
  293. justify-content: space-between;
  294. .price,.invoice,.have-invoiced{
  295. height: 18px;
  296. color: rgba(255, 61, 0, 100);
  297. font-size: 18px;
  298. }
  299. }
  300. p{
  301. color: rgba(102, 102, 102, 100);
  302. line-height: 26px;
  303. }
  304. .text-1{
  305. display: inline-block;
  306. width: 22vw;
  307. color: #666666;
  308. }
  309. .text-2{
  310. display: inline-block;
  311. margin-left:4px;
  312. width:50vw;
  313. color: #101010;
  314. }
  315. // .order-box{
  316. // display: flex;
  317. // .order{
  318. // width: 17vw;
  319. // }
  320. // .order-num{
  321. // width:55vw;
  322. // margin-left:4px;
  323. // overflow: hidden;
  324. // white-space: nowrap;
  325. // text-overflow: ellipsis;
  326. // }
  327. // }
  328. }
  329. .radio{
  330. margin: auto 0;
  331. /deep/.uni-radio-input{
  332. width: 20px !important;
  333. height: 20px !important;
  334. }
  335. }
  336. .bottom{
  337. width: 100%;
  338. padding: 14px 13px;
  339. background-color: rgba(255, 255, 255, 100);
  340. position: fixed;
  341. bottom: 0;
  342. left: 0;
  343. display: flex;
  344. .check-all{
  345. font-size: 16px;
  346. margin: auto 5px;
  347. }
  348. .total{
  349. flex: 1;
  350. // margin-left: 80px;
  351. text-align: right;
  352. .total-price{
  353. font-size:16px
  354. }
  355. .order{
  356. font-size: 12px;
  357. }
  358. }
  359. /deep/.u-btn{
  360. width: 27.7%;
  361. line-height: 40px;
  362. font-size: 18px;
  363. margin-left:20px;
  364. }
  365. }
  366. .invoice{
  367. color: rgba(255, 97, 0, 100) !important;
  368. }
  369. .have-invoiced{
  370. color: rgba(0, 185, 98, 100) !important;
  371. }
  372. .tips{
  373. color: rgba(153, 153, 153, 100);
  374. text-align: center;
  375. }
  376. </style>