Showing
14 changed files
with
184 additions
and
453 deletions
@@ -8,7 +8,6 @@ export default { | @@ -8,7 +8,6 @@ export default { | ||
8 | */ | 8 | */ |
9 | getOrders(params) { | 9 | getOrders(params) { |
10 | return api.get({ | 10 | return api.get({ |
11 | - url: '', | ||
12 | data: { | 11 | data: { |
13 | ...params, | 12 | ...params, |
14 | method: 'app.SpaceOrders.get' | 13 | method: 'app.SpaceOrders.get' |
@@ -22,7 +21,6 @@ export default { | @@ -22,7 +21,6 @@ export default { | ||
22 | */ | 21 | */ |
23 | delOrder(params) { | 22 | delOrder(params) { |
24 | return api.get({ | 23 | return api.get({ |
25 | - url: '', | ||
26 | data: { | 24 | data: { |
27 | ...params, | 25 | ...params, |
28 | method: 'app.SpaceOrders.delOrderByCode' | 26 | method: 'app.SpaceOrders.delOrderByCode' |
@@ -36,7 +34,6 @@ export default { | @@ -36,7 +34,6 @@ export default { | ||
36 | */ | 34 | */ |
37 | cancelOrder(params) { | 35 | cancelOrder(params) { |
38 | return api.get({ | 36 | return api.get({ |
39 | - url: '', | ||
40 | data: { | 37 | data: { |
41 | ...params, | 38 | ...params, |
42 | method: 'app.SpaceOrders.close' | 39 | method: 'app.SpaceOrders.close' |
@@ -44,13 +41,24 @@ export default { | @@ -44,13 +41,24 @@ export default { | ||
44 | }); | 41 | }); |
45 | }, | 42 | }, |
46 | /** | 43 | /** |
44 | + * 申请退款 | ||
45 | + * @param params | ||
46 | + * @returns {*} | ||
47 | + */ | ||
48 | + refundOrder() { | ||
49 | + return api.get({ | ||
50 | + data: { | ||
51 | + method: 'app.SpaceOrders.refundApply' | ||
52 | + } | ||
53 | + }); | ||
54 | + }, | ||
55 | + /** | ||
47 | * 确认收货 | 56 | * 确认收货 |
48 | * @param params | 57 | * @param params |
49 | * @returns {*} | 58 | * @returns {*} |
50 | */ | 59 | */ |
51 | confirmReceive(params) { | 60 | confirmReceive(params) { |
52 | return api.get({ | 61 | return api.get({ |
53 | - url: '', | ||
54 | data: { | 62 | data: { |
55 | ...params, | 63 | ...params, |
56 | method: 'app.SpaceOrders.confirm' | 64 | method: 'app.SpaceOrders.confirm' |
@@ -64,14 +72,12 @@ export default { | @@ -64,14 +72,12 @@ export default { | ||
64 | */ | 72 | */ |
65 | expressDetail (params) { | 73 | expressDetail (params) { |
66 | return api.get({ | 74 | return api.get({ |
67 | - url: '', | ||
68 | data: { | 75 | data: { |
69 | ...params, | 76 | ...params, |
70 | method: 'app.express.li' | 77 | method: 'app.express.li' |
71 | } | 78 | } |
72 | }); | 79 | }); |
73 | }, | 80 | }, |
74 | - | ||
75 | /** | 81 | /** |
76 | * 订单详情 | 82 | * 订单详情 |
77 | * @param params | 83 | * @param params |
@@ -79,11 +85,23 @@ export default { | @@ -79,11 +85,23 @@ export default { | ||
79 | */ | 85 | */ |
80 | getOrderDetail(orderCode) { | 86 | getOrderDetail(orderCode) { |
81 | return api.get({ | 87 | return api.get({ |
82 | - url: '', | ||
83 | data: { | 88 | data: { |
84 | method: 'app.SpaceOrders.detail', | 89 | method: 'app.SpaceOrders.detail', |
85 | order_code: orderCode | 90 | order_code: orderCode |
86 | } | 91 | } |
87 | }); | 92 | }); |
88 | }, | 93 | }, |
94 | + /** | ||
95 | + * 退款理由 | ||
96 | + * @param params | ||
97 | + * @returns {*} | ||
98 | + */ | ||
99 | + getRefundSeason() { | ||
100 | + return api.get({ | ||
101 | + data: { | ||
102 | + method: 'app.SpaceOrders.refundApplyReasons', | ||
103 | + fromPage: 'aFP_MineOrderContent' | ||
104 | + } | ||
105 | + }); | ||
106 | + }, | ||
89 | }; | 107 | }; |
app/pages/home/address/editor.wxml
deleted
100644 → 0
1 | -<template name="addressEditer"> | ||
2 | - <view class="edit-wrap"> | ||
3 | - <view class="edit-row"> | ||
4 | - <text class="left-cell">收货人</text> | ||
5 | - <input data-name="consignee" class="right-cell" placeholder="姓名" maxlength="20" bindinput="onInputChanged" value="{{consignee}}"/> | ||
6 | - </view> | ||
7 | - <view class="edit-row"> | ||
8 | - <text class="left-cell">手机号码</text> | ||
9 | - <input type="number" data-name="mobile" class="right-cell" placeholder="手机号码" maxlength="18" bindinput="onInputChanged" value="{{mobile}}"/> | ||
10 | - </view> | ||
11 | - <view class="edit-row" bindtap="chooseArea"> | ||
12 | - <text class="left-cell">选择地区</text> | ||
13 | - <input class="right-cell" disabled="disabled" placeholder="地区信息" value="{{area}}"/> | ||
14 | - </view> | ||
15 | - <view class="edit-row"> | ||
16 | - <text class="left-cell">详细地址</text> | ||
17 | - <input data-name="address" class="right-cell" placeholder="详细街道地址" maxlength="50" bindinput="onInputChanged" value="{{address}}"/> | ||
18 | - </view> | ||
19 | - </view> | ||
20 | - | ||
21 | - <button class="option-btn save-btn" catchtap="saveAddr">确认</button> | ||
22 | - <button wx:if="{{address_id}}" class="option-btn delete-btn" data-key="{{index}}" data-id="{{address_id}}" catchtap="deleteAddr">删除地址</button> | ||
23 | - <view class="aaa">{{editeAddressPage}}</view> | ||
24 | - | ||
25 | - <view wx:if="{{areaPicker}}" class="picker-mask" catchtap="hideAreaPicker"></view> | ||
26 | - <picker-view wx:if="{{areaPicker}}" class="picker-view" indicator-style="height: 50px;" style="width: 100%; height: 300px;" value="{{areaValue}}" bindchange="areaPickerChange"> | ||
27 | - <picker-view-column data-type="provice1"> | ||
28 | - <view wx:for="{{pickerProvice}}" wx:key="unique" class="picker-item"> | ||
29 | - <text class="picker-text">{{item.caption}}</text> | ||
30 | - </view> | ||
31 | - </picker-view-column> | ||
32 | - <picker-view-column> | ||
33 | - <view wx:for="{{pickerCity}}" wx:key="unique" class="picker-item"> | ||
34 | - <text class="picker-text">{{item.caption}}</text> | ||
35 | - </view> | ||
36 | - </picker-view-column> | ||
37 | - <picker-view-column> | ||
38 | - <view wx:for="{{pickerArea}}" wx:key="unique" class="picker-item"> | ||
39 | - <text class="picker-text">{{item.caption}}</text> | ||
40 | - </view> | ||
41 | - </picker-view-column> | ||
42 | - </picker-view> | ||
43 | -</template> |
app/pages/home/address/editor.wxss
deleted
100644 → 0
1 | -.edit-wrap { | ||
2 | - background-color: #fff; | ||
3 | - padding-left: 30rpx; | ||
4 | - margin-bottom: 50rpx; | ||
5 | -} | ||
6 | - | ||
7 | -.edit-wrap .edit-row { | ||
8 | - border-bottom: 1rpx solid #e0e0e0; | ||
9 | - padding: 10rpx 0; | ||
10 | -} | ||
11 | - | ||
12 | -.edit-wrap .edit-row:last-child { | ||
13 | - border-bottom: 0; | ||
14 | -} | ||
15 | - | ||
16 | -.edit-wrap .edit-row .left-cell, | ||
17 | -.edit-wrap .edit-row .right-cell { | ||
18 | - height: 80rpx; | ||
19 | - line-height: 80rpx; | ||
20 | - display: inline-block; | ||
21 | - vertical-align: middle; | ||
22 | -} | ||
23 | - | ||
24 | -.edit-wrap .edit-row .right-cell { | ||
25 | - float: right; | ||
26 | - width: 540rpx; | ||
27 | - margin-right: 30rpx; | ||
28 | -} | ||
29 | - | ||
30 | -.option-btn { | ||
31 | - height: 80rpx; | ||
32 | - line-height: 80rpx; | ||
33 | - margin: 20rpx 30rpx; | ||
34 | - color: #fff; | ||
35 | - background-color: #444; | ||
36 | -} | ||
37 | - | ||
38 | -.option-btn.delete-btn { | ||
39 | - background-color: #aaa; | ||
40 | -} | ||
41 | - | ||
42 | -.picker-mask { | ||
43 | - position: fixed; | ||
44 | - left: 0; | ||
45 | - right: 0; | ||
46 | - top: 0; | ||
47 | - bottom: 0; | ||
48 | - z-index: 10; | ||
49 | -} | ||
50 | - | ||
51 | -.picker-view { | ||
52 | - position: fixed; | ||
53 | - left: 0; | ||
54 | - bottom: 0; | ||
55 | - z-index: 20; | ||
56 | -} | ||
57 | - | ||
58 | -.picker-view .picker-item { | ||
59 | - line-height: 92rpx; | ||
60 | - text-align: center; | ||
61 | -} | ||
62 | - | ||
63 | -.picker-view .picker-text { | ||
64 | - max-width: 60%; | ||
65 | - margin: 0 auto; | ||
66 | - display: block; | ||
67 | - text-overflow: ellipsis; | ||
68 | - white-space: nowrap; | ||
69 | - overflow: hidden; | ||
70 | -} |
1 | -<import src="./editor.wxml"/> | 1 | +<import src="./template/editor/editor.wxml"/> |
2 | 2 | ||
3 | <view wx:if="{{showEditAddrPage}}" class="container"> | 3 | <view wx:if="{{showEditAddrPage}}" class="container"> |
4 | <template is="addressEditer" data="{{...editAddrPageData, areaPicker, pickerProvice, pickerCity, pickerArea, areaValue}}"/> | 4 | <template is="addressEditer" data="{{...editAddrPageData, areaPicker, pickerProvice, pickerCity, pickerArea, areaValue}}"/> |
@@ -10,7 +10,8 @@ const yas = new Yas(app); | @@ -10,7 +10,8 @@ const yas = new Yas(app); | ||
10 | 10 | ||
11 | Page({ | 11 | Page({ |
12 | data: { | 12 | data: { |
13 | - receiveAddress: {} | 13 | + receiveAddress: {}, |
14 | + reason: [] | ||
14 | }, | 15 | }, |
15 | onLoad(options) { | 16 | onLoad(options) { |
16 | if (!options.orderCode || !app.getUid()) { | 17 | if (!options.orderCode || !app.getUid()) { |
@@ -33,6 +34,8 @@ Page({ | @@ -33,6 +34,8 @@ Page({ | ||
33 | this.timeCountDown(parseInt(data.pay_lefttime)); | 34 | this.timeCountDown(parseInt(data.pay_lefttime)); |
34 | } | 35 | } |
35 | 36 | ||
37 | + let links = data.links || []; | ||
38 | + | ||
36 | this.setData({ | 39 | this.setData({ |
37 | pageLoaded: true, | 40 | pageLoaded: true, |
38 | receiveAddress: { | 41 | receiveAddress: { |
@@ -49,10 +52,24 @@ Page({ | @@ -49,10 +52,24 @@ Page({ | ||
49 | promotionList: data.promotion_formulas || [], | 52 | promotionList: data.promotion_formulas || [], |
50 | paymentAmount: data.payment_amount, | 53 | paymentAmount: data.payment_amount, |
51 | attribute: data.attribute, | 54 | attribute: data.attribute, |
52 | - links: data.links | 55 | + links: links |
53 | }); | 56 | }); |
57 | + | ||
58 | + if (links.indexOf('refundApply') > -1) { | ||
59 | + this.loadRefundReason(); // 获取退款理由 | ||
60 | + } | ||
54 | } | 61 | } |
55 | - }) | 62 | + }); |
63 | + }, | ||
64 | + loadRefundReason() { | ||
65 | + if (this.hasSetReason) { | ||
66 | + return; | ||
67 | + } | ||
68 | + | ||
69 | + orderHandle.getRefundReason(res => { | ||
70 | + this.setData({reason: res}); | ||
71 | + this.hasSetReason = true; | ||
72 | + }); | ||
56 | }, | 73 | }, |
57 | timeCountDown(second) { | 74 | timeCountDown(second) { |
58 | const that = this; | 75 | const that = this; |
@@ -119,7 +136,37 @@ Page({ | @@ -119,7 +136,37 @@ Page({ | ||
119 | confirmOrder() { | 136 | confirmOrder() { |
120 | orderHandle.confirmReceive(this.orderCode); | 137 | orderHandle.confirmReceive(this.orderCode); |
121 | }, | 138 | }, |
122 | - refundNow() { | ||
123 | - orderHandle.confirmReceive(this.orderCode); | 139 | + refundOrder() { |
140 | + let that = this; | ||
141 | + | ||
142 | + wx.showModal({ | ||
143 | + content: '申请退款后,本单享有的优惠可能会一并取消,确定申请吗?', | ||
144 | + cancelText: '取消', | ||
145 | + confirmText: '确定', | ||
146 | + confirmColor: '#FF0000', | ||
147 | + success(res) { | ||
148 | + if (res.confirm) { | ||
149 | + that.loadRefundReason(); | ||
150 | + that.setData({showReason: true}); | ||
151 | + } | ||
152 | + } | ||
153 | + }); | ||
154 | + }, | ||
155 | + hidePicker(e) { | ||
156 | + if (e.target.id === 'reason-picker') { | ||
157 | + this.setData({showReason: false}); | ||
158 | + } | ||
159 | + }, | ||
160 | + reasonChange(e) { | ||
161 | + this.reasonIndex = e.detail.value[0]; | ||
162 | + }, | ||
163 | + reasonSure() { | ||
164 | + orderHandle.refundNow(this.orderCode, this.data.reason[this.reasonIndex || 0], res => { | ||
165 | + if (res && res.code == 200) { | ||
166 | + wx.navigateBack({delta:1}); | ||
167 | + } | ||
168 | + }); | ||
169 | + | ||
170 | + this.setData({showReason: false}); | ||
124 | } | 171 | } |
125 | }); | 172 | }); |
1 | +<import src="./template/reason/reason.wxml"/> | ||
2 | + | ||
1 | <view wx:if="{{pageLoaded}}" class="container"> | 3 | <view wx:if="{{pageLoaded}}" class="container"> |
2 | <view class="address-wrap"> | 4 | <view class="address-wrap"> |
3 | <address-card address="{{receiveAddress}}"></address-card> | 5 | <address-card address="{{receiveAddress}}"></address-card> |
@@ -39,9 +41,11 @@ | @@ -39,9 +41,11 @@ | ||
39 | <view wx:if="{{link === 'delOrder'}}" class="option-btn" catchtap="deleteOrder">删除订单</view> | 41 | <view wx:if="{{link === 'delOrder'}}" class="option-btn" catchtap="deleteOrder">删除订单</view> |
40 | <view wx:if="{{link === 'getExpress'}}" class="option-btn" catchtap="viewExpress">查看物流</view> | 42 | <view wx:if="{{link === 'getExpress'}}" class="option-btn" catchtap="viewExpress">查看物流</view> |
41 | <button wx:if="{{link === 'confirm'}}" formType="submit" class="option-btn red-btn" catchtap="confirmOrder">确认收货</button> | 43 | <button wx:if="{{link === 'confirm'}}" formType="submit" class="option-btn red-btn" catchtap="confirmOrder">确认收货</button> |
42 | - <button wx:if="{{link === 'refundApply'}}" formType="submit" class="option-btn" catchtap="refundNow">申请退款</button> | 44 | + <button wx:if="{{link === 'refundApply'}}" formType="submit" class="option-btn" catchtap="refundOrder">申请退款</button> |
43 | </block> | 45 | </block> |
44 | </form> | 46 | </form> |
45 | </view> | 47 | </view> |
46 | </view> | 48 | </view> |
49 | + | ||
50 | + <template is="reason" data="{{reason, showReason}}"></template> | ||
47 | </view> | 51 | </view> |
app/pages/home/order/item/item.wxml
deleted
100644 → 0
1 | -<template name="orderItem"> | ||
2 | - <view class="order" data-order_code="{{item.order_code}}" bindtap="navToOrderDetail"> | ||
3 | - <view class="header"> | ||
4 | - 订单编号:{{item.order_code}} | ||
5 | - <view class="order-status">{{item.status_str}}</view> | ||
6 | - </view> | ||
7 | - <view class="order-goods"> | ||
8 | - <block wx:for="{{item.order_goods}}" wx:for-item="good" wx:key="product_id"> | ||
9 | - <view class="order-good" data-id=""> | ||
10 | - <view class="thumb-wrap"> | ||
11 | - <image class="thumb" src="{{good.goods_image}}"></image> | ||
12 | - <image wx:if="{{good.goods_type=='gift' || good.goods_type=='price_gift'}}"class='productTag' src="{{good.goods_type=='gift'?'images/zp-lab@2x.png':'images/jjg-lab@2x.png'}}"></image> | ||
13 | - </view> | ||
14 | - <view class="deps"> | ||
15 | - <view class="name row">{{good.product_name}}</view> | ||
16 | - <view class="row"> | ||
17 | - <view class="color"> | ||
18 | - 颜色:{{good.color_name}} | ||
19 | - </view> | ||
20 | - <view class="size"> | ||
21 | - 尺码:{{good.size_name}} | ||
22 | - </view> | ||
23 | - </view> | ||
24 | - <view class="row price-wrap"> | ||
25 | - <view class="price"> | ||
26 | - ¥{{good.real_pay_price}} | ||
27 | - </view> | ||
28 | - <view wx:if="{{good.sales_price}}" class="count" style='text-decoration:line-through;'> | ||
29 | - ¥{{good.sales_price}} | ||
30 | - </view> | ||
31 | - <view class="count"> | ||
32 | - × {{good.buy_number}} | ||
33 | - </view> | ||
34 | - </view> | ||
35 | - </view> | ||
36 | - <block wx:if="{{good.expect_arrival_time}}"> | ||
37 | - <text class="order-tip" >上市期:{{good.expect_arrival_time}}</text> | ||
38 | - </block> | ||
39 | - </view> | ||
40 | - </block> | ||
41 | - </view> | ||
42 | - <view class="footer"> | ||
43 | - 共{{item.buy_total}}件商品 实付 | ||
44 | - <view class="sum-cost">¥{{item.amount}}</view> | ||
45 | - (含运费¥{{item.shipping_cost}}) | ||
46 | - </view> | ||
47 | - <view wx:if="{{item.attribute == 9}}" class="order-opt" style='font-size:28rpx;color:#444444'>*此订单只能在APP端操作</view> | ||
48 | - <view wx:elif="{{item.links.length > 0}}" class="order-opt"> | ||
49 | - <block wx:if="{{item.counter_flag == 'Y' && item.is_cancel != 'Y' && item.pay_lefttime > 0}}"> | ||
50 | - <view class="counterView"> | ||
51 | - <image class="timeIcon" src='../../../static/images/shijian@3x.png'></image> | ||
52 | - <text class="counter">剩余 {{item.time_left}}</text> | ||
53 | - </view> | ||
54 | - </block> | ||
55 | - | ||
56 | - <block wx:for="{{item.links}}" wx:for-item="link" wx:key="order_code"> | ||
57 | - <block wx:if="{{link == 'closeOrder'}}"> | ||
58 | - <view class="btn" formType="submit" type="default" size="{{defaultSize}}" plain='true' | ||
59 | - catchtap="cancelOrder" data-code="{{item.order_code}}">取消订单</view> | ||
60 | - </block> | ||
61 | - <block wx:if="{{link == 'buyNow'}}"> | ||
62 | - <view class="btn pay" catchtap="payNow" data-code="{{item.order_code}}" | ||
63 | - data-amount="{{item.amount}}">立即付款 | ||
64 | - </view> | ||
65 | - </block> | ||
66 | - <block wx:if="{{link == 'delOrder'}}"> | ||
67 | - <view class="btn cancel" catchtap="delOrder" data-code="{{item.order_code}}">删除订单</view> | ||
68 | - </block> | ||
69 | - <block wx:if="{{link == 'getExpress'}}"> | ||
70 | - <view class="btn cancel" catchtap="expressDetail" data-code="{{item.order_code}}">查看物流</view> | ||
71 | - </block> | ||
72 | - <block wx:if="{{link == 'confirm'}}"> | ||
73 | - <view class="button pay" catchtap="confirmReceive" data-code="{{item.order_code}}">确认收货 | ||
74 | - </view> | ||
75 | - </block> | ||
76 | - </block> | ||
77 | - </view> | ||
78 | - </view> | ||
79 | -</template> |
app/pages/home/order/item/item.wxss
deleted
100644 → 0
1 | -.order:last-child { | ||
2 | - margin-bottom: 0; | ||
3 | -} | ||
4 | - | ||
5 | -.order { | ||
6 | - position: relative; | ||
7 | - display: block; | ||
8 | - background: #fff; | ||
9 | - margin-bottom: 20rpx; | ||
10 | - border-top: 1rpx solid #e0e0e0; | ||
11 | - border-bottom: 1rpx solid #e0e0e0; | ||
12 | -} | ||
13 | - | ||
14 | -.order .header { | ||
15 | - border-bottom: 1rpx solid #e0e0e0; | ||
16 | -} | ||
17 | - | ||
18 | -.order .footer, .order .header { | ||
19 | - height: 91rpx; | ||
20 | - line-height: 90rpx; | ||
21 | - font-size: 28rpx; | ||
22 | - padding: 0 28rpx; | ||
23 | - color: #444444; | ||
24 | -} | ||
25 | - | ||
26 | -.order .order-status { | ||
27 | - float: right; | ||
28 | - font-family: PingFang-SC-Medium; | ||
29 | - font-size: 28rpx; | ||
30 | - color: #D0021B; | ||
31 | - letter-spacing: -0.39px; | ||
32 | -} | ||
33 | - | ||
34 | -.order-good { | ||
35 | - position: relative; | ||
36 | - margin: 18rpx 0; | ||
37 | - margin-left: 30.6rpx; | ||
38 | - height: 144rpx; | ||
39 | - border-bottom: 1rpx solid #e0e0e0; | ||
40 | - font-size: 23.4rpx; | ||
41 | -} | ||
42 | - | ||
43 | -.order-tip { | ||
44 | - font-size: 25.2rpx; | ||
45 | - margin-left: 15rpx; | ||
46 | - color: red; | ||
47 | - margin-top: 10rpx; | ||
48 | -} | ||
49 | - | ||
50 | -.order-good:last-child { | ||
51 | - border-bottom: none; | ||
52 | - margin-bottom: 0rpx; | ||
53 | -} | ||
54 | - | ||
55 | -.order-good .thumb-wrap { | ||
56 | - position: relative; | ||
57 | - float: left; | ||
58 | - width: 100rpx; | ||
59 | - height: 132rpx; | ||
60 | - top: -9rpx; | ||
61 | -} | ||
62 | -.productTag{ | ||
63 | - width: 100%; | ||
64 | - height: 20rpx; | ||
65 | - bottom: 0; | ||
66 | - left: 0; | ||
67 | - position: absolute; | ||
68 | -} | ||
69 | -.order-good .thumb { | ||
70 | - width: 100%; | ||
71 | - height: 100%; | ||
72 | -} | ||
73 | - | ||
74 | -image { | ||
75 | - display: block; | ||
76 | - margin: 0 auto; | ||
77 | - max-width: 100%; | ||
78 | - border: 0; | ||
79 | -} | ||
80 | - | ||
81 | -.order-good .deps { | ||
82 | - margin-left: 121.5rpx; | ||
83 | -} | ||
84 | - | ||
85 | -.order-good .name { | ||
86 | - max-width: 70%; | ||
87 | - overflow: hidden; | ||
88 | - text-overflow: ellipsis; | ||
89 | - display: -webkit-box; | ||
90 | - -webkit-line-clamp: 2; | ||
91 | - -webkit-box-orient: vertical; | ||
92 | - font-family: PingFang-SC-Regular; | ||
93 | - font-size: 28rpx; | ||
94 | - color: #444; | ||
95 | - letter-spacing: -0.4rpx; | ||
96 | - line-height: 34rpx; | ||
97 | - min-height: 68rpx; | ||
98 | -} | ||
99 | - | ||
100 | -.order-good .row:nth-child(2) { | ||
101 | - height: 40.5rpx; | ||
102 | - line-height: 40.5rpx; | ||
103 | - width: 90%; | ||
104 | -} | ||
105 | - | ||
106 | -.order-good .row .color { | ||
107 | - display: inline-block; | ||
108 | - max-width: 200rpx; | ||
109 | - text-overflow: ellipsis; | ||
110 | - overflow: hidden; | ||
111 | - white-space: nowrap; | ||
112 | - vertical-align: bottom; | ||
113 | - font-family: PingFang-SC-Regular; | ||
114 | - font-size: 24rpx; | ||
115 | - color: #B0B0B0; | ||
116 | - letter-spacing: -0.34rpx; | ||
117 | -} | ||
118 | - | ||
119 | -.order-good .row .size { | ||
120 | - display: inline-block; | ||
121 | - vertical-align: bottom; | ||
122 | - padding-left: 20rpx; | ||
123 | - font-family: PingFang-SC-Regular; | ||
124 | - font-size: 24rpx; | ||
125 | - color: #B0B0B0; | ||
126 | - letter-spacing: -0.34rpx; | ||
127 | -} | ||
128 | - | ||
129 | -.order-good .color, .order-good .size { | ||
130 | - color: #b6b6b6; | ||
131 | -} | ||
132 | - | ||
133 | -.order-good .price-wrap { | ||
134 | - position: absolute; | ||
135 | - top: 0rpx; | ||
136 | - right: 27rpx; | ||
137 | - text-align: right; | ||
138 | -} | ||
139 | - | ||
140 | -.order-good .price { | ||
141 | - color: #d0021b; | ||
142 | -} | ||
143 | - | ||
144 | -.order-good .count { | ||
145 | - display: block; | ||
146 | - text-align: right; | ||
147 | - font-family: PingFang-SC-Regular; | ||
148 | - font-size: 24rpx; | ||
149 | - color: #B0B0B0; | ||
150 | - letter-spacing: -0.34rpx; | ||
151 | - margin-top: 40rpx; | ||
152 | -} | ||
153 | - | ||
154 | -.order .footer { | ||
155 | - text-align: right; | ||
156 | - border-top: 1rpx solid #e0e0e0; | ||
157 | -} | ||
158 | - | ||
159 | -.order .sum-cost { | ||
160 | - color: #e01; | ||
161 | - margin-left: 4.5rpx; | ||
162 | - display: inline-block; | ||
163 | -} | ||
164 | - | ||
165 | -.order .order-opt { | ||
166 | - padding: 27rpx 0; | ||
167 | - padding-right: 27rpx; | ||
168 | - border-top: 1rpx solid #e0e0e0; | ||
169 | - text-align: right; | ||
170 | - margin-right: 20rpx; | ||
171 | - display: flex; | ||
172 | - flex-direction:row; | ||
173 | - justify-content:flex-end; | ||
174 | -} | ||
175 | - | ||
176 | -.order .order-opt .counterView{ | ||
177 | - position: absolute; | ||
178 | - left: 33rpx; | ||
179 | - height: 108rpx; | ||
180 | - bottom: 0rpx; | ||
181 | - display: flex; | ||
182 | - flex-direction:row; | ||
183 | - align-items: center; | ||
184 | -} | ||
185 | - | ||
186 | -.order .order-opt .counterView .timeIcon{ | ||
187 | - height: 24rpx; | ||
188 | - width: 24rpx; | ||
189 | -} | ||
190 | - | ||
191 | -.order .order-opt .counterView .counter{ | ||
192 | - margin-left: 10rpx; | ||
193 | - font-size: 24rpx; | ||
194 | - text-align: center; | ||
195 | -} | ||
196 | - | ||
197 | -.order .order-opt .btn { | ||
198 | - display: inline-block; | ||
199 | - height: 60rpx; | ||
200 | - line-height: 60rpx; | ||
201 | - width: 140rpx; | ||
202 | - font-size: 25rpx; | ||
203 | - text-align: center; | ||
204 | - border: 1rpx solid #444444; | ||
205 | - color: #444444; | ||
206 | - border-radius: 4rpx; | ||
207 | -} | ||
208 | - | ||
209 | -.button { | ||
210 | - height: 54rpx; | ||
211 | - line-height: 54rpx; | ||
212 | - width: 130rpx; | ||
213 | - padding-left: 1rpx; | ||
214 | - padding-right: 1rpx; | ||
215 | - font-size: 25rpx; | ||
216 | - text-align: center; | ||
217 | - margin-right: 1rpx; | ||
218 | -} | ||
219 | - | ||
220 | -a { | ||
221 | - outline: none; | ||
222 | - color: #444444; | ||
223 | - text-decoration: none; | ||
224 | -} | ||
225 | - | ||
226 | -.order .order-opt .pay { | ||
227 | - background: #d0021b; | ||
228 | - color: #fff; | ||
229 | - border: none; | ||
230 | - font-size: 25rpx; | ||
231 | - margin-left: 20rpx; | ||
232 | - line-height: 58rpx; | ||
233 | - border: 1rpx solid #d0021b; | ||
234 | -} |
@@ -2,6 +2,8 @@ import wx from '../../../utils/wx'; | @@ -2,6 +2,8 @@ import wx from '../../../utils/wx'; | ||
2 | import orderModel from '../../../models/home/order'; | 2 | import orderModel from '../../../models/home/order'; |
3 | import { wechatPay } from '../../../utils/wechat-pay'; | 3 | import { wechatPay } from '../../../utils/wechat-pay'; |
4 | 4 | ||
5 | +const REASON_CACHE_KEY = 'refund_reason_cache'; | ||
6 | + | ||
5 | let app = getApp(); | 7 | let app = getApp(); |
6 | let router = global.router; | 8 | let router = global.router; |
7 | 9 | ||
@@ -19,7 +21,7 @@ export default { | @@ -19,7 +21,7 @@ export default { | ||
19 | }).then(res => { | 21 | }).then(res => { |
20 | if (res.confirm) { | 22 | if (res.confirm) { |
21 | orderModel.delOrder({order_code: orderCode}).then(json => { | 23 | orderModel.delOrder({order_code: orderCode}).then(json => { |
22 | - callback(json); | 24 | + callback && callback(json); |
23 | }); | 25 | }); |
24 | } | 26 | } |
25 | }) | 27 | }) |
@@ -38,7 +40,7 @@ export default { | @@ -38,7 +40,7 @@ export default { | ||
38 | }).then(res => { | 40 | }).then(res => { |
39 | if (res.confirm) { | 41 | if (res.confirm) { |
40 | orderModel.confirmReceive({order_code: orderCode, miniapp_type: app.getMiniappType()}).then(json => { | 42 | orderModel.confirmReceive({order_code: orderCode, miniapp_type: app.getMiniappType()}).then(json => { |
41 | - callback(json); | 43 | + callback && callback(json); |
42 | }); | 44 | }); |
43 | } | 45 | } |
44 | }); | 46 | }); |
@@ -61,7 +63,7 @@ export default { | @@ -61,7 +63,7 @@ export default { | ||
61 | wx.showModal({title: json.message, showCancel: false}); | 63 | wx.showModal({title: json.message, showCancel: false}); |
62 | } | 64 | } |
63 | 65 | ||
64 | - callback(json); | 66 | + callback && callback(json); |
65 | }); | 67 | }); |
66 | } | 68 | } |
67 | }); | 69 | }); |
@@ -79,7 +81,42 @@ export default { | @@ -79,7 +81,42 @@ export default { | ||
79 | 81 | ||
80 | wechatPay(data, callback) | 82 | wechatPay(data, callback) |
81 | }, | 83 | }, |
82 | - refundNow() { | 84 | + refundNow(orderCode, reason, callback) { |
85 | + orderModel.refundOrder({ | ||
86 | + order_code: orderCode, | ||
87 | + reason_id: reason.reason_id, | ||
88 | + reason: reason.reason, | ||
89 | + fromPage: 'aFP_MineOrderContent' | ||
90 | + }).then(json => { | ||
91 | + callback && callback(json); | ||
92 | + }) | ||
93 | + }, | ||
94 | + getRefundReason(callback) { | ||
95 | + let reason; | ||
96 | + | ||
97 | + try { | ||
98 | + reason = wx.getStorageSync(REASON_CACHE_KEY); | ||
99 | + | ||
100 | + if (reason) { | ||
101 | + reason = JSON.parse(reason); | ||
102 | + } | ||
103 | + } catch (e) { | ||
104 | + console.log(JSON.stringify(e)) | ||
105 | + } | ||
83 | 106 | ||
84 | - } | 107 | + if (reason) { |
108 | + return callback && callback(reason); | ||
109 | + } | ||
110 | + | ||
111 | + orderModel.getRefundSeason().then(res => { | ||
112 | + if (res.code === 200) { | ||
113 | + return callback && callback(res.data); | ||
114 | + | ||
115 | + wx.setStorage({ | ||
116 | + key: REASON_CACHE_KEY, | ||
117 | + data: JSON.stringify(res.data) | ||
118 | + }); | ||
119 | + } | ||
120 | + }); | ||
121 | + }, | ||
85 | } | 122 | } |
@@ -12,9 +12,10 @@ let timer; | @@ -12,9 +12,10 @@ let timer; | ||
12 | 12 | ||
13 | Page({ | 13 | Page({ |
14 | data: { | 14 | data: { |
15 | - windowHeight: windowHeight + 48, | 15 | + windowHeight: windowHeight + 48, |
16 | orderType: 1, | 16 | orderType: 1, |
17 | - ordersList: [] | 17 | + ordersList: [], |
18 | + reason: [] | ||
18 | }, | 19 | }, |
19 | onLoad: function (options) { | 20 | onLoad: function (options) { |
20 | let type = options.type || 1; | 21 | let type = options.type || 1; |
@@ -132,6 +133,16 @@ Page({ | @@ -132,6 +133,16 @@ Page({ | ||
132 | } | 133 | } |
133 | }); | 134 | }); |
134 | }, | 135 | }, |
136 | + loadRefundReason() { | ||
137 | + if (this.hasSetReason) { | ||
138 | + return; | ||
139 | + } | ||
140 | + | ||
141 | + orderHandle.getRefundReason(res => { | ||
142 | + this.setData({reason: res}); | ||
143 | + this.hasSetReason = true; | ||
144 | + }); | ||
145 | + }, | ||
135 | navToOrderDetail(e) { | 146 | navToOrderDetail(e) { |
136 | let code = e.currentTarget.dataset.order_code; | 147 | let code = e.currentTarget.dataset.order_code; |
137 | 148 | ||
@@ -179,5 +190,38 @@ Page({ | @@ -179,5 +190,38 @@ Page({ | ||
179 | orderType: type | 190 | orderType: type |
180 | }); | 191 | }); |
181 | this.getOrders(type); | 192 | this.getOrders(type); |
193 | + }, | ||
194 | + refundOrder() { | ||
195 | + let that = this; | ||
196 | + | ||
197 | + wx.showModal({ | ||
198 | + content: '申请退款后,本单享有的优惠可能会一并取消,确定申请吗?', | ||
199 | + cancelText: '取消', | ||
200 | + confirmText: '确定', | ||
201 | + confirmColor: '#FF0000', | ||
202 | + success(res) { | ||
203 | + if (res.confirm) { | ||
204 | + that.loadRefundReason(); | ||
205 | + that.setData({showReason: true}); | ||
206 | + } | ||
207 | + } | ||
208 | + }); | ||
209 | + }, | ||
210 | + hidePicker(e) { | ||
211 | + if (e.target.id === 'reason-picker') { | ||
212 | + this.setData({showReason: false}); | ||
213 | + } | ||
214 | + }, | ||
215 | + reasonChange(e) { | ||
216 | + this.reasonIndex = e.detail.value[0]; | ||
217 | + }, | ||
218 | + reasonSure() { | ||
219 | + orderHandle.refundNow(this.orderCode, this.data.reason[this.reasonIndex || 0], res => { | ||
220 | + if (res && res.code == 200) { | ||
221 | + wx.navigateBack({delta:1}); | ||
222 | + } | ||
223 | + }); | ||
224 | + | ||
225 | + this.setData({showReason: false}); | ||
182 | } | 226 | } |
183 | }); | 227 | }); |
1 | -<import src="./item/item.wxml"/> | 1 | +<import src="./template/item/item.wxml"/> |
2 | +<import src="./template/reason/reason.wxml"/> | ||
3 | + | ||
2 | <scroll-view class="page-container"> | 4 | <scroll-view class="page-container"> |
3 | <view class="order-types"> | 5 | <view class="order-types"> |
4 | <view class="type {{orderType == 1 ? 'active' : ''}}" data-type="1" bindtap="changeType"> | 6 | <view class="type {{orderType == 1 ? 'active' : ''}}" data-type="1" bindtap="changeType"> |
@@ -27,6 +29,8 @@ | @@ -27,6 +29,8 @@ | ||
27 | <button bindtap="goShopping" class="loginBtn">去逛逛</button> | 29 | <button bindtap="goShopping" class="loginBtn">去逛逛</button> |
28 | </view> | 30 | </view> |
29 | </view> | 31 | </view> |
30 | - <copyright class="copyright"></copyright> | 32 | + <copyright class="copyright"></copyright> |
31 | </view> | 33 | </view> |
32 | -</scroll-view> | ||
34 | +</scroll-view> | ||
35 | + | ||
36 | +<template is="reason" data="{{reason, showReason}}"></template> |
1 | -@import "./item/item.wxss"; | 1 | +@import "./template/item/item.wxss"; |
2 | +@import "./template/reason/reason.wxss"; | ||
2 | 3 | ||
3 | .page-container { | 4 | .page-container { |
4 | background-color: #f2f2f2; | 5 | background-color: #f2f2f2; |
@@ -258,4 +259,4 @@ a { | @@ -258,4 +259,4 @@ a { | ||
258 | bottom: 340rpx; | 259 | bottom: 340rpx; |
259 | right: 0; | 260 | right: 0; |
260 | z-index: 1101; | 261 | z-index: 1101; |
261 | -} | ||
262 | +} |
-
Please register or login to post a comment