257 lines
10 KiB
Vue
257 lines
10 KiB
Vue
<template>
|
||
<view>
|
||
<!-- 顶部操作条 -->
|
||
<cu-custom :bgColor="'bg-main-color'" :isBack="true">
|
||
<block slot="backText">返回</block>
|
||
<block slot="content">任务大厅</block>
|
||
</cu-custom>
|
||
<view class="sticky-bar" :style="[{top: stickyTop + 'px'}]">
|
||
<!-- 搜索栏 -->
|
||
<view class="cu-bar search bg-white">
|
||
<view class="search-form round">
|
||
<text class="cuIcon-search"></text>
|
||
<input @confirm="searchTasks" :adjust-position="true" type="text" placeholder="输入搜索的内容"
|
||
confirm-type="search"></input>
|
||
</view>
|
||
<view class="action">
|
||
<button class="cu-btn bg-main-color shadow-blur round">搜索</button>
|
||
</view>
|
||
</view>
|
||
<!-- 条件筛选栏 -->
|
||
<scroll-view scroll-x class="bg-white nav text-center" :scroll-with-animation="true"
|
||
:scroll-left="scrollLeft">
|
||
<view class="cu-item"
|
||
v-for="(item,index) in taskConditions" v-if="item.type !== 1" :key="index" @tap="tabSelect" :data-id="index">
|
||
<!-- 区域筛选picker -->
|
||
<picker v-if="item.code === 'area'" :mode="'multiSelector'" @change="regionChange" :value="areaMultiIndex" :range-key="'name'" :range="areaList">
|
||
{{item.title}}
|
||
<text class="text-lg"><text class="cuIcon-triangledownfill"></text></text>
|
||
</picker>
|
||
<!-- 品类筛选picker -->
|
||
<picker v-else-if="item.code === 'category'" :mode="'multiSelector'" @change="categoryChange" :value="categoryMultiIndex" :range-key="'name'" :range="categoryList">
|
||
{{item.title}}
|
||
<text class="text-lg"><text class="cuIcon-triangledownfill"></text></text>
|
||
</picker>
|
||
<text v-else>
|
||
{{item.title}}
|
||
<text v-if="item.type === 0" class="text-lg"><text :class="item.value === 0 ? 'cuIcon-triangleupfill' : 'cuIcon-triangledownfill'"></text></text>
|
||
<text v-else class="text-lg"><text class="cuIcon-triangledownfill"></text></text>
|
||
</text>
|
||
</view>
|
||
<view class="cu-item" v-else>
|
||
<button class="cu-btn bg-grey round shadow-blur">{{item.title}}</button>
|
||
</view>
|
||
</scroll-view>
|
||
</view>
|
||
<!-- 任务单 -->
|
||
<view class="margin-lr-sm margin-bottom-lg">
|
||
<view v-for="(task, index) in tasks" class="padding bg-white margin-top-sm">
|
||
<view class="flex justify-between">
|
||
<view class="text-lg text-bold text-cut" style="width: 70%;">{{task.title}}</view>
|
||
<view class="text-right">
|
||
<view class="text-lg text-price text-red text-bold">{{task.price}}</view>
|
||
<view v-if="task.expeditedPrice">
|
||
<text>加急:</text><text class="text-price text-red text-bold">{{task.expeditedPrice}}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="flex justify-start">
|
||
<view v-for="(tagContent, index1) in task.tag" class='cu-tag margin-right-xs'>{{tagContent}}</view>
|
||
</view>
|
||
<view class="margin-top-sm">
|
||
<text class="text-main-color text-lg margin-right-xs"><text class="cuIcon-locationfill"></text></text>
|
||
<text>{{task.address}}</text>
|
||
</view>
|
||
<view class="margin-top-sm">
|
||
<text class="text-main-color text-lg margin-right-xs"><text class="cuIcon-timefill"></text></text>
|
||
<text>{{task.doorTime}}</text>
|
||
</view>
|
||
<view class="padding-top-sm flex justify-end">
|
||
<button class="cu-btn bg-main-color margin-right-xs shadow-blur" data-modal="showForwardModal" @click="showModal($event, index)">转发</button>
|
||
<button class="cu-btn bg-main-color margin-right-xs shadow-blur" data-modal="showAddPriceModal" @click="showModal($event, index)">加价</button>
|
||
<button class="cu-btn bg-main-color margin-right-xs shadow-blur" v-if="task.canQuote">报价</button>
|
||
<button class="cu-btn bg-main-color margin-right-xs shadow-blur" @click="showDemandDetail($event, index)">查看</button>
|
||
<button class="cu-btn bg-main-color shadow-blur" data-take-modal="showTakeSuccessModal" data-certify-modal="showTakeCertifiedModal" @click="takeTask($event, index)">接单</button>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 加价模态框 -->
|
||
<view class="cu-modal" :class="showAddPriceModal?'show':''">
|
||
<view class="cu-dialog">
|
||
<view class="cu-bar bg-white justify-end solid-bottom">
|
||
<view class="content">加价申请</view>
|
||
<view class="action" data-modal="showAddPriceModal" @tap="hideModal">
|
||
<text class="cuIcon-close text-red"></text>
|
||
</view>
|
||
</view>
|
||
<view class="padding-xl bg-white text-left">
|
||
<view class="flex justify-center align-center margin-top-sm">
|
||
<text>加价金额:</text>
|
||
<input class="radius-input" type="digit"></input>
|
||
<text>元</text>
|
||
</view>
|
||
<view class="margin-top-sm flex justify-center">
|
||
<textarea class="solid radius text-left padding-sm" maxlength="-1" name="comments" placeholder="加价原因备注"></textarea>
|
||
</view>
|
||
</view>
|
||
<view class="cu-bar bg-white solid-top">
|
||
<view class="action margin-0 flex-sub text-black" data-modal="showAddPriceModal" @tap="hideModal">取消</view>
|
||
<view class="action margin-0 flex-sub text-main-color solid-left" @tap="hideModal" data-modal="showAddPriceModal"
|
||
@click="applyAddPrice">立即提交</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<!-- 推荐奖励模态框 -->
|
||
<view class="cu-modal" :class="showForwardModal?'show':''">
|
||
<view class="cu-dialog">
|
||
<view class="cu-bar bg-white justify-end solid-bottom">
|
||
<view class="content">推荐奖励</view>
|
||
<view class="action" data-modal="showForwardModal" @tap="hideModal">
|
||
<text class="cuIcon-close text-red"></text>
|
||
</view>
|
||
</view>
|
||
<view class="padding-xl bg-white">
|
||
<view>推荐转发有奖励,按每个奖励链接计算累计200单每单一元合计200元进行持续奖励:</view>
|
||
<view class="margin-top-sm">推荐本单另行奖励的金额如下</view>
|
||
<view class="flex justify-center align-center margin-top-sm">
|
||
<text>奖励金额:</text>
|
||
<input class="radius-input" type="digit"></input>
|
||
<text>元</text>
|
||
</view>
|
||
</view>
|
||
<view class="cu-bar bg-white solid-top">
|
||
<view class="action margin-0 flex-sub text-black" data-modal="showForwardModal" @tap="hideModal">取消</view>
|
||
<view class="action margin-0 flex-sub text-main-color solid-left" data-modal="showForwardModal" @tap="hideModal"
|
||
@click="forwardTask">立即推荐</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<!-- 接单认证模态框 -->
|
||
<view class="cu-modal" :class="showTakeCertifiedModal?'show':''">
|
||
<view class="cu-dialog">
|
||
<view class="padding-xl">
|
||
<view class="cuIcon-profile big-icon padding-tb text-main-color"></view>
|
||
<view>您还未进行认证</view>
|
||
</view>
|
||
<view class="cu-bar bg-white solid-top">
|
||
<view class="action margin-0 flex-sub text-black" data-modal="showTakeCertifiedModal" @tap="hideModal">以后认证</view>
|
||
<view class="action margin-0 flex-sub text-main-color solid-left" data-modal="showTakeCertifiedModal" @tap="hideModal"
|
||
@click="goToCertify">立即认证</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<!-- 接单成功模态框 -->
|
||
<view class="cu-modal" :class="showTakeSuccessModal?'show':''">
|
||
<view class="cu-dialog">
|
||
<view class="padding-xl">
|
||
<view class="cuIcon-roundcheck big-icon padding-tb text-main-color"></view>
|
||
<view class="text-bold text-lg margin-bottom-sm">接单成功</view>
|
||
<view>请在30分钟内联系客户,预约好上门时间,并在订单中操作排单时间,超时6倍将受平台处罚管理;该订单佣金在完成任务24小时内计入您的账户</view>
|
||
</view>
|
||
<view class="cu-bar bg-white solid-top">
|
||
<view class="action margin-0 flex-sub text-black" data-modal="showTakeSuccessModal" @click="contactCustomer">联系客户</view>
|
||
<view class="action margin-0 flex-sub text-main-color solid-left" data-modal="showTakeSuccessModal" @tap="hideModal">继续接单</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
export default {
|
||
data() {
|
||
return {
|
||
tabCur: 0,
|
||
scrollLeft: 0,
|
||
stickyTop: this.CustomBar,
|
||
taskConditions: [],
|
||
tasks: [],
|
||
curTask: null,
|
||
takeCertify: false,
|
||
showAddPriceModal: false,
|
||
showForwardModal: false,
|
||
showTakeCertifiedModal: false,
|
||
showTakeSuccessModal: false,
|
||
areaList: [],
|
||
areaMultiIndex: [0, 0, 0],
|
||
categoryList: [],
|
||
categoryMultiIndex: [0, 0, 0]
|
||
}
|
||
},
|
||
onLoad() {
|
||
this.loadData();
|
||
},
|
||
methods: {
|
||
async loadData() {
|
||
this.taskConditions = await this.$api.data('taskConditions');
|
||
this.tasks = await this.$api.data('tasks');
|
||
this.takeCertify = await this.$api.data('takeCertify');
|
||
this.areaList = await this.$api.data('areaList');
|
||
this.categoryList = await this.$api.data('categoryList');
|
||
},
|
||
tabSelect(e) {
|
||
this.tabCur = e.currentTarget.dataset.id;
|
||
this.scrollLeft = (e.currentTarget.dataset.id - 1) * 70;
|
||
let conditionType = this.taskConditions[this.tabCur].type;
|
||
let conditionCode = this.taskConditions[this.tabCur].code;
|
||
if (conditionType === 0) {
|
||
// 升降序类型的条件切换升降序
|
||
let orderVal = this.taskConditions[this.tabCur].value;
|
||
this.taskConditions[this.tabCur].value = orderVal === 0 ? 1 : 0;
|
||
}
|
||
},
|
||
regionChange(e) {
|
||
this.areaMultiIndex = e.detail.value;
|
||
let chosenArea = [];
|
||
for(let i = 0; i < this.areaList.length; i++) {
|
||
chosenArea.push(this.areaList[i][this.areaMultiIndex[i]]);
|
||
}
|
||
this.taskConditions[this.tabCur].value = chosenArea;
|
||
},
|
||
categoryChange(e) {
|
||
this.categoryMultiIndex = e.detail.value;
|
||
let chosenCategory = [];
|
||
for(let i = 0; i < this.categoryList.length; i++) {
|
||
chosenCategory.push(this.categoryList[i][this.categoryMultiIndex[i]]);
|
||
}
|
||
this.taskConditions[this.tabCur].value = chosenCategory;
|
||
},
|
||
showDemandDetail(e, taskIndex) {
|
||
let paramObj = {
|
||
orderId: this.tasks[taskIndex].id
|
||
}
|
||
uni.navigateTo({
|
||
url: '/pages/demand-center/demand-detail?paramObj=' + encodeURIComponent(JSON.stringify(paramObj))
|
||
})
|
||
},
|
||
takeTask(e, taskIndex) {
|
||
if (this.takeCertify) {
|
||
// 已认证可直接接单
|
||
e.currentTarget.dataset.modal = e.currentTarget.dataset.takeModal;
|
||
this.showModal(e, taskIndex);
|
||
} else {
|
||
// 未认证需提示前往认证
|
||
e.currentTarget.dataset.modal = e.currentTarget.dataset.certifyModal;
|
||
this.showModal(e, taskIndex);
|
||
}
|
||
},
|
||
contactCustomer() {
|
||
// 跳转到未约未排
|
||
},
|
||
showModal(e, taskIndex) {
|
||
this.curTask = this.tasks[taskIndex];
|
||
this[e.currentTarget.dataset.modal] = true;
|
||
},
|
||
hideModal(e) {
|
||
this.curTask = null;
|
||
this[e.currentTarget.dataset.modal] = false;
|
||
}
|
||
},
|
||
}
|
||
</script>
|
||
|
||
<style scoped>
|
||
|
||
</style>
|