Commit 2185883b by wangyalan-git

增加手动填写物品条形码出库

parent 07c0e9c2
...@@ -3,9 +3,45 @@ import App from './App.vue' ...@@ -3,9 +3,45 @@ import App from './App.vue'
import router from './router' import router from './router'
import store from './store' import store from './store'
import '@/assets/less/common.less' import '@/assets/less/common.less'
import 'vant/lib/icon/local.css'// 引用字体css import 'vant/lib/icon/local.css' // 引用字体css
import MyNavBar from '@/components/NavBar' import MyNavBar from '@/components/NavBar'
import { Toast, Dialog, Col, Row, DatetimePicker, Button, PullRefresh, DropdownMenu, DropdownItem, Tabbar, TabbarItem, Cell, CellGroup, Popup, Search, Swipe, SwipeItem, Grid, GridItem, Image, Tab, Tabs, NavBar, Icon, List, Card, Checkbox, CheckboxGroup, Stepper, Sticky, Divider, RadioGroup, Radio, Field } from 'vant' import {
Toast,
Dialog,
Col,
Row,
DatetimePicker,
Button,
PullRefresh,
DropdownMenu,
DropdownItem,
Tabbar,
TabbarItem,
Cell,
CellGroup,
Popup,
Search,
Swipe,
SwipeItem,
Grid,
GridItem,
Image,
Tab,
Tabs,
NavBar,
Icon,
List,
Card,
Checkbox,
CheckboxGroup,
Stepper,
Sticky,
Divider,
RadioGroup,
Radio,
Field,
Form
} from 'vant'
Vue.component('navbar', MyNavBar) Vue.component('navbar', MyNavBar)
Vue.config.productionTip = false Vue.config.productionTip = false
Vue.use(PullRefresh) Vue.use(PullRefresh)
...@@ -36,6 +72,7 @@ Vue.use(Divider) ...@@ -36,6 +72,7 @@ Vue.use(Divider)
Vue.use(Field) Vue.use(Field)
Vue.use(DropdownMenu) Vue.use(DropdownMenu)
Vue.use(DropdownItem) Vue.use(DropdownItem)
Vue.use(Form)
new Vue({ new Vue({
router, router,
store, store,
......
...@@ -7,24 +7,27 @@ import { Toast } from 'vant' ...@@ -7,24 +7,27 @@ import { Toast } from 'vant'
const service = axios.create({ const service = axios.create({
// baseURL: 'http://192.168.31.138:8201/mall-portal', // baseURL: 'http://192.168.31.138:8201/mall-portal',
// baseURL: 'http://vankemanage.jsonpro.cn/mall-portal', // baseURL: 'http://vankemanage.jsonpro.cn/mall-portal',
// baseURL: 'http://10.27.33.4:8201/mall-portal', // baseURL: 'http://10.27.33.5:8201/mall-portal',
baseURL: 'https://vv9.vanke.com:9443/mall-portal', baseURL: 'https://vv9.vanke.com:9443/mall-portal',
//注意 当前跨域问题 是同源策略解决。即前端地址 和服务端地址在同一域名下。 所以解决问题需要重这方面思考 // 注意 当前跨域问题 是同源策略解决。即前端地址 和服务端地址在同一域名下。 所以解决问题需要重这方面思考
timeout: 60000 // 请求超时时间 timeout: 60000 // 请求超时时间
}) })
// request拦截器 // request拦截器
service.interceptors.request.use(config => { service.interceptors.request.use(
config => {
/* eslint-disable */ /* eslint-disable */
if (store.getters.token) { if (store.getters.token) {
config.headers['Authorization'] = store.getters.token config.headers["Authorization"] = store.getters.token;
} }
return config return config;
}, error => { },
error => {
// Do something with request error // Do something with request error
console.log(error) console.log(error);
Promise.reject(error) Promise.reject(error);
}) }
);
// respone拦截器 // respone拦截器
service.interceptors.response.use( service.interceptors.response.use(
...@@ -32,31 +35,31 @@ service.interceptors.response.use( ...@@ -32,31 +35,31 @@ service.interceptors.response.use(
/** /**
* code为非200是抛错 可结合自己业务进行修改 * code为非200是抛错 可结合自己业务进行修改
*/ */
const res = response.data const res = response.data;
// debugger // debugger
if (res.code !== 200) { if (res.code !== 200) {
// 401:未登录; // 401:未登录;
if (res.code === 401) { if (res.code === 401) {
store.dispatch('LogOut').then(() => { store.dispatch("LogOut").then(() => {
router.replace({ router.replace({
name: 'login', name: "login",
query: { redirect: router.currentRoute.fullPath } // 登录后再跳回此页面时要做的配置 query: { redirect: router.currentRoute.fullPath } // 登录后再跳回此页面时要做的配置
}) });
}) });
} else { } else {
Toast(res.message) Toast(res.message);
} }
return Promise.reject(res) return Promise.reject(res);
} else { } else {
return response.data return response.data;
} }
}, },
error => { error => {
console.log('err' + error) console.log("err" + error);
// Toast.text(error.message || '服务器忙,请稍后再试!') // Toast.text(error.message || '服务器忙,请稍后再试!')
Toast('服务器忙,请稍后再试!') Toast("服务器忙,请稍后再试!");
return Promise.reject(error) return Promise.reject(error);
} }
) );
export default service export default service;
...@@ -45,16 +45,20 @@ ...@@ -45,16 +45,20 @@
</div> </div>
<van-dialog <van-dialog
v-model="barCodeModal" v-model="barCodeModal"
title="标题" title="提示"
show-cancel-button show-cancel-button
confirm-button-color="#4583f3" :before-close="onBeforeClose"
@confirm="goBarCode" @confirm="handleConfirm"
> >
<van-form ref="myform">
<van-field <van-field
v-model="barCode" v-model="barCode"
name="barCode"
label="物品条形码" label="物品条形码"
placeholder="请输入物品条形码" placeholder="请输入物品条形码"
:rules="[{ required: true, message: '请输入物品条形码' }]"
/> />
</van-form>
</van-dialog> </van-dialog>
</div> </div>
</template> </template>
...@@ -93,6 +97,17 @@ export default { ...@@ -93,6 +97,17 @@ export default {
} }
this.barCodeModal = !this.barCodeModal; this.barCodeModal = !this.barCodeModal;
}, },
onBeforeClose(action, done) {
if (action === "confirm") {
return done(false);
} else {
// 重置表单校验
this.$refs["myform"].resetValidation("barCode");
this.barCode = null;
return done();
}
},
init() { init() {
window.qing.config({ window.qing.config({
debug: false, debug: false,
...@@ -126,13 +141,13 @@ export default { ...@@ -126,13 +141,13 @@ export default {
}, },
}); });
}, },
goBarCode() { // 实例弹窗确认
handleConfirm() {
const that = this; const that = this;
if (!this.barCode) { this.$refs["myform"]
this.$toast.fail("请手动填写物品条形码"); .validate()
return; .then(() => {
} getGoodsInfo({ barCode: that.barCode }).then((res) => {
getGoodsInfo({ barCode: this.barCode }).then((res) => {
if (!res.data) { if (!res.data) {
that.$toast("该物品暂未入库"); that.$toast("该物品暂未入库");
return; return;
...@@ -153,9 +168,14 @@ export default { ...@@ -153,9 +168,14 @@ export default {
} else { } else {
that.list[isExist].goodsNum = that.list[isExist].goodsNum + 1; that.list[isExist].goodsNum = that.list[isExist].goodsNum + 1;
} }
that.barCode = null;
that.barCodeModal = false;
console.log("要出库的商品", that.list); console.log("要出库的商品", that.list);
}); });
})
.catch(() => {});
}, },
// 物品条形码扫描 // 物品条形码扫描
scanBarCode() { scanBarCode() {
/* eslint-disable */ /* eslint-disable */
......
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