123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988 |
- <template>
- <view class="renzheng" style="padding-bottom: 300rpx;" v-if="XCXIsSelect != '否'">
- <view class="text-center text-red bg-white">{{form.remek}}</view>
- <view class=" radius margin">
- <u-form :model="form" ref="uForm" label-position="top" :label-style='lableStyle'>
- <u-form-item label="真实姓名" :border-bottom='false'>
- <u-input placeholder="请输入真实姓名" v-model="form.name" maxlength="11" />
- </u-form-item>
- <view style="width: 100%;height:1rpx;background: #f4f5f6;position: relative;top: -25rpx;"></view>
- <u-form-item label="证件号码" :border-bottom='false'>
- <u-input placeholder="请输入身份证号码" v-model="form.idNumber" />
- </u-form-item>
- <view style="width: 100%;height:1rpx;background: #f4f5f6;position: relative;top: -25rpx;"></view>
- <u-form-item label="地址" :border-bottom='false'>
- <u-input placeholder="请选择当前位置" v-model="form.address" @click="getAddress()" />
- </u-form-item>
- <view style="width: 100%;height:1rpx;background: #f4f5f6;position: relative;top: -25rpx;"></view>
- <u-form-item label="出生日期" :border-bottom='false'>
- <u-input placeholder="请填写(必填)" v-model="form.birthdate" type="select" @click="birthData()" />
- </u-form-item>
- <view style="width: 100%;height:1rpx;background: #f4f5f6;position: relative;top: -25rpx;"></view>
- <u-form-item label="性别" :border-bottom='false'>
- <u-input placeholder="请填写(必填)" v-model="form.sex" type="select" @click="bindSex()" />
- </u-form-item>
- <view style="width: 100%;height:1rpx;background: #f4f5f6;position: relative;top: -25rpx;"></view>
- <u-form-item label="联系方式" :border-bottom='false'>
- <u-input placeholder="请填写(必填)" v-model="form.phone" type="number" maxlength="11" />
- </u-form-item>
- <view style="width: 100%;height:1rpx;background: #f4f5f6;position: relative;top: -25rpx;"></view>
- </u-form>
- </view>
- <view class=" margin">
- <view class="text-lg">自我介绍</view>
- <view class="margin-tb-sm">
- <u-input v-model="form.describes" type="textarea" height="200" placeholde="请描述一下您的特长" maxlengt="200"
- :clearable="false" style="border-radius: 32rpx;" />
- </view>
- <view class="text-lg margin-top-sm">上传身份证正面</view>
- <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 style="z-index: 9;position: absolute;top: -15rpx;right: -15rpx;" @click="frontRemove(1)">
- <u-icon name="close-circle-fill" color="#2FB57A" size="50rpx"></u-icon>
- </view>
- </view>
- </view>
- <view class="margin-top" @click="addImage(1)" v-if="form.front.length<=0">
- <view style="width: 200rpx;height: 200rpx;background: #f4f5f6;"
- class="flex justify-center align-center">
- <view>
- <view class="text-center">
- <image src="../../static/images/my/add.png" style="width: 65rpx;height: 55rpx;">
- </image>
- </view>
- <view class="text-center">添加图片</view>
- </view>
- </view>
- </view>
- </view>
- <view class="text-lg margin-top-sm">上传身份证反面</view>
- <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 style="z-index: 9;position: absolute;top: -15rpx;right: -15rpx;" @click="backRemove()">
- <u-icon name="close-circle-fill" color="#2FB57A" size="50rpx"></u-icon>
- </view>
- </view>
- </view>
- <view class="margin-top" @click="addImage(2)" v-if="form.back.length<=0">
- <view style="width: 200rpx;height: 200rpx;background: #f4f5f6;"
- class="flex justify-center align-center">
- <view>
- <view class="text-center">
- <image src="../../static/images/my/add.png" style="width: 65rpx;height: 55rpx;">
- </image>
- </view>
- <view class="text-center">添加图片</view>
- </view>
- </view>
- </view>
- </view>
- <view class="text-lg margin-top-sm">头像上传</view>
- <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 style="z-index: 9;position: absolute;top: -15rpx;right: -15rpx;"
- @click="headImgremove(index)">
- <u-icon name="close-circle-fill" color="#2FB57A" 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">
- <view style="width: 200rpx;height: 200rpx;background: #f4f5f6;"
- class="flex justify-center align-center">
- <view>
- <view class="text-center">
- <image src="../../static/images/my/add.png" style="width: 65rpx;height: 55rpx;">
- </image>
- </view>
- <view class="text-center">添加图片</view>
- </view>
- </view>
- </view>
- </view>
- <view class="text-lg margin-top-sm">持有资质证书(可多张)</view>
- <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 style="z-index: 9;position: absolute;top: -15rpx;right: -15rpx;"
- @click="removeImg(index)">
- <u-icon name="close-circle-fill" color="#2FB57A" size="50rpx"></u-icon>
- </view>
- </view>
- </view>
- <view class="margin-top" @click="addImages(2)" v-if="certificateImg.length<6">
- <view style="width: 200rpx;height: 200rpx;background: #f4f5f6;"
- class="flex justify-center align-center">
- <view>
- <view class="text-center">
- <image src="../../static/images/my/add.png" style="width: 65rpx;height: 55rpx;">
- </image>
- </view>
- <view class="text-center">添加图片</view>
- </view>
- </view>
- </view>
- </view>
- <view class="text-lg margin-top-sm">形象照(可多张)</view>
- <view class="flex" style="overflow: hidden;flex-wrap: wrap;">
- <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 style="z-index: 9;position: absolute;top: -15rpx;right: -15rpx;"
- @click="infantImgremove(index)">
- <u-icon name="close-circle-fill" color="#2FB57A" size="50rpx"></u-icon>
- </view>
- </view>
- </view>
- <view class="margin-top" @click="addImages(3)" v-if="infantImg.length<6">
- <view style="width: 200rpx;height: 200rpx;background: #f4f5f6;"
- class="flex justify-center align-center">
- <view>
- <view class="text-center">
- <image src="../../static/images/my/add.png" style="width: 65rpx;height: 55rpx;">
- </image>
- </view>
- <view class="text-center">添加图片</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view style="text-align: center;">
- <view class="footer">
- <image v-if="showAgree" @tap="isShowAgree"
- src="/static/image/selected.png"
- style="width: 30upx;height: 30upx;"></image>
- <image v-else @tap="isShowAgree"
- src="/static/image/noselect.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>
- <view class="btn-box" v-if="renzheng == 0||renzheng==3">
- <view class="tabbar" @click="submit()">提交发布</view>
- </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="#2FB57A" :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 configdata from '../../common/config.js';
- export default {
- data() {
- return {
- showAgree: false,
- form: {
- name: '',
- idNumber: '',
- remek: '',
- address: '',
- sex: '',
- birthdate: '',
- phone: '',
- front: '',
- back: '',
- //母婴护理师证
- infant: [],
- //头像上传
- headImg: '',
- //资质证书
- certificateImg: [],
- longitude: '',
- latitude: ''
- },
- // disabled: false,
- lableStyle: {
- color: '#222',
- fontSize: '32rpx',
- fontWeight: 'bold'
- },
- 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: '否'
- }
- },
- onLoad(e) {
- this.XCXIsSelect = this.$queue.getData("XCXIsSelect");
- if (this.XCXIsSelect != '否') {
- uni.setNavigationBarTitle({
- title: '实名认证'
- })
- } else {
- uni.setNavigationBarTitle({
- title: '关于我们'
- })
- }
- if (e.id) {
- this.typeId = e.id;
- }
- 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()
- },
- methods: {
- isShowAgree() {
- //是否选择协议
- this.showAgree = !this.showAgree;
- },
- getAddress() {
- let that = this
- 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
- },
- //性别选择
- bindSex() {
- this.show = true
- },
- //支付方式
- 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;
- }
- 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 : ''
- this.classify = res.data.classify
- 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 = this.config("APIHOST1") + '/alioss/upload';
- if (e == 2) {
- urlName = this.config("APIHOST1") + '/alioss/uploadWatermark';
- }
- uni.chooseImage({
- count: 6,
- sourceType: ['album', 'camera'],
- success: res => {
- for (let i = 0; i < res.tempFilePaths.length; i++) {
- that.$queue.showLoading("上传中...");
- uni.uploadFile({ // 上传接口
- // url: that.config("APIHOST1") + '/alioss/upload', //真实的接口地址
- 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)
- }
- }
- uni.hideLoading();
- }
- });
- }
- }
- })
- },
- 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("上传中...");
- uni.uploadFile({ // 上传接口
- url: that.config("APIHOST1") + '/alioss/upload', //真实的接口地址
- 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();
- }
- });
- }
- }
- })
- },
- config: function(name) {
- var info = null;
- if (name) {
- var name2 = name.split("."); //字符分割
- if (name2.length > 1) {
- info = configdata[name2[0]][name2[1]] || null;
- } else {
- info = configdata[name] || null;
- }
- if (info == null) {
- let web_config = cache.get("web_config");
- if (web_config) {
- if (name2.length > 1) {
- info = web_config[name2[0]][name2[1]] || null;
- } else {
- info = web_config[name] || null;
- }
- }
- }
- }
- return info;
- },
- 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>
- <style lang="scss">
- .renzheng {
- background: #FFFFFF;
- }
- .bg {
- background-color: #FFFFFF;
- }
- .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; */
- }
-
- .btn-box{
- width: 750rpx;
- height: 166rpx;
- background: #FFFFFF;
- box-shadow: 0rpx -6rpx 12rpx 2rpx rgba(0,0,0,0.09);
- border-radius: 32rpx 32rpx 0rpx 0rpx;
- position: fixed;
- bottom: 0%;
- left: 0%;
- box-sizing: border-box;
- padding: 20rpx 32rpx;
- .tabbar {
- width: 686rpx;
- height: 100rpx;
- line-height: 100rpx;
- text-align: center;
- background: #1EDA94;
- border-radius: 60rpx 60rpx 60rpx 60rpx;
- font-weight: bold;
- font-size: 32rpx;
- color: #FFFFFF;
- }
- }
- .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>
|