1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
| <template>
| <view class="login-container">
| <view class="p30">
| <view class="group-bd">
| <view class="form-level d-s-c">
| <view class="d-e-c field-name">
| <text class="orange">*</text>
| <text class="gray3">姓名:</text>
| </view>
| <view class="val flex-1"><input type="text" v-model="formData.real_name" placeholder="请输入姓名" /></view>
| </view>
|
| <view class="form-level d-s-c">
| <view class="d-e-c field-name">
| <text class="orange">*</text>
| <text class="gray3">电话:</text>
| </view>
| <view class="val flex-1"><input type="text" v-model="formData.mobile" placeholder="请输入电话" /></view>
| </view>
| <view class="form-level d-s-c">
| <view class="d-e-c field-name">
| <text class="orange">*</text>
| <text class="gray3">用户ID:</text>
| </view>
| <view class="val flex-1"><input type="text" v-model="formData.user_id" placeholder="请填写小程序的用户ID" /></view>
| </view>
|
| </view>
| </view>
|
| <view class="btns p30"><button type="default" @click="formSubmit">提交</button></view>
| </view>
| </template>
|
| <script>
| export default {
| components: {
|
| },
| data() {
| return {
| /*表单数据对象*/
| formData: {
| real_name: '',
| mobile: '',
| user_id:'',
| },
| };
| },
| onLoad() {
| },
| methods: {
| /*提交*/
| formSubmit() {
| let self = this;
| uni.showLoading({
| title: '正在提交'
| });
| self._post(
| 'takeout.commander/add',
| self.formData,
| result => {
| if(result.code == 1){
| uni.showToast({
| title: '添加成功',
| duration: 2000
| });
| setTimeout(function(){
| // 执行回调函数
| uni.navigateBack();
| }, 2000);
| }else{
| uni.showToast({
| title: '添加失败',
| duration: 2000
| });
| }
| },
| false,
| () => {
| uni.hideLoading();
| }
| );
| },
|
|
| }
| };
| </script>
|
| <style lang="scss" scoped>
| .login-container {
| background: #ffffff;
| font-size: 30rpx;
| }
| .login-container .field-name{
| width: 140rpx;
| }
| .login-container input {
| height: 88rpx;
| line-height: 88rpx;
| }
|
| .btns button {
| height: 80rpx;
| line-height: 80rpx;
| font-size: 34rpx;
| border-radius: 30rpx;
| background: #000;
| color: #ffffff;
| }
| </style>
|
|