12 changed files with 196 additions and 4 deletions
|
After Width: | Height: | Size: 544 B |
|
After Width: | Height: | Size: 303 B |
|
After Width: | Height: | Size: 758 B |
@ -0,0 +1,80 @@ |
|||
import { post } from "../../getMapData"; |
|||
Page({ |
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: {}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad(options) {}, |
|||
async handleCode(e) { |
|||
try { |
|||
const memberID = getApp().globalData.memberID; |
|||
const { code, msg } = await post("/api/ar/v1/applet/writeoffcoupon", { |
|||
orderNo: e.detail.result, |
|||
memberID, |
|||
}); |
|||
if (code === 200) { |
|||
wx.showToast({ |
|||
icon: "none", |
|||
title: "核销成功", |
|||
}); |
|||
setTimeout(() => { |
|||
wx.redirectTo({ |
|||
url: "/pages/h5map/index?e=writeoff", |
|||
}); |
|||
}, 1000); |
|||
} else { |
|||
wx.showToast({ |
|||
icon: "none", |
|||
title: msg, |
|||
}); |
|||
return false; |
|||
} |
|||
} catch (error) { |
|||
return false; |
|||
} |
|||
}, |
|||
back() { |
|||
wx.redirectTo({ |
|||
url: "/pages/h5map/index?e=writeoff", |
|||
}); |
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面初次渲染完成 |
|||
*/ |
|||
onReady() {}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面显示 |
|||
*/ |
|||
onShow() {}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面隐藏 |
|||
*/ |
|||
onHide() {}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面卸载 |
|||
*/ |
|||
onUnload() {}, |
|||
|
|||
/** |
|||
* 页面相关事件处理函数--监听用户下拉动作 |
|||
*/ |
|||
onPullDownRefresh() {}, |
|||
|
|||
/** |
|||
* 页面上拉触底事件的处理函数 |
|||
*/ |
|||
onReachBottom() {}, |
|||
|
|||
/** |
|||
* 用户点击右上角分享 |
|||
*/ |
|||
onShareAppMessage() {}, |
|||
}); |
|||
@ -0,0 +1,3 @@ |
|||
{ |
|||
"usingComponents": {} |
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
<view class="scanCode"> |
|||
<image class="border" src="./border.svg"> </image> |
|||
<image class="scaner" src="./scaner.svg"></image> |
|||
<camera class="camera" mode="scanCode" device-position="back" bindscancode="handleCode" style="width: 280px; height: 280px;" /> |
|||
<view class="btn" bindtap="back"> |
|||
手动输入券码 |
|||
</view> |
|||
<image class="back" src="./close.svg" bindtap="back"></image> |
|||
</view> |
|||
@ -0,0 +1,71 @@ |
|||
.scanCode { |
|||
position: relative; |
|||
width: 100vw; |
|||
height: 100vh; |
|||
background: #353230; |
|||
} |
|||
|
|||
.back { |
|||
position: absolute; |
|||
bottom: 48px; |
|||
left: 0; |
|||
right: 0; |
|||
margin: auto; |
|||
width: 48px; |
|||
height: 48px; |
|||
} |
|||
.btn { |
|||
position: absolute; |
|||
height: 56px; |
|||
left: 29px; |
|||
right: 28px; |
|||
bottom: 130px; |
|||
background: #ffffff; |
|||
border-radius: 10px; |
|||
font-weight: 600; |
|||
font-size: 16px; |
|||
line-height: 22px; |
|||
color: #437af7; |
|||
display: flex; |
|||
justify-content: center; |
|||
align-items: center; |
|||
} |
|||
@keyframes scaner { |
|||
0% { |
|||
top: 10px; |
|||
} |
|||
100% { |
|||
top: 340px; |
|||
} |
|||
} |
|||
.border { |
|||
position: absolute; |
|||
top: 94px; |
|||
left: 0; |
|||
right: 0; |
|||
margin: auto; |
|||
width: 320px; |
|||
height: 320px; |
|||
z-index: 1; |
|||
} |
|||
.scaner { |
|||
position: absolute; |
|||
left: 0; |
|||
right: 0; |
|||
margin: auto; |
|||
width: 320px; |
|||
height: 74px; |
|||
animation: 1s scaner infinite ease-in-out; |
|||
z-index: 3; |
|||
pointer-events: none; |
|||
} |
|||
.camera { |
|||
position: absolute; |
|||
top: 114px; |
|||
left: 0; |
|||
right: 0; |
|||
margin: auto; |
|||
width: 280px; |
|||
height: 280px; |
|||
z-index: 2; |
|||
} |
|||
|
After Width: | Height: | Size: 424 B |
Loading…
Reference in new issue