| @@ -6,7 +6,8 @@ | |||||
| "pages/payHistory/payHistory", | "pages/payHistory/payHistory", | ||||
| "pages/chat/chat", | "pages/chat/chat", | ||||
| "pages/orderDetail/orderDetail", | "pages/orderDetail/orderDetail", | ||||
| "pages/userProtocol/userProtocol" | |||||
| "pages/userProtocol/userProtocol", | |||||
| "pages/mine/mine" | |||||
| ], | ], | ||||
| "window": { | "window": { | ||||
| "backgroundTextStyle": "light", | "backgroundTextStyle": "light", | ||||
| @@ -14,6 +15,24 @@ | |||||
| "navigationBarTitleText": "Weixin", | "navigationBarTitleText": "Weixin", | ||||
| "navigationBarTextStyle": "black" | "navigationBarTextStyle": "black" | ||||
| }, | }, | ||||
| "tabBar": { | |||||
| "color": "#9F9F9F", | |||||
| "selectedColor": "#07c160", | |||||
| "list": [ | |||||
| { | |||||
| "pagePath": "pages/index/index", | |||||
| "iconPath": "./asset/icon/Home.png", | |||||
| "selectedIconPath": "./asset/icon/HomeSelect.png", | |||||
| "text": "首页" | |||||
| }, | |||||
| { | |||||
| "pagePath": "pages/mine/mine", | |||||
| "iconPath": "./asset/icon/User.png", | |||||
| "selectedIconPath": "./asset/icon/UserSelect.png", | |||||
| "text": "我的" | |||||
| } | |||||
| ] | |||||
| }, | |||||
| "style": "v2", | "style": "v2", | ||||
| "sitemapLocation": "sitemap.json" | "sitemapLocation": "sitemap.json" | ||||
| } | } | ||||
| @@ -0,0 +1,23 @@ | |||||
| // components/userNumberSync.ts | |||||
| Component({ | |||||
| /** | |||||
| * 组件的属性列表 | |||||
| */ | |||||
| properties: { | |||||
| }, | |||||
| /** | |||||
| * 组件的初始数据 | |||||
| */ | |||||
| data: { | |||||
| }, | |||||
| /** | |||||
| * 组件的方法列表 | |||||
| */ | |||||
| methods: { | |||||
| } | |||||
| }) | |||||
| @@ -0,0 +1,4 @@ | |||||
| { | |||||
| "component": true, | |||||
| "usingComponents": {} | |||||
| } | |||||
| @@ -0,0 +1 @@ | |||||
| /* components/userNumberSync.wxss */ | |||||
| @@ -0,0 +1,2 @@ | |||||
| <!--components/userNumberSync.wxml--> | |||||
| <text>components/userNumberSync.wxml</text> | |||||
| @@ -177,6 +177,21 @@ Page({ | |||||
| } | } | ||||
| }, | }, | ||||
| apply() { | |||||
| request.get({ | |||||
| url: '/api/user/apply' | |||||
| }).then(res => { | |||||
| console.log(res, 'apply'); | |||||
| wx.showToast({ | |||||
| title: '申请成功!', | |||||
| icon: 'success' | |||||
| }) | |||||
| this.checkUserInfo() | |||||
| }).catch(err => { | |||||
| console.log(err, 'err'); | |||||
| }) | |||||
| }, | |||||
| /** | /** | ||||
| * @description 检查用户信息 | * @description 检查用户信息 | ||||
| * @returns userInfo | * @returns userInfo | ||||
| @@ -22,9 +22,8 @@ | |||||
| </view> | </view> | ||||
| <view class="buttons"> | <view class="buttons"> | ||||
| <block wx:if="{{!isDevMode}}"> | <block wx:if="{{!isDevMode}}"> | ||||
| <block wx:if="{{!userInfo.phone}}"> | |||||
| <block wx:if="{{userInfo.isMember == 0 && userInfo.isValid == 0}}"> | |||||
| <view class="userProtocolModel"> | <view class="userProtocolModel"> | ||||
| <view class="textInside"> | <view class="textInside"> | ||||
| <view class="{{isNotRead ? 'agreeButton' : 'agreeButton active'}}" bindtap="agreedClick">√</view> | <view class="{{isNotRead ? 'agreeButton' : 'agreeButton active'}}" bindtap="agreedClick">√</view> | ||||
| @@ -32,33 +31,33 @@ | |||||
| <text class="userProtocol" bindtap="checkUserProtocol">《用户协议及隐私政策》</text> | <text class="userProtocol" bindtap="checkUserProtocol">《用户协议及隐私政策》</text> | ||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| <button type="primary" open-type="getPhoneNumber" bindgetphonenumber="getUserPhone" disabled="{{isNotRead}}">授权手机号使用</button> | |||||
| <button type="primary" bindtap="apply" disabled="{{isNotRead}}">申请使用</button> | |||||
| </block> | </block> | ||||
| <block wx:if="{{userInfo.isMember == 1 && userInfo.isValid == 1}}"> | <block wx:if="{{userInfo.isMember == 1 && userInfo.isValid == 1}}"> | ||||
| <view class="userPhone">当前用户:{{userInfo.coverPhone}}</view> | |||||
| <view wx:if="{{userInfo.coverPhone}}" class="userPhone">当前用户:{{userInfo.coverPhone}}</view> | |||||
| <view class="userPhone" wx:if="{{userInfo.validEndTime}}">到期时间:{{userInfo.validEndTime}}</view> | <view class="userPhone" wx:if="{{userInfo.validEndTime}}">到期时间:{{userInfo.validEndTime}}</view> | ||||
| <view class="payHistory"> | <view class="payHistory"> | ||||
| <text style="margin-right: 20rpx;" bindtap="checkUserProtocol">用户协议</text> | <text style="margin-right: 20rpx;" bindtap="checkUserProtocol">用户协议</text> | ||||
| <text bindtap="checkPayHistory">购买历史</text> | |||||
| <text bindtap="checkPayHistory">延续历史</text> | |||||
| </view> | </view> | ||||
| <button type="primary" bindtap="goToChat">开始聊天</button> | <button type="primary" bindtap="goToChat">开始聊天</button> | ||||
| </block> | </block> | ||||
| <block wx:if="{{userInfo.isMember == 1 && userInfo.isValid == 0}}"> | <block wx:if="{{userInfo.isMember == 1 && userInfo.isValid == 0}}"> | ||||
| <view class="userPhone">当前用户:{{userInfo.coverPhone}}</view> | |||||
| <view wx:if="{{userInfo.coverPhone}}" class="userPhone">当前用户:{{userInfo.coverPhone}}</view> | |||||
| <view class="userPhone" wx:if="{{userInfo.validEndTime}}">到期时间:{{userInfo.validEndTime}}</view> | <view class="userPhone" wx:if="{{userInfo.validEndTime}}">到期时间:{{userInfo.validEndTime}}</view> | ||||
| <view class="payHistory"> | <view class="payHistory"> | ||||
| <text bindtap="checkUserProtocol">用户协议</text> | <text bindtap="checkUserProtocol">用户协议</text> | ||||
| <text bindtap="checkPayHistory">购买历史</text> | |||||
| <text bindtap="checkPayHistory">延续历史</text> | |||||
| </view> | </view> | ||||
| <button type="primary" bindtap="goToBuy">续费会员</button> | |||||
| <button type="primary" bindtap="goToBuy">延续使用</button> | |||||
| </block> | </block> | ||||
| <block wx:if="{{userInfo.phone && userInfo.isMember == 0 && userInfo.isValid == 0}}"> | |||||
| <!-- <block wx:if="{{userInfo.phone && userInfo.isMember == 0 && userInfo.isValid == 0}}"> | |||||
| <view class="userPhone">当前用户:{{userInfo.coverPhone}}</view> | <view class="userPhone">当前用户:{{userInfo.coverPhone}}</view> | ||||
| <button type="primary" bindtap="goToBuy">购买会员</button> | <button type="primary" bindtap="goToBuy">购买会员</button> | ||||
| </block> | |||||
| </block> --> | |||||
| </block> | </block> | ||||
| <block wx:if="{{isDevMode}}"> | <block wx:if="{{isDevMode}}"> | ||||
| @@ -0,0 +1,66 @@ | |||||
| // pages/mine/mine.ts | |||||
| Page({ | |||||
| /** | |||||
| * 页面的初始数据 | |||||
| */ | |||||
| data: { | |||||
| }, | |||||
| /** | |||||
| * 生命周期函数--监听页面加载 | |||||
| */ | |||||
| onLoad() { | |||||
| }, | |||||
| /** | |||||
| * 生命周期函数--监听页面初次渲染完成 | |||||
| */ | |||||
| onReady() { | |||||
| }, | |||||
| /** | |||||
| * 生命周期函数--监听页面显示 | |||||
| */ | |||||
| onShow() { | |||||
| }, | |||||
| /** | |||||
| * 生命周期函数--监听页面隐藏 | |||||
| */ | |||||
| onHide() { | |||||
| }, | |||||
| /** | |||||
| * 生命周期函数--监听页面卸载 | |||||
| */ | |||||
| onUnload() { | |||||
| }, | |||||
| /** | |||||
| * 页面相关事件处理函数--监听用户下拉动作 | |||||
| */ | |||||
| onPullDownRefresh() { | |||||
| }, | |||||
| /** | |||||
| * 页面上拉触底事件的处理函数 | |||||
| */ | |||||
| onReachBottom() { | |||||
| }, | |||||
| /** | |||||
| * 用户点击右上角分享 | |||||
| */ | |||||
| onShareAppMessage() { | |||||
| } | |||||
| }) | |||||
| @@ -0,0 +1,3 @@ | |||||
| { | |||||
| "usingComponents": {} | |||||
| } | |||||
| @@ -0,0 +1 @@ | |||||
| /* pages/mine/mine.wxss */ | |||||
| @@ -0,0 +1,2 @@ | |||||
| <!--pages/mine/mine.wxml--> | |||||
| <text>pages/mine/mine.wxml</text> | |||||
| @@ -8,9 +8,11 @@ Page({ | |||||
| */ | */ | ||||
| data: { | data: { | ||||
| userInfo: {}, | userInfo: {}, | ||||
| salePrice: '', | |||||
| price: '', | |||||
| days: '' | |||||
| firstData: null,// 首充数据 | |||||
| orderList: [], | |||||
| imgUrl: 'https://formall.oss-accelerate.aliyuncs.com/ga/payOrder-1.png', | |||||
| currentIndex: null, | |||||
| currentId: '' | |||||
| }, | }, | ||||
| /** | /** | ||||
| @@ -20,31 +22,77 @@ Page({ | |||||
| this.setData({ | this.setData({ | ||||
| userInfo: JSON.parse(options.userInfo) | userInfo: JSON.parse(options.userInfo) | ||||
| }) | }) | ||||
| this.getProductDetail() | |||||
| // **已弃用 | |||||
| // this.getProductDetail() | |||||
| this.getProductList() | |||||
| }, | }, | ||||
| getProductDetail() { | |||||
| // 获取产品详情(价格、库存等)**已弃用 | |||||
| // getProductDetail() { | |||||
| // const that = this | |||||
| // request.get({ | |||||
| // url: '/api/product/detail', | |||||
| // }).then(res => { | |||||
| // console.log(res, 'getProductDetail'); | |||||
| // that.setData({ | |||||
| // salePrice: res.data.salePrice, | |||||
| // price: res.data.price, | |||||
| // days: res.data.days, | |||||
| // }) | |||||
| // }).catch(err => { | |||||
| // console.log(err, 'err'); | |||||
| // }) | |||||
| // }, | |||||
| getProductList() { | |||||
| const that = this | const that = this | ||||
| request.get({ | request.get({ | ||||
| url: '/api/product/detail', | |||||
| url: '/api/product/list', | |||||
| }).then(res => { | }).then(res => { | ||||
| console.log(res, 'getProductDetail'); | |||||
| that.setData({ | |||||
| salePrice: res.data.salePrice, | |||||
| price: res.data.price, | |||||
| days: res.data.days, | |||||
| }) | |||||
| console.log(res, 'getProductList'); | |||||
| const firstData = res.data.filter(item => item.first == 1) | |||||
| // 首充数据 | |||||
| if (firstData.length) { | |||||
| const data = { | |||||
| days: firstData[0].days, | |||||
| price: firstData[0].price, | |||||
| salePrice: firstData[0].salePrice, | |||||
| } | |||||
| this.setData({ | |||||
| firstData: data | |||||
| }) | |||||
| // 非首冲数据 | |||||
| } else { | |||||
| this.setData({ | |||||
| orderList: res.data | |||||
| }) | |||||
| } | |||||
| }).catch(err => { | }).catch(err => { | ||||
| console.log(err, 'err'); | console.log(err, 'err'); | ||||
| }) | }) | ||||
| }, | }, | ||||
| selectItem(e) { | |||||
| const index = e.currentTarget.dataset.index | |||||
| const id = e.currentTarget.dataset.id | |||||
| const currentIndex = this.data.currentIndex | |||||
| this.setData({ | |||||
| currentIndex: index == currentIndex ? null : index, | |||||
| currentId: index == currentIndex ? '' : id | |||||
| }) | |||||
| }, | |||||
| createPayOrder() { | createPayOrder() { | ||||
| const data = { | |||||
| appId: request.appId | |||||
| } | |||||
| if (this.data.currentId) { | |||||
| data.id = this.data.currentId | |||||
| } | |||||
| request.post({ | request.post({ | ||||
| url: '/api/pay/createPayOrder', | url: '/api/pay/createPayOrder', | ||||
| data: { | |||||
| appId: request.appId | |||||
| } | |||||
| data | |||||
| }).then(res => { | }).then(res => { | ||||
| console.log(res, 'createPayOrder'); | console.log(res, 'createPayOrder'); | ||||
| this.requestPayment(res.data.data) | this.requestPayment(res.data.data) | ||||
| @@ -1,4 +1,5 @@ | |||||
| { | { | ||||
| "navigationBarTitleText": "购买会员", | |||||
| "navigationBarTitleText": "延续会员", | |||||
| "navigationBarBackgroundColor": "#ededed", | |||||
| "usingComponents": {} | "usingComponents": {} | ||||
| } | } | ||||
| @@ -1,3 +1,7 @@ | |||||
| page { | |||||
| background-color: #ededed; | |||||
| } | |||||
| .content { | .content { | ||||
| padding: 50rpx 0; | padding: 50rpx 0; | ||||
| @@ -35,13 +39,15 @@ | |||||
| text-align: center; | text-align: center; | ||||
| margin: auto; | margin: auto; | ||||
| .payInfo { | |||||
| .firstPayInfo { | |||||
| position: relative; | |||||
| width: 550rpx; | width: 550rpx; | ||||
| height: 200rpx; | height: 200rpx; | ||||
| border: 1px dashed #9f9b88; | border: 1px dashed #9f9b88; | ||||
| border-radius: 30rpx; | border-radius: 30rpx; | ||||
| background-color: #f7f7f7; | background-color: #f7f7f7; | ||||
| margin: 50rpx auto; | margin: 50rpx auto; | ||||
| overflow: hidden; | |||||
| .saleInfo { | .saleInfo { | ||||
| font-size: 45rpx; | font-size: 45rpx; | ||||
| @@ -69,6 +75,90 @@ | |||||
| font-weight: 600; | font-weight: 600; | ||||
| } | } | ||||
| } | } | ||||
| .firstCharge { | |||||
| position: absolute; | |||||
| top: 28rpx; | |||||
| right: -50rpx; | |||||
| width: 200rpx; | |||||
| height: 40rpx; | |||||
| font-size: 25rpx; | |||||
| transform: rotate(45deg); | |||||
| background-color: red; | |||||
| color: #ffffff; | |||||
| } | |||||
| } | |||||
| .payInfo { | |||||
| width: 650rpx; | |||||
| background-color: #ffffff; | |||||
| border-radius: 25rpx; | |||||
| margin: 50rpx auto; | |||||
| padding-bottom: 40rpx; | |||||
| .continue { | |||||
| text-align: left; | |||||
| padding: 25rpx; | |||||
| margin-bottom: 20rpx; | |||||
| .grey { | |||||
| margin-left: 15rpx; | |||||
| font-size: 23rpx; | |||||
| color: #a3a3a3; | |||||
| } | |||||
| } | |||||
| .infoBox { | |||||
| display: flex; | |||||
| justify-content: space-between; | |||||
| align-items: center; | |||||
| flex-flow: row wrap; | |||||
| padding: 0 25rpx; | |||||
| .item { | |||||
| width: 180rpx; | |||||
| height: 180rpx; | |||||
| background-color: #f2f5fa; | |||||
| border-radius: 20rpx; | |||||
| padding: 20rpx; | |||||
| margin-bottom: 30rpx; | |||||
| box-sizing: border-box; | |||||
| border: 5rpx solid #f2f5fa; | |||||
| transition: all 0.4s; | |||||
| &.active { | |||||
| border: 5rpx solid #666666; | |||||
| } | |||||
| .remainDays { | |||||
| font-size: 38rpx; | |||||
| font-weight: 600; | |||||
| margin-bottom: 10rpx; | |||||
| .days { | |||||
| font-size: 28rpx; | |||||
| margin-left: 10rpx; | |||||
| } | |||||
| } | |||||
| .salePrice { | |||||
| font-size: 28rpx; | |||||
| margin-bottom: 10rpx; | |||||
| .lightHigh { | |||||
| color: #ff0000; | |||||
| } | |||||
| } | |||||
| .price { | |||||
| font-size: 22rpx; | |||||
| text-decoration: line-through; | |||||
| color: #727272; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | } | ||||
| .btn { | .btn { | ||||
| @@ -1,23 +1,39 @@ | |||||
| <!--pages/payOrder.wxml--> | <!--pages/payOrder.wxml--> | ||||
| <view class="content"> | <view class="content"> | ||||
| <view class="backGround"> | <view class="backGround"> | ||||
| <image src="../../asset/image/payOrder.png" mode="" /> | |||||
| <image src="{{imgUrl}}" mode="" /> | |||||
| </view> | </view> | ||||
| <view class="orderList"> | <view class="orderList"> | ||||
| <view class="payInfo"> | |||||
| <view class="firstPayInfo" wx:if="{{firstData}}"> | |||||
| <view class="saleInfo"> | <view class="saleInfo"> | ||||
| 售价: | 售价: | ||||
| <text class="salePrice">{{salePrice / 100 }}</text> | |||||
| <text class="price">{{price / 100}}</text> | |||||
| <text class="salePrice">{{firstData.salePrice / 100 }}</text> | |||||
| <text class="price">{{firstData.price / 100}}</text> | |||||
| 元 | 元 | ||||
| </view> | </view> | ||||
| <view class="validInfo"> | <view class="validInfo"> | ||||
| 有效期:自购买日起 | 有效期:自购买日起 | ||||
| <text class="day">{{days}}</text> | |||||
| <text class="day">{{firstData.days}}</text> | |||||
| 天 | 天 | ||||
| </view> | </view> | ||||
| <view class="firstCharge">首充优惠</view> | |||||
| </view> | </view> | ||||
| <view class="payInfo" wx:else> | |||||
| <view class="continue"> | |||||
| <text>延续会员</text> | |||||
| <text class="grey">有效期:自购买日起/天</text> | |||||
| </view> | |||||
| <view class="infoBox"> | |||||
| <view wx:for="{{orderList}}" class="{{currentIndex == index ? 'item active' : 'item'}}" wx:key="index" bindtap="selectItem" data-index="{{index}}" data-id="{{item.id}}"> | |||||
| <view class="remainDays">{{item.days}}<text class="days">天</text></view> | |||||
| <view class="salePrice">特价<text class="lightHigh">{{item.salePrice / 100}}</text>元</view> | |||||
| <view class="price">原价{{item.price / 100}}元</view> | |||||
| </view> | |||||
| </view> | |||||
| </view> | |||||
| <button class="btn" type="primary" bindtap="createPayOrder">立即购买</button> | <button class="btn" type="primary" bindtap="createPayOrder">立即购买</button> | ||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| @@ -33,7 +33,10 @@ | |||||
| "miniprogram/pages/payOrder/payOrder.js", | "miniprogram/pages/payOrder/payOrder.js", | ||||
| "miniprogram/pages/payHistory/payHistory.js", | "miniprogram/pages/payHistory/payHistory.js", | ||||
| "miniprogram/pages/chat/chat.js", | "miniprogram/pages/chat/chat.js", | ||||
| "miniprogram/pages/orderDetail/orderDetail.js", "miniprogram/pages/userProtocol/userProtocol.js", | |||||
| "miniprogram/pages/orderDetail/orderDetail.js", | |||||
| "miniprogram/pages/userProtocol/userProtocol.js", | |||||
| "miniprogram/pages/mine/mine.js", | |||||
| "miniprogram/components/userNumberSync.js", | |||||
| ], | ], | ||||
| "exclude": [ | "exclude": [ | ||||
| "node_modules" | "node_modules" | ||||