|
@@ -0,0 +1,64 @@
|
|
|
+<template>
|
|
|
+ <div id="index_login_container" class="animation-slide-right">
|
|
|
+ <form action="">
|
|
|
+ <view class="cu-form-group">
|
|
|
+ <view class="title">金额</view>
|
|
|
+ <input placeholder="输入金额" name="input" v-model="price"></input>
|
|
|
+ </view>
|
|
|
+ <van-button @click="wx_pay" block class="padding">支付</van-button>
|
|
|
+ </form> <van-toast id="van-toast"/>
|
|
|
+
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+import {testPay} from "../../requests/orders";
|
|
|
+import Toast from '../../../static/vant/toast/toast';
|
|
|
+
|
|
|
+var $this
|
|
|
+export default {
|
|
|
+ name: 'scan_container',
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ price: ""
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ wx_pay() {
|
|
|
+ let $params = {
|
|
|
+ total_fee: $this.price
|
|
|
+ }
|
|
|
+ testPay($params).then((res) => {
|
|
|
+ let $res = res.data
|
|
|
+ let $payment = $res.data
|
|
|
+ $this.payment_info = $payment
|
|
|
+ wx.requestPayment({
|
|
|
+ timeStamp: $payment.timeStamp,
|
|
|
+ nonceStr: $payment.nonceStr,
|
|
|
+ package: $payment.package,
|
|
|
+ signType: $payment.signType,
|
|
|
+ paySign: $payment.sign,
|
|
|
+ success(res) {
|
|
|
+ //支付成功
|
|
|
+ console.log('success', res)
|
|
|
+ Toast.success("支付成功")
|
|
|
+ },
|
|
|
+ fail(res) {
|
|
|
+ console.log('fail', res)
|
|
|
+ Toast.fail('支付失败')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ $this = this
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+<style scoped>
|
|
|
+#index_login_container {
|
|
|
+ height: 812px;
|
|
|
+ background-color: #31295B;
|
|
|
+}
|
|
|
+
|
|
|
+</style>
|