Compare commits
2 Commits
755aff7422
...
c00cb2e135
| Author | SHA1 | Date |
|---|---|---|
|
|
c00cb2e135 | |
|
|
fb3eec2ea3 |
2
App.vue
2
App.vue
|
|
@ -6,6 +6,8 @@ export default {
|
||||||
recentNativeData: 0 // 初始化一个全局变量
|
recentNativeData: 0 // 初始化一个全局变量
|
||||||
},
|
},
|
||||||
onLaunch: function (options) {
|
onLaunch: function (options) {
|
||||||
|
|
||||||
|
console.log=()=>{}
|
||||||
// === wgt 包启动诊断日志 ===
|
// === wgt 包启动诊断日志 ===
|
||||||
console.log('=== App Launch 开始 ===')
|
console.log('=== App Launch 开始 ===')
|
||||||
console.log('启动参数:', JSON.stringify(options))
|
console.log('启动参数:', JSON.stringify(options))
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,215 @@
|
||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<view class="right-btn" @click="open">
|
||||||
|
<image src="/static/image/recharge/rightBtnImg.png" mode=""></image>
|
||||||
|
</view>
|
||||||
|
<view class="maskExchange" v-if="isMaskExchange">
|
||||||
|
<view class="box">
|
||||||
|
<view class="info" v-if="!isExchange">
|
||||||
|
<view :style="styles">
|
||||||
|
<uni-easyinput :styles="styles" v-model="code" placeholder="请输入兑换码" :inputBorder="false" placeholderStyle="text-align: center;"></uni-easyinput>
|
||||||
|
</view>
|
||||||
|
<view class="btn" :class="{'noValue':code==''}" @click="getExchange">
|
||||||
|
兑换
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="info" v-else>
|
||||||
|
<view class="title">
|
||||||
|
{{couponVip.exchange_name}}
|
||||||
|
</view>
|
||||||
|
<view class="title">
|
||||||
|
{{couponVip.exchange_value}}
|
||||||
|
</view>
|
||||||
|
<view class="time">
|
||||||
|
截至日期:{{couponVip.expire_time}}
|
||||||
|
</view>
|
||||||
|
<view class="btn btn2" @click="submit">
|
||||||
|
兑换
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="close" @click="close">
|
||||||
|
<image src="/static/image/recharge/closeE.png" mode=""></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { postJson } from "@/utils/requests.js"
|
||||||
|
export default {
|
||||||
|
name: "exchange",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
code:"",
|
||||||
|
isMaskExchange:false,
|
||||||
|
isExchange:false,
|
||||||
|
couponVip:{
|
||||||
|
|
||||||
|
},
|
||||||
|
styles:{
|
||||||
|
backgroundColor: '#FFFCEC',
|
||||||
|
padding:'10px ',
|
||||||
|
'border-radius':'10px'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods:{
|
||||||
|
open(){
|
||||||
|
this.isMaskExchange=true
|
||||||
|
this.isExchange=false
|
||||||
|
this.code=''
|
||||||
|
},
|
||||||
|
close(){
|
||||||
|
this.isMaskExchange=false
|
||||||
|
this.code=''
|
||||||
|
},
|
||||||
|
async getExchange(){
|
||||||
|
if(this.code==''){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let couponVip = await this.$requestPromise({
|
||||||
|
url: 'api/activity/exchange',
|
||||||
|
method: "GET",
|
||||||
|
data: {
|
||||||
|
code: this.code
|
||||||
|
}
|
||||||
|
})
|
||||||
|
console.log(couponVip)
|
||||||
|
if(couponVip.code!=0){
|
||||||
|
uni.showToast({
|
||||||
|
icon:"none",
|
||||||
|
title:"兑换码有误"
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.isExchange=true
|
||||||
|
this.couponVip=couponVip.data
|
||||||
|
},
|
||||||
|
async submit(){
|
||||||
|
let exchangeRes = await postJson('q', 'api/activity/exchange', {
|
||||||
|
code: this.code
|
||||||
|
})
|
||||||
|
if(exchangeRes.code!=0){
|
||||||
|
// uni.showToast({
|
||||||
|
// icon:"none",
|
||||||
|
// title:exchangeRes.message
|
||||||
|
// })
|
||||||
|
return
|
||||||
|
}else{
|
||||||
|
uni.showToast({
|
||||||
|
icon:"none",
|
||||||
|
title:"兑换成功"
|
||||||
|
})
|
||||||
|
//获取app用户信息
|
||||||
|
let user = await proxy.$requestPromise({
|
||||||
|
url: 'api/user',
|
||||||
|
method: "GET",
|
||||||
|
data: {}
|
||||||
|
})
|
||||||
|
if (user.code == 0) {
|
||||||
|
data.appUser = user.data
|
||||||
|
console.log("app用户信息", data.appUser);
|
||||||
|
}
|
||||||
|
this.isMaskExchange=false
|
||||||
|
this.isExchange=false
|
||||||
|
uni.navigateBack({
|
||||||
|
delta: 1
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.maskExchange {
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
z-index: 999;
|
||||||
|
background-color: rgba(0, 0, 0, .5);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
.box {
|
||||||
|
background-image: url('/static/image/recharge/exchange.png');
|
||||||
|
background-size: 307px 120px;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
width: 307px;
|
||||||
|
padding: 120px 0 20px 0;
|
||||||
|
|
||||||
|
.info {
|
||||||
|
padding: 16px;
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 0 0 26px 26px;
|
||||||
|
|
||||||
|
input {
|
||||||
|
background: #FFFCEC;
|
||||||
|
border-radius: 11px 11px 11px 11px;
|
||||||
|
padding: 18px 0;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.title{
|
||||||
|
font-size: 20px;
|
||||||
|
color: #1a1a1a;
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
.time{
|
||||||
|
font-size: 16px;
|
||||||
|
color: #AAAAAA;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
color: #fff;
|
||||||
|
margin-top: 32px;
|
||||||
|
font-size: 18px;
|
||||||
|
padding: 16px 0;
|
||||||
|
color: #FFFFFF;
|
||||||
|
background: linear-gradient(360deg, #4B3F30 0%, #181713 56.43%, #504834 100%), #D8D8D8;
|
||||||
|
border-radius: 60px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.btn2{
|
||||||
|
margin-top: 12px;
|
||||||
|
}
|
||||||
|
.noValue{
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.close {
|
||||||
|
margin-top: 16px;
|
||||||
|
width: 34px;
|
||||||
|
height: 34px;
|
||||||
|
|
||||||
|
image {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.right-btn {
|
||||||
|
position: fixed;
|
||||||
|
top: 100rpx;
|
||||||
|
right: 36rpx;
|
||||||
|
z-index: 1;
|
||||||
|
width: 54px;
|
||||||
|
height: 26px;
|
||||||
|
image {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -4,10 +4,11 @@
|
||||||
<view>
|
<view>
|
||||||
<image :src="data.banner" style="width: 100%;height: 244px;"></image>
|
<image :src="data.banner" style="width: 100%;height: 244px;"></image>
|
||||||
</view>
|
</view>
|
||||||
|
<exchange/>
|
||||||
<!-- <view style="margin-top:-90px;position: relative;">
|
<!-- <view style="margin-top:-90px;position: relative;">
|
||||||
<customTab :isHuise="shouldBeTrue(data.goods)" />
|
<customTab :isHuise="shouldBeTrue(data.goods)" />
|
||||||
</view> -->
|
</view> -->
|
||||||
<scroll-view class="package-items-box" scroll-x="true" v-if="data.goodsList.length">
|
<scroll-view class="package-items-box" scroll-x="true" v-if="data.goodsList.length" :show-scrollbar="false">
|
||||||
<view class="package-items-container">
|
<view class="package-items-container">
|
||||||
<view class="package-item" :class="{ 'active-package-item': selected == (index + 1) }"
|
<view class="package-item" :class="{ 'active-package-item': selected == (index + 1) }"
|
||||||
v-for="(item, index) in data.goodsList" @click="onSelect(item, index)" :key="index">
|
v-for="(item, index) in data.goodsList" @click="onSelect(item, index)" :key="index">
|
||||||
|
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 98 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 210 KiB After Width: | Height: | Size: 206 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.7 KiB |
|
|
@ -27,7 +27,7 @@ function encodeParam(data) {
|
||||||
let keys = Object.keys(params);
|
let keys = Object.keys(params);
|
||||||
keys.forEach(res => {
|
keys.forEach(res => {
|
||||||
if ((params[res] && params[res] != "") || params[res] === 0) {
|
if ((params[res] && params[res] != "") || params[res] === 0) {
|
||||||
if (typeof (params[res]) != 'string' && typeof (params[res]) != 'number') {
|
if (typeof(params[res]) != 'string' && typeof(params[res]) != 'number') {
|
||||||
params[res] = 'Object';
|
params[res] = 'Object';
|
||||||
}
|
}
|
||||||
url += "&";
|
url += "&";
|
||||||
|
|
@ -107,7 +107,7 @@ function generateUUID() {
|
||||||
var d = new Date().getTime();
|
var d = new Date().getTime();
|
||||||
var uuid = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(
|
var uuid = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(
|
||||||
/[xy]/g,
|
/[xy]/g,
|
||||||
function (c) {
|
function(c) {
|
||||||
var r = (d + Math.random() * 16) % 16 | 0;
|
var r = (d + Math.random() * 16) % 16 | 0;
|
||||||
d = Math.floor(d / 16);
|
d = Math.floor(d / 16);
|
||||||
return (c === "x" ? r : (r & 0x3) | 0x8).toString(16);
|
return (c === "x" ? r : (r & 0x3) | 0x8).toString(16);
|
||||||
|
|
@ -185,7 +185,7 @@ const request = (method = 'GET', serverUrl, domainUrl, params, dataType = "json"
|
||||||
console.log("传参详情", data)
|
console.log("传参详情", data)
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
uni.request(data).then(res => {
|
uni.request(data).then(res => {
|
||||||
console.log(deCode(res.data.data))
|
console.log(deCode(res.data.data))
|
||||||
if (res.statusCode == 200) {
|
if (res.statusCode == 200) {
|
||||||
if (res.data.encrypt) {
|
if (res.data.encrypt) {
|
||||||
if (q != 'test') {
|
if (q != 'test') {
|
||||||
|
|
@ -195,6 +195,7 @@ const request = (method = 'GET', serverUrl, domainUrl, params, dataType = "json"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
console.log(res.data)
|
||||||
if (res.data.code == 1001003 || res.data.code == 1001004 || res.data.code == 1001005) {
|
if (res.data.code == 1001003 || res.data.code == 1001004 || res.data.code == 1001005) {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
|
@ -248,7 +249,7 @@ const request = (method = 'GET', serverUrl, domainUrl, params, dataType = "json"
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
console.log(123)
|
||||||
resolve(res.data);
|
resolve(res.data);
|
||||||
} else {
|
} else {
|
||||||
// InnerApp.addRequestLog(url, data, res)
|
// InnerApp.addRequestLog(url, data, res)
|
||||||
|
|
@ -271,20 +272,7 @@ const request = (method = 'GET', serverUrl, domainUrl, params, dataType = "json"
|
||||||
err: JSON.stringify(err)
|
err: JSON.stringify(err)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// uni.showModal({
|
|
||||||
// title: '提示',
|
|
||||||
// content: JSON.stringify(err),
|
|
||||||
// success: function (res) {
|
|
||||||
// if (res.confirm) {
|
|
||||||
// console.log('用户点击确定');
|
|
||||||
// } else if (res.cancel) {
|
|
||||||
// console.log('用户点击取消');
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// uniToast('服务器繁忙');
|
|
||||||
}
|
}
|
||||||
// InnerApp.addRequestLog(url, data, err)
|
|
||||||
reject(err);
|
reject(err);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue