Commit 75db1059 authored by chicheng's avatar chicheng

详情页确认后,返回主页扫码框清空并选中

parent f792d0e7
...@@ -117,9 +117,10 @@ import i18n from '../../lang/index' ...@@ -117,9 +117,10 @@ import i18n from '../../lang/index'
.then(res => { .then(res => {
if (res.success) { if (res.success) {
this.$u.toast(i18n.t('提交成功')); this.$u.toast(i18n.t('提交成功'));
setTimeout(()=> { setTimeout(() => {
this.goMypage('pages/forcheck/forcheckMain') uni.$emit('forcheckSubmitSuccess');
}, 200) this.goMypage('pages/forcheck/forcheckMain');
}, 200);
} }
}) })
} }
......
...@@ -56,6 +56,7 @@ import i18n from '../../lang/index' ...@@ -56,6 +56,7 @@ import i18n from '../../lang/index'
isFocus: false, isFocus: false,
wxparams: "", wxparams: "",
loading: false, loading: false,
pendingRefocus: false,
daohuoForm: { daohuoForm: {
cc001: "3701", cc001: "3701",
cc002: "" cc002: ""
...@@ -66,13 +67,38 @@ import i18n from '../../lang/index' ...@@ -66,13 +67,38 @@ import i18n from '../../lang/index'
}, },
} }
}, },
onLoad() {
uni.$on('forcheckSubmitSuccess', this.onForcheckSubmitSuccess);
},
onUnload() {
uni.$off('forcheckSubmitSuccess', this.onForcheckSubmitSuccess);
},
onShow() {
if (this.pendingRefocus) {
this.pendingRefocus = false;
this.resetFormInput();
}
},
created() { created() {
this.$nextTick(() => { this.focusOrderNoInput();
this.isFocus = true;
uni.hideKeyboard()
});
}, },
methods: { methods: {
onForcheckSubmitSuccess() {
this.pendingRefocus = true;
},
resetFormInput() {
this.daohuoForm.cc002 = '';
this.focusOrderNoInput();
},
focusOrderNoInput() {
this.isFocus = false;
this.$nextTick(() => {
setTimeout(() => {
this.isFocus = true;
uni.hideKeyboard();
}, 200);
});
},
inputCC(e){ inputCC(e){
if(e && e.detail.value) { if(e && e.detail.value) {
if(e.detail.value.includes("-")){ if(e.detail.value.includes("-")){
...@@ -99,6 +125,7 @@ import i18n from '../../lang/index' ...@@ -99,6 +125,7 @@ import i18n from '../../lang/index'
this.loading = false; this.loading = false;
if (res.success) { if (res.success) {
if (res.data) { if (res.data) {
this.isFocus = false;
uni.navigateTo({ uni.navigateTo({
url: '/pages/forcheck/Info?info=' + encodeURIComponent(JSON.stringify(res.data)) url: '/pages/forcheck/Info?info=' + encodeURIComponent(JSON.stringify(res.data))
}); });
......
...@@ -152,9 +152,10 @@ import i18n from '../../lang/index' ...@@ -152,9 +152,10 @@ import i18n from '../../lang/index'
.then(res => { .then(res => {
if (res.success) { if (res.success) {
this.$u.toast(i18n.t('提交成功')); this.$u.toast(i18n.t('提交成功'));
setTimeout(()=> { setTimeout(() => {
this.goMypage('pages/forcreate/Main') uni.$emit('forcreateSubmitSuccess');
}, 200) this.goMypage('pages/forcreate/Main');
}, 200);
} }
}) })
} }
......
...@@ -56,6 +56,7 @@ import i18n from '../../lang/index' ...@@ -56,6 +56,7 @@ import i18n from '../../lang/index'
wxparams: "", wxparams: "",
loading: false, loading: false,
isFocus: false, isFocus: false,
pendingRefocus: false,
daohuoForm: { daohuoForm: {
cc001: "3701", cc001: "3701",
cc002: "" cc002: ""
...@@ -66,13 +67,38 @@ import i18n from '../../lang/index' ...@@ -66,13 +67,38 @@ import i18n from '../../lang/index'
}, },
} }
}, },
onLoad() {
uni.$on('forcreateSubmitSuccess', this.onForcreateSubmitSuccess);
},
onUnload() {
uni.$off('forcreateSubmitSuccess', this.onForcreateSubmitSuccess);
},
onShow() {
if (this.pendingRefocus) {
this.pendingRefocus = false;
this.resetFormInput();
}
},
created() { created() {
this.$nextTick(() => { this.focusOrderNoInput();
this.isFocus = true;
uni.hideKeyboard()
});
}, },
methods: { methods: {
onForcreateSubmitSuccess() {
this.pendingRefocus = true;
},
resetFormInput() {
this.daohuoForm.cc002 = '';
this.focusOrderNoInput();
},
focusOrderNoInput() {
this.isFocus = false;
this.$nextTick(() => {
setTimeout(() => {
this.isFocus = true;
uni.hideKeyboard();
}, 200);
});
},
inputCC(e){ inputCC(e){
if(e && e.detail.value) { if(e && e.detail.value) {
if(e.detail.value.includes("-")){ if(e.detail.value.includes("-")){
...@@ -100,6 +126,7 @@ import i18n from '../../lang/index' ...@@ -100,6 +126,7 @@ import i18n from '../../lang/index'
if (res.success) { if (res.success) {
if (res.data) { if (res.data) {
if(!res.data.purths || res.data.purths.length === 0) return this.$u.toast(i18n.t('到货单已经完成入库')); if(!res.data.purths || res.data.purths.length === 0) return this.$u.toast(i18n.t('到货单已经完成入库'));
this.isFocus = false;
uni.navigateTo({ uni.navigateTo({
url: '/pages/forcreate/Info?info=' + encodeURIComponent(JSON.stringify(res.data)) url: '/pages/forcreate/Info?info=' + encodeURIComponent(JSON.stringify(res.data))
}); });
......
...@@ -226,9 +226,10 @@ import i18n from '../../lang/index' ...@@ -226,9 +226,10 @@ import i18n from '../../lang/index'
.then(res => { .then(res => {
if (res.success) { if (res.success) {
this.$u.toast(i18n.t('提交成功')); this.$u.toast(i18n.t('提交成功'));
setTimeout(()=> { setTimeout(() => {
this.goMypage('pages/moctcforcreate/Main') uni.$emit('moctcForCreateSubmitSuccess');
}, 200) this.goMypage('pages/moctcforcreate/Main');
}, 200);
} }
}) })
} }
......
...@@ -56,6 +56,7 @@ export default { ...@@ -56,6 +56,7 @@ export default {
show: true, show: true,
wxparams: "", wxparams: "",
loading: false, loading: false,
pendingRefocus: false,
daohuoForm: { daohuoForm: {
ta001: "510", ta001: "510",
ta002: "" ta002: ""
...@@ -66,13 +67,38 @@ export default { ...@@ -66,13 +67,38 @@ export default {
}, },
} }
}, },
onLoad() {
uni.$on('moctcForCreateSubmitSuccess', this.onMoctcSubmitSuccess);
},
onUnload() {
uni.$off('moctcForCreateSubmitSuccess', this.onMoctcSubmitSuccess);
},
onShow() {
if (this.pendingRefocus) {
this.pendingRefocus = false;
this.resetFormInput();
}
},
created() { created() {
this.$nextTick(() => { this.focusOrderNoInput();
this.isFocus = true;
uni.hideKeyboard()
});
}, },
methods: { methods: {
onMoctcSubmitSuccess() {
this.pendingRefocus = true;
},
resetFormInput() {
this.daohuoForm.ta002 = '';
this.focusOrderNoInput();
},
focusOrderNoInput() {
this.isFocus = false;
this.$nextTick(() => {
setTimeout(() => {
this.isFocus = true;
uni.hideKeyboard();
}, 200);
});
},
inputCC(e){ inputCC(e){
if(e && e.detail.value) { if(e && e.detail.value) {
if(e.detail.value.includes("-")){ if(e.detail.value.includes("-")){
...@@ -100,6 +126,7 @@ export default { ...@@ -100,6 +126,7 @@ export default {
if (res.success) { if (res.success) {
if (res.data) { if (res.data) {
if(!res.data.moctes || res.data.moctes.length === 0) return this.$u.toast(i18n.t('工单已经完成领料')); if(!res.data.moctes || res.data.moctes.length === 0) return this.$u.toast(i18n.t('工单已经完成领料'));
this.isFocus = false;
uni.navigateTo({ uni.navigateTo({
url: '/pages/moctcforcreate/Info?info=' + encodeURIComponent(JSON.stringify(res.data)) url: '/pages/moctcforcreate/Info?info=' + encodeURIComponent(JSON.stringify(res.data))
}); });
......
...@@ -41,16 +41,38 @@ export default { ...@@ -41,16 +41,38 @@ export default {
bgSrc: require('@/static/images/qrcode.png'), bgSrc: require('@/static/images/qrcode.png'),
wxparams: '', wxparams: '',
isFocus: false, isFocus: false,
isDisabled: false isDisabled: false,
pendingRefocus: false
}; };
}, },
onLoad() {
uni.$on('saleckSubmitSuccess', this.onSaleckSubmitSuccess);
},
onUnload() {
uni.$off('saleckSubmitSuccess', this.onSaleckSubmitSuccess);
},
onShow() {
if (this.pendingRefocus) {
this.pendingRefocus = false;
this.wxparams = '';
this.focusScanInput();
}
},
created() { created() {
this.$nextTick(() => { this.focusScanInput();
this.isFocus = true;
uni.hideKeyboard()
});
}, },
methods: { methods: {
onSaleckSubmitSuccess() {
this.pendingRefocus = true;
},
focusScanInput() {
this.isFocus = false;
this.$nextTick(() => {
setTimeout(() => {
this.isFocus = true;
}, 200);
});
},
handleConfirm(e) { handleConfirm(e) {
e && this.getPlnr(e); e && this.getPlnr(e);
// uni.navigateTo({ // uni.navigateTo({
...@@ -64,6 +86,7 @@ export default { ...@@ -64,6 +86,7 @@ export default {
}) })
.then(({data, errorMessage}) => { .then(({data, errorMessage}) => {
if (data && data.applyNo) { if (data && data.applyNo) {
this.isFocus = false;
uni.navigateTo({ uni.navigateTo({
url: `/pages/saleck/saleckList?order=${VBELN}` url: `/pages/saleck/saleckList?order=${VBELN}`
}); });
......
...@@ -173,10 +173,10 @@ export default { ...@@ -173,10 +173,10 @@ export default {
}).then(res => { }).then(res => {
if (res.success) { if (res.success) {
this.$u.toast(i18n.t('提交成功')) this.$u.toast(i18n.t('提交成功'))
setTimeout(()=>{ setTimeout(() => {
uni.$emit('saleckSubmitSuccess')
uni.navigateBack() uni.navigateBack()
}, 300) }, 300)
} }
}) })
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment