|
|
@@ -50,37 +50,50 @@ Page({
|
|
50
|
50
|
if (e) {
|
|
51
|
51
|
id = e.currentTarget.dataset.id;
|
|
52
|
52
|
}
|
|
|
53
|
+
|
|
53
|
54
|
var total = 0, totalFinal = 0,
|
|
54
|
55
|
selectCount = 0, discounts = 0;
|
|
55
|
|
- for (var i = 0; i < this.data.ListProgram.length; i++) {
|
|
56
|
|
- if (this.data.ListProgram[i].ID == id) {
|
|
57
|
|
- this.data.ListProgram[i].IsSelect = !this.data.ListProgram[i].IsSelect;
|
|
|
56
|
+ var remark = "", isAll = false;
|
|
|
57
|
+ if (id == 999) {
|
|
|
58
|
+ totalFinal = "150.00";
|
|
|
59
|
+ total = 150;
|
|
|
60
|
+ remark = "4款产品永久有效期";
|
|
|
61
|
+ isAll = true;
|
|
|
62
|
+ for (var i = 0; i < this.data.ListProgram.length; i++) {
|
|
|
63
|
+ this.data.ListProgram[i].IsSelect = false;
|
|
58
|
64
|
}
|
|
|
65
|
+ }
|
|
|
66
|
+ else {
|
|
|
67
|
+ for (var i = 0; i < this.data.ListProgram.length; i++) {
|
|
|
68
|
+ if (this.data.ListProgram[i].ID == id) {
|
|
|
69
|
+ this.data.ListProgram[i].IsSelect = !this.data.ListProgram[i].IsSelect;
|
|
|
70
|
+ }
|
|
59
|
71
|
|
|
60
|
|
- if (this.data.ListProgram[i].IsSelect) {
|
|
61
|
|
- total += this.data.ListProgram[i].Price;
|
|
62
|
|
- selectCount++;
|
|
|
72
|
+ if (this.data.ListProgram[i].IsSelect) {
|
|
|
73
|
+ total += this.data.ListProgram[i].Price;
|
|
|
74
|
+ selectCount++;
|
|
|
75
|
+ }
|
|
63
|
76
|
}
|
|
64
|
|
- }
|
|
65
|
77
|
|
|
66
|
|
- var discount = 1;
|
|
67
|
|
- if (selectCount >= 3) {
|
|
68
|
|
- discount = 0.7
|
|
69
|
|
- }
|
|
70
|
|
- else if (selectCount == 2) {
|
|
71
|
|
- discount = 0.8
|
|
72
|
|
- }
|
|
|
78
|
+ var discount = 1;
|
|
|
79
|
+ if (selectCount >= 3) {
|
|
|
80
|
+ discount = 0.7
|
|
|
81
|
+ }
|
|
|
82
|
+ else if (selectCount == 2) {
|
|
|
83
|
+ discount = 0.8
|
|
|
84
|
+ }
|
|
73
|
85
|
|
|
74
|
|
- totalFinal = total * discount;
|
|
75
|
|
- discounts = total - totalFinal;
|
|
|
86
|
+ totalFinal = total * discount;
|
|
|
87
|
+ discounts = total - totalFinal;
|
|
76
|
88
|
|
|
77
|
|
- total = Math.round(total) / 100;
|
|
78
|
|
- totalFinal = Math.round(totalFinal) / 100;
|
|
79
|
|
- discounts = Math.round(discounts) / 100;
|
|
|
89
|
+ total = Math.round(total) / 100;
|
|
|
90
|
+ totalFinal = Math.round(totalFinal) / 100;
|
|
|
91
|
+ discounts = Math.round(discounts) / 100;
|
|
80
|
92
|
|
|
81
|
|
- var remark = "一款原价,成套购买更划算";
|
|
82
|
|
- if (discount < 1)
|
|
83
|
|
- remark = "套装购买现享 " + (discount * 10) + " 折,已优惠 " + discounts + " 元"
|
|
|
93
|
+ remark = "一款原价,成套购买更划算";
|
|
|
94
|
+ if (discount < 1)
|
|
|
95
|
+ remark = "套装购买现享 " + (discount * 10) + " 折,已优惠 " + discounts + " 元"
|
|
|
96
|
+ }
|
|
84
|
97
|
|
|
85
|
98
|
this.setData({
|
|
86
|
99
|
ListProgram: this.data.ListProgram,
|
|
|
@@ -88,6 +101,7 @@ Page({
|
|
88
|
101
|
Remark: remark,
|
|
89
|
102
|
Total: total,
|
|
90
|
103
|
Discount: discount,
|
|
|
104
|
+ IsAll: isAll,
|
|
91
|
105
|
});
|
|
92
|
106
|
|
|
93
|
107
|
},
|
|
|
@@ -98,7 +112,7 @@ Page({
|
|
98
|
112
|
if (!isPaying) {
|
|
99
|
113
|
isPaying = true;
|
|
100
|
114
|
var that = this;
|
|
101
|
|
- var money = this.data.TotalFinal;
|
|
|
115
|
+ var money = Number(this.data.TotalFinal);
|
|
102
|
116
|
var detail = "";
|
|
103
|
117
|
for (var i = 0; i < this.data.ListProgram.length; i++) {
|
|
104
|
118
|
if (this.data.ListProgram[i].IsSelect) {
|
|
|
@@ -115,24 +129,47 @@ Page({
|
|
115
|
129
|
});
|
|
116
|
130
|
}
|
|
117
|
131
|
else {
|
|
118
|
|
- server.payMoney(4, money, detail, function (data) {
|
|
119
|
|
- wx.setStorageSync("IsShowActivty", true);
|
|
120
|
|
- var that = this;
|
|
121
|
|
- wx.getSetting({
|
|
122
|
|
- success(res) {
|
|
123
|
|
- if (res.authSetting['scope.userInfo']) {
|
|
124
|
|
- wx.navigateTo({
|
|
125
|
|
- url: '../about/payfinished?type=all',
|
|
126
|
|
- });
|
|
|
132
|
+ if (money >= 150) {
|
|
|
133
|
+ detail = "89:3750,98:3750,99:3750,106:3750";
|
|
|
134
|
+ server.payMoney(6, money, detail, function (data) {
|
|
|
135
|
+ wx.setStorageSync("IsShowActivty", true);
|
|
|
136
|
+ var that = this;
|
|
|
137
|
+ wx.getSetting({
|
|
|
138
|
+ success(res) {
|
|
|
139
|
+ if (res.authSetting['scope.userInfo']) {
|
|
|
140
|
+ wx.navigateTo({
|
|
|
141
|
+ url: '../about/payfinished?type=all',
|
|
|
142
|
+ });
|
|
|
143
|
+ }
|
|
|
144
|
+ else {
|
|
|
145
|
+ wx.navigateTo({
|
|
|
146
|
+ url: '../about/payfinished?type=accredit',
|
|
|
147
|
+ });
|
|
|
148
|
+ }
|
|
127
|
149
|
}
|
|
128
|
|
- else {
|
|
129
|
|
- wx.navigateTo({
|
|
130
|
|
- url: '../about/payfinished?type=accredit',
|
|
131
|
|
- });
|
|
|
150
|
+ });
|
|
|
151
|
+ });
|
|
|
152
|
+ }
|
|
|
153
|
+ else {
|
|
|
154
|
+ server.payMoney(4, money, detail, function (data) {
|
|
|
155
|
+ wx.setStorageSync("IsShowActivty", true);
|
|
|
156
|
+ var that = this;
|
|
|
157
|
+ wx.getSetting({
|
|
|
158
|
+ success(res) {
|
|
|
159
|
+ if (res.authSetting['scope.userInfo']) {
|
|
|
160
|
+ wx.navigateTo({
|
|
|
161
|
+ url: '../about/payfinished?type=all',
|
|
|
162
|
+ });
|
|
|
163
|
+ }
|
|
|
164
|
+ else {
|
|
|
165
|
+ wx.navigateTo({
|
|
|
166
|
+ url: '../about/payfinished?type=accredit',
|
|
|
167
|
+ });
|
|
|
168
|
+ }
|
|
132
|
169
|
}
|
|
133
|
|
- }
|
|
|
170
|
+ });
|
|
134
|
171
|
});
|
|
135
|
|
- });
|
|
|
172
|
+ }
|
|
136
|
173
|
}
|
|
137
|
174
|
setTimeout(function () {
|
|
138
|
175
|
isPaying = false;
|