123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686 |
- <template>
- <view class="info">
- <view class="popup" v-if="isDisable"></view>
- <view class="content" >
-
- <view class="title">
- 基 本 信 息
- </view>
- <view class="page-section">
- <view class="page-section-title">姓名</view>
- <view class="weui-cells weui-cells_after-title">
- <u-input v-model="form.cName" :type="type" placeholder="请输入姓名,最多四个字" maxlength='4'/>
- </view>
- </view>
- <view class="page-section">
- <view class="page-section-title">性别</view>
- <view class="sex" @click="isShow = true">
- {{changeSex}}
- </view>
- <u-select v-model="isShow" :list="sex" @confirm="confirm"></u-select>
- </view>
- <view class="page-section">
- <view class="page-section-title">手机号</view>
- <view class="weui-cells weui-cells_after-title">
- <!-- <input class="weui-input" v-model="form.cPhone" placeholder="请输入手机号" /> -->
- <u-input v-model="form.cPhone" placeholder="请输入手机号" maxlength='11'/>
- </view>
- </view>
- <view class="page-section">
- <view class="page-section-title">入驻城市</view>
- <view class="weui-cells weui-cells_after-title">
- <u-select v-model="show" :list="citylist" @confirm="select"></u-select>
- <view class="city" @click="selectCity" v-if="form.city == ''">
- 入驻城市
- </view>
- <view class="city" @click="selectCity" v-else>
- {{form.city}}
- </view>
- </view>
- </view>
- <view class="page-section" style="border:0;">
- <view class="page-section-title">上传近期生活照</view>
- <view class="images">
- <u-upload :action="uploadUrl" :file-list="LifeList" @on-success="handleUploadSuccess"
- @on-remove="handleUploadRemove" :header="header"></u-upload>
- </view>
- </view>
- <view class="title">
- 详 细 信 息
- </view>
- <view class="page-section">
- <view class="page-section-title">昵称</view>
- <view class="weui-cells weui-cells_after-title">
- <u-input v-model="form.cNickName" :type="type" placeholder="请输入昵称" maxlength='4' />
- </view>
- </view>
- <view class="page-section" style="border:0;">
- <view class="page-section-title">上传头像</view>
- <view class="">
- <u-upload :action="uploadUrl" :max-count="1" :file-list="headImg" @on-success="handleUploadHeaderSuccess"
- @on-remove="handleUploadHeaderRemove" :header="header" upload-text="点击上传图片" />
- </view>
- <!-- <view class="head_img" v-else>
- <image :src="headImg" mode=""></image>
- </view> -->
- </view>
- <view class="page-section">
- <view class="page-section-title">您所在的位置</view>
- <view class="weui-cells weui-cells_after-title location" @click="getAddress">
- <text class="point" v-if="!form.address">请选择</text>
- <text class="point active" v-else>{{form.address}}{{form.name}}</text>
- </view>
- </view>
- <view class="page-section">
- <view class="page-section-title">商户简介</view>
- <view class="weui-cells weui-cells_after-title textareas" style="border:none">
- <textarea value="" v-model="form.cJianjie" bindinput="jianIn" placeholder="请输入您的简介"></textarea>
- </view>
- </view>
- <view class="page-section" style="border:0;">
- <view class="page-section-title">上传身份证照片</view>
- <view class="images" style="padding-bottom: 0;">
- <!-- <u-upload :action="action" :file-list="idCard"></u-upload> -->
- <u-upload :action="uploadUrl" :file-list="codeList" @on-success="handleUploadIdcardSuccess"
- @on-remove="handleUploadIdcardRemove" :header="header" maxCount="2" />
- </view>
- </view>
- <view class="page-section" style="border:0;">
- <view class="page-section-title">上传健康证照片</view>
- <view class="images" style="padding-bottom: 0;">
- <u-upload :action="uploadUrl" :file-list="healthCertificate" @on-success="handleUploadHealthSuccess"
- @on-remove="handleUploadHealthRemove" :header="header" :max-count="1" />
- </view>
- </view>
- <view class="page-section" style="border:0;">
- <view class="page-section-title">上传从业资格证照片</view>
- <view class="images" style="padding-bottom: 0;">
- <!-- <u-upload :action="action" :file-list="idCard"></u-upload> -->
- <u-upload :action="uploadUrl" :file-list="certification" @on-success="handleUploadCertifiSuccess"
- @on-remove="handleUploadCertifiRemove" :header="header" :max-count="1" />
- </view>
- </view>
- <view class="page-section" style="border:0;">
- <view class="page-section-title">上传营业执照照片</view>
- <view class="images" style="padding-bottom: 0;">
- <!-- <u-upload :action="action" :file-list="idCard"></u-upload> -->
- <u-upload :action="uploadUrl" :file-list="businessLicense" @on-success="handleUploadLicenseSuccess"
- @on-remove="handleUploadLicenseRemove" :header="header" :max-count="1" />
- </view>
- </view>
- <view class="page-section" style="border:0;">
- <view class="page-section-title">上传无犯罪证明照片</view>
- <view class="images" style="padding-bottom: 0;">
- <!-- <u-upload :action="action" :file-list="idCard"></u-upload> -->
- <u-upload :action="uploadUrl" :file-list="noCrime" @on-success="handleUploadnoCrimeSuccess"
- @on-remove="handleUploadnoCrimeRemove" :header="header" :max-count="1" />
- </view>
- </view>
- <view class="submits">
- <button style="margin: 30rpx 0" type="primary" @click="submit">提交</button>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- addEngineer,
- project,
- UpdateEngine,
- engineDetail,
- imgUpload,
- getCityList
- } from '../.././api/index.js'
- import uUpload from 'uview-ui/components/u-upload/u-upload.vue';
- export default {
- components: {
- uUpload,
- },
- data() {
- return {
- isDisable:false,
- citylist:[],
- show:false,
- type: 'text',
- token: '',
- uploadId: '',
- isShow: false,
- // uploadUrl: 'https://test.baoxianzhanggui.com/nightFragrance/common/upload',
- uploadUrl:'https://city.baoxianzhanggui.com/nightFragrance/common/upload',
- headImgList: [],
- title: '商户入驻',
- details: '',
- sex: [
- {
- value: '0',
- label: '女'
- },
- {
- value: '1',
- label: '男'
- }
- ],
- changeSex: '女',
- index: 0,
- location: '',
- imglist: [],
- urlImg: [],
- pictures: [],
- pojectList: [],
- form: {
- id: '',
- cName: '',
- cNickName: '',
- cPortrait: '',
- cPhone: '',
- cJianjie: '',
- nSex: 0,
- cSfzImg: [],
- cImgList: [],
- latitude: '',
- longitude: '',
- name: '',
- address: '',
- cOpenId: '',
- cBhList: '',
- city: '',
- certification: '',
- healthCertificate: '',
- businessLicense: ''
- },
- headImg: [], //展示头像用
- imgsShow: true,
- idCard: [],
- LifeList: [], //展示生活照用
- codeList: [], //展示身份证用
- healthCertificate: [], //展示健康证
- businessLicense: [], //展示营业执照
- certification: [], //展示资格证
- noCrime:[],//展示无犯罪记录证明
- }
- },
- computed: {
- header() {
- return {
- Authorization: `tf: ${this.token}`, // 携带Token的请求头
- };
- },
- },
- mounted() {
- // 在页面加载时获取Token,可以从本地缓存中获取
- this.token = uni.getStorageSync('access-token'); // 假设token保存在本地缓存中
- },
- methods: {
-
- select(e) {
- this.form.city = e[0].label
- this.form.deptId = e[0].value
- },
- goCity() {
- uni.navigateTo({
- url: '/pages/identify/city?type=' + 'indent'
- })
- },
- getAddress() {
- uni.chooseLocation({
- success: res => {
- this.form.name = res.name;
- this.form.latitude = res.latitude;
- this.form.longitude = res.longitude;
- this.form.address = res.address
- }
- });
- },
- //上传头像
- handleUploadHeaderSuccess(response) {
- this.form.cPortrait = response.fileName
- },
- handleUploadHeaderRemove(index) {
- this.headImgList.splice(index, 1);
- },
- //上传身份证
- handleUploadIdcardSuccess(response) {
- this.form.cSfzImg.push(response.fileName);
- },
- handleUploadIdcardRemove(index) {
- this.idCard.splice(index, 1);
- this.form.cSfzImg.splice(index, 1)
- },
- //上传生活照
- handleUploadSuccess(response) {
- this.form.cImgList.push(response.fileName)
- },
- handleUploadRemove(index) {
- this.urlImg.splice(index, 1);
- this.form.cImgList.splice(index, 1)
- },
- //上传健康证
- handleUploadHealthSuccess(response) {
- this.form.healthCertificate = response.fileName
- },
- handleUploadHealthRemove(index) {
- this.healthCertificate.splice(index, 1);
- },
- //上传营业执照
- handleUploadLicenseSuccess(response) {
- this.form.businessLicense = response.fileName
- },
- handleUploadLicenseRemove(index) {
- this.businessLicense.splice(index, 1);
- },
- //上传资格证
- handleUploadCertifiSuccess(response) {
- this.form.certification = response.fileName
- },
- handleUploadCertifiRemove(index) {
- this.certification.splice(index, 1);
- },
- //上传无犯罪记录证明
- handleUploadnoCrimeSuccess(response){
- this.form.noCrime = response.fileName
- },
- handleUploadCertifiRemove(index) {
- this.noCrime.splice(index, 1);
- },
- //提交
- submit() {
- var that = this
- var openids = uni.getStorageSync('wx_copenid')
- this.form.cOpenId = openids
- // this.form.cAddress =this.form.cAddress
- this.form.nSex = this.index
- // this.form.cImgList = this.urlImg
- // this.form.cSfzImg = this.idCard
- // that.data.form.cBhList = that.data.form.cBhList.join(", ")
- if (this.form.cName == '') {
- uni.showToast({
- title: '请输入您的姓名',
- icon: 'none'
- })
- return
- }
- if (this.form.cPortrait == '') {
- uni.showToast({
- title: '请上传头像',
- icon: 'none'
- })
- return
- }
- if (this.form.cNickName == '') {
- uni.showToast({
- title: '请输入您的昵称',
- icon: 'none'
- })
- return
- }
- if (!/^1[3456789]\d{9}$/.test(this.form.cPhone)) {
- uni.showToast({
- title: '请输入正确的手机号',
- icon: 'none'
- });
- return;
- }
- if (this.form.city == '') {
- uni.showToast({
- title: '请选择所在城市',
- icon: 'none'
- });
- return
- }
- if (this.form.address == '') {
- uni.showToast({
- title: '请选择位置',
- icon: 'none'
- });
- return
- }
- if (this.form.cJianjie == '') {
- uni.showToast({
- title: '请填写您的简介',
- icon: 'none'
- });
- return
- }
- if (this.form.cSfzImg.length < 2) {
- uni.showToast({
- title: '请上传身份证照片正反面',
- icon: 'none'
- });
- return
- }
- if (this.form.cImgList.length < 1) {
- uni.showToast({
- title: '最少上传一张生活照片',
- icon: 'none'
- });
- return
- }
- if (this.title == '编辑资料') {
- UpdateEngine(this.form).then(res => {
- if (res.data.code == 200) {
- uni.showToast({
- title: "修改成功",
- })
- setTimeout(() => {
- uni.navigateBack()
- }, 1000)
- } else {
- uni.showToast({
- title: res.data.msg,
- icon: 'none'
- })
- }
- })
- } else {
- addEngineer(this.form).then(res => {
- if (res.data.code == 200) {
- uni.showToast({
- title: "添加成功",
- })
- setTimeout(() => {
- uni.navigateBack()
- }, 1000)
- } else {
- uni.showToast({
- title: res.data.msg,
- icon: 'none'
- })
- }
- })
- }
- },
- // 选中某个复选框时,由checkbox时触发
- checkboxChange(item) {},
- checkboxGroupChange(e) {
- this.form.cBhList = e.join(',')
- },
- //选择性别
- confirm(e) {
- this.changeSex = e[0].label
- },
- // 项目列表
- getPro() {
- project({
- current: 1,
- size: 10
- }).then(res => {
- var list = res.data.data
- setTimeout(() => {
- list.forEach(ele => {
- this.form.cBhList.split(',').forEach(eles => {
- if (ele.cId == eles) {
- ele.checked = true
- }
- })
- });
- this.pojectList = list
- }, 1000)
- })
- },
- getDetails() {
- var that = this
- var openid = {
- cOpenId: uni.getStorageSync('wx_copenid')
- }
- engineDetail(openid).then(res => {
- this.form = res.data.data
- if(res.data.data.nTong && res.data.data.nTong == 0 || res.data.data.nTong == 1 ){
- this.isDisable = true
- }
- //头像
- if (!this.form.cPortrait == '') {
- let header = {
- url: this.$globalData.publicUrl + this.form.cPortrait
- }
- this.headImg.push(header)
- }
- //健康证
- if (!this.form.healthCertificate == '') {
- let healthCertificate = {
- url: this.$globalData.publicUrl + this.form.healthCertificate
- }
- this.healthCertificate.push(healthCertificate)
- }
- //资格证
- if (!this.form.certification == '') {
- let certification = {
- url: this.$globalData.publicUrl + this.form.certification
- }
- this.certification.push(certification)
- }
- //营业执照
- if (!this.form.businessLicense == '') {
- let businessLicense = {
- url: this.$globalData.publicUrl + this.form.businessLicense
- }
- this.businessLicense.push(businessLicense)
- }
- //无犯罪证明
- if (!this.form.noCrime == '') {
- let noCrime = {
- url: this.$globalData.publicUrl + this.form.noCrime
- }
- this.noCrime.push(noCrime)
- }
- //生活照
- res.data.data.cImgList.forEach(item => {
- let obj = {
- url: this.$globalData.publicUrl + item
- }
- this.LifeList.push(obj)
- })
- //身份证
- res.data.data.cSfzImg.forEach(item => {
- let card = {
- url: this.$globalData.publicUrl + item
- }
- this.codeList.push(card)
- })
- this.imgsShow = false,
- this.index = res.data.data.nSex
- // this.form.cBhList = res.data.data.cBhList
- })
- },
- getCity() {
- getCityList().then(res => {
- this.citylist = res.data.data.map(({
- deptId,
- deptName
- }) => ({
- value: deptId,
- label: deptName
- }))
- });
- },
- selectCity(){
- this.show = true
- },
- },
- onLoad(options) {
- // uni.setStorageSync('access-token', 'eyJhbGciOiJIUzUxMiJ9.eyJ0ZjoiOiJiNGQ2NzJiMi0xNzcxLTRmYTMtYjM1OS01NmRhMjk4ZDcwZjAifQ.acq9x8MrF3aXzY3mYJIuG8MLeRtMQ2hybesrN8t5txI4H5HDthn07nq5QYZmCJ1_ZPL8ZDbYczN6qmIa8ckrrA')
- // uni.setStorageSync('wx_copenid','o-HEJ6VP2YNi0HPeLaIHCQsQD69s')
- this.getCity()
- this.title = options.title
- if (options.title == '编辑资料') {
- this.getDetails()
- }
- },
- onShow() {
-
- }
- }
- </script>
- <style lang="scss" scoped>
- .info{
- width: 100%;
- height: auto;
- padding-top: 20rpx;
- position: relative;
- .popup{
- width: 100%;
- height: 100%;
- position: absolute;
- top: 0;
- left: 0;
- background-color: rgba(0, 0, 0, 0.5); /* 半透明黑色遮罩 */
- z-index: 9999;
- overflow-y: auto;
- }
- }
- .title {
- border-left: 3px solid #2cb8d4;
- padding-left: 5px;
- font-size: 30rpx;
- // margin-top: 10px;
- }
- .head_img {
- width: 200rpx;
- height: 200rpx;
- image {
- width: 100%;
- height: 100%;
- }
- }
- .sex {
- width: 100%;
- height: 60rpx;
- line-height: 60rpx;
- border-bottom: 1px solid #333;
- // padding-bottom: 10rpx;
- }
- .weui-cells {
- margin-top: 10rpx;
- border-bottom: 1px solid #333333;
- }
- .listAll {
- background-color: #f8f8f8;
- height: 100vh;
- }
- .content {
- padding: 0 30rpx;
- .page-section-title {
- font-size: 32rpx;
- padding-top: 20rpx;
- }
- .weui-cells:before {
- border-top: 0;
- }
- .piker {
- border-bottom: 1px solid #ccc;
- height: 88rpx;
- line-height: 88rpx;
- }
- .location {
- // height: 88rpx;
- color: rgb(145, 145, 145);
- line-height: 60rpx;
- }
- .textareas {
- margin-top: 20rpx;
- textarea {
- border: 1px solid #b8b6b6;
- width: auto;
- padding: 20rpx;
- background-color: #f8f8f8;
- }
- }
- .images {
- display: flex;
- margin-top: 20rpx;
- // padding-bottom: 240rpx;
- width: 100%;
- .imagesPho {
- position: relative;
- image {
- width: 200rpx;
- height: 200rpx;
- margin-right: 20rpx;
- }
- .closeimg {
- position: absolute;
- right: -5px;
- top: -10rpx;
- position: absolute;
- z-index: 9;
- color: #f03d38 !important;
- width: 40rpx;
- height: 40rpx;
- }
- }
- }
- .uploadImg {
- border: 0;
- .image {
- width: 200rpx;
- height: 200rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- border: 1px solid #b8b6b6;
- }
- }
- .proList {
- margin-top: 20rpx;
- label {
- margin-right: 40rpx;
- margin-bottom: 20rpx;
- display: inline-block;
- }
- }
- .submits {
- width: 100%;
- background-color: #fff;
- border-top: 1px solid #b8b6b6;
- text-align: center;
- z-index: 10;
- button {
- width: 80%;
- display: inline-block;
- background-color: #2cb8d4;
- }
- }
- .heads {
- .uploadImg {
- width: 200rpx;
- height: 200rpx;
- border: 1px solid #ccc;
- text-align: center;
- line-height: 200rpx;
- image {
- width: 200rpx;
- height: 200rpx;
- }
- }
- }
- }
- </style>
|