Showing
4 changed files
with
400 additions
and
1 deletions
@@ -2,4 +2,144 @@ | @@ -2,4 +2,144 @@ | ||
2 | * @description: 订单保存 | 2 | * @description: 订单保存 |
3 | * @time: 2015/12/21 | 3 | * @time: 2015/12/21 |
4 | */ | 4 | */ |
5 | + var $ = require('yoho.jquery'); | ||
5 | 6 | ||
7 | + | ||
8 | +var Order={ | ||
9 | + Data:{ | ||
10 | + product:0, | ||
11 | + activity:0, | ||
12 | + carriage:0, | ||
13 | + juan:0, | ||
14 | + yohocoin:0 | ||
15 | + }, | ||
16 | + UI:{ | ||
17 | + e:{ | ||
18 | + $pan: $('.pan'), | ||
19 | + $jc: $("#juancode"), | ||
20 | + $bp:$("#biprice"), | ||
21 | + $statistics:$("li",".play-total"), | ||
22 | + $tobi:$("p em",".play-bi-pan .play-pan"), | ||
23 | + $cancel:$(".cancel",".btn-group") | ||
24 | + }, | ||
25 | + init:function(){ | ||
26 | + var e=this.e; | ||
27 | + | ||
28 | + /*初始化价格*/ | ||
29 | + this.render(); | ||
30 | + | ||
31 | + /*点击pan dt 打开dd*/ | ||
32 | + e.$pan.find("dt").click(function () { | ||
33 | + var pan=$(this).parent("dl.pan"); | ||
34 | + if(pan.find("dd").is(":hidden")){ | ||
35 | + pan.find("dd").show(); | ||
36 | + if(pan.attr("class").match(/(-bi-)|(-juan-)/g)){ | ||
37 | + $(this).hide(); | ||
38 | + } | ||
39 | + }else{ | ||
40 | + pan.find("dd").hide(); | ||
41 | + } | ||
42 | + | ||
43 | + }); | ||
44 | + | ||
45 | + /*使用优惠卷支付 下面的文本框*/ | ||
46 | + e.$jc.focus(function(){ | ||
47 | + $(this).prev("label").prev(":radio").attr("checked",true); | ||
48 | + }).change(function(){ | ||
49 | + $(this).prev("label").prev(":radio").val($(this).val()); | ||
50 | + }); | ||
51 | + | ||
52 | + /*使用YOHO币支付*/ | ||
53 | + e.$bp.data("tobi",e.$tobi.html()) | ||
54 | + e.$bp.keyup(function(){ | ||
55 | + var bi=Order.Common.enterNUM($(this).val(),$(this).data("tobi")); | ||
56 | + $(this).val(bi); | ||
57 | + }).change(function(){ | ||
58 | + var bi=Order.Common.enterNUM($(this).val(),$(this).data("tobi")); | ||
59 | + $(this).val(bi); | ||
60 | + }); | ||
61 | + | ||
62 | + /*取消关闭小窗口*/ | ||
63 | + e.$cancel.click(function(){ | ||
64 | + var p=$(this).parents(".pan"); | ||
65 | + p.find("dt").show(); | ||
66 | + p.find("dd").hide(); | ||
67 | + }); | ||
68 | + }, | ||
69 | + render:function(){ | ||
70 | + var e=this.e,d=Order.Data; | ||
71 | + | ||
72 | + e.$statistics.slice(3,5).hide(); | ||
73 | + e.$statistics.slice(2,5).find("em").html("0.00"); | ||
74 | + if(d.carriage){ | ||
75 | + e.$statistics.eq(2).find("em").html(d.carriage); | ||
76 | + } | ||
77 | + if(d.juan){ | ||
78 | + e.$statistics.eq(3).show().find("em").html(d.juan); | ||
79 | + } | ||
80 | + if(d.yohocoin){ | ||
81 | + e.$statistics.eq(4).show().find("em").html(d.yohocoin); | ||
82 | + } | ||
83 | + } | ||
84 | + }, | ||
85 | + Common:{ | ||
86 | + enterNUM:function(str1,str2){ | ||
87 | + str1=str1.replace(/[^\d]/g,''); | ||
88 | + if(str1&&str2){ | ||
89 | + str1=parseInt(str1); | ||
90 | + str2=parseInt(str2); | ||
91 | + if(str1>str2){ | ||
92 | + str1=str2; | ||
93 | + } | ||
94 | + } | ||
95 | + return str1; | ||
96 | + }, | ||
97 | + calucate:function(){ | ||
98 | + var p=Order.Data; | ||
99 | + $.each(Order.Data,function(key,index){ | ||
100 | + p[key]=parseFloat(Order.Data[key]); | ||
101 | + }); | ||
102 | + return p.product-p.activity+p.carriage-p.juan-p.yohocoin; | ||
103 | + } | ||
104 | + }, | ||
105 | + Submit:{ | ||
106 | + e:{ | ||
107 | + $juanok:$("#juansubmit"), | ||
108 | + $juantip:$(".errtip",".play-juan-pan"), | ||
109 | + $biok:$("#juansubmit") | ||
110 | + }, | ||
111 | + init:function(){ | ||
112 | + var e=this.e; | ||
113 | + | ||
114 | + e.$juanok.click(function(){ | ||
115 | + $jgroup=$('input[name="juangroup"]:checked'); | ||
116 | + var pan=$(this).parents(".pan"); | ||
117 | + if($jgroup.val()){ | ||
118 | + var options={ | ||
119 | + url:'/Order/save/priceByCode', | ||
120 | + type:'post', | ||
121 | + data:{code:$jgroup.val()}, | ||
122 | + success:function(data){ | ||
123 | + if(data.code===200){ | ||
124 | + if(data.price){ | ||
125 | + Order.Data.juan=data.price; | ||
126 | + } | ||
127 | + Order.UI.render(); | ||
128 | + pan.hide(); | ||
129 | + } | ||
130 | + e.$juantip.html(data.msg); | ||
131 | + }, | ||
132 | + error:function(){ | ||
133 | + e.$juantip.html(data.msg); | ||
134 | + } | ||
135 | + } | ||
136 | + $.ajax(options); | ||
137 | + } | ||
138 | + }); | ||
139 | + } | ||
140 | + } | ||
141 | +} | ||
142 | + | ||
143 | + | ||
144 | +Order.UI.init(); | ||
145 | +Order.Submit.init(); |
web-static/sass/order/_pay.scss
0 → 100644
1 | +.order-pay{ | ||
2 | + font-size: 12px; | ||
3 | + line-height: 150%; | ||
4 | + .pay-wapper{ | ||
5 | + border: 1px solid #ccc; | ||
6 | + } | ||
7 | + table{ | ||
8 | + width: 100%; | ||
9 | + td{ | ||
10 | + border: 1px solid #ccc; | ||
11 | + border-left: 0 none; | ||
12 | + padding: 10px; | ||
13 | + text-align: center; | ||
14 | + } | ||
15 | + } | ||
16 | + thead{ | ||
17 | + background: #000; | ||
18 | + th{ | ||
19 | + height: 32px; | ||
20 | + line-height: 32px; | ||
21 | + color: #fff; | ||
22 | + vertical-align: middle; | ||
23 | + text-align: center; | ||
24 | + font-weight: bold; | ||
25 | + } | ||
26 | + .clo1{ | ||
27 | + width: 10%; | ||
28 | + } | ||
29 | + .clo2{ | ||
30 | + width: 20%; | ||
31 | + } | ||
32 | + .clo4{ | ||
33 | + width: 40%; | ||
34 | + } | ||
35 | + } | ||
36 | + .pay-pro{ | ||
37 | + .pay-pro-icon{ | ||
38 | + float: left; | ||
39 | + display: inline; | ||
40 | + width: 60px; | ||
41 | + height: 60px; | ||
42 | + display: block; | ||
43 | + } | ||
44 | + .pay-pro-info{ | ||
45 | + color: #999; | ||
46 | + margin-left:70px; | ||
47 | + padding-top: 15px; | ||
48 | + text-align: left; | ||
49 | + a{ | ||
50 | + color: #468fa2; | ||
51 | + text-decoration: none; | ||
52 | + display: block; | ||
53 | + &:hover{ | ||
54 | + text-decoration: underline; | ||
55 | + } | ||
56 | + } | ||
57 | + } | ||
58 | + } | ||
59 | + .play-content{ | ||
60 | + padding: 10px; | ||
61 | + .red{ | ||
62 | + color: #e8044f!important; | ||
63 | + } | ||
64 | + .orange{ | ||
65 | + color: #f60!important; | ||
66 | + } | ||
67 | + .strong{ | ||
68 | + font-weight: bold; | ||
69 | + color: #000; | ||
70 | + } | ||
71 | + .pan{ | ||
72 | + dt{ | ||
73 | + width: 105px; | ||
74 | + height: 30px; | ||
75 | + padding: 0px 0px 0px 30px; | ||
76 | + line-height: 30px; | ||
77 | + text-align: left; | ||
78 | + border: 0px; | ||
79 | + color: #fff; | ||
80 | + display: inline-block; | ||
81 | + cursor: pointer; | ||
82 | + background: url(http://static.yohobuy.com/images/btn_openclose.png) no-repeat 0px -60px; | ||
83 | + margin-bottom:5px; | ||
84 | + } | ||
85 | + dd{ | ||
86 | + display: none; | ||
87 | + border: 1px #ccc solid; | ||
88 | + padding: 10px 15px; | ||
89 | + margin-bottom: 10px; | ||
90 | + } | ||
91 | + } | ||
92 | + .textbox{ | ||
93 | + height: 20px; | ||
94 | + line-height: 20px; | ||
95 | + color: #333; | ||
96 | + border: 1px #c9c9c9 solid; | ||
97 | + vertical-align: top; | ||
98 | + } | ||
99 | + .dropdown{ | ||
100 | + height: 20px; | ||
101 | + line-height: 20px; | ||
102 | + color: #333; | ||
103 | + border: 1px #c9c9c9 solid; | ||
104 | + vertical-align: top; | ||
105 | + } | ||
106 | + .btn-group{ | ||
107 | + text-align: right; | ||
108 | + input{ | ||
109 | + display: inline-block; | ||
110 | + background: none; | ||
111 | + border: 1px solid #ccc; | ||
112 | + border-radius: 2px; | ||
113 | + height: 20px; | ||
114 | + } | ||
115 | + .ok{ | ||
116 | + background-color: #000; | ||
117 | + color:#fff; | ||
118 | + } | ||
119 | + } | ||
120 | + .play-left{ | ||
121 | + float: left; | ||
122 | + width: 405px; | ||
123 | + .pan{ | ||
124 | + text-align: left; | ||
125 | + dt{ | ||
126 | + color: #000; | ||
127 | + background: url(http://static.yohobuy.com/images/btn_openclose.png) no-repeat 0px 0px; | ||
128 | + } | ||
129 | + } | ||
130 | + | ||
131 | + } | ||
132 | + .play-piao-pan{ | ||
133 | + li{ | ||
134 | + height: 25px; | ||
135 | + padding: 10px 0px; | ||
136 | + line-height: 22px; | ||
137 | + label{ | ||
138 | + width: 65px; | ||
139 | + display: inline-block; | ||
140 | + } | ||
141 | + .textbox{ | ||
142 | + width: 200px; | ||
143 | + } | ||
144 | + } | ||
145 | + } | ||
146 | + .play-remark-pan{ | ||
147 | + .textbox{ | ||
148 | + width: 369px; | ||
149 | + height: 70px; | ||
150 | + } | ||
151 | + .note{ | ||
152 | + padding: 5px 0; | ||
153 | + color: #999; | ||
154 | + } | ||
155 | + } | ||
156 | + .play-right{ | ||
157 | + float: right; | ||
158 | + width: 50%; | ||
159 | + width: 405px; | ||
160 | + .play-total{ | ||
161 | + text-align: right; | ||
162 | + padding-bottom: 20px; | ||
163 | + label{ | ||
164 | + padding-right: 10px; | ||
165 | + } | ||
166 | + em{ | ||
167 | + width: 80px; | ||
168 | + text-align: left; | ||
169 | + display: inline-block; | ||
170 | + } | ||
171 | + } | ||
172 | + .pan{ | ||
173 | + text-align: right; | ||
174 | + } | ||
175 | + | ||
176 | + } | ||
177 | + .play-juan-pan{ | ||
178 | + dd{ | ||
179 | + text-align: left; | ||
180 | + } | ||
181 | + | ||
182 | + .play-juan{ | ||
183 | + padding: 10px 0; | ||
184 | + .textbox{ | ||
185 | + width: 70px; | ||
186 | + } | ||
187 | + } | ||
188 | + | ||
189 | + } | ||
190 | + .play-bi-pan{ | ||
191 | + dd{ | ||
192 | + text-align: right; | ||
193 | + } | ||
194 | + .textbox{ | ||
195 | + width: 70px; | ||
196 | + } | ||
197 | + p{ | ||
198 | + padding: 10px 0; | ||
199 | + } | ||
200 | + | ||
201 | + } | ||
202 | + | ||
203 | + } | ||
204 | + .to-play{ | ||
205 | + p{ | ||
206 | + padding: 10px 0px; | ||
207 | + font-size: 14px; | ||
208 | + text-align: right; | ||
209 | + color: #000; | ||
210 | + em{ | ||
211 | + color: #e8044f; | ||
212 | + font-size: 24px; | ||
213 | + } | ||
214 | + } | ||
215 | + .btn-group{ | ||
216 | + padding: 10px 0px 40px 0px; | ||
217 | + .submit{ | ||
218 | + float: right; | ||
219 | + width: 133px; | ||
220 | + height: 33px; | ||
221 | + padding: 0px; | ||
222 | + text-align: center; | ||
223 | + border: 0px; | ||
224 | + line-height: 33px; | ||
225 | + font-size: 14px; | ||
226 | + color: #fff; | ||
227 | + font-weight: bold; | ||
228 | + background: url(http://static.yohobuy.com/images/btns.png) no-repeat 0px -33px; | ||
229 | + display: inline-block; | ||
230 | + cursor: pointer; | ||
231 | + } | ||
232 | + } | ||
233 | + } | ||
234 | + | ||
235 | +} |
@@ -10,10 +10,33 @@ class SaveController extends AbstractAction | @@ -10,10 +10,33 @@ class SaveController extends AbstractAction | ||
10 | public function indexAction() | 10 | public function indexAction() |
11 | { | 11 | { |
12 | $data = array( | 12 | $data = array( |
13 | - 'orderSavePage' => true | 13 | + 'orderSavePage' => true, |
14 | + 'orderSave'=>array( | ||
15 | + 'orderProducts'=>array( | ||
16 | + array('name' =>"Eight Guys 破洞束口牛仔裤",'tip'=>"颜色:蓝色 尺码:L",'unitprice'=>'179.00','currency'=>'0','count'=>'0'), | ||
17 | + array('name' =>"Eight Guys 破洞束口牛仔裤",'tip'=>"颜色:蓝色 尺码:L",'unitprice'=>'179.00','currency'=>'0','count'=>'0') | ||
18 | + ) | ||
19 | + ) | ||
14 | ); | 20 | ); |
15 | 21 | ||
16 | $this->_view->display('index', $data); | 22 | $this->_view->display('index', $data); |
17 | } | 23 | } |
18 | 24 | ||
25 | + /*获取优惠卷的面额*/ | ||
26 | + public function priceByCodeAction() | ||
27 | + { | ||
28 | + $result = array(); | ||
29 | + | ||
30 | + do { | ||
31 | + | ||
32 | + $result=array( | ||
33 | + 'code'=>200, | ||
34 | + 'msg'=>'成功',//卷不存在,过期等等 | ||
35 | + 'price'=>'10' | ||
36 | + ); | ||
37 | + } while (false); | ||
38 | + | ||
39 | + $this->echoJson($result); | ||
40 | + } | ||
41 | + | ||
19 | } | 42 | } |
-
Please register or login to post a comment