会员权益

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

250
pages/diy/index.vue Normal file
View File

@@ -0,0 +1,250 @@
<!-- +----------------------------------------------------------------------
| 麦沃德科技赋能开发者助力商协会发展
+----------------------------------------------------------------------
| Copyright (c) 20172024 www.wdsxh.cn All rights reserved.
+----------------------------------------------------------------------
| 沃德商协会系统并不是自由软件不加密并不代表开源未经许可不可自由转售和商用
+----------------------------------------------------------------------
| Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
+----------------------------------------------------------------------
| 首页 开发者: 麦沃德科技-半夏
+---------------------------------------------------------------------- -->
<template>
<view v-if="loadEnd">
<view class="container" :style="{backgroundColor: diyData.page.style.backgroundColor || ''}" v-if="diyData && diyData.page && diyData.page.style">
<title-bar class="container-header" :frontColor="diyData.page.style.titleTextColor" :backgroundColor="diyData.page.style.titleBackgroundColor || ''" :title="diyData.page.params.title || ''"></title-bar>
<image class="container-background" :src="getImagePath(diyData.page.style.backgroundImage)" mode="aspectFill" v-if="diyData.page.style.backgroundImage"></image>
<view class="container-main">
<diy-mode ref="diyMode" :show-data="diyData" :spaceHeight="spaceHeight" @setShareData="setShareData"></diy-mode>
</view>
<view class="container-footer safe-padding">
<tab-bar></tab-bar>
</view>
</view>
<view class="container" v-else>
<view class="container-header">
<title-bar></title-bar>
</view>
<view class="container-error">未配置首页样式请于后台进行首页装修</view>
<view class="container-footer safe-padding">
<tab-bar></tab-bar>
</view>
</view>
</view>
</template>
<script>
import { mapState } from "vuex"
import diyMode from '@/pages/component/diy/index.vue';
// #ifdef H5
import wx from 'weixin-js-sdk';
// #endif
export default {
components: {
diyMode,
},
data() {
return {
// 加载完成
loadEnd: false,
// 页面ID
pageId: null,
// 自定义数据
diyData: null,
// 分享数据
shareData: {},
// 头部与底部高度(仅会员地图占满屏幕时使用)
spaceHeight: 0,
}
},
computed: {
...mapState({
shareImage: state => state.app.shareImage,
shareTitle: state => state.app.shareTitle,
})
},
onLoad(option) {
this.pageId = option.page_id;
// #ifdef H5
this.initConfig()
// #endif
uni.showLoading({
title: "加载中"
})
this.getDiyData(() => {
uni.hideLoading()
this.loadEnd = true
});
},
onShow() {
if (this.loadEnd) this.getDiyData()
},
onPullDownRefresh() {
this.getDiyData(() => {
uni.stopPullDownRefresh();
});
},
onShareAppMessage(res) {
if (res.from == "button") {
return {
title: this.shareData.title,
path: this.shareData.path,
imageUrl: this.shareData.imageUrl || this.shareImage,
}
} else {
return {
title: this.shareTitle,
imageUrl: this.shareImage,
}
}
},
onShareTimeline() {
return {
title: this.shareTitle,
imageUrl: this.shareImage,
}
},
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: ["updateAppMessageShareData", "updateTimelineShareData", "wx-open-launch-weapp"],
openTagList: ["updateAppMessageShareData", "updateTimelineShareData", 'wx-open-launch-weapp'],
})
wx.ready(() => {
wx.updateAppMessageShareData({
title: this.shareTitle,
desc: "",
link: window.location.href,
imgUrl: this.shareImage,
});
wx.updateTimelineShareData({
title: this.shareTitle,
link: window.location.href,
imgUrl: this.shareImage,
});
});
} else {
uni.hideLoading()
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}).catch(error => {
uni.hideLoading()
console.error('通过config接口注入权限验证配置 ', error)
})
},
// #endif
// 获取自定义数据
getDiyData(fn) {
this.$util.request("main.diyData", {
page_id: this.pageId
}).then(res => {
if (res.code == 1) {
this.diyData = res.data
if (res.data && res.data.page) {
let page = res.data.page
// #ifdef MP-WEIXIN
// 设置navbar标题、颜色
uni.setNavigationBarColor({
frontColor: page.style.titleTextColor === 'white' ? '#ffffff' : '#000000',
backgroundColor: page.style.titleBackgroundColor || ''
})
// #endif
uni.setNavigationBarTitle({
title: page.params.title || ""
})
}
if (this.loadEnd) {
this.$refs.diyMode.updateData()
}
if (fn) fn()
if (res.data?.items?.length) {
const hasMemberMap = res.data.items.some(item => item.type == "memberMapDiy");
if (hasMemberMap) {
setTimeout(() => {
try {
const query = uni.createSelectorQuery().in(this);
let headerHeight, footerHeight;
query.select('.container-header').boundingClientRect(data => {
headerHeight = data?.height || 0;
}).select('.container-footer').boundingClientRect(data => {
footerHeight = data?.height || 0;
}).exec(() => {
this.spaceHeight = Number(Number(headerHeight) + Number(footerHeight))
});
} catch (error) {
this.spaceHeight = 0
}
}, 200);
}
}
} else {
if (fn) fn()
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}).catch(error => {
if (fn) fn()
console.error('获取自定义数据 ', error)
})
},
// 获取图片地址
getImagePath(url) {
if (url.indexOf('http') > -1) {
return url
} else {
return this.diyData.domain + url
}
},
// 设置分享数据
setShareData(data) {
this.shareData = data
},
}
}
</script>
<style lang="scss">
page {
padding: 0;
}
.container {
position: relative;
z-index: 9;
min-height: 100vh;
.container-background {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: -1;
}
.container-error {
padding: 64rpx 32rpx;
font-size: 32rpx;
line-height: 48rpx;
color: #5A5B6E;
text-align: center;
}
}
</style>

