| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659 |
- <template>
- <view>
- <view class="">
- <view class="margin-lr margin-top" style="position: relative;border-radius: 10upx;overflow: hidden;">
- <image src="https://mxys.chuanghai-tech.com/wmfile/20251112/c35cb76f45884a4a933c4a8d32c6742c.png" style="width: 100%;height: 250rpx;"></image>
- <view class=" u-flex u-p-l-30 u-p-t-40 u-p-b-30" style="position: absolute;top: 0;width: 100%;">
- <view class="u-m-r-20" style="margin-top: -15px;">
- <!-- <u-avatar :src="avatar" size="100"></u-avatar> -->
- <image src="https://mxys.chuanghai-tech.com/wmfile/20251112/34324c384d2543d0ba4cdfef27f6a337.png" style="width: 20px;height: 20px;"></image>
- </view>
- <view class="u-flex-1 ">
- <view class="" style="color: #2A748D; font-size: 20px;">{{userName}}</view>
- <view class="u-font-10 text-bold" style="margin-top: 10rpx;color: #376477;margin-left: -20px;" v-if="vipExpirationTime && isVip">有效期:{{vipExpirationTime}}</view>
- <view class="u-font-12 u-m-t-10 u-tips-color" style="color: #376477;margin-left: -20px;" v-if="!isVip">您目前还未开通会员
- </view>
- <!-- <view class="" style="color: #2A748D; font-size: 20px;">已省{{userName}}</view> -->
- </view>
- </view>
- <image src="https://mxys.chuanghai-tech.com/wmfile/20251112/222489f5f1f24623b2dc8e93e836b5ca.png" style="width: 121px;height: 84px;float: right;margin-top: -120px;"></image>
- </view>
- <!-- <view class="flex justify-center margin-top-sm flex-wrap padding-lr-sm">
- <view style="display: inline-block;width: 216rpx;height: 250rpx;margin: 10rpx 10rpx;">
- <view class="text-center flex flex-direction justify-between padding-tb radius active"
- style="color: #DFC5A7;width: 216rpx;height: 250rpx;background: linear-gradient(-30deg, #2B2A30, #4A4A4A);border: 1px;">
- <view class="text-bold">月会员</view>
- <view class="text-bold">¥<text class="text-xxl">{{vipList.value}}</text></view>
- <view>立即购买</view>
- </view>
- </view>
- </view> -->
- <!-- <view class="flex justify-center align-center margin-top" v-if="!isVip">
- <view class="" @click="showpay=true"
- style="position: relative;left: 0;right: 0;border-radius: 10upx;overflow: hidden;display: inline-block;margin: auto;">
- <image src="../static/vip/bg.png" style="width: 459rpx;height: 129rpx;"></image>
- <view class="flex align-center"
- style="position: absolute;top: -10rpx;left:30rpx;bottom: 0;margin: auto; width: 100%;height: 100%;">
- <view class="text-bold">¥<text class="text-xxl">{{vipList.value}}</text></view>
- </view>
- </view>
- </view> -->
- <view class="padding-tb radius margin-top margin-lr vip2bg">
- <view class="text-center text-xl text-bold " style="color: #2A748D;">会员特权</view>
- <view class="flex flex-wrap">
- <view v-for="(item,index) in MemberList" :key="index"
- style="width: 33%;text-align: center;margin-top: 34upx;">
- <image :src="item.memberImg" mode="" style="margin: 0 auto;height: 45rpx;width: 45rpx;"></image>
- <view class="grid-text margin-top-sm" style="color: #2A748D;">{{item.memberName}}</view>
- </view>
- </view>
- </view>
- <view style="width: 100%;height: 38rpx;"></view>
- <view class="nuanxin" @click="natNuan()">领取会员</view>
- <view style="margin-top: 38rpx;">
- <image style="width: 100%;height: 179px;" @click="clickImg" src="https://mxys.chuanghai-tech.com/wmfile/20251130/41d16a4ba8b9440b8b8872d760fb1cbe.png"></image>
- </view>
- </view>
- <view style="height: 110rpx;"></view>
- <view class="flex justify-between cu-bar foot bg padding-lr" v-if="!isVip">
- <view style="color: #DC2626;">
- <text style="color: #001713;">实付:</text><text style="font-size: 38upx;margin-top: 8upx;">¥{{price}}</text>
- </view>
- <view class="">
- <u-button :custom-style="customStyle" @click="popupShow2=true" shape="circle" :hair-line="false">立即开通
- </u-button>
- </view>
- </view>
- <!-- 支付方式 -->
- <u-popup v-model="showpay" mode="bottom" :closeable="closeable">
- <view class="popup_pay">
- <view style="background-color: #fff;">
- <view style="padding: 0 20upx;margin-top: 60rpx;margin-bottom: 20rpx;">
- <view
- style="display: flex;height: 100upx;align-items: center;padding: 20upx 0;justify-content: center;"
- v-for="(item,index) in openLists" :key='index'>
- <image :src="item.image" style="width: 55upx;height: 55upx;border-radius: 50upx;">
- </image>
- <view style="font-size: 30upx;margin-left: 20upx;width: 70%;">
- {{item.text}}
- </view>
- <radio-group name="openWay" style="margin-left: 45upx;" @tap='selectWay(item)'>
- <label class="tui-radio">
- <radio color="#1777FF" :checked="openWay === item.id ? true : false" />
- </label>
- </radio-group>
- </view>
- </view>
- </view>
- <view class="pay_btn" @click="pay()">确认支付</view>
- </view>
- </u-popup>
-
- <!-- 推广码弹框 -->
- <u-popup v-model="popupShow2" border-radius="20" mode="center">
- <view class="nuan_kuang">
- <view style="text-align: center;font-size: 18px;color: #001713;">推广码</view>
- <view class="cu-form-group">
- <view class="title">推广码</view>
- <input placeholder="请输入推广码" style="border: 1rpx solid;padding-left: 10px;" name="input" v-model="tuiguangma"></input>
- </view>
- <view style="display: flex;margin-top: 20px;">
- <view class="nuan_butt" style="margin-left: 70px;" @click="tuiguang()">确定</view>
- </view>
- </view>
- </u-popup>
- <!-- 暖心认证弹框 -->
- <u-popup v-model="popupShow" border-radius="20" mode="center">
- <view class="nuan_kuang">
- <view style="text-align: center;font-size: 18px;color: #001713;">领取会员</view>
- <view class="cu-form-group">
- <view class="title">学号</view>
- <input placeholder="请输入学号" name="input" v-model="xuehao"></input>
- </view>
- <view class="cu-form-group">
- <view class="title">姓名</view>
- <input placeholder="请输入姓名" name="input" v-model="studentName" type="text"></input>
- </view>
- <view style="display: flex;margin-top: 20px;">
- <view class="nuan_qu" @click="popupShow=false">取消</view>
- <view class="nuan_butt" @click="nuanQue">确定</view>
- </view>
- </view>
- </u-popup>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- vipExpirationTime:'',
- showpay: false,
- closeable: true,
- openLists: [],
- customStyle: {
- width: '136px',
- color: '#FFFFFF',
- background: "#2A748D",
- border: 0,
- fontWeight: '700'
- },
- gridData: [{
- title: '专享折上折',
- image: '../static/1.png'
- },
- {
- title: '特权礼物',
- image: '../static/2.png'
- },
- {
- title: '身份标识',
- image: '../static/3.png'
- },
- {
- title: '超值专享券',
- image: '../static/4.png'
- },
- {
- title: '商家特权',
- image: '../static/5.png'
- },
- {
- title: '定制挂件',
- image: '../static/6.png'
- }
- ],
- avatar: '',
- userName: '匿名',
- vipList: [],
- selNum: 1,
- newPrice: 0,
- money: 0,
- price: 0,
- MemberList: [],
- isVip: false,
- openWay: 2,
- popupShow:false,//暖心认证弹框
- tuiguangma:'',
- xuehao:'',
- studentName:'',
- popupShow2:false,//推广码弹框
- }
- },
- onLoad() {
- // #ifdef APP
- this.openLists = [{
- image: '../../static/images/my/weixin.png',
- text: '微信',
- id: 2
- }, {
- image: '../../static/images/my/zhifubao.png',
- text: '支付宝',
- id: 3
- },{
- image: '../../static/images/my/jinbi.png',
- text: '零钱',
- id: 1
- }]
- // #endif
- // #ifdef MP-WEIXIN
- this.openLists = [{
- image: '../../static/images/my/weixin.png',
- text: '微信',
- id: 2
- },
- // {
- // image: '../../static/images/my/jinbi.png',
- // text: '零钱',
- // id: 1
- // },
- ]
- // #endif
- // #ifdef H5
- this.openLists = [{
- image: '../../static/images/my/weixin.png',
- text: '微信',
- id: 2
- },{
- image: '../../static/images/my/zhifubao.png',
- text: '支付宝',
- id: 3
- },{
- image: '../../static/images/my/jinbi.png',
- text: '零钱',
- id: 1
- }]
- // #endif
- this.avatar = uni.getStorageSync('avatar')
- this.userName = uni.getStorageSync('userName')
- this.getVipList()
- this.getMemberList()
- this.getMoney()
- this.getIsVip()
- this.getUserInfo()
- },
- methods: {
- //点击放大图片
- clickImg(){
- wx.previewImage({
- urls: [], //需要预览的图片http链接列表,多张的时候,url直接写在后面就行了
- current:'https://mxys.chuanghai-tech.com/wmfile/20251130/41d16a4ba8b9440b8b8872d760fb1cbe.png', // 当前显示图片的http链接,默认是第一个
- success: function(res) {},
- fail: function(res) {},
- complete: function(res) {},
- })
- },
- //推广码弹框
- tuiguang(){
- if (!this.tuiguangma) {
- this.$queue.showToast("请输入推广码");
- }else{
- this.popupShow2=false
- this.showpay=true
- }
- },
- //暖心认证
- natNuan(){
- if(this.isVip==true){
- this.$queue.showToast("已是会员,请勿重复操作");
- }else{
- this.popupShow=true
- }
- },
- //提交认证
- nuanQue() {
- const data={
- "name": this.studentName,
- "studentNumber": this.xuehao,
- }
- console.log('提交1',data)
- if (!this.studentName) {
- this.$queue.showToast("请输入姓名");
- } else if (!this.xuehao) {
- this.$queue.showToast("请输入学号");
- }else {
- this.$queue.showLoading("加载中...");
- this.$Request.postJson("/app/special-favor-student/verify", {
- name: this.studentName,
- studentNumber: this.xuehao,
- }).then(res => {
- console.log('提交',res)
- if (res.code == 0) {
- uni.hideLoading()
-
- setTimeout(function() {
- this.popupShow=false
- this.getIsVip()
- }, 10)
- } else {
- uni.hideLoading();
- this.$queue.showToast(res.msg);
- }
- });
- }
- },
- selectWay: function(item) {
- this.openWay = item.id;
- },
- getUserInfo() {
- this.$Request.get("/app/user/selectUserById").then(res => {
- if (res.code == 0) {
- this.avatar = res.data.avatar ? res.data.avatar : 'https://mxys.chuanghai-tech.com/wmfile/20250814/fff4dc5d02ea4af881db9685f2e1e61d.png'
- uni.setStorageSync('avatar', res.data.avatar)
- }
- });
- },
- //获取VIP列表
- getVipList() {
- this.$Request.get('/app/common/type/313').then(res => {
- if (res.code == 0) {
- this.vipList = res.data
- this.price = this.vipList.value
- }
- })
- },
- // 获取特权列表
- getMemberList() {
- this.$Request.get('/app/member/selectMemberList').then(res => {
- console.log(res,'会员特权')
- if (res.code == 0) {
- this.MemberList = res.data
- }
- })
- },
- getIsVip() {
- this.$Request.get("/app/user/selectUserMessage").then(res => {
- console.log(res,'会员')
- if (res.code == 0) {
- this.vipExpirationTime = res.data.vipExpirationTime;
- const vip=res.data.isVip==1?true:false
-
- // 2. 解析为时间戳(毫秒)
- const expireTimestamp = new Date(this.vipExpirationTime).getTime();
- // 获取当前时间的时间戳
- const currentTimestamp = new Date().getTime();
- console.log("当前时间",expireTimestamp,currentTimestamp);
- if(vip==true){
- // 3. 比较:当前时间 > 有效期 → 已过期
- if (currentTimestamp > expireTimestamp) {
- console.log("当前时间已超过有效期");
- this.isVip = false
- // 这里写过期后的逻辑(比如提示用户、跳转页面等)
- } else {
- this.isVip = true
- console.log("当前时间在有效期内");
- }
- }else{
- this.isVip = false
- }
-
- // this.isVip = res.data.isVip==1?true:false
- }
- });
- },
- // 我的金币
- getMoney() {
- this.$Request.get("/app/userMoney/selectMyMoney").then(res => {
- if (res.code == 0 && res.data) {
- this.money = res.data.money
- }
- });
- },
- select(e) {
- this.selNum = e.id
- this.price = e.money
- },
- pay() {
- let userId = uni.getStorageSync('userId')
- this.showpay = false
- if (this.openWay == 1) { //余额支付/app/wxPay/balanceBuyVip
- let data1 = {
- // type: 3,
- userId:userId,
- promoCode:this.tuiguangma,
- }
- this.$Request.get("/app/vip/balance-pay", data1).then(res => {
- if (res.code == 0) {
- this.$queue.showToast('支付成功');
- setTimeout(function() {
- uni.navigateBack()
- }, 1000)
- }else {
- this.$queue.showToast(res.msg);
- }
- });
- } else if (this.openWay == 2) { //微信支付
- // #ifdef MP-WEIXIN
- let data = {
- // type: 3,
- userId:userId,
- promoCode:this.tuiguangma,
- }///app/wxPay/wxPayJsApiBuyVip
- console.log(data,'支付')
- this.$Request.get('/app/vip/get-pay-param', data).then(res => {
- console.log(res)
- if (res.code == 0) {
- uni.requestPayment({
- provider: 'wxpay',
- timeStamp: res.timeStamp,
- nonceStr: res.nonceStr,
- package: res.packageStr,
- signType: res.signType,
- paySign: res.paySign,
- success: function(res) {
- console.log(res)
- uni.showLoading({
- title: '支付成功',
- icon: 'none'
- });
- setTimeout(function() {
- uni.navigateBack()
- }, 1000)
- },
- fail: function(err) {
- uni.showLoading({
- title: '支付失败',
- icon: 'nones'
- });
- }
- });
- }
- });
- // #endif
- // #ifdef H5
- let data = {
- userId: userId,
- type: 2
- }
- this.$Request.post('/app/wxPay/wxPayJsApiBuyVip', data).then(res => {
- this.showpay = false
- this.callPay(res);
- });
- // #endif
- // #ifdef APP
- let data = {
- type: 1
- }
- this.$Request.post('/app/wxPay/wxPayJsApiBuyVip', data).then(res => {
- console.log(res)
- this.showpay = false
- if (res.code == 0) {
- this.isCheckPay(res.code, 'wxpay', JSON.stringify(res.data));
- }
- });
- // #endif
- } else if (this.openWay == 3) { //支付宝支付
- // #ifdef H5
- let data = {
- type: 5
- }
- this.$Request.post('/app/wxPay/wxPayJsApiBuyVip', data).then(
- res => {
- this.showpay = false
- const div = document.createElement('div')
- div.innerHTML = res.data //此处form就是后台返回接收到的数据
- document.body.appendChild(div)
- document.forms[0].submit()
- });
- // #endif
- // #ifdef APP-PLUS
- let data = {
- type: 4
- }
- this.$Request.post('/app/wxPay/wxPayJsApiBuyVip', data).then(res => {
- this.showpay = false
- this.setPayment('alipay', res.data);
- });
- // #endif
- }
- },
- callPay: function(response) {
- if (typeof WeixinJSBridge === "undefined") {
- if (document.addEventListener) {
- document.addEventListener('WeixinJSBridgeReady', this.onBridgeReady(response), false);
- } else if (document.attachEvent) {
- document.attachEvent('WeixinJSBridgeReady', this.onBridgeReady(response));
- document.attachEvent('onWeixinJSBridgeReady', this.onBridgeReady(response));
- }
- } else {
- this.onBridgeReady(response);
- }
- },
- onBridgeReady: function(response) {
- let that = this;
- console.log(response)
- if (!response.package) {
- return;
- }
- WeixinJSBridge.invoke(
- 'getBrandWCPayRequest', {
- "appId": response.appid, //公众号名称,由商户传入
- "timeStamp": response.timestamp, //时间戳,自1970年以来的秒数
- "nonceStr": response.noncestr, //随机串
- "package": response.package,
- "signType": response.signType, //微信签名方式:
- "paySign": response.sign //微信签名
- },
- function(res) {
- if (res.err_msg === "get_brand_wcpay_request:ok") {
- // 使用以上方式判断前端返回,微信团队郑重提示:
- //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
- uni.showLoading({
- title: '支付成功'
- });
- uni.hideLoading();
- uni.navigateTo({
- url: '/pages/my/index'
- })
- } else {
- uni.hideLoading();
- }
- WeixinJSBridge.log(response.err_msg);
- }
- );
- },
- isCheckPay(code, name, order) {
- if (code == 0) {
- console.log('999999999999')
- this.setPayment(name, order);
- } else {
- uni.hideLoading();
- uni.showToast({
- title: '支付信息有误'
- });
- }
- },
- setPayment(name, order) {
- console.log(777777777, name, order)
- uni.requestPayment({
- provider: name,
- orderInfo: order, //微信、支付宝订单数据
- success: function(res) {
- uni.hideLoading();
- uni.showLoading({
- title: '支付成功',
- icon: 'none'
- });
- setTimeout(function() {
- uni.navigateBack()
- }, 1000)
- },
- fail: function(err) {
- uni.hideLoading();
- },
- complete() {
- uni.hideLoading();
- }
- });
- }
- },
- computed: {
- }
- }
- </script>
- <style>
- .bg {
- background-color: #FFFFFF;
- }
- .btn {
- width: 100%;
- height: 88upx;
- background: linear-gradient(0deg, #af8262 0%, #cab49c 100%);
- border-radius: 44upx;
- text-align: center;
- line-height: 88upx;
- margin-top: 40upx;
- font-size: 34upx;
- font-weight: 600;
- color: #402321;
- }
- .active {
- border: 1px solid #cab49c !important;
- border-radius: ;
- }
- .popup_pay {
- width: 100%;
- position: relative;
- padding-bottom: 45rpx;
- }
- .pay_btn {
- width: 90%;
- margin: 0 auto;
- text-align: center;
- background: #FCD202;
- height: 80rpx;
- border-radius: 16rpx;
- color: #ffffff;
- line-height: 80rpx;
- }
- .vip2bg{
- background-image: url('https://mxys.chuanghai-tech.com/wmfile/20251112/16095cb872cf4572afc82f8755d74951.png');
- background-size: 100%;
- }
- /* 暖心认证 */
- .nuanxin{
- position: relative;
- width: 177px;
- height: 47px;
- background-color: #2A748D;
- color: #ffffff;
- font-size: 18px;
- border-radius: 32px;
- text-align: center;
- line-height: 47px;
- margin: auto;
- }
- /* 暖心认证弹框 */
- .nuan_kuang{
- padding: 30rpx 30rpx 30rpx 30rpx;
- font-size: 15px;
- width: 300px;
- height: 180px;
- }
- .nuan_qu{
- width: 130px;
- height: 33px;
- border: 2rpx solid rgba(129, 189, 179, 1);
- background-color: rgba(129, 189, 179, 0.4);
- color: #001713;
- font-size: 14px;
- border-radius: 16px;
- text-align: center;
- line-height: 33px;
- }
- .nuan_butt{
- margin-left: 20px;
- width: 130px;
- height: 33px;
- background-color: #2A748D;
- color: #ffffff;
- font-size: 14px;
- border-radius: 16px;
- text-align: center;
- line-height: 33px;
- }
- </style>
|