|
@@ -0,0 +1,51 @@
|
|
|
+<template>
|
|
|
+ <div id="payment_container">
|
|
|
+ <form action="">
|
|
|
+ <view class="cu-form-group">
|
|
|
+ <view class="title">支付金额</view>
|
|
|
+ <input v-model="amount" placeholder="输入支付金额" type="digit"></input>
|
|
|
+ </view>
|
|
|
+ </form>
|
|
|
+ <button class="cu-btn round bg-green text-center lg margin-tb-lg" style="width: 100%;"
|
|
|
+ @click="makePay"
|
|
|
+ >支付
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script type="text/javascript">
|
|
|
+import {testPay} from "../../requests/orders";
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "PaymentContainer",
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ amount: ""
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ makePay() {
|
|
|
+ console.log(this.amount)
|
|
|
+ testPay(this.amount).then((res) => {
|
|
|
+ let $res = res.data;
|
|
|
+ let $payment = $res.data;
|
|
|
+ wx.requestPayment({
|
|
|
+ timeStamp: $payment.timeStamp,
|
|
|
+ nonceStr: $payment.nonceStr,
|
|
|
+ package: $payment.package,
|
|
|
+ signType: $payment.signType,
|
|
|
+ paySign: $payment.sign,
|
|
|
+ success(res) {
|
|
|
+ //支付成功
|
|
|
+ console.log('success', res)
|
|
|
+
|
|
|
+ },
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|