invoiceManagement.vue 11 KB

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