invoiceManagement.vue 10.0 KB

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