发布通告功能
This commit is contained in:
parent
e8ea581394
commit
2f712d125f
5
App.vue
5
App.vue
@ -14,10 +14,7 @@
|
||||
initApp() {
|
||||
// 初始化应用配置
|
||||
this.initConfig()
|
||||
// 检查用户登录状态
|
||||
//#ifdef H5
|
||||
this.checkLogin()
|
||||
//#endif
|
||||
|
||||
},
|
||||
initConfig() {
|
||||
this.globalData.config = config
|
||||
|
@ -78,7 +78,10 @@
|
||||
onShow() {
|
||||
this.refreshUserType()
|
||||
},
|
||||
onLoad: function() {
|
||||
onLoad(param) {
|
||||
if (param.menuCode) {
|
||||
this.menuCode = param.menuCode
|
||||
}
|
||||
this.selectSiteConfig("platform_tel")
|
||||
},
|
||||
methods: {
|
||||
|
@ -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);
|
||||
|
||||
//获取url中的search
|
||||
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>
|
||||
|
@ -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)
|
||||
},
|
||||
/**
|
||||
* 跳转编辑页
|
||||
|
Loading…
Reference in New Issue
Block a user