Commit bb546863 by 姜雷

调整条码样式

parent 97a06a3d
...@@ -41,9 +41,13 @@ ...@@ -41,9 +41,13 @@
height: 52px; height: 52px;
} }
.BarCodeCav { .BarCodeCav {
display: none;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.BarCodeCav.show {
display: block;
}
.toggleBtn { .toggleBtn {
position: absolute; position: absolute;
right: 0; right: 0;
......
...@@ -186,29 +186,24 @@ class BarCode extends Component { ...@@ -186,29 +186,24 @@ class BarCode extends Component {
} }
payDoneHandle() { payDoneHandle() {
const { showBig } = this.state;
this.setState( this.setState(
{ {
showPayOrder: false, showPayOrder: false,
}, },
() => { () => {
this.drawBarCode(showBig); this.drawBarCode();
}, },
); );
} }
drawBarCode(showBig: boolean) { drawBarCode() {
const { userinfo } = this.props; const { userinfo } = this.props;
let idBar = userinfo.idBar.substring(0, userinfo.idBar.length - 2) + '04'; let idBar = userinfo.idBar.substring(0, userinfo.idBar.length - 2) + '04';
if (showBig) { wxbarcode.barcode('BarCode', idBar, 646, 188);
wxbarcode.barcode('BarCode', idBar, 700, 188); wxbarcode.barcode('BarCodeBig', idBar, 700, 364);
} else {
wxbarcode.barcode('BarCode', idBar, 700, 364);
}
} }
toggleBigBarCode() { toggleBigBarCode() {
const { showBig } = this.state; const { showBig } = this.state;
this.drawBarCode(showBig);
this.setState({ this.setState({
showBig: !showBig, showBig: !showBig,
}); });
...@@ -222,7 +217,7 @@ class BarCode extends Component { ...@@ -222,7 +217,7 @@ class BarCode extends Component {
updateUserInfo({ updateUserInfo({
idBar: data, idBar: data,
}); });
this.drawBarCode(false); this.drawBarCode();
}) })
.catch(err => { .catch(err => {
Taro.showToast({ Taro.showToast({
...@@ -267,11 +262,18 @@ class BarCode extends Component { ...@@ -267,11 +262,18 @@ class BarCode extends Component {
onClick={this.refreshCodeBar} onClick={this.refreshCodeBar}
/> />
)} )}
<View className={`BarCodeImg ${showBig ? 'BarCodeImgBig' : ''}`}>
{showPayOrder ? null : ( {showPayOrder ? null : (
<Canvas className='BarCodeCav' canvasId='BarCode' /> <View className={`BarCodeImg ${showBig ? 'BarCodeImgBig' : ''}`}>
)} <Canvas
className={`BarCodeCav ${showBig ? 'show' : ''}`}
canvasId='BarCodeBig'
/>
<Canvas
className={`BarCodeCav ${showBig ? '' : 'show'}`}
canvasId='BarCode'
/>
</View> </View>
)}
<View className='toggleBtn' onClick={this.toggleBigBarCode}> <View className='toggleBtn' onClick={this.toggleBigBarCode}>
{showBig ? '缩小' : '放大'} {showBig ? '缩小' : '放大'}
</View> </View>
......
...@@ -229,12 +229,16 @@ class Home extends Component { ...@@ -229,12 +229,16 @@ class Home extends Component {
<View className='Home-UserBox-BeanItem'> <View className='Home-UserBox-BeanItem'>
<Image className='Home-UserBox-BeanIcon' src={HBeanIcon} /> <Image className='Home-UserBox-BeanIcon' src={HBeanIcon} />
<Text>吹风豆:</Text> <Text>吹风豆:</Text>
<Text className='Home-UserBox-BeanCount'>{hairDryerBean}</Text> <Text className='Home-UserBox-BeanCount'>
{hairDryerBean.toFixed(2)}
</Text>
</View> </View>
<View className='Home-UserBox-BeanItem'> <View className='Home-UserBox-BeanItem'>
<Image className='Home-UserBox-BeanIcon' src={TBeanIcon} /> <Image className='Home-UserBox-BeanIcon' src={TBeanIcon} />
<Text>通用豆:</Text> <Text>通用豆:</Text>
<Text className='Home-UserBox-BeanCount'>{commBean}</Text> <Text className='Home-UserBox-BeanCount'>
{commBean.toFixed(2)}
</Text>
</View> </View>
</View> </View>
<View className='Home-UserBox-Order'> <View className='Home-UserBox-Order'>
......
...@@ -165,23 +165,22 @@ class OrderPayway extends Component { ...@@ -165,23 +165,22 @@ class OrderPayway extends Component {
}).toString(Utf8), }).toString(Utf8),
); );
console.log(payData); console.log(payData);
Taro.requestPayment({ Taro.requestPayment({
timeStamp: payData.msg.timeStamp.toString(), timeStamp: payData.msg.timeStamp.toString(),
nonceStr: payData.msg.nonceStr, nonceStr: payData.msg.nonceStr,
package: payData.msg.package, package: payData.msg.package,
signType: payData.msg.signType, signType: payData.msg.signType,
paySign: payData.msg.paySign, paySign: payData.msg.paySign,
success(res) { })
.then(res => {
console.log(res); console.log(res);
onPayDoneCallback(); onPayDoneCallback();
}, })
fail(res) { .catch(err => {
Taro.showToast({ Taro.showToast({
title: res.msg || '发起支付失败', title: err.msg || '发起支付失败',
icon: 'none', icon: 'none',
}); });
},
}); });
} else { } else {
onPayDoneCallback(); onPayDoneCallback();
......
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