123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333 |
- <template>
- <view class="wrap">
- <view>
- <view class="item last">
- <text>状态:</text>
- <uni-data-select v-model="state.status" :localdata="state.statusData"
- @change="statusChange"></uni-data-select>
- </view>
- <view class="item last">
- <text>订单类型:</text>
- <uni-data-select v-model="state.orderType" :localdata="state.orderTypeData"
- @change="orderTypeChange"></uni-data-select>
- <button size="mini" style="color: #ffffff;
- backgroundColor: rgb(118, 200, 77);
- borderColor: rgb(118, 200, 77);
- font-size: 26rpx;
- flex-shrink: 0;margin-left: 20rpx;" @click="search">查询</button>
- </view>
- </view>
- </view>
-
- <view class="listbox" v-if="state.data.length>0">
- <view class="card-no-active" v-for="(item,index) in state.data">
- <view class="content">
- <view class="row">
- 订单类型:<text>{{item.invoiceTypeName}}</text>
- </view>
- <view class="row">
- 车牌号:<text>{{item.remarks}}</text>
- </view>
- <view class="row">
- 发票抬头:<text>{{item.buyerName}}</text>
- </view>
- <view class="row">
- 状态:<text>{{item.status==1?'正常':"红冲"}}</text>
- </view>
- <view class="row">
- 商品价:<text>¥{{item.goodsAmount}}</text>
- </view>
- <view class="row">
- 开票日期:<text>{{item.invoiceOpenTime}}</text>
- </view>
- </view>
- <view class="btns">
- <button @click="down(item.fileUrl)">下载</button>
- </view>
- </view>
- <!-- <view class="bottom-line" v-if="state.flags">我是有底线的~~~</view> -->
- </view>
- <view v-else class="listbox" style="text-align: center;font-size: 32rpx;">
- 暂无数据
- </view>
- </template>
-
- <script setup lang="ts">
- import {
- reactive
- } from "vue";
- import { onLoad, onReachBottom } from "@dcloudio/uni-app";
- import { billQueryBill } from "@/utils/network/api.js";
- import { requestNew } from "@/utils/network/request.js";
- const state = reactive({
- userMobile: "",
- pageNumber: 1,
- pageSize: 10,
- status: 1,
- statusData: [{
- 'value': 1,
- 'text': '正常'
- }, {
- 'value': -1,
- 'text': '红冲'
- }],
- orderType: 1,
- orderTypeData: [{
- 'value': 1,
- 'text': 'ETC服务'
- }, {
- 'value': 2,
- 'text': '通行服务费'
- }],
- data: [],
- flags: false,
- })
- onLoad((options) => {
- state.userMobile = options.userMobile
- query(1)
- })
- const search = () => {
- query(1)
- }
- const query = (val) => {
- if (val == 1) {
- state.pageNumber = 1
- }
- if (state.pageNumber == 1 && state.data.length > 0) {
- state.data = []
- }
- const options = {
- type: 2,
- data: {
- userMobile: state.userMobile,
- pageNumber: state.pageNumber,
- pageSize: state.pageSize,
- status: state.status,
- orderType: state.orderType,
- },
- method: "POST",
- showLoading: true,
- };
- requestNew(billQueryBill, options).then((res) => {
- const data = res;
- state.data = data.invoices
- console.log(data, "通行");
- });
- }
- const statusChange = (e) => {
- state.status = e
- }
- const orderTypeChange = (e) => {
- state.orderType = e
- }
- // 触底加载
- onReachBottom(() => {
- if (state.data.length < state.pageNumber * 10) return state.flags = true
- console.log("触底了")
- state.pageNumber++
- query(2)
- })
- const down = (fileUrl) => {
- uni.downloadFile({
- url: fileUrl, //仅为示例,并非真实的资源
- success: (data) => {
- if (data.statusCode === 200) {
- uni.saveFile({ //文件保存到本地
- tempFilePath: data.tempFilePath, //临时路径
- success: function (res) {
- console.log("下载成功" + res.savedFilePath)
- console.log(JSON.stringify(res))
- uni.showToast({
- icon: 'none',
- mask: true,
- title: '文件已保存!',
- duration: 3000,
- });
- uni.openDocument({
- //fileType: 'docx',
- showMenu: true, //关键点,可以转发到微信
- filePath: res.savedFilePath,
- success: function (res) {
- console.log('打开文档成功');
- }
- });
- }
- });
- }
- }
- });
-
- }
- </script>
-
-
- <style>
- page {
- width: 100%;
- height: 100%;
- }
- </style>
-
- <style lang="scss" scoped>
- .listbox {
- height: 100%;
- background-color: #EEF7F7;
- padding: 30rpx;
- border-top: 1rpx solid #DFDFDF;
- margin-top: 200rpx;
-
- .card-no-active {
- margin-bottom: 30rpx;
- height: 438rpx;
- background: #FFFFFF;
- box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
- border-radius: 20rpx;
- display: flex;
- flex-direction: column;
-
- .head {
- display: flex;
- padding: 30rpx;
- align-items: center;
- border-bottom: 1px solid #DCDCDC;
-
- image {
- width: 48rpx;
- height: 48rpx;
- }
-
- text {
- font-size: 30rpx;
- font-family: Noto Sans S Chinese;
- font-weight: 400;
- color: #333333;
- }
- }
-
- .content {
- margin: 30rpx;
- margin-bottom: 0;
- border-bottom: 1rpx solid #DCDCDC;
-
- .row {
- font-size: 26rpx;
- font-family: Noto Sans S Chinese;
- font-weight: 400;
- color: #999999;
- margin-bottom: 20rpx;
-
- text {
- font-size: 26rpx;
- font-family: Noto Sans S Chinese;
- font-weight: 400;
- color: #333333;
- }
- }
- }
-
- .btns {
- flex: 1;
- display: flex;
- align-items: center;
- justify-content: flex-end;
- padding: 0 30rpx;
-
- button {
- margin: 0;
- display: inline-block;
- height: 61rpx;
- background: #FFFFFF;
- border: 1px solid #00B38B;
- border-radius: 30rpx;
- font-size: 26rpx;
- font-family: Noto Sans S Chinese;
- font-weight: 400;
- color: #00B38B;
- line-height: 61rpx;
- }
- }
- }
-
-
- .card-active {
- height: 375rpx;
- background: #FFFFFF;
- box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
- border-radius: 20rpx;
- display: flex;
- flex-direction: column;
-
- .head {
- display: flex;
- padding: 30rpx;
- align-items: center;
- border-bottom: 1px solid #DCDCDC;
-
- image {
- width: 48rpx;
- height: 48rpx;
- }
-
- text {
- font-size: 30rpx;
- font-family: Noto Sans S Chinese;
- font-weight: 400;
- color: #333333;
- }
-
- .status {
- position: absolute;
- right: 35px;
- font-size: 26rpx;
- font-family: Noto Sans S Chinese;
- font-weight: 400;
- color: #777777;
- }
- }
-
- .content {
- margin: 30rpx;
-
- .row {
- font-size: 26rpx;
- font-family: Noto Sans S Chinese;
- font-weight: 400;
- color: #999999;
- margin-bottom: 20rpx;
-
- text {
- font-size: 26rpx;
- font-family: Noto Sans S Chinese;
- font-weight: 400;
- color: #333333;
- }
- }
- }
-
- }
- }
-
- .item {
- display: flex;
- font-size: 30rpx;
- margin-top: 10rpx;
- align-items: center;
- }
-
- .wrap {
- padding: 10rpx 20rpx;
- box-sizing: border-box;
- // display: flex;
- // justify-content: space-evenly;
- position: fixed;
- left: 0;
- top: 0;
- background-color: white;
- width: 100%;
- }
-
- .bottom-line {
- text-align: center;
- margin: 30rpx 0;
- }
- </style>
|