我要申领按钮判断逻辑调整,如果 can_ref_previous 为true,就跳转到上次活动的页面为 false 就跳转到购物车
Showing
2 changed files
with
26 additions
and
23 deletions
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2024-07-23 10:50:38 | 2 | * @Date: 2024-07-23 10:50:38 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2024-07-29 10:58:37 | 4 | + * @LastEditTime: 2024-07-29 15:19:17 |
| 5 | * @FilePath: /temple_material_request/src/views/material_list.vue | 5 | * @FilePath: /temple_material_request/src/views/material_list.vue |
| 6 | * @Description: 物资情况页面 | 6 | * @Description: 物资情况页面 |
| 7 | --> | 7 | --> |
| ... | @@ -70,6 +70,7 @@ const form_id = $route.query.form_id ? $route.query.form_id : ''; | ... | @@ -70,6 +70,7 @@ const form_id = $route.query.form_id ? $route.query.form_id : ''; |
| 70 | const client_id = $route.query.client_id ? $route.query.client_id : ''; | 70 | const client_id = $route.query.client_id ? $route.query.client_id : ''; |
| 71 | 71 | ||
| 72 | const dept_id = ref(''); | 72 | const dept_id = ref(''); |
| 73 | +const canRefPrevious = ref(false); // 是否参考上一次活动 | ||
| 73 | 74 | ||
| 74 | onMounted(async () => { | 75 | onMounted(async () => { |
| 75 | const { data, code } = await getActivityDeptsAPI({ activity_id, is_previous: 0, only_my_dept: 0 }); | 76 | const { data, code } = await getActivityDeptsAPI({ activity_id, is_previous: 0, only_my_dept: 0 }); |
| ... | @@ -77,16 +78,6 @@ onMounted(async () => { | ... | @@ -77,16 +78,6 @@ onMounted(async () => { |
| 77 | tabList.value = data; | 78 | tabList.value = data; |
| 78 | if (tabList.value.length) { // 默认选中组别ID | 79 | if (tabList.value.length) { // 默认选中组别ID |
| 79 | dept_id.value = tabList.value[0]['dept_id']; | 80 | dept_id.value = tabList.value[0]['dept_id']; |
| 80 | - } else { // 组别为空时跳转到申领物资页面 | ||
| 81 | - // 跳转申领物资页面 | ||
| 82 | - $router.push({ | ||
| 83 | - path: '/material_request', | ||
| 84 | - query: { | ||
| 85 | - activity_id, | ||
| 86 | - form_id, | ||
| 87 | - client_id | ||
| 88 | - } | ||
| 89 | - }) | ||
| 90 | } | 81 | } |
| 91 | } | 82 | } |
| 92 | }); | 83 | }); |
| ... | @@ -113,7 +104,7 @@ const finished = ref(false); | ... | @@ -113,7 +104,7 @@ const finished = ref(false); |
| 113 | 104 | ||
| 114 | const onLoad = async () => { | 105 | const onLoad = async () => { |
| 115 | // 异步更新数据 | 106 | // 异步更新数据 |
| 116 | - const { code, data } = await getGoodUseListAPI({ activity_id, dept_id: dept_id.value, is_previous: 0, offset: offset.value, limit: limit.value }); | 107 | + const { code, data, can_ref_previous } = await getGoodUseListAPI({ activity_id, dept_id: dept_id.value, is_previous: 0, offset: offset.value, limit: limit.value }); |
| 117 | if (code) { | 108 | if (code) { |
| 118 | list.value = _.concat(list.value, data); | 109 | list.value = _.concat(list.value, data); |
| 119 | list.value = _.uniqBy(list.value, 'good_id'); | 110 | list.value = _.uniqBy(list.value, 'good_id'); |
| ... | @@ -124,6 +115,7 @@ const onLoad = async () => { | ... | @@ -124,6 +115,7 @@ const onLoad = async () => { |
| 124 | // 加载状态结束 | 115 | // 加载状态结束 |
| 125 | finished.value = true; | 116 | finished.value = true; |
| 126 | } | 117 | } |
| 118 | + canRefPrevious.value = can_ref_previous; | ||
| 127 | } | 119 | } |
| 128 | }; | 120 | }; |
| 129 | 121 | ||
| ... | @@ -139,15 +131,26 @@ const onCloseDetail = () => { // 关闭物资详情回调 | ... | @@ -139,15 +131,26 @@ const onCloseDetail = () => { // 关闭物资详情回调 |
| 139 | } | 131 | } |
| 140 | 132 | ||
| 141 | const onClickRequest = () => { // 我要申领物资 | 133 | const onClickRequest = () => { // 我要申领物资 |
| 142 | - // 上一次申领物资列表 | 134 | + if (canRefPrevious.value) { // 跳转上次活动页面 |
| 143 | - $router.push({ | 135 | + // 上一次申领物资列表 |
| 144 | - path: '/material_request', | 136 | + $router.push({ |
| 145 | - query: { | 137 | + path: '/material_request', |
| 146 | - activity_id, | 138 | + query: { |
| 147 | - form_id, | 139 | + activity_id, |
| 148 | - client_id | 140 | + form_id, |
| 149 | - } | 141 | + client_id |
| 150 | - }); | 142 | + } |
| 143 | + }); | ||
| 144 | + } else { // 跳转购物车 | ||
| 145 | + $router.push({ | ||
| 146 | + path: '/material_pre_request', | ||
| 147 | + query: { | ||
| 148 | + activity_id, | ||
| 149 | + form_id, | ||
| 150 | + client_id | ||
| 151 | + } | ||
| 152 | + }); | ||
| 153 | + } | ||
| 151 | } | 154 | } |
| 152 | </script> | 155 | </script> |
| 153 | 156 | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2024-07-23 12:53:15 | 2 | * @Date: 2024-07-23 12:53:15 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2024-07-29 10:30:14 | 4 | + * @LastEditTime: 2024-07-29 14:07:12 |
| 5 | * @FilePath: /temple_material_request/src/views/material_pre_request.vue | 5 | * @FilePath: /temple_material_request/src/views/material_pre_request.vue |
| 6 | * @Description: 待申领物资页面 | 6 | * @Description: 待申领物资页面 |
| 7 | --> | 7 | --> |
| ... | @@ -69,7 +69,7 @@ | ... | @@ -69,7 +69,7 @@ |
| 69 | <!-- --> | 69 | <!-- --> |
| 70 | <div style="display: flex; justify-content: space-between; align-items: center;"> | 70 | <div style="display: flex; justify-content: space-between; align-items: center;"> |
| 71 | <div style="display: flex; align-items: center;" @click="showPicker = true"> | 71 | <div style="display: flex; align-items: center;" @click="showPicker = true"> |
| 72 | - <div style="font-size: 0.85rem; color: #202020;">使用时间:</div> | 72 | + <div style="font-size: 0.85rem; color: #202020;">领用时间:</div> |
| 73 | <div style="border: 1px solid #f0f0f0; border-radius: 5px; padding: 0.5rem 0.35rem 0.5rem 1rem; min-width: 6rem; font-size: 0.85rem; display: flex; align-items: center; justify-content: space-between;">{{ use_time }} <van-icon name="notes-o" size="1rem" :color="styleColor.baseColor" /></div> | 73 | <div style="border: 1px solid #f0f0f0; border-radius: 5px; padding: 0.5rem 0.35rem 0.5rem 1rem; min-width: 6rem; font-size: 0.85rem; display: flex; align-items: center; justify-content: space-between;">{{ use_time }} <van-icon name="notes-o" size="1rem" :color="styleColor.baseColor" /></div> |
| 74 | </div> | 74 | </div> |
| 75 | <div style="display: flex; align-items: center;"> | 75 | <div style="display: flex; align-items: center;"> | ... | ... |
-
Please register or login to post a comment