290 lines
6.3 KiB
Vue
290 lines
6.3 KiB
Vue
<template>
|
|
<view class="content">
|
|
<view class="info">
|
|
<view class="info-box">
|
|
<view class="info-box-item">
|
|
<view class="info-box-item-name">联系人姓名</view>
|
|
<u-input placeholder="请输入联系人姓名" v-model="applyName" :clearable="false"></u-input>
|
|
</view>
|
|
<view class="line"></view>
|
|
<view class="info-box-item">
|
|
<view class="info-box-item-name">联系人手机号</view>
|
|
<u-input placeholder="请输入联系人手机号" v-model="applyPhone" :clearable="false"></u-input>
|
|
</view>
|
|
<view class="line"></view>
|
|
<view class="info-box-item">
|
|
<view class="info-box-item-name">地址</view>
|
|
<u-input placeholder="请选择所在区域地址" @click="getcity()" v-model="applyContent" :disabled="true"
|
|
:clearable="false">
|
|
</u-input>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="sub">
|
|
<view class="sub-box">
|
|
<view class="sub-box-l" @click="submit()" v-if="!applyId">确认提交</view>
|
|
<view class="sub-box-r" @click="goChat()" v-if="!applyId">直接联系 </view>
|
|
<view class="sub-box-rs" @click="goChat()" v-else>直接联系 </view>
|
|
</view>
|
|
</view>
|
|
|
|
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
applyName: '',
|
|
applyPhone: '',
|
|
applyContent: '',
|
|
applyId: '',
|
|
latitude:'',
|
|
longitude:''
|
|
};
|
|
},
|
|
onLoad() {
|
|
this.getDetail()
|
|
},
|
|
onShow() {
|
|
|
|
},
|
|
methods: {
|
|
getDetail() {
|
|
let data = {
|
|
classify: 1
|
|
}
|
|
this.$Request.get("/app/apply/selectApplyByUserIdAndClassify", data).then(res => {
|
|
if (res.code == 0 && res.data) {
|
|
this.applyName = res.data.applyName
|
|
this.applyPhone = res.data.applyPhone
|
|
this.applyContent = res.data.applyContent
|
|
this.applyId = res.data.status
|
|
}
|
|
})
|
|
},
|
|
getcity() {
|
|
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.latitude = res.latitude
|
|
that.longitude = res.longitude
|
|
uni.setStorageSync('latitude', res.latitude)
|
|
uni.setStorageSync('longitude', res.longitude)
|
|
that.applyContent = res.address + res.name
|
|
}
|
|
});
|
|
},
|
|
goChat() {
|
|
let kefu = this.$queue.getData('kefu'); // 用户端联系方式 1 手机号 2企业微信
|
|
let kefuPhone = this.$queue.getData('kefuPhone');
|
|
if (kefu == 1) {
|
|
uni.makePhoneCall({
|
|
phoneNumber: kefuPhone //仅为示例
|
|
});
|
|
} else if (kefu == 3) {
|
|
uni.navigateTo({
|
|
url: '/my/setting/customer'
|
|
});
|
|
} else {
|
|
// #ifdef MP-WEIXIN
|
|
let that = this
|
|
try {
|
|
wx.openCustomerServiceChat({
|
|
extInfo: {
|
|
url: that.$queue.getData('kefuUrl')
|
|
},
|
|
corpId: that.$queue.getData('kefuAppId'),
|
|
success(res) {},
|
|
fail(res) {
|
|
console.error(res)
|
|
}
|
|
})
|
|
} catch (error) {
|
|
console.error("catchcatch" + error)
|
|
uni.showToast({
|
|
title: '请更新至微信最新版本'
|
|
});
|
|
}
|
|
// #endif
|
|
// #ifndef MP-WEIXIN
|
|
let url = this.$queue.getData('kefuUrl');
|
|
if (url.indexOf('/pages/') !== -1 || url.indexOf('/my/') !== -1) {
|
|
uni.navigateTo({
|
|
url
|
|
});
|
|
} else {
|
|
//#ifndef H5
|
|
uni.navigateTo({
|
|
url: '/pages/index/webView?url=' + url
|
|
});
|
|
//#endif
|
|
//#ifdef H5
|
|
window.location.href = url;
|
|
//#endif
|
|
}
|
|
// #endif
|
|
}
|
|
},
|
|
submit() {
|
|
if (!this.applyName) {
|
|
uni.showToast({
|
|
title: '请输入联系人姓名',
|
|
icon: 'none'
|
|
})
|
|
return
|
|
}
|
|
if (!this.applyPhone) {
|
|
uni.showToast({
|
|
title: '请输入联系人手机号码',
|
|
icon: 'none'
|
|
})
|
|
return
|
|
}
|
|
if (!this.applyContent) {
|
|
uni.showToast({
|
|
title: '请输入地址',
|
|
icon: 'none'
|
|
})
|
|
return
|
|
}
|
|
let data = {
|
|
applyName: this.applyName,
|
|
applyPhone: this.applyPhone,
|
|
applyContent: this.applyContent,
|
|
classify: 1
|
|
}
|
|
|
|
this.$Request.postJson("/app/apply/insertApply", data).then(res => {
|
|
if (res.code == 0) {
|
|
uni.showToast({
|
|
title: '提交成功!',
|
|
icon: 'none'
|
|
})
|
|
setTimeout(function() {
|
|
uni.navigateBack()
|
|
}, 1000)
|
|
} else {
|
|
uni.showToast({
|
|
title: res.msg,
|
|
icon: 'none'
|
|
})
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="less">
|
|
.content {
|
|
background-color: #f7f7f7;
|
|
width: 100%;
|
|
height: 100vh;
|
|
padding-top: 20px;
|
|
position: relative;
|
|
}
|
|
|
|
.bgimg {
|
|
position: relative;
|
|
width: 100%;
|
|
}
|
|
|
|
.info {
|
|
width: 95%;
|
|
height: auto;
|
|
display: flex;
|
|
justify-content: center;
|
|
margin: 0px auto;
|
|
padding:20rpx 40rpx;
|
|
background-color: #fff;
|
|
border-radius: 10px;
|
|
.info-box {
|
|
width: 100%;
|
|
|
|
.info-box-title {
|
|
color: #333333;
|
|
font-size: 32rpx;
|
|
font-weight: 800;
|
|
text-align: center;
|
|
}
|
|
|
|
.info-box-item {
|
|
margin-top: 30rpx;
|
|
|
|
.info-box-item-name {
|
|
font-size: 30rpx;
|
|
color: #333333;
|
|
font-weight: 800;
|
|
margin-bottom: 10rpx;
|
|
}
|
|
}
|
|
|
|
.line {
|
|
width: 100%;
|
|
border-bottom: 1rpx solid #f7f7f7;
|
|
}
|
|
}
|
|
}
|
|
|
|
.sub {
|
|
width: 100%;
|
|
height: 88rpx;
|
|
display: flex;
|
|
justify-content: center;
|
|
position: fixed;
|
|
bottom: 0px;
|
|
margin-bottom: 20px;
|
|
.sub-box {
|
|
width: 613rpx;
|
|
height: 100%;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
|
|
.sub-box-l {
|
|
width: 290rpx;
|
|
height: 82rpx;
|
|
line-height: 82rpx;
|
|
background: linear-gradient(90deg, #019C88, #28BA92, #35C495);
|
|
border-radius: 46rpx;
|
|
color: #ffffff;
|
|
font-size: 30rpx;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
}
|
|
|
|
.sub-box-rs {
|
|
width: 290rpx;
|
|
height: 82rpx;
|
|
line-height: 82rpx;
|
|
background: linear-gradient(90deg, #019C88, #28BA92, #35C495);
|
|
border-radius: 46rpx;
|
|
color: #ffffff;
|
|
font-size: 30rpx;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
}
|
|
|
|
.sub-box-r {
|
|
width: 290rpx;
|
|
height: 82rpx;
|
|
line-height: 82rpx;
|
|
background: linear-gradient(90deg, #019C88, #28BA92, #35C495);
|
|
border-radius: 46rpx;
|
|
color: #ffffff;
|
|
font-size: 30rpx;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
}
|
|
}
|
|
}
|
|
</style>
|