Преглед на файлове

新增凯辉跳转页面,激活码开通套餐功能 -zzx

zouzexu преди 7 месеца
родител
ревизия
e7ebbde073
променени са 6 файла, в които са добавени 195 реда и са изтрити 7 реда
  1. 24 7
      my/vipActivation/index.vue
  2. 6 0
      pages.json
  3. 129 0
      special/kaihui.vue
  4. BIN
      static/kaihui.png
  5. BIN
      static/kaihuifuli.png
  6. 36 0
      utils/tool.js

+ 24 - 7
my/vipActivation/index.vue

@@ -5,7 +5,7 @@
 			<view class="vipInfo">
 				<view class="left">
 					<view class="ownVip">当前会员:<text>{{setMealName||'普通用户'}}</text></view>
-					<view class="endTime">会员到期时间: 2023-10-19 22:25:10</view>
+					<view class="endTime">会员到期时间: {{expireTime||'--'}}</view>
 				</view>
 				<view class="right">
 					<image slot="icon" src="../../static/vipTypology-icon.png" mode="widthFix"></image>
@@ -20,14 +20,14 @@
 		<view class="listCard">
 			<view class="listTitle">激活记录</view>
 			<view class="listBox" v-if="activationList.length>0">
-				<view class="list" v-for="item of 4">
+				<view class="list" v-for="(item,index) in activationList" :key="item.id">
 					<view class="vipTitle">
-						<view class="">尊享会员</view>
+						<view class="">{{item.planningName}}</view>
 						<view class="">已激活</view>
 					</view>
 					<view class="listInfo">
-						<view class="">激活码:<text>JTsjTIENS03J35ID</text></view>
-						<view class="">激活时间: 2023-10-19 22:25:10</view>
+						<view class="">激活码:<text>{{item.serialNumber}}</text></view>
+						<view class="">激活时间: {{item.useTime}}</view>
 					</view>
 				</view>
 			</view>
@@ -40,11 +40,14 @@
 
 <script>
 	import {mealList} from '@/api/combo.js'
+	import {refreshVip} from '@/api/common.js'
 	import { selectActivationCode,getActivationList } from '@/api/vipActivation.js'
 	import { levelImgName } from '@/utils/config.js'
