deming/components/mine/order-item/index.vue

207 lines
5.5 KiB
Vue
Raw Normal View History

2020-06-08 15:23:23 +08:00
<template>
<view class="order-item">
<view class="order-title">
<view class="store-info">
2020-07-07 17:47:00 +08:00
<image :src="order.extend_store.store_avatar"></image>
<view class="store-name">{{ order.extend_store.store_name }}</view>
2020-06-08 15:23:23 +08:00
</view>
2020-07-10 17:38:21 +08:00
<view class="order-status">{{ state }}</view>
2020-06-08 15:23:23 +08:00
</view>
2020-07-07 17:47:00 +08:00
<view class="goods-info">
2020-07-10 17:38:21 +08:00
<view class="goods-item" @click="toOtherPage('Details')" v-for="goods in order.extend_order_goods" :key="goods.goods_id">
2020-07-07 17:47:00 +08:00
<image :src="goods.goods_image"></image>
<view class="goods-text">
<view class="goods-name u-line-2">{{ goods.goods_name }}</view>
<view class="goods-sku u-line-1" v-if="order.order_state !== 20 && order.order_state !== 40">XL;红色条纹XL;红色条纹XL;红色条纹</view>
<view class="goods-time u-line-1" v-if="order.order_state == 10 || order.order_state == 10">距离结束23:23:38</view>
<view class="goods-price u-line-1" v-if="order.order_state == 20 || order.order_state == 40">总价99.00实付款99</view>
<view class="goods-date" v-if="order.order_state == 20 || order.order_state == 40">
<image src="@/pageE/static/mine/26.png"></image>
2020-07-10 09:03:19 +08:00
<view>{{ order.add_time | date }}</view>
2020-07-07 17:47:00 +08:00
</view>
2020-06-08 15:23:23 +08:00
</view>
</view>
</view>
2020-07-07 17:47:00 +08:00
<view class="order-btn" v-if="[10, 30, 20, 40].indexOf(order.order_state) >= 0">
2020-07-14 10:13:27 +08:00
<view class="logistics" v-if="order.order_state == 30">确认收货</view>
2020-07-10 17:38:21 +08:00
<view class="logistics" v-if="order.order_state == 30" @click="toOtherPage('Logistics')">查看物流</view>
<view class="comment" v-if="order.order_state == 40 && order.evaluation_state == 0" @click="toOtherPage('Comment')">立即评价</view>
2020-07-14 17:43:15 +08:00
<view class="calcel" v-if="order.order_state == 10" @click="cancelOrder">取消支付</view>
2020-07-07 17:47:00 +08:00
<view class="payment" v-if="order.order_state == 10">立即支付</view>
2020-07-10 17:38:21 +08:00
<view class="service" v-if="order.order_state == 20">联系官方客服</view>
<view class="submit" v-if="order.order_state == 20">提交官方审核</view>
2020-06-08 15:23:23 +08:00
</view>
</view>
</template>
<script>
export default {
data() {
2020-07-10 17:38:21 +08:00
return {
2020-07-14 10:13:27 +08:00
state: '', // 1: 待收货 2: 待评价 3: 交易成功 4: 已取消 5: 已退款 6: 待支付, 7: 售后
2020-07-10 17:38:21 +08:00
}
2020-06-08 15:23:23 +08:00
},
props: {
2020-07-07 17:47:00 +08:00
order: Object
},
2020-07-10 17:38:21 +08:00
created() {
this.viewState();
},
methods: {
viewState() {
2020-07-07 17:47:00 +08:00
let state;
2020-07-10 17:38:21 +08:00
switch (this.order.order_state) {
case 0: // 已取消
2020-07-07 17:47:00 +08:00
state = '已取消';
break;
2020-07-10 17:38:21 +08:00
case 10: // 未付款
state = '待支付';
2020-07-07 17:47:00 +08:00
break;
2020-07-10 17:38:21 +08:00
case 20: // 已付款
state = '交易成功';
2020-07-07 17:47:00 +08:00
break;
2020-07-10 17:38:21 +08:00
case 30: // 已发货
state = '待收货';
2020-07-07 17:47:00 +08:00
break;
2020-07-10 17:38:21 +08:00
case 40: // 已收货
if(this.order.evaluation_state == 0) state = '待评价';
else state = '交易成功'
2020-07-07 17:47:00 +08:00
break;
default:
break;
}
2020-07-10 17:38:21 +08:00
if(this.order.refund_state) state = '已退款';
2020-07-14 10:13:27 +08:00
// 申请退款
if(this.order.refund_data) {
if([1, 2].indexOf(this.order.refund_data.refund_state) >= 0) state = '待退款';
if(this.order.refund_data.refund_state == 3) state = '已退款';
}
2020-07-10 17:38:21 +08:00
this.state = state;
2020-07-07 17:47:00 +08:00
},
2020-07-14 17:43:15 +08:00
cancelOrder() {
this.$u.api.cancelOrder({
order_id: this.order.order_id,
}).then(res => {
if(res.errCode == 0) {
this.$emit("refreshOrderList", { reload: 'again' });
}
})
},
2020-07-10 17:38:21 +08:00
toOtherPage(url) {
this.$u.route('/pageE/order/' + url, {
oid: this.order.order_id,
2020-06-08 15:23:23 +08:00
});
},
},
};
</script>
<style lang="scss" scoped>
.order-item {
width: 690rpx;
background: rgba(255,255,255,1);
border-radius: 20rpx;
padding: 30rpx;
.order-title {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 20rpx;
.store-info {
display: flex;
align-items: center;
> image {
width: 50rpx;
height: 50rpx;
border-radius: 50%;
margin-right: 15rpx;
}
.store-name {
font-size: 26rpx;
color: rgba(51,51,51,1);
}
}
.order-status {
font-size: 28rpx;
color: rgba(255,120,15,1);
}
}
.goods-info {
2020-07-07 17:47:00 +08:00
.goods-item {
2020-06-08 15:23:23 +08:00
display: flex;
2020-07-07 17:47:00 +08:00
margin-bottom: 28rpx;
> image {
flex-shrink: 0;
width: 180rpx;
height: 160rpx;
border-radius: 10rpx;
margin-right: 30rpx;
2020-06-08 15:23:23 +08:00
}
2020-07-07 17:47:00 +08:00
.goods-text {
2020-06-08 15:23:23 +08:00
display: flex;
2020-07-07 17:47:00 +08:00
flex-direction: column;
justify-content: space-between;
.goods-name {
font-size: 28rpx;
color: rgba(51,51,51,1);
line-height: 38rpx;
}
.goods-sku {
max-width: 230rpx;
background: rgba(236,236,236,1);
border-radius: 6rpx;
padding: 10rpx 15rpx;
font-size: 24rpx;
color: rgba(153,153,153,1);
}
.goods-time {
font-size: 24rpx;
color: rgba(255,49,49,1);
}
.goods-price {
font-size: 24rpx;
color: rgba(253,211,96,1);
}
.goods-date {
display: flex;
align-items: center;
font-size: 24rpx;
color: rgba(153,153,153,1);
> image {
width: 24rpx;
height: 24rpx;
margin-right: 21rpx;
}
2020-06-08 15:23:23 +08:00
}
}
}
}
.order-btn {
display: flex;
justify-content: flex-end;
@mixin btn-class($width, $color) {
width: $width;
height: 60rpx;
border: 2rpx solid $color;
color: $color;
border-radius: 30rpx;
padding: 15rpx 23rpx;
font-size: 28rpx;
&:not(:last-child) {
margin-right: 30rpx;
}
}
.logistics, .comment, .payment {
@include btn-class($width: 160rpx, $color: rgba(255,119,15,1));
}
2020-07-10 09:03:19 +08:00
.calcel {
@include btn-class($width: 160rpx, $color: rgba(155,153,153,1));
}
2020-06-08 15:23:23 +08:00
.service {
@include btn-class($width: 216rpx, $color: rgba(155,153,153,1));
}
.submit {
@include btn-class($width: 216rpx, $color: rgba(255,119,15,1));
}
}
}
</style>