您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

invoiceList.vue 6.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. <template>
  2. <view class="wrap">
  3. <view>
  4. <view class="item last">
  5. <text>状态:</text>
  6. <uni-data-select v-model="state.status" :localdata="state.statusData"
  7. @change="statusChange"></uni-data-select>
  8. </view>
  9. <view class="item last">
  10. <text>订单类型:</text>
  11. <uni-data-select v-model="state.orderType" :localdata="state.orderTypeData"
  12. @change="orderTypeChange"></uni-data-select>
  13. <button size="mini" style="color: #ffffff;
  14. backgroundColor: rgb(118, 200, 77);
  15. borderColor: rgb(118, 200, 77);
  16. font-size: 26rpx;
  17. flex-shrink: 0;margin-left: 20rpx;" @click="search">查询</button>
  18. </view>
  19. </view>
  20. </view>
  21. <view class="listbox" v-if="state.data.length>0">
  22. <view class="card-no-active" v-for="(item,index) in state.data">
  23. <view class="content">
  24. <view class="row">
  25. 订单类型:<text>{{item.invoiceTypeName}}</text>
  26. </view>
  27. <view class="row">
  28. 车牌号:<text>{{item.remarks}}</text>
  29. </view>
  30. <view class="row">
  31. 发票抬头:<text>{{item.buyerName}}</text>
  32. </view>
  33. <view class="row">
  34. 状态:<text>{{item.status==1?'正常':"红冲"}}</text>
  35. </view>
  36. <view class="row">
  37. 商品价:<text>¥{{item.goodsAmount}}</text>
  38. </view>
  39. <view class="row">
  40. 开票日期:<text>{{item.invoiceOpenTime}}</text>
  41. </view>
  42. </view>
  43. <view class="btns">
  44. <button @click="down(item.fileUrl)">下载</button>
  45. </view>
  46. </view>
  47. <!-- <view class="bottom-line" v-if="state.flags">我是有底线的~~~</view> -->
  48. </view>
  49. <view v-else class="listbox" style="text-align: center;font-size: 32rpx;">
  50. 暂无数据
  51. </view>
  52. </template>
  53. <script setup lang="ts">
  54. import {
  55. reactive
  56. } from "vue";
  57. import { onLoad, onReachBottom } from "@dcloudio/uni-app";
  58. import { billQueryBill } from "@/utils/network/api.js";
  59. import { requestNew } from "@/utils/network/request.js";
  60. const state = reactive({
  61. userMobile: "",
  62. pageNumber: 1,
  63. pageSize: 10,
  64. status: 1,
  65. statusData: [{
  66. 'value': 1,
  67. 'text': '正常'
  68. }, {
  69. 'value': -1,
  70. 'text': '红冲'
  71. }],
  72. orderType: 1,
  73. orderTypeData: [{
  74. 'value': 1,
  75. 'text': 'ETC服务'
  76. }, {
  77. 'value': 2,
  78. 'text': '通行服务费'
  79. }],
  80. data: [],
  81. flags: false,
  82. })
  83. onLoad((options) => {
  84. state.userMobile = options.userMobile
  85. query(1)
  86. })
  87. const search = () => {
  88. query(1)
  89. }
  90. const query = (val) => {
  91. if (val == 1) {
  92. state.pageNumber = 1
  93. }
  94. if (state.pageNumber == 1 && state.data.length > 0) {
  95. state.data = []
  96. }
  97. const options = {
  98. type: 2,
  99. data: {
  100. userMobile: state.userMobile,
  101. pageNumber: state.pageNumber,
  102. pageSize: state.pageSize,
  103. status: state.status,
  104. orderType: state.orderType,
  105. },
  106. method: "POST",
  107. showLoading: true,
  108. };
  109. requestNew(billQueryBill, options).then((res) => {
  110. const data = res;
  111. state.data = data.invoices
  112. console.log(data, "通行");
  113. });
  114. }
  115. const statusChange = (e) => {
  116. state.status = e
  117. }
  118. const orderTypeChange = (e) => {
  119. state.orderType = e
  120. }
  121. // 触底加载
  122. onReachBottom(() => {
  123. if (state.data.length < state.pageNumber * 10) return state.flags = true
  124. console.log("触底了")
  125. state.pageNumber++
  126. query(2)
  127. })
  128. const down = (fileUrl) => {
  129. uni.downloadFile({
  130. url: fileUrl, //仅为示例,并非真实的资源
  131. success: (data) => {
  132. if (data.statusCode === 200) {
  133. uni.saveFile({ //文件保存到本地
  134. tempFilePath: data.tempFilePath, //临时路径
  135. success: function (res) {
  136. console.log("下载成功" + res.savedFilePath)
  137. console.log(JSON.stringify(res))
  138. uni.showToast({
  139. icon: 'none',
  140. mask: true,
  141. title: '文件已保存!',
  142. duration: 3000,
  143. });
  144. uni.openDocument({
  145. //fileType: 'docx',
  146. showMenu: true, //关键点,可以转发到微信
  147. filePath: res.savedFilePath,
  148. success: function (res) {
  149. console.log('打开文档成功');
  150. }
  151. });
  152. }
  153. });
  154. }
  155. }
  156. });
  157. }
  158. </script>
  159. <style>
  160. page {
  161. width: 100%;
  162. height: 100%;
  163. }
  164. </style>
  165. <style lang="scss" scoped>
  166. .listbox {
  167. height: 100%;
  168. background-color: #EEF7F7;
  169. padding: 30rpx;
  170. border-top: 1rpx solid #DFDFDF;
  171. margin-top: 200rpx;
  172. .card-no-active {
  173. margin-bottom: 30rpx;
  174. height: 438rpx;
  175. background: #FFFFFF;
  176. box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
  177. border-radius: 20rpx;
  178. display: flex;
  179. flex-direction: column;
  180. .head {
  181. display: flex;
  182. padding: 30rpx;
  183. align-items: center;
  184. border-bottom: 1px solid #DCDCDC;
  185. image {
  186. width: 48rpx;
  187. height: 48rpx;
  188. }
  189. text {
  190. font-size: 30rpx;
  191. font-family: Noto Sans S Chinese;
  192. font-weight: 400;
  193. color: #333333;
  194. }
  195. }
  196. .content {
  197. margin: 30rpx;
  198. margin-bottom: 0;
  199. border-bottom: 1rpx solid #DCDCDC;
  200. .row {
  201. font-size: 26rpx;
  202. font-family: Noto Sans S Chinese;
  203. font-weight: 400;
  204. color: #999999;
  205. margin-bottom: 20rpx;
  206. text {
  207. font-size: 26rpx;
  208. font-family: Noto Sans S Chinese;
  209. font-weight: 400;
  210. color: #333333;
  211. }
  212. }
  213. }
  214. .btns {
  215. flex: 1;
  216. display: flex;
  217. align-items: center;
  218. justify-content: flex-end;
  219. padding: 0 30rpx;
  220. button {
  221. margin: 0;
  222. display: inline-block;
  223. height: 61rpx;
  224. background: #FFFFFF;
  225. border: 1px solid #00B38B;
  226. border-radius: 30rpx;
  227. font-size: 26rpx;
  228. font-family: Noto Sans S Chinese;
  229. font-weight: 400;
  230. color: #00B38B;
  231. line-height: 61rpx;
  232. }
  233. }
  234. }
  235. .card-active {
  236. height: 375rpx;
  237. background: #FFFFFF;
  238. box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
  239. border-radius: 20rpx;
  240. display: flex;
  241. flex-direction: column;
  242. .head {
  243. display: flex;
  244. padding: 30rpx;
  245. align-items: center;
  246. border-bottom: 1px solid #DCDCDC;
  247. image {
  248. width: 48rpx;
  249. height: 48rpx;
  250. }
  251. text {
  252. font-size: 30rpx;
  253. font-family: Noto Sans S Chinese;
  254. font-weight: 400;
  255. color: #333333;
  256. }
  257. .status {
  258. position: absolute;
  259. right: 35px;
  260. font-size: 26rpx;
  261. font-family: Noto Sans S Chinese;
  262. font-weight: 400;
  263. color: #777777;
  264. }
  265. }
  266. .content {
  267. margin: 30rpx;
  268. .row {
  269. font-size: 26rpx;
  270. font-family: Noto Sans S Chinese;
  271. font-weight: 400;
  272. color: #999999;
  273. margin-bottom: 20rpx;
  274. text {
  275. font-size: 26rpx;
  276. font-family: Noto Sans S Chinese;
  277. font-weight: 400;
  278. color: #333333;
  279. }
  280. }
  281. }
  282. }
  283. }
  284. .item {
  285. display: flex;
  286. font-size: 30rpx;
  287. margin-top: 10rpx;
  288. align-items: center;
  289. }
  290. .wrap {
  291. padding: 10rpx 20rpx;
  292. box-sizing: border-box;
  293. // display: flex;
  294. // justify-content: space-evenly;
  295. position: fixed;
  296. left: 0;
  297. top: 0;
  298. background-color: white;
  299. width: 100%;
  300. }
  301. .bottom-line {
  302. text-align: center;
  303. margin: 30rpx 0;
  304. }
  305. </style>