Commit d1ab95a5 authored by 王建威's avatar 王建威

合并develop

parents 55747b98 f10ceec0
No preview for this file type
/**
* [js-md5]{@link https://github.com/emn178/js-md5}
*
* @namespace md5
* @version 0.7.3
* @author Chen, Yi-Cyuan [emn178@gmail.com]
* @copyright Chen, Yi-Cyuan 2014-2017
* @license MIT
*/
(function () {
'use strict';
var ERROR = 'input is invalid type';
var WINDOW = typeof window === 'object';
var root = WINDOW ? window : {};
if (root.JS_MD5_NO_WINDOW) {
WINDOW = false;
}
var WEB_WORKER = !WINDOW && typeof self === 'object';
var NODE_JS = !root.JS_MD5_NO_NODE_JS && typeof process === 'object' && process.versions && process.versions.node;
if (NODE_JS) {
root = global;
} else if (WEB_WORKER) {
root = self;
}
var COMMON_JS = !root.JS_MD5_NO_COMMON_JS && typeof module === 'object' && module.exports;
var AMD = typeof define === 'function' && define.amd;
var ARRAY_BUFFER = !root.JS_MD5_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined';
var HEX_CHARS = '0123456789abcdef'.split('');
var EXTRA = [128, 32768, 8388608, -2147483648];
var SHIFT = [0, 8, 16, 24];
var OUTPUT_TYPES = ['hex', 'array', 'digest', 'buffer', 'arrayBuffer', 'base64'];
var BASE64_ENCODE_CHAR = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
var blocks = [], buffer8;
if (ARRAY_BUFFER) {
var buffer = new ArrayBuffer(68);
buffer8 = new Uint8Array(buffer);
blocks = new Uint32Array(buffer);
}
if (root.JS_MD5_NO_NODE_JS || !Array.isArray) {
Array.isArray = function (obj) {
return Object.prototype.toString.call(obj) === '[object Array]';
};
}
if (ARRAY_BUFFER && (root.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView)) {
ArrayBuffer.isView = function (obj) {
return typeof obj === 'object' && obj.buffer && obj.buffer.constructor === ArrayBuffer;
};
}
/**
* @method hex
* @memberof md5
* @description Output hash as hex string
* @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
* @returns {String} Hex string
* @example
* md5.hex('The quick brown fox jumps over the lazy dog');
* // equal to
* md5('The quick brown fox jumps over the lazy dog');
*/
/**
* @method digest
* @memberof md5
* @description Output hash as bytes array
* @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
* @returns {Array} Bytes array
* @example
* md5.digest('The quick brown fox jumps over the lazy dog');
*/
/**
* @method array
* @memberof md5
* @description Output hash as bytes array
* @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
* @returns {Array} Bytes array
* @example
* md5.array('The quick brown fox jumps over the lazy dog');
*/
/**
* @method arrayBuffer
* @memberof md5
* @description Output hash as ArrayBuffer
* @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
* @returns {ArrayBuffer} ArrayBuffer
* @example
* md5.arrayBuffer('The quick brown fox jumps over the lazy dog');
*/
/**
* @method buffer
* @deprecated This maybe confuse with Buffer in node.js. Please use arrayBuffer instead.
* @memberof md5
* @description Output hash as ArrayBuffer
* @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
* @returns {ArrayBuffer} ArrayBuffer
* @example
* md5.buffer('The quick brown fox jumps over the lazy dog');
*/
/**
* @method base64
* @memberof md5
* @description Output hash as base64 string
* @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
* @returns {String} base64 string
* @example
* md5.base64('The quick brown fox jumps over the lazy dog');
*/
var createOutputMethod = function (outputType) {
return function (message) {
return new Md5(true).update(message)[outputType]();
};
};
/**
* @method create
* @memberof md5
* @description Create Md5 object
* @returns {Md5} Md5 object.
* @example
* var hash = md5.create();
*/
/**
* @method update
* @memberof md5
* @description Create and update Md5 object
* @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
* @returns {Md5} Md5 object.
* @example
* var hash = md5.update('The quick brown fox jumps over the lazy dog');
* // equal to
* var hash = md5.create();
* hash.update('The quick brown fox jumps over the lazy dog');
*/
var createMethod = function () {
var method = createOutputMethod('hex');
if (NODE_JS) {
method = nodeWrap(method);
}
method.create = function () {
return new Md5();
};
method.update = function (message) {
return method.create().update(message);
};
for (var i = 0; i < OUTPUT_TYPES.length; ++i) {
var type = OUTPUT_TYPES[i];
method[type] = createOutputMethod(type);
}
return method;
};
var nodeWrap = function (method) {
var crypto = eval("require('crypto')");
var Buffer = eval("require('buffer').Buffer");
var nodeMethod = function (message) {
if (typeof message === 'string') {
return crypto.createHash('md5').update(message, 'utf8').digest('hex');
} else {
if (message === null || message === undefined) {
throw ERROR;
} else if (message.constructor === ArrayBuffer) {
message = new Uint8Array(message);
}
}
if (Array.isArray(message) || ArrayBuffer.isView(message) ||
message.constructor === Buffer) {
return crypto.createHash('md5').update(new Buffer(message)).digest('hex');
} else {
return method(message);
}
};
return nodeMethod;
};
/**
* Md5 class
* @class Md5
* @description This is internal class.
* @see {@link md5.create}
*/
function Md5(sharedMemory) {
if (sharedMemory) {
blocks[0] = blocks[16] = blocks[1] = blocks[2] = blocks[3] =
blocks[4] = blocks[5] = blocks[6] = blocks[7] =
blocks[8] = blocks[9] = blocks[10] = blocks[11] =
blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
this.blocks = blocks;
this.buffer8 = buffer8;
} else {
if (ARRAY_BUFFER) {
var buffer = new ArrayBuffer(68);
this.buffer8 = new Uint8Array(buffer);
this.blocks = new Uint32Array(buffer);
} else {
this.blocks = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
}
}
this.h0 = this.h1 = this.h2 = this.h3 = this.start = this.bytes = this.hBytes = 0;
this.finalized = this.hashed = false;
this.first = true;
}
/**
* @method update
* @memberof Md5
* @instance
* @description Update hash
* @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
* @returns {Md5} Md5 object.
* @see {@link md5.update}
*/
Md5.prototype.update = function (message) {
if (this.finalized) {
return;
}
var notString, type = typeof message;
if (type !== 'string') {
if (type === 'object') {
if (message === null) {
throw ERROR;
} else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) {
message = new Uint8Array(message);
} else if (!Array.isArray(message)) {
if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) {
throw ERROR;
}
}
} else {
throw ERROR;
}
notString = true;
}
var code, index = 0, i, length = message.length, blocks = this.blocks;
var buffer8 = this.buffer8;
while (index < length) {
if (this.hashed) {
this.hashed = false;
blocks[0] = blocks[16];
blocks[16] = blocks[1] = blocks[2] = blocks[3] =
blocks[4] = blocks[5] = blocks[6] = blocks[7] =
blocks[8] = blocks[9] = blocks[10] = blocks[11] =
blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
}
if (notString) {
if (ARRAY_BUFFER) {
for (i = this.start; index < length && i < 64; ++index) {
buffer8[i++] = message[index];
}
} else {
for (i = this.start; index < length && i < 64; ++index) {
blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];
}
}
} else {
if (ARRAY_BUFFER) {
for (i = this.start; index < length && i < 64; ++index) {
code = message.charCodeAt(index);
if (code < 0x80) {
buffer8[i++] = code;
} else if (code < 0x800) {
buffer8[i++] = 0xc0 | (code >> 6);
buffer8[i++] = 0x80 | (code & 0x3f);
} else if (code < 0xd800 || code >= 0xe000) {
buffer8[i++] = 0xe0 | (code >> 12);
buffer8[i++] = 0x80 | ((code >> 6) & 0x3f);
buffer8[i++] = 0x80 | (code & 0x3f);
} else {
code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff));
buffer8[i++] = 0xf0 | (code >> 18);
buffer8[i++] = 0x80 | ((code >> 12) & 0x3f);
buffer8[i++] = 0x80 | ((code >> 6) & 0x3f);
buffer8[i++] = 0x80 | (code & 0x3f);
}
}
} else {
for (i = this.start; index < length && i < 64; ++index) {
code = message.charCodeAt(index);
if (code < 0x80) {
blocks[i >> 2] |= code << SHIFT[i++ & 3];
} else if (code < 0x800) {
blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3];
blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
} else if (code < 0xd800 || code >= 0xe000) {
blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3];
blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];
blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
} else {
code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff));
blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3];
blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3];
blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];
blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
}
}
}
}
this.lastByteIndex = i;
this.bytes += i - this.start;
if (i >= 64) {
this.start = i - 64;
this.hash();
this.hashed = true;
} else {
this.start = i;
}
}
if (this.bytes > 4294967295) {
this.hBytes += this.bytes / 4294967296 << 0;
this.bytes = this.bytes % 4294967296;
}
return this;
};
Md5.prototype.finalize = function () {
if (this.finalized) {
return;
}
this.finalized = true;
var blocks = this.blocks, i = this.lastByteIndex;
blocks[i >> 2] |= EXTRA[i & 3];
if (i >= 56) {
if (!this.hashed) {
this.hash();
}
blocks[0] = blocks[16];
blocks[16] = blocks[1] = blocks[2] = blocks[3] =
blocks[4] = blocks[5] = blocks[6] = blocks[7] =
blocks[8] = blocks[9] = blocks[10] = blocks[11] =
blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
}
blocks[14] = this.bytes << 3;
blocks[15] = this.hBytes << 3 | this.bytes >>> 29;
this.hash();
};
Md5.prototype.hash = function () {
var a, b, c, d, bc, da, blocks = this.blocks;
if (this.first) {
a = blocks[0] - 680876937;
a = (a << 7 | a >>> 25) - 271733879 << 0;
d = (-1732584194 ^ a & 2004318071) + blocks[1] - 117830708;
d = (d << 12 | d >>> 20) + a << 0;
c = (-271733879 ^ (d & (a ^ -271733879))) + blocks[2] - 1126478375;
c = (c << 17 | c >>> 15) + d << 0;
b = (a ^ (c & (d ^ a))) + blocks[3] - 1316259209;
b = (b << 22 | b >>> 10) + c << 0;
} else {
a = this.h0;
b = this.h1;
c = this.h2;
d = this.h3;
a += (d ^ (b & (c ^ d))) + blocks[0] - 680876936;
a = (a << 7 | a >>> 25) + b << 0;
d += (c ^ (a & (b ^ c))) + blocks[1] - 389564586;
d = (d << 12 | d >>> 20) + a << 0;
c += (b ^ (d & (a ^ b))) + blocks[2] + 606105819;
c = (c << 17 | c >>> 15) + d << 0;
b += (a ^ (c & (d ^ a))) + blocks[3] - 1044525330;
b = (b << 22 | b >>> 10) + c << 0;
}
a += (d ^ (b & (c ^ d))) + blocks[4] - 176418897;
a = (a << 7 | a >>> 25) + b << 0;
d += (c ^ (a & (b ^ c))) + blocks[5] + 1200080426;
d = (d << 12 | d >>> 20) + a << 0;
c += (b ^ (d & (a ^ b))) + blocks[6] - 1473231341;
c = (c << 17 | c >>> 15) + d << 0;
b += (a ^ (c & (d ^ a))) + blocks[7] - 45705983;
b = (b << 22 | b >>> 10) + c << 0;
a += (d ^ (b & (c ^ d))) + blocks[8] + 1770035416;
a = (a << 7 | a >>> 25) + b << 0;
d += (c ^ (a & (b ^ c))) + blocks[9] - 1958414417;
d = (d << 12 | d >>> 20) + a << 0;
c += (b ^ (d & (a ^ b))) + blocks[10] - 42063;
c = (c << 17 | c >>> 15) + d << 0;
b += (a ^ (c & (d ^ a))) + blocks[11] - 1990404162;
b = (b << 22 | b >>> 10) + c << 0;
a += (d ^ (b & (c ^ d))) + blocks[12] + 1804603682;
a = (a << 7 | a >>> 25) + b << 0;
d += (c ^ (a & (b ^ c))) + blocks[13] - 40341101;
d = (d << 12 | d >>> 20) + a << 0;
c += (b ^ (d & (a ^ b))) + blocks[14] - 1502002290;
c = (c << 17 | c >>> 15) + d << 0;
b += (a ^ (c & (d ^ a))) + blocks[15] + 1236535329;
b = (b << 22 | b >>> 10) + c << 0;
a += (c ^ (d & (b ^ c))) + blocks[1] - 165796510;
a = (a << 5 | a >>> 27) + b << 0;
d += (b ^ (c & (a ^ b))) + blocks[6] - 1069501632;
d = (d << 9 | d >>> 23) + a << 0;
c += (a ^ (b & (d ^ a))) + blocks[11] + 643717713;
c = (c << 14 | c >>> 18) + d << 0;
b += (d ^ (a & (c ^ d))) + blocks[0] - 373897302;
b = (b << 20 | b >>> 12) + c << 0;
a += (c ^ (d & (b ^ c))) + blocks[5] - 701558691;
a = (a << 5 | a >>> 27) + b << 0;
d += (b ^ (c & (a ^ b))) + blocks[10] + 38016083;
d = (d << 9 | d >>> 23) + a << 0;
c += (a ^ (b & (d ^ a))) + blocks[15] - 660478335;
c = (c << 14 | c >>> 18) + d << 0;
b += (d ^ (a & (c ^ d))) + blocks[4] - 405537848;
b = (b << 20 | b >>> 12) + c << 0;
a += (c ^ (d & (b ^ c))) + blocks[9] + 568446438;
a = (a << 5 | a >>> 27) + b << 0;
d += (b ^ (c & (a ^ b))) + blocks[14] - 1019803690;
d = (d << 9 | d >>> 23) + a << 0;
c += (a ^ (b & (d ^ a))) + blocks[3] - 187363961;
c = (c << 14 | c >>> 18) + d << 0;
b += (d ^ (a & (c ^ d))) + blocks[8] + 1163531501;
b = (b << 20 | b >>> 12) + c << 0;
a += (c ^ (d & (b ^ c))) + blocks[13] - 1444681467;
a = (a << 5 | a >>> 27) + b << 0;
d += (b ^ (c & (a ^ b))) + blocks[2] - 51403784;
d = (d << 9 | d >>> 23) + a << 0;
c += (a ^ (b & (d ^ a))) + blocks[7] + 1735328473;
c = (c << 14 | c >>> 18) + d << 0;
b += (d ^ (a & (c ^ d))) + blocks[12] - 1926607734;
b = (b << 20 | b >>> 12) + c << 0;
bc = b ^ c;
a += (bc ^ d) + blocks[5] - 378558;
a = (a << 4 | a >>> 28) + b << 0;
d += (bc ^ a) + blocks[8] - 2022574463;
d = (d << 11 | d >>> 21) + a << 0;
da = d ^ a;
c += (da ^ b) + blocks[11] + 1839030562;
c = (c << 16 | c >>> 16) + d << 0;
b += (da ^ c) + blocks[14] - 35309556;
b = (b << 23 | b >>> 9) + c << 0;
bc = b ^ c;
a += (bc ^ d) + blocks[1] - 1530992060;
a = (a << 4 | a >>> 28) + b << 0;
d += (bc ^ a) + blocks[4] + 1272893353;
d = (d << 11 | d >>> 21) + a << 0;
da = d ^ a;
c += (da ^ b) + blocks[7] - 155497632;
c = (c << 16 | c >>> 16) + d << 0;
b += (da ^ c) + blocks[10] - 1094730640;
b = (b << 23 | b >>> 9) + c << 0;
bc = b ^ c;
a += (bc ^ d) + blocks[13] + 681279174;
a = (a << 4 | a >>> 28) + b << 0;
d += (bc ^ a) + blocks[0] - 358537222;
d = (d << 11 | d >>> 21) + a << 0;
da = d ^ a;
c += (da ^ b) + blocks[3] - 722521979;
c = (c << 16 | c >>> 16) + d << 0;
b += (da ^ c) + blocks[6] + 76029189;
b = (b << 23 | b >>> 9) + c << 0;
bc = b ^ c;
a += (bc ^ d) + blocks[9] - 640364487;
a = (a << 4 | a >>> 28) + b << 0;
d += (bc ^ a) + blocks[12] - 421815835;
d = (d << 11 | d >>> 21) + a << 0;
da = d ^ a;
c += (da ^ b) + blocks[15] + 530742520;
c = (c << 16 | c >>> 16) + d << 0;
b += (da ^ c) + blocks[2] - 995338651;
b = (b << 23 | b >>> 9) + c << 0;
a += (c ^ (b | ~d)) + blocks[0] - 198630844;
a = (a << 6 | a >>> 26) + b << 0;
d += (b ^ (a | ~c)) + blocks[7] + 1126891415;
d = (d << 10 | d >>> 22) + a << 0;
c += (a ^ (d | ~b)) + blocks[14] - 1416354905;
c = (c << 15 | c >>> 17) + d << 0;
b += (d ^ (c | ~a)) + blocks[5] - 57434055;
b = (b << 21 | b >>> 11) + c << 0;
a += (c ^ (b | ~d)) + blocks[12] + 1700485571;
a = (a << 6 | a >>> 26) + b << 0;
d += (b ^ (a | ~c)) + blocks[3] - 1894986606;
d = (d << 10 | d >>> 22) + a << 0;
c += (a ^ (d | ~b)) + blocks[10] - 1051523;
c = (c << 15 | c >>> 17) + d << 0;
b += (d ^ (c | ~a)) + blocks[1] - 2054922799;
b = (b << 21 | b >>> 11) + c << 0;
a += (c ^ (b | ~d)) + blocks[8] + 1873313359;
a = (a << 6 | a >>> 26) + b << 0;
d += (b ^ (a | ~c)) + blocks[15] - 30611744;
d = (d << 10 | d >>> 22) + a << 0;
c += (a ^ (d | ~b)) + blocks[6] - 1560198380;
c = (c << 15 | c >>> 17) + d << 0;
b += (d ^ (c | ~a)) + blocks[13] + 1309151649;
b = (b << 21 | b >>> 11) + c << 0;
a += (c ^ (b | ~d)) + blocks[4] - 145523070;
a = (a << 6 | a >>> 26) + b << 0;
d += (b ^ (a | ~c)) + blocks[11] - 1120210379;
d = (d << 10 | d >>> 22) + a << 0;
c += (a ^ (d | ~b)) + blocks[2] + 718787259;
c = (c << 15 | c >>> 17) + d << 0;
b += (d ^ (c | ~a)) + blocks[9] - 343485551;
b = (b << 21 | b >>> 11) + c << 0;
if (this.first) {
this.h0 = a + 1732584193 << 0;
this.h1 = b - 271733879 << 0;
this.h2 = c - 1732584194 << 0;
this.h3 = d + 271733878 << 0;
this.first = false;
} else {
this.h0 = this.h0 + a << 0;
this.h1 = this.h1 + b << 0;
this.h2 = this.h2 + c << 0;
this.h3 = this.h3 + d << 0;
}
};
/**
* @method hex
* @memberof Md5
* @instance
* @description Output hash as hex string
* @returns {String} Hex string
* @see {@link md5.hex}
* @example
* hash.hex();
*/
Md5.prototype.hex = function () {
this.finalize();
var h0 = this.h0, h1 = this.h1, h2 = this.h2, h3 = this.h3;
return HEX_CHARS[(h0 >> 4) & 0x0F] + HEX_CHARS[h0 & 0x0F] +
HEX_CHARS[(h0 >> 12) & 0x0F] + HEX_CHARS[(h0 >> 8) & 0x0F] +
HEX_CHARS[(h0 >> 20) & 0x0F] + HEX_CHARS[(h0 >> 16) & 0x0F] +
HEX_CHARS[(h0 >> 28) & 0x0F] + HEX_CHARS[(h0 >> 24) & 0x0F] +
HEX_CHARS[(h1 >> 4) & 0x0F] + HEX_CHARS[h1 & 0x0F] +
HEX_CHARS[(h1 >> 12) & 0x0F] + HEX_CHARS[(h1 >> 8) & 0x0F] +
HEX_CHARS[(h1 >> 20) & 0x0F] + HEX_CHARS[(h1 >> 16) & 0x0F] +
HEX_CHARS[(h1 >> 28) & 0x0F] + HEX_CHARS[(h1 >> 24) & 0x0F] +
HEX_CHARS[(h2 >> 4) & 0x0F] + HEX_CHARS[h2 & 0x0F] +
HEX_CHARS[(h2 >> 12) & 0x0F] + HEX_CHARS[(h2 >> 8) & 0x0F] +
HEX_CHARS[(h2 >> 20) & 0x0F] + HEX_CHARS[(h2 >> 16) & 0x0F] +
HEX_CHARS[(h2 >> 28) & 0x0F] + HEX_CHARS[(h2 >> 24) & 0x0F] +
HEX_CHARS[(h3 >> 4) & 0x0F] + HEX_CHARS[h3 & 0x0F] +
HEX_CHARS[(h3 >> 12) & 0x0F] + HEX_CHARS[(h3 >> 8) & 0x0F] +
HEX_CHARS[(h3 >> 20) & 0x0F] + HEX_CHARS[(h3 >> 16) & 0x0F] +
HEX_CHARS[(h3 >> 28) & 0x0F] + HEX_CHARS[(h3 >> 24) & 0x0F];
};
/**
* @method toString
* @memberof Md5
* @instance
* @description Output hash as hex string
* @returns {String} Hex string
* @see {@link md5.hex}
* @example
* hash.toString();
*/
Md5.prototype.toString = Md5.prototype.hex;
/**
* @method digest
* @memberof Md5
* @instance
* @description Output hash as bytes array
* @returns {Array} Bytes array
* @see {@link md5.digest}
* @example
* hash.digest();
*/
Md5.prototype.digest = function () {
this.finalize();
var h0 = this.h0, h1 = this.h1, h2 = this.h2, h3 = this.h3;
return [
h0 & 0xFF, (h0 >> 8) & 0xFF, (h0 >> 16) & 0xFF, (h0 >> 24) & 0xFF,
h1 & 0xFF, (h1 >> 8) & 0xFF, (h1 >> 16) & 0xFF, (h1 >> 24) & 0xFF,
h2 & 0xFF, (h2 >> 8) & 0xFF, (h2 >> 16) & 0xFF, (h2 >> 24) & 0xFF,
h3 & 0xFF, (h3 >> 8) & 0xFF, (h3 >> 16) & 0xFF, (h3 >> 24) & 0xFF
];
};
/**
* @method array
* @memberof Md5
* @instance
* @description Output hash as bytes array
* @returns {Array} Bytes array
* @see {@link md5.array}
* @example
* hash.array();
*/
Md5.prototype.array = Md5.prototype.digest;
/**
* @method arrayBuffer
* @memberof Md5
* @instance
* @description Output hash as ArrayBuffer
* @returns {ArrayBuffer} ArrayBuffer
* @see {@link md5.arrayBuffer}
* @example
* hash.arrayBuffer();
*/
Md5.prototype.arrayBuffer = function () {
this.finalize();
var buffer = new ArrayBuffer(16);
var blocks = new Uint32Array(buffer);
blocks[0] = this.h0;
blocks[1] = this.h1;
blocks[2] = this.h2;
blocks[3] = this.h3;
return buffer;
};
/**
* @method buffer
* @deprecated This maybe confuse with Buffer in node.js. Please use arrayBuffer instead.
* @memberof Md5
* @instance
* @description Output hash as ArrayBuffer
* @returns {ArrayBuffer} ArrayBuffer
* @see {@link md5.buffer}
* @example
* hash.buffer();
*/
Md5.prototype.buffer = Md5.prototype.arrayBuffer;
/**
* @method base64
* @memberof Md5
* @instance
* @description Output hash as base64 string
* @returns {String} base64 string
* @see {@link md5.base64}
* @example
* hash.base64();
*/
Md5.prototype.base64 = function () {
var v1, v2, v3, base64Str = '', bytes = this.array();
for (var i = 0; i < 15;) {
v1 = bytes[i++];
v2 = bytes[i++];
v3 = bytes[i++];
base64Str += BASE64_ENCODE_CHAR[v1 >>> 2] +
BASE64_ENCODE_CHAR[(v1 << 4 | v2 >>> 4) & 63] +
BASE64_ENCODE_CHAR[(v2 << 2 | v3 >>> 6) & 63] +
BASE64_ENCODE_CHAR[v3 & 63];
}
v1 = bytes[i];
base64Str += BASE64_ENCODE_CHAR[v1 >>> 2] +
BASE64_ENCODE_CHAR[(v1 << 4) & 63] +
'==';
return base64Str;
};
var exports = createMethod();
if (COMMON_JS) {
module.exports = exports;
} else {
/**
* @method md5
* @description Md5 hash function, export to global in browsers.
* @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
* @returns {String} md5 hashes
* @example
* md5(''); // d41d8cd98f00b204e9800998ecf8427e
* md5('The quick brown fox jumps over the lazy dog'); // 9e107d9d372bb6826bd81d3542a419d6
* md5('The quick brown fox jumps over the lazy dog.'); // e4d909c290d0fb1ca068ffaddf22cbd0
*
* // It also supports UTF-8 encoding
* md5('中文'); // a7bac2239fcdcb3a067903d8077c4a07
*
* // It also supports byte `Array`, `Uint8Array`, `ArrayBuffer`
* md5([]); // d41d8cd98f00b204e9800998ecf8427e
* md5(new Uint8Array([])); // d41d8cd98f00b204e9800998ecf8427e
*/
root.md5 = exports;
if (AMD) {
define(function () {
return exports;
});
}
}
})();
......@@ -15,7 +15,12 @@
},
methods: {
back() {
this.$backup();
const routes = getCurrentPages();
if(routes.length > 1){
uni.navigateBack();
}else{
history.back();
}
}
}
}
......
<template>
<view class="time_box" v-if="flag">
<view class="black_bg" v-if="day > 0">{{day}}{{hour}}</view>
<view class="black_bg" v-if="day === 0 && hour > 0">{{hour}}{{minute}}</view>
<view class="black_bg" v-if="day === 0 && hour === 0">{{minute}}{{second}}</view>
</view>
</template>
<script>
import moment from 'moment';
export default {
props: {
time: {
type: String,
default: ''
}
},
data() {
return {
day: '',
hour: '',
minute: '',
second: '',
flag: true
}
},
mounted() {
let timer = setInterval(() => {
const now = moment(new Date(), 'YYYY-MM-DD HH:mm:ss').format('x')-0,
end = moment(this.time, 'YYYY-MM-DD HH:mm:ss').format('x')-0,
du = moment.duration(end-now);
this.day = du.days();
this.hour = du.hours();
this.minute = du.minutes();
this.second = du.seconds();
if(du.days() <=0 && du.hours() <=0 && du.minutes() <=0 && du.seconds() <= 0) {
clearInterval(timer);
this.flag = false;
}
}, 1000);
}
}
</script>
<style lang="less" scoped>
.time_box {
position: absolute;
left: 26rpx;
top: 40rpx;
z-index: 10;
}
.black_bg {
background:rgba(0,0,0,1);
height: 36rpx;
line-height: 36rpx;
color: #FFFFFF;
font-size: 24rpx;
padding: 0 20rpx;
width: 132rpx;
text-align: center;
}
</style>
......@@ -12,13 +12,20 @@
}
},
mounted(){
var elem = document.querySelector('.draggable');
this.$draggable = new Draggabilly(elem, {
var $draggable = $('.draggable').draggabilly({
containment: true
});
// $('.draggable').parent().css('min-height','100vh');
$draggable.on('staticClick', function( event, pointer ) {
$('#qidian_dom').click();
})
// var elem = document.querySelector('.draggable');
// this.$draggable = new Draggabilly(elem, {
// containment: true
// });
// this.$draggable.$on('staticClick', function( event, pointer ) {
// // elem.click();
// elem.click();
// })
}
}
......
......@@ -10,15 +10,20 @@
<title>
谛宝商城
</title>
<style>
#qidian_dom{line-height: 1;width: 42px;height: 42px;border-radius: 50%;cursor: pointer;text-align: center;background: #ff9232;position: fixed;bottom: 120px;right: 5px;z-index:2000000000}
#qidian_dom span{display: inline-block;position: relative;top: 10px;width: 20px;height: 20px;vertical-align: middle;background: url(https://bqq.gtimg.com/qidian/src/wpa/dist/4.1.0/images/icon-im-44-white-2x.png) no-repeat;background-size: 20px 20px;opacity: 1;cursor: pointer;}
</style>
<script>
document.addEventListener('DOMContentLoaded', function() {
document.documentElement.style.fontSize = document.documentElement.clientWidth / 20 + 'px'
})
</script>
<link rel="stylesheet" href="<%= BASE_URL %>static/index.<%= VUE_APP_INDEX_CSS_HASH %>.css" />
<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
<script src="https://dbc-static.oss-cn-beijing.aliyuncs.com/dbc-shop/lib/draggabilly.min.js"></script>
<!-- WPA start -->
<script id="qd28857712162361a518c852fc82fde1e5eab730ba68" src="https://wp.qiye.qq.com/qidian/2885771216/2361a518c852fc82fde1e5eab730ba68" charset="utf-8" defer></script>
<script id="qd28857712162361a518c852fc82fde1e5eab730ba68" src="https://wp.qiye.qq.com/qidian/2885771216/2361a518c852fc82fde1e5eab730ba68" charset="utf-8" async defer></script>
<!-- WPA end -->
</head>
<body>
......@@ -26,6 +31,7 @@
<strong>Please enable JavaScript to continue.</strong>
</noscript>
<div id="app"></div>
<div class='draggable is-pointer-down is-dragging' id='qidian_dom'><span></span></div>
<script>
var _hmt = _hmt || [];
(function() {
......@@ -34,6 +40,14 @@
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
var $draggable = $('.draggable').draggabilly({
containment: true
});
// $('.draggable').parent().css('min-height','100vh');
$draggable.on('staticClick', function( event, pointer ) {
$('#qidian_dom').click();
})
</script>
<!-- built files will be auto injected -->
</body>
......
......@@ -51,7 +51,7 @@
"mode": "history",
"base": "/uni"
},
"publicPath": "https://dbc-static.oss-cn-beijing.aliyuncs.com/dbc-shop/uni/mirror/1.0.6/",
"publicPath": "https://dbc-static.oss-cn-beijing.aliyuncs.com/dbc-shop/uni/test/1.0.6/",
"optimization": {
"treeShaking": {
"enable": true
......@@ -62,7 +62,7 @@
"disableHostCheck": true,
"proxy": {
"/uni/api": {
"target": "http://10.0.0.116:6564/",
"target": "http://39.96.85.45:9093/",
"changeOrigin": true,
"secure": false,
"pathRewrite": {
......
{
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
"pages": [
{
"path": "pages/home/home",
"style": {
......@@ -108,6 +108,24 @@
"style": {
"navigationBarTitleText": "金融分期-谛宝多多商城"
}
},
{
"path": "pages/wxpay/wxpay",
"style": {
"navigationBarTitleText": "微信支付-谛宝多多商城"
}
},
{
"path": "pages/yuepay/yuepay",
"style": {
"navigationBarTitleText": "余额支付-谛宝多多商城"
}
},
{
"path": "pages/payresult/payresult",
"style": {
"navigationBarTitleText": "支付状态-谛宝多多商城"
}
}
],
"globalStyle": {
......
......@@ -3,30 +3,30 @@
<TopBar title="谛宝收银台"/>
<view class="stand_title">分期定金</view>
<view class="stand_price">
<text class="symbol">¥</text>1998
<text class="symbol">¥</text>{{data.advance_payment}}
</view>
<view class="flex">
<image src="https://dbc-static.oss-cn-beijing.aliyuncs.com/credit_shop/20190424/goods/5cc03cef241dc.jpeg?x-oss-process=image/resize,m_lfit,w_300,h_300/auto-orient,0/quality,Q_85/format,jpg"></image>
<image :src="data.img_url"></image>
<view>
<view class="stand_goods_name">金融分期 谛宝 商品名称</view>
<view class="stand_goods_price">¥20,000</view>
<view class="stand_goods_name">{{data.equipment_name}}</view>
<view class="stand_goods_price">¥{{data.equipment_price}}</view>
</view>
</view>
<view class="stand_title" style="margin-top:60rpx">分期定金</view>
<view class="stand_tips">方案内详细信息</view>
<view class="stand_nper">10</view>
<view class="stand_nper">{{data.periods_num}}</view>
<view class="poupp_deposit">
<text>定金</text>
<text>¥ 2100</text>
<text>¥ {{data.advance_payment}}</text>
</view>
<view class="poupp_nper_detail">
<view>
<text>第1期 支付</text>
<text>¥ 2030.20</text>
<text>¥ {{data.first_payment}}</text>
</view>
<view>
<text>剩余9期 每期支付</text>
<text>¥ 11335</text>
<text>¥ {{data.remaining_payment}}</text>
</view>
</view>
<view class="pay_btn" @click="open()">确认支付</view>
......@@ -35,19 +35,37 @@
<view class="popup_top_bar">选择支付方式<text @click="close()"></text></view>
<view class="flex">
<text class="pay_title">支付定金</text>
<text class="pay_num">¥2900</text>
<text class="pay_num">¥{{data.order_price}}</text>
</view>
<view class="flex pay_item">
<view class="flex pay_item" @click="handleSelect(1)">
<view class="flex">
<text class="pay_methods_icon"></text>
<text class="pay_methods_icon yue"></text>
<view>
<view class="pay_methods_name">余额支付</view>
<view class="pay_methods_num">剩余余额:2360.20</view>
<view class="pay_methods_num">剩余余额:{{data.money}}</view>
</view>
</view>
<text class="uncheck"></text>
<text :class="type ===1 ? 'check' : 'uncheck'"></text>
</view>
<view class="pay_methods_btn">确认支付</view>
<view class="flex pay_item pay_item_other" @click="handleSelect(2)">
<view class="flex">
<text class="pay_methods_icon weixin"></text>
<view>
<view class="pay_methods_name">微信支付</view>
</view>
</view>
<text :class="type === 2 ? 'check' : 'uncheck'"></text>
</view>
<view class="flex pay_item pay_item_other" @click="handleSelect(3)">
<view class="flex">
<text class="pay_methods_icon alipay"></text>
<view>
<view class="pay_methods_name">支付宝支付</view>
</view>
</view>
<text :class="type === 3 ? 'check' : 'uncheck'"></text>
</view>
<view class="pay_methods_btn" @click="handleSubmit">确认支付</view>
</view>
</uni-popup>
</view>
......@@ -59,10 +77,88 @@
export default {
data() {
return {
data: {},
type: 1,
order_price: '',
money: ''
}
},
onLoad(){
this.loadData();
},
methods: {
loadData(){
const install = uni.getStorageSync('installment');
const {contract_no, equipment_id, property_id} = install;
uni.request({
url: `/uni/api/repayment/PayDetails?contract_no=${contract_no}`,
method: 'GET',
dataType: 'json',
success: (res) => {
const {data} = res;
if(data.data){
this.data = data.data;
this.order_price = data.data.order_price;
this.money = data.data.money;
}
}
})
},
// 选择支付方式
handleSelect(type){
this.type = type;
},
// 确认支付
handleSubmit(){
const {origin} = location;
const install = uni.getStorageSync('installment');
const {contract_no, equipment_id, property_id} = install;
if(!this.order_price || !contract_no){
uni.showToast({
title: '参数错误,无法发起支付',
icon: 'none'
})
}
// 余额支付
if(this.type === 1){
uni.navigateTo({
url: `/pages/yuepay/yuepay?amount=${this.order_price}&money=${this.money}&order_id=${contract_no}`
})
}
// 微信支付
if(this.type === 2){
this.$jump(`${origin}/uni/api/repayment/RedirectAuth?amount=${this.order_price}&order_id=${contract_no}`);
}
// 支付宝支付
if(this.type === 3){
uni.showLoading({
title: '提交中。。。'
})
uni.request({
url: `/uni/api/repayment/GoPay`,
method: 'post',
dataType: 'json',
data: {
amount: parseFloat(this.order_price),
order_id: contract_no,
payment_code: "epayalipaywap",
payment_name: "手机支付宝支付"
},
success: (res) => {
const {data} = res;
uni.hideLoading();
if(data.code === 0){
this.$jump(data.data);
}else{
uni.showToast({
title: '发起支付失败',
icon: 'none'
})
}
}
})
}
},
open() {
this.$refs.popup.open();
},
......@@ -228,7 +324,15 @@
background-size: 100% 100%;
background-repeat: no-repeat;
margin-right: 16rpx;
background-image: url(../../static/category/2641581405726_.pic.png);
&.yue{
background-image: url(../../static/paytype/yue.png);
}
&.weixin{
background-image: url(../../static/paytype/weixin.png);
}
&.alipay{
background-image: url(../../static/paytype/alipay.png);
}
}
.pay_methods_name {
font-size: 26rpx;
......@@ -248,6 +352,8 @@
background-size: 100% 100%;
}
.check {
width: 40rpx;
height: 40rpx;
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAMAAADW3miqAAACoFBMVEUhISEkIyArKR84Mx49Nh1cThhgURdiUxdqWRZwXhVzYBV+aROAahOihQ61kwu4lQu6lwq9mQrKpAjasAXwwQL3xgH9ywD/zQD/zQH/zQL/zgf/zgn/zwr/zxD/0BD/0BL/0BP/0RP/0RT/0RX/0h7/0x7/0x//0yP/1CT/1Cj/1Sf/1Sj/1Sr/1Sz/1jH/1zP/1zT/1zX/2Dn/2Dr/2T//2UD/2UL/2kH/2kT/2kX/20X/3E3/3E//3VL/3VT/3lT/3lf/3lj/31v/313/31//32H/4GH/4Gb/4Wb/4Wr/4Wz/4mn/4mv/4m3/43H/43L/43T/43X/5HP/5HT/5HX/5Hb/5Hf/5Hj/5Hn/5Hr/5Xn/5Xv/5X3/5oD/5oH/5oP/5oT/54P/54X/54b/54f/54n/6In/6Iv/6I7/6Y7/6Y//6ZL/6ZP/6ZT/6pf/6pj/6pn/65f/65n/65r/65v/657/65//7KD/7KP/7KT/7aP/7ab/7af/7aj/7an/7qr/7qv/7qz/7q3/763/767/76//77H/77P/8LT/8LX/8Lb/8Lf/8br/8bv/8b3/8r7/8sD/8sH/8sL/88L/88T/88X/88b/88n/9Mj/9Mn/9Mr/9Mv/9Mz/9M3/9c3/9c7/9dD/9dH/9tH/9tL/9tP/9tT/99b/99f/99j/99n/99r/99z/+Nv/+Nz/+N3/+N7/+N//+d7/+d//+eH/+eL/+eP/+eX/+uL/+uT/+uX/+ub/+uf/+uj/+un/+uv/++r/++v/++z/++3/++7/++//+/D//O7//O///PD//PH//PL//PP//PT//PX//fT//fX//fb//ff//fj//fn//fv//vb//vj//vn//vr//vv//vz//v3///z///3///7////If3C4AAACf0lEQVQ4y2O4TwRgQBe4BwR4FN27dfPyxfPnTp8+c+Hi5Zu372FRdO/m9bMn922ujg8Pj6/efujUhcu37qEpunfr+vljW1P0JcXBQNIgbcdxhDKIors3LxzdlSkvjgTks/acunbzHkLR7RvnD660EEcDlmuPXbhyF6bo7o3z+6doi2MA7RkHL1y5B1F07+b5/Yu1xLEAzeUHL4BsZAC6+cLBVabiWIHZ+uPXboMU3b58ZH2cOA6QtOXU5XtARTfPbZsli0uR3KK9F27dZ7h3/dCKYHGcIGzjicv3GG6d3zlLB1NSmFcETOsu2HvhNsONE2u6JTHUCDExcELCvm/z6TsMlw4sjsOmhoEbwkxecfgGw4VdM10hXAEWHjGEGlZRCNtjwf5rDGc2T3KAcNkYGLjE0NWIO03fdYHh9Lo+ewhXkBGiCkWNuOOUrVcZTq7ucYTy+cCqUNWIO0/ecgakyFccSRU7qhrxIJAioHXZEsiqUNVIFIOsAzq8RFUcWRWyGnG1KpDDgUFQYYMQ5GfmQFYjbtcACgJgYLamSOOKOpmMLlBgAqOlN88alyLb0kmgaAFFcE2COnY1Gukt4AgGJZWe/ABFbGqUIksngJMKKNHNbcn0UMBUo+iT27lkDyjRgZPv1JpUHxV0NWp+GU2zockXnBEmVqb5mUghK5EyD8monwbLCOAstWJSTUaUu5ESNOwllI29Y3Iap62DZSlI5lw1taUoKdTTxcJQT8/Qys0rIrW0fdZGROaEZPMN83vr8tNjI0L8/QOjEzNKmics3IKczaEFxso5fW01ZQWFhcXltR0T569GKzCgRc+2dUvnTJ3Q3z9x2rxlm3afQBQ9AO0gCIzNUhSlAAAAAElFTkSuQmCC') no-repeat;
background-size: 100% 100%;
}
......@@ -270,5 +376,8 @@
font-size: 28rpx;
margin-top: 22rpx;
}
.pay_item_other{
margin-top: 0;
}
}
</style>
......@@ -71,12 +71,15 @@
}
.menuItem {
text-align: center;
display: flex;
justify-content: center;
flex-direction: column;
}
.icon_img {
display: block;
width: 96rpx;
height: 96rpx;
margin: 0 auto 8rpx;
margin: 0 auto 20rpx;
}
.title {
font-size: 24rpx;
......
<template>
<view class="hot_main_content">
<view class="clearfix" style="padding: 28rpx 0 20rpx">
<view class="hot_main_content" :style="[fixFlag ? {'padding-top': '100rpx'} : null]" ref="fix">
<view class="clearfix scrollbar" :class="{'fixed': fixFlag}">
<view class="hot_head_left">
<view>
<text class="hot_title">
......@@ -10,7 +10,7 @@
<text class="hot_sub_title">{{style_setting.sub_title}}</text>
</view>
</view>
<view class="hot_cate_list">
<view class="hot_cate_list" :style="[fixFlag ? {'padding-right': '60rpx'} : null]">
<text class="hot_cate_item" v-for="(item, key) in cate_list" :key="key" @click="changeCate(key)" :class="key === hotIndex ? 'act' : ''" v-if="item.goods_list.length">
<text>{{item.cate_name}}</text>
<text>{{item.sub_title}}</text>
......@@ -54,7 +54,8 @@
return {
style_setting: this.wrapper_props.style_setting,
cate_list: this.wrapper_props.cate_list,
hotIndex: 0
hotIndex: 0,
fixFlag: false
}
},
mounted() {
......@@ -85,6 +86,19 @@
.hot_main_content {
width: 702rpx;
margin: 0 auto;
.scrollbar {
padding: 28rpx 0 20rpx;
}
.fixed {
position: fixed;
left: 0;
top: 100rpx;
background-color: #f8f8f8;
z-index: 10;
width: 100%;
padding: 28rpx 24rpx 20rpx;
box-shadow:0px 4px 16px 0px rgba(0,0,0,0.3);
}
}
.hot_head_left {
display: inline-block;
......@@ -118,6 +132,7 @@
position: relative;
left: 20rpx;
height: 88rpx;
padding-right: 18rpx;
}
.hot_cate_list::-webkit-scrollbar {
display: none;
......
......@@ -59,6 +59,7 @@
width: 100%;
top: 0;
left: 0;
height: 100rpx;
box-sizing: border-box;
z-index: 100;
.flex {
......
<template>
<view class="homeContent">
<component v-for="(item, index) in data" :key="index" :is="item.name" :wrapper_props="item.wrapper_props" :isLogin="isLogin"></component>
<component v-for="(item, index) in data" :key="index" :is="item.name" :wrapper_props="item.wrapper_props" :isLogin="isLogin" :ref="item.name"></component>
<BottomBar />
</view>
</template>
......@@ -21,7 +21,8 @@
data() {
return {
data: [],
isLogin: 0
isLogin: 0,
fixFlag: false
}
},
onLoad() {
......@@ -36,6 +37,16 @@
}
// #endif
},
onPageScroll() {
const top = this.$refs.HotRecommd[0].$refs.fix.$el.getBoundingClientRect().top;
if(top <= 50 && !this.fixFlag) {
this.fixFlag = true;
this.$refs.HotRecommd[0].fixFlag = true;
} else if(top > 50 && this.fixFlag) {
this.fixFlag = false;
this.$refs.HotRecommd[0].fixFlag = false;
}
},
methods: {
getData() {
uni.request({
......
<template>
<view class="content">
<view class="nav">支付状态</view>
<view class="icon"></view>
<view class="title">支付成功</view>
<button class="btn" type="default"><text>{{time}}</text>s)跳转个人中心</button>
</view>
</template>
<script>
export default{
data(){
return {
time: 5
}
},
onLoad(){
if(timer){
clearInterval(timer);
}
let timer = setInterval(() => {
if(this.time <= 0){
const {origin} = window.location;
this.$jump(`${origin}/index.php?app=member`);
clearInterval(timer);
return;
}
this.time = this.time - 1;
}, 1000)
}
}
</script>
<style lang="scss">
.content{
height: 100vh;
background-color: #fff;
.nav{
height: 100rpx;
line-height: 100rpx;
padding: 0 20rpx;
position: relative;
background-color: #fff;
text-align: center;
width: 100%;
font-size: 30rpx;
border-bottom: 1px solid #efefef;
}
.icon{
background: url(data:image;base64,iVBORw0KGgoAAAANSUhEUgAAAEwAAABMCAMAAADwSaEZAAAAbFBMVEX/zlb//////vv//fn/+/L/+u///Pf//PT/+ev/9+X/+Oj/9uH/9Nv/9d7/89f/8tP/8c//8Mr/0Fv/67v/02f/0WH/0F7/35D/2oD/5qf/7cL/3Yj/0mT/6bH/13b/1nH/4pr/45//4JT/1W0DuFcCAAAD/0lEQVRYw63Y2WKbMBAFUOHESQCz7+Dd//+PlQZZVws2IultH/rS0zsjOTWw4D/GB9tR/ortJEO/ZH6FPR0jEt2G4e99GIG/joEC9KXFANcxUAr6VlGgHHoVAzU7n0aESB7avcE0iqC9FQJnjrwlDBaoWfoRiXjoD+TpHDRgGFFSVEowxdCd66Ysm/rcDYUgqd4yx5wRqRVRYTW1zEg7VSFx1E5uzsRgUS9JJbcGCtLcEsmpg3AxqkUjEhVfS/Yi5TUWnBgVkwLD6mWtqKrZm9RVJMuhm9EMFl9Wx1bS8dVBAyYpWFF6Yau5pJGrMcOiEfOaeaTOxaimxnCQslfeMK80ueyGQyBM3ol5RvRa6zZPSjckUNhO3lVhxRfmnUssNHl7d8B4L7LMc1w/U9J4N4UJVi4/rNimVCEdwrMaM4ol9TasToxqDMX4kFe2MVc+KKoRJk8yTMutWJmG8kSByZNEMf9q8kRnDBsLk2Y71iQhtsa0jZ3YL3LC1jQsjPvfYH0cAqMpqVjSel7VTD+nNqFqNCfD+ke/86uCoGBaRhwBw5Q3v89jwKNv9xaHJrbf8yknn5vwEYgMDJn4nPv9jGFl51WqKYja3ZmWM5bG1Mqcz2XpHNwPWV+99flUS2NqZYfG/olgVR12ZO3PVt1DHLpYaVp8nEEvkAWU8GEPsI6dApFMjT59zlbasDXMHfM+H9t3py4XpTDrL48Zcaw2ty2rjK28XCIVc1NzLHIwa7GXnxmIenG5cL3snIFpY072PxkHCK6XnWlxZzd3G7r13bPF3BYxdyFtBgvXy0q1iKWt+yOieFph/cJqU2DaxyldmmPE9VpOn+LjpH3QDyf2QsP1cnM64IOu/Qg6ZO3iTowfX+5aD/qPIG1p9+UNv/upecfKBIalHYrt/wkXB7EyYFha2m3FuhQrM/+rS9L8uM065mmCKTWMjmDYhg20fhNDtWzaYk0ZihEW7PQjSPOHv/XIU6zf+UrFtWw8ei9szLhlfaVCNXHXssr3q3uViTtmfNkzvx8nQjt69eIWti8w5wtyLLTx4bGvUVix/QXZrEZaMa2eY0GWXsx6qICWD8e3Iw45LOuhgqrRiUIrutcPr10hLTzu4NkJa9O0fOzaJartxly35BWzMVqb1Igrhr61pH4oiCJr+RFRTqq6zeWynHune385tmXZHi/9/VTknJprUS9YFgaNynFOes9IiVNUC5b7wI9u86iCkx7lKQlqHhG9Fh74A7yKEOWonfC4SL+FRK2oFl5FBGjmvAfimuKon4roRJSqJXsBg6Zu75PjHgeRkEuR8foGvYBBs18sCZBCkNeLJXAbX3mtvIwT+fvLOHTze00IaxlDu/UXmKCQfzZUUs7ujoekAAAAAElFTkSuQmCC) no-repeat;
background-size: cover;
width: 152rpx;
height: 152rpx;
margin: 0 auto;
margin-top: 100rpx;
}
.title{
text-align: center;
margin-top: 30rpx;
font-size: 30rpx;
}
.btn{
font-size: 30rpx;
margin: 0 48rpx;
margin-top: 80rpx;
}
uni-button[type=default]{
background-color: #FFCF59;
color: rgba(0,0,0,1);
}
uni-button[loading][type=default]{
background-color: #dcb14d;
}
.button-hover[type=default]{
color: rgba(0,0,0,.5);
background-color: #dcb14d;
}
}
</style>
......@@ -44,26 +44,35 @@
<!-- 商品列表 -->
<view class="goods-list" v-if="goods_list.length > 0">
<view class="goods-item" v-for="(item,index) in goods_list" :key="index">
<countDown v-if="item._source.is_pro === 1" :time="item._source.end_time"></countDown>
<view class="image-outer" @click="jumpPhpPage(`app=goods&id=${item._source.goods_id}`)">
<image :src="item._source.default_image || $noGoodsImg" lazy-load @error="$__reloadResource(item)" mode="aspectFill"></image>
</view>
<view class="title">{{item._source.goods_name}}</view>
<view class="sub-title">{{item._source.goods_subname}}</view>
<view v-if="isLogin" class="price"><text class="price-tips"></text>{{item._source.price}}</view>
<view v-if="isLogin">
<view v-if="item._source.is_pro === 1">
<view class="price"><text class="price-tips"></text>{{item._source.pro_price.toFixed(2)}}
<text class="discount">{{(item._source.pro_price*10/Number(item._source.price)).toFixed(1)}}</text>
</view>
<view class="origin_price">¥{{item._source.price}}</view>
</view>
<view v-if="item._source.is_pro === 0">
<view class="price"><text class="price-tips"></text>{{item._source.price}}</view>
</view>
</view>
<view v-if="!isLogin" class="unlogin_price">登录显示价格</view>
<!-- <view class="old-price"><text class="price-tips"></text>30.00</view> -->
<image class="cart-icon" @click="addCart(item._source.default_spec, 1)" src="https://dbc-static.oss-cn-beijing.aliyuncs.com/credit_shop/global/icon_gouwuche%402x.png"></image>
</view>
</view>
<uni-load-more :status="loadingType"></uni-load-more>
<!-- 全局企点客服组件 -->
<service/>
<!-- 全局企点客服组件 -->
</view>
</template>
<script>
import uniIcons from "@/components/uni-icons/uni-icons.vue";
import countDown from "@/components/countDown.vue";
import uniLoadMore from "@/components/uni-load-more/uni-load-more.vue";
import empty from '@/components/empty.vue';
import service from '@/components/service.vue';
......@@ -73,7 +82,7 @@
uniIcons,
empty,
uniLoadMore,
service
countDown
},
data() {
return {
......@@ -170,6 +179,10 @@
this.goods_list = [];
}
this.goods_list = this.goods_list.concat(data.data);
this.goods_list.map((item, key) => {
if(item._source.is_pro === 1 && new Date(item._source.end_time).getTime() < new Date().getTime())
item._source.is_pro = 0;
});
this.isLogin = data.login_flg === 1;
const {total, page_size, current} = data.page;
this.param.current = current;
......@@ -218,7 +231,8 @@
z-index: 999;
background-color: #fff;
box-shadow: 0 2upx 10upx rgba(0,0,0,.06);
top: var(--window-top);
// top: var(--window-top);
top: 0;
}
.search-content{
display: flex;
......@@ -389,10 +403,29 @@
height: 44rpx;
line-height: 44rpx;
font-size: 32rpx;
color: #212121;
color: #AE8A57;
.price-tips{
font-size: 26rpx;
}
.discount {
display: inline-block;
padding: 0 14rpx;
height: 28rpx;
line-height: 28rpx;
text-align: center;
background:rgba(254,244,232,1);
color: #AE8A57;
font-size: 20rpx;
margin-left: 8px;
position: relative;
top: -4rpx;
}
}
.origin_price {
color: #aeaeae;
font-size: 24rpx;
line-height: 34rpx;
text-decoration: line-through;
}
.old-price{
height: 34rpx;
......
......@@ -4,27 +4,34 @@
<view :style="{'margin-top':'28rpx'}">
<view class="apply_title">签署合同</view>
<view class="apply_desc">请填写合同内详细信息</view>
<view v-for="(item,index) in list" :key="index">
{{item.index}}
</view>
</view>
<uni-collapse>
<uni-collapse-item title="企业信息" :open="true">
<view class="sign_title">企业名称</view>
<view v-for="(item, index) in list" :key="index">
<view class="sign_title">{{item.name}}</view>
<view>
<input type="text" class="sign_input">
<input type="text" v-model="list[index].value" value="" :name="item.key" class="sign_input">
</view>
</view>
</uni-collapse-item>
</uni-collapse>
<view class="agreement">
关于
<!-- <text>《谛宝多多金融分期协议》</text> -->
<text>《xx产品分期采购合同》</text>
</view>
<view>
<text class="sign_checkbox"></text>
<view @click="checkAgree" class="checkAgree">
<text class="sign_checkbox" :class="{act: is_agree}"></text>
<text class="agree_title">我已阅读并同意</text>
<text @click="previewContract" class="agreement">《产品分期采购合同》</text>
</view>
<!-- <text>《谛宝多多金融分期协议》</text> -->
<!-- <view class="agreement">
关于
<text @click="previewContract">《产品分期采购合同》</text>
</view> -->
<view class="sign_btn_box">
<text class="prev_step">上一步</text>
<text class="confirm_pay">缴纳定金
<text class="confirm_pay" @click="handleSubmit">缴纳定金
<i class="arrow_icon"></i>
</text>
</view>
......@@ -38,13 +45,148 @@
export default {
data() {
return {
list: [],
data: {},
is_eidt: false,
is_agree: false
}
},
components: {
uniCollapse,
uniCollapseItem,
TopBar
},
onLoad() {
this.loadData();
},
methods:{
// 默认获取合同签署字段
loadData(){
const install = uni.getStorageSync('installment');
const {contract_no, equipment_id, property_id} = install;
// 获取合同已填的信息
uni.request({
url: `/uni/api/signcontract/GetContract?contract_no=${contract_no}`,
method: 'GET',
dataType: 'json',
success: (res) => {
const {data} = res;
if(data.code == 0){
if(data.data){
const { contract_content } = data.data;
if(contract_content){
this.data = JSON.parse(contract_content);
this.is_eidt = true;
}
}
uni.request({
url: `/uni/api/signcontract/GetContractField?equipment_id=${equipment_id}`,
method: 'GET',
dataType: 'json',
success: (res) => {
const {data} = res;
if(data.code == 0){
this.list = data.data || [];
for(var i=0; i< this.list.length; i++){
let key = this.list[i].key;
this.list[i].value = this.data[key] || '';
}
}
}
})
}
}
})
},
// 缴纳定金提交
handleSubmit(){
if(!this.is_agree){
uni.showToast({
title: '请阅读并同意采购分期合同',
duration: 2000,
icon: 'none'
});
return;
}
const data = this.getData();
const install = uni.getStorageSync('installment');
const {contract_no, equipment_id, property_id} = install;
const url = this.is_eidt ? '/uni/api/signcontract/EditContract' : '/uni/api/signcontract/AddContract';
uni.showLoading({
title: '提交中。。。'
})
uni.request({
url: url,
method: this.is_eidt ? 'PUT' : 'POST',
data: {
contract_no: contract_no,
equipment_id: equipment_id,
property_id: property_id,
contract_content: data
},
dataType: 'json',
success: (res) => {
const {data} = res;
uni.hideLoading();
if(data.code == 0){
this.is_eidt = true;
uni.navigateTo({
url: '/pages/checkstand/checkstand'
});
}else{
uni.showToast({
icon: 'none',
title: '提交失败,请重试'
})
}
}
});
},
// 预览合同
previewContract(){
const data = this.getData();
const install = uni.getStorageSync('installment');
const {contract_no, equipment_id, property_id} = install;
uni.showLoading({
title: '获取合同中...',
});
uni.request({
url: '/uni/api/signcontract/PreviewContract',
method: 'POST',
data: {
contract_no: contract_no,
equipment_id: equipment_id,
property_id: property_id,
contract_content: data
},
dataType: 'json',
success: (res) => {
const {data} = res;
uni.hideLoading();
if(data.code == 0){
this.$jump(data.data.viewUrl);
}else{
uni.showToast({
icon: 'none',
title: '获取失败'
})
}
}
});
},
checkAgree(){
this.is_agree = !this.is_agree;
},
// 获取签署合同提交信息
getData(){
const length = this.list.length;
let data = {};
for(var i = 0; i < length; i++){
let key = this.list[i].key;
data[key] = this.list[i].value;
}
return data;
}
}
}
</script>
......@@ -123,7 +265,8 @@
}
.agreement {
font-size: 26rpx;
color: #979797;
// color: #979797;
color: #718BCA;
margin-top: 34rpx;
text {
color: #718BCA;
......@@ -133,6 +276,9 @@
font-size: 26rpx;
color: #7C7C7C;
}
.checkAgree{
margin-top: 26rpx;
}
.sign_checkbox {
display: inline-block;
width: 36rpx;
......
<template>
<view class="content">
<view class="nav-content">
<uni-icons color="#212121" class="search-icon-arrowleft" size="24" type="arrowleft" @click="goBack" />
<view class="title">微信支付</view>
</view>
<view class="price">
{{amount}}
</view>
<button type="primary" class="submit-btn" :loading="loading" @click="handleSumit">立即支付</button>
</view>
</template>
<script>
import uniIcons from "@/components/uni-icons/uni-icons.vue";
import {parse} from 'querystring'
export default{
components: {
uniIcons
},
data(){
return {
loading: false,
amount: ''
}
},
onLoad(){
const { href } = location;
const { amount, order_id, code } = parse(href.split('?')[1]);
this.amount = amount;
},
methods: {
handleSumit(){
const { href } = location;
const { amount, order_id, code } = parse(href.split('?')[1]);
if(!amount || !order_id || !code){
uni.showToast({
title: '参数错误请重新支付',
icon: 'none'
})
return;
}
this.loading = true;
uni.request({
url: `/uni/api/repayment/GoPay`,
method: 'post',
dataType: 'json',
data: {
amount: parseFloat(amount),
order_id: order_id,
payment_code: "epaywxjs",
payment_name: "微信支付",
wx_code: code
},
success: (res) => {
const {data} = res;
this.loading = false;
if(data.code === 0){
this.onBridgeReady(data.data);
}
}
})
},
onBridgeReady(res){
if(res.package === undefined){
uni.showToast({
title: '获取参数失败,请重新支付',
duration: 2000,
icon: 'none'
});
// this.closeWindow();
return;
}
WeixinJSBridge.invoke(
'getBrandWCPayRequest', {
"appId": res.app_id, //公众号名称,由商户传入
"timeStamp": res.timeStamp, //时间戳,自1970年以来的秒数
"nonceStr": res.nonce_str, //随机串
"package": res.package,
"signType": res.sign_type, //微信签名方式:
"paySign": res.pay_sign //微信签名
},
function (res) {
WeixinJSBridge.log(res.err_msg);
const url = window.location.origin;
if (res.err_msg === "get_brand_wcpay_request:ok") {
uni.navigateTo({
url: '/pages/payresult/payresult'
})
} else if (res.err_msg === "get_brand_wcpay_request:cancel") {
Toast.info("支付取消", 2);
// 重新跳转支付页面,刷新当前code 值
this.$jump(`${url}?app=member`);
} else if (res.err_msg === "get_brand_wcpay_request:fail") {
// Toast.fail('支付失败', 3);
// 提示支付失败,关闭当前页面
setTimeout(function() {
//这个可以关闭安卓系统的手机
document.addEventListener(
"WeixinJSBridgeReady",
function() {
WeixinJSBridge.call("closeWindow");
},
false
);
//这个可以关闭ios系统的手机
WeixinJSBridge.call("closeWindow");
}, 300);
} else {
uni.showToast({
title: '未知错误,刷新重试',
duration: 2000,
icon: 'none'
});
}
}
);
}
}
}
</script>
<style lang="scss">
.nav-content{
height: 100rpx;
padding: 0 20rpx;
display: flex;
justify-content: start;
align-items: center;
position: relative;
.search-icon-arrowleft{
width: 40rpx;
position: absolute;
left: 20rpx;
}
.title{
text-align: center;
width: 100%;
font-size: 30rpx;
}
}
.price{
text-align: center;
margin-top: 150rpx;
font-size: 60rpx;
}
.submit-btn{
margin: 0 48rpx;
margin-top: 80rpx;
font-size: 34rpx;
}
uni-button[type=primary]{
background-color: #07c160;
}
uni-button[loading][type=primary]{
background-color: #06ae56;
}
.button-hover[type=primary]{
color: rgba(0,0,0,.5);
background-color: #06ae56;
}
</style>
<template>
<view class="content">
<view class="nav-content">
<uni-icons color="#212121" class="search-icon-arrowleft" size="24" type="arrowleft" @click="goBack" />
<view class="title">余额支付</view>
</view>
<view class="order_info">
<view class="info_content">
<view class="order_price">
<text>订单总价:</text>
<text style="color: #8F99A7;">{{order_price}}</text>
</view>
<view class="money">
<text>账户余额:</text>
<text style="color: #8F99A7;">{{money}}</text>
</view>
</view>
<view class="password_content">
<view class="title">
支付密码
</view>
<input type="password" class="password" v-model="password" placeholder="默认支付密码:123456" />
</view>
</view>
<button type="primary" class="submit-btn" :loading="loading" @click="handleSumit">立即支付</button>
</view>
</template>
<script>
import uniIcons from "@/components/uni-icons/uni-icons.vue";
import md5 from '../../common/md5.js';
export default{
components: {
uniIcons
},
data(){
return {
money: '',
order_price: '',
order_id: '',
password: '',
loading: false
}
},
onLoad(option){
const {amount, money, order_id} = option;
this.money = money || '0.00';
this.order_price = amount || '0.00';
this.order_id = order_id || '';
},
methods: {
handleSumit(){
this.loading = true;
uni.request({
url: `/uni/api/repayment/GoPay`,
method: 'post',
dataType: 'json',
data: {
amount: parseFloat(this.order_price),
order_id: this.order_id,
payment_code: "tbopay",
payment_name: "余额支付",
password: md5(this.password)
},
success: (res) => {
const {data} = res;
this.loading = false;
if(data.code === 0){
uni.navigateTo({
url: '/pages/payresult/payresult'
})
}else{
uni.showToast({
title: data.message,
icon: 'none'
})
}
}
})
}
}
}
</script>
<style lang="scss">
.content{
background-color: #F8F8F8;
min-height: 100vh;
.order_info{
background-color: #fff;
margin: 0 24rpx;
min-height: 228rpx;
background: rgba(255,255,255,1);
border-radius: 20rpx;
margin-top: 30rpx;
box-sizing: border-box;
padding: 24rpx;
.info_content{
border-bottom: 1rpx solid #ececec;
.order_price,.money{
color: #212121;
font-size: 28rpx;
font-family:PingFangSC-Regular,PingFang SC;
font-weight:400;
height: 40rpx;
line-height: 40rpx;
margin-bottom: 20rpx;
}
}
}
.password_content{
padding-top: 20rpx;
.title{
font-size: 28rpx;
font-family:PingFangSC-Regular,PingFang SC;
font-weight:400;
margin-bottom: 20rpx;
}
.password{
height: 96rpx;
line-height: 96rpx;
padding-bottom: 8rpx;
box-sizing: border-box;
border-bottom: 2rpx solid #ECECEC;
font-size: 30rpx;
padding-left: 20rpx;
}
}
}
.nav-content{
height: 100rpx;
padding: 0 20rpx;
display: flex;
justify-content: start;
align-items: center;
position: relative;
background-color: #fff;
.search-icon-arrowleft{
width: 40rpx;
position: absolute;
left: 20rpx;
}
.title{
text-align: center;
width: 100%;
font-size: 30rpx;
}
}
.price{
text-align: center;
margin-top: 150rpx;
font-size: 60rpx;
}
.submit-btn{
margin: 0 48rpx;
margin-top: 80rpx;
font-size: 34rpx;
}
uni-button[type=primary]{
background-color: #FFCF59;
color: rgba(0,0,0,1);
}
uni-button[loading][type=primary]{
background-color: #dcb14d;
}
.button-hover[type=primary]{
color: rgba(0,0,0,.5);
background-color: #dcb14d;
}
</style>
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment