Authored by 郭成尧

pay-back

@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 * @Author: Targaryen 3 * @Author: Targaryen
4 * @Date: 2017-01-04 15:17:51 4 * @Date: 2017-01-04 15:17:51
5 * @Last Modified by: Targaryen 5 * @Last Modified by: Targaryen
6 - * @Last Modified time: 2017-01-17 16:02:22 6 + * @Last Modified time: 2017-02-09 10:50:07
7 */ 7 */
8 8
9 'use strict'; 9 'use strict';
@@ -70,7 +70,8 @@ const payCenter = (req, res) => { @@ -70,7 +70,8 @@ const payCenter = (req, res) => {
70 70
71 let responseData = { 71 let responseData = {
72 pageHeader: headerModel.setNav({ 72 pageHeader: headerModel.setNav({
73 - navTitle: '支付中心' 73 + navTitle: '支付中心',
  74 + backUrl: 'javascript:void(0);'
74 }), 75 }),
75 module: 'cart', 76 module: 'cart',
76 page: 'pay', 77 page: 'pay',
@@ -32,7 +32,7 @@ @@ -32,7 +32,7 @@
32 </div> 32 </div>
33 <div class="loading-toast hide"></div> 33 <div class="loading-toast hide"></div>
34 </div> 34 </div>
35 -<!-- TODO richTip --> 35 +{{> rich_tip}}
36 <input type="hidden" class="order-code" value="{{orderCode}}"> 36 <input type="hidden" class="order-code" value="{{orderCode}}">
37 <input type="hidden" class="order-total" value="{{orderTotal}}"> 37 <input type="hidden" class="order-total" value="{{orderTotal}}">
38 <script>_ozprm="orderid={{orderCode}}&ordertotal={{orderTotal}}";</script> 38 <script>_ozprm="orderid={{orderCode}}&ordertotal={{orderTotal}}";</script>
  1 +<!-- 结算提示框 -->
  2 +<div id="yoho-order-bg" class="yoho-order-bg">
  3 + <div class="order-tip-box">
  4 + <div class="order-tip-msg">
  5 + </div>
  6 + <div class="order-tip-btn-group">
  7 + </div>
  8 + </div>
  9 +</div>
  10 +<!-- /结算提示框 -->
@@ -17,6 +17,8 @@ var loading = require('../plugin/loading'), @@ -17,6 +17,8 @@ var loading = require('../plugin/loading'),
17 tip = require('../plugin/tip'), 17 tip = require('../plugin/tip'),
18 Hammer = require('yoho-hammer'); 18 Hammer = require('yoho-hammer');
19 19
  20 +var richTip = require('../plugin/rich-tip');
  21 +
20 22
21 // 点击微信显示加载 23 // 点击微信显示加载
22 var $loadingToast = $('.loading-toast'); 24 var $loadingToast = $('.loading-toast');
@@ -34,6 +36,24 @@ var appIconPosition = { @@ -34,6 +36,24 @@ var appIconPosition = {
34 bank: '-4rem' 36 bank: '-4rem'
35 }; 37 };
36 38
  39 +$('.nav-back').on('touchend', function() {
  40 + richTip.show(
  41 + ['超过支付时效后订单会被取消,', '请尽快到我的订单完成支付哦!'],
  42 + [
  43 + {
  44 + href: '/home/orders',
  45 + text: '确认离开',
  46 + class: ''
  47 + },
  48 + {
  49 + href: '',
  50 + text: '继续支付',
  51 + class: 'order-tip-btnred'
  52 + }
  53 + ]
  54 + );
  55 +});
  56 +
37 require('../common'); 57 require('../common');
38 58
39 lazyLoad($('img.lazy')); 59 lazyLoad($('img.lazy'));
  1 +/**
  2 + * Created by yoho on 2016/11/22.
  3 + */
  4 +var $ = require('yoho-jquery');
  5 +
  6 +var $tip = $('#yoho-order-bg'),
  7 + $tipMsg = $tip.find('.order-tip-msg'),
  8 + $tipBtns = $tip.find('.order-tip-btn-group');
  9 +
  10 +var touchCallback,
  11 + params;
  12 +
  13 +function setCallback(t, p) {
  14 + touchCallback = t;
  15 + params = p;
  16 +}
  17 +
  18 +/**
  19 + * 跳转还是消失控制
  20 + */
  21 +(function() {
  22 + $tip.on('touchend', function(event) {
  23 + if ('SPAN' === event.target.tagName) {
  24 + if (touchCallback) {
  25 + touchCallback(params);
  26 + }
  27 +
  28 + touchCallback = null;
  29 + params = null;
  30 +
  31 + setTimeout(function() {
  32 + $tip.hide();
  33 + }, 200);
  34 + } else if ('A' === event.target.tagName){
  35 + setTimeout(function() {
  36 + $tip.hide();
  37 + }, 200);
  38 + } else {
  39 + $tip.hide();
  40 + }
  41 + });
  42 +}());
  43 +
  44 +/**
  45 + * 显示提示
  46 + */
  47 +function show(con, btn) {
  48 + var content = '',
  49 + buttons = '';
  50 +
  51 + if (con && $.isArray(con)) {
  52 + $.each(con, function(key, value) {
  53 + content += '<p>' + value + '</p>';
  54 + });
  55 + }
  56 +
  57 + if (btn && $.isArray(btn) && btn.length === 1) {
  58 + if (!btn[0].href) {
  59 + buttons += '<a class="order-tip-btn1 ' + btn[0].class
  60 + + '"><span>' + btn[0].text
  61 + + '</span></a>';
  62 + } else {
  63 + buttons += '<a href="' + btn[0].href
  64 + + '" class="order-tip-btn1 ' + btn[0].class
  65 + + '">' + btn[0].text
  66 + + '</a>';
  67 + }
  68 + }
  69 +
  70 + if (btn && $.isArray(btn) && btn.length > 1) {
  71 + $.each(btn, function(key, value) {
  72 + if (!value.href) {
  73 + buttons += '<a class="' + value.class
  74 + + '"><span>' + value.text
  75 + + '</span></a>';
  76 + } else {
  77 + buttons += '<a href="' + value.href
  78 + + '" class="' + value.class
  79 + + '">' + value.text
  80 + + '</a>';
  81 + }
  82 + });
  83 + }
  84 +
  85 + $tipMsg.html(content);
  86 + $tipBtns.html(buttons);
  87 + $tip.show();
  88 +}
  89 +
  90 +exports.setCallback = setCallback;
  91 +exports.show = show;
@@ -119,3 +119,81 @@ button { @@ -119,3 +119,81 @@ button {
119 background-position-x: 40%; 119 background-position-x: 40%;
120 background-size: 132px !important; 120 background-size: 132px !important;
121 } 121 }
  122 +
  123 +/* rich-tip */
  124 +.yoho-order-bg {
  125 + position: fixed;
  126 + top: 0;
  127 + left: 0;
  128 + bottom: 0;
  129 + right: 0;
  130 + background-color: rgba(0,0,0,.7);
  131 + z-index:4;
  132 + display: none;
  133 +
  134 + .order-tip-box {
  135 + background-color: #fff;
  136 + margin-left: auto;
  137 + margin-right: auto;
  138 + border-radius: 10px;
  139 + width: 420px;
  140 + margin-top: 400px;
  141 + vertical-align: center;
  142 + position: relative;
  143 +
  144 + .order-tip-msg {
  145 + font-size: 1.1em;
  146 + padding: 40px 20px;
  147 + text-align: center;
  148 +
  149 + p:last-child {
  150 + margin-bottom: 50px;
  151 + }
  152 + }
  153 +
  154 + .order-tip-btn-group {
  155 + position: absolute;
  156 + bottom: 0;
  157 + width: 100%;
  158 + height: 60px;
  159 + line-height: 60px;
  160 +
  161 + a {
  162 + width: 209px;
  163 + box-shadow: none;
  164 + background-color: #fff;
  165 + font-size: 1.2em;
  166 + text-align: center;
  167 + float: left;
  168 + display: inline-block;
  169 +
  170 + span {
  171 + display: block;
  172 + width: 100%;
  173 + height: 100%;
  174 + }
  175 + }
  176 +
  177 + a:first-child {
  178 + border-top: 1px solid #ccc;
  179 + border-right: 1px solid #ccc;
  180 + border-radius: 0 0 0 8px;
  181 + }
  182 +
  183 + a:last-child {
  184 + border-top: 1px solid #ccc;
  185 + border-radius: 0 0 8px 0;
  186 + }
  187 +
  188 + .order-tip-btnred {
  189 + color: #d0021b;
  190 + }
  191 +
  192 + .order-tip-btn1 {
  193 + width: 418px;
  194 + border-right: none;
  195 + border-radius: 0 0 8px 8px!important;
  196 + }
  197 + }
  198 + }
  199 +}