瀏覽代碼

Merge remote-tracking branch 'origin/master'

chenxiqiang 6 年之前
父節點
當前提交
dcf89fa47d

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

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

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

@@ -2,25 +2,33 @@ const WxParse = require('../../wxParse/wxParse.js')
2 2
 const $ = global
3 3
 
4 4
 new $.Page({
5
+    data: {
6
+        options: [],
7
+        api: ''
8
+    },
5 9
     onLoad(options) {
6 10
         if (!options.id) {
7 11
             return $.wx.showToast({
8 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 16
             var article = res.data && res.data.content || '';
13 17
             const fields = res.data.fields || [];
14 18
             const options = [];
15 19
             WxParse.wxParse('article', 'html', article, this, 5);
16 20
             for (let item of fields) {
17 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 27
             this.setData({
21 28
                 banner: res.data.photo || '',
22 29
                 fields,
23
-                options
30
+                options,
31
+                api: res.data.api
24 32
             });
25 33
         });
26 34
     },
@@ -29,7 +37,8 @@ new $.Page({
29 37
             name,
30 38
             phone,
31 39
             address,
32
-            notes
40
+            notes,
41
+            options
33 42
         } = this.data;
34 43
         if (!name || !phone || !address) {
35 44
             return $.wx.showToast({
@@ -44,17 +53,16 @@ new $.Page({
44 53
         $.wx.showToast({
45 54
             title: '加载中'
46 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 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 66
             $.wx.hideToast('loading');
59 67
             $.router.goto({
60 68
                 path: '/pages/order/index',
@@ -72,7 +80,7 @@ new $.Page({
72 80
         const {
73 81
             options
74 82
         } = this.data;
75
-        options[index] = value;
83
+        options[index].value = value;
76 84
         this.setData({
77 85
             options
78 86
         });

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

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

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

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

Loading…
取消
儲存