Commit 7cc3f14a by TengFengLian

券码核销识别

parent f048acfc
.container { .container {
margin-top: 120rpx; margin-top: 130rpx;
padding-bottom: 196rpx; padding-bottom: 196rpx;
} }
.list-wrapper { .list-wrapper {
......
const App = getApp()
Page({ Page({
data: { data: {
avatarUrl: '/pages/mine/home/image/avatar.png', avatarUrl: '/pages/mine/home/image/avatar.png',
showDialog: false showDialog: false,
showDialogSmg: '非本店券码,无法使用',
couponCode: '',
}, },
onLoad: function (options) { onLoad: function (options) {
}, },
handleWriteOff() { handleWriteOff() {
let showDialog = true this.getVolumeDetails(this.data.couponCode)
},
//券码输入
bindCouponInput(e) {
this.setData({ this.setData({
showDialog couponCode: e.detail.value
}) })
}, },
// 扫码
handleScanCode() { handleScanCode() {
let that = this
wx.scanCode({ wx.scanCode({
onlyFromCamera: true, onlyFromCamera: true,
success: (res) => { success: (res) => {
console.log(res) console.log(res)
let result = res.result
that.getVolumeDetails(result)
} }
}) })
},
getVolumeDetails(couponCode) {
if (!couponCode || couponCode.length == 0) {
wx.lin.showToast({
image: '/image/error.png',
title: '请输入券码',
})
return
}
let that = this
wx.lin.showToast({
icon: 'loading',
title: '加载中',
show: true,
mask: true,
duration: 1000 * 60,
})
App.wxRequest({
url: '/api/v1/volume/getVolumeDetails',
data: {
serialNumber: couponCode,
},
success: function(res) {
wx.lin.hideToast()
let couponDetail = JSON.stringify(res.data)
wx.navigateTo({
url: '/pages/pay/coupon-detail/coupon-detail?couponDetail='+couponDetail,
})
},
fail: function(err) {
wx.lin.hideToast()
that.setData({
showDialogSmg: err.msg,
showDialog: true
})
}
})
} }
}) })
\ No newline at end of file
<navigation class="navigation" titleText="券码核销" backIcon="/image/back.png"></navigation> <navigation class="navigation" titleText="券码核销" backIcon="/image/back.png"></navigation>
<l-toast l-image-class="toast-image"></l-toast>
<view class="container"> <view class="container">
<!-- 头像信息 --> <!-- 头像信息 -->
<view class="header col align-c"> <view class="header col align-c">
...@@ -25,12 +25,12 @@ ...@@ -25,12 +25,12 @@
</view> </view>
<!-- 核销输入框 --> <!-- 核销输入框 -->
<view class="coupon-input-wrapper row con-b"> <view class="coupon-input-wrapper row con-b">
<input placeholder="请输入券码" placeholder-style="color: #C2C7CF"></input> <input placeholder="请输入券码" placeholder-style="color: #C2C7CF" bindinput="bindCouponInput" value="{{couponCode}}"></input>
<view class="coupon-input-btn" bindtap="handleWriteOff">核销</view> <view class="coupon-input-btn" bindtap="handleWriteOff">核销</view>
<l-dialog show="{{showDialog}}" l-class="dialog-wrapper" l-title-class="dialog-title" l-confirm-class="dialog-confirm" title="非本店券码,无法使用"> <l-dialog show="{{showDialog}}" l-class="dialog-wrapper" l-title-class="dialog-title" l-confirm-class="dialog-confirm" title="{{showDialogSmg}}">
<view class="dialog-content">所属门店:原味舒食</view> <!-- <view class="dialog-content">所属门店:原味舒食</view> -->
</l-dialog> </l-dialog>
<l-toast show="{{true}}" l-image-class="toast-image" l-class="toast-bg" image="/image/success.png" title="核销成功" /> <!-- <l-toast show="{{true}}" l-image-class="toast-image" l-class="toast-bg" image="/image/success.png" title="核销成功" /> -->
</view> </view>
<!-- 扫码核销 --> <!-- 扫码核销 -->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment