123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- import App from './App'
- import {myRequest} from './utils/request.js'
- import {getUserDetail} from '@/api/common.js'
- import {getVipLog,mealList,getTmpVip} from '@/api/combo.js'
- function GetVip(){
- console.log('cesjhio');
- if(uni.getStorageSync('token')){
- getVipLog().then(res=>{
- let createTime = new Date(JSON.parse(uni.getStorageSync('userInfo')).createTime)
- if(res.content&&!res.content.length&&createTime>new Date('2024-12-01 00:00:00')){
- this.showGetVip = true
- // uni.showModal({
- // title:'提示',
- // content:'免费领取7天会员,畅享专属权益,点击“领取”体验!',
- // cancelText:'取消',
- // confirmText:'领取',
- // success: function (r) {
- // if (r.confirm) {
- // console.log('用户点击确定');
- // mealList({source:2}).then(result=>{
- // if(result.content.records.length){
- // getTmpVip(result.content.records[0].setMealCode).then(res1=>{
- // if(res1.state == 'Success'){
- // getUserDetail().then(data => {
- // uni.setStorageSync('userInfo', JSON.stringify(data.content))
- // })
- // uni.showToast({
- // title:'领取成功',
- // icon:'none'
- // })
- // }
- // })
-
- // }else{
- // uni.showToast({
- // title:'未配置临时会员',
- // icon:'none'
- // })
- // }
- // })
- // }
- // }
- // })
- }
- })
- }
- }
- function submit(){
- mealList({source:2}).then(result=>{
- if(result.content.records.length){
- getTmpVip(result.content.records[0].setMealCode).then(res1=>{
- if(res1.state == 'Success'){
- getUserDetail().then(data => {
- uni.setStorageSync('userInfo', JSON.stringify(data.content))
- })
- this.showGetVip = false
- uni.showToast({
- title:'领取成功',
- icon:'none'
- })
- }
- })
-
- }else{
- uni.showToast({
- title:'未配置临时会员',
- icon:'none'
- })
- }
- })
- }
- // #ifndef VUE3
- import Vue from 'vue'
- import './uni.promisify.adaptor'
- Vue.config.productionTip = false
- App.mpType = 'app'
- //挂载,让全局可以使用
- Vue.prototype.$req = myRequest
- Vue.prototype.$GetVip = GetVip
- Vue.prototype.$Submit = submit
- import uView from '@/uni_modules/uview-ui'
- Vue.use(uView)
- uni.$u.config.unit = 'rpx'
- const app = new Vue({
- ...App
- })
- app.$mount()
- // #endif
- // #ifdef VUE3
- import { createSSRApp } from 'vue'
- export function createApp() {
- const app = createSSRApp(App)
- return {
- app
- }
- }
- // #endif
|