doum
2025-08-27 fe729234647c83f8029beba4e31dc8d364a6427b
small-program/pages/index/index.vue
@@ -120,7 +120,7 @@
                           <view class="radio-item-label">{{item.name}}</view>
                           <view class="radio-item-list">
                              <view class="radio-item-list-l">
                                 <view :class="child.active ? 'radio-item-list-item active' : 'radio-item-list-item'" v-for="(child, childIndex) in item.list" :key="childIndex" @click="selectMenu(index, childIndex)">{{child.price}}元</view>
                                 <view v-if="child.price" :class="child.active ? 'radio-item-list-item active' : 'radio-item-list-item'" v-for="(child, childIndex) in item.list" :key="childIndex" @click="selectMenu(index, childIndex)">{{child.price||0}}元</view>
                              </view>
                              <view class="radio-item-list-data">
                                 <text style="flex-shrink: 0;">份数:</text>
@@ -196,7 +196,7 @@
               </view>
               <view class="box-hz-btn" :style="{ backgroundImage: 'url(' + btn + ')' }">
                  <view class="box-hz-btn-kf" @click="contactPhone()">客服</view>
                  <view class="box-hz-btn-next" @click="submit">下一步</view>
                  <view class="box-hz-btn-next" @click="submit">立即下单</view>
               </view>
            </view>
         </template>
@@ -258,14 +258,14 @@
                        <view :class="form.startDate ? 'box-hz-list-item-val active' : 'box-hz-list-item-val'">
                           <view class="box-hz-list-item-val-left">
                              <image class="icon" src="/static/icon/ic_time@2x.png" mode="widthFix"></image>
                              <text>{{ form.startDate ? form.startDate + ' 至 ' + form.endDate : '请选择用工时间'}}</text>
                              <text>{{ form.startDate ? form.startDate + ' 至 ' + form.endDate : '请选择用车时间'}}</text>
                           </view>
                           <u-icon name="arrow-right" color="#111111" size="16"></u-icon>
                        </view>
                     </view>
                     <view class="box-hz-list-item">
                        <view class="box-hz-list-item-label">
                           <text>用车时间:</text>
                           <text>用车地点:</text>
                           <text @click="addAddr">+增加途经点</text>
                        </view>
                        <view class="item-d">
@@ -306,7 +306,7 @@
               
               <view class="box-hz-btn" :style="{ backgroundImage: 'url(' + btn + ')' }">
                  <view class="box-hz-btn-kf"  @click="contactPhone()" >客服</view>
                  <view class="box-hz-btn-next" @click="jump()">下一步</view>
                  <view class="box-hz-btn-next" @click="jump()">立即下单</view>
               </view>
            </view>
         </view>
@@ -461,7 +461,7 @@
            this.form.location = ''
            this.form.locationEnd = ''
            this.form.wayInfoDTOList = []
            this.form.workType = 0
            this.form.workType = 0
            this.form.days = ''
            this.form.locationRemark = ''
            this.form.supplement = ''
@@ -469,6 +469,7 @@
            this.form.estimatedAccount = ''
            this.form.price = ''
            this.form.address = ''
            this.clearAll()
         })
         // 刷新首页数据
         uni.$on('refresh', () => {
@@ -483,6 +484,23 @@
      async onShow(options) {
         await this.$onLaunched;
         console.log('2')
         this.form.startDate = ''
         this.form.address = ''
         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.estimatedAccount = ''
         this.form.price = ''
         this.viewStatus = false
         this.clearAll()
         
         if(this.token && this.token != '' && this.userInfo && JSON.stringify(this.userInfo) != '{}') {
            console.log('已登陆')
@@ -523,6 +541,7 @@
               this.form.estimatedAccount = ''
               this.form.price = ''
               this.viewStatus = false
               this.clearAll()
            }
         },
         orderFood: {
@@ -562,6 +581,14 @@
            this.orderFood[index].list.forEach(item => {
               item.active = false
            })
         },
         clearAll() {
            this.orderFood.forEach(p=>{
               p.num=null
               p.list.forEach(item => {
                  item.active = false
               })
            })
         },
         getDictInfo(){
            var that = this;
@@ -664,9 +691,31 @@
            var that = this
            if (!this.form.startDate) {
               return uni.showToast({ title: '请选择用餐时间', icon: 'none' })
            }
            let cateringDTOList = []
            let valid = true
            let msg ='请选择'
            that.orderFood.forEach(item => {
               item.list.forEach(child => {
                  if (child.active) {
                     // (Number(child.price) * Number(item.num))
                     if( !item.num){
                        msg =msg +'【'+item.name+'】';
                        valid =false
                     }
                     cateringDTOList.push({
                        name: item.name,
                        num: item.num,
                        price: child.price * 100
                     })
                  }
               })
            })
            if(!valid){
               return uni.showToast({ title: msg+'用餐份数', icon: 'none' })
            }
            if (this.form.price === 0) {
               return uni.showToast({ title: '请选择用餐时间', icon: 'none' })
            if (cateringDTOList.length === 0) {
               return uni.showToast({ title: '请选择用餐标准', icon: 'none' })
            }
            if (!this.form.address) {
               return uni.showToast({ title: '请选择用餐地点', icon: 'none' })
@@ -676,20 +725,7 @@
            }
            uni.requestSubscribeMessage({
               tmplIds: ['oVjOBLcHxIlGzOMJsdInmgI5CHGXh-UTvMzQqfFOnIg'],
               success(res) {
                  let cateringDTOList = []
                  that.orderFood.forEach(item => {
                     item.list.forEach(child => {
                        if (child.active) {
                           // (Number(child.price) * Number(item.num))
                           cateringDTOList.push({
                              name: item.name,
                              num: item.num,
                              price: child.price * 100
                           })
                        }
                     })
                  })
               success(res) {
                  that.$u.api.release({
                     ...that.form,
                     type: 2,
@@ -792,18 +828,19 @@
         selectAddress(type, index) {
            uni.chooseLocation({
               success: (res) => { 
                  console.log("==================",res)
                  if ([1,2].includes(type)) {
                     this.form.latitude = res.latitude
                     this.form.longitude = res.longitude
                     this.form.address = res.address
                     this.form.address = res.name ||res.address
                  } else if (type === 3) {
                     this.form.locationEnd = res.address
                     this.form.locationEnd = res.name ||res.address
                     this.form.latEnd = res.latitude
                     this.form.lgtEnd = res.longitude
                  } else if (type === 4) {
                     this.form.wayInfoDTOList[0].lat = res.latitude
                     this.form.wayInfoDTOList[0].lgt = res.longitude
                     this.form.wayInfoDTOList[0].location = res.address
                     this.form.wayInfoDTOList[index].lat = res.latitude
                     this.form.wayInfoDTOList[index].lgt = res.longitude
                     this.form.wayInfoDTOList[index].location = res.name||  res.address
                  }else if (type == -1) {
                     console.log(res)
                     this.location.latitude = res.latitude