@@ -426,10 +426,10 @@ var config = { | |||
verify: "/couponOrder/verify", | |||
//全包下订单 | |||
couponPackageSave: "/order/couponPackageSave", | |||
//获取动态核销码 | |||
dynamicId: "/couponOrder/dynamicId" | |||
dynamicId: "/couponOrder/dynamicId", | |||
// 获取卡详情 | |||
getCardDetail: "/couponPassword/getCardDetail", | |||
}, | |||
weapp: { | |||
AppId: weappId | |||
@@ -202,10 +202,10 @@ Component({ | |||
// wx.hideTabBar() | |||
Http.get({ | |||
url: config.api.templateId, | |||
data: { | |||
pageNum: 1, | |||
pageSize: 100 | |||
} | |||
// data: { | |||
// pageNum: 1, | |||
// pageSize: 100 | |||
// } | |||
}).then(res => { | |||
const { | |||
code, | |||
@@ -213,7 +213,7 @@ Component({ | |||
} = res | |||
if (code == 200) { | |||
this.setData({ | |||
templateId: data.list | |||
templateId: data || '' | |||
}) | |||
this.setWxMessage() | |||
} else { | |||
@@ -131,16 +131,17 @@ | |||
<view class="particulars_go">></view> | |||
</view> | |||
</navigator> | |||
<navigator url="/pages/exchange/exchange" open-type="navigate"> | |||
<!-- <navigator url="/pages/exchange/exchange" open-type="navigate"> | |||
<view class="particulars_list"> | |||
<view class="particulars_name">兑换</view> | |||
<view class="particulars_go">></view> | |||
</view> | |||
</navigator> | |||
</navigator> --> | |||
<navigator url="/pages/exchangeCard/exchangeCard" open-type="navigate"> | |||
<view class="particulars_list"> | |||
<view class="particulars_name">录入实体卡</view> | |||
<view class="particulars_name">激活消费卡</view> | |||
<view class="particulars_go">></view> | |||
</view> | |||
</navigator> | |||
@@ -18,7 +18,7 @@ Page({ | |||
let that = this; | |||
let code = e.detail.value.code; | |||
let formId = e.detail.formId; | |||
if (!code || !code.replace(/\s*/g, "")) { | |||
if (!code) { | |||
wx.showToast({ | |||
title: '请输入兑换码', | |||
icon: "none", | |||
@@ -39,7 +39,17 @@ Page({ | |||
that.setData({ | |||
code: num | |||
}) | |||
that.exchange({ detail: { value: num } }) | |||
const e = { | |||
detail: | |||
{ | |||
value: | |||
{ | |||
code: | |||
num | |||
} | |||
} | |||
} | |||
that.exchange(e) | |||
}, | |||
fail: (res) => { | |||
console.log(res, 'fail'); | |||
@@ -14,19 +14,22 @@ Page({ | |||
pdwSwitch: 0, | |||
isShowPwd: false, | |||
isChangePhone: false, | |||
isSHowInfoCard: false, | |||
code: "", | |||
name: "叶文沁", | |||
phone: "1379****591", | |||
tempPhone: '', | |||
password: '' | |||
title: "", | |||
name: "", | |||
phone: "", | |||
tempPhone: "", | |||
password: "" | |||
}, | |||
// 兑换 | |||
exchange(e) { | |||
console.log(e, 'e'); | |||
let that = this; | |||
// 查询 | |||
searchCard(e) { | |||
let code = e.detail.value.code; | |||
console.log(code); | |||
this.setData({ | |||
code: e.detail.value.code | |||
}) | |||
this.getCardDetail(code) | |||
}, | |||
// 更改手机号 | |||
@@ -81,7 +84,8 @@ Page({ | |||
this.setData({ | |||
tabIndex: e.target.id, | |||
code: '', | |||
password: '' | |||
password: '', | |||
isSHowInfoCard: false | |||
}) | |||
}, | |||
@@ -103,7 +107,10 @@ Page({ | |||
that.setData({ | |||
code: num | |||
}) | |||
that.exchange({ detail: { value: num } }) | |||
const e = { | |||
detail: { value: { code: num } } | |||
} | |||
that.searchCard(e) | |||
}, | |||
fail: (res) => { | |||
console.log(res, 'fail'); | |||
@@ -111,6 +118,72 @@ Page({ | |||
}) | |||
}, | |||
/** 根据卡id查询卡详情*/ | |||
getCardDetail(cardId) { | |||
const that = this | |||
Http.get({ | |||
url: config.api.getCardDetail, | |||
data: { cardId } | |||
}) | |||
.then(res => { | |||
console.log(res, 'res'); | |||
that.setData({ | |||
title: res.data.title, | |||
phone: res.data.ownerPhone, | |||
ownerUserId: res.data.ownerUserId, | |||
eCardId: res.data.eCardId, | |||
owned: res.data.owned, | |||
remainAmount: res.data.remainAmount / 100, | |||
isSHowInfoCard: true // 显示卡详情 | |||
}) | |||
}) | |||
.catch(err => { | |||
console.log(err); | |||
wx.showToast({ | |||
title: err.message, | |||
icon: "none" | |||
}) | |||
}) | |||
}, | |||
getCouponOrderByPassword(password) { | |||
Http.post({ | |||
url: config.api.getCouponOrderByPassword, | |||
data: { | |||
password, | |||
} | |||
}) | |||
.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 | |||
}) | |||
}) | |||
}, | |||
setPwdShow() { | |||
const isShowPwd = this.data.isShowPwd | |||
this.setData({ | |||
@@ -119,17 +192,29 @@ Page({ | |||
}, | |||
submit() { | |||
const thisData = this.data | |||
const data = { | |||
name: thisData.name, | |||
phone: thisData.phone, | |||
pdwSwitch: thisData.pdwSwitch, | |||
password: thisData.password, | |||
} | |||
console.log(data, 'submitData'); | |||
const data = this.data | |||
this.getCouponOrderByPassword(data.code) | |||
}, | |||
goGive() { }, | |||
goGive() { | |||
if (this.data.ownerUserId && this.data.eCardId) { | |||
if (this.data.owned && this.data.owned == 1) { | |||
wx.navigateTo({ | |||
url: `/pages/ConsumeDetail/ConsumeDetail?cardId=${this.data.eCardId}`, | |||
}) | |||
} else { | |||
wx.showToast({ | |||
title: '当前用户不是该卡的持有者,无法转赠!', | |||
icon: 'none' | |||
}) | |||
} | |||
} else { | |||
wx.showToast({ | |||
title: '该卡未绑定', | |||
icon: 'error' | |||
}) | |||
} | |||
}, | |||
// 检查用户登录状态 | |||
checkPhoneStatus() { | |||
@@ -138,13 +223,12 @@ Page({ | |||
url: config.api.checkPhoneStatus, | |||
}) | |||
.then(res => { | |||
}) | |||
.catch(err => { | |||
if (err.code == 11005) { | |||
// 手机号没有授权,将值传到用户手机号授权的页面 | |||
wx.redirectTo({ | |||
url: "/pages/getphoneInfo/index", | |||
url: "/pages/getphoneInfo/index?path=exchangeCard", | |||
}) | |||
} else { | |||
wx.showToast({ | |||
@@ -1,23 +1,39 @@ | |||
<navbar text="录入实体卡" home back background='#FD832D' color="white"></navbar> | |||
<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 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'> | |||
<form bindsubmit='searchCard' report-submit='true'> | |||
<view class="section"> | |||
<input name='code' placeholder="请输入卡号或扫描二维码" clearable value="{{code}}" /> | |||
<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="{{tabIndex == 0}}" class="comment"> | |||
<text class="txt1">如何获取卡号卡密?</text> | |||
<text class="txt2">1.实体卡卡密可刮开卡背面涂层查看;</text> | |||
<text class="txt2">2.扫描实体卡二维码获取卡号;</text> | |||
<text class="txt3">3.自己购买的电子卡,可到“我的卡包”或短信查看详情;</text> | |||
</view> | |||
<view wx:if="{{tabIndex == 1}}" class="comment"> | |||
<text class="txt2" style="font-size: 30rpx;">请先绑定消费卡再转赠</text> | |||
</view> | |||
<view wx:if="{{isSHowInfoCard}}" class="infoCard"> | |||
<view class="name">卡名称:{{title}}</view> | |||
<view wx:if="{{remainAmount}}" class="name">卡余额:{{remainAmount}}</view> | |||
<!-- <view class="name">持卡人姓名:{{name}}</view> --> | |||
<view wx:if="{{!isChangePhone && phone}}" 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" /> | |||
@@ -25,7 +41,7 @@ | |||
<text class="cancelChangePhone" bindtap="cancelChangePhone">取消</text> | |||
</view> | |||
<view class="security"> | |||
<!-- <view class="security"> | |||
<text>支付安全设置:</text> | |||
<radio-group wx:if="{{tabIndex == 0}}" class="radioGroup" bindchange="securityChange"> | |||
<label> | |||
@@ -41,7 +57,8 @@ | |||
<radio value="0" checked="true" />无验证 | |||
</label> | |||
</radio-group> | |||
</view> | |||
</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}}" /> | |||
@@ -58,7 +58,7 @@ | |||
} | |||
.tab .tabItem { | |||
width: 100rpx; | |||
width: 180rpx; | |||
text-align: center; | |||
padding-bottom: 15rpx; | |||
transition: all .3s; | |||
@@ -81,7 +81,7 @@ | |||
} | |||
.infoCard view { | |||
margin-bottom: 35rpx; | |||
margin-bottom: 45rpx; | |||
} | |||
.infoCard .phone .changePhone, | |||
@@ -129,4 +129,27 @@ | |||
.btns { | |||
margin-top: 50rpx; | |||
padding: 0 40rpx; | |||
} | |||
.comment { | |||
padding: 0 30rpx; | |||
margin-top: 20rpx; | |||
margin-bottom: 35rpx; | |||
} | |||
.comment text { | |||
display: block; | |||
} | |||
.txt1 { | |||
margin-top: 30rpx; | |||
font-size: 34rpx; | |||
margin-bottom: 20rpx; | |||
} | |||
.txt2, | |||
.txt3 { | |||
font-size: 25rpx; | |||
line-height: 40rpx; | |||
color: #999; | |||
} |
@@ -226,6 +226,10 @@ Page({ | |||
wx.switchTab({ | |||
url: app.globalData.goHomeUrl | |||
}); | |||
} else if (that.data.path == 'exchangeCard') { | |||
wx.navigateTo({ | |||
url: `/pages/exchangeCard/exchangeCard` | |||
}) | |||
} else { | |||
wx.showToast({ | |||
title: res.data.msg, | |||
@@ -249,11 +253,6 @@ Page({ | |||
} | |||
}); | |||
} | |||
if (that.data.path == 'exchangeCard') { | |||
wx.navigateTo({ | |||
url: `/pages/exchangeCard/exchangeCard` | |||
}) | |||
} | |||
}).catch(err => { | |||
wx.showToast({ | |||
title: err.message, | |||