repetitive_tasks_detail.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. var app = getApp()
  2. var that;
  3. Page({
  4. data: {
  5. date: app.globalData.month,
  6. activeIndex: 1,
  7. id: '',
  8. weekList: ['一', '二', '三', '四', '五', '六', '日']
  9. },
  10. onLoad(e) {
  11. that = this;
  12. dd.setNavigationBar({ title: "重复任务详情" });
  13. if (e.id) {
  14. that.getDetail(e.id);
  15. this.setData({
  16. id: e.id,
  17. })
  18. }
  19. },
  20. enable(){
  21. app.$post('api/integral/schedule/enable', { schedule_id: this.data.id }).then(res => {
  22. app.globalData.showToast(this.data.dataDetail.enable==1? '已暂停':'已启用');
  23. this.getDetail(this.data.id);
  24. })
  25. },
  26. formSubmit() {
  27. dd.confirm({
  28. title: '删除任务',
  29. content: '删除此任务将会删除其相关记录和积分数据,确认删除吗?',
  30. confirmButtonText: '确定',
  31. cancelButtonText: '取消',
  32. success: (result) => {
  33. if (result.confirm) {
  34. app.$get('api/integral/schedule/delete', { schedule_id: this.data.id }).then(res => {
  35. app.globalData.showToast(res.data.msg);
  36. setTimeout(() => {
  37. dd.navigateBack({ delta: 1 })
  38. }, 1000);
  39. })
  40. }
  41. },
  42. });
  43. },
  44. //显示图片
  45. showImg(e) {
  46. var index = e.target.dataset.index;
  47. var item = e.target.dataset.item
  48. dd.previewImage({
  49. current: index,
  50. urls: item
  51. });
  52. },
  53. fy(){
  54. if(this.data.dataDetail.type==1){
  55. dd.navigateTo({
  56. url: '../assaign/assaign?yData=' + JSON.stringify(this.data.dataDetail)
  57. })
  58. }else{
  59. dd.navigateTo({
  60. url: '../offerAreward/offerAreward?yData=' + JSON.stringify(this.data.dataDetail)
  61. })
  62. }
  63. },
  64. getDetail(id) {
  65. app.$get("api/integral/schedule", { schedule_id: id }).then((res) => {
  66. var data=res.data.data;
  67. data.img_url=app.globalData.userData.img_url;
  68. this.setData({ dataDetail: res.data.data })
  69. })
  70. },
  71. });