|
@@ -1,7 +1,8 @@
|
|
|
import { Component, OnInit } from '@angular/core';
|
|
|
import { UserData } from '../../providers/user-data';
|
|
|
-import {Keyboard} from "@ionic-native/keyboard/ngx";
|
|
|
+import { Keyboard } from "@ionic-native/keyboard/ngx";
|
|
|
import { commonService } from '../../providers/common.service'
|
|
|
+import { BarcodeScanner } from '@ionic-native/barcode-scanner/ngx';
|
|
|
|
|
|
@Component({
|
|
|
selector: 'app-store-sample-pending',
|
|
@@ -14,9 +15,10 @@ export class StoreSamplePendingPage implements OnInit {
|
|
|
current: number = 1
|
|
|
size: number = 10
|
|
|
constructor(
|
|
|
- private keyboard: Keyboard,
|
|
|
- public commonService: commonService,
|
|
|
- public userData: UserData) { }
|
|
|
+ private keyboard: Keyboard,
|
|
|
+ private barcodeScanner: BarcodeScanner,
|
|
|
+ public commonService: commonService,
|
|
|
+ public userData: UserData) { }
|
|
|
scanCode: string
|
|
|
ngOnInit() {
|
|
|
|
|
@@ -34,10 +36,10 @@ export class StoreSamplePendingPage implements OnInit {
|
|
|
async getList() {
|
|
|
let data = await this.userData.getStoreSamplePendingList(this.current, this.size)
|
|
|
this.storeSampleLists = data
|
|
|
- for(let i of this.storeSampleLists) {
|
|
|
- i['lendName'] = i.lend ? '已借出': '未借出'
|
|
|
- i['statusName'] = i.active ? '正常': '已销毁'
|
|
|
- if(i["pictures"] && i["pictures"].length!==0) {
|
|
|
+ for (let i of this.storeSampleLists) {
|
|
|
+ i['lendName'] = i.lend ? '已借出' : '未借出'
|
|
|
+ i['statusName'] = i.active ? '正常' : '已销毁'
|
|
|
+ if (i["pictures"] && i["pictures"].length !== 0) {
|
|
|
i["imgsrc"] = i["pictures"][0].smallPicture
|
|
|
}
|
|
|
}
|
|
@@ -50,10 +52,10 @@ export class StoreSamplePendingPage implements OnInit {
|
|
|
// 通过code获取仓库样品详情
|
|
|
async getStoreSampleDetail() {
|
|
|
this.keyboard.hide()
|
|
|
- let data = await this.userData.getStoreSampleDetail(this.scanCode)
|
|
|
- let code = JSON.parse(data).data.code
|
|
|
- await this.userData.changeShelfLend(code)
|
|
|
- this.getList();
|
|
|
+ let data = await this.userData.getStoreSampleDetail(this.scanCode)
|
|
|
+ let code = JSON.parse(data).data.code
|
|
|
+ await this.userData.changeShelfLend(code)
|
|
|
+ this.getList();
|
|
|
}
|
|
|
|
|
|
// 备货完成
|
|
@@ -61,5 +63,13 @@ export class StoreSamplePendingPage implements OnInit {
|
|
|
await this.userData.changeShelfLend(storeSample.code)
|
|
|
this.getList()
|
|
|
}
|
|
|
+
|
|
|
+ qrscan() {
|
|
|
+ this.barcodeScanner.scan().then(barcodeData => {
|
|
|
+ this.scanCode = barcodeData.text
|
|
|
+ }).catch(err => {
|
|
|
+ console.log('Error', err);
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
|