settlement.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. <template>
  2. <view>
  3. <ujp-navbar title="财务单列表">
  4. </ujp-navbar>
  5. <view class="modal" >
  6. <u-picker v-model="showTimePicker"
  7. @confirm="confirmTimePicker" @cancel="showTime=true"
  8. mode="time" :params="params" ></u-picker>
  9. <u-modal v-model="showTime" title="请选择生成时间"
  10. @confirm="confirmmodal"
  11. :show-cancel-button="true" confirm-text="生成结算单" cancel-text="取消">
  12. <view class="infos">
  13. <view class="item">
  14. <view class="name">
  15. 开始时间
  16. </view>
  17. <view class="content" @click="TimeKey='A',showTimePicker=true,showTime=false">
  18. {{defaultTimeA?defaultTimeA:'请选择开始时间'}}
  19. <u-icon name="arrow-right"></u-icon>
  20. </view>
  21. </view>
  22. <view class="item">
  23. <view class="name">
  24. 结束时间
  25. </view>
  26. <view class="content" @click="TimeKey='B',showTimePicker=true,showTime=false">
  27. {{defaultTimeB?defaultTimeB:'请选择结束时间'}}
  28. <u-icon name="arrow-right"></u-icon>
  29. </view>
  30. </view>
  31. </view>
  32. </u-modal>
  33. </view>
  34. <view class="main">
  35. <view class="item" v-for="(item ,index) in list" :key="index" >
  36. <view class="item1" >{{item.title}}</view>
  37. <view class="item2" >生成时间:{{item.createTime}}</view>
  38. <view class="item3" >
  39. <view class="item31" >
  40. <view class="item311" >
  41. 总金额
  42. </view>
  43. <view class="item312" >
  44. {{item.totalAmount}}元
  45. </view>
  46. </view>
  47. <view class="item31" >
  48. <view class="item311" >
  49. 电量
  50. </view>
  51. <view class="item312" >
  52. {{item.electricQuantity/ 10000}}度
  53. </view>
  54. </view>
  55. <view class="item31" >
  56. <view class="item311" >
  57. 服务费
  58. </view>
  59. <view class="item312" >
  60. {{item.servicePrice}}元
  61. </view>
  62. </view>
  63. </view>
  64. <view class="item4" >
  65. <view class="item41 item411" @click="down(item.settlementUrl)" >
  66. <img src="@/assets/img/riLine-file-download-line-2.svg"></img>
  67. 下载结算单
  68. </view>
  69. <view class="item41 item412" @click="down(item.recordUrl)" >
  70. <img src="@/assets/img/riLine-file-download-line-1.svg"></img>
  71. 下载充电明细
  72. </view>
  73. </view>
  74. </view>
  75. </view>
  76. <view style="text-align: center;margin-top: 100px" v-if="!list.length">
  77. <img src="@/assets/img/blankpage.png">
  78. <view>查询为空</view>
  79. </view>
  80. <u-button type="primary" @click="showTime=true" >生成结算单</u-button>
  81. </view>
  82. </template>
  83. <script>
  84. import * as API from '@/apis/invoiceApi.js'
  85. export default {
  86. data() {
  87. return {
  88. list:[],
  89. id:"",
  90. pageIndex: 1,
  91. recordsTotal: 0,
  92. showTime:false,
  93. showsheet:false,
  94. showTimePicker:false,
  95. TimeKey:"",
  96. defaultTimeA:'',
  97. defaultTimeB:'',
  98. params: {
  99. year: true,
  100. month: true,
  101. day: true,
  102. hour: false,
  103. minute: false,
  104. second: false
  105. },
  106. }
  107. },
  108. onReachBottom() {
  109. this.myLoadmore();
  110. },
  111. onLoad(op) {
  112. this.id=op.id
  113. },
  114. onReady() {
  115. this.getList()
  116. },
  117. methods: {
  118. down(url){
  119. if(url){
  120. window.location.href = url
  121. }else{
  122. uni.showToast({
  123. title:"下载异常"
  124. })
  125. }
  126. },
  127. confirmmodal(){
  128. if(!this.defaultTimeA){
  129. uni.showToast({
  130. title:"请选择开始时间"
  131. })
  132. this.showTime=true
  133. return
  134. }
  135. if(!this.defaultTimeB){
  136. uni.showToast({
  137. title:"请选择结束时间"
  138. })
  139. this.showTime=true
  140. return
  141. }
  142. if(this.defaultTimeA>this.defaultTimeB){
  143. uni.showToast({
  144. title:"结束时间需要大于开始时间"
  145. })
  146. this.showTime=true
  147. return
  148. }
  149. this.generateFinanceSettlementApi()
  150. },
  151. confirmTimePicker(e){
  152. var time=e.year+'-'+e.month+'-'+e.day
  153. if(this.TimeKey=='A'){
  154. this.defaultTimeA=time
  155. }
  156. if(this.TimeKey=='B'){
  157. this.defaultTimeB=time
  158. }
  159. this.showTime=true
  160. },
  161. generateFinanceSettlementApi(){
  162. uni.showLoading({
  163. title: "加载中",
  164. mask: true,
  165. })
  166. API.generateFinanceSettlement({
  167. entAccountId:this.id,
  168. startMonth:this.defaultTimeA,
  169. endMonth:this.defaultTimeB,
  170. }).then((res) => {
  171. uni.showModal({
  172. showCancel:false,
  173. title: '提示',
  174. content: '生成结算单成功',
  175. success: function (res) {
  176. }
  177. });
  178. this.pageIndex=1;
  179. this.list=[]
  180. this.getList()
  181. }).catch(error => {
  182. this.showTime=true
  183. uni.showToast({
  184. title: error
  185. })
  186. })
  187. },
  188. getList() {
  189. uni.showLoading({
  190. title: "加载中",
  191. mask: true,
  192. })
  193. var form={}
  194. form.entAccountId=this.id
  195. form.pageIndex=this.pageIndex
  196. form.pageSize=20
  197. API.financeSettlementList(form).then((res) => {
  198. this.list = [
  199. ...this.list,
  200. ...res.data.data
  201. ];
  202. this.recordsTotal = res.data.recordsTotal
  203. uni.hideLoading()
  204. }).catch(error => {
  205. uni.showToast({
  206. title: error
  207. })
  208. })
  209. },
  210. myLoadmore() {
  211. if (this.list.length < this.recordsTotal) {
  212. this.pageIndex += 1;
  213. this.getList()
  214. }
  215. }
  216. }
  217. }
  218. </script>
  219. <style>
  220. page{
  221. background-color: #F7F7F7;
  222. }
  223. </style>
  224. <style lang="scss" scoped >
  225. .main{
  226. padding-bottom: 60px;
  227. .item{
  228. border-radius: 12px;
  229. background-color: rgba(255, 255, 255, 1);
  230. color: rgba(16, 16, 16, 1);
  231. font-size: 28rpx;
  232. margin: 24rpx;
  233. padding: 24rpx;
  234. .item1{
  235. color: rgba(16, 16, 16, 1);
  236. font-size: 36rpx;
  237. font-weight: bold;
  238. }
  239. .item2{
  240. color: rgba(153, 153, 153, 1);;
  241. font-size: 24rpx;
  242. }
  243. .item3{
  244. margin-top: 24rpx;
  245. display: flex;
  246. justify-content: space-between;
  247. .item31{
  248. width: 30%;
  249. .item311{
  250. color: rgba(102, 102, 102, 1);
  251. font-size: 24rpx;
  252. }
  253. .item312{
  254. color: rgba(51, 51, 51, 1);
  255. font-size: 28rpx;
  256. font-weight: bold;
  257. }
  258. }
  259. }
  260. .item4{
  261. margin-top: 24rpx;
  262. display: flex;
  263. justify-content: space-between;
  264. img{
  265. width: 32rpx;height: 32rpx;
  266. }
  267. font-size: 28rpx;
  268. .item41{
  269. width: 45%;
  270. padding:16rpx ;
  271. display: flex;
  272. align-items: center;
  273. justify-content: center;
  274. border-radius: 12px;
  275. }
  276. .item411{
  277. border: 1px solid rgba(22, 119, 255, 1);
  278. color:rgba(22, 119, 255, 1);
  279. }
  280. .item412{
  281. border: 1px solid rgba(0, 167, 89, 1);;
  282. color:rgba(0, 167, 89, 1);
  283. }
  284. }
  285. }
  286. }
  287. .u-btn{
  288. margin: 0 16px;
  289. position: fixed;
  290. bottom: 12px;
  291. left: 0;
  292. right: 0;
  293. height: 44px;
  294. line-height: 44px;
  295. border-radius: 8px;
  296. background-color: rgba(24, 90, 198, 100);
  297. color: rgba(255, 255, 255, 100);
  298. }
  299. // 弹窗
  300. .modal {
  301. background-color: #101010;
  302. .title {
  303. line-height: 20px;
  304. padding: 18px 52px;
  305. background-image: linear-gradient(rgb(0, 217, 115), #00A457);
  306. color: #fff;
  307. text-align: center;
  308. }
  309. .infos {
  310. padding: 20px 14px;
  311. .item {
  312. white-space: pre;
  313. line-height: 28px;
  314. display: flex;
  315. justify-content: space-between;
  316. color: #666666;
  317. font-size: 16px
  318. }
  319. .content{
  320. color: #000;
  321. }
  322. .hint {
  323. color: rgba(238, 49, 56, 100);
  324. margin-top: 16px;
  325. font-size: 14px
  326. }
  327. }
  328. }
  329. </style>