lhl 2 vuotta sitten
vanhempi
commit
8c1248991b

+ 40 - 2
api/index.js

@@ -61,5 +61,43 @@ export function guide_map(data) {
 		data
 	});
 }
-
-
+
+export function certification(data) {
+	return request({
+		url: '/api/user/certification',
+		method: 'post',
+		data
+	});
+}
+//套餐列表
+export function getRents(data) {
+	return request({
+		url: '/api/rent',
+		method: 'get',
+		data
+	});
+}
+//创建套餐订单
+export function rentCreate(data) {
+	return request({
+		url: '/api/rent/create',
+		method: 'post',
+		data
+	});
+}
+//电池核销
+export function rentVerific(data) {
+	return request({
+		url: '/api/order/rent_verific',
+		method: 'post',
+		data
+	});
+}
+//普通商品核销
+export function orderVerific(data) {
+	return request({
+		url: '/api/order/order_verific',
+		method: 'post',
+		data
+	});
+}

+ 9 - 1
api/product.js

@@ -183,4 +183,12 @@ export function reply_list(data,id) {
 		data
 	});
 }
-
+
+// 获取首页信息
+export function storeList(data) {
+	return request({
+		url: '/api/store_list',
+		method: 'get',
+		data
+	});
+}

+ 9 - 1
api/user.js

@@ -269,4 +269,12 @@ export function getcar_status(data) {
 		data
 	});
 }
-
+
+//我的电池
+export function getMyRent(data) {
+	return request({
+		url: '/api/rent/order',
+		method: 'post',
+		data
+	})
+}

+ 1201 - 0
components/tki-qrcode/qrcode.js

