Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

invoiceList.vue 6.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  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">
  22. <view class="card-no-active" v-for="(item,index) in state.data">
  23. <view class="head">
  24. <!-- <image :src="`${$imgUrl}order/icon-star-green.png`" mode=""></image> -->
  25. <!-- <text>新办订单</text> -->
  26. </view>
  27. <view class="content">
  28. <view class="row">
  29. 开票日期:<text>{{item.invoiceDate}}</text>
  30. </view>
  31. <view class="row">
  32. 发票抬头:<text>{{item.buyerName}}</text>
  33. </view>
  34. <view class="row">
  35. 状态:<text>{{item.status==1?'正常':"红冲"}}</text>
  36. </view>
  37. </view>
  38. <view class="btns">
  39. <button @click="down(item.fileUrl)">开票</button>
  40. </view>
  41. </view>
  42. <!-- <view class="bottom-line" v-if="state.flags">我是有底线的~~~</view> -->
  43. </view>
  44. </template>
  45. <script setup lang="ts">
  46. import {
  47. reactive
  48. } from "vue";
  49. import { onLoad, onReachBottom } from "@dcloudio/uni-app";
  50. import { invoiceQueryApi } from "@/utils/network/api.js";
  51. import { stringToJson } from "@/utils/network/encryption";
  52. import { request } from "@/utils/network/request.js";
  53. import { msg } from "@/utils/utils";
  54. const state = reactive({
  55. userMobile: "",
  56. pageNumber: 1,
  57. pageSize: 10,
  58. status: 1,
  59. statusData: [{
  60. 'value': 1,
  61. 'text': '正常'
  62. }, {
  63. 'value': -1,
  64. 'text': '红冲'
  65. }],
  66. orderType: 1,
  67. orderTypeData: [{
  68. 'value': 1,
  69. 'text': 'ETC服务'
  70. }, {
  71. 'value': 2,
  72. 'text': '通行服务费'
  73. }],
  74. data: [],
  75. flags: false,
  76. })
  77. onLoad((options) => {
  78. state.userMobile = options.userMobile
  79. })
  80. const search = () => {
  81. query(1)
  82. }
  83. const query = (val) => {
  84. if (val == 1) {
  85. state.pageNumber = 1
  86. }
  87. if (state.pageNumber == 1 && state.data.length > 0) {
  88. state.data = []
  89. }
  90. const options = {
  91. type: 2,
  92. data: {
  93. userMobile: state.userMobile,
  94. pageNumber: state.pageNumber,
  95. pageSize: state.pageSize,
  96. status: state.status,
  97. orderType: state.orderType,
  98. },
  99. method: "POST",
  100. showLoading: true,
  101. };
  102. request(invoiceQueryApi, options).then((res) => {
  103. const data = stringToJson(res.bizContent);
  104. state.data = data.invoices
  105. console.log(data, "通行");
  106. });
  107. }
  108. const statusChange = (e) => {
  109. state.status = e
  110. }
  111. const orderTypeChange = (e) => {
  112. state.orderType = e
  113. }
  114. // 触底加载
  115. onReachBottom(() => {
  116. if (state.data.length < state.pageNumber * 10) return state.flags = true
  117. console.log("触底了")
  118. state.pageNumber++
  119. query(2)
  120. })
  121. const down = (fileUrl) => {
  122. uni.downloadFile({
  123. url: fileUrl, //仅为示例,并非真实的资源
  124. success: (res) => {
  125. if (res.statusCode === 200) {
  126. console.log('下载成功');
  127. msg("下载成功")
  128. }
  129. }
  130. });
  131. }
  132. </script>
  133. <style>
  134. page {
  135. width: 100%;
  136. height: 100%;
  137. }
  138. </style>
  139. <style lang="scss" scoped>
  140. .listbox {
  141. height: 100%;
  142. background-color: #EEF7F7;
  143. padding: 30rpx;
  144. border-top: 1rpx solid #DFDFDF;
  145. margin-top: 200rpx;
  146. .card-no-active {
  147. margin-bottom: 30rpx;
  148. height: 438rpx;
  149. background: #FFFFFF;
  150. box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
  151. border-radius: 20rpx;
  152. display: flex;
  153. flex-direction: column;
  154. .head {
  155. display: flex;
  156. padding: 30rpx;
  157. align-items: center;
  158. border-bottom: 1px solid #DCDCDC;
  159. image {
  160. width: 48rpx;
  161. height: 48rpx;
  162. }
  163. text {
  164. font-size: 30rpx;
  165. font-family: Noto Sans S Chinese;
  166. font-weight: 400;
  167. color: #333333;
  168. }
  169. }
  170. .content {
  171. margin: 30rpx;
  172. margin-bottom: 0;
  173. border-bottom: 1rpx solid #DCDCDC;
  174. .row {
  175. font-size: 26rpx;
  176. font-family: Noto Sans S Chinese;
  177. font-weight: 400;
  178. color: #999999;
  179. margin-bottom: 20rpx;
  180. text {
  181. font-size: 26rpx;
  182. font-family: Noto Sans S Chinese;
  183. font-weight: 400;
  184. color: #333333;
  185. }
  186. }
  187. }
  188. .btns {
  189. flex: 1;
  190. display: flex;
  191. align-items: center;
  192. justify-content: flex-end;
  193. padding: 0 30rpx;
  194. button {
  195. margin: 0;
  196. display: inline-block;
  197. height: 61rpx;
  198. background: #FFFFFF;
  199. border: 1px solid #00B38B;
  200. border-radius: 30rpx;
  201. font-size: 26rpx;
  202. font-family: Noto Sans S Chinese;
  203. font-weight: 400;
  204. color: #00B38B;
  205. line-height: 61rpx;
  206. }
  207. }
  208. }
  209. .card-active {
  210. height: 375rpx;
  211. background: #FFFFFF;
  212. box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
  213. border-radius: 20rpx;
  214. display: flex;
  215. flex-direction: column;
  216. .head {
  217. display: flex;
  218. padding: 30rpx;
  219. align-items: center;
  220. border-bottom: 1px solid #DCDCDC;
  221. image {
  222. width: 48rpx;
  223. height: 48rpx;
  224. }
  225. text {
  226. font-size: 30rpx;
  227. font-family: Noto Sans S Chinese;
  228. font-weight: 400;
  229. color: #333333;
  230. }
  231. .status {
  232. position: absolute;
  233. right: 35px;
  234. font-size: 26rpx;
  235. font-family: Noto Sans S Chinese;
  236. font-weight: 400;
  237. color: #777777;
  238. }
  239. }
  240. .content {
  241. margin: 30rpx;
  242. .row {
  243. font-size: 26rpx;
  244. font-family: Noto Sans S Chinese;
  245. font-weight: 400;
  246. color: #999999;
  247. margin-bottom: 20rpx;
  248. text {
  249. font-size: 26rpx;
  250. font-family: Noto Sans S Chinese;
  251. font-weight: 400;
  252. color: #333333;
  253. }
  254. }
  255. }
  256. }
  257. }
  258. .item {
  259. display: flex;
  260. font-size: 30rpx;
  261. margin-top: 10rpx;
  262. align-items: center;
  263. }
  264. .wrap {
  265. padding: 10rpx 20rpx;
  266. box-sizing: border-box;
  267. // display: flex;
  268. // justify-content: space-evenly;
  269. position: fixed;
  270. left: 0;
  271. top: 0;
  272. background-color: white;
  273. width: 100%;
  274. }
  275. .bottom-line {
  276. text-align: center;
  277. margin: 30rpx 0;
  278. }
  279. </style>