You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
fude/pages/my/sharePage.vue

196 lines
4.5 KiB

<template>
<view class="">
<u-modal :show="shareShow" confirmColor="#8EC31F" @confirm="shareConfirm" :showCancelButton="false">
<view class="slot-content">
<view class="title">
填写用户信息
</view>
<view class="form">
<u--form
labelPosition="left"
:model="confirmForm"
:borderBottom="false"
:rules="rules"
ref="uForm"
labelWidth="70"
>
<u-form-item
label="姓名:"
prop="name"
ref="item1"
:borderBottom="false"
>
<u--input
v-model="confirmForm.name"
placeholder="请选择"
border="surround"
></u--input>
</u-form-item>
<u-form-item
label="手机号:"
prop="phone"
ref="item2"
:borderBottom="false"
>
<u--input
v-model="confirmForm.phone"
placeholder="请输入"
border="surround"
></u--input>
</u-form-item>
<u-form-item
label="用户地址:"
prop="address"
ref="item2"
:borderBottom="false"
>
<u--input
:disabled="true"
v-model="confirmForm.address"
placeholder="请输入"
border="surround"
></u--input>
</u-form-item>
</u--form>
</view>
</view>
</u-modal>
<u-loading-page loading-text="loading..." :loading="loading"></u-loading-page>
</view>
</template>
<script>
import navbar from '@/components/navbar.vue'
import {checkUserSign} from '@/common/api.js'
import {getToken,getUserInfo,} from '@/common/auth.js'
export default {
components:{navbar},
data() {
return {
shareShow:true,
confirmForm:{
name:'',
phone:'',
address:''
},
rules: {
'name': {
required: true,
message: '请输入姓名',
trigger: ['blur', 'change']
},
'phone': {
required: true,
message: '请输入手机号',
trigger: ['blur', 'change']
},
'address':{
required: true,
message: '请授权定位',
trigger: ['blur', 'change']
}
},
id:null
}
},
onLoad(option) {
console.log(option,"0000000")
this.id=option.id;
},
onShow() {
this.getPosition()
},
methods: {
shareConfirm(){
this.$refs.uForm.validate().then(res => {
this.loading = true;
let params={
wordorder_id:this.id,
username:this.confirmForm.name,
mobile:this.confirmForm.phone
}
checkUserSign(params).then(res=>{
if(res.code==1){
this.loading = false;
uni.setStorageSync("acceptance_content",res.data)
if(res.data.status==4){//已签
if(res.data.user_name==this.confirmForm.name){//已签且是本人
uni.navigateTo({
url:'/pages/index/userSignPage?id='+this.id+'&isUserSign='+1+'&name='+this.confirmForm.name+'&mobile='+this.confirmForm.phone+'&user_address='+this.confirmForm.address
})
}
}else if(res.data.status==3){//待用户签字
uni.navigateTo({
url:'/pages/index/userInformation?id='+this.id+'&isUserSign='+0+'&name='+this.confirmForm.name+'&mobile='+this.confirmForm.phone+'&user_address='+this.confirmForm.address
})
}
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
})
}).catch(errors => {
uni.$u.toast('校验失败')
})
},
getPosition(){
console.log("=====")
uni.getFuzzyLocation({
type: 'wgs84',
success:(res)=> {
const latitude = res.latitude
const longitude = res.longitude
this.getLocationInfo(longitude,latitude)
}
})
},
//逆坐标解析
async getLocationInfo(longitude,latitude) {
console.log(longitude,latitude);
uni.request({
url: `https://restapi.amap.com/v3/geocode/regeo?location=${longitude},${latitude}&key=${this.MAP_KEY}`,
success:(res)=> {
console.log(res);
if(res.data.status=="1"){
this.confirmForm.address =
res.data.regeocode.addressComponent.country+
res.data.regeocode.addressComponent.province+
res.data.regeocode.addressComponent.district+
res.data.regeocode.addressComponent.township
}
}
});
},
}
}
</script>
<style lang="scss" scoped>
.slot-content{
width: 100%;
.title{
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 500;
color: #222222;
text-align: center;
}
/deep/.u-textarea{
margin-top:20rpx;
}
}
</style>