@@ -0,0 +1,1201 @@
+let QRCode = {};
+(function () {
+    /**
+     * 获取单个字符的utf8编码
+     * unicode BMP平面约65535个字符
+     * @param {num} code
+     * return {array}
+     */
+    function unicodeFormat8(code) {
+        // 1 byte
+        var c0, c1, c2;
+        if (code < 128) {
+            return [code];
+            // 2 bytes
+        } else if (code < 2048) {
+            c0 = 192 + (code >> 6);
+            c1 = 128 + (code & 63);
+            return [c0, c1];
+            // 3 bytes
+        } else {
+            c0 = 224 + (code >> 12);
+            c1 = 128 + (code >> 6 & 63);
+            c2 = 128 + (code & 63);
+            return [c0, c1, c2];
+        }
+    }
+    /**
+     * 获取字符串的utf8编码字节串
+     * @param {string} string
+     * @return {array}
+     */
+    function getUTF8Bytes(string) {
+        var utf8codes = [];
+        for (var i = 0; i < string.length; i++) {
+            var code = string.charCodeAt(i);
+            var utf8 = unicodeFormat8(code);
+            for (var j = 0; j < utf8.length; j++) {
+                utf8codes.push(utf8[j]);
+            }
+        }
+        return utf8codes;
+    }
+    /**
+     * 二维码算法实现
+     * @param {string} data              要编码的信息字符串
+     * @param {num} errorCorrectLevel 纠错等级
+     */
+    function QRCodeAlg(data, errorCorrectLevel) {
+        this.typeNumber = -1; //版本
+        this.errorCorrectLevel = errorCorrectLevel;
+        this.modules = null; //二维矩阵,存放最终结果
+        this.moduleCount = 0; //矩阵大小
+        this.dataCache = null; //数据缓存
+        this.rsBlocks = null; //版本数据信息
+        this.totalDataCount = -1; //可使用的数据量
+        this.data = data;
+        this.utf8bytes = getUTF8Bytes(data);
+        this.make();
+    }
+    QRCodeAlg.prototype = {
+        constructor: QRCodeAlg,
+        /**
+         * 获取二维码矩阵大小
+         * @return {num} 矩阵大小
+         */
+        getModuleCount: function () {
+            return this.moduleCount;
+        },
+        /**
+         * 编码
+         */
+        make: function () {
+            this.getRightType();
+            this.dataCache = this.createData();
+            this.createQrcode();
+        },
+        /**
+         * 设置二位矩阵功能图形
+         * @param  {bool} test 表示是否在寻找最好掩膜阶段
+         * @param  {num} maskPattern 掩膜的版本
+         */
+        makeImpl: function (maskPattern) {
+            this.moduleCount = this.typeNumber * 4 + 17;
+            this.modules = new Array(this.moduleCount);
+            for (var row = 0; row < this.moduleCount; row++) {
+                this.modules[row] = new Array(this.moduleCount);
+            }
+            this.setupPositionProbePattern(0, 0);
+            this.setupPositionProbePattern(this.moduleCount - 7, 0);
+            this.setupPositionProbePattern(0, this.moduleCount - 7);
+            this.setupPositionAdjustPattern();
+            this.setupTimingPattern();
+            this.setupTypeInfo(true, maskPattern);
+            if (this.typeNumber >= 7) {
+                this.setupTypeNumber(true);
+            }
+            this.mapData(this.dataCache, maskPattern);
+        },
+        /**
+         * 设置二维码的位置探测图形
+         * @param  {num} row 探测图形的中心横坐标
+         * @param  {num} col 探测图形的中心纵坐标
+         */
+        setupPositionProbePattern: function (row, col) {
+            for (var r = -1; r <= 7; r++) {
+                if (row + r <= -1 || this.moduleCount <= row + r) continue;
+                for (var c = -1; c <= 7; c++) {
+                    if (col + c <= -1 || this.moduleCount <= col + c) continue;
+                    if ((0 <= r && r <= 6 && (c == 0 || c == 6)) || (0 <= c && c <= 6 && (r == 0 || r == 6)) || (2 <= r && r <= 4 && 2 <= c && c <= 4)) {
+                        this.modules[row + r][col + c] = true;
+                    } else {
+                        this.modules[row + r][col + c] = false;
+                    }
+                }
+            }
+        },
+        /**
+         * 创建二维码
+         * @return {[type]} [description]
+         */
+        createQrcode: function () {
+            var minLostPoint = 0;
+            var pattern = 0;
+            var bestModules = null;
+            for (var i = 0; i < 8; i++) {
+                this.makeImpl(i);
+                var lostPoint = QRUtil.getLostPoint(this);
+                if (i == 0 || minLostPoint > lostPoint) {
+                    minLostPoint = lostPoint;
+                    pattern = i;
+                    bestModules = this.modules;
+                }
+            }
+            this.modules = bestModules;
+            this.setupTypeInfo(false, pattern);
+            if (this.typeNumber >= 7) {
+                this.setupTypeNumber(false);
+            }
+        },
+        /**
+         * 设置定位图形
+         * @return {[type]} [description]
+         */
+        setupTimingPattern: function () {
+            for (var r = 8; r < this.moduleCount - 8; r++) {
+                if (this.modules[r][6] != null) {
+                    continue;
+                }
+                this.modules[r][6] = (r % 2 == 0);
+                if (this.modules[6][r] != null) {
+                    continue;
+                }
+                this.modules[6][r] = (r % 2 == 0);
+            }
+        },
+        /**
+         * 设置矫正图形
+         * @return {[type]} [description]
+         */
+        setupPositionAdjustPattern: function () {
+            var pos = QRUtil.getPatternPosition(this.typeNumber);
+            for (var i = 0; i < pos.length; i++) {
+                for (var j = 0; j < pos.length; j++) {
+                    var row = pos[i];
+                    var col = pos[j];
+                    if (this.modules[row][col] != null) {
+                        continue;
+                    }
+                    for (var r = -2; r <= 2; r++) {
+                        for (var c = -2; c <= 2; c++) {
+                            if (r == -2 || r == 2 || c == -2 || c == 2 || (r == 0 && c == 0)) {
+                                this.modules[row + r][col + c] = true;
+                            } else {
+                                this.modules[row + r][col + c] = false;
+                            }
+                        }
+                    }
+                }
+            }
+        },
+        /**
+         * 设置版本信息(7以上版本才有)
+         * @param  {bool} test 是否处于判断最佳掩膜阶段
+         * @return {[type]}      [description]
+         */
+        setupTypeNumber: function (test) {
+            var bits = QRUtil.getBCHTypeNumber(this.typeNumber);
+            for (var i = 0; i < 18; i++) {
+                var mod = (!test && ((bits >> i) & 1) == 1);
+                this.modules[Math.floor(i / 3)][i % 3 + this.moduleCount - 8 - 3] = mod;
+                this.modules[i % 3 + this.moduleCount - 8 - 3][Math.floor(i / 3)] = mod;
+            }
+        },
+        /**
+         * 设置格式信息(纠错等级和掩膜版本)
+         * @param  {bool} test
+         * @param  {num} maskPattern 掩膜版本
+         * @return {}
+         */
+        setupTypeInfo: function (test, maskPattern) {
+            var data = (QRErrorCorrectLevel[this.errorCorrectLevel] << 3) | maskPattern;
+            var bits = QRUtil.getBCHTypeInfo(data);
+            // vertical
+            for (var i = 0; i < 15; i++) {
+                var mod = (!test && ((bits >> i) & 1) == 1);
+                if (i < 6) {
+                    this.modules[i][8] = mod;
+                } else if (i < 8) {
+                    this.modules[i + 1][8] = mod;
+                } else {
+                    this.modules[this.moduleCount - 15 + i][8] = mod;
+                }
+                // horizontal
+                var mod = (!test && ((bits >> i) & 1) == 1);
+                if (i < 8) {
+                    this.modules[8][this.moduleCount - i - 1] = mod;
+                } else if (i < 9) {
+                    this.modules[8][15 - i - 1 + 1] = mod;
+                } else {
+                    this.modules[8][15 - i - 1] = mod;
+                }
+            }
+            // fixed module
+            this.modules[this.moduleCount - 8][8] = (!test);
+        },
+        /**
+         * 数据编码
+         * @return {[type]} [description]
+         */
+        createData: function () {
+            var buffer = new QRBitBuffer();
+            var lengthBits = this.typeNumber > 9 ? 16 : 8;
+            buffer.put(4, 4); //添加模式
+            buffer.put(this.utf8bytes.length, lengthBits);
+            for (var i = 0, l = this.utf8bytes.length; i < l; i++) {
+                buffer.put(this.utf8bytes[i], 8);
+            }
+            if (buffer.length + 4 <= this.totalDataCount * 8) {
+                buffer.put(0, 4);
+            }
+            // padding
+            while (buffer.length % 8 != 0) {
+                buffer.putBit(false);
+            }
+            // padding
+            while (true) {
+                if (buffer.length >= this.totalDataCount * 8) {
+                    break;
+                }
+                buffer.put(QRCodeAlg.PAD0, 8);
+                if (buffer.length >= this.totalDataCount * 8) {
+                    break;
+                }
+                buffer.put(QRCodeAlg.PAD1, 8);
+            }
+            return this.createBytes(buffer);
+        },
+        /**
+         * 纠错码编码
+         * @param  {buffer} buffer 数据编码
+         * @return {[type]}
+         */
+        createBytes: function (buffer) {
+            var offset = 0;
+            var maxDcCount = 0;
+            var maxEcCount = 0;
+            var length = this.rsBlock.length / 3;
+            var rsBlocks = new Array();
+            for (var i = 0; i < length; i++) {
+                var count = this.rsBlock[i * 3 + 0];
+                var totalCount = this.rsBlock[i * 3 + 1];
+                var dataCount = this.rsBlock[i * 3 + 2];
+                for (var j = 0; j < count; j++) {
+                    rsBlocks.push([dataCount, totalCount]);
+                }
+            }
+            var dcdata = new Array(rsBlocks.length);
+            var ecdata = new Array(rsBlocks.length);
+            for (var r = 0; r < rsBlocks.length; r++) {
+                var dcCount = rsBlocks[r][0];
+                var ecCount = rsBlocks[r][1] - dcCount;
+                maxDcCount = Math.max(maxDcCount, dcCount);
+                maxEcCount = Math.max(maxEcCount, ecCount);
+                dcdata[r] = new Array(dcCount);
+                for (var i = 0; i < dcdata[r].length; i++) {
+                    dcdata[r][i] = 0xff & buffer.buffer[i + offset];
+                }
+                offset += dcCount;
+                var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount);
+                var rawPoly = new QRPolynomial(dcdata[r], rsPoly.getLength() - 1);
+                var modPoly = rawPoly.mod(rsPoly);
+                ecdata[r] = new Array(rsPoly.getLength() - 1);
+                for (var i = 0; i < ecdata[r].length; i++) {
+                    var modIndex = i + modPoly.getLength() - ecdata[r].length;
+                    ecdata[r][i] = (modIndex >= 0) ? modPoly.get(modIndex) : 0;
+                }
+            }
+            var data = new Array(this.totalDataCount);
+            var index = 0;
+            for (var i = 0; i < maxDcCount; i++) {
+                for (var r = 0; r < rsBlocks.length; r++) {
+                    if (i < dcdata[r].length) {
+                        data[index++] = dcdata[r][i];
+                    }
+                }
+            }
+            for (var i = 0; i < maxEcCount; i++) {
+                for (var r = 0; r < rsBlocks.length; r++) {
+                    if (i < ecdata[r].length) {
+                        data[index++] = ecdata[r][i];
+                    }
+                }
+            }
+            return data;
+
+        },
+        /**
+         * 布置模块,构建最终信息
+         * @param  {} data
+         * @param  {} maskPattern
+         * @return {}
+         */
+        mapData: function (data, maskPattern) {
+            var inc = -1;
+            var row = this.moduleCount - 1;
+            var bitIndex = 7;
+            var byteIndex = 0;
+            for (var col = this.moduleCount - 1; col > 0; col -= 2) {
+                if (col == 6) col--;
+                while (true) {
+                    for (var c = 0; c < 2; c++) {
+                        if (this.modules[row][col - c] == null) {
+                            var dark = false;
+                            if (byteIndex < data.length) {
+                                dark = (((data[byteIndex] >>> bitIndex) & 1) == 1);
+                            }
+                            var mask = QRUtil.getMask(maskPattern, row, col - c);
+                            if (mask) {
+                                dark = !dark;
+                            }
+                            this.modules[row][col - c] = dark;
+                            bitIndex--;
+                            if (bitIndex == -1) {
+                                byteIndex++;
+                                bitIndex = 7;
+                            }
+                        }
+                    }
+                    row += inc;
+                    if (row < 0 || this.moduleCount <= row) {
+                        row -= inc;
+                        inc = -inc;
+                        break;
+                    }
+                }
+            }
+        }
+    };
+    /**
+     * 填充字段
+     */
+    QRCodeAlg.PAD0 = 0xEC;
+    QRCodeAlg.PAD1 = 0x11;
+    //---------------------------------------------------------------------
+    // 纠错等级对应的编码
+    //---------------------------------------------------------------------
+    var QRErrorCorrectLevel = [1, 0, 3, 2];
+    //---------------------------------------------------------------------
+    // 掩膜版本
+    //---------------------------------------------------------------------
+    var QRMaskPattern = {
+        PATTERN000: 0,
+        PATTERN001: 1,
+        PATTERN010: 2,
+        PATTERN011: 3,
+        PATTERN100: 4,
+        PATTERN101: 5,
+        PATTERN110: 6,
+        PATTERN111: 7
+    };
+    //---------------------------------------------------------------------
+    // 工具类
+    //---------------------------------------------------------------------
+    var QRUtil = {
+        /*
+        每个版本矫正图形的位置
+         */
+        PATTERN_POSITION_TABLE: [
+            [],
+            [6, 18],
+            [6, 22],
+            [6, 26],
+            [6, 30],
+            [6, 34],
+            [6, 22, 38],
+            [6, 24, 42],
+            [6, 26, 46],
+            [6, 28, 50],
+            [6, 30, 54],
+            [6, 32, 58],
+            [6, 34, 62],
+            [6, 26, 46, 66],
+            [6, 26, 48, 70],
+            [6, 26, 50, 74],
+            [6, 30, 54, 78],
+            [6, 30, 56, 82],
+            [6, 30, 58, 86],
+            [6, 34, 62, 90],
+            [6, 28, 50, 72, 94],
+            [6, 26, 50, 74, 98],
+            [6, 30, 54, 78, 102],
+            [6, 28, 54, 80, 106],
+            [6, 32, 58, 84, 110],
+            [6, 30, 58, 86, 114],
+            [6, 34, 62, 90, 118],
+            [6, 26, 50, 74, 98, 122],
+            [6, 30, 54, 78, 102, 126],
+            [6, 26, 52, 78, 104, 130],
+            [6, 30, 56, 82, 108, 134],
+            [6, 34, 60, 86, 112, 138],
+            [6, 30, 58, 86, 114, 142],
+            [6, 34, 62, 90, 118, 146],
+            [6, 30, 54, 78, 102, 126, 150],
+            [6, 24, 50, 76, 102, 128, 154],
+            [6, 28, 54, 80, 106, 132, 158],
+            [6, 32, 58, 84, 110, 136, 162],
+            [6, 26, 54, 82, 110, 138, 166],
+            [6, 30, 58, 86, 114, 142, 170]
+        ],
+        G15: (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0),
+        G18: (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0),
+        G15_MASK: (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1),
+        /*
+        BCH编码格式信息
+         */
+        getBCHTypeInfo: function (data) {
+            var d = data << 10;
+            while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) >= 0) {
+                d ^= (QRUtil.G15 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15)));
+            }
+            return ((data << 10) | d) ^ QRUtil.G15_MASK;
+        },
+        /*
+        BCH编码版本信息
+         */
+        getBCHTypeNumber: function (data) {
+            var d = data << 12;
+            while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) >= 0) {
+                d ^= (QRUtil.G18 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18)));
+            }
+            return (data << 12) | d;
+        },
+        /*
+        获取BCH位信息
+         */
+        getBCHDigit: function (data) {
+            var digit = 0;
+            while (data != 0) {
+                digit++;
+                data >>>= 1;
+            }
+            return digit;
+        },
+        /*
+        获取版本对应的矫正图形位置
+         */
+        getPatternPosition: function (typeNumber) {
+            return QRUtil.PATTERN_POSITION_TABLE[typeNumber - 1];
+        },
+        /*
+        掩膜算法
+         */
+        getMask: function (maskPattern, i, j) {
+            switch (maskPattern) {
+                case QRMaskPattern.PATTERN000:
+                    return (i + j) % 2 == 0;
+                case QRMaskPattern.PATTERN001:
+                    return i % 2 == 0;
+                case QRMaskPattern.PATTERN010:
+                    return j % 3 == 0;
+                case QRMaskPattern.PATTERN011:
+                    return (i + j) % 3 == 0;
+                case QRMaskPattern.PATTERN100:
+                    return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 == 0;
+                case QRMaskPattern.PATTERN101:
+                    return (i * j) % 2 + (i * j) % 3 == 0;
+                case QRMaskPattern.PATTERN110:
+                    return ((i * j) % 2 + (i * j) % 3) % 2 == 0;
+                case QRMaskPattern.PATTERN111:
+                    return ((i * j) % 3 + (i + j) % 2) % 2 == 0;
+                default:
+                    throw new Error("bad maskPattern:" + maskPattern);
+            }
+        },
+        /*
+        获取RS的纠错多项式
+         */
+        getErrorCorrectPolynomial: function (errorCorrectLength) {
+            var a = new QRPolynomial([1], 0);
+            for (var i = 0; i < errorCorrectLength; i++) {
+                a = a.multiply(new QRPolynomial([1, QRMath.gexp(i)], 0));
+            }
+            return a;
+        },
+        /*
+        获取评价
+         */
+        getLostPoint: function (qrCode) {
+            var moduleCount = qrCode.getModuleCount(),
+                lostPoint = 0,
+                darkCount = 0;
+            for (var row = 0; row < moduleCount; row++) {
+                var sameCount = 0;
+                var head = qrCode.modules[row][0];
+                for (var col = 0; col < moduleCount; col++) {
+                    var current = qrCode.modules[row][col];
+                    //level 3 评价
+                    if (col < moduleCount - 6) {
+                        if (current && !qrCode.modules[row][col + 1] && qrCode.modules[row][col + 2] && qrCode.modules[row][col + 3] && qrCode.modules[row][col + 4] && !qrCode.modules[row][col + 5] && qrCode.modules[row][col + 6]) {
+                            if (col < moduleCount - 10) {
+                                if (qrCode.modules[row][col + 7] && qrCode.modules[row][col + 8] && qrCode.modules[row][col + 9] && qrCode.modules[row][col + 10]) {
+                                    lostPoint += 40;
+                                }
+                            } else if (col > 3) {
+                                if (qrCode.modules[row][col - 1] && qrCode.modules[row][col - 2] && qrCode.modules[row][col - 3] && qrCode.modules[row][col - 4]) {
+                                    lostPoint += 40;
+                                }
+                            }
+                        }
+                    }
+                    //level 2 评价
+                    if ((row < moduleCount - 1) && (col < moduleCount - 1)) {
+                        var count = 0;
+                        if (current) count++;
+                        if (qrCode.modules[row + 1][col]) count++;
+                        if (qrCode.modules[row][col + 1]) count++;
+                        if (qrCode.modules[row + 1][col + 1]) count++;
+                        if (count == 0 || count == 4) {
+                            lostPoint += 3;
+                        }
+                    }
+                    //level 1 评价
+                    if (head ^ current) {
+                        sameCount++;
+                    } else {
+                        head = current;
+                        if (sameCount >= 5) {
+                            lostPoint += (3 + sameCount - 5);
+                        }
+                        sameCount = 1;
+                    }
+                    //level 4 评价
+                    if (current) {
+                        darkCount++;
+                    }
+                }
+            }
+            for (var col = 0; col < moduleCount; col++) {
+                var sameCount = 0;
+                var head = qrCode.modules[0][col];
+                for (var row = 0; row < moduleCount; row++) {
+                    var current = qrCode.modules[row][col];
+                    //level 3 评价
+                    if (row < moduleCount - 6) {
+                        if (current && !qrCode.modules[row + 1][col] && qrCode.modules[row + 2][col] && qrCode.modules[row + 3][col] && qrCode.modules[row + 4][col] && !qrCode.modules[row + 5][col] && qrCode.modules[row + 6][col]) {
+                            if (row < moduleCount - 10) {
+                                if (qrCode.modules[row + 7][col] && qrCode.modules[row + 8][col] && qrCode.modules[row + 9][col] && qrCode.modules[row + 10][col]) {
+                                    lostPoint += 40;
+                                }
+                            } else if (row > 3) {
+                                if (qrCode.modules[row - 1][col] && qrCode.modules[row - 2][col] && qrCode.modules[row - 3][col] && qrCode.modules[row - 4][col]) {
+                                    lostPoint += 40;
+                                }
+                            }
+                        }
+                    }
+                    //level 1 评价
+                    if (head ^ current) {
+                        sameCount++;
+                    } else {
+                        head = current;
+                        if (sameCount >= 5) {
+                            lostPoint += (3 + sameCount - 5);
+                        }
+                        sameCount = 1;
+                    }
+                }
+            }
+            // LEVEL4
+            var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5;
+            lostPoint += ratio * 10;
+            return lostPoint;
+        }
+
+    };
+    //---------------------------------------------------------------------
+    // QRMath使用的数学工具
+    //---------------------------------------------------------------------
+    var QRMath = {
+        /*
+        将n转化为a^m
+         */
+        glog: function (n) {
+            if (n < 1) {
+                throw new Error("glog(" + n + ")");
+            }
+            return QRMath.LOG_TABLE[n];
+        },
+        /*
+        将a^m转化为n
+         */
+        gexp: function (n) {
+            while (n < 0) {
+                n += 255;
+            }
+            while (n >= 256) {
+                n -= 255;
+            }
+            return QRMath.EXP_TABLE[n];
+        },
+        EXP_TABLE: new Array(256),
+        LOG_TABLE: new Array(256)
+
+    };
+    for (var i = 0; i < 8; i++) {
+        QRMath.EXP_TABLE[i] = 1 << i;
+    }
+    for (var i = 8; i < 256; i++) {
+        QRMath.EXP_TABLE[i] = QRMath.EXP_TABLE[i - 4] ^ QRMath.EXP_TABLE[i - 5] ^ QRMath.EXP_TABLE[i - 6] ^ QRMath.EXP_TABLE[i - 8];
+    }
+    for (var i = 0; i < 255; i++) {
+        QRMath.LOG_TABLE[QRMath.EXP_TABLE[i]] = i;
+    }
+    //---------------------------------------------------------------------
+    // QRPolynomial 多项式
+    //---------------------------------------------------------------------
+    /**
+     * 多项式类
+     * @param {Array} num   系数
+     * @param {num} shift a^shift
+     */
+    function QRPolynomial(num, shift) {
+        if (num.length == undefined) {
+            throw new Error(num.length + "/" + shift);
+        }
+        var offset = 0;
+        while (offset < num.length && num[offset] == 0) {
+            offset++;
+        }
+        this.num = new Array(num.length - offset + shift);
+        for (var i = 0; i < num.length - offset; i++) {
+            this.num[i] = num[i + offset];
+        }
+    }
+    QRPolynomial.prototype = {
+        get: function (index) {
+            return this.num[index];
+        },
+        getLength: function () {
+            return this.num.length;
+        },
+        /**
+         * 多项式乘法
+         * @param  {QRPolynomial} e 被乘多项式
+         * @return {[type]}   [description]
+         */
+        multiply: function (e) {
+            var num = new Array(this.getLength() + e.getLength() - 1);
+            for (var i = 0; i < this.getLength(); i++) {
+                for (var j = 0; j < e.getLength(); j++) {
+                    num[i + j] ^= QRMath.gexp(QRMath.glog(this.get(i)) + QRMath.glog(e.get(j)));
+                }
+            }
+            return new QRPolynomial(num, 0);
+        },
+        /**
+         * 多项式模运算
+         * @param  {QRPolynomial} e 模多项式
+         * @return {}
+         */
+        mod: function (e) {
+            var tl = this.getLength(),
+                el = e.getLength();
+            if (tl - el < 0) {
+                return this;
+            }
+            var num = new Array(tl);
+            for (var i = 0; i < tl; i++) {
+                num[i] = this.get(i);
+            }
+            while (num.length >= el) {
+                var ratio = QRMath.glog(num[0]) - QRMath.glog(e.get(0));
+
+                for (var i = 0; i < e.getLength(); i++) {
+                    num[i] ^= QRMath.gexp(QRMath.glog(e.get(i)) + ratio);
+                }
+                while (num[0] == 0) {
+                    num.shift();
+                }
+            }
+            return new QRPolynomial(num, 0);
+        }
+    };
+
+    //---------------------------------------------------------------------
+    // RS_BLOCK_TABLE
+    //---------------------------------------------------------------------
+    /*
+    二维码各个版本信息[块数, 每块中的数据块数, 每块中的信息块数]
+     */
+    var RS_BLOCK_TABLE = [
+        // L
+        // M
+        // Q
+        // H
+        // 1
+        [1, 26, 19],
+        [1, 26, 16],
+        [1, 26, 13],
+        [1, 26, 9],
+
+        // 2
+        [1, 44, 34],
+        [1, 44, 28],
+        [1, 44, 22],
+        [1, 44, 16],
+
+        // 3
+        [1, 70, 55],
+        [1, 70, 44],
+        [2, 35, 17],
+        [2, 35, 13],
+
+        // 4
+        [1, 100, 80],
+        [2, 50, 32],
+        [2, 50, 24],
+        [4, 25, 9],
+
+        // 5
+        [1, 134, 108],
+        [2, 67, 43],
+        [2, 33, 15, 2, 34, 16],
+        [2, 33, 11, 2, 34, 12],
+
+        // 6
+        [2, 86, 68],
+        [4, 43, 27],
+        [4, 43, 19],
+        [4, 43, 15],
+
+        // 7
+        [2, 98, 78],
+        [4, 49, 31],
+        [2, 32, 14, 4, 33, 15],
+        [4, 39, 13, 1, 40, 14],
+
+        // 8
+        [2, 121, 97],
+        [2, 60, 38, 2, 61, 39],
+        [4, 40, 18, 2, 41, 19],
+        [4, 40, 14, 2, 41, 15],
+
+        // 9
+        [2, 146, 116],
+        [3, 58, 36, 2, 59, 37],
+        [4, 36, 16, 4, 37, 17],
+        [4, 36, 12, 4, 37, 13],
+
+        // 10
+        [2, 86, 68, 2, 87, 69],
+        [4, 69, 43, 1, 70, 44],
+        [6, 43, 19, 2, 44, 20],
+        [6, 43, 15, 2, 44, 16],
+
+        // 11
+        [4, 101, 81],
+        [1, 80, 50, 4, 81, 51],
+        [4, 50, 22, 4, 51, 23],
+        [3, 36, 12, 8, 37, 13],
+
+        // 12
+        [2, 116, 92, 2, 117, 93],
+        [6, 58, 36, 2, 59, 37],
+        [4, 46, 20, 6, 47, 21],
+        [7, 42, 14, 4, 43, 15],
+
+        // 13
+        [4, 133, 107],
+        [8, 59, 37, 1, 60, 38],
+        [8, 44, 20, 4, 45, 21],
+        [12, 33, 11, 4, 34, 12],
+
+        // 14
+        [3, 145, 115, 1, 146, 116],
+        [4, 64, 40, 5, 65, 41],
+        [11, 36, 16, 5, 37, 17],
+        [11, 36, 12, 5, 37, 13],
+
+        // 15
+        [5, 109, 87, 1, 110, 88],
+        [5, 65, 41, 5, 66, 42],
+        [5, 54, 24, 7, 55, 25],
+        [11, 36, 12],
+
+        // 16
+        [5, 122, 98, 1, 123, 99],
+        [7, 73, 45, 3, 74, 46],
+        [15, 43, 19, 2, 44, 20],
+        [3, 45, 15, 13, 46, 16],
+
+        // 17
+        [1, 135, 107, 5, 136, 108],
+        [10, 74, 46, 1, 75, 47],
+        [1, 50, 22, 15, 51, 23],
+        [2, 42, 14, 17, 43, 15],
+
+        // 18
+        [5, 150, 120, 1, 151, 121],
+        [9, 69, 43, 4, 70, 44],
+        [17, 50, 22, 1, 51, 23],
+        [2, 42, 14, 19, 43, 15],
+
+        // 19
+        [3, 141, 113, 4, 142, 114],
+        [3, 70, 44, 11, 71, 45],
+        [17, 47, 21, 4, 48, 22],
+        [9, 39, 13, 16, 40, 14],
+
+        // 20
+        [3, 135, 107, 5, 136, 108],
+        [3, 67, 41, 13, 68, 42],
+        [15, 54, 24, 5, 55, 25],
+        [15, 43, 15, 10, 44, 16],
+
+        // 21
+        [4, 144, 116, 4, 145, 117],
+        [17, 68, 42],
+        [17, 50, 22, 6, 51, 23],
+        [19, 46, 16, 6, 47, 17],
+
+        // 22
+        [2, 139, 111, 7, 140, 112],
+        [17, 74, 46],
+        [7, 54, 24, 16, 55, 25],
+        [34, 37, 13],
+
+        // 23
+        [4, 151, 121, 5, 152, 122],
+        [4, 75, 47, 14, 76, 48],
+        [11, 54, 24, 14, 55, 25],
+        [16, 45, 15, 14, 46, 16],
+
+        // 24
+        [6, 147, 117, 4, 148, 118],
+        [6, 73, 45, 14, 74, 46],
+        [11, 54, 24, 16, 55, 25],
+        [30, 46, 16, 2, 47, 17],
+
+        // 25
+        [8, 132, 106, 4, 133, 107],
+        [8, 75, 47, 13, 76, 48],
+        [7, 54, 24, 22, 55, 25],
+        [22, 45, 15, 13, 46, 16],
+
+        // 26
+        [10, 142, 114, 2, 143, 115],
+        [19, 74, 46, 4, 75, 47],
+        [28, 50, 22, 6, 51, 23],
+        [33, 46, 16, 4, 47, 17],
+
+        // 27
+        [8, 152, 122, 4, 153, 123],
+        [22, 73, 45, 3, 74, 46],
+        [8, 53, 23, 26, 54, 24],
+        [12, 45, 15, 28, 46, 16],
+
+        // 28
+        [3, 147, 117, 10, 148, 118],
+        [3, 73, 45, 23, 74, 46],
+        [4, 54, 24, 31, 55, 25],
+        [11, 45, 15, 31, 46, 16],
+
+        // 29
+        [7, 146, 116, 7, 147, 117],
+        [21, 73, 45, 7, 74, 46],
+        [1, 53, 23, 37, 54, 24],
+        [19, 45, 15, 26, 46, 16],
+
+        // 30
+        [5, 145, 115, 10, 146, 116],
+        [19, 75, 47, 10, 76, 48],
+        [15, 54, 24, 25, 55, 25],
+        [23, 45, 15, 25, 46, 16],
+
+        // 31
+        [13, 145, 115, 3, 146, 116],
+        [2, 74, 46, 29, 75, 47],
+        [42, 54, 24, 1, 55, 25],
+        [23, 45, 15, 28, 46, 16],
+
+        // 32
+        [17, 145, 115],
+        [10, 74, 46, 23, 75, 47],
+        [10, 54, 24, 35, 55, 25],
+        [19, 45, 15, 35, 46, 16],
+
+        // 33
+        [17, 145, 115, 1, 146, 116],
+        [14, 74, 46, 21, 75, 47],
+        [29, 54, 24, 19, 55, 25],
+        [11, 45, 15, 46, 46, 16],
+
+        // 34
+        [13, 145, 115, 6, 146, 116],
+        [14, 74, 46, 23, 75, 47],
+        [44, 54, 24, 7, 55, 25],
+        [59, 46, 16, 1, 47, 17],
+
+        // 35
+        [12, 151, 121, 7, 152, 122],
+        [12, 75, 47, 26, 76, 48],
+        [39, 54, 24, 14, 55, 25],
+        [22, 45, 15, 41, 46, 16],
+
+        // 36
+        [6, 151, 121, 14, 152, 122],
+        [6, 75, 47, 34, 76, 48],
+        [46, 54, 24, 10, 55, 25],
+        [2, 45, 15, 64, 46, 16],
+
+        // 37
+        [17, 152, 122, 4, 153, 123],
+        [29, 74, 46, 14, 75, 47],
+        [49, 54, 24, 10, 55, 25],
+        [24, 45, 15, 46, 46, 16],
+
+        // 38
+        [4, 152, 122, 18, 153, 123],
+        [13, 74, 46, 32, 75, 47],
+        [48, 54, 24, 14, 55, 25],
+        [42, 45, 15, 32, 46, 16],
+
+        // 39
+        [20, 147, 117, 4, 148, 118],
+        [40, 75, 47, 7, 76, 48],
+        [43, 54, 24, 22, 55, 25],
+        [10, 45, 15, 67, 46, 16],
+
+        // 40
+        [19, 148, 118, 6, 149, 119],
+        [18, 75, 47, 31, 76, 48],
+        [34, 54, 24, 34, 55, 25],
+        [20, 45, 15, 61, 46, 16]
+    ];
+
+    /**
+     * 根据数据获取对应版本
+     * @return {[type]} [description]
+     */
+    QRCodeAlg.prototype.getRightType = function () {
+        for (var typeNumber = 1; typeNumber < 41; typeNumber++) {
+            var rsBlock = RS_BLOCK_TABLE[(typeNumber - 1) * 4 + this.errorCorrectLevel];
+            if (rsBlock == undefined) {
+                throw new Error("bad rs block @ typeNumber:" + typeNumber + "/errorCorrectLevel:" + this.errorCorrectLevel);
+            }
+            var length = rsBlock.length / 3;
+            var totalDataCount = 0;
+            for (var i = 0; i < length; i++) {
+                var count = rsBlock[i * 3 + 0];
+                var dataCount = rsBlock[i * 3 + 2];
+                totalDataCount += dataCount * count;
+            }
+            var lengthBytes = typeNumber > 9 ? 2 : 1;
+            if (this.utf8bytes.length + lengthBytes < totalDataCount || typeNumber == 40) {
+                this.typeNumber = typeNumber;
+                this.rsBlock = rsBlock;
+                this.totalDataCount = totalDataCount;
+                break;
+            }
+        }
+    };
+
+    //---------------------------------------------------------------------
+    // QRBitBuffer
+    //---------------------------------------------------------------------
+    function QRBitBuffer() {
+        this.buffer = new Array();
+        this.length = 0;
+    }
+    QRBitBuffer.prototype = {
+        get: function (index) {
+            var bufIndex = Math.floor(index / 8);
+            return ((this.buffer[bufIndex] >>> (7 - index % 8)) & 1);
+        },
+        put: function (num, length) {
+            for (var i = 0; i < length; i++) {
+                this.putBit(((num >>> (length - i - 1)) & 1));
+            }
+        },
+        putBit: function (bit) {
+            var bufIndex = Math.floor(this.length / 8);
+            if (this.buffer.length <= bufIndex) {
+                this.buffer.push(0);
+            }
+            if (bit) {
+                this.buffer[bufIndex] |= (0x80 >>> (this.length % 8));
+            }
+            this.length++;
+        }
+    };
+
+
+
+    // xzedit
+    let qrcodeAlgObjCache = [];
+    /**
+     * 二维码构造函数,主要用于绘制
+     * @param  {参数列表} opt 传递参数
+     * @return {}
+     */
+    QRCode = function (opt) {
+        //设置默认参数
+        this.options = {
+            text: '',
+            size: 256,
+            correctLevel: 3,
+            background: '#ffffff',
+            foreground: '#000000',
+            pdground: '#000000',
+            image: '',
+            imageSize: 30,
+            canvasId: opt.canvasId,
+            context: opt.context,
+            usingComponents: opt.usingComponents,
+            showLoading: opt.showLoading,
+            loadingText: opt.loadingText,
+        };
+        if (typeof opt === 'string') { // 只编码ASCII字符串
+            opt = {
+                text: opt
+            };
+        }
+        if (opt) {
+            for (var i in opt) {
+                this.options[i] = opt[i];
+            }
+        }
+        //使用QRCodeAlg创建二维码结构
+        var qrCodeAlg = null;
+        for (var i = 0, l = qrcodeAlgObjCache.length; i < l; i++) {
+            if (qrcodeAlgObjCache[i].text == this.options.text && qrcodeAlgObjCache[i].text.correctLevel == this.options.correctLevel) {
+                qrCodeAlg = qrcodeAlgObjCache[i].obj;
+                break;
+            }
+        }
+        if (i == l) {
+            qrCodeAlg = new QRCodeAlg(this.options.text, this.options.correctLevel);
+            qrcodeAlgObjCache.push({
+                text: this.options.text,
+                correctLevel: this.options.correctLevel,
+                obj: qrCodeAlg
+            });
+        }
+        /**
+         * 计算矩阵点的前景色
+         * @param {Obj} config
+         * @param {Number} config.row 点x坐标
+         * @param {Number} config.col 点y坐标
+         * @param {Number} config.count 矩阵大小
+         * @param {Number} config.options 组件的options
+         * @return {String}
+         */
+        let getForeGround = function (config) {
+            var options = config.options;
+            if (options.pdground && (
+                (config.row > 1 && config.row < 5 && config.col > 1 && config.col < 5) ||
+                (config.row > (config.count - 6) && config.row < (config.count - 2) && config.col > 1 && config.col < 5) ||
+                (config.row > 1 && config.row < 5 && config.col > (config.count - 6) && config.col < (config.count - 2))
+            )) {
+                return options.pdground;
+            }
+            return options.foreground;
+        }
+        // 创建canvas
+        let createCanvas = function (options) {
+            if (options.showLoading) {
+                uni.showLoading({
+                    title: options.loadingText,
+                    mask: true
+                });
+            }
+            var ctx = uni.createCanvasContext(options.canvasId, options.context);
+            var count = qrCodeAlg.getModuleCount();
+            var ratioSize = options.size;
+            var ratioImgSize = options.imageSize;
+            //计算每个点的长宽
+            var tileW = (ratioSize / count).toPrecision(4);
+            var tileH = (ratioSize / count).toPrecision(4);
+            //绘制
+            for (var row = 0; row < count; row++) {
+                for (var col = 0; col < count; col++) {
+                    var w = (Math.ceil((col + 1) * tileW) - Math.floor(col * tileW));
+                    var h = (Math.ceil((row + 1) * tileW) - Math.floor(row * tileW));
+                    var foreground = getForeGround({
+                        row: row,
+                        col: col,
+                        count: count,
+                        options: options
+                    });
+                    ctx.setFillStyle(qrCodeAlg.modules[row][col] ? foreground : options.background);
+                    ctx.fillRect(Math.round(col * tileW), Math.round(row * tileH), w, h);
+                }
+            }
+            if (options.image) {
+                var x = Number(((ratioSize - ratioImgSize) / 2).toFixed(2));
+                var y = Number(((ratioSize - ratioImgSize) / 2).toFixed(2));
+                drawRoundedRect(ctx, x, y, ratioImgSize, ratioImgSize, 2, 6, true, true)
+                ctx.drawImage(options.image, x, y, ratioImgSize, ratioImgSize);
+                // 画圆角矩形
+                function drawRoundedRect(ctxi, x, y, width, height, r, lineWidth, fill, stroke) {
+                    ctxi.setLineWidth(lineWidth);
+                    ctxi.setFillStyle(options.background);
+                    ctxi.setStrokeStyle(options.background);
+                    ctxi.beginPath(); // draw top and top right corner 
+                    ctxi.moveTo(x + r, y);
+                    ctxi.arcTo(x + width, y, x + width, y + r, r); // draw right side and bottom right corner 
+                    ctxi.arcTo(x + width, y + height, x + width - r, y + height, r); // draw bottom and bottom left corner 
+                    ctxi.arcTo(x, y + height, x, y + height - r, r); // draw left and top left corner 
+                    ctxi.arcTo(x, y, x + r, y, r);
+                    ctxi.closePath();
+                    if (fill) {
+                        ctxi.fill();
+                    }
+                    if (stroke) {
+                        ctxi.stroke();
+                    }
+                }
+            }
+            setTimeout(() => {
+                ctx.draw(true, () => {
+                    // 保存到临时区域
+                    setTimeout(() => {
+                        uni.canvasToTempFilePath({
+                            width: options.width,
+                            height: options.height,
+                            destWidth: options.width,
+                            destHeight: options.height,
+                            canvasId: options.canvasId,
+                            quality: Number(1),
+                            success: function (res) {
+                                if (options.cbResult) {
+                                    options.cbResult(res.tempFilePath)
+                                }
+                            },
+                            fail: function (res) {
+                                if (options.cbResult) {
+                                    options.cbResult(res)
+                                }
+                            },
+                            complete: function () {
+                                if (options.showLoading){
+                                    uni.hideLoading();
+                                }
+                            },
+                        }, options.context);
+                    }, options.text.length + 100);
+                });
+            }, options.usingComponents ? 0 : 150);
+        }
+        createCanvas(this.options);
+        // 空判定
+        let empty = function (v) {
+            let tp = typeof v,
+                rt = false;
+            if (tp == "number" && String(v) == "") {
+                rt = true
+            } else if (tp == "undefined") {
+                rt = true
+            } else if (tp == "object") {
+                if (JSON.stringify(v) == "{}" || JSON.stringify(v) == "[]" || v == null) rt = true
+            } else if (tp == "string") {
+                if (v == "" || v == "undefined" || v == "null" || v == "{}" || v == "[]") rt = true
+            } else if (tp == "function") {
+                rt = false
+            }
+            return rt
+        }
+    };
+    QRCode.prototype.clear = function (fn) {
+        var ctx = uni.createCanvasContext(this.options.canvasId, this.options.context)
+        ctx.clearRect(0, 0, this.options.size, this.options.size)
+        ctx.draw(false, () => {
+            if (fn) {
+                fn()
+            }
+        })
+    };
+})()
+
+export default QRCode

