梁沛聪 6 vuotta sitten
vanhempi
commit
a0e07791dd

+ 5
- 0
miniapp/app/app.wxss Näytä tiedosto

@@ -189,4 +189,9 @@ button:after {
189 189
     font-size: 32rpx;
190 190
     color: #fff;
191 191
     text-align: center;
192
+}
193
+
194
+.slide-image {
195
+    width: 750rpx;
196
+    height: 446rpx;
192 197
 }

+ 1
- 1
miniapp/app/pages/bookService/index.js Näytä tiedosto

@@ -25,7 +25,7 @@ new $.Page({
25 25
                 });
26 26
             }
27 27
             this.setData({
28
-                banner: res.data.photo || '',
28
+                banner: res.data.photo.split(';') || [],
29 29
                 fields,
30 30
                 options,
31 31
                 api: res.data.api,

+ 10
- 2
miniapp/app/pages/bookService/index.wxml Näytä tiedosto

@@ -1,7 +1,15 @@
1 1
 <import src="/wxParse/wxParse.wxml" />
2 2
 <view class="page">
3
-    <view class="page-hd">
4
-        <image class="hero" src="{{banner}}"></image>
3
+    <view class="page-hd" wx:if="{{banner.length > 0}}">
4
+        <swiper indicator-dots="true" indicator-color="#ffffff" indicator-active-color="#00a0e9" autoplay="true"
5
+            interval="5000" duration="500">
6
+            <block wx:for="{{banner}}">
7
+                <swiper-item>
8
+                    <image src="{{item}}" class="slide-image" />
9
+                </swiper-item>
10
+            </block>
11
+        </swiper>
12
+        <!-- <image class="hero" src="{{banner}}"></image> -->
5 13
     </view>
6 14
     <view class="page-bd">
7 15
         <view class="mod">

+ 1
- 0
miniapp/app/pages/bookService/index.wxss Näytä tiedosto

@@ -104,3 +104,4 @@ radio-group {
104 104
 button[type=default].button-hover{
105 105
     background-color: #ddd;
106 106
 }
107
+

+ 15
- 16
miniapp/app/pages/cart/index.js Näytä tiedosto

@@ -20,7 +20,7 @@ new $.Page({
20 20
     },
21 21
 
22 22
     getCarts() {
23
-        $.request('shop/getCartList', 'GET', {}).then((res) => {
23
+        $.request('shopcars', 'GET', {}).then((res) => {
24 24
             $.wx.hideToast('loading');
25 25
             if (res.data && res.data.length > 0) {
26 26
                 this.setData({
@@ -55,9 +55,7 @@ new $.Page({
55 55
         $.wx.showToast({
56 56
             title: '删除中'
57 57
         }, 'loading');
58
-        $.request('shop/deleteCart', 'POST', {
59
-            cart: id
60
-        }).then(() => {
58
+        $.request(`shopcar/${id}`, 'DELETE', {}).then(() => {
61 59
             $.wx.hideToast('loading');
62 60
             if (goodsList.length > 0) {
63 61
                 goodsList.splice(idx, 1);
@@ -76,19 +74,19 @@ new $.Page({
76 74
 
77 75
     // 删除选中的商品
78 76
     deleteSelected() {
79
-        let ids = '';
77
+        const ids = [];
80 78
         const goodsList = this.data.goodsList;
81 79
         goodsList.forEach((g) => {
82 80
             if (g.checked) {
83
-                ids = ids + (ids === '' ? g.cartId : (';' + g.cartId));
81
+                ids.push(g.id);
84 82
             }
85 83
         });
86 84
         if (ids.length > 0) {
87 85
             $.wx.showToast({
88 86
                 title: '删除中'
89 87
             }, 'loading');
90
-            $.request('shop/deleteCart', 'POST', {
91
-                cart: ids
88
+            $.request('shopcar/pdelete', 'DELETE', {
89
+                ids
92 90
             }).then(() => {
93 91
                 this.getCarts();
94 92
             });
@@ -139,8 +137,8 @@ new $.Page({
139 137
     minusAmount(e) {
140 138
         const idx = e.currentTarget.dataset.index;
141 139
         const goodsList = this.data.goodsList;
142
-        if (goodsList[idx].number > 1) {
143
-            goodsList[idx].number--;
140
+        if (goodsList[idx].product_amount > 1) {
141
+            goodsList[idx].product_amount--;
144 142
             this.setData({
145 143
                 goodsList,
146 144
                 hasAmountModify: true
@@ -152,7 +150,7 @@ new $.Page({
152 150
     addAmount(e) {
153 151
         const idx = e.currentTarget.dataset.index;
154 152
         const goodsList = this.data.goodsList;
155
-        goodsList[idx].number++;
153
+        goodsList[idx].product_amount++;
156 154
         this.setData({
157 155
             goodsList,
158 156
             hasAmountModify: true
@@ -167,7 +165,7 @@ new $.Page({
167 165
         goodsList.forEach((g) => {
168 166
             if (g.checked) {
169 167
                 selectedAmount++;
170
-                totalPrice += g.price * g.number;
168
+                totalPrice += g.price * g.product_amount;
171 169
             }
172 170
         });
173 171
         this.setData({
@@ -182,11 +180,12 @@ new $.Page({
182 180
         if (goodsList.length === 0) return;
183 181
         goodsList.forEach((g) => {
184 182
             carts.push({
185
-                [`${g.cartId}`]: g.number
183
+                id: g.id,
184
+                amount: g.product_amount
186 185
             });
187 186
         });
188
-        $.request('shop/updateCart', 'POST', {
189
-            cart: JSON.stringify(carts)
187
+        $.request('shopcar/pstore', 'POST', {
188
+            products_prices: cart
190 189
         }).then(() => {
191 190
             this.setData({
192 191
                 hasAmountModify: false
@@ -200,7 +199,7 @@ new $.Page({
200 199
         if (goodsList.length === 0) return;
201 200
         goodsList.forEach((g) => {
202 201
             if (g.checked) {
203
-                g.amount = g.number;
202
+                g.amount = g.product_amount;
204 203
                 products.push(g);
205 204
             }
206 205
         });

+ 7
- 8
miniapp/app/pages/cart/index.wxml Näytä tiedosto

@@ -2,32 +2,31 @@
2 2
     <view class="page-bd">
3 3
         <view class="module" wx:if="{{goodsList.length > 0}}">
4 4
             <view class="module-hd">
5
-                <text class="tit">佳电科技商城</text>
5
+                <text class="tit">玥子轩母婴产品</text>
6 6
                 <view class="text-right" bindtap="changeEditStatus">{{isEditing ? '完成' : '编辑'}}</view>
7 7
             </view>
8 8
             <view class="module-bd">
9 9
                 <view class="goods-item" wx:for="{{goodsList}}" bindtap="changeSelect" data-index="{{index}}">
10 10
                     <view class="left">
11 11
                         <image class="icon-check" src="/img/icon-circle-check{{item.checked ? 'ed' : ''}}.png"></image>
12
-                        <image class="goods-img" src="{{item.image}}"></image>
12
+                        <image class="goods-img" src="{{item.photo}}"></image>
13 13
                         <view class="goods-info">
14 14
                             <view class="num-counter" wx:if="{{isEditing}}">
15 15
                                 <view class="minus" catchtap="minusAmount" data-index="{{index}}">-</view>
16
-                                <text class="input-num">{{item.number}}</text>
16
+                                <text class="input-num">{{item.product_amount}}</text>
17 17
                                 <view class="plus" catchtap="addAmount" data-index="{{index}}">+</view>
18 18
                             </view>
19 19
                             <view class="goods-name" wx:else>{{item.name}}</view>
20 20
                             <view class="goods-price">
21
-                                <text class="unit">¥</text>{{item.price/100}}</view>
21
+                                <text class="unit">¥</text>{{item.price}}</view>
22 22
                         </view>
23 23
                     </view>
24 24
                     <view class="right">
25 25
                         <view class="btn-delete" wx:if="{{isEditing}}" catchtap="deleteGoods" data-index="{{index}}"
26
-                            data-id="{{item.cartId}}">
26
+                            data-id="{{item.id}}">
27 27
                             <text>删除</text>
28 28
                         </view>
29
-                        <view class="amount" wx:else>×{{item.number}}</view>
30
-
29
+                        <view class="amount" wx:else>×{{item.product_amount}}</view>
31 30
                     </view>
32 31
                 </view>
33 32
             </view>
@@ -49,7 +48,7 @@
49 48
                 </block>
50 49
                 <block wx:else>
51 50
                     <view class="total-price">合计:
52
-                        <text class="price">¥{{totalPrice/100}}</text>
51
+                        <text class="price">¥{{totalPrice}}</text>
53 52
                     </view>
54 53
                     <view class="btn-settle" bindtap="toSettle">去结算({{selectedAmount}})</view>
55 54
                 </block>

+ 1
- 1
miniapp/app/pages/cart/index.wxss Näytä tiedosto

@@ -83,7 +83,7 @@ text {
83 83
     height: 100rpx;
84 84
     line-height: 100rpx;
85 85
     font-size: 30rpx;
86
-    color: #1aad19;
86
+    color: #00a0e9;
87 87
     padding: 0 20rpx;
88 88
 }
89 89
 

+ 15
- 2
miniapp/app/pages/goodsDetail/index.js Näytä tiedosto

@@ -102,7 +102,7 @@ new $.Page({
102 102
                             $.router.goto({
103 103
                                 path: '/pages/order/index',
104 104
                                 type: $.ROUTER_TYPE.SWITCH_TAB
105
-                            })
105
+                            });
106 106
                         }, 2000);
107 107
                     }
108 108
                 });
@@ -110,6 +110,19 @@ new $.Page({
110 110
         });
111 111
     },
112 112
     toCart() {
113
-        
113
+        $.request('shopcar/add', 'POST', {
114
+            product_id: this.data.detail.id,
115
+            product_amount: this.data.amount || 1
116
+        }).then((res) => {
117
+            $.wx.showToast({
118
+                title: '添加成功'
119
+            });
120
+            setTimeout(function () {
121
+                $.router.goto({
122
+                    path: '/pages/cart/index',
123
+                    type: $.ROUTER_TYPE.SWITCH_TAB
124
+                });
125
+            }, 2000);
126
+        });
114 127
     }
115 128
 });

+ 3
- 0
miniapp/app/pages/home/index.js Näytä tiedosto

@@ -16,6 +16,9 @@ new $.Page({
16 16
                 introduce
17 17
             } = res;
18 18
             WxParse.wxParse('article', 'html', introduce, this);
19
+            for (let item of top) {
20
+                item.topPhoto = item.photo.split(';')[0];
21
+            }
19 22
             this.setData({
20 23
                 bottom,
21 24
                 top,

+ 1
- 1
miniapp/app/pages/home/index.wxml Näytä tiedosto

@@ -5,7 +5,7 @@
5 5
             interval="5000" duration="500">
6 6
             <block wx:for="{{top}}">
7 7
                 <swiper-item>
8
-                    <image src="{{item.photo}}" class="slide-image" data-name="{{item.server}}" data-id="{{item.id}}"
8
+                    <image src="{{item.topPhoto}}" class="slide-image" data-name="{{item.server}}" data-id="{{item.id}}"
9 9
                         bindtap="toDetail" />
10 10
                 </swiper-item>
11 11
             </block>

+ 0
- 5
miniapp/app/pages/home/index.wxss Näytä tiedosto

@@ -1,8 +1,3 @@
1
-.slide-image {
2
-    width: 100%;
3
-    height: 446rpx;
4
-}
5
-
6 1
 .bottom-banner {
7 2
     width: 100%;
8 3
 }

+ 1
- 1
miniapp/app/pages/yuesao/index.js Näytä tiedosto

@@ -25,7 +25,7 @@ new $.Page({
25 25
                 });
26 26
             }
27 27
             this.setData({
28
-                banner: res.data.photo || '',
28
+                banner: res.data.photo.split(';') || [],
29 29
                 fields,
30 30
                 options,
31 31
                 api: res.data.api,

+ 10
- 2
miniapp/app/pages/yuesao/index.wxml Näytä tiedosto

@@ -1,7 +1,15 @@
1 1
 <import src="/wxParse/wxParse.wxml" />
2 2
 <view class="page">
3
-    <view class="page-hd">
4
-        <image class="hero" src="{{banner}}"></image>
3
+    <view class="page-hd" wx:if="{{banner.length > 0}}">
4
+        <swiper indicator-dots="true" indicator-color="#ffffff" indicator-active-color="#00a0e9" autoplay="true"
5
+            interval="5000" duration="500">
6
+            <block wx:for="{{banner}}">
7
+                <swiper-item>
8
+                    <image src="{{item}}" class="slide-image" />
9
+                </swiper-item>
10
+            </block>
11
+        </swiper>
12
+        <!-- <image class="hero" src="{{banner}}"></image> -->
5 13
     </view>
6 14
     <view class="page-bd">
7 15
         <view class="mod">

+ 4
- 1
miniapp/app/pages/yuesao/index.wxss Näytä tiedosto

@@ -101,4 +101,7 @@ radio-group {
101 101
 
102 102
 button[type=default].button-hover{
103 103
     background-color: #ddd;
104
-}
104
+}
105
+
106
+
107
+    

Loading…
Peruuta
Tallenna