uniapp/pages_promotion/futures/order.vue

344 lines
9.1 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<page-meta :page-style="themeColor"></page-meta>
<view class="order">
<!--搜索-->
<view class="cate-search">
<view class="search-box">
<input class="uni-input" maxlength="50" v-model="searchText" confirm-type="search" placeholder="请输入商品名称/订单编号" @confirm="search()"/>
<text class="iconfont icon-sousuo3" @click="search()"></text>
</view>
</view>
<!--选项卡-->
<view v-if="false" class="tabs">
<view
v-for="(item,index) in tabs" :key="index"
:class="['tabs-item',{'tabs-item-active': (item.status === tabs_active)}]"
@click="tabs_active = item.status"
>
{{ item.title }}
</view>
</view>
<!--订单列表-->
<mescroll-uni ref="mescroll" @getData="getList" top="70">
<block slot="list">
<view class="list" v-if="list.length > 0">
<view class="list-block" v-for="(item,index) in list" :key="index">
<view class="block-top">
<view class="left">订单号{{ item.order_no }}</view>
<view class="right">{{ status_text[item.status] }}</view>
</view>
<view class="block-content">
<view class="left">
<image class="top-image" :src="$util.img(item.goods_image)" mode="widthFix"></image>
</view>
<view class="right">
<view class="goods-name">{{ item.goods_name }}</view>
<view class="goods-num">数量{{ item.total }}</view>
<view class="goods-info">
总计<view class="goods-info-price"><text class="goods-info-unit"></text>{{ item.unit_price }}</view>
</view>
</view>
</view>
<view class="buttons">
<view class="button-item" @click="$util.redirectTo('/pages_promotion/futures/order_details',{ futures_id: item.id })">查看详情</view>
</view>
</view>
</view>
<view v-else>
<ns-empty :isIndex="false" text="无订单信息!"></ns-empty>
</view>
</block>
</mescroll-uni>
<!--登录弹框-->
<ns-login ref="login"></ns-login>
<!--加载动画-->
<loading-cover ref="loadingCover"></loading-cover>
</view>
</template>
<script>
export default {
data() {
return {
searchText: '',
// 选项卡all:全部stock:库存release:已上架sold:已售卖)
tabs_active: 'all',
tabs: [
{title: '全部', status: 'all'},
{title: '库存', status: 'stock'},
{title: '已上架', status: 'release'},
{title: '已售卖', status: 'sold'}
],
page_titles: {
all: '全部订单',
stock: '库存中订单',
release: '销售中订单',
sold: '已售卖订单',
},
list: [],
status_text: {
1 : '库存',
2 : '正在销售',
3 : '已售出',
4 : '提货中',
5 : '提货完成',
6 : '待支付',
7 : '捡漏',
}
};
},
components: {},
mixins: [],
onLoad(option) {
// 获取需要显示的订单类型
this.tabs_active = option.status || 'all';
// 获取页面标题
let pageTitle = this.page_titles[this.tabs_active];
uni.setNavigationBarTitle({
title: pageTitle
});
},
onShow() {},
onReady(){
// 判断是否登录
if (!uni.getStorageSync('token')) this.$refs.login.open('/pages_promotion/futures/list');
},
watch:{
tabs_active: {
handler(newStatus) {
if(this.$refs.mescroll) this.$refs.mescroll.refresh();
},
immediate: true
}
},
methods: {
// 订单搜索
search(){
this.$refs.mescroll.refresh();
},
// 获取订单列表
getList(mescroll) {
this.$api.sendRequest({
url: '/futures/api/futures/myList',
data: {
page: mescroll.num || 1,
page_size: mescroll.size || 10,
status: this.tabs_active,
search_text: this.searchText, // 搜索内容
},
success: res => {
if(parseInt(res.code) === 0){
mescroll.endSuccess(Object.keys(res.data.list).length);
//设置列表数据
if (parseInt(mescroll.num) === 1){
this.list = []; //如果是第一页需手动制空列表
}
this.list = this.list.concat(res.data.list); //追加新数据
}else {
this.msg = res.message;
}
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
},
fail: res => {
mescroll.endErr();
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
}
});
},
},
onBackPress(options) {
if (options.from === 'navigateBack') return false;
this.$util.redirectTo('/pages/member/index');
return true;
}
};
</script>
<style lang="scss" scoped>
.order{
background-color: #f8f8f8;// #f8f8f8
min-height: 100vh;
.cate-search {
width: calc(100% - 48rpx);
background: #ffffff;
padding: 10rpx 24rpx 0 24rpx;
/* #ifdef H5 */
padding-top: 30rpx;
/* #endif */
position: relative;
z-index: 998;
input {
font-size: $font-size-base;
height: 76rpx;
padding: 0 25rpx 0 30rpx;
line-height: 60rpx;
width: calc(100% - 120rpx);
}
text {
font-size: 32rpx;
color: $color-tip;
width: 120rpx;
text-align: center;
}
.search-box {
width: 100%;
background: $color-bg;
display: flex;
justify-content: center;
align-items: center;
border-radius: 100rpx;
}
}
.tabs{
width: 100vw;
height: 70rpx;
background-color: #FFFFFF;
display: inline-flex;
flex-direction: row;
flex-wrap: nowrap;
align-content: center;
justify-content: space-around;
align-items: center;
.tabs-item{
max-width: max-content;
height: 70rpx;
line-height: 70rpx;
font-size: 30rpx;
color: #000000;
}
.tabs-item-active{
color: #d86351;
position: relative;
}
.tabs-item-active:after{
content: "";
position: absolute;
left: 0;
bottom: 0;
height: 6rpx;
width: 100%;
background-color: #d86351;
}
}
.list{
width: calc(100vw - (30rpx * 2));
padding: 30rpx;
.list-block{
padding: 20rpx;
margin-bottom: 30rpx;
background-color: #FFFFFF;
border-radius: 20rpx;
.block-top{
width: 100%;
display: inline-flex;
flex-direction: row;
flex-wrap: nowrap;
align-items: center;
justify-content: space-between;
height: 50rpx;
.left{
line-height: 50rpx;
font-size: 26rpx;
color: #000000;
}
.right{
line-height: 40rpx;
font-size: 26rpx;
//color: #de6758;
//border: 2rpx solid #de6758;
height: 40rpx;
padding: 0 10rpx;
border-radius: 10rpx;
background: #de6758;
color: #ffffff;
}
}
.block-content{
--content-height--: 150rpx;
height: var(--content-height--);
width: 100%;
padding: 10rpx 0;
display: inline-flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: flex-start;
align-items: center;
.left{
height: var(--content-height--);
width: var(--content-height--);
border-radius: 10rpx;
overflow: hidden;
.top-image{
width: 100% !important;
height: 100%!important;
}
}
.right{
height: var(--content-height--);
width: calc(100% - var(--content-height--) - 20rpx);
padding-left: 20rpx;
.goods-name{
font-size: 26rpx;
font-weight: bold;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
height: 50rpx;
}
.goods-num{
display: inline-flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: flex-start;
align-items: center;
width: 100%;
font-size: 26rpx;
height: 50rpx;
}
.goods-info{
display: inline-flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: flex-start;
align-items: baseline;
width: 100%;
font-size: 26rpx;
height: 50rpx;
.goods-info-price{
color: #e05c3b;
.goods-info-unit{
font-size: 24rpx;
}
}
}
}
}
.buttons{
display: inline-flex;
justify-content: flex-end;
width: 100%;
.button-item{
height: 50rpx;
line-height: 50rpx;
color: #d74a2c;
border: 1rpx solid #d74a2c;
width: 160rpx;
text-align: center;
font-size: 26rpx;
border-radius: 10rpx;
}
}
}
}
}
</style>