+ 212 - 0
components/tki-qrcode/tki-qrcode.vue

@@ -0,0 +1,212 @@
+<template xlang="wxml" minapp="mpvue">
+	<view class="tki-qrcode">
+		<!-- #ifndef MP-ALIPAY -->
+		<canvas class="tki-qrcode-canvas" :canvas-id="cid" :style="{width:cpSize+'px',height:cpSize+'px'}" />
+		<!-- #endif -->
+		<!-- #ifdef MP-ALIPAY -->
+		<canvas :id="cid" :width="cpSize" :height="cpSize" class="tki-qrcode-canvas" />
+		<!-- #endif -->
+		<image v-show="show" :src="result" :style="{width:cpSize+'px',height:cpSize+'px'}" />
+	</view>
+</template>
+
+<script>
+import QRCode from "./qrcode.js"
+let qrcode
+export default {
+	name: "tki-qrcode",
+	props: {
+		cid: {
+			type: String,
+			default: 'tki-qrcode-canvas'
+		},
+		size: {
+			type: Number,
+			default: 200
+		},
+		unit: {
+			type: String,
+			default: 'upx'
+		},
+		show: {
+			type: Boolean,
+			default: true
+		},
+		val: {
+			type: String,
+			default: ''
+		},
+		background: {
+			type: String,
+			default: '#ffffff'
+		},
+		foreground: {
+			type: String,
+			default: '#000000'
+		},
+		pdground: {
+			type: String,
+			default: '#000000'
+		},
+		icon: {
+			type: String,
+			default: ''
+		},
+		iconSize: {
+			type: Number,
+			default: 40
+		},
+		lv: {
+			type: Number,
+			default: 3
+		},
+		onval: {
+			type: Boolean,
+			default: false
+		},
+		loadMake: {
+			type: Boolean,
+			default: false
+		},
+		usingComponents: {
+			type: Boolean,
+			default: true
+		},
+		showLoading: {
+			type: Boolean,
+			default: true
+		},
+		loadingText: {
+			type: String,
+			default: '二维码生成中'
+		},
+	},
+	data() {
+		return {
+			result: '',
+		}
+	},
+	methods: {
+		_makeCode() {
+			let that = this
+			if (!this._empty(this.val)) {
+				qrcode = new QRCode({
+					context: that, // 上下文环境
+					canvasId:that.cid, // canvas-id
+					usingComponents: that.usingComponents, // 是否是自定义组件
+					showLoading: that.showLoading, // 是否显示loading
+					loadingText: that.loadingText, // loading文字
+					text: that.val, // 生成内容
+					size: that.cpSize, // 二维码大小
+					background: that.background, // 背景色
+					foreground: that.foreground, // 前景色
+					pdground: that.pdground, // 定位角点颜色
+					correctLevel: that.lv, // 容错级别
+					image: that.icon, // 二维码图标
+					imageSize: that.iconSize,// 二维码图标大小
+					cbResult: function (res) { // 生成二维码的回调
+						that._result(res)
+					},
+				});
+			} else {
+				uni.showToast({
+					title: '二维码内容不能为空',
+					icon: 'none',
+					duration: 2000,
+					icon:'none'
+				});
+			}
+		},
+		_clearCode() {
+			this._result('')
+			qrcode.clear()
+		},
+		_saveCode() {
+			let that = this;
+			if (this.result != "") {
+				uni.saveImageToPhotosAlbum({
+					filePath: that.result,
+					success: function () {
+						uni.showToast({
+							title: '二维码保存成功',
+							icon: 'success',
+							duration: 2000,
+							icon:'none'
+						});
+					}
+				});
+			}
+		},
+		_result(res) {
+			this.result = res;
+			this.$emit('result', res)
+		},
+		_empty(v) {
+			let tp = typeof v,
+				rt = false;
+			if (tp == "number" && String(v) == "") {
+				rt = true
+			} else if (tp == "undefined") {
+				rt = true
+			} else if (tp == "object") {
+				if (JSON.stringify(v) == "{}" || JSON.stringify(v) == "[]" || v == null) rt = true
+			} else if (tp == "string") {
+				if (v == "" || v == "undefined" || v == "null" || v == "{}" || v == "[]") rt = true
+			} else if (tp == "function") {
+				rt = false
+			}
+			return rt
+		}
+	},
+	watch: {
+		size: function (n, o) {
+			if (n != o && !this._empty(n)) {
+				this.cSize = n
+				if (!this._empty(this.val)) {
+					setTimeout(() => {
+						this._makeCode()
+					}, 100);
+				}
+			}
+		},
+		val: function (n, o) {
+			if (this.onval) {
+				if (n != o && !this._empty(n)) {
+					setTimeout(() => {
+						this._makeCode()
+					}, 0);
+				}
+			}
+		}
+	},
+	computed: {
+		cpSize() {
+			if(this.unit == "upx"){
+				return uni.upx2px(this.size)
+			}else{
+				return this.size
+			}
+		}
+	},
+	mounted: function () {
+		if (this.loadMake) {
+			if (!this._empty(this.val)) {
+				setTimeout(() => {
+					this._makeCode()
+				}, 0);
+			}
+		}
+	},
+}
+</script>
+<style>
+.tki-qrcode {
+  position: relative;
+}
+.tki-qrcode-canvas {
+  position: fixed;
+  top: -99999upx;
+  left: -99999upx;
+  z-index: -99999;
+}
+</style>

+ 2 - 2
manifest.json

@@ -1,5 +1,5 @@
 {
-    "name" : "租",
+    "name" : "卡羚能租",
     "appid" : "__UNI__F0EBD91",
     "description" : "",
     "versionName" : "1.0.19",
@@ -173,7 +173,7 @@
         "requiredBackgroundModes" : [ "location" ]
     },
     "h5" : {
-        "title" : "绿津",
+        "title" : "卡羚能租",
         "domain" : "",
         "router" : {
             "base" : "/index/",

+ 19 - 7
pages.json

@@ -8,7 +8,7 @@
 					"titleNView": false
 				},
 				// #endif
-				"navigationBarTitleText": "租"
+				"navigationBarTitleText": "卡羚能租"
 			}
 		},
 		{
@@ -125,11 +125,17 @@
 						"navigationBarTitleText": "申请退款"
 					}
 				},
-				{
-					"path": "createOrder",
-					"style": {
-						"navigationBarTitleText": "创建订单"
-					}
+				{
+					"path": "createOrder",
+					"style": {
+						"navigationBarTitleText": "创建订单"
+					}
+				},
+				{
+					"path": "hxqm",
+					"style": {
+						"navigationBarTitleText": "券码"
+					}
 				}
 			]
 		},
@@ -253,6 +259,12 @@
 					"style": {
 						"navigationBarTitleText": "邀请好友"
 					}
+				},
+				{
+					"path": "myRent",
+					"style": {
+						"navigationBarTitleText": "我的电池"
+					}
 				}
 
 			]
@@ -394,7 +406,7 @@
 	],
 	"globalStyle": {
 		"navigationBarTextStyle": "black",
-		"navigationBarTitleText": "uni-app",
+		"navigationBarTitleText": "卡羚能租",
 		"navigationBarBackgroundColor": "#FFFFFF",
 		"backgroundColor": "#f8f8f8"
 	},

+ 476 - 417
pages/index/index.vue

