init
This commit is contained in:
@@ -0,0 +1,97 @@
|
||||
<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>
|
||||
@@ -0,0 +1,62 @@
|
||||
<template>
|
||||
<view class="tabBar bg16 h_100 flex-center ju-around">
|
||||
<view class="" v-for="(v, i) in nav" :key="i" @click="go(v)">
|
||||
<view class="flex-center">
|
||||
<image
|
||||
class="w_50 h_50"
|
||||
:src="`/static/increment/${v.icon == props.index ? v.icon1 : v.icon}.svg`"
|
||||
mode="scaleToFill"
|
||||
/>
|
||||
</view>
|
||||
<view class="size24 name" :class="{ c32: v.icon == props.index }">{{ v.name }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, getCurrentInstance } from 'vue';
|
||||
const { proxy } = getCurrentInstance() as any;
|
||||
let props = defineProps({
|
||||
index: {
|
||||
type: Number,
|
||||
default: 1,
|
||||
},
|
||||
});
|
||||
let nav = ref([
|
||||
{
|
||||
name: '拼分',
|
||||
icon: '1',
|
||||
icon1: '1_1',
|
||||
path: '/pages/increment/index',
|
||||
},
|
||||
// {
|
||||
// name: '报单',
|
||||
// icon: '2',
|
||||
// icon1: '2_1',
|
||||
// path: '/pages/increment/index'
|
||||
// },
|
||||
{
|
||||
name: '我的',
|
||||
icon: '3',
|
||||
icon1: '3_1',
|
||||
path: '/pages/increment/user',
|
||||
},
|
||||
]);
|
||||
const go = (v) => {
|
||||
if (v.icon == props.index) return;
|
||||
uni.redirectTo({ url: v.path });
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.tabBar {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 10;
|
||||
width: 100vw;
|
||||
}
|
||||
.name {
|
||||
color: #979797;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user