zhangback
2026-01-13 487ef37ec34860b255986d8716d193369024e000
ui/car_wx_app/pages/examine/index.vue
@@ -124,7 +124,7 @@
        </u-form-item> -->
        <u-form-item ref="item1" borderBottom label=" " labelWidth="0" prop="" :borderBottom="false">
        <u-form-item ref="item1" borderBottom label=" " labelWidth="0" prop="" :borderBottom="false" v-if="uploadAreas.length > 0">
          <view style="display: flex;align-items: center;"><u--image :showLoading="true" src="/static/bt.png"
              width="20px" height="20px"></u--image>凭证<span
              style="color: #c6c0ba;margin-left: 10px;display: inline-block;"></span></view>
@@ -162,7 +162,7 @@
        <u-button class="btn-list" @click="goThistory" text="行程历史"></u-button>
        <u-button class="btn-list" @click="goToAdvanceList" text="垫付列表"></u-button>
        <!-- <u-button class="btn-budget" @click="goToAdvanceBudget" type="success" text="垫付预算"></u-button> -->
        <u-button class="btn-submit" @click="submitForm" type="primary" text="提交"></u-button>
        <u-button :loading="loading" class="btn-submit" @click="submitForm" type="primary" text="提交"></u-button>
      </view>
    </view>
@@ -255,7 +255,7 @@
        <u-button class="btn-list" @click="goThistory" text="行程历史"></u-button>
        <u-button class="btn-list" @click="goToAdvanceList" text="垫付列表"></u-button>
        <!-- <u-button class="btn-budget" @click="goToAdvanceBudget" type="success" text="垫付预算"></u-button> -->
        <u-button class="btn-submit" @click="submitForm" type="primary" text="提交"></u-button>
        <u-button :loading="loading" class="btn-submit" @click="submitForm" type="primary" text="提交"></u-button>
      </view>
@@ -303,6 +303,25 @@
            </u-number-box>
          </view>
          <view v-if="form.tripType == '5'"  style="display: flex; align-items: center; width: 100%; margin-top: 15px">
            <view style="display: flex; align-items: center; flex-shrink: 0; margin-right: 10px;">
              <u--image :showLoading="true" src="/static/bt.png" width="20px" height="20px"></u--image>
              <text>是否查车:</text>
            </view>
              <u-radio-group
                  v-model="form.iscc"  iconPlacement="right"
                  placement="row">
                <u-radio  label="是" name="0" style="margin-right: 20px"></u-radio>
                <u-radio  label="否" name="1"></u-radio>
              </u-radio-group>
          </view>
@@ -315,7 +334,7 @@
        <u-button class="cancel-btn" @click="showPopup = false" type="info" plain>
          取消
        </u-button>
        <u-button class="submit-btn" @click="handleSubmit" type="primary">
        <u-button  class="submit-btn" @click="handleSubmit" type="primary">
          提交
        </u-button>
      </view>
