123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650 |
- <template>
- <view>
- <!-- 胶囊 -->
- <mvBar :mysNavConfig="mysNavConfig"></mvBar>
- <view :style="{marginTop:navH}"></view>
- <view class="menu">
- <view class="menu-item" @click="handleClickTab(0)">
- <p v-bind:class="showList[0]?'lor':'unlor'">全部</p>
- </view>
- <view class="menu-item" @click="handleClickTab(1)">
- <p v-bind:class="showList[1]?'lor':'unlor'">已领样</p>
- </view>
- <view class="menu-item" @click="handleClickTab(2)">
- <p v-bind:class="showList[2]?'lor':'unlor'">已出单</p>
- </view>
- <view class="menu-item" @click="handleClickTab(3)">
- <p v-bind:class="showList[3]?'lor':'unlor'">已结束</p>
- </view>
- </view>
- <view class="home" v-if="showList[0] && !loading">
- <view class="task" v-for="item in secTaskLists[0]" @click="handleToSecTaskDetail(item)">
- <view class="task-card">
- <view class="task-info">
- <!-- 左侧图片和文字 -->
- <view class="task-info-left">
- <!-- 图片 -->
- <image class="project-img" :src="item.product_img_url"></image>
- <image v-if="item.isFinished" class="overlay-img" src="https://horastar.obs.cn-east-3.myhuaweicloud.com/talent/home4.png"></image>
- <!-- 描述 -->
- <view class="task-info-txt">
- <view class="Tasktext">
- <image class="platform-img" :src="item.PlatformInfo.platform_icon"></image>
- <span>
- {{item.SelectionInfo.selection_name}}
- </span>
- </view>
- <p style="color: #ffcb41 ;">任务截至时间:{{item.ddl}}</p>
- <p>售价:¥{{item.price}} 佣金率:{{item.exclusive_commission}}%</p>
- <!-- sectask表有已经有 -->
- <p>全部销售量/有效销售量:{{item.sale_num_all}}单/{{item.sale_actual}}单</p>
- <p v-if="item.task_mode==1">悬赏金额/悬赏有效销售量:
- ¥{{item.RewardStrategy[0].per_reward}}/{{item.RewardStrategy[0].sale_actual}}单</p>
- <p v-if="item.sample_mode==1">免费领样状态:{{ getFreeStageText(item.free_stage) }}</p>
- </view>
- </view>
- <!-- 右侧图标 -->
- <view class="task-info-right">
- <image
- src="https://horastar.obs.cn-east-3.myhuaweicloud.com/talent_upload/icon-arrow-right.png"
- style="height: 30rpx;width: 30rpx;"></image>
- </view>
- </view>
- <!-- <view style="text-align: right;" v-if="item.task_stage > 5">
- <p style="font-size: 25rpx;">实际收益:¥{{item.show_real_reward}}</p>
- </view> -->
- <view class="container">
- <p class="left-text" v-if="item.reward_stage==1"><span style="color: green;">待领悬赏</span></p>
- <p class="right-text" v-if="item.reward_stage==2">实际收益:<span
- style="color: red;">¥{{item.RewardStrategy[0].per_reward}}</span></p>
- </view>
- </view>
- </view>
- </view>
- <view class="home" v-if="showList[1] && !loading">
- <view class="task" v-for="item in secTaskLists[1]" @click="handleToSecTaskDetail(item)">
- <view class="task-card">
- <view class="task-info">
- <!-- 左侧图片和文字 -->
- <view class="task-info-left">
- <!-- 图片 -->
- <image class="project-img" :src="item.product_img_url"></image>
- <image v-if="item.isFinished" class="overlay-img" src="https://horastar.obs.cn-east-3.myhuaweicloud.com/talent/home4.png"></image>
- <!-- 描述 -->
- <view class="task-info-txt">
- <!-- <view class="" style="display: flex;">
- <image class="platform-img" :src="item.platform_icon_url"></image>
- <p style="font-size: 28rpx; line-height: 28rpx;color: black;">
- {{item.selection_name}}
- </p>
- </view> -->
- <view class="Tasktext">
- <image class="platform-img" :src="item.PlatformInfo.platform_icon"></image>
- <span>
- {{item.SelectionInfo.selection_name}}
- </span>
- </view>
- <p style="color: #ffcb41 ;">任务截至时间:{{item.ddl}}</p>
- <p>售价:¥{{item.price}} 佣金率:{{item.exclusive_commission}}%</p>
- <!-- sectask表有已经有 -->
- <p>全部销售量/有效销售量:{{item.sale_num_all}}单/{{item.sale_actual}}单</p>
- <p v-if="item.task_mode==1">悬赏金额/悬赏有效销售量:
- ¥{{item.RewardStrategy[0].per_reward}}/{{item.RewardStrategy[0].sale_actual}}单</p>
- <p v-if="item.sample_mode==1">免费领样状态:{{ getFreeStageText(item.free_stage) }}</p>
- </view>
- </view>
- <!-- 右侧图标 -->
- <view class="task-info-right">
- <image
- src="https://horastar.obs.cn-east-3.myhuaweicloud.com/talent_upload/icon-arrow-right.png"
- style="height: 30rpx;width: 30rpx;"></image>
- </view>
- </view>
- <view class="container">
- <p class="left-text" v-if="item.reward_stage==1"><span style="color: green;">待领悬赏</span></p>
- <p class="right-text" v-if="item.reward_stage==2">实际收益:<span
- style="color: red;">¥{{item.RewardStrategy[0].per_reward}}</span></p>
- </view>
- </view>
- </view>
- </view>
- <view class="home" v-if="showList[2] && !loading">
- <view class="task" v-for="item in secTaskLists[2]" @click="handleToSecTaskDetail(item)">
- <view class="task-card">
- <view class="task-info">
- <!-- 左侧图片和文字 -->
- <view class="task-info-left">
- <!-- 图片 -->
- <image class="project-img" :src="item.product_img_url"></image>
- <image v-if="item.isFinished" class="overlay-img" src="https://horastar.obs.cn-east-3.myhuaweicloud.com/talent/home4.png"></image>
- <!-- 描述 -->
- <view class="task-info-txt">
- <!-- <view class="" style="display: flex;">
- <image class="platform-img" :src="item.platform_icon_url"></image>
- <p style="font-size: 28rpx; line-height: 28rpx;color: black;">
- {{item.selection_name}}
- </p>
- </view> -->
- <view class="Tasktext">
- <image class="platform-img" :src="item.PlatformInfo.platform_icon"></image>
- <span>
- {{item.SelectionInfo.selection_name}}
- </span>
- </view>
- <p style="color: #ffcb41 ;">任务截至时间:{{item.ddl}}</p>
- <p>售价:¥{{item.price}} 佣金率:{{item.exclusive_commission}}%</p>
- <!-- sectask表有已经有 -->
- <p>全部销售量/有效销售量:{{item.sale_num_all}}单/{{item.sale_actual}}单</p>
- <p v-if="item.task_mode==1">悬赏金额/悬赏有效销售量:
- ¥{{item.RewardStrategy[0].per_reward}}/{{item.RewardStrategy[0].sale_actual}}单</p>
- <p v-if="item.sample_mode==1">免费领样状态:{{ getFreeStageText(item.free_stage) }}</p>
- </view>
- </view>
- <!-- 右侧图标 -->
- <view class="task-info-right">
- <image
- src="https://horastar.obs.cn-east-3.myhuaweicloud.com/talent_upload/icon-arrow-right.png"
- style="height: 30rpx;width: 30rpx;"></image>
- </view>
- </view>
- <view class="container">
- <p class="left-text" v-if="item.reward_stage==1"><span style="color: green;">待领悬赏</span></p>
- <p class="right-text" v-if="item.reward_stage==2">实际收益:<span
- style="color: red;">¥{{item.RewardStrategy[0].per_reward}}</span></p>
- </view>
- </view>
- </view>
- </view>
- <view class="home" v-if="showList[3] && !loading">
- <view class="task" v-for="item in secTaskLists[3]" @click="handleToSecTaskDetail(item)">
- <view class="task-card">
- <view class="task-info">
- <!-- 左侧图片和文字 -->
- <view class="task-info-left">
- <!-- 图片 -->
- <image class="project-img" :src="item.product_img_url"></image>
- <image v-if="item.isFinished" class="overlay-img" src="https://horastar.obs.cn-east-3.myhuaweicloud.com/talent/home4.png"></image>
- <!-- 描述 -->
- <view class="task-info-txt">
- <!-- <view class="" style="display: flex;">
- <image class="platform-img" :src="item.platform_icon_url"></image>
- <p style="font-size: 28rpx; line-height: 28rpx;color: black;">
- {{item.selection_name}}
- </p>
- </view> -->
- <view class="Tasktext">
- <image class="platform-img" :src="item.PlatformInfo.platform_icon"></image>
- <span>
- {{item.SelectionInfo.selection_name}}
- </span>
- </view>
- <p style="color: #ffcb41 ;">任务截至时间:{{item.ddl}}</p>
- <p>售价:¥{{item.price}} 佣金率:{{item.exclusive_commission}}%</p>
- <!-- sectask表有已经有 -->
- <p>全部销售量/有效销售量:{{item.sale_num_all}}单/{{item.sale_actual}}单</p>
- <p v-if="item.task_mode==1">悬赏金额/悬赏有效销售量:
- ¥{{item.RewardStrategy[0].per_reward}}/{{item.RewardStrategy[0].sale_actual}}单</p>
- <p v-if="item.sample_mode==1">免费领样状态:{{ getFreeStageText(item.free_stage) }}</p>
- </view>
- </view>
- <!-- 右侧图标 -->
- <view class="task-info-right">
- <image
- src="https://horastar.obs.cn-east-3.myhuaweicloud.com/talent_upload/icon-arrow-right.png"
- style="height: 30rpx;width: 30rpx;"></image>
- </view>
- </view>
- <view class="container">
- <p class="left-text" v-if="item.reward_stage==1"><span style="color: green;">待领悬赏</span></p>
- <p class="right-text" v-if="item.reward_stage==2">实际收益:<span
- style="color: red;">¥{{item.RewardStrategy[0].per_reward}}</span></p>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import mvBar from "@/components/mys_navBar/mysNavBar";
- import {
- fansview,
- money,
- getDaysAndHoursBetweenDates,
- } from '@/components/utils.js';
- export default {
- components: {
- mvBar,
- },
- data() {
- return {
- navH: getApp().globalData.navHeight,
- mysNavConfig: {
- /* 开启单页显示首页图标 */
- isHome: true,
- /* 固定导航 */
- navFixed: true,
- /* 标题 (屏幕中心居中 两边图标中心居中使用slot center1) */
- navTitle: {
- text: "我的带货任务",
- color: "",
- fontSize: "32rpx", // px upx rpx
- fontWeight: "normal", // 100 - 700
- },
- btnType: "type2",
- onLeftClick: "/pages/mycenter/mycenter",
- /* type2 按钮 */
- type2Config: {
- // 左图标
- leftPath: "/static/img/png2.png",
- // 右图标
- rightPath: "/static/img/png4.png",
- // 圆角
- radius: "40rpx",
- },
- },
- loading: false,
- showList: [true, false, false, false],
- secTaskStageList: [],
- secTaskLists: [
- [],
- [],
- [],
- []
- ],
- curTab: 0,
- productInfo: {},
- }
- },
- async onLoad(options) {
- // 判断登录
- await this.isLoginApi();
- if (this.token === '') {
- uni.showModal({
- content: '请先登录',
- success: function(res) {
- if (res.confirm) {
- uni.navigateTo({
- url: '/pages/login/login'
- });
- } else if (res.cancel) {
- uni.navigateBack();
- }
- }
- });
- }
- console.log("options--->", options)
- let data = options.textObj.replace(/""/g, "");
- data = JSON.parse(decodeURIComponent(data))
- console.log("data(上级页面参数解码后)--->", data)
- this.curTab = data.value
- console.log("curTab---->", this.curTab)
- let that = this
- this.showList.forEach(function(item, index) {
- if (index == that.curTab) {
- that.showList[index] = true
- } else {
- that.showList[index] = false
- }
- })
- console.log("showList: ", this.showList)
- },
- async onShow() {
- console.log("onshow!!!!!!!!")
- await this.getInfoTableApi()
- this.handleClickTab(this.curTab)
- },
- methods: {
- getFreeStageText(freeStage) {
- switch (freeStage) {
- case 1:
- return '已申请';
- case 2:
- return '已拒绝';
- case 3:
- return '待发货';
- case 4:
- return '已发货';
- case 5:
- return '已收货';
- default:
- return '未知状态';
- }
- },
- async handleClickTab(value) {
- this.loading = true;
- uni.showLoading({
- title: '加载中'
- });
- let that = this
- this.showList.forEach(function(item, index) {
- if (index == value) {
- that.showList[index] = true
- } else {
- that.showList[index] = false
- }
- })
- console.log("handleClickTab", that.showList)
- // value为0123
- await this.getSecTaskListApi_new(parseInt(value) + 1);
- uni.hideLoading();
- this.loading = false;
- },
- handleToSecTaskDetail(item) {
- console.log("item--->", item)
- uni.navigateTo({
- url: '/page_workspace/selection/sectaskdetail1?taskId=' + item.task_id,
- success(res) {},
- fail(err) {}
- });
- },
- // 判断登陆是否过期
- isLoginApi() {
- return this.$https.get('/youngee/c/t/g/is-login')
- .then(res => {
- if (res.data.code === 403) {
- // 登陆已失效
- this.token = ""
- uni.clearStorage();
- } else {
- this.token = uni.getStorageSync('token')
- }
- })
- },
- // 获取所有的info_sectask_stage的状态即 任务阶段
- getInfoTableApi() {
- return this.$https.get('/youngee/c/g/get-info-tables')
- .then(res => {
- console.log("/youngee/c/g/get-info-tables", res)
- this.secTaskStageList = res.data.data.SecTaskStage
- })
- },
- getProductInfoApi(item) {
- return this.$https.get('/youngee/c/t/g/get-product-detail' +
- "?productid=" +
- item
- )
- .then(res => {
- console.log("getproductsuccess---", res)
- this.productInfo = res.data.data
- })
- },
- // 此处value为1234(在后端处理后,每个数字会对应多个状态) 更多task_stage参考info_sectask_stage
- async getSecTaskListApi(value) {
- return this.$https.get('/youngee/c/api/t/secTask/list?task_stage=' + value).then(
- async res => { // 注意这里添加了async关键字
- if (res.data.code === 1) {
- console.log("res--->", res)
- let secTaskList = res.data.data.sec_task
- console.log("secTaskList--->", secTaskList)
- let num = res.data.data.count
- for (let i = 0; i < num; ++i) {
- //通过prouctid获取product表和product_photo表的信息
- await this.getProductInfoApi(secTaskList[i].product_id);
- console.log("****secTaskList[i]*******", secTaskList[i])
- secTaskList[i].price = this.productInfo.product_price
- secTaskList[i].exclusive_commission = this.productInfo.exclusive_commission
- // 主图
- if (secTaskList[i].product_photo_snap != null && secTaskList[i]
- .product_photo_snap !=
- '') {
- let productPhoto = JSON.parse(secTaskList[i].product_photo_snap);
- for (let j = 0; j < productPhoto.length; j++) {
- if (productPhoto[j].Symbol == 1) {
- secTaskList[i].product_img_url = productPhoto[j].PhotoUrl
- }
- }
- }
- //截至时间
- secTaskList[i].ddl = secTaskList[i].task_ddl
- //售价和佣金率
- // 待修改标识
- if (secTaskList[i].task_stage == 8 && secTaskList[i].assignment_status == 3) {
- secTaskList[i].isShowModify = true
- } else {
- secTaskList[i].isShowModify = false
- }
- // 任务阶段展示
- secTaskList[i].task_stage_txt = this.secTaskStageList[secTaskList[i]
- .task_stage - 1]
- .task_stage
- // 任务收益
- }
- this.secTaskLists[value - 1] = secTaskList
- }
- })
- },
- // 此处value为1234(在后端处理后,每个数字会对应多个状态) 更多task_stage参考info_sectask_stage
- async getSecTaskListApi_new(value) {
- return this.$https.get('/youngee/c/api/t/secTask/list-tab?tab_stage=' + value).then(
- async res => { // 注意这里添加了async关键字
- if (res.data.code === 1) {
- console.log("****res*******", res)
- let secTaskList = res.data.data.SecTaskTable
- let num = res.data.data.count
- for (let i = 0; i < num; ++i) {
- console.log("****secTaskList[i]*******", secTaskList[i])
- let product_info = secTaskList[i].YounggeeProduct
- let product_photo_info = secTaskList[i].YounggeeProductPhoto
- let selection_platform = secTaskList[i].PlatformInfo
- secTaskList[i].price = product_info.product_price
- secTaskList[i].exclusive_commission = product_info.exclusive_commission
- // 主图
- if (product_photo_info != null && product_photo_info != '') {
- for (let j = 0; j < product_photo_info.length; j++) {
- if (product_photo_info[j].symbol == 1) {
- secTaskList[i].product_img_url = product_photo_info[j].photo_url
- }
- }
- }
- //截至时间
- secTaskList[i].ddl = secTaskList[i].SelectionInfo.task_ddl
- // 判断是否到期
- secTaskList[i].isFinished = this.isFinish(secTaskList[i].ddl)
- }
- this.secTaskLists[value - 1] = secTaskList
- }
- })
- },
- isFinish(ddl) {
- var timeNow = new Date();
- var ddl = new Date(ddl.replace(/-/g, "/"));
- var diff = getDaysAndHoursBetweenDates(timeNow, ddl);
- let remain_days = diff.days;
- let remain_hours = diff.hours;
- if (remain_days <= 0 & remain_hours <= 0) return true;
- else return false;
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- p {
- font-size: 32rpx;
- }
-
- .overlay-img {
- position: absolute;
- width: 200rpx;
- height: 200rpx;
- background-color: black;
- opacity: 0.5;
- pointer-events: none; /* This makes the overlay image not interfere with any click events on the main image */
- }
- .container {
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
- .left-text {
- text-align: left;
- flex: 1;
- font-size: 30rpx;
- padding-left: 20rpx;
- }
- .right-text {
- text-align: right;
- flex: 1;
- font-size: 30rpx;
- padding-right: 20rpx;
- padding-top: 15rpx;
- }
- .Tasktext {
- // padding-top: 5% ;
- padding: 0 0 0 1%;
- // height: 80rpx;
- // margin-top: 2%;
- }
- .Tasktext span {
- color: #333333;
- font-size: 23rpx;
- font-weight: 550;
- text-indent: 2em;
- }
- .Tasktext image {
- vertical-align: middle;
- width: 50rpx;
- height: 50rpx;
- display: inline-block;
- padding-right: 14rpx;
- }
- .home {
- padding-top: 70rpx;
- }
- .menu {
- position: fixed;
- border-bottom: #FCCF41;
- background-color: #FFFFFF;
- justify-content: space-around;
- height: 5%;
- width: 100%;
- display: flex;
- z-index: 10;
- }
- .menu-item p {
- font-weight: 600;
- &.lor {
- border-bottom: 5rpx solid #F0D232;
- color: #F0D232;
- padding-bottom: 15rpx;
- }
- &.unlor {
- border-bottom: 5rpx solid #fff;
- color: #81838f;
- padding-bottom: 15rpx;
- }
- }
- .task-card {
- margin: 10rpx 0;
- height: 300rpx;
- background-color: #f2f2f2;
- // border-bottom: 1rpx #d7d7d7 solid;
- .platform-img {
- width: 40rpx;
- height: 40rpx;
- margin-right: 10rpx;
- flex-shrink: 0;
- }
- .task-head {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 10rpx 20rpx;
- .task-head-account {
- display: flex;
- }
- .platform-img {
- width: 40rpx;
- height: 40rpx;
- margin-right: 10rpx;
- flex-shrink: 0;
- }
- .task-head-status p {
- color: red;
- }
- }
- .task-info {
- display: flex;
- justify-content: space-between;
- padding: 10rpx 20rpx;
- .task-info-left {
- display: flex;
- // align-items: center;
- .project-img {
- height: 200rpx;
- width: 200rpx;
- flex-shrink: 0;
- // background-color: #b3c96b;
- }
- .task-info-txt {
- margin-left: 10rpx;
- }
- .task-info-txt p {
- font-size: 24rpx;
- color: #85859d;
- letter-spacing: 2rpx;
- // margin-bottom: 4rpx;
- }
- }
- .task-info-right {
- // width: 100rpx;
- // height: 100rpx;
- border-radius: 50%;
- // border: #ffcb41 2rpx solid;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .task-info-right p {
- font-size: 24rpx;
- }
- }
- }
- </style>
|