@@ -7,7 +7,7 @@ |
||
| 7 | 7 |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| 8 | 8 |
<meta name="format-detection" content="telephone=no,email=no,address=no"> |
| 9 | 9 |
<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no"> |
| 10 |
- <title>图集</title> |
|
| 10 |
+ <title>拍爱</title> |
|
| 11 | 11 |
|
| 12 | 12 |
<link href="//cdn.bootcss.com/photoswipe/4.1.2/photoswipe.css" rel="stylesheet"> |
| 13 | 13 |
<link href="//cdn.bootcss.com/photoswipe/4.1.2/default-skin/default-skin.css" rel="stylesheet"> |
@@ -96,8 +96,9 @@ |
||
| 96 | 96 |
|
| 97 | 97 |
.nomark-buy, .origin-buy {
|
| 98 | 98 |
position: fixed; |
| 99 |
- bottom: 0; |
|
| 100 |
- width: 50%; |
|
| 99 |
+ right: 2px; |
|
| 100 |
+ bottom: 2px; |
|
| 101 |
+ left: 2px; |
|
| 101 | 102 |
height: 50px; |
| 102 | 103 |
line-height: 50px; |
| 103 | 104 |
text-align: center; |
@@ -107,14 +108,6 @@ |
||
| 107 | 108 |
box-sizing: border-box; |
| 108 | 109 |
z-index: 99999; |
| 109 | 110 |
} |
| 110 |
- |
|
| 111 |
- .nomark-buy {
|
|
| 112 |
- left: 0; |
|
| 113 |
- } |
|
| 114 |
- |
|
| 115 |
- .origin-buy {
|
|
| 116 |
- right: 0; |
|
| 117 |
- } |
|
| 118 | 111 |
</style> |
| 119 | 112 |
</head> |
| 120 | 113 |
<body> |
@@ -134,7 +127,7 @@ |
||
| 134 | 127 |
</div> |
| 135 | 128 |
<div id="buy" style="display:none"> |
| 136 | 129 |
<div id="nomark" class="nomark-buy">去除水印</div> |
| 137 |
- <div id="origin" class="origin-buy">购买原图</div> |
|
| 130 |
+ {# <div id="origin" class="origin-buy">购买原图</div>#}
|
|
| 138 | 131 |
</div> |
| 139 | 132 |
</div> |
| 140 | 133 |
<!-- Root element of PhotoSwipe. Must have class pswp. --> |
@@ -268,7 +261,7 @@ |
||
| 268 | 261 |
var width = $(document).width(); |
| 269 | 262 |
var renderData = {{ data|safe }};
|
| 270 | 263 |
var session_photos = renderData['session_photos']; |
| 271 |
-{# {% include 'page/snippets/sessionphotos.html' %}#}
|
|
| 264 |
+ {% include 'page/snippets/sessionphotos.html' %}
|
|
| 272 | 265 |
var photoWidth = width * 49 / 100; |
| 273 | 266 |
var photoHeight = 0; |
| 274 | 267 |
var photoIdx = 0; |
@@ -279,6 +272,8 @@ |
||
| 279 | 272 |
var swipeItems = []; |
| 280 | 273 |
var swipePhotos = []; |
| 281 | 274 |
var curIdx = -1; |
| 275 |
+ var orderId = ''; |
|
| 276 |
+ var orderQueryTimer = null; |
|
| 282 | 277 |
|
| 283 | 278 |
for (var i = 0; i < session_photos.length; i++) {
|
| 284 | 279 |
var photos = session_photos[i].photos; |
@@ -308,7 +303,7 @@ |
||
| 308 | 303 |
leftImgs += '<div class="imgctx">{0}{1}{2}</div>'.format(header, imgctx, footer);
|
| 309 | 304 |
} |
| 310 | 305 |
swipeItems.push({
|
| 311 |
- src: photos[j].photo_url, |
|
| 306 |
+ src: photos[j]['porder'].m_photo_url || photos[j].photo_url, |
|
| 312 | 307 |
w: photos[j].photo_w, |
| 313 | 308 |
h: photos[j].photo_h, |
| 314 | 309 |
}) |
@@ -332,7 +327,13 @@ |
||
| 332 | 327 |
}; |
| 333 | 328 |
|
| 334 | 329 |
function displayornot() {
|
| 335 |
- $('#buy').show();
|
|
| 330 |
+ var photoInfo = swipePhotos[curIdx]; |
|
| 331 |
+ var display_payment_btn = photoInfo['display_payment_btn']; |
|
| 332 |
+ if (photoInfo['display_payment_btn'] && (typeof photoInfo['porder'].m_photo_url == 'undefined' || photoInfo['porder'].m_photo_url == '')) {
|
|
| 333 |
+ $('#buy').show();
|
|
| 334 |
+ } else {
|
|
| 335 |
+ $('#buy').hide();
|
|
| 336 |
+ } |
|
| 336 | 337 |
$('#mask-thump').show();
|
| 337 | 338 |
} |
| 338 | 339 |
|
@@ -361,8 +362,53 @@ |
||
| 361 | 362 |
}); |
| 362 | 363 |
}) |
| 363 | 364 |
|
| 365 |
+ function order_query(orderId, photoId) {
|
|
| 366 |
+ $.ajax({
|
|
| 367 |
+ url: '/mini/order_query', |
|
| 368 |
+ type: 'POST', |
|
| 369 |
+ data: {
|
|
| 370 |
+ order_id: orderId, |
|
| 371 |
+ }, |
|
| 372 |
+ timeout: 5000, |
|
| 373 |
+ cache: true, |
|
| 374 |
+ success: function (res) {
|
|
| 375 |
+ if (res.status == 200) {
|
|
| 376 |
+ window.clearTimeout(orderQueryTimer); |
|
| 377 |
+ // 支付成功,获取 porder |
|
| 378 |
+ $.ajax({
|
|
| 379 |
+ url: 'f/bought', |
|
| 380 |
+ data: {
|
|
| 381 |
+ user_id: '{{ request.GET.user_id }}',
|
|
| 382 |
+ photo_id: photoId, |
|
| 383 |
+ }, |
|
| 384 |
+ success: function (res) {
|
|
| 385 |
+ if (res.data.status == 200) {
|
|
| 386 |
+ var swipeItem = swipeItems[curIdx]; |
|
| 387 |
+ swipeItem['src'] = res.data.porder.m_photo_url || swipeItem['src']; |
|
| 388 |
+ swipeItems[curIdx] = swipeItem; |
|
| 389 |
+ |
|
| 390 |
+ $('.pswp__img')[0].src = swipeItem['src'];
|
|
| 391 |
+ |
|
| 392 |
+ var photoInfo = swipePhotos[curIdx]; |
|
| 393 |
+ photoInfo['porder'] = res.data.porder; |
|
| 394 |
+ swipePhotos[curIdx] = photoInfo; |
|
| 395 |
+ } |
|
| 396 |
+ } |
|
| 397 |
+ }) |
|
| 398 |
+ } else {
|
|
| 399 |
+ orderQueryTimer = window.setTimeout(function () {
|
|
| 400 |
+ order_query(orderId, photoId); |
|
| 401 |
+ }, 1000) |
|
| 402 |
+ } |
|
| 403 |
+ }, |
|
| 404 |
+ error: function (res) {
|
|
| 405 |
+ } |
|
| 406 |
+ }); |
|
| 407 |
+ } |
|
| 408 |
+ |
|
| 364 | 409 |
$('#nomark').click(function () {
|
| 365 | 410 |
var photoInfo = swipePhotos[curIdx]; |
| 411 |
+ var photoId = photoInfo.photo_id; |
|
| 366 | 412 |
|
| 367 | 413 |
$.ajax({
|
| 368 | 414 |
url: '/mini/order_create', |
@@ -370,7 +416,7 @@ |
||
| 370 | 416 |
data: {
|
| 371 | 417 |
group_id: photoInfo.group_id, |
| 372 | 418 |
user_id: photoInfo.user_id, |
| 373 |
- photo_id: photoInfo.photo_id, |
|
| 419 |
+ photo_id: photoId, |
|
| 374 | 420 |
photo_type: 'nomark', |
| 375 | 421 |
body: '去除水印', |
| 376 | 422 |
total_fee: 1, |
@@ -380,7 +426,7 @@ |
||
| 380 | 426 |
cache: true, |
| 381 | 427 |
success: function (res) {
|
| 382 | 428 |
if (res.status == 200) {
|
| 383 |
- var order_id = res.data.order_id; |
|
| 429 |
+ orderId = res.data.order_id; |
|
| 384 | 430 |
var wxpay_params = res.data.wxpay_params; |
| 385 | 431 |
//点击微信支付后,调取统一下单接口生成微信小程序支付需要的支付参数 |
| 386 | 432 |
var params = '?timeStamp=' + wxpay_params.timeStamp + '&nonceStr=' + wxpay_params.nonceStr |
@@ -390,6 +436,8 @@ |
||
| 390 | 436 |
var path = '/pages/wxpay/wxpay' + params; |
| 391 | 437 |
//通过JSSDK的api使小程序跳转到指定的小程序页面 |
| 392 | 438 |
wx.miniProgram.navigateTo({url: path});
|
| 439 |
+ |
|
| 440 |
+ order_query(orderId, photoId); |
|
| 393 | 441 |
} |
| 394 | 442 |
}, |
| 395 | 443 |
error: function (res) {
|
@@ -80,6 +80,8 @@ urlpatterns += [ |
||
| 80 | 80 |
url(r'^mini/userinfo$', mini_views.get_userinfo_api, name='get_userinfo_api2'), # 获取用户信息 |
| 81 | 81 |
url(r'^mini/order_create$', pay_views.wx_order_create_api, name='wx_order_create_api'), # 订单创建 |
| 82 | 82 |
url(r'^mini/order_query$', pay_views.wx_order_query_api, name='wx_order_query_api'), # 订单查询补单 |
| 83 |
+ |
|
| 84 |
+ url(r'^f/bought$', group_views.lensman_photo_bought, name='lensman_photo_bought'), # 摄影师照片已购买 |
|
| 83 | 85 |
] |
| 84 | 86 |
|
| 85 | 87 |
# Wire up our API using automatic URL routing. |