125
pages/diy/richText.vue Normal file
View File

@@ -0,0 +1,125 @@
<!-- +----------------------------------------------------------------------
| 麦沃德科技赋能开发者助力商协会发展
+----------------------------------------------------------------------
| Copyright (c) 20172024 www.maiwd.cn All rights reserved.
+----------------------------------------------------------------------
| 沃德商协会系统并不是自由软件不加密并不代表开源未经许可不可自由转售和商用
+----------------------------------------------------------------------
| Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
+----------------------------------------------------------------------
| 富文本 开发者: 麦沃德科技半夏
+---------------------------------------------------------------------- -->
<template>
<view class="container">
<!-- 标题栏 -->
<title-bar :title="navigationBarTitle"></title-bar>
<!-- 内容区 -->
<view class="container-main" v-if="loadEnd">
<mp-html :content="editorContent" />
</view>
</view>
</template>
<script>
import { mapState } from "vuex"
// #ifdef H5
import wx from 'weixin-js-sdk';
// #endif
export default {
data() {
return {
// 页面标题
navigationBarTitle: "详情",
// 加载完成
loadEnd: false,
};
},
computed: {
...mapState({
shareInfo: state => state.app.shareInfo,
editorContent: state => state.app.editorContent,
})
},
onLoad(option) {
this.navigationBarTitle = option.name ? decodeURIComponent(option.name) : "详情"
this.$nextTick(() => {
this.loadEnd = true
})
// #ifdef H5
this.initConfig()
// #endif
},
onShareAppMessage() {
return {
title: this.shareInfo.title,
imageUrl: this.shareInfo.image,
}
},
onShareTimeline() {
return {
title: this.shareInfo.title,
imageUrl: this.shareInfo.image,
}
},
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: ["updateAppMessageShareData", "updateTimelineShareData"],
openTagList: ["updateAppMessageShareData", "updateTimelineShareData"],
})
wx.ready(() => {
wx.updateAppMessageShareData({
title: this.shareTitle,
desc: "",
link: window.location.href,
imgUrl: this.shareImage,
});
wx.updateTimelineShareData({
title: this.shareTitle,
link: window.location.href,
imgUrl: this.shareImage,
});
});
} else {
uni.hideLoading()
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}).catch(error => {
uni.hideLoading()
console.error('通过config接口注入权限验证配置 ', error)
})
},
// #endif
},
}
</script>
<style lang="scss">
page {
background: #fff;
}
.container {
.container-main {
padding: 32rpx;
font-size: 32rpx;
line-height: 60rpx;
color: #666;
}
}
</style>

