| | |
| | | <view class="search" :style="{ top: statusbarHeight + navHeight + 'px' }"> |
| | | <view class="index-j-cate"> |
| | | <view class="index-j-cate-item" v-for="(item, index) in searchType" :key="index" @click="clickCate(item.id)"> |
| | | <text :style="{ color: typeVal === item.id ? '##222222' : '' }">{{item.name}}</text> |
| | | <text :style="{ color: typeVal === item.id ? '#222222' : '', fontSize: typeVal === item.id ? '36rpx' : '', fontWeight: typeVal === item.id ? '600' : '' }">{{item.name}}</text> |
| | | <view class="index-j-cate-item-x" v-if="typeVal === item.id"></view> |
| | | </view> |
| | | </view> |
| | | <view class="index-j-search"> |
| | | <view class="index-j-search-item active">最新发布</view> |
| | | <view class="index-j-search-item">距离优先</view> |
| | | <view class="index-j-search-item">价格从高到低</view> |
| | | <view :class="sortType === item.id ? 'index-j-search-item active' : 'index-j-search-item'" v-for="(item, index) in sortList" :key="index" @click="clickSort(item.id)">{{item.name}}</view> |
| | | </view> |
| | | </view> |
| | | <view class="index-j-list"> |
| | |
| | | {{item.categoryName}}|{{item.priceNum1}}斤 |
| | | </view> |
| | | <view class="index-list-item-info" v-if="item.type === 0 && item.workType === 1"> |
| | | {{item.categoryName}}|{{item.priceNum1}}斤 |
| | | {{item.categoryName}}|{{item.priceNum1}}人 |
| | | </view> |
| | | <view class="index-list-item-info" v-if="item.type === 0 && item.workType === 2"> |
| | | {{item.categoryName}}|{{item.priceNum1}}斤 |
| | | {{item.categoryName}}|{{item.priceNum1}}人 |
| | | </view> |
| | | <view class="index-list-item-info" v-if="item.type === 1"> |
| | | {{item.categoryName}}|{{item.priceNum1}}斤 |
| | | {{item.transportTypeName}} | {{item.transportNum}}{{item.transportUnit}}|用车{{item.priceNum1}}天 |
| | | </view> |
| | | <view class="index-list-item-info" v-if="item.type === 2"> |
| | | {{item.wayInfoCopy}} |
| | | </view> |
| | | <view class="index-list-item-dz"> |
| | | <image src="/static/icon/order_ic_location@2x.png" mode="widthFix"></image> |
| | | <text>{{item.location}}</text> |
| | | |
| | | <view class="address" v-if="item.type === 1"> |
| | | <view class="address-xian"></view> |
| | | <view class="address-row" v-for="(address, i) in item.wayInfo" :key="i"> |
| | | <image src="/static/icon/ic_qidian@2x.png" mode="widthFix" v-if="i === 0"></image> |
| | | <image src="/static/icon/ic_jingguo@2x.png" mode="widthFix" v-else-if="i !== 0 && i !== item.wayInfo.length - 1"></image> |
| | | <image src="/static/icon/ic_zhongdian@2x.png" mode="widthFix" v-else-if="i === item.wayInfo.length - 1"></image> |
| | | <text>{{item.location}}</text> |
| | | </view> |
| | | </view> |
| | | <view class="index-list-item-dz"> |
| | | <image src="/static/icon/order_ic_time@2x.png" mode="widthFix"></image> |
| | | <text>{{item.startDate}} 至 {{item.endDate}}({{item.priceNum1}}天)</text> |
| | | </view> |
| | | <template v-if="[0, 2].includes(item.type)"> |
| | | <view class="index-list-item-dz"> |
| | | <image src="/static/icon/order_ic_location@2x.png" mode="widthFix"></image> |
| | | <text>{{item.location}}</text> |
| | | </view> |
| | | <view class="index-list-item-dz"> |
| | | <image src="/static/icon/order_ic_time@2x.png" mode="widthFix"></image> |
| | | <text>{{item.startDate}} 至 {{item.endDate}}({{item.totalDays}}天)</text> |
| | | </view> |
| | | </template> |
| | | <view class="index-list-item-price"> |
| | | <text>预估:</text> |
| | | <text>¥{{item.estimatedAccount / 100}}</text> |
| | | </view> |
| | | <view class="eidt"> |
| | | <sunui-mverify @change="mverify($event, item.id)"></sunui-mverify> |
| | | <sunui-mverify @change="getaccept($event, item.id, index)"></sunui-mverify> |
| | | </view> |
| | | </view> |
| | | </view> |
| | |
| | | </view> |
| | | <view class="box-hz-list-item" @click="selectAddress(1)"> |
| | | <view class="box-hz-list-item-label"><text>用工地点:</text></view> |
| | | <view :class="form.location ? 'box-hz-list-item-val active' :'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>{{form.location ? form.location : '请选择用工地点'}}</text> |
| | | <text>{{form.address ? form.address : '请选择用工地点'}}</text> |
| | | </view> |
| | | <u-icon name="arrow-right" color="#111111" size="16"></u-icon> |
| | | </view> |
| | |
| | | export default { |
| | | components: { sunuiMverify }, |
| | | computed: { |
| | | ...mapState(['navHeight', 'statusbarHeight','userInfo','token','openid']), |
| | | ...mapState(['navHeight', 'statusbarHeight','userInfo','token','openid', 'latitude', 'longitude']), |
| | | totalPrice() { |
| | | return this.form.estimatedAccount / 100 |
| | | } |
| | | }, |
| | | onShow(options) { |
| | | 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.typeViewId = 1 |
| | | } |
| | | }, |
| | | data() { |
| | |
| | | { name: '采摘工', id: 0 }, |
| | | { name: '分拣工', id: 1 }, |
| | | { name: '包装工', id: 2 } |
| | | ], |
| | | sortList: [ |
| | | { name: '最新发布', id: 0 }, |
| | | { name: '距离优先', id: 1 }, |
| | | { name: '价格从高到低', id: 2 } |
| | | ], |
| | | car: [], |
| | | btn: require('@/static/image/btn.png'), |
| | |
| | | estimatedAccount: '', |
| | | price: '' |
| | | }, |
| | | |
| | | sortType: 0, |
| | | orderList: [], |
| | | typeVal: '', |
| | | page: 1 |
| | | page: 1, |
| | | next: true, |
| | | |
| | | isOnce: true |
| | | } |
| | | }, |
| | | onLoad() { |
| | | this.getCategoryLists() |
| | | this.getOrderList() |
| | | async onLoad() { |
| | | await this.$onLaunched; |
| | | if(this.token && this.token != '' && this.userInfo && JSON.stringify(this.userInfo) != '{}') { |
| | | this.getOrderList() |
| | | this.getCategoryLists() |
| | | } |
| | | this.form.linkPhone = this.userInfo.telephone |
| | | }, |
| | | onShow(options) { |
| | | this.typeViewId = 0 |
| | | if(this.token && this.token != '' && this.userInfo && JSON.stringify(this.userInfo) != '{}') { |
| | | console.log('已登陆') |
| | | this.isLogin = true |
| | | |
| | | if (!this.isOnce && this.userInfo.useIdentity == 1) { |
| | | this.page = 1 |
| | | this.next = true |
| | | this.orderList = [] |
| | | this.getOrderList() |
| | | } |
| | | |
| | | } else { |
| | | this.isLogin = false |
| | | console.log('未登陆') |
| | | } |
| | | |
| | | if (this.userInfo && this.userInfo.useIdentity == 1) { |
| | | this.typeViewId = 1 |
| | | } |
| | | }, |
| | | watch: { |
| | | typeId: { |
| | | handler(news, old) { |
| | | this.form = { |
| | | startDate: '', |
| | | endDate: '', |
| | | latitude: '', |
| | | longitude: '', |
| | | location: '', |
| | | locationEnd: '', |
| | | wayInfoDTOList: [], |
| | | workType: 0, |
| | | categoryId: '', |
| | | categoryName: '', |
| | | days: '', |
| | | locationRemark: '', |
| | | supplement: '', |
| | | multifileList: [], |
| | | linkName: '', |
| | | linkPhone: '', |
| | | estimatedAccount: '', |
| | | price: '' |
| | | } |
| | | this.form.startDate = '' |
| | | |
| | | this.form.endDate = '' |
| | | this.form.latitude = '' |
| | | this.form.longitude = '' |
| | | this.form.location = '' |
| | | this.form.locationEnd = '' |
| | | this.form.wayInfoDTOList = [] |
| | | this.form.workType = '' |
| | | this.form.days = '' |
| | | this.form.locationRemark = '' |
| | | this.form.supplement = '' |
| | | this.form.multifileList = [] |
| | | this.form.linkName = '' |
| | | this.form.estimatedAccount = '' |
| | | this.form.price = '' |
| | | this.viewStatus = false |
| | | this.carImage = '' |
| | | this.carRemark = '' |
| | | } |
| | | }, |
| | | orderFood: { |
| | |
| | | } |
| | | } |
| | | }, |
| | | onReachBottom() { |
| | | this.getOrderList() |
| | | }, |
| | | methods: { |
| | | // 手动接单 |
| | | getaccept(e, orderId, index) { |
| | | this.$u.api.accept({ orderId }) |
| | | .then(res => { |
| | | if (res.code === 200) { |
| | | uni.showToast({ title: '抢单成功!', icon: 'success', duration: 2000 }) |
| | | setTimeout(() => { |
| | | this.page = 1 |
| | | this.next = true |
| | | this.orderList = [] |
| | | this.getOrderList() |
| | | }, 2000) |
| | | } |
| | | }) |
| | | }, |
| | | clickSort(id) { |
| | | this.sortType = id |
| | | this.page = 1 |
| | | this.next = true |
| | | this.orderList = [] |
| | | this.getOrderList() |
| | | }, |
| | | clickCate(id) { |
| | | this.typeVal = id |
| | | this.page = 1 |
| | | this.list = [] |
| | | this.next = true |
| | | this.orderList = [] |
| | | this.getOrderList() |
| | | }, |
| | | // 订单分页 |
| | | getOrderList() { |
| | | if (!this.next) return; |
| | | this.$u.api.orderPage({ |
| | | capacity: 10, |
| | | page: this.page, |
| | | model: { |
| | | queryMyOrderType: 2, |
| | | type: this.typeVal |
| | | type: this.typeVal, |
| | | sortType: this.sortType, |
| | | queryLat: this.latitude, |
| | | queryLgt: this.longitude |
| | | } |
| | | }).then(res => { |
| | | if (res.code !== 200) return; |
| | | this.isOnce = false |
| | | res.data.records.forEach(item => { |
| | | // 订餐单 |
| | | if (item.type === 2) { |
| | | item.wayInfoCopy = JSON.parse(item.wayInfo).map(item => { |
| | | return `${item.name}${item.price / 100}元(${item.num}份)` |
| | | }).join(' | ') |
| | | // 运货 |
| | | } else if (item.type === 1) { |
| | | item.wayInfo = JSON.parse(item.wayInfo) |
| | | } |
| | | }) |
| | | console.log(res.data.records) |
| | | this.orderList = [...this.orderList, ...res.data.records] |
| | | |
| | | if (this.orderList.length === res.data.total) { |
| | | this.next = false |
| | | } else { |
| | | this.page += 1 |
| | | } |
| | | }) |
| | | }, |
| | | // 提交订单 |
| | |
| | | priceNum1: that.form.days, |
| | | type: 2 |
| | | }).then(res => { |
| | | that.form.estimatedAccount = res.data |
| | | if (res.code === 200) { |
| | | that.form.estimatedAccount = res.data |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | |
| | | }, |
| | | clickType(e) { |
| | | this.typeId = e |
| | | if (e === 2) { |
| | | this.form.categoryId = this.car[0].id |
| | | this.form.categoryName = this.car[0].name |
| | | this.carRemark = this.car[0].remark |
| | | this.carImage = this.car[0].iconFull |
| | | } |
| | | }, |
| | | clickTypeWork(e) { |
| | | this.form.workType = e |
| | |
| | | // 采摘工 |
| | | if (this.form.workType === 0) { |
| | | uni.navigateTo({ |
| | | url: `/pages/using-workers/using-workers?days=${form.days}&startDate=${form.startDate}&endDate=${form.endDate}&latitude=${form.latitude}&longitude=${form.longitude}&address=${form.location}&workType=${form.workType}` |
| | | 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.location}&workType=${form.workType}` |
| | | 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.location}&workType=${form.workType}` |
| | | 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}` |
| | | }) |
| | | } |
| | | // 运货 |
| | |
| | | }) |
| | | } |
| | | }, |
| | | mverify(e, id){ |
| | | console.log('验证结果:', e, id); |
| | | }, |
| | | // 选择套餐 |
| | | selectMenu(a, b) { |
| | | this.orderFood.forEach((item, index) => { |
| | |
| | | getCategoryLists() { |
| | | this.$u.api.getCategoryList({ type: 1 }) |
| | | .then(res => { |
| | | this.car = res.data |
| | | this.form.categoryId = res.data[0].id |
| | | this.form.categoryName = res.data[0].name |
| | | this.carRemark = res.data[0].remark |
| | | this.carImage = res.data[0].iconFull |
| | | if (res.code === 200) { |
| | | this.car = res.data |
| | | this.form.categoryId = res.data[0].id |
| | | this.form.categoryName = res.data[0].name |
| | | this.carRemark = res.data[0].remark |
| | | this.carImage = res.data[0].iconFull |
| | | } |
| | | }) |
| | | this.$u.api.getCategoryList({ type: 2 }) |
| | | .then(res => { |
| | | res.data.forEach(item => { |
| | | item.num = '' |
| | | item.list = item.detailList.map(child => { |
| | | return { |
| | | active: false, |
| | | price: child |
| | | } |
| | | if (res.code === 200) { |
| | | res.data.forEach(item => { |
| | | item.num = '' |
| | | item.list = item.detailList.map(child => { |
| | | return { |
| | | active: false, |
| | | price: child |
| | | } |
| | | }) |
| | | }) |
| | | }) |
| | | this.orderFood = res.data |
| | | this.orderFood = res.data |
| | | } |
| | | }) |
| | | } |
| | | } |