Commit 7cc3f14a by TengFengLian

券码核销识别

parent f048acfc
.container {
margin-top: 120rpx;
margin-top: 130rpx;
padding-bottom: 196rpx;
}
.list-wrapper {
......
const App = getApp()
Page({
data: {
avatarUrl: '/pages/mine/home/image/avatar.png',
showDialog: false
showDialog: false,
showDialogSmg: '非本店券码,无法使用',
couponCode: '',
},
onLoad: function (options) {
},
handleWriteOff() {
let showDialog = true
this.getVolumeDetails(this.data.couponCode)
},
//券码输入
bindCouponInput(e) {
this.setData({
showDialog
couponCode: e.detail.value
})
},
// 扫码
handleScanCode() {
let that = this
wx.scanCode({
onlyFromCamera: true,
success: (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
})
}
})
}
......
<navigation class="navigation" titleText="券码核销" backIcon="/image/back.png"></navigation>
<l-toast l-image-class="toast-image"></l-toast>
<view class="container">
<!-- 头像信息 -->
<view class="header col align-c">
......@@ -25,12 +25,12 @@
</view>
<!-- 核销输入框 -->
<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>
<l-dialog show="{{showDialog}}" l-class="dialog-wrapper" l-title-class="dialog-title" l-confirm-class="dialog-confirm" title="非本店券码,无法使用">
<view class="dialog-content">所属门店:原味舒食</view>
<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> -->
</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>
<!-- 扫码核销 -->
......
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