OfficeApp/subpkg/townTask/townTask.vue

194 lines
4.9 KiB
Vue
Raw Normal View History

2023-09-23 11:37:52 +08:00
<template>
<view class="task_page">
2023-09-23 17:07:45 +08:00
<u-skeleton v-if="skeleton" :class="{'loading': skeleton}" :animate="true" title rows="3" rows-width="92%"
rowsHeight="56">
</u-skeleton>
<block v-else>
<view class="card">
<view class="c_title">{{`任务名称: ${taskInfo.title||''}`}}</view>
<view>{{taskInfo.content||''}}</view>
</view>
2023-10-30 18:49:50 +08:00
<view class="card" v-if="extend_info&&extend_info.target">
<view class="c_title">目标数量: {{extend_info.target}}</view>
</view>
<view class="card" v-if="extend_info&&extend_info.store_name">
<view class="c_title">指定商品: </view>
<view class="store">
<view class="store_name" v-for="(item, index) in extend_info.store_name" :key="index" @click="copyName(item)">
{{item}}
</view>
</view>
</view>
2023-09-23 17:07:45 +08:00
<view class="card">
<view class="c_title">判定条件:</view>
<view style="white-space: pre-line;">{{remark}}</view>
</view>
</block>
2023-09-23 11:37:52 +08:00
</view>
</template>
<script>
import { Toast } from "../../libs/uniApi";
2023-10-19 11:42:49 +08:00
import { townTaskDetails } from "@/api/task.js"
2023-09-23 16:21:09 +08:00
import { dictDataListsTypeValue } from "@/api/oaPbulic.js"
2023-09-23 11:37:52 +08:00
export default {
data() {
return {
taskInfo:{
id: '',
title: '',
content: '',
extend: {}
},
2023-10-30 18:49:50 +08:00
extend_info: null,
2023-09-23 17:07:45 +08:00
remark: '',
2023-10-19 11:42:49 +08:00
skeleton: true,
type_value: 'town_task_type', // 任务类型
2023-09-23 11:37:52 +08:00
}
},
onLoad(options) {
2023-09-23 16:21:09 +08:00
options.task_id?this.taskInfo.id=options.task_id:null;
2023-10-19 11:42:49 +08:00
options.type_value?this.type_value=options.type_value:null;
2023-09-23 11:37:52 +08:00
this.initTask();
},
onShow() {},
methods: {
async initTask(){
2023-09-23 17:07:45 +08:00
this.skeleton = true;
2023-10-19 11:42:49 +08:00
let res = await townTaskDetails({
2023-09-23 11:37:52 +08:00
id: this.taskInfo.id
});
2023-10-30 18:49:50 +08:00
if(res.data?.template_info?.extend){
if(res.data?.template_info?.extend?.goods_id && typeof res.data?.template_info?.extend?.goods_id!=='object'){
res.data.template_info.extend.goods_id = res.data?.template_info?.extend?.goods_id.split(',');
res.data.template_info.extend.store_name = res.data?.template_info?.extend?.store_name.split(';')||[];
}
this.extend_info = res.data?.template_info?.extend;
}
2023-09-23 11:37:52 +08:00
this.taskInfo = res.data;
2023-09-23 16:21:09 +08:00
let dict = await dictDataListsTypeValue({
2023-10-19 11:42:49 +08:00
type_value: this.type_value
2023-09-23 16:21:09 +08:00
})
2023-09-23 16:30:08 +08:00
dict.data.forEach((item)=>{
2023-09-23 16:27:00 +08:00
if(item.id==this.taskInfo.type){
this.remark = item.remark;
}
})
2023-09-23 17:07:45 +08:00
this.skeleton = false;
2023-09-23 11:37:52 +08:00
},
2023-10-30 18:49:50 +08:00
copyName(str = "", type = "商品名称") {
if (str) uni.setClipboardData({
data: str + "",
success: (e) => {
Toast(type + '已复制')
},
fail: (e) => {
Toast('复制失败')
}
})
}
2023-09-23 11:37:52 +08:00
},
}
</script>
<style lang="scss">
.task_page {
padding-top: 30rpx;
.card {
margin: 0 auto;
margin-bottom: 28rpx;
width: 694rpx;
background-color: #fff;
border-radius: 26rpx;
padding: 28rpx;
.c_title {
font-size: 32rpx;
font-weight: bold;
color: #333333;
margin-bottom: 20rpx;
}
.file {
display: flex;
justify-content: left;
flex-wrap: wrap;
&_item {
flex-shrink: 0;
width: 200rpx;
height: 200rpx;
margin: 0 auto;
margin-bottom: 16rpx;
border: 2px solid #ccc;
border-radius: 10rpx;
overflow: hidden;
position: relative;
.image {
width: 100%;
height: 100%;
}
.del {
position: absolute;
height: 40rpx;
width: 40rpx;
top: 10rpx;
right: 10rpx;
}
}
&_btn {
flex-shrink: 0;
width: 200rpx;
height: 200rpx;
margin: 0 auto;
margin-bottom: 16rpx;
border: 2px solid #ccc;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
border-radius: 10rpx;
image {
width: 100rpx;
height: 100rpx;
}
}
&_empty {
flex-shrink: 0;
width: 200rpx;
height: 200rpx;
margin: 0 auto;
margin-bottom: 16rpx;
border: 2px solid transparent;
}
}
2023-10-30 18:49:50 +08:00
.store{
display: flex;
flex-wrap: wrap;
font-size: 26rpx;
color: #0122c7;
margin-top: -10rpx;
&_name{
flex-shrink: 0;
padding: 8rpx;
border: 5rpx solid #0122c7;
border-radius: 10rpx;
background-color: rgba(#0122c7, 0.1);
margin-right: 10rpx;
margin-top: 10rpx;
}
}
2023-09-23 11:37:52 +08:00
}
2023-09-23 17:07:45 +08:00
.loading{
padding: 28rpx;
}
2023-09-23 11:37:52 +08:00
}
</style>