Files
kangyuan-mobile/pages/increment/components/increment/card_list.vue
T
2026-05-26 15:52:30 +08:00

98 lines
2.4 KiB
Vue

<template>
<view class="flex-row" @click="go">
<view class="w_176 h_176 radius12 bg0">
<image
class="w100 h100"
v-if="props.data?.picUrl"
:src="props.data.picUrl"
mode="scaleToFill"
/>
<image class="w100 h100" v-else src="/static/product_null.png" mode="scaleToFill" />
</view>
<view class="flex1 flex-column ju-between m-l-18">
<view>
<view class="size28 c0 lineTwo m-b-12">{{ props.data.productName }}</view>
<view class="size24 c19">{{ props.data.title }}</view>
</view>
<view class="flex-row ju-between">
<view class="c35 line56 size32"
>{{ props.data.price }}<span class="size24">积分</span>
</view>
<view
class="w_170 line56 bg35 radius12 center size28"
style="color: #ffffff"
@click.stop="sub"
>
{{
statusObj(parseInt(props?.data?.joinStatus) || 0, parseInt(props?.data?.status) || 0)
}}
</view>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import { ref, getCurrentInstance, defineProps } from 'vue';
import * as api from '@/sheep/api/increment';
const { proxy } = getCurrentInstance() as any;
let props = defineProps({
data: {
type: Object,
default: () => {
return {};
},
},
});
// status:1:已参加,0:未参加
// joinStatus:0:未开团,1:已开团,2:开团成功,3:开团失败
const statusObj = (joinStatus, status) => {
console.log(joinStatus, status);
let text = '未开团';
switch (status) {
case 0:
text = '未开团';
if (joinStatus === 1) {
text = '已参团';
} else {
text = '立即参团';
}
break;
case 1:
text = '已开团';
if (joinStatus === 1) {
text = '已参团';
} else {
text = '立即参团';
}
break;
case 2:
text = '开团成功';
break;
case 3:
text = '开团失败';
break;
}
return text;
};
const go = () => {
uni.navigateTo({
url: '/pages/increment/info?id=' + props.data.productId,
});
};
const sub = () => {
api
.joinGroup({
groupBuyId: props.data.groupBuyId,
})
.then((res) => {
if (res.code === 0) {
proxy.$emit('upDate');
}
});
};
</script>
<style scoped lang="scss"></style>