|
@@ -37,6 +37,10 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+ import {
|
|
|
+ mapState,
|
|
|
+ mapMutations,
|
|
|
+ } from 'vuex'
|
|
|
import { getVehicleInfoByVin, scanVinLog } from '@/api/car.js'
|
|
|
export default {
|
|
|
data() {
|
|
@@ -47,6 +51,7 @@
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
+ ...mapState(['hasLogin','vuex_vinScanNums']),
|
|
|
userInfo(){
|
|
|
return this.$store.state.vuex_userInfo
|
|
|
},
|
|
@@ -57,6 +62,21 @@
|
|
|
onLoad(opts) {
|
|
|
this.verifyCode = opts.verifyCode || ''
|
|
|
this.vinImg = opts.filePath || ''
|
|
|
+
|
|
|
+ // 不是手动输入
|
|
|
+ if(opts.type == 'carmen'){
|
|
|
+ // 游客需要记录扫描记录
|
|
|
+ if(this.userInfo.identifyType=='VISITOR' && this.verifyCode){
|
|
|
+ this.creatRecord(null)
|
|
|
+ }
|
|
|
+ // 如果识别返回空
|
|
|
+ if(!this.verifyCode){
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: 'VIN识别失败,请重新扫描或手动输入VIN'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
// 分享
|
|
|
onShareAppMessage(e){
|
|
@@ -70,9 +90,30 @@
|
|
|
methods: {
|
|
|
// 重新扫描
|
|
|
toScan(){
|
|
|
- uni.redirectTo({
|
|
|
- url: "/pages/scan-frame/scan-frame"
|
|
|
- })
|
|
|
+ if(this.userInfo.identifyType=='VISITOR'){
|
|
|
+ if(this.vuex_vinScanNums < 10){
|
|
|
+ uni.redirectTo({
|
|
|
+ url: "/pages/scan-frame/scan-frame"
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '个人用户扫描VIN限10次/天,您的次数已用完!',
|
|
|
+ confirmText: '去认证',
|
|
|
+ success(res) {
|
|
|
+ if(res.confirm) {
|
|
|
+ uni.redirectTo({
|
|
|
+ url: '/pages/storeManage/storeAuth'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ uni.redirectTo({
|
|
|
+ url: "/pages/scan-frame/scan-frame"
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
// 复制
|
|
|
toCopy(){
|
|
@@ -91,17 +132,18 @@
|
|
|
creatRecord(data){
|
|
|
scanVinLog({
|
|
|
vinCode: this.verifyCode.toUpperCase(),
|
|
|
- brandName: data.brand_name,
|
|
|
- brandId: data.brand_id,
|
|
|
- modelName: data.model_name,
|
|
|
- modelId:data.model_id,
|
|
|
- modelInfo: data.text,
|
|
|
- seriesId:data.series_id,
|
|
|
- seriesName:data.series_name,
|
|
|
- subId:data.sub_id,
|
|
|
- subName:data.sub_name,
|
|
|
- icon: data.icon,
|
|
|
- year: data.year
|
|
|
+ brandName: data?data.brand_name:'',
|
|
|
+ brandId: data?data.brand_id:'',
|
|
|
+ modelName: data?data.model_name:'',
|
|
|
+ modelId:data?data.model_id:'',
|
|
|
+ modelInfo: data?data.text:'',
|
|
|
+ seriesId:data?data.series_id:'',
|
|
|
+ seriesName:data?data.series_name:'',
|
|
|
+ subId:data?data.sub_id:'',
|
|
|
+ subName:data?data.sub_name:'',
|
|
|
+ icon: data?data.icon:'',
|
|
|
+ year: data?data.year:'',
|
|
|
+ identifyType: this.userInfo.identifyType
|
|
|
}).then(res => {
|
|
|
console.log(res)
|
|
|
uni.$emit("refashHome")
|
|
@@ -124,8 +166,10 @@
|
|
|
vin:vinNo
|
|
|
}).then(res => {
|
|
|
if (res.status == 200&&res.data) {
|
|
|
- // 生成vin记录
|
|
|
- _this.creatRecord(res.data)
|
|
|
+ // 非游客,生成vin记录
|
|
|
+ if(_this.userInfo.identifyType=='EMPLOYEE'){
|
|
|
+ _this.creatRecord(res.data)
|
|
|
+ }
|
|
|
// 打开选择配件页面
|
|
|
uni.redirectTo({
|
|
|
url: "/pages/digitalShelf/choosePart?vinNumber="+vinNo+"&carList="+encodeURIComponent(JSON.stringify(res.data))
|