@@ -1,427 +1,486 @@
-<template>
-	<view class="container">
-		<view class="status_bar"></view>
-		<!-- 轮播图 start -->
-		<swiper class="top-swiper" autoplay="true" duration="400" interval="5000" @change="swiperChange">
-			<swiper-item v-for="(item, index) in carouselList" :key="index" class="carousel-item"
-				@click="bannerNavToUrl(item)">
-				<image :src="item.pic" />
-			</swiper-item>
-		</swiper>
-		<!-- 轮播图 end -->
-		<!-- 认证提示 statr-->
-		<view class="rznow flex">
-			<view class="rztit">
-				您尚未完成身份认证,前往认证>>
-			</view>
-			<view class="rzbtn" @click="navTo('/pages/shop/attestation')">
-				立即认证
-			</view>
-		</view>
-		<!-- 认证提示 ed-->
-		<!-- 功能区 start-->
-		<view class="gn-wrap flex">
-			<view class="gn-icon flex">
-				<image src="../../static/icon/in1.png" mode="heightFix"></image>
-			</view>
-			<view class="gn-tit">
-				<view class="">
-					租电
-				</view>
-				<view class="tit-jj">
-					以租代购 方便省钱
-				</view>
-			</view>
-			<view class="gn-btn" @click="navTo('/pages/shop/rent')">
-				立即租电
-			</view>
-		</view>
-		<view class="gn-wrap flex">
-			<view class="gn-icon flex">
-				<image src="../../static/icon/in2.png" mode="heightFix"></image>
-			</view>
-			<view class="gn-tit">
-				<view class="">
-					配件购买
-				</view>
-				<view class="tit-jj">
-					扫码租电
-				</view>
-			</view>
-			<view class="gn-btn" @click="navTo('/pages/shop/accessory')">
-				立即购买
-			</view>
-		</view>
-		<!-- 功能区 ed-->
-		<!-- 附近门店 start -->
-		<view class="fjmd" @click="navTo('/pages/shop/shopTab')">
-			<image src="../../static/img/md.png" mode=""></image>
-		</view>
-		<!-- 附近门店 end -->
-		<!-- 使用攻略 start -->
-		<view class="sygl">
-			<view class="sy-top">
-				<image src="../../static/icon/gl-top.png" mode=""></image>
-				<view class="top-tit">
-					使用攻略
-				</view>
-			</view>
-			<view class="sy-content flex">
-				<view class="content-item flex">
-					<image src="../../static/icon/sy1.png" mode="" class="sy-icon"></image>
-					<view class="">
-						注册账号
-					</view>
-				</view>
-				<image src="../../static/icon/jt.png" mode="" class="jt"></image>
-				<view class="content-item flex">
-					<image src="../../static/icon/sy2.png" mode="" class="sy-icon"></image>
-					<view class="">
-						实名认证
-					</view>
-				</view>
-				
-				<image src="../../static/icon/jt.png" mode="" class="jt"></image>
-				<view class="content-item flex">
-					<image src="../../static/icon/sy3.png" mode="" class="sy-icon"></image>
-					<view class="">
-						购买租电
-					</view>
-				</view>
-				
-				<image src="../../static/icon/jt.png" mode="" class="jt"></image>
-				<view class="content-item flex">
-					<image src="../../static/icon/sy4.png" mode="" class="sy-icon"></image>
-					<view class="">
-						开始使用
-					</view>
-				</view>
-				
-			</view>
-		</view>
-		<!-- 使用攻略 ed-->
-	</view>
-</template>
-
-<script>
-	import { loadIndexs } from '@/api/index.js'
-	export default {
-
-		data() {
+<template>
+	<view class="container">
+		<view class="status_bar"></view>
+		<!-- 轮播图 start -->
+		<swiper class="top-swiper" autoplay="true" duration="400" interval="5000" @change="swiperChange">
+			<swiper-item v-for="(item, index) in carouselList" :key="index" class="carousel-item"
+				@click="bannerNavToUrl(item)">
+				<image :src="item.pic" />
+			</swiper-item>
+		</swiper>
+		<!-- 轮播图 end -->
+		<!-- 认证提示 statr-->
+		<view class="rznow flex" v-if="userInfo && userInfo.is_real == 0">
+			<view class="rztit">
+				您尚未完成身份认证,前往认证>>
+			</view>
+			<view class="rzbtn" @click="navTo('/pages/shop/attestation')">
+				立即认证
+			</view>
+		</view>
+		<!-- 认证提示 ed-->
+		<!-- 功能区 start-->
+		<view class="gn-wrap flex">
+			<view class="gn-icon flex">
+				<image src="../../static/icon/in1.png" mode="heightFix"></image>
+			</view>
+			<view class="gn-tit">
+				<view class="">
+					租电
+				</view>
+				<view class="tit-jj">
+					以租代购 方便省钱
+				</view>
+			</view>
+			<view class="gn-btn" @click="navTo('/pages/shop/rent',1)">
+				立即租电
+			</view>
+		</view>
+		<view class="gn-wrap flex">
+			<view class="gn-icon flex">
+				<image src="../../static/icon/in2.png" mode="heightFix"></image>
+			</view>
+			<view class="gn-tit">
+				<view class="">
+					配件购买
+				</view>
+				<view class="tit-jj">
+					扫码租电
+				</view>
+			</view>
+			<view class="gn-btn" @click="navTo('/pages/shop/accessory')">
+				立即购买
+			</view>
+		</view>
+		<!-- 功能区 ed-->
+		<!-- 附近门店 start -->
+		<view class="fjmd" @click="navTo('/pages/shop/shopTab')">
+			<image src="../../static/img/md.png" mode=""></image>
+		</view>
+		<!-- 附近门店 end -->
+		<!-- 使用攻略 start -->
+		<view class="sygl">
+			<view class="sy-top">
+				<image src="../../static/icon/gl-top.png" mode=""></image>
+				<view class="top-tit">
+					使用攻略
+				</view>
+			</view>
+			<view class="sy-content flex">
+				<view class="content-item flex">
+					<image src="../../static/icon/sy1.png" mode="" class="sy-icon"></image>
+					<view class="">
+						注册账号
+					</view>
+				</view>
+				<image src="../../static/icon/jt.png" mode="" class="jt"></image>
+				<view class="content-item flex">
+					<image src="../../static/icon/sy2.png" mode="" class="sy-icon"></image>
+					<view class="">
+						实名认证
+					</view>
+				</view>
+
+				<image src="../../static/icon/jt.png" mode="" class="jt"></image>
+				<view class="content-item flex">
+					<image src="../../static/icon/sy3.png" mode="" class="sy-icon"></image>
+					<view class="">
+						购买租电
+					</view>
+				</view>
+
+				<image src="../../static/icon/jt.png" mode="" class="jt"></image>
+				<view class="content-item flex">
+					<image src="../../static/icon/sy4.png" mode="" class="sy-icon"></image>
+					<view class="">
+						开始使用
+					</view>
+				</view>
+
+			</view>
+		</view>
+		<!-- 使用攻略 ed-->
+	</view>
+</template>
+
+<script>
+	import {
+		saveUrl,
+		interceptor
+	} from '@/utils/loginUtils.js';
+	import {
+		loadIndexs
+	} from '@/api/index.js'
+	import {
+		mapState
+	} from "vuex"
+	export default {
+
+		data() {
 			return {
-				carouselList: [],//轮播图
-				
-			};
-		},
-		computed: {
-
-		},
-		// 切换或显示后变动tabbar颜色
-		onHide() {
-
-		},
-		onLoad: function(option) {
-			// #ifndef MP
-			if (option.spread) {
-				// 存储其他邀请人
-				uni.setStorageSync('spread', option.spread);
-			}
-			// #endif
-			// #ifdef MP
-			if (option.scene) {
-				// 存储小程序邀请人
-				uni.setStorage({
-					key: 'spread_code',
-					data: option.scene
-				});
-			}
-			// #endif
-		},
-		onShow() {
-			this.getIndex()
-		},
-		onReady() {
-
-		},
-		// #ifdef MP
-		onShareAppMessage(options) {
-			// 设置菜单中的转发按钮触发转发事件时的转发内容
-			let pages = getCurrentPages(); //获取加载的页面
-			let currentPage = pages[pages.length - 1]; //获取当前页面的对象
-			let url = currentPage.route; //当前页面url
-			let item = currentPage.options; //如果要获取url中所带的参数可以查看options
-			let shareObj = {
-				title: '租电', // 默认是小程序的名称(可以写slogan等)
-				path: url, // 默认是当前页面,必须是以‘/’开头的完整路径
-				imageUrl: '',
-				desc:'',
-				success: function(res) {
-					// 转发成功之后的回调
-					if (res.errMsg == 'shareAppMessage:ok') {}
-				},
-				fail: function() {
-					// 转发失败之后的回调
-					if (res.errMsg == 'shareAppMessage:fail cancel') {
-						// 用户取消转发
-					} else if (res.errMsg == 'shareAppMessage:fail') {
-						// 转发失败,其中 detail message 为详细失败信息
-					}
-				}
-			};
-			// 判断是否可以邀请
-			// if (this.userInfo.uid) {
-			// 	shareObj.path += '&spread=' + this.userInfo.uid;
-			// }
-			return shareObj;
-		},
-		// #endif
+				carouselList: [], //轮播图
+
+			};
+		},
+		computed: {
+			...mapState('user', ['userInfo', 'hasLogin']),
+		},
+		// 切换或显示后变动tabbar颜色
+		onHide() {
+
+		},
+		onLoad: function(option) {
+			// #ifndef MP
+			if (option.spread) {
+				// 存储其他邀请人
+				uni.setStorageSync('spread', option.spread);
+			}
+			// #endif
+			// #ifdef MP
+			if (option.scene) {
+				// 存储小程序邀请人
+				uni.setStorage({
+					key: 'spread_code',
+					data: option.scene
+				});
+			}
+			// #endif
+		},
+		onShow() {
+			this.getIndex()
+		},
+		onReady() {
+
+		},
+		// #ifdef MP
+		onShareAppMessage(options) {
+			// 设置菜单中的转发按钮触发转发事件时的转发内容
+			let pages = getCurrentPages(); //获取加载的页面
+			let currentPage = pages[pages.length - 1]; //获取当前页面的对象
+			let url = currentPage.route; //当前页面url
+			let item = currentPage.options; //如果要获取url中所带的参数可以查看options
+			let shareObj = {
+				title: '租电', // 默认是小程序的名称(可以写slogan等)
+				path: url, // 默认是当前页面,必须是以‘/’开头的完整路径
+				imageUrl: '',
+				desc: '',
+				success: function(res) {
+					// 转发成功之后的回调
+					if (res.errMsg == 'shareAppMessage:ok') {}
+				},
+				fail: function() {
+					// 转发失败之后的回调
+					if (res.errMsg == 'shareAppMessage:fail cancel') {
+						// 用户取消转发
+					} else if (res.errMsg == 'shareAppMessage:fail') {
+						// 转发失败,其中 detail message 为详细失败信息
+					}
+				}
+			};
+			// 判断是否可以邀请
+			// if (this.userInfo.uid) {
+			// 	shareObj.path += '&spread=' + this.userInfo.uid;
+			// }
+			return shareObj;
+		},
+		// #endif
 		methods: {
 			getIndex() {
 				loadIndexs().then(res => {
-					
+					this.carouselList = res.data.banner
 				})
 			},
-			navTo(url) {
-				if(url.indexOf('http') != -1 ) {
-					window.location.href = url
-				}else {
-					uni.navigateTo({
-						url,
-						fail() {
-							uni.switchTab({
-								url
+			navTo(url, ind = 0) {
+				if (ind == 1) {
+					if (!this.hasLogin) {
+						// 保存地址
+						saveUrl();
+						// 登录拦截
+						interceptor();
+					} else {
+						if (this.userInfo.is_real == 1) {
+							uni.navigateTo({
+								url,
+								fail(e) {
+									console.log(e);
+								}
+							});
+
+						} else {
+							uni.showModal({
+								title: '提示',
+								content: '您当前未进行实名认证,是否立即实名认证?',
+								complete(res) {
+									if (res.confirm) {
+										uni.navigateTo({
+											url: '/pages/shop/attestation'
+										})
+									}
+								}
 							})
 						}
-					})
+
+					}
+				} else {
+					if (url.indexOf('http') != -1) {
+						window.location.href = url
+					} else {
+						uni.navigateTo({
+							url,
+							fail() {
+								uni.switchTab({
+									url
+								})
+							}
+						})
+					}
 				}
+
 			},
-			
-		}
-	};
-</script>
-
-<style lang="scss">
-	page {
-		background: #ffff;
-		min-height: 100%;
-		height: auto;
-	}
-
-	// 顶部搜索
-	.top-search {
-		height: 80rpx;
-		padding: 0 20rpx;
-		background-color: #fff;
-
-		.top-logo {
-			width: 50rpx;
-			// height: 50rpx;
-			margin-right: 10rpx;
-
-			image {
-				width: 48rpx;
-			}
-
-		}
-
-		.search-box {
-			justify-content: center;
-			width: 698rpx;
-			height: 60rpx;
-			background: #EEEEEE;
-			// box-shadow: 0px 10rpx 20rpx 0px rgba(4, 114, 69, 0.22);
-			border-radius: 30rpx;
-
-			.search {
-				width: 34rpx;
-				height: 34rpx;
-			}
-
-			.search-font {
-				margin-left: 14rpx;
-				font-size: 28rpx;
-				font-family: PingFang SC;
-				font-weight: 500;
-				color: #CBCBCB;
-			}
-		}
-	}
-
-	// 顶部轮播图
-	.top-swiper {
-		width: 750rpx;
-		height: 473rpx;
-
-		// margin: 20rpx 0 0;
-		image {
-			width: 750rpx;
-			height: 473rpx;
-		}
-	}
-
-	.jg {
-		height: 20rpx;
-		background: #F8F8F8;
-	}
-
-	// 分类
-	.cate-section {
-		justify-content: space-around;
-		background-color: #fff;
-		padding: 0rpx 0 30rpx;
-
-		.cate-item {
-			flex-grow: 0;
-			width: 20%;
-			flex-direction: column;
-			text-align: center;
-			align-items: center;
-			justify-content: center;
-
-			.img-wrapper {
-				width: 112rpx;
-				height: 112rpx;
-				border-radius: 20rpx;
-				position: relative;
-
-				image {
-					width: 112rpx;
-					height: 112rpx;
-					position: absolute;
-					left: 50%;
-					top: 50%;
-					transform: translate(-50%, -50%);
-				}
-			}
-
-			.item-title {
-				margin-top: 15rpx;
-				font-size: 26rpx;
-				font-weight: 500;
-				color: #666666;
-			}
-		}
-	}
-
-	.rznow {
-		font-weight: 500;
-		font-size: 26rpx;
-		color: #FFFFFF;
-		background-color: #78797a;
-		height: 74rpx;
-		padding: 0 42rpx 0 52rpx;
-		.rztit {
-			line-height: 74rpx;
-		}
-		.rzbtn {
-			width: 127rpx;
-			height: 47rpx;
-			text-align: center;
-			line-height: 47rpx;
-			background: #35d9b7;
-			border-radius: 24rpx;
-			font-size: 22rpx;
-		}
-	}
-	.gn-wrap {
-		margin: 45rpx auto;
-		width: 670rpx;
-		height: 219rpx;
-		background: #FFFFFF;
-		box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(50,50,52,0.06);
-		border-radius: 30rpx;
-		padding-right: 47rpx;
-		.gn-icon {
-			flex-shrink: 0;
-			width: 210rpx;
-			height: 100%;
-			justify-content: center;
-			image {
-				height: 112rpx;
-			}
-		}
-		.gn-tit {
-			flex-grow: 1;
-			font-weight: bold;
-			color: #333333;
-			font-size: 36rpx;
-			flex-direction: column;
-			justify-content: center;
-			align-items: flex-start;
-			.tit-jj {
-				font-size: 25rpx;
-				font-weight: 500;
-				color: #666666;
-				padding-top: 32rpx;
-			}
-		}
-		.gn-btn {
-			flex-shrink: 0;
-			width: 127rpx;
-			border: 1px solid $base-color;
-			border-radius: 28rpx;
-			font-size: 25rpx;
-			font-weight: 500;
-			color: $base-color;
-			line-height: 55rpx;
-			text-align: center;
-		}
-	}
-	.fjmd {
-		width: 708rpx;
-		height: 233rpx;
-		margin: 20rpx auto;
-		image {
-			width: 100%;
-			height: 100%;
-		}
-	}
-	.sygl {
-		.sy-top {
-			position: relative;
-			height: 100rpx;
-			image {
-				width: 369rpx;
-				height: 8rpx;
-				position: absolute;
-				top: 0;
-				bottom: 0;
-				left: 0;
-				right: 0;
-				margin: auto;
-			}
-			.top-tit {
-				font-size: 32rpx;
-				font-weight: bold;
-				color: #4A2723;
-				text-align: center;
-				line-height: 100rpx;
-			}
-			
-		}
-		.sy-content {
-			padding: 0 10rpx 65rpx ;
-			.content-item {
-				flex-grow: 1;
-				flex-direction: column;
-				justify-content: center;
-				align-items: center;
-				font-size: 22rpx;
-				font-weight: 500;
-				color: #4A2723;
-			}
-			.sy-icon {
-				width: 90rpx;
-				height: 90rpx;
-				margin-bottom: 15rpx;
-			}
-			.jt {
-				flex-shrink: 0;
-				width: 14rpx;
-				height: 15rpx;
-				margin-top: 40rpx;
-				align-self: flex-start;
-			}
-		}
-	}
-</style>
+
+		}
+	};
+</script>
+
+<style lang="scss">
+	page {
+		background: #ffff;
+		min-height: 100%;
+		height: auto;
+	}
+
+	// 顶部搜索
+	.top-search {
+		height: 80rpx;
+		padding: 0 20rpx;
+		background-color: #fff;
+
+		.top-logo {
+			width: 50rpx;
+			// height: 50rpx;
+			margin-right: 10rpx;
+
+			image {
+				width: 48rpx;
+			}
+
+		}
+
+		.search-box {
+			justify-content: center;
+			width: 698rpx;
+			height: 60rpx;
+			background: #EEEEEE;
+			// box-shadow: 0px 10rpx 20rpx 0px rgba(4, 114, 69, 0.22);
+			border-radius: 30rpx;
+
+			.search {
+				width: 34rpx;
+				height: 34rpx;
+			}
+
+			.search-font {
+				margin-left: 14rpx;
+				font-size: 28rpx;
+				font-family: PingFang SC;
+				font-weight: 500;
+				color: #CBCBCB;
+			}
+		}
+	}
+
+	// 顶部轮播图
+	.top-swiper {
+		width: 750rpx;
+		height: 473rpx;
+
+		// margin: 20rpx 0 0;
+		image {
+			width: 750rpx;
+			height: 473rpx;
+		}
+	}
+
+	.jg {
+		height: 20rpx;
+		background: #F8F8F8;
+	}
+
+	// 分类
+	.cate-section {
+		justify-content: space-around;
+		background-color: #fff;
+		padding: 0rpx 0 30rpx;
+
+		.cate-item {
+			flex-grow: 0;
+			width: 20%;
+			flex-direction: column;
+			text-align: center;
+			align-items: center;
+			justify-content: center;
+
+			.img-wrapper {
+				width: 112rpx;
+				height: 112rpx;
+				border-radius: 20rpx;
+				position: relative;
+
+				image {
+					width: 112rpx;
+					height: 112rpx;
+					position: absolute;
+					left: 50%;
+					top: 50%;
+					transform: translate(-50%, -50%);
+				}
+			}
+
+			.item-title {
+				margin-top: 15rpx;
+				font-size: 26rpx;
+				font-weight: 500;
+				color: #666666;
+			}
+		}
+	}
+
+	.rznow {
+		font-weight: 500;
+		font-size: 26rpx;
+		color: #FFFFFF;
+		background-color: #78797a;
+		height: 74rpx;
+		padding: 0 42rpx 0 52rpx;
+
+		.rztit {
+			line-height: 74rpx;
+		}
+
+		.rzbtn {
+			width: 127rpx;
+			height: 47rpx;
+			text-align: center;
+			line-height: 47rpx;
+			background: #35d9b7;
+			border-radius: 24rpx;
+			font-size: 22rpx;
+		}
+	}
+
+	.gn-wrap {
+		margin: 45rpx auto;
+		width: 670rpx;
+		height: 219rpx;
+		background: #FFFFFF;
+		box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(50, 50, 52, 0.06);
+		border-radius: 30rpx;
+		padding-right: 47rpx;
+
+		.gn-icon {
+			flex-shrink: 0;
+			width: 210rpx;
+			height: 100%;
+			justify-content: center;
+
+			image {
+				height: 112rpx;
+			}
+		}
+
+		.gn-tit {
+			flex-grow: 1;
+			font-weight: bold;
+			color: #333333;
+			font-size: 36rpx;
+			flex-direction: column;
+			justify-content: center;
+			align-items: flex-start;
+
+			.tit-jj {
+				font-size: 25rpx;
+				font-weight: 500;
+				color: #666666;
+				padding-top: 32rpx;
+			}
+		}
+
+		.gn-btn {
+			flex-shrink: 0;
+			width: 127rpx;
+			border: 1px solid $base-color;
+			border-radius: 28rpx;
+			font-size: 25rpx;
+			font-weight: 500;
+			color: $base-color;
+			line-height: 55rpx;
+			text-align: center;
+		}
+	}
+
+	.fjmd {
+		width: 708rpx;
+		height: 233rpx;
+		margin: 20rpx auto;
+
+		image {
+			width: 100%;
+			height: 100%;
+		}
+	}
+
+	.sygl {
+		.sy-top {
+			position: relative;
+			height: 100rpx;
+
+			image {
+				width: 369rpx;
+				height: 8rpx;
+				position: absolute;
+				top: 0;
+				bottom: 0;
+				left: 0;
+				right: 0;
+				margin: auto;
+			}
+
+			.top-tit {
+				font-size: 32rpx;
+				font-weight: bold;
+				color: #4A2723;
+				text-align: center;
+				line-height: 100rpx;
+			}
+
+		}
+
+		.sy-content {
+			padding: 0 10rpx 65rpx;
+
+			.content-item {
+				flex-grow: 1;
+				flex-direction: column;
+				justify-content: center;
+				align-items: center;
+				font-size: 22rpx;
+				font-weight: 500;
+				color: #4A2723;
+			}
+
+			.sy-icon {
+				width: 90rpx;
+				height: 90rpx;
+				margin-bottom: 15rpx;
+			}
+
+			.jt {
+				flex-shrink: 0;
+				width: 14rpx;
+				height: 15rpx;
+				margin-top: 40rpx;
+				align-self: flex-start;
+			}
+		}
+	}
+</style>

+ 172 - 31
pages/order/createOrder.vue

@@ -1,7 +1,7 @@
 <template>
 	<view class="padding-t-30">
 		<!-- 地址 -->
-		<navigator url="/pages/set/address?source=1" class="address-section">
+		<!-- <navigator url="/pages/set/address?source=1" class="address-section">
 			<view class="order-content" v-if="addressData.real_name">
 				<view class="cen">
 					<view class="top">
@@ -19,7 +19,59 @@
 					<text>添加收货地址</text>
 				</view>
 			</view>
-		</navigator>
+		</navigator> -->
+		<!-- 门店 -->
+		<view class="yt-list tc-wrap" @click="navTo('/pages/shop/shopTab?select=1')">
+			<view class="store-wrap flex" v-if="selctStore && selctStore.id">
+				<view class="imgBox">
+					<image class="logo" :src="selctStore.image" mode="aspectFit"></image>
+				</view>
+				<view class="padding-l-20 flex-grow-true">
+					<view class="title clamp flex">
+						<view class="name">
+							{{selctStore.name}}
+						</view>
+						<view class="km" v-if="selctStore.range">
+							{{selctStore.range<1?selctStore.distance+'m':selctStore.range+'km'}}
+						</view>
+					</view>
+					<view class="flex addressBox margin-t-20">
+						<image class="iconA margin-r-10" src="../../static/icon/shop.png" mode="">
+						</image>
+						<text class="clamp">
+							{{selctStore.detailed_address}}
+						</text>
+					</view>
+					<view class="addressBox flex">
+						<image class="iconA margin-r-10" src="../../static/icon/shopPhone.png" mode="">
+						
+						<text class="clamp">
+							{{selctStore.phone}}
+						</text>
+					</view>
+					<view class="yysj">
+						营业时间:{{selctStore.day_time}}
+					</view>
+					
+					
+				</view>
+			</view>
+			<view class="store-wrap-empty" v-else>
+				选择门店
+			</view>
+		</view>
+		
+		
+		<view class="yt-list">
+			<view class="yt-list-cell b-b">
+				<text class="cell-tit clamp">提货人</text>
+				<input class="desc" type="text" v-model="addressData.real_name" placeholder="请填写提货人姓名" placeholder-class="placeholder" />
+			</view>
+			<view class="yt-list-cell b-b">
+				<text class="cell-tit clamp">提货手机号</text>
+				<input class="desc" type="text" v-model="addressData.phone" placeholder="请填写提货人手机号" placeholder-class="placeholder" />
+			</view>
+		</view>
 		<view class="goodsList">
 
 			<view class="goods-section" v-for="(ls, ind) in shopList" :key="ind">
@@ -47,10 +99,10 @@
 		</view>
 		<!-- 金额明细 -->
 		<view class="yt-list">
-			<view class="yt-list-cell b-b">
+			<!-- <view class="yt-list-cell b-b">
 				<text class="cell-tit clamp">运费</text>
 				<text class="cell-tip disabled">{{ Postage }}</text>
-			</view>
+			</view> -->
 			<view class="yt-list-cell b-b">
 				<text class="cell-tit clamp">备注</text>
 				<input class="desc" type="text" v-model="desc" placeholder="请填写备注信息" placeholder-class="placeholder" />
@@ -82,7 +134,7 @@
 			<view class="yt-list-cell b-b" @click="payType='yue'">
 				<view class="cell-tit flex">
 					<image class="orderIcon" src="../../static/icon/ye.png" mode="widthFix"></image>
-					<text class="margin-l-10">余额({{now_money}})</text>
+					<text class="margin-l-10">卡券({{now_money}})</text>
 				</view>
 				<image class="checked" v-if="payType=='yue'" src="../../static/icon/addressIconXz.png" mode="widthFix">
 				</image>
@@ -106,7 +158,10 @@
 <script>
 	import {
 		mapState
-	} from 'vuex';
+	} from 'vuex';
+	import {
+		storeList,
+	} from '@/api/product.js';
 	import {
 		confirm,
 		computedOrderkey,
@@ -121,7 +176,9 @@
 	// #endif
 	export default {
 		data() {
-			return {
+			return {
+				shipping_type: 2,//1->快递,2->自提
+				selctStore: {id:''},//选中的门店
 				payType: 'ali',
 				desc: '', //备注
 				// 收货地址
@@ -141,7 +198,7 @@
 				orderKey: '', //订单id
 				payLoding: false, //判断是否支付中
 				orderId: '', //订单id
-				now_money: 0, //余额
+				now_money: 0, //卡券
 				onShopId: -1, //默认-1为不存在商家id
 			};
 		},
@@ -153,7 +210,8 @@
 				this.onShopId = option.shopId;
 			}
 			this.loadData();
-			this.userinfo();
+			this.userinfo();
+			this.storeList()
 		},
 		computed: {
 			Postage() {
@@ -168,15 +226,28 @@
 				return +this.moneyAll.totalPrice + +this.moneyAll.vipPrice;
 			},
 			...mapState('shop', ['shopDetail']),
-			...mapState(['fx'])
+			...mapState(['fx']),
+			...mapState('user', ['address'])
 		},
-		methods: {
+		methods: {
+			navTo(url) {
+				uni.navigateTo({
+					url,
+					fail() {
+						uni.switchTab({
+							url
+						})
+					}
+				})
+			},
 			// 加载用户基础信息
 			userinfo() {
 				getUserInfo({}).then(({
 					data
 				}) => {
-					this.now_money = data.now_money;
+					this.now_money = data.now_money;
+					this.addressData.real_name = data.real_name || '';
+					this.addressData.phone = data.phone || '';
 				});
 			},
 			// 计算支付金额
@@ -207,7 +278,8 @@
 				}).then(({
 					data
 				}) => {
-					obj.addressData = data.addressInfo || {};
+					// obj.addressData = data.addressInfo || {};
+					// console.log(obj.addressData,'obj.addressData')
 					obj.shopList = data.cartInfo; //商品列表
 					obj.moneyAll = data.priceGroup; //金额数据
 					obj.orderKey = data.orderKey; //订单key
@@ -218,15 +290,28 @@
 			// 提交订单
 			submit() {
 				let obj = this;
-				if (!this.addressData.real_name) {
-					this.$api.msg('请选择收货地址');
-					return false;
+				
+				if(obj.shipping_type == 2) {
+					if (!obj.addressData.real_name) {
+						// this.$api.msg('请选择收货地址');
+						obj.$api.msg('请输入提货人姓名')
+						return false;
+					}
+					if (!obj.addressData.phone) {
+						// this.$api.msg('请选择收货地址');
+						obj.$api.msg('请输入提货人手机号')
+						return false;
+					}
+					if(obj.selctStore.id == '') {
+						obj.$api.msg('请选择提货门店')
+						return false;
+					}
 				}
-				// 判断是否余额不足
+				// 判断是否卡券不足
 				if (obj.payType == 'yue' && +obj.now_money < obj.payPrice) {
 					uni.showModal({
 						title: '提示',
-						content: '账户余额不足!',
+						content: '账户卡券不足!',
 						showCancel: false,
 					});
 					return;
@@ -255,7 +340,7 @@
 						// #ifdef APP-PLUS
 						from: 'app', //来源
 						// #endif
-						paytype: obj.payType //支付类型  weixin-微信 yue-余额
+						paytype: obj.payType //支付类型  weixin-微信 yue-卡券
 					})
 					.then(e => {
 						// 判断是否微信小程序支付
@@ -333,20 +418,21 @@
 			paySuccessTo() {
 				uni.hideLoading();
 				uni.redirectTo({
-					url: '/pages/user/money/paySuccess?orderid=' + this.orderId,
+					url: '/pages/user_home/money/paySuccess?orderid=' + this.orderId,
 				});
 			},
 			// 初次订单创建
 			firstCreateOrder() {
 				let obj = this;
 				// 获取下单页面数据
-				let prepage = obj;
-				let data = {
+				let prepage = obj;
+				let data = {
+					store_id: this.selctStore.id,
 					real_name: prepage.addressData.real_name, //联系人名称
 					phone: prepage.addressData.phone, //联系人号码
 					addressId: prepage.addressData.id, //支付地址id
 					useIntegral: 0, //是否积分抵扣1为是0为否
-					payType: obj.payType, //支付类型  weixin-微信 yue-余额
+					payType: obj.payType, //支付类型  weixin-微信 yue-卡券
 					mark: prepage.desc, //备注
 					// #ifdef H5
 					from: 'weixin', //来源
@@ -357,14 +443,14 @@
 					// #ifdef APP-PLUS
 					from: 'app', //来源
 					// #endif
-					shipping_type: 1, //提货方式 1 快递 2自提
+					shipping_type: prepage.shipping_type, //提货方式 1 快递 2自提
 				};
 				// 判断是否需要读取非默认商家id
-				if (obj.onShopId != -1) {
-					data.store_id = obj.onShopId;
-				} else {
-					data.store_id = obj.shopDetail.id;
-				}
+				// if (obj.onShopId != -1) {
+				// 	data.store_id = obj.onShopId;
+				// } else {
+				// 	data.store_id = obj.shopDetail.id;
+				// }
 				// 生成订单
 				createOrderkey(data, obj.orderKey)
 					.then(({
@@ -385,9 +471,9 @@
 						}
 						// 保存订单号
 						obj.orderId = data.result.orderId;
-						// 判断是否为余额支付
+						// 判断是否为卡券支付
 						if (obj.payType == 'yue') {
-							console.log('余额支付', status == 200 && data.status == 'SUCCESS');
+							console.log('卡券支付', status == 200 && data.status == 'SUCCESS');
 							if (status == 200 && data.status == 'SUCCESS') {
 								obj.paySuccessTo();
 							} else {
@@ -759,5 +845,60 @@
 				background-color: $font-color-disabled;
 			}
 		}
+	}
+	.store-wrap {
+		background-color: #FFFFFF;
+		margin-bottom: 30rpx;
+		padding: 30rpx;
+		border-radius: 20rpx;
+		.list,.km{
+			color: $font-color-light;
+			font-size: $font-sm;
+		}
+		.logo {
+			height: 200rpx;
+			width: 200rpx;
+			border-radius: 20rpx;
+		}
+	
+		.title {
+			font-size: 36rpx;
+			color: $font-color-dark;
+		}
+	
+		.iconR {
+			height: 24rpx;
+		}
+	
+		.iconA {
+			width: 24rpx;
+			height: 24rpx;
+		}
+	
+		.addressBox {
+			font-size: 24rpx;
+			color: $font-color-light;
+			justify-content: flex-start;
+			padding: 10rpx 0;
+		}
+		.yysj {
+			display: inline-block;
+			// width: 239rpx;
+			padding: 0 10rpx;
+			height: 32rpx;
+			background: #ddf8f1;
+			border-radius: 16rpx 16rpx 16rpx 0rpx;
+			font-size: 20rpx;
+			font-weight: bold;
+			color: #5FCCA7;
+			text-align: center;
+			line-height: 32rpx;
+			margin-top: 10rpx;
+		}
+	}
+	.store-wrap-empty {
+		text-align: center;
+		height: 200rpx;
+		line-height: 200rpx;
 	}
 </style>

+ 197 - 0
pages/order/hxqm.vue

@@ -0,0 +1,197 @@
+<template>
+	<view class="content">
+		<view class="" style="height: 87rpx;">
+
+		</view>
+		<view class="djq-wrap">
+			<view class="djq-top flex f-d-c f-j-c">
+				<view class="djq-name">
+					服务确认二维码
+				</view>
+				<view class="djq-time">
+					请扫码核销
+				</view>
+			</view>
+			<view class="djq-body">
+				<view class="ewm">
+					<tki-qrcode :cid="cid" ref="qrcode" :val="val" :size="size" :unit="unit" :background="background"
+						:foreground="foreground" :pdground="pdground" :iconSize="iconSize" :lv="lv" :onval="onval"
+						:loadMake="loadMake" :usingComponents="usingComponents" @result="qrR" />
+				</view>
+				<view class="ewm-code" >
+					{{val}}
+				</view>
+			</view>
+		</view>
+
+	</view>
+</template>
+
+<script>
+	import tkiQrcode from '@/components/tki-qrcode/tki-qrcode.vue';
+	
+	import {
+		orderDetail
+	} from '@/api/order.js';
+	export default {
+		components: {
+			tkiQrcode
+		},
+		data() {
+			return {
+				type: 1,//1->普通商品核销 2-> 电池核销
+				orderInfo: {},
+				order_id: '', //订单编号
+				cid: 'tki-qrcode-canvas', //canvasId,页面存在多个二维码组件时需设置不同的ID
+				size: 440, //生成的二维码大小
+				unit: 'upx', //大小单位尺寸
+				show: true, //默认使用组件中的image标签显示二维码
+				val: '', //要生成的内容
+				background: '#ffffff', //二维码背景色
+				foreground: '#333333', //二维码前景色
+				pdground: '#333333', //二维码角标色
+				icon: '', //二维码图标URL(必须是本地图片,网络图需要先下载至本地)
+				iconSize: 40, //二维码图标大小
+				lv: 3, //容错级别
+				onval: true, //监听val值变化自动重新生成二维码
+				loadMake: true, //组件初始化完成后自动生成二维码,val需要有值
+				usingComponents: false, //是否使用了自定义组件模式(主要是为了修复非自定义组件模式时 v-if 无法生成二维码的问题)
+				showLoading: false, //是否显示loading
+				loadingText: '二维码生成中', //loading文字
+				src: '', // 二维码生成后的图片地址或base64
+				ratio: 1, //页面比例用于计算
+				ctxSrc: '', //要显示的图片
+				loading: true, //是否载入图片中
+			}
+		},
+		onLoad(opt) {
+			this.type = opt.type
+			// 普通商品核销
+			if (this.type == 1) {
+				this.order_id = opt.id
+				this.getOrderDetail()
+			}
+			if(this.type == 2) {
+				this.val = opt.id
+			}
+		},
+		onShow() {
+
+		},
+		onReachBottom() {
+
+		},
+		onReady() {
+
+		},
+		methods: {
+			getOrderDetail() {
+				let that = this;
+				orderDetail({}, that.order_id).then(e => {
+					// that.item = e.data;
+					that.orderInfo = e.data
+					that.val = that.orderInfo.verify_code
+				});
+			},
+			qrR() {
+				
+			},
+			
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	page {
+		height: 100%;
+		background-color:$base-color;
+	}
+
+	.djq-wrap {
+		width: 696rpx;
+
+		background-color: #fff;
+		position: relative;
+		margin: auto;
+
+		.djq-top {
+			height: 185rpx;
+			background: #F5F5F5;
+			overflow: hidden;
+			flex-direction: column;
+			justify-content: center;
+
+			.djq-name {
+				font-size: 44rpx;
+				font-weight: bold;
+				color: #222222;
+			}
+
+			.djq-time {
+				font-size: 24rpx;
+				font-weight: 500;
+				color: #686868;
+			}
+
+			&::after,
+			&::before {
+				content: '';
+				height: 120rpx;
+				width: 120rpx;
+				border-radius: 50%;
+				position: absolute;
+				top: -60rpx;
+				background-color: $base-color;
+			}
+
+			&::before {
+				left: -60rpx;
+			}
+
+			&::after {
+				right: -60rpx;
+			}
+		}
+
+		.djq-body {
+			height: 770rpx;
+			position: relative;
+			padding-top: 115rpx;
+
+			&::after,
+			&::before {
+				content: '';
+				height: 120rpx;
+				width: 120rpx;
+				border-radius: 50%;
+				position: absolute;
+				bottom: -60rpx;
+				background-color: $base-color;
+			}
+
+			&::before {
+				left: -60rpx;
+			}
+
+			&::after {
+				right: -60rpx;
+			}
+
+			.ewm {
+				width: 440rpx;
+				height: 440rpx;
+				margin: auto;
+			}
+
+			.ewm-code {
+				padding-top: 55rpx;
+				font-size: 44rpx;
+				font-weight: bold;
+				color: #333333;
+				text-align: center;
+			}
+		}
+
+
+	}
+</style>

+ 15 - 9
pages/order/order.vue

@@ -21,7 +21,7 @@
 					<view @click="navTo('/pages/order/orderDetail?id=' + item.order_id)"
 						v-for="(item, index) in tabItem.orderList" :key="index" class="order-item">
 						<view class="i-top b-b">
-							<text class="time">{{ item._add_time }}</text>
+							<text class="time">订单编号:{{ item.order_id }}</text>
 							<text class="state" :style="{ color: item.stateTipColor }">{{ item._status._title }}</text>
 							<text v-if="item.status === 4" class="del-btn iconfont icondelete"
 								@click="deleteOrder(index)"></text>
@@ -45,20 +45,21 @@
 										class="row_title">{{ goodsItem.productInfo.attrInfo ? goodsItem.productInfo.attrInfo.suk : '' }}</text>
 									<text class="attr-box"> x {{ goodsItem.cart_num }}</text>
 								</view>
-								<view class="row flex">
+								<!-- <view class="row flex">
 									<text class="attr-box">( 服务费:{{goodsItem.day_deducted}}
 										服务天数:{{goodsItem.day}})</text>
-								</view>
+								</view> -->
 							</view>
 						</view>
-						<!-- <view class="price-box">
+						<view class="price-box">
 							<text class="num">{{ item.cartInfo.length }}</text>
-							件商品 邮费
-							<text class="price">{{ moneyNum(item.pay_postage)}}</text>
+							件商品 
+							<!-- 邮费
+							<text class="price">{{ moneyNum(item.pay_postage)}}</text> -->
 							实付款
 							<text class="price">{{ moneyNum(item.pay_price)}}</text>
-						</view> -->
+						</view>
 						<view class="action-box b-t" v-if="tabItem.state != 4">
 							<button v-if="item._status._title == '未支付'" class="action-btn"
 								@click.stop="cancelOrder(item)">取消订单</button>
@@ -70,7 +71,8 @@
 								class="action-btn">确认收货</button>
 							<button v-if="item._status._title == '未发货'||item._status._title == '未领车'"
 								class="action-btn btn-red"
-								@click.stop="navTo('/pages/order/orderRefund?id=' + item.order_id)">申请退款</button>
+								@click.stop="navTo('/pages/order/orderRefund?id=' + item.order_id)">申请退款</button>
+							<button v-if="item._status._title == '待核销'" class="action-btn btn-base" @click.stop="navTo('/pages/order/hxqm?id=' + item.order_id + '&type=1')">出示券码</button>
 						</view>
 					</view>
 
@@ -109,7 +111,7 @@
 					// 	limit: 10 //每次信息条数
 					// },
 					{
-						state: 2,
+						state: 1,
 						text: '待核销',
 						loadingType: 'more',
 						orderList: [],
@@ -572,6 +574,10 @@
 			&.btn-red {
 				color: $color-red;
 				border: 1px solid $color-red;
+			}
+			&.btn-base {
+				color: $base-color;
+				border: 1px solid $base-color;
 			}
 
 			&:after {

+ 9 - 7
pages/order/orderDetail.vue

@@ -154,7 +154,8 @@
 	</view>
 </template>
 
-<script>
+<script>
+
 	import {
 		orderDetail
 	} from '@/api/order.js';
@@ -195,7 +196,7 @@
 				return this.vipMoney + +this.item.total_price;
 			}
 		},
-		methods: {
+		methods: {
 			navTo(url){
 				console.log(url);
 				uni.navigateTo({
@@ -569,16 +570,17 @@
 		.buttomBottom {
 			padding: 30rpx 80rpx;
 			line-height: 1;
-			color: $color-green;
+			color: $base-color;
 			font-size: $font-base;
-			border: 1px solid $color-green;
+			border: 1px solid $base-color;
 			border-radius: 99rpx;
 
 			&.bgYellow {
 				color: #FFFFFF;
-				background-color: $color-yellow;
-				border: 1px solid $color-yellow;
+				background-color: $base-color;
+				border: 1px solid $base-color;
 			}
 		}
-	}
+	}
+	
 </style>

+ 13 - 8
pages/product/common/productBottom.vue

@@ -1,15 +1,15 @@
 <template>
 	<view class="page-bottom">
-		<view class="p-b-btn" @click="shopLi">
+<!-- 		<view class="p-b-btn" @click="shopLi">
 			<image class="icon" src="../../../static/icon/goodsServer.png" mode="widthFix"></image>
 			<text>客服</text>
 		</view>
 		<view class="p-b-btn" :class="{ active: goodsObjact.userCollect }" @click="setCart(goodsObjact)">
 			<image class="icon" src="../../../static/icon/goodsAddCart.png" mode="widthFix"></image>
 			<text>购物车</text>
-		</view>
+		</view> -->
 		<view class="action-btn-group">
-			<button type="primary" class=" action-btn add-cart-btn margin-r-30" @click="buy(2)">加入购物车</button>
+			<!-- <button type="primary" class=" action-btn add-cart-btn margin-r-30" @click="buy(2)">加入购物车</button> -->
 			<button type="primary" class=" action-btn  buy-now-btn margin-r-30" @click="buy(1)">立即购买</button>
 		</view>
 	</view>
@@ -52,7 +52,12 @@ export default {
 		// 加入购物车
 		setCart(goodsObjact){
 			uni.switchTab({
-				url:'/pages/cart/cart'
+				url:'/pages/cart/cart',
+				fail() {
+					uni.navigateTo({
+						url:'/pages/cart/cart'
+					})
+				}
 			})
 		}
 		//收藏
@@ -127,7 +132,7 @@ export default {
 	.action-btn-group {
 		display: flex;
 		height: 76rpx;
-		border-radius: 100px;
+		// border-radius: 100px;
 		overflow: hidden;
 		margin-left: 20rpx;
 		position: relative;
@@ -150,12 +155,12 @@ export default {
 			height: 100%;
 			font-size: $font-base;
 			padding: 0;
-			border-radius: 100px;
+			// border-radius: 100px;
 			flex-grow: 1;
 			background: transparent;
 			&.buy-now-btn {
-				background-color: $color-yellow;
-				color: #714D01;
+				background-color: $uni-color-primary;
+				color: #fff;
 			}
 			&.add-cart-btn {
 				background-color: $color-red;

+ 5 - 4
pages/product/product.vue

@@ -320,7 +320,8 @@
 						obj.description = obj.goodsObjact.description.replace(/\<img/gi, '<img class="rich-img"');
 					} //小程序商品详情图超出屏幕问题
 					obj.imgList = goods.slider_image; //保存轮播图
-					obj.specList = data.productAttr; //保存分类列表
+					obj.specList = data.productAttr; //保存分类列表
+					let goodItemAction = obj.actionGoodsType
 					if (Array.isArray(data.productValue) != true) {
 						obj.many = 2; //多规格
 						obj.specList = data.productAttr; //保存产品属性
@@ -334,7 +335,7 @@
 						}
 						let str = obj.specSelected.join(',');
 						console.log(str, 'str');
-						let goodItemAction = obj.actionGoodsType
+						
 						// 设置默认值
 						goodItemAction.actionPrice = obj.productValue[str].price;
 						goodItemAction.goodsNumberMax = obj.productValue[str].stock;
@@ -502,9 +503,9 @@
 				height: 66rpx;
 				line-height: 66rpx;
 				border-radius: 100rpx;
-				background: $color-yellow;
+				background: $uni-color-primary;
 				font-size: $font-base + 2rpx;
-				color: #714D01;
+				color: #fff;
 				margin: 30rpx auto 20rpx;
 			}
 		}

+ 5 - 1
pages/shop/accessory.vue

@@ -31,6 +31,7 @@
 </template>
 
 <script>
+	import {getProducts } from '@/api/product.js'
 	export default {
 		data() {
 			return {
@@ -42,7 +43,7 @@
 			}
 		},
 		onLoad() {
-
+			this.getGoodList()
 		},
 		onShow() {
 
@@ -93,6 +94,9 @@
 </script>
 
 <style lang="scss">
+	.content {
+		padding-top: 20rpx;
+	}
 	.good {
 		width: 690rpx;
 		height: 276rpx;

+ 63 - 17
pages/shop/attestation.vue

@@ -3,22 +3,28 @@
 		<view class="yz-wrap">
 			<view class="top-wrap flex">
 				<view class="top-left">
-					选择套餐<text>*</text>
+					实名认证<text>*</text>
 				</view>
 			</view>
 			<view class="sr-wrap flex">
 				<view class="sr-tit">
 					姓名
 				</view>
-				<input type="text" class="sr-inp" placeholder="请输入姓名">
+				<input type="text" class="sr-inp" placeholder="请输入姓名" v-model="name">
 			</view>
 			<view class="sr-wrap flex">
 				<view class="sr-tit">
 					手机号
 				</view>
-				<input type="text" class="sr-inp" placeholder="请输入手机号">
+				<input type="number" class="sr-inp" placeholder="请输入手机号" v-model="phone">
 			</view>
 			<view class="sr-wrap flex">
+				<view class="sr-tit">
+					身份证号
+				</view>
+				<input type="idcard" class="sr-inp" placeholder="请输入手机号" v-model="idcard">
+			</view>
+			<!-- <view class="sr-wrap flex">
 				<view class="sr-tit">
 					验证码
 				</view>
@@ -26,28 +32,28 @@
 				<view class="sr-btn">
 					点击获取
 				</view>
-			</view>
+			</view> -->
 		</view>
-		<view class="yz-wrap">
+<!-- 		<view class="yz-wrap">
 			<view class="top-wrap flex">
 				<view class="top-left">
 					上传身份证照片<text>*</text>
 				</view>
 			</view>
-			<view class="sfz flex">
+			<view class="sfz flex"> -->
 				<!-- #ifdef H5 -->
-				<image class="" :src="sfzz||this.urlFile + '/static/img/sfzz.png'" mode="widthFix" @click="navCroper(664,414,'sfzz')"></image>
+				<!-- <image class="" :src="sfzz||this.urlFile + '/static/img/sfzz.png'" mode="widthFix" @click="navCroper(664,414,'sfzz')"></image> -->
 				<!-- #endif -->
 				<!-- #ifndef H5 -->
-				<image class="" :src="sfzz||'/static/img/sfzz.png'" mode="widthFix" @click="navCroper(664,414,'sfzz')"></image>
+				<!-- <image class="" :src="sfzz||'/static/img/sfzz.png'" mode="widthFix" @click="navCroper(664,414,'sfzz')"></image> -->
 				<!-- #endif -->
 				<!-- #ifdef H5 -->
-				<image class="" :src="sfzf||this.urlFile + '/static/img/sfzf.png'" mode="widthFix" @click="navCroper(664,414,'sfzf')"></image>
+				<!-- <image class="" :src="sfzf||this.urlFile + '/static/img/sfzf.png'" mode="widthFix" @click="navCroper(664,414,'sfzf')"></image> -->
 				<!-- #endif -->
 				<!-- #ifndef H5 -->
-				<image class="" :src="sfzf||'/static/img/sfzf.png'" mode="widthFix" @click="navCroper(664,414,'sfzf')"></image>
+				<!-- <image class="" :src="sfzf||'/static/img/sfzf.png'" mode="widthFix" @click="navCroper(664,414,'sfzf')"></image> -->
 				<!-- #endif -->
-				<view class="">
+				<!-- <view class="">
 					个人信息面
 				</view>
 				<view class="">
@@ -55,30 +61,35 @@
 				</view>
 			</view>
 
-		</view>
-		<view class="yz-wrap">
+		</view> -->
+		<!-- <view class="yz-wrap">
 			<view class="sr-wrap flex">
 				<view class="sr-tit">
 					绑定邀请码
 				</view>
 				<input type="text" class="sr-inp" placeholder="请输入绑定邀请码(非必填)">
 			</view>
-		</view>
-		<view class="base-buttom">
+		</view> -->
+		<view class="base-buttom" @click="sub">
 			提交认证
 		</view>
 	</view>
 </template>
 
 <script>
+	import { certification } from '@/api/index.js'
 	import {
 		mapState
 	} from "vuex"
 	export default {
 		data() {
 			return {
-				sfzz: '',
-				sfzf: ''
+				// sfzz: '',
+				// sfzf: ''
+				name: '',
+				phone: '',
+				idcard: '',
+				loading: false,
 			}
 		},
 		onLoad() {
@@ -99,6 +110,41 @@
 
 		},
 		methods: {
+			sub() {
+				let that = this
+				if(that.loading) {
+					return
+				}
+				if(that.name == '') {
+					that.$api.msg('请输入姓名')
+				}
+				if(that.phone == '') {
+					that.$api.msg('请输入手机号码')
+				}
+				if(that.idcard == '') {
+					that.$api.msg('请输入身份证号')
+				}
+				that.loading = true
+				certification({
+					name: that.name,
+					id_number: that.idcard,
+					phone_number: that.phone
+				}).then(res => {
+					uni.showToast({
+						title: '提交成功',
+						duration: 2000
+					});
+					setTimeout(()=> {
+						uni.switchTab({
+							url:'/pages/user/user'
+						})
+					})
+					console.log(res)
+					that.loading = false
+				}).catch(err => {
+					that.loading = false
+				})
+			},
 			upLoad(path) {
 				// #ifdef H5
 				console.log(path,'h5');

+ 349 - 28
pages/shop/rent.vue

@@ -1,5 +1,50 @@
 <template>
 	<view class="content">
+		<!-- 门店选择 -->
+		<view class="yt-list tc-wrap" @click="navTo('/pages/shop/shopTab?select=1')">
+			<view class="top-wrap flex">
+				<view class="top-left">
+					选择门店
+				</view>
+			</view>
+			<view class="store-wrap flex" v-if="selctStore && selctStore.id">
+				<view class="imgBox">
+					<image class="logo" :src="selctStore.image" mode="aspectFit"></image>
+				</view>
+				<view class="padding-l-20 flex-grow-true">
+					<view class="title clamp flex">
+						<view class="name">
+							{{selctStore.name}}{{selctStore.id}}
+						</view>
+						<view class="km" v-if="selctStore.range">
+							{{selctStore.range<1?selctStore.distance+'m':selctStore.range+'km'}}
+						</view>
+					</view>
+					<view class="flex addressBox margin-t-20">
+						<image class="iconA margin-r-10" src="../../static/icon/shop.png" mode="">
+						</image>
+						<text class="clamp">
+							{{selctStore.detailed_address}}
+						</text>
+					</view>
+					<view class="addressBox flex">
+						<image class="iconA margin-r-10" src="../../static/icon/shopPhone.png" mode="">
+						
+						<text class="clamp">
+							{{selctStore.phone}}
+						</text>
+					</view>
+					<view class="yysj">
+						营业时间:{{selctStore.day_time}}
+					</view>
+					
+					
+				</view>
+			</view>
+			<view class="store-wrap-empty" v-else>
+				选择门店
+			</view>
+		</view>
 		<!-- 套餐 -->
 		<view class="tc-wrap">
 			<view class="top-wrap flex">
@@ -8,31 +53,31 @@
 				</view>
 			</view>
 			<view class="contet-list flex">
-				<view class="tc flex" v-for="(item,index) in 5" :class="{'action': selectTcIndex == index}" @click="choosTc(index,item)">
+				<view class="tc flex" v-for="(item,index) in tcList" :class="{'action': selectTcIndex == index}" @click="choosTc(index,item)">
 					<view class="tc-time">
-						7天
+						{{item.month}}月
 					</view>
 					<view class="tc-price">
-						79
+						{{item.price}}
 					</view>
 					<view class="tc-time-price">
-					<text>11</text>元/天
+					<text>{{(item.price*1/(item.month*1*30)).toFixed(2)}}</text>元/天
 					</view>
 				</view>
 			</view>
 		</view>
-		<view class="dy-wrap">
+		<view class="dy-wrap" v-if="selectTc.id">
 			<view class="top-wrap flex">
 				<view class="top-left">
 					押金服务
 				</view>
-				<view class="top-right">
+				<!-- <view class="top-right">
 					<text>押金规则</text>
 					<image src="../../static/icon/next1.png" mode="heightFix"></image>
-				</view>
+				</view> -->
 			</view>
 			<view class="contet-list flex">
-				<view class="tc flex dy">
+				<!-- <view class="tc flex dy">
 					<view class="tc-time">
 						<image src="../../static/icon/orderWx.png" mode="heightFix"></image>微信信用免押金
 					</view>
@@ -42,16 +87,16 @@
 					<view class="tc-price">
 						77<text>¥88</text>
 					</view>
-				</view>
-				<view class="tc flex dy">
+				</view> -->
+				<view class="tc flex dy action">
 					<view class="tc-time">
 						支付押金
 					</view>
-					<view class="tc-time-price">
+					<!-- <view class="tc-time-price">
 					元/天
-					</view>
+					</view> -->
 					<view class="tc-price">
-						77
+						{{selectTc.deposit}}
 					</view>
 				</view>
 			</view>
@@ -62,11 +107,39 @@
 					使用说明
 				</view>
 			</view>
-			<view class="sysm">
-				1、套餐购买需在15分钟之内完成付款,超过15分系统自动取消订单
-				2、购买成功后,可至门店取货
-				3、商家超过30分钟未接单,自动退款
-				4、若未取车,可申请退款,套餐金额将全款退还至原支付账户,若已取车,暂不支持退款
+			<view class="sysm" v-html="sm">
+			</view>
+		</view>
+		
+		<view class="yt-list">
+			<!-- <view class="yt-list-cell b-b" @click="payType='weixin'">
+				<view class="cell-tit flex">
+					<image class="orderIcon" src="../../static/icon/orderWx.png" mode="widthFix"></image>
+					<text class="margin-l-10">微信支付</text>
+				</view>
+				<image class="checked" v-if="payType=='weixin'" src="../../static/icon/addressIconXz.png"
+					mode="widthFix"></image>
+				<view v-else class="noChecked"></view>
+			</view> -->
+			<!-- #ifdef APP-PLUS -->
+			<view class="yt-list-cell b-b" @click="payType='ali'">
+				<view class="cell-tit flex">
+					<image class="orderIcon" src="../../static/icon/orderAli.png" mode="widthFix"></image>
+					<text class="margin-l-10">支付宝</text>
+				</view>
+				<image class="checked" v-if="payType=='ali'" src="../../static/icon/addressIconXz.png" mode="widthFix">
+				</image>
+				<view v-else class="noChecked"></view>
+			</view>
+			<!-- #endif -->
+			<view class="yt-list-cell b-b" @click="payType='yue'">
+				<view class="cell-tit flex">
+					<image class="orderIcon" src="../../static/icon/ye.png" mode="widthFix"></image>
+					<text class="margin-l-10">卡券({{now_money}})</text>
+				</view>
+				<image class="checked" v-if="payType=='yue'" src="../../static/icon/addressIconXz.png" mode="widthFix">
+				</image>
+				<view v-else class="noChecked"></view>
 			</view>
 		</view>
 		<view class="ts">
@@ -74,30 +147,45 @@
 		</view>
 		<view class="btm-btn flex">
 			<view class="pay-price">
-				总计费用:<text>548</text>
+				总计费用:<text>{{(selectTc.price*1 + selectTc.deposit*1) || ''}}</text>
 			</view>
-			<view class="pay-btn">
+			<view class="pay-btn" @click="toBuy">
 				立即支付
 			</view>
 		</view>
 	</view>
 </template>
 
-<script>
+<script>
+	import { mapState} from 'vuex'
+	import {
+		storeList,
+	} from '@/api/product.js';
+	import {
+		getUserInfo
+	} from '@/api/user.js';
+	import {getRents,rentCreate,details} from '@/api/index.js'
 	export default {
 		data() {
-			return {
+			return {
+				selctStore: {id: ''},
+				now_money: '',
 				tcList: [],
 				selectTc: {},
 				selectTcIndex: 0,
-				
+				payType: 'yue',
+				sm: ''//使用说明
 			}
+		},
+		computed: {
+			...mapState('user', ['address'])
 		},
 		onLoad() {
-
+			this.getRents()
+			this.getSm()
 		},
 		onShow() {
-
+			this.userinfo()
 		},
 		onReachBottom() {
 
@@ -105,16 +193,94 @@
 		onReady() {
 
 		},
-		methods: {
+		methods: {
+			// 获取使用说明
+			getSm() {
+				details({},1).then(res => {
+					this.sm = res.data.content
+				})
+			},
+			navTo(url) {
+				uni.navigateTo({
+					url,
+					fail() {
+						uni.switchTab({
+							url
+						})
+					}
+				})
+			},
+			userinfo() {
+				getUserInfo({}).then(({
+					data
+				}) => {
+					this.now_money = data.now_money;
+				});
+			},
 			choosTc(index,item) {
 				this.selectTcIndex = index
 				this.selectTc = item
+			},
+			getRents() {
+				getRents().then(res => {
+				this.tcList = res.data.rent
+				this.selectTc = this.tcList[0]
+				})
+			},
+			toBuy() {
+				let that = this
+				if(that.selctStore.id == '') {
+					return that.$api.msg('请选择门店')
+				}
+				rentCreate({
+					store_id: that.selctStore.id,
+					rent_id: that.selectTc.id,
+					// #ifdef H5
+					from: 'weixin', //来源
+					// #endif
+					// #ifdef MP-WEIXIN
+					from: 'routine', //来源
+					// #endif
+					// #ifdef APP-PLUS
+					from: 'app', //来源
+					// #endif
+					pay_type: that.payType//支付方式
+				}).then(({
+						data,
+						status,
+						msg
+					}) => {
+					if (data.status == 'ORDER_EXIST') {
+						uni.showModal({
+							title: '提示',
+							content: msg,
+							showCancel: false
+						});
+						uni.hideLoading();
+						obj.payLoding = false;
+						return;
+					}
+					// 保存订单号
+					obj.orderId = data.result.orderId;
+					// 判断是否为卡券支付
+					if (obj.payType == 'yue') {
+						console.log('卡券支付', status == 200 && data.status == 'SUCCESS');
+						if (status == 200 && data.status == 'SUCCESS') {
+							// obj.paySuccessTo();
+						} else {
+							obj.$api.msg(msg);
+						}
+					} else {
+						// 立即支付
+						obj.orderMoneyPay();
+					}
+				})
 			}
 		}
 	}
 </script>
 
-<style lang="scss">
+<style lang="scss" scoped>
 	.content {
 		padding-top: 1rpx;
 	}
@@ -214,7 +380,7 @@
 		color: #666666;
 	}
 	.ts {
-		height: 130rpx;
+		height: 200rpx;
 	}
 	.btm-btn {
 		width: 750rpx;
@@ -222,6 +388,7 @@
 		position: fixed;
 		bottom: 0;
 		background-color: #fff;
+		z-index: 999;
 		.pay-price {
 			padding-left: 33rpx;
 			flex-grow: 1;
@@ -249,5 +416,159 @@
 			font-weight: 500;
 			color: #FFFFFF;
 		}
+	}
+	.yt-list {
+		background: #fff;
+		margin: 0 $page-row-spacing;
+		margin-top: 30rpx;
+		border-radius: 20rpx;
+	}
+	.yt-list-cell {
+		display: flex;
+		align-items: center;
+		justify-content: space-between;
+		padding: 10rpx 30rpx 10rpx 40rpx;
+		line-height: 70rpx;
+		position: relative;
+	
+		.checked,
+		.noChecked {
+			width: 36rpx;
+			height: 36rpx;
+		}
+	
+		.noChecked {
+			border: 1px solid $font-color-light;
+			border-radius: 100rpx;
+		}
+	
+		&.cell-hover {
+			background: #fafafa;
+		}
+	
+		&.b-b:after {
+			left: 30rpx;
+		}
+	
+		.cell-icon {
+			height: 32rpx;
+			width: 32rpx;
+			font-size: 22rpx;
+			color: #fff;
+			text-align: center;
+			line-height: 32rpx;
+			background: #f85e52;
+			border-radius: 4rpx;
+			margin-right: 12rpx;
+	
+			&.hb {
+				background: #ffaa0e;
+			}
+	
+			&.lpk {
+				background: #3ab54a;
+			}
+		}
+	
+		.cell-more {
+			align-self: center;
+			font-size: 24rpx;
+			color: $font-color-light;
+			margin-left: 8rpx;
+			margin-right: -10rpx;
+		}
+	
+		.cell-tit {
+			font-size: 26rpx;
+			color: $font-color-light;
+			margin-right: 10rpx;
+	
+			.orderIcon {
+				width: 48rpx;
+			}
+		}
+	
+		.cell-tip {
+			font-size: 26rpx;
+			color: $font-color-dark;
+	
+			&.disabled {
+				color: $font-color-light;
+			}
+	
+			&.active {
+				color: $base-color;
+			}
+	
+			&.red {
+				color: $base-color;
+			}
+		}
+	
+		&.desc-cell {
+			.cell-tit {
+				max-width: 90rpx;
+			}
+		}
+	
+		.desc {
+			text-align: right;
+			font-size: $font-base;
+			color: $font-color-light;
+		}
+	}
+	.store-wrap-empty {
+		text-align: center;
+		height: 100rpx;
+	}
+	.store-wrap {
+		background-color: #FFFFFF;
+		margin-bottom: 30rpx;
+		padding: 30rpx;
+		border-radius: 20rpx;
+		.list,.km{
+			color: $font-color-light;
+			font-size: $font-sm;
+		}
+		.logo {
+			height: 200rpx;
+			width: 200rpx;
+			border-radius: 20rpx;
+		}
+	
+		.title {
+			font-size: 36rpx;
+			color: $font-color-dark;
+		}
+	
+		.iconR {
+			height: 24rpx;
+		}
+	
+		.iconA {
+			width: 24rpx;
+			height: 24rpx;
+		}
+	
+		.addressBox {
+			font-size: 24rpx;
+			color: $font-color-light;
+			justify-content: flex-start;
+			padding: 10rpx 0;
+		}
+		.yysj {
+			display: inline-block;
+			// width: 239rpx;
+			padding: 0 10rpx;
+			height: 32rpx;
+			background: #ddf8f1;
+			border-radius: 16rpx 16rpx 16rpx 0rpx;
+			font-size: 20rpx;
+			font-weight: bold;
+			color: #5FCCA7;
+			text-align: center;
+			line-height: 32rpx;
+			margin-top: 10rpx;
+		}
 	}
 </style>

+ 47 - 36
pages/shop/shopTab.vue

@@ -59,8 +59,6 @@
 						<view class="yysj">
 							营业时间:{{item.day_time}}
 						</view>
-						
-						
 					</view>
 				</view>
 			</view>
@@ -70,9 +68,9 @@
 </template>
 
 <script>
-	// import {
-	// 	storeList,
-	// } from '@/api/shop.js';
+	import {
+		storeList,
+	} from '@/api/product.js';
 	import {
 		mapMutations,
 		mapState
@@ -85,19 +83,15 @@
 			return {
 				search: '', //查询内容
 				loadingType: 'more',
-				orderList: [{
-					name: '强而',
-					range: 5,
-					address: '浙江,台州,椒江区浙江,台州,椒江区',
-					phone: '45845454'
-				}],
+				orderList: [],
 				page: 1, //当前页数
 				limit: 10, //每次信息条数
 				province: '请选择', //省
 				city: '请选择', //市
 				district: '请选择', //区
 				loaded: false,
-				type: 0 //默认为切换商店,1为不切换
+				type: 0 ,//默认为切换商店,1为不切换
+				select: 0,//0为不选择商店,1为选择商店
 
 			};
 		},
@@ -105,8 +99,11 @@
 			console.log(option.type);
 			if (option.type) {
 				this.type = option.type;
+			}
+			if(option.select) {
+				this.select = option.select;
 			}
-			// this.storeList();
+			this.storeList();
 		},
 		methods: {
 			...mapMutations('shop', ['setShopInfo']),
@@ -129,25 +126,31 @@
 			},
 			// 存储当前的门店
 			onChecked(item) {
-				if (this.type == 0) {
-					this.setShopInfo(item);
-					uni.showToast({
-						title: '切换成功',
-						mask: true,
-						duration: 1500
-					});
-					setTimeout((e) => {
-						uni.switchTab({
-							url: '/pages/index/index'
-						})
-					}, 1500)
-				}
-				console.log();
-				if (+this.type == 1) {
-					this.setShopInfo(item);
-					uni.navigateTo({
-						url: '/pages/shop/shopIndex?id=' + item.id
-					})
+				// if (this.type == 0) {
+				// 	this.setShopInfo(item);
+				// 	uni.showToast({
+				// 		title: '切换成功',
+				// 		mask: true,
+				// 		duration: 1500
+				// 	});
+				// 	setTimeout((e) => {
+				// 		uni.switchTab({
+				// 			url: '/pages/index/index'
+				// 		})
+				// 	}, 1500)
+				// }
+				// console.log();
+				// if (+this.type == 1) {
+				// 	this.setShopInfo(item);
+				// 	uni.navigateTo({
+				// 		url: '/pages/shop/shopIndex?id=' + item.id
+				// 	})
+				// }
+				let that = this
+				if(that.select == 1) {
+					let prepage = that.$api.prePage();
+					prepage.selctStore = item
+					uni.navigateBack()
 				}
 			},
 			storeList(source) {
@@ -254,7 +257,6 @@
 				height: 200rpx;
 				width: 200rpx;
 				border-radius: 20rpx;
-				background-color: red;
 			}
 
 			.title {
@@ -274,13 +276,22 @@
 			.addressBox {
 				font-size: 24rpx;
 				color: $font-color-light;
-				justify-content: flex-start;
+				justify-content: flex-start;
+				padding: 10rpx 0;
 			}
 			.yysj {
-				width: 239rpx;
+				display: inline-block;
+				// width: 239rpx;
+				padding: 0 10rpx;
 				height: 32rpx;
-				background: linear-gradient(-38deg, #6CDBC3, #6DD6B8);
+				background: #ddf8f1;
 				border-radius: 16rpx 16rpx 16rpx 0rpx;
+				font-size: 20rpx;
+				font-weight: bold;
+				color: #5FCCA7;
+				text-align: center;
+				line-height: 32rpx;
+				margin-top: 10rpx;
 			}
 		}
 	}

+ 651 - 408
pages/user/user.vue

@@ -1,408 +1,651 @@
-<template>
-	<view class="container">
-		<view class="content-box" >
-			<view class="user-section">
-				<view class="avatar" @click="navTo('/pages/set/userinfo')">
-					<image class="image" :src="user.avatar|| urlFile+`/static/error/missing-face.png`" mode="scaleToFill"></image>
-				</view>
-				<view class="flex-center phone" >
-					<template v-if="user.phone">
-					{{((''+user.phone).split('').splice(3,4,'****')).join('')}}
-					</template>
-				</view>
-				<view class="tj-sction">
-					<view class="tj-item" @click="navTo('/pages/user_home/award/award')">
-						<text class="num">{{ user.brokerage_price || '0.00' }}</text>
-						<text>我的佣金</text>
-					</view>
-					<view class="tj-item" @click="navTo('/pages/user_home/money/wallet')">
-						<text class="num">{{user.now_money || '0.00' }}</text>
-						<text>我的卡券</text>
-					</view>
-				</view>
-			</view>
-			
-			<view class="cover-container">
-				
-				<view class="item-box">
-					<view class="box-title flex">
-						<view class="title"><text>我的订单</text></view>
-						<view class="link flex" @click="navTo('/pages/order/order?state=0')" hover-class="common-hover">
-							<text class="margin-r-10">全部</text>
-							<image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
-						</view>
-					</view>
-					<view class="order-section">
-						<view class="order-item" @click="navTo('/pages/order/order?state=0')" hover-class="common-hover"
-							:hover-stay-time="50">
-							<view class=" icon position-relative">
-								<image class="icon-img" src="../../static/icon/userorder1.png" mode="aspectFit">
-								</image>
-								<view class="corner" v-if="user.unpaid_count > 0">
-									<text>{{ user.unpaid_count }}</text>
-								</view>
-							</view>
-							<text>待付款</text>
-						</view>
-						<view class="order-item" @click="navTo('/pages/order/order?state=2')" hover-class="common-hover"
-							:hover-stay-time="50">
-							<view class="icon position-relative">
-								<image class="icon-img" src="../../static/icon/userorder2.png" mode="aspectFit">
-								</image>
-								<view class="corner" v-if="user.received_count > 0">
-									<text>{{ user.received_count }}</text>
-								</view>
-							</view>
-							<text>待核销</text>
-						</view>
-						<view class="order-item" @click="navTo('/pages/order/order?state=3')" hover-class="common-hover"
-							:hover-stay-time="50">
-							<view class=" icon position-relative">
-								<image class="icon-img" src="../../static/icon/userorder3.png" mode="aspectFit">
-								</image>
-							</view>
-							<text>已完成</text>
-						</view>
-					</view>
-				</view>
-				<view class="listBox">
-					<view class="list">
-						<view class="flex listItem" @click="navTo('/pages/shop/attestation')">
-							<view class="flex titleBox">
-								<image class="listIconImg" src="../../static/icon/userreal.png" mode="widthFix"></image>
-								<text class="title">实名认证</text>
-							</view>
-							<view class="right flex">
-								<text></text>
-								<image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
-							</view>
-						</view>
-						<button hover-class="none" class="flex listItem" open-type='contact'>
-							<view class="flex titleBox">
-								<image class="listIconImg" src="../../static/icon/userkf.png" mode="widthFix"></image>
-								<text class="title">客服</text>
-							</view>
-							<view class="right flex">
-								<text></text>
-								<image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
-							</view>
-						</button>
-						<view class="flex listItem" @click="navTo('/pages/user/shareQrCode')">
-							<view class="flex titleBox">
-								<image class="listIconImg" src="../../static/icon/usergg.png" mode="widthFix"></image>
-								<text class="title">邀请好友</text>
-							</view>
-							<view class="right flex">
-								<text></text>
-								<image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
-							</view>
-						</view>
-						<view class="flex listItem" @click="navTo('/pages/set/set')">
-							<view class="flex titleBox">
-								<image class="listIconImg" src="../../static/icon/userset.png" mode="widthFix"></image>
-								<text class="title">设置</text>
-							</view>
-							<view class="right flex">
-								<text></text>
-								<image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
-							</view>
-						</view>
-					</view>
-				</view>
-			</view>
-		</view>
-	</view>
-</template>
-<script>
-	import {
-		mapState,
-		mapMutations
-	} from 'vuex';
-	import {
-		share
-	} from '@/api/wx';
-	import {
-		getUser
-	} from '@/api/user.js';
-	import {
-		articleList,
-		notify
-	} from '@/api/index.js';
-	import {
-		saveUrl,
-		interceptor
-	} from '@/utils/loginUtils.js';
-	export default {
-		data() {
-			return {
-				user: {
-					avatar: '', //头像
-					nickname: '', //昵称
-					phone:''
-				},
-				shareData: {}
-			};
-		},
-		computed: {
-			...mapState('user', ['userInfo', 'orderInfo', 'hasLogin']),
-			...mapState(['baseURL', 'urlFile']),
-			...mapState(['fx']),
-			// 总消息条数
-			notic() {
-				return this.user.question_sum + this.user.notice_sum;
-			},
-		},
-		// 创建时获取分享信息
-		onLoad() {
-			// share().then((res) => {
-			// 	this.shareData = res.data.data
-			// }).catch((res) => {
-			// 	console.log(res, '分享加载失败');
-			// })
-		},
-		onShow() {
-			this.getUser();
-		},
-		methods: {
-			...mapMutations('user', ['setUserInfo']),
-			// 跳转卡片页面
-			navcard() {
-				// 判断是否已经认证
-				if (this.user.work_type_id <=0) {
-					this.navTo('/pages/user/model/modelrz')
-				} else {
-					if (this.user.show_template_id) {
-						this.navTo('/pages/user/model/model?mtype=' + this.user.show_template_id+'&look=1')
-					}else{
-						this.navTo('/pages/user/model/model')
-					}
-				}
-			},
-
-			//#ifdef APP
-			shareDomApp() {
-				uni.share({
-					provider: 'weixin',
-					type: 0,
-					title: '母婴界严选',
-					summary: '',
-					imageUrl: this.shareData.img,
-					href: this.baseURL + this.urlFile + '/pages/public/register?spread=' + this.userInfo.uid
-				})
-			},
-			//#endif
-			// 获取用户数据
-			getUser() {
-				console.log('data')
-				const that = this;
-				getUser({}).then((e) => {
-					this.user = e.data;
-					this.setUserInfo(e.data)
-				}).catch((e) => {
-					console.log(e, 'sj');
-				})
-				// 系统消息
-				// articleList({}, 1).then((e) => {
-				// 	that.user.question_sum = e.data.count
-				// 	console.log(that, 1);
-				// }).catch((e) => {
-				// 	console.log(e);
-				// })
-				// 报警消息
-				// notify().then((e) => {
-				// 	that.user.notice_sum = e.data.count
-				// }).catch((e) => {
-				// 	console.log(e);
-				// })
-			},
-			changeTab() {
-				this.$emit('tab', true)
-			},
-			navTo(url) {
-				console.log(this.hasLogin,'this.hasLogin');
-				if (!this.hasLogin) {
-					// 保存地址
-					saveUrl();
-					// 登录拦截
-					interceptor();
-				} else {
-					uni.navigateTo({
-						url,
-						fail(e) {
-							console.log(e);
-						}
-					});
-				}
-			},
-		}
-	};
-</script>
-<style lang="scss">
-	%section {
-		display: flex;
-		justify-content: space-around;
-		align-content: center;
-		border-radius: 10rpx;
-	}
-	%flex-center {
-		display: flex;
-		flex-direction: column;
-		justify-content: center;
-		align-items: center;
-	}
-	.listBox {
-		margin-top: 20rpx;
-		overflow: hidden;
-	}
-
-	.list {
-		.listItem {
-			padding: 35rpx 40rpx;
-			margin-bottom: 15rpx;
-			background-color: #FFFFFF;
-			border-radius: 20rpx;
-			border: none;
-			line-height: 1;
-			&::after{
-				border: none;
-			}
-		}
-		
-		.listIconImg {
-			width: 36rpx;
-			height: 36rpx;
-		}
-
-		.right {
-			.img {
-				width: 26rpx;
-			}
-		}
-
-		.titleBox {
-			.title {
-				padding-left: 20rpx;
-				color: $font-color-base;
-				font-size: $font-base;
-			}
-		}
-	}
-
-	.container {
-		background-color: $page-color-base;
-		background-image: url('../../static/image/userbg.png') ;
-		background-repeat: no-repeat;
-		background-size: 100% auto;
-		padding-top: 100rpx;
-		padding-bottom: 50rpx;
-	}
-
-	.user-section {
-		background-color: #FFF;
-		border-radius: 20rpx;
-		margin: 0 $page-row-spacing;
-		padding: 40rpx 0;
-		.avatar{
-			width: 130rpx;
-			height: 130rpx;
-			margin: 0 auto;
-			border-radius: 100rpx;
-			overflow: hidden;
-			margin-bottom: 30rpx;
-			.image{
-				width:100%;
-				height: 100%;
-			}
-		}
-		.phone{
-			height:1rem;
-			margin-bottom: 30rpx;
-		}
-	}
-
-	.cover-container {
-		padding: 0 30rpx;
-		position: relative;
-		padding-bottom: 20rpx;
-	}
-	.tj-sction {
-		@extend %section;
-	
-		.tj-item {
-			@extend %flex-center;
-			flex-direction: column;
-			height: 100rpx;
-			font-size: $font-sm;
-			color: $font-color-light;
-		}
-	
-		.num {
-			font-size: $font-lg + 4rpx;
-			color: $font-color-dark;
-			margin-bottom: 8rpx;
-			font-weight: bold;
-		}
-	}
-	.item-box {
-		border-radius: 20rpx;
-		background-color: white;
-		margin-top: 20rpx;
-	
-		.box-title {
-			line-height: 1;
-			padding: 30rpx 40rpx;
-	
-			.title {
-				font-size: $font-lg;
-				font-weight: bold;
-			}
-	
-			.link {
-				font-size: $font-base - 2rpx;
-				color: $font-color-light;
-				.img{
-					width: 26rpx;
-				}
-			}
-		}
-	
-		.order-section {
-			@extend %section;
-			padding: 28rpx 0;
-			padding-top: 0;
-	
-			.order-item {
-				@extend %flex-center;
-				width: 120rpx;
-				height: 120rpx;
-				border-radius: 10rpx;
-				font-size: $font-sm;
-				color: $font-color-dark;
-			}
-	
-			.iconfont {
-				font-size: 48rpx;
-				margin-bottom: 18rpx;
-				color: #fa436a;
-			}
-	
-			.icon-shouhoutuikuan {
-				font-size: 44rpx;
-			}
-	
-			.icon {
-				height: 50rpx;
-				width: 48rpx;
-				margin-bottom: 18rpx;
-				background-size: 100%;
-				background-repeat: no-repeat;
-				background-position: center;
-	
-				.icon-img {
-					width: 100%;
-					height: 100%;
-				}
-			}
-		}
-	}
-</style>
+<template>
+	<view class="container">
+		<view class="content-box">
+			<view class="user-section">
+				<view class="avatar" @click="navTo('/pages/set/userinfo')">
+					<image class="image" :src="user.avatar|| urlFile+`/static/error/missing-face.png`"
+						mode="scaleToFill"></image>
+				</view>
+				<view class="flex-center phone">
+					<template v-if="user.phone">
+						{{((''+user.phone).split('').splice(3,4,'****')).join('')}}
+					</template>
+				</view>
+				<view class="tj-sction">
+					<view class="tj-item" @click="navTo('/pages/user_home/award/award')">
+						<text class="num">{{ user.brokerage_price || '0.00' }}</text>
+						<text>我的佣金</text>
+					</view>
+					<view class="tj-item" @click="navTo('/pages/user_home/money/wallet')">
+						<text class="num">{{user.now_money || '0.00' }}</text>
+						<text>我的卡券</text>
+					</view>
+				</view>
+			</view>
+
+			<view class="cover-container">
+
+				<view class="item-box">
+					<view class="box-title flex">
+						<view class="title"><text>我的订单</text></view>
+						<view class="link flex" @click="navTo('/pages/order/order?state=0')" hover-class="common-hover">
+							<text class="margin-r-10">全部</text>
+							<image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
+						</view>
+					</view>
+					<view class="order-section">
+						<view class="order-item" @click="navTo('/pages/order/order?state=0')" hover-class="common-hover"
+							:hover-stay-time="50">
+							<view class=" icon position-relative">
+								<image class="icon-img" src="../../static/icon/userorder1.png" mode="aspectFit">
+								</image>
+								<view class="corner" v-if="user.unpaid_count > 0">
+									<text>{{ user.unpaid_count }}</text>
+								</view>
+							</view>
+							<text>待付款</text>
+						</view>
+						<view class="order-item" @click="navTo('/pages/order/order?state=1')" hover-class="common-hover"
+							:hover-stay-time="50">
+							<view class="icon position-relative">
+								<image class="icon-img" src="../../static/icon/userorder2.png" mode="aspectFit">
+								</image>
+								<view class="corner" v-if="user.received_count > 0">
+									<text>{{ user.received_count }}</text>
+								</view>
+							</view>
+							<text>待核销</text>
+						</view>
+						<view class="order-item" @click="navTo('/pages/order/order?state=3')" hover-class="common-hover"
+							:hover-stay-time="50">
+							<view class=" icon position-relative">
+								<image class="icon-img" src="../../static/icon/userorder3.png" mode="aspectFit">
+								</image>
+							</view>
+							<text>已完成</text>
+						</view>
+					</view>
+				</view>
+				<view class="listBox">
+					<view class="list">
+						<view class="flex listItem" @click="navTo('/pages/user_home/myRent')">
+							<view class="flex titleBox">
+								<image class="listIconImg" src="../../static/icon/in1.png" mode="widthFix"></image>
+								<text class="title">我的电池</text>
+							</view>
+							<view class="right flex">
+								<text></text>
+								<image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
+							</view>
+						</view>
+						<view class="flex listItem" @click="smsh" v-if="userInfo && userInfo.adminid == 1">
+							<view class="flex titleBox">
+								<image class="listIconImg" src="../../static/icon/userhx.png" mode="widthFix"></image>
+								<text class="title">核销</text>
+							</view>
+							<view class="right flex">
+								<text></text>
+								<image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
+							</view>
+						</view>
+						<view class="flex listItem" @click="navTo('/pages/shop/attestation')"
+							v-if="userInfo && userInfo.is_real != 1">
+							<view class="flex titleBox">
+								<image class="listIconImg" src="../../static/icon/userreal.png" mode="widthFix"></image>
+								<text class="title">实名认证</text>
+							</view>
+							<view class="right flex">
+								<text></text>
+								<image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
+							</view>
+						</view>
+						<button hover-class="none" class="flex listItem" open-type='contact'>
+							<view class="flex titleBox">
+								<image class="listIconImg" src="../../static/icon/userkf.png" mode="widthFix"></image>
+								<text class="title">客服</text>
+							</view>
+							<view class="right flex">
+								<text></text>
+								<image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
+							</view>
+						</button>
+						<view class="flex listItem" @click="navTo('/pages/user/shareQrCode')">
+							<view class="flex titleBox">
+								<image class="listIconImg" src="../../static/icon/usergg.png" mode="widthFix"></image>
+								<text class="title">邀请好友</text>
+							</view>
+							<view class="right flex">
+								<text></text>
+								<image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
+							</view>
+						</view>
+						<view class="flex listItem" @click="navTo('/pages/set/set')">
+							<view class="flex titleBox">
+								<image class="listIconImg" src="../../static/icon/userset.png" mode="widthFix"></image>
+								<text class="title">设置</text>
+							</view>
+							<view class="right flex">
+								<text></text>
+								<image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
+							</view>
+						</view>
+					</view>
+				</view>
+			</view>
+		</view>
+		<!-- 核销弹窗 -->
+		<uni-popup ref="popuphx" class="agree-wrapper">
+			<view class="hx-wrapper">
+				<view class="hx-img">
+					<image src="../../static/img/hxbg.png" mode=""></image>
+				</view>
+				<view class="hx-body">
+					<view class="nav-hx">
+						<text @click="hxtype = 0" :class="{'action': hxtype == 0}">商品核销</text ><text @click="hxtype = 1" :class="{'action': hxtype ==1}">电池核销</text>
+					</view>
+					<!-- <view class="hx-title">
+						核销码
+					</view> -->
+					<input type="text" v-model="code" placeholder="请输入核销码" placeholder-class="hx-placeholder" />
+					<!-- <image src="../../static/icon/scend.png" mode=""></image> -->
+					<input type="text" v-model="dcode" placeholder="请输入电池编号" placeholder-class="hx-placeholder" v-if="hxtype == 1"/>
+					<view class="hx-btn" @click="qhx">
+						立即核销
+					</view>
+				</view>
+				<view class="hx-close" @click="close">
+					<image src="../../static/icon/close.png" mode=""></image>
+				</view>
+			</view>
+		</uni-popup>
+	</view>
+</template>
+<script>
+	import weixinObj from "@/plugin/jweixin-module/index.js";
+	import {
+		mapState,
+		mapMutations
+	} from 'vuex';
+	import {
+		share
+	} from '@/api/wx';
+	import {
+		getUser
+	} from '@/api/user.js';
+	import {
+		articleList,
+		notify,
+		rentVerific,
+		orderVerific
+	} from '@/api/index.js';
+	import {
+		saveUrl,
+		interceptor
+	} from '@/utils/loginUtils.js';
+	export default {
+		data() {
+			return {
+				hxLoading: false,
+				hxtype: 0, //0普通核销1电池核销
+				dcode: '', //电池编号
+				code: '', //商品核销码
+				user: {
+					avatar: '', //头像
+					nickname: '', //昵称
+					phone: ''
+				},
+				shareData: {}
+			};
+		},
+		computed: {
+			...mapState('user', ['userInfo', 'orderInfo', 'hasLogin']),
+			...mapState(['baseURL', 'urlFile']),
+			...mapState(['fx']),
+			// 总消息条数
+			notic() {
+				return this.user.question_sum + this.user.notice_sum;
+			},
+		},
+		// 创建时获取分享信息
+		onLoad() {
+			// share().then((res) => {
+			// 	this.shareData = res.data.data
+			// }).catch((res) => {
+			// 	console.log(res, '分享加载失败');
+			// })
+		},
+		onShow() {
+			this.getUser();
+		},
+		methods: {
+			...mapMutations('user', ['setUserInfo']),
+			qhx() {
+				let that = this
+				if (that.hxLoading) {
+					return
+				}
+				if (that.code == '') {
+					return that.$api.msg('请输入核销码')
+				}
+				if (that.hxtype == 0) {
+					that.hxLoading = true
+					orderVerific({
+						verify_code: that.code,
+						is_confirm: 1
+					}).then(res => {
+						uni.showToast({
+							title: '核销成功',
+							mask: true,
+							duration: 1500
+						});
+						that.close()
+						that.hxLoading = false
+					}).catch(err => [
+						that.hxLoading = false
+					])
+				} else {
+					if (that.dcode == '') {
+						return that.$api.msg('请输入电池编号')
+					}
+					that.hxLoading = false
+					rentVerific({
+						verify_code: that.code,
+						battery_number: that.dcode,
+						is_confirm: 1
+					}).then(res => {
+						uni.showToast({
+							title: '核销成功',
+							mask: true,
+							duration: 1500
+						});
+						that.close()
+						that.hxLoading = false
+					})
+				}
+			},
+			openHx() {
+				this.$refs.popuphx.open()
+			},
+			close() {
+				this.code == ''
+				this.dcode == ''
+				this.$refs.popuphx.close()
+			},
+			// 扫码
+			smsh() {
+				let that = this
+				// #ifdef H5
+				try {
+					weixinObj.scanQRCode({
+						needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
+						scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是一维码,默认二者都有
+						success: function(res) {
+							var result = res.resultStr; // 当needResult 为 1 时,扫码返回的结果
+							that.code = result
+							that.openHx()
+							// 判断是否为电池核销
+							
+						}
+					});
+				} catch (err) {
+					console.log(err)
+					that.openHx()
+				}
+
+				// #endif
+				// #ifndef H5
+				uni.scanCode({
+					success: (res) => {
+						let result = res.result
+						that.code = result
+						that.openHx()
+					}
+				})
+				// #endif
+
+			},
+			// 跳转卡片页面
+			navcard() {
+				// 判断是否已经认证
+				if (this.user.work_type_id <= 0) {
+					this.navTo('/pages/user/model/modelrz')
+				} else {
+					if (this.user.show_template_id) {
+						this.navTo('/pages/user/model/model?mtype=' + this.user.show_template_id + '&look=1')
+					} else {
+						this.navTo('/pages/user/model/model')
+					}
+				}
+			},
+
+			//#ifdef APP
+			shareDomApp() {
+				uni.share({
+					provider: 'weixin',
+					type: 0,
+					title: '母婴界严选',
+					summary: '',
+					imageUrl: this.shareData.img,
+					href: this.baseURL + this.urlFile + '/pages/public/register?spread=' + this.userInfo.uid
+				})
+			},
+			//#endif
+			// 获取用户数据
+			getUser() {
+				console.log('data')
+				const that = this;
+				getUser({}).then((e) => {
+					this.user = e.data;
+					this.setUserInfo(e.data)
+				}).catch((e) => {
+					console.log(e, 'sj');
+				})
+				// 系统消息
+				// articleList({}, 1).then((e) => {
+				// 	that.user.question_sum = e.data.count
+				// 	console.log(that, 1);
+				// }).catch((e) => {
+				// 	console.log(e);
+				// })
+				// 报警消息
+				// notify().then((e) => {
+				// 	that.user.notice_sum = e.data.count
+				// }).catch((e) => {
+				// 	console.log(e);
+				// })
+			},
+			changeTab() {
+				this.$emit('tab', true)
+			},
+			navTo(url) {
+				console.log(this.hasLogin, 'this.hasLogin');
+				if (!this.hasLogin) {
+					// 保存地址
+					saveUrl();
+					// 登录拦截
+					interceptor();
+				} else {
+					uni.navigateTo({
+						url,
+						fail(e) {
+							console.log(e);
+						}
+					});
+				}
+			},
+		}
+	};
+</script>
+<style lang="scss">
+	%section {
+		display: flex;
+		justify-content: space-around;
+		align-content: center;
+		border-radius: 10rpx;
+	}
+
+	%flex-center {
+		display: flex;
+		flex-direction: column;
+		justify-content: center;
+		align-items: center;
+	}
+
+	.listBox {
+		margin-top: 20rpx;
+		overflow: hidden;
+	}
+
+	.list {
+		.listItem {
+			padding: 35rpx 40rpx;
+			margin-bottom: 15rpx;
+			background-color: #FFFFFF;
+			border-radius: 20rpx;
+			border: none;
+			line-height: 1;
+
+			&::after {
+				border: none;
+			}
+		}
+
+		.listIconImg {
+			width: 36rpx;
+			height: 36rpx;
+		}
+
+		.right {
+			.img {
+				width: 26rpx;
+			}
+		}
+
+		.titleBox {
+			.title {
+				padding-left: 20rpx;
+				color: $font-color-base;
+				font-size: $font-base;
+			}
+		}
+	}
+
+	.container {
+		background-color: $page-color-base;
+		background-image: url('../../static/image/userbg.png');
+		background-repeat: no-repeat;
+		background-size: 100% auto;
+		padding-top: 100rpx;
+		padding-bottom: 50rpx;
+	}
+
+	.user-section {
+		background-color: #FFF;
+		border-radius: 20rpx;
+		margin: 0 $page-row-spacing;
+		padding: 40rpx 0;
+
+		.avatar {
+			width: 130rpx;
+			height: 130rpx;
+			margin: 0 auto;
+			border-radius: 100rpx;
+			overflow: hidden;
+			margin-bottom: 30rpx;
+
+			.image {
+				width: 100%;
+				height: 100%;
+			}
+		}
+
+		.phone {
+			height: 1rem;
+			margin-bottom: 30rpx;
+		}
+	}
+
+	.cover-container {
+		padding: 0 30rpx;
+		position: relative;
+		padding-bottom: 20rpx;
+	}
+
+	.tj-sction {
+		@extend %section;
+
+		.tj-item {
+			@extend %flex-center;
+			flex-direction: column;
+			height: 100rpx;
+			font-size: $font-sm;
+			color: $font-color-light;
+		}
+
+		.num {
+			font-size: $font-lg + 4rpx;
+			color: $font-color-dark;
+			margin-bottom: 8rpx;
+			font-weight: bold;
+		}
+	}
+
+	.item-box {
+		border-radius: 20rpx;
+		background-color: white;
+		margin-top: 20rpx;
+
+		.box-title {
+			line-height: 1;
+			padding: 30rpx 40rpx;
+
+			.title {
+				font-size: $font-lg;
+				font-weight: bold;
+			}
+
+			.link {
+				font-size: $font-base - 2rpx;
+				color: $font-color-light;
+
+				.img {
+					width: 26rpx;
+				}
+			}
+		}
+
+		.order-section {
+			@extend %section;
+			padding: 28rpx 0;
+			padding-top: 0;
+
+			.order-item {
+				@extend %flex-center;
+				width: 120rpx;
+				height: 120rpx;
+				border-radius: 10rpx;
+				font-size: $font-sm;
+				color: $font-color-dark;
+			}
+
+			.iconfont {
+				font-size: 48rpx;
+				margin-bottom: 18rpx;
+				color: #fa436a;
+			}
+
+			.icon-shouhoutuikuan {
+				font-size: 44rpx;
+			}
+
+			.icon {
+				height: 50rpx;
+				width: 48rpx;
+				margin-bottom: 18rpx;
+				background-size: 100%;
+				background-repeat: no-repeat;
+				background-position: center;
+
+				.icon-img {
+					width: 100%;
+					height: 100%;
+				}
+			}
+		}
+	}
+
+	.hx-wrapper {
+		width: 536rpx;
+		// height: 630rpx;
+		position: relative;
+		padding-bottom: 40rpx;
+		background-color: #fff;
+		border-radius: 20rpx;
+
+		.hx-img {
+			width: 536rpx;
+			height: 281rpx;
+
+			image {
+				width: 536rpx;
+				height: 281rpx;
+			}
+		}
+
+		.hx-close {
+			position: absolute;
+			left: 243rpx;
+			bottom: -80rpx;
+			width: 52rpx;
+			height: 52rpx;
+
+			image {
+				width: 52rpx;
+				height: 52rpx;
+			}
+		}
+
+		.hx-body {
+			width: 536rpx;
+			// min-height: 349rpx;
+			background-color: #fff;
+			border-radius: 0 0 10rpx 10rpx;
+			padding-top: 40rpx;
+
+			.hx-title {
+				width: 536rpx;
+				font-size: 36rpx;
+				font-weight: 500;
+				color: #333333;
+				line-height: 1;
+				padding-top: 42rpx;
+				text-align: center;
+				padding-bottom: 10rpx;
+			}
+
+			input {
+				width: 439rpx;
+				height: 68rpx;
+				background: #f1faf6;
+				border-radius: 10rpx;
+				margin: 0 auto 40rpx;
+				padding-left: 26rpx;
+
+				.hx-placeholder {
+					font-size: 26rpx;
+					font-weight: 500;
+					color: $base-color;
+				}
+			}
+
+			.hx-btn {
+				margin: 44rpx auto 0;
+				width: 353rpx;
+				height: 71rpx;
+				background: $base-color;
+				border-radius: 34rpx;
+				font-size: 36rpx;
+				font-weight: 500;
+				color: #F8F9F9;
+				line-height: 71rpx;
+				text-align: center;
+			}
+
+
+		}
+	}
+	.nav-hx {
+		display: flex;
+		justify-content: center;
+		margin-bottom: 20rpx;
+		text {
+			font-size:28rpx;
+			padding: 10rpx;
+		}
+		.action {
+			color: $base-color;
+			font-weight: bold;
+			
+		}
+	}
+</style>

+ 316 - 0
pages/user_home/myRent.vue

@@ -0,0 +1,316 @@
+<template>
+	<view class="content">
+		<view v-for="(item, index) in list" :key="index" class="order-item">
+			<view class="i-top b-b">
+				<text class="time">订单编号:{{ item.order_id }}</text>
+				<text class="state">{{ item.status == 1?'待核销':(item.status == 2 ? '已核销': '')  }}</text>
+				<text v-if="item.status === 4" class="del-btn iconfont icondelete" @click="deleteOrder(index)"></text>
+			</view>
+			<view class="goods-box-single">
+				<image class="goods-img" src="../../static/icon/in1.png" mode="scaleToFill"></image>
+				<view class="right">
+					<view class="flex flextop">
+						<text class="title clamp2">租电订单</text>
+						<text class="price">{{ moneyNum(item.price) }}</text>
+					</view>
+					<view class="row flex">
+						<text class="row_title">{{ item.month ? (item.month + '月') : '' }}</text>
+					</view>
+				</view>
+			</view>
+			<view class="price-box">
+				实付款
+				<text class="price">{{ moneyNum(item.pay_price)}}</text>(押金{{moneyNum(item.deposit)}})
+			</view>
+			<view class="action-box b-t">
+				<button v-if="item.status == 1" class="action-btn btn-base"
+					@click.stop="navTo('/pages/order/hxqm?id=' + item.verify_code + '&type=2')">出示券码</button>
+<!-- 				<button v-if="item.status == 2" class="action-btn btn-base"
+					@click.stop="navTo('/pages/order/hxqm?id=' + item.verify_code + '&type=2')">续费</button> -->
+			</view>
+		</view>
+
+		<uni-load-more :status="loadingType"></uni-load-more>
+	</view>
+</template>
+
+<script>
+	import {
+		getMyRent
+	} from '@/api/user.js'
+	export default {
+		data() {
+			return {
+				page: 1,
+				limit: 10,
+				loadingType: 'more',
+				loaded: false,
+				list: []
+			}
+		},
+		onLoad() {
+			this.getMyRent()
+		},
+		onShow() {
+
+		},
+		onReachBottom() {
+			this.getMyRent()
+		},
+		onReady() {
+
+		},
+		methods: {
+			navTo(url) {
+				uni.navigateTo({
+					url,
+					fail() {
+						uni.switchTab({
+							url
+						})
+					}
+				})
+			},
+			moneyNum(val) {
+				return (val * 1).toFixed(2)
+			},
+			getMyRent() {
+				let that = this
+				if (that.loadingType == 'loading' && that.loadingType == 'noMore') {
+					return
+				}
+				that.loadingType = 'loading'
+				getMyRent({
+					page: that.page,
+					limit: that.limit,
+					status: 0
+				}).then(res => {
+					let arr = res.data.list
+					that.list = that.list.concat(arr)
+					that.page++
+					if (arr.length == that.limit) {
+						that.loadingType = 'more'
+					} else {
+						that.loadingType = 'noMore'
+					}
+					that.loaded = true
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.content {
+		padding-top: 20rpx;
+	}
+
+	.order-item {
+		display: flex;
+		flex-direction: column;
+		padding-left: 30rpx;
+		background: #fff;
+		margin: 0 $page-row-spacing;
+		margin-bottom: 30rpx;
+		border-radius: 20rpx;
+		padding-bottom: 10rpx;
+
+		.i-top {
+			display: flex;
+			align-items: center;
+			height: 80rpx;
+			padding-right: 30rpx;
+			font-size: $font-base;
+			color: $font-color-dark;
+			position: relative;
+
+			.time {
+				flex: 1;
+			}
+
+			.state {
+				color: $base-color;
+			}
+
+			.del-btn {
+				padding: 10rpx 0 10rpx 36rpx;
+				font-size: $font-lg;
+				color: $font-color-light;
+				position: relative;
+
+				&:after {
+					content: '';
+					width: 0;
+					height: 30rpx;
+					border-left: 1px solid $border-color-dark;
+					position: absolute;
+					left: 20rpx;
+					top: 50%;
+					transform: translateY(-50%);
+				}
+			}
+		}
+
+		/* 多条商品 */
+		.goods-box {
+			height: 160rpx;
+			padding: 20rpx 0;
+			white-space: nowrap;
+
+			.goods-item {
+				width: 120rpx;
+				height: 120rpx;
+				display: inline-block;
+				margin-right: 24rpx;
+			}
+
+			.goods-img {
+				display: block;
+				width: 100%;
+				height: 100%;
+			}
+		}
+
+		/* 单条商品 */
+		.goods-box-single {
+			display: flex;
+			padding: 20rpx 0;
+
+			.goods-img {
+				display: block;
+				width: 170rpx;
+				height: 170rpx;
+				border-radius: 20rpx;
+			}
+
+			.right {
+				flex: 1;
+				display: flex;
+				flex-direction: column;
+				padding: 0 30rpx 0 24rpx;
+				overflow: hidden;
+
+				.flextop {
+					align-items: flex-start;
+					line-height: 1.3;
+				}
+
+				.row {
+					margin-top: 10rpx;
+				}
+
+				.row_title {
+					padding: 5rpx 10rpx;
+					background-color: #dddddd;
+					border-radius: 10rpx;
+					font-size: 22rpx;
+					color: #ffffff;
+				}
+
+				.title {
+					font-size: $font-base + 2rpx;
+					color: $font-color-dark;
+					width: 80%;
+					min-height: 2rem;
+				}
+
+				.attr-box {
+					display: flex;
+					justify-content: flex-end;
+					font-size: $font-sm + 2rpx;
+					color: $font-color-light;
+				}
+
+				.price {
+					display: inline;
+					font-size: $font-base + 2rpx;
+					color: $font-color-light;
+
+					&:before {
+						content: '¥';
+						font-size: $font-sm;
+
+					}
+				}
+			}
+		}
+
+		.price-box {
+			display: flex;
+			justify-content: flex-end;
+			align-items: baseline;
+			padding: 20rpx 30rpx;
+			font-size: $font-sm + 2rpx;
+			color: $font-color-light;
+
+			.num {
+				margin: 0 8rpx;
+				color: $font-color-dark;
+			}
+
+			.price {
+				font-size: $font-lg;
+				color: $font-color-dark;
+
+				&:before {
+					content: '¥';
+					font-size: $font-sm;
+					margin: 0 2rpx 0 8rpx;
+				}
+			}
+		}
+
+		.action-box {
+			display: flex;
+			justify-content: flex-end;
+			align-items: center;
+			height: 100rpx;
+			position: relative;
+			padding-right: 30rpx;
+		}
+
+		.action-btn {
+			width: 160rpx;
+			height: 60rpx;
+			margin: 0;
+			margin-left: 24rpx;
+			padding: 0;
+			text-align: center;
+			line-height: 60rpx;
+			font-size: $font-sm + 2rpx;
+			color: $font-color-dark;
+			background: #fff;
+			border-radius: 100px;
+
+			&.btn-red {
+				color: $color-red;
+				border: 1px solid $color-red;
+			}
+
+			&.btn-base {
+				color: $base-color;
+				border: 1px solid $base-color;
+			}
+
+			&:after {
+				border-radius: 100px;
+			}
+
+			&.recom {
+				color: $base-color;
+
+				&:after {
+					border-color: $base-color;
+				}
+			}
+
+			&.evaluate {
+				color: $color-yellow;
+
+				&:after {
+					border-color: $color-yellow;
+				}
+			}
+		}
+	}
+</style>

+ 1 - 1
pages/user_home/shareQrCode.vue

@@ -64,7 +64,7 @@ export default {
 			let data = {
 				path: path,
 				imageUrl: this.poster,
-				title: this.userInfo.nickname + '邀请您进入绿津'
+				title: this.userInfo.nickname + '邀请您进入卡羚能租'
 			};
 			console.log('---data---',data)
 			return data;

BIN
static/icon/close.png


BIN
static/icon/userhx.png


BIN
static/img/hxbg.png