Authored by 毕凯

Merge branch 'feature/crm2' into release/5.8

1 'use strict'; 1 'use strict';
  2 +const moment = require('moment');
2 const model = require('../models/individuation'); 3 const model = require('../models/individuation');
3 const channels = { 4 const channels = {
4 boys: 1, 5 boys: 1,
@@ -74,6 +75,10 @@ exports.coupon = function(req, res, next) { @@ -74,6 +75,10 @@ exports.coupon = function(req, res, next) {
74 activity_template_id, 75 activity_template_id,
75 uid 76 uid
76 }).then((result) => { 77 }).then((result) => {
  78 + if (result && result.data) {
  79 + result.data.startTime = moment.unix(result.data.startTime).format('YYYY.M.D');
  80 + result.data.endTime = moment.unix(result.data.endTime).format('YYYY.M.D');
  81 + }
77 res.jsonp(result); 82 res.jsonp(result);
78 }).catch(next); 83 }).catch(next);
79 }; 84 };
@@ -157,6 +157,18 @@ function modalInit() { @@ -157,6 +157,18 @@ function modalInit() {
157 }); 157 });
158 } 158 }
159 159
  160 +function getPersenalCouponHtml(data) {
  161 + let html = `<div class="persenal-coupon">
  162 + <span class="coupon-amount">${data.amount || 0}</span>
  163 + <span class="coupon-limit">&yen;${data.useLimit || 0}使用</span>
  164 + <span class="coupon-name">${data.limitName}</span>
  165 + <span class="coupon-type">${data.limitTypeName}</span>
  166 + <span class="coupon-time">有效期:${data.startTime} - ${data.endTime}</span>
  167 + </div>`;
  168 +
  169 + return html;
  170 +}
  171 +
160 function persenalCouponInit() { 172 function persenalCouponInit() {
161 let data = { 173 let data = {
162 activity_id: $('.feature-page').data('id') 174 activity_id: $('.feature-page').data('id')
@@ -177,6 +189,7 @@ function persenalCouponInit() { @@ -177,6 +189,7 @@ function persenalCouponInit() {
177 success: function(res) { 189 success: function(res) {
178 if (res.code === 200 && res.data && res.data.couponId && res.data.personCouponId) { 190 if (res.code === 200 && res.data && res.data.couponId && res.data.personCouponId) {
179 $this.attr('data-token', `${res.data.couponId}:${res.data.personCouponId}`); 191 $this.attr('data-token', `${res.data.couponId}:${res.data.personCouponId}`);
  192 + $this.html(getPersenalCouponHtml(res.data));
180 $this.closest('.floor').show(); 193 $this.closest('.floor').show();
181 } 194 }
182 } 195 }
@@ -304,3 +304,76 @@ body { @@ -304,3 +304,76 @@ body {
304 margin-bottom: 20px; 304 margin-bottom: 20px;
305 } 305 }
306 } 306 }
  307 +
  308 +.feature-page .persenal-coupon {
  309 + color: #fff;
  310 +
  311 + .coupon-amount {
  312 + position: absolute;
  313 + top: 60px;
  314 + left: 50px;
  315 + width: 240px;
  316 + height: 80px;
  317 + line-height: 80px;
  318 + text-align: center;
  319 + font-size: 68px;
  320 + font-weight: bold;
  321 + border-bottom: 1px solid #fff;
  322 +
  323 + &:before {
  324 + content: "\00A5";
  325 + position: relative;
  326 + left: -6px;
  327 + top: -24px;
  328 + font-size: 34px;
  329 + }
  330 + }
  331 +
  332 + .coupon-limit {
  333 + position: absolute;
  334 + left: 50px;
  335 + top: 146px;
  336 + width: 240px;
  337 + text-align: center;
  338 + font-size: 24px;
  339 + }
  340 +
  341 + .coupon-name {
  342 + position: absolute;
  343 + top: 30px;
  344 + right: 30px;
  345 + width: 280px;
  346 + height: 40px;
  347 + font-size: 26px;
  348 + line-height: 40px;
  349 + text-align: center;
  350 + overflow: hidden;
  351 + text-overflow: ellipsis;
  352 + word-break: break-all;
  353 + }
  354 +
  355 + .coupon-type {
  356 + position: absolute;
  357 + top: 68px;
  358 + right: 30px;
  359 + width: 280px;
  360 + height: 56px;
  361 + font-size: 36px;
  362 + line-height: 56px;
  363 + font-weight: bold;
  364 + text-align: center;
  365 + overflow: hidden;
  366 + text-overflow: ellipsis;
  367 + word-break: break-all;
  368 + letter-spacing: 12px;
  369 + }
  370 +
  371 + .coupon-time {
  372 + position: absolute;
  373 + top: 144px;
  374 + right: 70px;
  375 + font-size: 40px;
  376 + transform: scale(0.4);
  377 + transform-origin: right center;
  378 + }
  379 +}