会员权益

This commit is contained in:
2026-04-29 15:33:58 +08:00
commit 54965243da
2787 changed files with 242809 additions and 0 deletions

View File

@@ -0,0 +1,757 @@
<template>
<view class="component-activity" :style="{'--theme-color': themeColor}">
<view class="activity-item" :class="{special: showType == 1}" v-for="item in showData" :key="item.id"
@click="toDetails(item)">
<view class="item-header flex justify-content-between align-items-center" v-if="showType == 2">
<view class="header-number">订单号{{item.order_no}}</view>
<view class="header-status">
<text style="color: #FF626E;" v-if="item.pay_state == 1">待付款</text>
<block v-else-if="item.pay_state == 2">
<text style="color: #FF9100;" v-if="item.activity_state == 1">报名中</text>
<text v-else-if="item.activity_state == 2">进行中</text>
<text style="color: #666666;" v-else-if="item.activity_state == 3">已结束</text>
</block>
<text style="color: #FF9100;" v-else-if="item.pay_state == 3">退款中</text>
<text style="color: #666666;" v-else-if="item.pay_state == 4">已退款</text>
<text style="color: #FF626E;" v-else-if="item.pay_state == 5">已驳回</text>
</view>
</view>
<view class="item-info flex">
<image class="info-image" :src="item.images" mode="aspectFill"></image>
<view class="info-box flex-item">
<view class="box-title text-ellipsis">{{item.name}}</view>
<view class="box-tag flex align-items-center">
<view class="icon" :style="{'background-image': 'url('+ iconTime +')'}" v-if="iconTime"></view>
<text class="text flex-item text-ellipsis">{{item.start_time}} | {{item.week}}</text>
</view>
<view class="box-tag flex align-items-center" v-if="item.organizing_method == 1">
<view class="icon" :style="{'background-image': 'url('+ iconNetwork +')'}" v-if="iconNetwork">
</view>
<text class="text flex-item text-ellipsis">报名成功后查看</text>
</view>
<view class="box-tag flex align-items-center" v-else-if="item.organizing_method == 2">
<view class="icon" :style="{'background-image': 'url('+ iconLocation +')'}" v-if="iconLocation">
</view>
<text class="text flex-item text-ellipsis">{{item.address}}</text>
</view>
</view>
</view>
<view class="item-footer flex align-items-center" v-if="showType == 2">
<view class="footer-label">
<text v-if="item.organizing_method == 1">线上活动</text>
<text v-else-if="item.organizing_method == 2">线下活动</text>
</view>
<view class="footer-price flex-item">
<block v-if="item.fees > 0">
<text></text>{{item.fees}}
</block>
<block v-else>免费</block>
</view>
<view class="footer-btn flex">
<!-- 报名中 -->
<block v-if="item.activity_state == 1">
<!-- 待付款 -->
<block v-if="item.pay_state == 1">
<view class="btn" style="background: #FF626E;" @click.stop="toCancel(item.id)">取消参加</view>
<view class="btn" @click.stop="toPayment(item.activity_id)">去支付</view>
</block>
<!-- 已付款 -->
<block v-else-if="item.pay_state == 2">
<view style="background: #FF626E;" class="btn" @click.stop="handleCancel(item.id)"
v-if="parseFloat(item.fees) == 0">取消参加</view>
<view style="background: #FF626E;" class="btn"
@click.stop="handleRefund(item.id,item.activity_id)" v-else-if="item.refund == 1">申请退款
</view>
<view class="btn" style="background: #FFB656;" @click.stop="showWebsite(item.url)"
v-if="item.organizing_method == 1">线上地址</view>
<!-- && item.is_verifying == 1 -->
<view class="btn" :class="{disabled: getButtonConfig(item).disabled}"
:style="{backgroundColor: getButtonConfig(item).bgColor}"
@click.stop="handleButtonClick(item, getButtonConfig(item))"
v-else-if="item.organizing_method == 2 ">
<text>{{getButtonConfig(item).text}}</text>
</view>
</block>
<!-- 已驳回 -->
<block v-else-if="item.pay_state == 5">
<view class="btn" style="background: #FF626E;">驳回原因</view>
</block>
</block>
<!-- 进行中 -->
<block v-else-if="item.pay_state == 2">
<!-- 线上 -->
<view class="btn" style="background: #FFB656;" @click.stop="showWebsite(item.url)"
v-if="item.organizing_method == 1">线上地址</view>
<!--线下-->
<view class="btn" :class="{disabled: getButtonConfig(item).disabled}"
:style="{backgroundColor: getButtonConfig(item).bgColor }"
@click.stop="handleButtonClick(item, getButtonConfig(item))"
v-else-if="item.organizing_method == 2">
{{getButtonConfig(item).text}}
</view>
</block>
<!-- 已结束 -->
<block v-if="item.activity_state == 3 && item.pay_state == 2">
<view class="btn" @click.stop="showCertificate(item.activity_id, item.id)">参会证书</view>
</block>
</view>
</view>
</view>
<!-- 参会凭证 -->
<activity-poster ref="activityPoster" @onChange="pageChange"></activity-poster>
<!-- 参会证书 -->
<activity-certificate ref="activityCertificate" @onChange="pageChange"></activity-certificate>
</view>
</template>
<script>
import {
mapState
} from "vuex"
import activityPoster from "@/pages/component/activity/poster.vue"
import activityCertificate from "@/pages/component/activity/certificate.vue"
import svgData from "@/common/svg.js"
// #ifdef H5
import wx from 'weixin-js-sdk';
// #endif
export default {
name: "activityIndex",
props: ["showData", "showType"],
components: {
activityPoster,
activityCertificate,
},
computed: {
...mapState({
themeColor: state => state.app.themeColor,
iconTime: state => {
return svgData.svgToUrl("time", state.app.themeColor)
},
iconLocation: state => {
return svgData.svgToUrl("location", state.app.themeColor)
},
iconNetwork: state => {
return svgData.svgToUrl("network", state.app.themeColor)
}
})
},
methods: {
// 获取按钮配置
getButtonConfig(item) {
//只有报名以后才会显示出来
// 默认配置
const config = {
text: "已报名",
disabled: false,
needPhone: false,
}
// 根据签到状态和活动状态返回不同配置
if (item.actitity_state_trans == 1) {
return {
text: "已报名",
disabled: false,
needPhone: false,
}
}
if (item.actitity_state_trans === 2) {
return {
text: "活动未开始",
disabled: true,
needPhone: false,
bgColor:'#8d929c'
}
}
if (item.actitity_state_trans == 3 && item.check_in_status == 'unchecked_in') {
return {
text: '扫码签到',
disabled: false,
needPhone: false
}
}
if (item.actitity_state_trans == 3 && item.check_in_status == 'checked_in') {
return {
text: "已签到",
disabled: true,
needPhone: false,
bgColor: '#52c41a'
}
}
if (item.actitity_state_trans == 4) {
return {
text: '活动已结束',
disabled: true,
needPhone: false,
bgColor:'#8d929c'
}
}
return config
},
// 统一处理按钮点击
handleButtonClick(item) {
// 根据签到状态和活动状态返回不同配置
if (item.actitity_state_trans == 1) {
this.showToast('您已报名!')
return
}
if (item.actitity_state_trans === 2) {
this.showToast('活动尚未开始,请在活动开始后前来签到!')
return
}
if (item.actitity_state_trans == 3 && item.check_in_status == 'unchecked_in') {
this.scanQRCode(item)
}
if (item.actitity_state_trans == 3 && item.check_in_status == 'checked_in') {
this.showToast('您已签到成功!')
return
}
if (item.actitity_state_trans == 4) {
this.showToast('本次活动已结束,无法进行签到或报名!')
return
}
},
// 扫码签到
scanQRCode(item) {
// 调起摄像头扫码
uni.scanCode({
scanType: ['barCode', 'qrCode','wxCode'],
success: (res) => {
let path = this.$util.parseURLParams(decodeURIComponent(res.path))
if(!path.scene && !path.op) {
uni.showToast({
title: '请扫描签到码 !',
icon: 'none',
duration: 3000 // 设置显示时间为3000毫秒3秒
})
return
}
let id = path.scene.split('=')[1]
if(id!==item.activity_id) {//name
uni.showToast({
title:`二维码不匹配:当前扫码入口属于【活动-${item.name}`,
icon: 'none',
duration: 3000 // 设置显示时间为3000毫秒3秒
});
return
}
// 验证并签到
this.verifyAndSign(id)
},
fail: (err) => {
if (err.errMsg !== 'scanCode:fail cancel') {
// 非取消操作才提示错误
this.showToast('扫码失败,请重试')
}
}
})
},
// 验证并签到
verifyAndSign(id) {
uni.showLoading({
title: '签到中'
})
// 调用签到接口
this.$util.request('activity.code', {
id: id, // 扫描到的二维码内容
}).then(res => {
uni.hideLoading()
if (res.code == 1) {
// 签到成功
this.showToast('签到成功')
setTimeout(()=>{
this.$emit("getOrderList");
},500)
} else {
this.showToast(res.msg || '签到失败')
}
}).catch(error => {
uni.hideLoading()
console.error('签到失败', error)
this.showToast('签到失败,请重试')
})
},
// 显示提示信息
showToast(message) {
uni.showToast({
title: message,
icon: 'none',
duration: 2000
})
},
// 改变页面滚动状态
pageChange(state) {
this.$emit("onChange", state)
},
// 申请退款
handleRefund(applyId, activity_id) {
uni.showModal({
content: "确认申请退款此活动?",
confirmColor: "#FF626E",
confirmText: "确认退款",
cancelColor: "#999999",
cancelText: "取消退款",
success: (res) => {
if (res.confirm) {
uni.showLoading({
title: "加载中",
mask: true
})
this.$util.request("activity.applyRefund", {
activity_id: activity_id,
apply_id: applyId
}).then(res => {
uni.hideLoading()
if (res.code == 1) {
uni.redirectTo({
url: "/pagesActivity/order/success"
})
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}).catch(error => {
uni.hideLoading()
console.error('申请退款 ', error)
})
}
}
})
},
// 未支付取消参加
toCancel(applyId) {
uni.showModal({
content: "确认取消参加此活动?",
confirmColor: "#FF626E",
confirmText: "确认取消",
cancelColor: "#999999",
cancelText: "我再想想",
success: (res) => {
if (res.confirm) {
uni.showLoading({
title: "加载中",
mask: true
})
this.$util.request("activity.applyDel", {
id: applyId
}).then(res => {
uni.hideLoading()
if (res.code == 1) {
uni.showToast({
title: "取消成功",
icon: "success",
mask: true,
duration: 1500
})
this.$emit("getOrderList");
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}).catch(error => {
uni.hideLoading()
console.error('取消参加 ', error)
})
}
}
})
},
// 去支付
toPayment(id) {
this.$util.toPage({
mode: 1,
path: "/pagesActivity/index/order?id=" + id
})
},
// 取消参加
handleCancel(applyId) {
uni.showModal({
content: "确认取消参加此活动?",
confirmColor: "#FF626E",
confirmText: "确认取消",
cancelColor: "#999999",
cancelText: "我再想想",
success: (res) => {
if (res.confirm) {
uni.showLoading({
title: "加载中",
mask: true
})
this.$util.request("activity.applyCancel", {
id: applyId
}).then(res => {
uni.hideLoading()
if (res.code == 1) {
uni.showToast({
title: "取消成功",
icon: "success",
mask: true,
duration: 1500
})
this.$emit("getOrderList");
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}).catch(error => {
uni.hideLoading()
console.error('取消参加 ', error)
})
}
}
})
},
// 线上地址
showWebsite(url) {
if (url) {
uni.showModal({
content: url,
confirmColor: this.themeColor,
confirmText: "复制链接",
cancelColor: "#999999",
cancelText: "关闭页面",
success: (res) => {
if (res.confirm) {
this.$util.toPage({
mode: 8,
content: url
})
}
}
})
} else {
uni.showToast({
icon: "none",
title: "暂无线上地址,请稍后再试"
})
}
},
// 跳转详情
toDetails(item) {
if (this.showType == 2) {
this.$util.toPage({
mode: 1,
path: `/pagesActivity/order/details?id=${item.id}&activity_id=${item.activity_id}`
})
} else if (this.showType == 3) {
this.$util.toPage({
mode: 1,
path: "/pagesActivity/verification/details?id=" + item.id
})
} else {
if (item.activity_auth == 2) {
if (!uni.getStorageSync("token")) {
uni.showModal({
title: "系统提示",
content: "该活动为会员专属,请登录后查看",
confirmColor: this.themeColor,
confirmText: "前往登录",
success: (res) => {
if (res.confirm) {
uni.navigateTo({
url: "/pages/login/index"
})
}
}
})
return
}
this.$util.toPage({
mode: 1,
path: "/pagesActivity/index/details?id=" + item.id
})
} else {
this.$util.toPage({
mode: 1,
path: "/pagesActivity/index/details?id=" + item.id
})
}
}
},
// 获取位置权限
getAuthSetting(fn) {
// #ifdef MP-WEIXIN
uni.getSetting({
success: (setting) => {
if (setting.authSetting && setting.authSetting.hasOwnProperty("scope.userLocation")) {
if (setting.authSetting["scope.userLocation"]) {
if (fn) fn()
} else {
uni.hideLoading()
uni.showModal({
title: '提示',
content: '请重新授权获取您的地理位置,否则部分功能将无法使用',
confirmColor: this.themeColor,
confirmText: "授权",
success: (res) => {
if (res.confirm) {
uni.openSetting({
success: (result) => {
if (result.authSetting[
"scope.userLocation"]) {
if (fn) fn()
} else {
uni.showToast({
title: '请确定已打开定位权限',
icon: "none",
duration: 2000,
});
}
},
fail: () => {
uni.showToast({
title: '位置获取失败',
icon: 'none',
duration: 2000,
})
}
})
} else {
uni.showToast({
title: '请授权获取您的地理位置,否则部分功能将无法使用',
icon: 'none',
duration: 2000,
})
}
},
fail: () => {
if (fn) fn()
}
})
}
} else {
if (fn) fn()
}
},
fail: () => {
uni.showToast({
title: '位置获取失败',
icon: 'none',
duration: 2000,
})
}
})
// #endif
// #ifdef H5
if (fn) fn()
// #endif
},
// 获取当前地址
getLocation(fn) {
// #ifdef MP-WEIXIN
uni.getLocation({
type: 'wgs84',
geocode: true,
success: (res) => {
fn({
latitude: res.latitude,
longitude: res.longitude,
})
},
fail: () => {
fn()
}
});
// #endif
// #ifdef H5
wx.ready(() => {
wx.getLocation({
type: 'wgs84',
success: (res) => {
fn({
latitude: res.latitude,
longitude: res.longitude,
})
},
fail: (err) => {
fn()
},
cancel: () => {
fn()
}
});
})
// #endif
},
// 截取地址栏参数
getUrlParam(url) {
const query = url.split("?")[1] || "";
const params = {};
query.split("&").forEach((pair) => {
const [key, value] = pair.split("=");
if (key) {
params[key] = decodeURIComponent(value || "");
}
});
return params;
},
// 参会证书
showCertificate(activityId, applyId) {
this.$refs.activityCertificate.getPoster(activityId, applyId)
},
},
}
</script>
<style lang="scss">
.component-activity {
.activity-item {
margin-top: 32rpx;
background: #ffffff;
border-radius: 10rpx;
padding: 32rpx;
&:first-child {
margin-top: 0;
}
&.special {
background: transparent;
border-radius: 0;
padding: 0;
}
.item-header {
padding-bottom: 32rpx;
border-bottom: 1rpx solid #E4E4E4;
margin-bottom: 32rpx;
.header-number {
color: #999999;
font-size: 28rpx;
line-height: 40rpx;
}
.header-status {
color: var(--theme-color);
font-size: 28rpx;
line-height: 40rpx;
}
}
.item-info {
.info-image {
width: 220rpx;
height: 160rpx;
border-radius: 16rpx;
}
.info-box {
margin-left: 32rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
.box-title {
color: #5A5B6E;
font-size: 28rpx;
font-weight: 600;
line-height: 40rpx;
}
.box-tag {
.icon {
width: 32rpx;
height: 32rpx;
background-size: 32rpx;
margin-right: 10rpx;
}
.text {
color: #8D929C;
font-size: 24rpx;
line-height: 34rpx;
}
}
}
}
.item-footer {
margin-top: 32rpx;
.footer-label {
color: var(--theme-color);
font-size: 24rpx;
line-height: 34rpx;
padding: 8rpx 16rpx;
border-radius: 8rpx;
background: #F6F7FB;
}
.footer-price {
margin-left: 16rpx;
color: var(--theme-color);
font-size: 36rpx;
font-weight: 600;
line-height: 50rpx;
text {
font-size: 22rpx;
}
}
.footer-btn {
margin-left: 16rpx;
.btn {
color: #ffffff;
font-size: 28rpx;
line-height: 40rpx;
padding: 14rpx 24rpx;
border-radius: 8rpx;
background: var(--theme-color);
margin-left: 12rpx;
&.disabled {
// opacity: 0.6;
cursor: not-allowed;
}
&:first-child {
margin-left: 0;
}
}
}
}
}
}
</style>

View File

@@ -0,0 +1,686 @@
<!-- +----------------------------------------------------------------------
| 麦沃德科技赋能开发者助力商协会发展
+----------------------------------------------------------------------
| Copyright (c) 20172024 www.wdsxh.cn All rights reserved.
+----------------------------------------------------------------------
| 沃德商协会系统并不是自由软件不加密并不代表开源未经许可不可自由转售和商用
+----------------------------------------------------------------------
| Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
+----------------------------------------------------------------------
| 组件-活动列表 开发者: 麦沃德科技-半夏
+---------------------------------------------------------------------- -->
<template>
<view class="component-activity" :style="{'--theme-color': themeColor}">
<view class="activity-item" :class="{special: showType == 1}" v-for="item in showData" :key="item.id" @click="toDetails(item)">
<view class="item-header flex justify-content-between align-items-center" v-if="showType == 2">
<view class="header-number">订单号{{item.order_no}}</view>
<view class="header-status">
<text style="color: #FF626E;" v-if="item.pay_state == 1">待付款</text>
<block v-else-if="item.pay_state == 2">
<text style="color: #FF9100;" v-if="item.activity_state == 1">报名中</text>
<text v-else-if="item.activity_state == 2">进行中</text>
<text style="color: #666666;" v-else-if="item.activity_state == 3">已结束</text>
</block>
<text style="color: #FF9100;" v-else-if="item.pay_state == 3">退款中</text>
<text style="color: #666666;" v-else-if="item.pay_state == 4">已退款</text>
<text style="color: #FF626E;" v-else-if="item.pay_state == 5">已驳回</text>
</view>
</view>
<view class="item-info flex">
<image class="info-image" :src="item.images" mode="aspectFill"></image>
<view class="info-box flex-item">
<view class="box-title text-ellipsis">{{item.name}}</view>
<view class="box-tag flex align-items-center">
<view class="icon" :style="{'background-image': 'url('+ iconTime +')'}" v-if="iconTime"></view>
<text class="text flex-item text-ellipsis">{{item.start_time}} | {{item.week}}</text>
</view>
<view class="box-tag flex align-items-center" v-if="item.organizing_method == 1">
<view class="icon" :style="{'background-image': 'url('+ iconNetwork +')'}" v-if="iconNetwork"></view>
<text class="text flex-item text-ellipsis">报名成功后查看</text>
</view>
<view class="box-tag flex align-items-center" v-else-if="item.organizing_method == 2">
<view class="icon" :style="{'background-image': 'url('+ iconLocation +')'}" v-if="iconLocation"></view>
<text class="text flex-item text-ellipsis">{{item.address}}</text>
</view>
</view>
</view>
<view class="item-footer flex align-items-center" v-if="showType == 2">
<view class="footer-label">
<text v-if="item.organizing_method == 1">线上活动</text>
<text v-else-if="item.organizing_method == 2">线下活动</text>
</view>
<view class="footer-price flex-item">
<block v-if="item.fees > 0">
<text></text>{{item.fees}}
</block>
<block v-else>免费</block>
</view>
<view class="footer-btn flex">
<!-- 报名中 -->
<block v-if="item.activity_state == 1">
<!-- 待付款 -->
<block v-if="item.pay_state == 1">
<view class="btn" style="background: #FF626E;" @click.stop="toCancel(item.id)">取消参加</view>
<view class="btn" @click.stop="toPayment(item.activity_id)">去支付</view>
</block>
<!-- 已付款 -->
<block v-else-if="item.pay_state == 2">
<view style="background: #FF626E;" class="btn" @click.stop="handleCancel(item.id)" v-if="parseFloat(item.fees) == 0">取消参加</view>
<view style="background: #FF626E;" class="btn" @click.stop="handleRefund(item.id,item.activity_id)" v-else-if="item.refund == 1">申请退款</view>
<view class="btn" style="background: #FFB656;" @click.stop="showWebsite(item.url)" v-if="item.organizing_method == 1">线上地址</view>
<view class="btn" style="background: #FFB656;" @click.stop="handleVerification(item.activity_id, item.verification_method)" v-else-if="item.organizing_method == 2 && item.is_verifying == 1 && item.is_sign_in == 2">
<text v-if="item.verification_method == 1">扫码签到</text>
<text v-else>参会凭证</text>
</view>
</block>
<!-- 已驳回 -->
<block v-else-if="item.pay_state == 5">
<view class="btn" style="background: #FF626E;">驳回原因</view>
</block>
</block>
<!-- 进行中 -->
<block v-else-if="item.activity_state == 2 && item.pay_state == 2">
<view class="btn" style="background: #FFB656;" @click.stop="showWebsite(item.url)" v-if="item.organizing_method == 1">线上地址</view>
<view class="btn" style="background: #FFB656;" @click.stop="handleVerification(item.activity_id, item.verification_method)" v-else-if="item.organizing_method == 2 && item.is_verifying == 1 && item.is_sign_in == 2">
<text v-if="item.verification_method == 1">扫码签到</text>
<text v-else>参会凭证</text>
</view>
</block>
<!-- 已结束 -->
<block v-else-if="item.activity_state == 3 && item.pay_state == 2">
<view class="btn" @click.stop="showCertificate(item.activity_id, item.id)">参会证书</view>
</block>
</view>
</view>
</view>
<!-- 参会凭证 -->
<activity-poster ref="activityPoster" @onChange="pageChange"></activity-poster>
<!-- 参会证书 -->
<activity-certificate ref="activityCertificate" @onChange="pageChange"></activity-certificate>
</view>
</template>
<script>
import { mapState } from "vuex"
import activityPoster from "@/pages/component/activity/poster.vue"
import activityCertificate from "@/pages/component/activity/certificate.vue"
import svgData from "@/common/svg.js"
// #ifdef H5
import wx from 'weixin-js-sdk';
// #endif
export default {
name: "activityIndex",
props: ["showData", "showType"],
components: {
activityPoster,
activityCertificate,
},
computed: {
...mapState({
themeColor: state => state.app.themeColor,
iconTime: state => {
return svgData.svgToUrl("time", state.app.themeColor)
},
iconLocation: state => {
return svgData.svgToUrl("location", state.app.themeColor)
},
iconNetwork: state => {
return svgData.svgToUrl("network", state.app.themeColor)
},
})
},
methods: {
// 改变页面滚动状态
pageChange(state) {
this.$emit("onChange", state)
},
// 申请退款
handleRefund(applyId, activity_id) {
uni.showModal({
content: "确认申请退款此活动?",
confirmColor: "#FF626E",
confirmText: "确认退款",
cancelColor: "#999999",
cancelText: "取消退款",
success: (res) => {
if (res.confirm) {
uni.showLoading({
title: "加载中",
mask: true
})
this.$util.request("activity.applyRefund", {
activity_id: activity_id,
apply_id: applyId
}).then(res => {
uni.hideLoading()
if (res.code == 1) {
uni.redirectTo({
url: "/pagesActivity/order/success"
})
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}).catch(error => {
uni.hideLoading()
console.error('申请退款 ', error)
})
}
}
})
},
// 未支付取消参加
toCancel(applyId) {
uni.showModal({
content: "确认取消参加此活动?",
confirmColor: "#FF626E",
confirmText: "确认取消",
cancelColor: "#999999",
cancelText: "我再想想",
success: (res) => {
if (res.confirm) {
uni.showLoading({
title: "加载中",
mask: true
})
this.$util.request("activity.applyDel", {
id: applyId
}).then(res => {
uni.hideLoading()
if (res.code == 1) {
uni.showToast({
title: "取消成功",
icon: "success",
mask: true,
duration: 1500
})
this.$emit("getOrderList");
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}).catch(error => {
uni.hideLoading()
console.error('取消参加 ', error)
})
}
}
})
},
// 去支付
toPayment(id) {
this.$util.toPage({
mode: 1,
path: "/pagesActivity/index/order?id=" + id
})
},
// 取消参加
handleCancel(applyId) {
uni.showModal({
content: "确认取消参加此活动?",
confirmColor: "#FF626E",
confirmText: "确认取消",
cancelColor: "#999999",
cancelText: "我再想想",
success: (res) => {
if (res.confirm) {
uni.showLoading({
title: "加载中",
mask: true
})
this.$util.request("activity.applyCancel", {
id: applyId
}).then(res => {
uni.hideLoading()
if (res.code == 1) {
uni.showToast({
title: "取消成功",
icon: "success",
mask: true,
duration: 1500
})
this.$emit("getOrderList");
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}).catch(error => {
uni.hideLoading()
console.error('取消参加 ', error)
})
}
}
})
},
// 线上地址
showWebsite(url) {
if (url) {
uni.showModal({
content: url,
confirmColor: this.themeColor,
confirmText: "复制链接",
cancelColor: "#999999",
cancelText: "关闭页面",
success: (res) => {
if (res.confirm) {
this.$util.toPage({
mode: 8,
content: url
})
}
}
})
} else {
uni.showToast({
icon: "none",
title: "暂无线上地址,请稍后再试"
})
}
},
// 跳转详情
toDetails(item) {
if (this.showType == 2) {
this.$util.toPage({
mode: 1,
path: `/pagesActivity/order/details?id=${item.id}&activity_id=${item.activity_id}`
})
} else if (this.showType == 3) {
this.$util.toPage({
mode: 1,
path: "/pagesActivity/verification/details?id=" + item.id
})
} else {
if (item.activity_auth == 2) {
if (!uni.getStorageSync("token")) {
uni.showModal({
title: "系统提示",
content: "该活动为会员专属,请登录后查看",
confirmColor: this.themeColor,
confirmText: "前往登录",
success: (res) => {
if (res.confirm) {
uni.navigateTo({
url: "/pages/login/index"
})
}
}
})
return
}
this.$util.toPage({
mode: 1,
path: "/pagesActivity/index/details?id=" + item.id
})
} else {
this.$util.toPage({
mode: 1,
path: "/pagesActivity/index/details?id=" + item.id
})
}
}
},
// 活动核销
handleVerification(id, method) {
if (method == 1) {
this.handleScan(id)
} else {
this.$refs.activityPoster.getPoster(id)
}
},
// 扫码核销
handleScan(id) {
uni.showLoading({
title: "加载中",
mask: true
})
this.getAuthSetting(() => {
uni.hideLoading()
// #ifdef MP-WEIXIN
uni.scanCode({
success: (res) => {
if (res.path) {
const parameter = this.getUrlParam(res.path)
if (parameter && parameter.scene) {
this.scanSign(parameter.scene, id)
} else {
uni.showToast({
icon: "none",
title: "签到失败,请检查签到码是否正确",
duration: 2500
})
}
} else {
uni.showToast({
icon: "none",
title: "签到失败,请检查签到码是否正确",
duration: 2500
})
}
}
});
// #endif
// #ifdef H5
wx.scanQRCode({
needResult: 1,
scanType: ["qrCode"],
success: (res) => {
if (res.resultStr) {
const parameter = this.getUrlParam(res.resultStr)
if (parameter && parameter.scene) {
this.scanSign(parameter.scene, id)
} else {
uni.showToast({
icon: "none",
title: "签到失败,请检查签到码是否正确",
duration: 2500
})
}
} else {
uni.showToast({
icon: "none",
title: "签到失败,请检查签到码是否正确",
duration: 2500
})
}
},
fail: () => {
uni.showModal({
title: "系统提示",
content: "当前设备暂不支持扫码核销,请稍后再试",
showCancel: false,
confirmText: "我知道了"
})
},
});
// #endif
})
},
// 自助核销
scanSign(value, id) {
uni.showLoading({
title: "加载中",
mask: true
})
this.getLocation((location) => {
if (!location) {
uni.showToast({
title: '位置获取失败,请确定已打开定位权限',
icon: 'none',
duration: 2000,
})
return
}
this.$util.request("activity.scanSign", {
activity_id: id,
validate_value: value,
lng: location.longitude,
lat: location.latitude,
}).then(res => {
if (res.code == 1) {
uni.showToast({
icon: "success",
title: "签到成功",
duration: 2000
})
this.$emit("getOrderList");
} else {
uni.showToast({
title: res.msg,
icon: "none",
duration: 2000
})
}
}).catch(error => {
console.error('核销签到', error)
})
})
},
// 获取位置权限
getAuthSetting(fn) {
// #ifdef MP-WEIXIN
uni.getSetting({
success: (setting) => {
if (setting.authSetting && setting.authSetting.hasOwnProperty("scope.userLocation")) {
if (setting.authSetting["scope.userLocation"]) {
if (fn) fn()
} else {
uni.hideLoading()
uni.showModal({
title: '提示',
content: '请重新授权获取您的地理位置,否则部分功能将无法使用',
confirmColor: this.themeColor,
confirmText: "授权",
success: (res) => {
if (res.confirm) {
uni.openSetting({
success: (result) => {
if (result.authSetting["scope.userLocation"]) {
if (fn) fn()
} else {
uni.showToast({
title: '请确定已打开定位权限',
icon: "none",
duration: 2000,
});
}
},
fail: () => {
uni.showToast({
title: '位置获取失败',
icon: 'none',
duration: 2000,
})
}
})
} else {
uni.showToast({
title: '请授权获取您的地理位置,否则部分功能将无法使用',
icon: 'none',
duration: 2000,
})
}
},
fail: () => {
if (fn) fn()
}
})
}
} else {
if (fn) fn()
}
},
fail: () => {
uni.showToast({
title: '位置获取失败',
icon: 'none',
duration: 2000,
})
}
})
// #endif
// #ifdef H5
if (fn) fn()
// #endif
},
// 获取当前地址
getLocation(fn) {
// #ifdef MP-WEIXIN
uni.getLocation({
type: 'wgs84',
geocode: true,
success: (res) => {
fn({
latitude: res.latitude,
longitude: res.longitude,
})
},
fail: () => {
fn()
}
});
// #endif
// #ifdef H5
wx.ready(() => {
wx.getLocation({
type: 'wgs84',
success: (res) => {
fn({
latitude: res.latitude,
longitude: res.longitude,
})
},
fail: (err) => {
fn()
},
cancel: () => {
fn()
}
});
})
// #endif
},
// 截取地址栏参数
getUrlParam(url) {
const query = url.split("?")[1] || "";
const params = {};
query.split("&").forEach((pair) => {
const [key, value] = pair.split("=");
if (key) {
params[key] = decodeURIComponent(value || "");
}
});
return params;
},
// 参会证书
showCertificate(activityId, applyId) {
this.$refs.activityCertificate.getPoster(activityId, applyId)
},
},
}
</script>
<style lang="scss">
.component-activity {
.activity-item {
margin-top: 32rpx;
background: #ffffff;
border-radius: 10rpx;
padding: 32rpx;
&:first-child {
margin-top: 0;
}
&.special {
background: transparent;
border-radius: 0;
padding: 0;
}
.item-header {
padding-bottom: 32rpx;
border-bottom: 1rpx solid #E4E4E4;
margin-bottom: 32rpx;
.header-number {
color: #999999;
font-size: 28rpx;
line-height: 40rpx;
}
.header-status {
color: var(--theme-color);
font-size: 28rpx;
line-height: 40rpx;
}
}
.item-info {
.info-image {
width: 220rpx;
height: 160rpx;
border-radius: 16rpx;
}
.info-box {
margin-left: 32rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
.box-title {
color: #5A5B6E;
font-size: 28rpx;
font-weight: 600;
line-height: 40rpx;
}
.box-tag {
.icon {
width: 32rpx;
height: 32rpx;
background-size: 32rpx;
margin-right: 10rpx;
}
.text {
color: #8D929C;
font-size: 24rpx;
line-height: 34rpx;
}
}
}
}
.item-footer {
margin-top: 32rpx;
.footer-label {
color: var(--theme-color);
font-size: 24rpx;
line-height: 34rpx;
padding: 8rpx 16rpx;
border-radius: 8rpx;
background: #F6F7FB;
}
.footer-price {
margin-left: 16rpx;
color: var(--theme-color);
font-size: 36rpx;
font-weight: 600;
line-height: 50rpx;
text {
font-size: 22rpx;
}
}
.footer-btn {
margin-left: 16rpx;
.btn {
color: #ffffff;
font-size: 28rpx;
line-height: 40rpx;
padding: 14rpx 24rpx;
border-radius: 8rpx;
background: var(--theme-color);
margin-left: 12rpx;
&:first-child {
margin-left: 0;
}
}
}
}
}
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,256 @@
<!-- +----------------------------------------------------------------------
| 麦沃德科技赋能开发者助力商协会发展
+----------------------------------------------------------------------
| Copyright (c) 20172024 www.wdsxh.cn All rights reserved.
+----------------------------------------------------------------------
| 沃德商协会系统并不是自由软件不加密并不代表开源未经许可不可自由转售和商用
+----------------------------------------------------------------------
| Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
+----------------------------------------------------------------------
| 我的活动 开发者: 麦沃德科技-半夏
+---------------------------------------------------------------------- -->
<template>
<view class="container" :style="{'--theme-color': themeColor}">
<!-- 标题栏 -->
<title-bar title="我的活动"></title-bar>
<!-- 内容区 -->
<view class="container-main" v-if="loadEnd">
<!-- 顶部导航 -->
<view class="main-screen" :style="{top: titleBarHeight + 'px'}">
<scroll-view scroll-x style="white-space: nowrap;">
<view class="screen-item" v-for="(item, index) in screenList" :key="item.id" @click="changeScreen(index)">
<view class="text" :class="{active: selectScreen == index}">{{item.name}}</view>
</view>
</scroll-view>
</view>
<!-- 活动列表 -->
<view class="main-list">
<list :show-data="orderList" show-type="2" @getOrderList="resetOrderList"></list>
<empty top="36%" title="暂无相关活动~" v-if="orderList.length == 0"></empty>
</view>
</view>
<!-- 底部导航 -->
<tab-bar></tab-bar>
</view>
</template>
<script>
import { mapState } from "vuex"
import list from "./components/list/index.vue"
// #ifdef H5
import wx from 'weixin-js-sdk';
// #endif
export default {
components: {
list
},
data() {
return {
// 加载完成
loadEnd: false,
// 标题栏高度
titleBarHeight: 0,
// 分类列表
screenList: [{
id: 0,
name: "全部"
},
{
id: 1,
name: "待付款",
pay_state: 1
},
{
id: 2,
name: "报名中",
pay_state: 2,
activity_state: 1,
},
{
id: 3,
name: "进行中",
pay_state: 2,
activity_state: 2,
},
{
id: 4,
name: "已结束",
pay_state: 2,
activity_state: 3,
},
{
id: 5,
name: "已退款",
pay_state: 4,
},
{
id: 6,
name: "已驳回",
pay_state: 5,
},
],
// 已选分类
selectScreen: 0,
// 活动列表
orderList: [],
// 分类查询参数
page: 1,
limit: 20,
hasMore: false,
}
},
computed: {
...mapState({
themeColor: state => state.app.themeColor,
})
},
mounted() {
// #ifdef MP-WEIXIN
let statusBarHeight = uni.getSystemInfoSync().statusBarHeight
let menuButtonInfo = uni.getMenuButtonBoundingClientRect()
this.titleBarHeight = statusBarHeight + (menuButtonInfo.top - statusBarHeight) * 2 + menuButtonInfo.height
// #endif
},
onLoad() {
if (uni.getStorageSync("token")) {
uni.showLoading({
title: "加载中"
})
this.getOrderList(() => {
uni.hideLoading()
this.loadEnd = true
})
// #ifdef H5
this.initConfig()
// #endif
} else {
this.$util.verifyLogin(2)
}
},
onShow() {
if (this.loadEnd) {
uni.pageScrollTo({
scrollTop: 0,
duration: 0
});
this.page = 1
this.getOrderList()
}
},
onPullDownRefresh() {
this.page = 1
this.getOrderList(() => {
uni.stopPullDownRefresh()
})
},
onReachBottom() {
if (this.hasMore) {
this.page++
this.getOrderList()
}
},
methods: {
// #ifdef H5
// 微信公众号初始化方法
initConfig() {
this.$util.request("main.WeChatConfig", {
url: location.href.split('#')[0]
}).then(res => {
if (res.code == 1) {
wx.config({
debug: false,
appId: res.data.appId,
timestamp: Number(res.data.timestamp),
nonceStr: res.data.nonceStr,
signature: res.data.signature,
jsApiList: ['scanQRCode', "getLocation"]
})
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}).catch(error => {
console.error('通过config接口注入权限验证配置 ', error)
})
},
// #endif
// 获取订单列表
getOrderList(fn) {
let data = {
page: this.page,
limit: this.limit,
}
if (this.screenList[this.selectScreen].activity_state) data.activity_state = this.screenList[this.selectScreen].activity_state
if (this.screenList[this.selectScreen].pay_state) data.pay_state = this.screenList[this.selectScreen].pay_state
this.$util.request("activity.orderList", data).then(res => {
if (fn) fn()
if (res.code == 1) {
let list = res.data.data
this.hasMore = this.page < res.data.total / this.limit ? true : false
this.orderList = this.page == 1 ? list : [...this.orderList, ...list];
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}).catch(error => {
if (fn) fn()
console.error('获取订单列表 ', error)
})
},
// 更改分类
changeScreen(index) {
this.selectScreen = index
this.page = 1
this.getOrderList()
},
// 重新获取订单列表
resetOrderList() {
this.page = 1
this.getOrderList()
},
}
}
</script>
<style lang="scss">
.container {
.container-main {
.main-screen {
background: #ffffff;
position: sticky;
top: 0;
z-index: 99;
padding: 0 32rpx;
.screen-item {
padding: 0 32rpx;
display: inline-flex;
justify-content: center;
.text {
padding: 36rpx 0;
color: #5A5B6E;
font-size: 28rpx;
line-height: 40rpx;
text-align: center;
border-bottom: 4rpx solid transparent;
&.active {
color: var(--theme-color);
border-color: var(--theme-color);
}
}
}
}
.main-list {
padding: 32rpx;
}
}
}
</style>

View File

@@ -0,0 +1,130 @@
<!-- +----------------------------------------------------------------------
| 麦沃德科技赋能开发者助力商协会发展
+----------------------------------------------------------------------
| Copyright (c) 20172024 www.wdsxh.cn All rights reserved.
+----------------------------------------------------------------------
| 沃德商协会系统并不是自由软件不加密并不代表开源未经许可不可自由转售和商用
+----------------------------------------------------------------------
| Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
+----------------------------------------------------------------------
| 提交成功 开发者: 麦沃德科技-半夏
+---------------------------------------------------------------------- -->
<template>
<view class="container" :style="{'--theme-color': themeColor}">
<!-- 标题栏 -->
<title-bar :showBack="true" title="提交成功"></title-bar>
<!-- 内容区 -->
<view class="container-main" v-if="loadEnd">
<view class="main-image">
<image class="icon" src="/static/check.png" mode="aspectFit"></image>
</view>
<view class="main-title">提交成功</view>
<view class="main-subtitle">请前往个人中心查看审核详情</view>
<view class="main-btn" @click="toOrder">前往查看</view>
<view class="main-back" @click="toIndex">返回首页</view>
</view>
</view>
</template>
<script>
import { mapState } from "vuex"
export default {
data() {
return {
// 加载完成
loadEnd: false,
// 支付类型
payType: null,
}
},
onLoad(option) {
this.payType = option.type
this.$nextTick(() => {
this.loadEnd = true
})
},
computed: {
...mapState({
themeColor: state => state.app.themeColor,
})
},
methods: {
// 跳转我的活动
toOrder() {
if (getCurrentPages().length == 1) {
this.$util.toPage({
mode: 2,
path: "/pagesActivity/order/index"
})
} else {
uni.navigateBack()
}
},
// 返回首页
toIndex() {
uni.switchTab({
url: "/pages/index/index"
})
},
}
}
</script>
<style lang="scss">
page {
background: #ffffff;
}
.container {
.container-main {
padding: 144rpx 48rpx 32rpx;
.main-image {
width: 200rpx;
height: 200rpx;
margin: 0 auto;
padding: 48rpx;
background: var(--theme-color);
border-radius: 50%;
}
.main-title {
color: #333;
font-size: 36rpx;
font-weight: 600;
line-height: 50rpx;
margin-top: 48rpx;
text-align: center;
}
.main-subtitle {
color: #999;
font-size: 24rpx;
line-height: 34rpx;
margin-top: 24rpx;
text-align: center;
}
.main-btn {
color: #FFF;
font-size: 32rpx;
line-height: 44rpx;
padding: 34rpx;
border-radius: 16rpx;
text-align: center;
margin-top: 48rpx;
background: var(--theme-color);
}
.main-back {
color: #979797;
font-size: 32rpx;
line-height: 44rpx;
padding: 32rpx;
text-align: center;
margin-top: 16rpx;
}
}
}
</style>