完成积分锁客模块

This commit is contained in:
gyq
2025-12-12 10:32:42 +08:00
parent 214026e859
commit f954bbd145
8 changed files with 399 additions and 21 deletions

View File

@@ -15,7 +15,7 @@
<image class="img" :src="item.goodsImageUrl" mode="aspectFill"></image>
</view>
<view class="icon border" v-if="includesString(item.goodsCategory, '优惠券')">
<couponIcon :item="item.couponInfo" typeKey="couponType" />
<couponIcon :item="item.couponInfo" typeKey="couponType" v-if="item.couponInfo" />
</view>
<view class="info-wrap">
<text class="name">{{ item.goodsName }}</text>

View File

@@ -20,7 +20,7 @@
<image class="img" :src="item.goodsImageUrl" mode="aspectFill"></image>
</view>
<view class="icon border" v-if="includesString(item.goodsCategory, '优惠券')">
<couponIcon :item="item.couponInfo" typeKey="couponType" />
<couponIcon :item="item.couponInfo" typeKey="couponType" v-if="item.couponInfo" />
</view>
<view class="info-wrap">
<text class="name">{{ item.pointsGoodsName }}</text>
@@ -176,28 +176,33 @@ function checkoutHandle(item) {
uni.showModal({
title: '注意',
content: `确认要核销吗?`,
success: async (res) => {
try {
if (res.confirm) {
uni.showLoading({
title: '核销中...',
mask: true
});
await goodsRecordCkecout(item.couponCode);
goodsRecordPageAjax();
uni.showToast({
title: '已核销',
icon: 'none'
});
}
} catch (error) {
console.log(error);
success: (res) => {
if (res.confirm) {
checkoutAjax(item.couponCode);
}
uni.hideLoading();
}
});
}
// 核销请求
async function checkoutAjax(couponCode) {
try {
uni.showLoading({
title: '核销中...',
mask: true
});
await goodsRecordCkecout(couponCode);
goodsRecordPageAjax();
uni.showToast({
title: '已核销',
icon: 'none'
});
} catch (error) {
console.log(error);
}
uni.hideLoading();
}
const refundLoading = ref(false);
const showRefundPopup = ref(false);
const refundForm = ref({
@@ -264,7 +269,8 @@ async function goodsRecordPageAjax(page = listData.page) {
defineExpose({
reachBottom,
goodsRecordPageAjax
goodsRecordPageAjax,
checkoutAjax
});
onMounted(() => {

View File

@@ -0,0 +1,147 @@
<template>
<view>
<view class="list">
<view class="item" v-for="item in listData.list" :key="item.id">
<view class="top">
<text class="t">用户ID{{ item.userId }}</text>
</view>
<view class="user-info">
<view class="left">
<u-avatar :src="item.headImg" shape="square" :size="50"></u-avatar>
<view class="info">
<text class="t">{{ item.nickName }}</text>
<text class="t">{{ item.phone }}</text>
</view>
</view>
<view class="right">
<text class="t1">当前积分</text>
<text class="t2">{{ item.pointBalance }}</text>
</view>
</view>
<view class="footer-wrap">
<view class="btn" @click="toDetail(item)">
<u-text type="primary" text="查看明细"></u-text>
</view>
</view>
</view>
</view>
<u-loadmore :status="listData.status"></u-loadmore>
</view>
</template>
<script setup>
import { ref, reactive, onMounted } from 'vue';
import { pointUserPage } from '@/http/api/market/point.js';
const listData = reactive({
page: 1,
size: 10,
status: 'loading',
list: []
});
function reachBottom() {
if (listData.status != 'nomore') {
listData.page++;
pointUserPageAjax();
}
}
// 获取用户所有门店下积分列表
async function pointUserPageAjax(page = listData.page) {
try {
const res = await pointUserPage({
page: page,
size: listData.size
});
if (listData.page == 1) {
listData.list = res.records;
} else {
listData.list.push(...res.records);
}
if (res.pageNumber >= res.totalPage) {
listData.status = 'nomore';
}
} catch (error) {
console.log(error);
}
}
// 去积分详情
function toDetail(item) {
uni.navigateTo({
url: `/pageMarket/points/userPointDetail?id=${item.id}&nickName=${item.nickName}&phone=${item.phone}`
});
}
defineExpose({
reachBottom
});
onMounted(() => {
pointUserPageAjax();
});
</script>
<style scoped lang="scss">
.list {
padding-bottom: 28upx;
.item {
background-color: #fff;
border-radius: 20upx;
padding: 28upx;
&:not(:first-child) {
margin-top: 28upx;
}
.top {
display: flex;
align-items: center;
justify-content: space-between;
.t {
font-size: 28upx;
color: #999;
}
}
.user-info {
display: flex;
padding: 28upx 0;
.left {
flex: 1;
display: flex;
.info {
flex: 1;
display: flex;
justify-content: center;
flex-direction: column;
padding-left: 10px;
.t {
font-size: 28upx;
color: #333;
}
}
}
.right {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.t1 {
font-size: 28upx;
color: #666;
}
.t2 {
color: #333;
font-size: 32upx;
font-weight: bold;
}
}
}
.footer-wrap {
display: flex;
justify-content: flex-end;
}
}
}
</style>