sadjv3_jishi/my/renzheng/index.vue

1137 lines
32 KiB
Vue
Raw Normal View History

2024-06-05 19:14:51 +08:00
<template>
<view style="padding-bottom: 100upx; margin-top: 20rpx;" v-if="XCXIsSelect != '否'">
<view class="text-center text-red bg-white">{{form.remek}}</view>
2024-06-27 11:08:18 +08:00
<view class="padding bg radius margin">
2024-06-05 19:14:51 +08:00
<u-form :model="form" ref="uForm" label-position="top" :label-style='lableStyle'>
<u-form-item label="" :border-bottom='false' style="border-bottom: 1px #f7f7f7 solid;">
<view class="skleft">
真实姓名
</view>
<u-input :disabled="renzhengStatus" placeholder="请输入真实姓名" v-model="form.name" maxlength="11"
style="color: #999999;" />
<!-- {{(renzheng !== 1 && renzheng !== 0) || (renzheng !== 2 && renzheng !== 0)}} -->
</u-form-item>
<u-form-item label="" :border-bottom='false' style="border-bottom: 1px #f7f7f7 solid;">
<view class="skleft">
性别
</view>
<u-input :disabled="true" placeholder="请填写(必填)" v-model="form.sex" type="select" @click="bindSex()"
style="color: #999999;" />
</u-form-item>
<u-form-item label="" :border-bottom='false' style="border-bottom: 1px #f7f7f7 solid;">
<view class="skleft">
证件号码
</view>
<u-input :disabled="renzhengStatus" placeholder="请输入身份证号码" v-model="form.idNumber"
style="color: #999999;" />
</u-form-item>
<u-form-item label="" :border-bottom='false' style="border-bottom: 1px #f7f7f7 solid;">
<view class="skleft">
出生日期
</view>
<u-input :disabled="renzhengStatus" placeholder="请填写(必填)" v-model="form.birthdate" type="select"
@click="birthData()" style="color: #999999;" />
</u-form-item>
<u-form-item label="" :border-bottom='false' style="border-bottom: 1px #f7f7f7 solid;">
<view class="skleft">
联系地址
</view>
<u-input :disabled="renzhengStatus" placeholder="请选择当前位置" v-model="form.address"
@click="getAddress()" style="color: #999999;" />
</u-form-item>
<u-form-item label="" :border-bottom='false'>
<view class="skleft">
联系方式
</view>
<u-input :disabled="renzhengStatus" placeholder="请填写(必填)" v-model="form.phone" type="number"
maxlength="11" style="color: #999999;" />
</u-form-item>
</u-form>
</view>
2024-08-14 16:38:29 +08:00
<view class=" padding bg radius margin" style="padding-top: 20rpx; margin-top: 20rpx;">
<view class="margin-top-sm">请选择认证类型</view>
<view class="guke-list">
<view class="guke-btn huiBtn" :class="{ lanBtn: selected.includes(item) }"
@click="gukeBtn(item)" v-for="(item,index) in typeList" :key="index">
{{item.value}}
</view>
</view>
</view>
2024-06-05 19:14:51 +08:00
<view class=" padding bg radius margin"
2024-06-27 11:08:18 +08:00
style="padding-top: 20rpx; margin-top: 20rpx;">
<view class="margin-top-sm">上传身份证正面</view>
2024-06-05 19:14:51 +08:00
<view class="flex" style="overflow: hidden;flex-direction: initial;">
<view class="margin-top flex margin-right-sm" v-if="form.front.length">
<view class="flex" style="width: 200rpx;height: 200rpx;margin-right: 10rpx;position: relative;">
<image :src="form.front" style="width: 100%;height: 100%;"></image>
<view v-if="renzheng == 0 || renzheng == 3"
style="z-index: 9;position: absolute;top: -15rpx;right: -15rpx;" @click="frontRemove(1)">
<u-icon name="close-circle-fill" color="#d81e06" size="50rpx"></u-icon>
</view>
</view>
</view>
<view class="margin-top" @click="addImage(1)" v-if="form.front.length <= 0 ">
2024-06-27 11:08:18 +08:00
<view style="width: 200rpx;height: 200rpx;background: #f7f8fa;"
2024-06-05 19:14:51 +08:00
class="flex justify-center align-center">
<view>
<view class="text-center">
2024-06-27 11:08:18 +08:00
<image src="../../static/images/my/add.png" style="width: 80rpx;height: 80rpx;">
2024-06-05 19:14:51 +08:00
</image>
</view>
2024-06-27 11:08:18 +08:00
<view class="text-center add-word">添加图片</view>
2024-06-05 19:14:51 +08:00
</view>
</view>
</view>
</view>
2024-06-27 11:08:18 +08:00
<view class="margin-top-sm">上传身份证反面</view>
2024-06-05 19:14:51 +08:00
<view class="flex" style="overflow: hidden;flex-direction: initial;">
<view class="margin-top flex margin-right-sm" v-if="form.back.length">
<view class="flex" style="width: 200rpx;height: 200rpx;margin-right: 10rpx;position: relative;">
<image :src="form.back" style="width: 100%;height: 100%;"></image>
<view v-if="renzheng == 0 || renzheng == 3"
style="z-index: 9;position: absolute;top: -15rpx;right: -15rpx;" @click="backRemove()">
<u-icon name="close-circle-fill" color="#d81e06" size="50rpx"></u-icon>
</view>
</view>
</view>
<view class="margin-top" @click="addImage(2)" v-if="form.back.length<=0">
2024-06-27 11:08:18 +08:00
<view style="width: 200rpx;height: 200rpx;background: #f7f8fa;"
2024-06-05 19:14:51 +08:00
class="flex justify-center align-center">
<view>
<view class="text-center">
2024-06-27 11:08:18 +08:00
<image src="../../static/images/my/add.png" style="width: 80rpx;height: 80rpx;">
2024-06-05 19:14:51 +08:00
</image>
</view>
2024-06-27 11:08:18 +08:00
<view class="text-center add-word">添加图片</view>
2024-06-05 19:14:51 +08:00
</view>
</view>
</view>
</view>
2024-06-27 11:08:18 +08:00
<view class="margin-top-sm">头像上传</view>
2024-06-05 19:14:51 +08:00
<view class="flex" style="overflow: hidden;flex-wrap: wrap;">
<view class="margin-top flex margin-right-sm flex-wrap" v-if="form.headImg && form.headImg.length">
<view class="flex" style="width: 200rpx;height: 200rpx;margin-right: 5rpx;position: relative;">
<image :src="form.headImg" style="width: 100%;height: 100%;"></image>
<view v-if="renzheng == 0 || renzheng == 3"
style="z-index: 9;position: absolute;top: -15rpx;right: -15rpx;"
@click="headImgremove(index)">
<u-icon name="close-circle-fill" color="#d81e06" size="50rpx"></u-icon>
</view>
<!-- <image :src="form.headImg" style="width: 100%;height: 100%;"></image>
<view style="z-index: 9;position: absolute;top: -15rpx;right: -15rpx;"
@click="headImgremove(index)">
<u-icon name="close-circle-fill" color="#2979ff" size="50rpx"></u-icon>
</view> -->
</view>
</view>
<view class="margin-top" @click="addImage(4)" v-if="form.headImg.length<=0">
2024-06-27 11:08:18 +08:00
<view style="width: 200rpx;height: 200rpx;background: #f7f8fa;"
2024-06-05 19:14:51 +08:00
class="flex justify-center align-center">
<view>
<view class="text-center">
2024-06-27 11:08:18 +08:00
<image src="../../static/images/my/avatar.png" style="width: 80rpx;height: 80rpx;">
2024-06-05 19:14:51 +08:00
</image>
</view>
2024-06-27 11:08:18 +08:00
<view class="text-center add-word">添加头像</view>
2024-06-05 19:14:51 +08:00
</view>
</view>
</view>
</view>
2024-06-27 11:08:18 +08:00
<view class="margin-top-sm">持有资质证书可多张</view>
2024-06-05 19:14:51 +08:00
<view class="flex" style="overflow: hidden;flex-wrap: wrap;">
<view class="margin-top flex margin-right-sm flex-wrap" v-if="certificateImg.length">
<view class="flex" style="width: 200rpx;height: 200rpx;margin-right: 2rpx;position: relative;"
v-for="(image,index) in certificateImg" :key="index">
<image :src="image" style="width: 100%;height: 100%;"></image>
<view v-if="renzheng == 0 || renzheng == 3"
style="z-index: 9;position: absolute;top: -15rpx;right: -15rpx;" @click="removeImg(index)">
<u-icon name="close-circle-fill" color="#d81e06" size="50rpx"></u-icon>
</view>
</view>
</view>
<view class="margin-top" @click="addImages(2)"
v-if="certificateImg.length < 6 && (renzheng ==0 || renzheng == 3)">
2024-06-27 11:08:18 +08:00
<view style="width: 200rpx;height: 200rpx;background: #f7f8fa;"
2024-06-05 19:14:51 +08:00
class="flex justify-center align-center">
<view>
<view class="text-center">
2024-06-27 11:08:18 +08:00
<image src="../../static/images/my/add.png" style="width: 80rpx;height: 80rpx;">
2024-06-05 19:14:51 +08:00
</image>
</view>
2024-06-27 11:08:18 +08:00
<view class="text-center add-word">添加图片</view>
2024-06-05 19:14:51 +08:00
</view>
</view>
</view>
</view>
2024-06-27 11:08:18 +08:00
<view class=" margin-top-sm">形象照可多张</view>
2024-06-05 19:14:51 +08:00
<view class="flex" style="overflow: hidden;flex-wrap: wrap;padding-bottom: 10rpx;">
<view class="margin-top flex margin-right-sm flex-wrap" v-if="infantImg.length">
<view class="flex" style="width: 200rpx;height: 200rpx;margin-right: 5rpx;position: relative;"
v-for="(image,index) in infantImg" :key="index">
<image :src="image" style="width: 100%;height: 100%;"></image>
<view v-if="renzheng == 0 || renzheng == 3"
style="z-index: 9;position: absolute;top: -15rpx;right: -15rpx;"
@click="infantImgremove(index)">
<u-icon name="close-circle-fill" color="#d81e06" size="50rpx"></u-icon>
</view>
</view>
</view>
<view class="margin-top" @click="addImages(3)"
v-if="infantImg.length < 6 && (renzheng ==0 || renzheng == 3)">
2024-06-27 11:08:18 +08:00
<view style="width: 200rpx;height: 200rpx;background: #f7f8fa; margin-bottom: 20rpx;"
2024-06-05 19:14:51 +08:00
class="flex justify-center align-center">
<view>
<view class="text-center">
2024-06-27 11:08:18 +08:00
<image src="../../static/images/my/add.png" style="width: 80rpx;height: 80rpx;">
2024-06-05 19:14:51 +08:00
</image>
</view>
2024-06-27 11:08:18 +08:00
<view class="text-center add-word">添加图片</view>
2024-06-05 19:14:51 +08:00
</view>
</view>
</view>
</view>
</view>
2024-06-27 11:08:18 +08:00
<view class=" padding bg radius margin">
<view class="padding-top">自我介绍</view>
2024-06-05 19:14:51 +08:00
<view class="margin-tb-sm">
<u-input :disabled="renzhengStatus" v-model="form.describes" style="border-radius: 20rpx;"
type="textarea" height="200" placeholde="请描述一下您的特长" maxlengt="200" :clearable="false" />
</view>
<view style="height: 15rpx;"></view>
</view>
<view style="text-align: center;">
<view v-if="renzheng == 0 || renzheng == 3" class="footer" style="margin-top: 20rpx;">
<image v-if="showAgree" @tap="isShowAgree"
src="https://wap.quanmindaojia.com/file/uploadPath/2023/02/15/ee4b62258955340385364b67c57c65e0.png"
style="width: 30upx;height: 30upx;"></image>
<image v-else @tap="isShowAgree"
src="https://wap.quanmindaojia.com/file/uploadPath/2023/01/18/02d699f656ea68f69a67ff906c8f1af6.png"
style="width: 30upx;height: 30upx;"></image>
<text style="margin-left: 10upx;margin-right: 0;" @tap="isShowAgree">我阅读并同意</text>
<!-- 协议地址 -->
<navigator url="/my/setting/xieyi?id=374" open-type="navigate">理疗师入驻协议</navigator>
</view>
</view>
2024-06-27 11:08:18 +08:00
<view class="tabbar" style="background: linear-gradient(to right, #019c88, #2dbe93); border-radius: 50rpx;"
2024-06-05 19:14:51 +08:00
@click="submit()" v-if="renzheng == 0||renzheng==3">提交发布</view>
<!-- 性别选择 -->
<u-action-sheet :list="actionSheetList" v-model="show" @click="actionSheetCallback"></u-action-sheet>
<!-- 出生日期 -->
<u-picker v-model="showData" :params="params" @confirm="bindData"></u-picker>
<!-- 支付方式 -->
<u-popup v-model="showpay" mode="bottom" :closeable="closeable">
<view class="popup_pay">
<view style="background-color: #fff;">
<view style="padding: 0 20upx;margin-top: 60rpx;margin-bottom: 20rpx;">
<view
style="display: flex;height: 100upx;align-items: center;padding: 20upx 0;justify-content: center;"
v-for="(item,index) in openLists" :key='index'>
<image :src="item.image" style="width: 55upx;height: 55upx;border-radius: 50upx;">
</image>
<view style="font-size: 30upx;margin-left: 20upx;width: 70%;">
{{item.text}}
</view>
<radio-group name="openWay" style="margin-left: 45upx;" @tap='selectWay(item)'>
<label class="tui-radio">
<radio color="#096f4b" :checked="openWay === item.id ? true : false" />
</label>
</radio-group>
</view>
</view>
</view>
<view class="pay_btn" @click="pay()">确认支付</view>
</view>
</u-popup>
</view>
</template>
<script>
import * as websocketUtils from 'utils/websocketUtils.js';
export default {
data() {
return {
2024-08-14 16:38:29 +08:00
selected:[],
2024-06-05 19:14:51 +08:00
showAgree: false,
form: {
name: '',
idNumber: '',
remek: '',
address: '',
sex: '',
birthdate: '',
phone: '',
front: '',
back: '',
//母婴护理师证
infant: [],
//头像上传
headImg: '',
//资质证书
certificateImg: [],
longitude: '',
latitude: ''
},
// disabled: false,
lableStyle: {
color: '#000000',
fontSize: '30upx'
},
customStyle: {
backgroundColor: '#005DFF',
color: '#ffffff',
border: 0
},
customStyle1: {
backgroundColor: '#ccc',
color: '#000000',
border: 0
},
renzheng: '',
show: false,
actionSheetList: [{
text: '男',
label: '1',
}, {
text: '女',
label: '2',
}],
showData: false,
params: {
year: true,
month: true,
day: true,
hour: false,
minute: false,
second: false
},
//母婴护理师证
infantImg: [],
//头像上传
headImg: [],
//资质证书
certificateImg: [],
money: 0,
showpay: false,
openLists: [],
openWay: 1,
typeId: '',
sex: 0,
closeable: true,
XCXIsSelect: '否',
renzhengStatus: false,
2024-08-14 16:38:29 +08:00
typeList:[],
2024-06-05 19:14:51 +08:00
}
},
2024-08-14 16:38:29 +08:00
onLoad() {
2024-06-05 19:14:51 +08:00
this.XCXIsSelect = this.$queue.getData("XCXIsSelect");
if (this.XCXIsSelect != '否') {
uni.setNavigationBarTitle({
title: '实名认证'
})
} else {
uni.setNavigationBarTitle({
title: '关于我们'
})
}
2024-08-14 16:38:29 +08:00
// if (e.id) {
// this.typeId = e.id;
// }
this.fuwuType()
2024-06-05 19:14:51 +08:00
this.getUserInfo()
this.renzheng = uni.getStorageSync("renzheng")
// #ifdef APP
this.openLists = [{
image: '../../static/images/icon_weixin.png',
text: '微信',
id: 1
}, {
image: '../../static/images/zhifubao.png',
text: '支付宝',
id: 2
}],
this.openWay = 1;
// #endif
// #ifdef MP-WEIXIN
this.openLists = [{
image: '../../static/images/icon_weixin.png',
text: '微信',
id: 1
}],
this.openWay = 1;
// #endif
// #ifdef H5
this.openLists = [{
image: '../../static/images/zhifubao.png',
text: '支付宝',
id: 2
}]
this.openWay = 2;
// #endif
},
onShow() {
// this.Getmoney()
this.checkRenzhengStatus();
},
methods: {
2024-08-14 16:38:29 +08:00
gukeBtn(item) {
var index = this.selected.indexOf(item);
if (index === -1) {
this.selected.push(item);
} else {
this.selected.splice(index, 1);
}
var data = [];
for (var i = 0; i < this.selected.length; i++) {
data.push(this.selected[i].id)
}
this.typeId = data.join(",")
console.log("this.typeId",this.typeId)
},
fuwuType(){
this.$Request.get("/app/dict/list", {
type: '服务类型'
}).then(res => {
if (res.code == 0) {
if (res.data) {
this.typeList = res.data
}
}
});
},
2024-06-05 19:14:51 +08:00
checkRenzhengStatus() {
if ((this.renzheng == 0 || this.renzheng == 3) && (this.renzheng !== 1 || this.renzheng !== 2)) {
this.renzhengStatus = false;
} else {
this.renzhengStatus = true;
}
},
isShowAgree() {
//是否选择协议
this.showAgree = !this.showAgree;
},
getAddress() {
let that = this
if ((this.renzheng == 0 || this.renzheng == 3) && (this.renzheng !== 1 || this.renzheng !== 2)) {
} else {
return;
}
uni.chooseLocation({
success: function(res) {
console.log('位置名称:' + res.name);
console.log('详细地址:' + res.address);
console.log('纬度:' + res.latitude);
console.log('经度:' + res.longitude);
that.form.address = res.address
that.form.latitude = res.latitude
that.form.longitude = res.longitude
}
});
},
//日期弹框
birthData() {
this.showData = true
if ((this.renzheng == 0 || this.renzheng == 3) && (this.renzheng !== 1 || this.renzheng !== 2)) {
this.showData = true;
} else {
this.showData = false;
}
},
//性别选择
bindSex() {
this.show = true
if ((this.renzheng == 0 || this.renzheng == 3) && (this.renzheng !== 1 || this.renzheng !== 2)) {
this.show = true;
} else {
this.show = false;
}
},
//支付方式
selectWay(item) {
this.openWay = item.id;
},
// 保证金
Getmoney() {
this.$Request.get("/app/common/type/239").then(res => {
console.log(res)
if (res.code == 0) {
this.money = res.data.value
}
});
},
// 点击actionSheet回调 性别
actionSheetCallback(index) {
console.log(index)
this.sex = this.actionSheetList[index].label;
this.form.sex = this.actionSheetList[index].text;
// this.from.sexs = this.actionSheetList[index].label;
console.log(this.sex)
},
//出生日期
bindData(e) {
console.log(e)
this.form.birthdate = e.year + '年' + e.month + '月' + e.day + '日'
this.form.birth = e.year + '-' + e.month + '-' + e.day
},
//身份证删除
frontRemove(index) {
if (index == 1) {
this.form.front = ''
} else if (index == 2) {
this.forms.front = ''
}
},
//资质证书删除
removeImg(index) {
this.certificateImg.splice(index, 1)
},
backRemove() {
this.form.back = ''
},
infantImgremove(index) {
this.infantImg.splice(index, 1)
},
headImgremove(index) {
this.form.headImg = ''
},
submit() {
this.form.infantImg = this.infantImg
this.form.infantImg = this.form.infantImg.toString();
this.form.certificateImg = this.certificateImg
this.form.certificateImg = this.form.certificateImg.toString();
// this.form.headImg = this.headImg
// this.form.headImg = this.form.headImg.toString();
if (!this.showAgree) {
uni.showToast({
title: '请阅读并同意《理疗师入驻协议》',
icon: 'none',
duration: 1000
})
return;
}
if (!this.form.name) {
uni.showToast({
title: '请输入真实姓名',
icon: 'none',
duration: 1000
})
return;
}
if (!this.form.idNumber) {
uni.showToast({
title: '请输入身份证号',
icon: 'none',
duration: 1000
})
return;
}
2024-08-14 16:38:29 +08:00
if (!this.typeId) {
uni.showToast({
title: '请输选择认证类型!',
icon: 'none',
duration: 1000
})
return;
}
2024-06-05 19:14:51 +08:00
let regX =
/^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
if (!regX.test(this.form.idNumber)) {
uni.showToast({
title: '请输入正确的身份证号',
icon: 'none',
duration: 1000
})
return;
}
if (!this.form.address) {
uni.showToast({
title: '请选择地址',
icon: 'none',
duration: 1000
})
return;
}
if (!this.form.birthdate) {
uni.showToast({
title: '请输入出生日期',
icon: 'none',
duration: 1000
})
return;
}
if (!this.form.sex) {
uni.showToast({
title: '请输入性别',
icon: 'none',
duration: 1000
})
return;
}
if (!this.form.phone) {
uni.showToast({
title: '请输入联系方式',
icon: 'none',
duration: 1000
})
return;
}
if (!this.form.describes) {
uni.showToast({
title: '请填写自我介绍',
icon: 'none',
duration: 1000
})
return
}
if (!this.form.front) {
uni.showToast({
title: '请上传身份证正面',
icon: 'none',
duration: 1000
})
return;
}
if (!this.form.back) {
uni.showToast({
title: '请上传身份证反面',
icon: 'none',
duration: 1000
})
return;
}
if (!this.form.headImg) {
uni.showToast({
title: '请上传头像',
icon: 'none',
duration: 1000
})
return;
}
if (!this.form.certificateImg) {
uni.showToast({
title: '请上传资质证书',
icon: 'none',
duration: 1000
})
return;
}
if (!this.form.infantImg) {
uni.showToast({
title: '请上传生活照',
icon: 'none',
duration: 1000
})
return;
}
let data = {
userId: uni.getStorageSync("userId"),
name: this.form.name,
idNumber: this.form.idNumber,
birthdate: this.form.birthdate,
classifyId: this.typeId,
sex: this.sex,
phone: this.form.phone,
address: this.form.address,
front: this.form.front,
back: this.form.back,
remek: this.form.remek,
certification: this.form.certificateImg,
imagePhoto: this.form.infantImg,
avatar: this.form.headImg,
individualResume: this.form.describes,
latitude: this.form.latitude,
longitude: this.form.longitude
}
this.$Request.postJson("/app/realname/auditRealName", data).then(res => {
if (res.code == 0) {
uni.showToast({
title: '认证提交成功!',
icon: 'none'
})
setTimeout(function() {
uni.switchTab({
url: '/pages/my/index'
})
}, 1000)
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
});
},
getUserInfo() {
let data = {
userId: uni.getStorageSync('userId')
}
this.$Request.get("/app/realname/selectRealName", data).then(res => {
console.log(res)
if (res.code == 0 && res.data) {
this.typeId = res.data.classifyId ? res.data.classifyId : ''
this.form.name = res.data.name ? res.data.name : ''
this.form.idNumber = res.data.idNumber ? res.data.idNumber : ''
this.form.front = res.data.front ? res.data.front : ''
this.form.back = res.data.back ? res.data.back : ''
2024-08-14 16:38:29 +08:00
this.classify = res.data.classify;
2024-06-05 19:14:51 +08:00
this.form.address = res.data.address
this.form.describes = res.data.individualResume
this.form.birthdate = res.data.birthdate
this.sex = res.data.sex
if (res.data.sex == 1) {
this.form.sex = '男'
} else if (res.data.sex == 2) {
this.form.sex = '女'
}
this.form.phone = res.data.phone
if (res.data.imagePhoto) {
this.infantImg = res.data.imagePhoto.split(',')
this.form.infantImg = res.data.imagePhoto
}
if (res.data.certification) {
this.certificateImg = res.data.certification.split(',')
this.form.certificateImg = res.data.certification
}
this.headImg = res.data.avatar
this.form.headImg = res.data.avatar;
if (res.data.status == 1) {
this.disabled = true
}
if (res.data.status == 2) {
this.form.remek = res.data.remek ? res.data.remek : ''
}
}
});
},
addImages(e) {
let that = this
let urlName = websocketUtils.getBaseUrl() + '/alioss/upload';
if (e == 2) {
urlName = websocketUtils.getBaseUrl() + '/alioss/uploadWatermark';
}
uni.chooseImage({
count: 6,
sourceType: ['album', 'camera'],
success: res => {
for (let i = 0; i < res.tempFilePaths.length; i++) {
that.$queue.showLoading("上传中...");
2024-08-14 16:38:29 +08:00
uni.getFileInfo({
filePath: res.tempFilePaths[i],
success: (infoRes) => {
const size = infoRes.size;
2024-08-14 17:25:04 +08:00
if (size / 1024 / 1024 > 4) {
2024-08-14 16:38:29 +08:00
// 图片大于2MB
uni.showToast({
icon:'error',
title:'图片超出2MB限制,请重新选择'
})
} else {
// 图片小于等于2MB
uni.uploadFile({ // 上传接口
//url: websocketUtils.uploadFileUrl(), //真实的接口地址
url: urlName,
filePath: res.tempFilePaths[i],
name: 'file',
success: (uploadFileRes) => {
if (e == 3) {
if (that.infantImg.length <= 5) {
that.infantImg.push(JSON.parse(uploadFileRes.data)
.data)
}
} else if (e == 2) {
if (that.certificateImg.length <= 5) {
that.certificateImg.push(JSON.parse(uploadFileRes.data)
.data)
// that.image = JSON.parse(uploadFileRes.data)
// .data
}
}
uni.hideLoading();
2024-06-05 19:14:51 +08:00
}
2024-08-14 16:38:29 +08:00
});
}
},
fail: () => {
cons.log("上传失败")
}
2024-06-05 19:14:51 +08:00
});
2024-08-14 16:38:29 +08:00
2024-06-05 19:14:51 +08:00
}
}
})
},
addImage(e) {
let that = this
uni.chooseImage({
count: 1,
sourceType: ['album', 'camera'],
success: res => {
for (let i = 0; i < res.tempFilePaths.length; i++) {
that.$queue.showLoading("上传中...");
2024-08-14 16:38:29 +08:00
uni.getFileInfo({
filePath: res.tempFilePaths[i],
success: (infoRes) => {
const size = infoRes.size;
2024-08-14 17:25:04 +08:00
if (size / 1024 / 1024 > 4) {
2024-08-14 16:38:29 +08:00
// 图片大于2MB
uni.showToast({
icon:'error',
title:'图片超出2MB限制,请重新选择'
})
} else {
// 图片小于等于2MB
uni.uploadFile({ // 上传接口
url: websocketUtils.uploadFileUrl(), //真实的接口地址
filePath: res.tempFilePaths[i],
name: 'file',
success: (uploadFileRes) => {
if (e == 1) {
that.form.front = JSON.parse(uploadFileRes.data).data
} else if (e == 2) {
that.form.back = JSON.parse(uploadFileRes.data).data
} else if (e == 4) {
that.form.headImg = JSON.parse(uploadFileRes.data).data
console.log(that.form.headImg)
}
uni.hideLoading();
}
});
}
},
fail: () => {
cons.log("上传失败")
}
2024-06-05 19:14:51 +08:00
});
2024-08-14 16:38:29 +08:00
2024-06-05 19:14:51 +08:00
}
}
})
},
pay() {
let userId = uni.getStorageSync('userId')
data = {
name: this.form.name,
idNumber: this.form.idNumber,
birthdate: this.form.birth,
sex: this.sex,
phone: this.form.phone,
front: this.form.front,
back: this.form.back,
remek: this.form.remek,
infantImg: this.form.infantImg,
infantImgs: this.form.infantImgs,
classify: this.classify,
userId: userId
}
console.log(data, 'pppp1')
this.showpay = false
if (this.openWay == 1) { //微信支付
// #ifdef MP-WEIXIN
this.$Request.postJson('/app/wxPay/wxPayJsApiUserCertification', data).then(res => {
console.log(res)
if (res.code == 0) {
// this.isCheckPay(res.code, 'wxpay', JSON.stringify(res.data));
uni.requestPayment({
provider: 'wxpay',
timeStamp: res.data.timestamp,
nonceStr: res.data.noncestr,
package: res.data.package,
signType: res.data.signType,
paySign: res.data.sign,
success: function(res) {
console.log(res)
// uni.showLoading({
// title: '支付成功',
// icon:'nones'
// });
// this.$queue.showToast('支付成功');
uni.switchTab({
url: '/pages/my/index'
})
},
fail: function(err) {
this.$queue.showToast('支付失败');
}
});
}
});
// #endif
// #ifdef H5
this.$Request.postJson('/app/wxPay/wxPayMpUserCertification', data).then(res => {
this.showpay = false
that.callPay(res);
});
// #endif
// #ifdef APP
this.$Request.postJson('/app/wxPay/payAppUserCertification', data).then(res => {
console.log(res)
this.showpay = false
if (res.code == 0) {
this.isCheckPay(res.code, 'wxpay', JSON.stringify(res.data));
}
});
// #endif
} else if (this.openWay == 2) { //支付宝支付
// #ifdef H5
this.$Request.postJson('/app/aliPay/payOrderUserCertification', data).then(
res => {
this.showpay = false
const div = document.createElement('div')
div.innerHTML = res.data //此处form就是后台返回接收到的数据
document.body.appendChild(div)
document.forms[0].submit()
});
// #endif
// #ifdef APP-PLUS
this.$Request.postJson('/app/aliPay/payAppUserCertification', data).then(
res => {
this.showpay = false
this.setPayment('alipay', res.data);
});
// #endif
}
},
callPay: function(response) {
if (typeof WeixinJSBridge === "undefined") {
if (document.addEventListener) {
document.addEventListener('WeixinJSBridgeReady', this.onBridgeReady(response), false);
} else if (document.attachEvent) {
document.attachEvent('WeixinJSBridgeReady', this.onBridgeReady(response));
document.attachEvent('onWeixinJSBridgeReady', this.onBridgeReady(response));
}
} else {
this.onBridgeReady(response);
}
},
onBridgeReady: function(response) {
let that = this;
if (!response.package) {
return;
}
WeixinJSBridge.invoke(
'getBrandWCPayRequest', {
"appId": response.appid, //公众号名称,由商户传入
"timeStamp": response.timestamp, //时间戳自1970年以来的秒数
"nonceStr": response.noncestr, //随机串
"package": response.package,
"signType": response.signType, //微信签名方式:
"paySign": response.sign //微信签名
},
function(res) {
if (res.err_msg === "get_brand_wcpay_request:ok") {
// 使用以上方式判断前端返回,微信团队郑重提示:
//res.err_msg将在用户支付成功后返回ok但并不保证它绝对可靠。
uni.showLoading({
title: '支付成功'
});
uni.hideLoading();
uni.navigateTo({
url: '/pages/my/index'
})
} else {
uni.hideLoading();
}
WeixinJSBridge.log(response.err_msg);
}
);
},
isCheckPay(code, name, order) {
if (code == 0) {
console.log('999999999999')
this.setPayment(name, order);
} else {
uni.hideLoading();
uni.showToast({
title: '支付信息有误'
});
}
},
setPayment(name, order) {
console.log(777777777, name, order)
uni.requestPayment({
provider: name,
orderInfo: order, //微信、支付宝订单数据
success: function(res) {
uni.hideLoading();
uni.showLoading({
title: '支付成功'
});
uni.switchTab({
url: '/pages/my/index'
})
},
fail: function(err) {
uni.hideLoading();
},
complete() {
uni.hideLoading();
}
});
}
}
}
</script>
2024-08-14 16:38:29 +08:00
<style scoped>
.huiBtn {
color:#333;
background: #f3f3f3;
// color: #333333;
}
.lanBtn {
color:#fff;
background: #049F89;
}
.guke-btn {
width:30%;
line-height:34px;
text-align: center;
font-weight: bold;
font-size:11px;
border-radius: 6px;
margin-top:5px;
margin-right:6px;
}
.guke-list {
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
flex-wrap: wrap;
box-sizing: border-box;
background-color: #fff;
justify-content: flex-start;
}
2024-06-05 19:14:51 +08:00
page {
background-color: #F7F7F7;
}
.bg {
2024-06-27 11:08:18 +08:00
width: 94%;
margin:30rpx auto;
background-color: #FFFFFF;
padding: 20rpx 36rpx;
border-radius: 26rpx;
}
.add-word{
font-size: 26rpx;
color: #afb5c1;
2024-06-05 19:14:51 +08:00
}
.skbox {}
.skleft {
width: 160rpx;
font-size: 28rpx;
}
.u-form-item {
padding: 10rpx !important;
}
.u-form-item--right__content__slot {
flex: 200rpx 1 !important;
}
.footer {
padding-left: 30upx;
font-size: 24upx;
color: #666666;
text-align: center;
display: flex;
margin-bottom: 20rpx;
}
.u-input__input {
color: balck !important;
}
.title_btn {
height: 78upx;
line-height: 78upx;
/* background: #f7f7f7; */
}
.tabbar {
width: 690upx;
2024-06-27 11:08:18 +08:00
height: 86upx;
background: #019c88;
2024-06-05 19:14:51 +08:00
border-radius: 8upx;
margin: 0 auto;
text-align: center;
2024-06-27 11:08:18 +08:00
line-height: 86upx;
2024-06-05 19:14:51 +08:00
color: #FFFFFF;
2024-06-27 11:08:18 +08:00
margin-top: 20rpx;
2024-06-05 19:14:51 +08:00
}
.popup_pay {
width: 100%;
position: relative;
padding-bottom: 45rpx;
/* height: 160px; */
/* #ifndef MP-WEIXIN */
/* height: 130px; */
/* #endif */
}
.pay_btn {
width: 90%;
margin: 0 auto;
text-align: center;
background: #1777FF;
height: 80rpx;
border-radius: 16rpx;
color: #ffffff;
line-height: 80rpx;
}
.hb {
/* #ifdef H5 */
padding-bottom: 180rpx;
/* #endif */
}
.bgCol2 {
color: #557EFD;
}
</style>