diff --git a/pages/bookShop/commodityDetail.vue b/pages/bookShop/commodityDetail.vue
index 074e921..d1919ac 100644
--- a/pages/bookShop/commodityDetail.vue
+++ b/pages/bookShop/commodityDetail.vue
@@ -27,7 +27,7 @@
- 其他购买套餐
+ 商品列表
@@ -442,8 +442,9 @@
buttonClick(e) {
console.log(e)
if(e.index == 0){
- // 点击的是加入购物车
- this.addCart()
+ // 点击的是加入购物车
+ this.upoShow = true
+ // this.addCart()
}else{
// 点击的是立即购买
this.upoShow = true
diff --git a/pages/clock/index.vue b/pages/clock/index.vue
index 95b7264..424f4ea 100644
--- a/pages/clock/index.vue
+++ b/pages/clock/index.vue
@@ -1,7 +1,9 @@
-
+
+ 请选择要打卡的书籍:
+
@@ -99,6 +101,10 @@
diff --git a/pages/listen/home.vue b/pages/listen/home.vue
index bb7709d..ae645a1 100644
--- a/pages/listen/home.vue
+++ b/pages/listen/home.vue
@@ -54,6 +54,7 @@
+
diff --git a/pages/listen/listen.vue b/pages/listen/listen.vue
index 040073c..52f5f31 100644
--- a/pages/listen/listen.vue
+++ b/pages/listen/listen.vue
@@ -30,6 +30,11 @@
{{item.title}} >
+
+
+
+
+
@@ -69,7 +74,7 @@
sort:0 可以听
sort:1 不可以听
-->
-
+
+
@@ -185,6 +191,19 @@
},
methods: {
...mapMutations(['setUserInfo']),
+ // 查看本书更多书评
+ toMore(val){
+ console.log(val,'val')
+ uni.navigateTo({
+ url: '../comments/comments?bookid='+ this.bookid,
+ });
+ },
+ // 去打卡
+ gotoclock(){
+ uni.navigateTo({
+ url: '../clock/clock?bookid='+ this.bookid,
+ });
+ },
getBookInfo(){
// 获取书本基本信息
this.$http
@@ -315,17 +334,6 @@
uni.navigateTo({
url: '../bookShop/settlementBook?type=2&list=' + this.bookid
});
- // uni.showModal({
- // title: '提示',
- // cancelText: '暂不购买',
- // confirmText:'立即购买',
- // content: '确定花费¥95元购买本书电子版吗?',
- // success: function (res) {
- // if (res.confirm) {
- // console.log('用户点击确定');
- // }
- // }
- // });
},
@@ -335,42 +343,8 @@
url: '../eBook/bookMessage?Id=' + id + '&typ=' + e
});
},
-
- // 第一次加载音乐播放器
- firstListen(){
- this.forceRefresh = false
- this.$http
- .post('book/bookchaptercontent/appBooksChapterContent', {
- 'userId': this.userInfo.id,
- 'bookid': this.bookid,
- 'id': this.playid
- })
- .then(res => {
- //this.tmpChapter.text = res.bookCatalogue
- if(res.code == 0){
- if(res.bookCatalogue.voices[0] != null){
- // console.log('走这')
- this.videoList = []
- this.boardRemark = res.bookCatalogue.chapter[0]
- this.fengImg = res.image
- this.videoList.push({'recorPath':res.bookCatalogue.voices[0]})
- // console.log(res.bookCatalogue.voices[0],'path')
- this.forceRefresh = true
- }else{
- uni.showToast({
- title:'暂无可播放音频~',
- icon:'none',
- duration:2000
- })
- setTimeout(()=>{
- uni.navigateBack({ // 返回上一页
- delta: 1
- });
- },2000)
- }
- }
- }).catch((e)=>{})
- },
+
+
// 存储播放进度
saveRate(val){
this.$http
@@ -430,16 +404,17 @@
if(res.BookCatalogue.length > 0){
this.libLIst = res.BookCatalogue
// this.fengImg = res.images
- }else{
- uni.showToast({
- title:'暂无可听章节哦~',
- icon:'none'
- })
- setTimeout(()=>{
- uni.navigateBack({ // 返回上一页
- delta: 1
- });
- },2000)
+ }else{
+ this.libLIst = []
+ // uni.showToast({
+ // title:'暂无可听章节哦~',
+ // icon:'none'
+ // })
+ // setTimeout(()=>{
+ // uni.navigateBack({ // 返回上一页
+ // delta: 1
+ // });
+ // },2000)
}
}
}).catch((e)=>{
@@ -541,6 +516,11 @@
.price{ margin-top: 160rpx; overflow: hidden;
.light{font-size: 50rpx; font-weight: bold; color: #f05654;}
}
+ .tags{
+ .tag{
+ margin-left: 0; margin-right: 10rpx;
+ }
+ }
.charType{display: inline; width:20px !important;}
.graytitle{color: #999;}
.yigoumai{background-color: #ffc773;}
diff --git a/pages/peanut/home.vue b/pages/peanut/home.vue
index 2d00839..6d373af 100644
--- a/pages/peanut/home.vue
+++ b/pages/peanut/home.vue
@@ -2,62 +2,65 @@
-
+
-
+
+
+
+
请输入想要搜索的书名
-
+
-
+
+
-
-
-
- 读书打卡
-
-
-
+
+
+
+ 读书打卡
+
+
+
听书
-
-
-
+
+
+
书评
-
+
图书馆
-
+
-
+
-
+
+
-
+
-
+
新书上市
-
-
+
+
-
-
-
-
+
+
+
+
+
+ {{item.productName}}
- {{item.productName}}
-
-
-
+
+
+
+
+
+
+
+
+
精选商品
查看更多 >
-
+
+ 精选图书
+ 折扣图书
+
-
-
-
-
- {{item.productName}}
-
-
- ¥{{item.price}}
- 已售:{{item.sumSales}} 件
+
+
+
+
+
+
+
+ {{item.productName}}
+
+
+ ¥{{item.activityPrice}}
+ ¥{{item.price}}
+ 已售:{{item.sumSales}} 件
+
-
-
-
-
-
- 努力加载中
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+ {{item.productName}}
+
+
+
+
+ ¥{{item.activityPrice}}
+
+
+ 原价:¥{{item.price}}
+ 已售:{{item.sumSales}} 件
+
+
+
+
+
+
+
+
+
-
+
@@ -165,26 +260,23 @@
import repciptData from '@/static/json/repcipt.json'
import $http from '@/config/requestConfig.js';
import {
- mapState,
- mapMutations
+ mapState,mapMutations
} from 'vuex';
export default {
data() {
return {
- myList: [],
- showEbook: false, // 显示电子书相关
+ myList:[],
+ showEbook:false, // 显示电子书相关
transaction: { // 成功回调
-
+
},
- status: 3,
- jPage: 1,
- jTotal: 0,
- scrollLeft: 0,
- maxTimes: 1, // 轮询最大次数
- ComplateRequestInterval: null, // 轮询定时器
- checking: false, // 正在检测
- ComplateRequestArr: [],
- iapChannel: null,
+ tabsNumber : 0,
+ scrollLeft:0,
+ maxTimes:1, // 轮询最大次数
+ ComplateRequestInterval:null, // 轮询定时器
+ checking:false, // 正在检测
+ ComplateRequestArr:[],
+ iapChannel:null,
scrollTop: 0,
list3: [
// '../../static/icon/home_ban_1.jpg',
@@ -195,11 +287,12 @@
limiTist: [],
jingList: [],
seckillList: [],
+ offSaleList:[], // 折扣列表
goodsList: [],
bgiStyle: {
background: '#fff'
},
- newBookList: [],
+ newBookList:[],
iconStyle: {
fontSize: '40rpx',
fontWeight: 'bold',
@@ -214,16 +307,15 @@
onLoad(e) {
// 隐藏原生的tabbar
uni.hideTabBar();
- // this.requestIapOrder()
+ // this.requestIapOrder()
},
//页面显示
onShow() {
// 隐藏原生的tabbar
uni.hideTabBar();
- this.goodsList = []
- this.getData();
-
-
+ this.getData();
+
+
},
// 页面加载完毕
onReady() {
@@ -231,27 +323,12 @@
},
// 下拉刷新
onPullDownRefresh() {
- console.log('下拉刷新')
- this.jPage = 1
- this.goodsList = []
this.getData()
uni.stopPullDownRefresh()
- this.requestIapOrder()
+ this.requestIapOrder()
},
- onHide() {
- this.jPage = 1
- this.goodsList = []
- },
- onReachBottom() {
- console.log('到底了')
- // if (this.jPage + 1 <= this.jTotal) {
- // this.jPage++
- // this.getJBook()
- // } else {
- // this.status = 1
- // }
- },
+
filters: {
// 控制字数
ellipsis(value) {
@@ -268,72 +345,78 @@
computed: {
...mapState(['userInfo']),
},
- components: {
+ components:{
musicPlay
},
//方法
methods: {
...mapMutations(['setUserInfo']),
- gotopingshu(val) {
- uni.navigateTo({
- url: '../comments/comments?bookid=' + val.id,
- });
+ tabsChange(num){
+ if(num != this.tabsNumber){
+ this.tabsNumber = num
+ }
},
- // 去打卡
- gotoclock(item) {
- this.onPageJump('../clock/clock?bookid=' + item.id)
- },
- // 去听书
- gotoListen(item) {
- uni.navigateTo({
- url: "../listen/listen?bookid=" + item.id
- });
+ // 获取折扣图书
+ getOffSale(){
+ this.$http
+ .post('book/shopproduct/listactivityprice?limit=10&page=1')
+ .then(res => {
+ console.log(res,'折扣')
+ if(res.code == 0 && res.page.list.length > 0){
+ this.offSaleList = res.page.list
+ this.tabsNumber = 0
+ }
+
+
+ }).catch(e => {
+ console.log(e,'e')
+ });
},
// 新书上市
- getNewBook() {
+ getNewBook(){
this.$http
- .post('book/shopproduct/getNewBook', {
+ .post('book/shopproduct/getNewBook',{
'limit': 10,
- 'page': 1
+ 'page':1
})
.then(res => {
- console.log(res, 'xinshu')
- this.newBookList = res.page.list
+ console.log(res,'xinshu')
+ this.newBookList = res.page.list
});
},
// 检测未完成订单
- requestIapOrder() {
+ requestIapOrder(){
console.log('检测支付环境...')
plus.payment.getChannels((channels) => {
console.log(channels, 'channels')
//this.setUserInfo({channelList:channels}); // 将支付通道保存到本地
- for (var i in channels) {
+ for (var i in channels) {
// 判断是否苹果支付1
if (channels[i].id === 'appleiap') {
- this.iapChannel = channels[i]
+ this.iapChannel = channels[i]
// console.log(this.userInfo.restoreFlag,'this.userInfo.restoreFlag')
- if (this.userInfo.restoreFlag) { // 如果存在异常回调订单
+ if(this.userInfo.restoreFlag){ // 如果存在异常回调订单
this.restoreComplateRequest()
}
}
- }
+ }
})
},
- // 查询未关闭订单
- restoreComplateRequest() {
+ // 查询未关闭订单
+ restoreComplateRequest(){
let that = this
console.log('检测未完成订单')
- console.log(this.iapChannel, 'this.iapChannel')
+ console.log(this.iapChannel,'this.iapChannel')
this.iapChannel.restoreComplateRequest({
manualFinishTransaction: true
- }, function(results) {
- if (!that.checking) {
- that.checking = true
- // console.log(that.checking)
- // results 格式为数组存放恢复的IAP商品交易信息对象 IAPTransaction,通用需将返回的支付凭证传给后端进行二次认证
+ }, function(results) {
+ if(!that.checking){
+ that.checking = true
+ // console.log(that.checking)
+ // results 格式为数组存放恢复的IAP商品交易信息对象 IAPTransaction,通用需将返回的支付凭证传给后端进行二次认证
that.ComplateRequestArr = results
- console.log(that.ComplateRequestArr, '未完成订单数组')
- if (results && results.length > 0) {
+ console.log(that.ComplateRequestArr,'未完成订单数组')
+ if(results && results.length>0){
// for(var j = 0; j {
- // "0"为正在支付;"1"为支付成功;"2"为支付失败;"3"为支付已恢复。
- if (item.transactionState == '1') {
- // 已经支付,但是没有走逻辑的内购订单
- that.iapCheck(item, index)
- } else {
- // 其他状态的内购订单
- that.finishTransaction(item)
-
- }
- })
+ results.map((item,index)=>{
+ // "0"为正在支付;"1"为支付成功;"2"为支付失败;"3"为支付已恢复。
+ if(item.transactionState == '1'){
+ // 已经支付,但是没有走逻辑的内购订单
+ that.iapCheck(item,index)
+ }else{
+ // 其他状态的内购订单
+ that.finishTransaction(item)
+
+ }
+ })
}
- }
- });
-
-
+ }
+ });
+
+
},
// 关闭交易订单
- finishTransaction(trans, index) {
+ finishTransaction(trans,index){
this.iapChannel.finishTransaction(trans, (success) => {
- console.log('关闭订单成功', index);
-
- if (index == this.ComplateRequestArr.length - 1) { // 最后一个支付订单
- this.setUserInfo({
- restoreFlag: false
- });
+ console.log('关闭订单成功',index);
+
+ if(index == this.ComplateRequestArr.length-1){ // 最后一个支付订单
+ this.setUserInfo({restoreFlag:false});
// console.log(this.userInfo.restoreFlag,'this.ComplateRequestArr.length+++')
}
-
- }, (fail) => {
- console.log('关闭订单失败');
- });
+
+ }, (fail) => {
+ console.log('关闭订单失败');
+ });
},
- iapCheck(result, index) {
- const that = this
+ iapCheck(result,index) {
+ const that = this
console.log('进入后台验证')
let data = {
transactionId: result.transactionIdentifier, // 支付交易id
- customerOid: that.userInfo.id,
+ customerOid: that.userInfo.id,
productId: result.payment.productid, // 产品id
orderId: result.payment.username, // 系统订单号
- receiptData: result.transactionReceipt, // 苹果返回收据
- loadAnimate: 'none', // 请求加载动画
- }
- console.log(data, 'data')
+ receiptData: result.transactionReceipt ,// 苹果返回收据
+ loadAnimate:'none', // 请求加载动画
+ }
+ console.log(data,'data')
$http.request({
url: "/Ipa/veri",
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
@@ -398,54 +479,54 @@
'Content-Type': 'application/json'
},
}).then(res => {
- console.log(JSON.stringify(res))
+ console.log(JSON.stringify(res))
console.log(res.code)
- if (res.code == 0) {
+ if(res.code == 0){
// uni.hideLoading()
- console.log('充值订单已处理,请留意账户金额变动....')
- // 服务器验证票据有效后在客户端关闭订单
- that.finishTransaction(result, index)
- } else if (res.code == 200) { // 重复验证订单
+ console.log('充值订单已处理,请留意账户金额变动....')
+ // 服务器验证票据有效后在客户端关闭订单
+ that.finishTransaction(result,index)
+ }else if(res.code == 200){ // 重复验证订单
console.log('重复验证....')
- that.finishTransaction(result, index)
+ that.finishTransaction(result,index)
}
- }).catch(e => {
+ }).catch(e => {
console.log('支付验证失败,进入轮询程序...')
- that.getIapPayResult(result, index)
- })
+ that.getIapPayResult(result,index)
+ })
console.log('--------------')
},
-
+
// 轮询验证支付结果
- getIapPayResult(result, index) {
+ getIapPayResult(result,index){
// let interval = null
- this.ComplateRequestInterval = setTimeout(() => {
- if (this.maxTimes <= 3) {
- this.iapCheck(result, index)
- console.log('执行1', this.maxTimes, this.ComplateRequestInterval)
- this.maxTimes += 1
- } else {
+ this.ComplateRequestInterval = setTimeout(() => {
+ if(this.maxTimes <= 3){
+ this.iapCheck(result,index)
+ console.log('执行1', this.maxTimes,this.ComplateRequestInterval)
+ this.maxTimes += 1
+ }else{
this.maxTimes = 0
- console.log('停止轮询', this.maxTimes, this.ComplateRequestInterval, this.maxTimes)
+ console.log('停止轮询', this.maxTimes,this.ComplateRequestInterval, this.maxTimes)
this.checking = false
- this.saveErrorIapOrder(result, index)
+ this.saveErrorIapOrder(result,index)
clearTimeout(this.ComplateRequestInterval)
-
+
}
- }, 10000)
-
+ },10000)
+
},
// 轮询失败接口
- saveErrorIapOrder(result, index) {
+ saveErrorIapOrder(result,index){
console.log('提交到充值问题单里面...')
let data = {
- transactionId: result.transactionIdentifier,
+ transactionId : result.transactionIdentifier,
failureflag: 1,
- orderId: result.payment.username,
- receiptData: result.transactionReceipt,
- productId: result.payment.productid,
- customerOid: this.userInfo.id
- }
+ orderId:result.payment.username,
+ receiptData:result.transactionReceipt,
+ productId:result.payment.productid,
+ customerOid:this.userInfo.id
+ }
$http.request({
url: "Ipa/failure",
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
@@ -454,50 +535,47 @@
'Content-Type': 'application/json'
},
}).then(res => {
- console.log(JSON.stringify(res))
- if (res.code == 200) {
+ console.log(JSON.stringify(res))
+ if(res.code == 200){
console.log('提交成功,关闭订单')
- this.finishTransaction(result, index)
+ this.finishTransaction(result,index)
}
- }).catch(e => {
- console.log(e)
- if (e.statusCode == 0) { // 重复提交,直接关闭订单
- this.finishTransaction(result, index)
+ }).catch(e => {
+ console.log(e)
+ if(e.statusCode == 0){ // 重复提交,直接关闭订单
+ this.finishTransaction(result,index)
}
- })
+ })
},
// 获取列表数据
getData() {
- this.$http
- .post('book/book/bookIndex')
- .then(res => {
- this.xinsList = res.bookIndex.newBookList
- this.limiTist = res.bookIndex.saleList
- this.jingList = res.bookIndex.topBookList
- });
+ // this.$http
+ // .post('book/book/bookIndex')
+ // .then(res => {
+ // // this.xinsList = res.bookIndex.newBookList
+ // // this.limiTist = res.bookIndex.saleList
+ // // this.jingList = res.bookIndex.topBookList
+ // });
// 获取限时秒杀
- this.$http
- .get(`book/shopseckill/getSeckillProd`)
- .then(res => {
- this.seckillList = res.list
- // this.seckillList = null
- })
+ // this.$http
+ // .get(`book/shopseckill/getSeckillProd`)
+ // .then(res => {
+ // this.seckillList = res.list
+ // // this.seckillList = null
+ // })
- // 获取精选图书
- this.getJBook()
-
- this.getNewBook()
- },
- // 获取精选图书
- getJBook() {
+ // 获取精选商品
this.$http
.post('book/shopproduct/appGetList?limit=30&page=1&istop=1')
.then(res => {
- console.log(res.page.list, '首页商品')
+ console.log(res.page.list,'首页商品')
this.goodsList = res.page.list
})
+ this.getOffSale()
+ this.getNewBook()
},
+
// 跳转
onPageJump(url) {
uni.navigateTo({
@@ -527,7 +605,7 @@
// 电子书内容跳转
onBookJump(e) {
uni.navigateTo({
- url: '../eBook/bookContent?Id=' + e.id
+ url: '../eBook/bookContent?Id=' + e.bookid
});
},
// 商品详情页
@@ -536,7 +614,7 @@
url: '../bookShop/commodityDetail?id=' + id
});
},
-
+
// 列表跳页
onShopMore(e) {
uni.navigateTo({
@@ -559,62 +637,37 @@
\ No newline at end of file
+