首页+我的

This commit is contained in:
2024-04-19 10:35:20 +08:00
parent 1bcb13ce7a
commit 8407d51fb6
538 changed files with 934456 additions and 1635 deletions

View File

@@ -0,0 +1,88 @@
<template>
<view>
<public-module></public-module>
<z-nav-bar title="关于我们" bgColor="#3AB3AE" fontColor="#fff"></z-nav-bar>
<view class="APPinfo">
<image src="@/static/icon/fengziIcon.png" mode="" style="height: 150rpx; width: 150rpx; margin: 0 auto;"></image><br/>
<p>版本信息{{versionName}},{{versionCode}}</p>
</view>
<view class="telInfo">
<view class="nav_list flexbox">
<text>客服热线</text>
<view class="view1">
<text>022-24142321</text>
<image @click="makeTel" src="@/static/icon/tel.png" mode="" style="height: 46rpx; width: 46rpx; margin-bottom: -10rpx; display: inline-block; "></image>
</view>
</view>
</view>
<view class="prof">众妙之门是一款融儒文为一体的国学学习平台提高认知提升修养而乐在其中</view>
<view class="" style="text-align: center;">
<!-- https://main.nuttyreading.com/privacy.html -->
<!-- <text @click="seeDetail('')" style="color: #007aff; font-size: 26rpx;">隐私政策</text> -->
<uni-link href="https://main.nuttyreading.com/privacy.html" text="隐私政策"></uni-link>
<!-- <uni-link href="https://uniapp.dcloud.io/" text="https://uniapp.dcloud.io/"></uni-link> -->
</view>
<music-play :playData="playData"></music-play>
</view>
</template>
<script>
import musicPlay from '@/components/music.vue'
export default {
data() {
return {
playData:{},
versionCode:null,
versionName:null
}
},
onLoad() {
this.getAppInfo()
},
components:{
musicPlay
},
methods: {
// 获取版本信息
getAppInfo(){
let that = this
plus.runtime.getProperty(plus.runtime.appid, function(inf) {
that.versionCode = inf.version
that.versionName = inf.name
// console.log(that.versionCode,555)
});
},
makeTel(){
uni.showModal({
title: '提示',
content: '微信号yilujiankangkefu',
// success: function (res) {
// if (res.confirm) {
// uni.makePhoneCall({
// phoneNumber: '022-24142321' //仅为示例
// });
// } else if (res.cancel) {
// }
// }
})
}
}
}
</script>
<style scoped lang="less">
.prof{padding: 20rpx; color: #666; font-size: 24rpx; line-height: 40rpx; text-indent: 2em;}
.telInfo{background-color:#fff;
.nav_list{padding: 30upx 0 30upx 20upx; border-top: 1px solid #e5e5e5; border-top: 1px solid #e5e5e5; justify-content: space-between; color: #666;
.view1{width:300rpx;}
}
}
.APPinfo{background-color:#fff; padding: 40rpx 0; margin-top: 20rpx; text-align: center;
p{font-size: 28rpx;}
}
.flexbox{display: flex; justify-content: center;}
</style>

646
pages/mine/mine/index.vue Normal file
View File

@@ -0,0 +1,646 @@
<template>
<view
style="padding: 0 0; font-size: 28rpx; "
class="commonPage commonPageBox"
>
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<view class="bg_top">
<u-icon
@click="goSetting"
class="setIcon"
labelColor="#fff"
labelPos="bottom"
label="设置"
name="setting"
:style="`top:${(10 + statusBarHeight) * 2}rpx`"
color="#fff"
size="28"
></u-icon>
</view>
<view class="mine_box" :style="`top:${(45 + statusBarHeight) * 2}rpx`">
<view class="per_mes" @click="goUserInfo">
<image
:src="userMes.avatar"
v-if="userMes.avatar != null"
class="per_mes_img color_shandow"
></image>
<image
src="@/static/icon/home_icon_1.png"
v-if="userMes.avatar == null"
class="per_mes_img color_shandow"
></image>
<view class="userInfoBox">
<template v-if="userMes.nickname != null">
<view class="name">昵称{{ userMes.nickname }}</view>
</template>
<template v-else>
<view class="name">未设置</view>
</template>
<template v-if="userMes.tel">
<view class="phone">手机号({{ userMes.tel }})</view>
</template>
<template v-if="userMes.email">
<view class="phone email">邮箱({{ userMes.email }})</view>
</template>
<!-- <text class="tong">累计读书5本
<span style="margin: 0 20upx;">|</span> 今日读50分钟
</text> -->
</view>
<br clear="both" />
</view>
<!-- <view class="now_vip" v-if="userMes.vip==0">
<text>
<image src="../../static/icon/mine_p.png" style="height: 44rpx;"></image>
开通会员畅享海量内容
</text>
<b class="kt_btn" @click="onPageJump('./opeVip')">开通VIP</b>
</view> -->
<!-- <view class="now_vip" v-if="userMes.vip==1">
<text>
<image src="../../static/icon/mine_v.png"></image>
尊贵的VIP会员
<font style="font-size: 14rpx;margin-left: 20rpx;">{{userMes.vipValidtime}}到期</font>
</text>
<b class="kt_btn" @click="onPageJump('./opeVip')">立即续费</b>
</view> -->
<view class="chong_zhi boxShadow box_fillet chongzhi_box" style="padding-top: 50rpx;">
<!-- <view
class="zhanghu"
@click="onPageJump('/pages/mine/wallet/index/index')"
>
我的账户
<image src="@/static/icon/icon_right.png" class="rightArrow"></image>
</view> -->
<view class="chong_list">
<!-- v-if="iosHide" -->
<view class="chong_list_item" @click="onPageJump('/pages/mine/wallet/index/index')">
<uni-icons
type="wallet-filled"
size="40"
color="#3ab3ae"
></uni-icons>
<view class="text"
>天医币&nbsp;{{
userMes.peanutCoin ? userMes.peanutCoin : ""
}}</view
>
</view>
<!-- <view v-if="iosHide" class="chong_list_item">
<b>{{ userMes.conponsCount }}</b>
优惠券
</view> -->
<!-- <b class="chong_btn" @click="onPageJump('../sdkDemo/pay')"> </b> -->
<b
class="chong_btn"
v-if="iosHide"
@click="onPageJump('/pages/mine/wallet/recharge/index')"
> </b
>
</view>
</view>
<view class="list_box">
<view class="xiugai boxShadow box_fillet">
<common-list
:dataList="pageList"
@hancleClick="handleClickTab"
label="name"
>
<template slot="rightSlot" slot-scope="slotProps">
<text class="fdButtonBox aui-text-success">{{
slotProps.row.content
}}</text>
<view> </view>
</template>
</common-list>
<!-- <view class="nav_list" @click="onPageJump('../clock/clockList')">
<text>我的打卡</text>
</view> -->
<!-- <view class="nav_list" @click="onPageJump('../listen/home')" v-if="iosHide">
<text>我的听书</text>
</view> -->
<!-- 暂时去掉 -->
<!-- <view class="nav_list" @click="onPageJump('../listen/setListen')" v-if="iosHide">
<text>听书设置</text>
</view> -->
<!-- <view class="nav_list" @click="onPageJump('../peanut/myComments')">
<text>我的评价</text>
</view> -->
<!-- 暂时去掉 -->
<!-- <view v-if="showEbook" class="nav_list" @click="onPageJump('../eBook/bookBuy')">
<text>电子书购买记录</text>
</view> -->
<!-- <view v-if="showEbook" class="nav_list" @click="onPageJump('../eBook/bookRecord')">
<text>阅读记录</text>
</view> -->
<!-- <view class="nav_list" @click="onGoing()">
<text>帮助与反馈11111</text>
</view> -->
<!-- <view class="nav_list" @click="newOnShare" v-if="isAndorid"> -->
</view>
</view>
</view>
<u-modal
:show="signShow"
:content="signContent"
:showCancelButton="true"
@cancel="signShow = false"
@confirm="signOut"
>
</u-modal>
<!-- 分享弹窗 -->
<uni-popup ref="share" type="share" safeArea backgroundColor="#fff">
<uni-popup-share @select="haveSelected"></uni-popup-share>
</uni-popup>
<music-play :playData="playData"></music-play>
<z-navigation></z-navigation>
</view>
</template>
<script>
import musicPlay from "@/components/music.vue";
import $http from "@/config/requestConfig.js";
// import appShare, { closeShare } from '@/uni_modules/zhouWei-APPshare/js_sdk/appShare';
import { mapState, mapMutations } from "vuex";
export default {
data() {
return {
showEbook: false, // 显示电子书相关
userMes: {},
signShow: false,
signContent: "是否要退出登录?",
playData: {},
isAndorid: true,
platform: null, // 设备系统
pageList: [
{
name: "我的订单",
url: "../bookShop/orderList",
type: "pageJump",
},
// {
// name: "购物车",
// url: "../peanut/shopping",
// type: "pageJump",
// },
{
name: "个人资料",
url: "/pages/mine/userInfo/persData",
type: "pageJump",
},
{
name: "地址管理",
url: "../user/address",
type: "pageJump",
},
{
name: "分享APP",
type: "share",
},
{
name: "关于我们",
url: "/pages/mine/aboutUs/index",
type: "pageJump",
},
//{ name: "设置", url: "/pages/mine/set/index", type: "pageJump" },
// { name: "退出登录", type: "quitLogin" },
// { name: "注销帐号", type: "loginOut" },
],
};
},
//第一次加载
onLoad(e) {
// 隐藏原生的tabbar
// uni.hideTabBar();
// #ifdef APP-PLUS
this.getOS();
this.platform = uni.getSystemInfoSync().platform;
// console.log('操纵系统',this.platform)
// #endif
},
computed: {
...mapState(["userInfo"]),
},
//页面显示
onShow() {
// 隐藏原生的tabbar
// uni.hideTabBar();
this.getData();
},
components: {
musicPlay,
},
//方法
methods: {
...mapMutations(["setUserInfo"]),
goSetting() {
this.onPageJump("/pages/mine/set/index");
},
goUserInfo() {
this.onPageJump("/pages/mine/userInfo/persData");
},
handleClickTab(v) {
console.log('v at line 259:', v)
switch (v.type) {
case "pageJump":
this.onPageJump(v.url);
break;
case "share":
//分享
this.newOnShare();
break;
case "quitLogin":
//退出登录
this.signShow = true;
break;
case "loginOut":
//注销账号
this.logout();
break;
}
},
// 获得操作系统
getOS() {
let oprateOs = "";
oprateOs = uni.getSystemInfoSync().platform;
// console.log(oprateOs)
if (oprateOs == "android") {
this.isAndorid = true;
} else {
this.isAndorid = false;
}
},
haveSelected(data) {
console.log(data, " 选择的是");
if (data.index == 0) {
// 分享到好友
uni.share({
provider: "weixin",
scene: "WXSceneSession",
type: 0,
href: this.$apkUrl,
title: "疯子读书",
summary: "我正在使用疯子读书提升自己,赶紧跟我一起来体验吧!",
imageUrl: "static/fengziIcon.jpg",
success: function (res) {
console.log("success:" + JSON.stringify(res));
},
fail: function (err) {
console.log("fail:" + JSON.stringify(err));
},
});
} else if (data.index == 1) {
// 分享到朋友圈
uni.share({
provider: "weixin",
scene: "WXSceneTimeline",
type: 0,
href: this.$apkUrl,
title: "疯子读书",
summary: "我正在使用疯子读书提升自己,赶紧跟我一起来体验吧!",
imageUrl: "static/fengziIcon.jpg",
success: function (res) {
console.log("success:" + JSON.stringify(res));
},
fail: function (err) {
console.log("fail:" + JSON.stringify(err));
},
});
}
},
switchTab(url) {
uni.switchTab({
url: url,
});
},
getData() {
// 获取个人信息
if (this.userInfo.id != undefined) {
this.$http.post("book/user/info/" + this.userInfo.id).then((res) => {
this.userMes = res.user;
if (this.userMes.vip == 1) {
this.userMes.vipValidtime = this.userMes.vipValidtime.substring(
0,
this.userMes.vipValidtime.indexOf(" ")
);
}
});
}
},
// 新写分享
newOnShare() {
this.$refs.share.open();
},
// 注销账户
logout() {
let that = this;
uni.showModal({
title: "提示",
content: "确定要注销当前账户吗?",
success: function (res) {
if (res.confirm) {
uni.showModal({
title: "提示",
showCancel: false,
content: `注销申请已提交成功,请联系客服进行后续操作022-24142321`,
success: function (res1) {
if (res1.confirm) {
that.signOut();
}
},
});
} else if (res.cancel) {
// 取消操作
}
},
});
},
// 跳转
onGoing() {
uni.showToast({
icon: "none",
title: "开发中,敬请期待...",
});
},
onPageJump(url) {
console.log(url, "url");
uni.navigateTo({
url: url,
});
},
// 退出登录
signOut() {
this.signShow = false;
this.setUserInfo({
token: null,
});
uni.reLaunch({
url: "/pages/user/login/login",
});
},
},
};
</script>
<style lang="scss" scoped>
@import "@/style/mixin.scss";
.per_mes {
margin: 0rpx 40rpx 60rpx 40rpx;
align-items: center;
display: flex;
align-items: center;
.per_mes_img {
width: 160rpx;
height: 160rpx;
background-color: #fff;
border-radius: 160rpx;
margin: 0 30rpx 0 0;
float: left;
}
view {
float: left;
// margin-top: 20rpx;
.name {
width: 100%;
// display: inline-block;
font-weight: bold;
font-size: 38upx;
margin-bottom: 10rpx;
color: #fff !important;
}
.phone {
font-size: 24rpx;
color: #fff;
}
.tong {
color: #999;
font-size: 25upx;
}
.per_user_img {
display: inline-block;
width: 40upx;
height: 40upx;
margin-left: 10rpx;
vertical-align: super;
}
}
}
.now_vip {
background-color: #fff;
// border-radius: 20upx;
margin: 0 0 30upx 0;
padding: 0 30upx;
height: 120upx;
background-image: linear-gradient(90deg, #feeed6 0%, #f5ce99 100%);
image {
width: 46rpx;
height: 50rpx;
display: inline-block;
vertical-align: text-bottom;
margin: 0 10rpx 0 0;
}
text {
font-size: 30upx;
line-height: 120upx;
color: #977749;
font-weight: bold;
}
.kt_btn {
font-size: 26upx;
display: block;
float: right;
border-radius: 50rpx;
color: #fffbf6;
padding: 12rpx 26rpx;
margin: 33rpx 0 0 0;
background-image: linear-gradient(90deg, #dfa964 0%, #7f5218 100%);
}
}
.commonPageBox{
background-color: #d8f8e4 !important;
}
.chong_zhi {
box-shadow: none;
border-bottom-left-radius: 0rpx !important;
border-bottom-right-radius: 0rpx !important;
background-color: #d8f8e4 ;
// margin: 0 0 30upx 0;
padding: 0 30upx;
height: auto;
.zhanghu {
width: 100%;
margin-bottom: 40rpx;
font-size: 32upx;
// line-height: 80rpx;
font-weight: bold;
display: flex;
align-items: center;
justify-content: space-between;
color: #3ab3ae;
font-weight: 700;
}
.chong_list {
.chong_list_item {
width: auto;
height: 120rpx;
margin-right: 60rpx;
text-align: center;
display: inline-block;
color: #3ab3ae;
.text {
font-size: 28rpx;
display: block;
font-weight: 700;
// margin: 0 0 10rpx 0;
color: #3ab3ae !important;
}
}
.chong_btn {
font-size: 26rpx;
display: block;
float: right;
border-radius: 50rpx;
color: #fffbf6;
padding: 10rpx 32rpx;
// margin: 20rpx 0 0 0;
background-image: linear-gradient(90deg, #3ab3ae 0%, #d5ecdd 200%)
}
}
}
.xiugai {
border-radius: 20rpx !important;
margin: 0 30rpx;
// padding:0 40rpx;
background: #edfcf7;
.nav_list {
background-color: #edfcf7;
padding: 15rpx 0 15rpx 10rpx;
display: flex;
align-items: center;
font-size: 22rpx;
position: relative;
font-weight: bold;
border-bottom: 1px solid #e5e5e5;
&:active {
background-color: #f5f5f5;
}
text {
color: #333;
margin-left: 10rpx;
}
&::after {
content: "";
position: absolute;
right: 20rpx;
top: 50%;
transform: translateY(-50%);
width: 30rpx;
height: 30rpx;
background-image: url("@/static/icon/icon_right.png");
background-position: center center;
background-repeat: no-repeat;
background-size: cover;
}
}
.nav_list:nth-last-child(1) {
border-bottom: 0;
}
}
.box_fillet {
border-radius: 40rpx;
overflow: hidden;
// background: #fff;
}
.chongzhi_box {
padding: 30rpx 50rpx 10rpx;
background-color: #d8f8e4 ;
}
/deep/.scroll-view-item:nth-child(2n-1) {
background-color: transparent !important;
}
uni-page-body {
background: #d8f8e4 !important;
}
.bg_top {
background-image: url("@/static/icon/login_bg.png");
// background-position: center center;
padding: 0 30rpx;
background-repeat: no-repeat;
background-size: 100% 100%;
height: 45vh;
position: relative;
.setIcon {
position: absolute;
right: 30rpx;
// top: 30rpx;
}
}
.mine_box {
width: 100%;
position: absolute;
// top: 90rpx;
left: 0;
padding: 0 0rpx;
}
.list_box{
background: #d8f8e4 !important;
padding: 20rpx 0;
margin-top: -10rpx;
}
</style>

812
pages/mine/set/index.vue Normal file
View File

@@ -0,0 +1,812 @@
<template>
<view class="container commonPageBox">
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<z-nav-bar title="设置" bgColor="#3AB3AE" fontColor="#fff"></z-nav-bar>
<view class="contentBox commonPageContentBox">
<view class="set_box">
<list :dataList="dataList" @hancleClick="handleClickRightContent" label="title">
<template slot="rightSlot" slot-scope="slotProps">
<text class="fdButtonBox aui-text-success">{{ slotProps.row.content }}</text>
<view>
</view>
</template>
</list>
</view>
<view class="button_box">
<u-button shape="square" type="" class="common_red_button button" size="medium" @click="handleClickButton(1)">注销账号</u-button>
<u-button shape="square" type="" class="common_grey_button button" size="medium" @click="handleClickButton(2)">退出登录</u-button>
</view>
<!-- <view class="set_box" style="margin-top:20rpx">
<list :dataList="otherList" @hancleClick="handleClickRightContent" label="title">
<template slot="rightSlot" slot-scope="slotProps">
<text class="fdButtonBox aui-text-success">{{ slotProps.row.content }}</text>
<view>
</view>
</template>
</list>
</view> -->
</view>
<z-navigation></z-navigation>
<u-modal :show="signShow" :content="signContent" :showCancelButton="true" @cancel="signShow = false"
@confirm="signOut">
</u-modal>
</view>
</template>
<script>
import list from "@/pages/component/commonComponents/list";
import $http from '@/config/requestConfig.js';
import { mapState, mapMutations } from "vuex";
export default {
components: {
list
},
data() {
return {
signShow: false,
signContent: "是否要退出登录?",
playData: {},
options: {},
searchValue: '',
twoCateList: [], // 二级分类标题
titleList: [], // 方剂标题
curOneCateIndex: 0, // 当前选中的一级分类
curTwoCateIndex: 0, // 当前选中的二级分类
searchList: [], // 搜索结果数组
showSearchList: false,
userMes: {}, // 用户信息
searchDisable: false, // 搜索不可用
limitShow: false,
limitTitle: '提示',
limitContent: '',
scrollViewHeight: 0,
dataList: [
{
"title": "客服热线",
content: '022-24142321',
type: "tel",
},
{
"title": "客服邮箱",
content: 'appyilujiankang@sina.com',
type: "email",
},
{
"title": "微信号",
content: 'yilujiankangkefu',
type: "wxNumber",
},
// {
// "title": "清楚缓存",
// content: 'yilujiankangkefu'
// },
],
otherList: [
{
"title": "关于我们",
url: '/pages/mine/aboutUs/index', type: 'pageJump'
},
// {
// "title": "清楚缓存",
// content: 'yilujiankangkefu'
// },
],
}
},
onLoad(options) {
console.log(options, '989')
this.options = options
this.getUserInfo()
// this.getCateList()
},
onHide() {
// this.showSearchList = false
// this.searchList = []
},
computed: {
...mapState(['userInfo']),
},
methods: {
...mapMutations(["setUserInfo"]),
signOut() {
this.signShow = false;
this.setUserInfo({ token: null });
uni.reLaunch({
url: "/pages/user/login/login",
});
},
// 注销账户
logout() {
let that = this;
uni.showModal({
title: "提示",
content: "确定要注销当前账户吗?",
success: function (res) {
if (res.confirm) {
uni.showModal({
title: "提示",
showCancel: false,
content: `注销申请已提交成功,请联系客服进行后续操作022-24142321`,
success: function (res1) {
if (res1.confirm) {
that.signOut();
}
},
});
} else if (res.cancel) {
// 取消操作
}
},
});
},
handleClickButton(type){
switch (type) {
case 1:
this.logout();
// this.$commonJS.logout()
break;
case 2:
this.signShow = true;
// this.$commonJS.signOut()
break;
//
}
},
handleClickRightContent(row) {
console.log('row.type at line 122:', row)
switch (row.type) {
case 'tel':
this.$commonJS.handleMakingPhoneCalls(row.content)
break;
case 'email':
this.$commonJS.handleCopy(row.content, row.title)
break;
case 'wxNumber':
this.$commonJS.handleCopy(row.content, row.title)
break;
case 'pageJump':
uni.navigateTo({
url: row.url,
});
break;
//
}
},
// 检查是有权限使用搜索功能
checkDisable() {
console.log('点击了')
},
// 显示无权限弹窗
// showNoRights() {
// let that = this
// uni.showModal({
// content: "",
// confirmText: '好的',
// showCancel: false,
// success: function(res) {
// if (res.confirm) {
// // console.log('用户点击确定');
// that.clear()
// }
// }
// })
// },
// 获取用户详情
getUserInfo() {
// 用户详情
if (this.userInfo.id != undefined) {
this.$http
.post('book/user/info/' + this.userInfo.id)
.then(res => {
this.userMes = res.user
this.getCateList()
console.log(this.userMes, '呼呼')
});
}
},
// 详情
gotoDetail(v) {
console.log(v)
uni.navigateTo({
// url: '../bookShop/commodityDetail?id=' + item.id
url: `/pages/curriculum/order/curriculum/index?navTitle=${v.title}&title=${v.title}&oid=${v.oid}`
})
},
// 获取名称
getTitles(dictType) {
console.log('dictType', dictType)
if (this.curOneCateIndex == 0) {
if (dictType == 2) {
uni.navigateTo({
url: './zhuanzhuchuban'
})
return
}
$http.request({
url: "book/generalArticle/articleByPage",
method: "POST",
data: {
// loadAnimate: 'none', // 请求加载动画
"type": dictType == 1 ? '1' : '2',
"limit": 1000,
"current": 1,
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
}).then(res => {
console.log(res, '内容获取成功')
if (res.code == 0 && res.result && res.result.records.length > 0) {
this.titleList = res.result.records
} else {
this.titleList = []
}
}).catch(e => {
this.titleList = []
console.log(e)
})
}
if (this.curOneCateIndex == 1) {
$http.request({
url: "book/medicaldes/inheritListByPage",
method: "POST",
data: {
// loadAnimate: 'none', // 请求加载动画
'dictType': dictType,
"limit": 1000,
"current": 1
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
}).then(res => {
console.log(res, '内容获取成功')
if (res.code == 0 && res.result.records.length > 0) {
this.titleList = res.result.records
for (let i = 0; i < this.titleList.length; i++) {
this.titleList[i].imageslist = [];
this.titleList[i].imageslist = this.titleList[i].img.split(";");
}
} else {
this.titleList = []
}
}).catch(e => {
this.titleList = []
console.log(e)
})
}
if (this.curOneCateIndex == 2) {
$http.request({
url: "book/medicaldes/lightListByType?type=" + dictType,
method: "POST",
data: {
// loadAnimate: 'none', // 请求加载动画
"limit": 1000,
"page": 1,
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
}).then(res => {
console.log(res, '内容获取成功')
if (res.code == 0 && res.result.length > 0) {
this.titleList = res.result
} else {
this.titleList = []
}
}).catch(e => {
this.titleList = []
console.log(e)
})
}
if (this.curOneCateIndex == 3) {
$http.request({
url: "book/medicaldes/recordByType?type=" + dictType,
method: "POST",
data: {
// loadAnimate: 'none', // 请求加载动画
"limit": 1000,
"page": 1,
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
}).then(res => {
console.log(res, '内容获取成功')
if (res.code == 0 && res.result.length > 0) {
this.titleList = res.result
} else {
this.titleList = []
}
}).catch(e => {
this.titleList = []
console.log(e)
})
}
},
setTwoCateIndex(item, index) {
let dictType = item.dictType
this.curTwoCateIndex = index
this.getTitles(dictType)
},
async setOneCateIndex(item, index) {
console.log(index, 99999)
var that = this
// if(this.userMes.tgdzPower == 0){
// let that = this
// uni.showModal({
// content: "购买 针灸六经法要上册和下册 后方可使用此功能",
// confirmText: '好的',
// showCancel: false,
// success: function(res) {
// if (res.confirm) {
// // console.log('用户点击确定');
// }
// }
// })
// return
// }
// if(item.title == "时辰取穴"){
// uni.navigateTo({
// url: "../timeAcupoint/timeAcupoint"
// })
// return
// }
let type = item.type
this.curOneCateIndex = index
this.curTwoCateIndex = 0
this.searchValue = ''
this.searchList = []
this.showSearchList = false
// if (index != 2) {
await this.getTowCateList(type)
// uni.createSelectorQuery().select('.oneCateList').boundingClientRect(function (rect) {
// var height = rect.height
// console.log('元素高度:',);
// }).exec();
// } else {
// this.getJFList(dictType)
// }
},
async getTowCateList(type) {
var that = this;
$http.request({
url: "book/medicaldes/typeList?label=" + type,
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
loadAnimate: 'none', // 请求加载动画
// 'categoryId': id
},
// header: { //默认 无 说明:请求头
// 'Content-Type': 'application/json'
// },
}).then(res => {
console.log(res, '二级分类获取成功')
if (res.code == 0 && res.result.length >= 0) {
this.twoCateList = res.result
if (this.curOneCateIndex == 0) {
this.twoCateList = [{
'dictType': "1",
"dictValue": "学术思想"
}, {
'dictType': "2",
"dictValue": "出版专著"
}, {
'dictType': "3",
"dictValue": "学术平台"
}]
}
if (this.curOneCateIndex == 2) {
this.twoCateList = [{
'dictType': "1",
"dictValue": "吴门之歌"
}, {
'dictType': "2",
"dictValue": "巴山夜语"
}, {
'dictType': "3",
"dictValue": "吴门之徽"
}]
}
if (this.curOneCateIndex == 3) {
this.twoCateList = [{
'dictType': "1",
"dictValue": "学术贡献"
}, {
'dictType': "2",
"dictValue": "抗疫纪实"
}, {
'dictType': "3",
"dictValue": "吴门公益"
}]
}
this.getTitles(this.twoCateList[0].dictType)
this.$nextTick(async () => {
// await uni.createSelectorQuery().select('.uni-tabbar').boundingClientRect(function (rect) {
// console.log(rect.height, '3333')
// // var height = 42 + rect.height + 10;
// // that.scrollViewHeight = height;
// // console.log(that.scrollViewHeight, '111111')
// // that.$forceUpdate()
// // console.log('元素高度2', height);
// }).exec();
await uni.createSelectorQuery().select('.cateList').boundingClientRect(function (rect) {
console.log(rect.height, '22222')
var height = 42 + rect.height + 20;
that.scrollViewHeight = height;
console.log(that.scrollViewHeight, '111111')
that.$forceUpdate()
console.log('元素高度2', height);
}).exec();
})
} else {
this.twoCateList = []
this.titleList = []
}
}).catch(e => {
this.twoCateList = []
this.titleList = []
console.log(e)
})
},
transformData(inputData) {
const result = {};
inputData.forEach(item => {
const {
letter
} = item;
if (!result[letter]) {
result[letter] = [];
}
result[letter].push(item);
});
// const finalResult = Object.keys(result).map(key => ({ [key]: result[key] }));
return result;
},
// getJFList(id) {
// $http.request({
// url: "book/prescript/prescriptListForJF",
// method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
// data: {
// loadAnimate: 'none', // 请求加载动画
// 'categoryId': id
// },
// header: { //默认 无 说明:请求头
// 'Content-Type': 'application/json'
// },
// }).then(res => {
// if (res.code == 0 && res.list.length > 0) {
// this.twoCateList = []
// this.titleList = this.transformData(res.list)
// console.log('JF经方', this.titleList)
// } else {
// this.twoCateList = []
// this.titleList = []
// }
// }).catch(e => {
// this.twoCateList = []
// this.titleList = []
// console.log(e)
// })
// },
getCateList(id) {
id ? '' : id = 0
this.twoCateList = []
this.curTwoCateIndex = 0
// 0为获取顶级分类其他为搜索下级分类目前的逻辑顶级是写死的所以可能只会涉及到搜索第二级
// $http.request({
// url: "book/prescript/prescriptCategoryList",
// method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
// data: {
// loadAnimate: 'none', // 请求加载动画
// 'categoryId': id
// },
// header: { //默认 无 说明:请求头
// 'Content-Type': 'application/json'
// },
// }).then(res => {
// console.log(res, '脉穴分类获取成功')
// if (res.code == 0 && res.list.length > 0) {
// this.oneCateList = res.list
this.getTowCateList(this.oneCateList[0].type)
// } else {
// this.oneCateList = []
// }
// }).catch(e => {
// this.oneCateList = []
// console.log(e)
// })
},
// 放大图片
previewImage(url) {
console.log(url)
uni.previewImage({
urls: [url],
longPressActions: {
itemList: ['很抱歉,暂不支持保存图片到本地'],
success: function (res) {
// console.log(res,'+++++')
}
}
});
},
// getSearch() {
// $http.request({
// url: "book/prescript/searchPrescript",
// method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
// data: {
// loadAnimate: 'none', // 请求加载动画
// 'keywords': this.searchValue,
// type: this.curOneCateIndex + 1
// },
// header: { //默认 无 说明:请求头
// 'Content-Type': 'application/json'
// },
// }).then(res => {
// console.log(res, '搜索结果')
// if (res.code == 0 && res.list.length >= 0) {
// this.showSearchList = true
// this.searchList = res.list
// } else {
// this.searchList = []
// }
// }).catch(e => {
// // this.titleList = []
// this.searchList = []
// console.log(e)
// })
// },
// search(res) {
// console.log(res, 'res')
// // uni.showToast({
// // title: '搜索:' + res,
// // icon: 'none'
// // })
// if (res == '') {
// this.showSearchList = false
// this.searchList = []
// } else {
// this.getSearch()
// }
// },
// input(res) {
// console.log('----input:', res)
// if (res == '') {
// this.searchList = []
// } else {
// this.getSearch()
// }
// },
// clear(res) {
// console.log('----clear:', res)
// // uni.showToast({
// // title: 'clear事件清除值为',
// // icon: 'none'
// // })
// this.searchValue = ''
// this.showSearchList = false
// },
// blur(res) {
// // console.log('----blur:', res)
// // if (res == '') {
// // this.showSearchList = false
// // this.searchList = []
// // } else {
// // this.getSearch()
// // }
// },
// focus(e) {
// console.log('----focus:')
// // uni.showToast({
// // title: 'focus事件输出值为' + e.value,
// // icon: 'none'
// // })
// // 等于1 就是有权限
// // this.showSearchList = true
// },
// cancel(res) {
// uni.showToast({
// title: '点击取消,输入值为:' + res.value,
// icon: 'none'
// })
// }
},
onBackPress() {
// #ifdef APP-PLUS
plus.key.hideSoftKeybord();
// #endif
},
}
</script>
<style lang="scss" scoped>
.u-grid-list {
// height: 40rpx;
}
.searchList {
.item {
font-size: 28rpx;
padding: 20rpx;
border-bottom: 1px solid #dadbde;
}
}
.scroll-view_H {
background-color: #fff;
white-space: nowrap;
padding: 10rpx;
}
.scroll-Y {
height: 100%;
}
.scroll-view_H {
white-space: nowrap;
width: 100%;
}
.scroll-view-item {
// height: 300rpx;
// line-height: 300rpx;
// text-align: center;
// font-size: 36rpx;
}
.scroll-view-item_H {
display: inline-block;
width: 100%;
// height: 300rpx;
// line-height: 300rpx;
// text-align: center;
// font-size: 36rpx;
}
.titleList {
height: 100%;
}
.titleList2 {
height: calc(100% - 170rpx);
}
/deep/.scroll-view-item:nth-child(2n-1) {
background-color: transparent !important;
}
.fdButtonBox {
color: #b0b0b0;
// width: 100%;
float: right;
padding: 4rpx 14rpx;
font-size: 24rpx;
font-weight: 500;
line-height: 30rpx;
border-radius: 10rpx;
box-sizing: border-box;
// margin-top: 10rpx;
// display: flex;
// align-items: center;
}
.commonPageBox {
background-color: #f0f0f0;
}
.set_box {
background-color: #fff;
height: auto;
padding: 20rpx;
}
.button_box {
width: 100%;
position: fixed;
bottom: 40rpx;
padding:20rpx 80rpx;
.button {
margin-top: 40rpx;
}
}
/deep/.rightArrow{
margin-top: 6rpx !important;
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,671 @@
<template>
<view>
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<z-nav-bar title="我的账户" bgColor="#3AB3AE" fontColor="#fff"> </z-nav-bar>
<view class="ACTable">
<!-- <u-tabs :list="tab_list" @click="tab_click" lineColor="#54a966 100% 100%"
:activeStyle="{color: '#303133',fontWeight: 'bold',transform: 'scale(1.1)'}" ></u-tabs> -->
<!-- <u-tabs :list="tab_list_ios" @click="tab_click" lineColor="#54a966 100% 100%"
:activeStyle="{color: '#303133',fontWeight: 'bold',transform: 'scale(1.1)'}" v-if="!iosHide"></u-tabs> -->
<view>
<view class="AC_mes">
<view class="wallet_title PM_font">天医币</view>
<view class="wallet_number">{{
userMes.peanutCoin ? userMes.peanutCoin : 0
}}</view>
<!-- <text v-if="platform != 'ios'" class="AC_chong" @click="buPoint()"
>充值</text
> -->
</view>
<view style="padding: 0 30rpx; padding-top: 0">
<view class="AC_chong" @click="onPageJump('/pages/mine/wallet/recharge/index')">立即充值
<u-icon name="arrow-right" color="#fff" size="16" class="rightArrow"></u-icon>
<!-- <image
src="@/static/icon/icon_white_right.png"
class="rightArrow"
style=""
></image> -->
</view>
</view>
<view style="padding: 30rpx; padding-top: 0">
<view class="AC_con">
<view class="AC_jilu PM_font">充值记录</view>
<common-list
:dataList="MoneyRecord"
isCondition="true"
isNoIcon="true"
label="orderType"
>
<template slot="labelSlot" slot-scope="slotProps">
<view class="label_content AC_List">
<view class="left">
<view class="title">{{ slotProps.row.orderType }}</view>
</view>
<view
:class="`right ${
slotProps.row.changeAmount > 0 ? 'Hot' : ''
}`"
>
<text v-if="slotProps.row.changeAmount > 0">+</text>
<text>{{ slotProps.row.changeAmount }}</text> </view
><view
class="AC_mark"
v-if="slotProps.row.remark "
>{{ slotProps.row.remark}}</view
><view class="AC_time">{{ slotProps.row.createTime }}</view>
</view>
</template>
</common-list>
</view>
</view>
</view>
<!-- <view v-if="tab_muJian==1">
<view class="couponList">
<view v-for="(item,index) in couponTabs" @click="couponTabCLi(index)"
:class="couponListTab==index?'couStyle':''">{{item.name}}</view>
</view>
<view>
<view class="card" v-for="item in cardList">
<view>
<view class="content">
<view :class="couponListTab==0?'page-group':'page-group grey'">
<i class="fold-page"></i>
<span class="page">优惠券</span>
</view>
<i class="dot-left"></i>
<i class="dot-right"></i>
<view class="coupon-detail">
<view :class="couponListTab==0?'':'grey'">
<span></span>
<span>{{item.coupons.amount}}</span>
</view>
<view>
<view>{{item.coupons.couponName}}</view>
<view>{{item.coupons.useLevel}}元可用</view>
<view>
<span v-if="item.coupons.couponProType == 0">使用类型商品类</span>
<span v-if="item.coupons.couponProType == 1">使用类型电子书</span>
</view>
</view>
<view>
<view v-if="couponListTab==0" @click="onPageJump('../bookShop/bookShopIndex')">
立即使用</view>
</view>
</view>
</view>
<view class="footer">
<view style="margin: 0 0 8rpx 0;">使用时间{{item.coupons.takeEffectDate}} -
{{item.coupons.expirationDate}}
</view>
<view>{{item.coupons.note}}</view>
<view class="arrow"></view>
<view class="arrow-up"></view>
</view>
<view class="ribbon" v-if="couponListTab==0">未使用</view>
<view class="ribbon grey" v-if="couponListTab==1">已使用</view>
<view class="ribbon grey" v-if="couponListTab==2">已过期</view>
</view>
</view>
<view v-if="cardList.length==0" style="text-align: center;font-size: 30rpx;color: #666;">暂无代金券
</view>
</view>
</view> -->
<!-- <view>
<view v-if="status == 0" style="text-align: center">
<u-loading-icon style="display: inline-block"></u-loading-icon>
<font
style="
vertical-align: super;
margin-left: 10px;
font-size: 26rpx;
color: #909399;
"
>努力加载中</font
>
</view>
<view v-if="status == 1">
<u-divider text="全部加载完成"></u-divider>
</view>
</view> -->
<view style="padding-bottom: 20rpx">
<u-back-top
:scroll-top="scrollTop"
bottom="60"
:customStyle="bgiStyle"
:iconStyle="iconStyle"
>
</u-back-top>
</view>
</view>
<music-play :playData="playData"></music-play>
</view>
</template>
<script>
import musicPlay from "@/components/music.vue";
import $http from "@/config/requestConfig.js";
import { mapState } from "vuex";
export default {
data() {
return {
playData: {},
platform: null,
urlList: {
list: "common/transactionDetails/getTransactionDetailsList",
},
tab_list: [
{
name: "天医币",
},
],
tab_list_ios: [
{
name: "优惠券",
},
],
couponTabs: [
{
name: "未使用",
},
{
name: "已使用",
},
{
name: "已过期",
},
],
cardList: [],
couponListTab: 0,
MoneyRecord: [],
userMes: {},
RecordScreen: {
userid: "",
page: 1,
limit: 5,
},
scrollTop: 0,
status: 3,
totalPage: 0,
totalCount: 0,
tab_muJian: 0,
bgiStyle: {
background: "#bbe5d8",
},
iconStyle: {
fontSize: "40rpx",
fontWeight: "bold",
color: "#54a966",
},
};
},
// 返回顶部
onPageScroll(e) {
this.scrollTop = e.scrollTop;
},
// 下拉刷新
onReachBottom() {
this.status = 0;
if (this.RecordScreen.page < this.totalPage) {
this.RecordScreen.page = this.RecordScreen.page + 1;
setTimeout(() => {
this.$http
.post(this.urlList.list, {
userId: this.userInfo.id,
})
.then((res) => {
this.totalPage = res.page.totalPage;
this.totalCount = res.page.totalCount;
for (let i in res.page.list) {
this.MoneyRecord.push(res.page.list[i]);
}
});
}, 1000);
} else {
this.status = 1;
}
},
//第一次加载
onLoad(e) {
// 隐藏原生的tabbar
uni.hideTabBar();
// #ifdef APP-PLUS
this.platform = uni.getSystemInfoSync().platform;
console.log("操纵系统", this.platform);
// #endif
},
computed: {
...mapState(["userInfo"]),
},
//页面显示
onShow() {
// 隐藏原生的tabbar
uni.hideTabBar();
this.getData();
// this.getCourpe();
},
components: {
musicPlay,
},
//方法
methods: {
// 获取
getData() {
var data = {
userId: this.userInfo.id,
};
if (!this.iosHide) {
this.tab_muJian = 1;
}
// 用户详情
if (this.userInfo.id != undefined) {
this.$http.post("book/user/info/" + this.userInfo.id).then((res) => {
this.userMes = res.user;
});
}
$http
.request({
url: this.urlList.list,
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data,
header: {
//默认 无 说明:请求头
"Content-Type": "application/json",
},
})
// 充值记录
.then((res) => {
console.log("res at line 255:", res);
this.MoneyRecord = res.transactionDetailsList;
// this.totalPage = res.page.totalPage;
// this.totalCount = res.page.totalCount;
});
},
// 点击tab
tab_click(e) {
this.tab_muJian = e.index;
},
// 优惠券
getCourpe() {
this.$http
.post(
"/book/couponhistory/appGetUserCenterCoupon?userId=" +
this.userInfo.id +
"&useStatus=" +
this.couponListTab
)
.then((res) => {
// this.cardList = res.couponVos
this.cardList = res.couponVos;
});
},
// 切换优惠券
couponTabCLi(e) {
this.couponListTab = e;
this.getCourpe();
},
// 充值天医币
buPoint() {
uni.navigateTo({
url: "../peanut/reCharge",
});
},
// 跳转
onPageJump(url) {
uni.navigateTo({
url: url,
});
},
},
};
</script>
<style lang="scss" scoped>
@import "@/style/mixin.scss";
.ACTable {
// padding: 20rpx 30rpx;
.AC_mes {
width: 100%;
height: 400rpx;
background-image: url("@/static/image/wallet.png");
background-position: center center;
background-repeat: no-repeat;
background-size: 100% 100%;
// margin-top: 50rpx;
padding: 160rpx 160rpx 100rpx 120rpx;
box-shadow: 0 0px 10px 1px #d3d1d133;
// background-color: #fff;
border-radius: 15rpx;
margin-bottom: 40rpx;
position: relative;
.wallet_title {
color: #fff;
font-size: 62rpx;
line-height: 80rpx;
font-weight: 600;
text-align: center;
}
.wallet_number {
color: #fff;
font-size: 70rpx;
line-height: 100rpx;
font-weight: 500;
text-align: center;
}
}
.AC_con {
background-color: #fff;
overflow: hidden;
// margin-top: 50rpx;
// padding: 30rpx 30rpx;
box-shadow: 0 0px 10px 1px #d3d1d133;
border-radius: 15rpx;
margin-bottom: 40rpx;
font-size: 30rpx;
padding-bottom: 30rpx;
.AC_jilu {
font-size: 42rpx;
text-align: left;
color: #3ab3ae;
// background-image: linear-gradient(90deg, #3AB3AE 20%, #c3fade 100%);
// margin-bottom: 30rpx;
padding: 30rpx 20rpx 20rpx;
}
.AC_List {
overflow: hidden;
.left {
width: calc(100% - 120rpx) !important;
font-weight: 700;
float: left;
color: #333;
font-size: 32rpx;
line-height: 60rpx;
}
.right {
display: block;
width: 100rpx !important;
float: right;
text-align: right;
font-size: 32rpx;
font-weight: 700;
color: #333;
}
// border-bottom: 1px solid #eee;
// padding: 40rpx 10rpx;
.AC_title {
font-size: 32rpx;
margin-bottom: 20rpx;
view {
float: right;
font-size: 34rpx;
font-weight: bold;
}
}
.AC_mark {
font-size: 28rpx;
margin-top: 20rpx;
margin-bottom: 15rpx;
// white-space: nowrap;
color: #888;
float: left;
}
.AC_time {
color: #bababa;
font-size: 28rpx;
}
}
}
.couponList {
view {
display: inline-block;
padding: 0 0 25rpx 0;
margin: 40rpx 0 40rpx 0;
width: 33%;
text-align: center;
font-size: 30rpx;
}
.couStyle {
border-bottom: 5rpx solid #54a966;
color: #54a966;
font-weight: bold;
}
}
.card {
width: 100%;
overflow: hidden;
margin-bottom: 30rpx;
padding-left: 10rpx;
position: relative;
}
.card > view {
background: #fff;
border-radius: 5rpx;
}
.card .dot-left,
.card .dot-right {
display: block;
width: 12rpx;
height: 12rpx;
border-radius: 50%;
background: #f5f5f5;
position: absolute;
z-index: 999;
}
.card .dot-left {
bottom: -6rpx;
left: -6rpx;
}
.card .dot-right {
bottom: -6rpx;
right: -6rpx;
}
.card .page-group {
position: absolute;
top: 10rpx;
left: -2rpx;
width: 100%;
max-width: 200rpx;
.fold-page {
display: block;
width: 10rpx;
height: 8rpx;
background: #54a966;
transform: skewY(-40deg);
position: absolute;
top: -5rpx;
left: -8rpx;
z-index: 0;
}
.page {
position: absolute;
z-index: 1;
display: block;
padding: 5rpx 20rpx 3rpx 20rpx;
height: 40rpx;
line-height: 40rpx;
background: linear-gradient(137deg, #54a966 0%, #0d5e1e 100%);
border-radius: 0 20rpx 20rpx 0;
color: #fff;
text-align: center;
font-size: 24rpx;
overflow: hidden;
left: -8rpx;
}
}
.card .page-group.grey {
.fold-page {
background: #c6c6c6;
}
.page {
background: linear-gradient(137deg, #c6c6c6 0%, #999595 100%);
}
}
.card .content {
width: 100%;
height: 180rpx;
border-bottom: 1rpx dotted #f5f5f5;
position: relative;
z-index: 2;
}
.card .content .coupon-detail {
display: flex;
padding: 0 15rpx 0 20rpx;
}
.card .content .coupon-detail > view {
height: 130rpx;
display: flex;
align-items: center;
}
.card .content .coupon-detail > view:first-child {
color: #54a966;
padding-top: 100rpx;
width: 30%;
}
.card .content .coupon-detail > view.grey {
color: #c6c6c6;
}
.card .content .coupon-detail > view:first-child > span:first-child {
font-size: 30rpx;
margin: 0 10rpx 0 0;
}
.card .content .coupon-detail > view:first-child > span:last-child {
font-size: 70rpx;
}
.card .content .coupon-detail > view:last-child > view {
color: #54a966;
border: 1rpx solid #54a966;
border-radius: 50rpx;
font-size: 12px;
line-height: 25px;
width: 150rpx;
height: 50rpx;
margin: 100rpx 0 0 5rpx;
text-align: center;
}
.card .coupon-detail > view:nth-child(2) {
flex-direction: column;
padding-top: 60rpx;
width: 40%;
}
.card .coupon-detail > view:nth-child(2) > view {
width: 100%;
}
.card .coupon-detail > view:nth-child(2) > view:first-child {
color: #333;
font-weight: bold;
font-size: 25rpx;
margin: 0 0 10rpx 0;
}
.card .coupon-detail > view:nth-child(2) > view:last-child {
font-size: 12px;
color: #adadad;
margin-top: 5rpx;
}
.card .coupon-detail > view:nth-child(2) > view:last-child > view {
transform: scale(0.8);
margin-left: -14rpx;
}
.card {
.footer {
color: #999;
font-size: 12px;
padding: 30rpx 15rpx 30rpx 30rpx;
}
.ribbon {
width: 160rpx;
height: 40rpx;
background: #54a966;
position: absolute;
right: -40rpx;
top: 25rpx;
transform: rotateZ(45deg);
text-align: center;
color: #fff;
font-size: 20rpx;
line-height: 44rpx;
}
.ribbon.grey {
background: #c6c6c6;
}
}
}
.Hot {
color: #3ab3ae !important;
}
.AC_chong {
display: flex;
align-items: center;
justify-content: space-between;
background-image: linear-gradient(90deg, #3ab3ae 0%, #73ee9c 100%);
color: #fff;
border-top-left-radius: 15rpx;
border-top-right-radius: 15rpx;
padding:20rpx 20rpx;
font-size: 36rpx;
font-weight: 800;
text-align: right;
}
.rightArrow {
width: 40rpx;
height: 40rpx;
float: right;
margin-left: 10rpx;
// position: absolute;
// right: 30rpx;
// top: 20rpx;
}
</style>

View File

@@ -0,0 +1,833 @@
<template>
<view class="container commonPageBox">
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<z-nav-bar title="充值" bgColor="#3AB3AE" fontColor="#fff"></z-nav-bar>
<view class="cha_jine">
<view class="cj_title PM_font">充值金额</view>
<view class="cj_xiang">
<view
v-for="(item, index) in cjList"
@click="chosPric(item)"
:class="
stepsCj.priceTypeId == item.priceTypeId
? 'Tab_cj cj_price'
: 'cj_price'
"
>
<view class="pr_jg">{{ item.realMoney }}</view>
<view class="pr_yl">{{ item.money }} 天医币</view>
<view class="pr_lj">限时特惠</view>
</view>
<br clear="both" />
</view>
</view>
<view class="cha_fangsh">
<view class="cf_title PM_font">支付方式</view>
<view class="cf_radio">
<u-radio-group v-model="payType">
<view style="width: 100%" v-if="isAndroid">
<view
v-for="(item, index) in paylist"
@click="choseType(item.id)"
:class="payType == item.id ? 'Tab_xf cf_xuanx' : 'cf_xuanx'"
>
<image class="pay_item_img" :src="item.imgUrl" mode="aspectFil">
</image>
{{ item.title }}
<u-radio
:key="index"
activeColor="#3AB3AE"
:name="item.id"
style="float: right; margin-top: 5rpx"
></u-radio>
</view>
</view>
<view style="width: 100%" v-else>
<view
v-for="(item, index) in iosPaylist"
@click="choseType(item.id)"
:class="payType == item.id ? 'Tab_xf cf_xuanx' : 'cf_xuanx'"
>
<image class="pay_item_img" :src="item.imgUrl" mode="aspectFil">
</image>
{{ item.title }}
<u-radio
:key="index"
activeColor="#3AB3AE"
:name="item.id"
style="float: right; margin-top: 5rpx"
></u-radio>
</view>
</view>
</u-radio-group>
</view>
</view>
<view class="agree_wo flexbox" style="float: left; display: flex">
<radio-group class="agree">
<view v-for="(item, index) in argee" :key="index">
<radio
class="agreeRadio"
:value="item.id"
:checked="item.id == radioValue"
color="#3AB3AE"
@click="radioCheck(index)"
></radio>
</view>
</radio-group>
<view
>* 我已阅读并同意<span class="highlight" @click="showXieyi"
>增值服务协议</span
></view
>
</view>
<view class="char_btn">
<view @click="goToPay">立即充值</view>
<!-- <view @click="iosPay" >立即充值</view> -->
</view>
<!-- 充值协议 -->
<u-popup :show="xieyiShow" :round="10" @close="xieyiShow = false">
<view class="tanchu">
<view class="dp_title">{{ xieyi.title }}</view>
<view style="max-height: 1000rpx; overflow-y: scroll">
<view v-html="xieyi.content"></view>
</view>
</view>
</u-popup>
<music-play :playData="playData"></music-play>
</view>
</template>
<script>
import musicPlay from "@/components/music.vue";
import $http from "@/config/requestConfig.js";
import { checkIapOrder } from "@/store/modules/common.js";
// import { // 引入ios支付
// Iap,
// IapTransactionState
// } from "@/utils/iap.js"
import { mapState, mapMutations } from "vuex";
import { setPay, setPayAssign, setWXPay } from "@/config/utils";
// const IAPOrders = [ // 根据这些ids获取到苹果app内商品信息这些ids就是你上面设置的产品id
// 'add69'
// ]
export default {
data() {
return {
playData: {},
xieyi: {
title: "",
content: "",
},
chargeOrderSn: "", // 通过query传过来的orderSN二次支付情况
xieyiShow: false,
stepsCj: {},
cjList: [],
argee: [
{
value: false,
id: "1",
},
], // 同意权限
radioValue: "",
orderSn: "", // 订单sn
productid: "",
isAndroid: true, // 是否为安卓环境
payType: 2,
// #ifdef APP-IOS
payType: 3,
// #endif
paylist: [
{
title: "支付宝",
id: 2,
imgUrl: require("@/static/icon/pay_1.png"),
},
{
title: "微信",
id: 1,
imgUrl: require("@/static/icon/pay_2.png"),
},
],
iosPaylist: [
{
title: "apple pay支付",
id: 3,
imgUrl: require("@/static/icon/pay_2.png"),
},
],
transaction: {
// 成功回调
},
urlList: {
list:'common/bookBuyConfig/getBookBuyConfigList',
},
};
},
//第一次加载
onLoad(e) {
// 隐藏原生的tabbar
uni.hideTabBar();
this.chargeOrderSn = e.orderSn;
// console.log(e.orderSn,'orderSn')
},
//页面显示
onShow() {
// 隐藏原生的tabbar
// this.iphonepay()
uni.hideTabBar();
this.getDevName();
// setTimeout(()=>{
// uni.navigateTo({
// url:'/pages/user/persCount'
// })
// },2000)
},
computed: {
...mapState(["userInfo"]),
},
components: {
musicPlay,
},
//方法
methods: {
...mapMutations(["setUserInfo"]),
// 关闭交易订单
finishTransaction(trans) {
this.iapChannel.finishTransaction(
trans,
(success) => {
console.log("关闭订单成功");
this.setUserInfo({ restoreFlag: false });
},
(fail) => {
console.log("关闭订单失败");
}
);
},
showXieyi() {
this.$http.get(`sys/agreement/list?key=pay`).then((res) => {
this.xieyi = res.page.list[0];
this.xieyiShow = true;
});
},
radioCheck(index) {
// 勾选用户协议
this.argee.forEach((item) => {
item.isCheck = false;
});
if (this.radioValue == this.argee[index].id) {
this.radioValue = null;
} else {
this.radioValue = this.argee[index].id;
}
// console.log(this.radioValue)
},
iphonepay() {
const that = this;
// 如果ios已经绑定支付信息就直接支付如果没有绑定就需要先绑定
console.log("检测支付环境...");
plus.payment.getChannels((channels) => {
console.log(channels, "channels");
for (var i in channels) {
// 判断是否苹果支付1
if (channels[i].id === "appleiap") {
that.iapChannel = channels[i];
that.requestOrder();
}
}
});
},
requestOrder() {
uni.showLoading({
title: "获取商品信息",
mask: true,
});
const that = this;
console.log(that.stepsCj.priceTypeId, 88888888);
// ['xxxxx'] 是平台申请拿到的内购商品的id
let IAPOrders = [];
IAPOrders.push(that.stepsCj.priceTypeId + "");
console.log(IAPOrders, "IAPOrders");
// 新建订单
that.iapChannel.requestOrder(
IAPOrders,
function (event) {
// uni.hideLoading()
console.log(event, "event");
for (var index in event) {
var OrderItem = event[index];
// console.log(OrderItem, 'OrderItem')
console.log(OrderItem.productid, "OrderItem.productid");
that.topay(OrderItem.productid);
}
},
function (erroemsg) {
uni.showToast({
title: "商品获取失败",
icon: "none",
});
}
);
},
topay(id) {
const that = this;
uni.hideLoading();
// if(this.chargeOrderSn != '' || this.chargeOrderSn != undefined){ // 判断是不是二次支付的订单
// that.orderSn = this.chargeOrderSn
// console.log(that.orderSn,'二次支付的订单号')
// }
// var restoreFlag = true; // 调用支付接口时标记 restoreFlag = true , 实际应用请将标记存储在 storage 中
this.setUserInfo({ restoreFlag: true });
console.log(this.userInfo, "更新后的用户信息");
plus.payment.request(
that.iapChannel,
{
productid: id,
username: that.orderSn, // 用户标识/订单标识
manualFinishTransaction: true, // 3.5.1+ 支持,设置此参数后需要开发者主动关闭订单,参见下面的关闭订单方法 finishTransaction()
},
function (result) {
// restoreFlag = false; // 支付成功清除标记 restoreFlag = false
that.transaction = result;
// 支付成功result 为 IAP商品交易信息对象 IAPTransaction 需将返回的支付凭证传给后端进行二次认证
that.iapCheck(result);
},
function (e) {
console.log("错误回调", e);
if (e.errCode == 2) {
// 用户未绑定支付方式app内支付流程结束系统弹出框引导用户绑定支付方式此过程将跳转到系统应用 AppStore 进行绑定支付方式,绑定成功同步支付成功,用户成功付款
plus.runtime.openURL("https://apps.apple.com/account/billing");
} else {
// restoreFlag = false; // 支付失败清楚标记
that.finishTransaction(result);
//console.log('订单关闭后的用户信息', that.userInfo);
console.log(e);
//console.log(e.message)
}
}
);
},
iapCheck(result) {
let that = this;
console.log("进入后台验证");
let data = {
transactionId: result.transactionIdentifier, // 支付交易id
customerOid: that.userInfo.id,
productId: result.payment.productid, // 产品id
orderId: result.payment.username, // 系统订单号
receiptData: result.transactionReceipt, // 苹果返回收据
// body: that.stepsCj.priceTypeId // 充值类型id
};
console.log(data, "data");
$http
.request({
url: "/Ipa/veri",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data,
header: {
//默认 无 说明:请求头
"Content-Type": "application/json",
},
})
.then((res) => {
console.log(JSON.stringify(res));
if (res.code == 0) {
//uni.hideLoading()
that.userInfo.restoreFlag == true
? that.setUserInfo({ restoreFlag: false })
: "";
console.log(that.userInfo.restoreFlag);
console.log("充值订单已处理,请留意账户金额变动....");
// 服务器验证票据有效后在客户端关闭订单 (iapChannel.finishTransaction)
that.finishTransaction(result);
}
})
.catch((e) => {
uni.showModal({
title: "提示",
showCancel: false,
content:
"支付验证失败请稍后重启app如不能解决您的问题可联系官方客服",
success: function (res) {
if (res.confirm) {
console.log("用户点击确定");
}
},
});
});
},
getDevName() {
// 获取使用环境
if (uni.getSystemInfoSync().platform === "android") {
this.isAndroid = true;
// console.log('运行Android上')
} else {
this.isAndroid = false;
// console.log('运行iOS上')
}
this.getData();
},
// 获取充值金额
getData() {
// console.log(this.isAndroid)
if (this.isAndroid) {
this.getAndorList();
} else {
this.getAppleList();
}
},
// 安卓充值列表
getAndorList() {
var data={
type: "point",
qudao: "Android",
}
$http
.request({
url: this.urlList.list,
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data,
header: {
//默认 无 说明请求头1
"Content-Type": "application/json",
},
})
.then((res) => {
console.log("res at line 389:", res);
console.log("res at line 388:", res);
this.cjList = res.bookBuyConfigList;
console.log("this.cjList at line 389:", this.cjList);
this.stepsCj = res.bookBuyConfigList[0];
});
},
// 苹果充值列表
getAppleList() {
var data={
type: "point",
qudao: "IOS",
}
this.$http
.post(this.urlList.list, {
type: "point",
qudao: "IOS",
})
.then((res) => {
console.log("res at line 403:", res);
this.cjList = res.bookBuyConfigList;
this.stepsCj = res.bookBuyConfigList[0];
});
},
// 点击充值金额
chosPric(e) {
this.stepsCj = e;
console.log(e);
},
// 选择支付方式1
choseType(e) {
let that = this;
that.payType = e;
},
//ios充值
iosPay() {
this.iphonepay();
},
// 充值
goToPay() {
this.kaiChar();
},
// 正常充值
kaiChar() {
// 常规充值
if (this.radioValue == "1") {
uni.showLoading({
title: "支付中,请勿离开",
icon: "loading",
});
let that = this;
let data = {
userId: that.userInfo.id, //下单人ID
userPhone: that.userInfo.tel, //收货人手机号
paymentMethod: that.payType, //2支付宝1微信3ios内购
orderMoney: that.stepsCj.money * 1, //订单金额
districtMoney: 0, //优惠金额
realMoney: that.stepsCj.money * 1, //实收金额
orderStatus: 0, //订单状态
orderType: "point", //订单类型
productId: that.stepsCj.priceTypeId, // 充值的类型id
};
$http
.request({
url: "book/buyOrder/rechargeSave",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data,
header: {
//默认 无 说明请求头1
"Content-Type": "application/json",
},
})
.then((res) => {
that.orderSn = res.orderSn;
uni.hideLoading();
if (res.code == 0) {
if (that.payType == 2) {
setPay(
{
typePay: "alipay",
subject: "point",
totalAmount: that.stepsCj.money,
type: that.payType,
relevanceoid: res.orderSn,
body: that.stepsCj.priceTypeId,
},
(res) => {
if (res.success) {
uni.showToast({
title: "支付成功",
});
setTimeout(() => {
uni.navigateTo({
url: "/pages/mine/wallet/index/index",
});
}, 2000);
} else {
uni.showToast({
title: "支付失败",
icon: "none",
image: "@/static/icon/ic_close.png",
});
}
}
);
} else if (that.payType == 1) {
// 微信支付
that.orderSn = res.orderSn;
let data1 = {
orderSn: that.orderSn,
buyOrderId: that.stepsCj.priceTypeId,
totalAmount: that.stepsCj.money,
};
console.log(data1, "data1");
// console.log(this.userInfo.channelList,'channelList')
// this.userInfo.channelList.map(item => {
// if(item.id == "wxpay"){
// console.log('支持微信支付')
setWXPay(data1, (res) => {
if (res.success) {
uni.showToast({
title: "支付成功",
});
setTimeout(() => {
uni.navigateTo({
url: "/pages/mine/wallet/index/index",
});
}, 2000);
} else {
console.log(res);
if (res.data.errMsg.indexOf("User canceled") != -1) {
uni.showToast({
title: "用户取消支付",
icon: "none",
image: "@/static/icon/ic_close.png",
});
} else {
uni.showToast({
title: "支付失败",
icon: "none",
image: "@/static/icon/ic_close.png",
});
}
}
});
// }
// })
} else if (that.payType == 3) {
console.log("苹果支付");
that.iosPay();
}
}
});
} else {
uni.showToast({
title: "请勾选 已阅读会员服务协议",
icon: "none",
});
return false;
}
},
// 跳转
onPageJump(url) {
uni.navigateTo({
url: url,
});
},
},
};
</script>
<style lang="scss" scoped>
@import "@/style/mixin.scss";
.tanchu {
padding: 40rpx 30rpx 40rpx 30rpx;
position: relative;
.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;
}
.youhuiItem {
border: 1px solid #d9d9d9;
border-radius: 10rpx;
width: 100%;
display: flex;
padding: 20rpx 10rpx;
margin: 25rpx 0 0 0;
align-items: center;
background-color: #fff;
font-size: 30rpx;
}
.youhuiItem > view {
float: left;
}
.youhuiItem.youItem_style {
border-color: #fd6004;
}
}
.agreeRadio {
zoom: 0.8;
}
.cha_jine {
padding: 60rpx 30rpx 40rpx;
// margin: 40rpx 50rpx 0 50rpx;
.cj_title {
font-size: 46rpx;
color: #3ab3ae;
// font-weight: bold;
}
.cj_xiang {
margin-top: 40rpx;
.cj_price {
box-shadow: 0 0 20rpx 0 #0000001a;
float: left;
width: 47%;
margin: 0 5% 30rpx 0;
text-align: center;
padding: 20rpx;
border-radius: 15rpx;
position: relative;
color: #2d2d2d;
.pr_jg {
font-size: 45rpx;
margin: 20rpx 0 10rpx 0;
font-weight: bold;
}
.pr_yl {
font-size: 26rpx;
// text-decoration: line-through;
color: #575555;
}
.pr_lj {
background-image: linear-gradient(90deg, #3ab3ae 0%, #d8f8e4 100%);
color: #fff;
position: absolute;
top: -30rpx;
right: -20rpx;
font-size: 24rpx;
padding: 5rpx 10rpx;
border-top-left-radius: 20rpx;
border-bottom-right-radius: 20rpx;
}
}
.cj_price:nth-child(2n) {
margin-right: 0;
}
.Tab_cj {
// box-shadow: 0 0 20rpx 0 #fe700bcc;
box-shadow: 0px 0px 3px 0px #3ab3ae !important;
color: #259f9a;
background: #edfcf7 !important;
}
}
}
.highlight {
color: $uni-color-primary;
}
.cha_fangsh {
padding: 40rpx 30rpx;
.cf_title {
font-size: 46rpx;
color: #3ab3ae;
}
.cf_radio {
margin-top: 20rpx;
.cf_xuanx {
font-size: 32rpx;
padding: 20rpx 0;
margin-bottom: 20rpx;
border-bottom: 1px solid #ededed;
image {
width: 40rpx;
height: 40rpx;
display: inline-block;
margin-right: 20rpx;
vertical-align: bottom;
}
}
.Tab_xf {
// background-color: #fdf1e9cc;
}
}
}
.agree_wo {
color: #aaa;
font-size: 25rpx;
margin-top: 30rpx;
padding: 30rpx;
// margin: 40rpx 50rpx 0 50rpx;
padding-bottom: 180rpx;
}
.char_btn {
position: fixed;
left: 0;
right: 0;
bottom: 30rpx;
view {
background-image: linear-gradient(90deg, #3ab3ae 0%, #d8f8e4 100%);
color: #fff;
width: 90%;
margin: 0 auto;
text-align: center;
font-size: 35rpx;
font-weight: bold;
padding: 25rpx 0;
border-radius: 50rpx;
}
}
.pay_item_img {
width: 50rpx;
height: 50rpx;
float: left;
margin-right: 20rpx;
}
.agree {
width: auto !important;
}
.commonPageBox{
background-color: #fff !important;
}
</style>