Commit 25214db1 by 肖康

仓库拍照

parents
# dependencies
**/node_modules
.idea
.DS_Store
# misc
npm-debug.log*
yarn-error.log
yarn.lock
package-lock.json
*bak
# visual studio code
.vscode
.history
*.log
functions/*
.temp/**
.eslintcache
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": []
}
const g = typeof global !== 'undefined' ? global : self;
g.appXAppJson = {
"app": {
"$homepage": "pages/index/index"
}
};
if(!self.Map || !self.Set || !self.Symbol) {
importScripts('https://gw.alipayobjects.com/as/g/appx_release/deps/1.0.3/es6-set-map-symbol.js');
}
\ No newline at end of file
require('@alipay/appx-compiler/lib/sjsEnvInit');
require('./config$');
require('../../pages/index/index?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
require('../../pages/list/list?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
require('../../pages/detail/detail?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
if(!self.__appxInited) {
self.__appxInited = 1;
require('./config$');
if( navigator.userAgent && (navigator.userAgent.indexOf('LyraVM') > 0 || navigator.userAgent.indexOf('AlipayIDE') > 0) ) {
var AFAppX = self.AFAppX.getAppContext ? self.AFAppX.getAppContext().AFAppX : self.AFAppX;
} else {
importScripts('https://appx/af-appx.worker.min.js');
var AFAppX = self.AFAppX;
}
self.getCurrentPages = AFAppX.getCurrentPages;
self.getApp = AFAppX.getApp;
self.Page = AFAppX.Page;
self.App = AFAppX.App;
self.my = AFAppX.bridge || AFAppX.abridge;
self.abridge = self.my;
self.Component = AFAppX.WorkerComponent || function(){};
self.$global = AFAppX.$global;
self.requirePlugin = AFAppX.requirePlugin;
if(AFAppX.registerApp) {
AFAppX.registerApp({
appJSON: appXAppJson,
});
}
function success() {
require('../../app');
require('../../pages/index/index?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
require('../../pages/list/list?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
require('../../pages/detail/detail?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
}
self.bootstrapApp ? self.bootstrapApp({ success }) : success();
}
\ No newline at end of file
const g = typeof global !== 'undefined' ? global : self;
g.appXAppJson = {
"app": {
"$homepage": "pages/index/index"
}
};
if(!self.Map || !self.Set || !self.Symbol) {
importScripts('https://gw.alipayobjects.com/as/g/appx_release/deps/1.0.3/es6-set-map-symbol.js');
}
importScripts(`https://appx/af-appx.worker.min.js`);
require('@alipay/appx-compiler/lib/sjsEnvInit');
require('./config$');
require('../../pages/index/index?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
require('../../pages/list/list?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
require('../../pages/detail/detail?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
const host = 'http://www.photo.com:8000';//开发环境
//const host = '172.18.137.41:8001';//线上环境
const axios = ({ method = 'GET', url, data = {}, isLoading = true }) => {
let url_ = host + url;
isLoading &&
dd.showLoading({
content: '加载中...',
});
return new Promise((resolve, reject) => {
dd.httpRequest({
url: url_,
method: method,
data: data,
success: function (res) {
isLoading && dd.hideLoading();
resolve(res)
},
fail: function (err) {
isLoading && dd.hideLoading();
dd.showToast({
type: 'fail',
content: '服务器异常'
});
reject('服务器异常')
}
});
})
}
export default axios
\ No newline at end of file
.header{
padding:0 10rpx ;
}
.header .box-h{
height:80rpx;
display: flex;
align-items: center;
border-bottom:1rpx solid #ccc;
}
App({
onLaunch(options) {
// 第一次打开
// options.query == {number:1}
console.info('App onLaunch');
},
onShow(options) {
// 从后台被 scheme 重新打开
// options.query == {number:1}
},
personName: "仓库管理员"
});
{
"pages": [
"pages/index/index",
"pages/list/list",
"pages/detail/detail"
],
"window": {
"defaultTitle": "仓库拍照扫码系统"
}
}
.list-box{
padding:10rpx 30rpx;
display: flex;
align-items: center;
}
.list-box .t2{
flex:2;
}
.list-box input{
border:1px solid #ccc;
flex:2;
height:60rpx;
border-radius: 10rpx;
background: #f3f3f3;
}
.list-box2 input{
background:rgba(255,255,255,0);
}
.list-box .tl{
flex:1;
}
.list-box view{
flex:1;
height:60rpx;
line-height: 60rpx;
text-align: center;
cursor: pointer;
background: #319cd8;
border-radius: 10rpx;
color:#fff;
margin-left: 10rpx;
}
.list-box2 view{
background: none;
}
.detail-list{
padding:30rpx;
}
.detail-list .group{
border-bottom:1px solid #ccc;
font-size: 28rpx;
}
.detail-list .group.d{
background: yellow
}
.detail-list .group.y{
background: green;
}
.detail-list .group .g-t{
height:40rpx;
line-height: 40rpx;
}
.detail-list .group .g-c{
display: flex;
}
.detail-list .group .g-c-l{
flex:2;
height:80rpx;
line-height: 80rpx;
}
.detail-list .group .g-c-r view{
height:40rpx;
line-height: 40rpx;
text-align: left;
}
.detail-list .group .g-c-r{
flex:1;
text-align: center;
}
.detail-list .group .g-b{
height:110rpx;
}
.detail-list .group .g-b .imgs{
width:100rpx;
height:100rpx;
margin-right: 20rpx;
float: left;
}
\ No newline at end of file
<include src="../public/header/header.axml"/>
<view class="list-box">
<text>出库单号:</text>
<input onInput="bindKeyInput" value="{{inputValue}}" disabled="true"/>
<view onTap="submitGo">整单提交</view>
</view>
<view class="list-box list-box2">
<text class="tl">明细扫码:</text>
<text onTap="saoma" class="t2">
<input placeholder="点击输入框扫码" disabled="true"/>
</text>
<view ></view>
</view>
<view class="detail-list">
<view hidden="{{item.order_info.isShow ? false : true}}" class="group {{(item.order_info.scanqty==0)?'':(item.order_info.qty==item.order_info.scanqty)?'y':'d'}}" a:for="{{list}}">
<view class="g-t">
{{item.order_info.materialname}}
</view>
<view class="g-c">
<view class="g-c-l">
{{item.order_info.brand }}
</view>
<view class="g-c-r">
<view>数量:{{item.order_info.qty}}</view>
<view>已扫描:{{item.order_info.scanqty}}</view>
</view>
</view>
<view class="g-b" >
<image src="{{item.image_src}}" class="imgs" a:for="{{item.order_info.order_image_info}}"/>
</view>
</view>
</view>
\ No newline at end of file
import axios from '../../api'
Page({
data: {
inputValue: "",
inputValue2: "",
detailId: "",
personName: "",
list: [],
detailImages: []
},
onLoad(query) {
// 页面加载
this.setData({
inputValue: query.data
})
this.getDateList()
},
onReady() {
// 页面加载完成
this.setData({
personName: getApp().personName
})
},
getDateList() {
axios({
url: "/photo_taking/get_order_info/" + this.data.inputValue
}).then(res => {
res.data.data.forEach((item) => {
item.order_info.isShow = 1
});
this.setData({
list: res.data.data
})
})
},
getSaoMaId(code) {
axios({
url: "/photo_taking/scan_order_detail/" + this.data.inputValue + "/" + code
}).then(res => {
//请求得到的ID值
let detail_id = res.data.data;
this.data.list.forEach((item) => {
if (item.order_info.id == detail_id) {
item.order_info.isShow = 1
} else {
item.order_info.isShow = 0
}
});
this.setData({
list: this.data.list,
detailId: detail_id
})
this.subMxActionShee()
}).catch(err=>{
console.log(err)
})
},
saoma() {
dd.scan({
type: 'qr',
success: (res) => {
let code_=encodeURI(res.code)
this.setData({
inputValue2: code_
});
this.getSaoMaId(code_)
}
});
},
clear() {
//提交成功 取消
this.data.list.forEach((item) => {
item.order_info.isShow = 1
});
this.setData({
inputValue2: "",
detailImages: "",
list: this.data.list
});
},
submitDetail() {
console.log(
{
id: this.data.detailId,
scan_str: this.data.inputValue2,
image_src: (this.data.detailImages.join(","))
}
)
axios({
url: "/photo_taking/add_order_image",
method: "POST",
data: {
id: this.data.detailId,
scan_str: this.data.inputValue2,
image_src: (this.data.detailImages.join(","))
}
}).then(res => {
if (res.code == 0) {
console.log(res)
dd.showToast({
type: 'success',
content: '扫码明细提交成功',
duration: 3000
});
//提交成功
this.clear();
this.getDateList();
}
})
},
subMxActionShee() {
//提交明细
dd.showActionSheet({
items: ['提交', '拍照'],
cancelButtonText: '取消',
success: (res) => {
if (res.index == 0) {
this.submitDetail()
} else if (res.index == 1) {
//拍照
dd.chooseImage({
count: 10,
success: (res) => {
console.log(res.filePaths)
this.setData({
detailImages: [...this.data.detailImages, ...res.filePaths]
});
console.log(this.data.detailImages)
this.subMxActionShee();
},
});
} else {
this.clear()
}
}
});
},
bindKeyInput(e) {
this.setData({
inputValue: e.detail.value,
});
},
bindKeyInput2(e) {
this.setData({
inputValue2: e.detail.value,
});
},
submitGo() {
//提交
axios({
url: "/photo_taking/submit_order/" + this.data.inputValue
}).then(res => {
if (res.code == 0) {
dd.showToast({
type: 'success',
content: '整单提交成功',
duration: 3000
});
setTimeout(() => {
dd.navigateTo({
url: '/pages/index/index'
})
}, 500)
} else {
dd.showToast({
type: 'fail',
content: res.data,
duration: 3000
});
}
})
},
onShareAppMessage() {
// 返回自定义分享信息
return {
title: '仓库拍照扫码系统',
desc: '猎芯网内部使用',
path: 'pages/index/index',
};
},
});
{}
\ No newline at end of file
.store-box{
padding:30rpx;
padding-top: 300rpx;
}
.saoma-btn{
margin:0 auto;
width:400rpx;
height:200rpx;
border:1rpx solid #ccc;
background: #f3f3f3;
border-radius: 10rpx;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
font-size:32rpx;
}
\ No newline at end of file
<include src="../public/header/header.axml"/>
<view class="store-box">
<view class="saoma-btn" onTap="gotoList">
扫码拍照
</view>
</view>
Page({
data: {
page:1,
personName:""
},
onLoad(query) {
// 页面加载
console.info(`Page onLoad with query: ${JSON.stringify(query)}`);
},
onReady() {
// 页面加载完成
this.setData({
personName: getApp().personName
})
},
gotoList(){
dd.navigateTo({
url: '/pages/list/list'
})
},
onShow() {
// 页面显示
},
onHide() {
// 页面隐藏
},
onUnload() {
// 页面被关闭
},
onTitleClick() {
// 标题被点击
},
onPullDownRefresh() {
// 页面被下拉
},
onReachBottom() {
// 页面被拉到底部
},
onShareAppMessage() {
// 返回自定义分享信息
return {
title: '仓库拍照扫码系统',
desc: '猎芯网内部使用',
path: 'pages/index/index',
};
},
});
{}
\ No newline at end of file
.list-box{
padding:30rpx;
display: flex;
align-items: center;
}
.list-box input{
border:1px solid #ccc;
height:60rpx;
border-radius: 10rpx;
}
.list-box .inputbox{
flex:2;
}
.list-box text{
flex:1;
}
.list-box .bl{
flex:1;
height:60rpx;
line-height: 60rpx;
text-align: center;
cursor: pointer;
background: #319cd8;
border-radius: 10rpx;
color:#fff;
margin-left: 10rpx;
}
\ No newline at end of file
<include src="../public/header/header.axml"/>
<view class="list-box">
<text>出库单号:</text>
<view class="inputbox" onTap="saoma">
<input placeholder="点击输入框扫码" onInput="bindKeyInput"/>
</view>
<view class="bl" onTap="gotoDetail">锁定</view>
</view>
\ No newline at end of file
Page({
data: {
inputValue: "",
personName: ""
},
onLoad(query) {
// 页面加载
console.info(`Page onLoad with query: ${JSON.stringify(query)}`);
},
onReady() {
// 页面加载完成
this.setData({
personName: getApp().personName
})
},
saoma() {
dd.scan({
type: 'bar',
success: (res) => {
this.setData({
inputValue: (res.code.split("|")[0]),
});
this.gotoDetail()
},
});
},
bindKeyInput(e) {
this.setData({
inputValue: e.detail.value,
});
},
gotoDetail() {
let val = this.data.inputValue
if (val) {
dd.navigateTo({
url: '/pages/detail/detail?data=' + this.data.inputValue
})
} else {
dd.showToast({
type: 'fail',
content: '单号不能为空',
duration: 3000
});
}
},
onShow() {
// 页面显示
},
onHide() {
// 页面隐藏
},
onUnload() {
// 页面被关闭
},
onTitleClick() {
// 标题被点击
},
onPullDownRefresh() {
// 页面被下拉
},
onReachBottom() {
// 页面被拉到底部
},
onShareAppMessage() {
// 返回自定义分享信息
return {
title: '仓库拍照扫码系统',
desc: '猎芯网内部使用',
path: 'pages/index/index',
};
},
});
{}
\ No newline at end of file
<view class="header">
<view class="box-h">
当前操作人员:{{personName}}
</view>
</view>
\ No newline at end of file
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 sign in to comment