feat: 首页联调
This commit is contained in:
parent
ac125a8d3c
commit
09f985c8f6
|
|
@ -31,6 +31,12 @@ class Api {
|
|||
let url = `${config.host}/worker/worker/show`;
|
||||
return fetch.request('postFrom', url, {}, true)
|
||||
}
|
||||
|
||||
// 接单列表
|
||||
static orderDispatchList(data) {
|
||||
let url = `${config.host}/worker/order_dispatch/index`;
|
||||
return fetch.request('GET', url, data, true)
|
||||
}
|
||||
}
|
||||
|
||||
export default Api
|
||||
|
|
|
|||
|
|
@ -6,22 +6,23 @@
|
|||
|
||||
<me-empty-space :height="listMarginTop"></me-empty-space>
|
||||
<view class="list">
|
||||
<view class="order-item">
|
||||
<view class="order-item" v-for="(item, index) in data.list" :key="index">
|
||||
<view class="top flex-sb">
|
||||
<view class="type flex-l">日常保洁</view>
|
||||
<view class="price flex-r">平台已收款</view>
|
||||
<view class="type flex-l">{{item.order_info.item_title}}</view>
|
||||
<view class="price flex-r important-color" v-if="item.order_info.receive_type === 1">上门报价</view>
|
||||
<view class="price flex-r" v-else>平台已收款</view>
|
||||
</view>
|
||||
<view class="content flex-sb">
|
||||
<view class="left" @click="toDetail(1)">
|
||||
<view class="left" @click="toDetail(item.id)">
|
||||
<view class="address-name flex-l">
|
||||
金城花园(天府二街)
|
||||
{{item.order_info.address}}
|
||||
</view>
|
||||
<view class="address">
|
||||
广东省茂名市茂南区金城路26号大院附近
|
||||
<view class="address flex-l">
|
||||
安徽省蚌埠市禹会区
|
||||
</view>
|
||||
<view class="time-ctr flex-l">
|
||||
<view class="time-ctr flex-l" v-if="item.order_info.plan_time !== null">
|
||||
<me-icon type="icon-time" color="var(--themeColor)" size="40rpx"></me-icon>
|
||||
<text class="time">周日 10月08日 12:30</text>
|
||||
<text class="time">{{helpers.formatDate(item.order_info.plan_time)}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
|
|
@ -35,7 +36,6 @@
|
|||
<me-button @click="" text="确认接单" width="460rpx" icon-type="icon-flashlight"></me-button>
|
||||
<me-button @click="" active-color="var(--contentBgColor)" text="拒 绝" width="166rpx" text-color="var(--titleColor)"></me-button>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="order-item">
|
||||
<view class="top flex-sb">
|
||||
|
|
@ -45,10 +45,10 @@
|
|||
<view class="content flex-sb">
|
||||
<view class="left">
|
||||
<view class="address-name flex-l">
|
||||
金城花园(天府二街)
|
||||
金城花园(天府二街)336号
|
||||
</view>
|
||||
<view class="address">
|
||||
广东省茂名市茂南区金城路26号大院附近
|
||||
<view class="address flex-l">
|
||||
四川省成都市武侯区
|
||||
</view>
|
||||
<view class="time-ctr flex-l">
|
||||
<me-icon type="icon-time" color="var(--themeColor)" size="40rpx"></me-icon>
|
||||
|
|
@ -113,6 +113,7 @@ import MeButton from "../../components/me-button/me-button";
|
|||
import MeEmptySpace from "../../components/me-empty-space/me-empty-space.vue";
|
||||
import MeTop from "../../components/me-top/me-top.vue";
|
||||
import helpers from "../../utils/helpers";
|
||||
import api from "../../api/api";
|
||||
|
||||
const listMarginTop = computed(() => {
|
||||
return (inject('globalData').statusBarH + (inject('globalData').customBarH - inject('globalData').statusBarH)) * 2
|
||||
|
|
@ -123,9 +124,34 @@ const toDetail = (id) => {
|
|||
}
|
||||
|
||||
onLoad(() => {
|
||||
|
||||
getList()
|
||||
})
|
||||
|
||||
const data = reactive({
|
||||
page: 1,
|
||||
page_size: 10,
|
||||
last_page: 0,
|
||||
refresherTriggered: false,
|
||||
list: []
|
||||
})
|
||||
const getList = () => {
|
||||
api.orderDispatchList({page: data.page, page_size: data.page_size}).then(res => {
|
||||
data.last_page = res.last_page
|
||||
if (data.page === 1) {
|
||||
data.list = res.data;
|
||||
data.refresherTriggered = false;
|
||||
} else {
|
||||
data.list = data.list.concat(helpers.deepObj(res.data))
|
||||
}
|
||||
// data.isShowSkeleton = false
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
const refresh = () => {
|
||||
data.refresherTriggered = true
|
||||
data.page = 1
|
||||
getList()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
|||
|
|
@ -68,5 +68,20 @@ class helpers {
|
|||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
static formatDate(dateString) {
|
||||
const date = new Date(dateString);
|
||||
|
||||
const weekdays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
|
||||
const weekDay = weekdays[date.getDay()];
|
||||
|
||||
const year = date.getFullYear().toString().slice(2); // 获取两位数年份
|
||||
const month = date.getMonth() + 1;
|
||||
const day = date.getDate();
|
||||
const hours = date.getHours().toString().padStart(2, '0');
|
||||
const minutes = date.getMinutes().toString().padStart(2, '0');
|
||||
|
||||
return `${weekDay} ${year}年${month}月${day}日 ${hours}:${minutes}`;
|
||||
}
|
||||
}
|
||||
export default helpers
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user