|
@@ -1,4 +1,4 @@
|
|
|
-<!-- 入库扫码 -->
|
|
|
+<!-- 出库扫码 -->
|
|
|
<template>
|
|
|
<view class="content">
|
|
|
<view class="text-area">
|
|
@@ -11,8 +11,8 @@
|
|
|
<u-icon name="edit-pen"></u-icon>手动录入
|
|
|
</view>
|
|
|
<view class="lnput" v-if="show==false">
|
|
|
- <input type="text" v-model="number_a" :placeholder="content" clearable="true" focus="true"/>
|
|
|
- <u-button type="primary" size="medium" @click="manualentry">确认录入</u-button>
|
|
|
+ <input type="text" v-model="number_a" :placeholder="content" clearable="true" focus="true" />
|
|
|
+ <u-button type="primary" size="medium" @click="manualentry" >确认录入</u-button>
|
|
|
</view>
|
|
|
<view class="" v-else>
|
|
|
<view>{{tips}}:{{number}}</view>
|
|
@@ -58,6 +58,17 @@
|
|
|
</scroll-view>
|
|
|
</view>
|
|
|
</u-popup>
|
|
|
+ <u-popup mode="bottom" v-model="show_d" :mask-close-able="false" :safe-area-inset-bottom="true">
|
|
|
+ <view class="confrim-btn">
|
|
|
+ <u-button @click="show_d = false;" style="float: left;border: none;" :hair-line="false" :plain="false">取消</u-button>
|
|
|
+ <u-button @click="container_s" style="float: right;border: none;" :hair-line="false" :plain="false">确定</u-button>
|
|
|
+ </view>
|
|
|
+ <view class="content_s">
|
|
|
+ <scroll-view scroll-y="true" style="height: 200rpx;">
|
|
|
+ {{regular}}
|
|
|
+ </scroll-view>
|
|
|
+ </view>
|
|
|
+ </u-popup>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
@@ -66,6 +77,10 @@
|
|
|
request
|
|
|
} from '../../../common/request/request'
|
|
|
require("promise.prototype.finally").shim()
|
|
|
+ var QQMapWX = require('../../../components/mi-map/qqmap-wx-jssdk.min.js')
|
|
|
+ var qqmapsdk = new QQMapWX({
|
|
|
+ key: 'LXCBZ-NNIKD-UZ64F-H6AFI-UNJLH-OCFGE'
|
|
|
+ })
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
@@ -84,6 +99,11 @@
|
|
|
show_s: false,
|
|
|
show_d: false,
|
|
|
res: '',
|
|
|
+ position: '',
|
|
|
+ point: '',
|
|
|
+ coord: '',
|
|
|
+ address: '',
|
|
|
+ addd:''
|
|
|
}
|
|
|
},
|
|
|
onBackPress(options) {
|
|
@@ -96,7 +116,7 @@
|
|
|
}
|
|
|
return true;
|
|
|
},
|
|
|
- onLaunch(){
|
|
|
+ onLaunch() {
|
|
|
uni.$on('update', data => {
|
|
|
this.lisi = data.lisi
|
|
|
console.log(this.lisi)
|
|
@@ -120,9 +140,10 @@
|
|
|
this.lisi = res.lisi
|
|
|
console.log(res.lisi)
|
|
|
})
|
|
|
+ //开始扫码
|
|
|
const innerAudioContext = uni.createInnerAudioContext();
|
|
|
innerAudioContext.autoplay = true;
|
|
|
- innerAudioContext.src = '../../../static/mp3/startscan.mp3';
|
|
|
+ innerAudioContext.src = '../../../static/mp3/start.mp3';
|
|
|
innerAudioContext.onPlay(() => {
|
|
|
console.log('开始播放');
|
|
|
});
|
|
@@ -130,62 +151,170 @@
|
|
|
console.log(res.errMsg);
|
|
|
console.log(res.errCode);
|
|
|
});
|
|
|
+ this.coord = ''
|
|
|
+ this.mounteds()
|
|
|
},
|
|
|
methods: {
|
|
|
+ mounteds() {
|
|
|
+ let that = this
|
|
|
+ uni.getLocation({
|
|
|
+ type: 'gcj02', // 返回国测局坐标
|
|
|
+ geocode: true,
|
|
|
+ success: function(res) {
|
|
|
+ console.log(res)
|
|
|
+ this.addd = res
|
|
|
+ that.tishi(that.coord, res)
|
|
|
+ },
|
|
|
+ fail: function(e) {
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: '获取地址失败, 请检查是否开启定位权限~~'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ async tishi(x, res) {
|
|
|
+ console.log(res)
|
|
|
+ let this_ = this
|
|
|
+ this_.coord = x
|
|
|
+ qqmapsdk.reverseGeocoder({
|
|
|
+ location: {
|
|
|
+ latitude: res.latitude,
|
|
|
+ longitude: res.longitude
|
|
|
+ },
|
|
|
+ success(res) {
|
|
|
+ var newCity = ''
|
|
|
+ // 取到用户的定位地址,赋值传递出去
|
|
|
+ let aress = res.result.address_component.nation + res.result.address_component.province + res.result.address_component
|
|
|
+ .city + res.result.formatted_addresses.recommend
|
|
|
+ this_.addreev(res,aress)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ async addreev(res,x) {
|
|
|
+ this.address = x
|
|
|
+ this.addd = res.result.location
|
|
|
+ console.log(this.addd)
|
|
|
+ },
|
|
|
//手动录入调用
|
|
|
manualentry() {
|
|
|
- request({
|
|
|
- url: '/storeScan/storeScanGetTyre',
|
|
|
- method: 'Post',
|
|
|
- data: {
|
|
|
- storeId: this.$store.state.storeInfo.storeId,
|
|
|
- userId: this.$store.state.storeInfo.userId,
|
|
|
- tyreNum: this.number_a
|
|
|
- }
|
|
|
- }).then(res => {
|
|
|
- console.log(res.data.code)
|
|
|
- if (res.data.code == 500) {
|
|
|
- this.$refs.repeat.show({
|
|
|
- title: '请扫描或输入正确的胎号',
|
|
|
- type: 'default',
|
|
|
- position: 'bottom'
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
- this.res = res
|
|
|
- console.log(res.data.data[0].isRegular)
|
|
|
- for (let i = 0; i < this.lisi.length; i++) {
|
|
|
- if (this.lisi[i].tireNumber == res.data.data[0].tirenumber) {
|
|
|
- this.$refs.repeat.show({
|
|
|
- title: '请勿重复录入',
|
|
|
- type: 'default',
|
|
|
- position: 'bottom'
|
|
|
- })
|
|
|
+ console.log(this.coord)
|
|
|
+ console.log(this.address)
|
|
|
+ if (this.number_a.length != 0) {
|
|
|
+ request({
|
|
|
+ url: '/storeScan/storeScanGetTyre',
|
|
|
+ method: 'Post',
|
|
|
+ data:{
|
|
|
+ storeId: this.$store.state.storeInfo.storeId,
|
|
|
+ userId: this.$store.state.storeInfo.userId,
|
|
|
+ tyreNum: this.number_a,
|
|
|
+ scanType: 2,
|
|
|
+ scanWay: 0,
|
|
|
+ longitude: this.addd.lng,
|
|
|
+ latitude: this.addd.lat,
|
|
|
+ scanAddress: this.address
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ if (res.data.code == 513) {
|
|
|
+ console.log(res.data.msg)
|
|
|
+ let name = 'regular'
|
|
|
+ this.tipss(res, name)
|
|
|
return
|
|
|
}
|
|
|
- }
|
|
|
- if (res.data.data[0].isRegular == 1) {
|
|
|
- console.log(res.data.data[0].isRegular)
|
|
|
- this.$refs.repeat.show({
|
|
|
- title: '轮胎非正规',
|
|
|
- type: 'default',
|
|
|
- position: 'bottom'
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
- this.container()
|
|
|
- console.log(this.lisi)
|
|
|
- }).catch(err => {
|
|
|
- this.$refs.repeat.show({
|
|
|
- title: "无网络,请连接网络后再试~",
|
|
|
- type: 'default',
|
|
|
- position: 'bottom'
|
|
|
+ if (res.data.code == 514) {
|
|
|
+ console.log(res.data.msg)
|
|
|
+ let name = 'nonoperating'
|
|
|
+ this.tipss(res, name)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (res.data.code == 515) {
|
|
|
+ console.log(res.data.msg)
|
|
|
+ let name = 'warehousing'
|
|
|
+ this.tipss(res, name)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (res.data.code == 517) {
|
|
|
+ console.log(res.data.msg)
|
|
|
+ let name = 'atypism'
|
|
|
+ this.tipss(res, name)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (res.data.code == 518) {
|
|
|
+ console.log(res.data.msg)
|
|
|
+ let name = 'gobeyond'
|
|
|
+ this.tipss(res, name)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (res.data.code == 519) {
|
|
|
+ console.log(res.data.msg)
|
|
|
+ let name = 'notallow'
|
|
|
+ this.tipss(res, name)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (res.data.code == 500) {
|
|
|
+ console.log(res.data.msg)
|
|
|
+ let name = 'error'
|
|
|
+ this.tipss(res, name)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (res.data.code == 0) {
|
|
|
+ console.log(res)
|
|
|
+ this.res = res
|
|
|
+ console.log(res.data.data[0].isRegular)
|
|
|
+ for (let i = 0; i < this.lisi.length; i++) {
|
|
|
+ if (this.lisi[i].tireNumber == res.data.data[0].tirenumber) {
|
|
|
+ console.log(res)
|
|
|
+ let err = {
|
|
|
+ "data": {
|
|
|
+ "msg": "请勿重复录入",
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log(err.data.msg)
|
|
|
+ let name = 'duplicateentry'
|
|
|
+ this.tipss(err, name)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.container()
|
|
|
+ }
|
|
|
+ console.log(this.lisi)
|
|
|
+ }).catch(err => {
|
|
|
+ // this.$refs.repeat.show({
|
|
|
+ // title: "网络繁忙,请稍后再试",
|
|
|
+ // type: 'default',
|
|
|
+ // position: 'bottom'
|
|
|
+ // })
|
|
|
+ console.log(err)
|
|
|
})
|
|
|
- console.log(err)
|
|
|
- })
|
|
|
- .finally(() => {
|
|
|
- // Loading.close()
|
|
|
+ .finally(() => {
|
|
|
+ // Loading.close()
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$refs.repeat.show({
|
|
|
+ title: '请输入胎号',
|
|
|
+ type: 'default',
|
|
|
+ position: 'bottom'
|
|
|
})
|
|
|
+ }
|
|
|
+ },
|
|
|
+ tipss(res, name) {
|
|
|
+ this.$refs.repeat.show({
|
|
|
+ title: res.data.msg,
|
|
|
+ type: 'default',
|
|
|
+ position: 'bottom'
|
|
|
+ })
|
|
|
+ //提示语音
|
|
|
+ const innerAudioContext = uni.createInnerAudioContext();
|
|
|
+ innerAudioContext.autoplay = true;
|
|
|
+ innerAudioContext.src = '../../../static/mp3/' + name + '.mp3';
|
|
|
+ innerAudioContext.onPlay(() => {
|
|
|
+ console.log('开始播放');
|
|
|
+ });
|
|
|
+ innerAudioContext.onError((res) => {
|
|
|
+ console.log(res.errMsg);
|
|
|
+ console.log(res.errCode);
|
|
|
+ });
|
|
|
},
|
|
|
container() {
|
|
|
this.$refs.repeat.show({
|
|
@@ -193,6 +322,17 @@
|
|
|
type: 'success',
|
|
|
position: 'bottom'
|
|
|
})
|
|
|
+ //录入成功语音
|
|
|
+ const innerAudioContext = uni.createInnerAudioContext();
|
|
|
+ innerAudioContext.autoplay = true;
|
|
|
+ innerAudioContext.src = '../../../static/mp3/entered.mp3';
|
|
|
+ innerAudioContext.onPlay(() => {
|
|
|
+ console.log('开始播放');
|
|
|
+ });
|
|
|
+ innerAudioContext.onError((res) => {
|
|
|
+ console.log(res.errMsg);
|
|
|
+ console.log(res.errCode);
|
|
|
+ });
|
|
|
console.log(this.res.data.data[0].specs)
|
|
|
this.show_s = false
|
|
|
console.log(this.show_s)
|
|
@@ -214,6 +354,7 @@
|
|
|
})
|
|
|
console.log(this.lisi)
|
|
|
},
|
|
|
+
|
|
|
//获取扫码控件
|
|
|
getScanCode(val) {
|
|
|
uni.getNetworkType({
|
|
@@ -223,9 +364,19 @@
|
|
|
if (none == 'none') {
|
|
|
uni.showToast({
|
|
|
icon: 'none',
|
|
|
- title: '无网络,请连接网络后再试~',
|
|
|
+ title: '无网络,请连接网络后再试',
|
|
|
position: "bottom"
|
|
|
})
|
|
|
+ const innerAudioContext = uni.createInnerAudioContext();
|
|
|
+ innerAudioContext.autoplay = true;
|
|
|
+ innerAudioContext.src = '../../../static/mp3/failure.mp3';
|
|
|
+ innerAudioContext.onPlay(() => {
|
|
|
+ console.log('开始播放');
|
|
|
+ });
|
|
|
+ innerAudioContext.onError((res) => {
|
|
|
+ console.log(res.errMsg);
|
|
|
+ console.log(res.errCode);
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
});
|
|
@@ -238,53 +389,81 @@
|
|
|
data: {
|
|
|
storeId: this.$store.state.storeInfo.storeId,
|
|
|
userId: this.$store.state.storeInfo.userId,
|
|
|
- tyreNum: this.number_s
|
|
|
+ tyreNum: this.number_s,
|
|
|
+ scanType: 2,
|
|
|
+ scanWay: 1,
|
|
|
+ longitude: this.addd.lng,
|
|
|
+ latitude: this.addd.lat,
|
|
|
+ scanAddress: this.address
|
|
|
}
|
|
|
}).then(res => {
|
|
|
this.res_s = res
|
|
|
this.tips = "胎号"
|
|
|
- for (let i = 0; i < this.lisi.length; i++) {
|
|
|
- if (this.lisi[i].tireNumber == res.data.data[0].tirenumber) {
|
|
|
- this.$refs.repeat.show({
|
|
|
- title: '请勿重复扫码',
|
|
|
- type: 'default',
|
|
|
- position: 'bottom'
|
|
|
- })
|
|
|
- this.repeated()
|
|
|
- return
|
|
|
- }
|
|
|
+ if (res.data.code == 513) {
|
|
|
+ console.log(res.data.msg)
|
|
|
+ let name = 'regular'
|
|
|
+ this.tipss(res, name)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (res.data.code == 514) {
|
|
|
+ console.log(res.data.msg)
|
|
|
+ let name = 'nonoperating'
|
|
|
+ this.tipss(res, name)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (res.data.code == 515) {
|
|
|
+ console.log(res.data.msg)
|
|
|
+ let name = 'warehousing'
|
|
|
+ this.tipss(res, name)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (res.data.code == 517) {
|
|
|
+ console.log(res.data.msg)
|
|
|
+ let name = 'atypism'
|
|
|
+ this.tipss(res, name)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (res.data.code == 518) {
|
|
|
+ console.log(res.data.msg)
|
|
|
+ let name = 'gobeyond'
|
|
|
+ this.tipss(res, name)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (res.data.code == 519) {
|
|
|
+ console.log(res.data.msg)
|
|
|
+ let name = 'notallow'
|
|
|
+ this.tipss(res, name)
|
|
|
+ return
|
|
|
}
|
|
|
if (res.data.code == 500) {
|
|
|
- this.$refs.repeat.show({
|
|
|
- title: '请扫描或输入正确的胎号',
|
|
|
- type: 'default',
|
|
|
- position: 'bottom'
|
|
|
- })
|
|
|
- const innerAudioContext = uni.createInnerAudioContext();
|
|
|
- innerAudioContext.autoplay = true;
|
|
|
- innerAudioContext.src = '../../../static/mp3/scanfailed.mp3';
|
|
|
- innerAudioContext.onPlay(() => {
|
|
|
- console.log('开始播放');
|
|
|
- });
|
|
|
- innerAudioContext.onError((res) => {
|
|
|
- console.log(res.errMsg);
|
|
|
- console.log(res.errCode);
|
|
|
- });
|
|
|
+ console.log(res.data.msg)
|
|
|
+ let name = 'error'
|
|
|
+ this.tipss(res, name)
|
|
|
return
|
|
|
}
|
|
|
- if (res.data.data[0].isRegular == 1) {
|
|
|
+ if (res.data.code == 0) {
|
|
|
+ console.log(res)
|
|
|
+ this.res = res
|
|
|
console.log(res.data.data[0].isRegular)
|
|
|
- this.$refs.repeat.show({
|
|
|
- title: '轮胎非正规',
|
|
|
- type: 'default',
|
|
|
- position: 'bottom'
|
|
|
- })
|
|
|
- return
|
|
|
+ for (let i = 0; i < this.lisi.length; i++) {
|
|
|
+ if (this.lisi[i].tireNumber == res.data.data[0].tirenumber) {
|
|
|
+ console.log(res)
|
|
|
+ let err = {
|
|
|
+ "data": {
|
|
|
+ "msg": "请勿重复扫码",
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log(err.data.msg)
|
|
|
+ let name = 'repeatcode'
|
|
|
+ this.tipss(err, name)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.container_s()
|
|
|
}
|
|
|
- this.container_s()
|
|
|
- console.log(this.lisi)
|
|
|
+ // console.log(this.lisi)
|
|
|
}).catch(err => {
|
|
|
- if (code == 400) {
|
|
|
+ if (err.code == 400) {//谁给我删了......
|
|
|
this.$refs.repeat.show({
|
|
|
title: "无网络",
|
|
|
type: 'default',
|
|
@@ -357,7 +536,7 @@
|
|
|
} else {
|
|
|
this.$u.route({
|
|
|
type: 'redirectTo',
|
|
|
- url: 'pages/home/Scan-code-out/index'
|
|
|
+ url: 'pages/home/Scan-code-in/index'
|
|
|
})
|
|
|
uni.$emit('update', {
|
|
|
materialList: this.lisi
|
|
@@ -499,4 +678,4 @@
|
|
|
width: 100%;
|
|
|
background-color: #0095FF;
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|