Commit 3730162c authored by jt's avatar jt

x

parents 6570c19b f856c46e
......@@ -185,11 +185,14 @@ onMounted(async () => {
//获取邀请码和奖励
const res = await integralStore.getOriginInviteHome();
if(res.success && res.data?.unclaimedPrize) {
// const unionId = uni.getStorageSync('unionId');
const unclaimedPrize = res.data?.unclaimedPrize;
if(res.success && unclaimedPrize) {
globalStore.isShowInvitePrizePanel = true;
globalStore.inviteCount = res.data?.invitedCount;
globalStore.prizeName = res.data?.invitationImageUrl;//????
globalStore.prizeImage = res.data?.invitationImageUrl;
globalStore.prizeName = unclaimedPrize?.prizeName;
globalStore.prizeImage = res.data?.prizeImageUrl;
}
console.log('邀请活动首页数据:', res);
});
......
......@@ -34,7 +34,6 @@
justify-content: center;
box-shadow: 0 4rpx 20rpx rgba(211, 164, 88, 0.3);
transition: transform 0.2s ease;
z-index: 2;
&:active {
transform: translateX(-50%) scale(0.95);
......@@ -46,6 +45,16 @@
font-weight: bold;
}
}
.sharepage_login_button {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0.2;
background-color: #000;
}
}
}
......@@ -8,7 +8,14 @@
<view class="claim_button" @click="handleClaim">
<text class="claim_text">一键领取</text>
</view>
<button class="sharepage_login_button"
v-if="!isLogin"
open-type="getPhoneNumber"
@getphonenumber="onGetPhoneNumber"
:debug-mode="debugMode"
/>
</view>
<!-- 分享登录弹窗 -->
<!-- <sharepoplogin
......@@ -43,14 +50,14 @@ const showSharePopLogin = ref(false);
const showShareNPopNoLogin = ref(true);
const handlePageClick = () => {
console.log('handlePageClick');
if(!isLogin.value) {
needReinit.value = true;
jump({
type: JumpType.INNER,
url: "/pages/activity/register",
})
}
// console.log('handlePageClick');
// if(!isLogin.value) {
// needReinit.value = true;
// jump({
// type: JumpType.INNER,
// url: "/pages/activity/register",
// })
// }
};
// 获取store实例
......@@ -60,37 +67,97 @@ const integralStore = useIntegralStore();
const isLogin = computed(()=>{
//return false
console.log('isLogin--sharepage:', userStore.isLogin);
return userStore.isLogin;
})
const isnew = ref(false);
const inviteCode = ref('');
const unionId = ref('oQ9KswkD0qMVwPHQGslkHaJ0QxnE' || '');
onMounted(() => {
// 页面加载时显示分享未登录弹窗
// showShareNPopNoLogin.value = true;
const unionId = ref('');
const showPhone = ref(false);
// 获取邀请码参数
// 获取邀请码和unionId
const initInviteParams = () => {
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1];
const options = currentPage.options || {};
const inviteCode1 = options.inviteCode || '';
inviteCode.value = inviteCode1;
unionId.value = uni.getStorageSync('unionId');
console.log('unionIdsharepage:', unionId.value);
return { inviteCode: inviteCode1, unionId: unionId.value };
};
onMounted(() => {
// 页面加载时显示分享未登录弹窗
// showShareNPopNoLogin.value = true;
if(isLogin.value) {
// 获取邀请码参数
const { inviteCode: ivtCode, unionId: uid } = initInviteParams();
// 如果有邀请码,调用助力接口
if (inviteCode.value && isLogin.value) {
callAssistInvite(inviteCode1,unionId.value);
// 如果有邀请码,调用助力接口
if (ivtCode && isLogin.value) {
callAssistInvite(ivtCode, uid);
}
}
});
// Phone authorization
const onGetPhoneNumber = async (e) => {
console.log('onGetPhoneNumber', e.detail)
showLoading('授权中...')
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1];
const options = currentPage.options;
const incomingCode = options.inviteCode;
if (e.detail.errMsg === 'getPhoneNumber:ok') {
try {
// console.warn('onGetPhoneNumber', e.detail)
// 隐藏授权弹窗
userStore.phoneCallback(e.detail, null, null, async () => {
hideLoading()
// 重新获取用户信息(登录后)getphonenumber
await Promise.all([
userStore.loadUserInfo(),
userStore.loadMemberInfo(),
])
console.warn('授权后重新获取用户信息')
// 获取邀请码参数
const { inviteCode: ivtCode, unionId: uid } = initInviteParams();
// 如果有邀请码,调用助力接口
if (ivtCode && isLogin.value) {
callAssistInvite(ivtCode, uid);
}
}, {
wxLoginBusinessDTO: {
activityUserInvite915Code: incomingCode
}
})
} catch (error) {
hideLoading()
console.error('授权后处理失败:', error)
uni.showToast({title: '授权失败', icon: 'none'});
}
} else {
hideLoading()
uni.showToast({title: '授权失败', icon: 'none'});
}
};
// 调用助力接口
const callAssistInvite = async (ivtCode,unionId) => {
try {
// 获取用户unionId
const wxUnionId = userStore.unionId || '';
const res = await integralStore.assistInvite(ivtCode, unionId);
console.log('助力接口返回:', res);
......@@ -101,18 +168,20 @@ const callAssistInvite = async (ivtCode,unionId) => {
onShow(() => {
if(isLogin.value) {
if(isnew.value) {
globalStore.invateUseType = 'new';
//新用户注册登录后调用助力接口
gotoIntegral();
// 如果有邀请码,调用助力接口
if (inviteCode.value) {
callAssistInvite(ivtCode, unionId.value);
}
isnew.value = false;
}
// if(integralStore.assistInviteData.success && integralStore.assistInviteData.data.newUser) {
// globalStore.invateUseType = 'new';
// //新用户注册登录后调用助力接口
// gotoIntegral();
// // 如果有邀请码,调用助力接口
// if (inviteCode.value) {
// callAssistInvite(ivtCode, unionId.value);
// }
// isnew.value = false;
// }
}
});
......@@ -139,23 +208,18 @@ onShow(() => {
// 一键领取按钮点击事件
const handleClaim = () => {
if(!isLogin.value) {
needReinit.value = true;
jump({
type: JumpType.INNER,
url: "/pages/activity/register",
})
isnew.value = true;
}else{
// 设置邀请用户类型
if(isnew.value) {
globalStore.invateUseType = 'new';
} else {
globalStore.invateUseType = 'old';
}
showPhone.value = true;
return;
}
gotoIntegral();
// 设置邀请用户类型
if(integralStore.assistInviteData?.data?.newUser) {
globalStore.invateUseType = 'new';
} else {
globalStore.invateUseType = 'old';
}
gotoIntegral();
};
const gotoIntegral = () => {
......
......@@ -31,8 +31,8 @@
</view>
<!-- 购买限制 -->
<view class="purchase-limit-section" v-if="goodsData.goodsLimit">
<text class="purchase-limit">每人限{{ goodsData.goodsLimit }}</text>
<view class="purchase-limit-section" v-if="userBuyLimitCount">
<text class="purchase-limit">每人限{{ userBuyLimitCount }}</text>
</view>
<!-- 优惠券名称 -->
......@@ -120,7 +120,7 @@
<button class="modal-btn cancel-btn" @click="closeModal">取消</button>
<button class="modal-btn confirm-btn" @click="confirmExchange">确定</button>
</view>
<view class="modal-disclaimer">已发货商品非质量问题不退不换</view>
<view class="modal-disclaimer">{{ isPhysicalGoods() ? '已发货商品非质量问题不退不换' : '兑换完成后不退不换' }}</view>
</view>
<!-- 关闭按钮 -->
<view class="modal-close-btn" @click="closeModal">
......@@ -215,7 +215,7 @@ export default {
return true; // 未登录时按钮仍然可点击,会跳转到登录页
}
// 已登录用户:只有state=1时才能兑换
// 已登录用户:只有state=1时才能兑换,其他状态(包括状态3-已下架)都禁用按钮
return this.goodsData.goodsState === 1;
},
......@@ -621,6 +621,10 @@ export default {
// 积分不足:灰色背景
classes['insufficient-points'] = true;
break;
case 3:
// 商品已下架:灰色背景
classes['sold-out'] = true;
break;
case 7:
// 等级不足:灰色背景
classes['insufficient-level'] = true;
......@@ -654,6 +658,8 @@ export default {
return '立即兑换';
case 2:
return '积分不足';
case 3:
return '商品已下架';
case 7:
return '等级不足';
case 6:
......@@ -661,6 +667,10 @@ export default {
case 4:
return '已抢完';
default:
// 如果有自定义按钮文本,优先使用
if (this.goodsData.buttonText && this.goodsData.buttonText !== '立即兑换') {
return this.goodsData.buttonText;
}
return '立即兑换';
}
},
......
......@@ -33,7 +33,8 @@
<view class="product-image">
<image v-if="orderData.goodsImage && orderData.goodsImage.length > 0"
:src="orderData.goodsImage[0]" mode="aspectFill" class="product-img" />
<image v-else-if="orderData.productType === 'virtual' && orderData.coupon && orderData.coupon.qrImage"
<image
v-else-if="orderData.productType === 'virtual' && orderData.coupon && orderData.coupon.qrImage"
:src="orderData.coupon.qrImage" mode="aspectFill" class="product-img" />
<text v-else class="image-placeholder">{{ orderData.productType === 'virtual' ? '优惠券' : '商品'
}}</text>
......@@ -44,7 +45,8 @@
orderData.skuDesc }}</text>
<text v-if="orderData.productType === 'virtual' && orderData.expireTime"
class="product-spec">过期时间 {{ orderData.expireTime }}</text>
<view v-if="orderData.productType === 'virtual' && orderData.goodsContent" class="product-content">
<view v-if="orderData.productType === 'virtual' && orderData.goodsContent"
class="product-content">
<rich-text :nodes="orderData.goodsContent" class="content-text"></rich-text>
</view>
<view class="price-quantity-row">
......@@ -111,7 +113,7 @@
</view>
<!-- 客服按钮 -->
<view class="service-btn">
<view class="service-btn" @click="handleServiceClick">
<image class="service-icon" :src="$baseUrl + 'homepage/Q3Res/settlementCenter_serviceBtn.png'"
mode="aspectFit"></image>
</view>
......@@ -120,10 +122,13 @@
<script>
import { getOrderDetail } from '@/api/user.js';
import { useHomeStore } from '@/stores/home';
import { jump, JumpType } from '@/utils/index';
import { storeToRefs } from 'pinia';
export default {
data() {
return {
export default {
data() {
return {
// 订单数据
orderData: {
productType: '', // 'physical' | 'virtual'
......@@ -360,7 +365,7 @@ import { getOrderDetail } from '@/api/user.js';
// 统一处理价格显示,优先使用credits字段
const creditsValue = this.orderData.credits || '0';
const creditsType = this.orderData.creditsTypeName || '积分';
this.orderData.price = `${creditsValue}${creditsType}`;
this.orderData.totalPrice = `${creditsValue}${creditsType}`;
this.orderData.actualPayment = `${creditsValue}${creditsType}`;
......@@ -382,7 +387,7 @@ import { getOrderDetail } from '@/api/user.js';
} else if (apiData && apiData.expireTime) {
expireTime = apiData.expireTime;
}
if (expireTime) {
this.orderData.expireTime = this.formatTime(expireTime);
}
......@@ -525,9 +530,27 @@ import { getOrderDetail } from '@/api/user.js';
this.orderData.totalPrice = '0积分';
this.orderData.actualPayment = '免费';
}
}
},
// 处理客服按钮点击
handleServiceClick() {
console.log('客服点击');
const homeStore = useHomeStore();
const {
memberId,
mobile,
openId,
unionId
} = homeStore.homeInfo;
const customerUrl =
`https://intelcc-user.icsoc.net/?channelKey=45839e0505554f8c8aea3c7b6259b049&init=1&crmld=${memberId}&mobile=${mobile}&openId=${openId}&unionId=${unionId}`;
jump({
type: JumpType.H5,
url: customerUrl
});
}
}
}
</script>
<style scoped>
......
......@@ -97,56 +97,7 @@ export default {
orderList: [],
nextId: null,
loading: false,
hasMore: true,
// 模拟数据(用于测试)
mockData: [
{
orderId: '1782993789',
status: 'pending_shipment',
productType: 'physical',
productName: '商品名称—实物',
description: '商品描述文案占位',
points: 200,
creditsTypeName: '积分',
exchangeTime: '2025.09.10 23:23:23',
productImage: ''
},
{
orderId: '1782993790',
status: 'pending_payment',
productType: 'physical',
productName: '商品名称—实物',
description: '商品描述文案占位',
points: 300,
creditsTypeName: '积分',
exchangeTime: '2025.09.10 23:23:23',
countdown: '23:59:59',
productImage: ''
},
{
orderId: '1782993791',
status: 'completed',
productType: 'physical',
productName: '商品名称—实物',
description: '商品描述文案占位',
points: 150,
creditsTypeName: '积分',
exchangeTime: '2025.09.10 23:23:23',
productImage: ''
},
{
orderId: '1782993792',
status: 'completed',
productType: 'coupon',
productName: '商品名称—卡券',
description: '商品描述文案占位',
points: 100,
creditsTypeName: '积分',
exchangeTime: '2025.09.10 23:23:23',
validUntil: '2025.09.10 23:23:23',
productImage: ''
}
]
hasMore: true
}
},
onLoad() {
......@@ -190,15 +141,14 @@ export default {
this.nextId = response.data.nextId || null;
this.hasMore = !!this.nextId;
} else {
// API调用失败时使用模拟数据
console.warn('API调用失败,使用模拟数据:', response.msg);
this.orderList = this.mockData;
}
// API调用失败
console.warn('API调用失败:', response.msg);
this.orderList = [];
}
} catch (error) {
console.error('加载兑换记录失败:', error);
// 网络错误时使用模拟数据
this.orderList = this.mockData;
} finally {
console.error('加载兑换记录失败:', error);
this.orderList = [];
} finally {
this.loading = false;
}
},
......
......@@ -8,21 +8,21 @@
<view class="result-icon" :class="resultIconClass">
<text class="icon-text">{{ resultIcon }}</text>
</view>
<!-- 状态文字 -->
<text class="result-text">{{ resultText }}</text>
<!-- 成功状态显示积分信息 -->
<view v-if="isSuccess" class="points-info">
<text class="points-value">{{ pointsValue }}</text>
<text class="points-unit">{{ resultData.creditsTypeName || '积分' }}</text>
</view>
<!-- 失败状态显示失败原因 -->
<view v-if="!isSuccess" class="failure-info">
<text class="failure-reason">{{ failureReason }}</text>
</view>
<!-- 支付方式信息 - 仅成功状态显示 -->
<view v-if="isSuccess" class="payment-info">
<view class="payment-row">
......@@ -44,13 +44,17 @@
</view>
<!-- 客服按钮 -->
<view class="service-btn">
<image class="service-icon" :src="$baseUrl + 'homepage/Q3Res/settlementCenter_serviceBtn.png'" mode="aspectFit"></image>
<view class="service-btn" @click="handleServiceClick">
<image class="service-icon" :src="$baseUrl + 'homepage/Q3Res/settlementCenter_serviceBtn.png'"
mode="aspectFit"></image>
</view>
</view>
</template>
<script>
import { useHomeStore } from '@/stores/home';
import { jump, JumpType } from '../../utils';
export default {
data() {
return {
......@@ -70,7 +74,9 @@ export default {
gid: '',
skuld: '',
buy_num: 1
}
},
// 商店信息
homeStore: null
}
},
computed: {
......@@ -78,32 +84,32 @@ export default {
isSuccess() {
return this.resultData.isSuccess;
},
// 结果图标
resultIcon() {
return this.isSuccess ? '✓' : '✕';
},
// 结果图标样式类
resultIconClass() {
return this.isSuccess ? 'icon-success' : 'icon-failure';
},
// 结果文字
resultText() {
return this.isSuccess ? '兑换成功' : '兑换失败';
},
// 积分值
pointsValue() {
return this.resultData.pointsValue;
},
// 失败原因
failureReason() {
return this.resultData.failureReason;
},
// 操作按钮文字
actionButtonText() {
return this.isSuccess ? '查看订单' : '返回首页';
......@@ -111,7 +117,10 @@ export default {
},
onLoad(options) {
console.log('支付结果页面接收到的参数:', options);
// 初始化homeStore
this.homeStore = useHomeStore();
// 处理页面参数
if (options.isSuccess !== undefined) {
this.resultData.isSuccess = options.isSuccess === 'true';
......@@ -126,7 +135,7 @@ export default {
this.resultData.orderId = options.orderId;
console.log('接收到的订单ID:', options.orderId);
}
// 保存其他参数供后续使用
this.resultData.goodsName = options.goodsName || '';
this.resultData.goodsImage = options.goodsImage || '';
......@@ -137,7 +146,7 @@ export default {
this.resultData.gid = options.gid || '';
this.resultData.skuld = options.skuld || '';
this.resultData.buy_num = parseInt(options.buy_num) || 1;
console.log('支付结果数据:', this.resultData);
},
methods: {
......@@ -164,13 +173,31 @@ export default {
});
}
},
// 设置支付结果 - 供外部调用
setPaymentResult(isSuccess, pointsValue = '', failureReason = '', orderId = '') {
this.resultData.isSuccess = isSuccess;
this.resultData.pointsValue = pointsValue;
this.resultData.failureReason = failureReason;
this.resultData.orderId = orderId;
},
// 处理客服按钮点击
handleServiceClick() {
console.log('客服点击');
const homeStore = useHomeStore();
const {
memberId,
mobile,
openId,
unionId
} = homeStore.homeInfo;
const customerUrl =
`https://intelcc-user.icsoc.net/?channelKey=45839e0505554f8c8aea3c7b6259b049&init=1&crmld=${memberId}&mobile=${mobile}&openId=${openId}&unionId=${unionId}`;
jump({
type: JumpType.H5,
url: customerUrl
});
}
}
}
......
......@@ -66,7 +66,7 @@
</view>
<!-- 客服按钮 -->
<view class="service-btn">
<view class="service-btn" @click="handleServiceClick">
<image class="service-icon" :src="$baseUrl + 'homepage/Q3Res/settlementCenter_serviceBtn.png'"
mode="aspectFit"></image>
</view>
......@@ -85,6 +85,8 @@
<script>
import { fetchTradeCredits } from '@/api/goods.js';
import { getAddressList } from '@/api/address.js';
import { useHomeStore } from '@/stores/home';
import { jump, JumpType } from '../../utils';
export default {
data() {
......@@ -105,12 +107,17 @@ export default {
spec: '',
points: 0,
quantity: 1
}
},
// 商店信息
homeStore: null
}
},
onLoad(options) {
console.log('结算页面参数:', options);
// 初始化homeStore
this.homeStore = useHomeStore();
// 解析页面参数
this.parsePageParams(options);
......@@ -366,6 +373,24 @@ export default {
return Object.keys(params)
.map(key => `${key}=${encodeURIComponent(params[key])}`)
.join('&');
},
// 处理客服按钮点击
handleServiceClick() {
console.log('客服点击');
const homeStore = useHomeStore();
const {
memberId,
mobile,
openId,
unionId
} = homeStore.homeInfo;
const customerUrl =
`https://intelcc-user.icsoc.net/?channelKey=45839e0505554f8c8aea3c7b6259b049&init=1&crmld=${memberId}&mobile=${mobile}&openId=${openId}&unionId=${unionId}`;
jump({
type: JumpType.H5,
url: customerUrl
});
}
}
}
......
......@@ -868,7 +868,8 @@
.goods-img {
width: 100%;
height: 365rpx;
height: 300rpx;
// height: 365rpx;
margin-bottom: 20rpx;
}
......@@ -877,7 +878,7 @@
// height: auto;
margin-left: 20rpx;
// margin-bottom: 10rpx;
margin-top: -48rpx;
margin-top: 25rpx;
.title-text1 {
position: relative;
......@@ -963,22 +964,6 @@
margin-bottom: 30rpx;
padding: 0 30rpx 0 30rpx;
display: block;
&.item-1 {
color: #284A6C;
}
&.item-2 {
color: #322D6F;
}
&.item-3 {
color: #814912;
}
&.item-4 {
color: #FFF0DF;
}
}
.yiyequan_card {
......@@ -1114,6 +1099,22 @@
margin-top: 17rpx;
font-size: 32rpx;
color: #D3A458;
&.item-1 {
color: #284A6C;
}
&.item-2 {
color: #322D6F;
}
&.item-3 {
color: #814912;
}
&.item-4 {
color: #FFF0DF;
}
}
}
......@@ -1198,6 +1199,21 @@
color: #333333;
width: 100%;
margin-bottom: 16rpx;
&.item-1 {
color: #284A6C;
}
&.item-2 {
color: #322D6F;
}
&.item-3 {
color: #814912;
}
&.item-4 {
color: #FFF0DF;
}
}
.exchange_button {
......
This diff is collapsed.
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