invoiceManagement.vue 8.4 KB

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