Showing
2 changed files
with
72 additions
and
26 deletions
| ... | @@ -59,4 +59,16 @@ export function changeStatusById(data) { | ... | @@ -59,4 +59,16 @@ export function changeStatusById(data) { |
| 59 | method: 'post', | 59 | method: 'post', |
| 60 | data: data | 60 | data: data |
| 61 | }) | 61 | }) |
| 62 | +} | ||
| 63 | + | ||
| 64 | +//特殊规则获取释放仓位重量 | ||
| 65 | +/** | ||
| 66 | + * @param id ID * | ||
| 67 | + */ | ||
| 68 | +export function getReleaseWeight(data) { | ||
| 69 | + return request({ | ||
| 70 | + url: '/shipperAccount/getReleaseWeight', | ||
| 71 | + method: 'post', | ||
| 72 | + data: data | ||
| 73 | + }) | ||
| 62 | } | 74 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -48,7 +48,7 @@ | ... | @@ -48,7 +48,7 @@ |
| 48 | </template> | 48 | </template> |
| 49 | 49 | ||
| 50 | <script> | 50 | <script> |
| 51 | -import { queryShipperAccountRule, changeStatusById, queryShipperAccountRuleById } from "@/api/supserAllocation" | 51 | +import { queryShipperAccountRule, changeStatusById, queryShipperAccountRuleById, getReleaseWeight } from "@/api/supserAllocation" |
| 52 | import Dialog from './dialog.vue'; | 52 | import Dialog from './dialog.vue'; |
| 53 | 53 | ||
| 54 | export default { | 54 | export default { |
| ... | @@ -133,22 +133,30 @@ export default { | ... | @@ -133,22 +133,30 @@ export default { |
| 133 | }, | 133 | }, |
| 134 | //删除 | 134 | //删除 |
| 135 | del(val) { | 135 | del(val) { |
| 136 | - this.$confirm("是否要删除记录!", "注意!", { | 136 | + getReleaseWeight({ id: val.id }).then(res => { |
| 137 | - confirmButtonText: "确定", | 137 | + if (res.code === 200) { |
| 138 | - cancelButtonText: '取消', | 138 | + this.$confirm("是否要删除记录!", "注意!", { |
| 139 | - type: "warning", | 139 | + confirmButtonText: "确定", |
| 140 | - }).then(() => { | 140 | + cancelButtonText: '取消', |
| 141 | - changeStatusById({ id: val.id, status: 2 }).then(res => { | 141 | + type: "warning", |
| 142 | - if (res.code === 200) { | 142 | + }).then(() => { |
| 143 | - this.msgSuccess('删除成功!') | 143 | + changeStatusById({ id: val.id, status: 2 }).then(res => { |
| 144 | - this.selection(1) | 144 | + if (res.code === 200) { |
| 145 | - } else { | 145 | + this.msgSuccess(`删除成功!以释放舱位${res.data}`) |
| 146 | - this.msgWarning(res.msg) | 146 | + this.selection(1) |
| 147 | - } | 147 | + } else { |
| 148 | - }).catch(err => { | 148 | + this.msgWarning(res.msg) |
| 149 | - console.log(err) | 149 | + } |
| 150 | - }) | 150 | + }).catch(err => { |
| 151 | - }).catch(() => { }) | 151 | + console.log(err) |
| 152 | + }) | ||
| 153 | + }).catch(() => { }) | ||
| 154 | + } else { | ||
| 155 | + this.msgWarning(res.code) | ||
| 156 | + } | ||
| 157 | + }).catch(err => { | ||
| 158 | + console.log(err) | ||
| 159 | + }) | ||
| 152 | }, | 160 | }, |
| 153 | //停用启用 | 161 | //停用启用 |
| 154 | changeStatus(val) { | 162 | changeStatus(val) { |
| ... | @@ -161,22 +169,31 @@ export default { | ... | @@ -161,22 +169,31 @@ export default { |
| 161 | status = 0 | 169 | status = 0 |
| 162 | tip = '停用' | 170 | tip = '停用' |
| 163 | } | 171 | } |
| 164 | - this.$confirm(`是否要${tip}记录!`, "注意!", { | 172 | + if (tip === "停用") { |
| 165 | - confirmButtonText: "确定", | 173 | + getReleaseWeight({ id: val.id }).then(res => { |
| 166 | - cancelButtonText: '取消', | ||
| 167 | - type: "warning", | ||
| 168 | - }).then(() => { | ||
| 169 | - changeStatusById({ id: val.id, status: status }).then(res => { | ||
| 170 | if (res.code === 200) { | 174 | if (res.code === 200) { |
| 171 | - this.msgSuccess(tip + '成功!') | 175 | + this.$confirm(`预计释放仓位为${res.data},是否确定!`, "注意!", { |
| 172 | - this.selection(1) | 176 | + confirmButtonText: "确定", |
| 177 | + cancelButtonText: '取消', | ||
| 178 | + type: "warning", | ||
| 179 | + }).then(() => { | ||
| 180 | + this.statusChange({ id: val.id, status: status, tip: tip }) | ||
| 181 | + }).catch(() => { }) | ||
| 173 | } else { | 182 | } else { |
| 174 | this.msgWarning(res.msg) | 183 | this.msgWarning(res.msg) |
| 175 | } | 184 | } |
| 176 | }).catch(err => { | 185 | }).catch(err => { |
| 177 | console.log(err) | 186 | console.log(err) |
| 178 | }) | 187 | }) |
| 179 | - }).catch(() => { }) | 188 | + } else { |
| 189 | + this.$confirm(`是否要${tip}记录!`, "注意!", { | ||
| 190 | + confirmButtonText: "确定", | ||
| 191 | + cancelButtonText: '取消', | ||
| 192 | + type: "warning", | ||
| 193 | + }).then(() => { | ||
| 194 | + this.statusChange({ id: val.id, status: status, tip: tip }) | ||
| 195 | + }).catch(() => { }) | ||
| 196 | + } | ||
| 180 | }, | 197 | }, |
| 181 | //复制 | 198 | //复制 |
| 182 | copy(val) { | 199 | copy(val) { |
| ... | @@ -185,6 +202,23 @@ export default { | ... | @@ -185,6 +202,23 @@ export default { |
| 185 | this.ruleData.id = undefined | 202 | this.ruleData.id = undefined |
| 186 | this.dialogVisible = true | 203 | this.dialogVisible = true |
| 187 | }, | 204 | }, |
| 205 | + //状态修改请求 | ||
| 206 | + statusChange(val) { | ||
| 207 | + changeStatusById(val).then(res => { | ||
| 208 | + if (res.code === 200) { | ||
| 209 | + if (val.tip == '停用') { | ||
| 210 | + this.msgSuccess(`${val.tip}成功!以释放${res.data}`) | ||
| 211 | + } else { | ||
| 212 | + this.msgSuccess(`${val.tip}成功!`) | ||
| 213 | + } | ||
| 214 | + this.selection(1) | ||
| 215 | + } else { | ||
| 216 | + this.msgWarning(res.msg) | ||
| 217 | + } | ||
| 218 | + }).catch(err => { | ||
| 219 | + console.log(err) | ||
| 220 | + }) | ||
| 221 | + }, | ||
| 188 | //关闭 | 222 | //关闭 |
| 189 | close() { | 223 | close() { |
| 190 | this.dialogVisible = false | 224 | this.dialogVisible = false | ... | ... |
-
Please register or login to post a comment