瀏覽代碼

更新表单提交

梁沛聪 6 年之前
父節點
當前提交
73c16d0691

+ 1
- 0
miniapp/app/app.wxss 查看文件

31
     font-size: 30rpx;
31
     font-size: 30rpx;
32
     color: #666666;
32
     color: #666666;
33
     line-height: 1;
33
     line-height: 1;
34
+    overflow: hidden;
34
 }
35
 }
35
 
36
 
36
 .mod-hd .dot {
37
 .mod-hd .dot {

+ 23
- 15
miniapp/app/pages/bookService/index.js 查看文件

2
 const $ = global
2
 const $ = global
3
 
3
 
4
 new $.Page({
4
 new $.Page({
5
+    data: {
6
+        options: [],
7
+        api: ''
8
+    },
5
     onLoad(options) {
9
     onLoad(options) {
6
         if (!options.id) {
10
         if (!options.id) {
7
             return $.wx.showToast({
11
             return $.wx.showToast({
8
                 title: '找不到对应id'
12
                 title: '找不到对应id'
9
             });
13
             });
10
         }
14
         }
11
-        $.request(`server_info/${options.id}`, 'GET', {}).then((res) => {
15
+        $.request(`classify/${options.id}`, 'GET', {}).then((res) => {
12
             var article = res.data && res.data.content || '';
16
             var article = res.data && res.data.content || '';
13
             const fields = res.data.fields || [];
17
             const fields = res.data.fields || [];
14
             const options = [];
18
             const options = [];
15
             WxParse.wxParse('article', 'html', article, this, 5);
19
             WxParse.wxParse('article', 'html', article, this, 5);
16
             for (let item of fields) {
20
             for (let item of fields) {
17
                 const group = item.input_group;
21
                 const group = item.input_group;
18
-                options.push(group[0].value || '');
22
+                options.push({
23
+                    value: group[0].value || '',
24
+                    key: item.name
25
+                });
19
             }
26
             }
20
             this.setData({
27
             this.setData({
21
                 banner: res.data.photo || '',
28
                 banner: res.data.photo || '',
22
                 fields,
29
                 fields,
23
-                options
30
+                options,
31
+                api: res.data.api
24
             });
32
             });
25
         });
33
         });
26
     },
34
     },
29
             name,
37
             name,
30
             phone,
38
             phone,
31
             address,
39
             address,
32
-            notes
40
+            notes,
41
+            options
33
         } = this.data;
42
         } = this.data;
34
         if (!name || !phone || !address) {
43
         if (!name || !phone || !address) {
35
             return $.wx.showToast({
44
             return $.wx.showToast({
44
         $.wx.showToast({
53
         $.wx.showToast({
45
             title: '加载中'
54
             title: '加载中'
46
         }, 'loading');
55
         }, 'loading');
47
-        $.request('housekeeper_order/store', 'POST', {
48
-            contents: '保洁服务',
49
-            people_num: '1-2人',
50
-            notes,
51
-            server_time: '白天',
52
-            address,
53
-            rest: '晚上',
54
-            area: '60-120平',
56
+        const data = {
55
             contact: name,
57
             contact: name,
56
-            phone
57
-        }).then((res) => {
58
+            phone,
59
+            address,
60
+            notes
61
+        }
62
+        for (let option of options) {
63
+            data[`${option.key}`] = option.value;
64
+        }
65
+        $.request(api, 'POST', data).then((res) => {
58
             $.wx.hideToast('loading');
66
             $.wx.hideToast('loading');
59
             $.router.goto({
67
             $.router.goto({
60
                 path: '/pages/order/index',
68
                 path: '/pages/order/index',
72
         const {
80
         const {
73
             options
81
             options
74
         } = this.data;
82
         } = this.data;
75
-        options[index] = value;
83
+        options[index].value = value;
76
         this.setData({
84
         this.setData({
77
             options
85
             options
78
         });
86
         });

+ 1
- 1
miniapp/app/pages/bookService/index.wxml 查看文件

1
 <import src="/wxParse/wxParse.wxml" />
1
 <import src="/wxParse/wxParse.wxml" />
2
 <view class="page">
2
 <view class="page">
3
     <view class="page-hd">
3
     <view class="page-hd">
4
-        <image class="hero" src="/img/demo/banner.jpg"></image>
4
+        <image class="hero" src="{{banner}}"></image>
5
     </view>
5
     </view>
6
     <view class="page-bd">
6
     <view class="page-bd">
7
         <view class="mod">
7
         <view class="mod">

+ 19
- 10
miniapp/app/pages/yuesao/index.js 查看文件

3
 
3
 
4
 new $.Page({
4
 new $.Page({
5
     data: {
5
     data: {
6
-        options: []
6
+        options: [],
7
+        api: ''
7
     },
8
     },
8
     onLoad(options) {
9
     onLoad(options) {
9
         if (!options.id) {
10
         if (!options.id) {
11
                 title: '找不到对应id'
12
                 title: '找不到对应id'
12
             });
13
             });
13
         }
14
         }
14
-        $.request(`server_info/${options.id}`, 'GET', {}).then((res) => {
15
+        $.request(`classify/${options.id}`, 'GET', {}).then((res) => {
15
             var article = res.data && res.data.content || '';
16
             var article = res.data && res.data.content || '';
16
             const fields = res.data.fields || [];
17
             const fields = res.data.fields || [];
17
             const options = [];
18
             const options = [];
18
             WxParse.wxParse('article', 'html', article, this, 5);
19
             WxParse.wxParse('article', 'html', article, this, 5);
19
             for (let item of fields) {
20
             for (let item of fields) {
20
                 const group = item.input_group;
21
                 const group = item.input_group;
21
-                options.push(group[0].value || '');
22
+                options.push({
23
+                    value: group[0].value || '',
24
+                    key: item.name
25
+                });
22
             }
26
             }
23
             this.setData({
27
             this.setData({
24
                 banner: res.data.photo || '',
28
                 banner: res.data.photo || '',
25
                 fields,
29
                 fields,
26
-                options
30
+                options,
31
+                api: res.data.api
27
             });
32
             });
28
         });
33
         });
29
     },
34
     },
34
             address,
39
             address,
35
             notes,
40
             notes,
36
             expectedDate,
41
             expectedDate,
37
-            serviceDate
42
+            serviceDate,
43
+            options
38
         } = this.data;
44
         } = this.data;
39
         if (!name || !phone || !address || !expectedDate || !serviceDate) {
45
         if (!name || !phone || !address || !expectedDate || !serviceDate) {
40
             return $.wx.showToast({
46
             return $.wx.showToast({
49
         $.wx.showToast({
55
         $.wx.showToast({
50
             title: '加载中'
56
             title: '加载中'
51
         }, 'loading');
57
         }, 'loading');
52
-        $.request('maternity_matron_order/store', 'POST', {
53
-            level: '金牌月嫂',
58
+        const data = {
54
             expected_date: expectedDate,
59
             expected_date: expectedDate,
55
-            special_demand: notes || '特殊需求',
60
+            special_demand: notes,
56
             server_time: serviceDate,
61
             server_time: serviceDate,
57
             address,
62
             address,
58
             contact: name,
63
             contact: name,
59
             phone
64
             phone
60
-        }).then((res) => {
65
+        };
66
+        for (let option of options) {
67
+            data[`${option.key}`] = option.value;
68
+        }
69
+        $.request(this.data.api, 'POST', data).then((res) => {
61
             $.wx.hideToast('loading');
70
             $.wx.hideToast('loading');
62
             $.router.goto({
71
             $.router.goto({
63
                 path: '/pages/order/index',
72
                 path: '/pages/order/index',
75
         const {
84
         const {
76
             options
85
             options
77
         } = this.data;
86
         } = this.data;
78
-        options[index] = value;
87
+        options[index].value = value;
79
         this.setData({
88
         this.setData({
80
             options
89
             options
81
         });
90
         });

Loading…
取消
儲存