xuxueyang
2024-07-21 883ca635ebb2df1ccb9e7f6dc19a88c7ad374cb6
sub_pages/partner/partner-info/partner-info.vue
@@ -17,7 +17,17 @@
            </view>
         </view>
         <view class="form-item before-line">
            <view class="label required">集货站</view>
            <view class="m-l-a m-r-0 flex " :class="[!dto.stationId?'desc-gray':'']" @click="()=>{
               if(!id){
                  show_select_station=true
               }
            }">
               <view>{{dto.stationName || '请选择'}}</view>
               <u-icon class="m-l-a" name="arrow-right"></u-icon>
            </view>
         </view>
         <view class="form-item before-line">
            <view class="label required">地区</view>
@@ -65,7 +75,7 @@
         <view class="button-green-1 m-t-20 button-fixed-bottom before-line " @click="submit">
            提交审核
            {{source==='step'?'下一步':'提交审核'}}
         </view>
      </view>
@@ -73,6 +83,8 @@
      <view style="min-height: 200rpx;">
         &nbsp;
      </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 +103,14 @@
         return {
            id: '',
            refresh: false,
            source: '',
            api: '',
            dto: {
               idCards: [],
               address: '',
               id: '',
               stationId: '',
               stationName: '',
               userId: '',
               name: '',
               contactTel: '',
@@ -114,6 +129,10 @@
                  key: 'contactTel'
               },
               {
                  name: '集货站',
                  key: 'stationId'
               },
               {
                  name: '地区',
                  key: 'province'
               },
@@ -123,21 +142,47 @@
               },
            ],
            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) {
@@ -248,29 +293,41 @@
            }
            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.redirectTo({
                  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) {