7">7
+  justify-content: center;
6 8
 
7 9
   .icon {
8
-    width: 72rpx;
9
-    height: 72rpx;
10
+    .flex-center(row);
11
+
12
+    justify-content: center;
13
+    width: 48rpx;
14
+    height: 48rpx;
15
+    background-color: @color-bg;
16
+    border-radius: 24rpx;
17
+
18
+    image {
19
+      width: 28rpx;
20
+      height: 28rpx;
21
+    }
10 22
   }
11 23
 
12 24
   .num {
13
-    padding: 0 @spacing-short-text;
25
+    min-width: 24rpx;
26
+    padding: 0 @spacing-text;
14 27
     color: #000;
15 28
     text-align: center;
16 29
   }

+ 6 - 2
src/component/stepper/stepper.wxml

@@ -1,5 +1,9 @@
1 1
 <view class="stepper">
2
-  <image class="icon" src="minus.svg" bindtap="bindminus" wx:if="{{ num !== 0 }}"></image>
2
+  <view class="icon">
3
+    <image src="{{num === 1 ? 'minus1' : 'minus2'}}.svg" bindtap="bindminus"></image>
4
+  </view>
3 5
   <text class="num" wx:if="{{ num !== 0 }}">{{ num }}</text>
4
-  <image class="icon" src="add.svg" bindtap="bindadd"></image>
6
+  <view class="icon">
7
+    <image src="add.svg" style="fill:#000" bindtap="bindadd"></image>
8
+  </view>
5 9
 </view>

+ 14 - 3
src/component/stepper/stepper.wxss

@@ -1,13 +1,24 @@
1 1
 .stepper {
2 2
   display: flex;
3 3
   align-items: center;
4
+  justify-content: center;
4 5
 }
5 6
 .stepper .icon {
6
-  width: 72rpx;
7
-  height: 72rpx;
7
+  display: flex;
8
+  align-items: center;
9
+  justify-content: center;
10
+  width: 48rpx;
11
+  height: 48rpx;
12
+  background-color: #efefef;
13
+  border-radius: 24rpx;
14
+}
15
+.stepper .icon image {
16
+  width: 28rpx;
17
+  height: 28rpx;
8 18
 }
9 19
 .stepper .num {
10
-  padding: 0 4rpx;
20
+  min-width: 24rpx;
21
+  padding: 0 12rpx;
11 22
   color: #000;
12 23
   text-align: center;
13 24
 }

+ 10 - 4
src/pages/index/index.js

