mall-uniapp/components/orderGoods/index.vue

137 lines
3.4 KiB
Vue
Raw Normal View History

2020-08-13 08:12:57 +00:00
<template>
<view class="orderGoods borRadius14">
<view class='total'>{{ totalNmu }}件商品</view>
<view class='goodWrapper pad30'>
<view class='item acea-row row-between-wrapper' v-for="(item,index) in cartInfo" :key="index"
@click="jumpCon(item.spuId)">
2020-08-13 08:12:57 +00:00
<view class='pictrue'>
<image :src='item.picUrl' />
2020-08-13 08:12:57 +00:00
</view>
<view class='text'>
<view class='acea-row row-between-wrapper'>
<view class='name line1'>{{ item.spuName }}</view>
<view class='num'>x {{ item.count }}</view>
2020-08-13 08:12:57 +00:00
</view>
<view class='attr line1'>
<text v-for="(property, propertyIndex) in item.properties" :key="propertyIndex" style="padding-right: 10rpx;">
{{ property.valueName }} 
</text>
</view>
<view class='money font-color'>{{ fen2yuan(item.price) }}</view>
2023-08-18 11:59:47 +00:00
<!-- 售后状态 -->
<!-- TODO 芋艿这样式不太合理应该顺着向右对齐 -->
<view class="evaluate" style="right: 60px;" v-if="afterSale" @click.stop="afterSaleTap(item)">
{{
item.afterSaleStatus === 0 ? '申请退款' :
item.afterSaleStatus === 10 ? '退款中' : '退款成功'
}}
</view>
<!-- 评价状态 -->
2023-08-18 11:59:47 +00:00
<view class='evaluate' v-if='item.commentStatus === false && evaluate === 2' @click.stop="evaluateTap(item)">评价</view>
<view class='evaluate' v-else-if="item.replyStatus === true">已评价</view>
2020-08-13 08:12:57 +00:00
</view>
</view>
</view>
</view>
</template>
<script>
import * as Util from '@/utils/util.js';
2020-08-13 08:12:57 +00:00
export default {
props: {
evaluate: {
type: Number,
default: 0, // 是否开启评价功能 0 - 不开启2 - 开启
2020-08-13 08:12:57 +00:00
},
2023-08-18 11:59:47 +00:00
afterSale: { // 是否开启售后功能
type: Boolean,
default: false,
},
2020-08-13 08:12:57 +00:00
cartInfo: {
type: Array,
default: function() {
return [];
}
},
orderId: {
type: String,
default: '',
},
jump: {
type: Boolean,
default: false,
},
productType: {
type: Number,
default: function() {
return 0;
}
2020-08-13 08:12:57 +00:00
}
},
data() {
return {
totalNmu: 0 // 商品数量
2020-08-13 08:12:57 +00:00
};
},
watch: {
cartInfo: function(nVal, oVal) {
2020-08-13 08:12:57 +00:00
let num = 0
nVal.forEach((item, index) => {
num += item.count
2020-08-13 08:12:57 +00:00
})
2023-08-18 11:59:47 +00:00
this.totalNmu = num
2020-08-13 08:12:57 +00:00
}
},
methods: {
evaluateTap(item) {
2020-08-13 08:12:57 +00:00
uni.navigateTo({
url: "/pages/users/goods_comment_con/index?orderItemId=" + item.id
2020-08-13 08:12:57 +00:00
})
},
2023-08-18 11:59:47 +00:00
afterSaleTap(item) {
if (item.afterSaleStatus === 0) {
uni.navigateTo({
url: "/pages/users/goods_return/index?orderId=" + item.orderId + '&orderItemId=' + item.id
})
return;
}
uni.navigateTo({
url: "/pages/users/user_return_detail/index?id=" + item.afterSaleId
})
},
jumpCon: function(id) {
let type = this.productType === 0 ?'normal':'video'
if (this.jump) {
2020-08-13 08:12:57 +00:00
uni.navigateTo({
url: `/pages/goods_details/index?id=${id}&type=${type}`
2020-08-13 08:12:57 +00:00
})
}
},
fen2yuan(price) {
return Util.fen2yuan(price)
},
2020-08-13 08:12:57 +00:00
}
}
</script>
<style scoped lang="scss">
.orderGoods {
background-color: #fff;
margin-top: 15rpx;
2020-08-13 08:12:57 +00:00
}
.orderGoods .total {
width: 100%;
height: 86rpx;
padding: 0 24rpx;
2020-08-13 08:12:57 +00:00
border-bottom: 2rpx solid #f0f0f0;
font-size: 30rpx;
color: #282828;
line-height: 86rpx;
box-sizing: border-box;
}
.pictrue image {
background: #f4f4f4;
}
2020-08-13 08:12:57 +00:00
</style>