331
pages/diy/search.vue Normal file
View File

@@ -0,0 +1,331 @@
<!-- +----------------------------------------------------------------------
| 麦沃德科技赋能开发者助力商协会发展
+----------------------------------------------------------------------
| 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-column" v-if="memberList.length">
<view class="column-title">会员列表</view>
<member-item :show-data="memberList"></member-item>
<view class="column-more" v-if="parseInt(memberTotal) > parseInt(firstLimit) && memberList.length < parseInt(memberTotal)" @click="memberLoadMore()">
<view class="more-bg"></view>
<view class="more-text">加载更多</view>
</view>
</view>
<view class="main-column" v-if="unitsList.length">
<view class="column-title">会员单位列表</view>
<member-units :show-data="unitsList"></member-units>
<view class="column-more" v-if="parseInt(unitsTotal) > parseInt(firstLimit) && unitsList.length < parseInt(unitsTotal)" @click="unitsLoadMore()">
<view class="more-bg"></view>
<view class="more-text">加载更多</view>
</view>
</view>
<view class="main-column" v-if="activityList.length">
<view class="column-title">活动列表</view>
<activity-item :show-data="activityList"></activity-item>
<view class="column-more" v-if="parseInt(activityTotal) > parseInt(firstLimit) && activityList.length < parseInt(activityTotal)" @click="activityLoadMore()">
<view class="more-bg"></view>
<view class="more-text">加载更多</view>
</view>
</view>
<view class="main-column" v-if="articleList.length">
<view class="column-title">资讯列表</view>
<article-item :show-data="articleList"></article-item>
<view class="column-more" v-if="parseInt(articleTotal) > parseInt(firstLimit) && articleList.length < parseInt(articleTotal)" @click="articleLoadMore()">
<view class="more-bg"></view>
<view class="more-text">加载更多</view>
</view>
</view>
<view class="main-column" v-if="goodsList.length">
<view class="column-title">商品列表</view>
<goods-item :show-data="goodsList"></goods-item>
<view class="column-more" v-if="parseInt(goodsTotal) > parseInt(firstLimit) && goodsList.length < parseInt(goodsTotal)" @click="goodsLoadMore()">
<view class="more-bg"></view>
<view class="more-text">加载更多</view>
</view>
</view>
<empty top="30%" title="暂无相关内容~" v-if="!memberList.length && !unitsList.length && !activityList.length && !articleList.length && !goodsList.length"></empty>
</view>
</view>
</template>
<script>
import { mapState } from "vuex"
import memberItem from "@/pages/component/member/index.vue"
import memberUnits from "@/pages/component/member/units.vue"
import activityItem from "@/pages/component/activity/index.vue"
import articleItem from "@/pages/component/article/index.vue"
import goodsItem from '@/pages/component/mall/goods.vue'
export default {
components: {
memberItem,
memberUnits,
activityItem,
articleItem,
goodsItem,
},
data() {
return {
// 加载完成
loadEnd: false,
// 搜索关键词
keyword: "",
// 首次搜索数量限制
firstLimit: 5,
// 会员查询参数
memberList: [],
memberPage: 0,
memberLimit: 50,
memberTotal: 0,
// 会员单位查询参数
unitsList: [],
unitsPage: 0,
unitsLimit: 50,
unitsTotal: 0,
// 活动查询参数
activityList: [],
activityPage: 0,
activityLimit: 50,
activityTotal: 0,
// 新闻查询参数
articleList: [],
articlePage: 0,
articleLimit: 50,
articleTotal: 0,
// 商品查询参数
goodsList: [],
goodsPage: 0,
goodsLimit: 50,
goodsTotal: 0,
// 是否授权位置信息
isLocation: false,
}
},
computed: {
...mapState({
themeColor: state => state.app.themeColor,
memberTypeConfig: state => state.app.memberTypeConfig,
})
},
onLoad(option) {
this.keyword = decodeURIComponent(option.keyword)
uni.showLoading({
title: "加载中"
})
this.getSearchData(() => {
uni.hideLoading()
this.loadEnd = true
})
},
methods: {
// 获取搜索数据
getSearchData(fn) {
this.$util.request("main.diySearch", {
keywords: this.keyword,
limit: this.firstLimit,
}).then(res => {
if (fn) fn()
if (res.code == 1) {
this.memberList = res.data?.member_data?.data || []
this.memberTotal = res.data?.member_data?.total || 0
this.unitsList = res.data?.unit_data?.data || []
this.unitsTotal = res.data?.unit_data?.total || 0
this.activityList = res.data?.activity_data?.data || []
this.activityTotal = res.data?.activity_data?.total || 0
this.articleList = res.data?.article_data?.data || []
this.articleTotal = res.data?.article_data?.total || 0
this.goodsList = res.data?.goods_data?.data || []
this.goodsTotal = res.data?.goods_data?.total || 0
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}).catch(error => {
console.error('获取自定义搜索数据 ', error)
})
},
// 会员加载更多数据
memberLoadMore() {
if (this.memberList.length >= parseInt(this.memberTotal)) return
this.memberPage++
this.$util.request("member.diySearchList", {
page: this.memberPage,
limit: this.memberLimit,
keywords: this.keyword,
}).then(res => {
if (res.code == 1) {
let list = res.data.data
this.memberTotal = res.data.total
this.memberList = this.memberPage == 1 ? list : [...this.memberList, ...list];
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}).catch(error => {
console.error('获取自定义搜索会员列表 ', error)
})
},
// 会员单位加载更多数据
unitsLoadMore() {
if (this.unitsList.length >= parseInt(this.unitsTotal)) return
this.unitsPage++
this.$util.request("member.units", {
page: this.unitsPage,
limit: this.unitsLimit,
keywords: this.keyword,
}).then(res => {
if (res.code == 1) {
let list = res.data.data
this.unitsTotal = res.data.total
this.unitsList = this.unitsPage == 1 ? list : [...this.unitsList, ...list];
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}).catch(error => {
console.error('获取自定义搜索会员单位列表 ', error)
})
},
// 活动加载更多数据
activityLoadMore() {
if (this.activityList.length >= parseInt(this.activityTotal)) return
this.activityPage++
this.$util.request("activity.list", {
page: this.activityPage,
limit: this.activityLimit,
keywords: this.keyword,
}).then(res => {
if (res.code == 1) {
let list = res.data.data
this.activityTotal = res.data.total
this.activityList = this.activityPage == 1 ? list : [...this.activityList, ...list];
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}).catch(error => {
console.error('获取自定义搜索活动列表 ', error)
})
},
// 资讯加载更多数据
articleLoadMore() {
if (this.articleList.length >= parseInt(this.articleTotal)) return
this.articlePage++
this.$util.request("main.article.list", {
page: this.articlePage,
limit: this.articleLimit,
keywords: this.keyword,
}).then(res => {
if (res.code == 1) {
let list = res.data.data
this.articleTotal = res.data.total
this.articleList = this.articlePage == 1 ? list : [...this.articleList, ...list];
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}).catch(error => {
console.error('获取自定义搜索资讯列表 ', error)
})
},
// 商品加载更多数据
goodsLoadMore() {
if (this.goodsList.length >= parseInt(this.goodsTotal)) return
this.goodsPage++
this.$util.request("mall.goodsList", {
page: this.goodsPage,
limit: this.goodsLimit,
keywords: this.keyword,
}).then(res => {
if (res.code == 1) {
let list = res.data.data
this.goodsTotal = res.data.total
this.goodsList = this.goodsPage == 1 ? list : [...this.goodsList, ...list];
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}).catch(error => {
console.error('获取自定义搜索商品列表 ', error)
})
},
}
}
</script>
<style lang="scss">
.container {
.container-main {
padding: 32rpx;
.main-column {
margin-top: 32rpx;
&:first-child {
margin-top: 0;
}
.column-title {
color: #5A5B6E;
font-size: 32rpx;
font-weight: 600;
line-height: 44rpx;
margin-bottom: 32rpx;
}
.column-more {
position: relative;
width: 100%;
height: 72rpx;
border-radius: 16rpx;
overflow: hidden;
background: #FFF;
margin-top: 32rpx;
.more-bg {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: var(--theme-color);
opacity: .1;
}
.more-text {
position: relative;
z-index: 1;
color: var(--theme-color);
font-size: 12px;
line-height: 72rpx;
text-align: center;
}
}
}
}
}
</style>