167 lines
6.6 KiB
Vue
167 lines
6.6 KiB
Vue
<template>
|
|
<view class="">
|
|
<!-- 使用标题栏 -->
|
|
<status-nav :statusBackw="true" :statusTitle="true" :whereCome="1" :title-val="'商务合作'" :tabcolor="'#ffffff'"></status-nav>
|
|
<!-- 合作列表 -->
|
|
<view class="bacb padding-zy20 posir" :style="{marginTop:statusHNH+'px'}">
|
|
<view class="disbc flw padding-zy10 padding-sx30">
|
|
<view class="fon36 bold">商务合作</view>
|
|
<view class="fon24 margin-s10" style="text-align: center;">
|
|
<rich-text :nodes="businessCon"></rich-text>
|
|
</view>
|
|
</view>
|
|
<view class="padding-zy20 margin-s20 business-box">
|
|
<input class="fon24 businessInput" type="text" v-model="name" placeholder="姓名" />
|
|
</view>
|
|
<view class="padding-zy20 margin-s20 business-box">
|
|
<input class="fon24 businessInput" type="number" v-model="phone" maxlength="11" placeholder="电话号码" />
|
|
</view>
|
|
<view class="padding-zy20 margin-s20 business-box">
|
|
<input class="fon24 businessInput" type="text" v-model="company" placeholder="公司名称" />
|
|
</view>
|
|
<view class="disac padding-x40">
|
|
<view class=" margin-s20 flexs" style="">
|
|
<view @tap="chooseImg" v-if="isChoose" class="discc" style="height: 159rpx;width: 159rpx;border: 1rpx dashed #9c9c9c;border-radius: 8rpx;">
|
|
<image style="width: 63rpx;height: 57rpx;" src="/static/img/public/bussiness.png" mode=""></image>
|
|
<view class="fon26 margin-s20" style="color: #7d7b7e;">添加图片</view>
|
|
</view>
|
|
<view v-else class="posir" style="height: 159rpx;width: 159rpx;border: 1rpx dashed #FFFFFF;">
|
|
<image @tap="previewImg" v-if="imgSrc!=''" style="border-radius: 8rpx;height: 159rpx;width: 159rpx;" :src="imgSrc" mode="aspectFill"></image>
|
|
<image @tap="delimg" class="posia" style="width: 30rpx;height: 30rpx;right: 6rpx;top: 6rpx;" src="/static/img/product/pclose.png" mode=""></image>
|
|
</view>
|
|
</view>
|
|
<view class="fon24 padding-z20" style="color: #727272;margin-top: -30rpx;">请上传公司营业执照照片</view>
|
|
</view>
|
|
</view>
|
|
<view class="disbc">
|
|
<button class="businessbtn" :disabled="disabled" @tap="submit">{{btncon}}</button>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
businessCon:'',//商务合作描述
|
|
isChoose:true,//是否显示照相机
|
|
imgSrc:'',//选择后的图片路径
|
|
name:'',
|
|
phone:'',
|
|
company:'',//公司名称
|
|
disabled:false,
|
|
btncon:'提交',//btn按钮文字
|
|
statusHNH:uni.getStorageSync('statusHNH')
|
|
}
|
|
},
|
|
onShow() {
|
|
this.$toolAll.tools.guoq()
|
|
},
|
|
onLoad() {
|
|
this.businessConEv()
|
|
},
|
|
watch:{
|
|
imgSrc:function(newSrc,oldSrc){
|
|
// console.log(newSrc);
|
|
if(newSrc!=''){
|
|
this.uploadImg()
|
|
}
|
|
}
|
|
},
|
|
methods: {
|
|
businessConEv(){//查询商务合作内容
|
|
this.$requst.post('user/business').then(res=>{
|
|
this.businessCon = this.$toolAll.tools.escape2Html(res.data.content)
|
|
},error=>{})
|
|
},
|
|
submit(){//提交商务合作信息
|
|
if(!this.name){
|
|
this.$toolAll.tools.showToast('请输入姓名o(╥﹏╥)o')
|
|
} else if(!this.phone){
|
|
this.$toolAll.tools.showToast('请输入电话号码o(╥﹏╥)o')
|
|
} else if(this.$toolAll.tools.isPhone(this.phone)){
|
|
this.$toolAll.tools.showToast('请输入正确的电话号码o(╥﹏╥)o')
|
|
} else if(!this.company){
|
|
this.$toolAll.tools.showToast('请输入公司名称o(╥﹏╥)o')
|
|
} else if(!this.imgSrc) {
|
|
this.$toolAll.tools.showToast('请添加营业执照照片o(╥﹏╥)o')
|
|
} else {
|
|
this.disabled = true
|
|
this.btncon = '正在提交...'
|
|
let paramBusiness = {
|
|
company_name:this.company,//公司名称
|
|
contact_name:this.name,//姓名
|
|
phone:this.phone,//联系电话
|
|
license:this.imgSrc//营业执照
|
|
}
|
|
// console.log(paramBusiness);
|
|
this.$requst.post('user/business-apply',paramBusiness).then(res=>{
|
|
if(res.code==0){
|
|
this.$toolAll.tools.showToast('信息提交成功(*^▽^*)')
|
|
this.name = ''
|
|
this.phone = ''
|
|
this.company = ''
|
|
this.imgSrc = ''
|
|
this.isChoose = true
|
|
this.$toolAll.tools.setTime('','',2000)
|
|
uni.login({
|
|
provider: 'weixin',
|
|
success: (res)=> {
|
|
if (res.code) {
|
|
var params = {code:res.code}
|
|
this.$requst.post('user/wxAppletsLogin',params).then(res=>{
|
|
if(res.code==0){
|
|
if(res.data.token!=''){
|
|
uni.setStorageSync('token',res.data.token)//缓存token
|
|
uni.setStorageSync('openid',res.data.openid)//缓存Openid
|
|
uni.setStorageSync('expire',res.data.expire)//缓存失效时间(时间戳格式)
|
|
uni.setStorageSync('is_active',res.data.is_active)//是否第一次授权
|
|
uni.setStorageSync('user_type',res.data.user_type)//权限
|
|
}
|
|
} else {
|
|
this.$toolAll.tools.showToast(res.msg)
|
|
}
|
|
},error=>{})
|
|
}
|
|
},
|
|
});
|
|
}
|
|
},error=>{})
|
|
}
|
|
},
|
|
uploadImg(){//获取压缩的图
|
|
this.$requst.upload('file/upload/image',{file:this.imgSrc}).then(res=>{
|
|
this.imgSrc = this.$http + res.data.src
|
|
this.$toolAll.tools.showToast('图片上传成功(*^▽^*)')
|
|
},error=>{})
|
|
},
|
|
chooseImg(){
|
|
uni.chooseImage({
|
|
count:1,
|
|
sizeType:['original'],
|
|
success: (res) => {
|
|
this.isChoose = false
|
|
this.imgSrc = res.tempFilePaths[0]
|
|
},
|
|
complete: (res) => {
|
|
// console.log(res);
|
|
}
|
|
})
|
|
},
|
|
previewImg(){
|
|
uni.previewImage({
|
|
urls:[this.imgSrc]
|
|
})
|
|
},
|
|
delimg(){
|
|
this.isChoose = true
|
|
this.imgSrc = ''
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
|
|
</style>
|