@@ -432,8 +451,8 @@
      },
      mapList: {},
      activeActive: {},
      isHk:false,
      loading: false
    };
  },
  onLoad(options) {
@@ -447,6 +466,7 @@
    this.amapPlugin = new amap.AMapWX({
      key: this.mapApiKey
    });
    // 获取 URL 参数
    if (options.id) {
      //this.getList();
@@ -455,6 +475,8 @@
      this.form.tripTime = this.getCurrentDateTime();
    }
    this.getLocation();
  },
  created() {
    // this.getList();
@@ -658,6 +680,8 @@
        success: (res) => {
          const latitude = res.latitude;
          const longitude = res.longitude;
          this.form.longitude =longitude;
          this.form.latitude =latitude;
          this.getAddress(latitude, longitude);
        },
        fail: (err) => {
@@ -671,7 +695,14 @@
      this.amapPlugin.getRegeo({
        location:`${longitude},${latitude}`,
        success: (data) => {
          this.form.address  = data[0].name;
          let datum = data[0];
          if (datum.regeocodeData){
            if (datum.regeocodeData.addressComponent){
              let province = datum.regeocodeData.addressComponent.province;
              this.isHk = province.indexOf("香港") != -1;
            }
          }
          this.form.address  = datum.name;
        },
        fail: (err) => {
          console.error("SDK调用失败:", err);
@@ -737,8 +768,8 @@
      else if (type == '2'||type == '6'){ // 到达装货点 到达卸货点
        this.uploadAreas = [
          { name: '车头', imageUrl: '',required: true },
          { name: '车尾(非必填)', imageUrl: '',required: false },
          { name: '仪表盘(非必填)', imageUrl: '',required: false },
          // { name: '车尾(非必填)', imageUrl: '',required: false },
          // { name: '仪表盘(非必填)', imageUrl: '',required: false },
        ]
@@ -747,13 +778,21 @@
        this.uploadAreas = [
          { name: '车头', imageUrl: '',required: true },
          { name: '车尾', imageUrl: '',required: true },
          { name: '仪表盘(非必填)', imageUrl: '',required: false },
          // { name: '仪表盘(非必填)', imageUrl: '',required: false },
        ]
      }else if (type == '4'||type == '5'){// 到达清关场地 离开清关场地
        this.uploadAreas = [
          { name: '仪表盘(非必填)', imageUrl: '',required: false },
          { name: '车头(非必填)', imageUrl: '',required: false },
          { name: '车尾(非必填)', imageUrl: '',required: false },
          // { name: '仪表盘(非必填)', imageUrl: '',required: false },
          // { name: '车头(非必填)', imageUrl: '',required: false },
          // { name: '车尾(非必填)', imageUrl: '',required: false },
        ]
      }else if (type == '8'){
        this.uploadAreas = [
          { name: '车头', imageUrl: '',required: true },
          { name: '仪表盘', imageUrl: '',required: true },
          { name: '车尾', imageUrl: '',required: true },
          { name: '承运单', imageUrl: '',required: false },
        ]
      }else{
        this.uploadAreas = [
@@ -770,6 +809,7 @@
        if (['3','5','7'].includes(type)){
          let item = this.tmsTripTables[0] || {};
          this.form.odometer = item.odometer;
          this.form.iscc = "1";
        }else{
          this.form.odometer = 0
        }
@@ -790,26 +830,31 @@
    // 新增图片
    async afterRead(event) {
      // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
      let lists = [].concat(event.file)
      let fileListLen = this.fileList.length
      lists.map((item) => {
        this.fileList.push({
          ...item,
          status: 'success',
          message: '上传中'
        })
      uploadImage(event.file[0].url,this.isHk).then(res=>{
        console.log(res)
        this.fileList.push(res);
      })
      for (let i = 0; i < lists.length; i++) {
        const result = await this.uploadFilePromise(lists[i].url)
        let item = this.fileList[fileListLen]
        this.fileList.splice(fileListLen, 1, Object.assign(item, {
          status: result.status,
          message: result.status == 'success' ? '上传成功' : '上传失败',
          urls: result.url
        }))
        fileListLen++
      }
      // let lists = [].concat(event.file)
      // let fileListLen = this.fileList.length
      // lists.map((item) => {
      //   this.fileList.push({
      //     ...item,
      //     status: 'success',
      //     message: '上传中'
      //   })
      // })
      // for (let i = 0; i < lists.length; i++) {
      //
      //   const result = await this.uploadFilePromise(lists[i].url)
      //   let item = this.fileList[fileListLen]
      //   this.fileList.splice(fileListLen, 1, Object.assign(item, {
      //     status: result.status,
      //     message: result.status == 'success' ? '上传成功' : '上传失败',
      //     urls: result.url
      //   }))
      //   fileListLen++
      // }
    },
    uploadFilePromise(url) {
@@ -897,8 +942,8 @@
        success: (res) => {
          const tempFilePaths = res.tempFilePaths;
          const imgUrl = tempFilePaths[0];
          uploadImage(imgUrl).then(res2=>{
            this.uploadAreas[index].imageUrl = res.url;
          uploadImage(imgUrl,this.isHk).then(res2=>{
            this.uploadAreas[index].imageUrl = res2.url;
            // const tempFilePath = res.tempFilePaths[0];
            // // 上传图片到服务器
            // this.uploadAreaPic(tempFilePath, index);
@@ -939,7 +984,9 @@
    // 表单提交时验证图片是否完整(根据需求调整必填项)
    submitForm() {
      if(this.loading){
         return;
      }
      // 根据当前激活的标签页执行不同的提交逻辑
      if (this.activeTab == 'upload') {
@@ -963,7 +1010,7 @@
        } else {
          // 验证是否至少上传了一张图片
          // 收集所有上传的图片地址(用逗号分隔)
         this.loading = true;
          const voucherUrls = this.uploadAreas.filter(item => item.imageUrl!=='').map(item => item.imageUrl).join(',');
          this.form.voucherUrl = voucherUrls;
@@ -975,7 +1022,9 @@
              if (this.form.tripType == 1) {
                /*设置 */
                // console.log(this.form);
         setTimeout(()=>{
                     this.loading = false
                  },2000)
                uni.setStorageSync("signContractForm", this.form);
                setTimeout(() => {
                  uni.$u.route('/pages/signContract/index');
@@ -984,6 +1033,9 @@
                /* 上传行程发车 */
                carUploadTrip(this.form).then((res) => {
                  if (res == 1) {
                 setTimeout(()=>{
                    this.loading = false
                 },2000)
                    uni.$u.toast('操作成功')
                    // 重置表单
                    this.form = {
@@ -1002,12 +1054,18 @@
                  }
                }).catch(err => {
                  uni.$u.toast('提交失败')
              setTimeout(()=>{
                 this.loading = false
              },2000)
                })
              }
            }
          }).catch(errors => {
            uni.$u.toast('校验失败')
         setTimeout(()=>{
            this.loading = false
         },2000)
          })
@@ -1027,7 +1085,7 @@
        this.$refs.uForm.validate().then(res => {
          if (res) {
            var urls = this.fileList.map(item => item.urls).join(',');
            var urls = this.fileList.map(item => item.url).join(',');
            this.form.feeVoucherUrl = urls
            this.form.dispatchOrderId = this.newForm.dispatchId
            this.form.driverId = this.newForm.driverId
@@ -1039,6 +1097,9 @@
            this.cleanedForm = this.cleanFormData({ ...this.form })
            carUploadFinance(this.cleanedForm).then((res) => {
              if (res == 1) {
              setTimeout(()=>{
                 this.loading = false
              },2000)
                uni.$u.toast('操作成功')
                // 重置表单
                this.form = {
@@ -1053,10 +1114,16 @@
              }
            }).catch(err => {
              uni.$u.toast('提交失败')
           setTimeout(()=>{
              this.loading = false
           },2000)
            })
          }
        }).catch(errors => {
          uni.$u.toast('校验失败')
        setTimeout(()=>{
           this.loading = false
        },2000)
        })
      }
@@ -1537,4 +1604,13 @@
  padding: 2px;
  z-index: 999;
}
</style>
<style lang="scss" scoped>
::v-deep .u-radio{
  margin-right: 20px;
}
::v-deep .u-radio__icon-wrap{
  margin-left: 10px;
}
</style>