兼兼街公众号代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

503 lines
14 KiB

<template>
<view>
<view class="active-card">
<view>
<view class="active-title">{{dataInfo.title}}</view>
<view class="active-time">
<text>{{dataInfo.longTitle}} </text>
</view>
<view class="active-add2">
<text>库存{{dataInfo.num}} </text>
</view>
<view class="active-add">
<text>销量{{dataInfo.payNum}} </text>
</view>
</view>
<view>
<view class="hide-context" >可用{{dataInfo.intgerPrice}}积分进行兑换该商品</view>
<!-- <view style="padding: 25rpx 0;" v-if="erop == true">
<view class="active-title">联系方式</view>
<view class="active-time">
<view class="menu-price">
<text class="tips">{{dataInfo.phone}}</text>
</view>
</view>
</view> -->
</view>
</view>
<view class="contnet">
<u-parse :content="dataInfo.details"></u-parse>
</view>
<view v-if="!showp" class="btn-box">
<u-button v-if="fromPage && fromPage == 'tuijian'" text="我要推荐" @click="share" :customStyle="baomingStyle"
:hairline="false" color="#00BBFF"></u-button>
<view style="display: flex; background-color: #FFFFFF;">
<view
style="width: 266rpx; height: 72rpx; border: 1rpx solid #00BBFF; color: #00BBFF; line-height: 72rpx;text-align: center;margin: 20rpx 60rpx;"
@click="getCreteClick">立即购买({{dataInfo.price}})</view>
<view
style="width: 266rpx; height: 72rpx; border: 1rpx solid #00BBFF; background-color: #00BBFF; color: #FFFFFF; line-height: 72rpx;text-align: center;margin: 20rpx 60rpx; margin-left: auto;"
@click="getCreteClickJf">积分兑换({{dataInfo.intgerPrice}})</view>
</view>
</view>
<view class="share-box" v-show="shareShow" @click="shareShow=false">
<view class="jiantou">
<image src="@/static/img/jiantou-icon.png" mode=""></image>
</view>
<view class="title">
<image src="@/static/img/title-icon.png" mode=""></image>
</view>
</view>
<!-- <view v-if="showp">
<view
style="position: fixed;left: 0; top: 0;width: 100vw;height: 100vh;background-color: rgba(0, 0, 0, 0.2);">
<view
style="margin: 200rpx auto;width: 600rpx;height: 818rpx;background-color: #FFFFFF;padding: 0 32rpx;position: relative;">
<view style="font-size: 28rpx;
font-family: Microsoft YaHei, Microsoft YaHei-Bold;
font-weight: 700;
text-align: left;
color: #191919;
line-height: 120rpx;
border-bottom: 1rpx solid #e7e7e7;
position: relative;">
<text>{{dataInfo.title}}</text>
<view style="position: absolute; right: 20rpx; top: 0">
</view>
</view>
<view style="font-size: 24rpx;line-height: 60rpx;margin-top: 30rpx;">
<view class="active-time">
<text>发车时间:{{dataInfo.outGoTime}}</text>
</view>
<view class="active-add">
<text>始发终点: {{dataInfo.outGo}} - {{dataInfo.toGo}}</text>
</view>
<view class="active-add">
<text>
剩余位置:{{dataInfo.sum}} 位
</text>
</view>
</view>
<view style="position: absolute; bottom: 50rpx;display: flex;">
<image style="width: 60rpx; height: 60rpx; border-radius: 50%;" src="../../static/qrcode.jpg">
</iimage>
<view style="padding: 18rpx;font-size: 28rpx;">兼兼街</view>
</view>
<view style="position: absolute; bottom: 50rpx; right: 32rpx;">
<canvas canvas-id="qrcode" style="width: 140rpx; height: 140rpx;" />
<view style="padding: 18rpx;font-size: 24rpx;text-align: center;">国联智聘</view>
</view>
</view>
<view style="position: absolute; bottom: 0; left: 0;">
<view style="display: flex; background-color: #CCCCCC;">
<view
style="width: 266rpx; height: 72rpx; border: 1rpx solid #00BBFF; color: #00BBFF; line-height: 72rpx;text-align: center;margin: 20rpx 60rpx;"
@click="showp=false">取消</view>
<view
style="width: 266rpx; height: 72rpx; border: 1rpx solid #00BBFF; background-color: #00BBFF; color: #FFFFFF; line-height: 72rpx;text-align: center;margin: 20rpx 60rpx; margin-left: auto;"
@click="">保存海报</view>
</view>
</view>
</view>
</view> -->
</view>
</template>
<script>
import uQRCode from '@/common/uqrcode.js'
export default {
data() {
return {
shareShow: false,
fromPage: null,
dataInfo: {},
showp: false,
userInfo: {},
id: '',
erop: false,
src: '',//require('@/static/img/course-img.png'),
baomingStyle: {
fontSize: "30rpx",
fontWeight: "700",
height: "100rpx"
}
}
},
onLoad(e) {
if (e.fromPage) this.fromPage = e.fromPage;
this.id = e.id;
this.getactivityFindById(e.id);
},
onReady() {
this.$com.displayNav()
},
methods: {
getmyInfo() {
this.$api('myInfo')
.then(res => {
if (res.code == 200) {
this.role = res.result.role;
this.userInfo = res.result;
this.$store.commit('set_userInfo', res.result)
this.qrFun('https://xinxiong.java996.icu/pages/my/login-kehu?vid=' + this.userInfo.id +
"&did=" + this.id)
} else {
this.userInfo = null
}
})
},
getCreteClick() {
let that = this;
this.$api('createShopOrder', {
id: this.dataInfo.id
})
.then(res => {
// if (res.code == 200) {
// that.erop = true;
// }
if (res.code == 200) {
that.$api('create', {
id: res.result.id
})
.then(res => {
console.log(res)
that.$jweixin.config({
debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
appId: 'wx6fb4a17b28186d58', // 必填,公众号的唯一标识
timestamp: res.result.timestamp, // 必填,生成签名的时间戳
nonceStr: res.result.noncestr, // 必填,生成签名的随机串
signature: res.result.sgture, // 必填,签名
jsApiList: ['updateAppMessageShareData', 'updateTimelineShareData',
'onMenuShareTimeline', 'onMenuShareAppMessage',
'chooseWXPay'
]
});
that.$jweixin.chooseWXPay({
appId: 'wx6fb4a17b28186d58',
timestamp: res.result
.timeStamp, // 支付签名时间戳,注意微信 jssdk 中的所有使用 timestamp 字段均为小写。但最新版的支付后台生成签名使用的 timeStamp 字段名需大写其中的 S 字符
nonceStr: res.result.nonceStr, // 支付签名随机串,不长于 32 位
package: res.result
.packageValue, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=\*\*\*)
signType: res.result
.signType, // 微信支付V3的传入 RSA ,微信支付V2的传入格式与V2统一下单的签名格式保持一致
paySign: res.result.paySign, // 支付签名
success: function(res) {
that.erop = true;
}
});
})
}
})
},
getCreteClickJf(){
this.$api('createIntegerOrder', {
id: this.dataInfo.id
})
.then(res => {
this.$Toast('购买成功')
setTimeout(() => {
uni.navigateTo({
url: '/pages/my/my-order-list'
})
}, 1000)
})
},
qrFun(text) {
this.qrShow = true
uQRCode.make({
canvasId: 'qrcode',
componentInstance: this,
text: text,
size: 65,
margin: 0,
backgroundColor: '#FFFFFF',
foregroundColor: '#000000',
fileType: 'png',
errorCorrectLevel: uQRCode.errorCorrectLevel.H,
success: res => {
console.log("ercode", text)
}
})
},
apply() {
if (!this.$store.state.userToken) {
this.$Toast('请先登录!')
setTimeout(() => {
uni.navigateTo({
url: '/pages/my/login-kehu'
})
}, 1000)
return
}
this.share(1)
uni.navigateTo({
url: `/pages/home/buy-course?id=${this.id}`
})
},
wechatMoments() {
this.$api('creteFenxian', {
url: location.href.split('#')[0]
})
.then(res => {
if (res.code == 200) {
this.$jweixin.config({
debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
appId: 'wxdabccf5a0110cfab', // 必填,公众号的唯一标识
timestamp: res.result.timestamp, // 必填,生成签名的时间戳
nonceStr: res.result.noncestr, // 必填,生成签名的随机串
signature: res.result.sgture, // 必填,签名
jsApiList: ['updateAppMessageShareData', 'updateTimelineShareData',
'onMenuShareTimeline', 'onMenuShareAppMessage', 'chooseWXPay'
]
});
this.$jweixin.ready(ress => {
this.$jweixin.updateTimelineShareData({
title: this.dataInfo.title,
link: `https://xinxiong.java996.icu/pages/home/course-detial?id=${this.id}`, // 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
})
});
}
})
},
share(type) { //1为支付
if (!type) {
this.shareShow = true;
}
this.$api('creteFenxian', {
url: location.href.split('#')[0]
})
.then(res => {
if (res.code == 200) {
this.$jweixin.config({
debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
appId: 'wxdabccf5a0110cfab', // 必填,公众号的唯一标识
timestamp: res.result.timestamp, // 必填,生成签名的时间戳
nonceStr: res.result.noncestr, // 必填,生成签名的随机串
signature: res.result.sgture, // 必填,签名
jsApiList: ['updateAppMessageShareData', 'updateTimelineShareData',
'onMenuShareTimeline', 'onMenuShareAppMessage', 'chooseWXPay'
]
});
this.$jweixin.ready(ress => {
this.$jweixin.onMenuShareTimeline({
title: this.dataInfo.title,
desc: this.dataInfo.title, // 分享描述
link: `http://liyuyu.xzaiyp.top/pages/home/course-detial?id=${this.id}`, // 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
success: function() {
// 用户点击了分享后执行的回调函数
}
})
this.$jweixin.onMenuShareAppMessage({
title: this.dataInfo.title,
desc: this.dataInfo.title, // 分享描述
link: `http://liyuyu.xzaiyp.top/pages/home/course-detial?id=${this.id}`, // 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
success: function() {
// 用户点击了分享后执行的回调函数
}
})
})
this.$jweixin.error(err => {
// uni.showModal({
// content:'err:' + JSON.stringify(err)
// })
// config信息验证失败会执行 error 函数,如签名过期导致验证失败,具体错误信息可以打开 config 的debug模式查看,也可以在返回的 res 参数中查看,对于 SPA 可以在这里更新签名。
});
// uni.navigateTo({
// url:`/pages/home/buy-course?id=${this.id}`
// })
}
})
},
getactivityFindById(id) {
uni.showLoading()
this.$api('getShopDetailsById', {
id
})
.then(res => {
uni.hideLoading()
if (res.code == 200) {
this.dataInfo = res.result;
}
})
},
poster() {
this.showp = true;
this.getmyInfo()
}
}
}
</script>
<style lang="scss" scoped>
.hide-context {
margin: 20rpx 0;
padding: 30rpx 30rpx;
outline: 0px;
width: 100%;
max-width: 100%;
box-sizing: border-box;
overflow-wrap: break-word;
display: inline-block;
vertical-align: top;
background-image: linear-gradient(#dceefc 0%, #fefeff 100%);
height: auto;
overflow: hidden;
border: 0px none;
color: #B0B0B0;
text-align: center;
font-size: 26rpx;
}
.active-card {
background: #ffffff;
padding: 20rpx 29rpx 13rpx;
border-bottom: 20rpx solid #F5F5F5;
.active-title {
font-size: 36rpx;
color: #000;
font-weight: 700;
margin-top: 20rpx;
line-height: 40rpx;
}
.active-time {
color: #707070;
font-size: 30rpx;
margin: 30rpx 0;
}
.active-add {
color: #707070;
font-size: 30rpx;
margin: 30rpx 0;
}
.active-add2 {
color: #707070;
font-size: 30rpx;
}
.menu-price {
font-weight: 700;
font-size: 40rpx;
color: #D33D3E;
.unit {
font-size: 40rpx;
}
.tips {
font-size: 30rpx;
}
}
.copy {
padding-left: 20rpx;
font-size: 26rpx;
color: #1b2bbc;
cursor: pointer;
}
.active-menu {
margin-top: 31rpx;
.menu-btn {
width: 213rpx;
height: 79rpx;
display: flex;
align-items: center;
justify-content: center;
background-color: #ED1450;
color: #FFFFFF;
font-size: 26rpx;
border-radius: 40rpx;
}
}
}
.contnet {
padding: 20rpx 20rpx 150rpx 20rpx;
font-weight: 500;
font-size: 40rpx;
}
.btn-box {
position: fixed;
bottom: 0;
left: 0;
right: 0;
}
.share-box {
width: 100%;
height: 100vh;
position: fixed;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, .8);
.jiantou {
position: absolute;
top: 140rpx;
right: 40rpx;
image {
width: 138rpx;
height: 138rpx;
}
}
.title {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
image {
width: 526rpx;
height: 212rpx;
}
}
}
</style>