diff --git a/components/payPwd/index.vue b/components/payPwd/index.vue index fdf46c7..8032dab 100644 --- a/components/payPwd/index.vue +++ b/components/payPwd/index.vue @@ -1,19 +1,21 @@ + + \ No newline at end of file diff --git a/components/popups/index.vue b/components/popups/index.vue index 1c18754..3cdf31e 100644 --- a/components/popups/index.vue +++ b/components/popups/index.vue @@ -57,10 +57,10 @@ type: Boolean, default: false }, - title: { - type: String, - default: '请输入支付密码' - } + title: { + type: String, + default: '请输入支付密码' + } }, data() { return { @@ -134,7 +134,6 @@ // 开启 handleOpen() { this.value = ''; - console.log('123:' + this.value); this.$refs.popup.open(); }, diff --git a/components/popups/index_backup.vue b/components/popups/index_backup.vue deleted file mode 100644 index 166054a..0000000 --- a/components/popups/index_backup.vue +++ /dev/null @@ -1,167 +0,0 @@ - - - - - \ No newline at end of file diff --git a/pages/payment/settlement.vue b/pages/payment/settlement.vue index a557ea8..9aa2925 100644 --- a/pages/payment/settlement.vue +++ b/pages/payment/settlement.vue @@ -395,7 +395,6 @@ payment: function(data) { let that = this; createOrder(data).then(res => { - let status = res.data.status, orderId = res.data.result.order_id, jsConfig = res.data.result.config, @@ -404,7 +403,6 @@ '&product_type=' + that.payForm.product_type + '&source=' + that.payForm.source, goPagesOrder = '/pages/order_details/stay?order_id=' + orderId + '&credit_buy=1&product_type=' + that.payForm.product_type; - that.orderPay = true; uni.hideLoading(); switch (status) { @@ -580,7 +578,7 @@ }); }, - SubOrder: function() { + SubOrder: async function() { let that = this, data = {}; if (!that.payType) return that.$util.Tips({ @@ -596,6 +594,17 @@ // 设置支付密码 if (that.payType == 'balance' || that.payType == 'merBalance') { + // 是否输入密码 + const result = await this.$util.checkPassword(); + if (result.data.code == 101) { //未设置支付密码 + return this.$util.Tips({ + title: "您暂未设置支付密码,请前往设置!" + }, () => { + uni.navigateTo({ + url: "/pages/users/user_modify_pwd/index?type=payPwd" + }); + }) + } this.$refs.popups.handleOpen(); } else { uni.showLoading({ @@ -606,29 +615,20 @@ } }, - // 输入密码回调 - handleConfirm(e) { - // 验证密码是否正确 - verifyPwd({ - withdrawal_pwd: e - }).then(res => { - // 密码是否有效 状态码判断 - const code = res.data.code; + async handleConfirm(e) { + const result = await this.$util.checkPassword(e); + // 验证密码正确 + if (result.data.code == 100) { this.$set(this.payForm, 'withdrawal_pwd', e); - - if (code == 100) { //密码正确 - uni.showLoading({ - title: '订单支付中', - mask: true - }); - this.truePayOrder(this.payForm); - } else { - this.$refs.payPwd.handleOpen(code); - } - }).catch(err => { - console.log(err) - }) + uni.showLoading({ + title: '订单支付中', + mask: true + }); + this.truePayOrder(this.payForm); + } else { + this.$refs.payPwd.handleOpen(result.data.code); + } }, // 弹框左边按钮 101 未设置密码 102 忘记密码 都去设置密码 diff --git a/pages/product/shop_type_change/index.vue b/pages/product/shop_type_change/index.vue index accf02b..b6c7c88 100644 --- a/pages/product/shop_type_change/index.vue +++ b/pages/product/shop_type_change/index.vue @@ -81,7 +81,7 @@ }) shopTypeChange({ - type: 3, + type: this.selected == 1 ? 3 : 4, mer_id: this.mer_id }).then(res => { if (res.status == 200) { diff --git a/pages/product/shop_type_change/list.vue b/pages/product/shop_type_change/list.vue index 4bbd5df..aef89c8 100644 --- a/pages/product/shop_type_change/list.vue +++ b/pages/product/shop_type_change/list.vue @@ -13,7 +13,6 @@ - {{item.status == 0?'审核中':item.status==1?'审核通过':'审核未通过'}} @@ -47,7 +46,8 @@ 备注: - {{item.update_time || ''}} + {{item.update_time || ''}} + diff --git a/pages/users/embody/embody.vue b/pages/users/embody/embody.vue index 82f5782..ab33309 100644 --- a/pages/users/embody/embody.vue +++ b/pages/users/embody/embody.vue @@ -435,6 +435,8 @@ that.$set(that, 'pics', that.pics); }, subCash: async function(e) { + + let that = this, value = e.detail.value; value.source = this.source @@ -504,6 +506,17 @@ } this.modes = mode; + // 是否输入密码 + const result = await this.$util.checkPassword(); + if (result.data.code == 101) { //未设置支付密码 + return this.$util.Tips({ + title: "您暂未设置支付密码,请前往设置!" + }, () => { + uni.navigateTo({ + url: "/pages/users/user_modify_pwd/index?type=payPwd" + }); + }) + } this.$refs.popups.handleOpen(); }, @@ -528,27 +541,19 @@ }, // 输入密码回调 - handleConfirm(e) { - // 验证密码是否正确 - verifyPwd({ - withdrawal_pwd: e - }).then(res => { - // 密码是否有效 状态码判断 - const code = res.data.code; + async handleConfirm(e) { + const result = await this.$util.checkPassword(e); + // 验证密码正确 + if (result.data.code == 100) { this.$set(this.modes, 'withdrawal_pwd', e); - - if (code == 100) { //密码正确 - uni.showLoading({ - title: '订单支付中', - mask: true - }); - this.trueWithdraw(); - } else { - this.$refs.payPwd.handleOpen(code); - } - }).catch(err => { - console.log(err) - }) + uni.showLoading({ + title: '订单支付中', + mask: true + }); + this.trueWithdraw(); + } else { + this.$refs.payPwd.handleOpen(result.data.code); + } }, // 弹框左边按钮 101 未设置密码 102 忘记密码 都去设置密码 @@ -570,8 +575,9 @@ }, handleClear() {}, - handleChange() {}, - + handleChange() { + this.load = false; + }, async postCreate(price) { const data = { diff --git a/utils/util.js b/utils/util.js index 95f5fc2..74b8c5d 100644 --- a/utils/util.js +++ b/utils/util.js @@ -15,10 +15,20 @@ import store from '../store'; import { pathToBase64 } from '@/plugin/image-tools/index.js'; +import { + verifyPwd +} from '@/api/order.js'; // #ifdef APP-PLUS import permision from "./permission.js" // #endif export default { + // 是否设置密码 + checkPassword: async function(e) { + e = e ? e : ''; + return await verifyPwd({ + withdrawal_pwd: e + }); + }, /** * 字符串截取 * @obj 传入的数据 @@ -110,9 +120,9 @@ export default { setTimeout(function() { uni.redirectTo({ url: url, - fail(err) { - console.log("跳转失败", err); - } + fail(err) { + console.log("跳转失败", err); + } }) }, endtime); break; @@ -185,7 +195,7 @@ export default { arr.push(text.slice(str, text.length)); return [strLength, arr, rows] // [处理文字的总字节长度,每行显示内容的数组,行数] }, -/** + /** * 获取分享海报 * @param array arr2 海报素材 * @param string store_name 素材文字 @@ -202,7 +212,7 @@ export default { * 只能获取合法域名下的图片信息,本地调试无法获取 * */ - uni.getImageInfo({ + uni.getImageInfo({ src: arr2[0], success: function(res) { // console.log(res, 'getImageInfo') @@ -220,7 +230,8 @@ export default { ctx.drawImage(arr2[2], cx, cy, d, d); ctx.restore(); const CONTENT_ROW_LENGTH = 40; - let [contentLeng, contentArray, contentRows] = that.textByteLength(store_name, CONTENT_ROW_LENGTH); + let [contentLeng, contentArray, contentRows] = that.textByteLength(store_name, + CONTENT_ROW_LENGTH); if (contentRows > 2) { contentRows = 2; let textArray = contentArray.slice(0, 2); @@ -280,36 +291,38 @@ export default { * 只能获取合法域名下的图片信息,本地调试无法获取 * */ - uni.getImageInfo({ + uni.getImageInfo({ src: arr2[0], success: function(res) { // console.log(res, 'getImageInfo') const WIDTH = res.width; const HEIGHT = res.height; - ctx.drawImage(arr2[0], 0, 0, WIDTH, HEIGHT+50); + ctx.drawImage(arr2[0], 0, 0, WIDTH, HEIGHT + 50); ctx.save(); let r = 90; let d = r * 2; let cx = 555; let cy = 910; let ux = 50; - let uy = 50; + let uy = 50; ctx.arc(cx + r, cy + r, r, 0, 2 * Math.PI); ctx.drawImage(arr2[3], 30, 30, 50, 50); ctx.save(); - ctx.drawImage(arr2[2], cx, cy-30, d-30, d-30); + ctx.drawImage(arr2[2], cx, cy - 30, d - 30, d - 30); ctx.restore(); ctx.setTextAlign('left'); ctx.setFontSize(24); ctx.setFillStyle('#282828'); ctx.fillText(site_name, r, 62); const CONTENT_ROW_LENGTH = 26; - let [contentLeng, contentArray, contentRows] = that.textByteLength(store_name, CONTENT_ROW_LENGTH); + let [contentLeng, contentArray, contentRows] = that.textByteLength(store_name, + CONTENT_ROW_LENGTH); if (contentRows > 2) { contentRows = 2; let textArray = contentArray.slice(0, 2); - textArray[textArray.length - 1] = textArray[textArray.length - 1].slice(0,textArray[textArray.length - 1].length-1) - textArray[textArray.length - 1] += '…'; + textArray[textArray.length - 1] = textArray[textArray.length - 1].slice(0, + textArray[textArray.length - 1].length - 1) + textArray[textArray.length - 1] += '…'; contentArray = textArray; } ctx.setFontSize(32); @@ -323,18 +336,18 @@ export default { ctx.setFontSize(26); ctx.setFillStyle('#999999'); ctx.beginPath(); - const textWidth = ctx.measureText(ot_price+'¥').width + 16; //检查字体的宽度 + const textWidth = ctx.measureText(ot_price + '¥').width + 16; //检查字体的宽度 //绘制数字中间的矩形 ctx.setFillStyle('#999999'); - ctx.rect(35, 1062,textWidth-10, 1); + ctx.rect(35, 1062, textWidth - 10, 1); ctx.fill(); ctx.closePath(); ctx.fillText('¥' + ot_price, 35, 1030 + contentHh); ctx.clip(); ctx.restore(); - that.handleBorderRect(ctx, 30, 108, WIDTH-60, WIDTH-20, 12); + that.handleBorderRect(ctx, 30, 108, WIDTH - 60, WIDTH - 20, 12); ctx.clip(); - ctx.drawImage(arr2[1], 30, 108, WIDTH-60, WIDTH-20); + ctx.drawImage(arr2[1], 30, 108, WIDTH - 60, WIDTH - 20); ctx.draw(true, function() { uni.canvasToTempFilePath({ canvasId: 'myCanvas', @@ -378,7 +391,7 @@ export default { * 只能获取合法域名下的图片信息,本地调试无法获取 * */ - uni.getImageInfo({ + uni.getImageInfo({ src: arr2[0], success: function(res) { const WIDTH = res.width; @@ -390,25 +403,26 @@ export default { let ux = 50; let uy = 700; ctx.drawImage(arr2[0], 0, 0, WIDTH, HEIGHT); - ctx.drawImage(arr2[1], 32, 32, WIDTH-64, WIDTH-64); + ctx.drawImage(arr2[1], 32, 32, WIDTH - 64, WIDTH - 64); ctx.strokeStyle = "#ffffff"; ctx.save(); ctx.arc(cx + r, cy + r, r, 0, 2 * Math.PI); ctx.drawImage(arr2[2], 530, 760, d, d); that.handleBorderRect(ctx, ux, uy, r, r, 45); ctx.clip(); - ctx.stockStyle ="#ffffff"; + ctx.stockStyle = "#ffffff"; ctx.drawImage(arr2[3], ux, uy, r, r); ctx.restore(); ctx.setTextAlign('left') ctx.setFontSize(28); ctx.setFillStyle('#282828'); - ctx.fillText(nickname, r+60, 760); + ctx.fillText(nickname, r + 60, 760); ctx.setTextAlign('left') ctx.setFontSize(28); ctx.setFillStyle('#282828'); const CONTENT_ROW_LENGTH = 25; - let [contentLeng, contentArray, contentRows] = that.textByteLength(content, CONTENT_ROW_LENGTH); + let [contentLeng, contentArray, contentRows] = that.textByteLength(content, + CONTENT_ROW_LENGTH); if (contentRows > 2) { contentRows = 2; let textArray = contentArray.slice(0, 2); @@ -416,11 +430,11 @@ export default { contentArray = textArray; } ctx.setTextAlign('left'); - ctx.font = 'bold 32px Arial'; + ctx.font = 'bold 32px Arial'; let contentHh = 32 * 1.3; for (let m = 0; m < contentArray.length; m++) { ctx.fillText(contentArray[m], 55, 850 + contentHh * m); - } + } ctx.draw(true, function() { uni.canvasToTempFilePath({ canvasId: 'myCanvas', @@ -448,36 +462,36 @@ export default { }) }, /** - * 图片圆角设置 - * @param string x x轴位置 - * @param string y y轴位置 - * @param string w 图片宽 - * @param string y 图片高 - * @param string r 圆角值 - */ - handleBorderRect(ctx, x, y, w, h, r) { - ctx.beginPath(); - // 左上角 - ctx.arc(x + r, y + r, r, Math.PI, 1.5 * Math.PI); - ctx.moveTo(x + r, y); - ctx.lineTo(x + w - r, y); - ctx.lineTo(x + w, y + r); - // 右上角 - ctx.arc(x + w - r, y + r, r, 1.5 * Math.PI, 2 * Math.PI); - ctx.lineTo(x + w, y + h - r); - ctx.lineTo(x + w - r, y + h); - // 右下角 - ctx.arc(x + w - r, y + h - r, r, 0, 0.5 * Math.PI); - ctx.lineTo(x + r, y + h); - ctx.lineTo(x, y + h - r); - // 左下角 - ctx.arc(x + r, y + h - r, r, 0.5 * Math.PI, Math.PI); - ctx.lineTo(x, y + r); - ctx.lineTo(x + r, y); - - ctx.fill(); - ctx.closePath(); - }, + * 图片圆角设置 + * @param string x x轴位置 + * @param string y y轴位置 + * @param string w 图片宽 + * @param string y 图片高 + * @param string r 圆角值 + */ + handleBorderRect(ctx, x, y, w, h, r) { + ctx.beginPath(); + // 左上角 + ctx.arc(x + r, y + r, r, Math.PI, 1.5 * Math.PI); + ctx.moveTo(x + r, y); + ctx.lineTo(x + w - r, y); + ctx.lineTo(x + w, y + r); + // 右上角 + ctx.arc(x + w - r, y + r, r, 1.5 * Math.PI, 2 * Math.PI); + ctx.lineTo(x + w, y + h - r); + ctx.lineTo(x + w - r, y + h); + // 右下角 + ctx.arc(x + w - r, y + h - r, r, 0, 0.5 * Math.PI); + ctx.lineTo(x + r, y + h); + ctx.lineTo(x, y + h - r); + // 左下角 + ctx.arc(x + r, y + h - r, r, 0.5 * Math.PI, Math.PI); + ctx.lineTo(x, y + r); + ctx.lineTo(x + r, y); + + ctx.fill(); + ctx.closePath(); + }, /** * 用户信息分享海报 * @param array arr2 海报素材 1背景 0二维码 @@ -528,7 +542,7 @@ export default { } ctx.fillText(sitename, w * markx, h * marky); ctx.save(); - ctx.draw(false,setTimeout(()=>{ + ctx.draw(false, setTimeout(() => { uni.canvasToTempFilePath({ canvasId: 'myCanvas' + index, fileType: 'png', @@ -540,10 +554,10 @@ export default { fail: function(err) { // console.log(err) uni.hideLoading(); - + } }) - },1000)) + }, 1000)) }, fail: function(err) { @@ -624,7 +638,7 @@ export default { } }) }, -/** + /** * 小程序头像获取上传 * @param uploadUrl 上传接口地址 * @param filePath 上传文件路径 @@ -633,7 +647,7 @@ export default { */ uploadImgs(uploadUrl, filePath, successCallback, errorCallback) { let that = this; - let inputName = 'pics'; + let inputName = 'pics'; uni.uploadFile({ url: HTTP_REQUEST_URL + '/api/' + uploadUrl + '/' + inputName, filePath: filePath, @@ -688,8 +702,8 @@ export default { }, getNowUrl: function() { const pages = getCurrentPages(), - page = pages[pages.length - 1], - query = this.serialize(page.options || {}); + page = pages[pages.length - 1], + query = this.serialize(page.options || {}); return page.route + (query ? '?' + query : ''); }, /** @@ -923,4 +937,4 @@ export default { return status; }, } -} +} \ No newline at end of file