红绿项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

115 lines
2.1 KiB

<template>
<view class="goods_con">
<navigation>
ADD Red Envelope
</navigation>
<view class="login-body">
<u-form :model="form" ref="uForm" :rules="rules">
<view class="big">
<view class="text">
Fixed Money
</view>
<u-form-item prop="amount">
<u-input v-model="form.amount" :placeholder="''" />
</u-form-item>
</view>
<view class="big">
<view class="text">
Enter Your Login Password
</view>
<u-form-item prop="password">
<u-input type="password" v-model="form.password" :placeholder="''" />
</u-form-item>
</view>
</u-form>
<button @click="submit" class="login-btn">
Confirm
</button>
</view>
<tab-bar></tab-bar>
</view>
</template>
<script>
import api from '@/utils/api'
import utils from '@/utils'
import md5 from 'js-md5'
import store from '@/store'
export default {
data() {
return {
form: {
password: '',
amount: '',
ticket: '',
},
rules: {
amount: [{
amount: true,
message: 'Please enter your amount',
// 可以单个或者同时写两个触发验证方式
trigger: ['blur'],
},
],
password: [{
required: true,
// min: 5,
message: 'Please enter password',
trigger: 'blur'
}],
}
}
},
onLoad(i) {
this.form.ticket = uni.getStorageSync('logInfo').data
},
onReady() {
},
methods: {
submit() {
this.$refs.uForm.validate(valid => {
if (valid) {
uni.showLoading({})
const post = api.launchRedEnvelop(this.form)
post.then(res => {
if(res.errCode=='SUCCESS'){
uni.showToast({
title: 'Successfully',
icon: 'success',
duration: 2500
})
setTimeout(()=>{
uni.navigateTo({
url:'../list/index'
})
},1500)
}
}).catch((e)=>{
uni.showToast({
title: e,
icon: 'none',
duration: 2500
})
})
} else {
console.log('验证失败');
}
});
}
},
}
</script>
<style>
@import './index.css';
</style>