myselection.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435
  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. <view class="task-info-left">
  34. <image class="project-img" :src="item.product_img_url"></image>
  35. <view class="task-info-txt">
  36. <p style="color: #000;font-size: 32rpx;">{{item.selection_name}}</p>
  37. <p v-if="item.sample_mode === 2">预计样品返现金额:¥{{item.show_payment}}</p>
  38. <p>预计收益:¥{{item.show_task_reward}}</p>
  39. </view>
  40. </view>
  41. <view class="task-info-right" v-if="item.isShowModify">
  42. <image src="../../static/img/icon-edit.png" style="height: 60rpx;width: 60rpx;"></image>
  43. <p style="font-size: 32rpx;color: #ffcb41;font-weight: 600">改</p>
  44. </view>
  45. </view>
  46. <view style="text-align: right;" v-if="item.task_stage > 5">
  47. <p style="display: inline-block;">实际收益:¥{{item.show_real_reward}}</p>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. <view class="home" v-if="showList[1] && !loading">
  53. <view class="task" v-for="item in secTaskLists[1]" @click="handleToSecTaskDetail(item)">
  54. <view class="task-card">
  55. <view class="task-head">
  56. <view class="task-head-account">
  57. <image class="platform-img" :src="item.platform_icon_url"></image>
  58. <p>{{item.platform_nick_name}}</p>
  59. </view>
  60. <view class="task-head-status">
  61. <p>{{item.task_stage_txt}}</p>
  62. </view>
  63. </view>
  64. <view class="task-info">
  65. <view class="task-info-left">
  66. <image class="project-img" :src="item.product_img_url"></image>
  67. <view class="task-info-txt">
  68. <p style="color: #000;font-size: 32rpx;">{{item.selection_name}}</p>
  69. <p v-if="item.sample_mode === 2">预计样品返现金额:¥{{item.show_payment}}</p>
  70. <p>预计收益:¥{{item.show_task_reward}}</p>
  71. </view>
  72. </view>
  73. <view class="task-info-right" v-if="item.isShowModify">
  74. <image src="../../static/img/icon-edit.png" style="height: 60rpx;width: 60rpx;"></image>
  75. <p style="font-size: 32rpx;color: #ffcb41;font-weight: 600">改</p>
  76. </view>
  77. </view>
  78. <view style="text-align: right;" v-if="item.task_stage > 5">
  79. <p style="display: inline-block;">实际收益:¥{{item.show_real_reward}}</p>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. <view class="home" v-if="showList[2] && !loading">
  85. <view class="task" v-for="item in secTaskLists[2]" @click="handleToSecTaskDetail(item)">
  86. <view class="task-card">
  87. <view class="task-head">
  88. <view class="task-head-account">
  89. <image class="platform-img" :src="item.platform_icon_url"></image>
  90. <p>{{item.platform_nick_name}}</p>
  91. </view>
  92. <view class="task-head-status">
  93. <p>{{item.task_stage_txt}}</p>
  94. </view>
  95. </view>
  96. <view class="task-info">
  97. <view class="task-info-left">
  98. <image class="project-img" :src="item.product_img_url"></image>
  99. <view class="task-info-txt">
  100. <p style="color: #000;font-size: 32rpx;">{{item.selection_name}}</p>
  101. <p v-if="item.sample_mode === 2">预计样品返现金额:¥{{item.show_payment}}</p>
  102. <p>预计收益:¥{{item.show_task_reward}}</p>
  103. </view>
  104. </view>
  105. <view class="task-info-right" v-if="item.isShowModify">
  106. <image src="../../static/img/icon-edit.png" style="height: 60rpx;width: 60rpx;"></image>
  107. <p style="font-size: 32rpx;color: #ffcb41;font-weight: 600">改</p>
  108. </view>
  109. </view>
  110. <view style="text-align: right;" v-if="item.task_stage > 5">
  111. <p style="display: inline-block;">实际收益:¥{{item.show_real_reward}}</p>
  112. </view>
  113. </view>
  114. </view>
  115. </view>
  116. <view class="home" v-if="showList[3] && !loading">
  117. <view class="task" v-for="item in secTaskLists[3]" @click="handleToSecTaskDetail(item)">
  118. <view class="task-card">
  119. <view class="task-head">
  120. <view class="task-head-account">
  121. <image class="platform-img" :src="item.platform_icon_url"></image>
  122. <p>{{item.platform_nick_name}}</p>
  123. </view>
  124. <view class="task-head-status">
  125. <p>{{item.task_stage_txt}}</p>
  126. </view>
  127. </view>
  128. <view class="task-info">
  129. <view class="task-info-left">
  130. <image class="project-img" :src="item.product_img_url"></image>
  131. <view class="task-info-txt">
  132. <p style="color: #000;font-size: 32rpx;">{{item.selection_name}}</p>
  133. <p v-if="item.sample_mode === 2">预计样品返现金额:¥{{item.show_payment}}</p>
  134. <p>预计收益:¥{{item.show_task_reward}}</p>
  135. </view>
  136. </view>
  137. <view class="task-info-right" v-if="item.isShowModify">
  138. <image src="../../static/img/icon-edit.png" style="height: 60rpx;width: 60rpx;"></image>
  139. <p style="font-size: 32rpx;color: #ffcb41;font-weight: 600">改</p>
  140. </view>
  141. </view>
  142. <view style="text-align: right;" v-if="item.task_stage > 5">
  143. <p style="display: inline-block;">实际收益:¥{{item.show_real_reward}}</p>
  144. </view>
  145. </view>
  146. </view>
  147. </view>
  148. </view>
  149. </template>
  150. <script>
  151. import mvBar from "@/components/mys_navBar/mysNavBar";
  152. import {
  153. fansview,
  154. money
  155. } from '@/components/utils.js';
  156. export default {
  157. components: {
  158. mvBar,
  159. },
  160. data() {
  161. return {
  162. navH: getApp().globalData.navHeight,
  163. mysNavConfig: {
  164. /* 开启单页显示首页图标 */
  165. isHome: true,
  166. /* 固定导航 */
  167. navFixed: true,
  168. /* 标题 (屏幕中心居中 两边图标中心居中使用slot center1) */
  169. navTitle: {
  170. text: "带货任务",
  171. color: "",
  172. fontSize: "32rpx", // px upx rpx
  173. fontWeight: "normal", // 100 - 700
  174. },
  175. btnType: "type2",
  176. onLeftClick: "/pages/mycenter/mycenter",
  177. /* type2 按钮 */
  178. type2Config: {
  179. // 左图标
  180. leftPath: "/static/img/png2.png",
  181. // 右图标
  182. rightPath: "/static/img/png4.png",
  183. // 圆角
  184. radius: "40rpx",
  185. },
  186. },
  187. loading: false,
  188. showList: [true, false, false, false],
  189. secTaskStageList: [],
  190. secTaskLists: [
  191. [],
  192. [],
  193. [],
  194. []
  195. ],
  196. curTab: 0,
  197. }
  198. },
  199. async onLoad(options) {
  200. // 判断登录
  201. await this.isLoginApi();
  202. if (this.token === '') {
  203. uni.showModal({
  204. content: '请先登录',
  205. success: function(res) {
  206. if (res.confirm) {
  207. uni.navigateTo({
  208. url: '/pages/login/login'
  209. });
  210. } else if (res.cancel) {
  211. uni.navigateBack();
  212. }
  213. }
  214. });
  215. }
  216. let data = options.textObj.replace(/""/g, "");
  217. data = JSON.parse(decodeURIComponent(data))
  218. this.curTab = data.value
  219. let that = this
  220. this.showList.forEach(function(item, index) {
  221. if (index == that.curTab) {
  222. that.showList[index] = true
  223. } else {
  224. that.showList[index] = false
  225. }
  226. })
  227. console.log("showList: ", this.showList)
  228. },
  229. async onShow() {
  230. await this.getInfoTableApi()
  231. this.handleClickTab(this.curTab)
  232. },
  233. methods: {
  234. async handleClickTab(value) {
  235. this.loading = true;
  236. uni.showLoading({
  237. title: '加载中'
  238. });
  239. let that = this
  240. this.showList.forEach(function(item, index) {
  241. if (index == value) {
  242. that.showList[index] = true
  243. } else {
  244. that.showList[index] = false
  245. }
  246. })
  247. await this.getSecTaskListApi(parseInt(value) + 1);
  248. uni.hideLoading();
  249. this.loading = false;
  250. },
  251. handleToSecTaskDetail(item) {
  252. uni.navigateTo({
  253. url: '/page_workspace/selection/sectaskdetail?taskId=' + item.task_id,
  254. success(res) {},
  255. fail(err) {}
  256. });
  257. },
  258. // 判断登陆是否过期
  259. isLoginApi() {
  260. return this.$https.get('/youngee/c/t/g/is-login')
  261. .then(res => {
  262. if (res.data.code === 403) {
  263. // 登陆已失效
  264. this.token = ""
  265. uni.clearStorage();
  266. } else {
  267. this.token = uni.getStorageSync('token')
  268. }
  269. })
  270. },
  271. getInfoTableApi() {
  272. return this.$https.get('/youngee/c/g/get-info-tables')
  273. .then(res => {
  274. console.log(res)
  275. this.secTaskStageList = res.data.data.SecTaskStage
  276. })
  277. },
  278. getSecTaskListApi(value) {
  279. return this.$https.get('/youngee/c/api/t/secTask/list?task_stage=' + value).then(res => {
  280. if (res.data.code === 1) {
  281. let secTaskList = res.data.data.sec_task
  282. let num = res.data.data.count
  283. for (let i = 0; i < num; ++i) {
  284. // 主图
  285. if (secTaskList[i].product_photo_snap != null && secTaskList[i].product_photo_snap != ''){
  286. let productPhoto = JSON.parse(secTaskList[i].product_photo_snap);
  287. for (let j = 0; j < productPhoto.length; j++) {
  288. if (productPhoto[j].Symbol == 1) {
  289. secTaskList[i].product_img_url = productPhoto[j].PhotoUrl
  290. }
  291. }
  292. }
  293. // 待修改标识
  294. if (secTaskList[i].task_stage == 8 && secTaskList[i].assignment_status == 3) {
  295. secTaskList[i].isShowModify = true
  296. } else {
  297. secTaskList[i].isShowModify = false
  298. }
  299. // 任务阶段展示
  300. secTaskList[i].task_stage_txt = this.secTaskStageList[secTaskList[i].task_stage - 1]
  301. .task_stage
  302. // 任务收益
  303. secTaskList[i].real_reward = secTaskList[i].task_reward
  304. secTaskList[i].show_task_reward = money(secTaskList[i].task_reward)
  305. secTaskList[i].show_real_reward = money(secTaskList[i].real_reward)
  306. secTaskList[i].show_payment = money(secTaskList[i].talent_payment)
  307. }
  308. this.secTaskLists[value-1] = secTaskList
  309. console.log("secTaskLists: ", this.secTaskLists)
  310. }
  311. })
  312. },
  313. }
  314. }
  315. </script>
  316. <style lang="scss" scoped>
  317. p {
  318. font-size: 32rpx;
  319. }
  320. .home {
  321. padding-top: 70rpx;
  322. }
  323. .menu {
  324. position: fixed;
  325. border-bottom: #FCCF41;
  326. background-color: #FFFFFF;
  327. justify-content: space-around;
  328. height: 5%;
  329. width: 100%;
  330. display: flex;
  331. z-index: 10;
  332. }
  333. .menu-item p {
  334. font-weight: 600;
  335. &.lor {
  336. border-bottom: 5rpx solid #F0D232;
  337. color: #F0D232;
  338. padding-bottom: 15rpx;
  339. }
  340. &.unlor {
  341. border-bottom: 5rpx solid #fff;
  342. color: #81838f;
  343. padding-bottom: 15rpx;
  344. }
  345. }
  346. .task-card {
  347. margin: 10rpx 0;
  348. // border-bottom: 1rpx #d7d7d7 solid;
  349. .task-head {
  350. display: flex;
  351. justify-content: space-between;
  352. align-items: center;
  353. padding: 10rpx 20rpx;
  354. .task-head-account {
  355. display: flex;
  356. }
  357. .platform-img {
  358. width: 40rpx;
  359. height: 40rpx;
  360. margin-right: 10rpx;
  361. }
  362. .task-head-status p {
  363. color: red;
  364. }
  365. }
  366. .task-info {
  367. display: flex;
  368. justify-content: space-between;
  369. padding: 10rpx 20rpx;
  370. .task-info-left {
  371. display: flex;
  372. // align-items: center;
  373. .project-img {
  374. height: 120rpx;
  375. width: 120rpx;
  376. // background-color: #b3c96b;
  377. }
  378. .task-info-txt {
  379. margin-left: 10rpx;
  380. }
  381. .task-info-txt p {
  382. font-size: 24rpx;
  383. color: #85859d;
  384. margin-bottom: 10rpx;
  385. }
  386. }
  387. .task-info-right {
  388. width: 100rpx;
  389. height: 100rpx;
  390. border-radius: 50%;
  391. border: #ffcb41 2rpx solid;
  392. display: flex;
  393. align-items: center;
  394. justify-content: center;
  395. }
  396. .task-info-right p {
  397. font-size: 24rpx;
  398. }
  399. }
  400. }
  401. </style>