From 6e12337e17704d873d8954d80e4567a94e23d92d Mon Sep 17 00:00:00 2001 From: xuxueyang <xuxy@fengyuntec.com> Date: 星期五, 09 八月 2024 19:02:14 +0800 Subject: [PATCH] 1 --- sub_pages/partner/partner-info/partner-info.vue | 148 ++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 121 insertions(+), 27 deletions(-) diff --git a/sub_pages/partner/partner-info/partner-info.vue b/sub_pages/partner/partner-info/partner-info.vue index efa38ec..c816e67 100644 --- a/sub_pages/partner/partner-info/partner-info.vue +++ b/sub_pages/partner/partner-info/partner-info.vue @@ -1,6 +1,16 @@ <template> - <view class="container-page"> - <view> + <view class="container-page" style="padding: 0rpx;"> + <view v-if="source==='step'" style="padding: 20rpx 0rpx;color: red;;background-color: #e6e6e6;"> + <view style="padding: 20rpx;text-align: center;background-color: #fff;">仅限花满芫合伙人入驻</view> + </view> + <view v-if="source==='step'" class="m-t-20"> + <u-steps current="0"> + <u-steps-item title="信息填写" class="u-steps-item" style="font-size: 28rpx;"> + </u-steps-item> + <u-steps-item title="提交申请" class="u-steps-item"></u-steps-item> + </u-steps> + </view> + <view class="p20"> <view class="form-item before-line"> <view class="label required">联系人姓名</view> <view class="m-l-a m-r-0 flex"> @@ -17,6 +27,16 @@ </view> </view> + + <view class="form-item before-line"> + <view class="label required">城市仓名称</view> + <view class="m-l-a m-r-0 flex"> + <input v-model="dto.cityWarehouse" placeholder="请输入城市仓名称" + style="margin-top: 16px;text-align: right;"></input> + + </view> + </view> + <view class="form-item before-line"> <view class="label required">地区</view> @@ -45,7 +65,7 @@ <view class="form-item before-line m-t-20" @click="uploadIcon('idCards')"> <view class="label required">上传身份证正反面</view> <view class="m-l-a m-r-0 flex"> - <view class="component-button-upload" @click="uploadIcon('idCards')"> + <view class="component-button-upload"> </view> @@ -65,7 +85,7 @@ <view class="button-green-1 m-t-20 button-fixed-bottom before-line " @click="submit"> - 提交审核 + {{source==='step'?'下一步':'提交审核'}} </view> </view> @@ -73,6 +93,8 @@ <view style="min-height: 200rpx;"> </view> + <u-picker @confirm="select_station" keyName="name" @cancel="show_select_station=false" + :show="show_select_station" :columns="columns_station"></u-picker> </view> @@ -91,11 +113,14 @@ return { id: '', refresh: false, + source: '', api: '', dto: { idCards: [], address: '', id: '', + // stationId: '', + // stationName: '', userId: '', name: '', contactTel: '', @@ -114,6 +139,10 @@ key: 'contactTel' }, { + name: '城市仓名称', + key: 'cityWarehouse' + }, + { name: '地区', key: 'province' }, @@ -123,28 +152,61 @@ }, ], regionDataPlus: [], + show_select_station: false, + columns_station: [], } }, onLoad(options) { + this.source = options.source || '' + // this.$http.request('get', '/api/station/list', { + // params: {} + // }).then(res => { + // var data = res.data + // this.columns_station = [data || []] + // }) if (options.id) { this.id = options.id this.getDetail() } else { - this.getCurrentInfo() + //判断是不是来自登录步骤,是等话需要从缓存里面拿信息 + if (this.source === 'step') { + var tjson = this.$storage.getItem('cache_partner_info') + if (tjson) { + this.dto = { + ...this.dto, + ...JSON.parse(tjson) + } + } + } else { + this.getCurrentInfo() + } this.init_area() } + }, methods: { + select_station(e) { + this.show_select_station = false + this.dto.stationName = e.value[0].name + this.dto.stationId = e.value[0].id + }, PickArea(item, e) { console.log('PickArea', item, e) if (e.detail.value) { this.dto.province = '' this.dto.city = '' this.dto.region = '' - if (e.detail.value.length <= 3) { + if (e.detail.value.length == 2) { + if (!!e.detail.value[0]) + this.dto.province = e.detail.value[0].value + if (!!e.detail.value[0]) + this.dto.city = e.detail.value[0].value + if (!!e.detail.value[1]) + this.dto.region = e.detail.value[1].value + } else if (e.detail.value.length <= 3) { if (!!e.detail.value[0]) this.dto.province = e.detail.value[0].value if (!!e.detail.value[1]) @@ -179,10 +241,17 @@ } }, async init_area() { - const res = await this.$http.request('get', '/api/pub/china/area/json') - // console.log('area', JSON.parse(res.data)) - this.regionDataPlus = res.data && JSON.parse(res.data.replaceAll('code', 'value').replaceAll('name', - 'text')) || [] + var a = this.$storage.getItem('cache_area') + if (a) { + this.regionDataPlus = JSON.parse(a) || [] + } else { + const res = await this.$http.request('get', '/api/pub/china/area/json') + // console.log('area', JSON.parse(res.data)) + this.regionDataPlus = res.data && JSON.parse(res.data.replaceAll('code', 'value').replaceAll( + 'name', + 'text')) || [] + this.$storage.setItem('cache_area', JSON.stringify(this.regionDataPlus)) + } @@ -242,35 +311,60 @@ return } } + + if (this.dto.contactTel.length !== 11 && !this.dto.contactTel.startsWith('1')) { + this.$message.showToast(`联系方式需要为11位,且开头为1`) + return + } + if(isNaN(parseInt(this.dto.contactTel))){ + this.$message.showToast(`联系方式需要为11位手机号,格式错误`) + return + } if (this.dto.idCards.length == 0) { this.$message.showToast(`身份证信息未填写`) return } + if (this.dto.idCards.length < 2) { + this.$message.showToast(`身份证信息需要上传至少2张图片(正反面)`) + return + } await this.$message.confirm(`是否确定提交/修改信息`) + if (this.source === 'step') { + //先保存下来,进入下一步,然后注册成功后再保存 + this.$storage.setItem("cache_partner_info", JSON.stringify({ + ...this.dto + })) - var dto = { - ...this.dto, - } - this.$message.showLoading() - const re = await this.$http.request('post', '/api/partner/addOrUpdate', { - data: dto - }) - this.$message.hideLoading() - if (re.code == 2000 || re.code == 0) { - this.$message.showToast('操作成功') - //需要标记加一下 - this.$store.dispatch('sign_add', 'info'); - this.$store.dispatch('getCurrentInfo') + uni.navigateTo({ + url: '/pages/login/supplier-reg?source=step' + }) - this.backpage() } else { - console.log('error re', re) - if (re.code === 30000 && Array.isArray(re.msg)) { - this.$message.showToast('字段未填写完整') + var dto = { + ...this.dto, + } + this.$message.showLoading() + const re = await this.$http.request('post', '/api/partner/addOrUpdate', { + data: dto + }) + this.$message.hideLoading() + if (re.code == 2000 || re.code == 0) { + this.$message.showToast('操作成功') + //需要标记加一下 + this.$store.dispatch('sign_add', 'info'); + this.$store.dispatch('getCurrentInfo') + this.backpage() + } else { + console.log('error re', re) + if (re.code === 30000 && Array.isArray(re.msg)) { + this.$message.showToast('字段未填写完整') + + } } } + }, async deleteImg(key, index) { -- Gitblit v1.9.3