vip功能

This commit is contained in:
liuyuan
2025-02-19 12:01:58 +08:00
563 changed files with 228600 additions and 2650 deletions

View File

@@ -69,7 +69,7 @@ export default {
},
{
title: "客服邮箱",
content: "appyilujiankang@sina.com",
content: "fengzidushu@163.com",
type: "email",
},
{

View File

@@ -1,7 +1,4 @@
<template><page-meta
:page-font-size="$baseFontSize() + 'px'"
:root-font-size="$baseFontSize() + 'px'"
></page-meta>
<template><page-meta :page-font-size="$baseFontSize() + 'px'" :root-font-size="$baseFontSize() + 'px'"></page-meta>
<view style="
height: 100vh;
padding: 0 0;
@@ -118,7 +115,25 @@
<view class="text" style="line-height: 40rpx">{{
userMes.jf ? userMes.jf : 0
}}</view>
</view>
<view
class="chong_list_item"
style="
display: flex;
align-items: center;
flex-direction: column;
justify-content: space-between;
"
@click="onPageJump('/pages/mine/wallet/couponList')"
>
<view class="pay_item_img"> 优惠券 </view>
<view class="text" style="line-height: 40rpx">{{
userCouponNum
}}</view>
</view>
</view>
<view class="chong_list_item" style="
display: flex;
@@ -126,7 +141,7 @@
margin-right: 0;
justify-content: center;
">
<view class="chong_btn" v-if="iosHide"
<view class="chong_btn"
@click="onPageJump('/pages/mine/wallet/recharge/index')"> </view>
</view>
</view>
@@ -194,6 +209,7 @@
export default {
data() {
return {
userCouponNum: 0,
come: "1",
orderList: [{
title: "全部",
@@ -254,12 +270,11 @@
isAndorid: true,
platform: null, // 设备系统
pageList: [
{
name: "我的订单",
url: "/pages/bookShop/orderList?type=mine",
pageList: [{
name: "我的订单",
url: "/pages/bookShop/orderList?type=mine",
type: "switchTab",
type: "switchTab",
},
{
name: "个人资料",
@@ -323,6 +338,33 @@
//方法
methods: {
...mapMutations(["setUserInfo"]),
async getUserCouponList() {
await this.$http
.request({
url: "common/coupon/getCouponHistoryList",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
page: 1,
limit: 10,
getType: "", //获取类型 0 后台赠送 1 主动获取
status: "0", //使用状态 0 未使用 1 已使用 2 已过期
userInfo: "", //用户信息
userId: this.userInfo.id,
},
header: {
//默认 无 说明:请求头
"Content-Type": "application/json",
},
})
.then(async (res) => {
if (res.code != 0) return this.$commonJS.showToast(res.errMsg);
this.userCouponNum = res.couponList.total;
})
.catch((e) => {
console.log(e);
this.$commonJS.showToast(e.errMsg);
});
},
getBookList(flag, refreshflag) {
this.isLoadingHide = false;
var that = this;

View File

@@ -31,7 +31,7 @@
activeColor="cadetblue"
style="float: left;"
v-model="fontSizeBlod"
size="14"
size="16"
@change="asyncChange"
></u-switch>
<text style="margin-left: 5px;font-size: 14px !important;float: left;color: cadetblue;font-weight: bold;">最大</text>
@@ -40,7 +40,8 @@
</template>
</list>
</view>
<view class="button_box">
<!-- v-if="iosHide" -->
<view class="button_box" >
<u-button
shape="square"
type=""
@@ -143,7 +144,7 @@ export default {
},
{
title: "客服邮箱",
content: "appyilujiankang@sina.com",
content: "fengzidushu@163.com",
type: "email",
},
{
@@ -185,7 +186,7 @@ export default {
onShow() {
//改变字体大小
var status = this.$baseFontSize();
if (status == 5) {
if (status == 4) {
this.fontSizeBlod = true;
} else {
this.fontSizeBlod = false;
@@ -205,7 +206,7 @@ export default {
//改变字体大小
console.log("this.fontSizeBlod at line 196:", this.fontSizeBlod);
if (this.fontSizeBlod) {
uni.setStorageSync("fontSize", 5);
uni.setStorageSync("fontSize", 4);
} else {
uni.setStorageSync("fontSize", 3.5);
}

View File

@@ -1,8 +1,4 @@
<template>
<page-meta
:page-font-size="$baseFontSize() + 'px'"
:root-font-size="$baseFontSize() + 'px'"
></page-meta>
<view class="commonPageBox">
<z-nav-bar title="VIP"></z-nav-bar>
<view class="vip_block">

View File

@@ -0,0 +1,290 @@
<template>
<view>
<public-module></public-module>
<z-nav-bar title="我的优惠券"></z-nav-bar>
<view class="">
<view class="">
<u-tabs
v-if="tabList.length > 0"
:class="['tabList']"
@click="tabClick"
:current="curTagIndex"
:activeStyle="activeStyle"
:scrollable="false"
:list="tabList"
itemStyle="padding-left:10rpx; background-color:#fff; padding-right: 10rpx; height: 50px; font-size:26rpx"
></u-tabs>
</view>
<!-- -->
<view class="tanchu" style="position: relative">
<view
v-if="status!=0"
style="
min-height: 80vh;
z-index: 100;
background-color: #f0f0f0;
opacity: 0.55;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
"
></view>
<view class="listBox" v-if="list.length > 0">
<view style="min-height: 40vh; overflow-y: scroll">
<common-coupon :List="list" :source="'mine'"> </common-coupon>
</view>
<!-- <view style="font-size: 20rpx;color: #aaa;margin-top: 30rpx;">* 每笔订单只能使用一张优惠价</view> -->
</view>
<view class="" v-else>
<u-divider v-show="listStatus == 2" text="已加载全部"></u-divider>
<u-divider v-show="listStatus == 3" text="暂无数据"></u-divider>
<u-divider v-show="listStatus == 1" text="加载中..."></u-divider>
</view>
</view>
</view>
<z-navigation></z-navigation>
</view>
</template>
<script>
import $http from "@/config/requestConfig.js";
import { mapState } from "vuex";
export default {
data() {
return {
list: [], // 优惠券列表
listStatus: 88,
curTagIndex: 0, // 当前索引
tabList: [
{
name: "未使用",
id: "0",
},
{
name: "已使用",
id: "1",
},
{
name: "已过期",
id: "2",
},
],
activeStyle: {
background: "#fff",
color: "#666",
padding: "10rpx",
borderRadius: "10rpx",
},
page: 0,
limit: 15,
status: 0,
flag: false, // 请求标记
};
},
onLoad() {
this.page = 1;
this.getUserCouponList();
},
async onReachBottom() {
console.log("触底", this.listStatus, this.flag);
if (this.listStatus != 1 && this.listStatus != 2) {
if (!this.flag) {
this.page++;
await this.getUserCouponList();
}
}
},
filters: {
couponType(type) {
// 0无限制 1课程卷 2课程品类卷
var str = "";
switch (type) {
case 0:
str = "全场通用";
break;
case 1:
str = "指定课程可用";
break;
case 2:
str = "指定课程品类可用";
break;
}
return str;
},
},
computed: {
...mapState(["userInfo"]),
},
methods: {
async tabClick(e) {
console.log("e", e);
this.status = e.id;
// this.curTagIndex = e.index
this.page = 0;
this.page += 1;
this.list = [];
await this.getUserCouponList();
},
async getUserCouponList() {
console.log("进入函数了妈");
this.listStatus = 1;
this.flag = true;
uni.showLoading({
title: "加载中",
});
console.log(
{
page: this.page,
limit: this.limit,
getType: "", //获取类型 0 后台赠送 1 主动获取
status: this.status, //使用状态 0 未使用 1 已使用 2 已过期
userInfo: "", //用户信息
userId: this.userInfo.id,
},
111111111111111111111111111
);
await this.$http
.request({
url: "common/coupon/getCouponHistoryList",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
page: this.page,
limit: this.limit,
getType: "", //获取类型 0 后台赠送 1 主动获取
status: this.status, //使用状态 0 未使用 1 已使用 2 已过期
userInfo: "", //用户信息
userId: this.userInfo.id,
},
header: {
//默认 无 说明:请求头
"Content-Type": "application/json",
},
})
.then(async (res) => {
console.log(res, "1111111111111");
uni.hideLoading();
if (res.code != 0) return this.$commonJS.showToast(res.errMsg);
if (res.couponList.records.length > 0) {
this.list = this.list.concat(res.couponList.records);
if (res.couponList.pages > this.page) {
this.listStatus = 0;
} else {
this.listStatus = 2;
}
} else {
this.listStatus = 3; // 暂无数据
}
this.flag = false;
})
.catch((e) => {
uni.hideLoading();
console.log(e);
this.flag = false;
this.listStatus = 3;
console.log(e, "数据报错");
this.$commonJS.showToast(e.errMsg);
});
},
},
};
</script>
<style lang="scss" scoped>
.btnBox {
margin-top: 20rpx;
}
.tanchu {
padding: 0 30rpx 40rpx 30rpx;
position: relative;
// max-height: 60vh;
// overflow-y: scroll;
.dp_title {
font-size: 32rpx;
margin-bottom: 50rpx;
color: #555;
text-align: center;
font-weight: bold;
}
.dp_add {
position: absolute;
top: 40rpx;
right: 30rpx;
font-size: 22rpx;
background-color: #fd6004;
color: #fff;
border-radius: 10rpx;
padding: 5rpx 10rpx;
.u-icon {
display: inline-block;
margin-right: 5rpx;
}
}
.addressItem {
border: 2px dashed #d9d9d9;
border-radius: 10rpx;
width: 100%;
display: flex;
padding: 20rpx 10rpx;
margin: 25rpx 0 0 0;
align-items: center;
background-color: #fff;
.addrContent {
margin-left: 40rpx;
flex: 1;
.addrContentTop {
display: flex;
align-items: flex-end;
margin: 0 0 15rpx 0;
position: relative;
.userName {
font-size: 35rpx;
font-weight: bold;
margin-right: 30rpx;
}
.userTel {
font-size: 25rpx;
color: #888;
}
.userMoren {
border: 1px solid #fd6004;
color: #fd6004;
padding: 3rpx 10rpx;
font-size: 22rpx;
border-radius: 10rpx;
margin: 0 0 0 20rpx;
}
.chooseCheck {
position: absolute;
top: 3rpx;
right: 6rpx;
}
}
.addrContentBottom {
font-size: 32rpx;
}
}
}
.addressItem.addItem_style {
border-color: #fd6004;
}
}
</style>

View File

@@ -3,6 +3,7 @@
:root-font-size="$baseFontSize() + 'px'"
></page-meta>
<view>
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<z-nav-bar

View File

@@ -1,7 +1,4 @@
<template><page-meta
:page-font-size="$baseFontSize() + 'px'"
:root-font-size="$baseFontSize() + 'px'"
></page-meta>
<template><page-meta :page-font-size="$baseFontSize() + 'px'" :root-font-size="$baseFontSize() + 'px'"></page-meta>
<view class="container commonPageBox">
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
@@ -170,6 +167,7 @@
},
//页面显示
onShow() {
// 隐藏原生的tabbar
// this.iphonepay()
// setTimeout(()=>{
@@ -253,10 +251,12 @@
provider: 'appleiap',
orderInfo: orderInfo,
success: (res) => {
console.log('uni.requestPayment成功提示', res)
that.iapCheck(res);
resolve(res);
},
fail: (err) => {
console.log('uni.requestPayment失败提示', err)
uni.hideLoading()
// console.log('其他支付错误', err);
that.restoreComplateRequest()
@@ -281,28 +281,28 @@
async restoreComplateRequest() {
let that = this
console.log('检测未完成订单')
// if (!that.checking) {
// that.checking = true
// console.log(this.iapChannel, 'this.iapChannel1')
await this.iapChannel.restoreCompletedTransactions({
manualFinishTransaction: true
}, function(results) {
// console.log(that.checking)
// results 格式为数组存放恢复的IAP商品交易信息对象 IAPTransaction通用需将返回的支付凭证传给后端进行二次认证
that.ComplateRequestArr = results
console.log('未完成订单数组共有:=》', that.ComplateRequestArr.length)
if (results && results.length > 0) {
console.log('未完成订单数组共有resultsresultsresults=》', results)
results.map((item, index) => {
// "0"为正在支付;"1"为支付成功;"2"为支付失败;"3"为支付已恢复。
if (item.transactionState == '1') {
// 已经支付,但是没有走逻辑的内购订单 就发给后台做验证
that.iapCheck('未完成订单的验证', item, index)
// that.finishTransaction(item)
} else if (item.transactionState != '1' || item.transactionState != '0') {
// 不是正在支付订单,也不是已经支付订单就关闭掉
// 其他状态的内购订单
that.finishTransaction(item)
}
// if (item.transactionState == '1') {
// // 已经支付,但是没有走逻辑的内购订单 就发给后台做验证
// that.iapCheck('未完成订单的验证', item, index)
// // that.finishTransaction(item)
// } else if (item.transactionState != '1' || item.transactionState != '0') {
// // 不是正在支付订单,也不是已经支付订单就关闭掉
// // 其他状态的内购订单
console.log('未完成订单数组共有resultsresultsresults15=》', results)
that.finishTransaction(item)
// }
})
}
@@ -311,40 +311,34 @@
},
async iphonepay() {
//获取iap通道是判断当前设备是否支持苹果内购支付的必要条件
const that = this;
uni.showLoading({
title: "检测支付环境"
title: "购买中"
})
console.log("检测支付环境...");
this.iapChannel = await this.getProvider()
console.log('that.iapChannel', this.iapChannel);
if (this.iapChannel) {
this.requestOrder();
await this.restoreComplateRequest()
await this.requestOrder();
} else {
uni.hideLoading()
uni.showToast({
title: '不支持内购支付',
icon: 'none'
})
console.log("获取iap支付通道失败" + e.message, that.iapChannel);
}
},
requestOrder() {
uni.showLoading({
title: "获取商品信息",
mask: true,
});
const that = this;
console.log(that.stepsCj.priceTypeId, 88888888);
// ['xxxxx'] 是平台申请拿到的内购商品的id
let IAPOrders = [];
IAPOrders.push('Z' + that.stepsCj.priceTypeId);
// console.log(IAPOrders, "IAPOrders");
console.log(IAPOrders, "IAPOrders");
// 新建订单
uni.showLoading({
title: "正在创建订单",
mask: true,
});
// uni.showLoading({
// title: "正在创建订单",
// mask: true,
// });
that.iapChannel.requestProduct(
IAPOrders,
function(event) {
@@ -367,16 +361,14 @@
},
async topay(id) {
const that = this;
uni.showLoading({
title: "正在支付",
mask: true,
});
let orderInfo = {
productid: id,
username: that.orderSn, // 用户标识/订单标识
quantity: 1,
manualFinishTransaction: true, // 3.5.1+ 支持,设置此参数后需要开发者主动关闭订单,参见下面的关闭订单方法 finishTransaction()
}
console.log('支付后的订单信息', orderInfo);
this.transaction = await this.requestPayment(orderInfo)
console.log('支付后的that.transaction', this.transaction);
},
@@ -389,12 +381,13 @@
productId: result.payment.productid.slice(1), // 产品id
orderId: result.payment.username, // 系统订单号
receiptData: result.transactionReceipt, // 苹果返回收据
// sandBox: true, //测试数据
// body: that.stepsCj.priceTypeId // 充值类型id
};
console.log("提交给后台的数据", data);
$http
.request({
url: "/Ipa/veri",
url: "Ipa/veri",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data,
header: {
@@ -404,22 +397,25 @@
})
.then((res) => {
// console.log('res',res);
console.log(JSON.stringify(res));
if (res.code == 0) {
this.transaction = null
uni.hideLoading()
console.log(JSON.stringify(res), '返回信息');
uni.showToast({
title: '充值成功!',
icon: 'success'
})
console.log("充值订单已处理,请留意账户金额变动....");
uni.hideLoading()
// console.log("充值订单已处理,请留意账户金额变动....");
// 服务器验证票据有效后在客户端关闭订单 (iapChannel.finishTransaction)
that.finishTransaction(result);
// that.finishTransaction(result);
}
})
.catch((e) => {
uni.hideLoading()
console.log('后台验证失败=>', e);
this.transaction = null
uni.showModal({
title: "提示",
showCancel: false,
@@ -512,10 +508,7 @@
let that = this;
that.payType = e;
},
//ios充值
iosPay() {
this.iphonepay();
},
// 充值
goToPay() {
this.kaiChar();
@@ -562,6 +555,8 @@
})
.then((res) => {
that.orderSn = res.orderSn;
console.log(res.orderSn, 'dingdanhao111111111111')
uni.hideLoading();
if (res.code == 0) {
if (that.payType == 2) {
@@ -636,7 +631,7 @@
// })
} else if (that.payType == 3) {
console.log("苹果支付");
that.iosPay();
that.iphonepay();
}
}
});