增加签到活动

This commit is contained in:
2023-11-01 14:54:25 +08:00
parent 60041324ed
commit 76d57cea37
10 changed files with 155 additions and 31 deletions

1
components.d.ts vendored
View File

@@ -41,6 +41,7 @@ declare module '@vue/runtime-core' {
NutTextarea: typeof import('@nutui/nutui-taro')['Textarea']
NutUploader: typeof import('@nutui/nutui-taro')['Uploader']
Pay: typeof import('./src/components/Pay.vue')['default']
Popup: typeof import('./src/components/Popup.vue')['default']
RichEditor: typeof import('./src/components/RichEditor.vue')['default']
Ucharts: typeof import('./src/components/Ucharts.vue')['default']
Upload: typeof import('./src/components/Upload.vue')['default']

View File

@@ -63,3 +63,14 @@ export const getRefereeCode = () => request("/user/promotion", {}, "POST");
// 取消订单返回积分
export const qxOrder = (data: object) =>
request("/user/point/off", data, "POST");
// 用户签到
export const userSign = () =>
request("/sign/user", {}, "POST");
// 获取签到记录
export const getSignRecord = () =>
request("/sign/pulse/count", {}, "POST");
// 获取赠送总记录
export const getGiftRecord = (data: object) =>
request("/user/giftPulseRecord", data, "POST");

View File

@@ -57,6 +57,10 @@ export default defineAppConfig({
{
root: 'pages/mer',
pages: ['mer_detail/index']
},
{
root: 'pages/marketing',
pages: ['sign/index']
}
],
window: {

View File

@@ -1,11 +1,59 @@
<script setup lang="ts">
import {ref} from 'vue'
import Taro from '@tarojs/taro'
import {getSignRecord, userSign} from '@/api/user'
const show = ref(false)
Taro.useLoad(async () => {
show.value = true
// const res = await getSignRecord()
// console.log(res)
})
const toSign = async () => {
try {
await userSign()
Taro.showToast({
title: '签到成功',
icon: 'none'
})
} catch (e) {
console.log(e)
}
show.value = false
}
</script>
<template>
$END$
<nut-overlay v-model:visible="show" :lock-scroll="true" :close-on-click-overlay="false">
<view class="wrapper">
<view @click.stop="toSign">
<image class="image" src="../static/index/poppBg.png"/>
</view>
<view @click.stop="show = false">
<image class="icon" src="../static/index/close.png"/>
</view>
</view>
</nut-overlay>
</template>
<style scoped lang="scss">
<style lang="scss">
.wrapper {
display: flex;
height: 100%;
align-items: center;
justify-content: center;
flex-direction: column;
}
.image {
width: 500px;
height: 600px;
}
.icon {
width: 80px;
height: 80px;
}
</style>

View File

@@ -32,7 +32,7 @@
<view class="goodBox">
<view
class="good"
v-for="item in (merdata as any)"
v-for="item in (merdata as any[])"
:key="item.ID"
@click.stop="toMerDetails(item)"
>
@@ -53,6 +53,8 @@
</view>
</view>
</view>
<!-- 签到弹窗 -->
<Popup/>
</view>
</template>
@@ -62,6 +64,7 @@ import Taro from '@tarojs/taro'
import {bindParent, getBanner} from '@/api/user'
import {getMerList} from '@/api/goods'
import {calculateDistance} from '@/utils'
import Popup from "@/components/Popup.vue";
const searchValue = ref('')

View File

@@ -0,0 +1,3 @@
export default definePageConfig({
navigationBarTitleText: "每日签到",
});

View File

@@ -3,9 +3,9 @@
</script>
<template>
$END$
<view></view>
</template>
<style scoped lang="scss">
<style lang="scss">
</style>

View File

@@ -1,7 +1,7 @@
<script lang="ts" setup>
import { ref } from "vue";
import {computed, ref} from "vue";
import {showToast, useLoad, getStorageSync} from "@tarojs/taro";
import { getIntegralDetail, getBeanDetail } from "@/api/user";
import {getIntegralDetail, getBeanDetail, getGiftRecord} from "@/api/user";
const tabValue = ref(1);
@@ -18,8 +18,25 @@ const tabsList = ref([
title: "豆子明细",
value: 2,
},
{
title: "活动赠送",
value: 4,
}
]);
const computerType = computed(() => {
return (val: number) => {
switch (val) {
case 5:
return '注册赠送';
case 6:
return '签到赠送';
case 7:
return '系统赠送';
}
}
})
const tabChange = (index: number) => {
tabValue.value = index;
data.value = [];
@@ -57,10 +74,13 @@ const getList = async () => {
};
if (tabValue.value === 1 || tabValue.value === 3) {
res = await getBeanDetail(newData);
} else {
} else if (tabValue.value === 2) {
delete data.Type;
res = await getIntegralDetail(newData);
} else {
res = await getGiftRecord(newData);
}
console.log(res);
data.value = res.data.data || [];
page.value.ItemCount = res.data.count;
} catch (error) {
@@ -114,16 +134,22 @@ const getList = async () => {
</view>
<view class="right">
<view v-if="tabValue === 1" style="color: green"
>-<text>{{ item.number }}积分</text></view
>-
<text>{{ item.number }}积分</text>
</view
>
<view v-if="tabValue === 3" style="color: red"
>+<text>{{ item.number }}</text
>积分</view
>+
<text>{{ item.number }}
</text
>
积分
</view
>
</view>
</view>
</view>
<view v-else>
<view v-else-if="tabValue === 2">
<view
class="card-list"
v-for="(item, index) in (data as any[])"
@@ -136,8 +162,34 @@ const getList = async () => {
</view>
<view class="right">
<view style="color: red"
>+<text>{{ item.number }}</text
>豆子</view
>+
<text>{{ item.number }}
</text
>
豆子
</view
>
</view>
</view>
</view>
<view v-else-if="tabValue === 4">
<view
class="card-list"
v-for="(item, index) in (data as any[])"
:key="index"
>
<view class="left">
<view class="text">类型{{ computerType(item.type) }}</view>
<view>时间{{ item.add_time.slice(0, 10) }}</view>
</view>
<view class="right">
<view style="color: red"
>+
<text>{{ item.number }}
</text
>
豆子
</view
>
</view>
</view>
@@ -159,6 +211,7 @@ const getList = async () => {
left: 50%;
transform: translateX(-50%);
}
.card {
width: 90%;
height: 300px;
@@ -230,6 +283,7 @@ const getList = async () => {
background-color: #ff0000;
}
}
.card-list {
margin: 10px 20px;
background-color: #fff;

BIN
src/static/index/close.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
src/static/index/poppBg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB