You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

invoiceList.vue 6.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  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. console.log("state.data",state.data)
  95. if (state.pageNumber == 1 && state.data.length > 0) {
  96. state.data = []
  97. }
  98. const options = {
  99. type: 2,
  100. data: {
  101. userMobile: state.userMobile,
  102. pageNumber: state.pageNumber,
  103. pageSize: state.pageSize,
  104. status: state.status,
  105. orderType: state.orderType,
  106. },
  107. method: "POST",
  108. showLoading: true,
  109. };
  110. requestNew(billQueryBill, options).then((res) => {
  111. const data = res;
  112. // 有数据才赋值
  113. if(Boolean(data.invoices)){
  114. state.data = data.invoices
  115. }
  116. console.log(data, "通行");
  117. });
  118. }
  119. const statusChange = (e) => {
  120. state.status = e
  121. }
  122. const orderTypeChange = (e) => {
  123. state.orderType = e
  124. }
  125. // 触底加载
  126. onReachBottom(() => {
  127. if (state.data.length < state.pageNumber * 10) return state.flags = true
  128. console.log("触底了")
  129. state.pageNumber++
  130. query(2)
  131. })
  132. const down = (fileUrl) => {
  133. uni.downloadFile({
  134. url: fileUrl, //仅为示例,并非真实的资源
  135. success: (data) => {
  136. if (data.statusCode === 200) {
  137. uni.saveFile({ //文件保存到本地
  138. tempFilePath: data.tempFilePath, //临时路径
  139. success: function (res) {
  140. console.log("下载成功" + res.savedFilePath)
  141. console.log(JSON.stringify(res))
  142. uni.showToast({
  143. icon: 'none',
  144. mask: true,
  145. title: '文件已保存!',
  146. duration: 3000,
  147. });
  148. uni.openDocument({
  149. //fileType: 'docx',
  150. showMenu: true, //关键点,可以转发到微信
  151. filePath: res.savedFilePath,
  152. success: function (res) {
  153. console.log('打开文档成功');
  154. }
  155. });
  156. }
  157. });
  158. }
  159. }
  160. });
  161. }
  162. </script>
  163. <style>
  164. page {
  165. width: 100%;
  166. height: 100%;
  167. }
  168. </style>
  169. <style lang="scss" scoped>
  170. .listbox {
  171. height: 100%;
  172. background-color: #EEF7F7;
  173. padding: 30rpx;
  174. border-top: 1rpx solid #DFDFDF;
  175. margin-top: 200rpx;
  176. .card-no-active {
  177. margin-bottom: 30rpx;
  178. height: 438rpx;
  179. background: #FFFFFF;
  180. box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
  181. border-radius: 20rpx;
  182. display: flex;
  183. flex-direction: column;
  184. .head {
  185. display: flex;
  186. padding: 30rpx;
  187. align-items: center;
  188. border-bottom: 1px solid #DCDCDC;
  189. image {
  190. width: 48rpx;
  191. height: 48rpx;
  192. }
  193. text {
  194. font-size: 30rpx;
  195. font-family: Noto Sans S Chinese;
  196. font-weight: 400;
  197. color: #333333;
  198. }
  199. }
  200. .content {
  201. margin: 30rpx;
  202. margin-bottom: 0;
  203. border-bottom: 1rpx solid #DCDCDC;
  204. .row {
  205. font-size: 26rpx;
  206. font-family: Noto Sans S Chinese;
  207. font-weight: 400;
  208. color: #999999;
  209. margin-bottom: 20rpx;
  210. text {
  211. font-size: 26rpx;
  212. font-family: Noto Sans S Chinese;
  213. font-weight: 400;
  214. color: #333333;
  215. }
  216. }
  217. }
  218. .btns {
  219. flex: 1;
  220. display: flex;
  221. align-items: center;
  222. justify-content: flex-end;
  223. padding: 0 30rpx;
  224. button {
  225. margin: 0;
  226. display: inline-block;
  227. height: 61rpx;
  228. background: #FFFFFF;
  229. border: 1px solid #00B38B;
  230. border-radius: 30rpx;
  231. font-size: 26rpx;
  232. font-family: Noto Sans S Chinese;
  233. font-weight: 400;
  234. color: #00B38B;
  235. line-height: 61rpx;
  236. }
  237. }
  238. }
  239. .card-active {
  240. height: 375rpx;
  241. background: #FFFFFF;
  242. box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
  243. border-radius: 20rpx;
  244. display: flex;
  245. flex-direction: column;
  246. .head {
  247. display: flex;
  248. padding: 30rpx;
  249. align-items: center;
  250. border-bottom: 1px solid #DCDCDC;
  251. image {
  252. width: 48rpx;
  253. height: 48rpx;
  254. }
  255. text {
  256. font-size: 30rpx;
  257. font-family: Noto Sans S Chinese;
  258. font-weight: 400;
  259. color: #333333;
  260. }
  261. .status {
  262. position: absolute;
  263. right: 35px;
  264. font-size: 26rpx;
  265. font-family: Noto Sans S Chinese;
  266. font-weight: 400;
  267. color: #777777;
  268. }
  269. }
  270. .content {
  271. margin: 30rpx;
  272. .row {
  273. font-size: 26rpx;
  274. font-family: Noto Sans S Chinese;
  275. font-weight: 400;
  276. color: #999999;
  277. margin-bottom: 20rpx;
  278. text {
  279. font-size: 26rpx;
  280. font-family: Noto Sans S Chinese;
  281. font-weight: 400;
  282. color: #333333;
  283. }
  284. }
  285. }
  286. }
  287. }
  288. .item {
  289. display: flex;
  290. font-size: 30rpx;
  291. margin-top: 10rpx;
  292. align-items: center;
  293. }
  294. .wrap {
  295. padding: 10rpx 20rpx;
  296. box-sizing: border-box;
  297. // display: flex;
  298. // justify-content: space-evenly;
  299. position: fixed;
  300. left: 0;
  301. top: 0;
  302. background-color: white;
  303. width: 100%;
  304. }
  305. .bottom-line {
  306. text-align: center;
  307. margin: 30rpx 0;
  308. }
  309. </style>