myselection.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656
  1. <template>
  2. <view>
  3. <!-- 胶囊 -->
  4. <mvBar :mysNavConfig="mysNavConfig"></mvBar>
  5. <view :style="{marginTop:navH}"></view>
  6. <view class="menu">
  7. <view class="menu-item" @click="handleClickTab(0)">
  8. <p v-bind:class="showList[0]?'lor':'unlor'">全部</p>
  9. </view>
  10. <view class="menu-item" @click="handleClickTab(1)">
  11. <p v-bind:class="showList[1]?'lor':'unlor'">已领样</p>
  12. </view>
  13. <view class="menu-item" @click="handleClickTab(2)">
  14. <p v-bind:class="showList[2]?'lor':'unlor'">已出单</p>
  15. </view>
  16. <view class="menu-item" @click="handleClickTab(3)">
  17. <p v-bind:class="showList[3]?'lor':'unlor'">已结束</p>
  18. </view>
  19. </view>
  20. <view class="home" v-if="showList[0] && !loading">
  21. <view class="task" v-for="item in secTaskLists[0]" @click="handleToSecTaskDetail(item)">
  22. <view class="task-card">
  23. <view class="task-info">
  24. <!-- 左侧图片和文字 -->
  25. <view class="task-info-left">
  26. <!-- 图片 -->
  27. <image class="project-img" :src="item.product_img_url"></image>
  28. <!-- 描述 -->
  29. <view class="task-info-txt">
  30. <!-- <view class="" style="display: flex;">
  31. <image class="platform-img" :src="item.platform_icon_url"></image>
  32. <p style="font-size: 28rpx; line-height: 28rpx;color: black;">
  33. {{item.selection_name}}
  34. </p>
  35. </view> -->
  36. <view class="Tasktext">
  37. <image class="platform-img" :src="item.platform_icon_url"></image>
  38. <span>
  39. {{item.selection_name}}
  40. </span>
  41. </view>
  42. <p style="color: #ffcb41 ;">任务截至时间:{{item.ddl}}</p>
  43. <p>售价:¥{{item.price}} 佣金率:{{item.exclusive_commission}}%</p>
  44. <!-- sectask表有已经有 -->
  45. <p>全部销售量/有效销售量:{{item.SecTaskTable.sale_num_all}}单/{{item.sale_actual}}单</p>
  46. <p v-if="item.task_mode==1">悬赏金额/悬赏有效销售量:
  47. ¥{{item.RewardStrategy[0].per_reward}}/{{item.RewardStrategy[0].sale_actual}}单</p>
  48. <p v-if="item.sample_mode==1">免费领样状态:{{ getFreeStageText(item.SecTaskTable.free_stage) }}</p>
  49. </view>
  50. </view>
  51. <!-- 右侧图标 -->
  52. <view class="task-info-right">
  53. <image
  54. src="https://horastar.obs.cn-east-3.myhuaweicloud.com/talent_upload/icon-arrow-right.png"
  55. style="height: 30rpx;width: 30rpx;"></image>
  56. </view>
  57. </view>
  58. <!-- <view style="text-align: right;" v-if="item.task_stage > 5">
  59. <p style="font-size: 25rpx;">实际收益:¥{{item.show_real_reward}}</p>
  60. </view> -->
  61. <view class="container" v-if="item.task_stage > 5">
  62. <p class="left-text">待领悬赏</p>
  63. <p class="right-text">实际收益:¥{{ item.show_real_reward }}</p>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. <view class="home" v-if="showList[1] && !loading">
  69. <view class="task" v-for="item in secTaskLists[1]" @click="handleToSecTaskDetail(item)">
  70. <view class="task-card">
  71. <view class="task-head">
  72. <view class="task-head-account">
  73. <image class="platform-img" :src="item.platform_icon_url"></image>
  74. <p>{{item.platform_nick_name}}</p>
  75. </view>
  76. <view class="task-head-status">
  77. <p>{{item.task_stage_txt}}</p>
  78. </view>
  79. </view>
  80. <view class="task-info">
  81. <view class="task-info-left">
  82. <image class="project-img" :src="item.product_img_url"></image>
  83. <view class="task-info-txt">
  84. <p style="color: #000;font-size: 32rpx;">{{item.selection_name}}</p>
  85. <p v-if="item.sample_mode === 2">预计样品返现金额:¥{{item.show_payment}}</p>
  86. <p>预计收益:¥{{item.show_task_reward}}</p>
  87. </view>
  88. </view>
  89. <view class="task-info-right" v-if="item.isShowModify">
  90. <image src="../../static/img/icon-edit.png" style="height: 60rpx;width: 60rpx;"></image>
  91. <p style="font-size: 32rpx;color: #ffcb41;font-weight: 600">改</p>
  92. </view>
  93. </view>
  94. <view style="text-align: right;" v-if="item.task_stage > 5">
  95. <p style="display: inline-block;">实际收益:¥{{item.show_real_reward}}</p>
  96. </view>
  97. </view>
  98. </view>
  99. </view>
  100. <view class="home" v-if="showList[2] && !loading">
  101. <view class="task" v-for="item in secTaskLists[2]" @click="handleToSecTaskDetail(item)">
  102. <view class="task-card">
  103. <view class="task-head">
  104. <view class="task-head-account">
  105. <image class="platform-img" :src="item.platform_icon_url"></image>
  106. <p>{{item.platform_nick_name}}</p>
  107. </view>
  108. <view class="task-head-status">
  109. <p>{{item.task_stage_txt}}</p>
  110. </view>
  111. </view>
  112. <view class="task-info">
  113. <view class="task-info-left">
  114. <image class="project-img" :src="item.product_img_url"></image>
  115. <view class="task-info-txt">
  116. <p style="color: #000;font-size: 32rpx;">{{item.selection_name}}</p>
  117. <p v-if="item.sample_mode === 2">预计样品返现金额:¥{{item.show_payment}}</p>
  118. <p>预计收益:¥{{item.show_task_reward}}</p>
  119. </view>
  120. </view>
  121. <view class="task-info-right" v-if="item.isShowModify">
  122. <image src="../../static/img/icon-edit.png" style="height: 60rpx;width: 60rpx;"></image>
  123. <p style="font-size: 32rpx;color: #ffcb41;font-weight: 600">改</p>
  124. </view>
  125. </view>
  126. <view style="text-align: right;" v-if="item.task_stage > 5">
  127. <p style="display: inline-block;">实际收益:¥{{item.show_real_reward}}</p>
  128. </view>
  129. </view>
  130. </view>
  131. </view>
  132. <view class="home" v-if="showList[3] && !loading">
  133. <view class="task" v-for="item in secTaskLists[3]" @click="handleToSecTaskDetail(item)">
  134. <view class="task-card">
  135. <view class="task-head">
  136. <view class="task-head-account">
  137. <image class="platform-img" :src="item.platform_icon_url"></image>
  138. <p>{{item.platform_nick_name}}</p>
  139. </view>
  140. <view class="task-head-status">
  141. <p>{{item.task_stage_txt}}</p>
  142. </view>
  143. </view>
  144. <view class="task-info">
  145. <view class="task-info-left">
  146. <image class="project-img" :src="item.product_img_url"></image>
  147. <view class="task-info-txt">
  148. <p style="color: #000;font-size: 32rpx;">{{item.selection_name}}</p>
  149. <p v-if="item.sample_mode === 2">预计样品返现金额:¥{{item.show_payment}}</p>
  150. <p>预计收益:¥{{item.show_task_reward}}</p>
  151. </view>
  152. </view>
  153. <view class="task-info-right" v-if="item.isShowModify">
  154. <image src="../../static/img/icon-edit.png" style="height: 60rpx;width: 60rpx;"></image>
  155. <p style="font-size: 32rpx;color: #ffcb41;font-weight: 600">改</p>
  156. </view>
  157. </view>
  158. <view style="text-align: right;" v-if="item.task_stage > 5">
  159. <p style="display: inline-block;">实际收益:¥{{item.show_real_reward}}</p>
  160. </view>
  161. </view>
  162. </view>
  163. </view>
  164. </view>
  165. </template>
  166. <script>
  167. import mvBar from "@/components/mys_navBar/mysNavBar";
  168. import {
  169. fansview,
  170. money
  171. } from '@/components/utils.js';
  172. export default {
  173. components: {
  174. mvBar,
  175. },
  176. data() {
  177. return {
  178. navH: getApp().globalData.navHeight,
  179. mysNavConfig: {
  180. /* 开启单页显示首页图标 */
  181. isHome: true,
  182. /* 固定导航 */
  183. navFixed: true,
  184. /* 标题 (屏幕中心居中 两边图标中心居中使用slot center1) */
  185. navTitle: {
  186. text: "我的带货任务",
  187. color: "",
  188. fontSize: "32rpx", // px upx rpx
  189. fontWeight: "normal", // 100 - 700
  190. },
  191. btnType: "type2",
  192. onLeftClick: "/pages/mycenter/mycenter",
  193. /* type2 按钮 */
  194. type2Config: {
  195. // 左图标
  196. leftPath: "/static/img/png2.png",
  197. // 右图标
  198. rightPath: "/static/img/png4.png",
  199. // 圆角
  200. radius: "40rpx",
  201. },
  202. },
  203. loading: false,
  204. showList: [true, false, false, false],
  205. secTaskStageList: [],
  206. secTaskLists: [
  207. [],
  208. [],
  209. [],
  210. []
  211. ],
  212. curTab: 0,
  213. productInfo: {},
  214. }
  215. },
  216. async onLoad(options) {
  217. // 判断登录
  218. await this.isLoginApi();
  219. if (this.token === '') {
  220. uni.showModal({
  221. content: '请先登录',
  222. success: function(res) {
  223. if (res.confirm) {
  224. uni.navigateTo({
  225. url: '/pages/login/login'
  226. });
  227. } else if (res.cancel) {
  228. uni.navigateBack();
  229. }
  230. }
  231. });
  232. }
  233. console.log("options--->", options)
  234. let data = options.textObj.replace(/""/g, "");
  235. data = JSON.parse(decodeURIComponent(data))
  236. console.log("data(上级页面参数解码后)--->", data)
  237. this.curTab = data.value
  238. console.log("curTab---->", this.curTab)
  239. let that = this
  240. this.showList.forEach(function(item, index) {
  241. if (index == that.curTab) {
  242. that.showList[index] = true
  243. } else {
  244. that.showList[index] = false
  245. }
  246. })
  247. console.log("showList: ", this.showList)
  248. },
  249. async onShow() {
  250. await this.getInfoTableApi()
  251. this.handleClickTab(this.curTab)
  252. },
  253. methods: {
  254. getFreeStageText(freeStage) {
  255. switch (freeStage) {
  256. case 1:
  257. return '已申请';
  258. case 2:
  259. return '已拒绝';
  260. case 3:
  261. return '待发货';
  262. case 4:
  263. return '已发货';
  264. case 5:
  265. return '已收货';
  266. default:
  267. return '未知状态';
  268. }
  269. },
  270. async handleClickTab(value) {
  271. this.loading = true;
  272. uni.showLoading({
  273. title: '加载中'
  274. });
  275. let that = this
  276. this.showList.forEach(function(item, index) {
  277. if (index == value) {
  278. that.showList[index] = true
  279. } else {
  280. that.showList[index] = false
  281. }
  282. })
  283. // value为0123
  284. await this.getSecTaskListApi(parseInt(value) + 1);
  285. uni.hideLoading();
  286. this.loading = false;
  287. },
  288. handleToSecTaskDetail(item) {
  289. console.log("item--->", item)
  290. uni.navigateTo({
  291. url: '/page_workspace/selection/sectaskdetail1?taskId=' + item.task_id,
  292. success(res) {},
  293. fail(err) {}
  294. });
  295. },
  296. // 判断登陆是否过期
  297. isLoginApi() {
  298. return this.$https.get('/youngee/c/t/g/is-login')
  299. .then(res => {
  300. if (res.data.code === 403) {
  301. // 登陆已失效
  302. this.token = ""
  303. uni.clearStorage();
  304. } else {
  305. this.token = uni.getStorageSync('token')
  306. }
  307. })
  308. },
  309. // 获取所有的info_sectask_stage的状态即 任务阶段
  310. getInfoTableApi() {
  311. return this.$https.get('/youngee/c/g/get-info-tables')
  312. .then(res => {
  313. console.log(res)
  314. this.secTaskStageList = res.data.data.SecTaskStage
  315. })
  316. },
  317. getProductInfoApi(item) {
  318. return this.$https.get('/youngee/c/t/g/get-product-detail' +
  319. "?productid=" +
  320. item
  321. )
  322. .then(res => {
  323. console.log("getproductsuccess---", res)
  324. this.productInfo = res.data.data
  325. })
  326. },
  327. // 此处value为1234(在后端处理后,每个数字会对应多个状态) 更多task_stage参考info_sectask_stage
  328. async getSecTaskListApi(value) {
  329. return this.$https.get('/youngee/c/api/t/secTask/list?task_stage=' + value).then(
  330. async res => { // 注意这里添加了async关键字
  331. if (res.data.code === 1) {
  332. console.log("res--->", res)
  333. let secTaskList = res.data.data.sec_task
  334. console.log("secTaskList--->", secTaskList)
  335. let num = res.data.data.count
  336. for (let i = 0; i < num; ++i) {
  337. //通过prouctid获取product表和product_photo表的信息
  338. await this.getProductInfoApi(secTaskList[i].product_id);
  339. console.log("****secTaskList[i]*******", secTaskList[i])
  340. secTaskList[i].price = this.productInfo.product_price
  341. secTaskList[i].exclusive_commission = this.productInfo.exclusive_commission
  342. // 主图
  343. if (secTaskList[i].product_photo_snap != null && secTaskList[i]
  344. .product_photo_snap !=
  345. '') {
  346. let productPhoto = JSON.parse(secTaskList[i].product_photo_snap);
  347. for (let j = 0; j < productPhoto.length; j++) {
  348. if (productPhoto[j].Symbol == 1) {
  349. secTaskList[i].product_img_url = productPhoto[j].PhotoUrl
  350. }
  351. }
  352. }
  353. //截至时间
  354. secTaskList[i].ddl = secTaskList[i].task_ddl
  355. //售价和佣金率
  356. // 待修改标识
  357. if (secTaskList[i].task_stage == 8 && secTaskList[i].assignment_status == 3) {
  358. secTaskList[i].isShowModify = true
  359. } else {
  360. secTaskList[i].isShowModify = false
  361. }
  362. // 任务阶段展示
  363. secTaskList[i].task_stage_txt = this.secTaskStageList[secTaskList[i]
  364. .task_stage - 1]
  365. .task_stage
  366. // 任务收益
  367. secTaskList[i].real_reward = secTaskList[i].task_reward
  368. secTaskList[i].show_task_reward = money(secTaskList[i].task_reward)
  369. secTaskList[i].show_real_reward = money(secTaskList[i].real_reward)
  370. secTaskList[i].show_payment = money(secTaskList[i].talent_payment)
  371. }
  372. this.secTaskLists[value - 1] = secTaskList
  373. }
  374. })
  375. },
  376. // async getSecTaskListApi(value) {
  377. // return this.$https.get('/youngee/c/api/t/secTask/list?task_stage=' + value).then(res => {
  378. // if (res.data.code === 1) {
  379. // console.log("res--->", res)
  380. // let secTaskList = res.data.data.sec_task
  381. // console.log("secTaskList--->", secTaskList)
  382. // let num = res.data.data.count
  383. // for (let i = 0; i < num; ++i) {
  384. // //通过prouctid获取product表和product_photo表的信息
  385. // await getProductInfoApi(secTaskList[i].product_id);
  386. // // 主图
  387. // if (secTaskList[i].product_photo_snap != null && secTaskList[i].product_photo_snap !=
  388. // '') {
  389. // let productPhoto = JSON.parse(secTaskList[i].product_photo_snap);
  390. // for (let j = 0; j < productPhoto.length; j++) {
  391. // if (productPhoto[j].Symbol == 1) {
  392. // secTaskList[i].product_img_url = productPhoto[j].PhotoUrl
  393. // }
  394. // }
  395. // }
  396. // //截至时间
  397. // secTaskList[i].ddl=secTaskList[i].task_ddl
  398. // //售价和佣金率
  399. // // 待修改标识
  400. // if (secTaskList[i].task_stage == 8 && secTaskList[i].assignment_status == 3) {
  401. // secTaskList[i].isShowModify = true
  402. // } else {
  403. // secTaskList[i].isShowModify = false
  404. // }
  405. // // 任务阶段展示
  406. // secTaskList[i].task_stage_txt = this.secTaskStageList[secTaskList[i].task_stage - 1]
  407. // .task_stage
  408. // // 任务收益
  409. // secTaskList[i].real_reward = secTaskList[i].task_reward
  410. // secTaskList[i].show_task_reward = money(secTaskList[i].task_reward)
  411. // secTaskList[i].show_real_reward = money(secTaskList[i].real_reward)
  412. // secTaskList[i].show_payment = money(secTaskList[i].talent_payment)
  413. // }
  414. // this.secTaskLists[value - 1] = secTaskList
  415. // }
  416. // })
  417. // },
  418. // getSecTaskListApi(value) {
  419. // return this.$https.get('/youngee/c/api/t/secTask/list' +
  420. // "?" +
  421. // "task_stage" +
  422. // "=" +
  423. // value +
  424. // "&" +
  425. // "productid" +
  426. // "=" +
  427. // this.productId
  428. // )
  429. // .then(res => {
  430. // console.log("res--->", res)
  431. // if (res.data.code === 1) {
  432. // let secTaskList = res.data.data.sec_task
  433. // console.log("secTaskList--->", secTaskList)
  434. // let num = res.data.data.count
  435. // for (let i = 0; i < num; ++i) {
  436. // // 主图
  437. // if (secTaskList[i].product_photo_snap != null && secTaskList[i].product_photo_snap !=
  438. // '') {
  439. // let productPhoto = JSON.parse(secTaskList[i].product_photo_snap);
  440. // for (let j = 0; j < productPhoto.length; j++) {
  441. // if (productPhoto[j].Symbol == 1) {
  442. // secTaskList[i].product_img_url = productPhoto[j].PhotoUrl
  443. // }
  444. // }
  445. // }
  446. // // 待修改标识
  447. // if (secTaskList[i].task_stage == 8 && secTaskList[i].assignment_status == 3) {
  448. // secTaskList[i].isShowModify = true
  449. // } else {
  450. // secTaskList[i].isShowModify = false
  451. // }
  452. // // 任务阶段展示
  453. // secTaskList[i].task_stage_txt = this.secTaskStageList[secTaskList[i].task_stage - 1]
  454. // .task_stage
  455. // // 任务收益
  456. // secTaskList[i].real_reward = secTaskList[i].task_reward
  457. // secTaskList[i].show_task_reward = money(secTaskList[i].task_reward)
  458. // secTaskList[i].show_real_reward = money(secTaskList[i].real_reward)
  459. // secTaskList[i].show_payment = money(secTaskList[i].talent_payment)
  460. // }
  461. // this.secTaskLists[value - 1] = secTaskList
  462. // }
  463. // })
  464. // },
  465. }
  466. }
  467. </script>
  468. <style lang="scss" scoped>
  469. p {
  470. font-size: 32rpx;
  471. }
  472. .container {
  473. display: flex;
  474. justify-content: space-between;
  475. align-items: center;
  476. }
  477. .left-text {
  478. text-align: left;
  479. flex: 1;
  480. font-size: 25rpx;
  481. }
  482. .right-text {
  483. text-align: right;
  484. flex: 1;
  485. font-size: 25rpx;
  486. }
  487. .Tasktext {
  488. // padding-top: 5% ;
  489. padding: 0 0 0 1%;
  490. // height: 80rpx;
  491. // margin-top: 2%;
  492. }
  493. .Tasktext span {
  494. color: #333333;
  495. font-size: 23rpx;
  496. font-weight: 550;
  497. text-indent: 2em;
  498. }
  499. .Tasktext image {
  500. vertical-align: middle;
  501. width: 50rpx;
  502. height: 50rpx;
  503. display: inline-block;
  504. padding-right: 14rpx;
  505. }
  506. .home {
  507. padding-top: 70rpx;
  508. }
  509. .menu {
  510. position: fixed;
  511. border-bottom: #FCCF41;
  512. background-color: #FFFFFF;
  513. justify-content: space-around;
  514. height: 5%;
  515. width: 100%;
  516. display: flex;
  517. z-index: 10;
  518. }
  519. .menu-item p {
  520. font-weight: 600;
  521. &.lor {
  522. border-bottom: 5rpx solid #F0D232;
  523. color: #F0D232;
  524. padding-bottom: 15rpx;
  525. }
  526. &.unlor {
  527. border-bottom: 5rpx solid #fff;
  528. color: #81838f;
  529. padding-bottom: 15rpx;
  530. }
  531. }
  532. .task-card {
  533. margin: 10rpx 0;
  534. height: 300rpx;
  535. background-color: #f2f2f2;
  536. // border-bottom: 1rpx #d7d7d7 solid;
  537. .platform-img {
  538. width: 40rpx;
  539. height: 40rpx;
  540. margin-right: 10rpx;
  541. flex-shrink: 0;
  542. }
  543. .task-head {
  544. display: flex;
  545. justify-content: space-between;
  546. align-items: center;
  547. padding: 10rpx 20rpx;
  548. .task-head-account {
  549. display: flex;
  550. }
  551. .platform-img {
  552. width: 40rpx;
  553. height: 40rpx;
  554. margin-right: 10rpx;
  555. flex-shrink: 0;
  556. }
  557. .task-head-status p {
  558. color: red;
  559. }
  560. }
  561. .task-info {
  562. display: flex;
  563. justify-content: space-between;
  564. padding: 10rpx 20rpx;
  565. .task-info-left {
  566. display: flex;
  567. // align-items: center;
  568. .project-img {
  569. height: 200rpx;
  570. width: 200rpx;
  571. flex-shrink: 0;
  572. // background-color: #b3c96b;
  573. }
  574. .task-info-txt {
  575. margin-left: 10rpx;
  576. }
  577. .task-info-txt p {
  578. font-size: 24rpx;
  579. color: #85859d;
  580. letter-spacing: 2rpx;
  581. // margin-bottom: 4rpx;
  582. }
  583. }
  584. .task-info-right {
  585. // width: 100rpx;
  586. // height: 100rpx;
  587. border-radius: 50%;
  588. // border: #ffcb41 2rpx solid;
  589. display: flex;
  590. align-items: center;
  591. justify-content: center;
  592. }
  593. .task-info-right p {
  594. font-size: 24rpx;
  595. }
  596. }
  597. }
  598. </style>