123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542 |
- <template>
- <view class="content">
- <view class="nav-wrap flex">
- <view class="item" v-for="(nav,inden) in navList" :class="{'action': navCurrent == inden}"
- @click="changeNav(inden)">
- {{nav.tit}}
- </view>
- </view>
- <view class="flex nav-list">
- <view class="item" v-for="(item,index) in navList[navCurrent].list" :class="{'action': current == index}"
- @click="changeNavT(index)">
- {{item.tit}}
- </view>
- </view>
- <swiper disable-touch :style="{'height': maxHeight}" class="scroll-wrap" :current="current">
- <swiper-item v-for="navItem in navList[navCurrent].list">
- <scroll-view scroll-y="true" :style="{'height': maxHeight}" @scrolltolower="getList">
- <view class="order-wrap " v-for="orderItem in navItem.list">
- <view class="flex m-info">
- <image src="../../static/icon/gs-av.png" mode="" class="card-img"></image>
- <text style=" display: inline-block;line-height: 55rpx;">{{orderItem.user.phone || orderItem.user.nickname}}</text>
- </view>
- <view class="price">
- ¥{{orderItem.total_price}}
- </view>
- <view class="num">
- 数量:{{orderItem.amount}}
- </view>
- <view class="num">
- {{ getTime(orderItem.add_time)}}
- </view>
- <view class="status" :style="{color: showColor(orderItem.status)}">
- {{orderItem.status == 0 ? '挂售中': (orderItem.status == 1? '待支付': (orderItem.status == 2? '待审核': orderItem.status == 3 ? '已完成': (orderItem.status == 4? '已取消': '未通过')))}}
- </view>
- <view class="flex btn-list">
- <view class="order-btn" v-if="orderItem.status == 0 && navCurrent == 1" @click="qxOrder(orderItem)">
- 取消交易
- </view>
- <view class="order-btn" v-if="orderItem.status == 1 && navCurrent == 0" @click="upPz(orderItem)">
- 上传凭证
- </view>
- <view class="order-btn" v-if="orderItem.status == 2 && navCurrent == 0" @click="upPz(orderItem)">
- 修改凭证
- </view>
- <view class="order-btn" v-if="orderItem.status == 2 || orderItem.status == 3" @click="lookimg(orderItem)">
- 查看凭证
- </view>
- <view class="order-btn" v-if="orderItem.status == 2 && navCurrent == 1" @click="auth(orderItem,-1)">
- 拒绝
- </view>
- <view class="order-btn" v-if="orderItem.status == 2 && navCurrent == 1" @click="auth(orderItem,1)">
- 通过
- </view>
- <view class="order-btn order-btn-hui" v-if="orderItem.status == 4">
- 已取消
- </view>
- <view class="order-btn order-btn-hui" v-if="orderItem.status == -1">
- 未通过
- </view>
- </view>
- </view>
- <empty v-if="navItem.loaded && navItem.list == 0"></empty>
- <uni-load-more :status="navItem.loadingType" v-else></uni-load-more>
- </scroll-view>
- </swiper-item>
- </swiper>
- <uni-popup ref="popup" type="center">
- <view class="pz-wrap">
- <view class="tit">
- 上传凭证
- </view>
- <image v-if="!pz" src="../../static/img/add.png" mode="" @click="upimg"></image>
- <image v-else :src="pz" mode="" @click="upimg"></image>
- <view class="btn" @click="goUp">
- 上传
- </view>
- </view>
- </uni-popup>
- </view>
- </template>
- <script>
- import {
- mapState,
- mapMutations
- } from 'vuex';
-
- import empty from '@/components/empty.vue'
-
- import {
- getGsList,
- qxGs,
- upEvaluation,
- auth
- } from '@/api/zero.js'
- import { upload } from '@/api/order.js';
- export default {
- components: {
- empty
- },
- data() {
- return {
- pzing: false,
- orderId: '',
- pz: '',
- maxHeight: '',
- navCurrent: 0, // 0-》买单 1-》卖单
- current: 0, //二层次序
- navList: [{
- tit: '我的买单',
- list: [{
- tit: '全部',
- status: -2,
- list: [],
- loadingType: 'more',
- page: 1,
- limit: 10,
- loaded: false
- },
- {
- tit: '待支付',
- status: 1,
- list: [],
- loadingType: 'more',
- page: 1,
- limit: 10,
- loaded: false
- },
- {
- tit: '待审核',
- status: 2,
- list: [],
- loadingType: 'more',
- page: 1,
- limit: 10,
- loaded: false
- },
- {
- tit: '已完成',
- status: 3,
- list: [],
- loadingType: 'more',
- page: 1,
- limit: 10,
- loaded: false
- }
- ]
- },
- {
- tit: '我的卖单',
- list: [{
- tit: '全部',
- status: -2,
- list: [],
- loadingType: 'more',
- page: 1,
- limit: 10,
- loaded: false
- },
- {
- tit: '挂售中',
- status: 0,
- list: [],
- loadingType: 'more',
- page: 1,
- limit: 10,
- loaded: false
- },
- {
- tit: '待支付',
- status: 1,
- list: [],
- loadingType: 'more',
- page: 1,
- limit: 10,
- loaded: false
- },
- {
- tit: '待审核',
- status: 2,
- list: [],
- loadingType: 'more',
- page: 1,
- limit: 10,
- loaded: false
- }
- ]
- }
- ]
- }
- },
- computed: {
- ...mapState('user',['userInfo'])
- },
- onLoad() {
-
- },
- onShow() {
- this.getList('reload')
- },
- onReachBottom() {
- },
- onReady() {
- var that = this;
- uni.getSystemInfo({
- success: resu => {
- const query = uni.createSelectorQuery();
- query.select('.scroll-wrap').boundingClientRect();
- query.exec(function(res) {
- that.maxHeight = resu.windowHeight - res[0].top + 'px';
- });
- },
- fail: res => {}
- });
- },
- methods: {
- showColor(status) {
- if(status == -1 || status == 4) {
- return '#aaa'
- }else {
- return '#FF5570'
- }
- },
- auth(item,type) {
- let that =this
- uni.showModal({
- title: '提示',
- content: type == 1?'是否确认收款完成?': '是否确认当前提交的凭证没有通过审核',
- complete(e) {
- if(e.confirm) {
- auth({
- id: item.id,
- auth: type
- }).then(res => {
- uni.showToast({
- title:'审核成功',
- duration:2000
- });
- that.getList('reload')
- })
- }
- }
-
- })
- },
- // 取消交易
- qxOrder(item) {
- let that = this
- uni.showModal({
- title: '提示',
- content: '是否确认取消挂售?',
- complete(e) {
- if(e.confirm) {
- qxGs({
- id: item.id
- }).then(res => {
- uni.showToast({
- title:'取消成功',
- duration:2000
- });
- that.getList('reload')
- })
- }
- }
-
- })
- },
- upPz(item) {
- // if(item.up_files) {
- // this.pz = item.up_files
- // }
- // this.orderId = item.id
- // this.$refs.popup.open()
- uni.navigateTo({
- url: '/pages/zero/pay?id=' + item.id
- })
- },
- //上传凭证
- goUp() {
- if(this.pzing) {
- return
- }
- if(!this.pz) {
- return this.$api.msg('请上传凭证')
- }
- this.pzing = true
- upEvaluation({
- id: this.orderId,
- up_files: this.pz
- }).then(res => {
- uni.showToast({
- title:'上传成功',
- duration:2000
- });
- this.$refs.popup.close()
- this.orderId = ''
- this.getList('reload')
- this.pzing = false
- }).catch(err => {
- this.pzing = false
- })
- },
- upimg() {
- upload({
- file: ''
- })
- .then(e => {
- console.log(e,'e')
- this.pz = e[0].url
- console.log(this.pz)
- })
- .catch(e => {});
- },
- lookimg(item) {
- let arr = item.up_files.split(',')
- uni.previewImage({
- current: 0,
- loop: false,
- urls: arr,
- indicator: 'default'
- });
- },
- getTime(time) {
- const num =13 - (time+'').length;
- let l = 1;//倍数
- for (let i = 0; i < num; i++) {
- l+='0';
- }
- // 重新解析为数字
- l = parseInt(l)
- const date = new Date(parseInt(time) * l);
- const year = date.getFullYear();
- const mon = date.getMonth() + 1;
- const day = date.getDate();
- const hours = date.getHours();
- const minu = date.getMinutes();
- const sec = date.getSeconds();
- return year + '-' + mon + '-' + day + ' ' + hours + ':' + minu + ':' + sec;
- },
- // 切换nav
- changeNav(index) {
- if (index === this.navCurrent) {
- return
- }
- console.log('切换');
- this.navCurrent = index
- this.getList('tab')
- },
- changeNavT(index) {
- if (index === this.current) {
- return
- }
- console.log('切换');
- this.current = index
- this.getList('reload')
- },
- getList(type) {
- let that = this
- let item = that.navList[that.navCurrent].list[that.current]
- if(type == 'reload') {
- item.page = 1
- item.list = []
- item.loadingType = 'more'
- item.loaded = false
- }
- if (item.loadingType == 'loading' || item.loadingType == 'noMore') {
- return
- }
- if (type == 'tab' && item.loaded) {
- return
- }
- item.loadingType = 'loading'
- let qdata = {
- page: item.page,
- limit: item.limit,
- status: item.status,
- type: 1,
- order: 'id desc'
- }
- if(that.navCurrent == 1) {
- qdata.uid = that.userInfo.uid
- }else {
- qdata.to_uid = that.userInfo.uid
- }
- getGsList(qdata).then(res => {
- let arr = res.data.result.list
- item.list = item.list.concat(arr)
- if (item.limit == arr.length) {
- item.loadingType = 'more'
- item.page++
- } else {
- item.loadingType = 'noMore'
- }
- item.loaded = true
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .nav-wrap {
- padding: 28rpx 30rpx 20rpx;
- background-color: #fff;
- .item {
- width: 336rpx;
- height: 81rpx;
- border-radius: 10rpx;
- border: 1px solid #EC5A54;
- color: #EC5A54;
- line-height: 80rpx;
- text-align: center;
- }
- .action {
- background-color: #EC5A54;
- color: #fff;
- }
- }
- .nav-list {
- justify-content: space-around;
- background-color: #fff;
- font-weight: 500;
- color: #333333;
- .item {
- padding: 28rpx 20rpx 16rpx;
- }
- .action {
- color: #EC5A54;
- border-bottom: 2px solid red;
- }
- }
- .scroll-wrap {
- padding-top: 20rpx;
- }
- .order-wrap {
- width: 686rpx;
- // height: 297rpx;
- background: #FFFFFF;
- box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(50, 50, 52, 0.06);
- border-radius: 20rpx;
- margin: 0 auto 20rpx;
- padding: 33rpx 40rpx;
- position: relative;
- .m-info {
- justify-content: flex-start;
- image {
- width: 55rpx;
- height: 55rpx;
- margin-right: 13rpx;
- }
- text {
- font-size: 28rpx;
- font-weight: bold;
- color: #333333;
- }
- }
- .price {
- font-size: 40rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #FF4C4C;
- padding: 40rpx 0 30rpx;
- }
- .num {
- font-size: 26rpx;
- font-weight: 500;
- color: #888785;
- }
- .status {
- position: absolute;
- right: 10rpx;
- top: 10rpx;
- font-size: 26rpx;
- }
- .btn-list {
- border-top: 1px solid #eee;
- margin-top: 20rpx;
- padding-top: 20rpx;
- justify-content: flex-end;
- }
- .order-btn {
- width: 148rpx;
- height: 62rpx;
- border: 2px solid #FF5570;
- border-radius: 30rpx;
- line-height: 62rpx;
- text-align: center;
- font-size: 28rpx;
- font-weight: bold;
- color: #FF4C4C;
- margin-left: 20rpx;
- }
- .order-btn-hui {
- color: #aaa;
- border: 2px solid #aaa;
- }
- }
- .pz-wrap {
- width: 550rpx;
- // height: 500rpx;
- background-color: #fff;
- border-radius: 20rpx;
- text-align: center;
- font-size: 32rpx;
- padding:40rpx;
- image {
- width: 250rpx;
- height: 250rpx;
- }
- .tit {
- font-weight: bold;
- padding: 20rpx 0;
- }
- .btn {
- background-color: $base-color;
- padding:0 20rpx;
- height: 65rpx;
- border-radius: 25rpx;
- width:250rpx;
- color: #fff;
- line-height: 60rpx;
- margin:20rpx auto 0;
- }
- }
- </style>
|