Commit 1bd8dd1b authored by 王炽's avatar 王炽

66666

parent e7af6a61
...@@ -39,3 +39,6 @@ export const checkInJSON = (activityId) => api.post('/c/activity/todo/checkIn', ...@@ -39,3 +39,6 @@ export const checkInJSON = (activityId) => api.post('/c/activity/todo/checkIn',
//完成任务接口 //完成任务接口
export const taskCompleteJSON = (activityId) => api.post('/c/activity/todo/complete', { activityId }); export const taskCompleteJSON = (activityId) => api.post('/c/activity/todo/complete', { activityId });
//获取积分权益券接口
export const getPointsBenefitCouponJSON = () => api.get('/c/resource/pointsBenefit/coupon');
\ No newline at end of file
{
"ok": true,
"success": true,
"msg": "获取积分权益券成功",
"code": "200",
"data": [
{
"resourcePositionCode": "COUPON_001",
"source": "INTEGRAL_EXCHANGE",
"skuId": "SKU001",
"itemId": "ITEM001",
"goodsName": "星飞帆4段儿童成长配方奶粉",
"appGoodsId": 5162055520238164,
"goodsIcon": "integral/1023/coupon1.png",
"goodsLogo": "integral/1023/coupon_logo1.png",
"credits": "1000",
"priceMarket": "2000",
"priceSale": "150",
"price": "150",
"goodsType": "COUPON",
"urlType": 2,
"url": "subPackages/shopMainProcess/product/index?productId={productId}&skuId={skuId}&entrySource=xmh_wechatmp_points_coupon",
"wxAppId": "wx4205ec55b793245e",
"envVersion": "release",
"sort": 1
},
{
"resourcePositionCode": "COUPON_002",
"source": "INTEGRAL_EXCHANGE",
"skuId": "SKU002",
"itemId": "ITEM002",
"goodsName": "飞鹤茁然儿童配方奶粉升级版",
"appGoodsId": 4309829677188336,
"goodsIcon": "integral/1023/coupon2.png",
"goodsLogo": "integral/1023/coupon_logo2.png",
"credits": "800",
"priceMarket": "1500",
"priceSale": "120",
"price": "120",
"goodsType": "COUPON",
"urlType": 2,
"url": "subPackages/shopMainProcess/product/index?productId={productId}&skuId={skuId}&entrySource=xmh_wechatmp_points_coupon",
"wxAppId": "wx4205ec55b793245e",
"envVersion": "release",
"sort": 2
},
{
"resourcePositionCode": "COUPON_003",
"source": "INTEGRAL_EXCHANGE",
"skuId": "SKU003",
"itemId": "ITEM003",
"goodsName": "茁护儿童配方奶粉",
"appGoodsId": 1234567890123456,
"goodsIcon": "integral/1023/coupon3.png",
"goodsLogo": "integral/1023/coupon_logo3.png",
"credits": "600",
"priceMarket": "1200",
"priceSale": "100",
"price": "100",
"goodsType": "COUPON",
"urlType": 2,
"url": "subPackages/shopMainProcess/product/index?productId={productId}&skuId={skuId}&entrySource=xmh_wechatmp_points_coupon",
"wxAppId": "wx4205ec55b793245e",
"envVersion": "release",
"sort": 3
},
{
"resourcePositionCode": "COUPON_004",
"source": "INTEGRAL_EXCHANGE",
"skuId": "SKU004",
"itemId": "ITEM004",
"goodsName": "经典爱本乳铁蛋白配方奶粉",
"appGoodsId": 9876543210987654,
"goodsIcon": "integral/1023/coupon4.png",
"goodsLogo": "integral/1023/coupon_logo4.png",
"credits": "1500",
"priceMarket": "3000",
"priceSale": "200",
"price": "200",
"goodsType": "COUPON",
"urlType": 2,
"url": "subPackages/shopMainProcess/product/index?productId={productId}&skuId={skuId}&entrySource=xmh_wechatmp_points_coupon",
"wxAppId": "wx4205ec55b793245e",
"envVersion": "release",
"sort": 4
},
{
"resourcePositionCode": "COUPON_005",
"source": "INTEGRAL_EXCHANGE",
"skuId": "SKU005",
"itemId": "ITEM005",
"goodsName": "飞鹤茁然高钙奶酪泡芙",
"appGoodsId": 1111222233334444,
"goodsIcon": "integral/1023/coupon5.png",
"goodsLogo": "integral/1023/coupon_logo5.png",
"credits": "300",
"priceMarket": "600",
"priceSale": "50",
"price": "50",
"goodsType": "COUPON",
"urlType": 2,
"url": "subPackages/shopMainProcess/product/index?productId={productId}&skuId={skuId}&entrySource=xmh_wechatmp_points_coupon",
"wxAppId": "wx4205ec55b793245e",
"envVersion": "release",
"sort": 5
},
{
"resourcePositionCode": "COUPON_006",
"source": "INTEGRAL_EXCHANGE",
"skuId": "SKU006",
"itemId": "ITEM006",
"goodsName": "金装1962-中老年高钙奶粉",
"appGoodsId": 5555666677778888,
"goodsIcon": "integral/1023/coupon6.png",
"goodsLogo": "integral/1023/coupon_logo6.png",
"credits": "500",
"priceMarket": "1000",
"priceSale": "80",
"price": "80",
"goodsType": "COUPON",
"urlType": 2,
"url": "subPackages/shopMainProcess/product/index?productId={productId}&skuId={skuId}&entrySource=xmh_wechatmp_points_coupon",
"wxAppId": "wx4205ec55b793245e",
"envVersion": "release",
"sort": 6
}
]
}
import { defineStore } from "pinia"; import { defineStore } from "pinia";
import { getSigninAndTaskInfoJSON, checkInJSON } from "../api/integral"; import { getSigninAndTaskInfoJSON, checkInJSON, getPointsBenefitCouponJSON } from "../api/integral";
import signinAndTaskInfoMock from '../mock/getSigninAndTaskInMock.json'; import signinAndTaskInfoMock from '../mock/getSigninAndTaskInMock.json';
import checkInMock from '../mock/checkIndata.json'; import checkInMock from '../mock/checkIndata.json';
import pointsBenefitCouponMock from '../mock/pointsBenefitCoupon.json';
export const useIntegralStore = defineStore("integral", { export const useIntegralStore = defineStore("integral", {
state: () => { state: () => {
return { return {
_signinAndTaskInfo: null, _signinAndTaskInfo: null,
_checkInData: null, // 新增:存储签到数据 _checkInData: null, // 新增:存储签到数据
_pointsBenefitCoupon: null, // 新增:存储积分权益券数据
}; };
}, },
actions: { actions: {
...@@ -32,9 +34,20 @@ export const useIntegralStore = defineStore("integral", { ...@@ -32,9 +34,20 @@ export const useIntegralStore = defineStore("integral", {
return res; return res;
} }
}, },
async getPointsBenefitCoupon(isdebug = false) {
if(isdebug) {
this._pointsBenefitCoupon = pointsBenefitCouponMock;
return pointsBenefitCouponMock;
}else{
const res = await getPointsBenefitCouponJSON();
this._pointsBenefitCoupon = res;
return res;
}
},
}, },
getters: { getters: {
signinAndTaskInfo : (state) => {return state._signinAndTaskInfo; }, signinAndTaskInfo : (state) => {return state._signinAndTaskInfo; },
checkInData : (state) => {return state._checkInData; }, checkInData : (state) => {return state._checkInData; },
pointsBenefitCoupon : (state) => {return state._pointsBenefitCoupon; },
}, },
}); });
\ No newline at end of file
...@@ -844,7 +844,7 @@ ...@@ -844,7 +844,7 @@
margin-top: 58rpx; margin-top: 58rpx;
.yiyequan_title { .yiyequan_title {
font-size: 36rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
color: #333333; color: #333333;
text-align: left; text-align: left;
......
...@@ -378,6 +378,7 @@ ...@@ -378,6 +378,7 @@
<!-- 积分价格容器 --> <!-- 积分价格容器 -->
<view class="benefit_points_container"> <view class="benefit_points_container">
<text class="benefit_points">{{ benefit.points }}积分</text> <text class="benefit_points">{{ benefit.points }}积分</text>
<text class="benefit_original_points" v-if="benefit.originalPoints">{{ benefit.originalPoints }}积分</text>
</view> </view>
<!-- 兑换按钮 --> <!-- 兑换按钮 -->
...@@ -1556,34 +1557,8 @@ const gongzhonghaoDescription = ref('长按关注星妈会公众号,了解更多 ...@@ -1556,34 +1557,8 @@ const gongzhonghaoDescription = ref('长按关注星妈会公众号,了解更多
const gongzhonghaoQrCodeUrl = ref('https://course.feihe.com/momclub-picture/homepage/qrcode_gzh.png'); const gongzhonghaoQrCodeUrl = ref('https://course.feihe.com/momclub-picture/homepage/qrcode_gzh.png');
// 异业券权益相关数据 // 异业券权益相关数据
const availableBenefits = ref(1); // 可兑换权益数量 const availableBenefits = ref(0); // 可兑换权益数量
const benefitList = ref([ const benefitList = ref([]);
{
id: 1,
name: '商品名称商品名称称商品名品名品名品名品...',
points: 100,
originalPoints: 500,
image: ''
},{
id: 1,
name: '商品名称商品名称称商品名品名品名品名品...',
points: 100,
originalPoints: 500,
image: ''
},{
id: 1,
name: '商品名称商品名称称商品名品名品名品名品...',
points: 100,
originalPoints: 500,
image: ''
},{
id: 1,
name: '商品名称商品名称称商品名品名品名品名品...',
points: 100,
originalPoints: 500,
image: ''
}
]);
//今天已经签到过 //今天已经签到过
const todaySigned = ref(false); const todaySigned = ref(false);
...@@ -1899,11 +1874,15 @@ onMounted(async () => { ...@@ -1899,11 +1874,15 @@ onMounted(async () => {
await userStore.loadMemberInfo(); await userStore.loadMemberInfo();
await integralStore.getSigninAndTaskInfo(isdebug.value); await integralStore.getSigninAndTaskInfo(isdebug.value);
await integralStore.getPointsBenefitCoupon(true);//isdebug.value);
//初始化签掉数据 //初始化签掉数据
initSignin(); initSignin();
//初始化积分权益券数据
initPointsBenefitCoupon();
//初始化ui //初始化ui
initNetData(); initNetData();
...@@ -1937,6 +1916,7 @@ onMounted(async () => { ...@@ -1937,6 +1916,7 @@ onMounted(async () => {
componentContent: "累计积分" componentContent: "累计积分"
}); });
} }
}); });
const initExposure = () => { const initExposure = () => {
...@@ -1986,6 +1966,31 @@ const initSignin = () => { ...@@ -1986,6 +1966,31 @@ const initSignin = () => {
}); });
} }
const initPointsBenefitCoupon = () => {
if(!integralStore?.pointsBenefitCoupon?.success){
console.log('获取积分权益券信息失败');
return;
}
const couponData = integralStore?.pointsBenefitCoupon?.data || [];
benefitList.value = couponData.map((item, index) => ({
id: item.itemId || index + 1,
name: item.goodsName || '权益名称文案占位...',
points: item.credits || 100,
originalPoints: item.priceMarket || 500,
image: item.goodsIcon || '',
price: item.price || '25',
priceSale: item.priceSale || '',
url: item.url || '',
urlType: item.urlType || 0,
wxAppId: item.wxAppId || '',
envVersion: item.envVersion || 'release'
}));
availableBenefits.value = benefitList.value.length;
console.log('积分权益券数据初始化完成:', benefitList.value);
}
const initNetData = () => { const initNetData = () => {
console.log('initNetData'); console.log('initNetData');
...@@ -2827,11 +2832,25 @@ const handleExchangeClick = (benefit, index) => { ...@@ -2827,11 +2832,25 @@ const handleExchangeClick = (benefit, index) => {
buttonName: `兑换权益-${benefit.name}`, buttonName: `兑换权益-${benefit.name}`,
}); });
// 如果有跳转链接,则跳转
if (benefit.url) {
const extra = {
appId: benefit.wxAppId,
envVersion: benefit.envVersion
};
jump({
type: benefit.urlType,
url: benefit.url,
extra: extra
});
} else {
// 这里可以添加兑换逻辑 // 这里可以添加兑换逻辑
uni.showToast({ uni.showToast({
title: `兑换${benefit.name}成功`, title: `兑换${benefit.name}成功`,
icon: 'success' icon: 'success'
}); });
}
} }
const downloadQrCode = (imgurl) => {//现在二维码图片 const downloadQrCode = (imgurl) => {//现在二维码图片
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment