111
rk
2025-08-22 6b6dea66dc53ebee26ac5e6731d8e7f0bd6a9fe2
small-program/pages/index/index.vue
@@ -83,10 +83,10 @@
      <!-- 发单方 -->
      <view class="index-c" v-if="typeViewId === 0">
         <view :style="{ width: '100%', height: statusbarHeight + 'px' }"></view>
         <view class="index-c-title" :style="{ height: navHeight + 'px' }" @click="selectAddress">
         <view class="index-c-title" :style="{ height: navHeight + 'px' }" @click="selectAddress(-1)">
            <text class="index-c-title-logo">近快</text>
            <image class="dingwei" src="/static/icon/home_ic_location@2x.png" mode="widthFix"></image>
            <text>西湖国际广场</text>
            <text>{{location.address || address || '获取地址失败'}}</text>
            <image class="qu" src="/static/icon/home_ar_next@2x.png" mode="widthFix"></image>
         </view>
         
@@ -193,7 +193,7 @@
                  </view>
               </view>
               <view class="box-hz-btn" :style="{ backgroundImage: 'url(' + btn + ')' }">
                  <view class="box-hz-btn-kf">客服</view>
                  <view class="box-hz-btn-kf" @click="contactPhone()">客服</view>
                  <view class="box-hz-btn-next" @click="submit">下一步</view>
               </view>
            </view>
@@ -303,7 +303,7 @@
               </template>
               
               <view class="box-hz-btn" :style="{ backgroundImage: 'url(' + btn + ')' }">
                  <view class="box-hz-btn-kf">客服</view>
                  <view class="box-hz-btn-kf"  @click="contactPhone()" >客服</view>
                  <view class="box-hz-btn-next" @click="jump()">下一步</view>
               </view>
            </view>
@@ -312,6 +312,19 @@
      
      <!-- 选择日期范围 -->
      <u-calendar :show="show" color="#00BC12" mode="range" @close="show = false" @confirm="confirmDate"></u-calendar>
      <u-popup :show="showPhone" round="15" mode="bottom"   @close="contactPhone()" :closeable="true" :closeOnClickOverlay="true">
         <view class="phone">
            <view class="phone-head">
               <view></view>
               <text>客服电话</text>
            </view>
             <view class="phone-item" v-for="(item,index) in serverPhone"    :key="item" @click="contactPhoneDo(item)">
                <view></view>
                <text>{{item}}</text>
             </view>
            <!-- <view class="phone-botton"  @click="contactPhone()" >关闭</view> -->
         </view>
      </u-popup>
   </view>
</template>
@@ -322,17 +335,24 @@
   export default {
      components: { sunuiMverify },
      computed: {
         ...mapState(['navHeight', 'statusbarHeight','userInfo','token','openid', 'latitude', 'longitude']),
         ...mapState(['navHeight', 'statusbarHeight','userInfo','token','openid', 'latitude', 'longitude','address']),
         totalPrice() {
            return this.form.estimatedAccount / 100
         }
      },
      data() {
         return {
            showPhone:false,
            serverPhone:[],
            show: false,
            isLogin: false,
            typeId: 0,
            qqmapsdk: null,
            location:{
               latitude:null,
               longitude:null,
               address:null,
            },
            type: [
               { name: '用工', id: 0 },
               { name: '运货', id: 1 },
@@ -392,19 +412,52 @@
            isOnce: true
         }
      },
      async onLoad() {
      async onLoad() {
         await this.$onLaunched;
         
         if (this.token && this.token != '' && this.userInfo && JSON.stringify(this.userInfo) != '{}') {
         if (this.token && this.token != '' && this.userInfo && JSON.stringify(this.userInfo) != '{}' && this.userInfo.useIdentity === 1) {
            this.getOrderList()
            this.getCategoryLists()
         }
         this.getCategoryLists()
         this.getDictInfo()
         if (this.token && this.token != '' && this.userInfo && JSON.stringify(this.userInfo) != '{}') {
            this.form.linkPhone = this.userInfo.telephone
         }
         
         this.qqmapsdk = new QQMapWX({
            key: '4PXBZ-JLBC7-LCLXG-P2SZX-C4HYE-LDBLQ'
         });
         
         this.form.linkPhone = this.userInfo.telephone
         uni.$on('clear', (data) => {
            this.form.startDate = ''
            this.form.endDate = ''
            this.form.latitude = ''
            this.form.longitude = ''
            this.form.location = ''
            this.form.locationEnd = ''
            this.form.wayInfoDTOList = []
            this.form.workType = 0
            this.form.days = ''
            this.form.locationRemark = ''
            this.form.supplement = ''
            this.form.multifileList = []
            this.form.linkName = ''
            this.form.estimatedAccount = ''
            this.form.price = ''
            this.form.address = ''
            this.orderFood = []
         })
         // 刷新首页数据
         uni.$on('refresh', () => {
            this.getCategoryLists()
            this.getDictInfo()
            if (this.token && this.token != '' && this.userInfo && JSON.stringify(this.userInfo) != '{}') {
               this.form.linkPhone = this.userInfo.telephone
            }
         })
      },
      onShow(options) {
         this.typeViewId = 0
@@ -439,7 +492,7 @@
               this.form.location = ''
               this.form.locationEnd = ''
               this.form.wayInfoDTOList = []
               this.form.workType = ''
               this.form.workType = 0
               this.form.days = ''
               this.form.locationRemark = ''
               this.form.supplement = ''
@@ -477,9 +530,28 @@
         }
      },
      onReachBottom() {
         this.getOrderList()
         if (this.token && this.token != '' && this.userInfo && JSON.stringify(this.userInfo) != '{}' && this.userInfo.useIdentity === 1) {
            this.getOrderList()
         }
      },
      methods: {
         getDictInfo(){
            var that = this;
            this.$u.api.getPlatformAboutUs({}).then(res =>{
                 that.serverPhone = (res.data.serverPhone||'').split(",")
            })
         },
         contactPhone(){
             this.showPhone = !this.showPhone
             console.log("==================================",this.showPhone)
         },
         contactPhoneDo(phone){
            if(phone !=null && phone!=''){
               uni.makePhoneCall({
                  phoneNumber: phone
               })
            }
         },
         // 手动接单
         getaccept(e, orderId, index) {
            if (!e.msg) return;
@@ -610,24 +682,25 @@
         uploadImg() {
            uni.chooseImage({
               success: (chooseImageRes) => {
                  const tempFilePaths = chooseImageRes.tempFilePaths;
                  uni.uploadFile({
                     url: this.$baseUrl + '/web/public/upload',
                     filePath: tempFilePaths[0],
                     name: 'file',
                     formData: {
                        'folder': 'orders'
                     },
                     success: (uploadFileRes) => {
                        const res = JSON.parse(uploadFileRes.data)
                        this.form.multifileList.push({
                           fileurl: res.data.imgaddr,
                           name: res.data.originname,
                           url: res.data.url,
                           type: 0
                        })
                     }
                  });
                  for (let i = 0; i < chooseImageRes.tempFilePaths.length; i++) {
                     uni.uploadFile({
                        url: this.$baseUrl + '/web/public/upload',
                        filePath: chooseImageRes.tempFilePaths[i],
                        name: 'file',
                        formData: {
                           'folder': 'orders'
                        },
                        success: (uploadFileRes) => {
                           const res = JSON.parse(uploadFileRes.data)
                           this.form.multifileList.push({
                              fileurl: res.data.imgaddr,
                              name: res.data.originname,
                              url: res.data.url,
                              type: 0
                           })
                        }
                     });
                  }
               }
            });
         },
@@ -664,7 +737,7 @@
         },
         selectAddress(type, index) {
            uni.chooseLocation({
               success: (res) => {
               success: (res) => {
                  if ([1,2].includes(type)) {
                     this.form.latitude = res.latitude
                     this.form.longitude = res.longitude
@@ -677,7 +750,12 @@
                     this.form.wayInfoDTOList[0].lat = res.latitude
                     this.form.wayInfoDTOList[0].lgt = res.longitude
                     this.form.wayInfoDTOList[0].location = res.address
                  }
                  }else if (type == -1) {
                     console.log(res)
                     this.location.latitude = res.latitude
                     this.location.longitude = res.longitude
                     this.location.address =res.name ||  res.address
                  }
               }
            });
         },
@@ -1069,7 +1147,7 @@
            padding: 0 30rpx;
            box-sizing: border-box;
            display: flex;
            align-items: center;
            align-items: center;
            .index-c-title-logo {
               font-weight: bold;
               font-size: 40rpx;
@@ -1086,6 +1164,10 @@
               font-size: 32rpx;
               color: #ffffff;
               margin-right: 12rpx;
               max-width: 280rpx;
               white-space: nowrap;
               overflow: hidden;
               text-overflow: ellipsis;
            }
            .qu {
               width: 22rpx;
@@ -1184,12 +1266,16 @@
                     padding: 30rpx 0;
                     box-sizing: border-box;
                     flex-direction: column;
                     border-bottom: 1rpx solid #E5E5E5;
                     // border-bottom: 1rpx solid #E5E5E5;
                     .radio-item {
                        width: 100%;
                        display: flex;
                        align-items: self-end;
                        margin-bottom: 30rpx;
                        border-bottom: 1rpx solid #E5E5E5;
                        &:last-child {
                           border: none;
                        }
                        &:last-child {
                           margin: 0 !important;
                        }
@@ -1242,6 +1328,7 @@
                              align-items: center;
                              justify-content: flex-end;
                              margin-top: 42rpx;
                              margin-bottom: 34rpx;
                              text {
                                 font-weight: 400;
                                 font-size: 30rpx;
@@ -1649,7 +1736,7 @@
                              flex-shrink: 0;
                           }
                           text {
                              flex: 1;
                              width: 470rpx;
                              overflow: hidden;
                              text-overflow: ellipsis;
                              white-space: nowrap;
@@ -1704,5 +1791,46 @@
            }
         }
      }
      .phone {
         width: 100%;
         padding-top: 40rpx;
         box-sizing: border-box;
         .phone-botton {
            width: 100%;
            height: 88rpx;
            line-height: 88rpx;
            text-align: center;
            font-weight: 500;
            font-size: 32rpx;
            color: #FFFFFF;
            background: #00BC12;
            border-radius: 44rpx;
            margin-top: 60rpx;
         }
         .phone-head {
            width: 100%;
            text-align: center;
            justify-content: space-between;
            margin-bottom: 40rpx;
            text {
               font-weight: 800;
               font-size: 32rpx;
               color: #222222;
            }
         }
         .phone-item {
            width: 100%;
            text-align: center;
            justify-content: space-between;
            border-bottom: 1rpx solid #eeeeee;
            line-height: 78rpx;
            text {
               font-weight: 500;
               font-size: 28rpx;
               line-height: 28rpx;
               color: #222222;
            }
         }
      }
   }
</style>