wk
2024-08-13 521cad436a0145c7c5f5d22be57f2b7045462251
pages/freight-forwarder-page/freightForwarder-my/freightForwarder-my.vue
@@ -78,12 +78,15 @@
         <view class="utils"><u-button text="修改密码"
               type="primary"
               @click="modifyPwd"></u-button></view>
         <view class="utils"><u-button text="重置密码"
         <!-- <view class="utils"><u-button text="重置密码"
               type="primary"
               @click="initPwd"></u-button></view>
               @click="initPwd"></u-button></view> -->
         <view class="utils"><u-button text="退出登录"
               type="primary"
               @click="logout"></u-button></view>
         <view class="utils"><u-button text="联系我们"
               type="primary"
               @click="contactUs"></u-button></view>
      </view>
      <!-- 删除车队模态框 -->
@@ -107,16 +110,16 @@
            @cancel="logoutCancel"></u-modal>
      </view>
      <!-- 重置密码弹出框 -->
      <view class="initPwdModal">
      <!-- <view class="initPwdModal">
         <u-modal :show="initPwdShow"
            title="重置密码"
            showCancelButton
            content="初始密码将变更为123456,是否确认重置"
            @confirm="initPwdConfirm"
            @cancel="initPwdCancel"></u-modal>
      </view>
      </view> -->
      <!-- 修改密码弹出框 -->
      <view class="modifyPwdModal">
      <!-- <view class="modifyPwdModal">
         <u-modal :show="modifyPwdShow"
            title="修改密码"
            showCancelButton
@@ -129,12 +132,13 @@
                  type="password"></u-input>
            </view>
         </u-modal>
      </view>
      </view> -->
   </view>
</template>
<script>
   import { redirectLogin } from '@/utils/status';
   import { BaseUrl } from '@/api/publicInterface.js'
   export default {
      data() {
         return {
@@ -161,7 +165,7 @@
            modifyPwdShow: false,
            passwordModified: '',
            // 用户信息对象
            userEntity: {},
            userInfo: {},
         };
      },
      onLoad() {
@@ -170,21 +174,76 @@
      methods: {
         init() {
            this.getFleet();
            this.getUserEntity()
         },
         // 获取用户信息
         getUserEntity() {
            this.$reqGet('getUserEntity').then(res => {
               this.userEntity = res.data;
            });
            this.getUserEntity();
            uni.request({
               url:  `${BaseUrl}/admin/dict/page`,
               method: 'GET',
               data: {
                  dictType:'phone'
               },
               header: {
                  Authorization: 'Bearer' + ' ' + uni.getStorageSync('token'),
                  clientToc: 'Y',
                  'CLIENT_TOC': 'Y',
               },
               success: res => {
                  let dictId=res.data.data?.records[0].id
                  uni.request({
                     url:  `${BaseUrl}/admin/dict/item/page`,
                     method: 'GET',
                     data: {
                        dictId:dictId
                     },
                     header: {
                        Authorization: 'Bearer' + ' ' + uni.getStorageSync('token'),
                        clientToc: 'Y',
                        'CLIENT_TOC': 'Y',
                     },
                     success: res => {
                        this.phoneList=res.data.data.records
                     },
                     fail: err => {
                     }
                  })
               },
               fail: err => {
               }
               })
         },
         // 获取车队
         getFleet() {
            // this.$reqGet('getFleet', { wxUserId: this.addGroupForm.wxUserId }).then(res => {
            this.$reqGet('getFleet').then(res => {
               console.log('货代1车队', res);
               console.log('承运商1车队', res);
               this.fleetData = res.data;
            });
         },
         contactUs(){
            let data=[]
            this.phoneList.map(item=>{
               item.value.split(',').map(ite=>{
                  data.push(ite)
               })
            })
            uni.showActionSheet({
            itemList: Array.from(new Set(data)),
            success: (res) => {
               uni.makePhoneCall({
                  phoneNumber:Array.from(new Set(data))[res.tapIndex + 1]
               })
            },
            fail: (err) => {
               console.log('弹窗取消');
            }
            });
         },
         getUserEntity() {
            uni.showLoading({
               title: '加载中...'
            });
            this.$reqGet('getUserEntity').then(res => {
               uni.hideLoading()
               this.userInfo = res.data;
            })
         },
         // 添加车队
         addFleet() {
@@ -247,49 +306,12 @@
               url: `/pages/customer-page/fleet-management/fleet-management?id=${id}`
            });
         },
         updateInfo() {
            this.$reqPost('updateUser', this.userEntity, 'json').then(res => {
               uni.hideLoading()
               if (res.code == 0) {
                  uni.showToast({
                     title: '重置成功',
                     duration: 2000,
                     icon: 'success'
                  })
               } else {
                  this.$u.toast(res.msg ? res.msg : '修改失败');
               }
            }).catch(err => {
               this.$u.toast('修改失败');
            });
         },
         initPwd() {
            this.initPwdShow = true
         },
         initPwdConfirm() {
            this.initPwdShow = false
            uni.showLoading({
               title: '加载中'
            })
            this.userEntity.password = '123456'
            this.updateInfo()
         },
         initPwdCancel() {
            this.initPwdShow = false
         },
         modifyPwd() {
            this.modifyPwdShow = true
         },
         modifyPwdConfirm() {
            if (this.passwordModified.length === 0) {
               return this.$u.toast('密码不能为空')
            }
            this.modifyPwdShow = false
            this.userEntity.password = this.passwordModified
            this.updateInfo()
         },
         modifyPwdCancel() {
            this.modifyPwdShow = false
            this.$store.commit('changeisLogin', false)
            this.$store.dispatch('websocketOnClose')
            uni.reLaunch({
               url: `/pages/login/resetPassword/resetPassword?phone=${this.userInfo.phone}&idCard=${this.userInfo.idCard}`
            })
         },
         logout() {
            this.logoutShow = true;