Authored by 黄敬囿

优化我的收入 review by 李其昌

1 -// src/components/order/orderButton.js  
2 -import OrderActionService from './orderActionService.js';  
3 -const DEL_ORDER = 'del_order';  
4 -const BUY_AGAIN = 'buy_again';  
5 -const CANCEL_ORDER = 'cancel_order';  
6 -const NOW_BUY = 'now_buy';  
7 -//订单操作接口  
8 -const UFO_BUYER_DELETE_ORDER = 'ufo.buyer.delete';  
9 -const UFO_BUYER_CANCEL_ORDER = 'ufo.buyer.cancel';  
10 -const api = new OrderActionService();  
11 -Component({  
12 - /**  
13 - * 组件的属性列表  
14 - */  
15 - properties: {  
16 - button: Object,  
17 - cIndex: Number,  
18 - lastIndex: Number,  
19 - isLast: Boolean,  
20 - orderCode: String,  
21 -  
22 - },  
23 -  
24 - /**  
25 - * 组件的初始数据  
26 - */  
27 - data: {  
28 - isSelected: false,  
29 -  
30 - },  
31 -  
32 - lifetimes: {  
33 -  
34 - },  
35 -  
36 - attached: function () {  
37 - let that = this;  
38 - // let buttonInfo = that.button;  
39 - // let code = buttonInfo.code;  
40 - console.log(that.cIndex + "====orderCode===" + that.orderCode + "===" +that.isLast);  
41 - // let sum = that.id + 1;  
42 - // if (that.length === sum){  
43 - // that.setData({isSelected : true});  
44 - // }  
45 -  
46 -  
47 - },  
48 -  
49 - /**  
50 - * 组件的方法列表  
51 - */  
52 - methods: {  
53 - onButtonClick: function (e) {  
54 - let actionCode = e.currentTarget.dataset.buttonCode;  
55 - let orderCode = e.currentTarget.dataset.orderCode;  
56 - let productId = e.currentTarget.dataset.productId;  
57 -  
58 - if (actionCode == BUY_AGAIN) {  
59 - wx.navigateTo({  
60 - url: '/pages/productDetail/index?id=' + productId,  
61 - })  
62 - } else if (actionCode == NOW_BUY) {  
63 - console.log("== 去支付页面===")  
64 - wx.navigateTo({  
65 - //todo:  
66 -  
67 - //url: '/pages/productDetail/index?id=' + productId,  
68 - })  
69 - } else {  
70 - this.triggerEvent('buttonClick', actionCode)  
71 - // this.showDialog(orderCode, actionCode);  
72 - }  
73 -  
74 - },  
75 - /**  
76 - * 订单操作  
77 - */  
78 - actionOrder: function (orderCode, method) {  
79 - let that = this;  
80 - wx.showLoading({  
81 - title: '加载中...',  
82 - })  
83 - let params = {  
84 - uid: '500031132',  
85 - method: method,  
86 - orderCode: orderCode,  
87 - debug: 'XYZ',  
88 - }  
89 - api.actionOrder(params, () => {  
90 - wx.hideLoading();  
91 - }).then(data => {  
92 - event.emit('refresh-order');  
93 - });  
94 - },  
95 - /**  
96 - * 确认Dialog  
97 - */  
98 - showDialog: function (orderCode, actionType, ) {  
99 - let that = this;  
100 - let content = '';  
101 - let method = '';  
102 - if (actionType == DEL_ORDER) {  
103 - content = '您确定删除订单?';  
104 - method = UFO_BUYER_DELETE_ORDER;  
105 - } else if (actionType == CANCEL_ORDER) {  
106 - content = '您确定取消订单?';  
107 - method = UFO_BUYER_CANCEL_ORDER;  
108 -  
109 - }  
110 - wx.showModal({  
111 - // title: title,  
112 - content: content,  
113 - showCancel: true,  
114 - cancelText: "确定",  
115 - cancelColor: '#000000',  
116 - confirmText: "取消",  
117 - confirmColor: '#E0E0E0',  
118 - success: function (res) {  
119 - if (res.cancel) {  
120 - that.actionOrder(orderCode, method);  
121 - } else {  
122 - //点击取消,默认隐藏弹框  
123 - }  
124 - },  
125 - fail: function (res) { },  
126 - complete: function (res) { },  
127 - })  
128 -  
129 - }  
130 -  
131 - }  
132 -})  
1 -{  
2 - "component": true,  
3 - "usingComponents": {}  
4 -}  
1 -<!--src/components/order/orderButton.wxml-->  
2 -<!-- <block wx:for="buttons" wx:key="{{index}}"> -->  
3 - <button class='order-action-unselected-button' bind:buttonClick='onButtonClick' data-button-code='{{button.code}}'>{{button.text}}</button>  
4 -<!-- </block> -->  
5 -  
6 -  
1 -/* src/components/order/orderButton.wxss */  
2 -.order-action-selected-button {  
3 - /* display: flex; */  
4 - /* align-items: center; */  
5 - font-family: PingFang-SC-Medium;  
6 - font-size: 24rpx;  
7 - color: #FFFFFF;  
8 - background-color: #002B47;  
9 - border-radius: 0;  
10 - margin-left: 20rpx;  
11 - /* padding-top: 20rpx; */  
12 - /* padding-bottom: 20rpx; */  
13 - /* padding-left: 40rpx; */  
14 - /* padding-right: 40rpx; */  
15 -}  
16 -  
17 -.order-action-unselected-button::after {  
18 - /* border-style: none; */  
19 - border-radius: 0;  
20 -}  
21 -.order-action-unselected-button {  
22 - width: 224rpx;  
23 - /* display: flex; */  
24 - /* align-items: center; */  
25 - font-family: PingFang-SC-Regular;  
26 - /* font-size: 24rpx; */  
27 - color: #999999;  
28 - background-color: #FFFFFF;  
29 - border: 2rpx solid #CCCCCC;  
30 - border-radius: 0;  
31 - margin-left: 20rpx;  
32 - /* padding-top: 20rpx;  
33 - padding-bottom: 20rpx;  
34 - padding-left: 40rpx;  
35 - padding-right: 40rpx; */  
36 - /* border-style: none; */  
37 - /* margin-left: 20rpx; */  
38 - /* padding-left: 40rpx;  
39 - padding-right: 40rpx; */  
40 -}  
41 -.order-action-left-view {  
42 - display: flex;  
43 - flex-direction: row;  
44 - align-items: center;  
45 -}  
46 -  
1 { 1 {
2 "component": true, 2 "component": true,
3 "usingComponents": { 3 "usingComponents": {
4 - "orderbutton":"./orderButton"  
5 } 4 }
6 } 5 }
@@ -130,7 +130,7 @@ Page({ @@ -130,7 +130,7 @@ Page({
130 goodsIncome: '0.00', 130 goodsIncome: '0.00',
131 compensateIncome: '0.00', 131 compensateIncome: '0.00',
132 } 132 }
133 - let summary = constSummary;//data.summary ? data.summary : constSummary; 133 + let summary = data.summary ? data.summary : constSummary;
134 if(detail){ 134 if(detail){
135 detail = that.data.data.concat(detail); 135 detail = that.data.data.concat(detail);
136 } else { 136 } else {
@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
9 </view> 9 </view>
10 </view> 10 </view>
11 <view class='assets-record-right-view'> 11 <view class='assets-record-right-view'>
12 - <text class='assets-record-income-txt'>{{item.amount}}</text> 12 + <text class='assets-record-income-txt'>+{{item.amount}}</text>
13 <text class='assets-record-income-tip-txt' wx:if="{{!item.normalFlag}}">打款失败</text> 13 <text class='assets-record-income-tip-txt' wx:if="{{!item.normalFlag}}">打款失败</text>
14 </view> 14 </view>
15 </view> 15 </view>