This commit is contained in:
DESKTOP-GMUNQ1B\k 2024-03-22 17:42:25 +08:00
parent 51448c0cf6
commit 8405461850
9 changed files with 397 additions and 297 deletions

View File

@ -1,4 +1,5 @@
<template>
<view>
<uni-popup ref="payModal" type="center" safeArea :animation="true">
<view class="payModal">
<view class="payModal-title">{{code == 101?'未设置密码':'支付密码错误'}}</view>
@ -14,6 +15,7 @@
</view>
</view>
</uni-popup>
</view>
</template>
<script>
@ -24,7 +26,6 @@
}
},
methods: {
//
handleOpen(code) {
this.code = code;

View File

@ -0,0 +1,247 @@
<template>
<view>
<uni-popup ref="popup" type="bottom" :mask-background-color="isPay?'rgba(0,0,0,.8)':'transparent'" safeArea
backgroundColor="transparent" :animation="true" @maskClick="maskClick">
<view class="popup-wrap" :style="{'border-radius':isPay?'': 0}">
<view class="paybox" v-if="isPay">
<view class="paybox-title">
<view class="paybox-title-left"></view>
<view class="paybox-title-middle">请输入支付密码</view>
<view class="paybox-titler-right" @click="handleClose">
<u-icon name="close" size="18" color="#666" />
</view>
</view>
<view class="paybox-input">
<u-code-input v-model="value" mode="box" dot readonly></u-code-input>
</view>
</view>
<view class="keyboard">
<view class="keyboard-left" :style="{width:isPay?'100%':''}">
<block v-for="(item,indx) in keys" :key="indx">
<view class="keyboard-left-item active del" v-if="item=='del'" @click="handleClick(item)">
<image style="width: 48rpx;height: 48rpx;" src="@/static/del.webp" />
</view>
<view class="keyboard-left-item word active"
:style="{width:isPay?'0%':'',border:isPay?'0':''}" v-else-if="item == '.'"
@click="handleClick(item)">
{{isPay?'':item}}
</view>
<view class="keyboard-left-item word active"
:style="{width:(isPay && item == '0')?'66.66%':''}" v-else @click="handleClick(item)">
{{item}}
</view>
</block>
</view>
<view class="keyboard-right" :style="{width:isPay?'0%':''}">
<view class="keyboard-right-clear word active" @click="handleClear">清空</view>
<view class="keyboard-right-pay word active-pay" @click="handlePay">{{txt}}</view>
</view>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
export default {
name: "popups",
props: {
txt: {
type: String,
default: '付款'
},
isPay: { //
type: Boolean,
default: false
}
},
data() {
return {
keys: [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, '.', 'del'],
value: '',
}
},
watch: {
value(newVal, oldVal) {
//
if (newVal.length == 6 && this.isPay) {
this.handlePay();
}
}
},
methods: {
//
handleClick(item) {
if (this.value.length >= 10) return;
if (item == ".") {
if (!this.value) {
this.value = '0.';
} else {
if (this.value.indexOf('.') > -1) return;
this.value = this.value + item;
}
} else if (item == 'del') {
if (this.value == "0.")
this.value = this.value.substring(0, 0);
else
this.value = this.value.substring(0, this.value.length - 1);
} else if (item == 0) {
if (this.isPay) {
this.value = this.value + item;
} else {
if (this.value) {
if (this.value.lastIndexOf('.') != -1 && this.value.length - this.value.lastIndexOf('.') == 3)
return;
this.value = this.value + item;
} else {
this.value = this.value + item;
}
}
} else {
if (this.value.lastIndexOf('.') != -1 && this.value.length - this.value.lastIndexOf('.') == 3) return;
this.value = this.value + item;
}
this.$emit('change', this.value);
},
//
handleClear() {
this.value = '';
this.$emit('clear');
},
//
handlePay() {
// .
if (this.value && this.value.endsWith('.')) {
this.value = this.value.replace('.', '');
}
this.$emit('confirm', this.value);
this.handleClose();
},
//
handleOpen() {
this.value = '';
this.$refs.popup.open();
},
//
handleClose() {
this.$refs.popup.close();
},
maskClick() {
// .
if (this.value && this.value.endsWith('.')) {
this.value = this.value.replace('.', '');
}
this.$emit('change', this.value);
}
}
}
</script>
<style lang="scss" scoped>
.popup-wrap {
background-color: #fff;
border-radius: 30rpx 30rpx 0 0;
.paybox {
.paybox-title {
display: flex;
justify-content: space-between;
padding: 40rpx;
.paybox-title-left {}
.paybox-title-middle {
font-size: 30rpx;
font-weight: bold;
color: #333;
}
.paybox-titler-right {}
}
.paybox-input {
display: flex;
justify-content: center;
margin-bottom: 40rpx;
/deep/.u-code-input__item {
background-color: #E6E6E6;
border-radius: 8rpx;
border: 0 !important;
}
}
}
}
.keyboard {
display: flex;
padding-bottom: 20rpx;
border-top: 2rpx solid #E6E6E6;
.keyboard-left {
width: 75%;
display: flex;
flex-wrap: wrap;
.keyboard-left-item {
width: 33.3%;
height: 120rpx;
line-height: 102rpx;
border-bottom: 2rpx solid #E6E6E6;
border-right: 2rpx solid #E6E6E6;
}
.del {
display: flex;
justify-content: center;
align-items: center;
}
}
.keyboard-right {
width: 25%;
.keyboard-right-clear {
width: 100%;
height: 240rpx;
line-height: 226rpx;
}
.keyboard-right-pay {
width: 100%;
height: 240rpx;
line-height: 226rpx;
text-align: center;
background-color: #40AE36;
color: #fff !important;
}
}
.word {
font-weight: 600;
font-size: 34rpx;
color: #000000;
text-align: center;
}
.active:active {
background-color: rgba(232, 232, 232, 0.5);
}
.active-pay:active {
opacity: .9;
}
}
</style>

View File

@ -134,7 +134,6 @@
//
handleOpen() {
this.value = '';
console.log('123:' + this.value);
this.$refs.popup.open();
},

View File

@ -1,167 +0,0 @@
<template>
<uni-popup ref="popup" type="bottom" mask-background-color="rgba(0,0,0,0)" safeArea backgroundColor="#fff"
:animation="true" @maskClick="maskClick">
<view style="padding:40rpx;display: flex;justify-content: center;align-items: center;">
<u-code-input v-model="value" mode="box" dot readonly></u-code-input>
</view>
<view class="keyboard">
<view class="keyboard-left">
<block v-for="(item,indx) in keys" :key="indx">
<view class="keyboard-left-item word active" v-if="item != 'del'" @click="handleClick(item)">
{{item}}
</view>
<view class="keyboard-left-item active del" v-else @click="handleClick(item)">
<image style="width: 48rpx;height: 48rpx;" src="@/static/del.webp" />
</view>
</block>
</view>
<view class="keyboard-right">
<view class="keyboard-right-clear word active" @click="handleClear">清空</view>
<view class="keyboard-right-pay word active-pay" @click="handlePay">付款</view>
</view>
</view>
</uni-popup>
</template>
<script>
export default {
name: "popups",
data() {
return {
keys: [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, '.', 'del'],
value: ''
}
},
methods: {
//
handleClick(item) {
if (this.value.length >= 10) return;
if (item == ".") {
if (!this.value) {
this.value = '0.';
} else {
if (this.value.indexOf('.') > -1) return;
this.value = this.value + item;
}
} else if (item == 'del') {
if (this.value == "0.")
this.value = this.value.substring(0, 0);
else
this.value = this.value.substring(0, this.value.length - 1);
} else if (item == 0) {
if (this.value) {
if (this.value.lastIndexOf('.') != -1 && this.value.length - this.value.lastIndexOf('.') == 3)
return;
this.value = this.value + item;
}
} else {
if (this.value.lastIndexOf('.') != -1 && this.value.length - this.value.lastIndexOf('.') == 3) return;
this.value = this.value + item;
}
this.$emit('change', this.value);
},
//
handleClear() {
this.value = '';
this.$emit('clear');
},
//
handlePay() {
// .
if (this.value && this.value.endsWith('.')) {
this.value = this.value.replace('.', '');
}
this.$emit('confirm', this.value);
this.handleClose();
},
//
handleOpen() {
this.$refs.popup.open();
},
//
handleClose() {
this.$refs.popup.close();
},
maskClick() {
// .
if (this.value && this.value.endsWith('.')) {
this.value = this.value.replace('.', '');
}
this.$emit('change', this.value);
}
}
}
</script>
<style lang="scss">
.keyboard {
display: flex;
padding-bottom: 20rpx;
.keyboard-left {
width: 75%;
display: flex;
flex-wrap: wrap;
.keyboard-left-item {
width: 33.3%;
height: 120rpx;
line-height: 102rpx;
border-bottom: 2rpx solid #E6E6E6;
border-right: 2rpx solid #E6E6E6;
}
.del {
display: flex;
justify-content: center;
align-items: center;
}
}
.keyboard-right {
width: 25%;
.keyboard-right-clear {
width: 100%;
height: 240rpx;
line-height: 226rpx;
}
.keyboard-right-pay {
width: 100%;
height: 240rpx;
line-height: 226rpx;
text-align: center;
background-color: #40AE36;
color: #fff !important;
}
}
.word {
font-weight: 600;
font-size: 34rpx;
color: #000000;
text-align: center;
}
.active:active {
background-color: rgba(232, 232, 232, 0.5);
}
.active-pay:active {
opacity: .9;
}
}
</style>

View File

@ -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);
this.$refs.payPwd.handleOpen(result.data.code);
}
}).catch(err => {
console.log(err)
})
},
// 101 102