@@ -23,9 +23,17 @@ app.routerInterceptor.checkLoginStatus({
23 23
   /**
24 24
    * 生命周期函数--监听页面加载
25 25
    */
26
-  onLoad() {
27
-    this.getData()
26
+  onLoad(options) {
28 27
     wx.hideHomeButton()
28
+    const { room_id } = options
29
+    if (room_id !== undefined) {
30
+      wx.redirectTo({
31
+        url: `/pages/live/anchorHome/anchorHome?room_id=${room_id}`
32
+      })
33
+
34
+      return
35
+    }
36
+    this.getData()
29 37
   },
30 38
 
31 39
   getData() {
@@ -69,8 +77,6 @@ app.routerInterceptor.checkLoginStatus({
69 77
   bindstepperChanged(e) {
70 78
     const { nums, commodities } = this.data
71 79
     nums[e.currentTarget.dataset.index] = e.detail
72
-    console.log(commodities)
73
-    console.log(nums)
74 80
     const total = commodities.reduce(
75 81
       (accumulator, cur, index) =>
76 82
         accumulator + (cur.price * 100 * nums[index]) / 100,

+ 5 - 3
src/pages/index/index.less

@@ -148,7 +148,7 @@ page {
148 148
       .commodity-left {
149 149
         .flex-center(row);
150 150
 
151
-        height: 200rpx;
151
+        height: 220rpx;
152 152
 
153 153
         .commodity-img {
154 154
           width: 180rpx;
@@ -158,6 +158,7 @@ page {
158 158
         .commodity-content {
159 159
           display: flex;
160 160
           flex-direction: column;
161
+          width: 360rpx;
161 162
           height: 100%;
162 163
           margin-left: @spacing-item;
163 164
 
@@ -190,6 +191,7 @@ page {
190 191
       display: flex;
191 192
       flex-direction: column;
192 193
       align-items: flex-end;
194
+      justify-content: flex-end;
193 195
       width: 100rpx;
194 196
       height: 100%;
195 197
 
@@ -210,14 +212,14 @@ page {
210 212
           display: flex;
211 213
           flex-direction: column;
212 214
           align-items: flex-end;
213
-          width: 200rpx;
214 215
           height: 40rpx;
215 216
           margin-top: @spacing-inline;
216 217
 
217 218
           text {
218
-            padding: 0 @spacing-short-text;
219
+            padding: 0 8rpx;
219 220
             font-size: @font-label;
220 221
             color: @color-bg;
222
+            white-space: nowrap;
221 223
             background-color: @color-light-gray;
222 224
             border-radius: @radius;
223 225
           }

+ 8 - 6
src/pages/index/index.wxss

@@ -91,7 +91,7 @@ page {
91 91
 .commodity-container .commodity-title-container .title {
92 92
   font-size: 14pt;
93 93
   font-weight: 600;
94
-  color: #000;
94
+  color: #111;
95 95
 }
96 96
 .commodity-container .commodity-title-container .expired {
97 97
   margin-top: 4rpx;
@@ -121,7 +121,7 @@ page {
121 121
 .commodity-container .commodity-list .commodity-item .commodity-left {
122 122
   display: flex;
123 123
   align-items: center;
124
-  height: 200rpx;
124
+  height: 220rpx;
125 125
 }
126 126
 .commodity-container .commodity-list .commodity-item .commodity-left .commodity-img {
127 127
   width: 180rpx;
@@ -130,6 +130,7 @@ page {
130 130
 .commodity-container .commodity-list .commodity-item .commodity-left .commodity-content {
131 131
   display: flex;
132 132
   flex-direction: column;
133
+  width: 360rpx;
133 134
   height: 100%;
134 135
   margin-left: 24rpx;
135 136
 }
@@ -155,6 +156,7 @@ page {
155 156
   display: flex;
156 157
   flex-direction: column;
157 158
   align-items: flex-end;
159
+  justify-content: flex-end;
158 160
   width: 100rpx;
159 161
   height: 100%;
160 162
 }
@@ -174,14 +176,14 @@ page {
174 176
   display: flex;
175 177
   flex-direction: column;
176 178
   align-items: flex-end;
177
-  width: 200rpx;
178 179
   height: 40rpx;
179 180
   margin-top: 12rpx;
180 181
 }
181 182
 .commodity-container .commodity-list .commodity-right .stepper-container .bought-tip text {
182
-  padding: 0 4rpx;
183
+  padding: 0 8rpx;
183 184
   font-size: 8pt;
184 185
   color: #efefef;
186
+  white-space: nowrap;
185 187
   background-color: #959595;
186 188
   border-radius: 5px;
187 189
 }
@@ -226,7 +228,7 @@ page {
226 228
   margin-left: 12rpx;
227 229
   font-size: 11pt;
228 230
   font-weight: 600;
229
-  color: #000;
231
+  color: #111;
230 232
 }
231 233
 .consumer-container .consumer-item .consumer-info .time {
232 234
   margin-top: 4rpx;
@@ -257,7 +259,7 @@ page {
257 259
   height: 160rpx;
258 260
   padding: 24rpx;
259 261
   background-color: #fff;
260
-  box-shadow: 0 -5px 9px 2px rgba(0, 0, 0, 0.1);
262
+  box-shadow: 0 -5px 9px 2px rgba(17, 17, 17, 0.1);
261 263
 }
262 264
 .btn-footer .btn-footer-container {
263 265
   display: flex;

+ 42 - 0
src/pages/live/anchorHome/anchorHome.js

@@ -0,0 +1,42 @@
1
+const WxParse = require('../../../utils/wxParse/wxParse.js')
2
+
3
+const app = getApp()
4
+
5
+app.routerInterceptor.checkLoginStatus({
6
+  /**
7
+   * 页面的初始数据
8
+   */
9
+  data: {
10
+    anchor: {},
11
+    rooms: [],
12
+    isLodding: false
13
+  },
14
+
15
+  /**
16
+   * 生命周期函数--监听页面加载
17
+   */
18
+  onLoad(options) {
19
+    this.getData(options)
20
+    wx.hideHomeButton()
21
+  },
22
+
23
+  getData(options) {
24
+    const { room_id } = options
25
+    const that = this
26
+    app.network.post({
27
+      url: app.urls.LIVE.ROOM_ANCHOR,
28
+      data: {
29
+        room_id
30
+      },
31
+      success(res) {
32
+        const { anchor, rooms } = res.data
33
+        WxParse.wxParse('intro', 'html', anchor.anchor_intro, that, 5)
34
+        that.setData({
35
+          anchor,
36
+          rooms,
37
+          isLodding: true
38
+        })
39
+      }
40
+    })
41
+  }
42
+})

+ 3 - 0
src/pages/live/anchorHome/anchorHome.json

@@ -0,0 +1,3 @@
1
+{
2
+  "usingComponents": {}
3
+}

+ 67 - 0
src/pages/live/anchorHome/anchorHome.less

@@ -0,0 +1,67 @@
1
+@import './src/style/less/variable.less';
2
+@import './src/style/less/layout.less';
3
+@import './src/style/less/shape.less';
4
+@import '/template/footer/footer.wxss';
5
+@import '/template/btn/btn.wxss';
6
+@import '/utils/wxParse/wxParse.wxss';
7
+
8
+page {
9
+  width: 100%;
10
+  height: 100%;
11
+  background-color: @color-bg;
12
+}
13
+
14
+.wrap {
15
+  box-sizing: border-box;
16
+  display: flex;
17
+  flex-direction: column;
18
+  align-items: center;
19
+  height: 100%;
20
+  background-color: @color-bg;
21
+}
22
+
23
+.header {
24
+  position: relative;
25
+  width: 100%;
26
+
27
+  .banner-img {
28
+    position: absolute;
29
+    width: 750rpx;
30
+    height: 400rpx;
31
+  }
32
+
33
+  .user-info {
34
+    position: relative;
35
+    box-sizing: border-box;
36
+    display: flex;
37
+    align-items: flex-end;
38
+    width: 750rpx;
39
+    height: 200rpx;
40
+    padding: 0 @spacing-item @spacing-item;
41
+    margin-top: 200rpx;
42
+    background-image: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.8));
43
+
44
+    .avatar {
45
+      width: 100rpx;
46
+      height: 100rpx;
47
+      border-radius: 6px;
48
+    }
49
+
50
+    .nickname {
51
+      margin: 0 0 @spacing-inline @spacing-inline;
52
+      font-size: @font-primary;
53
+      color: #fff;
54
+    }
55
+  }
56
+}
57
+
58
+.main {
59
+  box-sizing: border-box;
60
+  width: @visual-width;
61
+  margin-top: @spacing-view;
62
+}
63
+
64
+.anchor-intro {
65
+  width: 100%;
66
+  margin-top: @spacing-item;
67
+}

+ 24 - 0
src/pages/live/anchorHome/anchorHome.wxml

@@ -0,0 +1,24 @@
1
+<view
2
+  style="postition:z-index:999;background-color:#fff;width:100%;height:100%;"
3
+  wx:if="{{ !isLodding }}"
4
+></view>
5
+<scroll-view
6
+  class="wrap"
7
+  scroll-y="{{ true }}"
8
+  enable-flex="{{ true }}"
9
+  >
10
+  <view class="header">
11
+    <image class="banner-img" src="{{ anchor.banner }}"></image>
12
+
13
+    <view class="user-info">
14
+      <image class="avatar" src="{{ anchor.anchor_avatar }}"></image>
15
+      <text class="nickname">{{ anchor.anchor_name }}</text>
16
+    </view>
17
+  </view>
18
+  <view class="main">
19
+    <view class="anchor-intro">
20
+      <import src="/utils/wxParse/wxParse.wxml"></import>
21
+      <template is="wxParse" data="{{wxParseData:intro.nodes}}"></template>
22
+    </view>
23
+  </view>
24
+</scroll-view>

+ 55 - 0
src/pages/live/anchorHome/anchorHome.wxss

@@ -0,0 +1,55 @@
1
+@import '/template/footer/footer.wxss';
2
+@import '/template/btn/btn.wxss';
3
+@import '/utils/wxParse/wxParse.wxss';
4
+page {
5
+  width: 100%;
6
+  height: 100%;
7
+  background-color: #efefef;
8
+}
9
+.wrap {
10
+  box-sizing: border-box;
11
+  display: flex;
12
+  flex-direction: column;
13
+  align-items: center;
14
+  height: 100%;
15
+  background-color: #efefef;
16
+}
17
+.header {
18
+  position: relative;
19
+  width: 100%;
20
+}
21
+.header .banner-img {
22
+  position: absolute;
23
+  width: 750rpx;
24
+  height: 400rpx;
25
+}
26
+.header .user-info {
27
+  position: relative;
28
+  box-sizing: border-box;
29
+  display: flex;
30
+  align-items: flex-end;
31
+  width: 750rpx;
32
+  height: 200rpx;
33
+  padding: 0 24rpx 24rpx;
34
+  margin-top: 200rpx;
35
+  background-image: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.8));
36
+}
37
+.header .user-info .avatar {
38
+  width: 100rpx;
39
+  height: 100rpx;
40
+  border-radius: 6px;
41
+}
42
+.header .user-info .nickname {
43
+  margin: 0 0 12rpx 12rpx;
44
+  font-size: 14pt;
45
+  color: #fff;
46
+}
47
+.main {
48
+  box-sizing: border-box;
49
+  width: 702rpx;
50
+  margin-top: 36rpx;
51
+}
52
+.anchor-intro {
53
+  width: 100%;
54
+  margin-top: 24rpx;
55
+}

+ 134 - 0
src/pages/live/order/order.js

@@ -0,0 +1,134 @@
1
+const app = getApp()
2
+
3
+app.routerInterceptor.checkLoginStatus({
4
+  /**
5
+   * Page initial data
6
+   */
7
+  data: {
8
+    hasAddress: false,
9
+    goodsInfo: {},
10
+    address: {},
11
+    order_id: '',
12
+    prepay_id: '',
13
+    total: 0,
14
+    amount: 1,
15
+    isLoading: false
16
+  },
17
+
18
+  onLoad(options) {
19
+    wx.hideHomeButton()
20
+    const that = this
21
+    const { userInfo } = app.globalData
22
+    this.getGoods(options)
23
+
24
+    if (userInfo.consignee_name !== '' && userInfo.consignee_name !== null) {
25
+      that.setData({
26
+        address: {
27
+          userName: userInfo.consignee_name,
28
+          telNumber: userInfo.consignee_phone,
29
+          detailInfo: userInfo.consignee_address
30
+        },
31
+        hasAddress: true
32
+      })
33
+    }
34
+  },
35
+
36
+  getGoods(options) {
37
+    const { room_id, goods_id, share_openid } = options
38
+    const _self = this
39
+    app.network.post({
40
+      url: app.urls.LIVE.GOODS_DETAIL,
41
+      data: {
42
+        goods_id,
43
+        room_id
44
+      },
45
+      success(res) {
46
+        const { goods_info } = res.data
47
+        if (goods_info.price_type === 3) {
48
+          const tmp = goods_info.price
49
+          goods_info.price = goods_info.price2
50
+          goods_info.price2 = tmp
51
+        }
52
+        _self.setData({
53
+          goodsInfo: goods_info,
54
+          anchor_id: res.data.anchor_id,
55
+          room_id,
56
+          share_openid,
57
+          goods_id,
58
+          total: res.data.goods_info.price,
59
+          isLoading: true
60
+        })
61
+      }
62
+    })
63
+  },
64
+
65
+  bindstepperChanged(e) {
66
+    this.setData({
67
+      amount: e.detail,
68
+      total: this.data.goodsInfo.price * e.detail
69
+    })
70
+  },
71
+
72
+  navigateToAddress() {
73
+    const that = this
74
+    wx.chooseAddress({
75
+      success: res => {
76
+        res.detailInfo =
77
+          res.provinceName + res.cityName + res.countyName + res.detailInfo
78
+        that.setData({
79
+          address: res,
80
+          hasAddress: true
81
+        })
82
+      }
83
+    })
84
+  },
85
+
86
+  confirm() {
87
+    const that = this
88
+    app.network.post({
89
+      url: app.urls.LIVE.ORDER_CREATE,
90
+      data: {
91
+        anchor_id: this.data.anchor_id,
92
+        room_id: this.data.room_id,
93
+        share_openid: this.data.share_openid,
94
+        goods_id: this.data.goods_id,
95
+        total_fee: this.data.total,
96
+        amount: this.data.amount,
97
+        name: this.data.address.userName || '',
98
+        phone: this.data.address.telNumber || '',
99
+        address: this.data.address.detailInfo || '',
100
+        body: '尖货接龙'
101
+      },
102
+      success(res1) {
103
+        const { wxpay_params } = res1.data
104
+        that.setData({
105
+          order_id: res1.data.order_id,
106
+          prepay_id: res1.data.prepay_id
107
+        })
108
+        wx.requestPayment({
109
+          timeStamp: wxpay_params.timeStamp,
110
+          nonceStr: wxpay_params.nonceStr,
111
+          package: wxpay_params.package,
112
+          signType: wxpay_params.signType,
113
+          paySign: wxpay_params.paySign,
114
+          success: _ => {
115
+            wx.redirectTo({
116
+              url: '/template/resultView/resultView'
117
+            })
118
+          },
119
+          fail: res2 => {
120
+            if (res2.errMsg === 'requestPayment:fail cancel') {
121
+              app.network.post({
122
+                url: app.urls.LIVE.ORDER_CANCEL,
123
+                data: {
124
+                  order_id: that.data.order_id,
125
+                  prepay_id: that.data.prepay_id
126
+                }
127
+              })
128
+            }
129
+          }
130
+        })
131
+      }
132
+    })
133
+  }
134
+})

+ 6 - 0
src/pages/live/order/order.json

@@ -0,0 +1,6 @@
1
+{
2
+  "usingComponents": {
3
+    "stepper": "/component/stepper/stepper"
4
+  },
5
+  "disableScroll": true
6
+}

+ 248 - 0
src/pages/live/order/order.less

@@ -0,0 +1,248 @@
1
+@import './src/style/less/variable.less';
2
+@import './src/style/less/layout.less';
3
+@import './src/style/less/shape.less';
4
+@import '/template/footer/footer.wxss';
5
+@import '/template/btn/btn.wxss';
6
+
7
+.order-view {
8
+  .flex-center(column);
9
+  .with-btnFooter();
10
+
11
+  width: 100%;
12
+  background-color: @color-bg;
13
+
14
+  text {
15
+    color: @color-black;
16
+  }
17
+
18
+  view {
19
+    color: @color-black;
20
+  }
21
+}
22
+
23
+.address {
24
+  .flex-center(row);
25
+
26
+  box-sizing: border-box;
27
+  width: @visual-width;
28
+  min-height: 80rpx;
29
+  padding: 0 @spacing-item;
30
+  margin: @spacing-item;
31
+  background-color: @color-white;
32
+  border-radius: @radius;
33
+
34
+  .item() {
35
+    .square(40rpx);
36
+
37
+    .icon {
38
+      .full-image();
39
+    }
40
+  }
41
+
42
+  .left {
43
+    .item();
44
+  }
45
+
46
+  .content {
47
+    .flex-center(column);
48
+
49
+    box-sizing: border-box;
50
+    width: @visual-width - 80rpx - @spacing-item * 2;
51
+    min-height: 80rpx;
52
+    padding: @spacing-inline @spacing-item;
53
+
54
+    view {
55
+      .flex-center(row);
56
+
57
+      width: 100%;
58
+      margin-top: @spacing-inline;
59
+    }
60
+
61
+    .top {
62
+      justify-content: flex-start;
63
+
64
+      .name {
65
+        font-size: @font-primary;
66
+      }
67
+
68
+      .phone {
69
+        margin-left: @spacing-item;
70
+        font-size: @font-quaternary;
71
+        color: @color-gray;
72
+      }
73
+    }
74
+
75
+    .bottom {
76
+      font-size: @font-tertiary;
77
+    }
78
+  }
79
+
80
+  .right {
81
+    .item();
82
+
83
+    .arrow {
84
+      .arrow(right; @color-dark-bg; @icon-small-size);
85
+    }
86
+  }
87
+
88
+  &-hover {
89
+    background-color: darken(@color-white, 15%);
90
+  }
91
+}
92
+
93
+.authorization {
94
+  justify-content: center;
95
+
96
+  text {
97
+    margin-left: @spacing-short-text;
98
+    font-size: @font-primary;
99
+    color: @color-brand;
100
+  }
101
+
102
+  .plus {
103
+    .plus(6rpx; @color-brand);
104
+    .square(@icon-small-size);
105
+  }
106
+}
107
+
108
+.goods {
109
+  .flex-center(row);
110
+
111
+  align-items: center;
112
+  width: @visual-width;
113
+  min-height: 200rpx;
114
+  margin-top: @spacing-inline;
115
+  background-color: @color-white;
116
+  border-radius: @radius;
117
+
118
+  .left {
119
+    .flex-center(row);
120
+
121
+    justify-content: center;
122
+    width: 200rpx;
123
+    height: 200rpx;
124
+
125
+    image {
126
+      .square(160rpx);
127
+
128
+      border-radius: @radius;
129
+    }
130
+  }
131
+
132
+  .right {
133
+    display: flex;
134
+    flex-direction: column;
135
+    justify-content: space-between;
136
+    width: @visual-width - 200rpx;
137
+    min-height: 160rpx;
138
+    margin: @spacing-inline 0;
139
+
140
+    .top {
141
+      display: flex;
142
+      flex-direction: column;
143
+      width: 100%;
144
+
145
+      .title {
146
+        font-size: @font-primary;
147
+      }
148
+
149
+      .inventory {
150
+        font-size: @font-quaternary;
151
+        color: @color-light-gray;
152
+      }
153
+    }
154
+
155
+    .bottom {
156
+      .flex-center(row);
157
+
158
+      box-sizing: border-box;
159
+      justify-content: space-between;
160
+      width: 100%;
161
+      padding-right: @spacing-inline;
162
+
163
+      .price-group {
164
+        .flex-center(row);
165
+
166
+        .price1 {
167
+          display: flex;
168
+          align-items: flex-end;
169
+
170
+          text {
171
+            color: @color-gray;
172
+          }
173
+
174
+          .value {
175
+            font-size: @font-secondary;
176
+          }
177
+
178
+          .symbol {
179
+            margin-bottom: 2px;
180
+            font-size: @font-quaternary;
181
+          }
182
+        }
183
+
184
+        .price2 {
185
+          display: flex;
186
+          align-items: flex-end;
187
+          margin-left: @spacing-inline;
188
+
189
+          text {
190
+            color: @color-light-gray;
191
+          }
192
+
193
+          .value {
194
+            font-size: @font-tertiary;
195
+            text-decoration: line-through;
196
+          }
197
+        }
198
+      }
199
+    }
200
+  }
201
+}
202
+
203
+.btn-footer {
204
+  .flex-center(row);
205
+
206
+  position: fixed;
207
+  bottom: 0;
208
+  box-sizing: border-box;
209
+  justify-content: center;
210
+  width: 100%;
211
+  height: @btnFooter-height;
212
+  padding: @spacing-item;
213
+  background-color: @color-white;
214
+  box-shadow: 0 -5px 9px 2px fade(@color-black, 10%);
215
+
216
+  .btn-footer-container {
217
+    display: flex;
218
+    width: 100%;
219
+    height: 100rpx;
220
+    overflow: hidden;
221
+    border: 1px #09bb07 solid;
222
+    border-radius: @radius;
223
+
224
+    &-disabled {
225
+      border: 1px @color-light-gray solid !important;
226
+    }
227
+
228
+    .left {
229
+      .flex-center(row);
230
+
231
+      justify-content: center;
232
+      width: 40%;
233
+      height: 100rpx;
234
+      background-color: @color-white;
235
+
236
+      text {
237
+        font-size: @font-primary;
238
+        font-weight: 700;
239
+        color: #e64340;
240
+      }
241
+    }
242
+
243
+    .right {
244
+      width: 100%;
245
+      height: 100%;
246
+    }
247
+  }
248
+}

+ 79 - 0
src/pages/live/order/order.wxml

@@ -0,0 +1,79 @@
1
+<view class="order-view">
2
+  <view
3
+    class="address"
4
+    hover-class="address-hover"
5
+    bindtap="navigateToAddress"
6
+    wx:if="{{ hasAddress }}"
7
+  >
8
+    <view class="left">
9
+      <image class="icon" src="/resources/common/location.png"></image>
10
+    </view>
11
+    <view class="content">
12
+      <view class="top">
13
+        <text class="name">{{ address.userName }}</text>
14
+        <text class="phone">{{ address.telNumber }}</text>
15
+      </view>
16
+      <view class="bottom">{{ address.detailInfo }}</view>
17
+    </view>
18
+    <view class="right">
19
+      <view class="icon arrow"></view>
20
+    </view>
21
+  </view>
22
+  <view
23
+    class="address authorization"
24
+    hover-class="address-hover"
25
+    bindtap="navigateToAddress"
26
+    wx:elif="{{ !hasAddress }}"
27
+  >
28
+    <view class="plus"></view>
29
+    <text>新建地址</text>
30
+  </view>
31
+  <view class="goods-container" wx:if="{{ isLoading }}">
32
+    <view class="goods">
33
+      <view class="left">
34
+        <image src="{{ goodsInfo.goods_img }}" mode="aspectFit"></image>
35
+      </view>
36
+      <view class="right">
37
+        <view class="top">
38
+          <text class="title">{{ goodsInfo.name }}</text>
39
+          <text class="inventory" wx:if="{{ goodsInfo.inventory > 0 }}"
40
+            >仅剩{{ goodsInfo.inventory }}个</text
41
+          >
42
+          <text class="inventory" wx:else>库存不足</text>
43
+        </view>
44
+        <view class="bottom">
45
+          <view class="price-group">
46
+            <view class="price1">
47
+              <text class="symbol">¥</text>
48
+              <text class="value">{{ goodsInfo.price / 100 }}</text>
49
+            </view>
50
+            <view class="price2" wx:if="{{ goodsInfo.price_type === 3 }}">
51
+              <text class="value">¥{{ goodsInfo.price2 / 100 }}</text>
52
+            </view>
53
+          </view>
54
+          <stepper
55
+            num="{{ num }}"
56
+            bindstepperChanged="bindstepperChanged"
57
+            wx:if="{{ goodsInfo.inventory > 0 }}"
58
+          ></stepper>
59
+        </view>
60
+      </view>
61
+    </view>
62
+  </view>
63
+</view>
64
+
65
+<import src="/template/btn/btn.wxml"></import>
66
+<view class="btn-footer">
67
+  <view
68
+    class="btn-footer-container {{hasAddress && goodsInfo.inventory > 0 ? '' : 'btn-footer-container-disabled'}}">
69
+    <view class="left" wx:if="{{ total > 0 & goodsInfo.inventory > 0 }}">
70
+      <text class="money">¥{{ total / 100 }}</text>
71
+    </view>
72
+    <view class="right">
73
+      <template
74
+        is="iconBtn"
75
+        data="{{btnClass: 'button4', btnTxt: goodsInfo.inventory > 0 ? '立即支付' : '库存不足', disabled: !(hasAddress && goodsInfo.inventory > 0), action: 'confirm'}}"
76
+      ></template>
77
+    </view>
78
+  </view>
79
+</view>

+ 236 - 0
src/pages/live/order/order.wxss

@@ -0,0 +1,236 @@
1
+@import '/template/footer/footer.wxss';
2
+@import '/template/btn/btn.wxss';
3
+.order-view {
4
+  display: flex;
5
+  flex-direction: column;
6
+  align-items: center;
7
+  height: calc(100% - 160rpx);
8
+  width: 100%;
9
+  background-color: #efefef;
10
+}
11
+.order-view text {
12
+  color: #111;
13
+}
14
+.order-view view {
15
+  color: #111;
16
+}
17
+.address {
18
+  display: flex;
19
+  align-items: center;
20
+  box-sizing: border-box;
21
+  width: 702rpx;
22
+  min-height: 80rpx;
23
+  padding: 0 24rpx;
24
+  margin: 24rpx;
25
+  background-color: #fff;
26
+  border-radius: 5px;
27
+}
28
+.address .left {
29
+  width: 40rpx;
30
+  height: 40rpx;
31
+}
32
+.address .left .icon {
33
+  width: 100%;
34
+  height: 100%;
35
+}
36
+.address .content {
37
+  display: flex;
38
+  flex-direction: column;
39
+  align-items: center;
40
+  box-sizing: border-box;
41
+  width: 574rpx;
42
+  min-height: 80rpx;
43
+  padding: 12rpx 24rpx;
44
+}
45
+.address .content view {
46
+  display: flex;
47
+  align-items: center;
48
+  width: 100%;
49
+  margin-top: 12rpx;
50
+}
51
+.address .content .top {
52
+  justify-content: flex-start;
53
+}
54
+.address .content .top .name {
55
+  font-size: 14pt;
56
+}
57
+.address .content .top .phone {
58
+  margin-left: 24rpx;
59
+  font-size: 10pt;
60
+  color: #3e3e3e;
61
+}
62
+.address .content .bottom {
63
+  font-size: 11pt;
64
+}
65
+.address .right {
66
+  width: 40rpx;
67
+  height: 40rpx;
68
+}
69
+.address .right .icon {
70
+  width: 100%;
71
+  height: 100%;
72
+}
73
+.address .right .arrow {
74
+  width: 32rpx;
75
+  height: 32rpx;
76
+  box-sizing: border-box;
77
+  border-top: 2px solid #3e3e3e;
78
+  border-right: 2px solid #3e3e3e;
79
+  transform: rotate(45deg);
80
+}
81
+.address-hover {
82
+  background-color: #d9d9d9;
83
+}
84
+.authorization {
85
+  justify-content: center;
86
+}
87
+.authorization text {
88
+  margin-left: 4rpx;
89
+  font-size: 14pt;
90
+  color: #09bb07;
91
+}
92
+.authorization .plus {
93
+  position: relative;
94
+  width: 32rpx;
95
+  height: 32rpx;
96
+}
97
+.authorization .plus::before {
98
+  position: absolute;
99
+  top: calc(50% - 6rpx / 2);
100
+  left: 0;
101
+  width: 100%;
102
+  height: 6rpx;
103
+  content: '';
104
+  background-color: #09bb07;
105
+  border-radius: 6rpx;
106
+}
107
+.authorization .plus::after {
108
+  position: absolute;
109
+  top: 0;
110
+  left: calc(50% - 6rpx / 2);
111
+  width: 6rpx;
112
+  height: 100%;
113
+  content: '';
114
+  background-color: #09bb07;
115
+  border-radius: 6rpx;
116
+}
117
+.goods {
118
+  display: flex;
119
+  align-items: center;
120
+  width: 702rpx;
121
+  min-height: 200rpx;
122
+  margin-top: 12rpx;
123
+  background-color: #fff;
124
+  border-radius: 5px;
125
+}
126
+.goods .left {
127
+  display: flex;
128
+  align-items: center;
129
+  justify-content: center;
130
+  width: 200rpx;
131
+  height: 200rpx;
132
+}
133
+.goods .left image {
134
+  width: 160rpx;
135
+  height: 160rpx;
136
+  border-radius: 5px;
137
+}
138
+.goods .right {
139
+  display: flex;
140
+  flex-direction: column;
141
+  justify-content: space-between;
142
+  width: 502rpx;
143
+  min-height: 160rpx;
144
+  margin: 12rpx 0;
145
+}
146
+.goods .right .top {
147
+  display: flex;
148
+  flex-direction: column;
149
+  width: 100%;
150
+}
151
+.goods .right .top .title {
152
+  font-size: 14pt;
153
+}
154
+.goods .right .top .inventory {
155
+  font-size: 10pt;
156
+  color: #959595;
157
+}
158
+.goods .right .bottom {
159
+  display: flex;
160
+  align-items: center;
161
+  box-sizing: border-box;
162
+  justify-content: space-between;
163
+  width: 100%;
164
+  padding-right: 12rpx;
165
+}
166
+.goods .right .bottom .price-group {
167
+  display: flex;
168
+  align-items: center;
169
+}
170
+.goods .right .bottom .price-group .price1 {
171
+  display: flex;
172
+  align-items: flex-end;
173
+}
174
+.goods .right .bottom .price-group .price1 text {
175
+  color: #3e3e3e;
176
+}
177
+.goods .right .bottom .price-group .price1 .value {
178
+  font-size: 13pt;
179
+}
180
+.goods .right .bottom .price-group .price1 .symbol {
181
+  margin-bottom: 2px;
182
+  font-size: 10pt;
183
+}
184
+.goods .right .bottom .price-group .price2 {
185
+  display: flex;
186
+  align-items: flex-end;
187
+  margin-left: 12rpx;
188
+}
189
+.goods .right .bottom .price-group .price2 text {
190
+  color: #959595;
191
+}
192
+.goods .right .bottom .price-group .price2 .value {
193
+  font-size: 11pt;
194
+  text-decoration: line-through;
195
+}
196
+.btn-footer {
197
+  display: flex;
198
+  align-items: center;
199
+  position: fixed;
200
+  bottom: 0;
201
+  box-sizing: border-box;
202
+  justify-content: center;
203
+  width: 100%;
204
+  height: 160rpx;
205
+  padding: 24rpx;
206
+  background-color: #fff;
207
+  box-shadow: 0 -5px 9px 2px rgba(17, 17, 17, 0.1);
208
+}
209
+.btn-footer .btn-footer-container {
210
+  display: flex;
211
+  width: 100%;
212
+  height: 100rpx;
213
+  overflow: hidden;
214
+  border: 1px #09bb07 solid;
215
+  border-radius: 5px;
216
+}
217
+.btn-footer .btn-footer-container-disabled {
218
+  border: 1px #959595 solid !important;
219
+}
220
+.btn-footer .btn-footer-container .left {
221
+  display: flex;
222
+  align-items: center;
223
+  justify-content: center;
224
+  width: 40%;
225
+  height: 100rpx;
226
+  background-color: #fff;
227
+}
228
+.btn-footer .btn-footer-container .left text {
229
+  font-size: 14pt;
230
+  font-weight: 700;
231
+  color: #e64340;
232
+}
233
+.btn-footer .btn-footer-container .right {
234
+  width: 100%;
235
+  height: 100%;
236
+}

+ 3 - 3
src/pages/order/order.wxss

@@ -9,10 +9,10 @@
9 9
   background-color: #efefef;
10 10
 }
11 11
 .order-view text {
12
-  color: #000;
12
+  color: #111;
13 13
 }
14 14
 .order-view view {
15
-  color: #000;
15
+  color: #111;
16 16
 }
17 17
 .address {
18 18
   display: flex;
@@ -169,7 +169,7 @@
169 169
   height: 160rpx;
170 170
   padding: 24rpx;
171 171
   background-color: #fff;
172
-  box-shadow: 0 -5px 9px 2px rgba(0, 0, 0, 0.1);
172
+  box-shadow: 0 -5px 9px 2px rgba(17, 17, 17, 0.1);
173 173
 }
174 174
 .btn-footer .btn-footer-container {
175 175
   display: flex;

+ 5 - 5
src/project.config.json

@@ -58,16 +58,16 @@
58 58
 			"list": [
59 59
 				{
60 60
 					"id": 0,
61
-					"name": "pages/cameraCompatible/cameraCompatible",
62
-					"pathName": "pages/cameraCompatible/cameraCompatible",
63
-					"query": "activity_id=nBJ56hN9ik94js4duSh34V&isSignIn=1",
64
-					"scene": 1047
61
+					"name": "pages/live/order/order",
62
+					"pathName": "pages/live/order/order",
63
+					"query": "room_id=24&share_openid='ccc'&goods_id=nHUqwuwaygHpos4hiekz7f",
64
+					"scene": 1007
65 65
 				},
66 66
 				{
67 67
 					"id": 1,
68 68
 					"name": "pages/index/index",
69 69
 					"pathName": "pages/index/index",
70
-					"query": "q=http://kodo.tamron.cn/v/0+21+KUjsUKURRRRRRUK6KxxK",
70
+					"query": "room_id=17",
71 71
 					"scene": 1011
72 72
 				},
73 73
 				{

+ 1 - 1
src/style/less/variable.less

@@ -1,7 +1,7 @@
1 1
 //color
2 2
 @color-bg: #efefef;
3 3
 @color-dark-bg: #3e3e3e;
4
-@color-black: #000;
4
+@color-black: #111;
5 5
 @color-white: #fff;
6 6
 @color-brand: #09bb07;
7 7
 @color-other1: #d2b167;

+ 2 - 2
src/template/footer/footer.wxss

@@ -38,7 +38,7 @@
38 38
   width: 100%;
39 39
   height: 160rpx;
40 40
   background-color: #fff;
41
-  box-shadow: 0 -5px 9px 2px rgba(0, 0, 0, 0.1);
41
+  box-shadow: 0 -5px 9px 2px rgba(17, 17, 17, 0.1);
42 42
 }
43 43
 .btn-footer1 button {
44 44
   height: 100rpx;
@@ -55,7 +55,7 @@
55 55
   width: 100%;
56 56
   height: 160rpx;
57 57
   background-color: #fff;
58
-  box-shadow: 0 -5px 9px 2px rgba(0, 0, 0, 0.1);
58
+  box-shadow: 0 -5px 9px 2px rgba(17, 17, 17, 0.1);
59 59
 }
60 60
 .btn-footer2 button {
61 61
   height: 100rpx;

+ 2 - 26
src/template/resultView/resultView.js

@@ -13,32 +13,8 @@ Page({
13 13
     isHightlight: false
14 14
   },
15 15
 
16
-  onLoad(options) {
17
-    if (options.goods) {
18
-      const goods = JSON.parse(options.goods)
19
-      let desc = this.data.desc1
20
-      if (goods.only_for_member) {
21
-        desc = this.data.desc3
22
-      } else if (goods.good_type === 0) {
23
-        desc = this.data.desc2
24
-      }
25
-      this.setData({
26
-        isVirtual: goods.good_type === 1,
27
-        desc
28
-      })
29
-    } else {
30
-      const eventChannel = this.getOpenerEventChannel()
31
-      const that = this
32
-      eventChannel.on('acceptDataFromOpenerPage', data => {
33
-        that.setData({
34
-          title: data.title,
35
-          desc: data.desc,
36
-          action: 'navigateToMine',
37
-          btnTitle: data.btnTitle,
38
-          isHightlight: data.isHightlight
39
-        })
40
-      })
41
-    }
16
+  onLoad() {
17
+    wx.hideHomeButton()
42 18
   },
43 19
 
44 20
   navigateToMine() {

+ 7 - 10
src/template/resultView/resultView.wxml

@@ -1,24 +1,21 @@
1 1
 
2
-<view class="result-view" wx:if="{{isHightlight}}">
2
+<view class="result-view">
3 3
   <view class="logo">
4 4
     <image src="success.svg"></image>
5 5
   </view>
6 6
   <view class="content">
7
-    <text class="title">{{ title }}</text>
8
-    <view class="hint">
7
+    <text class="title">购买成功</text>
8
+    <!-- <view class="hint">
9 9
       <image src="/resources/trumpet.svg"></image>
10
-      <text>{{ desc }}</text>
11
-    </view>
10
+      <text>七天内发货</text>
11
+    </view> -->
12 12
     <view class="official-account">
13 13
       <official-account binderror="officialAccountError"></official-account>
14 14
     </view>
15 15
   </view>
16
-  <view class="action-bottom">
17
-    <view class="goOn" bindtap="{{ action }}">{{ btnTitle }}</view>
18
-  </view>
19 16
 </view>
20 17
 
21
-<view class="result-view" wx:else>
18
+<!-- <view class="result-view" wx:else>
22 19
   <view class="logo">
23 20
     <image src="success.svg"></image>
24 21
   </view>
@@ -30,4 +27,4 @@
30 27
     <view class="goOn" bindtap="{{ action }}">{{ btnTitle }}</view>
31 28
     <view class="detail" bindtap="navigateToVoucher" wx:if="{{ isVirtual }}">去查看</view>
32 29
   </view>
33
-</view>
30
+</view> -->

+ 1 - 1
src/template/resultView/resultView.wxss

@@ -28,7 +28,7 @@
28 28
   margin-top: 24rpx;
29 29
   font-size: 17pt;
30 30
   font-weight: 600;
31
-  color: #000;
31
+  color: #111;
32 32
 }
33 33
 .content .desc {
34 34
   margin-top: 24rpx;

+ 47 - 1
src/utils/network.js

@@ -149,7 +149,53 @@ function post(params, isTip = true) {
149 149
   })
150 150
 }
151 151
 
152
+function liveLogin(data) {
153
+  const params = data
154
+  wx.showLoading({
155
+    title: '加载中...',
156
+    mask: true
157
+  })
158
+  wx.login({
159
+    success(res1) {
160
+      if (res1.code) {
161
+        params.code = res1.code
162
+        wx.request({
163
+          url: urls.LIVE.LOGIN,
164
+          data: params,
165
+          method: 'POST',
166
+          header: {
167
+            'content-type': 'application/x-www-form-urlencoded'
168
+          },
169
+          success(res2) {
170
+            wx.setStorage({
171
+              key: 'userInfo',
172
+              data: res2.data.data
173
+            })
174
+          },
175
+          complete: () => {
176
+            wx.hideLoading()
177
+          }
178
+        })
179
+      } else {
180
+        wx.showToast({
181
+          title: '微信登录异常',
182
+          icon: 'none'
183
+        })
184
+        wx.hideLoading()
185
+      }
186
+    },
187
+    fail() {
188
+      wx.showToast({
189
+        title: '微信登录异常',
190
+        icon: 'none'
191
+      })
192
+      wx.hideLoading()
193
+    }
194
+  })
195
+}
196
+
152 197
 module.exports = {
153 198
   post,
154
-  login
199
+  login,
200
+  liveLogin
155 201
 }

+ 9 - 1
src/utils/urls.js

@@ -7,5 +7,13 @@ module.exports = {
7 7
 
8 8
   PACK: `${config.baseURL}/api/pack`,
9 9
   ORDER_CREATE: `${config.baseURL}/api/pay/wx/order_create`,
10
-  ORDER_CANCEL: `${config.baseURL}/api/pay/wx/order/cancel`
10
+  ORDER_CANCEL: `${config.baseURL}/api/pay/wx/order/cancel`,
11
+
12
+  LIVE: {
13
+    GOODS_DETAIL: `${config.baseURL}/api/live/goods/detail`,
14
+    ORDER_CREATE: `${config.baseURL}/api/live/order/create`,
15
+    ORDER_CANCEL: `${config.baseURL}/api/live/order/cancel`,
16
+    ROOM_ANCHOR: `${config.baseURL}/api/live/room/anchor/detail`,
17
+    LOGIN: `${config.baseURL}/api/mini/live/login`
18
+  }
11 19
 }

adminSystem - Gogs: Go Git Service

Keine Beschreibung

pagination.js 26KB

    module.exports = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = "/dist/"; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 55); /******/ }) /************************************************************************/ /******/ ({ /***/ 0: /***/ (function(module, exports) { /* globals __VUE_SSR_CONTEXT__ */ // IMPORTANT: Do NOT use ES2015 features in this file. // This module is a runtime utility for cleaner component module output and will // be included in the final webpack user bundle. module.exports = function normalizeComponent ( rawScriptExports, compiledTemplate, functionalTemplate, injectStyles, scopeId, moduleIdentifier /* server only */ ) { var esModule var scriptExports = rawScriptExports = rawScriptExports || {} // ES6 modules interop var type = typeof rawScriptExports.default if (type === 'object' || type === 'function') { esModule = rawScriptExports scriptExports = rawScriptExports.default } // Vue.extend constructor export interop var options = typeof scriptExports === 'function' ? scriptExports.options : scriptExports // render functions if (compiledTemplate) { options.render = compiledTemplate.render options.staticRenderFns = compiledTemplate.staticRenderFns options._compiled = true } // functional template if (functionalTemplate) { options.functional = true } // scopedId if (scopeId) { options._scopeId = scopeId } var hook if (moduleIdentifier) { // server build hook = function (context) { // 2.3 injection context = context || // cached call (this.$vnode && this.$vnode.ssrContext) || // stateful (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional // 2.2 with runInNewContext: true if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') { context = __VUE_SSR_CONTEXT__ } // inject component styles if (injectStyles) { injectStyles.call(this, context) } // register component module identifier for async chunk inferrence if (context && context._registeredComponents) { context._registeredComponents.add(moduleIdentifier) } } // used by ssr in case component is cached and beforeCreate // never gets called options._ssrRegister = hook } else if (injectStyles) { hook = injectStyles } if (hook) { var functional = options.functional var existing = functional ? options.render : options.beforeCreate if (!functional) { // inject component registration as beforeCreate hook options.beforeCreate = existing ? [].concat(existing, hook) : [hook] } else { // for template-only hot-reload because in that case the render fn doesn't // go through the normalizer options._injectStyles = hook // register for functioal component in vue file options.render = function renderWithStyleInjection (h, context) { hook.call(context) return existing(h, context) } } } return { esModule: esModule, exports: scriptExports, options: options } } /***/ }), /***/ 3: /***/ (function(module, exports) { module.exports = require("element-ui/lib/utils/util"); /***/ }), /***/ 5: /***/ (function(module, exports) { module.exports = require("element-ui/lib/mixins/locale"); /***/ }), /***/ 55: /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(56); /***/ }), /***/ 56: /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _pagination = __webpack_require__(57); var _pagination2 = _interopRequireDefault(_pagination); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /* istanbul ignore next */ _pagination2.default.install = function (Vue) { Vue.component(_pagination2.default.name, _pagination2.default); }; exports.default = _pagination2.default; /***/ }), /***/ 57: /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _pager = __webpack_require__(58); var _pager2 = _interopRequireDefault(_pager); var _select = __webpack_require__(61); var _select2 = _interopRequireDefault(_select); var _option = __webpack_require__(62); var _option2 = _interopRequireDefault(_option); var _input = __webpack_require__(6); var _input2 = _interopRequireDefault(_input); var _locale = __webpack_require__(5); var _locale2 = _interopRequireDefault(_locale); var _util = __webpack_require__(3); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.default = { name: 'ElPagination', props: { pageSize: { type: Number, default: 10 }, small: Boolean, total: Number, pageCount: Number, pagerCount: { type: Number, validator: function validator(value) { return (value | 0) === value && value > 4 && value < 22 && value % 2 === 1; }, default: 7 }, currentPage: { type: Number, default: 1 }, layout: { default: 'prev, pager, next, jumper, ->, total' }, pageSizes: { type: Array, default: function _default() { return [10, 20, 30, 40, 50, 100]; } }, popperClass: String, prevText: String, nextText: String, background: Boolean, disabled: Boolean }, data: function data() { return { internalCurrentPage: 1, internalPageSize: 0, lastEmittedPage: -1, userChangePageSize: false }; }, render: function render(h) { var template = h( 'div', { 'class': ['el-pagination', { 'is-background': this.background, 'el-pagination--small': this.small }] }, [] ); var layout = this.layout || ''; if (!layout) return; var TEMPLATE_MAP = { prev: h( 'prev', null, [] ), jumper: h( 'jumper', null, [] ), pager: h( 'pager', { attrs: { currentPage: this.internalCurrentPage, pageCount: this.internalPageCount, pagerCount: this.pagerCount, disabled: this.disabled }, on: { 'change': this.handleCurrentChange } }, [] ), next: h( 'next', null, [] ), sizes: h( 'sizes', { attrs: { pageSizes: this.pageSizes } }, [] ), slot: h( 'my-slot', null, [] ), total: h( 'total', null, [] ) }; var components = layout.split(',').map(function (item) { return item.trim(); }); var rightWrapper = h( 'div', { 'class': 'el-pagination__rightwrapper' }, [] ); var haveRightWrapper = false; template.children = template.children || []; rightWrapper.children = rightWrapper.children || []; components.forEach(function (compo) { if (compo === '->') { haveRightWrapper = true; return; } if (!haveRightWrapper) { template.children.push(TEMPLATE_MAP[compo]); } else { rightWrapper.children.push(TEMPLATE_MAP[compo]); } }); if (haveRightWrapper) { template.children.unshift(rightWrapper); } return template; }, components: { MySlot: { render: function render(h) { return this.$parent.$slots.default ? this.$parent.$slots.default[0] : ''; } }, Prev: { render: function render(h) { return h( 'button', { attrs: { type: 'button', disabled: this.$parent.disabled || this.$parent.internalCurrentPage <= 1 }, 'class': 'btn-prev', on: { 'click': this.$parent.prev } }, [this.$parent.prevText ? h( 'span', null, [this.$parent.prevText] ) : h( 'i', { 'class': 'el-icon el-icon-arrow-left' }, [] )] ); } }, Next: { render: function render(h) { return h( 'button', { attrs: { type: 'button', disabled: this.$parent.disabled || this.$parent.internalCurrentPage === this.$parent.internalPageCount || this.$parent.internalPageCount === 0 }, 'class': 'btn-next', on: { 'click': this.$parent.next } }, [this.$parent.nextText ? h( 'span', null, [this.$parent.nextText] ) : h( 'i', { 'class': 'el-icon el-icon-arrow-right' }, [] )] ); } }, Sizes: { mixins: [_locale2.default], props: { pageSizes: Array }, watch: { pageSizes: { immediate: true, handler: function handler(newVal, oldVal) { if ((0, _util.valueEquals)(newVal, oldVal)) return; if (Array.isArray(newVal)) { this.$parent.internalPageSize = newVal.indexOf(this.$parent.pageSize) > -1 ? this.$parent.pageSize : this.pageSizes[0]; } } } }, render: function render(h) { var _this = this; return h( 'span', { 'class': 'el-pagination__sizes' }, [h( 'el-select', { attrs: { value: this.$parent.internalPageSize, popperClass: this.$parent.popperClass || '', disabled: this.$parent.disabled }, on: { 'input': this.handleChange } }, [this.pageSizes.map(function (item) { return h( 'el-option', { attrs: { value: item, label: item + _this.t('el.pagination.pagesize') } }, [] ); })] )] ); }, components: { ElSelect: _select2.default, ElOption: _option2.default }, methods: { handleChange: function handleChange(val) { if (val !== this.$parent.internalPageSize) { this.$parent.internalPageSize = val = parseInt(val, 10); this.$parent.userChangePageSize = true; this.$parent.$emit('size-change', val); } } } }, Jumper: { mixins: [_locale2.default], data: function data() { return { oldValue: null }; }, components: { ElInput: _input2.default }, watch: { '$parent.internalPageSize': function $parentInternalPageSize() { var _this2 = this; this.$nextTick(function () { _this2.$refs.input.$el.querySelector('input').value = _this2.$parent.internalCurrentPage; }); } }, methods: { handleFocus: function handleFocus(event) { this.oldValue = event.target.value; }, handleBlur: function handleBlur(_ref) { var target = _ref.target; this.resetValueIfNeed(target.value); this.reassignMaxValue(target.value); }, handleKeyup: function handleKeyup(_ref2) { var keyCode = _ref2.keyCode, target = _ref2.target; if (keyCode === 13 && this.oldValue && target.value !== this.oldValue) { this.handleChange(target.value); } }, handleChange: function handleChange(value) { this.$parent.internalCurrentPage = this.$parent.getValidCurrentPage(value); this.$parent.emitChange(); this.oldValue = null; this.resetValueIfNeed(value); }, resetValueIfNeed: function resetValueIfNeed(value) { var num = parseInt(value, 10); if (!isNaN(num)) { if (num < 1) { this.$refs.input.$el.querySelector('input').value = 1; } else { this.reassignMaxValue(value); } } }, reassignMaxValue: function reassignMaxValue(value) { if (+value > this.$parent.internalPageCount) { this.$refs.input.$el.querySelector('input').value = this.$parent.internalPageCount; } } }, render: function render(h) { return h( 'span', { 'class': 'el-pagination__jump' }, [this.t('el.pagination.goto'), h( 'el-input', { 'class': 'el-pagination__editor is-in-pagination', attrs: { min: 1, max: this.$parent.internalPageCount, value: this.$parent.internalCurrentPage, type: 'number', disabled: this.$parent.disabled }, domProps: { 'value': this.$parent.internalCurrentPage }, ref: 'input', nativeOn: { 'keyup': this.handleKeyup }, on: { 'change': this.handleChange, 'focus': this.handleFocus, 'blur': this.handleBlur } }, [] ), this.t('el.pagination.pageClassifier')] ); } }, Total: { mixins: [_locale2.default], render: function render(h) { return typeof this.$parent.total === 'number' ? h( 'span', { 'class': 'el-pagination__total' }, [this.t('el.pagination.total', { total: this.$parent.total })] ) : ''; } }, Pager: _pager2.default }, methods: { handleCurrentChange: function handleCurrentChange(val) { this.internalCurrentPage = this.getValidCurrentPage(val); this.userChangePageSize = true; this.emitChange(); }, prev: function prev() { if (this.disabled) return; var newVal = this.internalCurrentPage - 1; this.internalCurrentPage = this.getValidCurrentPage(newVal); this.$emit('prev-click', this.internalCurrentPage); this.emitChange(); }, next: function next() { if (this.disabled) return; var newVal = this.internalCurrentPage + 1; this.internalCurrentPage = this.getValidCurrentPage(newVal); this.$emit('next-click', this.internalCurrentPage); this.emitChange(); }, getValidCurrentPage: function getValidCurrentPage(value) { value = parseInt(value, 10); var havePageCount = typeof this.internalPageCount === 'number'; var resetValue = void 0; if (!havePageCount) { if (isNaN(value) || value < 1) resetValue = 1; } else { if (value < 1) { resetValue = 1; } else if (value > this.internalPageCount) { resetValue = this.internalPageCount; } } if (resetValue === undefined && isNaN(value)) { resetValue = 1; } else if (resetValue === 0) { resetValue = 1; } return resetValue === undefined ? value : resetValue; }, emitChange: function emitChange() { var _this3 = this; this.$nextTick(function () { if (_this3.internalCurrentPage !== _this3.lastEmittedPage || _this3.userChangePageSize) { _this3.$emit('current-change', _this3.internalCurrentPage); _this3.lastEmittedPage = _this3.internalCurrentPage; _this3.userChangePageSize = false; } }); } }, computed: { internalPageCount: function internalPageCount() { if (typeof this.total === 'number') { return Math.ceil(this.total / this.internalPageSize); } else if (typeof this.pageCount === 'number') { return this.pageCount; } return null; } }, watch: { currentPage: { immediate: true, handler: function handler(val) { this.internalCurrentPage = val; } }, pageSize: { immediate: true, handler: function handler(val) { this.internalPageSize = isNaN(val) ? 10 : val; } }, internalCurrentPage: { immediate: true, handler: function handler(newVal, oldVal) { newVal = parseInt(newVal, 10); /* istanbul ignore if */ if (isNaN(newVal)) { newVal = oldVal || 1; } else { newVal = this.getValidCurrentPage(newVal); } if (newVal !== undefined) { this.internalCurrentPage = newVal; if (oldVal !== newVal) { this.$emit('update:currentPage', newVal); } } else { this.$emit('update:currentPage', newVal); } } }, internalPageCount: function internalPageCount(newVal) { /* istanbul ignore if */ var oldPage = this.internalCurrentPage; if (newVal > 0 && oldPage === 0) { this.internalCurrentPage = 1; } else if (oldPage > newVal) { this.internalCurrentPage = newVal === 0 ? 1 : newVal; this.userChangePageSize && this.emitChange(); } this.userChangePageSize = false; } } }; /***/ }), /***/ 58: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_pager_vue__ = __webpack_require__(59); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_pager_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_pager_vue__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_e5b72590_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_pager_vue__ = __webpack_require__(60); var normalizeComponent = __webpack_require__(0) /* script */ /* template */ /* template functional */ var __vue_template_functional__ = false /* styles */ var __vue_styles__ = null /* scopeId */ var __vue_scopeId__ = null /* moduleIdentifier (server only) */ var __vue_module_identifier__ = null var Component = normalizeComponent( __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_pager_vue___default.a, __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_e5b72590_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_pager_vue__["a" /* default */], __vue_template_functional__, __vue_styles__, __vue_scopeId__, __vue_module_identifier__ ) /* harmony default export */ __webpack_exports__["default"] = (Component.exports); /***/ }), /***/ 59: /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // exports.default = { name: 'ElPager', props: { currentPage: Number, pageCount: Number, pagerCount: Number, disabled: Boolean }, watch: { showPrevMore: function showPrevMore(val) { if (!val) this.quickprevIconClass = 'el-icon-more'; }, showNextMore: function showNextMore(val) { if (!val) this.quicknextIconClass = 'el-icon-more'; } }, methods: { onPagerClick: function onPagerClick(event) { var target = event.target; if (target.tagName === 'UL' || this.disabled) { return; } var newPage = Number(event.target.textContent); var pageCount = this.pageCount; var currentPage = this.currentPage; var pagerCountOffset = this.pagerCount - 2; if (target.className.indexOf('more') !== -1) { if (target.className.indexOf('quickprev') !== -1) { newPage = currentPage - pagerCountOffset; } else if (target.className.indexOf('quicknext') !== -1) { newPage = currentPage + pagerCountOffset; } } /* istanbul ignore if */ if (!isNaN(newPage)) { if (newPage < 1) { newPage = 1; } if (newPage > pageCount) { newPage = pageCount; } } if (newPage !== currentPage) { this.$emit('change', newPage); } }, onMouseenter: function onMouseenter(direction) { if (this.disabled) return; if (direction === 'left') { this.quickprevIconClass = 'el-icon-d-arrow-left'; } else { this.quicknextIconClass = 'el-icon-d-arrow-right'; } } }, computed: { pagers: function pagers() { var pagerCount = this.pagerCount; var halfPagerCount = (pagerCount - 1) / 2; var currentPage = Number(this.currentPage); var pageCount = Number(this.pageCount); var showPrevMore = false; var showNextMore = false; if (pageCount > pagerCount) { if (currentPage > pagerCount - halfPagerCount) { showPrevMore = true; } if (currentPage < pageCount - halfPagerCount) { showNextMore = true; } } var array = []; if (showPrevMore && !showNextMore) { var startPage = pageCount - (pagerCount - 2); for (var i = startPage; i < pageCount; i++) { array.push(i); } } else if (!showPrevMore && showNextMore) { for (var _i = 2; _i < pagerCount; _i++) { array.push(_i); } } else if (showPrevMore && showNextMore) { var offset = Math.floor(pagerCount / 2) - 1; for (var _i2 = currentPage - offset; _i2 <= currentPage + offset; _i2++) { array.push(_i2); } } else { for (var _i3 = 2; _i3 < pageCount; _i3++) { array.push(_i3); } } this.showPrevMore = showPrevMore; this.showNextMore = showNextMore; return array; } }, data: function data() { return { current: null, showPrevMore: false, showNextMore: false, quicknextIconClass: 'el-icon-more', quickprevIconClass: 'el-icon-more' }; } }; /***/ }), /***/ 6: /***/ (function(module, exports) { module.exports = require("element-ui/lib/input"); /***/ }), /***/ 60: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('ul',{staticClass:"el-pager",on:{"click":_vm.onPagerClick}},[(_vm.pageCount > 0)?_c('li',{staticClass:"number",class:{ active: _vm.currentPage === 1, disabled: _vm.disabled }},[_vm._v("1")]):_vm._e(),(_vm.showPrevMore)?_c('li',{staticClass:"el-icon more btn-quickprev",class:[_vm.quickprevIconClass, { disabled: _vm.disabled }],on:{"mouseenter":function($event){_vm.onMouseenter('left')},"mouseleave":function($event){_vm.quickprevIconClass = 'el-icon-more'}}}):_vm._e(),_vm._l((_vm.pagers),function(pager){return _c('li',{key:pager,staticClass:"number",class:{ active: _vm.currentPage === pager, disabled: _vm.disabled }},[_vm._v(_vm._s(pager))])}),(_vm.showNextMore)?_c('li',{staticClass:"el-icon more btn-quicknext",class:[_vm.quicknextIconClass, { disabled: _vm.disabled }],on:{"mouseenter":function($event){_vm.onMouseenter('right')},"mouseleave":function($event){_vm.quicknextIconClass = 'el-icon-more'}}}):_vm._e(),(_vm.pageCount > 1)?_c('li',{staticClass:"number",class:{ active: _vm.currentPage === _vm.pageCount, disabled: _vm.disabled }},[_vm._v(_vm._s(_vm.pageCount))]):_vm._e()],2)} var staticRenderFns = [] var esExports = { render: render, staticRenderFns: staticRenderFns } /* harmony default export */ __webpack_exports__["a"] = (esExports); /***/ }), /***/ 61: /***/ (function(module, exports) { module.exports = require("element-ui/lib/select"); /***/ }), /***/ 62: /***/ (function(module, exports) { module.exports = require("element-ui/lib/option"); /***/ }) /******/ });