Showing
9 changed files
with
159 additions
and
2 deletions
src/assets/images/close.png
0 → 100644
433 Bytes
src/assets/images/slide.png
0 → 100644
3.93 KB
src/components/order/cancel-order-dialog.js
0 → 100644
1 | +Component({ | ||
2 | + properties: { | ||
3 | + showConfirm: { | ||
4 | + type: Boolean, | ||
5 | + value: true | ||
6 | + } | ||
7 | + }, | ||
8 | + data: { | ||
9 | + slideLeft: 0, | ||
10 | + startX: 0, | ||
11 | + hideSlide: true, | ||
12 | + hideTip: false, | ||
13 | + containerWidth: 0 | ||
14 | + }, | ||
15 | + methods: { | ||
16 | + closeSlide: function() { | ||
17 | + this.setData({ | ||
18 | + hideSlide: true | ||
19 | + }); | ||
20 | + }, | ||
21 | + touchStart: function (e) { | ||
22 | + this.data.startX = e.touches[0].clientX; | ||
23 | + }, | ||
24 | + touchMove: function (e) { | ||
25 | + let currentX = e.touches[0].clientX; | ||
26 | + | ||
27 | + if (currentX - this.data.startX < 0 || this.data.complete) { | ||
28 | + return; | ||
29 | + } | ||
30 | + this.setData({ | ||
31 | + hideTip: true, | ||
32 | + slideLeft: currentX - this.data.startX | ||
33 | + }) | ||
34 | + }, | ||
35 | + touchEnd: function (e) { | ||
36 | + if (!this.data.complete) { | ||
37 | + this.setData({ | ||
38 | + slideLeft: 0, | ||
39 | + hideTip: false | ||
40 | + }); | ||
41 | + } | ||
42 | + }, | ||
43 | + confirm: function() { | ||
44 | + this.setData({ | ||
45 | + showConfirm: false, | ||
46 | + hideSlide: false | ||
47 | + }); | ||
48 | + }, | ||
49 | + keep: function () { | ||
50 | + this.setData({ | ||
51 | + showConfirm: false | ||
52 | + }); | ||
53 | + } | ||
54 | + } | ||
55 | +}); |
1 | +<view class="cancel-order-dialog"> | ||
2 | + <view class="confirm-layer" wx:if="{{showConfirm}}"> | ||
3 | + <view class="mask"></view> | ||
4 | + <view class="info"> | ||
5 | + <view class="item">123232</view> | ||
6 | + <view class="cancel" bindtap="confirm">赔付并取消订单</view> | ||
7 | + <view class="keep" bindtap="keep">保留订单</view> | ||
8 | + </view> | ||
9 | + </view> | ||
10 | + <view class="slide-layer" hidden="{{hideSlide}}"> | ||
11 | + <view class="slide-mask"> | ||
12 | + <image class="close-icon" | ||
13 | + bindtap="closeSlide" | ||
14 | + src="../../assets/images/close.png"></image> | ||
15 | + </view> | ||
16 | + <view class="slide"> | ||
17 | + <view class="slide-container"> | ||
18 | + <view class="tip" hidden="{{hideTip}}">滑动确认赔付并取消订单</view> | ||
19 | + <image class="slide-icon" | ||
20 | + catchtouchstart="touchStart" | ||
21 | + catchtouchmove="touchMove" | ||
22 | + catchtouchend="touchEnd" | ||
23 | + style="margin-left:{{slideLeft}}px" | ||
24 | + src="../../assets/images/slide.png"></image> | ||
25 | + </view> | ||
26 | + </view> | ||
27 | + </view> | ||
28 | +</view> |
1 | +.cancel-order-dialog .confirm-layer .info { | ||
2 | + position: relative; | ||
3 | + z-index: 1000; | ||
4 | + background-color: #ffffff; | ||
5 | +} | ||
6 | + | ||
7 | +.cancel-order-dialog .mask { | ||
8 | + position: fixed; | ||
9 | + top: 0; | ||
10 | + right: 0; | ||
11 | + bottom: 0; | ||
12 | + left: 0; | ||
13 | + opacity: 0.4; | ||
14 | + z-index: 999; | ||
15 | + background: #000000; | ||
16 | +} | ||
17 | + | ||
18 | + | ||
19 | + | ||
20 | +.cancel-order-dialog .slide-mask { | ||
21 | + position: fixed; | ||
22 | + top: 0; | ||
23 | + right: 0; | ||
24 | + bottom: 0; | ||
25 | + left: 0; | ||
26 | + opacity: 0.9; | ||
27 | + z-index: 999; | ||
28 | + background: #000000; | ||
29 | +} | ||
30 | + | ||
31 | +.cancel-order-dialog .slide-layer .close-icon { | ||
32 | + position: fixed; | ||
33 | + top: 60rpx; | ||
34 | + right: 40rpx; | ||
35 | + width: 48rpx; | ||
36 | + height: 48rpx; | ||
37 | +} | ||
38 | + | ||
39 | +.cancel-order-dialog .slide-container { | ||
40 | + position: absolute; | ||
41 | + width: 640rpx; | ||
42 | + height: 140rpx; | ||
43 | + z-index: 9999; | ||
44 | + background: #FFFFFF; | ||
45 | + border-radius: 70rpx; | ||
46 | + top: 50%; | ||
47 | + left: 50%; | ||
48 | + margin-top: -70rpx; | ||
49 | + margin-left: -320rpx; | ||
50 | +} | ||
51 | + | ||
52 | +.cancel-order-dialog .slide-container .tip { | ||
53 | + font-size: 28px; | ||
54 | + color: #444444; | ||
55 | + letter-spacing: 0; | ||
56 | + text-align: center; | ||
57 | + line-height: 140rpx; | ||
58 | + margin-left: 122rpx; | ||
59 | +} | ||
60 | + | ||
61 | +.cancel-order-dialog .slide-container .slide-icon { | ||
62 | + position: absolute; | ||
63 | + width: 132rpx; | ||
64 | + height: 132rpx; | ||
65 | + top: 4rpx; | ||
66 | + left: 4rpx; | ||
67 | +} |
@@ -128,7 +128,6 @@ Page({ | @@ -128,7 +128,6 @@ Page({ | ||
128 | interval = setInterval(() => { | 128 | interval = setInterval(() => { |
129 | leftTime = leftTime - 1; | 129 | leftTime = leftTime - 1; |
130 | timer = formatTimeByMin(leftTime, 'm:s'); | 130 | timer = formatTimeByMin(leftTime, 'm:s'); |
131 | - console.log(leftTime); | ||
132 | if (leftTime <= 0) { | 131 | if (leftTime <= 0) { |
133 | timer = '00:00'; | 132 | timer = '00:00'; |
134 | setTimeout(() => { | 133 | setTimeout(() => { |
@@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
2 | "navigationBarTitleText": "我的购买", | 2 | "navigationBarTitleText": "我的购买", |
3 | "usingComponents": { | 3 | "usingComponents": { |
4 | "orderlistcell":"./orderlistcell", | 4 | "orderlistcell":"./orderlistcell", |
5 | - "no-data-show-view": "../../../components/no-data-show-view/no-data-show-view" | 5 | + "no-data-show-view": "../../components/no-data-show-view/no-data-show-view", |
6 | + "cancel-order-dialog": "../../components/order/cancel-order-dialog" | ||
6 | } | 7 | } |
7 | } | 8 | } |
-
Please register or login to post a comment