View File

@ -81,7 +81,7 @@
})
shopTypeChange({
type: 3,
type: this.selected == 1 ? 3 : 4,
mer_id: this.mer_id
}).then(res => {
if (res.status == 200) {

View File

@ -13,7 +13,6 @@
<block v-for="(item,indx) in list" :key="indx">
<view class="shop-type-list-item">
<view class="shop-type-list-item-title" @click='hanldeTo(item)'>
<!-- #40AE36 审核通过 #F55726 审核未通过 #666666 审核中-->
<view class="shop-type-list-item-title-status"
:style="{'color':item.status==0?'#666':item.status==1?'#40AE36':'#F55726'}">
{{item.status == 0?'审核中':item.status==1?'审核通过':'审核未通过'}}
@ -47,7 +46,8 @@
<view class="shop-type-list-item-con-item" v-if="item.status == 2">
<view class="shop-type-list-item-con-key">备注</view>
<view class="shop-type-list-item-con-val" style="word-break: break-all;">
{{item.update_time || ''}}</view>
{{item.update_time || ''}}
</view>
</view>
</view>
</view>

View File

@ -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);
this.$refs.payPwd.handleOpen(result.data.code);
}
}).catch(err => {
console.log(err)
})
},
// 101 102
@ -570,8 +575,9 @@
},
handleClear() {},
handleChange() {},
handleChange() {
this.load = false;
},
async postCreate(price) {
const data = {

View File

@ -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 传入的数据
@ -185,7 +195,7 @@ export default {
arr.push(text.slice(str, text.length));
return [strLength, arr, rows] // [处理文字的总字节长度,每行显示内容的数组,行数]
},
/**
/**
* 获取分享海报
* @param array arr2 海报素材
* @param string store_name 素材文字
@ -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);
@ -286,7 +297,7 @@ export default {
// 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;
@ -297,18 +308,20 @@ export default {
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].slice(0,
textArray[textArray.length - 1].length - 1)
textArray[textArray.length - 1] += '…';
contentArray = textArray;
}
@ -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',
@ -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);
@ -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',
@ -543,7 +557,7 @@ export default {
}
})
},1000))
}, 1000))
},
fail: function(err) {
@ -624,7 +638,7 @@ export default {
}
})
},
/**
/**
* 小程序头像获取上传
* @param uploadUrl 上传接口地址
* @param filePath 上传文件路径