From 45cb5d66f7c6a0df5949e81ce55d9e2ef4141369 Mon Sep 17 00:00:00 2001 From: "@fawn-nine" <1271023382@qq.com> Date: Thu, 9 Mar 2023 17:13:31 +0800 Subject: [PATCH] =?UTF-8?q?0309=20=E5=90=AC=E4=B9=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- manifest.json | 2 +- pages/bookShop/classify.vue | 40 ++-- pages/bookShop/commodityDetail.vue | 12 +- pages/bookShop/settlement.vue | 101 ++++++++-- pages/eBook/bookContent.vue | 6 +- pages/peanut/home.vue | 6 +- pages/peanut/opeVip.vue | 106 +++++++++-- pages/yRead/angbook.vue | 291 +++++++++++++++-------------- 8 files changed, 367 insertions(+), 197 deletions(-) diff --git a/manifest.json b/manifest.json index e73f2f2..96ff3aa 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "name" : "E-crazy", - "appid" : "__UNI__23F6060", + "appid" : "__UNI__9788EB5", "description" : "E-crazy-案例", "transformPx" : false, "icons" : [ diff --git a/pages/bookShop/classify.vue b/pages/bookShop/classify.vue index 2f332f8..e5b165b 100644 --- a/pages/bookShop/classify.vue +++ b/pages/bookShop/classify.vue @@ -9,7 +9,7 @@ :activeStyle="{color: '#303133',fontWeight: 'bold', transform: 'scale(1.01)'}"> - + 搜索... @@ -36,15 +36,15 @@ ¥ - {{item.price}}折后价 + {{item.price}} + 原价:¥{{item.activityPrice}} - - 已售400 + 已售{{item.sumSales}} - - 张三1著/ xx出版社出版 + + {{item.author}}著/ {{item.publisher}} @@ -79,13 +79,7 @@ }, // contentButtonClick(e) { // console.log(e) - // }, - // 跳转 - onPageJump(url) { - uni.navigateTo({ - url: url - }); - }, + // }, // onLoad(e) { // //获取一级分类 // this.$http @@ -104,6 +98,12 @@ ...mapState(['userInfo']), }, methods: { + // 跳转 + onPageJump(url) { + uni.navigateTo({ + url: url + }); + }, // 获取一级分类 getOneLevel() { this.$http @@ -123,9 +123,17 @@ if (this.towLevel == '') { this.commodityList = [] } else { + let newo = { + catId:0, + name:'全部', + parentCid:e.catId + } + this.towLevel.splice(0,0,newo) + // this.getCategoryList(res.list[0]) + // console.log(this.towLevel, 'towLevel') this.getCategoryList(res.list[0]) } - + }) }, @@ -372,9 +380,9 @@ .priceTag { flex-direction: row; - color: #f56c6c; + color: #999; display: inline-block; - zoom: .7; + zoom: .8; margin-left: 6rpx; margin-bottom: 6px; } diff --git a/pages/bookShop/commodityDetail.vue b/pages/bookShop/commodityDetail.vue index 06add17..a6a07a7 100644 --- a/pages/bookShop/commodityDetail.vue +++ b/pages/bookShop/commodityDetail.vue @@ -30,15 +30,17 @@ 书名:{{productInfo.productName}} 作者:{{productInfo.author}} - + + 出版社:{{productInfo.publisher}} - 出版时间:{{ productInfo.pubDate | formatDate }} - + 出版时间:{{ productInfo.pubDate | formatDate }} + + 开本:{{productInfo.format}} 页数:{{productInfo.pageNum}} - - + + 内文用纸材质:{{productInfo.quality}} diff --git a/pages/bookShop/settlement.vue b/pages/bookShop/settlement.vue index 95231f8..c3fe8b8 100644 --- a/pages/bookShop/settlement.vue +++ b/pages/bookShop/settlement.vue @@ -39,7 +39,7 @@ ¥{{item.price*item.productAmount}} + :input-height="20" :min="1" :max="item.productStock" integer > @@ -72,29 +72,39 @@ - + {{item.title}} + {{userMes.peanutCoin}}疯币可用 + 去充值 + style="float: right;margin-top: 5rpx;" > - - + + 实付款: {{realPrice}} - + + 实付款: + {{realPrice}}疯币 + + 立即支付 - - + + + 立即支付 + + + @@ -185,6 +195,7 @@ shangIDNum: 0, cartIDNum: [], cartList: [], + userMes:{}, // 用户信息 amount:null, // 商品总价 addressList: [], adressMoRen: {}, @@ -206,7 +217,12 @@ title: '支付宝', id: 1, img: '../../static/icon/pay_1.png' - } + }, + { + title: '疯币购买', + id: 4, + img: '../../static/icon/oder_chong.png' + } // { // title: '微信', // id: 2, @@ -231,19 +247,41 @@ // this.getYunFei() }, - onShow() { + onShow() { if (this.typeId == 1) { this.getCartList() } else if (this.typeId == 0) { this.getShangList(this.shangIDNum); } - // this.getUserAddress() + this.getData() }, computed: { ...mapState(['userInfo']), }, methods: { + // 充值疯币 + buPoint() { + uni.navigateTo({ + url: '../peanut/reCharge' + }); + }, + getData() { + let that = this + // 获取个人信息 + // 用户详情 + if (this.userInfo.id != undefined) { + this.$http + .post('book/user/info/' + this.userInfo.id) + .then(res => { + this.userMes = res.user + // consol.log(this.userMes.peanutCoin,'呼呼') + if (this.userMes.vip != 0) { + this.typeFen = 2 + } + }); + } + }, // 获取地址列表 getUserAddress() { this.$http @@ -264,7 +302,18 @@ } }) }, - + goPoinBuy(){ + if(this.realPrice > this.userMes.peanutCoin){ + uni.showToast({ + title:'疯币不足,请充值', + icon: 'error', + duration: 2000 + }) + return + }else{ + this.goBuyJie() + } + }, // 获取优惠券列表 getCourpe() { let proId = '' @@ -470,7 +519,7 @@ city: this.adressMoRen.areaidpathtext.split(' ')[1], //市 district: this.adressMoRen.areaidpathtext.split(' ')[2], //区 address: this.adressMoRen.useraddress, //地址 - paymentMethod: this.payType, //支付方式 1支付宝,2微信,3ios内购 + paymentMethod: this.payType, //支付方式 2支付宝,1微信,3ios内购 4,疯币购买 orderMoney: this.totalPrice, //订单金额 realMoney: this.realPrice, //实收金额 shippingMoney: this.farePrice, //运费 @@ -482,8 +531,7 @@ products: xiaBiao, //订单列表 orderType: "order", //订单类型 addressId:this.adressMoRen.addressid // 地址ID - } - + } $http.request({ url: "book/buyorder/save", method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档 @@ -500,6 +548,8 @@ image: '../../static/icon/ic_close.png' }); } else { + if(this.payType != 4){ + // 常规支付 uni.showToast({ title: "正在支付", icon: "loading" @@ -534,6 +584,18 @@ }, 1000) } }) + }else{ + // 疯币支付 + uni.showToast({ + title: "购买成功", + icon: "success" + }); + setTimeout(() => { + uni.navigateTo({ + url: './orderList' + }); + }, 1000) + } } @@ -875,4 +937,13 @@ border-color: #fd6004; } } + .chongBtn { + background-color: #54a966; + color: #fff !important; + margin-left: 20rpx; + border-radius: 10rpx; + padding: 2rpx 10rpx; + font-size: 20rpx; + display: inline-block; + } diff --git a/pages/eBook/bookContent.vue b/pages/eBook/bookContent.vue index f167809..292db0b 100644 --- a/pages/eBook/bookContent.vue +++ b/pages/eBook/bookContent.vue @@ -402,11 +402,9 @@ onPageJump(url) { uni.navigateTo({ url: url - }); - + }); }, - // 电子书阅读跳转 onBokReadJump(e) { const that = this; @@ -474,7 +472,7 @@ // 充值疯币 buPoint() { uni.navigateTo({ - url: '../../peanut/reCharge' + url: '../peanut/reCharge' }); }, diff --git a/pages/peanut/home.vue b/pages/peanut/home.vue index fadf038..08a49c2 100644 --- a/pages/peanut/home.vue +++ b/pages/peanut/home.vue @@ -66,7 +66,7 @@ - + @@ -266,7 +266,8 @@ this.$http .get(`book/shopseckill/getSeckillProd`) .then(res => { - this.seckillList = res.list + //this.seckillList = res.list + this.seckillList = null }) // 获取精选商品 @@ -309,7 +310,6 @@ url: '../eBook/bookContent?Id=' + e.bookid }); }, - // 商品详情页 goDetail(id) { uni.navigateTo({ diff --git a/pages/peanut/opeVip.vue b/pages/peanut/opeVip.vue index 15e36e9..06dbccd 100644 --- a/pages/peanut/opeVip.vue +++ b/pages/peanut/opeVip.vue @@ -47,7 +47,7 @@ 服务类型 - + {{item.description}} @@ -66,6 +66,8 @@ {{item.title}} + {{userMes.peanutCoin}}疯币可用 + 去充值 @@ -76,7 +78,7 @@ * 我已阅读并同意《会员服务协议》 - 立即开通会员 + 立即开通会员 @@ -95,12 +97,19 @@ return { stepsVc: {}, vcList: [], - payType: 2, - paylist: [{ - title: '支付宝', - id: 1, - img: '../../static/icon/pay_1.png' - } + userMes:{}, + payType: 4, + paylist: [ + // { + // title: '支付宝', + // id: 1, + // img: '../../static/icon/pay_1.png' + // }, + { + title: '疯币充值', + id: 4, + img: '../../static/icon/oder_chong.png' + } // { // title: '微信', // id: 2, @@ -117,6 +126,7 @@ }, //页面显示 onShow() { + this.getDataPoint() // 隐藏原生的tabbar uni.hideTabBar(); }, @@ -125,6 +135,40 @@ }, //方法 methods: { + goPoinBuy(){ + if(this.stepsVc.money > this.userMes.peanutCoin){ + uni.showToast({ + title:'疯币不足,请充值', + icon: 'error', + duration: 2000 + }) + return + }else{ + this.kaiVip() + } + }, + // 充值疯币 + buPoint() { + uni.navigateTo({ + url: '../peanut/reCharge' + }); + }, + getDataPoint() { + let that = this + // 获取个人信息 + // 用户详情 + if (this.userInfo.id != undefined) { + this.$http + .post('book/user/info/' + this.userInfo.id) + .then(res => { + this.userMes = res.user + // consol.log(this.userMes.peanutCoin,'呼呼') + if (this.userMes.vip != 0) { + this.typeFen = 2 + } + }); + } + }, // 获取会员类型 getData() { let that = this @@ -151,7 +195,7 @@ that.payType = e }, - // 开通vip + // 开通vip 常规支付 kaiVip() { let that = this @@ -165,7 +209,6 @@ orderStatus: 0, //订单状态 orderType: "vip", //订单类型 } - $http.request({ url: "book/buyorder/rechargeSave", method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档 @@ -175,6 +218,8 @@ }, }).then(res => { if (res.code == 0) { + console.log(res) + if(that.payType != 4){ setPay({ typePay: 'alipay', subject: 'vip', @@ -195,6 +240,37 @@ }); } }) + }else{ + console.log(that.userMes) + this.$http + .post('book/user/openVipByVirtualCoin', { + 'configId': that.stepsVc.priceTypeId, + 'userId': that.userMes.id, + 'orderSn':res.orderSn + }) + .then(res => { + if(res.code == 0){ + console.log(res, 'res') + uni.showToast({ + title: "充值成功", + icon:'success', + duration:2000 + }); + setTimeout(()=>{ + uni.navigateTo({ + url: '../bookShop/orderList' + }); + },1000) + } + + }) + } + }else{ + uni.showToast({ + title: "下单失败", + icon:'Error', + duration:2000 + }); } }) @@ -214,7 +290,15 @@