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

invoiceList.vue 6.9KB

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