123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383 |
- <template>
- <view class="all">
- <view class="fixedBox">
- <!-- <view class="navList flex">
- <view v-for="(item, index) in navItem" :key="index" class="navItem"
- :class="{ activeItem: tabIndex === index,tip:index == 0 }" @click="tabClick(index,1)">{{ item }}
- </view>
- </view> -->
- <view class="navList flex navList2">
- <view v-for="(item, index) in navList[tabIndex]" :key="index" class="navItem"
- :class="{ activeItem: tabCurr === index}" @click="tabClick(index,2)">{{ item.name }}
- </view>
- </view>
- </view>
- <view class="listItemBox">
- <view class="listItem" v-for="item,index in list" :key="index" @click="navItemTo(item)">
- <view class="itemInfo flex">
- <view class="flex_item">
- <image src="/static/image/img20.png" style="width: 55rpx;height: 55rpx;" mode="widthFix"></image>
- <view class="name">{{item.real_name}}</view>
- </view>
- <view class="" style="font-size: 24rpx;font-weight: bold;color: #0C5AFA;">
- <text v-if="item.status==0">结束</text>
- <text v-else-if="item.status==1">挂出</text>
- <text v-else-if="item.status==2">完成</text>
- <text v-else-if="item.status==3">待上传</text>
- <text v-else-if="item.status==5">已上传</text>
-
- </view>
- </view>
- <view class="itemTip flex">
- <view class="tipBox">
- <view class="tipText">数量:{{item.num}}{{item.money_type}}</view>
- <view class="tipText">总价:¥{{item.money}}</view>
- <view class="tipText">{{item.add_time|dateFormat}}</view>
- </view>
- <view class="" style="text-align: right;">
- <image src="/static/image/img21.png" style="width: 40rpx;height: 31rpx;margin-bottom: 25rpx;" mode="widthFix">
- </image>
- <view class="tipBtn" v-if="status==5 && item.voucher" @click.stop="comfirOrder(item.id,item.voucher)">查看凭证</view>
- <view class="tipBtn" v-if="status==3">上传凭证</view>
- <view class="tipBtn" v-if="status==1" @click.stop="cancel(item.id)">取消</view>
- </view>
- </view>
- </view>
- </view>
- <uni-load-more :status="loadingType"></uni-load-more>
- <!-- 查看凭证弹窗 -->
- <u-popup :show="popShow" @close="popShow = false" :round="10" @open="popShow = true" mode="center">
- <view class="popBox">
- <image :src="popShowImg" mode="aspectFit"></image>
- <view class="popBtn" v-if="tabIndex == 0" @click="comirOrder">确认订单</view>
- <view class="popBtn" v-if="tabIndex == 1" @click="popShow = false">关闭查看</view>
- </view>
- </u-popup>
- </view>
- </template>
- <script>
- import {
- sellMy,
- sellBuyMy,
- cancelLog,
- comfirLog
- } from '@/api/game.js';
- import {
- mapState
- } from 'vuex';
- import dayjs from '@/libs/dayjs/dayjs.min.js';
- export default {
- computed: {
- ...mapState('user', ['hasLogin'])
- },
- filters: {
- dateFormat: function(value) {
- return dayjs(value * 1000).format('YYYY/MM/DD HH:mm');
- }
- },
- data() {
- return {
- tabIndex: 0, //当前选中的一级分类
- navItem: ['卖币订单', '买币订单'],
- tabCurr: 0, //当前选中的二级分类
- status: 1, //当前选中状态
- navList: [
- [{
- name: '挂出',
- status: 1
- },{
- name: '待上传',
- status: 3
- },{
- name: '待确认',
- status: 5
- },{
- name: '完成',
- status: 2
- },{
- name: '结束',
- status: 0
- }],
- [{
- name: '待上传',
- status: 3
- }, {
- name: '已上传',
- status: 5
- }, {
- name: '完成',
- status: 2
- }]
- ],
- page: 1,
- limit: 10,
- loadingType: "more",
- list: [],
- popShow:false,
- popShowImg:'',
- popId:''
- }
- },
- onShow() {
- this.page = 1;
- this.loadingType = "more";
- this.list = []
- this.loadData()
- },
- onReachBottom() {
- this.loadData()
- },
- methods: {
- navItemTo(item){
- uni.navigateTo({
- url:`/pages/index/orderDetail?id=${item.id}&tab=${this.tabIndex}`
- })
- },
- loadData() {
- let obj = this;
- if (obj.loadingType == "nomore" ||
- obj.loadingType == "loading") {
- return;
- }
- obj.loadingType = "loading";
- console.log(obj.status,'obj.status');
- console.log(obj.tabIndex,'obj.tabIndex');
- console.log(obj.list,'obj.list');
- if (this.tabIndex == 0) {
- sellMy({
- page: obj.page,
- limit: obj.limit,
- status:obj.status
- }, obj.status).then(res => {
- let ar = res.data.list.map((re)=>{
- re.num = +re.num;
- re.price = +re.price;
- re.money = +(re.num*re.price).toFixed(8);
- return re
- })
- obj.dataList(ar)
- });
- } else if (this.tabIndex == 1) {
- sellBuyMy({
- page: obj.page,
- limit: obj.limit,
- status:obj.status
- }, obj.status).then(res => {
- let ar = res.data.list.map((re)=>{
- re.num = +re.num;
- re.price = +re.price;
- re.money = +(re.num*re.price).toFixed(8);
- return re
- })
- obj.dataList(ar)
- });
- }
- },
- //取消挂出
- cancel(id){
- let obj = this;
- cancelLog({
- id:id
- }).then(res => {
- if(res.status == 200){
- uni.showToast({
- title: res.msg,
- icon: 'none',
- })
- setTimeout(function () {
- obj.page = 1;
- obj.loadingType = "more";
- obj.list = []
- obj.loadData()
- }, 1000);
- }else{
- uni.showToast({
- title: res.msg,
- icon: 'none',
- })
- }
- });
- },
- //确认订单
- comirOrder(){
- const that = this;
- comfirLog({
- id:that.popId,
- }).then(res => {
- if(res.status == 200){
- uni.showToast({
- title: res.msg,
- icon: 'none',
- })
- that.popShow = false
- setTimeout(()=>{
- that.page = 1;
- that.loadingType = "more";
- that.list = []
- that.loadData()
- },1000)
- }else{
- uni.showToast({
- title: res.msg,
- icon: 'none',
- })
- }
- });
- },
- //点击查看凭证
- comfirOrder(id,img){
- this.popShowImg = img
- this.popId = id
- this.popShow = true
- },
- dataList(ar) {
- const obj = this;
- if (ar.length > 0) {
- obj.list = obj.list.concat(ar);
- obj.page++;
- }
- if (obj.limit == ar.length) {
- obj.loadingType = "more";
- } else {
- obj.loadingType = "nomore";
- }
- },
- tabClick(index,type) {
- if (type == 1) {
- if (index == this.tabIndex) {
- return
- }
- this.tabIndex = index;
- this.tabCurr = 0
- } else if (type == 2) {
- if (index == this.tabCurr) {
- return
- }
- this.tabCurr = index
- }
- this.status = this.navList[this.tabIndex][this.tabCurr].status;
- this.page = 1;
- this.loadingType = "more";
- this.list = []
- this.loadData()
- },
- }
- };
- </script>
- <style lang="scss">
- .all {
- width: 750rpx;
- height: 100%;
- background-color: #051137;
- padding-top: var(--status-bar-height);
- }
- .fixedBox {
- position: fixed;
- top: 44px;
- left: 0;
- width: 100%;
- z-index: 9;
- }
- .navList {
- padding: 20rpx 50rpx 20rpx 50rpx;
- background: #1F2A4A;
- .navItem {
- color: #fff;
- font-size: 30rpx;
- text-align: center;
- width: 50%;
- &.activeItem {
- color: #0C5AFA;
- position: relative;
- &:after {
- content: '';
- position: absolute;
- left: 36%;
- bottom: -20rpx;
- width: 30%;
- height: 8rpx;
- // transform: translateX(-50%);
- border-bottom: 4rpx solid #0C5AFA;
- border-radius: 0rpx 20rpx 0rpx 0rpx;
- }
- }
- &.tip {
- border-right: 1rpx solid #333D5B;
- }
- }
- }
- .navList2 {
- background: #051137;
- padding: 20rpx 25rpx 20rpx 25rpx;
- }
- .listItemBox {
- padding-top: 44px;
- .listItem {
- padding: 34rpx 34rpx;
- background: #1F2A4A;
- margin-bottom: 25rpx;
- .name {
- font-family: PingFang SC;
- font-weight: bold;
- font-size: 30rpx;
- color: #FFFFFF;
- padding-left: 25rpx;
- }
- .itemTpl {
- font-family: PingFang SC;
- font-weight: bold;
- font-size: 36rpx;
- color: #0C5AFA;
- padding-top: 25rpx;
- }
- .itemTip {
- .tipText {
- font-family: PingFang SC;
- font-weight: 500;
- font-size: 26rpx;
- color: #999999;
- padding-top: 15rpx;
- }
- .tipBtn {
- font-family: PingFang SC;
- font-weight: bold;
- font-size: 24rpx;
- color: #FFFFFF;
- background: linear-gradient(90deg, #0C5AFA, #1356FF);
- border-radius: 7rpx;
- padding: 15rpx 35rpx;
- }
- }
- }
- }
- .popBox{
- max-height: 70vh;
- padding: 35rpx 35rpx;
- image{
- max-height: 60vh;
- }
- .popBtn{
- background: linear-gradient(90deg, #0C5AFA, #1356FF);
- border-radius: 7rpx;
- padding: 15rpx 35rpx;
- width: 60%;
- margin: 35rpx auto;
- text-align: center;
- color: #fff;
- }
- }
- </style>
|