Commit f638d60e by 修福龙

增加了带字母的条码识别功能,刷脸支付余额抵扣功能

parent ca060e88
import React, {Component} from 'react';
import {Modal, View, Text, Image} from 'react-native';
import Icon from 'react-native-vector-icons/Ionicons';
// import Icon from 'react-native-vector-icons/Ionicons';
import MIcon from 'react-native-vector-icons/MaterialCommunityIcons';
import ModalStyles from './Modal/styles';
import {colors, font} from '../utils/common';
......
......@@ -81,13 +81,15 @@ const CounterMixins = ComposeComponent => {
const handleScan = this.submitBarcode;
// if you want to react to keyUp
KeyEvent.onKeyUpListener(async e => {
const {keyCode} = e;
const {keyCode, pressedKey} = e;
if (keyCode === 66) {
// 回车事件
await handleScan();
this.barcode = '';
} else if (keyCode >= 7 && keyCode <= 16) {
this.barcode += keyCode - 7;
} else if (keyCode >= 29 && keyCode <= 54) {
this.barcode += pressedKey;
}
});
this.listen();
......@@ -449,7 +451,7 @@ const CounterMixins = ComposeComponent => {
const good = {
barcode: '000000',
name: '无码商品',
unit: 1,
// unit: 1,
num: 1,
// price: NP.round(price, 2).toFixed(2),
prePrice: NP.round(price, 2).toFixed(2),
......@@ -487,6 +489,7 @@ const CounterMixins = ComposeComponent => {
purPrice: 0,
prePrice,
num,
weight: 0,
});
}
});
......@@ -494,7 +497,7 @@ const CounterMixins = ComposeComponent => {
};
// 付款码支付
barcodepay = async (code, facepay) => {
barcodepay = async (code, facepay, openid) => {
if (this.barcodeBusy) {
return true;
}
......@@ -512,6 +515,7 @@ const CounterMixins = ComposeComponent => {
code,
facepay,
noBarcode,
openid,
});
if (res.code !== 1) {
await this.setState({voiceModal: true, voiceTitle: res.msg});
......
......@@ -194,7 +194,8 @@ class VerticalPage extends Component {
res = await WxFacepay.facepay(params);
}
if (res.face_code) {
await this.props.barcodepay(res.face_code, true);
await this.props.barcodepay(res.face_code, true, res.sub_openid);
// const ret = await this.props.barcodepay(res.face_code, true);
// const result = { ...params, payresult: ret };
// if (ret !== 'SUCCESS') result.payresult = 'ERROR';
......@@ -287,18 +288,36 @@ class VerticalPage extends Component {
}}>
{NP.round(item.prePrice, 2).toFixed(2)}
</Text>
{item.unit ? (
<Text style={{fontSize: 25, color: colors.textXSActive}}>
{NP.round(item.price, 2).toFixed(2)}/
<Text style={styles.TdText}>{item.unit}</Text>
</Text>
) : (
<Text style={{fontSize: 25, color: colors.textXSActive}}>
{NP.round(item.price, 2).toFixed(2)}
</Text>
)}
</View>
) : (
<View
style={{
justifyContent: 'center',
alignItems: 'center',
flexDirection: 'row',
}}>
{item.unit ? (
<Text style={styles.TdText}>
{NP.round(item.prePrice, 2).toFixed(2)}/{item.unit}
</Text>
) : (
<Text style={styles.TdText}>
{' '}
{NP.round(item.prePrice, 2).toFixed(2)}/{item.unit}{' '}
{NP.round(item.prePrice, 2).toFixed(2)}
</Text>
)}
</View>
)}
</View>
<View style={styles.TdStyle}>
{item.numChange ? (
<Icon
......
......@@ -9,10 +9,10 @@ export function getBags() {
return axios.get('/store/goods/bags');
}
export function barcodepay({ids, code, facepay, noBarcode}) {
export function barcodepay({ids, code, facepay, noBarcode, openid}) {
return axios.post(
'/store/goods/barcodepay',
qs.stringify({ids, code, facepay, noBarcode}),
qs.stringify({ids, code, facepay, noBarcode, openid}),
);
}
......
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 to comment