正在显示
6 个修改的文件
包含
118 行增加
和
11 行删除
@@ -20,6 +20,7 @@ class GoodsdetailsController extends WeChatBaseController{ | @@ -20,6 +20,7 @@ class GoodsdetailsController extends WeChatBaseController{ | ||
20 | 20 | ||
21 | $goods_id = $this -> request -> param(); | 21 | $goods_id = $this -> request -> param(); |
22 | $data = Db::name('goods') -> alias('a') -> field("a.*,b.name") -> join('classification b','a.classify_id = b.id','LEFT') -> where('a.id',$goods_id['goods_id']) -> find(); | 22 | $data = Db::name('goods') -> alias('a') -> field("a.*,b.name") -> join('classification b','a.classify_id = b.id','LEFT') -> where('a.id',$goods_id['goods_id']) -> find(); |
23 | + $this -> assign('price',$data['price']); | ||
23 | $price = explode('.',$data['price']); | 24 | $price = explode('.',$data['price']); |
24 | $pricing = explode('.',$data['pricing']); | 25 | $pricing = explode('.',$data['pricing']); |
25 | $data['price0'] = $price[0]; | 26 | $data['price0'] = $price[0]; |
@@ -69,6 +70,91 @@ class GoodsdetailsController extends WeChatBaseController{ | @@ -69,6 +70,91 @@ class GoodsdetailsController extends WeChatBaseController{ | ||
69 | 70 | ||
70 | } | 71 | } |
71 | 72 | ||
73 | + /** | ||
74 | + * 立即支付判断 | ||
75 | + */ | ||
76 | + public function goodsdetails_go_pay(){ | ||
77 | + | ||
78 | + $uid = cmf_get_current_user_id(); | ||
79 | + $goods_id = $_POST['id']; | ||
80 | + $data[] = Db::name('goods') -> where('id',$goods_id) -> find(); | ||
81 | + $data[0]['book_num'] = 1; | ||
82 | + | ||
83 | + foreach ($data as $key => $val){ | ||
84 | + if($data[0]['type'] == $data[$key]['type']){ | ||
85 | + }else{ | ||
86 | + $ret['type'] = 3; | ||
87 | + return json_encode($ret); | ||
88 | + } | ||
89 | + } | ||
90 | + if($data[0]['type'] == 1){ | ||
91 | + | ||
92 | + $indent['uid'] = $uid; | ||
93 | + $indent['state'] = 4; | ||
94 | + $indent['order_number'] = date('Ymd').substr(implode(NULL, array_map('ord', str_split(substr(uniqid(), 7, 13), 1))), 0, 8); | ||
95 | + $indent['money'] = $_POST['myprice']; | ||
96 | + $indent['create_time'] = time(); | ||
97 | + $indent['indent_type'] = 1; | ||
98 | + $indent['logistic_name'] = 'YTO'; | ||
99 | + $book_num = 0; | ||
100 | + foreach ($data as $key => $val){ | ||
101 | + $book_num += $val['book_num']; | ||
102 | + } | ||
103 | + $indent['book_num'] = $book_num; | ||
104 | + $indet_id = Db::name('indent') -> insertGetId($indent); | ||
105 | + foreach ($data as $key => $val){ | ||
106 | + $indent_goods['book_name'] = $val['book_name']; | ||
107 | + $indent_goods['pricing'] = $val['pricing']; | ||
108 | + $indent_goods['price'] = $val['price']; | ||
109 | + $indent_goods['number'] = $val['book_num']; | ||
110 | + $indent_goods['thumbnail'] = $val['show_img']; | ||
111 | + $indent_goods['indent_id'] = $indet_id; | ||
112 | + $indent_goods['commission'] = $val['money']; | ||
113 | + $indent_goods['goods_id'] = $val['id']; | ||
114 | + Db::name('indent_goods ') -> insert($indent_goods); | ||
115 | + } | ||
116 | + $ret['type'] = 1; | ||
117 | + $ret['indet_id'] = $indet_id; | ||
118 | + $res = json_encode($ret); | ||
119 | + return $res; | ||
120 | + }elseif ($data[0]['type'] == 2){ | ||
121 | + $indent['uid'] = $uid; | ||
122 | + $indent['state'] = 4; | ||
123 | + $indent['order_number'] = date('Ymd').substr(implode(NULL, array_map('ord', str_split(substr(uniqid(), 7, 13), 1))), 0, 8); | ||
124 | + $indent['money'] = $_POST['myprice']; | ||
125 | + $indent['indent_type'] = 2; | ||
126 | + $indent['create_time'] = time(); | ||
127 | + $book_num = 0; | ||
128 | + foreach ($data as $key => $val){ | ||
129 | + $book_num += $val['book_num']; | ||
130 | + } | ||
131 | + $indent['book_num'] = $book_num; | ||
132 | + $indent['salesman_uid'] = $data[0]['uid']; | ||
133 | + $indet_id = Db::name('indent') -> insertGetId($indent); | ||
134 | + foreach ($data as $key => $val){ | ||
135 | + $indent_goods['book_name'] = $val['book_name']; | ||
136 | + $indent_goods['pricing'] = $val['pricing']; | ||
137 | + $indent_goods['price'] = $val['price']; | ||
138 | + $indent_goods['number'] = $val['book_num']; | ||
139 | + $indent_goods['thumbnail'] = $val['show_img']; | ||
140 | + $indent_goods['indent_id'] = $indet_id; | ||
141 | + $indent_goods['commission'] = $val['money']; | ||
142 | + $indent_goods['goods_id'] = $val['id']; | ||
143 | + Db::name('indent_goods ') -> insert($indent_goods); | ||
144 | + } | ||
145 | + $ret['type'] = 2; | ||
146 | + $ret['indet_id'] = $indet_id; | ||
147 | + $res = json_encode($ret); | ||
148 | + return $res; | ||
149 | + } | ||
150 | + | ||
151 | + | ||
152 | + | ||
153 | + | ||
154 | + | ||
155 | + | ||
156 | + | ||
157 | + } | ||
72 | 158 | ||
73 | 159 | ||
74 | 160 |
@@ -30,6 +30,9 @@ class IndexController extends WeChatBaseController | @@ -30,6 +30,9 @@ class IndexController extends WeChatBaseController | ||
30 | $data_goods_hot[$key]['price1'] = $price[1]; | 30 | $data_goods_hot[$key]['price1'] = $price[1]; |
31 | } | 31 | } |
32 | } | 32 | } |
33 | + //首页轮播图 | ||
34 | + $slideshow = Db::name('slide_item') -> select(); | ||
35 | + $this -> assign('slideshow',$slideshow); | ||
33 | //判断用户是否存在 | 36 | //判断用户是否存在 |
34 | $uid = cmf_get_current_user_id(); | 37 | $uid = cmf_get_current_user_id(); |
35 | $data_my_user = Db::name('my_user') -> where('uid',$uid) -> find(); | 38 | $data_my_user = Db::name('my_user') -> where('uid',$uid) -> find(); |
@@ -51,7 +51,7 @@ class PayController extends HomeBaseController | @@ -51,7 +51,7 @@ class PayController extends HomeBaseController | ||
51 | 'body' => '百荣科技', | 51 | 'body' => '百荣科技', |
52 | 'detail' => '以客户为中心 以奋斗者文本', | 52 | 'detail' => '以客户为中心 以奋斗者文本', |
53 | 'out_trade_no' => $data['order_number'], | 53 | 'out_trade_no' => $data['order_number'], |
54 | - 'total_fee' => $data['money']*100, // 单位:分 | 54 | + 'total_fee' => 1, /*$data['money']*100,*/ // 单位:分 |
55 | 'notify_url' => url('portal/pay/notify','','',true), // 支付结果通知网址,如果不设置则会使用配置里的默认地址 | 55 | 'notify_url' => url('portal/pay/notify','','',true), // 支付结果通知网址,如果不设置则会使用配置里的默认地址 |
56 | 'openid' => $openid, // trade_type=JSAPI,此参数必传,用户在商户appid下的唯一标识, | 56 | 'openid' => $openid, // trade_type=JSAPI,此参数必传,用户在商户appid下的唯一标识, |
57 | ]; | 57 | ]; |
@@ -264,12 +264,12 @@ class PayController extends HomeBaseController | @@ -264,12 +264,12 @@ class PayController extends HomeBaseController | ||
264 | Db::rollback(); | 264 | Db::rollback(); |
265 | } | 265 | } |
266 | 266 | ||
267 | - cache('a1',"789"); | 267 | + /* cache('a1',"789"); |
268 | $bird = new BirdController; | 268 | $bird = new BirdController; |
269 | $createOrder = $bird -> createOrder($order['id']); | 269 | $createOrder = $bird -> createOrder($order['id']); |
270 | cache('yuyue1',$createOrder); | 270 | cache('yuyue1',$createOrder); |
271 | $takeOrder = $bird -> takeOrder($order['id']); | 271 | $takeOrder = $bird -> takeOrder($order['id']); |
272 | - cache('dingyue1',$takeOrder); | 272 | + cache('dingyue1',$takeOrder);*/ |
273 | } | 273 | } |
274 | return true; // 返回处理完成 | 274 | return true; // 返回处理完成 |
275 | }); | 275 | }); |
@@ -129,9 +129,7 @@ | @@ -129,9 +129,7 @@ | ||
129 | </div> | 129 | </div> |
130 | <div class="de_footerRight"> | 130 | <div class="de_footerRight"> |
131 | <div class="de_footerRight1" onclick="add_cart({$data.id})">加入购物车</div> | 131 | <div class="de_footerRight1" onclick="add_cart({$data.id})">加入购物车</div> |
132 | - <a href="order_confirm.html"> | ||
133 | - <div class="de_footerRight2">立即购买</div> | ||
134 | - </a> | 132 | + <div class="de_footerRight2" onclick="buy_now({$data.id})">立即购买</div> |
135 | </div> | 133 | </div> |
136 | </div> | 134 | </div> |
137 | </div> | 135 | </div> |
@@ -139,6 +137,25 @@ | @@ -139,6 +137,25 @@ | ||
139 | <script src="__TMPL__/public/assets/js/jquery.js"></script> | 137 | <script src="__TMPL__/public/assets/js/jquery.js"></script> |
140 | <script> | 138 | <script> |
141 | /** | 139 | /** |
140 | + * 点击立即购买 | ||
141 | + */ | ||
142 | + function buy_now(id){ | ||
143 | + price = {$price}; | ||
144 | + $.post("{:url('Goodsdetails/goodsdetails_go_pay')}",{id:id,myprice:price},function(data){ | ||
145 | + obj = JSON.parse(data); | ||
146 | + if(obj.type == 3){ | ||
147 | + alert('业务员商品和平台商品不能同时购买!'); | ||
148 | + }else if(obj.type == 1){ | ||
149 | + window.location.href = "{:url('Orderpage/order_page')}?indet_id="+obj.indet_id; | ||
150 | + }else if(obj.type == 2){ | ||
151 | + window.location.href = "{:url('Orderpage/order_salesman_ty')}?indet_id="+obj.indet_id; | ||
152 | + } | ||
153 | + }); | ||
154 | + } | ||
155 | + | ||
156 | + | ||
157 | + | ||
158 | + /** | ||
142 | *点击收藏 | 159 | *点击收藏 |
143 | */ | 160 | */ |
144 | function goods_collection(id){ | 161 | function goods_collection(id){ |
@@ -45,12 +45,13 @@ | @@ -45,12 +45,13 @@ | ||
45 | <!-- banner --> | 45 | <!-- banner --> |
46 | <div class="in_banner swiper-container"> | 46 | <div class="in_banner swiper-container"> |
47 | <ul class="swiper-wrapper"> | 47 | <ul class="swiper-wrapper"> |
48 | + <volist name="slideshow" id="vo"> | ||
48 | <li class="swiper-slide"> | 49 | <li class="swiper-slide"> |
49 | - <img src="__TMPL__/public/assets/images/2.png" alt=""> | ||
50 | - </li> | ||
51 | - <li class="swiper-slide"> | ||
52 | - <img src="__TMPL__/public/assets/images/2.png" alt=""> | 50 | + <a href="{$vo.url}"> |
51 | + <img src="{:cmf_get_image_url($vo.image)}" alt=""> | ||
52 | + </a> | ||
53 | </li> | 53 | </li> |
54 | + </volist> | ||
54 | </ul> | 55 | </ul> |
55 | <div class="swiper-pagination"></div> | 56 | <div class="swiper-pagination"></div> |
56 | </div> | 57 | </div> |
-
请 注册 或 登录 后发表评论