| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387 |
- <template>
- <view class="container">
- <Watermark />
- <Step :step="currentStep" :stepsData="currentText" />
- <scroll-view class="content" scroll-y>
- <!-- 任务信息 -->
- <view class="task-info-section">
- <view class="section-title">任务信息</view>
- <view class="info-item">
- <view class="info-label">任务名称:</view>
- <view class="info-value">{{ taskInfo.taskName || '-' }}</view>
- </view>
- <view class="info-item">
- <view class="info-label">任务类型:</view>
- <view class="info-value">{{ taskInfo.taskType || '-' }}</view>
- </view>
- <view class="info-item">
- <view class="info-label">任务描述:</view>
- <view class="info-value">{{ taskInfo.taskDesc || '-' }}</view>
- </view>
- </view>
- <!-- 完成情况 -->
- <view class="complete-section">
- <view class="section-title">完成情况</view>
- <view class="complete-item">
- <view class="complete-label">已完成客户:</view>
- <view class="complete-value">{{ completedCustomers.length }} / {{ totalCustomers }}</view>
- </view>
- <view class="progress-bar">
- <view class="progress-fill" :style="{ width: progressPercentage + '%' }"></view>
- </view>
- </view>
- <!-- 客户列表 -->
- <view class="customer-list">
- <view class="customer-item" v-for="(customer, index) in customerList" :key="customer.id">
- <view class="left">
- <image class="head" src="https://ysrw-1395926010.cos.ap-chengdu.myqcloud.com/image/my_heads_icon.png"></image>
- <view class="customer-info">
- <view class="customer-header">
- <view class="customer-name">{{ customer.doctorName ||'-'}}</view>
- <view class="customer-status" :class="customer.status === 'completed' ? 'completed' : 'pending'">
- {{ customer.status === 'completed' ? '已完成' : '待完成' }}
- </view>
- </view>
- <view class="customer-details">
- <view class="customer-hospital">{{ customer.cityName||'-' }}</view>
- <view class="customer-department">{{ customer.department ||'-'}}</view>
- </view>
- </view>
- </view>
- <view class="action-btn" v-if="customer.status === 'pending'" @click="completeCustomer(customer)">
- 完成
- </view>
- </view>
- </view>
- </scroll-view>
- <!-- 底部操作栏 -->
- <view class="bottom-bar">
- <view class="action-buttons">
- <view class="btn btn-cancel" @click="handlePrev">上一步</view>
- <view class="btn btn-submit" @click="handleNext" :disabled="completedCustomers.length === 0">提交</view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import Step from '@/pages_task/components/step.vue'
- export default {
- components: {
- Step
- },
- data() {
- return {
- currentText: [{
- id: 1,
- stepNumber: 1,
- title: '任务详情'
- },
- {
- id: 2,
- stepNumber: 2,
- title: '完成任务'
- },
- {
- id: 3,
- stepNumber: 3,
- title: '提交成功'
- }
- ],
- currentStep: 2,
- taskInfo: {},
- customerList: [],
- completedCustomers: []
- }
- },
- onLoad() {
- this.loadTaskData()
- this.loadCustomerData()
- },
- computed: {
- totalCustomers() {
- return this.customerList.length
- },
- progressPercentage() {
- if (this.totalCustomers === 0) return 0
- return Math.round((this.completedCustomers.length / this.totalCustomers) * 100)
- }
- },
- methods: {
- loadTaskData() {
- // 从本地存储获取任务信息
- const taskInfo = uni.getStorageSync('taskInfo')
- if (taskInfo) {
- this.taskInfo = JSON.parse(taskInfo)
- }
- },
- loadCustomerData() {
- // 从本地存储获取客户列表
- const selectedCustomers = uni.getStorageSync('selectedCustomers')
- if (selectedCustomers) {
- this.customerList = JSON.parse(selectedCustomers).map(customer => ({
- ...customer,
- status: 'pending'
- }))
- }
- },
- completeCustomer(customer) {
- // 标记客户为已完成
- const index = this.customerList.findIndex(item => item.id === customer.id)
- if (index > -1) {
- this.customerList[index].status = 'completed'
- // 更新已完成客户列表
- this.completedCustomers = this.customerList.filter(item => item.status === 'completed')
- }
- },
- handlePrev() {
- uni.navigateBack()
- },
- handleNext() {
- if (this.completedCustomers.length === 0) {
- uni.showToast({
- icon: 'none',
- title: '请至少完成一个客户的任务'
- })
- return
- }
- // 保存完成情况到本地存储
- uni.setStorageSync('completedCustomers', JSON.stringify(this.completedCustomers))
- // 跳转到提交成功页面
- uni.navigateTo({
- url: '/pages_task/taskCompleteSuccess'
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .container {
- min-height: 100vh;
- background: #F7F8FA;
- display: flex;
- flex-direction: column;
- &::before {
- content: '';
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- width: 100%;
- height: 544rpx;
- background: linear-gradient(180deg, #E4EFFE 0%, rgba(228, 239, 254, 0) 100%);
- }
- }
- .content {
- flex: 1;
- padding: 24rpx;
- box-sizing: border-box;
- padding-bottom: 200rpx;
- }
- .task-info-section,
- .complete-section {
- background-color: #ffffff;
- border-radius: 24rpx 24rpx 24rpx 24rpx;
- padding: 24rpx;
- margin-bottom: 24rpx;
- .section-title {
- font-size: 32rpx;
- font-weight: 500;
- color: #333333;
- margin-bottom: 24rpx;
- }
- .info-item {
- display: flex;
- margin-bottom: 16rpx;
- .info-label {
- font-size: 28rpx;
- color: #666666;
- width: 120rpx;
- }
- .info-value {
- font-size: 28rpx;
- color: #333333;
- flex: 1;
- }
- }
- .complete-item {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 24rpx;
- .complete-label {
- font-size: 28rpx;
- color: #666666;
- }
- .complete-value {
- font-size: 28rpx;
- font-weight: 500;
- color: #388BFF;
- }
- }
- .progress-bar {
- width: 100%;
- height: 12rpx;
- background-color: #F2F3F5;
- border-radius: 6rpx;
- overflow: hidden;
- .progress-fill {
- height: 100%;
- background-color: #388BFF;
- transition: width 0.3s ease;
- }
- }
- }
- .customer-list {
- .customer-item {
- border-radius: 24rpx 24rpx 24rpx 24rpx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 32rpx;
- margin-bottom: 12rpx;
- background-color: #ffffff;
- &:last-child {
- margin-bottom: 0;
- }
- .left {
- display: flex;
- align-items: center;
- flex: 1;
- .head {
- width: 88rpx;
- height: 88rpx;
- border-radius: 50%;
- margin-right: 24rpx;
- }
- .customer-info {
- flex: 1;
- .customer-header {
- display: flex;
- align-items: center;
- margin-bottom: 12rpx;
- .customer-name {
- font-weight: 500;
- font-size: 32rpx;
- color: #333333;
- margin-right: 16rpx;
- }
- .customer-status {
- font-size: 24rpx;
- border-radius: 8rpx;
- padding: 4rpx 12rpx;
- &.completed {
- background: #E6F7EF;
- color: #00B42A;
- }
- &.pending {
- background: #FFF6E5;
- color: #C89743;
- }
- }
- }
- .customer-details {
- display: flex;
- align-items: center;
- .customer-hospital {
- font-size: 28rpx;
- color: #666;
- margin-right: 24rpx;
- border-right: 2rpx solid #EAEBEE;
- padding-right: 24rpx;
- }
- .customer-department {
- font-size: 28rpx;
- color: #666;
- }
- }
- }
- }
- .action-btn {
- background-color: #388BFF;
- color: #ffffff;
- padding: 12rpx 24rpx;
- border-radius: 100rpx;
- font-size: 28rpx;
- cursor: pointer;
- }
- }
- }
- .bottom-bar {
- position: fixed;
- bottom: 0;
- left: 0;
- right: 0;
- background: #fff;
- padding: 24rpx 32rpx;
- border-top: 1rpx solid #F2F3F5;
- z-index: 100;
- .action-buttons {
- display: flex;
- justify-content: space-between;
- .btn {
- width: 292rpx;
- height: 88rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 32rpx;
- font-weight: 500;
- border-radius: 200rpx 200rpx 200rpx 200rpx;
- cursor: pointer;
- &.btn-cancel {
- background: #fff;
- border: 2rpx solid #388BFF;
- color: #388BFF;
- }
- &.btn-submit {
- background: #388BFF;
- color: #fff;
- &:disabled {
- background: #C8C9CC;
- cursor: not-allowed;
- }
- }
- }
- }
- }
- </style>
|