+	import{parseDate} from '@/utils/tool.js'
 	export default {
 		data() {
 			return {
+				expireTime:'',
 				redeemload: false,
 				activationList: [],
 				list:[],
@@ -63,14 +66,27 @@
 			this.vipQuery.phoneNum=this.userInfo.phoneNum
 			this.mealList()
 			this.get_activationList()
+			this.get_userinfo()
 		},
 
 		methods: {
+			// 用户信息
+			get_userinfo(){
+				refreshVip().then(res=>{
+					res.content.map((item)=>{
+						this.expireTime=parseDate(item.expirationTime, '{y}-{m}-{d} {h}:{m}:{s}' )
+					})
+				})
+			},
+			
 			// 激活列表
 			get_activationList(){
 				getActivationList().then(res=>{
 					if(res.state=='Success'){
-						this.activationList=res.content
+						res.content.content.map((item)=>{
+							item.useTime= parseDate(item.useTime,'{y}-{m}-{d} {h}:{m}:{s}')
+						})
+						this.activationList=res.content.content
 					}
 				})
 			},
@@ -98,6 +114,7 @@
 						uni.showToast({
 							title: '激活成功',
 						});
+						this.vipQuery.activationCode=''
 						this.get_activationList()
 					}else{
 						uni.showToast({
@@ -107,7 +124,7 @@
 				})
 			},
 
-			// 获取套餐列表
+			// 获取套餐类型
 			mealList(){
 				mealList({currentPage:1,pageSize:99,status:1}).then(res=>{
 					if (res.state == 'Success') {

+ 6 - 0
pages.json

@@ -649,6 +649,12 @@
 					"style": {
 						"navigationBarTitleText": "领券"
 					}
+				},
+				{
+					"path": "kaihui",
+					"style": {
+						"navigationBarTitleText": "凯辉便利"
+					}
 				}
 				
 			]

+ 129 - 0
special/kaihui.vue

@@ -0,0 +1,129 @@
+<template>
+	<view class="kaihuiLink">
+		<view class="imgBox">
+			<image src="../static/kaihui.png" mode="widthFix"></image>
+		</view>
+		<view class="btn">
+			<view class="kaihuiBtn" @click="handleBtn">立即下单</view>
+		</view>
+		<view class="kaihuiRule">
+			<view class="title">
+				<image src="../static/kaihuifuli.png" mode="widthFix"></image>
+			</view>
+			<view class="text">*仅限本平台会员中国移动用户专享</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	import {
+		qrcode
+	} from '@/api/common.js';
+	export default {
+		data() {
+			return {
+				showWeb: false,
+				src: '',
+				test: ''
+			}
+		},
+		methods: {
+			handleBtn() {
+				if(uni.getStorageSync('token')){
+					if(JSON.parse(uni.getStorageSync('userInfo')).setMealCode != 0&&JSON.parse(uni.getStorageSync('userInfo')).setMealCode){
+						uni.navigateToMiniProgram({
+							appId:'wx57a08b407511613d',
+							path:'//凯辉/首页/YWUe2IrfXEryMkw'
+						})
+					}else{
+						uni.showModal({
+							title:'此权益需要开通会员才可使用',
+							cancelText:'下次再说',
+							confirmText:'立即开通',
+							success(res) {
+								if(res.confirm){
+									uni.navigateTo({
+										url:'/my/memberCenter/index'
+									})
+								}
+							}
+						})
+					}
+					
+				}else{
+					return uni.showModal({
+						title:'请登录',
+						confirmText:'去登录',
+						success(res){
+							if(res.confirm){
+								uni.navigateTo({
+									url:'/login/login/login?redirect=/special/water'
+								})
+							}
+						}
+					})
+				}
+				
+			},
+			loadedPage(){
+				uni.hideLoading()
+			},
+			onmessage(val){
+				console.log(val);
+			}
+		},
+		 created() {},
+	}
+</script>
+
+<style lang="scss" scoped>
+	.kaihuiLink {
+		.imgBox {
+			&>image {
+				width: 100%;
+			}
+		}
+
+		.btn {
+			width: 100%;
+			display: flex;
+			align-items: center;
+			justify-content: center;
+			position: relative;
+
+			.kaihuiBtn {
+				position: absolute;
+				width: 360rpx;
+				height: 80rpx;
+				border-radius: 40rpx;
+				background-color: #EE4320;
+				color: white;
+				display: flex;
+				align-items: center;
+				justify-content: center;
+				font-size: 32rpx;
+				font-weight: bold;
+			}
+		}
+
+		.kaihuiRule {
+			margin-top: 60rpx;
+			width: 100%;
+			position: relative;
+			.title{
+				position: absolute;
+				left:200rpx;
+				&>image{
+					width: 350rpx;
+				}
+			}
+			.text{
+				position: absolute;
+				top: 40rpx;
+				font-size: 24rpx;
+				margin-top: 20rpx;
+				margin-left: 20rpx;
+			}
+		}
+	}
+</style>

BIN
static/kaihui.png


BIN
static/kaihuifuli.png


+ 36 - 0
utils/tool.js

@@ -11,6 +11,42 @@ export function debounce(fn,delay=500) {
   };
 }
 
+// 时间戳转换
+export function parseDate(time, cFormat) {
+  if (arguments.length === 0) {
+    return null
+  }
+  const format = cFormat || '{y}-{m}-{d}'
+  let date
+  if (typeof time === 'object') {
+    date = time
+  } else {
+    if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
+      time = parseInt(time)
+    }
+    if ((typeof time === 'number') && (time.toString().length === 10)) {
+      time = time * 1000
+    }
+    date = new Date(time)
+  }
+  const formatObj = {
+    y: date.getFullYear(),
+    m: date.getMonth() + 1,
+    d: date.getDate(),
+    h: date.getHours(),
+    i: date.getMinutes(),
+    s: date.getSeconds(),
+    a: date.getDay()
+  }
+  const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
+    const value = formatObj[key]
+    if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value ] }
+    return value.toString().padStart(2, '0')
+  })
+  return time_str
+}
+
+
 // 返回两个经纬度之间的距离 单位米
 const earthDistance = function (location1, location2) {
 	    const lat1 = parseFloat(location1.lat);