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

275 lines
7.2 KiB
Vue
Raw Normal View History

2020-06-08 07:23:23 +00:00
<template>
2020-08-08 04:07:50 +00:00
<view class="order-item" v-if="order.extend_store">
2020-06-08 07:23:23 +00:00
<view class="order-title">
<view class="store-info">
2020-07-07 09:47:00 +00:00
<image :src="order.extend_store.store_avatar"></image>
<view class="store-name">{{ order.extend_store.store_name }}</view>
2020-06-08 07:23:23 +00:00
</view>
2020-07-10 09:38:21 +00:00
<view class="order-status">{{ state }}</view>
2020-06-08 07:23:23 +00:00
</view>
2020-07-07 09:47:00 +00:00
<view class="goods-info">
2020-09-05 08:11:53 +00:00
<view class="goods-item" @click="toOtherPage('Details')" v-for="(goods,index) in order.extend_order_goods" :key="index">
2020-07-07 09:47:00 +00:00
<image :src="goods.goods_image"></image>
<view class="goods-text">
<view class="goods-name u-line-2">{{ goods.goods_name }}</view>
2020-08-14 03:24:44 +00:00
<view class="goods-sku u-line-1" v-if="order.order_state !== 20 && order.order_state !== 40 && goods.goods_spec">{{ goods.goods_spec | concatSpec }}</view>
2020-08-13 03:54:44 +00:00
<!-- <view class="goods-time u-line-1" v-if="order.view_type == 1">结束时间{{ order.end_time | date('yyyy-mm-dd hh:MM') }}</view> -->
2020-07-25 07:17:52 +00:00
<view class="goods-price u-line-1" v-if="order.order_state == 20 || order.order_state == 40">总价{{ goods.goods_price }}实付款{{ goods.goods_pay_price }}</view>
2020-07-07 09:47:00 +00:00
<view class="goods-date" v-if="order.order_state == 20 || order.order_state == 40">
<image src="@/pageE/static/mine/26.png"></image>
2020-08-03 10:38:04 +00:00
<view>{{ order.add_time | date('yyyy-mm-dd hh:MM') }}</view>
2020-07-07 09:47:00 +00:00
</view>
2020-06-08 07:23:23 +00:00
</view>
</view>
</view>
2020-08-13 09:05:02 +00:00
<view class="order-btn" v-if="[1, 2, 3, 4, 8, 11].indexOf(order.view_type) >= 0">
2020-08-13 08:07:19 +00:00
<!-- || order.view_type == 2 -->
2020-08-17 04:11:38 +00:00
<view class="cancel" v-if="(order.view_type == 3 || order.view_type == 2) && order.is_refund == 1" @click="toOtherPage('RefundOrder')">申请退款</view>
2020-09-07 03:32:52 +00:00
<view class="cancel" v-if="order.view_type == 3 && order.shipping_code && (order.store_deliver_type ? order.store_deliver_type != 3 : order.member_deliver_type != 3)" @click="toOtherPage('Logistics')">查看物流</view>
2020-07-31 13:47:41 +00:00
<view class="logistics" v-if="order.view_type == 3" @click="confirmReceive">确认收货</view>
<view class="comment" v-if="order.view_type == 4" @click="toOtherPage('Comment')">立即评价</view>
2020-08-01 08:36:48 +00:00
<view class="cancel" v-if="order.view_type == 1" @click="cancelOrder">取消支付</view>
2020-08-13 07:41:03 +00:00
<!-- <view class="cancel" v-if="order.view_type == 9" @click="cancelOrder">取消订单</view> -->
2020-08-14 09:57:13 +00:00
<view class="phone" v-if="order.view_type == 3 && order.takeawayer_phone" @click="makePhone(order.takeawayer_phone)">
<u-icon name="phone-fill" color="#FF780F" size="28"></u-icon>
<text>联系骑手</text>
</view>
2020-08-13 07:41:03 +00:00
<!-- || order.view_type == 9 -->
<view class="payment" v-if="order.view_type == 1" @click="payNow(order.pay_sn, order.order_amount,order.order_id)">立即支付</view>
2020-07-31 13:47:41 +00:00
<view class="service" v-if="order.view_type == 8">联系官方客服</view>
<view class="submit" v-if="order.view_type == 8">提交官方审核</view>
2020-06-08 07:23:23 +00:00
</view>
</view>
</template>
<script>
2020-07-25 07:17:52 +00:00
import common from '@/static/js/common.js';
2020-06-08 07:23:23 +00:00
export default {
data() {
2020-07-10 09:38:21 +00:00
return {
}
2020-06-08 07:23:23 +00:00
},
props: {
2020-07-07 09:47:00 +00:00
order: Object
},
2020-08-06 09:52:25 +00:00
mounted() {
2020-08-17 04:11:38 +00:00
// this.viewState();
2020-07-10 09:38:21 +00:00
},
2020-08-14 03:24:44 +00:00
filters: {
concatSpec(value) {
let spec = '';
for (const key in value) {
if (value.hasOwnProperty(key)) {
const element = value[key];
spec = spec + element + ';'
}
}
return spec;
}
},
2020-07-10 09:38:21 +00:00
methods: {
2020-07-14 09:43:15 +00:00
cancelOrder() {
this.$u.api.cancelOrder({
order_id: this.order.order_id,
}).then(res => {
if(res.errCode == 0) {
2020-07-31 13:47:41 +00:00
this.$emit("refreshOrderList");
}
this.$u.toast(res.message);
})
2020-08-01 08:36:48 +00:00
},
2020-07-31 13:47:41 +00:00
confirmReceive() {
this.$u.api.confirmReceive({
order_id: this.order.order_id,
}).then(res => {
if(res.errCode == 0) {
this.$emit("refreshOrderList");
2020-07-14 09:43:15 +00:00
}
2020-07-27 09:59:47 +00:00
this.$u.toast(res.message);
2020-07-14 09:43:15 +00:00
})
},
2020-07-10 09:38:21 +00:00
toOtherPage(url) {
this.$u.route('/pageE/order/' + url, {
oid: this.order.order_id,
2020-08-17 04:11:38 +00:00
type:this.order.view_type
2020-06-08 07:23:23 +00:00
});
},
2020-08-04 13:46:52 +00:00
payNow(pay_sn, order_amount, id) {
2020-07-25 07:17:52 +00:00
this.$u.route('/pageC/cart/cashier', {
pay_sn: pay_sn,
price: order_amount,
2020-08-04 13:46:52 +00:00
order_id: id
2020-07-25 07:17:52 +00:00
});
},
2020-08-14 09:57:13 +00:00
makePhone(phone) {
uni.makePhoneCall({
phoneNumber: phone
});
}
2020-06-08 07:23:23 +00:00
},
2020-08-17 04:11:38 +00:00
computed:{
state() {
let state;
// console.log(this.order.view_type);
switch (this.order.view_type) {
case 1:
state = '待支付';
break;
case 2:
state = '待发货';
break;
case 3:
state = '待收货';
break;
case 4:
state = '待评价';
break;
case 5:
state = '交易成功';
break;
case 6:
state = '待退款';
break;
case 7:
2020-09-21 08:58:25 +00:00
state = '商家已退款';
2020-08-17 04:11:38 +00:00
break;
case 9:
state = '拼团中';
break;
case 10:
state = '已取消';
break;
case 11:
2020-09-21 08:58:25 +00:00
state = '商家已拒绝';
2020-09-21 08:42:38 +00:00
case 12:
2020-09-21 08:58:25 +00:00
state = '平台已退款';
2020-08-17 04:11:38 +00:00
break;
default:
break;
}
// console.log(state);
return state;
},
}
2020-06-08 07:23:23 +00: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;
2020-07-25 07:17:52 +00:00
background-color: aquamarine;
2020-06-08 07:23:23 +00:00
}
.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 09:47:00 +00:00
.goods-item {
2020-06-08 07:23:23 +00:00
display: flex;
2020-07-07 09:47:00 +00:00
margin-bottom: 28rpx;
> image {
flex-shrink: 0;
width: 180rpx;
height: 160rpx;
border-radius: 10rpx;
margin-right: 30rpx;
2020-06-08 07:23:23 +00:00
}
2020-07-07 09:47:00 +00:00
.goods-text {
2020-08-14 03:30:49 +00:00
display: flex;
flex-direction: column;
justify-content: space-between;
2020-07-07 09:47:00 +00:00
.goods-name {
font-size: 28rpx;
color: rgba(51,51,51,1);
line-height: 38rpx;
}
.goods-sku {
2020-08-14 03:30:49 +00:00
align-self: baseline;
2020-07-07 09:47:00 +00:00
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 07:23:23 +00:00
}
}
}
}
.order-btn {
display: flex;
justify-content: flex-end;
@mixin btn-class($width, $color) {
2020-08-14 09:57:13 +00:00
// width: $width;
2020-06-08 07:23:23 +00:00
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-08-01 08:36:48 +00:00
.cancel {
2020-07-10 01:03:19 +00:00
@include btn-class($width: 160rpx, $color: rgba(155,153,153,1));
}
2020-06-08 07:23:23 +00: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));
}
2020-08-14 09:57:13 +00:00
.phone {
@include btn-class($width: 206rpx, $color: rgba(255,119,15,1));
display: flex;
align-items: center;
justify-content: center;
.u-icon {
margin-right: 10rpx;
}
}
2020-06-08 07:23:23 +00:00
}
}
</style>