myselection.vue 18 KB

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