| @@ -52,6 +52,7 @@ | |||
| "pages/payrule/payrule", | |||
| "pages/grade/grade", | |||
| "pages/exchange/exchange", | |||
| "pages/exchangeCard/exchangeCard", | |||
| "pages/game/index", | |||
| "pages/canvas/index", | |||
| "pages/specialcourtesy/specialcourtesy", | |||
| @@ -137,6 +137,14 @@ | |||
| <view class="particulars_go">></view> | |||
| </view> | |||
| </navigator> | |||
| <navigator url="/pages/exchangeCard/exchangeCard" open-type="navigate"> | |||
| <view class="particulars_list"> | |||
| <view class="particulars_name">录入实体卡</view> | |||
| <view class="particulars_go">></view> | |||
| </view> | |||
| </navigator> | |||
| <navigator url="/pages/questionnaire/questionnaireLsit/questionnaireLsit" open-type="navigate"> | |||
| <view class="particulars_list"> | |||
| <view class="particulars_name">问券调查</view> | |||
| @@ -9,33 +9,54 @@ Page({ | |||
| * 页面的初始数据 | |||
| */ | |||
| data: { | |||
| navigationBarHeight | |||
| navigationBarHeight, | |||
| code: "" | |||
| }, | |||
| // 兑换 | |||
| exchange(e){ | |||
| exchange(e) { | |||
| console.log(e, 'e'); | |||
| let that = this; | |||
| let code = e.detail.value.code; | |||
| let formId = e.detail.formId; | |||
| if (!code || !code.replace(/\s*/g, "")){ | |||
| if (!code || !code.replace(/\s*/g, "")) { | |||
| wx.showToast({ | |||
| title: '请输入兑换码', | |||
| icon:"none", | |||
| duration:2500 | |||
| icon: "none", | |||
| duration: 2500 | |||
| }) | |||
| return; | |||
| } | |||
| that.checkPhoneStatus(e.detail.value.code,formId = e.detail.formId); | |||
| that.checkPhoneStatus(code, formId); | |||
| }, | |||
| goScanCode() { | |||
| console.log('scan!!!'); | |||
| const that = this | |||
| wx.scanCode({ | |||
| success: (res) => { | |||
| console.log(res, 'res'); | |||
| const num = res.result | |||
| that.setData({ | |||
| code: num | |||
| }) | |||
| that.exchange({ detail: { value: num } }) | |||
| }, | |||
| fail: (res) => { | |||
| console.log(res, 'fail'); | |||
| } | |||
| }) | |||
| }, | |||
| checkPhoneStatus: function (password, formId) { | |||
| let that = this; | |||
| Http.get({ | |||
| url: config.api.checkPhoneStatus, | |||
| data: {} | |||
| }) | |||
| .then(res => { | |||
| that.getCouponOrderByPassword(password, formId); | |||
| }) | |||
| .catch(err => { | |||
| .then(res => { | |||
| that.getCouponOrderByPassword(password, formId); | |||
| }) | |||
| .catch(err => { | |||
| if (err.code == 11005) { | |||
| /** | |||
| * 手机号没有授权,将值传到用户手机号授权的页面 | |||
| @@ -51,7 +72,7 @@ Page({ | |||
| duration: 2500 | |||
| }) | |||
| } | |||
| }) | |||
| }) | |||
| }, | |||
| getCouponOrderByPassword(password, formId) { | |||
| let that = this; | |||
| @@ -62,34 +83,34 @@ Page({ | |||
| formId: formId | |||
| } | |||
| }) | |||
| .then(res => { | |||
| wx.showModal({ | |||
| title: '兑换成功', | |||
| content: '消费卡已发放到"我的卡包"', | |||
| showCancel: true, | |||
| cancelText: "知道了", | |||
| cancelColor: '', | |||
| confirmText: "去查看", | |||
| confirmColor: '#FD832D', | |||
| success: function (res) { | |||
| if (res.cancel) { | |||
| //点击取消,默认隐藏弹框 | |||
| } else { | |||
| wx.redirectTo({ | |||
| url: '/pages/cardorder/index/index', | |||
| }) | |||
| } | |||
| }, | |||
| fail: function (res) { },//接口调用失败的回调函数 | |||
| complete: function (res) { },//接口调用结束的回调函数(调用成功、失败都会执行) | |||
| .then(res => { | |||
| wx.showModal({ | |||
| title: '兑换成功', | |||
| content: '消费卡已发放到"我的卡包"', | |||
| showCancel: true, | |||
| cancelText: "知道了", | |||
| cancelColor: '', | |||
| confirmText: "去查看", | |||
| confirmColor: '#FD832D', | |||
| success: function (res) { | |||
| if (res.cancel) { | |||
| //点击取消,默认隐藏弹框 | |||
| } else { | |||
| wx.redirectTo({ | |||
| url: '/pages/cardorder/index/index', | |||
| }) | |||
| } | |||
| }, | |||
| fail: function (res) { },//接口调用失败的回调函数 | |||
| complete: function (res) { },//接口调用结束的回调函数(调用成功、失败都会执行) | |||
| }) | |||
| }) | |||
| }) | |||
| .catch(err => { | |||
| wx.showToast({ | |||
| title: err.message, | |||
| icon: 'none', | |||
| duration: 2000 | |||
| .catch(err => { | |||
| wx.showToast({ | |||
| title: err.message, | |||
| icon: 'none', | |||
| duration: 2000 | |||
| }) | |||
| }) | |||
| }) | |||
| } | |||
| }) | |||
| @@ -1,11 +1,13 @@ | |||
| <navbar text="兑换" home back background='#FD832D' color="white"></navbar> | |||
| <view style="height:{{navigationBarHeight}} "></view> | |||
| <form bindsubmit='exchange' report-submit='true'> | |||
| <view class="section" > | |||
| <input name='code'placeholder="请输入兑换码" clearable/> | |||
| <button size="{{primarySize}}" style="background:#FD832D;color:#fff;" hover-class="opcaity" form-type="submit">兑换</button> | |||
| <view class="section"> | |||
| <input name='code' placeholder="请输入兑换码" clearable value="{{code}}" /> | |||
| <button size="{{primarySize}}" style="background:#FD832D;color:#fff;" hover-class="opcaity" form-type="submit">兑换</button> | |||
| <image class="scan" src="../../assets/images/scan.png" bindtap="goScanCode"></image> | |||
| </view> | |||
| </form> | |||
| <view class="comment"> | |||
| <text class="txt1">如何获取兑换码?</text> | |||
| <text class="txt2">1.实体卡卡密可刮开卡背面涂层查看;</text> | |||
| @@ -1,12 +1,15 @@ | |||
| /* pages/exchange/exchange.wxss */ | |||
| .section{ | |||
| .section { | |||
| padding: 20rpx 20rpx; | |||
| } | |||
| .section{ | |||
| .section { | |||
| position: relative; | |||
| display: flex; | |||
| flex: 5; | |||
| } | |||
| .section input{ | |||
| .section input { | |||
| flex: 3; | |||
| border: 1px solid #ccc; | |||
| border-radius: 10rpx; | |||
| @@ -16,29 +19,45 @@ | |||
| padding-left: 20rpx; | |||
| margin-right: 10rpx; | |||
| } | |||
| .section button{ | |||
| .section button { | |||
| flex: 1; | |||
| height: 74rpx; | |||
| line-height: 74rpx; | |||
| font-size: 30rpx; | |||
| } | |||
| .comment{ | |||
| .section .scan { | |||
| position: absolute; | |||
| right: 255rpx; | |||
| bottom: 37rpx; | |||
| width: 40rpx; | |||
| height: 40rpx; | |||
| z-index: 999; | |||
| } | |||
| .comment { | |||
| padding: 0 20rpx; | |||
| margin-top: 60rpx; | |||
| } | |||
| .comment text{ | |||
| .comment text { | |||
| display: block; | |||
| } | |||
| .txt1{ | |||
| .txt1 { | |||
| margin-top: 30rpx; | |||
| font-size: 34rpx; | |||
| margin-bottom: 20rpx; | |||
| } | |||
| .txt2,.txt3{ | |||
| .txt2, | |||
| .txt3 { | |||
| font-size: 30rpx; | |||
| line-height: 40rpx; | |||
| color: #999; | |||
| } | |||
| .opcaity{ | |||
| .opcaity { | |||
| opacity: .6; | |||
| } | |||
| @@ -0,0 +1,163 @@ | |||
| const navigationBarHeight = (getApp().statusBarHeight + 60) + 'px' | |||
| const util = require("../../utils/util.js"); | |||
| const Http = require("../../utils/HttpBasics"); | |||
| const config = require("../../config/config"); | |||
| const imgurl = require("../../utils/imgurl"); | |||
| Page({ | |||
| /** | |||
| * 页面的初始数据 | |||
| */ | |||
| data: { | |||
| navigationBarHeight, | |||
| tabIndex: 0, | |||
| pdwSwitch: 0, | |||
| isShowPwd: false, | |||
| isChangePhone: false, | |||
| code: "", | |||
| name: "叶文沁", | |||
| phone: "1379****591", | |||
| tempPhone: '', | |||
| password: '' | |||
| }, | |||
| // 兑换 | |||
| exchange(e) { | |||
| console.log(e, 'e'); | |||
| let that = this; | |||
| let code = e.detail.value.code; | |||
| console.log(code); | |||
| }, | |||
| // 更改手机号 | |||
| changePhone() { | |||
| this.setData({ | |||
| isChangePhone: true, | |||
| tempPhone: this.data.phone | |||
| }) | |||
| }, | |||
| // 输入手机号 | |||
| phoneInput(e) { | |||
| this.setData({ | |||
| phone: e.detail.value | |||
| }) | |||
| }, | |||
| // 输入密码 | |||
| pwdInput(e) { | |||
| this.setData({ | |||
| password: e.detail.value, | |||
| }) | |||
| }, | |||
| // 确认手机号更改 | |||
| confirmPhone() { | |||
| const phoneReg = /^(?:(?:\+|00)86)?1[3-9]\d{9}$/ | |||
| const phoneValid = phoneReg.test(this.data.phone) | |||
| if (!phoneValid) { | |||
| wx.showToast({ | |||
| title: '请输入正确的手机号!', | |||
| icon: 'none' | |||
| }) | |||
| return | |||
| } | |||
| this.setData({ | |||
| isChangePhone: false, | |||
| }) | |||
| }, | |||
| // 取消更改 | |||
| cancelChangePhone() { | |||
| this.setData({ | |||
| isChangePhone: false, | |||
| phone: this.data.tempPhone | |||
| }) | |||
| }, | |||
| // 更改tab栏 | |||
| changeTabs(e) { | |||
| console.log(e, 'changeTabs'); | |||
| this.setData({ | |||
| tabIndex: e.target.id, | |||
| code: '', | |||
| password: '' | |||
| }) | |||
| }, | |||
| // 支付安全设置 | |||
| securityChange(e) { | |||
| this.setData({ | |||
| pdwSwitch: e.detail.value * 1 | |||
| }) | |||
| }, | |||
| // 扫描二维码 | |||
| goScanCode() { | |||
| console.log('scan!!!'); | |||
| const that = this | |||
| wx.scanCode({ | |||
| success: (res) => { | |||
| console.log(res, 'res'); | |||
| const num = res.result | |||
| that.setData({ | |||
| code: num | |||
| }) | |||
| that.exchange({ detail: { value: num } }) | |||
| }, | |||
| fail: (res) => { | |||
| console.log(res, 'fail'); | |||
| } | |||
| }) | |||
| }, | |||
| setPwdShow() { | |||
| const isShowPwd = this.data.isShowPwd | |||
| this.setData({ | |||
| isShowPwd: !isShowPwd | |||
| }) | |||
| }, | |||
| submit() { | |||
| const thisData = this.data | |||
| const data = { | |||
| name: thisData.name, | |||
| phone: thisData.phone, | |||
| pdwSwitch: thisData.pdwSwitch, | |||
| password: thisData.password, | |||
| } | |||
| console.log(data, 'submitData'); | |||
| }, | |||
| goGive() { }, | |||
| // 检查用户登录状态 | |||
| checkPhoneStatus() { | |||
| let that = this; | |||
| Http.get({ | |||
| url: config.api.checkPhoneStatus, | |||
| }) | |||
| .then(res => { | |||
| }) | |||
| .catch(err => { | |||
| if (err.code == 11005) { | |||
| // 手机号没有授权,将值传到用户手机号授权的页面 | |||
| wx.redirectTo({ | |||
| url: "/pages/getphoneInfo/index", | |||
| }) | |||
| } else { | |||
| wx.showToast({ | |||
| title: err.message, | |||
| icon: 'none', | |||
| duration: 2500 | |||
| }) | |||
| } | |||
| }) | |||
| }, | |||
| onLoad() { | |||
| setTimeout(() => { | |||
| this.checkPhoneStatus() | |||
| }, 2000); | |||
| } | |||
| }) | |||
| @@ -0,0 +1,5 @@ | |||
| { | |||
| "usingComponents": { | |||
| "navbar": "../../components/navbar/navbar" | |||
| } | |||
| } | |||
| @@ -0,0 +1,63 @@ | |||
| <navbar text="录入实体卡" home back background='#FD832D' color="white"></navbar> | |||
| <view style="height:{{navigationBarHeight}} "></view> | |||
| <view class="tab" bindtap="changeTabs"> | |||
| <view class="{{tabIndex == 0 ? 'tabItem active' : 'tabItem'}}" id="0">绑定</view> | |||
| <view class="{{tabIndex == 1 ? 'tabItem active' : 'tabItem'}}" id="1">转增</view> | |||
| </view> | |||
| <form bindsubmit='exchange' report-submit='true'> | |||
| <view class="section"> | |||
| <input name='code' placeholder="请输入卡号或扫描二维码" clearable value="{{code}}" /> | |||
| <button size="primarySize" style="background:#FD832D;color:#fff;" hover-class="opcaity" form-type="submit">查询</button> | |||
| <image class="scan" src="../../assets/images/scan.png" bindtap="goScanCode"></image> | |||
| </view> | |||
| </form> | |||
| <view class="infoCard"> | |||
| <view class="name">持卡人姓名:{{name}}</view> | |||
| <view wx:if="{{!isChangePhone}}" class="phone">持卡人手机号:{{phone}} <text class="changePhone" bindtap="changePhone">更改</text></view> | |||
| <view wx:if="{{isChangePhone}}" class="phone">持卡人手机号: | |||
| <input class="phoneInput" type="text" placeholder="请填写手机号" focus="true" bindinput="phoneInput" /> | |||
| <text class="confirmPhone" bindtap="confirmPhone">确定</text> | |||
| <text class="cancelChangePhone" bindtap="cancelChangePhone">取消</text> | |||
| </view> | |||
| <view class="security"> | |||
| <text>支付安全设置:</text> | |||
| <radio-group wx:if="{{tabIndex == 0}}" class="radioGroup" bindchange="securityChange"> | |||
| <label> | |||
| <radio value="0" checked="true" />无验证 | |||
| </label> | |||
| <label> | |||
| <radio value="1" />密码验证 | |||
| </label> | |||
| </radio-group> | |||
| <radio-group wx:if="{{tabIndex == 1}}" class="radioGroup" bindchange="securityChange"> | |||
| <label> | |||
| <radio value="0" checked="true" />无验证 | |||
| </label> | |||
| </radio-group> | |||
| </view> | |||
| <view wx:if="{{pdwSwitch && tabIndex == 0}}" class="pwdBox"> | |||
| <view wx:if="{{!isShowPwd}}" style="margin-bottom: 0;"> | |||
| <input type="password" placeholder="请设置密码" placeholder-class="pwdBoxInside" focus="true" bindinput="pwdInput" value="{{password}}" /> | |||
| <image class=" eye" src="../../assets/images/password-show.png" bindtap="setPwdShow"></image> | |||
| </view> | |||
| <view wx:if="{{isShowPwd}}" style="margin-bottom: 0;"> | |||
| <input type="text" placeholder="请设置密码" placeholder-class="pwdBoxInside" value="{{password}}" bindinput="pwdInput" /> | |||
| <image class="eye" src="../../assets/images/password-close.png" bindtap="setPwdShow"></image> | |||
| </view> | |||
| </view> | |||
| </view> | |||
| <view class="btns"> | |||
| <!-- 绑定 --> | |||
| <button wx:if="{{tabIndex == 0}}" type="primary" bindtap="submit">确认绑定</button> | |||
| <!-- 转赠 --> | |||
| <button wx:if="{{tabIndex == 1}}" type="primary" bindtap="goGive">去转赠</button> | |||
| </view> | |||
| @@ -0,0 +1,132 @@ | |||
| /* pages/exchange/exchange.wxss */ | |||
| .section { | |||
| padding: 20rpx 20rpx; | |||
| } | |||
| .section { | |||
| position: relative; | |||
| display: flex; | |||
| flex: 5; | |||
| } | |||
| .section input { | |||
| flex: 3; | |||
| border: 1px solid #ccc; | |||
| border-radius: 10rpx; | |||
| height: 70rpx; | |||
| line-height: 70rpx; | |||
| font-size: 30rpx; | |||
| padding-left: 20rpx; | |||
| margin-right: 10rpx; | |||
| } | |||
| .section button { | |||
| flex: 1; | |||
| height: 74rpx; | |||
| line-height: 74rpx; | |||
| font-size: 30rpx; | |||
| } | |||
| .section .scan { | |||
| position: absolute; | |||
| right: 255rpx; | |||
| bottom: 37rpx; | |||
| width: 40rpx; | |||
| height: 40rpx; | |||
| z-index: 999; | |||
| } | |||
| .comment { | |||
| padding: 0 20rpx; | |||
| margin-top: 60rpx; | |||
| } | |||
| .comment text { | |||
| display: block; | |||
| } | |||
| .opcaity { | |||
| opacity: .6; | |||
| } | |||
| .tab { | |||
| display: flex; | |||
| justify-content: space-around; | |||
| margin-bottom: 25rpx; | |||
| z-index: 999; | |||
| height: 60rpx; | |||
| } | |||
| .tab .tabItem { | |||
| width: 100rpx; | |||
| text-align: center; | |||
| padding-bottom: 15rpx; | |||
| transition: all .3s; | |||
| } | |||
| .tabItem.active { | |||
| font-size: 35rpx; | |||
| color: #fd832d; | |||
| border-bottom: 5rpx solid #fd832d; | |||
| } | |||
| .infoCard { | |||
| width: 90%; | |||
| text-align: left; | |||
| padding: 25rpx 25rpx 5rpx 25rpx; | |||
| font-size: 32rpx; | |||
| background-color: #fff; | |||
| margin: 10rpx auto; | |||
| border-radius: 15rpx; | |||
| } | |||
| .infoCard view { | |||
| margin-bottom: 35rpx; | |||
| } | |||
| .infoCard .phone .changePhone, | |||
| .infoCard .phone .confirmPhone { | |||
| color: #09bb07; | |||
| } | |||
| .infoCard .phone .cancelChangePhone { | |||
| color: #fd832d; | |||
| margin-left: 15rpx; | |||
| } | |||
| .infoCard .phone { | |||
| position: relative; | |||
| } | |||
| .infoCard .phone .phoneInput { | |||
| position: relative; | |||
| top: 8rpx; | |||
| display: inline-block; | |||
| width: 240rpx; | |||
| } | |||
| .infoCard .radioGroup { | |||
| display: inline-block; | |||
| } | |||
| .infoCard .pwdBox { | |||
| position: relative; | |||
| border: 1px solid #5c5c5c; | |||
| padding: 15rpx; | |||
| border-radius: 15rpx; | |||
| line-height: 100%; | |||
| } | |||
| .infoCard .pwdBox .eye { | |||
| position: absolute; | |||
| right: 25rpx; | |||
| bottom: 5rpx; | |||
| width: 60rpx; | |||
| height: 60rpx; | |||
| z-index: 999; | |||
| } | |||
| .btns { | |||
| margin-top: 50rpx; | |||
| padding: 0 40rpx; | |||
| } | |||
| @@ -249,6 +249,11 @@ Page({ | |||
| } | |||
| }); | |||
| } | |||
| if (that.data.path == 'exchangeCard') { | |||
| wx.navigateTo({ | |||
| url: `/pages/exchangeCard/exchangeCard` | |||
| }) | |||
| } | |||
| }).catch(err => { | |||
| wx.showToast({ | |||
| title: err.message, | |||
| @@ -77,6 +77,8 @@ Page({ | |||
| options.id = this.data.newArr[2]; | |||
| } else if (options.type == 'ts') { | |||
| options.id = this.data.newArr[2]; | |||
| } else if (options.type == 'ts') { | |||
| options.id = this.data.newArr[2]; | |||
| } | |||
| } | |||
| } | |||
| @@ -344,6 +346,13 @@ Page({ | |||
| url: '/pages/discountCardList/discountCardList' | |||
| }) | |||
| } | |||
| // 录入电子卡 | |||
| else if (app.globalData.type == 'se') { | |||
| // 录入电子卡 | |||
| wx.redirectTo({ | |||
| url: '/pages/exchangeCard/exchangeCard' | |||
| }) | |||
| } | |||
| //直播 | |||
| else if (app.globalData.type == 'zb') { | |||
| wx.redirectTo({ | |||
| @@ -533,6 +542,13 @@ Page({ | |||
| url: '/pages/discountCardList/discountCardList' | |||
| }) | |||
| } | |||
| // 录入电子卡 | |||
| else if (app.globalData.type == 'se') { | |||
| // 录入电子卡 | |||
| wx.redirectTo({ | |||
| url: '/pages/exchangeCard/exchangeCard' | |||
| }) | |||
| } | |||
| // 兑换 | |||
| else if (app.globalData.type == 'ec') { | |||
| wx.redirectTo({ | |||
| @@ -8,5 +8,24 @@ | |||
| "useIsolateContext": true | |||
| }, | |||
| "libVersion": "2.11.2", | |||
| "condition": {} | |||
| "condition": { | |||
| "miniprogram": { | |||
| "list": [ | |||
| { | |||
| "name": "exchangeCard", | |||
| "pathName": "pages/exchangeCard/exchangeCard", | |||
| "query": "", | |||
| "launchMode": "default", | |||
| "scene": null | |||
| }, | |||
| { | |||
| "name": "pages/index/index", | |||
| "pathName": "pages/index/index", | |||
| "query": "type=se", | |||
| "launchMode": "default", | |||
| "scene": null | |||
| } | |||
| ] | |||
| } | |||
| } | |||
| } | |||