发布通告功能

This commit is contained in:
13405411873 2025-04-21 12:26:33 +08:00
parent e8ea581394
commit 2f712d125f
4 changed files with 158 additions and 90 deletions

View File

@ -14,10 +14,7 @@
initApp() {
//
this.initConfig()
//
//#ifdef H5
this.checkLogin()
//#endif
},
initConfig() {
this.globalData.config = config

View File

@ -78,7 +78,10 @@
onShow() {
this.refreshUserType()
},
onLoad: function() {
onLoad(param) {
if (param.menuCode) {
this.menuCode = param.menuCode
}
this.selectSiteConfig("platform_tel")
},
methods: {

View File

@ -69,8 +69,21 @@
<script>
import navigationBarVue from '@/components/navigation/navigationBar.vue';
import {baseCardList, rightList} from '@/api/business/base.js'
import {saveOrder} from '@/api/business/member.js'
import {
baseCardList,
rightList
} from '@/api/business/base.js'
import {
saveOrder
} from '@/api/business/member.js'
import {
getToken
} from '@/utils/auth'
import {
getCodeUrl,
getWebAccessTokenAndOpenid,
gzhLogin
} from '@/api/wxApi'
export default {
components: {
navigationBarVue
@ -83,8 +96,8 @@
chooseCardIndex: 0,
//
choosePriceIndex: 0,
//
userType:'02',
//
userType: '02',
//
memberCardList: [{
id: "1",
@ -133,10 +146,10 @@
cardName: '非会员'
}, {
id: '2',
cardName: '箐英'
cardName: '箐英'
}, {
id: '3',
cardName: '钻石'
cardName: '钻石'
}],
rightsList: [{
name: "每日解锁通告上限",
@ -160,44 +173,95 @@
}
},
onLoad(options){
this.initData(options.userType);
},
methods: {
/**初始化*/
initData(userType){
this.userType = userType
this.getCardList(userType);
this.getRightsList(userType);
},
onLoad(options) {
/**获取会员卡列表*/
getCardList(userType){
baseCardList({userType:userType}).then(res => {
this.memberCardList = res.data
}).catch((e) => {
uni.showToast({
icon: 'error',
duration: 2000,
title: e
});
})
},
/**权益列表*/
getRightsList(userType){
rightList({userType:userType}).then(res => {
this.cardList = res.data.cardList
this.rightsList = res.data.rightsList
console.log(this.cardList,'cardList')
console.log(this.rightsList,'rightsList')
}).catch((e) => {
uni.showToast({
icon: 'error',
duration: 2000,
title: e
});
})
},
this.initData(options.userType);
//urlsearch
let search = location.search.slice(1);
let arr = search.split("&");
let result = {};
arr.forEach(function(item) {
let itemArr = item.split('=');
result[itemArr[0]] = itemArr[1];
})
if (result.code) {
getWebAccessTokenAndOpenid(result.code).then(res => {
gzhLogin(res)
})
} else {
this.toLogin(options.userType)
}
},
methods: {
toLogin(userType) {
/*#ifdef APP-PLUS*/
// App
console.log('Running on App-Plus');
/*#endif*/
/*#ifdef H5*/
// H5
if (!getToken()) {
//
getCodeUrl(userType).then(res => {
window.location.href = res.codeUrl;
})
}
/*#endif*/
/*#ifdef MP-WEIXIN*/
//
console.log('Running on WeChat Mini Program');
/*#endif*/
},
/**初始化*/
initData(userType) {
if (getToken()) {
this.userType = userType
this.getCardList(userType);
this.getRightsList(userType);
}
},
/**获取会员卡列表*/
getCardList(userType) {
baseCardList({
userType: userType
}).then(res => {
this.memberCardList = res.data
}).catch((e) => {
uni.showToast({
icon: 'error',
duration: 2000,
title: e
});
})
},
/**权益列表*/
getRightsList(userType) {
rightList({
userType: userType
}).then(res => {
this.cardList = res.data.cardList
this.rightsList = res.data.rightsList
console.log(this.cardList, 'cardList')
console.log(this.rightsList, 'rightsList')
}).catch((e) => {
uni.showToast({
icon: 'error',
duration: 2000,
title: e
});
})
},
/**
* 菜单点击
* @param {Object} index
@ -220,41 +284,41 @@
handleUserAgrement(site) {
this.$tab.navigateTo(`/pages/common/richview/index?title=${site.title}&code=${site.code}`)
},
/**生成订单*/
toOrder(){
let data = {
userType:this.userType,
orderType:'01',
goodsId:this.memberCardList[this.chooseCardIndex].id,
goodsNum:1,
goodsPrice:this.memberCardList[this.chooseCardIndex].priceList[this.choosePriceIndex].price,
}
if (this.memberCardList[this.chooseCardIndex].priceList[this.choosePriceIndex].title === '年付会员') {
data.goodsCycle = '03'
}
if (this.memberCardList[this.chooseCardIndex].priceList[this.choosePriceIndex].title === '季付会员') {
data.goodsCycle = '02'
}
if (this.memberCardList[this.chooseCardIndex].priceList[this.choosePriceIndex].title === '月付会员') {
data.goodsCycle = '01'
}
saveOrder(data).then(res => {
if (res.code == 200) {
uni.showToast({
icon: 'success',
duration: 2000,
title: '保存成功'
});
uni.navigateBack()
}
}).catch((e) => {
uni.showToast({
icon: 'error',
duration: 2000,
title: e
});
})
},
/**生成订单*/
toOrder() {
let data = {
userType: this.userType,
orderType: '01',
goodsId: this.memberCardList[this.chooseCardIndex].id,
goodsNum: 1,
goodsPrice: this.memberCardList[this.chooseCardIndex].priceList[this.choosePriceIndex].price,
}
if (this.memberCardList[this.chooseCardIndex].priceList[this.choosePriceIndex].title === '年付会员') {
data.goodsCycle = '03'
}
if (this.memberCardList[this.chooseCardIndex].priceList[this.choosePriceIndex].title === '季付会员') {
data.goodsCycle = '02'
}
if (this.memberCardList[this.chooseCardIndex].priceList[this.choosePriceIndex].title === '月付会员') {
data.goodsCycle = '01'
}
saveOrder(data).then(res => {
if (res.code == 200) {
uni.showToast({
icon: 'success',
duration: 2000,
title: '保存成功'
});
uni.navigateBack()
}
}).catch((e) => {
uni.showToast({
icon: 'error',
duration: 2000,
title: e
});
})
},
}
}
</script>

View File

@ -181,6 +181,12 @@
import {
queryDetail
} from '@/api/business/member.js'
import {
getToken
} from '@/utils/auth'
import {
getCodeUrl
} from '@/api/wxApi'
export default {
props: {
nowUserType: {
@ -188,11 +194,6 @@
default: null
}
},
watch: {
// 'nowUserType': function(newVal, oldVal) {
// this.$emit('update:params', newVal);
// }
},
components: {
tabBarVue,
},
@ -215,7 +216,9 @@
}
},
onShow() {},
onLoad() {},
onLoad() {
},
mounted() {
if (null != getJSONData(constant.userInfo)) {
this.userInfo = getJSONData(constant.userInfo)
@ -294,7 +297,8 @@
* 去积分列表
*/
goPoints() {
this.$tab.navigateTo('/pages/mine/points/points?userId='+this.userInfo.userId+'&pointsBalance='+this.userInfo.pointsBalance)
this.$tab.navigateTo('/pages/mine/points/points?userId=' + this.userInfo.userId + '&pointsBalance=' + this
.userInfo.pointsBalance)
},
/**
* 跳转编辑页