|  |  | 
 |  |  | <template> | 
 |  |  |    <view class="index"> | 
 |  |  |       <!-- 接单方 --> | 
 |  |  |       <view class="index-j" v-if="type === 1"> | 
 |  |  |       <view class="index-j" v-if="typeViewId === 1"> | 
 |  |  |          <view class="index-j-head"> | 
 |  |  |             <view :style="{ width: '100%', height: statusbarHeight + 'px' }"></view> | 
 |  |  |             <view class="index-c-title" :style="{ height: navHeight + 'px' }"> | 
 |  |  | 
 |  |  |             </view> | 
 |  |  |          </view> | 
 |  |  |       </view> | 
 |  |  | 		 | 
 |  |  |       <!-- 发单方 --> | 
 |  |  |       <view class="index-c" v-if="type === 0"> | 
 |  |  |       <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' }"> | 
 |  |  |          <view class="index-c-title" :style="{ height: navHeight + 'px' }" @click="selectAddress"> | 
 |  |  |             <text class="index-c-title-logo">近快</text> | 
 |  |  |             <image class="dingwei" src="/static/icon/home_ic_location@2x.png" mode="widthFix"></image> | 
 |  |  |             <text>西湖国际广场</text> | 
 |  |  | 
 |  |  |             </view> | 
 |  |  |          </view> | 
 |  |  |           | 
 |  |  |          <template v-if="typeId === 3"> | 
 |  |  |          <template v-if="typeId === 2"> | 
 |  |  |             <view class="list"> | 
 |  |  |                <view class="list-item"> | 
 |  |  |                   <view class="list-item-label">时间地点</view> | 
 |  |  | 
 |  |  |             </view> | 
 |  |  |          </template> | 
 |  |  |           | 
 |  |  |          <view class="box" v-if="typeId !== 3"> | 
 |  |  |          <view class="box" v-if="typeId !== 2"> | 
 |  |  |             <view class="box-hz" :style="{ minHeight: 'calc(100vh - env(safe-area-inset-bottom) - 94rpx - ' + ((navHeight + statusbarHeight) + 'px') + ')' }"> | 
 |  |  |                 | 
 |  |  |                <!-- 用工 --> | 
 |  |  |                <template v-if="typeId === 1"> | 
 |  |  |                <template v-if="typeId === 0"> | 
 |  |  |                   <view class="box-hz-cate"> | 
 |  |  |                      <view :class="typeWorkId === item.id ? 'box-hz-cate-item active' : 'box-hz-cate-item'" v-for="(item, index) in typeWork" :key="index" @click="clickTypeWork(item.id)"> | 
 |  |  |                      <view :class="form.workType === item.id ? 'box-hz-cate-item active' : 'box-hz-cate-item'" v-for="(item, index) in typeWork" :key="index" @click="clickTypeWork(item.id)"> | 
 |  |  |                         <text>{{item.name}}</text> | 
 |  |  |                         <view class="box-hz-cate-item-x" v-if="typeWorkId === item.id"></view> | 
 |  |  |                         <view class="box-hz-cate-item-x" v-if="form.workType === item.id"></view> | 
 |  |  |                      </view> | 
 |  |  |                   </view> | 
 |  |  |                   <view class="box-hz-list"> | 
 |  |  |                      <view class="box-hz-list-item"> | 
 |  |  |                      <view class="box-hz-list-item" @click="show = true"> | 
 |  |  |                         <view class="box-hz-list-item-label"><text>用工时间:</text></view> | 
 |  |  |                         <view class="box-hz-list-item-val"> | 
 |  |  |                         <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>请选择用工时间</text> | 
 |  |  |                               <text>{{ form.startDate ? form.startDate + ' 至 ' + form.endDate : '请选择用工时间'}}</text> | 
 |  |  |                            </view> | 
 |  |  |                            <image class="icon1" src="/static/icon/home_ar_next@2x.png" mode="widthFix"></image> | 
 |  |  |                            <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" @click="selectAddress(1)"> | 
 |  |  |                         <view class="box-hz-list-item-label"><text>用工地点:</text></view> | 
 |  |  |                         <view class="box-hz-list-item-val"> | 
 |  |  |                         <view :class="form.address ? '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_location@2x.png" mode="widthFix"></image> | 
 |  |  |                               <text>请选择用工地点</text> | 
 |  |  |                               <text>{{form.address ? form.address : '请选择用工地点'}}</text> | 
 |  |  |                            </view> | 
 |  |  |                            <image class="icon1" src="/static/icon/home_ar_next@2x.png" mode="widthFix"></image> | 
 |  |  |                            <u-icon name="arrow-right" color="#111111" size="16"></u-icon> | 
 |  |  |                         </view> | 
 |  |  |                      </view> | 
 |  |  |                   </view> | 
 |  |  |                </template> | 
 |  |  |                 | 
 |  |  |                <!-- 运货 --> | 
 |  |  |                <template v-if="typeId === 2"> | 
 |  |  |                <template v-if="typeId === 1"> | 
 |  |  |                   <view class="box-hz-cate"> | 
 |  |  |                      <view :class="carId === item.id ? 'box-hz-cate-item active' : 'box-hz-cate-item'" v-for="(item, index) in car" :key="index" @click="clickCar(item.id)"> | 
 |  |  |                         <text>{{item.name}}</text> | 
 |  |  | 
 |  |  |             </view> | 
 |  |  |          </view> | 
 |  |  |       </view> | 
 |  |  | 		 | 
 |  |  |       <!-- 选择日期范围 --> | 
 |  |  |       <u-calendar :show="show" color="#00BC12" mode="range" @close="show = false" @confirm="confirmDate"></u-calendar> | 
 |  |  | 		 | 
 |  |  |    </view> | 
 |  |  | </template> | 
 |  |  |  | 
 |  |  | 
 |  |  |          ...mapState(['navHeight', 'statusbarHeight','userInfo','token','openid']) | 
 |  |  |       }, | 
 |  |  |       onShow(options){ | 
 |  |  |          this.type = 0 | 
 |  |  |          this.typeViewId = 0 | 
 |  |  |          if(this.token &&this.token!='' && this.userInfo && JSON.stringify(this.userInfo) != '{}'){ | 
 |  |  |             this.isLogin=true | 
 |  |  |          } | 
 |  |  |          if (this.userInfo && this.userInfo.useIdentity == 1) { | 
 |  |  |             this.type =1 | 
 |  |  |             this.typeViewId = 1 | 
 |  |  |          }  | 
 |  |  |       }, | 
 |  |  |       data() { | 
 |  |  |          return { | 
 |  |  |             show: false, | 
 |  |  |             isLogin: false, | 
 |  |  |             typeId: 1, | 
 |  |  |             typeWorkId: 1, | 
 |  |  |             typeId: 0, | 
 |  |  |             carId: 1, | 
 |  |  |             type: [ | 
 |  |  |                { name: '用工', id: 1 }, | 
 |  |  |                { name: '运货', id: 2 }, | 
 |  |  |                { name: '订餐', id: 3 } | 
 |  |  |                { name: '用工', id: 0 }, | 
 |  |  |                { name: '运货', id: 1 }, | 
 |  |  |                { name: '订餐', id: 2 } | 
 |  |  |             ], | 
 |  |  |             typeWork: [ | 
 |  |  |                { name: '采摘工', id: 1 }, | 
 |  |  |                { name: '分拣工', id: 2 }, | 
 |  |  |                { name: '包装工', id: 3 } | 
 |  |  |                { name: '采摘工', id: 0 }, | 
 |  |  |                { name: '分拣工', id: 1 }, | 
 |  |  |                { name: '包装工', id: 2 } | 
 |  |  |             ], | 
 |  |  |             car: [ | 
 |  |  |                { name: '三轮车', id: 1 }, | 
 |  |  |                { name: '小货车', id: 2 } | 
 |  |  |             ], | 
 |  |  |             btn: require('@/static/image/btn.png'), | 
 |  |  |             type: 0 | 
 |  |  |             typeViewId: 0, | 
 |  |  | 				 | 
 |  |  |             form: { | 
 |  |  |                startDate: '', | 
 |  |  |                endDate: '', | 
 |  |  |                latitude: '', | 
 |  |  |                longitude: '', | 
 |  |  |                address: '', | 
 |  |  |                workType: 0, | 
 |  |  |                days: '' | 
 |  |  |             } | 
 |  |  |          } | 
 |  |  |       }, | 
 |  |  |       methods: { | 
 |  |  |          confirmDate(e) { | 
 |  |  |             this.form.startDate = e[0] | 
 |  |  |             this.form.endDate = e[e.length - 1] | 
 |  |  |             this.form.days = e.length; | 
 |  |  |             this.show = false | 
 |  |  |          }, | 
 |  |  |          selectAddress(type) { | 
 |  |  |             uni.chooseLocation({ | 
 |  |  |                success: (res) => { | 
 |  |  |                   if (type === 1) { | 
 |  |  |                      this.form.latitude = res.latitude | 
 |  |  |                      this.form.longitude = res.longitude | 
 |  |  |                      this.form.address = res.address | 
 |  |  |                   } | 
 |  |  |                } | 
 |  |  |             }); | 
 |  |  |             // uni.getLocation({ | 
 |  |  |             //    type: 'gcj02', | 
 |  |  |             //    success: function (res) { | 
 |  |  |             //       console.log(res) | 
 |  |  |             //    } | 
 |  |  |             // }); | 
 |  |  |          }, | 
 |  |  |          clickType(e) { | 
 |  |  |             this.typeId = e | 
 |  |  |          }, | 
 |  |  |          clickTypeWork(e) { | 
 |  |  |             this.typeWorkId = e | 
 |  |  |             this.form.workType = e | 
 |  |  |          }, | 
 |  |  |          clickCar(e) { | 
 |  |  |             this.carId = e | 
 |  |  |          }, | 
 |  |  |          jump() { | 
 |  |  |             console.log(this.userInfo,this.token,this.openid) | 
 |  |  |             if(!this.userInfo  ||!this.token  ){ | 
 |  |  |             if(!this.userInfo || !this.token){ | 
 |  |  |                uni.navigateTo({ | 
 |  |  |                   url: '/pages/login/login' | 
 |  |  |                }) | 
 |  |  |                return | 
 |  |  |             } | 
 |  |  |             if (this.typeId === 1) { | 
 |  |  | 				 | 
 |  |  |             const { form } = this; | 
 |  |  | 				 | 
 |  |  |             if (!form.startDate || !form.endDate) { | 
 |  |  |                return uni.showToast({ title: '请选择用工时间', icon: 'none' }) | 
 |  |  |             } else if (!form.latitude || !form.longitude) { | 
 |  |  |                return uni.showToast({ title: '请选择用工地点', icon: 'none' }) | 
 |  |  |             } | 
 |  |  | 				 | 
 |  |  |             // 采摘工 | 
 |  |  |             if (this.form.workType === 0) { | 
 |  |  |                uni.navigateTo({ | 
 |  |  |                   url: '/pages/using-workers/using-workers' | 
 |  |  |                   url: `/pages/using-workers/using-workers?days=${form.days}&startDate=${form.startDate}&endDate=${form.endDate}&latitude=${form.latitude}&longitude=${form.longitude}&address=${form.address}&workType=${form.workType}` | 
 |  |  |                }) | 
 |  |  |             // 分拣工 | 
 |  |  |             } else if (this.form.workType === 1) { | 
 |  |  |                uni.navigateTo({ | 
 |  |  |                   url: `/pages/sorting/sorting?days=${form.days}&startDate=${form.startDate}&endDate=${form.endDate}&latitude=${form.latitude}&longitude=${form.longitude}&address=${form.address}&workType=${form.workType}` | 
 |  |  |                }) | 
 |  |  |             // 包装工 | 
 |  |  |             } else if (this.form.workType === 2) { | 
 |  |  |                uni.navigateTo({ | 
 |  |  |                   url: `/pages/packaging-worker/packaging-worker?days=${form.days}&startDate=${form.startDate}&endDate=${form.endDate}&latitude=${form.latitude}&longitude=${form.longitude}&address=${form.address}&workType=${form.workType}` | 
 |  |  |                }) | 
 |  |  |             } | 
 |  |  |          }, | 
 |  |  | 
 |  |  |                               font-size: 32rpx; | 
 |  |  |                               color: #111111; | 
 |  |  |                            } | 
 |  |  |                         } | 
 |  |  |                         .icon1 { | 
 |  |  |                            flex-shrink: 0; | 
 |  |  |                            width: 30rpx; | 
 |  |  |                            height: 30rpx; | 
 |  |  |                         } | 
 |  |  |                      } | 
 |  |  |                   } |