parent
d175b3dd26
commit
6a1b442c3c
|
@ -1,11 +1,11 @@
|
||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<view class='my-order'>
|
<view class='my-order'>
|
||||||
<view class='header bg-color'>
|
<!-- 顶部统计 -->
|
||||||
|
<view class='header bg-color'>
|
||||||
<view class='picTxt acea-row row-between-wrapper'>
|
<view class='picTxt acea-row row-between-wrapper'>
|
||||||
<view class='text'>
|
<view class='text'>
|
||||||
<view class='name'>订单信息</view>
|
<view class='name'>订单信息</view>
|
||||||
<view>消费订单:{{orderData.orderCount || 0}} 总消费:¥{{Number(orderData.sumPrice).toFixed(2) || 0}}</view>
|
|
||||||
</view>
|
</view>
|
||||||
<view class='pictrue'>
|
<view class='pictrue'>
|
||||||
<image src='../../../static/images/orderTime.png'></image>
|
<image src='../../../static/images/orderTime.png'></image>
|
||||||
|
@ -13,283 +13,224 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class='nav acea-row row-around'>
|
<view class='nav acea-row row-around'>
|
||||||
<view class='item' :class='orderStatus==0 ? "on": ""' @click="statusClick(0)">
|
<view class='item' :class='orderStatus === undefined ? "on": ""' @click="statusClick()">
|
||||||
|
<view>全部</view>
|
||||||
|
<view class='num'>{{ orderData.allCount || 0}}</view>
|
||||||
|
</view>
|
||||||
|
<view class='item' :class='orderStatus === 0 ? "on": ""' @click="statusClick(0)">
|
||||||
<view>待付款</view>
|
<view>待付款</view>
|
||||||
<view class='num'>{{orderData.unPaidCount || 0}}</view>
|
<view class='num'>{{orderData.unpaidCount || 0}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class='item' :class='orderStatus==1 ? "on": ""' @click="statusClick(1)">
|
<view class='item' :class='orderStatus === 10 ? "on": ""' @click="statusClick(10)">
|
||||||
<view>待发货</view>
|
<view>待发货</view>
|
||||||
<view class='num'>{{orderData.unShippedCount || 0}}</view>
|
<view class='num'>{{orderData.undeliveredCount || 0}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class='item' :class='orderStatus==2 ? "on": ""' @click="statusClick(2)">
|
<view class='item' :class='orderStatus === 20 ? "on": ""' @click="statusClick(20)">
|
||||||
<view>待收货</view>
|
<view>待收货</view>
|
||||||
<view class='num '>{{orderData.receivedCount || 0}}</view>
|
<view class='num '>{{orderData.deliveredCount || 0}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class='item' :class='orderStatus==3 ? "on": ""' @click="statusClick(3)">
|
<view class='item' :class='orderStatus === 30 ? "on": ""' @click="statusClick(30, false)">
|
||||||
<view>待评价</view>
|
<view>待评价</view>
|
||||||
<view class='num'>{{orderData.evaluatedCount || 0}}</view>
|
<view class='num'>{{orderData.uncommentedCount || 0}}</view>
|
||||||
</view>
|
|
||||||
<view class='item' :class='orderStatus==4 ? "on": ""' @click="statusClick(4)">
|
|
||||||
<view>已完成</view>
|
|
||||||
<view class='num'>{{orderData.completeCount || 0}}</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class='list'>
|
<view class='list'>
|
||||||
<view class='item' v-for="(item,index) in orderList" :key="index">
|
<view class='item' v-for="(order, index) in orderList" :key="index">
|
||||||
<view @click='goOrderDetails(item.orderId)'>
|
<view @click='goOrderDetails(order.orderId)'>
|
||||||
<view class='title acea-row row-between-wrapper'>
|
<view class='title acea-row row-between-wrapper'>
|
||||||
<view class="acea-row row-middle">
|
<view class="acea-row row-middle">
|
||||||
<text class="sign cart-color acea-row row-center-wrapper" v-if="item.activityType !== '普通' && item.activityType !== '核销'">{{item.activityType}}</text>
|
<text class="sign cart-color acea-row row-center-wrapper" v-if="order.typeName">{{ order.typeName }}</text>
|
||||||
<!-- <text class="sign cart-color acea-row row-center-wrapper" v-if="item.bargainId != 0">砍价</text>
|
<view>{{order.createTime}}</view>
|
||||||
<text class="sign cart-color acea-row row-center-wrapper" v-else-if="item.storeOrder.combinationId != 0">拼团</text>
|
|
||||||
<text class="sign cart-color acea-row row-center-wrapper" v-else-if="item.storeOrder.seckillId != 0">秒杀</text> -->
|
|
||||||
<view>{{item.createTime}}</view>
|
|
||||||
</view>
|
</view>
|
||||||
<view class='font-color'>{{item.orderStatus}}</view>
|
<!-- 订单状态 -->
|
||||||
<!-- <view v-if="item.status?item.status.type == 0:0" class='font-color'>待付款</view>
|
<view class='font-color'>{{order.orderStatus}}</view>
|
||||||
<view v-else-if="item.status?item.status.type == 1:0 && item.storeOrder.shippingType==1" class='font-color'>待发货</view>
|
<view v-if="order.status === 0" class="font-color">待付款</view>
|
||||||
<view v-else-if="item.status?item.status.type == 2:0 && item.storeOrder.shippingType==1" class='font-color'>待收货</view>
|
<view v-else-if="order.status === 10 && order.deliveryType === 1" class="font-color">待发货</view>
|
||||||
<view v-else-if="item.status?item.status.type == 3:0 && item.storeOrder.shippingType==1" class='font-color'>待评价</view>
|
<view v-else-if="order._status === 10 && order.deliveryType === 2" class="font-color">待核销</view>
|
||||||
<view v-else-if="item.status?item.status.type == 4:0 && item.storeOrder.shippingType==1" class='font-color'>已完成</view>
|
<view v-else-if="order.status === 20" class="font-color">待收货</view>
|
||||||
<view v-else-if="item.storeOrder.shippingType==2" class='font-color'>待核销</view> -->
|
<view v-else-if="order.status === 30 && !order.commentStatus" class="font-color">待评价</view>
|
||||||
|
<view v-else-if="order.status === 30 && order.commentStatus" class="font-color">已完成</view>
|
||||||
|
<view v-else-if="order.status === 40" class="font-color">已关闭</view>
|
||||||
</view>
|
</view>
|
||||||
<view class='item-info acea-row row-between row-top' v-for="(items,index) in item.orderInfoList" :key="index">
|
<!-- 订单项信息 -->
|
||||||
|
<view class='item-info acea-row row-between row-top' v-for="(item, index) in order.items" :key="index">
|
||||||
<view class='pictrue'>
|
<view class='pictrue'>
|
||||||
<image :src='items.image'></image>
|
<image :src='item.picUrl'></image>
|
||||||
</view>
|
</view>
|
||||||
<view class='text acea-row row-between'>
|
<view class='text acea-row row-between'>
|
||||||
<view class='name line2'>{{items.storeName}}</view>
|
<view class='name line2'>{{ item.spuName }}</view>
|
||||||
<view class='money'>
|
<view class='money'>
|
||||||
<view>¥{{items.price}}</view>
|
<view>¥{{ fen2yuan(item.price) }}</view>
|
||||||
<view>x{{items.cartNum}}</view>
|
<view>x{{ item.count }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class='totalPrice'>共{{item.totalNum}}件商品,总金额
|
<!-- 订单金额 -->
|
||||||
<text class='money font-color'>¥{{item.payPrice}}</text>
|
<view class='totalPrice'>共{{ order.productCount }}件商品,总金额
|
||||||
|
<text class='money font-color'>¥{{ fen2yuan(order.payPrice) }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class='bottom acea-row row-right row-middle'>
|
<!-- 订单操作区 -->
|
||||||
<view class='bnt cancelBnt' v-if="!item.paid" @click='cancelOrder(index,item.id)'>取消订单</view>
|
<view class='bottom acea-row row-right row-middle'>
|
||||||
<view class='bnt bg-color' v-if="!item.paid" @click='goPay(item.payPrice,item.orderId)'>立即付款</view>
|
<view class='bnt cancelBnt' v-if="order.status === 0" @click='cancelOrder(index, order.id)'>
|
||||||
<view class='bnt bg-color' v-else-if="item.status== 0 || item.status== 1 || item.status== 3" @click='goOrderDetails(item.orderId)'>查看详情</view>
|
取消订单
|
||||||
<view class='bnt bg-color' v-else-if="item.status==2" @click='goOrderDetails(item.orderId)'>去评价</view>
|
</view>
|
||||||
<view class='bnt cancelBnt' v-if="item.status == 3" @click='delOrder(item.id,index)'>删除订单</view>
|
<view class='bnt bg-color' v-if="order.status === 0" @click='goPay(order.id, order.payOrderId)'>
|
||||||
|
立即付款
|
||||||
|
</view>
|
||||||
|
<view class='bnt bg-color' v-if="order.status === 30 && !order.commentStatus" @click='goOrderDetails(order.id)'>
|
||||||
|
去评价
|
||||||
|
</view>
|
||||||
|
<view class='bnt cancelBnt' v-if="order.status === 40" @click='delOrder(order.id, index)'>
|
||||||
|
删除订单
|
||||||
|
</view>
|
||||||
|
<view class='bnt bg-color' @click='goOrderDetails(order.id)'>
|
||||||
|
查看详情
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- <view class='bottom acea-row row-right row-middle'>
|
|
||||||
<view class='bnt cancelBnt' v-if="item.status?item.status.type==0:0 || item.status?item.status.type == 9:0" @click='cancelOrder(index,item.id)'>取消订单</view>
|
|
||||||
<view class='bnt bg-color' v-if="item.status?item.status.type == 0:0" @click='goPay(item.payPrice,item.orderId)'>立即付款</view>
|
|
||||||
<view class='bnt bg-color' v-else-if="item.status?item.status.type == 1:0 || item.status?item.status.type == 9:0" @click='goOrderDetails(item.orderId)'>查看详情</view>
|
|
||||||
<view class='bnt bg-color' v-else-if="item.status?item.status.type == 2:0 && item.status.deliveryType" @click='goOrderDetails(item.orderId)'>查看详情</view>
|
|
||||||
<view class='bnt bg-color' v-else-if="item.status?item.status.type == 3:0" @click='goOrderDetails(item.orderId)'>去评价</view>
|
|
||||||
<view class='bnt bg-color' v-else-if="item.storeOrder.seckillId < 1 && item.storeOrder.bargainId < 1 && item.storeOrder.combinationId < 1 && item.status?item.status.type == 4:0"
|
|
||||||
@click='goOrderDetails(item.orderId)'>再次购买</view>
|
|
||||||
<view class='bnt cancelBnt' v-if="item.status?item.status.type == 4:0" @click='delOrder(item.id,index)'>删除订单</view>
|
|
||||||
</view> -->
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class='loadingicon acea-row row-center-wrapper' v-if="orderList.length>0">
|
<view class='loadingicon acea-row row-center-wrapper' v-if="orderList.length>0">
|
||||||
<text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
|
<text class='loading iconfont icon-jiazai' :hidden='!loading' /> {{loadTitle}}
|
||||||
</view>
|
</view>
|
||||||
<view v-if="orderList.length == 0">
|
<view v-if="orderList.length === 0">
|
||||||
<emptyPage title="暂无订单~"></emptyPage>
|
<emptyPage title="暂无订单~"></emptyPage>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class='noCart' v-if="orderList.length == 0 && page > 1">
|
<view class='noCart' v-if="orderList.length === 0 && page > 1">
|
||||||
<view class='pictrue'>
|
<view class='pictrue'>
|
||||||
<image src='/images/noOrder.png'></image>
|
<image src='/images/noOrder.png'></image>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- #ifdef MP -->
|
|
||||||
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
|
|
||||||
<!-- #endif -->
|
|
||||||
<home></home>
|
<home></home>
|
||||||
<payment :payMode='payMode' :pay_close="pay_close" @onChangeFun='onChangeFun' :order_id="pay_order_id" :totalPrice='totalPrice'></payment>
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {
|
import { orderCancel, orderDel } from '@/api/order.js';
|
||||||
getOrderList,
|
import { openOrderSubscribe } from '@/utils/SubscribeMessage.js';
|
||||||
orderData,
|
|
||||||
orderCancel,
|
|
||||||
orderDel
|
|
||||||
} from '@/api/order.js';
|
|
||||||
import {
|
|
||||||
openOrderSubscribe
|
|
||||||
} from '@/utils/SubscribeMessage.js';
|
|
||||||
import home from '@/components/home';
|
import home from '@/components/home';
|
||||||
import payment from '@/components/payment';
|
import payment from '@/components/payment';
|
||||||
import {
|
import { toLogin } from '@/libs/login.js';
|
||||||
toLogin
|
import { mapGetters } from "vuex";
|
||||||
} from '@/libs/login.js';
|
|
||||||
import {
|
|
||||||
mapGetters
|
|
||||||
} from "vuex";
|
|
||||||
// #ifdef MP
|
|
||||||
import authorize from '@/components/Authorize';
|
|
||||||
// #endif
|
|
||||||
import emptyPage from '@/components/emptyPage.vue'
|
import emptyPage from '@/components/emptyPage.vue'
|
||||||
export default {
|
import * as OrderApi from '@/api/trade/order.js';
|
||||||
|
import dayjs from '@/plugin/dayjs/dayjs.min.js';
|
||||||
|
import * as Util from '@/utils/util.js';
|
||||||
|
export default {
|
||||||
components: {
|
components: {
|
||||||
payment,
|
payment,
|
||||||
home,
|
home,
|
||||||
emptyPage,
|
emptyPage
|
||||||
// #ifdef MP
|
|
||||||
authorize
|
|
||||||
// #endif
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading: false, //是否加载中
|
loading: false, //是否加载中
|
||||||
loadend: false, //是否加载完毕
|
loadend: false, //是否加载完毕
|
||||||
loadTitle: '加载更多', //提示语
|
loadTitle: '加载更多', //提示语
|
||||||
orderList: [], //订单数组
|
orderList: [], // 订单数组
|
||||||
orderData: {}, //订单详细统计
|
orderData: {}, // 订单详细统计
|
||||||
orderStatus: 0, //订单状态
|
orderStatus: undefined, // Tab 的订单状态
|
||||||
|
commentStatus: undefined, // Tab 的评论状态
|
||||||
page: 1,
|
page: 1,
|
||||||
limit: 20,
|
limit: 20,
|
||||||
payMode: [{
|
|
||||||
name: "微信支付",
|
|
||||||
icon: "icon-weixinzhifu",
|
|
||||||
value: 'weixin',
|
|
||||||
title: '微信快捷支付'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "余额支付",
|
|
||||||
icon: "icon-yuezhifu",
|
|
||||||
value: 'yue',
|
|
||||||
title: '可用余额:',
|
|
||||||
number: 0
|
|
||||||
}
|
|
||||||
],
|
|
||||||
pay_close: false,
|
|
||||||
pay_order_id: '',
|
|
||||||
totalPrice: '0',
|
|
||||||
isAuto: false, //没有授权的不会自动授权
|
|
||||||
isShowAuth: false //是否隐藏授权
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: mapGetters(['isLogin', 'userInfo']),
|
computed: mapGetters(['isLogin', 'userInfo']),
|
||||||
onShow() {
|
onShow() {
|
||||||
if (this.isLogin) {
|
if (!this.isLogin) {
|
||||||
this.loadend = false;
|
toLogin();
|
||||||
this.page = 1;
|
return;
|
||||||
this.$set(this, 'orderList', []);
|
|
||||||
this.getOrderData();
|
|
||||||
this.getOrderList();
|
|
||||||
this.payMode[1].number = this.userInfo.nowMoney;
|
|
||||||
this.$set(this, 'payMode', this.payMode);
|
|
||||||
} else {
|
|
||||||
toLogin();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.loadend = false;
|
||||||
|
this.page = 1;
|
||||||
|
this.$set(this, 'orderList', []);
|
||||||
|
this.getOrderData();
|
||||||
|
this.getOrderList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onLoadFun() {
|
|
||||||
this.getOrderData();
|
|
||||||
this.getOrderList();
|
|
||||||
},
|
|
||||||
// 授权关闭
|
|
||||||
authColse: function(e) {
|
|
||||||
this.isShowAuth = e
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 事件回调
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
onChangeFun: function(e) {
|
|
||||||
let opt = e;
|
|
||||||
let action = opt.action || null;
|
|
||||||
let value = opt.value != undefined ? opt.value : null;
|
|
||||||
(action && this[action]) && this[action](value);
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 关闭支付组件
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
payClose: function() {
|
|
||||||
this.pay_close = false;
|
|
||||||
},
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad: function(options) {
|
onLoad: function(options) {
|
||||||
if (options.status) this.orderStatus = options.status;
|
if (options.status) {
|
||||||
|
this.orderStatus = options.status;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 获取订单统计数据
|
* 获取订单统计数据
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
getOrderData: function() {
|
getOrderData: function() {
|
||||||
let that = this;
|
OrderApi.getOrderCount().then(res => {
|
||||||
orderData().then(res => {
|
this.$set(this, 'orderData', res.data);
|
||||||
that.$set(that, 'orderData', res.data);
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 取消订单
|
* 切换类型
|
||||||
*
|
*/
|
||||||
*/
|
statusClick: function(status, commentStatus) {
|
||||||
cancelOrder: function(index, order_id) {
|
if (status === this.orderStatus) {
|
||||||
let that = this;
|
return;
|
||||||
if (!order_id) return that.$util.Tips({
|
}
|
||||||
title: '缺少订单号无法取消订单'
|
this.orderStatus = status;
|
||||||
});
|
this.commentStatus = commentStatus;
|
||||||
uni.showLoading({
|
this.loadend = false;
|
||||||
title: '正在删除中'
|
this.page = 1;
|
||||||
});
|
this.$set(this, 'orderList', []);
|
||||||
orderCancel(order_id).then(res => {
|
this.getOrderList();
|
||||||
uni.hideLoading();
|
},
|
||||||
return that.$util.Tips({
|
/**
|
||||||
title: '删除成功',
|
* 获取订单列表
|
||||||
icon: 'success'
|
*/
|
||||||
}, function() {
|
getOrderList: function() {
|
||||||
that.orderList.splice(index, 1);
|
if (this.loadend || this.loading) {
|
||||||
that.$set(that, 'orderList', that.orderList);
|
return;
|
||||||
that.$set(that.orderData, 'unpaid_count', that.orderData.unpaid_count - 1);
|
}
|
||||||
that.getOrderData();
|
this.loading = true;
|
||||||
});
|
this.loadTitle = "加载更多";
|
||||||
}).catch(err => {
|
OrderApi.getOrderPage({
|
||||||
return that.$util.Tips({
|
status: this.orderStatus,
|
||||||
title: err
|
commentStatus: this.commentStatus,
|
||||||
});
|
pageNo: this.page,
|
||||||
});
|
pageSize: this.limit
|
||||||
},
|
}).then(res => {
|
||||||
|
const list = res.data.list || [];
|
||||||
|
list.forEach(item => {
|
||||||
|
item.typeName = item.type === 1 ? '秒杀'
|
||||||
|
: item.type === 2 ? '砍价'
|
||||||
|
: item.type === 3 ? '拼团' : undefined;
|
||||||
|
});
|
||||||
|
|
||||||
|
// 设置结束
|
||||||
|
const loadend = list.length < this.limit;
|
||||||
|
this.orderList = this.$util.SplitArray(list, this.orderList);
|
||||||
|
this.$set(this, 'orderList', this.orderList);
|
||||||
|
this.loadend = loadend;
|
||||||
|
this.loading = false;
|
||||||
|
this.loadTitle = loadend ? "我也是有底线的" : '加载更多';
|
||||||
|
this.page = this.page + 1;
|
||||||
|
}).catch(err => {
|
||||||
|
this.loading = false;
|
||||||
|
this.loadTitle = "加载更多";
|
||||||
|
})
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 打开支付组件
|
* 打开支付组件
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
goPay(pay_price, order_id) {
|
goPay(id, payOrderId) {
|
||||||
this.$set(this, 'pay_close', true);
|
uni.navigateTo({
|
||||||
this.$set(this, 'pay_order_id', order_id);
|
url: `/pages/goods/cashier/index?order_id=${payOrderId}&from_type=order`
|
||||||
this.$set(this, 'totalPrice', pay_price);
|
})
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 支付成功回调
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
pay_complete: function() {
|
|
||||||
this.loadend = false;
|
|
||||||
this.page = 1;
|
|
||||||
this.$set(this, 'orderList', []);
|
|
||||||
this.$set(this, 'pay_close', false);
|
|
||||||
this.getOrderData();
|
|
||||||
this.getOrderList();
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 支付失败回调
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
pay_fail: function() {
|
|
||||||
this.pay_close = false;
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 去订单详情
|
* 去订单详情
|
||||||
*/
|
*/
|
||||||
goOrderDetails: function(order_id) {
|
goOrderDetails: function(order_id) {
|
||||||
if (!order_id) return that.$util.Tips({
|
if (!order_id) {
|
||||||
title: '缺少订单号无法查看订单详情'
|
return this.$util.Tips({
|
||||||
});
|
title: '缺少订单号无法查看订单详情'
|
||||||
|
});
|
||||||
|
}
|
||||||
// #ifdef MP
|
// #ifdef MP
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '正在加载',
|
title: '正在加载',
|
||||||
|
@ -302,79 +243,74 @@
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
})
|
})
|
||||||
// #endif
|
// #endif
|
||||||
// #ifndef MP
|
// #ifndef MP
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/order_details/index?order_id=' + order_id
|
url: '/pages/order_details/index?order_id=' + order_id
|
||||||
})
|
})
|
||||||
// #endif
|
// #endif
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* 取消订单 TODO 芋艿:未实现;
|
||||||
|
*/
|
||||||
|
cancelOrder: function(index, order_id) {
|
||||||
|
if (!order_id) {
|
||||||
|
return this.$util.Tips({
|
||||||
|
title: '缺少订单号无法取消订单'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
uni.showLoading({
|
||||||
|
title: '正在删除中'
|
||||||
|
});
|
||||||
|
orderCancel(order_id).then(res => {
|
||||||
|
uni.hideLoading();
|
||||||
|
return this.$util.Tips({
|
||||||
|
title: '删除成功',
|
||||||
|
icon: 'success'
|
||||||
|
}, () => {
|
||||||
|
this.orderList.splice(index, 1);
|
||||||
|
this.$set(this, 'orderList', this.orderList);
|
||||||
|
this.$set(this.orderData, 'unpaid_count', this.orderData.unpaid_count - 1);
|
||||||
|
this.getOrderData();
|
||||||
|
});
|
||||||
|
}).catch(err => {
|
||||||
|
return this.$util.Tips({
|
||||||
|
title: err
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 切换类型
|
* 删除订单 TODO 芋艿:未实现
|
||||||
*/
|
|
||||||
statusClick: function(status) {
|
|
||||||
if (status == this.orderStatus) return;
|
|
||||||
this.orderStatus = status;
|
|
||||||
this.loadend = false;
|
|
||||||
this.page = 1;
|
|
||||||
this.$set(this, 'orderList', []);
|
|
||||||
this.getOrderList();
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 获取订单列表
|
|
||||||
*/
|
|
||||||
getOrderList: function() {
|
|
||||||
let that = this;
|
|
||||||
if (that.loadend) return;
|
|
||||||
if (that.loading) return;
|
|
||||||
that.loading = true;
|
|
||||||
that.loadTitle = "加载更多";
|
|
||||||
getOrderList({
|
|
||||||
type: that.orderStatus,
|
|
||||||
page: that.page,
|
|
||||||
limit: that.limit,
|
|
||||||
}).then(res => {
|
|
||||||
let list = res.data.list || [];
|
|
||||||
let loadend = list.length < that.limit;
|
|
||||||
that.orderList = that.$util.SplitArray(list, that.orderList);
|
|
||||||
that.$set(that, 'orderList', that.orderList);
|
|
||||||
that.loadend = loadend;
|
|
||||||
that.loading = false;
|
|
||||||
that.loadTitle = loadend ? "我也是有底线的" : '加载更多';
|
|
||||||
that.page = that.page + 1;
|
|
||||||
}).catch(err => {
|
|
||||||
that.loading = false;
|
|
||||||
that.loadTitle = "加载更多";
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除订单
|
|
||||||
*/
|
*/
|
||||||
delOrder: function(order_id, index) {
|
delOrder: function(order_id, index) {
|
||||||
let that = this;
|
|
||||||
orderDel(order_id).then(res => {
|
orderDel(order_id).then(res => {
|
||||||
that.orderList.splice(index, 1);
|
this.orderList.splice(index, 1);
|
||||||
that.$set(that, 'orderList', that.orderList);
|
this.$set(this, 'orderList', this.orderList);
|
||||||
that.$set(that.orderData, 'unpaid_count', that.orderData.unpaid_count - 1);
|
this.$set(this.orderData, 'unpaid_count', this.orderData.unpaid_count - 1);
|
||||||
that.getOrderData();
|
this.getOrderData();
|
||||||
return that.$util.Tips({
|
return this.$util.Tips({
|
||||||
title: '删除成功',
|
title: '删除成功',
|
||||||
icon: 'success'
|
icon: 'success'
|
||||||
});
|
});
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
return that.$util.Tips({
|
return this.$util.Tips({
|
||||||
title: err
|
title: err
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
fen2yuan(price) {
|
||||||
|
return Util.fen2yuan(price)
|
||||||
|
},
|
||||||
|
formatDate: function(date) {
|
||||||
|
return dayjs(date).format("YYYY-MM-DD HH:mm:ss");
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onReachBottom: function() {
|
onReachBottom: function() {
|
||||||
this.getOrderList();
|
this.getOrderList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.my-order .header {
|
.my-order .header {
|
||||||
height: 250rpx;
|
height: 250rpx;
|
||||||
|
|
Loading…
Reference in New Issue