123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274 |
- <template>
- <view class="content">
- <scroll-view scroll-y class="scroll-box" @scrolltolower="handleLoadMore" :refresher-enabled="true"
- :refresher-triggered="triggered" :refresher-threshold="100" refresher-background="white" @refresherrefresh="onRefresh"
- @refresherrestore="onRestore">
- <u-card :head-border-bottom="false" padding="0px" margin="10px" borderRadius="40" v-for="(item, index) in tableList"
- :key="index" class="class-card">
- <view class="class-content" slot="head" style="padding-top: 10px;">
- <view class="class-name">{{item.className}}</view>
- </view>
- <view class="class-content" slot="body">
- <view class="class-info-text">
- <u-icon name="order"></u-icon>
- 订单号:{{item.orderNumber}}
- </view>
- <view class="class-info-text">
- <u-icon name="clock"></u-icon>
- 支付时间:{{item.payTime}}
- </view>
- <view class="class-info-text">
- <u-icon name="rmb-circle"></u-icon>
- 支付金额:{{item.factPrices}}
- </view>
- </view>
- <view class="class-content" slot="foot" style="padding-top: 10px;padding-bottom: 10px;text-align: right;">
- <u-button type="default" shape="circle" :ripple="true" :custom-style="handleDefaultCustomStyle" size="mini"
- :hair-line="false" plain @click.stop="checkQRCode(item)">二维码</u-button>
- <u-button type="default" shape="circle" :ripple="true" :custom-style="handleDefaultCustomStyle" size="mini"
- :hair-line="false" plain @click.stop="copyOrderNumber(item)">复制订单号</u-button>
- <u-button v-if="item.stateStr=='已支付'" type="warning" shape="circle" :ripple="true" :custom-style="handleCustomStyle" size="mini" @click.stop="checkContract(item)">查看合同</u-button>
- <u-button v-if="item.stateStr!='已支付'" type="error" shape="circle" :ripple="true" :custom-style="handleCustomStyle" size="mini" @click.stop="delOrder(item)">删除</u-button>
- </view>
- </u-card>
- <u-divider v-if="isOver" bg-color="transparent">没有更多了</u-divider>
- </scroll-view>
- <u-modal v-model="qrCodeShow" title="二维码">
- <u-image :src="qrCodeUrl" mode="aspectFill" height="45vw" width="45vw" style="display: flex; justify-content: center;"></u-image>
- </u-modal>
- <u-popup v-model="contractShow" mode="center" border-radius="30" width="600rpx" height="500px">
- <view class="common-title">合同列表</view>
- <view class="menber-box" style="overflow-y: auto;height:390px;">
- <template v-for="(item, index) in contractUrls">
- <view class="card-item" :key="index" @click="handleContractShowClick(item)">
- {{ item.name }}
- </view>
- </template>
- </view>
- <view class="button-box">
- <u-button type="warning" shape="circle" :ripple="true" :custom-style="customStyle" @click="contractShow = false">确定</u-button>
- </view>
- </u-popup>
- <u-top-tips ref="uTips"></u-top-tips>
- </view>
- </template>
- <script>
- import {
- mapGetters
- } from 'vuex'
- const NET = require('@/utils/request')
- const API = require('@/config/api')
- export default {
- computed: {
- ...mapGetters([
- 'customStyle',
- 'handleCustomStyle',
- 'handleDefaultCustomStyle',
- ])
- },
- data() {
- return {
- qrCodeShow: false,
- qrCodeUrl: '',
- contractShow: false,
- contractUrls: [],
- triggered: false,
- isOver: false,
- pageIndex: 1,
- tableList: [],
- }
- },
- onLoad() {
- this.getTableList()
- },
- onReady() {},
- methods: {
- // 下拉刷新
- onRefresh() {
- this.triggered = true
- this.isOver = false
- this.pageIndex = 1
- this.tableList = []
- this.getTableList()
- },
- // 重置下拉刷新状态
- onRestore() {
- this.triggered = 'restore'
- this.triggered = false
- },
- // 懒加载
- handleLoadMore() {
- if (!this.isOver) {
- this.pageIndex++
- this.getTableList()
- }
- },
- // 获取列表数据
- getTableList() {
- NET.request(API.getOrderList, {
- page: this.pageIndex,
- size: 10,
- }, 'POST').then(res => {
- if(res.data) {
- this.triggered = false
- this.tableList = this.tableList.concat(res.data.row)
- this.isOver = res.data.row.length != 10
- }
- }).catch(error => {
- this.triggered = false
- this.$refs.uTips.show({
- title: error.message,
- type: 'warning',
- })
- })
- },
- // 查看二维码
- checkQRCode(item) {
- this.qrCodeShow = true
- this.qrCodeUrl = item.qrCodeUrl
- },
- // 复制订单号
- copyOrderNumber(item) {
- uni.setClipboardData({
- data: item.orderNumber,
- success: () => {
- this.$refs.uTips.show({
- title: '复制成功',
- type: 'success',
- })
- }
- });
- },
- // 查看合同
- handleContractShowClick(item) {
- console.log(item);
- uni.downloadFile({
- url: item.url,
- success: (res) => {
- console.log(res);
- uni.openDocument({
- filePath: res.tempFilePath,
- });
- }
- })
- },
- // 显示合同列表
- checkContract(item) {
- this.contractUrls = item.url
- this.contractShow = true
- },
- //删除订单
- delOrder(item){
- let that = this
- uni.showModal({
- title: '提示',
- content: '您确定要删除此项吗?',
- success: async (res) => {
- if (res.confirm) {
- NET.request(API.delete+'/'+item.orderId, null, 'GET').then(res => {
- that.onRefresh()
- })
- }
- }
- })
- }
- },
- }
- </script>
- <style>
- page {
- width: 100%;
- height: 100%;
- background-color: #f7f7f7;
- }
- </style>
- <style lang="scss" scoped>
- @import "@/static/css/themes.scss";
- .content {
- width: 100%;
- float: left;
- .scroll-box {
- width: 100%;
- height: 100vh;
- padding-bottom: 10px;
- box-sizing: border-box;
- .class-card {
- .class-content {
- padding: 5px 15px;
- }
- .class-name {
- height: 20px;
- display: inline-block;
- font-weight: bold;
- font-size: 14px;
- line-height: 20px;
- }
- .class-info-text {
- color: #999999;
- margin-bottom: 5px;
- /deep/.u-icon {
- margin-right: 5px;
- font-size: 14px;
- color: #000000;
- }
- }
- }
- }
- }
-
- .menber-box {
- width: 100%;
- padding: 10px 15px;
-
- .menber-col {
- width: 100%;
- padding: 15px;
- display: inline-block;
- background-color: #FFFFFF;
- border-radius: 15px;
- box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.2);
- position: relative;
- overflow: hidden;
- box-sizing: border-box;
-
- .menber-label {
- width: 100%;
- font-size: 14px;
- // line-height: 20px;
- }
- .menber-num {
- width: 100%;
- font-size: 26px;
- line-height: 28px;
- color: $mainColor;
- }
- }
- }
- .common-title {
- width:100%;
- text-align: center;
- font-size: 20px;
- padding: 10px 0;
- }
- .button-box {
- // width: 100%;
- padding: 10px 15px;
- box-sizing: border-box;
- }
- .card-item {
- width: 100%;
- padding:8px;
- border-radius: 10px;
- background-color: #ff6e3e;
- margin-bottom: 8px;
- color: #fff;
- }
- </style>
|