|
|
- <template>
- <view class="page">
- <!-- 导航栏 -->
- <navbar title="订单中心" leftClick @leftClick="$utils.navigateBack" bgColor="#E3441A" color="#fff" />
-
- <!-- 未登录提示 -->
- <view class="not-login" v-if="!isLogin">
- <view class="tips">登录后查看您的订单信息</view>
- <view class="login-btn" @click="$utils.toLogin">立即登录</view>
- </view>
-
- <!-- 订单筛选 -->
- <view class="tabs" v-if="isLogin">
- <uv-tabs :list="tabs"
- :activeStyle="{color : '#fff', fontWeight : 600}"
- lineColor="#fff"
- :inactiveStyle="{color: 'rgba(255,255,255,.8)'}"
- lineHeight="8rpx"
- lineWidth="50rpx"
- :current="current"
- @click="clickTabs"></uv-tabs>
- </view>
-
- <view class="list" v-if="isLogin">
- <view class="item" v-for="(item, index) in list" @click="toOrderDetail(item.id)" :key="index">
- <view class="content" :key="index" v-for="(good, index) in item.commonOrderSkuList">
- <view class="top">
- <view class="service">
- {{ good.title }}
- </view>
- <view class="status">
- <text> {{ tabs[Number(item.state) + 1].name }}</text>
- </view>
- </view>
-
- <view class="main">
- <view class="left">
- <image mode="aspectFill" :src="good.image && good.image.split(',')[0]"></image>
- </view>
-
- <view class="right">
- <view class="text-hidden-1">
- 客户姓名:{{item.name}}
- </view>
- <view class="text-hidden-1">
- 下单时间:{{item.createTime}}
- </view>
- <view class="text-hidden-1">
- 联系电话:{{item.phone}}
- </view>
-
- </view>
- </view>
-
- </view>
-
- <view class="bottom">
- <view class="price">
- <text class="total-title">总价格:</text>
- <text class="unit">¥</text>
- <text class="num">{{item.price}}</text>
- <text class="c-unit">元</text>
- </view>
-
- <view @click.stop="toPayOrder(item)" class="btn" v-if="item.state == 0">
- 立即付款
- </view>
-
- <view @click.stop="cancelOrder(item)" class="btn" v-if="item.state == 0">
- 取消订单
- </view>
-
- <view class="btn" @click.stop="confirmOrder(item)" v-if="item.state == 2">
- 确认收货
- </view>
-
- <view @click.stop="$refs.customerServicePopup.open()" class="btn" v-if="item.state > 0">
- 联系客服
- </view>
- </view>
-
- </view>
- <view style="
- margin-top: 20rpx;
- min-width: 700rpx;">
- <uv-empty mode="list" v-if="list.length == 0"></uv-empty>
- </view>
- </view>
-
- <customerServicePopup ref="customerServicePopup" />
-
- <kefu></kefu>
-
- <tabber select="order" />
- </view>
- </template>
-
- <script>
- import {
- mapGetters
- } from 'vuex'
- import mixinsList from '@/mixins/list.js'
- import mixinsOrder from '@/mixins/order.js'
- import tabber from '@/components/base/tabbar.vue'
- import customerServicePopup from '@/components/config/customerServicePopup.vue'
-
- export default {
- mixins: [mixinsList, mixinsOrder],
- components: {
- tabber,
- customerServicePopup,
- },
- data() {
- return {
- isLogin: false,
- tabs: [{
- name: '全部'
- },
- {
- name: '待付款'
- },
- {
- name: '待发货'
- },
- {
- name: '待收货'
- },
- {
- name: '已完成'
- },
- {
- name: '已取消'
- }
- ],
- current: 0,
- mixinsListApi: '',
- }
- },
- onLoad(args) {
- this.current = args.type || 0
- this.checkLogin()
- },
- onShow() {
- this.checkLogin()
- },
- methods: {
- // 检查是否登录
- checkLogin() {
- const token = uni.getStorageSync('token')
- this.isLogin = !!token
-
- if (this.isLogin) {
- this.mixinsListApi = 'getOrderPageList'
- this.clickTabs({
- index: this.current
- })
- }
- },
-
- //点击tab栏
- clickTabs({
- index
- }) {
- if (index == 0) {
- delete this.queryParams.state
- } else {
- this.queryParams.state = index - 1
- }
- this.getData()
- },
- //跳转订单详情页面
- toOrderDetail(id) {
- uni.navigateTo({
- url: '/pages_order/order/orderDetail?id=' + id
- })
- },
- }
- }
- </script>
-
- <style scoped lang="scss">
- .page {}
-
- .not-login {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- height: 400rpx;
- background-color: #fff;
- margin: 20rpx;
- border-radius: 16rpx;
-
- .tips {
- font-size: 32rpx;
- color: #666;
- margin-bottom: 30rpx;
- }
-
- .login-btn {
- background-color: $uni-color;
- color: #fff;
- padding: 20rpx 80rpx;
- border-radius: 40rpx;
- font-size: 30rpx;
- }
- }
-
- .tabs {
- background: $uni-color;
- }
-
- .list {
- .item {
- width: calc(100% - 40rpx);
- background-color: #fff;
- margin: 20rpx;
- box-sizing: border-box;
- border-radius: 16rpx;
- padding: 30rpx;
-
- .content {
- .top {
- display: flex;
- justify-content: space-between;
- align-items: center;
- font-size: 34rpx;
-
- .status {
- font-weight: 600;
- color: #FFAC2F;
- flex-shrink: 0;
- margin-left: 20rpx;
- }
- }
-
- .main {
- display: flex;
- margin: 20rpx 0rpx;
-
- .left {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 180rpx;
- height: 180rpx;
-
- image {
- width: 95%;
- height: 95%;
- border-radius: 10rpx;
- }
- }
-
- .right {
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- width: calc(100% - 200rpx);
- color: #777;
- font-size: 26rpx;
- padding: 30rpx 20rpx;
- box-sizing: border-box;
- margin-left: 20rpx;
- border-radius: 10rpx;
- background-color: #F8F8F8;
- }
- }
- }
-
- .bottom {
- display: flex;
- justify-content: space-between;
- font-size: 25rpx;
-
- .price {
- .total-title {}
-
- .num {
- font-size: 36rpx;
- }
-
- .num,
- .unit,
- .c-unit {
- color: $uni-color;
- }
- }
-
- .btn {
- border: 1px solid #C7C7C7;
- padding: 10rpx 20rpx;
- border-radius: 40rpx;
- color: #575757;
- }
- }
- }
- }
- </style>
|