commit
5706d00d5d
1043 changed files with 182257 additions and 0 deletions
@ -0,0 +1,70 @@ |
|||||
|
<script setup lang="ts"> |
||||
|
import { |
||||
|
onLaunch, |
||||
|
onShow, |
||||
|
onHide |
||||
|
} from '@dcloudio/uni-app' |
||||
|
import { |
||||
|
getCurrentInstance |
||||
|
} from 'vue' |
||||
|
import { |
||||
|
getAccessToken |
||||
|
} from '@/utils/auth' |
||||
|
const { proxy } = getCurrentInstance() |
||||
|
|
||||
|
import { storeToRefs } from 'pinia' |
||||
|
import { useCountStore } from '@/store' |
||||
|
|
||||
|
|
||||
|
// 获取自定义的store |
||||
|
const store = useCountStore() |
||||
|
|
||||
|
onLaunch(async () => { |
||||
|
// #ifdef MP-WEIXIN |
||||
|
if (uni.canIUse('getUpdateManager')) { |
||||
|
const updateManager = uni.getUpdateManager() |
||||
|
updateManager.onCheckForUpdate(function (res) { |
||||
|
if (res.hasUpdate) { |
||||
|
updateManager.onUpdateReady(function () { |
||||
|
uni.showModal({ |
||||
|
title: '更新提示', |
||||
|
content: '新版本已经准备好,是否重启应用?', |
||||
|
success: function (res) { |
||||
|
if (res.confirm) { |
||||
|
updateManager.applyUpdate() |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
updateManager.onUpdateFailed(function () { |
||||
|
uni.showModal({ |
||||
|
title: '已经有新版本了哟~', |
||||
|
content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~' |
||||
|
}) |
||||
|
}) |
||||
|
} |
||||
|
}) |
||||
|
} else { |
||||
|
uni.showModal({ |
||||
|
title: '提示', |
||||
|
content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。' |
||||
|
}) |
||||
|
} |
||||
|
// #endif |
||||
|
if (getAccessToken()) { |
||||
|
await store.GetPermissionInfo().then(res => { |
||||
|
}).catch(() => { }) |
||||
|
await store.GetInfo().then(res => { |
||||
|
}).catch(() => { }) |
||||
|
} |
||||
|
// 解决onLaunch和onLoad异步问题 |
||||
|
proxy.$isResolve(); |
||||
|
}) |
||||
|
onShow(() => { |
||||
|
}) |
||||
|
onHide(() => { |
||||
|
}) |
||||
|
</script> |
||||
|
<style lang="scss"> |
||||
|
@import 'vk-uview-ui/index.scss'; |
||||
|
</style> |
@ -0,0 +1,114 @@ |
|||||
|
import axios from 'axios' |
||||
|
|
||||
|
import { getFullURL } from '@/utils/http' |
||||
|
import { getAccessToken, removeToken } from '@/utils/auth' |
||||
|
|
||||
|
const instance = axios.create({ |
||||
|
baseURL: import.meta.env.VITE_BASE_URL, |
||||
|
adapter(config) { |
||||
|
const { url, method, data, params, headers, baseURL, paramsSerializer } = |
||||
|
config |
||||
|
return new Promise((resolve, reject) => { |
||||
|
uni.request({ |
||||
|
method: method!.toUpperCase() as any, |
||||
|
url: getFullURL(baseURL || '', url!, params, paramsSerializer), |
||||
|
header: headers, |
||||
|
data, |
||||
|
dataType: 'json', |
||||
|
responseType: config.responseType, |
||||
|
success: (res : any) => { |
||||
|
resolve(res) |
||||
|
}, |
||||
|
fail: (error : any) => { |
||||
|
reject(error) |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 请求拦截 |
||||
|
*/ |
||||
|
instance.interceptors.request.use((config) => { |
||||
|
const { method, params, url } = config |
||||
|
// 附带鉴权的token
|
||||
|
const tenantId = 1 |
||||
|
const headers : any = { |
||||
|
token: getAccessToken(), |
||||
|
"tenant-id":tenantId, |
||||
|
'Authorization': 'Bearer ' + getAccessToken() |
||||
|
} |
||||
|
if (uni.getStorageSync('openId')) { |
||||
|
headers['openId'] = uni.getStorageSync('openId') |
||||
|
} |
||||
|
// 不缓存get请求
|
||||
|
if (method === 'get') { |
||||
|
headers['Cache-Control'] = 'no-cache' |
||||
|
} |
||||
|
// delete请求参数放入body中
|
||||
|
if (method === 'delete') { |
||||
|
headers['Content-type'] = 'application/json;' |
||||
|
Object.assign(config, { |
||||
|
data: params, |
||||
|
params: {} |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
return { |
||||
|
...config, |
||||
|
headers |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
/** |
||||
|
* 响应拦截 |
||||
|
*/ |
||||
|
instance.interceptors.response.use((v) => { |
||||
|
const code = v.data?.code || 200 |
||||
|
if (code === 401) { |
||||
|
// alert('即将跳转登录页。。。', '登录过期')
|
||||
|
// setTimeout(redirectHome, 1500)
|
||||
|
removeToken() |
||||
|
uni.showModal({ |
||||
|
title: '系统提示', |
||||
|
content: '登录状态已过期,您可以继续留在该页面,或者重新登录', |
||||
|
cancelText: '关闭', |
||||
|
confirmText: '重新登录', |
||||
|
success: function (res) { |
||||
|
if (res.confirm) { |
||||
|
uni.reLaunch({ url: '/pages/login' }) |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
return v.data |
||||
|
} else if (code === 500) { |
||||
|
uni.showToast({ |
||||
|
title: v.data.msg, |
||||
|
icon: 'none' |
||||
|
}) |
||||
|
return v.data |
||||
|
} else if (code !== 200) { |
||||
|
uni.showToast({ |
||||
|
title: v.data.msg, |
||||
|
icon: 'none' |
||||
|
}) |
||||
|
return v.data |
||||
|
} |
||||
|
|
||||
|
// @ts-ignore
|
||||
|
if ((v.status || v.statusCode) === 200) { |
||||
|
return v.data |
||||
|
}else{ |
||||
|
|
||||
|
} |
||||
|
return Promise.reject(v) |
||||
|
},error=>{ |
||||
|
console.log(error) |
||||
|
uni.showToast({ |
||||
|
title: '网络错误', |
||||
|
icon: 'none' |
||||
|
}) |
||||
|
}) |
||||
|
export default instance |
@ -0,0 +1,41 @@ |
|||||
|
import http from './http' |
||||
|
|
||||
|
// 登录方法
|
||||
|
export function login(username, password, captchaVerification, tenantName, rememberMe, code, uuid) { |
||||
|
const data = { |
||||
|
username, |
||||
|
password, |
||||
|
captchaVerification, |
||||
|
tenantName, |
||||
|
rememberMe, |
||||
|
code, |
||||
|
uuid, |
||||
|
} |
||||
|
return http.post('/system/auth/login', data) |
||||
|
} |
||||
|
|
||||
|
// 获取用户详细信息
|
||||
|
export function getInfo() { |
||||
|
return http.get('/system/user/profile/get') |
||||
|
} |
||||
|
// 获取权限
|
||||
|
export function getPermissionInfo() { |
||||
|
return http.get('/system/auth/get-permission-info') |
||||
|
} |
||||
|
// 退出方法
|
||||
|
export function logout() { |
||||
|
return http.post('/system/auth/logout') |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
File diff suppressed because it is too large
@ -0,0 +1,116 @@ |
|||||
|
import { |
||||
|
appCheckUpdate |
||||
|
} from '../api/request2.js'; |
||||
|
export function appUpdate() { |
||||
|
let curversion = 0; |
||||
|
plus.runtime.getProperty(plus.runtime.appid, function(widgetInfo) { |
||||
|
const data = { |
||||
|
action: 'checkVersion', |
||||
|
appid: plus.runtime.appid, |
||||
|
appVersion: plus.runtime.version, |
||||
|
wgtVersion: widgetInfo.version, |
||||
|
versionCode: widgetInfo.versionCode |
||||
|
} |
||||
|
curversion=data.versionCode |
||||
|
appCheckUpdate().then(res => { |
||||
|
console.log("当前版本提示",curversion) |
||||
|
if (res.data) { |
||||
|
if (res.data.versionCode > Number(curversion)) { |
||||
|
var downUrl = res.data.downUrl; |
||||
|
var content = res.data.content; |
||||
|
var version =res.data.version |
||||
|
console.log("新版本提示") |
||||
|
uni.showModal({ |
||||
|
title: "发现新版本:("+version+")", |
||||
|
content: content, |
||||
|
confirmText: "更新", |
||||
|
cancelText: "取消", |
||||
|
success: (res) => { |
||||
|
if (res.confirm) { |
||||
|
confirm(downUrl); |
||||
|
console.log('comfirm') //点击确定之后执行的代码
|
||||
|
} else { |
||||
|
console.log('cancel') //点击取消之后执行的代码
|
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
} else { |
||||
|
uni.showToast({ |
||||
|
title:"当前是最新版本" |
||||
|
}) |
||||
|
console.log("没有新版本") |
||||
|
} |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
console.log("版本错误", error) |
||||
|
}) |
||||
|
|
||||
|
}) |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
export function confirm(downUrl) { |
||||
|
var downloadApkUrl = downUrl |
||||
|
var dtask = plus.downloader.createDownload(downloadApkUrl, {}, |
||||
|
function(d, status) { |
||||
|
|
||||
|
// 下载完成
|
||||
|
if (status == 200) { |
||||
|
|
||||
|
plus.runtime.install(plus.io.convertLocalFileSystemURL( |
||||
|
d.filename), {}, {}, function(error) { |
||||
|
uni.showToast({ |
||||
|
title: '安装失败', |
||||
|
duration: 1500 |
||||
|
}); |
||||
|
}) |
||||
|
} else { |
||||
|
uni.showToast({ |
||||
|
title: '更新失败', |
||||
|
duration: 1500 |
||||
|
}); |
||||
|
} |
||||
|
}); |
||||
|
try { |
||||
|
dtask.start(); // 开启下载的任务
|
||||
|
var prg = 0; |
||||
|
var showLoading = plus.nativeUI.showWaiting( |
||||
|
"正在下载"); //创建一个showWaiting对象
|
||||
|
dtask.addEventListener('statechanged', function( |
||||
|
task, |
||||
|
status |
||||
|
) { |
||||
|
// 给下载任务设置一个监听 并根据状态 做操作
|
||||
|
switch (task.state) { |
||||
|
case 1: |
||||
|
showLoading.setTitle("正在下载"); |
||||
|
break; |
||||
|
case 2: |
||||
|
showLoading.setTitle("已连接到服务器"); |
||||
|
break; |
||||
|
case 3: |
||||
|
prg = parseInt( |
||||
|
(parseFloat(task.downloadedSize) / |
||||
|
parseFloat(task.totalSize)) * |
||||
|
100 |
||||
|
); |
||||
|
showLoading.setTitle(" 正在下载" + prg + "% "); |
||||
|
break; |
||||
|
case 4: |
||||
|
plus.nativeUI.closeWaiting(); |
||||
|
//下载完成
|
||||
|
break; |
||||
|
} |
||||
|
}); |
||||
|
} catch (err) { |
||||
|
plus.nativeUI.closeWaiting(); |
||||
|
uni.showToast({ |
||||
|
title: '更新失败-03', |
||||
|
mask: false, |
||||
|
duration: 1500 |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,320 @@ |
|||||
|
// 详情和审批
|
||||
|
export function getDetailAndApproveOption() { |
||||
|
let option_detail = [{ |
||||
|
text: '详情', |
||||
|
style: { |
||||
|
backgroundColor: '#3C9CFF' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
text: '提交\n审批', |
||||
|
style: { |
||||
|
backgroundColor: '#00CC33' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
text: '关闭', |
||||
|
style: { |
||||
|
backgroundColor: '#ff0000' |
||||
|
} |
||||
|
} |
||||
|
]; |
||||
|
return option_detail; |
||||
|
} |
||||
|
//详情、审批通过、审批驳回
|
||||
|
export function getDetailAndApprovePassAndApproveNoOption() { |
||||
|
let option_detail = [{ |
||||
|
text: '详情', |
||||
|
style: { |
||||
|
backgroundColor: '#3C9CFF' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
text: '审批\n通过', |
||||
|
style: { |
||||
|
backgroundColor: '#00CC33' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
text: '审批\n驳回', |
||||
|
style: { |
||||
|
backgroundColor: '#F56C6C' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
text: '关闭', |
||||
|
style: { |
||||
|
backgroundColor: '#ff0000' |
||||
|
} |
||||
|
} |
||||
|
]; |
||||
|
return option_detail; |
||||
|
} |
||||
|
//详情、处理、审批不通过
|
||||
|
export function getDetailAndHandleOption() { |
||||
|
let option_detail = [{ |
||||
|
text: '详情', |
||||
|
style: { |
||||
|
backgroundColor: '#3C9CFF' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
text: '处理', |
||||
|
style: { |
||||
|
backgroundColor: '#00CC33' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
text: '关闭', |
||||
|
style: { |
||||
|
backgroundColor: '#ff0000' |
||||
|
} |
||||
|
} |
||||
|
]; |
||||
|
return option_detail; |
||||
|
} |
||||
|
//详情、重新添加、关闭
|
||||
|
export function getDetailAndAddAndCloseOption() { |
||||
|
let option_detail = [{ |
||||
|
text: '详情', |
||||
|
style: { |
||||
|
backgroundColor: '#3C9CFF' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
text: '重新\n添加', |
||||
|
style: { |
||||
|
backgroundColor: '#E6A23C' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
text: '关闭', |
||||
|
style: { |
||||
|
backgroundColor: '#F56C6C' |
||||
|
} |
||||
|
} |
||||
|
]; |
||||
|
return option_detail; |
||||
|
} |
||||
|
// 采购退货返回侧滑按钮 详情 、编辑、库位、移除
|
||||
|
export function getPurchaseReceiptOption(allowModifyQty, allowModifyLocation) { |
||||
|
var option = [] |
||||
|
option.push(...getDetailOption()) |
||||
|
if (allowModifyQty == "TRUE") { |
||||
|
option.push(...getEditOption()) |
||||
|
} |
||||
|
if (allowModifyLocation == "TRUE") { |
||||
|
option.push(...getLocationOption()) |
||||
|
} |
||||
|
option.push(...getRemoveOption()) |
||||
|
return option; |
||||
|
} |
||||
|
|
||||
|
//详情
|
||||
|
export function getDetailOption() { |
||||
|
let option_detail = [{ |
||||
|
text: '详情', |
||||
|
style: { |
||||
|
backgroundColor: '#3C9CFF' |
||||
|
} |
||||
|
}]; |
||||
|
return option_detail; |
||||
|
} |
||||
|
|
||||
|
//详情移除(扫描后不允许修改数量)
|
||||
|
export function getDetailRemoveOption() { |
||||
|
let option_detail_edit_remove = [{ |
||||
|
text: '详情', |
||||
|
style: { |
||||
|
backgroundColor: '#3C9CFF' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
text: '移除', |
||||
|
style: { |
||||
|
backgroundColor: '#F56C6C' |
||||
|
} |
||||
|
} |
||||
|
]; |
||||
|
return option_detail_edit_remove; |
||||
|
} |
||||
|
|
||||
|
export function getRemoveOption() { |
||||
|
let option_detail_remove = [{ |
||||
|
text: '移除', |
||||
|
style: { |
||||
|
backgroundColor: '#F56C6C' |
||||
|
} |
||||
|
}]; |
||||
|
return option_detail_remove; |
||||
|
} |
||||
|
|
||||
|
export function getAddAgainOption() { |
||||
|
let option_detail_remove = [{ |
||||
|
text: '详情', |
||||
|
style: { |
||||
|
backgroundColor: '#3C9CFF' |
||||
|
} |
||||
|
}, { |
||||
|
text: '重新\n添加', |
||||
|
style: { |
||||
|
backgroundColor: '#E6A23C' |
||||
|
} |
||||
|
}]; |
||||
|
return option_detail_remove; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
export function getEditOption() { |
||||
|
let option_detail_edit = [{ |
||||
|
text: '编辑', |
||||
|
style: { |
||||
|
backgroundColor: '#F1A532' |
||||
|
} |
||||
|
}]; |
||||
|
return option_detail_edit; |
||||
|
} |
||||
|
export function getLocationOption() { |
||||
|
let option_detail_location = [{ |
||||
|
text: '库位', |
||||
|
style: { |
||||
|
backgroundColor: '#00A3FF' |
||||
|
} |
||||
|
}]; |
||||
|
return option_detail_location; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
//清空
|
||||
|
export function getClearOption() { |
||||
|
let option_detail_edit_remove = [{ |
||||
|
text: '清空', |
||||
|
style: { |
||||
|
backgroundColor: '#F56C6C' |
||||
|
} |
||||
|
}]; |
||||
|
return option_detail_edit_remove; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
//详情编辑移除
|
||||
|
export function getDetailEditRemoveOption() { |
||||
|
let option_detail_edit_remove = [{ |
||||
|
text: '详情', |
||||
|
style: { |
||||
|
backgroundColor: '#3C9CFF' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
text: '编辑', |
||||
|
style: { |
||||
|
backgroundColor: '#F1A532' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
text: '移除', |
||||
|
style: { |
||||
|
backgroundColor: '#F56C6C' |
||||
|
} |
||||
|
} |
||||
|
]; |
||||
|
return option_detail_edit_remove; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
//详情编辑放弃
|
||||
|
export function getDetailGiveupOption() { |
||||
|
let option_detail_giveup = [{ |
||||
|
text: '详情', |
||||
|
style: { |
||||
|
backgroundColor: '#3C9CFF' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
text: '放弃', |
||||
|
style: { |
||||
|
backgroundColor: '#F56C6C' |
||||
|
} |
||||
|
} |
||||
|
]; |
||||
|
return option_detail_giveup; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
//详情编辑移除
|
||||
|
export function getEditRemoveOption() { |
||||
|
let option_edit_remove = [{ |
||||
|
text: '编辑', |
||||
|
style: { |
||||
|
backgroundColor: '#F1A532' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
text: '移除', |
||||
|
style: { |
||||
|
backgroundColor: '#F56C6C' |
||||
|
} |
||||
|
} |
||||
|
]; |
||||
|
return option_edit_remove; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
// 库存状态字典项
|
||||
|
export function getInventoryStatusArray() { |
||||
|
let array = [{ |
||||
|
text: '待检', |
||||
|
value: "INSP" |
||||
|
}, { |
||||
|
text: '合格', |
||||
|
value: "OK" |
||||
|
}, { |
||||
|
text: '不合格', |
||||
|
value: "NOK" |
||||
|
}, { |
||||
|
text: '隔离', |
||||
|
value: "HOLD" |
||||
|
}, { |
||||
|
text: '报废', |
||||
|
value: "SCRAP" |
||||
|
}] |
||||
|
return array; |
||||
|
} |
||||
|
|
||||
|
// 业务类型字典项
|
||||
|
export function getBusinessTypeArray() { |
||||
|
let array = [{ |
||||
|
text: '供应商发货', |
||||
|
value: "SupplierDeliver" |
||||
|
}, { |
||||
|
text: '采购收货', |
||||
|
value: "PurchaseReceipt" |
||||
|
}, { |
||||
|
text: '采购退货', |
||||
|
value: "PurchaseReturn" |
||||
|
}, { |
||||
|
text: '采购上架', |
||||
|
value: "PurchasePutaway" |
||||
|
}] |
||||
|
return array; |
||||
|
} |
||||
|
|
||||
|
export function getLocationTypeArray(data) { |
||||
|
var list = [] |
||||
|
if (data == undefined || data == null || data == "") { |
||||
|
return list |
||||
|
} |
||||
|
|
||||
|
if (data.indexOf(',') < 0) { |
||||
|
list.push(data) |
||||
|
} else { |
||||
|
var arrayItems = data.split(',') |
||||
|
arrayItems.forEach(res => { |
||||
|
list.push(res) |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
return list |
||||
|
} |
@ -0,0 +1,477 @@ |
|||||
|
import { |
||||
|
getManagementPrecision, |
||||
|
getPrecisionStrategy, |
||||
|
getBalanceByFilter |
||||
|
} from '@/api/request2.js'; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
获取管理精度查询策略参数 |
||||
|
* @param {*} |
||||
|
* |
||||
|
*/ |
||||
|
export function getPrecisionStrategyParams(detailSource) { |
||||
|
var itemList = [] |
||||
|
detailSource.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
if (detail.scaned) { |
||||
|
var filterResult = itemList.filter(res => { |
||||
|
if (res.itemCode == item.itemCode && |
||||
|
res.locationCode == detail.toLocationCode) { |
||||
|
return res |
||||
|
} |
||||
|
}) |
||||
|
//去掉重复元素
|
||||
|
if (filterResult.length == 0) { |
||||
|
var result = { |
||||
|
itemCode: item.itemCode, |
||||
|
locationCode: detail.toLocationCode |
||||
|
} |
||||
|
itemList.push(result) |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
return itemList; |
||||
|
} |
||||
|
/** |
||||
|
* |
||||
|
获取管理精度查询策略参数 |
||||
|
* @param {*} |
||||
|
* |
||||
|
*/ |
||||
|
export function getPrecisionStrategyParamsByLocation(detailSource, toLocationCode) { |
||||
|
var itemList = [] |
||||
|
detailSource.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
if (detail.scaned) { |
||||
|
detail.toLocationCode = toLocationCode; |
||||
|
var filterResult = itemList.filter(res => { |
||||
|
if (res.itemCode == item.itemCode && |
||||
|
res.locationCode == detail.toLocationCode) { |
||||
|
return res |
||||
|
} |
||||
|
}) |
||||
|
//去掉重复元素
|
||||
|
if (filterResult.length == 0) { |
||||
|
var result = { |
||||
|
itemCode: item.itemCode, |
||||
|
locationCode: detail.toLocationCode |
||||
|
} |
||||
|
itemList.push(result) |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
return itemList; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* "itemCode": [], |
||||
|
"locationCode":"INSPECT" |
||||
|
管理精度策略 |
||||
|
* @param {*} |
||||
|
* |
||||
|
*/ |
||||
|
export function getPrecisionStrategyList(itemList, callback) { |
||||
|
// let jsonParem = JSON.stringify(param)
|
||||
|
let result = { |
||||
|
list: [], |
||||
|
success: true, |
||||
|
message: '' |
||||
|
}; |
||||
|
|
||||
|
getPrecisionStrategy(itemList).then(res => { |
||||
|
if (res.data == null) { |
||||
|
result.success = false |
||||
|
result.message = '未查询到管理精度信息' |
||||
|
} else { |
||||
|
result.list = res.data; |
||||
|
} |
||||
|
callback(result); |
||||
|
}).catch(error => { |
||||
|
result.success = false; |
||||
|
result.message = error; |
||||
|
callback(result); |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* "itemCode": [], |
||||
|
"locationCode":"INSPECT" |
||||
|
管理精度策略 |
||||
|
* @param {*} |
||||
|
* |
||||
|
*/ |
||||
|
export function getManagementPrecisions(itemCodes, locationCode, callback) { |
||||
|
// let jsonParem = JSON.stringify(param)
|
||||
|
let result = { |
||||
|
list: [], |
||||
|
success: true, |
||||
|
message: '' |
||||
|
}; |
||||
|
|
||||
|
var params = { |
||||
|
itemCodes: itemCodes, |
||||
|
locationCode: locationCode |
||||
|
} |
||||
|
getManagementPrecision(params).then(res => { |
||||
|
if (res.data == null) { |
||||
|
result.success = false |
||||
|
result.message = '未查询到管理精度信息' |
||||
|
} else { |
||||
|
result.list = res.data; |
||||
|
} |
||||
|
callback(result); |
||||
|
}).catch(error => { |
||||
|
result.success = false; |
||||
|
result.message = error; |
||||
|
callback(result); |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
export function getBalanceByManagementPrecision(label, locationCode, fromInventoryStatuses, callback) { |
||||
|
let result = { |
||||
|
list: [], |
||||
|
success: true, |
||||
|
message: '' |
||||
|
}; |
||||
|
let params = { |
||||
|
itemCodes: [label.itemCode], |
||||
|
locationCode: locationCode |
||||
|
}; |
||||
|
// let jsonParem = JSON.stringify(param)
|
||||
|
getManagementPrecision(params).then(res => { |
||||
|
let managementPrecision = res.data[0].ManagementPrecision; |
||||
|
switch (managementPrecision) { |
||||
|
case 'BY_PACKAGING': |
||||
|
byPacking(label, locationCode, fromInventoryStatuses, res => { |
||||
|
res.managementPrecision = managementPrecision; |
||||
|
callback(res); |
||||
|
}); |
||||
|
break; |
||||
|
case 'BY_BATCH': |
||||
|
byBatch(label, locationCode, fromInventoryStatuses, res => { |
||||
|
res.managementPrecision = managementPrecision; |
||||
|
callback(res); |
||||
|
}); |
||||
|
break; |
||||
|
case 'BY_QUANTITY': |
||||
|
byQuantity(label, locationCode, fromInventoryStatuses, res => { |
||||
|
res.managementPrecision = managementPrecision; |
||||
|
callback(res); |
||||
|
}); |
||||
|
break; |
||||
|
case 'BY_UNIQUEID': |
||||
|
byUniqueId(label, fromInventoryStatuses, res => { |
||||
|
res.managementPrecision = managementPrecision; |
||||
|
callback(res); |
||||
|
}); |
||||
|
break; |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
let result = { |
||||
|
success: false, |
||||
|
message: error |
||||
|
}; |
||||
|
callback(result); |
||||
|
}) |
||||
|
} |
||||
|
/** 按包装管理查询库存 |
||||
|
* @param {Object} label |
||||
|
* @param {Object} locationCode |
||||
|
* @param {Object} callback |
||||
|
*/ |
||||
|
export function byPacking(label, locationCode, fromInventoryStatuses, callback) { |
||||
|
let result = { |
||||
|
success: true, |
||||
|
message: '', |
||||
|
data: {} |
||||
|
}; |
||||
|
var filters = [] |
||||
|
filters.push({ |
||||
|
column: "packingNumber", |
||||
|
action: "==", |
||||
|
value: label.packingNumber |
||||
|
}) |
||||
|
filters.push({ |
||||
|
column: "itemCode", |
||||
|
action: "==", |
||||
|
value: label.itemCode |
||||
|
}) |
||||
|
filters.push({ |
||||
|
column: "batch", |
||||
|
action: "==", |
||||
|
value: label.batch |
||||
|
}) |
||||
|
filters.push({ |
||||
|
column: "locationCode", |
||||
|
action: "==", |
||||
|
value: locationCode |
||||
|
}) |
||||
|
if (fromInventoryStatuses != null && fromInventoryStatuses != "") { |
||||
|
filters.push({ |
||||
|
column: "inventoryStatus", |
||||
|
action: "in", |
||||
|
value: fromInventoryStatuses |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
|
||||
|
var params = { |
||||
|
filters: filters, |
||||
|
pageNo: 1, |
||||
|
pageSize: 100, |
||||
|
} |
||||
|
getBalanceByFilter(params).then(res => { |
||||
|
if (res.data == null) { |
||||
|
result.success = false; |
||||
|
result.message = |
||||
|
"按包装管理查询、未查询到物料号[" + label.itemCode + "]" + |
||||
|
"到箱码[" + label.packingNumber + "]" + |
||||
|
"批次[" + label.batch + "]" + |
||||
|
"库位[" + label.locationCode + "]的信息" |
||||
|
} else { |
||||
|
result.success = true; |
||||
|
result.data = res.data; |
||||
|
} |
||||
|
|
||||
|
callback(result) |
||||
|
}).catch(err => { |
||||
|
result.success = false; |
||||
|
result.data = null; |
||||
|
result.message = err; |
||||
|
callback(result) |
||||
|
}) |
||||
|
} |
||||
|
/** 按批次管理查询库存 |
||||
|
* @param {Object} label |
||||
|
* @param {Object} locationCode |
||||
|
* @param {Object} callback |
||||
|
*/ |
||||
|
export function byBatch(label, locationCode, fromInventoryStatuses, callback) { |
||||
|
var filters = [] |
||||
|
filters.push({ |
||||
|
column: "itemCode", |
||||
|
action: "==", |
||||
|
value: label.itemCode |
||||
|
}) |
||||
|
filters.push({ |
||||
|
column: "batch", |
||||
|
action: "==", |
||||
|
value: label.batch |
||||
|
}) |
||||
|
filters.push({ |
||||
|
column: "packingNumber", |
||||
|
action: "==", |
||||
|
value: null |
||||
|
}) |
||||
|
filters.push({ |
||||
|
column: "locationCode", |
||||
|
action: "==", |
||||
|
value: locationCode |
||||
|
}) |
||||
|
|
||||
|
if (fromInventoryStatuses != null && fromInventoryStatuses != "") { |
||||
|
filters.push({ |
||||
|
column: "inventoryStatus", |
||||
|
action: "in", |
||||
|
value: fromInventoryStatuses |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
var params = { |
||||
|
filters: filters, |
||||
|
pageNo: 1, |
||||
|
pageSize: 100, |
||||
|
} |
||||
|
|
||||
|
let result = { |
||||
|
success: true, |
||||
|
message: '', |
||||
|
data: {} |
||||
|
}; |
||||
|
getBalanceByFilter(params).then(res => { |
||||
|
if (res.data == null) { |
||||
|
result.success = false; |
||||
|
result.message = |
||||
|
"按批次管理查询、未查询到物料号[" + label.itemCode + "]" + |
||||
|
"批次[" + label.batch + "]" + |
||||
|
"库位[" + label.locationCode + "]的信息" |
||||
|
} else { |
||||
|
result.success = true; |
||||
|
result.data = res.data; |
||||
|
} |
||||
|
callback(result) |
||||
|
}).catch(err => { |
||||
|
result.success = false; |
||||
|
result.data = null; |
||||
|
result.message = err.message; |
||||
|
callback(result) |
||||
|
}) |
||||
|
} |
||||
|
/** 按数量管理查询库存 |
||||
|
* @param {Object} label |
||||
|
* @param {Object} locationCode |
||||
|
* @param {Object} callback |
||||
|
*/ |
||||
|
export function byQuantity(label, locationCode, fromInventoryStatuses, callback) { |
||||
|
let result = { |
||||
|
success: true, |
||||
|
message: '', |
||||
|
data: {} |
||||
|
}; |
||||
|
|
||||
|
var filters = [] |
||||
|
filters.push({ |
||||
|
column: "itemCode", |
||||
|
action: "==", |
||||
|
value: label.itemCode |
||||
|
}) |
||||
|
filters.push({ |
||||
|
column: "packingNumber", |
||||
|
action: "==", |
||||
|
value: null |
||||
|
}) |
||||
|
filters.push({ |
||||
|
column: "batch", |
||||
|
action: "==", |
||||
|
value: null |
||||
|
}) |
||||
|
filters.push({ |
||||
|
column: "locationCode", |
||||
|
action: "==", |
||||
|
value: locationCode |
||||
|
}) |
||||
|
|
||||
|
if (fromInventoryStatuses != null && fromInventoryStatuses != "") { |
||||
|
filters.push({ |
||||
|
column: "inventoryStatus", |
||||
|
action: "in", |
||||
|
value: fromInventoryStatuses |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
var params = { |
||||
|
filters: filters, |
||||
|
pageNo: 1, |
||||
|
pageSize: 100, |
||||
|
} |
||||
|
|
||||
|
getBalanceByFilter(params).then(res => { |
||||
|
if (res.data == null) { |
||||
|
result.success = false; |
||||
|
result.message = |
||||
|
"按数量管理查询、未查询到物料号[" + label.itemCode + "]" + |
||||
|
"库位[" + label.locationCode + "]的信息" |
||||
|
} else { |
||||
|
result.success = true; |
||||
|
result.data = res.data; |
||||
|
} |
||||
|
callback(result) |
||||
|
}).catch(err => { |
||||
|
result.success = false; |
||||
|
result.data = null; |
||||
|
result.message = err.message; |
||||
|
callback(result) |
||||
|
}) |
||||
|
} |
||||
|
/** 按唯一码管理查询库存 |
||||
|
* @param {Object} label |
||||
|
* @param {Object} locationCode |
||||
|
* @param {Object} callback |
||||
|
*/ |
||||
|
export function byUniqueId(label, locationCode, fromInventoryStatuses, callback) { |
||||
|
let param = { |
||||
|
packingNumber: label.packingNumber |
||||
|
}; |
||||
|
let result = { |
||||
|
success: true, |
||||
|
message: '', |
||||
|
data: {} |
||||
|
}; |
||||
|
|
||||
|
var filters = [] |
||||
|
filters.push({ |
||||
|
column: "packingNumber", |
||||
|
action: "==", |
||||
|
value: label.packingNumber |
||||
|
}) |
||||
|
|
||||
|
if (fromInventoryStatuses != null && fromInventoryStatuses != "") { |
||||
|
filters.push({ |
||||
|
column: "inventoryStatus", |
||||
|
action: "in", |
||||
|
value: fromInventoryStatuses |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
var params = { |
||||
|
filters: filters, |
||||
|
pageNo: 1, |
||||
|
pageSize: 100, |
||||
|
} |
||||
|
|
||||
|
getBalanceByFilter(params).then(res => { |
||||
|
if (res.data == null) { |
||||
|
result.success = false; |
||||
|
result.message = |
||||
|
"按唯一码管理查询、未查询到箱码[" + label.packingNumber + "]" + |
||||
|
"的信息" |
||||
|
} else { |
||||
|
result.success = true; |
||||
|
result.data = res.data; |
||||
|
} |
||||
|
callback(result) |
||||
|
}).catch(err => { |
||||
|
result.success = false; |
||||
|
result.data = null; |
||||
|
result.message = err.message; |
||||
|
callback(result) |
||||
|
}) |
||||
|
} |
||||
|
/** |
||||
|
* 查询指定库位下的库存 |
||||
|
* @param {*} param |
||||
|
* @param {*} callback |
||||
|
*/ |
||||
|
export function balanceByLocation(locationCode, callback) { |
||||
|
let result = { |
||||
|
success: true, |
||||
|
message: '', |
||||
|
data: {} |
||||
|
}; |
||||
|
|
||||
|
var filters = [] |
||||
|
filters.push({ |
||||
|
column: "locationCode", |
||||
|
action: "==", |
||||
|
value: locationCode |
||||
|
}) |
||||
|
|
||||
|
var params = { |
||||
|
filters: filters, |
||||
|
pageNo: 1, |
||||
|
pageSize: 100, |
||||
|
} |
||||
|
|
||||
|
getBalanceByFilter(params).then(res => { |
||||
|
if (res.data == null) { |
||||
|
result.success = false; |
||||
|
result.message = |
||||
|
"按唯一码管理查询、未查询到库位[" + label.locationCode + "]" + |
||||
|
"的信息" |
||||
|
} else { |
||||
|
result.success = true; |
||||
|
result.data = res.data; |
||||
|
} |
||||
|
callback(result) |
||||
|
}).catch(err => { |
||||
|
result.success = false; |
||||
|
result.data = null; |
||||
|
result.message = err.message; |
||||
|
callback(result) |
||||
|
}) |
||||
|
} |
File diff suppressed because it is too large
@ -0,0 +1,17 @@ |
|||||
|
/* 解决js计算精度问题 */ |
||||
|
import { Decimal } from 'decimal.js';//引入
|
||||
|
class Calc { |
||||
|
add(num1,num2) { |
||||
|
return new Decimal(num1).add(new Decimal(num2)).toNumber() |
||||
|
} |
||||
|
sub(num1,num2) { |
||||
|
return new Decimal(num1).sub(new Decimal(num2)).toNumber() |
||||
|
} |
||||
|
mul(num1,num2) { |
||||
|
return new Decimal(num1).mul(new Decimal(num2)).toNumber() |
||||
|
} |
||||
|
div(num1,num2) { |
||||
|
return new Decimal(num1).div(new Decimal(num2)).toNumber() |
||||
|
} |
||||
|
} |
||||
|
export const calc = new Calc(); |
@ -0,0 +1,83 @@ |
|||||
|
import { |
||||
|
calc |
||||
|
} from '@/common/calc' |
||||
|
|
||||
|
import { Decimal } from 'decimal.js';//引入
|
||||
|
export function getDataSource(subList) { |
||||
|
let items = []; |
||||
|
subList.forEach(detail => { |
||||
|
var item = items.find(r => |
||||
|
r.itemCode == detail.itemCode) |
||||
|
if (item == undefined) { |
||||
|
item = createItemInfo(detail); |
||||
|
let newDetail = createDetailInfo(detail); //
|
||||
|
item.subList.push(newDetail); |
||||
|
items.push(item) |
||||
|
} else { |
||||
|
item.qty = calc.add(item.qty, detail.qty) |
||||
|
let newDetail = createDetailInfo(detail); //
|
||||
|
item.subList.push(newDetail); |
||||
|
} |
||||
|
}) |
||||
|
return items; |
||||
|
} |
||||
|
|
||||
|
export function createItemInfo(detail) { |
||||
|
let item = { |
||||
|
itemCode: detail.itemCode, |
||||
|
itemName: detail.itemName, |
||||
|
stdPackQty: Number(detail.stdPackQty) || undefined, |
||||
|
stdPackUnit: detail.stdPackUnit, |
||||
|
qty: Number(detail.qty), |
||||
|
handleQty: 0, |
||||
|
uom: detail.uom, |
||||
|
subList: [] |
||||
|
} |
||||
|
return item; |
||||
|
} |
||||
|
|
||||
|
export function createDetailInfo(data) { |
||||
|
data.scaned = false; |
||||
|
// data.record = {};
|
||||
|
let detail = data; |
||||
|
return detail; |
||||
|
} |
||||
|
|
||||
|
//根据明细创建记录
|
||||
|
export function createRecordInfo(detail, balance) { |
||||
|
var record = {} |
||||
|
// let record = JSON.parse(JSON.stringify(detail));
|
||||
|
//克隆对象,深度克隆,防止双向绑定同一个变量
|
||||
|
Object.assign(record, detail) |
||||
|
detail.scaned = true; |
||||
|
detail.balance = balance; |
||||
|
detail.recommendInventoryStatus = detail.inventoryStatus; |
||||
|
detail.inventoryStatus = balance.inventoryStatus; |
||||
|
record.qty = Number(balance.qty); |
||||
|
return record; |
||||
|
} |
||||
|
|
||||
|
//计算实际数量
|
||||
|
export function calcHandleQty(detailSource) { |
||||
|
for (let item of detailSource) { |
||||
|
item.handleQty = new Decimal(0).toNumber(); |
||||
|
// item.qty = new Decimal(0).toNumber();
|
||||
|
for (let detail of item.subList) { |
||||
|
if (detail != undefined && detail.scaned) { |
||||
|
item.handleQty = calc.add(item.handleQty,detail.handleQty); |
||||
|
// item.qty = calc.add(item.qty,detail.qty);
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
export function getScanCount(subList) { |
||||
|
let items = subList.filter(r => { |
||||
|
if (r.scaned) { |
||||
|
return r; |
||||
|
} |
||||
|
}) |
||||
|
let scanCount = items != null ? items.length : 0; |
||||
|
return scanCount; |
||||
|
} |
@ -0,0 +1,516 @@ |
|||||
|
let jobStatusList = []; |
||||
|
let itemStatusList = []; |
||||
|
let itemTypeList =[]; |
||||
|
let locationTypeList = []; |
||||
|
let uomList = []; |
||||
|
let inventoryStatusList = []; |
||||
|
let containerTypeList = []; |
||||
|
let packUnitList = []; |
||||
|
let requestStatusList = []; |
||||
|
let unplannedReceiptReasonList = []; |
||||
|
let unplannedIssueReasonList = []; |
||||
|
let unplannedIissueReason = []; |
||||
|
let scrapReasonList = []; |
||||
|
let inspectFailedReasonList = []; |
||||
|
let inspectResultList = []; |
||||
|
let nextActionList = []; |
||||
|
let inspectTypeList = []; |
||||
|
let sampleMethodList = []; |
||||
|
let transferModeList = []; |
||||
|
let countStageList = []; |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
// 获取业务类型字典项
|
||||
|
export function getBusinessTypeDesc(type) { |
||||
|
if (type == "SupplierDeliver") { |
||||
|
return "供应商发货" |
||||
|
} else if (type = "PurchaseReceipt") { |
||||
|
return "采购收货"; |
||||
|
} else if (type = "PurchaseReturn") { |
||||
|
return "采购退货"; |
||||
|
} else if (type = "PurchasePutaway") { |
||||
|
return "采购上架"; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
//获取字典信息
|
||||
|
export function clearCacheData() { |
||||
|
jobStatusList = []; |
||||
|
itemStatusList = []; |
||||
|
itemTypeList =[]; |
||||
|
locationTypeList = []; |
||||
|
uomList = []; |
||||
|
inventoryStatusList = []; |
||||
|
containerTypeList = []; |
||||
|
packUnitList = []; |
||||
|
requestStatusList = []; |
||||
|
unplannedReceiptReasonList = []; |
||||
|
unplannedIssueReasonList = []; |
||||
|
unplannedIissueReason = []; |
||||
|
scrapReasonList = []; |
||||
|
inspectFailedReasonList = []; |
||||
|
inspectResultList = []; |
||||
|
nextActionList = []; |
||||
|
inspectTypeList = []; |
||||
|
sampleMethodList = []; |
||||
|
transferModeList = []; |
||||
|
countStageList = []; |
||||
|
} |
||||
|
|
||||
|
//获取字典信息
|
||||
|
export function getDirectoryInfo(type) { |
||||
|
|
||||
|
var result = []; |
||||
|
var list = uni.getStorageSync("dictionary") |
||||
|
if (list != undefined && list.length > 0) { |
||||
|
for (let item of list) { |
||||
|
if (item.type == type) { |
||||
|
result = item.subList |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return result |
||||
|
} |
||||
|
|
||||
|
//将字典项转为数组
|
||||
|
export function getDirectoryItemArray(data) { |
||||
|
var array = [] |
||||
|
if (data == undefined || data == null || data == "") { |
||||
|
return array |
||||
|
} |
||||
|
|
||||
|
if (data.indexOf(',') < 0) { |
||||
|
array.push(data) |
||||
|
} else { |
||||
|
var arrayItems = data.split(',') |
||||
|
arrayItems.forEach(res => { |
||||
|
array.push(res) |
||||
|
}) |
||||
|
} |
||||
|
return array |
||||
|
} |
||||
|
|
||||
|
//查询字典项是否在列表中
|
||||
|
export function checkDirectoryItemExist(list, type) { |
||||
|
let exist = false; |
||||
|
if (list == null || list.length == 0) { |
||||
|
exist = true; |
||||
|
} else { |
||||
|
var temp = list.filter(res => { |
||||
|
if (res == type) { |
||||
|
return res |
||||
|
} |
||||
|
}) |
||||
|
if (temp != undefined && temp.length > 0) { |
||||
|
exist = true |
||||
|
} |
||||
|
} |
||||
|
return exist |
||||
|
} |
||||
|
|
||||
|
|
||||
|
//获取任务状态
|
||||
|
export function getJobStateInfo(value) { |
||||
|
var resultInfo = ""; |
||||
|
if (jobStatusList.length == 0) { |
||||
|
jobStatusList = getDirectoryInfo("job_status") |
||||
|
} |
||||
|
if (jobStatusList.length > 0) { |
||||
|
for (let item of jobStatusList) { |
||||
|
if (item.value == value) { |
||||
|
resultInfo = item |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
return resultInfo |
||||
|
} |
||||
|
|
||||
|
//获取任务状态样式
|
||||
|
export function getJobStateStyle(value) { |
||||
|
let item = getJobStateInfo(value); |
||||
|
if (item == null || item == '') { |
||||
|
return 'other' |
||||
|
} else { |
||||
|
if (item.remark == '') { |
||||
|
return 'other' |
||||
|
} else { |
||||
|
return item.remark; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
//获取库位描述(多个库位)
|
||||
|
export function getListLocationTypeDesc(list) { |
||||
|
let desc = ''; |
||||
|
list.forEach(res => { |
||||
|
desc += getLocationTypeInfo(res).label + "," |
||||
|
}) |
||||
|
desc = desc.slice(0, -1); |
||||
|
return desc; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
//获取物品状态(多个状态)
|
||||
|
export function getListItemStateDesc(list) { |
||||
|
let desc = ''; |
||||
|
list.forEach(res => { |
||||
|
desc += getItemStateInfo(res).label + "," |
||||
|
}) |
||||
|
desc = desc.slice(0, -1); |
||||
|
return desc; |
||||
|
} |
||||
|
|
||||
|
//获取物品类型(多个)
|
||||
|
export function getListItemTypeDesc(list) { |
||||
|
let desc = ''; |
||||
|
list.forEach(res => { |
||||
|
desc += getItemTypeInfo(res).label + "," |
||||
|
}) |
||||
|
desc = desc.slice(0, -1); |
||||
|
return desc; |
||||
|
} |
||||
|
|
||||
|
//获取物品类型
|
||||
|
export function getItemTypeInfo(value) { |
||||
|
var resultInfo = ""; |
||||
|
if (itemTypeList.length == 0) { |
||||
|
itemTypeList = getDirectoryInfo("item_type") |
||||
|
} |
||||
|
if (itemTypeList.length > 0) { |
||||
|
for (let item of itemTypeList) { |
||||
|
if (item.value == value) { |
||||
|
resultInfo = item |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
return resultInfo |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
//获取物品状态
|
||||
|
export function getItemStateInfo(value) { |
||||
|
var resultInfo = ""; |
||||
|
if (itemStatusList.length == 0) { |
||||
|
itemStatusList = getDirectoryInfo("item_status") |
||||
|
} |
||||
|
if (itemStatusList.length > 0) { |
||||
|
for (let item of itemStatusList) { |
||||
|
if (item.value == value) { |
||||
|
resultInfo = item |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
return resultInfo |
||||
|
} |
||||
|
|
||||
|
//获取库位类型
|
||||
|
export function getLocationTypeInfo(value) { |
||||
|
var resultInfo = ""; |
||||
|
if (locationTypeList.length == 0) { |
||||
|
locationTypeList = getDirectoryInfo("location_type") |
||||
|
} |
||||
|
if (locationTypeList.length > 0) { |
||||
|
for (let item of locationTypeList) { |
||||
|
if (item.value == value) { |
||||
|
resultInfo = item |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
return resultInfo |
||||
|
} |
||||
|
|
||||
|
//获取库位类型名称
|
||||
|
export function getLocationTypeName(value) { |
||||
|
let location = getLocationTypeInfo(value); |
||||
|
|
||||
|
return location == '' ? value : location.label; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
//获取库位类型名称
|
||||
|
export function getLocationTypeNameList(lst) { |
||||
|
let desc = ''; |
||||
|
lst.forEach(res => { |
||||
|
desc += getLocationTypeInfo(res).label + "," |
||||
|
}) |
||||
|
desc = desc.slice(0, -1); |
||||
|
return desc; |
||||
|
} |
||||
|
|
||||
|
//获取计量单位
|
||||
|
export function getUnitInfo(value) { |
||||
|
var resultInfo = ""; |
||||
|
if (uomList.length == 0) { |
||||
|
uomList = getDirectoryInfo("uom") |
||||
|
} |
||||
|
if (uomList.length > 0) { |
||||
|
for (let item of uomList) { |
||||
|
if (item.value == value) { |
||||
|
resultInfo = item |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
return resultInfo |
||||
|
} |
||||
|
|
||||
|
//获取包装单位
|
||||
|
export function getStdPackUnitInfo(value) { |
||||
|
var resultInfo = ""; |
||||
|
if (packUnitList.length == 0) { |
||||
|
packUnitList = getDirectoryInfo("pack_unit") |
||||
|
} |
||||
|
if (packUnitList.length > 0) { |
||||
|
for (let item of packUnitList) { |
||||
|
if (item.value == value) { |
||||
|
resultInfo = item |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
return resultInfo |
||||
|
} |
||||
|
|
||||
|
//获取申请状态
|
||||
|
export function getRequestStateInfo(value) { |
||||
|
var resultInfo = ""; |
||||
|
if (requestStatusList.length == 0) { |
||||
|
requestStatusList = getDirectoryInfo("request_status") |
||||
|
} |
||||
|
if (requestStatusList.length > 0) { |
||||
|
for (let item of requestStatusList) { |
||||
|
if (item.value == value) { |
||||
|
resultInfo = item |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
return resultInfo |
||||
|
} |
||||
|
|
||||
|
|
||||
|
//获取库存状态
|
||||
|
export function getInventoryStatusInfo(value) { |
||||
|
var resultInfo = ""; |
||||
|
if (inventoryStatusList.length == 0) { |
||||
|
inventoryStatusList = getDirectoryInfo("inventory_status") |
||||
|
} |
||||
|
if (inventoryStatusList.length > 0) { |
||||
|
for (let item of inventoryStatusList) { |
||||
|
if (item.value == value) { |
||||
|
resultInfo = item |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
return resultInfo |
||||
|
} |
||||
|
|
||||
|
//获取库存样式
|
||||
|
export function getInventoryStatusStyle(value) { |
||||
|
let item = getInventoryStatusInfo(value); |
||||
|
if (item == null || item == '') { |
||||
|
return 'other' |
||||
|
} else { |
||||
|
if (item.remark == '') { |
||||
|
return 'other' |
||||
|
} else { |
||||
|
return item.remark; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
//获取库存样式
|
||||
|
export function getInventoryStatusName(value) { |
||||
|
let item = getInventoryStatusInfo(value); |
||||
|
if (item == null || item == '') { |
||||
|
return value |
||||
|
} else { |
||||
|
if (item.label == '') { |
||||
|
return value |
||||
|
} else { |
||||
|
return item.label; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
//获取状态描述 list
|
||||
|
export function getInventoryStatusDesc(lst) { |
||||
|
let desc = ''; |
||||
|
lst.forEach(res => { |
||||
|
desc += getInventoryStatusInfo(res).label + "," |
||||
|
}) |
||||
|
desc = desc.slice(0, -1); |
||||
|
return desc; |
||||
|
} |
||||
|
|
||||
|
//获取器具状态
|
||||
|
export function getContainerStatusInfo(value) { |
||||
|
var resultInfo = ""; |
||||
|
if (containerTypeList.length == 0) { |
||||
|
containerTypeList = getDirectoryInfo("container_type") |
||||
|
} |
||||
|
if (containerTypeList.length > 0) { |
||||
|
for (let item of containerTypeList) { |
||||
|
if (item.value == value) { |
||||
|
resultInfo = item |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
return resultInfo |
||||
|
} |
||||
|
|
||||
|
//获取计划外入库原因
|
||||
|
export function getUnPlannedReceiptReasonList(value) { |
||||
|
if (unplannedReceiptReasonList.length == 0) { |
||||
|
unplannedReceiptReasonList = getDirectoryInfo("unplanned_receipt_reason") |
||||
|
} |
||||
|
unplannedReceiptReasonList.forEach(res => { |
||||
|
res.text = res.label; |
||||
|
res.value = res.value |
||||
|
}) |
||||
|
return unplannedReceiptReasonList |
||||
|
} |
||||
|
|
||||
|
//获取计划外出库原因
|
||||
|
export function getUnPlannedIssuseReasonList(value) { |
||||
|
if (unplannedIssueReasonList.length == 0) { |
||||
|
unplannedIssueReasonList = getDirectoryInfo("unplanned_issue_reason") |
||||
|
} |
||||
|
unplannedIssueReasonList.forEach(res => { |
||||
|
res.text = res.label; |
||||
|
res.value = res.value |
||||
|
}) |
||||
|
return unplannedIssueReasonList |
||||
|
} |
||||
|
|
||||
|
//获取报废出库原因
|
||||
|
export function getScarpReasonList(value) { |
||||
|
if (scrapReasonList.length == 0) { |
||||
|
scrapReasonList = getDirectoryInfo("scrap_reason") |
||||
|
} |
||||
|
scrapReasonList.forEach(res => { |
||||
|
res.text = res.label; |
||||
|
res.value = res.value |
||||
|
}) |
||||
|
return scrapReasonList |
||||
|
} |
||||
|
|
||||
|
//获取检验失败原因
|
||||
|
export function getInspectFailedReasonList(value) { |
||||
|
if (inspectFailedReasonList.length == 0) { |
||||
|
inspectFailedReasonList = getDirectoryInfo("inspect_failed_reason") |
||||
|
} |
||||
|
inspectFailedReasonList.forEach(res => { |
||||
|
res.text = res.label; |
||||
|
res.value = res.value |
||||
|
}) |
||||
|
return inspectFailedReasonList |
||||
|
} |
||||
|
|
||||
|
//获取检验结果
|
||||
|
export function getInspectResultList(value) { |
||||
|
if (inspectResultList.length == 0) { |
||||
|
inspectResultList = getDirectoryInfo("inspect_result") |
||||
|
} |
||||
|
inspectResultList.forEach(res => { |
||||
|
res.text = res.label; |
||||
|
res.value = res.value |
||||
|
}) |
||||
|
return inspectResultList |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
//获取下一步动作
|
||||
|
export function getNextActionList(value) { |
||||
|
if (nextActionList.length == 0) { |
||||
|
nextActionList = getDirectoryInfo("next_action") |
||||
|
} |
||||
|
nextActionList.forEach(res => { |
||||
|
res.text = res.label; |
||||
|
res.value = res.value |
||||
|
}) |
||||
|
return nextActionList |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
//获取检验类型
|
||||
|
export function getInspectType(value) { |
||||
|
var resultInfo = ""; |
||||
|
if (inspectTypeList.length == 0) { |
||||
|
inspectTypeList = getDirectoryInfo("inspect_type") |
||||
|
} |
||||
|
if (inspectTypeList.length > 0) { |
||||
|
for (let item of inspectTypeList) { |
||||
|
if (item.value == value) { |
||||
|
resultInfo = item.label |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
return resultInfo |
||||
|
} |
||||
|
//获取抽检方式
|
||||
|
export function getSampleMethod(value) { |
||||
|
var resultInfo = ""; |
||||
|
if (sampleMethodList.length == 0) { |
||||
|
sampleMethodList = getDirectoryInfo("sample_method") |
||||
|
} |
||||
|
if (sampleMethodList.length > 0) { |
||||
|
for (let item of sampleMethodList) { |
||||
|
if (item.value == value) { |
||||
|
resultInfo = item.label |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
return resultInfo |
||||
|
} |
||||
|
|
||||
|
//获取运输方式
|
||||
|
export function getTransferModeName(value) { |
||||
|
var resultInfo = ""; |
||||
|
if (transferModeList.length == 0) { |
||||
|
transferModeList = getDirectoryInfo("transfer_mode") |
||||
|
} |
||||
|
if (transferModeList.length > 0) { |
||||
|
for (let item of transferModeList) { |
||||
|
if (item.value == value) { |
||||
|
resultInfo = item.label |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
return resultInfo |
||||
|
} |
||||
|
|
||||
|
//获取盘点阶段名称
|
||||
|
export function getCountStageName(value) { |
||||
|
var resultInfo = ""; |
||||
|
if (countStageList.length == 0) { |
||||
|
countStageList = getDirectoryInfo("count_stage") |
||||
|
} |
||||
|
if (countStageList.length > 0) { |
||||
|
for (let item of countStageList) { |
||||
|
if (item.value == value) { |
||||
|
resultInfo = item.label |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
return resultInfo |
||||
|
} |
@ -0,0 +1,194 @@ |
|||||
|
let labelDic = []; |
||||
|
|
||||
|
import { |
||||
|
getLabelByHeader, |
||||
|
getPackageByNumber |
||||
|
} from '../api/request2.js'; |
||||
|
|
||||
|
import { |
||||
|
checkDirectoryItemExist, |
||||
|
getDirectoryItemArray |
||||
|
} from '../common/directory.js'; |
||||
|
|
||||
|
|
||||
|
|
||||
|
export function getLabelInfo(scanMsg,headerType, callBack) { |
||||
|
console.log('扫描信息:', scanMsg); |
||||
|
if (scanMsg.length == 0) { |
||||
|
return null |
||||
|
} |
||||
|
let items = scanMsg.split(';'); |
||||
|
let header = items[0]; |
||||
|
let version = items[1]; |
||||
|
if ((header != undefined) && (version!=undefined)) { |
||||
|
var hearList =getDirectoryItemArray(headerType) |
||||
|
if(!checkDirectoryItemExist(hearList,header)){ |
||||
|
let labelResult = { |
||||
|
label: { |
||||
|
labelType: "", |
||||
|
barType: '', |
||||
|
code:"" |
||||
|
}, |
||||
|
package: null, |
||||
|
success: false, |
||||
|
message: '请输入'+headerType+"开始的标签", |
||||
|
} |
||||
|
callBack(labelResult); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
//解析扫描的是一维码还是二维码
|
||||
|
let type = header.substring(header.length - 1, header.length); |
||||
|
if (type == 'Q') //qrcode
|
||||
|
{ |
||||
|
getQRCodeInfo(header, version, scanMsg, callBack); |
||||
|
} else if (type == 'B') //barcode
|
||||
|
{ |
||||
|
getBarCodeInfo(header, version, items[2], callBack); |
||||
|
} else { //直接输入文本
|
||||
|
getBarCodeInfo('text', 'V1.0', scanMsg, callBack); |
||||
|
} |
||||
|
}else { |
||||
|
let labelResult = { |
||||
|
label: { |
||||
|
labelType: "", |
||||
|
barType: '', |
||||
|
code:"" |
||||
|
}, |
||||
|
package: null, |
||||
|
success: false, |
||||
|
message: '标签格式不正确', |
||||
|
} |
||||
|
callBack(labelResult); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
export function getQRCodeInfo(header, version, scanMsg, callBack) { |
||||
|
//获取包装信息
|
||||
|
let labelItem = labelDic.find(r => r.header == header && r.version == version); |
||||
|
if (labelItem == undefined) { |
||||
|
let labelResult = { |
||||
|
label: { |
||||
|
barType: 'QRCode', |
||||
|
}, |
||||
|
package: {}, |
||||
|
success: true, |
||||
|
message: '' |
||||
|
} |
||||
|
getLabelByHeader(header, version).then(res => { |
||||
|
if (res.data==null) { |
||||
|
labelResult.success = false; |
||||
|
labelResult.message = '未查找到标签头为[' + header + ']的标签类型'; |
||||
|
callBack(labelResult); |
||||
|
} else { |
||||
|
let newItem = { |
||||
|
header: header, |
||||
|
version: version, |
||||
|
label: res.data, |
||||
|
}; |
||||
|
|
||||
|
labelDic.push(newItem); |
||||
|
getLabelItems(newItem, scanMsg, callBack); |
||||
|
} |
||||
|
}).catch(err => { |
||||
|
labelResult.success = false; |
||||
|
labelResult.message = err; |
||||
|
callBack(err); |
||||
|
}) |
||||
|
} else { |
||||
|
getLabelItems(labelItem, scanMsg, callBack); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
export function getLabelItems(labelItem, scanMsg, callBack) { |
||||
|
let labelResult = analysisQRCodeLabel(labelItem, scanMsg); |
||||
|
if (labelResult.label.labelType == 'PurchaseLabel' || labelResult.label.labelType == 'MakeLabel') { |
||||
|
//查询包装信息
|
||||
|
let packingNumber = labelResult.label.packingNumber |
||||
|
if (packingNumber != undefined) { |
||||
|
getPackageByNumber(packingNumber).then(pack => { |
||||
|
if (pack.data.list.length == 0) { |
||||
|
labelResult.success = false; |
||||
|
labelResult.message = '包装号[' + packingNumber + ']没有包装信息'; |
||||
|
} else { |
||||
|
labelResult.package = pack.data.list[0]; |
||||
|
console.log('包装信息', JSON.stringify(labelResult.package)) |
||||
|
} |
||||
|
callBack(labelResult); |
||||
|
}).catch(err => { |
||||
|
labelResult.success = false; |
||||
|
labelResult.message = err; |
||||
|
callBack(labelResult); |
||||
|
}) |
||||
|
} else { |
||||
|
labelResult.success = false; |
||||
|
labelResult.message = '在条码中未解析到箱码'; |
||||
|
callBack(labelResult); |
||||
|
} |
||||
|
} else { |
||||
|
callBack(labelResult); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
export function analysisQRCodeLabel(labelItem, scanMsg) { |
||||
|
let labelResult = { |
||||
|
label: { |
||||
|
labelType: labelItem.label.labelType, |
||||
|
barType: 'QRCode', |
||||
|
}, |
||||
|
package: {}, |
||||
|
success: true, |
||||
|
message: '' |
||||
|
} |
||||
|
|
||||
|
let separators = labelItem.label.separators; |
||||
|
if (separators == undefined || separators == null) { |
||||
|
labelResult.message = "未读取到分隔符"; |
||||
|
} else { |
||||
|
if (scanMsg.indexOf(separators) < 0) { |
||||
|
labelResult.success = false; |
||||
|
labelResult.message = "标签格式不正确"; |
||||
|
} else { |
||||
|
try { |
||||
|
let scanItems = scanMsg.split(separators); |
||||
|
if (scanItems.length > 0) { |
||||
|
scanItems.forEach((item, index) => { |
||||
|
let type = item.substring(0, 1); |
||||
|
let value = item.substring(1, item.length); |
||||
|
if (type == 'H') { |
||||
|
labelResult.label.header = item; |
||||
|
} else if (type == 'V') { |
||||
|
labelResult.label.version = item; |
||||
|
} else { |
||||
|
let barcode = labelItem.label.subList.find(code => code.prefixChar.toUpperCase() == |
||||
|
type |
||||
|
.toUpperCase()); |
||||
|
if (barcode != undefined) { |
||||
|
labelResult.label[barcode.code] = value; |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
} catch (e) { |
||||
|
labelResult.message = e.message; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
// console.log('标签', labelResult.label)
|
||||
|
return labelResult; |
||||
|
} |
||||
|
|
||||
|
export function getBarCodeInfo(header, version, value, callBack) { |
||||
|
let labelResult = { |
||||
|
label: { |
||||
|
labelType: header, |
||||
|
barType: 'BarCode', |
||||
|
code:value |
||||
|
}, |
||||
|
package: null, |
||||
|
success: true, |
||||
|
message: '', |
||||
|
} |
||||
|
callBack(labelResult); |
||||
|
} |
@ -0,0 +1,91 @@ |
|||||
|
import { |
||||
|
getBusinesstypeByCode |
||||
|
} from '@/api/request2.js'; |
||||
|
|
||||
|
import { |
||||
|
getDirectoryItemArray, |
||||
|
} from '@/common/directory.js'; |
||||
|
import { calc } from '@/common/calc' |
||||
|
import { Decimal } from 'decimal.js';//引入
|
||||
|
import { |
||||
|
deepCopyData |
||||
|
} from '@/common/basic.js'; |
||||
|
|
||||
|
export function createItemInfo(balance, pack) { |
||||
|
let item = { |
||||
|
itemCode: pack.itemCode, |
||||
|
itemName: pack.itemName, |
||||
|
stdPackQty: pack.stdPackQty, |
||||
|
stdPackUnit: pack.stdPackUnit, |
||||
|
qty: new Decimal(balance.qty).toNumber(), |
||||
|
handleQty:new Decimal(0).toNumber(), |
||||
|
uom: pack.uom, |
||||
|
subList: [] |
||||
|
} |
||||
|
return item; |
||||
|
} |
||||
|
|
||||
|
export function createDetailInfo(balance, pack) { |
||||
|
balance.scaned = true; |
||||
|
// data.toInventoryStatus = this.toInventoryStatus == "" ? data.inventoryStatus : this.toInventoryStatus;
|
||||
|
// data.inventoryStatus = data.inventoryStatus;
|
||||
|
let detail = deepCopyData(balance); |
||||
|
detail.balanceQty = new Decimal(detail.qty).toNumber() |
||||
|
detail.qty = new Decimal(detail.qty).toNumber(); |
||||
|
detail.stdPackQty = new Decimal(pack.stdPackQty).toNumber() |
||||
|
detail.stdPackUnit = pack.stdPackUnit |
||||
|
detail.handleQty = new Decimal(detail.qty).toNumber() ; |
||||
|
detail.package = pack; |
||||
|
|
||||
|
return detail; |
||||
|
} |
||||
|
|
||||
|
//计算实际数量
|
||||
|
export function calcHandleQty(detailSource) { |
||||
|
for (let item of detailSource) { |
||||
|
item.handleQty = new Decimal(0).toNumber(); |
||||
|
item.qty = new Decimal(0).toNumber(); |
||||
|
for (let detail of item.subList) { |
||||
|
if(detail!=undefined){ |
||||
|
if(detail.scaned){ |
||||
|
item.handleQty = calc.add(item.handleQty,detail.handleQty); |
||||
|
} |
||||
|
item.qty = calc.add(item.qty,detail.qty); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
export function getBusinessType(typeCode, callback) { |
||||
|
let result = { |
||||
|
success: true, |
||||
|
businessType: '', |
||||
|
fromlocationTypeList: '', |
||||
|
tolocationTypeList: '', |
||||
|
itemCodeTypeList:"", |
||||
|
useOnTheWay:"FALSE", |
||||
|
fromInventoryStatuses: '', |
||||
|
toInventoryStatuses: '', |
||||
|
message: '' |
||||
|
}; |
||||
|
getBusinesstypeByCode(typeCode).then(res => { |
||||
|
if (res.data.total > 0) { |
||||
|
result.businessType = res.data.list[0]; |
||||
|
result.fromlocationTypeList = getDirectoryItemArray(res.data.list[0].outLocationTypes) |
||||
|
result.tolocationTypeList = getDirectoryItemArray(res.data.list[0].inLocationTypes) |
||||
|
result.itemCodeTypeList = getDirectoryItemArray(res.data.list[0].itemTypes) |
||||
|
result.fromInventoryStatuses = res.data.list[0].outInventoryStatuses; |
||||
|
result.toInventoryStatuses = res.data.list[0].inInventoryStatuses; |
||||
|
result.useOnTheWay =res.data.list[0].useOnTheWay |
||||
|
callback(result) |
||||
|
} else { |
||||
|
result.success = false; |
||||
|
result.message = '业务类型[' + typeCode + ']获取失败'; |
||||
|
callback(result) |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
result.success = false; |
||||
|
result.message = error; |
||||
|
callback(result) |
||||
|
}) |
||||
|
} |
@ -0,0 +1,221 @@ |
|||||
|
|
||||
|
@media screen and (min-width:400px) { |
||||
|
uni-app, uni-page-head{ |
||||
|
height: 60px; |
||||
|
} |
||||
|
uni-page-head .uni-page-head{ |
||||
|
height: 60px !important; |
||||
|
} |
||||
|
uni-page-head[uni-page-head-type=default]~uni-page-wrapper{ |
||||
|
height: calc(100% - 70px) !important; |
||||
|
} |
||||
|
uni-page-head .uni-page-head__title{ |
||||
|
font-size: 1.125rem !important; |
||||
|
line-height: 40px !important; |
||||
|
font-weight: normal !important; |
||||
|
} |
||||
|
uni-page-head .uni-btn-icon{ |
||||
|
font-size: 1.725rem !important; |
||||
|
} |
||||
|
.font_xs{ |
||||
|
font-size: 0.825rem !important; |
||||
|
} |
||||
|
.font_xl{ |
||||
|
font-size: 1.325rem !important; |
||||
|
} |
||||
|
.mini-type-style{ |
||||
|
font-size: 0.8rem !important; |
||||
|
} |
||||
|
.cen_card .label_box .label_info uni-text{ |
||||
|
line-height: 1.725 !important; |
||||
|
/* font-size: 1rem !important; */ |
||||
|
color: #333; |
||||
|
} |
||||
|
.cen_card .label_box .label_info{ |
||||
|
background-color: #eee !important; |
||||
|
} |
||||
|
.popup_box .detail-list{ |
||||
|
box-shadow: none !important; |
||||
|
} |
||||
|
.detail-list,.device-detail{ |
||||
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.15) !important; |
||||
|
} |
||||
|
.list_form .uni-table-tr{ |
||||
|
background-color: #f0f0f0 !important; |
||||
|
} |
||||
|
.list_form .uni-table-th{ |
||||
|
border-bottom: 1px solid #cfcfcf !important; |
||||
|
} |
||||
|
/* yuanswitch |
||||
|
.require_wrap{ |
||||
|
padding-top: 0 !important; |
||||
|
} |
||||
|
.require_wrap .require_cell{ |
||||
|
line-height: 1.75 !important; |
||||
|
} |
||||
|
.ljh_box .tit_ljh{ |
||||
|
font-size: 1.25rem !important; |
||||
|
} |
||||
|
.cen_card .label_box .label_info { |
||||
|
background-color: #eee !important; |
||||
|
} |
||||
|
.cen_card .label_box .label_info uni-image{ |
||||
|
width: 48rpx !important; |
||||
|
height: 48rpx !important; |
||||
|
} |
||||
|
|
||||
|
.cen_card .label_box .label_info uni-text{ |
||||
|
line-height: 1.5 !important; |
||||
|
font-size: 1rem !important; |
||||
|
color: #333; |
||||
|
} |
||||
|
.ljh_box .tit_ljh .state-style, .top_card .state-style{ |
||||
|
font-size: 0.8rem !important; |
||||
|
} |
||||
|
.card_task .ljh_box{ |
||||
|
margin-bottom: 0 !important; |
||||
|
} |
||||
|
.task_num uni-image{ |
||||
|
width: 56rpx !important; |
||||
|
height: 56rpx !important; |
||||
|
} |
||||
|
.task_num uni-text{ |
||||
|
font-size: 1rem !important; |
||||
|
} |
||||
|
.pda_receipt_label .label_order uni-text{ |
||||
|
font-size: 1rem; |
||||
|
color: #434556; |
||||
|
} |
||||
|
.pda_receipt_label .icon_normal{ |
||||
|
width: 56rpx; |
||||
|
height: 56rpx; |
||||
|
} |
||||
|
.pda_receipt_bot .icon_normal{ |
||||
|
width: 56rpx; |
||||
|
height: 56rpx; |
||||
|
float: left; |
||||
|
} |
||||
|
.pda_receipt_bot .text_darkblue{ |
||||
|
float: left; |
||||
|
font-size: 1rem; |
||||
|
margin-top: 8rpx; |
||||
|
display: inline-block; |
||||
|
}*/ |
||||
|
.top_card .text_lightblue{ |
||||
|
font-size: 1rem !important; |
||||
|
} |
||||
|
.top_card .cell_box .cell_info{ |
||||
|
margin-bottom: 0; |
||||
|
} |
||||
|
.uni-tab-item-title{ |
||||
|
font-size: 1.125rem !important; |
||||
|
} |
||||
|
.cell_box .cell_info uni-view{ |
||||
|
font-size: 1rem !important; |
||||
|
color: #101010 !important; |
||||
|
} |
||||
|
.cell_box .cell_info .text_lightblue{ |
||||
|
font-size: 0.875rem !important; |
||||
|
color: #6A6E7A !important; |
||||
|
} |
||||
|
.cell_box .cell_info .text_black{ |
||||
|
font-size: 1.125rem !important; |
||||
|
|
||||
|
} |
||||
|
.scan_float uni-image{ |
||||
|
margin-top: 18rpx !important; |
||||
|
} |
||||
|
.scan_float uni-view{ |
||||
|
font-size: 0.875rem !important; |
||||
|
letter-spacing: 1px; |
||||
|
} |
||||
|
.new_btn_bot .new_save_btn,.popup_box .pop_title uni-text{ |
||||
|
font-size: 1rem !important; |
||||
|
} |
||||
|
.bot_card{ |
||||
|
background-color: #eee !important; |
||||
|
} |
||||
|
.bot_card_item uni-text{ |
||||
|
font-size: 0.8rem !important; |
||||
|
font-weight: 600; |
||||
|
} |
||||
|
.summary_state .state_point{ |
||||
|
font-size: 1rem !important; |
||||
|
} |
||||
|
.summary_item label{ |
||||
|
float: left; |
||||
|
} |
||||
|
.summary_item uni-text{ |
||||
|
font-size: 1.125rem !important; |
||||
|
font-weight: normal !important; |
||||
|
float: left; |
||||
|
} |
||||
|
/* popup */ |
||||
|
.popup_box{ |
||||
|
box-sizing: border-box; |
||||
|
} |
||||
|
.popup_box .uni-steps{ |
||||
|
width:100%; |
||||
|
overflow-x: hidden; |
||||
|
} |
||||
|
.popup_box .uni-steps__row-line-item{ |
||||
|
height: 60rpx !important; |
||||
|
} |
||||
|
.popup_box .uni-steps__row-text-container{ |
||||
|
margin-top: 0 !important; |
||||
|
} |
||||
|
.popup_box,.uni-popup .uni-scroll-view-content{ |
||||
|
border-top-left-radius:30rpx !important; |
||||
|
border-top-right-radius:30rpx !important; |
||||
|
} |
||||
|
.popup_box .pop_title{ |
||||
|
font-size: 1.125rem !important; |
||||
|
letter-spacing: 1px; |
||||
|
} |
||||
|
.popup_box .pop_tab .tab_tit{ |
||||
|
font-size: 0.875rem !important; |
||||
|
} |
||||
|
.popup_box .pop_tab .tab_tit_active{ |
||||
|
font-size: 1rem !important; |
||||
|
} |
||||
|
.popup_box .pop_tab .tab_info{ |
||||
|
min-height: 200rpx !important; |
||||
|
} |
||||
|
.popup_box .pop_tab .tab_info uni-textarea{ |
||||
|
height: 200rpx; |
||||
|
} |
||||
|
.popup_box .pop_tab .tab_info uni-button{ |
||||
|
font-size: 0.875rem !important; |
||||
|
letter-spacing: 1px; |
||||
|
} |
||||
|
/*底部按钮*/ |
||||
|
.new_btn_bot .new_save_btn{ |
||||
|
background-color: #E4EAFF !important; |
||||
|
height: 50px; |
||||
|
line-height: 50px; |
||||
|
} |
||||
|
.new_btn_bot .new_clear_btn{ |
||||
|
font-size: 1rem !important; |
||||
|
line-height: 50px; |
||||
|
} |
||||
|
.scroll-detail{ |
||||
|
padding-bottom: 70px !important; |
||||
|
} |
||||
|
.count_shadow,.device-detail{ |
||||
|
box-shadow: 0 0 20rpx rgba(0,0,0,0.2); |
||||
|
} |
||||
|
.list_info { |
||||
|
padding: 0 20rpx 20rpx; |
||||
|
margin-top: 0; |
||||
|
} |
||||
|
.uni-scroll-view-content .creattp_list{ |
||||
|
width: 100% !important; |
||||
|
} |
||||
|
.creattp_list .uni-list .list_cell uni-text{ |
||||
|
font-weight: bold; |
||||
|
} |
||||
|
.popup_box .scan_scroll{ |
||||
|
max-height: 44vh !important; |
||||
|
|
||||
|
} |
||||
|
} |
File diff suppressed because it is too large
@ -0,0 +1,762 @@ |
|||||
|
/* |
||||
|
.pda-list { |
||||
|
padding: 10rpx 10rpx; |
||||
|
box-sizing: border-box; |
||||
|
display: flex; |
||||
|
width: 100%; |
||||
|
flex-direction: row; |
||||
|
} |
||||
|
*/ |
||||
|
|
||||
|
/* 列表 */ |
||||
|
.pda-list { |
||||
|
padding: 0 20rpx; |
||||
|
box-sizing: border-box; |
||||
|
background-color: #FFFFFF; |
||||
|
position: relative; |
||||
|
width: 100%; |
||||
|
display: flex; |
||||
|
flex-direction: column; |
||||
|
border-radius: 16rpx; |
||||
|
margin-bottom: 10rpx; |
||||
|
} |
||||
|
|
||||
|
.pda-list:after { |
||||
|
position: absolute; |
||||
|
z-index: 10; |
||||
|
/* right: 0; */ |
||||
|
bottom: 0; |
||||
|
left: 0; |
||||
|
height: 1px; |
||||
|
content: ''; |
||||
|
-webkit-transform: scaleY(.5); |
||||
|
transform: scaleY(.5); |
||||
|
background-color: #c8c7cc; |
||||
|
} |
||||
|
|
||||
|
.pda-list-cell { |
||||
|
position: relative; |
||||
|
display: flex; |
||||
|
flex-direction: row; |
||||
|
justify-content: space-between; |
||||
|
align-items: center; |
||||
|
border-bottom: 1px solid #eee; |
||||
|
padding: 10rpx 0; |
||||
|
} |
||||
|
|
||||
|
.pda-list-cell:last-child { |
||||
|
border-bottom: 0; |
||||
|
} |
||||
|
|
||||
|
.pda-list-cell-left { |
||||
|
white-space: nowrap; |
||||
|
/* padding: 0 10rpx; */ |
||||
|
} |
||||
|
|
||||
|
.pda-list-cell-db, |
||||
|
.pda-list-cell-right { |
||||
|
flex: 1; |
||||
|
} |
||||
|
|
||||
|
.pda-list-cell .pda-list-cell-db .uni-input-input { |
||||
|
font-size: .875rem; |
||||
|
} |
||||
|
|
||||
|
.pda-list-cell .uni-easyinput__content-input, |
||||
|
.pda-list-cell .uni-input-placeholder { |
||||
|
height: 2rem; |
||||
|
line-height: 2rem; |
||||
|
} |
||||
|
|
||||
|
.pda-list-cell .placeholder { |
||||
|
color: #999 !important; |
||||
|
font-size: 0.875rem; |
||||
|
padding-left: 10rpx; |
||||
|
} |
||||
|
|
||||
|
.pda-list-cell .uni-label { |
||||
|
color: #434556; |
||||
|
} |
||||
|
|
||||
|
.list_locode .uni-collapse-item__title-box { |
||||
|
font-weight: bold !important; |
||||
|
} |
||||
|
|
||||
|
.display-flex { |
||||
|
display: flex; |
||||
|
justify-content: space-between; |
||||
|
align-items: center; |
||||
|
} |
||||
|
|
||||
|
.list-body { |
||||
|
/* height: 84rpx; */ |
||||
|
display: flex; |
||||
|
flex: 1; |
||||
|
flex-direction: column; |
||||
|
justify-content: space-between; |
||||
|
align-items: flex-start; |
||||
|
overflow: hidden; |
||||
|
} |
||||
|
|
||||
|
.list-text-top { |
||||
|
width: 100%; |
||||
|
color: #000; |
||||
|
font-weight: bolder; |
||||
|
/* line-height: 36rpx; */ |
||||
|
/* font-size: 30rpx; */ |
||||
|
} |
||||
|
|
||||
|
.list-text-bottom { |
||||
|
/* line-height: 30rpx; */ |
||||
|
/* font-size: 26rpx; */ |
||||
|
color: #8f8f94; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/* 改为detail-content */ |
||||
|
/* margin-bottom: 20rpx; */ |
||||
|
.device-detail { |
||||
|
padding: 10rpx !important; |
||||
|
margin: 10rpx; |
||||
|
border-radius: 16rpx; |
||||
|
background-color: #fff; |
||||
|
color: #666666; |
||||
|
line-height: 1.5; |
||||
|
overflow: hidden; |
||||
|
} |
||||
|
|
||||
|
.list-style { |
||||
|
margin-bottom: 0rpx; |
||||
|
border-radius: 16rpx; |
||||
|
background-color: #FFFFFF; |
||||
|
color: #666666; |
||||
|
line-height: 1.5; |
||||
|
} |
||||
|
|
||||
|
.border-font { |
||||
|
color: #000; |
||||
|
font-weight: bolder; |
||||
|
} |
||||
|
|
||||
|
.space-between { |
||||
|
-webkit-justify-content: space-between; |
||||
|
justify-content: space-between; |
||||
|
} |
||||
|
|
||||
|
.accept-button { |
||||
|
width: 30%; |
||||
|
font-size: 16px; |
||||
|
background-color: #7ac756; |
||||
|
color: #ffffff; |
||||
|
} |
||||
|
|
||||
|
.bigsave-button { |
||||
|
width: 80%; |
||||
|
font-size: 16px; |
||||
|
background-color: #007AFF; |
||||
|
color: #ffffff; |
||||
|
} |
||||
|
|
||||
|
.save-button { |
||||
|
width: 30%; |
||||
|
font-size: 16px; |
||||
|
background-color: #007AFF; |
||||
|
color: #ffffff; |
||||
|
} |
||||
|
|
||||
|
.scroll-detail { |
||||
|
overflow: hidden; |
||||
|
padding-bottom: 60px; |
||||
|
height: 480px; |
||||
|
/* 没有高度不可以回到顶部 */ |
||||
|
/* background-color: #ffffff; */ |
||||
|
} |
||||
|
|
||||
|
.scrollView { |
||||
|
overflow: hidden; |
||||
|
padding-bottom: 50px |
||||
|
} |
||||
|
|
||||
|
.scroll-Y { |
||||
|
/* height: 70ux; */ |
||||
|
padding-bottom: 50px |
||||
|
} |
||||
|
|
||||
|
.bottom1 { |
||||
|
position: fixed; |
||||
|
width: 100%; |
||||
|
/* padding: 10rpx 10rpx; */ |
||||
|
left: 0; |
||||
|
/* right: 0; */ |
||||
|
bottom: 0; |
||||
|
background-color: #ffffff; |
||||
|
} |
||||
|
|
||||
|
.bottom { |
||||
|
position: fixed; |
||||
|
display: flex; |
||||
|
width: 100%; |
||||
|
padding: 10rpx 10rpx; |
||||
|
left: 0; |
||||
|
/* right: 0; */ |
||||
|
bottom: 0; |
||||
|
background-color: #ffffff; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
.pars-num { |
||||
|
/* font-size: 26rpx; */ |
||||
|
} |
||||
|
|
||||
|
.right-width { |
||||
|
text-align: center; |
||||
|
width: 100rpx; |
||||
|
} |
||||
|
|
||||
|
.state-style { |
||||
|
float: left; |
||||
|
margin-top: 10rpx; |
||||
|
/* border-radius: 16rpx; |
||||
|
padding: 0rpx 10rpx; */ |
||||
|
/* line-height: 50rpx; |
||||
|
height: 50rpx; */ |
||||
|
/* width: 120rpx; |
||||
|
display: flex; |
||||
|
flex-direction: column; |
||||
|
align-items: center; */ |
||||
|
/* 垂直居中 */ |
||||
|
} |
||||
|
|
||||
|
.uni-popup-view { |
||||
|
background-color: #fff; |
||||
|
border-radius: 10px; |
||||
|
} |
||||
|
|
||||
|
.uni-popup-button-box { |
||||
|
/* #ifndef APP-NVUE */ |
||||
|
display: flex; |
||||
|
/* #endif */ |
||||
|
flex-direction: row; |
||||
|
padding: 10px 15px; |
||||
|
} |
||||
|
|
||||
|
.uni-popup-button { |
||||
|
flex: 1; |
||||
|
/* // border-radius: 50px; |
||||
|
// color: #666; */ |
||||
|
/* font-size: 16px; */ |
||||
|
} |
||||
|
|
||||
|
/* 任务状态 */ |
||||
|
/* 打开 */ |
||||
|
.open { |
||||
|
font-size: 28rpx; |
||||
|
background: rgba(95, 203, 148, 0.2); |
||||
|
color: #22AF68; |
||||
|
padding: 10rpx 20rpx 10rpx 20rpx; |
||||
|
border-radius: 10rpx; |
||||
|
} |
||||
|
|
||||
|
/* 进行中 */ |
||||
|
.pending { |
||||
|
font-size: 28rpx; |
||||
|
background: rgba(236, 156, 0, 0.2); |
||||
|
color: #EC9C00; |
||||
|
padding: 10rpx 20rpx 10rpx 20rpx; |
||||
|
border-radius: 10rpx; |
||||
|
} |
||||
|
|
||||
|
/* 完成 */ |
||||
|
.completed { |
||||
|
background-color: #E6A23C; |
||||
|
color: #FFFFFF; |
||||
|
border-radius: 10rpx; |
||||
|
} |
||||
|
|
||||
|
/* 关闭 */ |
||||
|
.close { |
||||
|
background-color: #F56C6C; |
||||
|
color: #FFFFFF; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/* 关闭 */ |
||||
|
.other { |
||||
|
background-color: #808080; |
||||
|
color: #FFFFFF; |
||||
|
border-radius: 10rpx; |
||||
|
} |
||||
|
|
||||
|
/* 其他 */ |
||||
|
.unk { |
||||
|
background-color: #ececec; |
||||
|
color: #666; |
||||
|
border-radius: 10rpx; |
||||
|
} |
||||
|
|
||||
|
/* 检验任务状态 */ |
||||
|
/* 免检 */ |
||||
|
.exempt { |
||||
|
background-color: #409EFF; |
||||
|
color: #FFFFFF; |
||||
|
} |
||||
|
|
||||
|
/* 全检 */ |
||||
|
.full { |
||||
|
background-color: #67C23A; |
||||
|
color: #FFFFFF; |
||||
|
} |
||||
|
|
||||
|
/* 抽检 */ |
||||
|
.sampling { |
||||
|
background-color: #E6A23C; |
||||
|
color: #FFFFFF; |
||||
|
} |
||||
|
|
||||
|
/* 挑检 */ |
||||
|
.pick { |
||||
|
background-color: #F56C6C; |
||||
|
color: #FFFFFF; |
||||
|
} |
||||
|
|
||||
|
/* 库存状态 */ |
||||
|
|
||||
|
.uni-link { |
||||
|
background-color: #BD2C00; |
||||
|
color: #BD2C00 !important; |
||||
|
} |
||||
|
|
||||
|
.inventory_status_insp { |
||||
|
color: #F9AE3D; |
||||
|
margin-right: 10rpx; |
||||
|
} |
||||
|
|
||||
|
.inventory_status_ok { |
||||
|
color: #67C23A; |
||||
|
margin-right: 10rpx; |
||||
|
} |
||||
|
|
||||
|
.inventory_status_nok { |
||||
|
color: #FF2424; |
||||
|
margin-right: 10rpx; |
||||
|
} |
||||
|
|
||||
|
.inventory_status_hold { |
||||
|
color: #EC9C00; |
||||
|
margin-right: 10rpx; |
||||
|
} |
||||
|
|
||||
|
.inventory_status_scarp { |
||||
|
color: #999; |
||||
|
margin-right: 10rpx; |
||||
|
} |
||||
|
|
||||
|
.frozen { |
||||
|
color: #FF581D; |
||||
|
margin-right: 10rpx; |
||||
|
} |
||||
|
|
||||
|
.pass { |
||||
|
color: #67C23A !important; |
||||
|
} |
||||
|
|
||||
|
.unPass { |
||||
|
color: #FF2424 !important; |
||||
|
} |
||||
|
|
||||
|
.location_inspect { |
||||
|
background-color: #F6CB61; |
||||
|
color: #FFFFFF; |
||||
|
} |
||||
|
|
||||
|
.location_raw { |
||||
|
background-color: #2DA8D8; |
||||
|
color: #FFFFFF; |
||||
|
} |
||||
|
|
||||
|
.location_semi { |
||||
|
background-color: #EDAE50; |
||||
|
color: #FFFFFF; |
||||
|
} |
||||
|
|
||||
|
.location_fg { |
||||
|
background-color: #078343; |
||||
|
color: #FFFFFF; |
||||
|
} |
||||
|
|
||||
|
.location_wip { |
||||
|
background-color: #FC85FE; |
||||
|
color: #FFFFFF; |
||||
|
} |
||||
|
|
||||
|
.location_scrap { |
||||
|
background-color: #E30016; |
||||
|
color: #FFFFFF; |
||||
|
} |
||||
|
|
||||
|
.location_noc { |
||||
|
background-color: #C31223; |
||||
|
color: #FFFFFF; |
||||
|
} |
||||
|
|
||||
|
.location_overflow { |
||||
|
background-color: #7D1EDC; |
||||
|
color: #FFFFFF; |
||||
|
} |
||||
|
|
||||
|
.location_customer { |
||||
|
background-color: #5A7CF3; |
||||
|
color: #FFFFFF; |
||||
|
} |
||||
|
|
||||
|
.location_hold { |
||||
|
background-color: #FF8C00; |
||||
|
color: #FFFFFF; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
/* //物料状态 |
||||
|
export function getItemTypeStyle(val) { |
||||
|
if (val == 0) return 'active' |
||||
|
else if (val == 1) return 'hold' |
||||
|
else if (val == 2) return 'new' |
||||
|
else if (val == 3) return 'plan' |
||||
|
else if (val == 4) return 'disable' |
||||
|
else return 'other' |
||||
|
} |
||||
|
*/ |
||||
|
|
||||
|
/* 物料状态 */ |
||||
|
.active { |
||||
|
background-color: #5FCB94; |
||||
|
color: #FFFFFF; |
||||
|
} |
||||
|
|
||||
|
.hold_item { |
||||
|
background-color: #FF4206; |
||||
|
color: #FFFFFF; |
||||
|
} |
||||
|
|
||||
|
.new { |
||||
|
background-color: #E6A23C; |
||||
|
color: #FFFFFF; |
||||
|
} |
||||
|
|
||||
|
.plan { |
||||
|
background-color: #2677F9; |
||||
|
color: #FFFFFF; |
||||
|
} |
||||
|
|
||||
|
.disable { |
||||
|
background-color: #666; |
||||
|
color: #FFFFFF; |
||||
|
} |
||||
|
|
||||
|
/* 任务编号字体 */ |
||||
|
.text-number { |
||||
|
color: #000; |
||||
|
font-weight: bolder; |
||||
|
} |
||||
|
|
||||
|
/* 物料编号字体 */ |
||||
|
.text-itemcode { |
||||
|
/* font-size: 26rpx; */ |
||||
|
color: #000; |
||||
|
font-weight: bolder; |
||||
|
} |
||||
|
|
||||
|
.text-desc { |
||||
|
color: #8f8f91; |
||||
|
/* font-size: 22rpx; */ |
||||
|
} |
||||
|
|
||||
|
/* 物料编号字体 */ |
||||
|
.text-bolder { |
||||
|
color: #000; |
||||
|
font-weight: bolder; |
||||
|
} |
||||
|
|
||||
|
.detail-list { |
||||
|
background-color: #fff; |
||||
|
padding:5rpx 10rpx; |
||||
|
/* margin: 20rpx; */ |
||||
|
/* border-radius: 16rpx; */ |
||||
|
/* overflow: hidden; */ |
||||
|
} |
||||
|
|
||||
|
.detail-content { |
||||
|
position: relative; |
||||
|
flex: 1; |
||||
|
/* font-size: 26rpx; */ |
||||
|
color: #101010; |
||||
|
} |
||||
|
|
||||
|
.example-body { |
||||
|
background-color: #FFFFFF; |
||||
|
} |
||||
|
|
||||
|
.result-box { |
||||
|
text-align: center; |
||||
|
padding: 20px 0px; |
||||
|
/* font-size: 16px; */ |
||||
|
} |
||||
|
|
||||
|
.toptext { |
||||
|
padding-left: 20upx; |
||||
|
line-height: 80upx; |
||||
|
} |
||||
|
|
||||
|
.numberstyle { |
||||
|
display: flex; |
||||
|
/* flex-direction: row-reverse; */ |
||||
|
border-bottom: 10upx solid #EEEEEE; |
||||
|
width: 200upx; |
||||
|
padding-bottom: 20upx; |
||||
|
} |
||||
|
|
||||
|
.input { |
||||
|
height: 20rpx; |
||||
|
padding: 0rpx 8rpx; |
||||
|
line-height: 50rpx; |
||||
|
/* font-size: 25rpx; */ |
||||
|
background: #FFF; |
||||
|
border-radius: 4rpx; |
||||
|
flex: 1; |
||||
|
} |
||||
|
|
||||
|
.mini-type-style { |
||||
|
vertical-align: middle; |
||||
|
font-size: 0.725rem; |
||||
|
margin-right: 6rpx; |
||||
|
border-radius: 4rpx; |
||||
|
padding: 4rpx 8rpx; |
||||
|
/* width: 80rpx; */ |
||||
|
/* height: 46rpx; |
||||
|
min-width: 80rpx; |
||||
|
display: flex; |
||||
|
flex-direction: column; */ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
.text-color { |
||||
|
color: #000; |
||||
|
font-weight: bolder; |
||||
|
} |
||||
|
|
||||
|
.tabs { |
||||
|
flex: 1; |
||||
|
flex-direction: column; |
||||
|
overflow: hidden; |
||||
|
/* background-color: #ffffff; */ |
||||
|
} |
||||
|
|
||||
|
/* .scroll-h { |
||||
|
touch-action: none; |
||||
|
width: 100%; |
||||
|
height: 100rpx; |
||||
|
flex-direction: row; |
||||
|
white-space: nowrap; |
||||
|
justify-content: center; |
||||
|
} */ |
||||
|
|
||||
|
.line-h { |
||||
|
height: 1rpx; |
||||
|
background-color: #cccccc; |
||||
|
} |
||||
|
|
||||
|
.uni-tab-item { |
||||
|
/* #ifndef APP-PLUS */ |
||||
|
display: inline-block; |
||||
|
/* #endif */ |
||||
|
flex-wrap: nowrap; |
||||
|
padding: 0 30rpx; |
||||
|
} |
||||
|
|
||||
|
.uni-tab-item-title { |
||||
|
position: relative; |
||||
|
color: #555; |
||||
|
/* font-size: 24rpx; */ |
||||
|
height: 100rpx; |
||||
|
line-height: 100rpx; |
||||
|
flex-wrap: nowrap; |
||||
|
/* #ifndef APP-PLUS */ |
||||
|
white-space: nowrap; |
||||
|
/* #endif */ |
||||
|
} |
||||
|
|
||||
|
.uni-tab-item-title-active { |
||||
|
color: #101010; |
||||
|
font-weight: bold; |
||||
|
} |
||||
|
|
||||
|
.uni-tab-item-title-active:after { |
||||
|
left: 50%; |
||||
|
transform: translateX(-50%); |
||||
|
position: absolute; |
||||
|
bottom: -20rpx; |
||||
|
display: inline-block; |
||||
|
content: ""; |
||||
|
width: 40rpx; |
||||
|
height: 8rpx; |
||||
|
background-color: #5a7cf3; |
||||
|
border-radius: 5px; |
||||
|
} |
||||
|
|
||||
|
/* .blece { |
||||
|
padding: 10upx; |
||||
|
color: #111111; |
||||
|
border-bottom: 2px solid #f5f5f5; |
||||
|
display: flex; |
||||
|
flex-wrap: wrap; |
||||
|
} */ |
||||
|
|
||||
|
.conbox { |
||||
|
/* padding: 10rpx 0; */ |
||||
|
padding-left: 10rpx; |
||||
|
} |
||||
|
|
||||
|
.myinput { |
||||
|
display: flex; |
||||
|
box-sizing: border-box; |
||||
|
overflow: hidden; |
||||
|
position: relative; |
||||
|
flex: 1; |
||||
|
justify-content: center; |
||||
|
flex-direction: row; |
||||
|
align-items: center; |
||||
|
height: 88rpx; |
||||
|
padding: 20rpx 0; |
||||
|
/* border-width: 0.5px; |
||||
|
border-style: solid; |
||||
|
border-color: #e5e5e5; |
||||
|
border-radius: 5px; |
||||
|
background-color: rgb(248, 248, 248); |
||||
|
font-size: 18px;*/ |
||||
|
font-size: .825rem; |
||||
|
} |
||||
|
|
||||
|
.qtyinput { |
||||
|
height: 50px; |
||||
|
padding: 10px 0px; |
||||
|
font-size: 20px; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
.count-input { |
||||
|
padding: 5rpx 3rpx; |
||||
|
width: 95%; |
||||
|
font-size: 18px; |
||||
|
} |
||||
|
|
||||
|
.pda-data-picker { |
||||
|
padding: 5rpx 3rpx; |
||||
|
width: 95%; |
||||
|
font-size: 18px; |
||||
|
} |
||||
|
|
||||
|
.inputPlaceholderStyle { |
||||
|
font-size: 16px; |
||||
|
} |
||||
|
|
||||
|
.inputfocus { |
||||
|
border-color: #007AFF; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
.txt-16 { |
||||
|
font-size: 16px; |
||||
|
} |
||||
|
|
||||
|
.txt-18 { |
||||
|
font-size: 18px; |
||||
|
} |
||||
|
|
||||
|
.txt-20 { |
||||
|
font-size: 20px; |
||||
|
} |
||||
|
|
||||
|
.pda-label { |
||||
|
width: 210rpx; |
||||
|
word-wrap: break-word; |
||||
|
word-break: break-all; |
||||
|
text-indent: 20rpx; |
||||
|
font-size: 16px; |
||||
|
} |
||||
|
|
||||
|
.fontsize-16 { |
||||
|
font-size: 16px; |
||||
|
} |
||||
|
|
||||
|
.fontsize-18 { |
||||
|
font-size: 18px; |
||||
|
} |
||||
|
|
||||
|
.fontsize-20 { |
||||
|
font-size: 20px; |
||||
|
} |
||||
|
|
||||
|
/deep/ .uni-collapse-item__title-text { |
||||
|
font-size: 16px; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/deep/ .input-value { |
||||
|
font-size: 16px; |
||||
|
} |
||||
|
|
||||
|
/deep/ .uni-input-input { |
||||
|
font-size: 18px; |
||||
|
} |
||||
|
|
||||
|
page { |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
/* background-color: #fff; */ |
||||
|
} |
||||
|
|
||||
|
.page-wraper { |
||||
|
display: flex; |
||||
|
flex-direction: column; |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
/* background-color: #fff; */ |
||||
|
} |
||||
|
|
||||
|
.page-header { |
||||
|
background-color: #fff; |
||||
|
font-size: 35rpx; |
||||
|
padding: 10rpx 20rpx; |
||||
|
} |
||||
|
|
||||
|
.page-header .header_item { |
||||
|
/* padding-left: 10rpx; */ |
||||
|
padding: 5rpx 10rpx; |
||||
|
font-size:32rpx ; |
||||
|
} |
||||
|
|
||||
|
.page-header .header_job_top { |
||||
|
padding:5rpx 0rpx; |
||||
|
} |
||||
|
.page-main { |
||||
|
flex: 1; |
||||
|
position: relative; |
||||
|
background: #fff; |
||||
|
} |
||||
|
|
||||
|
.page-main-scroll { |
||||
|
position: absolute; |
||||
|
left: 0; |
||||
|
right: 0; |
||||
|
top: 0; |
||||
|
bottom: 0; |
||||
|
} |
||||
|
|
||||
|
.page-main-list { |
||||
|
/* height: 80rpx; |
||||
|
line-height: 80rpx; */ |
||||
|
text-align: center; |
||||
|
background: #e0e0e0; |
||||
|
|
||||
|
} |
File diff suppressed because it is too large
@ -0,0 +1,21 @@ |
|||||
|
const AccessTokenKey = 'ACCESS_TOKEN' |
||||
|
const RefreshTokenKey = 'REFRESH_TOKEN' |
||||
|
|
||||
|
// ========== Token 相关 ==========
|
||||
|
export function getAccessToken() { |
||||
|
return uni.getStorageSync(AccessTokenKey) |
||||
|
} |
||||
|
|
||||
|
export function getRefreshToken() { |
||||
|
return uni.getStorageSync(RefreshTokenKey) |
||||
|
} |
||||
|
|
||||
|
export function setToken(token) { |
||||
|
uni.setStorageSync(AccessTokenKey, token.accessToken) |
||||
|
uni.setStorageSync(RefreshTokenKey, token.refreshToken) |
||||
|
} |
||||
|
|
||||
|
export function removeToken() { |
||||
|
uni.removeStorageSync(AccessTokenKey) |
||||
|
uni.removeStorageSync(RefreshTokenKey) |
||||
|
} |
@ -0,0 +1,54 @@ |
|||||
|
/** |
||||
|
* 显示消息提示框 |
||||
|
* @param content 提示的标题 |
||||
|
*/ |
||||
|
export function toast(content) { |
||||
|
uni.showToast({ |
||||
|
icon: 'none', |
||||
|
title: content |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 显示模态弹窗 |
||||
|
* @param content 提示的标题 |
||||
|
*/ |
||||
|
export function showConfirm(content) { |
||||
|
return new Promise((resolve, reject) => { |
||||
|
uni.showModal({ |
||||
|
title: '提示', |
||||
|
content: content, |
||||
|
cancelText: '取消', |
||||
|
confirmText: '确定', |
||||
|
success: function(res) { |
||||
|
resolve(res) |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 参数处理 |
||||
|
* @param params 参数 |
||||
|
*/ |
||||
|
export function tansParams(params) { |
||||
|
let result = '' |
||||
|
for (const propName of Object.keys(params)) { |
||||
|
const value = params[propName] |
||||
|
var part = encodeURIComponent(propName) + "=" |
||||
|
if (value !== null && value !== "" && typeof (value) !== "undefined") { |
||||
|
if (typeof value === 'object') { |
||||
|
for (const key of Object.keys(value)) { |
||||
|
if (value[key] !== null && value[key] !== "" && typeof (value[key]) !== 'undefined') { |
||||
|
let params = propName + '[' + key + ']' |
||||
|
var subPart = encodeURIComponent(params) + "=" |
||||
|
result += subPart + encodeURIComponent(value[key]) + "&" |
||||
|
} |
||||
|
} |
||||
|
} else { |
||||
|
result += part + encodeURIComponent(value) + "&" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
return result |
||||
|
} |
@ -0,0 +1,9 @@ |
|||||
|
const constant = { |
||||
|
avatar: 'vuex_avatar', |
||||
|
name: 'vuex_name', |
||||
|
roles: 'vuex_roles', |
||||
|
permissions: 'vuex_permissions', |
||||
|
tenantId:'vuex_tenantId' |
||||
|
} |
||||
|
|
||||
|
export default constant |
@ -0,0 +1,6 @@ |
|||||
|
export default { |
||||
|
'401': '认证失败,无法访问系统资源', |
||||
|
'403': '当前操作没有权限', |
||||
|
'404': '访问资源不存在', |
||||
|
'default': '系统未知错误,请反馈给管理员' |
||||
|
} |
@ -0,0 +1,51 @@ |
|||||
|
import store from '@/store' |
||||
|
|
||||
|
/** |
||||
|
* 字符权限校验 |
||||
|
* @param {Array} value 校验值 |
||||
|
* @returns {Boolean} |
||||
|
*/ |
||||
|
export function checkPermi(value) { |
||||
|
if (value && value instanceof Array && value.length > 0) { |
||||
|
const permissions = store.getters && store.getters.permissions |
||||
|
const permissionDatas = value |
||||
|
const all_permission = "*:*:*" |
||||
|
|
||||
|
const hasPermission = permissions.some(permission => { |
||||
|
return all_permission === permission || permissionDatas.includes(permission) |
||||
|
}) |
||||
|
|
||||
|
if (!hasPermission) { |
||||
|
return false |
||||
|
} |
||||
|
return true |
||||
|
} else { |
||||
|
console.error(`need roles! Like checkPermi="['system:user:add','system:user:edit']"`) |
||||
|
return false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 角色权限校验 |
||||
|
* @param {Array} value 校验值 |
||||
|
* @returns {Boolean} |
||||
|
*/ |
||||
|
export function checkRole(value) { |
||||
|
if (value && value instanceof Array && value.length > 0) { |
||||
|
const roles = store.getters && store.getters.roles |
||||
|
const permissionRoles = value |
||||
|
const super_admin = "admin" |
||||
|
|
||||
|
const hasRole = roles.some(role => { |
||||
|
return super_admin === role || permissionRoles.includes(role) |
||||
|
}) |
||||
|
|
||||
|
if (!hasRole) { |
||||
|
return false |
||||
|
} |
||||
|
return true |
||||
|
} else { |
||||
|
console.error(`need roles! Like checkRole="['admin','editor']"`) |
||||
|
return false |
||||
|
} |
||||
|
} |
@ -0,0 +1,47 @@ |
|||||
|
/** |
||||
|
* 通用js方法封装处理 |
||||
|
* Copyright (c) 2019 ruoyi |
||||
|
*/ |
||||
|
|
||||
|
// 日期格式化
|
||||
|
export function parseTime(time, pattern) { |
||||
|
if (arguments.length === 0 || !time) { |
||||
|
return null |
||||
|
} |
||||
|
const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}' |
||||
|
let date |
||||
|
if (typeof time === 'object') { |
||||
|
date = time |
||||
|
} else { |
||||
|
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) { |
||||
|
time = parseInt(time) |
||||
|
} else if (typeof time === 'string') { |
||||
|
time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.[\d]{3}/gm),''); |
||||
|
} |
||||
|
if ((typeof time === 'number') && (time.toString().length === 10)) { |
||||
|
time = time * 1000 |
||||
|
} |
||||
|
date = new Date(time) |
||||
|
} |
||||
|
const formatObj = { |
||||
|
y: date.getFullYear(), |
||||
|
m: date.getMonth() + 1, |
||||
|
d: date.getDate(), |
||||
|
h: date.getHours(), |
||||
|
i: date.getMinutes(), |
||||
|
s: date.getSeconds(), |
||||
|
a: date.getDay() |
||||
|
} |
||||
|
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => { |
||||
|
let value = formatObj[key] |
||||
|
// Note: getDay() returns 0 on Sunday
|
||||
|
if (key === 'a') { |
||||
|
return ['日', '一', '二', '三', '四', '五', '六'][value] |
||||
|
} |
||||
|
if (result.length > 0 && value < 10) { |
||||
|
value = '0' + value |
||||
|
} |
||||
|
return value || 0 |
||||
|
}) |
||||
|
return time_str |
||||
|
} |
@ -0,0 +1,37 @@ |
|||||
|
// 获取本地存储对应key
|
||||
|
const getStorage = (key)=>{ |
||||
|
return uni.getStorageSync( key ); |
||||
|
} |
||||
|
|
||||
|
// 设置本地存储对应key
|
||||
|
const setStorage = (key,value)=>{ |
||||
|
return uni.setStorageSync( key,value ); |
||||
|
} |
||||
|
|
||||
|
// 清除全部本地存储
|
||||
|
const clearStorage = ()=>{ |
||||
|
uni.clearStorageSync(); |
||||
|
} |
||||
|
|
||||
|
// 清除指定key本地存储
|
||||
|
const removeStorage = ( key )=>{ |
||||
|
uni.removeStorageSync( key ); |
||||
|
} |
||||
|
|
||||
|
const constant = { |
||||
|
id:"id", |
||||
|
token:"token", |
||||
|
avatar: 'avatar', |
||||
|
name: 'name', |
||||
|
roles: 'roles', |
||||
|
permissions: 'permissions' |
||||
|
} |
||||
|
|
||||
|
|
||||
|
export default { |
||||
|
getStorage, |
||||
|
setStorage, |
||||
|
clearStorage, |
||||
|
removeStorage, |
||||
|
constant |
||||
|
} |
@ -0,0 +1,181 @@ |
|||||
|
import amap from '@/components/amap-wx/lib/amap-wx.js'; |
||||
|
// 地铁颜色图
|
||||
|
const line = { |
||||
|
'1号线': '#C43B33', |
||||
|
'2号线': '#016299', |
||||
|
'4号线/大兴线': '#008E9C', |
||||
|
'5号线': '#A42380', |
||||
|
'6号线': '#D09900', |
||||
|
'7号线': '#F2C172', |
||||
|
'8号线': '#009D6A', |
||||
|
'9号线': '#8FC41E', |
||||
|
'10号线': '#009DBE', |
||||
|
'13号线': '#F9E701', |
||||
|
'14号线东段': '#D4A7A2', |
||||
|
'14号线西段': '#D4A7A2', |
||||
|
'15号线': '#5D2D69', |
||||
|
'八通线': '#C33A32', |
||||
|
'昌平线': '#DE82B1', |
||||
|
'亦庄线': '#E40177', |
||||
|
'房山线': '#E66021', |
||||
|
'机场线': '#A29BBC', |
||||
|
} |
||||
|
|
||||
|
// 150500:地铁站 ,150700:公交站 , 190700:地名地址
|
||||
|
const typecode = [{ |
||||
|
id: '150500', |
||||
|
icon: 'icon-ditie' |
||||
|
}, { |
||||
|
id: '150700', |
||||
|
icon: 'icon-gongjiao' |
||||
|
}, { |
||||
|
id: '190700', |
||||
|
icon: 'icon-gonglu' |
||||
|
}]; |
||||
|
|
||||
|
const util = { |
||||
|
key:'b526b09b86cd2996e7732be8ab8c4430', |
||||
|
/** |
||||
|
* 初始化高德地图api |
||||
|
*/ |
||||
|
mapInit() { |
||||
|
return new amap.AMapWX({ |
||||
|
key: this.key |
||||
|
}); |
||||
|
}, |
||||
|
// 服务状态吗
|
||||
|
typecode, |
||||
|
/** |
||||
|
* 获取地图颜色 |
||||
|
*/ |
||||
|
lineColor(name) { |
||||
|
if (line[name]) { |
||||
|
return line[name]; |
||||
|
} else { |
||||
|
return '#ccc'; |
||||
|
} |
||||
|
}, |
||||
|
/** |
||||
|
* 关键字颜色变化 |
||||
|
*/ |
||||
|
serachNmme(val, name) { |
||||
|
let namestr = new RegExp(val); |
||||
|
let nameresult = |
||||
|
`<div style="font-size: 14px;color: #333;line-height: 1.5;">
|
||||
|
${name.replace(namestr, "<span style='color:#66ccff;'>" + val + '</span>')} |
||||
|
</div>` |
||||
|
.trim(); |
||||
|
|
||||
|
return nameresult; |
||||
|
}, |
||||
|
/** |
||||
|
* 地址转地铁线路 |
||||
|
*/ |
||||
|
addressToLine(address, type) { |
||||
|
let addr = address.split(';'); |
||||
|
let dt = ''; |
||||
|
addr.forEach(elm => { |
||||
|
let color = '#cccccc'; |
||||
|
if (type === typecode[0].id) { |
||||
|
color = this.lineColor(elm) |
||||
|
} else if (type === typecode[1].id) { |
||||
|
color = '#4075cb' |
||||
|
} |
||||
|
let style = 'margin:5px 0;margin-right:5px;padding:0 5px;background:' + color + |
||||
|
';font-size:12px;color:#fff;border-radius:3px;'; |
||||
|
dt += `<div style=\'${style}\'>${elm}</div>`; |
||||
|
|
||||
|
}); |
||||
|
return `<div style="display:flex;flex-wrap: wrap;">${dt}</div>`; |
||||
|
}, |
||||
|
/** |
||||
|
* 数据处理 |
||||
|
*/ |
||||
|
dataHandle(item, val) { |
||||
|
// 改变字体颜色
|
||||
|
if (val) { |
||||
|
item.nameNodes = util.serachNmme(val, item.name); |
||||
|
} else { |
||||
|
item.nameNodes = `<div style="font-size: 14px;color: #333;line-height: 1.5;">${item.name}</div>`; |
||||
|
|
||||
|
} |
||||
|
// 地址解析 地铁
|
||||
|
if ( |
||||
|
item.typecode === util.typecode[0].id || |
||||
|
item.typecode === util.typecode[1].id |
||||
|
) { |
||||
|
item.addressNodes = util.addressToLine(item.address, item.typecode); |
||||
|
if (item.typecode === util.typecode[0].id) { |
||||
|
item.icon = util.typecode[0].icon; |
||||
|
} else if (item.typecode === util.typecode[1].id) { |
||||
|
item.icon = util.typecode[1].icon; |
||||
|
} |
||||
|
} else { |
||||
|
item.addressNodes = `<span>${item.district}${ |
||||
|
item.address.length > 0 ? '·' + item.address : '' |
||||
|
}</span>`.trim(); |
||||
|
item.icon = 'icon-weizhi'; |
||||
|
} |
||||
|
|
||||
|
if (item.location && item.location.length === 0) { |
||||
|
item.icon = 'icon-sousuo'; |
||||
|
} |
||||
|
|
||||
|
return item; |
||||
|
}, |
||||
|
/** |
||||
|
* 存储历史数据 |
||||
|
* val [string | object]需要存储的内容 |
||||
|
*/ |
||||
|
setHistory(val) { |
||||
|
let searchHistory = uni.getStorageSync('search:history'); |
||||
|
if (!searchHistory) searchHistory = []; |
||||
|
let serachData = {}; |
||||
|
if (typeof(val) === 'string') { |
||||
|
serachData = { |
||||
|
adcode: [], |
||||
|
address: [], |
||||
|
city: [], |
||||
|
district: [], |
||||
|
id: [], |
||||
|
location: [], |
||||
|
name: val, |
||||
|
typecode: [] |
||||
|
}; |
||||
|
} else { |
||||
|
serachData = val |
||||
|
} |
||||
|
|
||||
|
// 判断数组是否存在,如果存在,那么将放到最前面
|
||||
|
for (var i = 0; i < searchHistory.length; i++) { |
||||
|
if (searchHistory[i].name === serachData.name) { |
||||
|
searchHistory.splice(i, 1); |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
searchHistory.unshift(util.dataHandle(serachData)); |
||||
|
uni.setStorage({ |
||||
|
key: 'search:history', |
||||
|
data: searchHistory, |
||||
|
success: function() { |
||||
|
// console.log('success');
|
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
getHistory() { |
||||
|
|
||||
|
}, |
||||
|
removeHistory() { |
||||
|
uni.removeStorage({ |
||||
|
key: 'search:history', |
||||
|
success: function(res) { |
||||
|
console.log('success'); |
||||
|
} |
||||
|
}); |
||||
|
return [] |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
export default util; |
File diff suppressed because one or more lines are too long
@ -0,0 +1,39 @@ |
|||||
|
<!-- z-paging自定义的没有更多数据view --> |
||||
|
<template> |
||||
|
<view class="nomore"> |
||||
|
<!-- 这里的图片请换成自己项目的图片 --> |
||||
|
<image class="nomore-image" mode="aspectFit" src="@/static/no_more.png"></image> |
||||
|
<text class="nomore-text">已经到达宇宙尽头啦~</text> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
data() { |
||||
|
return { |
||||
|
|
||||
|
}; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
</script> |
||||
|
|
||||
|
<style scoped> |
||||
|
.nomore{ |
||||
|
/* #ifndef APP-NVUE */ |
||||
|
display: flex; |
||||
|
/* #endif */ |
||||
|
flex-direction: column; |
||||
|
align-items: center; |
||||
|
padding: 20rpx 0px; |
||||
|
} |
||||
|
.nomore-image{ |
||||
|
width: 200rpx; |
||||
|
height: 130rpx; |
||||
|
} |
||||
|
.nomore-text{ |
||||
|
margin-top: 10rpx; |
||||
|
font-size: 24rpx; |
||||
|
color: #222963; |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,58 @@ |
|||||
|
<!-- z-paging自定义的下拉刷新view --> |
||||
|
<template> |
||||
|
<view class="refresher-container"> |
||||
|
<!-- 这里的图片请换成自己项目的图片 --> |
||||
|
<image class="refresher-image" mode="aspectFit" src="@/static/refresher_loading.gif"></image> |
||||
|
<text class="refresher-text">{{statusText}}</text> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
data() { |
||||
|
return { |
||||
|
|
||||
|
}; |
||||
|
}, |
||||
|
computed: { |
||||
|
statusText() { |
||||
|
// 这里可以做i18n国际化相关操作,可以通过uni.getLocale()获取当前语言(具体操作见i18n-demo.vue); |
||||
|
// 获取到当前语言之后,就可以自定义不同语言下的展示内容了 |
||||
|
const statusTextArr = ['哎呀,用点力继续下拉!', '拉疼我啦,松手刷新~~', '正在努力刷新中...', '刷新成功啦~']; |
||||
|
return statusTextArr[this.status]; |
||||
|
} |
||||
|
}, |
||||
|
props: { |
||||
|
status: { |
||||
|
type: Number, |
||||
|
default: function() { |
||||
|
return 0; |
||||
|
}, |
||||
|
}, |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped> |
||||
|
.refresher-container { |
||||
|
/* #ifndef APP-NVUE */ |
||||
|
display: flex; |
||||
|
/* #endif */ |
||||
|
height: 150rpx; |
||||
|
flex-direction: column; |
||||
|
align-items: center; |
||||
|
justify-content: center; |
||||
|
} |
||||
|
|
||||
|
.refresher-image { |
||||
|
margin-top: 10rpx; |
||||
|
height: 45px; |
||||
|
width: 45px; |
||||
|
} |
||||
|
|
||||
|
.refresher-text { |
||||
|
margin-top: 10rpx; |
||||
|
font-size: 24rpx; |
||||
|
color: #666666; |
||||
|
} |
||||
|
</style> |
@ -0,0 +1 @@ |
|||||
|
export default './lib/marked' |
File diff suppressed because it is too large
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -0,0 +1,139 @@ |
|||||
|
/* eslint-disable */ |
||||
|
var provinceData = [{ |
||||
|
"label": "北京市", |
||||
|
"value": "11" |
||||
|
}, |
||||
|
{ |
||||
|
"label": "天津市", |
||||
|
"value": "12" |
||||
|
}, |
||||
|
{ |
||||
|
"label": "河北省", |
||||
|
"value": "13" |
||||
|
}, |
||||
|
{ |
||||
|
"label": "山西省", |
||||
|
"value": "14" |
||||
|
}, |
||||
|
{ |
||||
|
"label": "内蒙古自治区", |
||||
|
"value": "15" |
||||
|
}, |
||||
|
{ |
||||
|
"label": "辽宁省", |
||||
|
"value": "21" |
||||
|
}, |
||||
|
{ |
||||
|
"label": "吉林省", |
||||
|
"value": "22" |
||||
|
}, |
||||
|
{ |
||||
|
"label": "黑龙江省", |
||||
|
"value": "23" |
||||
|
}, |
||||
|
{ |
||||
|
"label": "上海市", |
||||
|
"value": "31" |
||||
|
}, |
||||
|
{ |
||||
|
"label": "江苏省", |
||||
|
"value": "32" |
||||
|
}, |
||||
|
{ |
||||
|
"label": "浙江省", |
||||
|
"value": "33" |
||||
|
}, |
||||
|
{ |
||||
|
"label": "安徽省", |
||||
|
"value": "34" |
||||
|
}, |
||||
|
{ |
||||
|
"label": "福建省", |
||||
|
"value": "35" |
||||
|
}, |
||||
|
{ |
||||
|
"label": "江西省", |
||||
|
"value": "36" |
||||
|
}, |
||||
|
{ |
||||
|
"label": "山东省", |
||||
|
"value": "37" |
||||
|
}, |
||||
|
{ |
||||
|
"label": "河南省", |
||||
|
"value": "41" |
||||
|
}, |
||||
|
{ |
||||
|
"label": "湖北省", |
||||
|
"value": "42" |
||||
|
}, |
||||
|
{ |
||||
|
"label": "湖南省", |
||||
|
"value": "43" |
||||
|
}, |
||||
|
{ |
||||
|
"label": "广东省", |
||||
|
"value": "44" |
||||
|
}, |
||||
|
{ |
||||
|
"label": "广西壮族自治区", |
||||
|
"value": "45" |
||||
|
}, |
||||
|
{ |
||||
|
"label": "海南省", |
||||
|
"value": "46" |
||||
|
}, |
||||
|
{ |
||||
|
"label": "重庆市", |
||||
|
"value": "50" |
||||
|
}, |
||||
|
{ |
||||
|
"label": "四川省", |
||||
|
"value": "51" |
||||
|
}, |
||||
|
{ |
||||
|
"label": "贵州省", |
||||
|
"value": "52" |
||||
|
}, |
||||
|
{ |
||||
|
"label": "云南省", |
||||
|
"value": "53" |
||||
|
}, |
||||
|
{ |
||||
|
"label": "西藏自治区", |
||||
|
"value": "54" |
||||
|
}, |
||||
|
{ |
||||
|
"label": "陕西省", |
||||
|
"value": "61" |
||||
|
}, |
||||
|
{ |
||||
|
"label": "甘肃省", |
||||
|
"value": "62" |
||||
|
}, |
||||
|
{ |
||||
|
"label": "青海省", |
||||
|
"value": "63" |
||||
|
}, |
||||
|
{ |
||||
|
"label": "宁夏回族自治区", |
||||
|
"value": "64" |
||||
|
}, |
||||
|
{ |
||||
|
"label": "新疆维吾尔自治区", |
||||
|
"value": "65" |
||||
|
}, |
||||
|
{ |
||||
|
"label": "台湾", |
||||
|
"value": "66" |
||||
|
}, |
||||
|
{ |
||||
|
"label": "香港", |
||||
|
"value": "67" |
||||
|
}, |
||||
|
{ |
||||
|
"label": "澳门", |
||||
|
"value": "68" |
||||
|
} |
||||
|
] |
||||
|
export default provinceData; |
@ -0,0 +1,230 @@ |
|||||
|
<template> |
||||
|
<div class="mpvue-picker"> |
||||
|
<div :class="{'pickerMask':showPicker}" @click="maskClick" catchtouchmove="true"></div> |
||||
|
<div class="mpvue-picker-content " :class="{'mpvue-picker-view-show':showPicker}"> |
||||
|
<div class="mpvue-picker__hd" catchtouchmove="true"> |
||||
|
<div class="mpvue-picker__action" @click="pickerCancel">取消</div> |
||||
|
<div class="mpvue-picker__action" :style="{color:themeColor}" @click="pickerConfirm">确定</div> |
||||
|
</div> |
||||
|
<picker-view indicator-style="height: 40px;" class="mpvue-picker-view" :value="pickerValue" @change="pickerChange"> |
||||
|
<block> |
||||
|
<picker-view-column> |
||||
|
<div class="picker-item" v-for="(item,index) in provinceDataList" :key="index">{{item.label}}</div> |
||||
|
</picker-view-column> |
||||
|
<picker-view-column> |
||||
|
<div class="picker-item" v-for="(item,index) in cityDataList" :key="index">{{item.label}}</div> |
||||
|
</picker-view-column> |
||||
|
<picker-view-column> |
||||
|
<div class="picker-item" v-for="(item,index) in areaDataList" :key="index">{{item.label}}</div> |
||||
|
</picker-view-column> |
||||
|
</block> |
||||
|
</picker-view> |
||||
|
</div> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import provinceData from './city-data/province.js'; |
||||
|
import cityData from './city-data/city.js'; |
||||
|
import areaData from './city-data/area.js'; |
||||
|
export default { |
||||
|
data() { |
||||
|
return { |
||||
|
pickerValue: [0, 0, 0], |
||||
|
provinceDataList: provinceData, |
||||
|
cityDataList: cityData[0], |
||||
|
areaDataList: areaData[0][0], |
||||
|
/* 是否显示控件 */ |
||||
|
showPicker: false, |
||||
|
}; |
||||
|
}, |
||||
|
created() { |
||||
|
this.init() |
||||
|
}, |
||||
|
props: { |
||||
|
/* 默认值 */ |
||||
|
pickerValueDefault: { |
||||
|
type: Array, |
||||
|
default () { |
||||
|
return [0, 0, 0] |
||||
|
} |
||||
|
}, |
||||
|
/* 主题色 */ |
||||
|
themeColor: String |
||||
|
}, |
||||
|
watch: { |
||||
|
pickerValueDefault() { |
||||
|
this.init(); |
||||
|
} |
||||
|
}, |
||||
|
methods: { |
||||
|
init() { |
||||
|
this.handPickValueDefault(); // 对 pickerValueDefault 做兼容处理 |
||||
|
|
||||
|
const pickerValueDefault = this.pickerValueDefault |
||||
|
|
||||
|
this.cityDataList = cityData[pickerValueDefault[0]]; |
||||
|
this.areaDataList = areaData[pickerValueDefault[0]][pickerValueDefault[1]]; |
||||
|
this.pickerValue = pickerValueDefault; |
||||
|
}, |
||||
|
show() { |
||||
|
setTimeout(() => { |
||||
|
this.showPicker = true; |
||||
|
}, 0); |
||||
|
}, |
||||
|
maskClick() { |
||||
|
this.pickerCancel(); |
||||
|
}, |
||||
|
pickerCancel() { |
||||
|
this.showPicker = false; |
||||
|
this._$emit('onCancel'); |
||||
|
}, |
||||
|
pickerConfirm(e) { |
||||
|
this.showPicker = false; |
||||
|
this._$emit('onConfirm'); |
||||
|
}, |
||||
|
showPickerView() { |
||||
|
this.showPicker = true; |
||||
|
}, |
||||
|
handPickValueDefault() { |
||||
|
const pickerValueDefault = this.pickerValueDefault |
||||
|
|
||||
|
let provinceIndex = pickerValueDefault[0] |
||||
|
let cityIndex = pickerValueDefault[1] |
||||
|
const areaIndex = pickerValueDefault[2] |
||||
|
if ( |
||||
|
provinceIndex !== 0 || |
||||
|
cityIndex !== 0 || |
||||
|
areaIndex !== 0 |
||||
|
) { |
||||
|
if (provinceIndex > provinceData.length - 1) { |
||||
|
this.pickerValueDefault[0] = provinceIndex = provinceData.length - 1; |
||||
|
} |
||||
|
if (cityIndex > cityData[provinceIndex].length - 1) { |
||||
|
this.pickerValueDefault[1] = cityIndex = cityData[provinceIndex].length - 1; |
||||
|
} |
||||
|
if (areaIndex > areaData[provinceIndex][cityIndex].length - 1) { |
||||
|
this.pickerValueDefault[2] = areaData[provinceIndex][cityIndex].length - 1; |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
pickerChange(e) { |
||||
|
let changePickerValue = e.mp.detail.value; |
||||
|
if (this.pickerValue[0] !== changePickerValue[0]) { |
||||
|
// 第一级发生滚动 |
||||
|
this.cityDataList = cityData[changePickerValue[0]]; |
||||
|
this.areaDataList = areaData[changePickerValue[0]][0]; |
||||
|
changePickerValue[1] = 0; |
||||
|
changePickerValue[2] = 0; |
||||
|
} else if (this.pickerValue[1] !== changePickerValue[1]) { |
||||
|
// 第二级滚动 |
||||
|
this.areaDataList = |
||||
|
areaData[changePickerValue[0]][changePickerValue[1]]; |
||||
|
changePickerValue[2] = 0; |
||||
|
} |
||||
|
this.pickerValue = changePickerValue; |
||||
|
this._$emit('onChange'); |
||||
|
}, |
||||
|
_$emit(emitName) { |
||||
|
let pickObj = { |
||||
|
label: this._getLabel(), |
||||
|
value: this.pickerValue, |
||||
|
cityCode: this._getCityCode() |
||||
|
}; |
||||
|
this.$emit(emitName, pickObj); |
||||
|
}, |
||||
|
_getLabel() { |
||||
|
let pcikerLabel = |
||||
|
this.provinceDataList[this.pickerValue[0]].label + |
||||
|
'-' + |
||||
|
this.cityDataList[this.pickerValue[1]].label + |
||||
|
'-' + |
||||
|
this.areaDataList[this.pickerValue[2]].label; |
||||
|
return pcikerLabel; |
||||
|
}, |
||||
|
_getCityCode() { |
||||
|
return this.areaDataList[this.pickerValue[2]].value; |
||||
|
} |
||||
|
} |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
.pickerMask { |
||||
|
position: fixed; |
||||
|
z-index: 1000; |
||||
|
top: 0; |
||||
|
right: 0; |
||||
|
left: 0; |
||||
|
bottom: 0; |
||||
|
background: rgba(0, 0, 0, 0.6); |
||||
|
} |
||||
|
|
||||
|
.mpvue-picker-content { |
||||
|
position: fixed; |
||||
|
bottom: 0; |
||||
|
left: 0; |
||||
|
width: 100%; |
||||
|
transition: all 0.3s ease; |
||||
|
transform: translateY(100%); |
||||
|
z-index: 3000; |
||||
|
} |
||||
|
|
||||
|
.mpvue-picker-view-show { |
||||
|
transform: translateY(0); |
||||
|
} |
||||
|
|
||||
|
.mpvue-picker__hd { |
||||
|
display: flex; |
||||
|
padding: 9px 15px; |
||||
|
background-color: #fff; |
||||
|
position: relative; |
||||
|
text-align: center; |
||||
|
font-size: 17px; |
||||
|
} |
||||
|
|
||||
|
.mpvue-picker__hd:after { |
||||
|
content: ' '; |
||||
|
position: absolute; |
||||
|
left: 0; |
||||
|
bottom: 0; |
||||
|
right: 0; |
||||
|
height: 1px; |
||||
|
border-bottom: 1px solid #e5e5e5; |
||||
|
color: #e5e5e5; |
||||
|
transform-origin: 0 100%; |
||||
|
transform: scaleY(0.5); |
||||
|
} |
||||
|
|
||||
|
.mpvue-picker__action { |
||||
|
display: block; |
||||
|
flex: 1; |
||||
|
color: #1aad19; |
||||
|
} |
||||
|
|
||||
|
.mpvue-picker__action:first-child { |
||||
|
text-align: left; |
||||
|
color: #888; |
||||
|
} |
||||
|
|
||||
|
.mpvue-picker__action:last-child { |
||||
|
text-align: right; |
||||
|
} |
||||
|
|
||||
|
.picker-item { |
||||
|
text-align: center; |
||||
|
line-height: 40px; |
||||
|
text-overflow: ellipsis; |
||||
|
white-space: nowrap; |
||||
|
font-size: 16px; |
||||
|
} |
||||
|
|
||||
|
.mpvue-picker-view { |
||||
|
position: relative; |
||||
|
bottom: 0; |
||||
|
left: 0; |
||||
|
width: 100%; |
||||
|
height: 238px; |
||||
|
background-color: rgba(255, 255, 255, 1); |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,123 @@ |
|||||
|
<template> |
||||
|
<canvas v-if="canvasId" class="ec-canvas" :id="canvasId" :canvasId="canvasId" @touchstart="touchStart" @touchmove="touchMove" @touchend="touchEnd" @error="error"></canvas> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import WxCanvas from './wx-canvas'; |
||||
|
|
||||
|
export default { |
||||
|
props: { |
||||
|
canvasId: { |
||||
|
type: String, |
||||
|
default: 'ec-canvas' |
||||
|
}, |
||||
|
lazyLoad: { |
||||
|
type: Boolean, |
||||
|
default: false |
||||
|
}, |
||||
|
disableTouch: { |
||||
|
type: Boolean, |
||||
|
default: false |
||||
|
}, |
||||
|
throttleTouch: { |
||||
|
type: Boolean, |
||||
|
default: false |
||||
|
} |
||||
|
}, |
||||
|
// #ifdef H5 |
||||
|
mounted() { |
||||
|
if (!this.lazyLoad) this.init(); |
||||
|
}, |
||||
|
// #endif |
||||
|
// #ifndef H5 |
||||
|
onReady() { |
||||
|
if (!this.lazyLoad) this.init(); |
||||
|
}, |
||||
|
// #endif |
||||
|
methods: { |
||||
|
setChart(chart){ |
||||
|
this.chart = chart |
||||
|
}, |
||||
|
init() { |
||||
|
const { canvasId } = this; |
||||
|
this.ctx = wx.createCanvasContext(canvasId, this); |
||||
|
|
||||
|
this.canvas = new WxCanvas(this.ctx, canvasId); |
||||
|
|
||||
|
const query = wx.createSelectorQuery().in(this); |
||||
|
query |
||||
|
.select(`#${canvasId}`) |
||||
|
.boundingClientRect(res => { |
||||
|
if (!res) { |
||||
|
setTimeout(() => this.init(), 50); |
||||
|
return; |
||||
|
} |
||||
|
this.$emit('onInit', { |
||||
|
width: res.width, |
||||
|
height: res.height |
||||
|
}); |
||||
|
}) |
||||
|
.exec(); |
||||
|
}, |
||||
|
canvasToTempFilePath(opt) { |
||||
|
const { canvasId } = this; |
||||
|
this.ctx.draw(true, () => { |
||||
|
wx.canvasToTempFilePath({ |
||||
|
canvasId, |
||||
|
...opt |
||||
|
}); |
||||
|
}); |
||||
|
}, |
||||
|
touchStart(e) { |
||||
|
const { disableTouch, chart } = this; |
||||
|
if (disableTouch || !chart || !e.mp.touches.length) return; |
||||
|
const touch = e.mp.touches[0]; |
||||
|
chart._zr.handler.dispatch('mousedown', { |
||||
|
zrX: touch.x, |
||||
|
zrY: touch.y |
||||
|
}); |
||||
|
chart._zr.handler.dispatch('mousemove', { |
||||
|
zrX: touch.x, |
||||
|
zrY: touch.y |
||||
|
}); |
||||
|
}, |
||||
|
touchMove(e) { |
||||
|
const { disableTouch, throttleTouch, chart, lastMoveTime } = this; |
||||
|
if (disableTouch || !chart || !e.mp.touches.length) return; |
||||
|
|
||||
|
if (throttleTouch) { |
||||
|
const currMoveTime = Date.now(); |
||||
|
if (currMoveTime - lastMoveTime < 240) return; |
||||
|
this.lastMoveTime = currMoveTime; |
||||
|
} |
||||
|
|
||||
|
const touch = e.mp.touches[0]; |
||||
|
chart._zr.handler.dispatch('mousemove', { |
||||
|
zrX: touch.x, |
||||
|
zrY: touch.y |
||||
|
}); |
||||
|
}, |
||||
|
touchEnd(e) { |
||||
|
const { disableTouch, chart } = this; |
||||
|
if (disableTouch || !chart) return; |
||||
|
const touch = e.mp.changedTouches ? e.mp.changedTouches[0] : {}; |
||||
|
chart._zr.handler.dispatch('mouseup', { |
||||
|
zrX: touch.x, |
||||
|
zrY: touch.y |
||||
|
}); |
||||
|
chart._zr.handler.dispatch('click', { |
||||
|
zrX: touch.x, |
||||
|
zrY: touch.y |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style scoped> |
||||
|
.ec-canvas { |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
flex: 1; |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,73 @@ |
|||||
|
export default class WxCanvas { |
||||
|
constructor(ctx, canvasId) { |
||||
|
this.ctx = ctx; |
||||
|
this.canvasId = canvasId; |
||||
|
this.chart = null; |
||||
|
|
||||
|
WxCanvas.initStyle(ctx); |
||||
|
this.initEvent(); |
||||
|
} |
||||
|
|
||||
|
getContext(contextType) { |
||||
|
return contextType === '2d' ? this.ctx : null; |
||||
|
} |
||||
|
|
||||
|
setChart(chart) { |
||||
|
this.chart = chart; |
||||
|
} |
||||
|
|
||||
|
attachEvent() { |
||||
|
// noop
|
||||
|
} |
||||
|
|
||||
|
detachEvent() { |
||||
|
// noop
|
||||
|
} |
||||
|
|
||||
|
static initStyle(ctx) { |
||||
|
const styles = ['fillStyle', 'strokeStyle', 'globalAlpha', |
||||
|
'textAlign', 'textBaseAlign', 'shadow', 'lineWidth', |
||||
|
'lineCap', 'lineJoin', 'lineDash', 'miterLimit', 'fontSize']; |
||||
|
|
||||
|
styles.forEach((style) => { |
||||
|
Object.defineProperty(ctx, style, { |
||||
|
set: (value) => { |
||||
|
if ((style !== 'fillStyle' && style !== 'strokeStyle') |
||||
|
|| (value !== 'none' && value !== null) |
||||
|
) { |
||||
|
ctx[`set${style.charAt(0).toUpperCase()}${style.slice(1)}`](value); |
||||
|
} |
||||
|
}, |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
ctx.createRadialGradient = () => ctx.createCircularGradient(arguments); |
||||
|
} |
||||
|
|
||||
|
initEvent() { |
||||
|
this.event = {}; |
||||
|
const eventNames = [{ |
||||
|
wxName: 'touchStart', |
||||
|
ecName: 'mousedown', |
||||
|
}, { |
||||
|
wxName: 'touchMove', |
||||
|
ecName: 'mousemove', |
||||
|
}, { |
||||
|
wxName: 'touchEnd', |
||||
|
ecName: 'mouseup', |
||||
|
}, { |
||||
|
wxName: 'touchEnd', |
||||
|
ecName: 'click', |
||||
|
}]; |
||||
|
|
||||
|
eventNames.forEach((name) => { |
||||
|
this.event[name.wxName] = (e) => { |
||||
|
const touch = e.mp.touches[0]; |
||||
|
this.chart._zr.handler.dispatch(name.ecName, { |
||||
|
zrX: name.wxName === 'tap' ? touch.clientX : touch.x, |
||||
|
zrY: name.wxName === 'tap' ? touch.clientY : touch.y, |
||||
|
}); |
||||
|
}; |
||||
|
}); |
||||
|
} |
||||
|
} |
@ -0,0 +1,484 @@ |
|||||
|
<template> |
||||
|
<view class="mpvue-picker"> |
||||
|
<view :class="{'pickerMask':showPicker}" @click="maskClick" catchtouchmove="true"></view> |
||||
|
<view class="mpvue-picker-content " :class="{'mpvue-picker-view-show':showPicker}"> |
||||
|
<view class="mpvue-picker__hd" catchtouchmove="true"> |
||||
|
<view class="mpvue-picker__action" @click="pickerCancel">取消</view> |
||||
|
<view class="mpvue-picker__action" :style="{color:themeColor}" @click="pickerConfirm">确定</view> |
||||
|
</view> |
||||
|
<!-- 单列 --> |
||||
|
<picker-view indicator-style="height: 40px;" class="mpvue-picker-view" :value="pickerValue" |
||||
|
@change="pickerChange" v-if="mode==='selector' && pickerValueSingleArray.length > 0"> |
||||
|
<picker-view-column> |
||||
|
<view class="picker-item" v-for="(item,index) in pickerValueSingleArray" :key="index">{{item.label}} |
||||
|
</view> |
||||
|
</picker-view-column> |
||||
|
</picker-view> |
||||
|
<!-- 时间选择器 --> |
||||
|
<picker-view indicator-style="height: 40px;" class="mpvue-picker-view" :value="pickerValue" |
||||
|
@change="pickerChange" v-if="mode==='timeSelector'"> |
||||
|
<picker-view-column> |
||||
|
<view class="picker-item" v-for="(item,index) in pickerValueHour" :key="index">{{item.label}}</view> |
||||
|
</picker-view-column> |
||||
|
<picker-view-column> |
||||
|
<view class="picker-item" v-for="(item,index) in pickerValueMinute" :key="index">{{item.label}} |
||||
|
</view> |
||||
|
</picker-view-column> |
||||
|
</picker-view> |
||||
|
<!-- 多列选择 --> |
||||
|
<picker-view indicator-style="height: 40px;" class="mpvue-picker-view" :value="pickerValue" |
||||
|
@change="pickerChange" v-if="mode==='multiSelector'"> |
||||
|
<!-- #ifdef VUE3 --> |
||||
|
<template v-for="(n,index) in pickerValueMulArray.length" :key="index"> |
||||
|
<picker-view-column> |
||||
|
<view class="picker-item" v-for="(item,index1) in pickerValueMulArray[n]" :key="index1"> |
||||
|
{{item.label}} |
||||
|
</view> |
||||
|
</picker-view-column> |
||||
|
</template> |
||||
|
<!-- #endif --> |
||||
|
<!-- #ifndef VUE3 --> |
||||
|
<block v-for="(n,index) in pickerValueMulArray.length" :key="index"> |
||||
|
<picker-view-column> |
||||
|
<view class="picker-item" v-for="(item,index1) in pickerValueMulArray[n]" :key="index1"> |
||||
|
{{item.label}} |
||||
|
</view> |
||||
|
</picker-view-column> |
||||
|
</block> |
||||
|
<!-- #endif --> |
||||
|
</picker-view> |
||||
|
<!-- 二级联动 --> |
||||
|
<picker-view indicator-style="height: 40px;" class="mpvue-picker-view" :value="pickerValue" |
||||
|
@change="pickerChangeMul" v-if="mode==='multiLinkageSelector' && deepLength===2"> |
||||
|
<picker-view-column> |
||||
|
<view class="picker-item" v-for="(item,index) in pickerValueMulTwoOne" :key="index">{{item.label}} |
||||
|
</view> |
||||
|
</picker-view-column> |
||||
|
<picker-view-column> |
||||
|
<view class="picker-item" v-for="(item,index) in pickerValueMulTwoTwo" :key="index">{{item.label}} |
||||
|
</view> |
||||
|
</picker-view-column> |
||||
|
</picker-view> |
||||
|
<!-- 三级联动 --> |
||||
|
<picker-view indicator-style="height: 40px;" class="mpvue-picker-view" :value="pickerValue" |
||||
|
@change="pickerChangeMul" v-if="mode==='multiLinkageSelector' && deepLength===3"> |
||||
|
<picker-view-column> |
||||
|
<view class="picker-item" v-for="(item,index) in pickerValueMulThreeOne" :key="index">{{item.label}} |
||||
|
</view> |
||||
|
</picker-view-column> |
||||
|
<picker-view-column> |
||||
|
<view class="picker-item" v-for="(item,index) in pickerValueMulThreeTwo" :key="index">{{item.label}} |
||||
|
</view> |
||||
|
</picker-view-column> |
||||
|
<picker-view-column> |
||||
|
<view class="picker-item" v-for="(item,index) in pickerValueMulThreeThree" :key="index"> |
||||
|
{{item.label}} |
||||
|
</view> |
||||
|
</picker-view-column> |
||||
|
</picker-view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
data() { |
||||
|
return { |
||||
|
pickerChangeValue: [], |
||||
|
pickerValue: [], |
||||
|
pickerValueArrayChange: true, |
||||
|
modeChange: false, |
||||
|
pickerValueSingleArray: [], |
||||
|
pickerValueHour: [], |
||||
|
pickerValueMinute: [], |
||||
|
pickerValueMulArray: [], |
||||
|
pickerValueMulTwoOne: [], |
||||
|
pickerValueMulTwoTwo: [], |
||||
|
pickerValueMulThreeOne: [], |
||||
|
pickerValueMulThreeTwo: [], |
||||
|
pickerValueMulThreeThree: [], |
||||
|
/* 是否显示控件 */ |
||||
|
showPicker: false, |
||||
|
}; |
||||
|
}, |
||||
|
props: { |
||||
|
/* mode */ |
||||
|
mode: { |
||||
|
type: String, |
||||
|
default: 'selector' |
||||
|
}, |
||||
|
/* picker 数值 */ |
||||
|
pickerValueArray: { |
||||
|
type: Array, |
||||
|
default () { |
||||
|
return [] |
||||
|
} |
||||
|
}, |
||||
|
/* 默认值 */ |
||||
|
pickerValueDefault: { |
||||
|
type: Array, |
||||
|
default () { |
||||
|
return [] |
||||
|
} |
||||
|
}, |
||||
|
/* 几级联动 */ |
||||
|
deepLength: { |
||||
|
type: Number, |
||||
|
default: 2 |
||||
|
}, |
||||
|
/* 主题色 */ |
||||
|
themeColor: String |
||||
|
}, |
||||
|
watch: { |
||||
|
pickerValueArray(oldVal, newVal) { |
||||
|
this.pickerValueArrayChange = true; |
||||
|
}, |
||||
|
mode(oldVal, newVal) { |
||||
|
this.modeChange = true; |
||||
|
}, |
||||
|
pickerValueArray(val) { |
||||
|
this.initPicker(val); |
||||
|
} |
||||
|
}, |
||||
|
methods: { |
||||
|
initPicker(valueArray) { |
||||
|
let pickerValueArray = valueArray; |
||||
|
this.pickerValue = this.pickerValueDefault; |
||||
|
// 初始化多级联动 |
||||
|
if (this.mode === 'selector') { |
||||
|
this.pickerValueSingleArray = valueArray; |
||||
|
} else if (this.mode === 'timeSelector') { |
||||
|
this.modeChange = false; |
||||
|
let hourArray = []; |
||||
|
let minuteArray = []; |
||||
|
for (let i = 0; i < 24; i++) { |
||||
|
hourArray.push({ |
||||
|
value: i, |
||||
|
label: i > 9 ? `${i} 时` : `0${i} 时` |
||||
|
}); |
||||
|
} |
||||
|
for (let i = 0; i < 60; i++) { |
||||
|
minuteArray.push({ |
||||
|
value: i, |
||||
|
label: i > 9 ? `${i} 分` : `0${i} 分` |
||||
|
}); |
||||
|
} |
||||
|
this.pickerValueHour = hourArray; |
||||
|
this.pickerValueMinute = minuteArray; |
||||
|
} else if (this.mode === 'multiSelector') { |
||||
|
this.pickerValueMulArray = valueArray; |
||||
|
} else if (this.mode === 'multiLinkageSelector' && this.deepLength === 2) { |
||||
|
// 两级联动 |
||||
|
let pickerValueMulTwoOne = []; |
||||
|
let pickerValueMulTwoTwo = []; |
||||
|
// 第一列 |
||||
|
for (let i = 0, length = pickerValueArray.length; i < length; i++) { |
||||
|
pickerValueMulTwoOne.push(pickerValueArray[i]); |
||||
|
} |
||||
|
// 渲染第二列 |
||||
|
// 如果有设定的默认值 |
||||
|
if (this.pickerValueDefault.length === 2) { |
||||
|
let num = this.pickerValueDefault[0]; |
||||
|
for ( |
||||
|
let i = 0, length = pickerValueArray[num].children.length; i < length; i++ |
||||
|
) { |
||||
|
pickerValueMulTwoTwo.push(pickerValueArray[num].children[i]); |
||||
|
} |
||||
|
} else { |
||||
|
for ( |
||||
|
let i = 0, length = pickerValueArray[0].children.length; i < length; i++ |
||||
|
) { |
||||
|
pickerValueMulTwoTwo.push(pickerValueArray[0].children[i]); |
||||
|
} |
||||
|
} |
||||
|
this.pickerValueMulTwoOne = pickerValueMulTwoOne; |
||||
|
this.pickerValueMulTwoTwo = pickerValueMulTwoTwo; |
||||
|
} else if ( |
||||
|
this.mode === 'multiLinkageSelector' && |
||||
|
this.deepLength === 3 |
||||
|
) { |
||||
|
let pickerValueMulThreeOne = []; |
||||
|
let pickerValueMulThreeTwo = []; |
||||
|
let pickerValueMulThreeThree = []; |
||||
|
// 第一列 |
||||
|
for (let i = 0, length = pickerValueArray.length; i < length; i++) { |
||||
|
pickerValueMulThreeOne.push(pickerValueArray[i]); |
||||
|
} |
||||
|
// 渲染第二列 |
||||
|
this.pickerValueDefault = |
||||
|
this.pickerValueDefault.length === 3 ? |
||||
|
this.pickerValueDefault : [0, 0, 0]; |
||||
|
if (this.pickerValueDefault.length === 3) { |
||||
|
let num = this.pickerValueDefault[0]; |
||||
|
for ( |
||||
|
let i = 0, length = pickerValueArray[num].children.length; i < length; i++ |
||||
|
) { |
||||
|
pickerValueMulThreeTwo.push(pickerValueArray[num].children[i]); |
||||
|
} |
||||
|
// 第三列 |
||||
|
let numSecond = this.pickerValueDefault[1]; |
||||
|
for (let i = 0, length = pickerValueArray[num].children[numSecond].children.length; i < |
||||
|
length; i++) { |
||||
|
pickerValueMulThreeThree.push( |
||||
|
pickerValueArray[num].children[numSecond].children[i] |
||||
|
); |
||||
|
} |
||||
|
} |
||||
|
this.pickerValueMulThreeOne = pickerValueMulThreeOne; |
||||
|
this.pickerValueMulThreeTwo = pickerValueMulThreeTwo; |
||||
|
this.pickerValueMulThreeThree = pickerValueMulThreeThree; |
||||
|
} |
||||
|
}, |
||||
|
show() { |
||||
|
setTimeout(() => { |
||||
|
if (this.pickerValueArrayChange || this.modeChange) { |
||||
|
this.initPicker(this.pickerValueArray); |
||||
|
this.showPicker = true; |
||||
|
this.pickerValueArrayChange = false; |
||||
|
this.modeChange = false; |
||||
|
} else { |
||||
|
this.showPicker = true; |
||||
|
} |
||||
|
}, 0); |
||||
|
}, |
||||
|
maskClick() { |
||||
|
this.pickerCancel(); |
||||
|
}, |
||||
|
pickerCancel() { |
||||
|
this.showPicker = false; |
||||
|
this._initPickerVale(); |
||||
|
let pickObj = { |
||||
|
index: this.pickerValue, |
||||
|
value: this._getPickerLabelAndValue(this.pickerValue, this.mode).value, |
||||
|
label: this._getPickerLabelAndValue(this.pickerValue, this.mode).label |
||||
|
}; |
||||
|
this.$emit('onCancel', pickObj); |
||||
|
}, |
||||
|
pickerConfirm(e) { |
||||
|
this.showPicker = false; |
||||
|
this._initPickerVale(); |
||||
|
let pickObj = { |
||||
|
index: this.pickerValue, |
||||
|
value: this._getPickerLabelAndValue(this.pickerValue, this.mode).value, |
||||
|
label: this._getPickerLabelAndValue(this.pickerValue, this.mode).label |
||||
|
}; |
||||
|
this.$emit('onConfirm', pickObj); |
||||
|
}, |
||||
|
showPickerView() { |
||||
|
this.showPicker = true; |
||||
|
}, |
||||
|
pickerChange(e) { |
||||
|
console.log(11111111, e); |
||||
|
this.pickerValue = e.detail.value; |
||||
|
let pickObj = { |
||||
|
index: this.pickerValue, |
||||
|
value: this._getPickerLabelAndValue(this.pickerValue, this.mode).value, |
||||
|
label: this._getPickerLabelAndValue(this.pickerValue, this.mode).label |
||||
|
}; |
||||
|
this.$emit('onChange', pickObj); |
||||
|
}, |
||||
|
pickerChangeMul(e) { |
||||
|
if (this.deepLength === 2) { |
||||
|
let pickerValueArray = this.pickerValueArray; |
||||
|
let changeValue = e.detail.value; |
||||
|
// 处理第一列滚动 |
||||
|
if (changeValue[0] !== this.pickerValue[0]) { |
||||
|
let pickerValueMulTwoTwo = []; |
||||
|
// 第一列滚动第二列数据更新 |
||||
|
for (let i = 0, length = pickerValueArray[changeValue[0]].children.length; i < length; i++) { |
||||
|
pickerValueMulTwoTwo.push(pickerValueArray[changeValue[0]].children[i]); |
||||
|
} |
||||
|
this.pickerValueMulTwoTwo = pickerValueMulTwoTwo; |
||||
|
// 第二列初始化为 0 |
||||
|
changeValue[1] = 0; |
||||
|
} |
||||
|
this.pickerValue = changeValue; |
||||
|
} else if (this.deepLength === 3) { |
||||
|
let pickerValueArray = this.pickerValueArray; |
||||
|
let changeValue = e.detail.value; |
||||
|
let pickerValueMulThreeTwo = []; |
||||
|
let pickerValueMulThreeThree = []; |
||||
|
// 重新渲染第二列 |
||||
|
// 如果是第一列滚动 |
||||
|
if (changeValue[0] !== this.pickerValue[0]) { |
||||
|
this.pickerValueMulThreeTwo = []; |
||||
|
for (let i = 0, length = pickerValueArray[changeValue[0]].children.length; i < length; i++) { |
||||
|
pickerValueMulThreeTwo.push(pickerValueArray[changeValue[0]].children[i]); |
||||
|
} |
||||
|
// 重新渲染第三列 |
||||
|
for (let i = 0, length = pickerValueArray[changeValue[0]].children[0].children.length; i < |
||||
|
length; i++) { |
||||
|
pickerValueMulThreeThree.push(pickerValueArray[changeValue[0]].children[0].children[i]); |
||||
|
} |
||||
|
changeValue[1] = 0; |
||||
|
changeValue[2] = 0; |
||||
|
this.pickerValueMulThreeTwo = pickerValueMulThreeTwo; |
||||
|
this.pickerValueMulThreeThree = pickerValueMulThreeThree; |
||||
|
} else if (changeValue[1] !== this.pickerValue[1]) { |
||||
|
// 第二列滚动 |
||||
|
// 重新渲染第三列 |
||||
|
this.pickerValueMulThreeThree = []; |
||||
|
pickerValueMulThreeTwo = this.pickerValueMulThreeTwo; |
||||
|
for (let i = 0, length = pickerValueArray[changeValue[0]].children[changeValue[1]].children |
||||
|
.length; i < |
||||
|
length; i++) { |
||||
|
pickerValueMulThreeThree.push(pickerValueArray[changeValue[0]].children[changeValue[1]] |
||||
|
.children[ |
||||
|
i]); |
||||
|
} |
||||
|
changeValue[2] = 0; |
||||
|
this.pickerValueMulThreeThree = pickerValueMulThreeThree; |
||||
|
} |
||||
|
this.pickerValue = changeValue; |
||||
|
} |
||||
|
let pickObj = { |
||||
|
index: this.pickerValue, |
||||
|
value: this._getPickerLabelAndValue(this.pickerValue, this.mode).value, |
||||
|
label: this._getPickerLabelAndValue(this.pickerValue, this.mode).label |
||||
|
}; |
||||
|
this.$emit('onChange', pickObj); |
||||
|
}, |
||||
|
// 获取 pxikerLabel |
||||
|
_getPickerLabelAndValue(value, mode) { |
||||
|
let pickerLable; |
||||
|
let pickerGetValue = []; |
||||
|
// selector |
||||
|
if (mode === 'selector') { |
||||
|
pickerLable = this.pickerValueSingleArray[value].label; |
||||
|
pickerGetValue.push(this.pickerValueSingleArray[value].value); |
||||
|
} else if (mode === 'timeSelector') { |
||||
|
pickerLable = `${this.pickerValueHour[value[0]].label}-${this.pickerValueMinute[value[1]].label}`; |
||||
|
pickerGetValue.push(this.pickerValueHour[value[0]].value); |
||||
|
pickerGetValue.push(this.pickerValueHour[value[1]].value); |
||||
|
} else if (mode === 'multiSelector') { |
||||
|
for (let i = 0; i < value.length; i++) { |
||||
|
if (i > 0) { |
||||
|
pickerLable += this.pickerValueMulArray[i][value[i]].label + (i === value.length - 1 ? '' : |
||||
|
'-'); |
||||
|
} else { |
||||
|
pickerLable = this.pickerValueMulArray[i][value[i]].label + '-'; |
||||
|
} |
||||
|
pickerGetValue.push(this.pickerValueMulArray[i][value[i]].value); |
||||
|
} |
||||
|
} else if (mode === 'multiLinkageSelector') { |
||||
|
/* eslint-disable indent */ |
||||
|
pickerLable = |
||||
|
this.deepLength === 2 ? |
||||
|
`${this.pickerValueMulTwoOne[value[0]].label}-${this.pickerValueMulTwoTwo[value[1]].label}` : |
||||
|
`${this.pickerValueMulThreeOne[value[0]].label}-${this.pickerValueMulThreeTwo[value[1]].label}-${this.pickerValueMulThreeThree[value[2]].label}`; |
||||
|
if (this.deepLength === 2) { |
||||
|
pickerGetValue.push(this.pickerValueMulTwoOne[value[0]].value); |
||||
|
pickerGetValue.push(this.pickerValueMulTwoTwo[value[1]].value); |
||||
|
} else { |
||||
|
pickerGetValue.push(this.pickerValueMulThreeOne[value[0]].value); |
||||
|
pickerGetValue.push(this.pickerValueMulThreeTwo[value[1]].value); |
||||
|
pickerGetValue.push(this.pickerValueMulThreeThree[value[2]].value); |
||||
|
} |
||||
|
/* eslint-enable indent */ |
||||
|
} |
||||
|
return { |
||||
|
label: pickerLable, |
||||
|
value: pickerGetValue |
||||
|
}; |
||||
|
}, |
||||
|
// 初始化 pickerValue 默认值 |
||||
|
_initPickerVale() { |
||||
|
if (this.pickerValue.length === 0) { |
||||
|
if (this.mode === 'selector') { |
||||
|
this.pickerValue = [0]; |
||||
|
} else if (this.mode === 'multiSelector') { |
||||
|
this.pickerValue = new Int8Array(this.pickerValueArray.length); |
||||
|
} else if ( |
||||
|
this.mode === 'multiLinkageSelector' && |
||||
|
this.deepLength === 2 |
||||
|
) { |
||||
|
this.pickerValue = [0, 0]; |
||||
|
} else if ( |
||||
|
this.mode === 'multiLinkageSelector' && |
||||
|
this.deepLength === 3 |
||||
|
) { |
||||
|
this.pickerValue = [0, 0, 0]; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
.pickerMask { |
||||
|
position: fixed; |
||||
|
z-index: 1000; |
||||
|
top: 0; |
||||
|
right: 0; |
||||
|
left: 0; |
||||
|
bottom: 0; |
||||
|
background: rgba(0, 0, 0, 0.6); |
||||
|
} |
||||
|
|
||||
|
.mpvue-picker-content { |
||||
|
position: fixed; |
||||
|
bottom: 0; |
||||
|
left: 0; |
||||
|
width: 100%; |
||||
|
transition: all 0.3s ease; |
||||
|
transform: translateY(100%); |
||||
|
z-index: 3000; |
||||
|
} |
||||
|
|
||||
|
.mpvue-picker-view-show { |
||||
|
transform: translateY(0); |
||||
|
} |
||||
|
|
||||
|
.mpvue-picker__hd { |
||||
|
display: flex; |
||||
|
padding: 9px 15px; |
||||
|
background-color: #fff; |
||||
|
position: relative; |
||||
|
text-align: center; |
||||
|
font-size: 17px; |
||||
|
} |
||||
|
|
||||
|
.mpvue-picker__hd:after { |
||||
|
content: ' '; |
||||
|
position: absolute; |
||||
|
left: 0; |
||||
|
bottom: 0; |
||||
|
right: 0; |
||||
|
height: 1px; |
||||
|
border-bottom: 1px solid #e5e5e5; |
||||
|
color: #e5e5e5; |
||||
|
transform-origin: 0 100%; |
||||
|
transform: scaleY(0.5); |
||||
|
} |
||||
|
|
||||
|
.mpvue-picker__action { |
||||
|
display: block; |
||||
|
flex: 1; |
||||
|
color: #1aad19; |
||||
|
} |
||||
|
|
||||
|
.mpvue-picker__action:first-child { |
||||
|
text-align: left; |
||||
|
color: #888; |
||||
|
} |
||||
|
|
||||
|
.mpvue-picker__action:last-child { |
||||
|
text-align: right; |
||||
|
} |
||||
|
|
||||
|
.picker-item { |
||||
|
text-align: center; |
||||
|
line-height: 40px; |
||||
|
font-size: 16px; |
||||
|
} |
||||
|
|
||||
|
.mpvue-picker-view { |
||||
|
position: relative; |
||||
|
bottom: 0; |
||||
|
left: 0; |
||||
|
width: 100%; |
||||
|
height: 238px; |
||||
|
background-color: rgba(255, 255, 255, 1); |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,175 @@ |
|||||
|
class GestureLock { |
||||
|
|
||||
|
constructor(containerWidth, cycleRadius) { |
||||
|
this.containerWidth = containerWidth; // 容器宽度
|
||||
|
this.cycleRadius = cycleRadius; // 圆的半径
|
||||
|
|
||||
|
this.circleArray = []; // 全部圆的对象数组
|
||||
|
this.checkPoints = []; // 选中的圆的对象数组
|
||||
|
this.lineArray = []; // 已激活锁之间的线段数组
|
||||
|
this.lastCheckPoint = 0; // 最后一个激活的锁
|
||||
|
this.offsetX = 0; // 容器的 X 偏移
|
||||
|
this.offsetY = 0; // 容器的 Y 偏移
|
||||
|
this.activeLine = {}; // 最后一个激活的锁与当前位置之间的线段
|
||||
|
|
||||
|
this.windowWidth = wx.getSystemInfoSync().windowWidth; // 窗口大小(用于rpx 和 px 转换)
|
||||
|
|
||||
|
this.initCircleArray(); |
||||
|
} |
||||
|
|
||||
|
// 初始化 画布上的 9个圆
|
||||
|
initCircleArray() { |
||||
|
const cycleMargin = (this.containerWidth - 6 * this.cycleRadius) / 6; |
||||
|
let count = 0; |
||||
|
for (let i = 0; i < 3; i++) { |
||||
|
for (let j = 0; j < 3; j++) { |
||||
|
count++; |
||||
|
this.circleArray.push({ |
||||
|
count: count, |
||||
|
x: this.rpxTopx((cycleMargin + this.cycleRadius) * (j * 2 + 1)), |
||||
|
y: this.rpxTopx((cycleMargin + this.cycleRadius) * (i * 2 + 1)), |
||||
|
radius: this.rpxTopx(this.cycleRadius), |
||||
|
check: false, |
||||
|
style: { |
||||
|
left: (cycleMargin + this.cycleRadius) * (j * 2 + 1) - this.cycleRadius + 'rpx', |
||||
|
top: (cycleMargin + this.cycleRadius) * (i * 2 + 1) - this.cycleRadius + 'rpx', |
||||
|
width: this.cycleRadius * 2 + 'rpx', |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
onTouchStart(e) { |
||||
|
this.setOffset(e); |
||||
|
this.checkTouch({ |
||||
|
x: e.touches[0].pageX - this.offsetX, |
||||
|
y: e.touches[0].pageY - this.offsetY |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
onTouchMove(e) { |
||||
|
this.moveDraw(e) |
||||
|
} |
||||
|
|
||||
|
onTouchEnd(e) { |
||||
|
const checkPoints = this.checkPoints; |
||||
|
this.reset(); |
||||
|
return checkPoints; |
||||
|
} |
||||
|
|
||||
|
// 初始化 偏移量
|
||||
|
setOffset(e) { |
||||
|
this.offsetX = e.currentTarget.offsetLeft; |
||||
|
this.offsetY = e.currentTarget.offsetTop; |
||||
|
} |
||||
|
|
||||
|
// 检测当时 触摸位置是否位于 锁上
|
||||
|
checkTouch({ |
||||
|
x, |
||||
|
y |
||||
|
}) { |
||||
|
for (let i = 0; i < this.circleArray.length; i++) { |
||||
|
let point = this.circleArray[i]; |
||||
|
if (this.isPointInCycle(x, y, point.x, point.y, point.radius)) { |
||||
|
if (!point.check) { |
||||
|
this.checkPoints.push(point.count); |
||||
|
if (this.lastCheckPoint != 0) { |
||||
|
// 已激活锁之间的线段
|
||||
|
const line = this.drawLine(this.lastCheckPoint, point); |
||||
|
this.lineArray.push(line); |
||||
|
} |
||||
|
this.lastCheckPoint = point; |
||||
|
} |
||||
|
point.check = true; |
||||
|
return; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 画线 - 返回 样式 对象
|
||||
|
drawLine(start, end) { |
||||
|
const width = this.getPointDis(start.x, start.y, end.x, end.y); |
||||
|
const rotate = this.getAngle(start, end); |
||||
|
|
||||
|
return { |
||||
|
activeLeft: start.x + 'px', |
||||
|
activeTop: start.y + 'px', |
||||
|
activeWidth: width + 'px', |
||||
|
activeRotate: rotate + 'deg' |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
// 获取 画线的 角度
|
||||
|
getAngle(start, end) { |
||||
|
var diff_x = end.x - start.x, |
||||
|
diff_y = end.y - start.y; |
||||
|
if (diff_x >= 0) { |
||||
|
return 360 * Math.atan(diff_y / diff_x) / (2 * Math.PI); |
||||
|
} else { |
||||
|
return 180 + 360 * Math.atan(diff_y / diff_x) / (2 * Math.PI); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 判断 当前点是否位于 锁内
|
||||
|
isPointInCycle(x, y, circleX, circleY, radius) { |
||||
|
return (this.getPointDis(x, y, circleX, circleY) < radius) ? true : false; |
||||
|
} |
||||
|
|
||||
|
// 获取两点之间距离
|
||||
|
getPointDis(ax, ay, bx, by) { |
||||
|
return Math.sqrt(Math.pow(ax - bx, 2) + Math.pow(ay - by, 2)); |
||||
|
} |
||||
|
|
||||
|
// 移动 绘制
|
||||
|
moveDraw(e) { |
||||
|
// 画经过的圆
|
||||
|
const x = e.touches[0].pageX - this.offsetX; |
||||
|
const y = e.touches[0].pageY - this.offsetY; |
||||
|
this.checkTouch({ |
||||
|
x, |
||||
|
y |
||||
|
}); |
||||
|
|
||||
|
// 画 最后一个激活的锁与当前位置之间的线段
|
||||
|
this.activeLine = this.drawLine(this.lastCheckPoint, { |
||||
|
x, |
||||
|
y |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
// 使 画布 恢复初始状态
|
||||
|
reset() { |
||||
|
this.circleArray.forEach((item) => { |
||||
|
item.check = false; |
||||
|
}); |
||||
|
this.checkPoints = []; |
||||
|
this.lineArray = []; |
||||
|
this.activeLine = {}; |
||||
|
this.lastCheckPoint = 0; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
// 获取 最后一个激活的锁与当前位置之间的线段
|
||||
|
getActiveLine() { |
||||
|
return this.activeLine; |
||||
|
} |
||||
|
|
||||
|
// 获取 圆对象数组
|
||||
|
getCycleArray() { |
||||
|
return this.circleArray; |
||||
|
} |
||||
|
|
||||
|
// 获取 已激活锁之间的线段
|
||||
|
getLineArray() { |
||||
|
return this.lineArray; |
||||
|
} |
||||
|
|
||||
|
// 将 RPX 转换成 PX
|
||||
|
rpxTopx(rpx) { |
||||
|
return rpx / 750 * this.windowWidth; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
export default GestureLock; |
@ -0,0 +1,138 @@ |
|||||
|
<template> |
||||
|
<view class="gesture-lock" :class="{error:error}" :style="{width: containerWidth +'rpx', height:containerWidth +'rpx'}" |
||||
|
@touchstart.stop="onTouchStart" @touchmove.stop="onTouchMove" @touchend.stop="onTouchEnd"> |
||||
|
<!-- 同级 v-for 的 key 重复会有问题,需要套一层。 --> |
||||
|
<!-- 9 个圆 --> |
||||
|
<view> |
||||
|
<view v-for="(item,i) in circleArray" :key="i" class="cycle" :class="{check:item.check}" :style="{left:item.style.left,top:item.style.top,width:item.style.width,height:item.style.width}"> |
||||
|
</view> |
||||
|
</view> |
||||
|
<view> |
||||
|
<!-- 已激活锁之间的线段 --> |
||||
|
<view v-for="(item,i) in lineArray" :key="i" class="line" :style="{left:item.activeLeft,top:item.activeTop,width:item.activeWidth,'-webkit-transform':'rotate('+item.activeRotate+')',transform:'rotate('+item.activeRotate+')'}"> |
||||
|
</view> |
||||
|
</view> |
||||
|
<!-- 最后一个激活的锁与当前位置之间的线段 --> |
||||
|
<view class="line" :style="{left:activeLine.activeLeft,top:activeLine.activeTop,width:activeLine.activeWidth,'-webkit-transform':'rotate('+activeLine.activeRotate+')',transform:'rotate('+activeLine.activeRotate+')'}"> |
||||
|
</view> |
||||
|
</view> |
||||
|
</template> |
||||
|
<script> |
||||
|
import GestureLock from './gestureLock'; |
||||
|
|
||||
|
export default { |
||||
|
name: 'index', |
||||
|
props: { |
||||
|
/** |
||||
|
* 容器宽度 |
||||
|
*/ |
||||
|
containerWidth: { |
||||
|
type: [Number, String], |
||||
|
default: 0 |
||||
|
}, |
||||
|
/** |
||||
|
* 圆的半径 |
||||
|
*/ |
||||
|
cycleRadius: { |
||||
|
type: [Number, String], |
||||
|
default: 0 |
||||
|
}, |
||||
|
/** |
||||
|
* 已设定的密码 |
||||
|
*/ |
||||
|
password: { |
||||
|
type: Array, |
||||
|
default () { |
||||
|
return [] |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
gestureLock: {}, // 锁对象 |
||||
|
circleArray: [], // 圆对象数组 |
||||
|
lineArray: [], // 已激活锁之间的线段 |
||||
|
activeLine: {}, // 最后一个激活的锁与当前位置之间的线段 |
||||
|
error: false |
||||
|
} |
||||
|
}, |
||||
|
methods: { |
||||
|
onTouchStart(e) { |
||||
|
this.gestureLock.onTouchStart(e); |
||||
|
this.refesh(); |
||||
|
}, |
||||
|
|
||||
|
onTouchMove(e) { |
||||
|
this.gestureLock.onTouchMove(e); |
||||
|
this.refesh(); |
||||
|
}, |
||||
|
|
||||
|
onTouchEnd(e) { |
||||
|
const checkPoints = this.gestureLock.onTouchEnd(e); |
||||
|
if (!this.password.length || checkPoints.join('') == this.password.join('')) { |
||||
|
this.refesh(); |
||||
|
this.$emit('end', checkPoints); |
||||
|
} else { |
||||
|
this.error = true; |
||||
|
setTimeout(() => { |
||||
|
this.refesh(); |
||||
|
this.$emit('end', checkPoints); |
||||
|
}, 800); |
||||
|
} |
||||
|
|
||||
|
}, |
||||
|
refesh() { |
||||
|
this.error = false; |
||||
|
this.circleArray = this.gestureLock.getCycleArray(); |
||||
|
this.lineArray = this.gestureLock.getLineArray(); |
||||
|
this.activeLine = this.gestureLock.getActiveLine(); |
||||
|
} |
||||
|
}, |
||||
|
mounted() { |
||||
|
this.gestureLock = new GestureLock(this.containerWidth, this.cycleRadius); |
||||
|
this.refesh(); |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped> |
||||
|
.gesture-lock { |
||||
|
margin: 0 auto; |
||||
|
position: relative; |
||||
|
box-sizing: border-box; |
||||
|
overflow: auto; |
||||
|
} |
||||
|
|
||||
|
.gesture-lock .cycle { |
||||
|
box-sizing: border-box; |
||||
|
position: absolute; |
||||
|
border: 2px solid #66aaff; |
||||
|
border-radius: 50%; |
||||
|
} |
||||
|
|
||||
|
.gesture-lock .cycle.check:after { |
||||
|
content: ""; |
||||
|
display: block; |
||||
|
position: absolute; |
||||
|
width: 32%; |
||||
|
height: 32%; |
||||
|
border: 2px solid #66aaff; |
||||
|
border-radius: 50%; |
||||
|
top: 50%; |
||||
|
left: 50%; |
||||
|
transform: translate(-50%, -50%); |
||||
|
} |
||||
|
|
||||
|
.gesture-lock .line { |
||||
|
height: 0; |
||||
|
border-top: 2px solid #66aaff; |
||||
|
position: absolute; |
||||
|
transform-origin: left center; |
||||
|
} |
||||
|
|
||||
|
.gesture-lock.error .cycle.check, |
||||
|
.gesture-lock.error .cycle.check:after, |
||||
|
.gesture-lock.error .line { |
||||
|
border-color: #ffa197; |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,157 @@ |
|||||
|
<!-- 基于z-paging封装个性化分页组件演示,可减少大量重复代码 --> |
||||
|
<template> |
||||
|
<!-- 这边统一设置z-paging,在页面中使用时就不用重复写 --> |
||||
|
<!-- 如果要在这里设置极简写法,这里的ref不能设置为paging,设置为其他名即可,因为极简写法会修改/调用第一个包含了ref="paging"的付view中的list和query --> |
||||
|
<!-- 极简写法在下方设置autowire-list-name="xxx" autowire-query-name="xxx"即可,与minimalism-demo.vue中的一致,并且不用再从这个组件转发到页面,只要遵循上一行的规则即可 --> |
||||
|
<z-paging ref="paging" v-model="list" fixed auto-show-back-to-top refresher-threshold="160rpx" @query="queryList" |
||||
|
:useVirtualList="useVirtualList" :useInnerList="useInnerList" :cellKeyName="cellKeyName" :innerListStyle="innerListStyle" :preloadPage="preloadPage" :cellHeightMode="cellHeightMode" :virtualScrollFps="virtualScrollFps" |
||||
|
:loading-more-loading-text="{'en':'英文的加载中','zh-cn':'中文的加载中','zh-hant-cn':'繁体的加载中'}"> |
||||
|
|
||||
|
<!-- 这里插入一个view到z-paging中,并且这个view会被z-paging标记为top固定在顶部 --> |
||||
|
<template #top> |
||||
|
<!-- 这里接收页面传进来的slot,这样相当于将页面传进来的slot传给z-paging的slot="top"了 --> |
||||
|
<slot name="top" /> |
||||
|
</template> |
||||
|
|
||||
|
<!-- 这里插入一个view到z-paging中,并且这个view会被z-paging标记为bottom固定在顶部 --> |
||||
|
<!-- vue3中用v-slot:bottom --> |
||||
|
<template #bottom> |
||||
|
<!-- 这里接收页面传进来的slot,这样相当于将页面传进来的slot传给z-paging的slot="bottom"了 --> |
||||
|
<slot name="bottom" /> |
||||
|
</template> |
||||
|
|
||||
|
<template #empty v-if="$slots.empty" > |
||||
|
<!-- 这里接收页面传进来的slot,这样相当于将页面传进来的slot传给z-paging的slot="empty"了 --> |
||||
|
<slot name="empty" /> |
||||
|
</template> |
||||
|
|
||||
|
<!-- 这个是插入虚拟列表/内置列表的cell --> |
||||
|
<template #cell="{item,index}"> |
||||
|
<slot name="cell" :item="item" :index="index"/> |
||||
|
</template> |
||||
|
|
||||
|
<!-- 这里通过slot统一自定义了下拉刷新view和没有更多数据view,页面那边就不用再写下面两行了 --> |
||||
|
<!-- 自定义下拉刷新view(如果use-custom-refresher为true且不设置下面的slot="refresher",此时不用获取refresherStatus,会自动使用z-paging自带的下拉刷新view) --> |
||||
|
<template #refresher="{refresherStatus}"> |
||||
|
<!-- <custom-refresher :status="refresherStatus" /> --> |
||||
|
</template> |
||||
|
<!-- 自定义没有更多数据view --> |
||||
|
<template #loadingMoreNoMore> |
||||
|
<!-- <custom-nomore></custom-nomore> --> |
||||
|
<uni-load-more status="normore" /> |
||||
|
</template> |
||||
|
|
||||
|
<!-- 这里接收页面传进来的普通slot,如列表数据等 --> |
||||
|
<slot /> |
||||
|
</z-paging> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
name: "my-paging", |
||||
|
data() { |
||||
|
return { |
||||
|
list: [] |
||||
|
}; |
||||
|
}, |
||||
|
props: { |
||||
|
//用于接收父组件v-model所绑定的list的值 |
||||
|
value: { |
||||
|
type: Array, |
||||
|
default: function() { |
||||
|
return []; |
||||
|
} |
||||
|
}, |
||||
|
//是否使用虚拟列表,默认为否 |
||||
|
useVirtualList: { |
||||
|
type: Boolean, |
||||
|
default: false |
||||
|
}, |
||||
|
//是否在z-paging内部循环渲染列表(内置列表),默认为否。若use-virtual-list为true,则此项恒为true |
||||
|
useInnerList: { |
||||
|
type: Boolean, |
||||
|
default: false |
||||
|
}, |
||||
|
//内置列表cell的key名称,仅nvue有效,在nvue中开启use-inner-list时必须填此项 |
||||
|
cellKeyName: { |
||||
|
type: String, |
||||
|
default: '' |
||||
|
}, |
||||
|
//innerList样式 |
||||
|
innerListStyle: { |
||||
|
type: Object, |
||||
|
default: function() { |
||||
|
return {}; |
||||
|
} |
||||
|
}, |
||||
|
//预加载的列表可视范围(列表高度)页数,默认为12,即预加载当前页及上下各7页的cell。此数值越大,则虚拟列表中加载的dom越多,内存消耗越大(会维持在一个稳定值),但增加预加载页面数量可缓解快速滚动短暂白屏问题 |
||||
|
preloadPage: { |
||||
|
type: [Number, String], |
||||
|
default: 12 |
||||
|
}, |
||||
|
//虚拟列表cell高度模式,默认为fixed,也就是每个cell高度完全相同,将以第一个cell高度为准进行计算。可选值【dynamic】,即代表高度是动态非固定的,【dynamic】性能低于【fixed】。 |
||||
|
cellHeightMode: { |
||||
|
type: String, |
||||
|
default: 'fixed' |
||||
|
}, |
||||
|
//虚拟列表scroll取样帧率,默认为60,过高可能出现卡顿等问题 |
||||
|
virtualScrollFps: { |
||||
|
type: [Number, String], |
||||
|
default: 60 |
||||
|
}, |
||||
|
}, |
||||
|
watch: { |
||||
|
//监听页面v-mode传过来的值,同时传给z-paging |
||||
|
value(newVal) { |
||||
|
this.list = newVal; |
||||
|
}, |
||||
|
// #ifdef VUE3 |
||||
|
modelValue(newVal) { |
||||
|
this.list = newVal; |
||||
|
}, |
||||
|
// #endif |
||||
|
//监听z-paging给当前组件的值,同时传给页面 |
||||
|
list(newVal) { |
||||
|
//通过emit input修改页面中v-model绑定的值 |
||||
|
this.$emit('input', newVal); |
||||
|
// #ifdef VUE3 |
||||
|
this.$emit('update:modelValue', newVal); |
||||
|
// #endif |
||||
|
} |
||||
|
}, |
||||
|
methods: { |
||||
|
//监听z-paging的@query方法,通过emit传递给页面 |
||||
|
queryList(pageNo, pageSize) { |
||||
|
console.log("queryList",pageNo) |
||||
|
// this.$emit('query', pageNo, pageSize); |
||||
|
}, |
||||
|
//接收页面触发的reload方法,传给z-paging |
||||
|
reload(data) { |
||||
|
this.$refs.paging.reload(data); |
||||
|
}, |
||||
|
//接收页面触发的complete方法,传给z-paging |
||||
|
complete(data) { |
||||
|
this.$refs.paging.complete(data); |
||||
|
}, |
||||
|
/* |
||||
|
//如果是使用页面滚动,则需要添加以下三行,注意页面那边要引入mixins,与使用页面滚动示例写法相同。 |
||||
|
//接收页面触发的updatePageScrollTop方法,传给z-paging |
||||
|
updatePageScrollTop(data){ |
||||
|
this.$refs.paging.updatePageScrollTop(data); |
||||
|
}, |
||||
|
//接收页面触发的pageReachBottom方法,传给z-paging |
||||
|
pageReachBottom(){ |
||||
|
this.$refs.paging.pageReachBottom(); |
||||
|
}, |
||||
|
//接收页面触发的doChatRecordLoadMore方法,传给z-paging |
||||
|
doChatRecordLoadMore() { |
||||
|
this.$refs.paging.doChatRecordLoadMore(); |
||||
|
} |
||||
|
*/ |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
|
||||
|
</style> |
@ -0,0 +1,38 @@ |
|||||
|
<template name="page-foot"> |
||||
|
<view class="page-share-title"> |
||||
|
<text>感谢{{name}}提供本示例,</text> |
||||
|
<text class="submit" @click="submit">我也提交</text> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
name: "page-foot", |
||||
|
props: { |
||||
|
name: { |
||||
|
type: String, |
||||
|
default: "" |
||||
|
} |
||||
|
}, |
||||
|
methods: { |
||||
|
submit() { |
||||
|
uni.showModal({ |
||||
|
content:"hello uni-app开源地址为https://github.com/dcloudio/uni-app/tree/master/examples,请在这个开源项目上贡献你的代码", |
||||
|
showCancel:false |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
<style> |
||||
|
.page-share-title { |
||||
|
text-align: center; |
||||
|
font-size: 30rpx; |
||||
|
color: #BEBEBE; |
||||
|
padding: 20rpx 0; |
||||
|
} |
||||
|
|
||||
|
.submit { |
||||
|
border-bottom: 1rpx solid #BEBEBE; |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,16 @@ |
|||||
|
<template name="page-head"> |
||||
|
<view class="common-page-head"> |
||||
|
<view class="common-page-head-title">{{title}}</view> |
||||
|
</view> |
||||
|
</template> |
||||
|
<script> |
||||
|
export default { |
||||
|
name: "page-head", |
||||
|
props: { |
||||
|
title: { |
||||
|
type: String, |
||||
|
default: "" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
@ -0,0 +1,663 @@ |
|||||
|
<template> |
||||
|
<view> |
||||
|
<view class="maskbox" v-show="active" @tap="maskClick"></view> |
||||
|
<view :class="description == 'row'?'uni-combox-row':'uni-combox-column'"> |
||||
|
<view v-if="label" class="uni-combox__label" :style="labelStyle"> |
||||
|
<text>{{label}}</text> |
||||
|
</view> |
||||
|
<view class="u-dropdown"> |
||||
|
<view class="u-dropdown__menu"> |
||||
|
<view class="u-dropdown__menu__item"> |
||||
|
<view class="u-flex " style="width: 100%;"> |
||||
|
<view class="u-close-wrap" v-if="isSearch"> |
||||
|
<u-icon class="u-clear-icon" :size="30" :name="searchIcon" |
||||
|
:color="searchIconColor ? searchIconColor : color"></u-icon> |
||||
|
</view> |
||||
|
|
||||
|
<view class="u-input"> |
||||
|
<u-input confirm-type="search" class="uni-combox__input" |
||||
|
:type="isAutoHeight ? 'textarea':'text'" v-model="inputVal" @confirm="confirm()" |
||||
|
:placeholder="placeholder" :auto-height="isAutoHeight" |
||||
|
:height="isAutoHeight ?height-20:height" /> |
||||
|
</view> |
||||
|
|
||||
|
<icon class="uni-combox__icon" type="clear" size="16" @tap="clearInputValue" |
||||
|
v-if="inputVal!=''" style="height: 100%;align-items: center;justify-content: center;" /> |
||||
|
<!-- <image size="16" src="/static/icons/close-circle2.svg" |
||||
|
style="height: 35%;width: 10%;align-items: center;justify-content: center;background-color: aqua;display: flex;"> --> |
||||
|
<!-- </image> --> |
||||
|
<view :style="{width:height + 'rpx'}" class="u-dropdown__menu__item__arrow" :class="{ |
||||
|
'u-dropdown__menu__item__arrow--rotate': active |
||||
|
}" @tap.stop="menuClick()"> |
||||
|
<u-icon :custom-style="{display: 'flex'}" :name="menuIcon" |
||||
|
:size="$u.addUnit(menuIconSize)" :color="active ? activeColor : '#c0c4cc'"></u-icon> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class="u-dropdown__content" :style="[contentStyle, { |
||||
|
transition: `opacity ${duration / 1000}s linear`, |
||||
|
top: $u.addUnit(height+28), |
||||
|
height: contentHeight + 'px'}]" @tap="maskClick" @touchmove.stop.prevent> |
||||
|
|
||||
|
<view class="u-dropdown__content__popup" :style="[popupStyle]" @touchmove.stop.prevent="() => {}" |
||||
|
@tap.stop.prevent="() => {}"> |
||||
|
|
||||
|
<view class="uni-combox__selector-empty" v-if="optionsLength === 0" @click="empty()"> |
||||
|
<text>{{emptyTips}}</text> |
||||
|
</view> |
||||
|
|
||||
|
<view v-for="(item, index) in filterOptions" style="width: 100%;" |
||||
|
@click="onSelectorClick(index)"> |
||||
|
<view v-if="itemTextCount == 1" class="uni-combox-item"> |
||||
|
<text class="uni-combox-item-text" :title-style="{ |
||||
|
color: inputVal === item ? activeColor : inactiveColor |
||||
|
}">{{item}}</text> |
||||
|
<u-icon v-if="inputVal === item" name="checkbox-mark" :color="activeColor" size="32"> |
||||
|
</u-icon> |
||||
|
</view> |
||||
|
<view v-if="itemTextCount == 2" class="uni-combox-item2"> |
||||
|
<text class="uni-combox-item-text" :title-style="{ |
||||
|
color: inputVal === item ? activeColor : inactiveColor |
||||
|
}">{{item.value}}</text> |
||||
|
<text class="uni-combox-item-text" :title-style="{ |
||||
|
color: inputVal === item ? activeColor : inactiveColor |
||||
|
}">{{item.desc}}</text> |
||||
|
</view> |
||||
|
<u-line class="line_color"></u-line> |
||||
|
</view> |
||||
|
</view> |
||||
|
<!-- <view class="u-dropdown__content__mask"></view> --> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
/** |
||||
|
* dropdown 下拉菜单 |
||||
|
* @description 菜单标题与编辑框排列方向,即水平排列row/垂直排列column,默认水平排列row |
||||
|
* @tutorial http://uviewui.com/components/dropdown.html |
||||
|
* @property {String} active-color 标题和选项卡选中的颜色(默认#2979ff) |
||||
|
* @property {String} inactive-color 标题和选项卡未选中的颜色(默认#606266) |
||||
|
* @property {Boolean} close-on-click-mask 点击遮罩是否关闭菜单(默认true) |
||||
|
* @property {Boolean} close-on-click-self 点击当前激活项标题是否关闭菜单(默认true) |
||||
|
* @property {String | Number} duration 选项卡展开和收起的过渡时间,单位ms(默认300) |
||||
|
* @property {String | Number} height 标题菜单的高度,单位任意(默认80) |
||||
|
* @property {String | Number} border-radius 菜单展开内容下方的圆角值,单位任意(默认0) |
||||
|
* @property {Boolean} border-bottom 标题菜单是否显示下边框(默认false) |
||||
|
* @property {String | Number} title-size 标题的字体大小,单位任意,数值默认为rpx单位(默认28) |
||||
|
* @event {Function} open 下拉菜单被打开时触发 |
||||
|
* @event {Function} close 下拉菜单被关闭时触发 |
||||
|
* @example <pulldown></pulldown> |
||||
|
*/ |
||||
|
export default { |
||||
|
name: 'pulldown', |
||||
|
emits: ["open", "close", "update:modelValue", "input", "change", "confirm"], |
||||
|
props: { |
||||
|
// 菜单标题与编辑框排列方向,水平排列row/垂直排列column |
||||
|
description: { |
||||
|
type: String, |
||||
|
default: 'row' |
||||
|
}, |
||||
|
|
||||
|
// 菜单标题 |
||||
|
label: { |
||||
|
type: String, |
||||
|
default: '' |
||||
|
}, |
||||
|
// 菜单标题长度 |
||||
|
labelWidth: { |
||||
|
type: String, |
||||
|
default: 'auto' |
||||
|
}, |
||||
|
// 菜单标题和选项的激活态颜色 |
||||
|
activeColor: { |
||||
|
type: String, |
||||
|
default: '#2979ff' |
||||
|
}, |
||||
|
// 菜单标题和选项的未激活态颜色 |
||||
|
inactiveColor: { |
||||
|
type: String, |
||||
|
default: '#606266' |
||||
|
}, |
||||
|
// 点击遮罩是否关闭菜单 |
||||
|
closeOnClickMask: { |
||||
|
type: Boolean, |
||||
|
default: true |
||||
|
}, |
||||
|
// 点击当前激活项标题是否关闭菜单 |
||||
|
closeOnClickSelf: { |
||||
|
type: Boolean, |
||||
|
default: true |
||||
|
}, |
||||
|
// 过渡时间 |
||||
|
duration: { |
||||
|
type: [Number, String], |
||||
|
default: 300 |
||||
|
}, |
||||
|
// 标题菜单的高度,单位任意,数值默认为rpx单位 |
||||
|
height: { |
||||
|
type: [Number, String], |
||||
|
default: 55 |
||||
|
}, |
||||
|
// 是否显示下边框 |
||||
|
borderBottom: { |
||||
|
type: Boolean, |
||||
|
default: false |
||||
|
}, |
||||
|
// 标题的字体大小 |
||||
|
titleSize: { |
||||
|
type: [Number, String], |
||||
|
default: 28 |
||||
|
}, |
||||
|
// 下拉出来的内容部分的圆角值 |
||||
|
borderRadius: { |
||||
|
type: [Number, String], |
||||
|
default: 0 |
||||
|
}, |
||||
|
// 菜单右侧的icon图标 |
||||
|
menuIcon: { |
||||
|
type: String, |
||||
|
default: 'arrow-down' |
||||
|
}, |
||||
|
// 菜单右侧图标的大小 |
||||
|
menuIconSize: { |
||||
|
type: [Number, String], |
||||
|
default: 26 |
||||
|
}, |
||||
|
|
||||
|
emptyTips: { |
||||
|
type: String, |
||||
|
default: '无匹配项' |
||||
|
}, |
||||
|
|
||||
|
// 是否开启搜索模式 |
||||
|
isSearch: { |
||||
|
type: Boolean, |
||||
|
default: false |
||||
|
}, |
||||
|
|
||||
|
// 占位提示文字 |
||||
|
hint: { |
||||
|
type: String, |
||||
|
default: '' |
||||
|
}, |
||||
|
|
||||
|
// 搜索图标的颜色,默认同输入框字体颜色 |
||||
|
searchIconColor: { |
||||
|
type: String, |
||||
|
default: '' |
||||
|
}, |
||||
|
// 输入框字体颜色 |
||||
|
color: { |
||||
|
type: String, |
||||
|
default: '#606266' |
||||
|
}, |
||||
|
|
||||
|
// 左边输入框的图标,可以为uView图标名称或图片路径 |
||||
|
searchIcon: { |
||||
|
type: String, |
||||
|
default: 'search' |
||||
|
}, |
||||
|
|
||||
|
// 选项数据,如果传入了默认slot,此参数无效 |
||||
|
options: { |
||||
|
type: Array, |
||||
|
default () { |
||||
|
return []; |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
// 搜索图标的颜色,默认同输入框字体颜色 |
||||
|
itemTextCount: { |
||||
|
type: Number, |
||||
|
default: 1 |
||||
|
}, |
||||
|
//输入框的高度是否随着行数增加,而自动增加输入框的高度 |
||||
|
isAutoHeight: { |
||||
|
type: Boolean, |
||||
|
default: false |
||||
|
}, |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
inputVal: '', |
||||
|
showDropdown: true, // 是否打开下来菜单, |
||||
|
menuList: [], // 显示的菜单 |
||||
|
active: false, // 下拉菜单的状态 |
||||
|
// 当前是第几个菜单处于激活状态,小程序中此处不能写成false或者"",否则后续将current赋值为0, |
||||
|
// 无能的TX没有使用===而是使用==判断,导致程序认为前后二者没有变化,从而不会触发视图更新 |
||||
|
current: 99999, |
||||
|
// 外层内容的样式,初始时处于底层,且透明 |
||||
|
contentStyle: { |
||||
|
// zIndex: 11, |
||||
|
zIndex: -1, |
||||
|
opacity: 0 |
||||
|
}, |
||||
|
// 让某个菜单保持高亮的状态 |
||||
|
highlightIndex: 99999, |
||||
|
contentHeight: 0 |
||||
|
} |
||||
|
}, |
||||
|
computed: { |
||||
|
// 下拉出来部分的样式 |
||||
|
popupStyle() { |
||||
|
let style = {}; |
||||
|
// 进行Y轴位移,展开状态时,恢复原位。收齐状态时,往上位移100%,进行隐藏 |
||||
|
style.transform = `translateY(${this.active ? 0 : '-100%'})` |
||||
|
style['transition-duration'] = this.duration / 1000 + 's'; |
||||
|
style.borderRadius = `0 0 ${this.$u.addUnit(this.borderRadius)} ${this.$u.addUnit(this.borderRadius)}`; |
||||
|
return style; |
||||
|
}, |
||||
|
|
||||
|
labelStyle() { |
||||
|
if (this.labelWidth === 'auto') { |
||||
|
return {} |
||||
|
} |
||||
|
return { |
||||
|
width: this.labelWidth |
||||
|
} |
||||
|
}, |
||||
|
optionsLength() { |
||||
|
return this.options.length |
||||
|
}, |
||||
|
filterOptions() { |
||||
|
if (this.isSearch) { |
||||
|
return this.options.filter((item) => { |
||||
|
return item.indexOf(this.inputVal) > -1 |
||||
|
}) |
||||
|
} else { |
||||
|
return this.options; |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
placeholder() { |
||||
|
if (this.hint) { |
||||
|
return this.hint; |
||||
|
} else { |
||||
|
if (this.isSearch) { |
||||
|
return '请输入关键字'; |
||||
|
} else { |
||||
|
return '请选择'; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
}, |
||||
|
}, |
||||
|
created() { |
||||
|
// 引用所有子组件(u-dropdown-item)的this,不能在data中声明变量,否则在微信小程序会造成循环引用而报错 |
||||
|
this.children = []; |
||||
|
}, |
||||
|
mounted() { |
||||
|
this.getContentHeight(); |
||||
|
}, |
||||
|
methods: { |
||||
|
//清空数据 |
||||
|
clearInputValue() { |
||||
|
this.inputVal = ""; |
||||
|
}, |
||||
|
|
||||
|
//回车监听 |
||||
|
confirm() { |
||||
|
this.$emit("confirm", this.inputVal); |
||||
|
}, |
||||
|
|
||||
|
init() { |
||||
|
// 当某个子组件内容变化时,触发父组件的init,父组件再让每一个子组件重新初始化一遍 |
||||
|
// 以保证数据的正确性 |
||||
|
this.menuList = []; |
||||
|
this.children.map(child => { |
||||
|
child.init(); |
||||
|
}) |
||||
|
}, |
||||
|
// 点击菜单 |
||||
|
menuClick() { |
||||
|
// 判断是否被禁用 |
||||
|
// if (this.menuList[index].disabled) return; |
||||
|
// 如果点击时的索引和当前激活项索引相同,意味着点击了激活项,需要收起下拉菜单 |
||||
|
if (this.active) { |
||||
|
this.close(); |
||||
|
// 等动画结束后,再移除下拉菜单中的内容,否则直接移除,也就没有下拉菜单收起的效果了 |
||||
|
// setTimeout(() => { |
||||
|
// this.active = false; |
||||
|
// }, this.duration) |
||||
|
return; |
||||
|
} |
||||
|
this.open(); |
||||
|
}, |
||||
|
|
||||
|
onSelectorClick(index) { |
||||
|
// console.log(index); |
||||
|
if (this.itemTextCount == 1) { |
||||
|
this.inputVal = this.options[index]; |
||||
|
this.close(); |
||||
|
// 修改通过v-model绑定的值 |
||||
|
this.$emit("input", this.inputVal); |
||||
|
this.$emit("update:modelValue", this.inputVal); |
||||
|
// 发出事件,抛出当前勾选项的value |
||||
|
this.$emit("change", index, this.inputVal); |
||||
|
} else if (this.itemTextCount == 2) { |
||||
|
this.inputVal = this.options[index].value; |
||||
|
this.close(); |
||||
|
// 修改通过v-model绑定的值 |
||||
|
this.$emit("input", this.inputVal); |
||||
|
this.$emit("update:modelValue", this.inputVal); |
||||
|
// 发出事件,抛出当前勾选项的value |
||||
|
this.$emit("change", index, this.inputVal); |
||||
|
} |
||||
|
|
||||
|
}, |
||||
|
// 打开下拉菜单 |
||||
|
open() { |
||||
|
console.log(this.options[0]); |
||||
|
console.log(this.options.length); |
||||
|
// console.log(this.filterOptions()); |
||||
|
// 重置高亮索引,否则会造成多个菜单同时高亮 |
||||
|
// this.highlightIndex = 9999; |
||||
|
// 展开时,设置下拉内容的样式 |
||||
|
this.contentStyle = { |
||||
|
zIndex: 11, |
||||
|
} |
||||
|
this.$forceUpdate(); |
||||
|
// 标记展开状态以及当前展开项的索引 |
||||
|
this.active = true; |
||||
|
// this.current = index; |
||||
|
// 历遍所有的子元素,将索引匹配的项标记为激活状态,因为子元素是通过v-if控制切换的 |
||||
|
// 之所以不是因display: none,是因为nvue没有display这个属性 |
||||
|
|
||||
|
this.$emit('open', this.current); |
||||
|
}, |
||||
|
// 设置下拉菜单处于收起状态 |
||||
|
close() { |
||||
|
this.$emit('close', this.current); |
||||
|
// 设置为收起状态,同时current归位,设置为空字符串 |
||||
|
this.active = false; |
||||
|
this.current = 99999; |
||||
|
// 下拉内容的样式进行调整,不透明度设置为0 |
||||
|
this.contentStyle = { |
||||
|
zIndex: -1, |
||||
|
opacity: 0 |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
//点击无匹配选项关闭下拉菜单 |
||||
|
empty() { |
||||
|
// 设置为收起状态,同时current归位,设置为空字符串 |
||||
|
this.active = false; |
||||
|
this.current = 99999; |
||||
|
// 下拉内容的样式进行调整,不透明度设置为0 |
||||
|
this.contentStyle = { |
||||
|
zIndex: -1, |
||||
|
opacity: 0 |
||||
|
} |
||||
|
}, |
||||
|
// 点击遮罩 |
||||
|
maskClick() { |
||||
|
// 如果不允许点击遮罩,直接返回 |
||||
|
if (!this.closeOnClickMask) return; |
||||
|
this.close(); |
||||
|
}, |
||||
|
// 外部手动设置某个菜单高亮 |
||||
|
highlight(index = undefined) { |
||||
|
this.highlightIndex = index !== undefined ? index : 99999; |
||||
|
}, |
||||
|
// 获取下拉菜单内容的高度 |
||||
|
getContentHeight() { |
||||
|
// 这里的原理为,因为dropdown组件是相对定位的,它的下拉出来的内容,必须给定一个高度 |
||||
|
// 才能让遮罩占满菜单一下,直到屏幕底部的高度 |
||||
|
// this.$u.sys()为uView封装的获取设备信息的方法 |
||||
|
let windowHeight = this.$u.sys().windowHeight; |
||||
|
this.$uGetRect('.u-dropdown__menu').then(res => { |
||||
|
// 这里获取的是dropdown的尺寸,在H5上,uniapp获取尺寸是有bug的(以前提出修复过,后来又出现了此bug,目前hx2.8.11版本) |
||||
|
// H5端bug表现为元素尺寸的top值为导航栏底部到到元素的上边沿的距离,但是元素的bottom值确是导航栏顶部到元素底部的距离 |
||||
|
// 二者是互相矛盾的,本质原因是H5端导航栏非原生,uni的开发者大意造成 |
||||
|
// 这里取菜单栏的botton值合理的,不能用res.top,否则页面会造成滚动 |
||||
|
this.contentHeight = windowHeight - res.bottom; |
||||
|
// console.log(this.contentHeight); |
||||
|
// console.log(res.bottom); |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="scss"> |
||||
|
@import "../../uni_modules/vk-uview-ui/libs/css/style.components.scss"; |
||||
|
|
||||
|
.u-input { |
||||
|
width: 100%; |
||||
|
padding-top: 5px; |
||||
|
padding-bottom: 5px; |
||||
|
} |
||||
|
|
||||
|
.u-clear-icon { |
||||
|
@include vue-flex; |
||||
|
align-items: center; |
||||
|
} |
||||
|
|
||||
|
.u-close-wrap { |
||||
|
width: 30px; |
||||
|
height: 100%; |
||||
|
@include vue-flex; |
||||
|
align-items: center; |
||||
|
justify-content: center; |
||||
|
border-radius: 50%; |
||||
|
} |
||||
|
|
||||
|
.maskbox { |
||||
|
position: fixed; |
||||
|
top: 0; |
||||
|
left: 0; |
||||
|
width: 100vw; |
||||
|
height: 100vh; |
||||
|
z-index: 4; |
||||
|
} |
||||
|
|
||||
|
.uni-combox-row { |
||||
|
/* #ifndef APP-NVUE */ |
||||
|
width: 100%; |
||||
|
display: flex; |
||||
|
/* #endif */ |
||||
|
min-height: 40px; |
||||
|
flex-direction: row; |
||||
|
align-items: center; |
||||
|
position: relative; |
||||
|
background-color: #FFFFFF; |
||||
|
// padding-right: 5px; |
||||
|
// padding-left: 5px; |
||||
|
// z-index: 3; |
||||
|
} |
||||
|
|
||||
|
.uni-combox-column { |
||||
|
/* #ifndef APP-NVUE */ |
||||
|
width: 100%; |
||||
|
display: flex; |
||||
|
/* #endif */ |
||||
|
min-height: 40px; |
||||
|
flex-direction: column; |
||||
|
align-items: flex-start; |
||||
|
position: relative; |
||||
|
background-color: #FFFFFF; |
||||
|
// padding-right: 5px; |
||||
|
// padding-left: 5px; |
||||
|
// z-index: 3; |
||||
|
} |
||||
|
|
||||
|
.uni-combox__label { |
||||
|
font-size: 16px; |
||||
|
line-height: 22px; |
||||
|
padding-right: 10px; |
||||
|
} |
||||
|
|
||||
|
.uni-combox__selector-empty, |
||||
|
.uni-combox__selector-item { |
||||
|
/* #ifdef APP-NVUE */ |
||||
|
display: flex; |
||||
|
/* #endif */ |
||||
|
line-height: 36px; |
||||
|
font-size: 14px; |
||||
|
text-align: center; |
||||
|
border-bottom: solid 1px #DDDDDD; |
||||
|
/* margin: 0px 10px; */ |
||||
|
} |
||||
|
|
||||
|
.uni-combox__icon { |
||||
|
display: flex; |
||||
|
height: 100%; |
||||
|
align-items: center; |
||||
|
justify-content: center; |
||||
|
background-color: #FFFFFF; |
||||
|
z-index: 4; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
.uni-combox__input { |
||||
|
// flex: 1; |
||||
|
font-size: 16px; |
||||
|
height: 100%; |
||||
|
line-height: 100%; |
||||
|
background-color: #FFFFFF; |
||||
|
width: 100%; |
||||
|
z-index: 5; |
||||
|
} |
||||
|
|
||||
|
.uni-combox-item { |
||||
|
display: flex; |
||||
|
flex-direction: row; |
||||
|
font-size: 16px; |
||||
|
height: 100%; |
||||
|
line-height: 100%; |
||||
|
background-color: #FFFFFF; |
||||
|
width: 100%; |
||||
|
} |
||||
|
|
||||
|
.uni-combox-item2 { |
||||
|
display: flex; |
||||
|
flex-direction: column; |
||||
|
font-size: 16px; |
||||
|
height: 100%; |
||||
|
line-height: 100%; |
||||
|
background-color: #FFFFFF; |
||||
|
width: 100%; |
||||
|
} |
||||
|
|
||||
|
.uni-combox-item-text { |
||||
|
font-size: 16px; |
||||
|
height: 100%; |
||||
|
line-height: 100%; |
||||
|
background-color: #FFFFFF; |
||||
|
width: 100%; |
||||
|
padding: 20rpx; |
||||
|
display: flex; |
||||
|
} |
||||
|
|
||||
|
.uni-combox__input-box { |
||||
|
/* #ifndef APP-NVUE */ |
||||
|
display: flex; |
||||
|
/* #endif */ |
||||
|
flex: 1; |
||||
|
flex-direction: column; |
||||
|
} |
||||
|
|
||||
|
.uni-combox__selector { |
||||
|
box-sizing: border-box; |
||||
|
position: absolute; |
||||
|
top: 42px; |
||||
|
left: 0; |
||||
|
width: 100%; |
||||
|
background-color: #FFFFFF; |
||||
|
border-radius: 6px; |
||||
|
box-shadow: #DDDDDD 4px 4px 8px, #DDDDDD -4px -4px 8px; |
||||
|
z-index: 2; |
||||
|
} |
||||
|
|
||||
|
.u-dropdown { |
||||
|
flex: 1; |
||||
|
width: 100%; |
||||
|
position: relative; |
||||
|
background-color: #FFFFFF; |
||||
|
margin-right: 2rpx; |
||||
|
margin-left: 2rpx; |
||||
|
|
||||
|
&__menu { |
||||
|
@include vue-flex; |
||||
|
// position: relative; |
||||
|
z-index: 11; |
||||
|
width: 100%; |
||||
|
|
||||
|
&__item { |
||||
|
// flex: 1; |
||||
|
@include vue-flex; |
||||
|
justify-content: center; |
||||
|
// align-items: center; |
||||
|
border: 2rpx solid $uni-border-color; |
||||
|
width: 100%; |
||||
|
margin-top: 2rpx; |
||||
|
// margin-right: 2rpx; |
||||
|
// margin-left: 2rpx; |
||||
|
|
||||
|
&__text { |
||||
|
font-size: 28rpx; |
||||
|
color: $u-content-color; |
||||
|
} |
||||
|
|
||||
|
&__arrow { |
||||
|
transition: transform .3s; |
||||
|
align-items: center; |
||||
|
justify-content: center; |
||||
|
@include vue-flex; |
||||
|
|
||||
|
&--rotate { |
||||
|
transform: rotate(180deg); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
&__content { |
||||
|
position: absolute; |
||||
|
z-index: 8; |
||||
|
width: 100%; |
||||
|
left: 0px; |
||||
|
bottom: 0; |
||||
|
overflow: hidden; |
||||
|
// z-index: 10; |
||||
|
// box-sizing: border-box; |
||||
|
// position: absolute; |
||||
|
// top: 42px; |
||||
|
// left: 0; |
||||
|
// width: 100%; |
||||
|
// // background-color: #FFFFFF; |
||||
|
// border-radius: 6px; |
||||
|
// box-shadow: #DDDDDD 4px 4px 8px, #DDDDDD -4px -4px 8px; |
||||
|
// z-index: 10; |
||||
|
|
||||
|
&__mask { |
||||
|
position: relative; |
||||
|
z-index: 9; |
||||
|
background: rgba(0, 0, 0, .3); |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
left: 0; |
||||
|
top: 0; |
||||
|
bottom: 0; |
||||
|
} |
||||
|
|
||||
|
&__popup { |
||||
|
position: relative; |
||||
|
z-index: 11; |
||||
|
transition: all 0.3s; |
||||
|
transform: translate3D(0, -100%, 0); |
||||
|
overflow: hidden; |
||||
|
width: 100%; |
||||
|
background-color: aliceblue; |
||||
|
border: 2rpx solid $uni-border-color; |
||||
|
// z-index: 10; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
</style> |
@ -0,0 +1,85 @@ |
|||||
|
<template> |
||||
|
<view class="content"> |
||||
|
<view class="screen-input"> |
||||
|
<u-search |
||||
|
v-model='keyWord' |
||||
|
:show-action='false' |
||||
|
:bg-color="searchData.bgBolor ||'white'" |
||||
|
:border-color="searchData.borderColor ||'#E4E4E4'" |
||||
|
:shape="searchData.shape ||'square'" |
||||
|
:height="searchData.height || 80" |
||||
|
:placeholder="searchData.placeholder ||'请输入设备名称'" |
||||
|
:clearabled="true" |
||||
|
@search='search' |
||||
|
@clear='clear' |
||||
|
> |
||||
|
</u-search> |
||||
|
</view> |
||||
|
<view class="screen-btn" @click="screen" v-if="isShowScreen"> |
||||
|
<image src="../../static/icon/screen.png" mode="widthFix"></image> |
||||
|
<view>筛选</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
props: { |
||||
|
searchData:{ |
||||
|
type: Object, |
||||
|
default:()=>{return {}}, |
||||
|
require:false |
||||
|
}, |
||||
|
isShowScreen: { |
||||
|
type: Boolean, |
||||
|
default:()=>{return true}, |
||||
|
require:false |
||||
|
}, |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
keyWord: '', |
||||
|
} |
||||
|
}, |
||||
|
methods: { |
||||
|
// 搜索 |
||||
|
search() { |
||||
|
this.$emit('search', this.keyWord) |
||||
|
}, |
||||
|
// 搜索 |
||||
|
clear() { |
||||
|
this.$emit('search', '') |
||||
|
}, |
||||
|
// 筛选 |
||||
|
screen() { |
||||
|
this.$emit('screen') |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss" scoped> |
||||
|
.content { |
||||
|
padding: 20rpx; |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
background: white; |
||||
|
|
||||
|
.screen-input { |
||||
|
flex: 1; |
||||
|
width: 0px; |
||||
|
} |
||||
|
|
||||
|
.screen-btn { |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
margin-left:20rpx; |
||||
|
|
||||
|
image { |
||||
|
width: 30rpx; |
||||
|
margin-right: 6rpx; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
</style> |
@ -0,0 +1,456 @@ |
|||||
|
<template name="show-modal"> |
||||
|
<view> |
||||
|
<u-modal v-model="show" :title-style="{color: 'red'}" :title="title" :showTitle="false" |
||||
|
:showConfirmButton="false" ref="modal"> |
||||
|
<view class="slot-content"> |
||||
|
<slot name="icon"> |
||||
|
<image class="icon" :src="icon" /> |
||||
|
</slot> |
||||
|
|
||||
|
<scroll-view scroll-y="true" style="max-height: 200px;"> |
||||
|
<rich-text class="content" :nodes="content"> |
||||
|
</rich-text> |
||||
|
</scroll-view> |
||||
|
|
||||
|
|
||||
|
<u-line></u-line> |
||||
|
<slot name="button"> |
||||
|
<view class="uni-flex uni-row u-col-center space-between" style="width: 100%;height: 48px;"> |
||||
|
<view v-if="showCancelButton" class="cance_button" @tap="$u.throttle(cancelClose, 500)"> |
||||
|
<text :style="{'color':cancelColor}">{{ cancelText }}</text> |
||||
|
</view> |
||||
|
<u-line direction="col" length="100%"></u-line> |
||||
|
<view v-if="showConfirmButton" class="confirm_button" @tap="$u.throttle(confirmClose, 500)"> |
||||
|
<text :style="{'color':confirmColor}">{{confirmText}}</text> |
||||
|
<text v-if="showConfirmCountdown">({{seconds}}s关闭)</text> |
||||
|
</view> |
||||
|
</view> |
||||
|
</slot> |
||||
|
</view> |
||||
|
</u-modal> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
/** |
||||
|
* modal 模态框 |
||||
|
* @description 弹出模态框,常用于消息提示、消息确认、在当前页面内完成特定的交互操作 |
||||
|
* */ |
||||
|
export default { |
||||
|
data() { |
||||
|
return { |
||||
|
timer: null, |
||||
|
show: false, // 是否显示 |
||||
|
iconType: '消息', |
||||
|
icon: '../../static/icons/error-circle.svg', |
||||
|
title: '', // 提示标题 |
||||
|
content: '', // 提示内容 |
||||
|
cancelText: '取消', // 取消按钮的文字 |
||||
|
confirmText: '确定', // 确认按钮文字 |
||||
|
showCancel: true, // 是否显示取消按钮,默认为 true |
||||
|
confirmColor: '#007aff', // 确定按钮颜色 |
||||
|
cancelColor: null, // 取消按钮颜色 |
||||
|
showConfirmButton: true, // 是否显示确认按钮 |
||||
|
showConfirmCountdown: true, // 是否显示确定倒计时 |
||||
|
showCancelButton: true, // 是否显示取消按钮 |
||||
|
showClose: false, |
||||
|
confirm: false, //为 true 时,表示用户点击了确定按钮 |
||||
|
cancel: false, //为 true 时,表示用户点击了取消 |
||||
|
seconds: 0, |
||||
|
success: () => {} // 回调方法 |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
methods: { |
||||
|
open() { |
||||
|
this.show = true; |
||||
|
}, |
||||
|
close() { |
||||
|
this.$.refs.modal.popupClose(); |
||||
|
}, |
||||
|
confirmClose() { |
||||
|
if (this.show) { |
||||
|
this.show = false; |
||||
|
clearInterval(this.timer) //清空timer |
||||
|
this.$.refs.modal.popupClose(); |
||||
|
this.success({ |
||||
|
// cancel: false, |
||||
|
confirm: true, |
||||
|
}); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
cancelClose() { |
||||
|
clearInterval(this.timer) //清空timer |
||||
|
this.$.refs.modal.popupClose(); |
||||
|
this.success({ |
||||
|
// cancel: true, |
||||
|
confirm: false, |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
// 打开消息弹框(确定) |
||||
|
showConfirmMessageModal(mContent, callback) { |
||||
|
this.showConfirmModal("消息", mContent, callback); |
||||
|
}, |
||||
|
|
||||
|
// 打开成功弹框(确定) |
||||
|
showConfirmSuccessModal(mContent, callback) { |
||||
|
this.showConfirmModal("成功", mContent, callback); |
||||
|
}, |
||||
|
|
||||
|
// 打开失败弹框(确定) |
||||
|
showConfirmFailModal(mContent, callback) { |
||||
|
this.showConfirmModal("失败", mContent, callback); |
||||
|
}, |
||||
|
|
||||
|
// 打开警告弹框(确定) |
||||
|
showConfirmWarningModal(mContent, callback) { |
||||
|
this.showConfirmModal("警告", mContent, callback); |
||||
|
}, |
||||
|
|
||||
|
// 打开疑问弹框(确定) |
||||
|
showConfirmQuestionModal(mContent, callback) { |
||||
|
this.showConfirmModal("疑问", mContent, callback); |
||||
|
}, |
||||
|
|
||||
|
// 初始化弹框并打开(确定) |
||||
|
showConfirmModal(mIconType, mContent, callback) { |
||||
|
this.showModal({ |
||||
|
iconType: mIconType, |
||||
|
content: mContent, |
||||
|
showCancelButton: false, |
||||
|
success: function(res) { |
||||
|
if (callback != undefined) { |
||||
|
if (res.confirm == true) { |
||||
|
callback(true); |
||||
|
console.log('用户点击确定') |
||||
|
} else { |
||||
|
callback(false); |
||||
|
console.log('用户点击取消') |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
// 打开消息弹框(取消+确定) |
||||
|
showSelectMessageModal(mContent, callback) { |
||||
|
this.showSelectModal("消息", mContent, callback); |
||||
|
}, |
||||
|
|
||||
|
// 打开成功弹框(取消+确定) |
||||
|
showSelectSuccessModal(mContent, callback) { |
||||
|
this.showSelectModal("成功", mContent, callback); |
||||
|
}, |
||||
|
|
||||
|
// 打开失败弹框(取消+确定) |
||||
|
showSelectFailModal(mContent, callback) { |
||||
|
this.showSelectModal("失败", mContent, callback); |
||||
|
}, |
||||
|
|
||||
|
// 打开警告弹框(取消+确定) |
||||
|
showSelectWarningModal(mContent, callback) { |
||||
|
this.showSelectModal("警告", mContent, callback); |
||||
|
}, |
||||
|
|
||||
|
// 打开疑问弹框(取消+确定) |
||||
|
showSelectQuestionModal(mContent, callback) { |
||||
|
this.showSelectModal("疑问", mContent, callback); |
||||
|
}, |
||||
|
|
||||
|
// 初始化弹框并打开(取消+确定) |
||||
|
showSelectModal(mIconType, mContent, callback) { |
||||
|
this.showModal({ |
||||
|
iconType: mIconType, |
||||
|
content: mContent, |
||||
|
success: function(res) { |
||||
|
if (callback != undefined) { |
||||
|
if (res.confirm == true) { |
||||
|
callback(true); |
||||
|
console.log('用户点击确定') |
||||
|
} else { |
||||
|
callback(false); |
||||
|
console.log('用户点击取消') |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
// 打开消息弹框(确定+倒计时) |
||||
|
showConfirmCountdownMessageModal(mContent, callback) { |
||||
|
this.showConfirmCountdownModal("消息", mContent, callback); |
||||
|
}, |
||||
|
|
||||
|
// 打开成功弹框(确定+倒计时) |
||||
|
showConfirmCountdownSuccessModal(mContent, callback) { |
||||
|
this.showConfirmCountdownModal("成功", mContent, callback); |
||||
|
}, |
||||
|
|
||||
|
// 打开失败弹框(确定+倒计时) |
||||
|
showConfirmCountdownFailModal(mContent, callback) { |
||||
|
this.showConfirmCountdownModal("失败", mContent, callback); |
||||
|
}, |
||||
|
|
||||
|
// 打开警告弹框(确定+倒计时) |
||||
|
showConfirmCountdownWarningModal(mContent, callback) { |
||||
|
this.showConfirmCountdownModal("警告", mContent, callback); |
||||
|
}, |
||||
|
|
||||
|
// 打开疑问弹框(确定+倒计时) |
||||
|
showConfirmCountdownQuestionModal(mContent, callback) { |
||||
|
this.showConfirmCountdownModal("疑问", mContent, callback); |
||||
|
}, |
||||
|
|
||||
|
// 初始化弹框并打开(确定+倒计时) |
||||
|
showConfirmCountdownModal(mIconType, mContent, callback) { |
||||
|
this.showModal({ |
||||
|
iconType: mIconType, |
||||
|
content: mContent, |
||||
|
showCancelButton: false, |
||||
|
showConfirmCountdown: true, |
||||
|
success: function(res) { |
||||
|
if (callback != undefined) { |
||||
|
if (res.confirm == true) { |
||||
|
callback(true); |
||||
|
console.log('用户点击确定') |
||||
|
} else { |
||||
|
callback(false); |
||||
|
console.log('用户点击取消') |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
// 打开消息弹框(取消+确定+倒计时) |
||||
|
showSelectCountdownMessageModal(mContent, callback) { |
||||
|
this.showSelectCountdownModal("消息", mContent, callback); |
||||
|
}, |
||||
|
|
||||
|
// 打开成功弹框(取消+确定+倒计时) |
||||
|
showSelectCountdownSuccessModal(mContent, callback) { |
||||
|
this.showSelectCountdownModal("成功", mContent, callback); |
||||
|
}, |
||||
|
|
||||
|
// 打开失败弹框(取消+确定+倒计时) |
||||
|
showSelectCountdownFailModal(mContent, callback) { |
||||
|
this.showSelectCountdownModal("失败", mContent, callback); |
||||
|
}, |
||||
|
|
||||
|
// 打开警告弹框(取消+确定+倒计时) |
||||
|
showSelectCountdownWarningModal(mContent, callback) { |
||||
|
this.showSelectCountdownModal("警告", mContent, callback); |
||||
|
}, |
||||
|
|
||||
|
// 打开疑问弹框(取消+确定+倒计时) |
||||
|
showSelectCountdownQuestionModal(mContent, callback) { |
||||
|
this.showSelectCountdownModal("疑问", mContent, callback); |
||||
|
}, |
||||
|
|
||||
|
// 初始化弹框并打开(取消+确定+倒计时) |
||||
|
showSelectCountdownModal(mIconType, mContent, callback) { |
||||
|
this.showModal({ |
||||
|
iconType: mIconType, |
||||
|
content: mContent, |
||||
|
showConfirmCountdown: true, |
||||
|
success: function(res) { |
||||
|
if (callback != undefined) { |
||||
|
if (res.confirm == true) { |
||||
|
callback(true); |
||||
|
console.log('用户点击确定') |
||||
|
} else { |
||||
|
callback(false); |
||||
|
console.log('用户点击取消') |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
// 初始化弹框并打开 |
||||
|
showModal(data) { |
||||
|
if (data.iconType) { |
||||
|
this.iconType = data.iconType |
||||
|
switch (data.iconType) { |
||||
|
case '消息': |
||||
|
this.icon = '/static/icons/error-circle.svg'; |
||||
|
break; |
||||
|
case '成功': |
||||
|
this.icon = '/static/icons/checkmark-circle.svg'; |
||||
|
break; |
||||
|
case '失败': |
||||
|
this.icon = '/static/icons/close-circle.svg'; |
||||
|
break; |
||||
|
case '警告': |
||||
|
this.icon = '/static/icons/warning.svg'; |
||||
|
break; |
||||
|
case '疑问': |
||||
|
this.icon = '/static/icons/question-circle.svg'; |
||||
|
break; |
||||
|
default: |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
// image |
||||
|
if (data.title) { |
||||
|
this.title = data.title |
||||
|
} |
||||
|
if (data.content) { |
||||
|
console.log(data.content); |
||||
|
this.content = data.content; |
||||
|
} else { |
||||
|
this.content = '' |
||||
|
} |
||||
|
if (data.cancelText) { |
||||
|
this.cancelText = data.cancelText |
||||
|
} else { |
||||
|
this.cancelText = '取消' |
||||
|
} |
||||
|
if (data.confirmText) { |
||||
|
this.confirmText = data.confirmText |
||||
|
} else { |
||||
|
this.confirmText = '确定' |
||||
|
} |
||||
|
|
||||
|
if (data.showCancel === false || data.showCancel === true) { |
||||
|
this.showCancel = data.showCancel |
||||
|
} else { |
||||
|
this.showCancel = true |
||||
|
} |
||||
|
|
||||
|
if (data.confirmColor) { |
||||
|
this.confirmColor = data.confirmColor |
||||
|
} else { |
||||
|
this.confirmColor = '#007aff' |
||||
|
} |
||||
|
|
||||
|
if (data.cancelColor) { |
||||
|
this.cancelColor = data.cancelColor |
||||
|
} else { |
||||
|
this.cancelColor = '#666F83' |
||||
|
} |
||||
|
|
||||
|
if (data.showConfirmButton === false || data.showConfirmButton === true) { |
||||
|
this.showConfirmButton = data.showConfirmButton |
||||
|
} else { |
||||
|
this.showConfirmButton = true |
||||
|
} |
||||
|
|
||||
|
if (data.showConfirmCountdown === false || data.showConfirmCountdown === true) { |
||||
|
this.showConfirmCountdown = data.showConfirmCountdown |
||||
|
} else { |
||||
|
this.showConfirmCountdown = false |
||||
|
} |
||||
|
|
||||
|
if (data.showCancelButton === false || data.showCancelButton === true) { |
||||
|
this.showCancelButton = data.showCancelButton |
||||
|
} else { |
||||
|
this.showCancelButton = true |
||||
|
} |
||||
|
|
||||
|
if (data.success) { |
||||
|
this.success = data.success |
||||
|
} else { |
||||
|
this.success = () => {} |
||||
|
} |
||||
|
setTimeout(res => { |
||||
|
this.show = true; |
||||
|
}, 500) |
||||
|
if (this.showConfirmCountdown) { |
||||
|
this.startTimer(); |
||||
|
} |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
startTimer() { |
||||
|
this.seconds = 3; |
||||
|
clearInterval(this.timer) |
||||
|
this.timer = setInterval(() => { |
||||
|
this.seconds-- |
||||
|
// console.log("倒计时时间", this.seconds); |
||||
|
if (this.seconds <= 0) { |
||||
|
this.timeUp() |
||||
|
return |
||||
|
} |
||||
|
}, 1000) |
||||
|
}, |
||||
|
|
||||
|
timeUp() { |
||||
|
// clearInterval(this.timer) |
||||
|
console.log('时间到') |
||||
|
this.confirmClose(); |
||||
|
}, |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
|
</script> |
||||
|
<style lang="scss" scoped> |
||||
|
.slot-content { |
||||
|
font-size: 36rpx; |
||||
|
display: flex; //弹性布局 |
||||
|
flex-direction: column; //垂直排列 |
||||
|
align-items: center; //子元素居中 |
||||
|
// background-image: url() |
||||
|
} |
||||
|
|
||||
|
.icon { |
||||
|
width: 70rpx; |
||||
|
height: 70rpx; |
||||
|
opacity: 1; //透明度 |
||||
|
margin-top: 16px; |
||||
|
} |
||||
|
|
||||
|
.title { |
||||
|
font-size: 35rpx; |
||||
|
} |
||||
|
|
||||
|
.content { |
||||
|
margin-top: 16px; |
||||
|
margin-bottom: 16px; |
||||
|
margin-left: 8px; |
||||
|
margin-right: 8px; |
||||
|
font-size: 32rpx; |
||||
|
text-align: center; |
||||
|
word-wrap: break-word; |
||||
|
word-break: break-all; |
||||
|
white-space: pre-line; |
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
.cance_button { |
||||
|
width: 100%; |
||||
|
margin-top: 10px; |
||||
|
margin-bottom: 10px; |
||||
|
font-size: 32rpx; |
||||
|
display: flex; |
||||
|
justify-content: center; |
||||
|
align-items: center; |
||||
|
} |
||||
|
|
||||
|
.confirm_button { |
||||
|
width: 100%; |
||||
|
margin-top: 10px; |
||||
|
margin-bottom: 10px; |
||||
|
font-size: 32rpx; |
||||
|
display: flex; |
||||
|
justify-content: center; |
||||
|
align-items: center; |
||||
|
} |
||||
|
|
||||
|
.confirm_text { |
||||
|
// color: $uni-color-primary; |
||||
|
} |
||||
|
|
||||
|
.def_text { |
||||
|
color: $uni-color-primary; |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,175 @@ |
|||||
|
<template> |
||||
|
<view class="view"> |
||||
|
<view class="list-cell view" hover-class="uni-list-cell-hover" @click="bindClick"> |
||||
|
<view class="media-list view" v-if="options.title"> |
||||
|
<view class="view" :class="{'media-image-right': options.article_type === 2, 'media-image-left': options.article_type === 1}"> |
||||
|
<text class="media-title" :class="{'media-title2': options.article_type === 1 || options.article_type === 2}">{{options.title}}</text> |
||||
|
<view v-if="options.image_list || options.image_url" class="image-section view" :class="{'image-section-right': options.article_type === 2, 'image-section-left': options.article_type === 1}"> |
||||
|
<image class="image-list1" :class="{'image-list2': options.article_type === 1 || options.article_type === 2}" |
||||
|
v-if="options.image_url" :src="options.image_url"></image> |
||||
|
<image class="image-list3" v-if="options.image_list" :src="source.url" v-for="(source, i) in options.image_list" |
||||
|
:key="i" /> |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class="media-foot view"> |
||||
|
<view class="media-info view"> |
||||
|
<text class="info-text">{{options.source}}</text> |
||||
|
<text class="info-text">{{options.comment_count}}条评论</text> |
||||
|
<text class="info-text">{{options.datetime}}</text> |
||||
|
</view> |
||||
|
<view class="max-close-view view" @click.stop="close"> |
||||
|
<view class="close-view view"><text class="close">×</text></view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
props: { |
||||
|
options: { |
||||
|
type: Object, |
||||
|
default: function(e) { |
||||
|
return {} |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
methods: { |
||||
|
close(e) { |
||||
|
this.$emit('close'); |
||||
|
}, |
||||
|
bindClick() { |
||||
|
this.$emit('click'); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
.view { |
||||
|
display: flex; |
||||
|
flex-direction: column; |
||||
|
box-sizing: border-box; |
||||
|
} |
||||
|
|
||||
|
.list-cell { |
||||
|
width: 750rpx; |
||||
|
padding: 0 30rpx; |
||||
|
} |
||||
|
|
||||
|
.uni-list-cell-hover { |
||||
|
background-color: #eeeeee; |
||||
|
} |
||||
|
|
||||
|
.media-list { |
||||
|
flex: 1; |
||||
|
flex-direction: column; |
||||
|
border-bottom-width: 1rpx; |
||||
|
border-bottom-style: solid; |
||||
|
border-bottom-color: #c8c7cc; |
||||
|
padding: 20rpx 0; |
||||
|
} |
||||
|
|
||||
|
.media-image-right { |
||||
|
flex-direction: row; |
||||
|
} |
||||
|
|
||||
|
.media-image-left { |
||||
|
flex-direction: row-reverse; |
||||
|
} |
||||
|
|
||||
|
.media-title { |
||||
|
flex: 1; |
||||
|
} |
||||
|
|
||||
|
.media-title { |
||||
|
lines: 3; |
||||
|
text-overflow: ellipsis; |
||||
|
font-size: 32rpx; |
||||
|
color: #555555; |
||||
|
} |
||||
|
|
||||
|
.media-title2 { |
||||
|
flex: 1; |
||||
|
margin-top: 6rpx; |
||||
|
line-height: 40rpx; |
||||
|
} |
||||
|
|
||||
|
.image-section { |
||||
|
margin-top: 20rpx; |
||||
|
flex-direction: row; |
||||
|
justify-content: space-between; |
||||
|
} |
||||
|
|
||||
|
.image-section-right { |
||||
|
margin-top: 0rpx; |
||||
|
margin-left: 10rpx; |
||||
|
width: 225rpx; |
||||
|
height: 146rpx; |
||||
|
} |
||||
|
|
||||
|
.image-section-left { |
||||
|
margin-top: 0rpx; |
||||
|
margin-right: 10rpx; |
||||
|
width: 225rpx; |
||||
|
height: 146rpx; |
||||
|
} |
||||
|
|
||||
|
.image-list1 { |
||||
|
width: 690rpx; |
||||
|
height: 481rpx; |
||||
|
} |
||||
|
|
||||
|
.image-list2 { |
||||
|
width: 225rpx; |
||||
|
height: 146rpx; |
||||
|
} |
||||
|
|
||||
|
.image-list3 { |
||||
|
width: 225rpx; |
||||
|
height: 146rpx; |
||||
|
} |
||||
|
|
||||
|
.media-info { |
||||
|
flex-direction: row; |
||||
|
} |
||||
|
|
||||
|
.info-text { |
||||
|
margin-right: 20rpx; |
||||
|
color: #999999; |
||||
|
font-size: 24rpx; |
||||
|
} |
||||
|
|
||||
|
.media-foot { |
||||
|
margin-top: 20rpx; |
||||
|
flex-direction: row; |
||||
|
justify-content: space-between; |
||||
|
} |
||||
|
|
||||
|
.max-close-view { |
||||
|
align-items: center; |
||||
|
justify-content: flex-end; |
||||
|
flex-direction: row; |
||||
|
height: 40rpx; |
||||
|
width: 80rpx; |
||||
|
} |
||||
|
|
||||
|
.close-view { |
||||
|
border-style: solid; |
||||
|
border-width: 1px; |
||||
|
border-color: #999999; |
||||
|
border-radius: 10rpx; |
||||
|
justify-content: center; |
||||
|
height: 30rpx; |
||||
|
width: 40rpx; |
||||
|
line-height: 30rpx; |
||||
|
} |
||||
|
|
||||
|
.close { |
||||
|
text-align: center; |
||||
|
color: #999999; |
||||
|
font-size: 28rpx; |
||||
|
} |
||||
|
</style> |
File diff suppressed because it is too large
File diff suppressed because one or more lines are too long
@ -0,0 +1,14 @@ |
|||||
|
import CryptoJS from 'crypto-js' |
||||
|
/** |
||||
|
* @word 要加密的内容 |
||||
|
* @keyWord String 服务器随机返回的关键字 |
||||
|
* */ |
||||
|
export function aesEncrypt(word, keyWord = "XwKsGlMcdPMEhR1B") { |
||||
|
var key = CryptoJS.enc.Utf8.parse(keyWord); |
||||
|
var srcs = CryptoJS.enc.Utf8.parse(word); |
||||
|
var encrypted = CryptoJS.AES.encrypt(srcs, key, { |
||||
|
mode: CryptoJS.mode.ECB, |
||||
|
padding: CryptoJS.pad.Pkcs7 |
||||
|
}); |
||||
|
return encrypted.toString(); |
||||
|
} |
@ -0,0 +1,17 @@ |
|||||
|
import config from '@/config' |
||||
|
const baseUrl = config.baseUrl |
||||
|
export const myRequest = (option = {}) => { |
||||
|
return new Promise((reslove, reject) => { |
||||
|
uni.request({ |
||||
|
url: baseUrl + option.url, |
||||
|
data: option.data, |
||||
|
method: option.method || "GET", |
||||
|
success: (result) => { |
||||
|
reslove(result) |
||||
|
}, |
||||
|
fail: (error) => { |
||||
|
reject(error) |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
} |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,13 @@ |
|||||
|
/// <reference types="vite/client" />
|
||||
|
|
||||
|
declare module '*.vue' { |
||||
|
import { DefineComponent } from 'vue' |
||||
|
|
||||
|
const component: DefineComponent<{}, {}, any> |
||||
|
export default component |
||||
|
} |
||||
|
|
||||
|
interface ImportMetaEnv { |
||||
|
VITE_TITLE: string |
||||
|
VITE_BASE_URL: string |
||||
|
} |
@ -0,0 +1,41 @@ |
|||||
|
import { createSSRApp } from 'vue' |
||||
|
import * as Pinia from 'pinia' |
||||
|
// @ts-ignore
|
||||
|
import uView from 'vk-uview-ui' |
||||
|
import App from './App.vue' |
||||
|
|
||||
|
|
||||
|
|
||||
|
import tab from './plugins/tab' |
||||
|
import modal from './plugins/modal' |
||||
|
import time from './plugins/time' |
||||
|
|
||||
|
|
||||
|
// unocss
|
||||
|
import 'uno.css' |
||||
|
|
||||
|
import { accessTimeInAnHour, getNowFormatDate } from "./utils/dateTime"; |
||||
|
export function createApp() { |
||||
|
const app = createSSRApp(App) |
||||
|
app.use(Pinia.createPinia()) |
||||
|
app.use(uView) |
||||
|
// 解决onLaunch和onLoad异步问题
|
||||
|
app.config.globalProperties.$onLaunched = new Promise(resolve => { |
||||
|
app.config.globalProperties.$isResolve = resolve |
||||
|
}) |
||||
|
|
||||
|
// 页签操作
|
||||
|
app.config.globalProperties.$tab = tab |
||||
|
// 模态框对象
|
||||
|
app.config.globalProperties.$modal = modal |
||||
|
// 时间对象
|
||||
|
app.config.globalProperties.$time = time |
||||
|
|
||||
|
|
||||
|
|
||||
|
return { |
||||
|
app, |
||||
|
// uni-app 官方文档示例 https://zh.uniapp.dcloud.io/tutorial/vue3-pinia.html#%E7%8A%B6%E6%80%81%E7%AE%A1%E7%90%86-pinia
|
||||
|
Pinia // 此处必须将 Pinia 返回
|
||||
|
} |
||||
|
} |
@ -0,0 +1,82 @@ |
|||||
|
{ |
||||
|
"name" : "富维汽车镜", |
||||
|
"appid" : "__UNI__DA78BC9", |
||||
|
"description" : "", |
||||
|
"versionName" : "1.0.0", |
||||
|
"versionCode" : "100", |
||||
|
"transformPx" : false, |
||||
|
/* 5+App特有相关 */ |
||||
|
"app-plus" : { |
||||
|
"usingComponents" : true, |
||||
|
"nvueStyleCompiler" : "uni-app", |
||||
|
"compilerVersion" : 3, |
||||
|
"splashscreen" : { |
||||
|
"alwaysShowBeforeRender" : true, |
||||
|
"waiting" : true, |
||||
|
"autoclose" : true, |
||||
|
"delay" : 0 |
||||
|
}, |
||||
|
/* 模块配置 */ |
||||
|
"modules" : {}, |
||||
|
/* 应用发布信息 */ |
||||
|
"distribute" : { |
||||
|
/* android打包配置 */ |
||||
|
"android" : { |
||||
|
"permissions" : [ |
||||
|
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>", |
||||
|
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>", |
||||
|
"<uses-permission android:name=\"android.permission.VIBRATE\"/>", |
||||
|
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>", |
||||
|
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>", |
||||
|
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>", |
||||
|
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>", |
||||
|
"<uses-permission android:name=\"android.permission.CAMERA\"/>", |
||||
|
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>", |
||||
|
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>", |
||||
|
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>", |
||||
|
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>", |
||||
|
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>", |
||||
|
"<uses-feature android:name=\"android.hardware.camera\"/>", |
||||
|
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>" |
||||
|
] |
||||
|
}, |
||||
|
/* ios打包配置 */ |
||||
|
"ios" : { |
||||
|
"dSYMs" : false |
||||
|
}, |
||||
|
/* SDK配置 */ |
||||
|
"sdkConfigs" : { |
||||
|
"ad" : {} |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
/* 快应用特有相关 */ |
||||
|
"quickapp" : {}, |
||||
|
/* 小程序特有相关 */ |
||||
|
"mp-weixin" : { |
||||
|
"appid" : "wx6176535b0b0153f0", |
||||
|
"setting" : { |
||||
|
"urlCheck" : false |
||||
|
}, |
||||
|
"usingComponents" : true |
||||
|
}, |
||||
|
"mp-alipay" : { |
||||
|
"usingComponents" : true |
||||
|
}, |
||||
|
"mp-baidu" : { |
||||
|
"usingComponents" : true |
||||
|
}, |
||||
|
"mp-toutiao" : { |
||||
|
"usingComponents" : true |
||||
|
}, |
||||
|
"uniStatistics" : { |
||||
|
"enable" : false |
||||
|
}, |
||||
|
"vueVersion" : "3", |
||||
|
"h5" : { |
||||
|
"template" : "index.html", |
||||
|
"devServer" : { |
||||
|
"port" : 9020 |
||||
|
} |
||||
|
} |
||||
|
} |
File diff suppressed because it is too large
@ -0,0 +1,43 @@ |
|||||
|
<template> |
||||
|
<view> |
||||
|
<uni-card class="view-title" :title="title"> |
||||
|
<text class="uni-body view-content">{{ content }}</text> |
||||
|
</uni-card> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
data() { |
||||
|
return { |
||||
|
title: '', |
||||
|
content: '' |
||||
|
} |
||||
|
}, |
||||
|
onLoad(options) { |
||||
|
this.title = options.title |
||||
|
this.content = options.content |
||||
|
uni.setNavigationBarTitle({ |
||||
|
title: options.title |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped> |
||||
|
page { |
||||
|
background-color: #ffffff; |
||||
|
} |
||||
|
|
||||
|
.view-title { |
||||
|
font-weight: bold; |
||||
|
} |
||||
|
|
||||
|
.view-content { |
||||
|
font-size: 26rpx; |
||||
|
padding: 12px 5px 0; |
||||
|
color: #333; |
||||
|
line-height: 24px; |
||||
|
font-weight: normal; |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,34 @@ |
|||||
|
<template> |
||||
|
<view v-if="params.url"> |
||||
|
<web-view :webview-styles="webviewStyles" :src="`${params.url}`"></web-view> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
data() { |
||||
|
return { |
||||
|
params: {}, |
||||
|
webviewStyles: { |
||||
|
progress: { |
||||
|
color: "#FF3333" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
props: { |
||||
|
src: { |
||||
|
type: [String], |
||||
|
default: null |
||||
|
} |
||||
|
}, |
||||
|
onLoad(event) { |
||||
|
this.params = event |
||||
|
if (event.title) { |
||||
|
uni.setNavigationBarTitle({ |
||||
|
title: event.title |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
@ -0,0 +1,120 @@ |
|||||
|
<template> |
||||
|
<view class="page-wraper"> |
||||
|
<view class="page-main" style="background-color: #fff; height: 100%;"> |
||||
|
|
||||
|
<pullDown label="项目名称" v-model="name" :options="arrayUnique(options,'name')" description='column' /> |
||||
|
|
||||
|
<pullDown label="服务器地址" v-model="value" :options="unique(options)" :itemTextCount="2" :isAutoHeight='true' |
||||
|
description='column' style="font-size: 35rpx;padding: 30rpx 0 0 0;" /> |
||||
|
|
||||
|
</view> |
||||
|
<!-- 页面底部 --> |
||||
|
<view class="page-footer"> |
||||
|
<button type="primary" @click="saveClick">保存</button> |
||||
|
</view> |
||||
|
</view> |
||||
|
|
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
data() { |
||||
|
return { |
||||
|
name: '', |
||||
|
value: '', |
||||
|
|
||||
|
options: [{ |
||||
|
|
||||
|
name: '汽车镜备件', |
||||
|
desc: '汽车镜备件公司测试库', |
||||
|
value: 'http://192.168.0.178:12080/admin-api', |
||||
|
}, |
||||
|
{ |
||||
|
|
||||
|
name: '汽车镜备件', |
||||
|
desc: '汽车镜备件现场测试库', |
||||
|
value: 'http://192.168.0.178:12080/admin-api', |
||||
|
}, |
||||
|
{ |
||||
|
|
||||
|
name: '汽车镜备件', |
||||
|
desc: '汽车镜备件现场正式库', |
||||
|
value: 'http://192.168.0.178:12080/admin-api', |
||||
|
}, |
||||
|
{ |
||||
|
|
||||
|
name: '富维汽车镜', |
||||
|
desc: '汽车镜备件现场正式库', |
||||
|
value: 'http://192.168.0.178:12080/admin-api', |
||||
|
}, |
||||
|
], |
||||
|
}; |
||||
|
}, |
||||
|
|
||||
|
onLoad(option) { |
||||
|
this.value ="" |
||||
|
// this.value = getApp().globalData.request_url; |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
|
||||
|
methods: { |
||||
|
saveClick() { |
||||
|
// getApp().globalData.request_url = this.value; |
||||
|
// console.log(getApp().globalData.request_url); |
||||
|
// 调用uni.navigateBack()函数来返回上一页 |
||||
|
uni.navigateBack({ |
||||
|
delta: 1 // 表示返回到上一页,若需要返回多级页面则设置delta值为对应的级数 |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
unique(arr) { |
||||
|
let that = this; |
||||
|
if (this.name == '') { |
||||
|
return this.options |
||||
|
} else { |
||||
|
return arr.filter(item => item.name === this.name); |
||||
|
} |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
arrayUnique(arr, type) { |
||||
|
return arr ? [ |
||||
|
...new Set( |
||||
|
arr.map((item) => { |
||||
|
return item[type] |
||||
|
}) |
||||
|
) |
||||
|
] : [] |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
.page-wraper { |
||||
|
display: flex; |
||||
|
flex-direction: column; |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
} |
||||
|
|
||||
|
.page-main { |
||||
|
flex: 1; |
||||
|
position: relative; |
||||
|
} |
||||
|
|
||||
|
.page-footer { |
||||
|
color: #fff; |
||||
|
line-height: 100rpx; |
||||
|
/* 不放大不缩小固定100rpx */ |
||||
|
flex: 0 0 100rpx; |
||||
|
background-color: #00AAFF; |
||||
|
} |
||||
|
|
||||
|
.container { |
||||
|
background-color: #f5f7fa; |
||||
|
/* 这里只是作为样式展示 */ |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,180 @@ |
|||||
|
<template> |
||||
|
<view class="" style="background-color: #fff;"> |
||||
|
<uni-collapse ref="collapse1" @change=""> |
||||
|
<uni-collapse-item :open="true"> |
||||
|
<template v-slot:title> |
||||
|
<uni-swipe-action ref="swipeAction"> |
||||
|
<uni-swipe-action-item @click="removeData($event,dataContent)" :right-options="removeOptions"> |
||||
|
<item-qty :dataContent="dataContent" :handleQty="dataContent.handleQty" |
||||
|
:isShowBalance="true"></item-qty> |
||||
|
</uni-swipe-action-item> |
||||
|
</uni-swipe-action> |
||||
|
|
||||
|
</template> |
||||
|
<u-line /> |
||||
|
<view class="" v-for="(item,index) in dataContent.subList"> |
||||
|
<balance :dataContent="item" :isShowStdPack="false" :isShowPack="true" :isShowStatus="false" |
||||
|
:isShowBatch="true" :toInventoryStatus="item.toInventoryStatus" |
||||
|
:isShowLocation="isShowLocation"> |
||||
|
</balance> |
||||
|
</view> |
||||
|
|
||||
|
<!-- <view class="" v-for="(item,index) in dataContent.bindList"> |
||||
|
<uni-swipe-action ref="swipeAction"> |
||||
|
<uni-swipe-action-item @click="swipeClick($event,item,index)" |
||||
|
:right-options="item.scaned?scanOptions:detailOptions"> |
||||
|
<balance :dataContent="item" :isShowStdPack="false" :isShowPack="true" :isShowStatus="false" |
||||
|
:isShowBatch="true" :toInventoryStatus="item.toInventoryStatus" |
||||
|
:isShowLocation="isShowLocation"> |
||||
|
</balance> |
||||
|
</uni-swipe-action-item> |
||||
|
</uni-swipe-action> |
||||
|
</view> --> |
||||
|
</uni-collapse-item> |
||||
|
</uni-collapse> |
||||
|
<recommendQtyEdit ref="receiptEdit" :dataContent="editItem" :settingParam="settingParam" |
||||
|
:handleQty="editItem.qty" @confirm="confirm"> |
||||
|
</recommendQtyEdit> |
||||
|
<job-detail-popup ref="receiptHint" :dataContent="showItem"></job-detail-popup> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import itemQty from '@/mycomponents/item/itemQty.vue' |
||||
|
import recommend from '@/mycomponents/recommend/recommend.vue' |
||||
|
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue' |
||||
|
import balance from '@/mycomponents/balance/balance.vue' |
||||
|
import recommendQtyEdit from '@/mycomponents/qty/recommendQtyEdit.vue' |
||||
|
|
||||
|
import { |
||||
|
getDetailOption, |
||||
|
getDetailEditRemoveOption, |
||||
|
getClearOption |
||||
|
} from '@/common/array.js'; |
||||
|
export default { |
||||
|
components: { |
||||
|
itemQty, |
||||
|
recommend, |
||||
|
jobDetailPopup, |
||||
|
balance, |
||||
|
recommendQtyEdit, |
||||
|
}, |
||||
|
props: { |
||||
|
dataContent: { |
||||
|
type: Object, |
||||
|
default: {} |
||||
|
}, |
||||
|
settingParam: { |
||||
|
type: Object, |
||||
|
default: {} |
||||
|
}, |
||||
|
fromInventoryStatus: { |
||||
|
type: String, |
||||
|
default: "" |
||||
|
}, |
||||
|
toInventoryStatus: { |
||||
|
type: String, |
||||
|
default: "" |
||||
|
}, |
||||
|
isShowStatus: { |
||||
|
type: Boolean, |
||||
|
default: false |
||||
|
}, |
||||
|
isShowLocation: { |
||||
|
type: Boolean, |
||||
|
default: false |
||||
|
}, |
||||
|
isShowPatch: { |
||||
|
type: Boolean, |
||||
|
default: true |
||||
|
} |
||||
|
}, |
||||
|
watch: { |
||||
|
dataContent: { |
||||
|
handler(newName, oldName) { |
||||
|
if (this.dataContent.subList.length > 0) { |
||||
|
if (this.$refs.collapse1 != undefined) { |
||||
|
this.$nextTick(res => { |
||||
|
this.$refs.collapse1.resize() |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
}, |
||||
|
immediate: true, |
||||
|
deep: true |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
data() { |
||||
|
return { |
||||
|
option: [], |
||||
|
title: "推荐详情", |
||||
|
showItem: {}, |
||||
|
editItem: {}, |
||||
|
detailOptions: [], |
||||
|
scanOptions: [], |
||||
|
removeOptions: [], |
||||
|
dataList: [] |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
mounted() { |
||||
|
this.detailOptions = getDetailOption(); |
||||
|
this.scanOptions = getDetailEditRemoveOption(); |
||||
|
this.removeOptions = getClearOption(); |
||||
|
}, |
||||
|
|
||||
|
methods: { |
||||
|
removeData(e, dataContent) { |
||||
|
if (e.content.text == "清空") { |
||||
|
this.$refs.comMessage.showQuestionMessage("确定清空物料及箱码信息?", |
||||
|
res => { |
||||
|
if (res) { |
||||
|
this.$emit('removeItem') |
||||
|
// this.$emit('removeItem', this.dataContent) |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
}, |
||||
|
swipeClick(e, item, index) { |
||||
|
if (e.content.text == "详情") { |
||||
|
this.detail(item) |
||||
|
} else if (e.content.text == "编辑") { |
||||
|
this.edit(item) |
||||
|
} else if (e.content.text == "移除") { |
||||
|
this.remove(item, index) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
edit(item) { |
||||
|
this.editItem = item; |
||||
|
this.$refs.receiptEdit.openEditPopup(); |
||||
|
}, |
||||
|
|
||||
|
detail(item) { |
||||
|
|
||||
|
this.showItem = item; |
||||
|
this.$refs.receiptHint.openScanPopup() |
||||
|
}, |
||||
|
remove(item, index) { |
||||
|
this.$refs.comMessage.showQuestionMessage("确定移除扫描信息?", |
||||
|
res => { |
||||
|
if (res) { |
||||
|
item.scaned = false; |
||||
|
// this.dataContent.subList.splice(index, 1) |
||||
|
// this.$emit('removePack') |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
confirm(qty) { |
||||
|
this.editItem.qty = qty; |
||||
|
this.$emit('updateData') |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
</style> |
@ -0,0 +1,172 @@ |
|||||
|
<template> |
||||
|
<view class="" style="background-color: #fff;"> |
||||
|
<uni-collapse ref="collapse1" @change=""> |
||||
|
<uni-collapse-item :open="true"> |
||||
|
<template v-slot:title> |
||||
|
<uni-swipe-action ref="swipeAction"> |
||||
|
<uni-swipe-action-item @click="removeData($event,dataContent)" :right-options="removeOptions"> |
||||
|
<item-qty :dataContent="dataContent" |
||||
|
:isShowBalance="true"></item-qty> |
||||
|
</uni-swipe-action-item> |
||||
|
</uni-swipe-action> |
||||
|
|
||||
|
</template> |
||||
|
<u-line /> |
||||
|
<view class="" v-for="(item,index) in dataContent.subList"> |
||||
|
<uni-swipe-action ref="swipeAction"> |
||||
|
<uni-swipe-action-item @click="swipeClick($event,item,index)" |
||||
|
:right-options="item.scaned?scanOptions:detailOptions"> |
||||
|
<balance :dataContent="item" :isShowStdPack="false" :isShowPack="true" :isShowStatus="false" :isShowBatch="true" |
||||
|
:toInventoryStatus="item.toInventoryStatus" :isShowFromLocation="isShowLocation" > |
||||
|
</balance> |
||||
|
</uni-swipe-action-item> |
||||
|
</uni-swipe-action> |
||||
|
<!-- <u-line color="#D8D8D8"></u-line> --> |
||||
|
</view> |
||||
|
</uni-collapse-item> |
||||
|
</uni-collapse> |
||||
|
<recommendQtyEdit ref="receiptEdit" :dataContent="editItem" :settingParam="settingParam" |
||||
|
:handleQty="editItem.qty" @confirm="confirm"> |
||||
|
</recommendQtyEdit> |
||||
|
<job-detail-popup ref="receiptHint" :dataContent="showItem"></job-detail-popup> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import itemQty from '@/mycomponents/item/itemQty.vue' |
||||
|
import recommend from '@/mycomponents/recommend/recommend.vue' |
||||
|
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue' |
||||
|
import balance from '@/mycomponents/balance/balance.vue' |
||||
|
import recommendQtyEdit from '@/mycomponents/qty/recommendQtyEdit.vue' |
||||
|
|
||||
|
import { |
||||
|
getDetailOption, |
||||
|
getEditOption, |
||||
|
getClearOption |
||||
|
} from '@/common/array.js'; |
||||
|
export default { |
||||
|
components: { |
||||
|
itemQty, |
||||
|
recommend, |
||||
|
jobDetailPopup, |
||||
|
balance, |
||||
|
recommendQtyEdit, |
||||
|
}, |
||||
|
props: { |
||||
|
dataContent: { |
||||
|
type: Object, |
||||
|
default: {} |
||||
|
}, |
||||
|
settingParam: { |
||||
|
type: Object, |
||||
|
default: {} |
||||
|
}, |
||||
|
fromInventoryStatus: { |
||||
|
type: String, |
||||
|
default: "" |
||||
|
}, |
||||
|
toInventoryStatus: { |
||||
|
type: String, |
||||
|
default: "" |
||||
|
}, |
||||
|
isShowStatus: { |
||||
|
type: Boolean, |
||||
|
default: false |
||||
|
}, |
||||
|
isShowLocation: { |
||||
|
type: Boolean, |
||||
|
default: false |
||||
|
}, |
||||
|
isShowPatch: { |
||||
|
type: Boolean, |
||||
|
default: true |
||||
|
} |
||||
|
}, |
||||
|
watch: { |
||||
|
dataContent: { |
||||
|
handler(newName, oldName) { |
||||
|
if (this.dataContent.subList.length > 0) { |
||||
|
if (this.$refs.collapse1 != undefined) { |
||||
|
this.$nextTick(res => { |
||||
|
this.$refs.collapse1.resize() |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
immediate: true, |
||||
|
deep: true |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
data() { |
||||
|
return { |
||||
|
option: [], |
||||
|
title: "推荐详情", |
||||
|
showItem: {}, |
||||
|
editItem: {}, |
||||
|
detailOptions: [], |
||||
|
scanOptions: [], |
||||
|
removeOptions: [], |
||||
|
dataList: [] |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
mounted() { |
||||
|
this.detailOptions = getDetailOption(); |
||||
|
this.scanOptions = getEditOption(); |
||||
|
this.removeOptions = getClearOption(); |
||||
|
}, |
||||
|
|
||||
|
methods: { |
||||
|
removeData(e, dataContent) { |
||||
|
if (e.content.text == "清空") { |
||||
|
this.$refs.comMessage.showQuestionMessage("确定清空物料及箱码信息?", |
||||
|
res => { |
||||
|
if (res) { |
||||
|
this.$emit('removeItem') |
||||
|
// this.$emit('removeItem', this.dataContent) |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
}, |
||||
|
swipeClick(e, item, index) { |
||||
|
if (e.content.text == "详情") { |
||||
|
this.detail(item) |
||||
|
} else if (e.content.text == "编辑") { |
||||
|
this.edit(item) |
||||
|
} else if (e.content.text == "移除") { |
||||
|
this.remove(item, index) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
edit(item) { |
||||
|
this.editItem = item; |
||||
|
this.$refs.receiptEdit.openEditPopup(); |
||||
|
}, |
||||
|
|
||||
|
detail(item) { |
||||
|
|
||||
|
this.showItem = item; |
||||
|
this.$refs.receiptHint.openScanPopup() |
||||
|
}, |
||||
|
remove(item, index) { |
||||
|
this.$refs.comMessage.showQuestionMessage("确定移除扫描信息?", |
||||
|
res => { |
||||
|
if (res) { |
||||
|
item.scaned=false; |
||||
|
// this.dataContent.subList.splice(index, 1) |
||||
|
// this.$emit('removePack') |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
confirm(qty) { |
||||
|
this.editItem.qty = qty; |
||||
|
this.$emit('updateData') |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
</style> |
@ -0,0 +1,422 @@ |
|||||
|
<template> |
||||
|
<view class="page-wraper"> |
||||
|
<view class=""> |
||||
|
<com-blank-view @goScan='showContainerPopup' v-if="containerCode==''"></com-blank-view> |
||||
|
</view> |
||||
|
|
||||
|
<view class="page-wraper" v-if="containerCode!=''"> |
||||
|
<view class="" style="margin-left: 20rpx;"> |
||||
|
<targetContainer ref="targetContainer" title="托盘" :containerCode="containerCode" :isShowEdit="false" |
||||
|
@getContainer="getContainer"></targetContainer> |
||||
|
</view> |
||||
|
<u-line color="#D8D8D8"></u-line> |
||||
|
<view class="page-main"> |
||||
|
<scroll-view scroll-y="true" class="page-main-scroll"> |
||||
|
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> |
||||
|
<view class=""> |
||||
|
<!-- {{item.contentNumber}} --> |
||||
|
<comPalletRecord :dataContent="item" :index="index" :isShowPatch="false" |
||||
|
@removeItem="removeItem(index,item)" @updateData="updateData" @removePack="removePack"> |
||||
|
</comPalletRecord> |
||||
|
|
||||
|
</view> |
||||
|
</view> |
||||
|
</scroll-view> |
||||
|
</view> |
||||
|
|
||||
|
<view class="page-footer"> |
||||
|
<view class="uni-flex u-col-center space-between padding_10" |
||||
|
style="background-color:ghostwhite; width: 100%; "> |
||||
|
<view class=""> |
||||
|
</view> |
||||
|
<view class=" uni-flex uni-row"> |
||||
|
<button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
<win-scan-button @goScan='openScanPopup'></win-scan-button> |
||||
|
</view> |
||||
|
<win-scan-container ref="scanContainer" title="器具" @getContainer='getContainer'></win-scan-container> |
||||
|
<win-scan-location ref="scanLocationPopup" title="来源库位" @getLocation="getFromLocation"></win-scan-location> |
||||
|
<win-scan-pack-and-location ref="scanPopup" @getResult='getScanResult' :allowModifyLocation="false"> |
||||
|
</win-scan-pack-and-location> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { |
||||
|
containerBindRecordSubmit, |
||||
|
getContainerDetailByNumber |
||||
|
} from '@/api/request2.js'; |
||||
|
import { |
||||
|
goHome |
||||
|
} from '@/common/basic.js'; |
||||
|
|
||||
|
import { |
||||
|
getDirectoryItemArray |
||||
|
} from '@/common/directory.js'; |
||||
|
|
||||
|
import { |
||||
|
calc |
||||
|
} from '@/common/calc.js'; |
||||
|
|
||||
|
import { |
||||
|
getBusinessType, |
||||
|
createItemInfo, |
||||
|
createDetailInfo, |
||||
|
calcHandleQty |
||||
|
} from '@/common/record.js'; |
||||
|
|
||||
|
import { |
||||
|
getScanCount |
||||
|
} from '@/common/detail.js'; |
||||
|
|
||||
|
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
||||
|
import winScanPack from '@/mycomponents/scan/winScanPack.vue' |
||||
|
import comBlankView from '@/mycomponents/common/comBlankView.vue' |
||||
|
import targetContainer from "@/mycomponents/container/targetContainer.vue" |
||||
|
import winScanContainer from "@/mycomponents/scan/winScanContainer.vue" |
||||
|
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' |
||||
|
import comPalletRecord from '@/pages/container/coms/comPalletRecord.vue' |
||||
|
import winScanPackAndLocation from '@/mycomponents/scan/winScanPackAndLocation.vue' |
||||
|
import winScanLocation from '@/mycomponents/scan/winScanLocation.vue' |
||||
|
export default { |
||||
|
components: { |
||||
|
winScanButton, |
||||
|
winScanPack, |
||||
|
comBlankView, |
||||
|
targetContainer, |
||||
|
recordComDetailCard, |
||||
|
winScanContainer, |
||||
|
comPalletRecord, |
||||
|
winScanPackAndLocation, |
||||
|
winScanLocation |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
id: '', |
||||
|
scanCount: 0, |
||||
|
detailSource: [], //绑定在页面上的数据源 |
||||
|
locationTypeList: [], |
||||
|
toLocationInfo: {}, |
||||
|
fromLocationInfo: {}, |
||||
|
toLocationInfo: {}, |
||||
|
containerCode: "", |
||||
|
containerInfo: {}, |
||||
|
fromlocationTypeList: [], |
||||
|
tolocationTypeList: [], |
||||
|
allowModifyLocation: false, |
||||
|
inInventoryStatus: "", //目标入库库存状态 |
||||
|
outInventoryStatus: "", //来源出库库存状态 |
||||
|
businessType: {} |
||||
|
}; |
||||
|
}, |
||||
|
onLoad(option) { |
||||
|
|
||||
|
}, |
||||
|
//返回首页 |
||||
|
onNavigationBarButtonTap(e) { |
||||
|
if (e.index === 0) { |
||||
|
goHome(); |
||||
|
} |
||||
|
}, |
||||
|
//拦截返回按钮事件 |
||||
|
onBackPress(e) {}, |
||||
|
|
||||
|
onPullDownRefresh() {}, |
||||
|
|
||||
|
mounted() { |
||||
|
getBusinessType('ContainerBind', res => { |
||||
|
if (res.success) { |
||||
|
this.businessType = res.businessType; |
||||
|
this.fromlocationTypeList = res.fromlocationTypeList; |
||||
|
this.tolocationTypeList = res.tolocationTypeList; |
||||
|
this.showContainerPopup(); |
||||
|
} else { |
||||
|
this.showErrorMessage(res.message) |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
methods: { |
||||
|
getContainer(containerInfo) { |
||||
|
this.containerInfo = containerInfo; |
||||
|
this.containerCode = containerInfo.number; |
||||
|
getContainerDetailByNumber(this.containerCode).then(res => { |
||||
|
if (res.data != null && res.data.subList.length > 0) { |
||||
|
this.detailSource = this.getDataSource(res.data.subList) |
||||
|
} |
||||
|
this.showScanLocation(); |
||||
|
}).catch(error => { |
||||
|
this.showErrorMessage(error.message) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
showScanLocation() { |
||||
|
this.$nextTick(r => { |
||||
|
this.$refs.scanLocationPopup.openScanPopup(); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
getFromLocation(location, code) { |
||||
|
this.fromLocationInfo = location; |
||||
|
this.openScanPopup(); |
||||
|
}, |
||||
|
|
||||
|
getScanResult(result) { |
||||
|
try { |
||||
|
var packingNumber = result.label.packingNumber; |
||||
|
var batch = result.label.batch; |
||||
|
var qty = result.label.qty; |
||||
|
var itemCode = result.label.itemCode; |
||||
|
|
||||
|
var item = this.detailSource.find(r => r.itemCode == itemCode); |
||||
|
if (item == undefined) { |
||||
|
if (this.detailSource.length == 0) { |
||||
|
item = this.createItemInfo(result.label); |
||||
|
let itemDetail = result.balance; |
||||
|
itemDetail.scaned = true; |
||||
|
item.subList.push(itemDetail); |
||||
|
this.detailSource.push(item); |
||||
|
} else { |
||||
|
this.showMessage("绑定物料【" + itemCode + "】与现有物料不一致,不可以绑定"); |
||||
|
} |
||||
|
} else { |
||||
|
var itemDetail = item.subList.find(r => r.packingNumber == packingNumber && r.batch == batch); |
||||
|
if (itemDetail == undefined) { |
||||
|
itemDetail = result.balance; |
||||
|
itemDetail.scaned = true; |
||||
|
item.subList.push(itemDetail); |
||||
|
} else { |
||||
|
if (itemDetail.scaned) { |
||||
|
this.showMessage("箱码【" + packingNumber + "】,批次【" + batch + "】已经扫描") |
||||
|
} else { |
||||
|
this.showMessage("箱码【" + packingNumber + "】,批次【" + batch + "】已经绑定到器具") |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} catch (e) { |
||||
|
this.showErrorMessage(e.message) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
createRecordInfo(detail, label) { |
||||
|
var record = {} |
||||
|
detail.scaned = true; |
||||
|
// let record = JSON.parse(JSON.stringify(detail)); |
||||
|
//克隆对象,深度克隆,防止双向绑定同一个变量 |
||||
|
Object.assign(record, detail) |
||||
|
record.qty = Number(label.qty); |
||||
|
return record; |
||||
|
}, |
||||
|
|
||||
|
calcHandleQty() { |
||||
|
calcHandleQty(this.detailSource); |
||||
|
this.scanPopupGetFocus(); |
||||
|
this.$forceUpdate(); |
||||
|
}, |
||||
|
|
||||
|
getDataSource(subList) { |
||||
|
let items = []; |
||||
|
subList.forEach(detail => { |
||||
|
var item = items.find(r => |
||||
|
r.itemCode == detail.itemCode) |
||||
|
if (item == undefined) { |
||||
|
item = this.createItemInfo(detail); |
||||
|
let newDetail = this.createDetailInfo(detail); // |
||||
|
item.subList.push(newDetail); |
||||
|
items.push(item) |
||||
|
} else { |
||||
|
item.qty = calc.add(item.qty,detail.qty) |
||||
|
let newDetail = this.createDetailInfo(detail); // |
||||
|
item.subList.push(newDetail); |
||||
|
} |
||||
|
}) |
||||
|
return items; |
||||
|
}, |
||||
|
|
||||
|
updateData() { |
||||
|
this.calcHandleQty(); |
||||
|
}, |
||||
|
|
||||
|
removeItem(index, item) { |
||||
|
this.detailSource.splice(index, 1) |
||||
|
}, |
||||
|
|
||||
|
createItemInfo(res) { |
||||
|
let item = { |
||||
|
itemCode: res.itemCode, |
||||
|
itemName: res.itemName, |
||||
|
stdPackQty: res.stdPackQty, |
||||
|
stdPackUnit: res.stdPackUnit, |
||||
|
qty: res.qty, |
||||
|
handleQty: 0, |
||||
|
uom: res.uom, |
||||
|
subList: [] |
||||
|
} |
||||
|
return item; |
||||
|
}, |
||||
|
|
||||
|
createDetailInfo(data) { |
||||
|
data.scaned = false; |
||||
|
data.packingNumber = data.contentNumber |
||||
|
data.qty = Number(data.qty) |
||||
|
data.handleQty = 0; |
||||
|
let detail = data; |
||||
|
return detail; |
||||
|
}, |
||||
|
|
||||
|
removePack() { |
||||
|
for (var i = 0; i < this.detailSource.length; i++) { |
||||
|
var item = this.detailSource[i]; |
||||
|
if (item.subList.length == 0) { |
||||
|
this.detailSource.splice(i, 1) |
||||
|
} |
||||
|
} |
||||
|
this.updateData(); |
||||
|
}, |
||||
|
|
||||
|
openScanPopup() { |
||||
|
if (this.fromLocationInfo.code != undefined) { |
||||
|
this.$refs.scanPopup.openScanPopupForType(this.fromLocationInfo.code, this.businessType); |
||||
|
} else { |
||||
|
this.showScanLocation(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
showContainerPopup() { |
||||
|
this.$nextTick(() => { |
||||
|
this.$refs.scanContainer.openScanPopup(); |
||||
|
}) |
||||
|
|
||||
|
}, |
||||
|
closeScanPopup() { |
||||
|
this.$refs.scanPopup.closeScanPopup(); |
||||
|
}, |
||||
|
|
||||
|
scanPopupGetFocus() { |
||||
|
if (this.$refs.scanPopup != undefined) { |
||||
|
this.$refs.scanPopup.packGetFocus(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
scanPopupLoseFocus() { |
||||
|
if (this.$refs.scanPopup != undefined) { |
||||
|
this.$refs.scanPopup.packLoseFocus(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
commit() { |
||||
|
uni.showLoading({ |
||||
|
title: '提交中...', |
||||
|
mask: true |
||||
|
}) |
||||
|
|
||||
|
this.scanCount = getScanCount(this.detailSource[0].subList); |
||||
|
if (this.scanCount == 0) { |
||||
|
this.showErrorMessage("扫描数为0,请先扫描要解绑的箱码") |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
let params = this.getParams(); |
||||
|
console.log("提交" + JSON.stringify(params)) |
||||
|
|
||||
|
containerBindRecordSubmit(params).then(res => { |
||||
|
uni.hideLoading() |
||||
|
if (res.data) { |
||||
|
this.showCommitSuccessMessage("提交成功<br>生成器具绑定记录<br>" + res.data) |
||||
|
this.clear(); |
||||
|
} else { |
||||
|
this.showErrorMessage("提交失败[" + res.msg + "]") |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
uni.hideLoading() |
||||
|
this.showErrorMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
getParams() { |
||||
|
var subList = [] |
||||
|
var creator = this.$store.state.user.id |
||||
|
let params = { |
||||
|
number: this.containerCode, |
||||
|
status: 'USED', |
||||
|
toLocationCode: this.fromLocationInfo.code, |
||||
|
containerType: this.containerInfo.type, |
||||
|
creator: creator |
||||
|
}; |
||||
|
|
||||
|
this.detailSource.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
if (detail.scaned) { |
||||
|
detail.containerContentType = 'PACKAGE'; |
||||
|
detail.contentNumber = detail.packingNumber; |
||||
|
detail.package = null; |
||||
|
subList.push(detail) |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
params.subList = subList |
||||
|
return params; |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
showMessage(message) { |
||||
|
setTimeout(r => { |
||||
|
this.scanPopupLoseFocus(); |
||||
|
this.$refs.comMessage.showMessage(message, res => { |
||||
|
if (res) { |
||||
|
this.scanPopupGetFocus(); |
||||
|
} |
||||
|
}); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
showErrorMessage(message) { |
||||
|
setTimeout(r => { |
||||
|
this.scanPopupLoseFocus(); |
||||
|
this.$refs.comMessage.showErrorMessage(message, res => { |
||||
|
if (res) { |
||||
|
this.scanPopupGetFocus(); |
||||
|
} |
||||
|
}); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
showScanMessage(message) { |
||||
|
this.$refs.comMessage.showScanMessage(message); |
||||
|
}, |
||||
|
|
||||
|
afterCloseMessage() { |
||||
|
this.scanPopupGetFocus(); |
||||
|
}, |
||||
|
|
||||
|
closeScanMessage() { |
||||
|
this.scanPopupGetFocus(); |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
showCommitSuccessMessage(hint) { |
||||
|
this.$refs.comMessage.showSuccessMessage(hint, res => { |
||||
|
this.containerCode = ''; |
||||
|
|
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
updateData() { |
||||
|
this.calcHandleQty(); |
||||
|
for (var i = 0; i < this.detailSource.length; i++) { |
||||
|
let item = this.detailSource[i]; |
||||
|
if (item.qty == 0) { |
||||
|
this.detailSource.splice(i, 1) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="scss"> |
||||
|
|
||||
|
</style> |
@ -0,0 +1,384 @@ |
|||||
|
<template> |
||||
|
<view class="page-wraper"> |
||||
|
<view class=""> |
||||
|
<com-blank-view @goScan='showContainerPopup' v-if="containerCode==''"></com-blank-view> |
||||
|
</view> |
||||
|
|
||||
|
<view class="page-wraper" v-if="containerCode!=''"> |
||||
|
<view class="" style="margin-left: 20rpx;"> |
||||
|
<targetContainer ref="targetContainer" title="托盘" :containerCode="containerCode" :isShowEdit="false" |
||||
|
@getContainer="getContainer"></targetContainer> |
||||
|
</view> |
||||
|
<u-line color="#D8D8D8"></u-line> |
||||
|
<view class="page-main"> |
||||
|
<scroll-view scroll-y="true" class="page-main-scroll"> |
||||
|
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> |
||||
|
<view class=""> |
||||
|
<!-- {{item.contentNumber}} --> |
||||
|
<comPalletRecord :dataContent="item" :index="index" |
||||
|
:isShowPatch="false" @removeItem="removeItem(index,item)" @updateData="updateData" |
||||
|
@removePack="removePack"> |
||||
|
</comPalletRecord> |
||||
|
|
||||
|
</view> |
||||
|
</view> |
||||
|
</scroll-view> |
||||
|
</view> |
||||
|
|
||||
|
<view class="page-footer"> |
||||
|
<view class="uni-flex u-col-center space-between padding_10" |
||||
|
style="background-color:ghostwhite; width: 100%; "> |
||||
|
<view class=""> |
||||
|
</view> |
||||
|
<view class=" uni-flex uni-row"> |
||||
|
<button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
<win-scan-button @goScan='openScanPopup'></win-scan-button> |
||||
|
</view> |
||||
|
<win-scan-pack ref="scanPopup" @getResult='getScanResult'></win-scan-pack> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
<winScanContainer ref="scanContainer" title="托盘" @getContainer='getContainer'></winScanContainer> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { |
||||
|
containerUnBindRecordSubmit, |
||||
|
getContainerDetailByNumber |
||||
|
} from '@/api/request2.js'; |
||||
|
import { |
||||
|
goHome |
||||
|
} from '@/common/basic.js'; |
||||
|
|
||||
|
import { |
||||
|
calc |
||||
|
} from '@/common/calc.js'; |
||||
|
|
||||
|
import { |
||||
|
getDirectoryItemArray |
||||
|
} from '@/common/directory.js'; |
||||
|
|
||||
|
import { |
||||
|
getBusinessType, |
||||
|
createItemInfo, |
||||
|
createDetailInfo, |
||||
|
calcHandleQty |
||||
|
} from '@/common/record.js'; |
||||
|
|
||||
|
import { |
||||
|
getScanCount |
||||
|
} from '@/common/detail.js'; |
||||
|
|
||||
|
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
||||
|
import winScanPack from '@/mycomponents/scan/winScanPack.vue' |
||||
|
import comBlankView from '@/mycomponents/common/comBlankView.vue' |
||||
|
import targetContainer from "@/mycomponents/container/targetContainer.vue" |
||||
|
import winScanContainer from "@/mycomponents/scan/winScanContainer.vue" |
||||
|
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' |
||||
|
import comPalletRecord from '@/pages/container/coms/comPalletRecord.vue' |
||||
|
|
||||
|
export default { |
||||
|
components: { |
||||
|
winScanButton, |
||||
|
winScanPack, |
||||
|
comBlankView, |
||||
|
targetContainer, |
||||
|
recordComDetailCard, |
||||
|
winScanContainer, |
||||
|
comPalletRecord |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
id: '', |
||||
|
scanCount: 0, |
||||
|
detailSource: [], //绑定在页面上的数据源 |
||||
|
businessTypeInfo: {}, |
||||
|
fromLocationInfo: {}, |
||||
|
containerCode: "", |
||||
|
}; |
||||
|
}, |
||||
|
onLoad(option) { |
||||
|
|
||||
|
}, |
||||
|
//返回首页 |
||||
|
onNavigationBarButtonTap(e) { |
||||
|
if (e.index === 0) { |
||||
|
goHome(); |
||||
|
} |
||||
|
}, |
||||
|
//拦截返回按钮事件 |
||||
|
onBackPress(e) {}, |
||||
|
|
||||
|
onPullDownRefresh() {}, |
||||
|
|
||||
|
mounted() { |
||||
|
this.showContainerPopup(); |
||||
|
}, |
||||
|
methods: { |
||||
|
getScanResult(result) { |
||||
|
try { |
||||
|
var packingNumber = result.label.packingNumber; |
||||
|
var batch = result.label.batch; |
||||
|
var qty = result.label.qty; |
||||
|
var itemCode = result.label.itemCode; |
||||
|
var detail = this.detailSource.find(r => r.itemCode == itemCode); |
||||
|
if (detail == undefined) { |
||||
|
this.showMessage("物料号【" + itemCode + "】不在列表中") |
||||
|
} else { |
||||
|
var itemDetail = detail.subList.find(r => r.packingNumber == packingNumber && r.batch == batch); |
||||
|
if (itemDetail == undefined) { |
||||
|
this.showMessage("箱码【" + packingNumber + "】,批次【" + batch + "】不在列表中") |
||||
|
} else { |
||||
|
if (itemDetail.scaned) { |
||||
|
this.showMessage("箱码【" + packingNumber + "】,批次【" + batch + "】已经扫描") |
||||
|
} else { |
||||
|
itemDetail.scaned = true; |
||||
|
itemDetail.record = this.createRecordInfo(itemDetail, result.label); |
||||
|
// this.calcHandleQty(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} catch (e) { |
||||
|
this.showErrorMessage(e.message) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
createRecordInfo(detail, label) { |
||||
|
var record = {} |
||||
|
detail.scaned = true; |
||||
|
// let record = JSON.parse(JSON.stringify(detail)); |
||||
|
//克隆对象,深度克隆,防止双向绑定同一个变量 |
||||
|
Object.assign(record, detail) |
||||
|
record.qty = Number(label.qty); |
||||
|
return record; |
||||
|
}, |
||||
|
|
||||
|
calcHandleQty() { |
||||
|
calcHandleQty(this.detailSource); |
||||
|
this.scanPopupGetFocus(); |
||||
|
this.$forceUpdate(); |
||||
|
}, |
||||
|
|
||||
|
getDataSource(subList) { |
||||
|
let items = []; |
||||
|
subList.forEach(detail => { |
||||
|
var item = items.find(r => |
||||
|
r.itemCode == detail.itemCode) |
||||
|
if (item == undefined) { |
||||
|
item = this.createItemInfo(detail); |
||||
|
let newDetail = this.createDetailInfo(detail); // |
||||
|
item.subList.push(newDetail); |
||||
|
items.push(item) |
||||
|
} else { |
||||
|
item.qty = calc.add(item.qty,detail.qty) |
||||
|
let newDetail = this.createDetailInfo(detail); // |
||||
|
item.subList.push(newDetail); |
||||
|
} |
||||
|
}) |
||||
|
return items; |
||||
|
}, |
||||
|
|
||||
|
updateData() { |
||||
|
this.calcHandleQty(); |
||||
|
}, |
||||
|
|
||||
|
removeItem(index, item) { |
||||
|
this.detailSource.splice(index, 1) |
||||
|
}, |
||||
|
|
||||
|
createItemInfo(res) { |
||||
|
let item = { |
||||
|
itemCode: res.itemCode, |
||||
|
itemName: res.itemName, |
||||
|
stdPackQty: res.stdPackQty, |
||||
|
stdPackUnit: res.stdPackUnit, |
||||
|
qty: res.qty, |
||||
|
handleQty: 0, |
||||
|
uom: res.uom, |
||||
|
subList: [] |
||||
|
} |
||||
|
return item; |
||||
|
}, |
||||
|
|
||||
|
createDetailInfo(data) { |
||||
|
data.scaned = false; |
||||
|
data.packingNumber = data.contentNumber |
||||
|
data.qty = Number(data.qty) |
||||
|
data.handleQty =0; |
||||
|
let detail = data; |
||||
|
return detail; |
||||
|
}, |
||||
|
|
||||
|
removePack() { |
||||
|
for (var i = 0; i < this.detailSource.length; i++) { |
||||
|
var item = this.detailSource[i]; |
||||
|
if (item.subList.length == 0) { |
||||
|
this.detailSource.splice(i, 1) |
||||
|
} |
||||
|
} |
||||
|
this.updateData(); |
||||
|
}, |
||||
|
|
||||
|
openScanPopup() { |
||||
|
if (this.containerCode == "") { |
||||
|
this.showContainerPopup(); |
||||
|
return |
||||
|
} |
||||
|
this.$refs.scanPopup.openScanPopup(); |
||||
|
}, |
||||
|
showContainerPopup() { |
||||
|
this.$nextTick(() => { |
||||
|
this.$refs.scanContainer.openScanPopup(); |
||||
|
}) |
||||
|
|
||||
|
}, |
||||
|
closeScanPopup() { |
||||
|
this.$refs.scanPopup.closeScanPopup(); |
||||
|
}, |
||||
|
|
||||
|
scanPopupGetFocus() { |
||||
|
if (this.$refs.scanPopup != undefined) { |
||||
|
this.$refs.scanPopup.getfocus(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
scanPopupLoseFocus() { |
||||
|
if (this.$refs.scanPopup != undefined) { |
||||
|
this.$refs.scanPopup.losefocus(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
commit() { |
||||
|
uni.showLoading({ |
||||
|
title: '提交中...', |
||||
|
mask: true |
||||
|
}) |
||||
|
|
||||
|
this.scanCount = getScanCount(this.detailSource[0].subList); |
||||
|
if (this.scanCount == 0) { |
||||
|
this.showErrorMessage("扫描数为0,请先扫描要解绑的箱码") |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
let params = this.getParams(); |
||||
|
console.log("提交" + JSON.stringify(params)) |
||||
|
|
||||
|
containerUnBindRecordSubmit(params).then(res => { |
||||
|
uni.hideLoading() |
||||
|
if (res.data) { |
||||
|
this.showCommitSuccessMessage("提交成功<br>生成器具绑定记录<br>" + res.data) |
||||
|
this.clear(); |
||||
|
} else { |
||||
|
this.showErrorMessage("提交失败[" + res.msg + "]") |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
uni.hideLoading() |
||||
|
this.showErrorMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
getParams() { |
||||
|
var subList = [] |
||||
|
var creator = this.$store.state.user.id |
||||
|
let params = { |
||||
|
number: this.containerCode, |
||||
|
type: 'bind', |
||||
|
status: 'USED', |
||||
|
creator: creator |
||||
|
}; |
||||
|
|
||||
|
this.detailSource.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
if (detail.scaned) { |
||||
|
detail.containerContentType = 'PACKAGE'; |
||||
|
detail.contentNumber = detail.packingNumber; |
||||
|
|
||||
|
detail.itemCode = detail.itemCode; |
||||
|
detail.batch = detail.batch; |
||||
|
detail.inventoryStatus = detail.inventoryStatus; |
||||
|
detail.qty =detail.handleQty; |
||||
|
detail.package = null; |
||||
|
subList.push(detail) |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
params.subList = subList |
||||
|
return params; |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
showMessage(message) { |
||||
|
setTimeout(r => { |
||||
|
this.scanPopupLoseFocus(); |
||||
|
this.$refs.comMessage.showMessage(message, res => { |
||||
|
if (res) { |
||||
|
this.scanPopupGetFocus(); |
||||
|
} |
||||
|
}); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
showErrorMessage(message) { |
||||
|
setTimeout(r => { |
||||
|
this.scanPopupLoseFocus(); |
||||
|
this.$refs.comMessage.showErrorMessage(message, res => { |
||||
|
if (res) { |
||||
|
this.scanPopupGetFocus(); |
||||
|
} |
||||
|
}); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
showScanMessage(message) { |
||||
|
this.$refs.comMessage.showScanMessage(message); |
||||
|
}, |
||||
|
|
||||
|
afterCloseMessage() { |
||||
|
this.scanPopupGetFocus(); |
||||
|
}, |
||||
|
|
||||
|
closeScanMessage() { |
||||
|
this.scanPopupGetFocus(); |
||||
|
}, |
||||
|
|
||||
|
getContainer(containerInfo) { |
||||
|
this.containerCode = containerInfo.number; |
||||
|
getContainerDetailByNumber(this.containerCode).then(res => { |
||||
|
if (res.data != null && res.data.subList.length > 0) { |
||||
|
this.detailSource = this.getDataSource(res.data.subList) |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
this.showErrorMessage(error.message) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
showCommitSuccessMessage(hint) { |
||||
|
this.$refs.comMessage.showSuccessMessage(hint, res => { |
||||
|
this.containerCode = ''; |
||||
|
|
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
updateData() { |
||||
|
this.calcHandleQty(); |
||||
|
for (var i = 0; i < this.detailSource.length; i++) { |
||||
|
let item = this.detailSource[i]; |
||||
|
if (item.qty == 0) { |
||||
|
this.detailSource.splice(i, 1) |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
clear() |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="scss"> |
||||
|
|
||||
|
</style> |
@ -0,0 +1,158 @@ |
|||||
|
<template> |
||||
|
<view class="" style="background-color: #fff;"> |
||||
|
<uni-collapse ref="collapse1" @change=""> |
||||
|
<uni-collapse-item :open="true"> |
||||
|
<template v-slot:title> |
||||
|
<uni-swipe-action ref="swipeAction"> |
||||
|
<uni-swipe-action-item @click="removeData($event,dataContent)" :right-options="removeOptions"> |
||||
|
<item-qty v-if="settingParam.isOpenCount=='TRUE'" :dataContent="dataContent" |
||||
|
:handleQty="dataContent.handleQty" :isShowBalanceQty="false"> |
||||
|
</item-qty> |
||||
|
<item-qty v-else :dataContent="dataContent" :handleQty="dataContent.handleQty" |
||||
|
:isShowBalanceQty="true" :showRecommendQty="false" :showStdPack="true"> |
||||
|
</item-qty> |
||||
|
</uni-swipe-action-item> |
||||
|
</uni-swipe-action> |
||||
|
</template> |
||||
|
<view class="" v-for="(item,index) in dataContent.subList"> |
||||
|
<uni-swipe-action ref="swipeAction"> |
||||
|
<uni-swipe-action-item @click="swipeClick($event,item)" |
||||
|
:right-options="item.scaned?scanOptions:detailOptions"> |
||||
|
<recommend-count :detail="item" :isShowFromLocation="false" style='margin:1px 0px;' |
||||
|
:isShowRecommendQty="settingParam.isOpenCount=='TRUE'"> |
||||
|
</recommend-count> |
||||
|
<u-line /> |
||||
|
</uni-swipe-action-item> |
||||
|
</uni-swipe-action> |
||||
|
</view> |
||||
|
</uni-collapse-item> |
||||
|
</uni-collapse> |
||||
|
<detail-info-popup ref="detailInfoPopup"></detail-info-popup> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import itemQty from '@/mycomponents/item/itemQty.vue' |
||||
|
import item from '@/mycomponents/item/item.vue' |
||||
|
import recommendCount from '@/mycomponents/recommend/recommendCount.vue' |
||||
|
import detailInfoPopup from '@/pages/count/coms/detailInfoPopup.vue' |
||||
|
|
||||
|
import { |
||||
|
getDetailOption, |
||||
|
getDetailEditRemoveOption, |
||||
|
getClearOption |
||||
|
} from '@/common/array.js'; |
||||
|
|
||||
|
export default { |
||||
|
components: { |
||||
|
item, |
||||
|
itemQty, |
||||
|
recommendCount, |
||||
|
detailInfoPopup, |
||||
|
}, |
||||
|
props: { |
||||
|
dataContent: { |
||||
|
type: Object, |
||||
|
default: {} |
||||
|
}, |
||||
|
settingParam: { |
||||
|
type: Object, |
||||
|
default: {} |
||||
|
}, |
||||
|
}, |
||||
|
watch: { |
||||
|
dataContent: { |
||||
|
handler(newName, oldName) { |
||||
|
if (this.dataContent.subList.length > 0) { |
||||
|
if (this.$refs.collapse1 != undefined) { |
||||
|
this.$nextTick(res => { |
||||
|
this.$refs.collapse1.resize() |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
immediate: true, |
||||
|
deep: true |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
data() { |
||||
|
return { |
||||
|
option: [], |
||||
|
title: "推荐详情", |
||||
|
showItem: {}, |
||||
|
editItem: { |
||||
|
record: { |
||||
|
|
||||
|
} |
||||
|
}, |
||||
|
detailOptions: [], |
||||
|
scanOptions: [], |
||||
|
removeOptions: [], |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
mounted() { |
||||
|
this.detailOptions = getDetailOption(); |
||||
|
this.scanOptions = getDetailEditRemoveOption(); |
||||
|
this.removeOptions = getClearOption(); |
||||
|
}, |
||||
|
|
||||
|
methods: { |
||||
|
removeData(e, dataContent) { |
||||
|
if (e.content.text == "清空") { |
||||
|
this.$refs.comMessage.showQuestionMessage("确定清空该物料下面扫描的信息吗?", |
||||
|
res => { |
||||
|
if (res) { |
||||
|
dataContent.handleQty = 0; |
||||
|
dataContent.subList.forEach(res=>{ |
||||
|
res.scaned = false; |
||||
|
res.handleQty= 0 |
||||
|
}) |
||||
|
|
||||
|
this.$emit('clear') |
||||
|
// this.$emit('removeItem', this.dataContent) |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
}, |
||||
|
swipeClick(e, item) { |
||||
|
if (e.content.text == "详情") { |
||||
|
this.detail(item) |
||||
|
} else if (e.content.text == "编辑") { |
||||
|
this.edit(item) |
||||
|
} else if (e.content.text == "移除") { |
||||
|
this.remove(item) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
edit(detail) { |
||||
|
this.$emit("editItem", detail) |
||||
|
}, |
||||
|
|
||||
|
detail(item) { |
||||
|
this.showItem = item; |
||||
|
this.$refs.detailInfoPopup.openPopup(item); |
||||
|
}, |
||||
|
remove(item, index) { |
||||
|
this.$refs.comMessage.showQuestionMessage("确定移除扫描信息?", |
||||
|
res => { |
||||
|
if (res) { |
||||
|
// this.dataContent.subList.splice(index, 1) |
||||
|
item.scaned = false; |
||||
|
item.handleQty = 0; |
||||
|
this.$emit('removePack') |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
confirm(qty) { |
||||
|
this.$emit('updateData') |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
</style> |
@ -0,0 +1,63 @@ |
|||||
|
<template> |
||||
|
<job-com-main-card :dataContent="dataContent"> |
||||
|
<view class="task_item"> |
||||
|
<view class="task_text"> |
||||
|
<view class=""> |
||||
|
申请单号 : {{dataContent.requestNumber}} |
||||
|
</view> |
||||
|
</view> |
||||
|
|
||||
|
<view class="task_text"> |
||||
|
<view class=""> |
||||
|
盘点阶段 : {{getCountStageName(dataContent.stage)}} |
||||
|
</view> |
||||
|
</view> |
||||
|
|
||||
|
<view class="task_text"> |
||||
|
<view class=""> |
||||
|
盘点库位 : {{dataContent.locationCode}} |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class="task_text"> |
||||
|
<view class=""> |
||||
|
盘点策略 : {{isOpenCount(dataContent.isOpenCount)}} |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</job-com-main-card> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { |
||||
|
getCountStageName |
||||
|
} from '@/common/directory.js'; |
||||
|
import jobComMainCard from '@/mycomponents/job/jobComMainCard.vue' |
||||
|
export default { |
||||
|
components: { |
||||
|
jobComMainCard, |
||||
|
}, |
||||
|
data() { |
||||
|
return {}; |
||||
|
}, |
||||
|
|
||||
|
props: { |
||||
|
dataContent: { |
||||
|
type: Object, |
||||
|
default: {} |
||||
|
}, |
||||
|
}, |
||||
|
|
||||
|
methods: { |
||||
|
getCountStageName(value){ |
||||
|
return getCountStageName(value) |
||||
|
}, |
||||
|
isOpenCount(value){ |
||||
|
return value=="TRUE"?"明盘":"盲盘" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss"> |
||||
|
|
||||
|
</style> |
@ -0,0 +1,53 @@ |
|||||
|
<template> |
||||
|
<view class=""> |
||||
|
<uni-popup ref="popup"> |
||||
|
<detail-common-info :dataContent="dataContent" @onClose="closePopup"> |
||||
|
<view class=""> |
||||
|
<view class="uni-flex uni-column"> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">盘点明细号 : </text> |
||||
|
<text class="text_wrap">{{dataContent.CountDetailNumber}} </text> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</detail-common-info> |
||||
|
</uni-popup> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import detailCommonInfo from '@/mycomponents/detail/detailCommonInfo.vue' |
||||
|
export default { |
||||
|
components: { |
||||
|
detailCommonInfo |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
dataContent: { |
||||
|
type: Object, |
||||
|
default: {} |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
mounted() {}, |
||||
|
props: {}, |
||||
|
|
||||
|
methods: { |
||||
|
openPopup(val) { |
||||
|
this.dataContent = val; |
||||
|
setTimeout(res => { |
||||
|
this.$refs.popup.open('bottom') |
||||
|
}, 500) |
||||
|
}, |
||||
|
closePopup() { |
||||
|
this.$refs.popup.close() |
||||
|
}, |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
|
||||
|
|
||||
|
</style> |
@ -0,0 +1,76 @@ |
|||||
|
<template> |
||||
|
<view class=""> |
||||
|
<uni-popup ref="popup"> |
||||
|
<job-common-info :dataContent="dataContent" @onClose="closePopup"> |
||||
|
<view class=""> |
||||
|
<view class="uni-flex uni-column"> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">计划单号 : </text> |
||||
|
<text class="text_wrap">{{dataContent.planNumber}} </text> |
||||
|
</view> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">阶段 : </text> |
||||
|
<text class="text_wrap">{{getCountStageName(dataContent.stage)}} </text> |
||||
|
</view> |
||||
|
|
||||
|
<view class="item"> |
||||
|
<text class="item_title">库位 : </text> |
||||
|
<text class="text_wrap">{{dataContent.locationCode}} </text> |
||||
|
</view> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">盘点策略 : </text> |
||||
|
<text class="text_wrap">{{isOpenCount(dataContent.isOpenCount)}}</text> |
||||
|
</view> |
||||
|
|
||||
|
</view> |
||||
|
</view> |
||||
|
</job-common-info> |
||||
|
</uni-popup> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { |
||||
|
getCountStageName |
||||
|
} from '@/common/directory.js'; |
||||
|
import jobCommonInfo from '@/mycomponents/job/jobCommonInfo.vue' |
||||
|
export default { |
||||
|
components: { |
||||
|
jobCommonInfo, |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
dataContent: { |
||||
|
type: Object, |
||||
|
default: {} |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
mounted() {}, |
||||
|
props: {}, |
||||
|
|
||||
|
methods: { |
||||
|
openPopup(val) { |
||||
|
this.dataContent = val; |
||||
|
setTimeout(res => { |
||||
|
this.$refs.popup.open('bottom') |
||||
|
}, 500) |
||||
|
}, |
||||
|
closePopup() { |
||||
|
this.$refs.popup.close() |
||||
|
}, |
||||
|
getCountStageName(value) { |
||||
|
return getCountStageName(value) |
||||
|
}, |
||||
|
isOpenCount(value) { |
||||
|
return value == "TRUE" ? "明盘" : "盲盘" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
|
||||
|
|
||||
|
</style> |
@ -0,0 +1,47 @@ |
|||||
|
<template> |
||||
|
<uni-popup ref="popupItems"> |
||||
|
<com-popup @onClose="closePopup"> |
||||
|
<view v-for="(item, index) in receiptList" :key="index"> |
||||
|
<com-count-job-card :dataContent="item" @click='selectItem(item)'></com-count-job-card> |
||||
|
<u-line></u-line> |
||||
|
</view> |
||||
|
</com-popup> |
||||
|
</uni-popup> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import comPopup from '@/mycomponents/common/comPopup.vue' |
||||
|
import comCountJobCard from '@/pages/count/coms/comCountJobCard.vue' |
||||
|
|
||||
|
export default { |
||||
|
emits: ["selectedItem"], |
||||
|
components: { |
||||
|
comPopup, |
||||
|
comCountJobCard |
||||
|
}, |
||||
|
props: { |
||||
|
|
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
receiptList: [] |
||||
|
} |
||||
|
}, |
||||
|
methods: { |
||||
|
openPopup(items) { |
||||
|
this.receiptList = items; |
||||
|
this.$refs['popupItems'].open("center"); |
||||
|
}, |
||||
|
closePopup() { |
||||
|
this.$refs.popupItems.close() |
||||
|
}, |
||||
|
selectItem(item) { |
||||
|
this.$emit("selectedItem", item); |
||||
|
this.$refs['popupItems'].close(); |
||||
|
}, |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
</style> |
@ -0,0 +1,843 @@ |
|||||
|
<template> |
||||
|
<view class="page-wraper"> |
||||
|
<view class="page-header"> |
||||
|
<view class="header_job_top"> |
||||
|
<job-top :dataContent="jobContent"></job-top> |
||||
|
</view> |
||||
|
<view class="cen_card" style="padding-top: 10rpx;padding-bottom: 10rpx;"> |
||||
|
<view class="cell_box uni-flex uni-row"> |
||||
|
<view class="cell_info"> |
||||
|
<view class="text_lightblue">阶段</view> |
||||
|
<view>{{getCountStageName(jobContent.stage)}}</view> |
||||
|
</view> |
||||
|
<view class="cell_info"> |
||||
|
<view class="text_lightblue">策略</view> |
||||
|
<view>{{ isOpenCount(jobContent.isOpenCount) }}</view> |
||||
|
</view> |
||||
|
<view class="cell_info"> |
||||
|
<view class="text_lightblue">库位</view> |
||||
|
<view>{{fromLocationCode}}</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
<u-line color="#D8D8D8" style="margin-bottom: 15rpx;"></u-line> |
||||
|
<view class="page-main"> |
||||
|
<scroll-view scroll-y="true" class="page-main-scroll"> |
||||
|
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> |
||||
|
<view class=""> |
||||
|
<com-count-detail-card :ref="'countDetail_'+index" :dataContent="item" :index="index" |
||||
|
@editItem="editItem" :settingParam="jobContent" @remove="updateData" |
||||
|
@updateData="updateData"> |
||||
|
</com-count-detail-card> |
||||
|
</view> |
||||
|
<u-line /> |
||||
|
</view> |
||||
|
</scroll-view> |
||||
|
</view> |
||||
|
|
||||
|
<view class="page-footer"> |
||||
|
<view class="uni-flex u-col-center space-between padding_10" |
||||
|
style="background-color:ghostwhite; width: 100%; "> |
||||
|
<view class=""> |
||||
|
</view> |
||||
|
<view class=" uni-flex uni-row"> |
||||
|
<button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
|
||||
|
<win-scan-button @goScan='openScanPopup'></win-scan-button> |
||||
|
<win-scan-pack-and-location ref="scanPopup" :noShowBalanceMessage="true" @getCountScanResult='getScanResult'> |
||||
|
</win-scan-pack-and-location> |
||||
|
<count-qty-edit ref="countQtyEdit" @confirm="editConfirm" @close="editClose" :isShowStatus="true" |
||||
|
:allowEditStatus="editInventoryStatus" :isShowBalance="jobContent.isOpenCount=='TRUE'"> |
||||
|
</count-qty-edit> |
||||
|
<balance-select ref="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { |
||||
|
getCountJobDetail, |
||||
|
takeCountJob, |
||||
|
cancleTakeCountJob, |
||||
|
countJobSubmit |
||||
|
} from '@/api/request2.js'; |
||||
|
import { |
||||
|
calc |
||||
|
} from '@/common/calc.js'; |
||||
|
|
||||
|
import { |
||||
|
goHome, |
||||
|
navigateBack, |
||||
|
getPackingNumberAndBatch |
||||
|
} from '@/common/basic.js'; |
||||
|
import { |
||||
|
getCountStageName |
||||
|
} from '@/common/directory.js'; |
||||
|
|
||||
|
|
||||
|
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
||||
|
import winScanPack from '@/mycomponents/scan/winScanPack.vue' |
||||
|
import requiredLocation from '@/mycomponents/location/requiredLocation.vue' |
||||
|
import comCountDetailCard from '@/pages/count/coms/comCountDetailCard.vue' |
||||
|
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue" |
||||
|
import countQtyEdit from '@/mycomponents/qty/CountQtyEdit.vue' |
||||
|
import jobTop from '@/mycomponents/job/jobTop.vue' |
||||
|
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue' |
||||
|
|
||||
|
export default { |
||||
|
name: 'receipt_detail', |
||||
|
components: { |
||||
|
winScanButton, |
||||
|
winScanPack, |
||||
|
comCountDetailCard, |
||||
|
requiredLocation, |
||||
|
winScanPackAndLocation, |
||||
|
countQtyEdit, |
||||
|
jobTop, |
||||
|
balanceSelect |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
id: '', |
||||
|
receiptJob: {}, |
||||
|
fromLocationCode: '', |
||||
|
isShowPackingCode: true, |
||||
|
scanCount: 0, |
||||
|
jobContent: {}, //任务内容 |
||||
|
subList: [], //接口返回的任务subList |
||||
|
detailSource: [], //绑定在页面上的数据源 |
||||
|
balance: {}, //库存余额 |
||||
|
editInventoryStatus: false, |
||||
|
package: {}, //包装 |
||||
|
label: {}, //标签 |
||||
|
currentEditItem: {}, |
||||
|
jobStatus: "" |
||||
|
}; |
||||
|
}, |
||||
|
onLoad(option) { |
||||
|
this.id = option.id; |
||||
|
if (this.id != undefined) { |
||||
|
//新建的任务自动接收 |
||||
|
if (option.status == "1") { |
||||
|
this.receive((callback => { |
||||
|
this.getDetail(); |
||||
|
})); |
||||
|
} else { |
||||
|
this.getDetail(); |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
//返回首页 |
||||
|
onNavigationBarButtonTap(e) { |
||||
|
if (e.index === 0) { |
||||
|
goHome(); |
||||
|
} |
||||
|
}, |
||||
|
//拦截返回按钮事件 |
||||
|
onBackPress(e) { |
||||
|
//已经接收但是没提交任务 |
||||
|
if (e.from === 'backbutton') { |
||||
|
if (this.jobStatus == "2") { |
||||
|
//取消承接任务 |
||||
|
cancleTakeCountJob(this.id).then(res => { |
||||
|
uni.navigateBack(); |
||||
|
}).catch(error => { |
||||
|
uni.navigateBack(); |
||||
|
}) |
||||
|
} else { |
||||
|
uni.navigateBack(); |
||||
|
} |
||||
|
return true; |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
onPullDownRefresh() { |
||||
|
this.getDetail(); |
||||
|
uni.stopPullDownRefresh(); |
||||
|
}, |
||||
|
|
||||
|
mounted() { |
||||
|
|
||||
|
}, |
||||
|
methods: { |
||||
|
//接收 |
||||
|
receive(callback) { |
||||
|
if (this.id != null) { |
||||
|
takeCountJob(this.id).then(res => { |
||||
|
callback(); |
||||
|
}).catch(error => { |
||||
|
this.showErrorMessage(error) |
||||
|
}) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
getDetail() { |
||||
|
var that = this; |
||||
|
uni.showLoading({ |
||||
|
title: "加载中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
getCountJobDetail(that.id).then(res => { |
||||
|
uni.hideLoading(); |
||||
|
if (res.data == null) { |
||||
|
that.showMessage('未获取到详情'); |
||||
|
} else { |
||||
|
that.jobContent = res.data; |
||||
|
that.jobStatus = res.data.status; |
||||
|
that.fromLocationCode = that.jobContent.locationCode; |
||||
|
that.subList = res.data.subList; |
||||
|
that.detailSource = that.getDataSource(that.subList) |
||||
|
this.calcHandleQty(); |
||||
|
} |
||||
|
|
||||
|
}).catch(error => { |
||||
|
uni.hideLoading() |
||||
|
this.showErrorMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
getDataSource(subList) { |
||||
|
let items = []; |
||||
|
subList.forEach(detail => { |
||||
|
var item = items.find(r => |
||||
|
r.itemCode == detail.itemCode) |
||||
|
if (item == undefined) { |
||||
|
item = this.createItemInfo(detail); |
||||
|
let newDetail = this.createDetailInfo(detail); // |
||||
|
item.subList.push(newDetail); |
||||
|
items.push(item) |
||||
|
} else { |
||||
|
console.log("数量", item.qty) |
||||
|
item.qty = calc.add(item.qty, detail.qty) |
||||
|
let newDetail = this.createDetailInfo(detail); // |
||||
|
item.subList.push(newDetail); |
||||
|
} |
||||
|
}) |
||||
|
return items; |
||||
|
}, |
||||
|
|
||||
|
createItemInfo(res) { |
||||
|
let item = { |
||||
|
itemCode: res.itemCode, |
||||
|
itemName: res.itemName, |
||||
|
stdPackQty: res.stdPackQty, |
||||
|
stdPackUnit: res.stdPackUnit, |
||||
|
qty: Number(res.qty), |
||||
|
handleQty: 0, |
||||
|
uom: res.uom, |
||||
|
subList: [] |
||||
|
} |
||||
|
return item; |
||||
|
}, |
||||
|
|
||||
|
createDetailInfo(data) { |
||||
|
data.scaned = false; |
||||
|
let detail = data; |
||||
|
detail.balanceQty = 0 |
||||
|
detail.handleQty = 0; |
||||
|
detail.inventoryStatus = detail.inventoryStatus |
||||
|
detail.fromLocationCode = this.fromLocationCode |
||||
|
return detail; |
||||
|
}, |
||||
|
|
||||
|
calcScanCount(closeScan) { |
||||
|
let items = this.subList.filter(r => { |
||||
|
if (r.scaned) { |
||||
|
return r; |
||||
|
} |
||||
|
}) |
||||
|
this.scanCount = items != null ? items.length : 0; |
||||
|
if (this.scanCount == this.subList.length) { |
||||
|
this.closeScanPopup(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
calcHandleQty() { |
||||
|
for (let item of this.detailSource) { |
||||
|
item.handleQty = new Decimal(0).toNumber(); |
||||
|
item.qty = new Decimal(0).toNumber(); |
||||
|
for (let detail of item.subList) { |
||||
|
if (detail!= undefined) { |
||||
|
if (detail.scaned) { |
||||
|
item.handleQty = calc.add(item.handleQty, detail.handleQty); |
||||
|
} |
||||
|
item.qty = calc.add(item.qty, detail.qty); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
this.$forceUpdate(); |
||||
|
}, |
||||
|
|
||||
|
updateData() { |
||||
|
this.calcHandleQty(); |
||||
|
}, |
||||
|
|
||||
|
openScanPopup() { |
||||
|
let fromlocationCode = ''; |
||||
|
let fromlocationList = []; |
||||
|
for (var i = 0; i < this.detailSource.length; i++) { |
||||
|
let item = this.detailSource[i]; |
||||
|
item.subList.forEach(l => { |
||||
|
//重复的库位不往里面插入 |
||||
|
var location = fromlocationList.find(res => res == l.fromLocationCode) |
||||
|
if (location == undefined) { |
||||
|
fromlocationList.push(l.fromLocationCode); |
||||
|
} |
||||
|
//来源库位赋默认值 |
||||
|
if (fromlocationCode == '') { |
||||
|
if (!l.scaned) { |
||||
|
fromlocationCode = l.fromLocationCode; |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
this.$refs.scanPopup.openScanPopupForJob(fromlocationCode, fromlocationList, this.jobContent); |
||||
|
}, |
||||
|
|
||||
|
closeScanPopup() { |
||||
|
if (this.$refs.scanPopup != undefined) { |
||||
|
this.$refs.scanPopup.closeScanPopup(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
scanPopupGetFocus() { |
||||
|
if (this.$refs.scanPopup != undefined) { |
||||
|
this.$refs.scanPopup.packGetFocus(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
scanPopupLoseFocus() { |
||||
|
if (this.$refs.scanPopup != undefined) { |
||||
|
this.$refs.scanPopup.packLoseFocus(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
//明盘 |
||||
|
getScanResult(result) { |
||||
|
if (this.jobContent.isOpenCount) { |
||||
|
this.getOpenCountResult(result); |
||||
|
} else { |
||||
|
this.getUnOpenCountResult(result); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
getOpenCountResult(result) { |
||||
|
try { |
||||
|
let that = this; |
||||
|
that.package = result.package; |
||||
|
that.label = result.label; |
||||
|
var item = this.detailSource.find(r => r.itemCode == that.package.itemCode); |
||||
|
if (item == undefined) { |
||||
|
that.scanByBalance(result); |
||||
|
} else { |
||||
|
// let subItem = item.subList.find(item => { |
||||
|
// if (item.packingNumber == that.label.packingNumber && |
||||
|
// item.batch == that.label.batch && item.scaned == true) { |
||||
|
// return item; |
||||
|
// } |
||||
|
// }) |
||||
|
let subItems = item.subList.filter(item => { |
||||
|
if (item.packingNumber == that.label.packingNumber && |
||||
|
item.batch == that.label.batch) { |
||||
|
return item; |
||||
|
} |
||||
|
}) |
||||
|
//有多条:同箱码同批次,但是状态不同 |
||||
|
if (subItems.length > 1) { |
||||
|
let subItem = subItems.find(r => r.scaned == false) |
||||
|
if (subItem == undefined) { |
||||
|
subItem = subItems[0]; |
||||
|
that.editCountResult(item, subItem); |
||||
|
} else { |
||||
|
that.scanByBalance(result); |
||||
|
} |
||||
|
} else if (subItems.length == 1) { |
||||
|
let subItem = subItems[0]; |
||||
|
if (subItem.scaned) { |
||||
|
that.editCountResult(item, subItem); |
||||
|
// this.$refs.comMessage.showQuestionMessage("箱码【" + that.label.packingNumber + |
||||
|
// "】已经完成盘点,是否要编辑盘点结果?", |
||||
|
// res => { |
||||
|
// if (res) { |
||||
|
// this.currentEditItem = subItem; |
||||
|
// this.$refs.countQtyEdit.openEditPopup(subItem, |
||||
|
// item.subList); |
||||
|
// // this.$refs.countQtyEdit.openEditPopupShowSeconds(subItem, |
||||
|
// // item.subList); |
||||
|
// } else { |
||||
|
// this.scanPopupGetFocus(); |
||||
|
// } |
||||
|
// }) |
||||
|
} else { |
||||
|
that.scanByBalance(result); |
||||
|
} |
||||
|
} else if (subItems.length == 0) { |
||||
|
that.scanByBalance(result); |
||||
|
} |
||||
|
} |
||||
|
} catch (e) { |
||||
|
this.showErrorMessage(e.message) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
//编辑盘点结果 |
||||
|
editCountResult(item, subItem) { |
||||
|
let that = this; |
||||
|
this.$refs.comMessage.showQuestionMessage("箱码【" + that.label.packingNumber + |
||||
|
"】已经完成盘点,是否要编辑盘点结果?", |
||||
|
res => { |
||||
|
if (res) { |
||||
|
this.currentEditItem = subItem; |
||||
|
this.$refs.countQtyEdit.openEditPopup(subItem, |
||||
|
item.subList); |
||||
|
// this.$refs.countQtyEdit.openEditPopupShowSeconds(subItem, |
||||
|
// item.subList); |
||||
|
} else { |
||||
|
this.scanPopupGetFocus(); |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
getUnOpenCountResult(result) { |
||||
|
try { |
||||
|
let that = this; |
||||
|
that.package = result.package; |
||||
|
that.label = result.label; |
||||
|
var item = this.detailSource.find(r => r.itemCode == that.package.itemCode); |
||||
|
if (item == undefined) { |
||||
|
this.$refs.comMessage.showQuestionMessage("没有物料【" + that.package.itemCode + |
||||
|
"】的盘点明细,是否继续盘点?", |
||||
|
res => { |
||||
|
if (res) { |
||||
|
that.scanByLabel(result); |
||||
|
} else { |
||||
|
this.scanPopupGetFocus(); |
||||
|
} |
||||
|
}) |
||||
|
} else { |
||||
|
let subItem = item.subList.find(item => { |
||||
|
if (item.packingNumber == that.label.packingNumber && |
||||
|
item.batch == that.label.batch && item.scaned == true) { |
||||
|
return item; |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
if (subItem != undefined) { |
||||
|
this.$refs.comMessage.showQuestionMessage("箱码【" + that.label.packingNumber + |
||||
|
"】已经完成盘点,是否要编辑盘点结果?", |
||||
|
res => { |
||||
|
if (res) { |
||||
|
this.currentEditItem = subItem; |
||||
|
this.$refs.countQtyEdit.openEditPopup(subItem, |
||||
|
item.subList); |
||||
|
} else { |
||||
|
this.scanPopupGetFocus(); |
||||
|
} |
||||
|
}) |
||||
|
} else { |
||||
|
that.scanByLabel(result); |
||||
|
} |
||||
|
} |
||||
|
} catch (e) { |
||||
|
this.showErrorMessage(e.message) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
//明盘,按库存盘点 |
||||
|
scanByBalance(result) { |
||||
|
let that = this; |
||||
|
if (result.balance.length == 0) { |
||||
|
that.scanPopupLoseFocus() |
||||
|
that.$refs.comMessage.showQuestionMessage("该包装在来源库位[" + that.fromLocationCode + |
||||
|
"],未查找到库存,是否继续盘点?", |
||||
|
res => { |
||||
|
if (res) { |
||||
|
that.editInventoryStatus = true; |
||||
|
let item = that.package; |
||||
|
item.packingNumber = that.label.packingNumber; |
||||
|
item.qty = 0 |
||||
|
item.handleQty = Number(that.label.qty); |
||||
|
item.balanceQty = 0; |
||||
|
item.inventoryStatus = "OK"; |
||||
|
that.balance = item; |
||||
|
that.$refs.countQtyEdit.openEditPopupShowSeconds(item, |
||||
|
null); |
||||
|
} else { |
||||
|
//继续扫描 |
||||
|
that.scanPopupGetFocus(); |
||||
|
} |
||||
|
}) |
||||
|
} else if (result.balance.length == 1) { |
||||
|
this.countByBalance(result.balance[0]); |
||||
|
} else { |
||||
|
//有多条库存记录 |
||||
|
this.$refs.balanceSelect.openPopup(result.balance); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
//盲盘,按标签盘点 |
||||
|
scanByLabel(result) { |
||||
|
let that = this; |
||||
|
that.scanPopupLoseFocus() |
||||
|
let item = that.package; |
||||
|
item.packingNumber = that.label.packingNumber; |
||||
|
item.qty = 0 |
||||
|
item.handleQty = Number(that.label.qty); |
||||
|
item.balanceQty = 0; |
||||
|
item.inventoryStatus = "OK"; |
||||
|
that.balance = item; |
||||
|
that.$refs.countQtyEdit.openEditPopupShowSeconds(item, |
||||
|
null); |
||||
|
}, |
||||
|
|
||||
|
selectBalanceItem(balance) { |
||||
|
this.countByBalance(balance); |
||||
|
}, |
||||
|
|
||||
|
countByBalance(balance) { |
||||
|
this.balance = balance; |
||||
|
// this.balance.qty = 0 |
||||
|
this.balance.handleQty = Number(this.label.qty); |
||||
|
this.balance.balanceQty = this.balance.qty; |
||||
|
this.balance.stdPackQty = this.package.stdPackQty; |
||||
|
this.balance.stdPackUnit = this.package.stdPackUnit; |
||||
|
this.$refs.countQtyEdit.openEditPopupShowSeconds(this.balance, |
||||
|
null); |
||||
|
}, |
||||
|
|
||||
|
editConfirm(qty, inventoryStatus, mode) { |
||||
|
let that = this; |
||||
|
//编辑 |
||||
|
if (mode == 'edit') { |
||||
|
this.currentEditItem.handleQty = qty; |
||||
|
this.currentEditItem.inventoryStatus = inventoryStatus; |
||||
|
} else { |
||||
|
//新增盘点 |
||||
|
//检查物料号是否存在 |
||||
|
var detail = that.detailSource.find(r => r.itemCode == that.label.itemCode); |
||||
|
if (detail == undefined) { |
||||
|
//物料号不存在,创建物料号数据添加到列表。设置为已经扫描 |
||||
|
that.addNewItemCodeToList(qty, inventoryStatus) |
||||
|
} else { |
||||
|
var itemEditInfo = detail.subList.find(item => { |
||||
|
if (item.packingNumber == that.label.packingNumber && |
||||
|
item.batch == that.label.batch && |
||||
|
item.inventoryStatus == inventoryStatus) { |
||||
|
return item; |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
if (itemEditInfo == undefined) { |
||||
|
//不在任务列表中,提示是否添加到列表 |
||||
|
that.addExistItemCodeToList(detail, qty, inventoryStatus); |
||||
|
} else { //已经扫描是否编辑 |
||||
|
itemEditInfo.scaned = true; |
||||
|
itemEditInfo.handleQty = qty; |
||||
|
itemEditInfo.inventoryStatus = inventoryStatus; |
||||
|
itemEditInfo.balanceQty = that.balance.qty; |
||||
|
itemEditInfo.stdPackQty = that.package.stdPackQty; |
||||
|
itemEditInfo.stdPackUnit = that.package.stdPackUnit; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
setTimeout(r => { |
||||
|
this.calcHandleQty(); |
||||
|
this.scanPopupGetFocus(); |
||||
|
}, 100) |
||||
|
} |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
openEditConfirm() { |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
unOpenEditConfirm() { |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
editClose() { |
||||
|
this.scanPopupGetFocus(); |
||||
|
}, |
||||
|
|
||||
|
addNewItemCodeToList(qty, inventoryStatus) { |
||||
|
this.$refs.comMessage.showQuestionMessage("物料[" + this.package.itemCode + "]不在列表中,是否添加到列表?", |
||||
|
res => { |
||||
|
if (res) { |
||||
|
var item = this.createAddItemInfo(this.balance, this.package); |
||||
|
let newDetail = this.createAddDetailInfo(qty, inventoryStatus); // |
||||
|
item.subList.push(newDetail); |
||||
|
this.detailSource.push(item) |
||||
|
this.showMessage('添加成功'); |
||||
|
this.updateData() |
||||
|
this.scanPopupGetFocus(); |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
addExistItemCodeToList(detail, qty, inventoryStatus) { |
||||
|
let that = this; |
||||
|
that.scanPopupLoseFocus(); |
||||
|
this.$refs.comMessage.showQuestionMessage("盘点结果不在明细列表中,是否添加到列表?", |
||||
|
res => { |
||||
|
if (res) { |
||||
|
// detail.qty = calc.add(qty, qty) |
||||
|
let newDetail = that.createAddDetailInfo(qty, inventoryStatus); // |
||||
|
detail.subList.push(newDetail); |
||||
|
this.showMessage('添加成功'); |
||||
|
that.updateData() |
||||
|
} |
||||
|
that.scanPopupGetFocus(); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
createAddItemInfo() { |
||||
|
let item = { |
||||
|
itemCode: this.package.itemCode, |
||||
|
itemName: this.package.itemName, |
||||
|
stdPackQty: this.package.stdPackQty, |
||||
|
stdPackUnit: this.package.stdPackUnit, |
||||
|
// qty: Number(qty), |
||||
|
qty: 0, |
||||
|
handleQty: 0, |
||||
|
uom: this.package.uom, |
||||
|
subList: [], |
||||
|
} |
||||
|
return item; |
||||
|
}, |
||||
|
|
||||
|
//创建盘盈的明细 |
||||
|
createAddDetailInfo(qty, inventoryStatus) { |
||||
|
var detail = { |
||||
|
id: "0", //新增的明细 |
||||
|
scaned: true, |
||||
|
countDetailNumber: "", |
||||
|
ownerCode: this.balance.ownerCode, |
||||
|
packingNumber: this.package.number, |
||||
|
containerNumber: this.balance.containerNumber, |
||||
|
batch: this.package.batch, |
||||
|
inventoryStatus: inventoryStatus, |
||||
|
itemCode: this.package.itemCode, |
||||
|
itemName: this.package.itemName, |
||||
|
itemDesc1: this.package.itemDesc1, |
||||
|
itemDesc2: this.package.itemDesc2, |
||||
|
stdPackQty: this.package.stdPackQty, |
||||
|
stdPackUnit: this.package.stdPackUnit, |
||||
|
projectCode: "", |
||||
|
qty: 0, |
||||
|
handleQty: qty, |
||||
|
uom: this.package.uom, |
||||
|
number: this.jobContent.number, |
||||
|
remark: "", |
||||
|
countQty: qty, |
||||
|
balanceQty: this.balance.qty, |
||||
|
fromLocationCode: this.balance.locationCode, |
||||
|
creator: this.$store.state.user.id |
||||
|
} |
||||
|
return detail; |
||||
|
}, |
||||
|
|
||||
|
scanLocationCode(location, code) { |
||||
|
this.$refs.comMessage.showQuestionMessage("是否把所有的目标库位都变成默认库位[" + code + "]", res => { |
||||
|
this.toLocationCode = code |
||||
|
this.detailSource.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
detail.toLocationCode = code |
||||
|
}) |
||||
|
}) |
||||
|
}) |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
getScanCount() { |
||||
|
var scanCount = 0; |
||||
|
this.detailSource.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
if (detail.scaned) { |
||||
|
scanCount = scanCount + 1; |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
return scanCount; |
||||
|
}, |
||||
|
|
||||
|
getTotalCount() { |
||||
|
var totalCount = 0; |
||||
|
this.detailSource.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
totalCount = totalCount + 1; |
||||
|
}) |
||||
|
}) |
||||
|
return totalCount; |
||||
|
}, |
||||
|
|
||||
|
commit() { |
||||
|
this.scanCount = this.getScanCount(); |
||||
|
|
||||
|
if (this.scanCount == this.getTotalCount()) { |
||||
|
this.submitJob(); |
||||
|
} else if (this.scanCount < this.getTotalCount()) { |
||||
|
//扫描数量小于任务数量,判断是否允许部分提交 |
||||
|
if (this.jobContent.allowPartialComplete == "TRUE") { |
||||
|
//提交 |
||||
|
this.$refs.comMessage.showQuestionMessage("已经扫描[" + this.scanCount + |
||||
|
"]总共[" + this |
||||
|
.getTotalCount() + "],是否把未扫描的盘点数量设置为0?", |
||||
|
res => { |
||||
|
if (res) { |
||||
|
this.detailSource.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
if (!detail.scaned) { |
||||
|
detail.countQty = 0; |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
this.submitJob(); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
} else { |
||||
|
//不允许部分提交,提示 |
||||
|
this.$refs.comMessage.showErrorMessage('请完成扫描后,再进行提交<br>' + "已经扫描[" + this.scanCount + |
||||
|
"]总共[" + this |
||||
|
.getTotalCount() + "]", res => { |
||||
|
if (res) { |
||||
|
this.openScanPopup(); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
submitJob() { |
||||
|
uni.showLoading({ |
||||
|
title: "提交中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
var params = this.setParams() |
||||
|
console.log("提交参数", JSON.stringify(params)); |
||||
|
countJobSubmit(params).then(res => { |
||||
|
uni.hideLoading() |
||||
|
if (res.data) { |
||||
|
this.showCommitSuccessMessage("提交成功<br>生成盘点记录<br>" + res.data) |
||||
|
} else { |
||||
|
this.showErrorMessage("提交失败[" + res.msg + "]") |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
uni.hideLoading() |
||||
|
this.showErrorMessage(error) |
||||
|
}) |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
setParams() { |
||||
|
var subList = [] |
||||
|
var creator = this.$store.state.user.id |
||||
|
|
||||
|
this.detailSource.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
if (detail.scaned) { |
||||
|
detail.countQty = detail.handleQty; |
||||
|
} |
||||
|
subList.push(detail) |
||||
|
}) |
||||
|
}) |
||||
|
|
||||
|
this.jobContent.subList = subList |
||||
|
this.jobContent.creator = creator; |
||||
|
return this.jobContent; |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
showMessage(message) { |
||||
|
this.$refs.comMessage.showMessage(message, res => { |
||||
|
if (res) { |
||||
|
this.afterCloseMessage() |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
showErrorMessage(message) { |
||||
|
this.$refs.comMessage.showErrorMessage(message, res => { |
||||
|
if (res) { |
||||
|
this.afterCloseMessage() |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
showScanMessage(message) { |
||||
|
this.$refs.comMessage.showScanMessage(message); |
||||
|
}, |
||||
|
|
||||
|
afterCloseMessage() { |
||||
|
this.scanPopupGetFocus(); |
||||
|
}, |
||||
|
|
||||
|
closeScanMessage() { |
||||
|
this.scanPopupGetFocus(); |
||||
|
}, |
||||
|
|
||||
|
editItem(item) { |
||||
|
this.currentEditItem = item; |
||||
|
var detail = this.detailSource.find(r => r.itemCode == item.itemCode); |
||||
|
this.$refs.countQtyEdit.openEditPopup(item, |
||||
|
detail.subList); |
||||
|
}, |
||||
|
|
||||
|
showCommitSuccessMessage(hint) { |
||||
|
this.$refs.comMessage.showSuccessMessage(hint, res => { |
||||
|
navigateBack(1); |
||||
|
}) |
||||
|
}, |
||||
|
getCountStageName(value) { |
||||
|
return getCountStageName(value) |
||||
|
}, |
||||
|
isOpenCount(value) { |
||||
|
return value == "TRUE" ? "明盘" : "盲盘" |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="scss"> |
||||
|
page { |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
background-color: #fff; |
||||
|
} |
||||
|
|
||||
|
.page-wraper { |
||||
|
display: flex; |
||||
|
flex-direction: column; |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
.page-main { |
||||
|
flex: 1; |
||||
|
position: relative; |
||||
|
} |
||||
|
|
||||
|
.page-main-scroll { |
||||
|
position: absolute; |
||||
|
left: 0; |
||||
|
right: 0; |
||||
|
top: 0; |
||||
|
bottom: 0; |
||||
|
} |
||||
|
|
||||
|
.page-main-list { |
||||
|
/* height: 80rpx; |
||||
|
line-height: 80rpx; */ |
||||
|
text-align: center; |
||||
|
background: #e0e0e0; |
||||
|
|
||||
|
} |
||||
|
</style> |
@ -0,0 +1,290 @@ |
|||||
|
<template> |
||||
|
<view class=""> |
||||
|
<com-empty-view v-if="jobList.length==0"></com-empty-view> |
||||
|
<job-filter ref="filter" otherTitle="ASN" @switchChangeToday="switchChangeToday" |
||||
|
@switchChangeWait="switchChangeWait" @onScanNumber="getScanNumber" :checkedToday="checkedToday" |
||||
|
:checkedWaitTask="checkedWaitTask"> |
||||
|
</job-filter> |
||||
|
<view v-if="jobList.length>0"> |
||||
|
<uni-swipe-action ref="swipeAction"> |
||||
|
<view v-for="(item, index) in jobList" :key="index"> |
||||
|
<uni-swipe-action-item |
||||
|
:right-options="item.status=='2'?detailGiveupOptions:detailOptions" |
||||
|
@click="swipeClick($event,item)"> |
||||
|
<com-count-job-card :dataContent="item" @click='openJobDetail(item)'></com-count-job-card> |
||||
|
</uni-swipe-action-item> |
||||
|
</view> |
||||
|
</uni-swipe-action> |
||||
|
|
||||
|
<job-list-popup ref="jobListPopup" @selectedItem="selectedItem"></job-list-popup> |
||||
|
<job-info-popup ref='jobInfoPopup'></job-info-popup> |
||||
|
|
||||
|
<uni-load-more :status="loadingType" /> |
||||
|
</view> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { |
||||
|
cancleTakeCountJob, |
||||
|
getCountJobList |
||||
|
} from '@/api/request2.js'; |
||||
|
|
||||
|
import { |
||||
|
goHome, |
||||
|
updateTitle |
||||
|
} from '@/common/basic.js'; |
||||
|
|
||||
|
import { |
||||
|
getDetailOption, |
||||
|
getDetailGiveupOption |
||||
|
} from '@/common/array.js'; |
||||
|
|
||||
|
import comEmptyView from '@/mycomponents/common/comEmptyView.vue' |
||||
|
import jobFilter from '@/mycomponents/job/jobFilter.vue' |
||||
|
|
||||
|
import comCountJobCard from '@/pages/count/coms/comCountJobCard.vue' |
||||
|
import jobListPopup from '@/pages/count/coms/jobListPopup.vue' |
||||
|
import jobInfoPopup from '@/pages/count/coms/jobInfoPopup.vue' |
||||
|
|
||||
|
export default { |
||||
|
name: 'receipt', |
||||
|
components: { |
||||
|
comEmptyView, |
||||
|
jobFilter, |
||||
|
comCountJobCard, |
||||
|
jobListPopup, |
||||
|
jobInfoPopup |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
jobList: [], |
||||
|
pageNo: 1, |
||||
|
pageSize: 10, |
||||
|
totalCount: 0, |
||||
|
loadingType: "nomore", |
||||
|
checkedToday: false, |
||||
|
checkedWaitTask: false, |
||||
|
todayTime: "", |
||||
|
status: '1,2', //待处理 、进行中 |
||||
|
detailOptions: [], |
||||
|
detailGiveupOptions: [], |
||||
|
}; |
||||
|
}, |
||||
|
|
||||
|
onShow() { |
||||
|
this.getList('refresh'); |
||||
|
}, |
||||
|
|
||||
|
onReady() { |
||||
|
this.detailOptions = getDetailOption(); |
||||
|
this.detailGiveupOptions = getDetailGiveupOption(); |
||||
|
}, |
||||
|
|
||||
|
onReachBottom() { |
||||
|
//避免多次触发 |
||||
|
if (this.loadingType == 'loading' || this.loadingType == 'nomore') { |
||||
|
return; |
||||
|
} |
||||
|
this.getList("more"); |
||||
|
}, |
||||
|
|
||||
|
onPullDownRefresh() { |
||||
|
this.getList('refresh'); |
||||
|
}, |
||||
|
|
||||
|
//后退按钮 |
||||
|
onBackPress(options) { |
||||
|
if (options.from === 'navigateBack') { |
||||
|
uni.navigateBack({ |
||||
|
delta: 1 |
||||
|
}) |
||||
|
return false; |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
//返回首页 |
||||
|
onNavigationBarButtonTap(e) { |
||||
|
if (e.index === 0) { |
||||
|
goHome(); |
||||
|
} else if (e.index == 1) { |
||||
|
this.$refs.filter.openFilter(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
methods: { |
||||
|
|
||||
|
getList(type) { |
||||
|
let that = this; |
||||
|
uni.showLoading({ |
||||
|
title: "加载中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
|
||||
|
this.loadingType = "loading"; |
||||
|
if (type === "refresh") { |
||||
|
this.pageNo = 1; |
||||
|
this.jobList = []; |
||||
|
} |
||||
|
|
||||
|
var filters = [] |
||||
|
if (this.checkedToday) { |
||||
|
filters.push({ |
||||
|
column: "request_time", |
||||
|
action: "betweeen", |
||||
|
value: this.todayTime |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
filters.push({ |
||||
|
column: "status", |
||||
|
action: "in", |
||||
|
value: this.status |
||||
|
}) |
||||
|
|
||||
|
var params = { |
||||
|
filters: filters, |
||||
|
pageNo: this.pageNo, |
||||
|
pageSize: this.pageSize, |
||||
|
} |
||||
|
|
||||
|
getCountJobList(params).then(res => { |
||||
|
uni.hideLoading(); |
||||
|
if (type === "refresh") { |
||||
|
uni.stopPullDownRefresh(); |
||||
|
} |
||||
|
|
||||
|
var list = res.data.list; |
||||
|
this.totalCount = res.data.total |
||||
|
this.loadingType = "loadmore"; |
||||
|
if (list == null || list.length == 0) { |
||||
|
this.loadingType = "nomore"; |
||||
|
return; |
||||
|
} |
||||
|
this.jobList = type === "refresh" ? list : this.jobList.concat(list); |
||||
|
this.pageNo++; |
||||
|
updateTitle("盘点(" + this.totalCount + ")"); |
||||
|
|
||||
|
}).catch(error => { |
||||
|
if (type === "refresh") { |
||||
|
uni.stopPullDownRefresh(); |
||||
|
} |
||||
|
updateTitle("盘点"); |
||||
|
this.loadingType = ""; |
||||
|
uni.hideLoading(); |
||||
|
that.showMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
openJobDetail(item) { |
||||
|
uni.navigateTo({ |
||||
|
url: './countDetail?id=' + item.id + '&status=' + item.status |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
showItemList(itemList) { |
||||
|
this.$refs.jobListPopup.openPopup(itemList); |
||||
|
}, |
||||
|
|
||||
|
selectedItem(item) { |
||||
|
this.openJobDetail(item); |
||||
|
}, |
||||
|
|
||||
|
swipeClick(e, dataContent) { |
||||
|
if (e.content.text == "详情") { |
||||
|
this.openjobInfoPopup(dataContent); |
||||
|
} else if (e.content.text == "放弃") { |
||||
|
this.$refs.comMessage.showQuestionMessage("确定要放弃当前任务?", |
||||
|
res => { |
||||
|
if (res) { |
||||
|
this.cancleJob(dataContent.id); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
openjobInfoPopup(item) { |
||||
|
this.$refs.jobInfoPopup.openPopup(item) |
||||
|
}, |
||||
|
|
||||
|
cancleJob(id) { |
||||
|
cancleTakeCountJob(id).then(res => { |
||||
|
if(res.data){ |
||||
|
this.getList("refresh") |
||||
|
uni.showToast({ |
||||
|
title:"放弃任务成功" |
||||
|
}) |
||||
|
}else { |
||||
|
this.showMessage("放弃任务失败") |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
this.showMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
switchChangeToday(state, creationTime) { |
||||
|
this.checkedToday = state; |
||||
|
this.todayTime = creationTime; |
||||
|
this.getList("refresh"); |
||||
|
}, |
||||
|
|
||||
|
switchChangeWait(state, jobStatus) { |
||||
|
this.checkedWaitTask = state; |
||||
|
this.status = jobStatus; |
||||
|
this.getList("refresh"); |
||||
|
}, |
||||
|
|
||||
|
getScanNumber(code) { |
||||
|
this.getDataListByType(code) |
||||
|
}, |
||||
|
getDataListByType(code) { |
||||
|
let that = this; |
||||
|
uni.showLoading({ |
||||
|
title: "加载中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
var filters = [] |
||||
|
filters.push({ |
||||
|
column: "status", |
||||
|
action: "in", |
||||
|
value: '1,2' |
||||
|
}) |
||||
|
filters.push({ |
||||
|
column: "number", |
||||
|
action: "==", |
||||
|
value: code |
||||
|
}) |
||||
|
|
||||
|
var params = { |
||||
|
filters: filters, |
||||
|
pageNo: 1, |
||||
|
pageSize: 100, |
||||
|
} |
||||
|
getCountJobList(params).then(res => { |
||||
|
uni.hideLoading(); |
||||
|
if (res.data.list.length == 0) { |
||||
|
that.showMessage('未查找到' + '【' + code + '】的收货任务'); |
||||
|
} else if (res.data.list.length == 1) { |
||||
|
that.openJobDetail(res.data.list[0]); |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
uni.hideLoading(); |
||||
|
that.showMessage(error); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
showMessage(message) { |
||||
|
this.$refs.comMessage.showErrorMessage(message, res => { |
||||
|
if (res) { |
||||
|
|
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="scss"> |
||||
|
|
||||
|
</style> |
@ -0,0 +1,552 @@ |
|||||
|
<template> |
||||
|
<view class="page-wraper"> |
||||
|
<view class=""> |
||||
|
<com-blank-view @goScan='showFromLocationPopup' v-if="fromLocationCode==''"></com-blank-view> |
||||
|
</view> |
||||
|
<view class="page-wraper" v-if="fromLocationCode!=''"> |
||||
|
<requiredLocation title="盘点库位" :locationCode="fromLocationCode" |
||||
|
:isShowEdit="jobContent.allowModifyLocation==1" @getLocation='scanLocationCode' |
||||
|
:locationTypeList="locationTypeList"></requiredLocation> |
||||
|
<u-line></u-line> |
||||
|
<view class="page-main"> |
||||
|
<scroll-view scroll-y="true" class="page-main-scroll"> |
||||
|
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> |
||||
|
<view class=""> |
||||
|
<com-count-detail-card :dataContent="item" :index="index" :settingParam="jobContent" |
||||
|
@removeItem="removeItem(index,item)" @updateData="updateData" @removePack="removePack" |
||||
|
@editItem="editItem"> |
||||
|
</com-count-detail-card> |
||||
|
</view> |
||||
|
<u-line /> |
||||
|
</view> |
||||
|
</scroll-view> |
||||
|
</view> |
||||
|
|
||||
|
<view class="page-footer"> |
||||
|
<view class="uni-flex u-col-center space-between padding_10" |
||||
|
style="background-color:ghostwhite; width: 100%; "> |
||||
|
<view class=""> |
||||
|
</view> |
||||
|
<view class=" uni-flex uni-row"> |
||||
|
<button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
<win-scan-button @goScan='openScanPopup'></win-scan-button> |
||||
|
</view> |
||||
|
|
||||
|
<win-scan-pack-and-location ref="scanPopup" @getResult='getScanResult'></win-scan-pack-and-location> |
||||
|
<win-scan-location ref="scanFromLocationCode" title="盘点库位" @getLocation='getLocation' |
||||
|
:locationTypeList="fromLocationTypeArray"></win-scan-location> |
||||
|
<count-qty-edit ref="CountQtyEdit" @confirm="editConfirm" :isShowStatus="true" :allowEditStatus="true"> |
||||
|
</count-qty-edit> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { |
||||
|
goHome, |
||||
|
getDataSource, |
||||
|
navigateBack |
||||
|
} from '@/common/basic.js'; |
||||
|
|
||||
|
import { |
||||
|
calc |
||||
|
} from '@/common/calc.js'; |
||||
|
|
||||
|
import { |
||||
|
getDirectoryItemArray |
||||
|
} from '@/common/directory.js'; |
||||
|
|
||||
|
import { |
||||
|
getBusinessType, |
||||
|
} from '@/common/record.js'; |
||||
|
|
||||
|
import { |
||||
|
balanceByLocation |
||||
|
} from '@/common/balance.js'; |
||||
|
|
||||
|
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
||||
|
import winScanPack from '@/mycomponents/scan/winScanPack.vue' |
||||
|
import requiredLocation from '@/mycomponents/location/requiredLocation.vue' |
||||
|
import comCountDetailCard from '@/pages/count/coms/comCountDetailCard.vue' |
||||
|
import comBlankView from '@/mycomponents/common/comBlankView.vue' |
||||
|
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue" |
||||
|
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue" |
||||
|
import CountQtyEdit from '@/mycomponents/qty/CountQtyEdit.vue' |
||||
|
|
||||
|
export default { |
||||
|
name: 'receipt_detail', |
||||
|
components: { |
||||
|
winScanButton, |
||||
|
winScanPack, |
||||
|
comCountDetailCard, |
||||
|
requiredLocation, |
||||
|
comBlankView, |
||||
|
winScanPackAndLocation, |
||||
|
winScanLocation, |
||||
|
CountQtyEdit |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
id: '', |
||||
|
receiptJob: {}, |
||||
|
received: false, |
||||
|
isShowPackingCode: true, |
||||
|
scanCount: 0, |
||||
|
jobContent: {}, //任务内容 |
||||
|
subList: [], //接口返回的任务subList |
||||
|
detailSource: [], //绑定在页面上的数据源 |
||||
|
locationTypeList: [], |
||||
|
toLocationInfo: {}, |
||||
|
businessTypeInfo: {}, |
||||
|
fromLocationTypeArray: [], |
||||
|
toLocationTypeArray: [], |
||||
|
fromLocationInfo: {}, |
||||
|
fromLocationCode: "", |
||||
|
businessType: {}, |
||||
|
itemEditInfo: {} |
||||
|
}; |
||||
|
}, |
||||
|
onLoad(option) { |
||||
|
var typeCode = "Count" |
||||
|
getBusinessType(typeCode, res => { |
||||
|
if (res.success) { |
||||
|
this.businessType = res.businessType; |
||||
|
this.fromlocationTypeList = res.fromlocationTypeList; |
||||
|
this.tolocationTypeList = res.tolocationTypeList; |
||||
|
this.showFromLocationPopup(); |
||||
|
} else { |
||||
|
this.showErrorMessage(res.message) |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
}, |
||||
|
//返回首页 |
||||
|
onNavigationBarButtonTap(e) { |
||||
|
if (e.index === 0) { |
||||
|
goHome(); |
||||
|
} |
||||
|
}, |
||||
|
//拦截返回按钮事件 |
||||
|
onBackPress(e) { |
||||
|
//已经接收但是没提交任务 |
||||
|
}, |
||||
|
|
||||
|
onPullDownRefresh() { |
||||
|
uni.stopPullDownRefresh(); |
||||
|
}, |
||||
|
|
||||
|
mounted() {}, |
||||
|
methods: { |
||||
|
calcScanCount(closeScan) { |
||||
|
let items = this.subList.filter(r => { |
||||
|
if (r.scaned) { |
||||
|
return r; |
||||
|
} |
||||
|
}) |
||||
|
this.scanCount = items != null ? items.length : 0; |
||||
|
if (this.scanCount == this.subList.length) { |
||||
|
this.closeScanPopup(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
calcHandleQty() { |
||||
|
for (let item of this.detailSource) { |
||||
|
item.handleQty = new Decimal(0).toNumber(); |
||||
|
item.qty = new Decimal(0).toNumber(); |
||||
|
for (let detail of item.subList) { |
||||
|
if(detail!=undefined){ |
||||
|
if(detail.scaned){ |
||||
|
item.handleQty = calc.add(item.handleQty,detail.handleQty); |
||||
|
} |
||||
|
item.qty = calc.add(item.qty,detail.qty); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
this.$forceUpdate(); |
||||
|
}, |
||||
|
selectedItem(item) { |
||||
|
if (item.locationCode != this.fromLocationCode) { |
||||
|
this.showErrorMessage("来源库位[" + this.fromLocationCode + "]无库存") |
||||
|
return; |
||||
|
} |
||||
|
}, |
||||
|
openScanPopup() { |
||||
|
if (this.fromLocationCode == "") { |
||||
|
this.showFromLocationPopup(); |
||||
|
return |
||||
|
} |
||||
|
this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType); |
||||
|
}, |
||||
|
|
||||
|
showFromLocationPopup() { |
||||
|
this.$nextTick(() => { |
||||
|
this.$refs.scanFromLocationCode.openScanPopup(); |
||||
|
}) |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
getLocation(location) { |
||||
|
this.getfromLocationCode(location) |
||||
|
}, |
||||
|
|
||||
|
getfromLocationCode(location) { |
||||
|
this.fromLocationInfo = location; |
||||
|
this.fromLocationCode = location.code; |
||||
|
|
||||
|
//查询库位下的库存 |
||||
|
balanceByLocation(this.fromLocationCode, res => { |
||||
|
this.subList = res.data.list; |
||||
|
this.detailSource = getDataSource(this.subList); |
||||
|
|
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
removePack() { |
||||
|
for (var i = 0; i < this.detailSource.length; i++) { |
||||
|
var item = this.detailSource[i]; |
||||
|
if (item.subList.length == 0) { |
||||
|
this.detailSource.splice(i, 1) |
||||
|
} |
||||
|
} |
||||
|
this.updateData(); |
||||
|
}, |
||||
|
|
||||
|
removeItem(index, item) { |
||||
|
this.detailSource.splice(index, 1) |
||||
|
}, |
||||
|
|
||||
|
updateData() { |
||||
|
this.calcHandleQty(); |
||||
|
}, |
||||
|
|
||||
|
closeScanPopup() { |
||||
|
if (this.$refs.scanPopup != undefined) { |
||||
|
this.$refs.scanPopup.closeScanPopup(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
scanPopupGetFocus() { |
||||
|
if (this.$refs.scanPopup != undefined) { |
||||
|
this.$refs.scanPopup.packGetFocus(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
getScanResult(result) { |
||||
|
try { |
||||
|
var packingNumber = result.balance.packingNumber; |
||||
|
var batch = result.balance.batch; |
||||
|
var qty = result.balance.qty; |
||||
|
var itemCode = result.balance.itemCode; |
||||
|
var inventoryStatus = result.balance.inventoryStatus; |
||||
|
var detail = this.detailSource.find(r => r.itemCode == itemCode); |
||||
|
//检查物料号是否存在 |
||||
|
if (detail == undefined) { |
||||
|
//物料号不存在,创建物料号数据添加到列表。设置为已经扫描 |
||||
|
this.addNewItemCodeToList(result) |
||||
|
} else { |
||||
|
//物料号存在,查询是否在任务列表中 |
||||
|
|
||||
|
this.itemEditInfo = detail.subList.find(item => { |
||||
|
if (item.packingNumber == packingNumber && |
||||
|
item.batch == batch && |
||||
|
item.inventoryStatus == inventoryStatus) { |
||||
|
return item; |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
if (this.itemEditInfo == undefined) { |
||||
|
//不在任务列表中,提示是否添加到列表 |
||||
|
this.addExistItemCodeToList(); |
||||
|
} else { |
||||
|
//在列表中,更新已扫描状态, |
||||
|
if (this.itemEditInfo.scaned) { |
||||
|
this.$refs.comMessage.showSelectMessageModal("箱码【" + packingNumber + "】已经完成盘点,是否要编辑数量", |
||||
|
res => { |
||||
|
if (res) { |
||||
|
this.$refs.CountQtyEdit.openEditPopup(this.itemEditInfo, |
||||
|
detail.subList); |
||||
|
} else { |
||||
|
this.scanPopupGetFocus(); |
||||
|
} |
||||
|
}) |
||||
|
} else { |
||||
|
this.itemEditInfo.scaned = true; |
||||
|
this.itemEditInfo.stdPackQty = result.package.stdPackQty; |
||||
|
this.itemEditInfo.stdPackUnit = result.package.stdPackUnit; |
||||
|
this.itemEditInfo.record = this.createRecordInfo(this.itemEditInfo, result.balance); |
||||
|
this.$refs.CountQtyEdit.openEditPopupShowSeconds(this.itemEditInfo); |
||||
|
this.calcHandleQty(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} catch (e) { |
||||
|
this.showErrorMessage(e.message) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
addNewItemCodeToList(result) { |
||||
|
var item = this.createAddItemInfo(result.balance, result.package); |
||||
|
let newDetail = this.createAddDetailInfo(result.balance, result.package); // |
||||
|
item.subList.push(newDetail); |
||||
|
this.detailSource.push(item) |
||||
|
}, |
||||
|
|
||||
|
createRecordInfo(detail, balance) { |
||||
|
var record = {} |
||||
|
detail.scaned = true; |
||||
|
detail.balanceQty = Number(balance.qty); |
||||
|
detail.inventoryStatus = balance.inventoryStatus; |
||||
|
// let record = JSON.parse(JSON.stringify(detail)); |
||||
|
//克隆对象,深度克隆,防止双向绑定同一个变量 |
||||
|
Object.assign(record, detail) |
||||
|
record.fromLocationCode = this.fromLocationCode; |
||||
|
return record; |
||||
|
}, |
||||
|
addExistItemCodeToList(detail, result) { |
||||
|
detail.qty = calc.add(detail.qty,detail.qty) |
||||
|
let newDetail = this.createAddDetailInfo(result.balance, result.package); // |
||||
|
detail.subList.push(newDetail); |
||||
|
}, |
||||
|
|
||||
|
createAddItemInfo(balance, pack) { |
||||
|
let item = { |
||||
|
itemCode: balance.itemCode, |
||||
|
itemName: pack.itemName, |
||||
|
stdPackQty: pack.stdPackQty, |
||||
|
stdPackUnit: pack.stdPackUnit, |
||||
|
qty: balance.qty, |
||||
|
handleQty: 0, |
||||
|
uom: pack.uom, |
||||
|
subList: [] |
||||
|
} |
||||
|
return item; |
||||
|
}, |
||||
|
|
||||
|
createAddDetailInfo(balance, pack) { |
||||
|
var detail = { |
||||
|
scaned: true, |
||||
|
balanceQty: balance.qty, |
||||
|
toInventoryStatus: balance.inventoryStatus, |
||||
|
fromLocationCode: balance.locationCode, |
||||
|
id: "", |
||||
|
countDetailNumber: "", |
||||
|
ownerCode: balance.OwnerCode, |
||||
|
packingNumber: balance.packingNumber, |
||||
|
containerNumber: pack.containerNumber, |
||||
|
batch: balance.batch, |
||||
|
inventoryStatus: balance.inventoryStatus, |
||||
|
itemCode: balance.itemCode, |
||||
|
itemName: pack.itemName, |
||||
|
itemDesc1: pack.itemDesc1, |
||||
|
itemDesc2: pack.itemDesc2, |
||||
|
projectCode: "", |
||||
|
qty: balance.qty, |
||||
|
uom: balance.uom, |
||||
|
masterID: "", |
||||
|
Number: "", |
||||
|
remark: "", |
||||
|
creationTime: "", |
||||
|
creatorId: "", |
||||
|
creatorName: "", |
||||
|
siteId: "" |
||||
|
} |
||||
|
|
||||
|
return detail; |
||||
|
}, |
||||
|
|
||||
|
editItem(val) { |
||||
|
var detail = this.detailSource.find(r => r.itemCode == val.itemCode); |
||||
|
this.$refs.CountQtyEdit.openEditPopup(val, |
||||
|
detail.subList); |
||||
|
}, |
||||
|
|
||||
|
editConfirm() { |
||||
|
this.calcHandleQty(); |
||||
|
this.scanPopupGetFocus(); |
||||
|
}, |
||||
|
|
||||
|
scanLocationCode(location, code) { |
||||
|
this.$refs.comMessage.showQuestionMessage("是否把所有的目标库位都变成默认库位[" + code + "]", res => { |
||||
|
this.toLocationCode = code |
||||
|
this.detailSource.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
detail.toLocationCode = code |
||||
|
}) |
||||
|
}) |
||||
|
}) |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
commit() { |
||||
|
if (this.fromLocationCode == "") { |
||||
|
this.showMessage("请先选择目标库位") |
||||
|
return; |
||||
|
} |
||||
|
//允许部分提交 |
||||
|
if (this.jobContent.allowPartialComplete == "TRUE") { |
||||
|
uni.showLoading({ |
||||
|
title: "提交中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
|
||||
|
var params = this.setParams(); |
||||
|
console.log("提交" + JSON.stringify(params)) |
||||
|
// (this.id, params).then(res => { |
||||
|
// uni.hideLoading() |
||||
|
// if (res.data) { |
||||
|
// var hint = res.data.Number; |
||||
|
// this.showCommitSuccessMessage("提交成功" + hint, ) |
||||
|
|
||||
|
// } else { |
||||
|
// this.showErrorMessage("提交失败[" + res.msg + "]") |
||||
|
// } |
||||
|
// }).catch(error => { |
||||
|
// uni.hideLoading() |
||||
|
// this.showErrorMessage(error) |
||||
|
// }) |
||||
|
} else { |
||||
|
this.calcScanCount(); |
||||
|
if (this.scanCount < this.subList.length) { |
||||
|
this.showMessage('请完成扫描后,再进行提交<br>' + "已经扫描[" + this.scanCount + "]总共[" + this.subList.length + |
||||
|
"]"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
setParams() { |
||||
|
var params = { |
||||
|
requestNumber: this.jobContent.requestNumber, |
||||
|
jobNumber: "", |
||||
|
asnNumber: this.jobContent.asnNumber, |
||||
|
ppNumber: this.jobContent.ppNumber, |
||||
|
supplierCode: this.jobContent.supplierCode, |
||||
|
receiptDock: this.jobContent.receiptDock, |
||||
|
carrierCode: this.jobContent.carrierCode, |
||||
|
transferMode: this.jobContent.transferMode, |
||||
|
vehiclePlateNumber: this.jobContent.vehiclePlateNumber, |
||||
|
fromWarehouseCode: this.toLocationInfo.WarehouseCode, |
||||
|
toWarehouseCode: this.toLocationInfo.warehouseCode, |
||||
|
outTransaction: this.businessTypeInfo.outTransactionType, //出库事务类型 |
||||
|
inTransaction: this.businessTypeInfo.inTransactionType, //入库事务类型 |
||||
|
executeTime: "2023-08-4 16:30:11", //执行时间 |
||||
|
activeDate: "2023-08-4 16:30:11", //生效时间 |
||||
|
available: "1", //是否可用 0不可用,1可用 |
||||
|
requestTime: this.jobContent.requestTime, |
||||
|
dueTime: "2023-08-4 16:30:11", //截止时间 |
||||
|
departmentCode: this.jobContent.departmentCode, |
||||
|
userPositionCode: "", //岗位 |
||||
|
interfaceType: "jklxPURCHASE_RECEIPT", //接口类型 |
||||
|
number: this.jobContent.number, |
||||
|
businessType: this.jobContent.businessType, |
||||
|
remark: this.jobContent.remark, |
||||
|
creationTime: this.jobContent.creationTime, |
||||
|
creatorld: this.jobContent.creatorld, |
||||
|
creatorName: this.jobContent.creatorName, |
||||
|
extraProperties: this.jobContent.extraProperties, |
||||
|
siteld: this.jobContent.siteld, |
||||
|
code: "", |
||||
|
subList: [ |
||||
|
|
||||
|
], |
||||
|
} |
||||
|
|
||||
|
this.detailSource.forEach(res => { |
||||
|
res.subList.forEach(res1 => { |
||||
|
if (res1.scaned) { |
||||
|
res1.FromLocationGroupCode = ""; |
||||
|
res1.FromAreaCode = ""; |
||||
|
res1.ToLocationGroupCode = this.toLocationInfo.LocationGroupCode; |
||||
|
res1.ToAreaCode = this.toLocationInfo.AreaCode; |
||||
|
res1.VisualInspectResult = ""; //目检结果 |
||||
|
res1.VisualInspectPhotos = ""; //目检照片 |
||||
|
res1.FailedReason = ""; //不合格原因 |
||||
|
res1.MassDefect = ""; //质量缺陷 |
||||
|
res1.SinglePrice = ""; //单价 |
||||
|
res1.Amount = ""; //金额 |
||||
|
res1.Code = ""; |
||||
|
res1.JobDetailID = res1.id; |
||||
|
res1.interfaceType = "jklxPURCHASE_RECEIPT"; |
||||
|
params.subList.push(res1) |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
|
||||
|
return params; |
||||
|
}, |
||||
|
|
||||
|
showMessage(message) { |
||||
|
this.$refs.comMessage.showMessage(message, res => { |
||||
|
if (res) { |
||||
|
this.afterCloseMessage() |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
showErrorMessage(message) { |
||||
|
this.$refs.comMessage.showErrorMessage(message, res => { |
||||
|
if (res) { |
||||
|
this.afterCloseMessage() |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
showScanMessage(message) { |
||||
|
this.$refs.comMessage.showScanMessage(message); |
||||
|
}, |
||||
|
|
||||
|
afterCloseMessage() { |
||||
|
this.scanPopupGetFocus(); |
||||
|
}, |
||||
|
|
||||
|
closeScanMessage() { |
||||
|
this.scanPopupGetFocus(); |
||||
|
}, |
||||
|
|
||||
|
showCommitSuccessMessage(hint) { |
||||
|
this.$refs.comMessage.showSuccessMessage(hint, res => { |
||||
|
navigateBack(1) |
||||
|
}) |
||||
|
}, |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="scss"> |
||||
|
page { |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
background-color: #fff; |
||||
|
} |
||||
|
|
||||
|
.page-wraper { |
||||
|
display: flex; |
||||
|
flex-direction: column; |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
.page-main { |
||||
|
flex: 1; |
||||
|
position: relative; |
||||
|
} |
||||
|
|
||||
|
.page-main-scroll { |
||||
|
position: absolute; |
||||
|
left: 0; |
||||
|
right: 0; |
||||
|
top: 0; |
||||
|
bottom: 0; |
||||
|
} |
||||
|
|
||||
|
.page-main-list { |
||||
|
/* height: 80rpx; |
||||
|
line-height: 80rpx; */ |
||||
|
text-align: center; |
||||
|
background: #e0e0e0; |
||||
|
|
||||
|
} |
||||
|
</style> |
@ -0,0 +1,44 @@ |
|||||
|
<template> |
||||
|
<job-com-main-card :dataContent="dataContent"> |
||||
|
<view class="task_item"> |
||||
|
<view class="task_text"> |
||||
|
<view class=""> |
||||
|
申请单号 : {{dataContent.requestNumber}} |
||||
|
</view> |
||||
|
</view> |
||||
|
|
||||
|
<view class="task_text"> |
||||
|
<view class=""> |
||||
|
客户代码 : {{dataContent.customerCode}} |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</job-com-main-card> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import jobComMainCard from '@/mycomponents/job/jobComMainCard.vue' |
||||
|
export default { |
||||
|
components: { |
||||
|
jobComMainCard, |
||||
|
}, |
||||
|
data() { |
||||
|
return {}; |
||||
|
}, |
||||
|
|
||||
|
props: { |
||||
|
dataContent: { |
||||
|
type: Object, |
||||
|
default: {} |
||||
|
}, |
||||
|
}, |
||||
|
|
||||
|
methods: { |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss"> |
||||
|
|
||||
|
</style> |
@ -0,0 +1,172 @@ |
|||||
|
<template> |
||||
|
<view class="" style="background-color: #fff;"> |
||||
|
<uni-collapse ref="collapse1" @change=""> |
||||
|
<uni-collapse-item :open="true"> |
||||
|
<template v-slot:title> |
||||
|
<uni-swipe-action ref="swipeAction"> |
||||
|
<uni-swipe-action-item @click="removeData($event,dataContent)" :right-options="removeOptions"> |
||||
|
<item-qty :dataContent="dataContent" |
||||
|
:isShowBalance="true"></item-qty> |
||||
|
</uni-swipe-action-item> |
||||
|
</uni-swipe-action> |
||||
|
|
||||
|
</template> |
||||
|
<u-line /> |
||||
|
<view class="" v-for="(item,index) in dataContent.subList"> |
||||
|
<uni-swipe-action ref="swipeAction"> |
||||
|
<uni-swipe-action-item @click="swipeClick($event,item,index)" |
||||
|
:right-options="item.scaned?scanOptions:detailOptions"> |
||||
|
<production-label :dataContent="item" :packageContent="item.package"> |
||||
|
</production-label> |
||||
|
</uni-swipe-action-item> |
||||
|
</uni-swipe-action> |
||||
|
<u-line color="#D8D8D8"></u-line> |
||||
|
</view> |
||||
|
</uni-collapse-item> |
||||
|
</uni-collapse> |
||||
|
<balanceQtyEdit ref="balanceQtyEdit" @confirm="confirm" :isShowStatus="true" :allowEditStatus="false"> |
||||
|
</balanceQtyEdit> |
||||
|
<job-detail-popup ref="winHint" :dataContent="showItem"></job-detail-popup> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import itemQty from '@/mycomponents/item/itemQty.vue' |
||||
|
import recommend from '@/mycomponents/recommend/recommend.vue' |
||||
|
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue' |
||||
|
import productionLabel from '@/mycomponents/balance/productionLabel.vue' |
||||
|
import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue' |
||||
|
|
||||
|
import { |
||||
|
getDetailOption, |
||||
|
getDetailEditRemoveOption, |
||||
|
getClearOption |
||||
|
} from '@/common/array.js'; |
||||
|
export default { |
||||
|
components: { |
||||
|
itemQty, |
||||
|
recommend, |
||||
|
jobDetailPopup, |
||||
|
balanceQtyEdit, |
||||
|
productionLabel, |
||||
|
}, |
||||
|
props: { |
||||
|
dataContent: { |
||||
|
type: Object, |
||||
|
default: {} |
||||
|
}, |
||||
|
settingParam: { |
||||
|
type: Object, |
||||
|
default: {} |
||||
|
}, |
||||
|
}, |
||||
|
watch: { |
||||
|
dataContent: { |
||||
|
handler(newName, oldName) { |
||||
|
if (this.dataContent.subList.length > 0) { |
||||
|
if (this.$refs.collapse1 != undefined) { |
||||
|
this.$nextTick(res => { |
||||
|
this.$refs.collapse1.resize() |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
}, |
||||
|
immediate: true, |
||||
|
deep: true |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
data() { |
||||
|
return { |
||||
|
option: [], |
||||
|
title: "推荐详情", |
||||
|
showItem: {}, |
||||
|
editItem: {}, |
||||
|
detailOptions: [], |
||||
|
scanOptions: [], |
||||
|
removeOptions: [], |
||||
|
dataList: [] |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
mounted() { |
||||
|
this.detailOptions = getDetailOption(); |
||||
|
this.scanOptions = getDetailEditRemoveOption(); |
||||
|
this.removeOptions = getClearOption(); |
||||
|
}, |
||||
|
|
||||
|
methods: { |
||||
|
removeData(e, dataContent) { |
||||
|
if (e.content.text == "清空") { |
||||
|
this.$refs.comMessage.showQuestionMessage("确定清空物料及箱码信息?", |
||||
|
res => { |
||||
|
if (res) { |
||||
|
this.$emit('removeItem') |
||||
|
// this.$emit('removeItem', this.dataContent) |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
}, |
||||
|
swipeClick(e, item, index) { |
||||
|
if (e.content.text == "详情") { |
||||
|
this.detail(item) |
||||
|
} else if (e.content.text == "编辑") { |
||||
|
this.edit(item) |
||||
|
} else if (e.content.text == "移除") { |
||||
|
this.remove(item, index) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
edit(item) { |
||||
|
this.editItem = item; |
||||
|
this.$refs.balanceQtyEdit.openEditPopup(this.editItem, this.editItem.qty); |
||||
|
}, |
||||
|
|
||||
|
detail(item) { |
||||
|
this.showItem = item; |
||||
|
this.dataList = [ |
||||
|
|
||||
|
{ |
||||
|
title: "箱码", |
||||
|
content: item.packingNumber |
||||
|
}, |
||||
|
{ |
||||
|
title: "批次", |
||||
|
content: item.batch |
||||
|
}, |
||||
|
{ |
||||
|
title: "库位", |
||||
|
content: item.locationCode |
||||
|
}, |
||||
|
{ |
||||
|
title: "数量", |
||||
|
content: item.qty |
||||
|
}, |
||||
|
{ |
||||
|
title: "单位", |
||||
|
content: item.uom |
||||
|
} |
||||
|
] |
||||
|
this.$refs.winHint.openScanPopup() |
||||
|
}, |
||||
|
remove(item, index) { |
||||
|
this.$refs.comMessage.showQuestionMessage("确定移除扫描信息?", |
||||
|
res => { |
||||
|
if (res) { |
||||
|
this.dataContent.subList.splice(index, 1) |
||||
|
this.$emit('removePack') |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
confirm(qty) { |
||||
|
this.editItem.qty = qty; |
||||
|
this.$emit('updateData') |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
</style> |
@ -0,0 +1,39 @@ |
|||||
|
<template> |
||||
|
<request-com-main-card :dataContent="dataContent"> |
||||
|
<view class="task_item"> |
||||
|
<!-- <view class="task_text"> |
||||
|
申请单号 : {{dataContent.requestNumber}} |
||||
|
</view> --> |
||||
|
<view class="task_text"> |
||||
|
客户代码 : {{dataContent.customerCode}} |
||||
|
</view> |
||||
|
</view> |
||||
|
</request-com-main-card> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import requestComMainCard from '@/mycomponents/request/requestComMainCard.vue' |
||||
|
export default { |
||||
|
components: { |
||||
|
requestComMainCard, |
||||
|
}, |
||||
|
data() { |
||||
|
return {}; |
||||
|
}, |
||||
|
|
||||
|
props: { |
||||
|
dataContent: { |
||||
|
type: Object, |
||||
|
default: {} |
||||
|
}, |
||||
|
}, |
||||
|
|
||||
|
methods: { |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss"> |
||||
|
|
||||
|
</style> |
@ -0,0 +1,57 @@ |
|||||
|
<template> |
||||
|
<view class=""> |
||||
|
<uni-popup ref="popup"> |
||||
|
<detail-common-info :dataContent="dataContent" @onClose="closePopup"> |
||||
|
<view class=""> |
||||
|
<view class="uni-flex uni-column"> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">销售订单号 : </text> |
||||
|
<text class="text_wrap">{{dataContent.SoNumber}} </text> |
||||
|
</view> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">销售订单行 : </text> |
||||
|
<text class="text_wrap">{{dataContent.SoLine}} </text> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</detail-common-info> |
||||
|
</uni-popup> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import detailCommonInfo from '@/mycomponents/detail/detailCommonInfo.vue' |
||||
|
export default { |
||||
|
components: { |
||||
|
detailCommonInfo |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
dataContent: { |
||||
|
type: Object, |
||||
|
default: {} |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
mounted() {}, |
||||
|
props: {}, |
||||
|
|
||||
|
methods: { |
||||
|
openPopup(val) { |
||||
|
this.dataContent = val; |
||||
|
setTimeout(res => { |
||||
|
this.$refs.popup.open('bottom') |
||||
|
}, 500) |
||||
|
}, |
||||
|
closePopup() { |
||||
|
this.$refs.popup.close() |
||||
|
}, |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
|
||||
|
|
||||
|
</style> |
@ -0,0 +1,78 @@ |
|||||
|
<template> |
||||
|
<view class=""> |
||||
|
<uni-popup ref="popup"> |
||||
|
<job-common-info :dataContent="dataContent" @onClose="closePopup"> |
||||
|
<view class=""> |
||||
|
<view class="uni-flex uni-column"> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">发货记录单号 : </text> |
||||
|
<text class="text_wrap">{{dataContent.deliverRecordNumber}} </text> |
||||
|
</view> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">发货计划单号 : </text> |
||||
|
<text class="text_wrap">{{dataContent.deliverPlanNumber}} </text> |
||||
|
</view> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">客户代码 : </text> |
||||
|
<text class="text_wrap">{{dataContent.customerCode}} </text> |
||||
|
</view> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">客户月台代码 : </text> |
||||
|
<text class="text_wrap">{{dataContent.customerDockCode}} </text> |
||||
|
</view> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">承运商 : </text> |
||||
|
<text class="text_wrap">{{dataContent.carrierCode}} </text> |
||||
|
</view> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">运输方式 : </text> |
||||
|
<text class="text_wrap">{{dataContent.transferMode}} </text> |
||||
|
</view> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">车牌号 : </text> |
||||
|
<text class="text_wrap">{{dataContent.vehiclePlateNumber}} </text> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
<u-line></u-line> |
||||
|
</job-common-info> |
||||
|
</uni-popup> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import jobCommonInfo from '@/mycomponents/job/jobCommonInfo.vue' |
||||
|
export default { |
||||
|
components: { |
||||
|
jobCommonInfo, |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
dataContent: { |
||||
|
type: Object, |
||||
|
default: {} |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
mounted() {}, |
||||
|
props: {}, |
||||
|
|
||||
|
methods: { |
||||
|
openPopup(val) { |
||||
|
this.dataContent = val; |
||||
|
setTimeout(res => { |
||||
|
this.$refs.popup.open('bottom') |
||||
|
}, 500) |
||||
|
}, |
||||
|
closePopup() { |
||||
|
this.$refs.popup.close() |
||||
|
}, |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
|
||||
|
|
||||
|
</style> |
@ -0,0 +1,47 @@ |
|||||
|
<template> |
||||
|
<uni-popup ref="popupItems"> |
||||
|
<com-popup @onClose="closePopup"> |
||||
|
<view v-for="(item, index) in receiptList" :key="index"> |
||||
|
<com-return-job-card :dataContent="item" @click='selectItem(item)'></com-return-job-card> |
||||
|
<u-line></u-line> |
||||
|
</view> |
||||
|
</com-popup> |
||||
|
</uni-popup> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import comPopup from '@/mycomponents/common/comPopup.vue' |
||||
|
import comReturnJobCard from '@/pages/productionReturn/coms/comReturnJobCard.vue' |
||||
|
|
||||
|
export default { |
||||
|
emits: ["selectedItem"], |
||||
|
components: { |
||||
|
comPopup, |
||||
|
comReturnJobCard |
||||
|
}, |
||||
|
props: { |
||||
|
|
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
receiptList: [] |
||||
|
} |
||||
|
}, |
||||
|
methods: { |
||||
|
openPopup(items) { |
||||
|
this.receiptList = items; |
||||
|
this.$refs['popupItems'].open("center"); |
||||
|
}, |
||||
|
closePopup() { |
||||
|
this.$refs.popupItems.close() |
||||
|
}, |
||||
|
selectItem(item) { |
||||
|
this.$emit("selectedItem", item); |
||||
|
this.$refs['popupItems'].close(); |
||||
|
}, |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
</style> |
@ -0,0 +1,87 @@ |
|||||
|
<template> |
||||
|
<view class=""> |
||||
|
<uni-popup ref="popup"> |
||||
|
<requestDetailCommonInfo :dataContent="dataContent" @onClose="closePopup"> |
||||
|
<view class=""> |
||||
|
<view class="uni-flex uni-column"> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">销售订单号 : </text> |
||||
|
<text class="text_wrap">{{dataContent.soNumber}} </text> |
||||
|
</view> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">销售订单行 : </text> |
||||
|
<text class="text_wrap">{{dataContent.soLine}} </text> |
||||
|
</view> |
||||
|
|
||||
|
<view class="item"> |
||||
|
<text class="item_title">包装号 : </text> |
||||
|
<text class="text_wrap">{{dataContent.packingNumber}} </text> |
||||
|
</view> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">器具号 : </text> |
||||
|
<text class="text_wrap">{{dataContent.containerNumber}} </text> |
||||
|
</view> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">批次 : </text> |
||||
|
<text class="text_wrap">{{dataContent.batch}} </text> |
||||
|
</view> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">库存状态 : </text> |
||||
|
<text class="text_wrap">{{dataContent.inventoryStatus}} </text> |
||||
|
</view> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">从库位代码 : </text> |
||||
|
<text class="text_wrap">{{dataContent.fromLocationCode}} </text> |
||||
|
</view> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">从货主代码 : </text> |
||||
|
<text class="text_wrap">{{dataContent.fromOwnerCode}} </text> |
||||
|
</view> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">到货主代码 : </text> |
||||
|
<text class="text_wrap">{{dataContent.toOwnerCode}} </text> |
||||
|
</view> |
||||
|
|
||||
|
</view> |
||||
|
</view> |
||||
|
</requestDetailCommonInfo> |
||||
|
</uni-popup> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import requestDetailCommonInfo from '@/mycomponents/detail/requestDetailCommonInfo.vue' |
||||
|
export default { |
||||
|
components: { |
||||
|
requestDetailCommonInfo |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
dataContent: { |
||||
|
type: Object, |
||||
|
default: {} |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
mounted() {}, |
||||
|
props: {}, |
||||
|
|
||||
|
methods: { |
||||
|
openPopup(val) { |
||||
|
this.dataContent = val; |
||||
|
setTimeout(res => { |
||||
|
this.$refs.popup.open('bottom') |
||||
|
}, 500) |
||||
|
}, |
||||
|
closePopup() { |
||||
|
this.$refs.popup.close() |
||||
|
}, |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
|
||||
|
|
||||
|
</style> |
@ -0,0 +1,105 @@ |
|||||
|
<template> |
||||
|
<view class=""> |
||||
|
<uni-popup ref="popup"> |
||||
|
<request-common-info :dataContent="dataContent" @onClose="closePopup"> |
||||
|
<view class=""> |
||||
|
<comListItem :dataList="dataList"></comListItem> |
||||
|
</view> |
||||
|
<u-line></u-line> |
||||
|
</request-common-info> |
||||
|
</uni-popup> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import requestCommonInfo from '@/mycomponents/request/requestCommonInfo.vue' |
||||
|
import comListItem from '@/mycomponents/common/comListItem.vue'; |
||||
|
export default { |
||||
|
components: { |
||||
|
requestCommonInfo, |
||||
|
comListItem |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
dataContent: {}, |
||||
|
dataList:[] |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
mounted() {}, |
||||
|
props: {}, |
||||
|
|
||||
|
methods: { |
||||
|
openPopup(val) { |
||||
|
this.dataContent = val; |
||||
|
this.dataList=[{ |
||||
|
title: '申请单号', |
||||
|
content: this.dataContent.requestNumber |
||||
|
}, { |
||||
|
title: '发货记录单号', |
||||
|
content: this.dataContent.deliverRecordNumber |
||||
|
},{ |
||||
|
title: '发货计划单号', |
||||
|
content: this.dataContent.deliverPlanNumber, |
||||
|
},{ |
||||
|
title: '客户代码', |
||||
|
content: this.dataContent.customerCode, |
||||
|
},{ |
||||
|
title: '客户月台代码', |
||||
|
content: this.dataContent.customerDockCode, |
||||
|
},{ |
||||
|
title: '承运商', |
||||
|
content: this.dataContent.carrierCode, |
||||
|
},{ |
||||
|
title: '运输方式', |
||||
|
content: this.dataContent.transferMode, |
||||
|
}, |
||||
|
{ |
||||
|
title: '车牌号', |
||||
|
content: this.dataContent.vehiclePlateNumber, |
||||
|
}, |
||||
|
{ |
||||
|
title: '从仓库代码', |
||||
|
content: this.dataContent.fromWarehouseCode, |
||||
|
}, |
||||
|
{ |
||||
|
title: '到仓库代码', |
||||
|
content: this.dataContent.toWarehouseCode, |
||||
|
}, |
||||
|
{ |
||||
|
title: '从库位类型范围', |
||||
|
content: this.dataContent.fromLocationTypes, |
||||
|
type:"locationType" |
||||
|
}, |
||||
|
{ |
||||
|
title: '到库位类型范围', |
||||
|
content: this.dataContent.toLocationTypes, |
||||
|
type:"locationType" |
||||
|
}, |
||||
|
{ |
||||
|
title: '从库区代码范围', |
||||
|
content: this.dataContent.fromAreaCodes, |
||||
|
}, |
||||
|
{ |
||||
|
title: '到库区代码范围', |
||||
|
content: this.dataContent.toAreaCodes, |
||||
|
}, |
||||
|
{ |
||||
|
title: '到月台代码', |
||||
|
content: this.dataContent.toDockCode, |
||||
|
}]; |
||||
|
setTimeout(res => { |
||||
|
this.$refs.popup.open('bottom') |
||||
|
}, 500) |
||||
|
}, |
||||
|
closePopup() { |
||||
|
this.$refs.popup.close() |
||||
|
}, |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
|
||||
|
|
||||
|
</style> |
@ -0,0 +1,538 @@ |
|||||
|
<template> |
||||
|
<view class="page-wraper"> |
||||
|
<view class="page-main"> |
||||
|
<scroll-view scroll-y="true" class="page-main-scroll"> |
||||
|
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> |
||||
|
<view class=""> |
||||
|
<com-detail-card :dataContent="item" :settingParam="jobContent" :isShowLocation="false" |
||||
|
@remove="updateData" @updateData="updateData" @openDetail="openDetail" |
||||
|
:locationTypeList="tolocationTypeList"> |
||||
|
</com-detail-card> |
||||
|
</view> |
||||
|
<u-line /> |
||||
|
</view> |
||||
|
</scroll-view> |
||||
|
</view> |
||||
|
|
||||
|
<view class="page-footer"> |
||||
|
<view class="uni-flex u-col-center space-between padding_10" |
||||
|
style="background-color:ghostwhite; width: 100%; "> |
||||
|
<view class=""> |
||||
|
<requiredLocation ref='comScanLocation' title="目标库位" :locationCode="toLocationCode" |
||||
|
@getLocation='scanLocationCode' :isShowEdit="jobContent.allowModifyLocation == 'TRUE'" |
||||
|
:locationTypeList="tolocationTypeList"></requiredLocation> |
||||
|
</view> |
||||
|
<view class=" uni-flex uni-row"> |
||||
|
<button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
|
||||
|
<win-scan-button @goScan='openScanPopup'></win-scan-button> |
||||
|
<win-scan-pack-and-location ref="scanPopup" @getResult='getScanResult'></win-scan-pack-and-location> |
||||
|
<detail-info-popup ref="detailInfoPopup"></detail-info-popup> |
||||
|
|
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { |
||||
|
getManagementPrecisions |
||||
|
} from '@/common/balance.js'; |
||||
|
|
||||
|
import { |
||||
|
getCustomerReturnJobDetail, |
||||
|
getBasicLocationByCode, |
||||
|
takeCustomerReturnJob, |
||||
|
cancleTakeCustomerReturnJob, |
||||
|
customerReturnJobSubmit |
||||
|
} from '@/api/request2.js'; |
||||
|
import { |
||||
|
goHome, |
||||
|
navigateBack, |
||||
|
getPackingNumberAndBatch, |
||||
|
getInventoryStatusName, |
||||
|
getDirectoryItemArray |
||||
|
} from '@/common/basic.js'; |
||||
|
|
||||
|
import { |
||||
|
getDataSource, |
||||
|
createRecordInfo, |
||||
|
calcHandleQty, |
||||
|
getScanCount |
||||
|
} from '@/common/detail.js'; |
||||
|
|
||||
|
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
||||
|
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue" |
||||
|
import requiredLocation from '@/mycomponents/location/requiredLocation.vue' |
||||
|
import comDetailCard from "@/mycomponents/detail/comDetailCard.vue" |
||||
|
import detailInfoPopup from '@/pages/customerReturn/coms/detailInfoPopup.vue' |
||||
|
|
||||
|
export default { |
||||
|
components: { |
||||
|
winScanButton, |
||||
|
winScanPackAndLocation, |
||||
|
requiredLocation, |
||||
|
comDetailCard, |
||||
|
detailInfoPopup |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
id: '', |
||||
|
scanCount: 0, |
||||
|
jobContent: {}, //任务内容 |
||||
|
subList: [], //接口返回的任务subList |
||||
|
detailSource: [], //绑定在页面上的数据源 |
||||
|
managementList: [], |
||||
|
fromLocationCode: "", |
||||
|
toLocationCode: "", |
||||
|
toLocationInfo: {}, |
||||
|
tolocationTypeList: [], |
||||
|
jobStatus:"" |
||||
|
}; |
||||
|
}, |
||||
|
onLoad(option) { |
||||
|
this.id = option.id; |
||||
|
if (this.id != undefined) { |
||||
|
//新建的任务自动接收 |
||||
|
if (option.status == "1") { |
||||
|
this.receive((callback => { |
||||
|
this.getDetail(); |
||||
|
})); |
||||
|
} else { |
||||
|
this.getDetail(); |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
//返回首页 |
||||
|
onNavigationBarButtonTap(e) { |
||||
|
if (e.index === 0) { |
||||
|
goHome(); |
||||
|
} |
||||
|
}, |
||||
|
//拦截返回按钮事件 |
||||
|
onBackPress(e) { |
||||
|
//已经接收但是没提交任务 |
||||
|
if (e.from == 'backbutton') { |
||||
|
if (this.jobStatus=="2") { |
||||
|
//取消承接任务 |
||||
|
cancleTakeCustomerReturnJob(this.id).then(res => { |
||||
|
uni.navigateBack(); |
||||
|
}).catch(error => { |
||||
|
uni.navigateBack(); |
||||
|
}) |
||||
|
} else { |
||||
|
uni.navigateBack(); |
||||
|
} |
||||
|
|
||||
|
return true; |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
onPullDownRefresh() { |
||||
|
this.getDetail(); |
||||
|
uni.stopPullDownRefresh(); |
||||
|
}, |
||||
|
|
||||
|
mounted() { |
||||
|
|
||||
|
}, |
||||
|
methods: { |
||||
|
//接收 |
||||
|
receive(callback) { |
||||
|
if (this.id != null) { |
||||
|
takeCustomerReturnJob(this.id).then(res => { |
||||
|
callback(); |
||||
|
}).catch(error => { |
||||
|
this.showErrorMessage(error) |
||||
|
}) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
getDetail() { |
||||
|
var that = this; |
||||
|
uni.showLoading({ |
||||
|
title: "加载中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
getCustomerReturnJobDetail(that.id).then(res => { |
||||
|
uni.hideLoading(); |
||||
|
if (res.data == null) { |
||||
|
that.showMessage('未获取到详情'); |
||||
|
} else { |
||||
|
if (res.data.subList.length > 0) { |
||||
|
that.jobContent = res.data; |
||||
|
that.subList = res.data.subList; |
||||
|
that.jobStatus = res.data.status |
||||
|
|
||||
|
that.detailSource = getDataSource(that.subList) |
||||
|
that.fromLocationCode = that.subList[0].fromLocationCode |
||||
|
that.toLocationCode = that.subList[0].toLocationCode |
||||
|
that.tolocationTypeList = getDirectoryItemArray(that.jobContent.toLocationTypes) |
||||
|
|
||||
|
that.getLocationInfo(that.toLocationCode); |
||||
|
} else { |
||||
|
that.showMessage('列表数据为0'); |
||||
|
} |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
uni.hideLoading() |
||||
|
this.showErrorMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
getLocationInfo(locationCode) { |
||||
|
if (locationCode != '') { |
||||
|
getBasicLocationByCode(locationCode).then(res => { |
||||
|
if (res.data.list.length > 0) { |
||||
|
this.toLocationInfo = res.data.list[0] |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
calcHandleQty() { |
||||
|
calcHandleQty(this.detailSource); |
||||
|
this.continueScan(); |
||||
|
this.$forceUpdate(); |
||||
|
}, |
||||
|
|
||||
|
//继续扫描 |
||||
|
continueScan() { |
||||
|
this.scanCount = getScanCount(this.subList); |
||||
|
if (this.scanCount == this.subList.length) { |
||||
|
this.closeScanPopup(); |
||||
|
} else { |
||||
|
this.scanPopupGetFocus(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
updateData() { |
||||
|
this.calcHandleQty(); |
||||
|
}, |
||||
|
|
||||
|
openDetail(item) { |
||||
|
this.$refs.detailInfoPopup.openPopup(item) |
||||
|
}, |
||||
|
|
||||
|
openScanPopup() { |
||||
|
let fromlocationCode = ''; |
||||
|
let fromlocationList = []; |
||||
|
for (var i = 0; i < this.detailSource.length; i++) { |
||||
|
let item = this.detailSource[i]; |
||||
|
item.subList.forEach(l => { |
||||
|
//重复的库位不往里面插入 |
||||
|
var location = fromlocationList.find(res => res == l.fromLocationCode) |
||||
|
if (location == undefined) { |
||||
|
fromlocationList.push(l.fromLocationCode); |
||||
|
} |
||||
|
//来源库位赋默认值 |
||||
|
if (fromlocationCode == '') { |
||||
|
if (!l.scaned) { |
||||
|
fromlocationCode = l.fromLocationCode; |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
this.$refs.scanPopup.openScanPopupForJob(fromlocationCode, fromlocationList, this.jobContent); |
||||
|
}, |
||||
|
|
||||
|
closeScanPopup() { |
||||
|
this.$refs.scanPopup.closeScanPopup(); |
||||
|
}, |
||||
|
|
||||
|
getScanResult(result) { |
||||
|
try { |
||||
|
var packingNumber = result.balance.packingNumber; |
||||
|
var batch = result.balance.batch; |
||||
|
var qty = result.balance.qty; |
||||
|
var itemCode = result.balance.itemCode; |
||||
|
var locationCode = result.balance.locationCode; |
||||
|
var inventoryStatus = result.balance.inventoryStatus; |
||||
|
var detail = this.detailSource.find(r => r.itemCode == itemCode); |
||||
|
|
||||
|
if (detail == undefined) { |
||||
|
this.showErrorMessage("物料号【" + itemCode + "】不在列表中") |
||||
|
} else { |
||||
|
var itemDetail = detail.subList.find(r => { |
||||
|
return r.packingNumber == packingNumber && |
||||
|
r.batch == batch |
||||
|
}) |
||||
|
if (itemDetail == undefined) { |
||||
|
this.showErrorMessage("箱码[" + packingNumber + "]" + "批次[" + batch + "]不在列表中") |
||||
|
} else { |
||||
|
if (itemDetail.scaned) { |
||||
|
this.showErrorMessage("箱码[" + packingNumber + "]" + "批次[" + batch + "]已经扫描") |
||||
|
} else { |
||||
|
let balanceStatus = getInventoryStatusName(result.balance.inventoryStatus); |
||||
|
let itemStatus = getInventoryStatusName(itemDetail.inventoryStatus); |
||||
|
|
||||
|
|
||||
|
if (itemDetail.inventoryStatus != result.balance.inventoryStatus) { |
||||
|
if(this.jobContent.allowModifyInventoryStatus=="TRUE"){ |
||||
|
this.showQuestionMessage('实际库存状态[' + balanceStatus + ']与推荐库存状态[' + itemStatus + |
||||
|
']不一致,是否继续退货?', res => { |
||||
|
if (res) { |
||||
|
itemDetail.scaned = true; |
||||
|
itemDetail.handleQty = Number(result.balance.qty) |
||||
|
itemDetail.inventoryStatus = result.balance.inventoryStatus; |
||||
|
itemDetail.balance = result.balance; |
||||
|
itemDetail.balance.balanceQty = Number(result.balance.qty) |
||||
|
itemDetail.balance.stdPackQty = Number(result.package.stdPackQty) |
||||
|
itemDetail.balance.stdPackUnit = result.package.stdPackUnit |
||||
|
this.calcHandleQty(); |
||||
|
} else { |
||||
|
this.scanPopupGetFocus(); |
||||
|
} |
||||
|
}); |
||||
|
}else { |
||||
|
this.showQuestionMessage('任务中不允许修改库存状态,实际库存状态[' + balanceStatus + ']与推荐库存状态[' + itemStatus + |
||||
|
']不一致,不允许转移!', res => { |
||||
|
this.scanPopupGetFocus(); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
} else { |
||||
|
itemDetail.scaned = true; |
||||
|
itemDetail.handleQty = Number(result.balance.qty) |
||||
|
itemDetail.toInventoryStatus = result.balance.inventoryStatus; |
||||
|
itemDetail.balance = result.balance; |
||||
|
itemDetail.balance.balanceQty = Number(result.balance.qty) |
||||
|
itemDetail.balance.stdPackQty = Number(result.package.stdPackQty) |
||||
|
itemDetail.balance.stdPackUnit = result.package.stdPackUnit |
||||
|
this.calcHandleQty(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} catch (e) { |
||||
|
this.showMessage(e.message) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
scanLocationCode(location, code) { |
||||
|
this.$refs.comMessage.showQuestionMessage("是否把所有的目标库位都变成默认库位[" + code + "]", res => { |
||||
|
this.toLocationCode = code |
||||
|
this.detailSource.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
detail.toLocationCode = code |
||||
|
}) |
||||
|
}) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
commit() { |
||||
|
this.scanCount = getScanCount(this.subList); |
||||
|
if (this.scanCount == 0) { |
||||
|
this.showErrorMessage("扫描数为0,请先扫描") |
||||
|
return; |
||||
|
} |
||||
|
//校验库位、 |
||||
|
if (!this.checkLocation()) { |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
//扫描数量和任务数量相等,直接提交 |
||||
|
if (this.scanCount == this.subList.length) { |
||||
|
this.submitJob(); |
||||
|
} else if (this.scanCount < this.subList.length) { |
||||
|
//扫描数量小于任务数量,判断是否允许部分提交 |
||||
|
if (this.jobContent.allowPartialComplete == "TRUE") { |
||||
|
//提交 |
||||
|
this.submitJob(); |
||||
|
} else { |
||||
|
//不允许部分提交,提示 |
||||
|
this.$refs.comMessage.showErrorMessage('请完成扫描后,再进行提交<br>' + "已经扫描[" + this.scanCount + |
||||
|
"]箱总共[" + this.subList.length + "]箱", res => { |
||||
|
if (res) { |
||||
|
this.openScanPopup(); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
submitJob() { |
||||
|
uni.showLoading({ |
||||
|
title: "提交中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
var itemCodes = [] |
||||
|
this.detailSource.forEach(item => { |
||||
|
itemCodes.push(item.itemCode) |
||||
|
}) |
||||
|
|
||||
|
getManagementPrecisions(itemCodes, this.toLocationCode, res => { |
||||
|
if (res.success) { |
||||
|
this.managementList = res.list; |
||||
|
var params = this.setParams() |
||||
|
console.log("提交参数", JSON.stringify(params)); |
||||
|
customerReturnJobSubmit(params).then(res => { |
||||
|
uni.hideLoading() |
||||
|
if (res.data) { |
||||
|
this.showCommitSuccessMessage("提交成功<br>生成客户退货记录:" + res.data) |
||||
|
} else { |
||||
|
this.showErrorMessage("提交失败[" + res.msg + "]") |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
uni.hideLoading() |
||||
|
this.showErrorMessage(error) |
||||
|
}) |
||||
|
} else { |
||||
|
uni.hideLoading(); |
||||
|
this.showErrorMessage(res.message); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
setParams() { |
||||
|
var subList = [] |
||||
|
var creator = this.$store.state.user.id |
||||
|
|
||||
|
this.detailSource.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
if (detail.scaned) { |
||||
|
var info = getPackingNumberAndBatch(this.managementList, detail.itemCode, |
||||
|
detail.packingNumber, detail.batch); |
||||
|
detail.toPackingNumber = info.packingNumber; |
||||
|
detail.toContainerNumber = detail.containerNumber; |
||||
|
detail.toBatch = info.batch; |
||||
|
detail.toLocationCode = detail.toLocationCode; |
||||
|
detail.toInventoryStatus = 'HOLD'; |
||||
|
subList.push(detail) |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
this.jobContent.subList = subList |
||||
|
this.jobContent.creator = creator; |
||||
|
return this.jobContent; |
||||
|
}, |
||||
|
|
||||
|
checkLocation() { |
||||
|
var isPass = true; |
||||
|
if (this.toLocationCode == "" || this.toLocationCode == null) { |
||||
|
this.showMessageHint('请扫描收货库位', callback => { |
||||
|
this.$refs.comScanLocation.showLocation(); |
||||
|
}) |
||||
|
|
||||
|
return isPass = false; |
||||
|
} |
||||
|
return isPass; |
||||
|
}, |
||||
|
|
||||
|
showMessageHint(hint, callback) { |
||||
|
this.$refs.comMessage.showErrorMessage(hint, res => { |
||||
|
if (res) { |
||||
|
callback() |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
showMessage(message) { |
||||
|
setTimeout(r => { |
||||
|
this.scanPopupLoseFocus(); |
||||
|
this.$refs.comMessage.showMessage(message, res => { |
||||
|
if (res) { |
||||
|
this.afterCloseMessage() |
||||
|
} |
||||
|
}); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
showErrorMessage(message) { |
||||
|
setTimeout(r => { |
||||
|
this.scanPopupLoseFocus(); |
||||
|
this.$refs.comMessage.showErrorMessage(message, res => { |
||||
|
if (res) { |
||||
|
this.afterCloseMessage() |
||||
|
} |
||||
|
}); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
showQuestionMessage(message, callback) { |
||||
|
setTimeout(r => { |
||||
|
this.scanPopupLoseFocus(); |
||||
|
this.$refs.comMessage.showQuestionMessage(message, res => { |
||||
|
if (res) { |
||||
|
callback(res); |
||||
|
} |
||||
|
}); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
scanPopupGetFocus() { |
||||
|
if(this.$refs.scanPopup!=undefined){ |
||||
|
this.$refs.scanPopup.packGetFocus(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
scanPopupLoseFocus() { |
||||
|
if(this.$refs.scanPopup!=undefined){ |
||||
|
this.$refs.scanPopup.packLoseFocus(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
afterCloseMessage() { |
||||
|
this.scanPopupGetFocus(); |
||||
|
}, |
||||
|
|
||||
|
scanLocationCode(location, code) { |
||||
|
this.$refs.comMessage.showQuestionMessage("是否把所有的目标库位都变成默认库位[" + code + "]", res => { |
||||
|
this.toLocationCode = code |
||||
|
this.detailSource.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
detail.toLocationCode = code |
||||
|
}) |
||||
|
}) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
showCommitSuccessMessage(hint) { |
||||
|
this.$refs.comMessage.showSuccessMessage(hint, res => { |
||||
|
navigateBack(1) |
||||
|
}) |
||||
|
}, |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="scss"> |
||||
|
page { |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
background-color: #fff; |
||||
|
} |
||||
|
|
||||
|
.page-wraper { |
||||
|
display: flex; |
||||
|
flex-direction: column; |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
.page-main { |
||||
|
flex: 1; |
||||
|
position: relative; |
||||
|
} |
||||
|
|
||||
|
.page-main-scroll { |
||||
|
position: absolute; |
||||
|
left: 0; |
||||
|
right: 0; |
||||
|
top: 0; |
||||
|
bottom: 0; |
||||
|
} |
||||
|
|
||||
|
.page-main-list { |
||||
|
/* height: 80rpx; |
||||
|
line-height: 80rpx; */ |
||||
|
text-align: center; |
||||
|
background: #e0e0e0; |
||||
|
|
||||
|
} |
||||
|
</style> |
@ -0,0 +1,284 @@ |
|||||
|
<template> |
||||
|
<view class=""> |
||||
|
<com-empty-view v-if="jobList.length==0"></com-empty-view> |
||||
|
<job-filter ref="filter" otherTitle="ASN" @switchChangeToday="switchChangeToday" |
||||
|
@switchChangeWait="switchChangeWait" @onScanNumber="getScanNumber" :checkedToday="checkedToday" |
||||
|
:checkedWaitTask="checkedWaitTask"> |
||||
|
</job-filter> |
||||
|
<view v-if="jobList.length>0"> |
||||
|
<uni-swipe-action ref="swipeAction"> |
||||
|
<view v-for="(item, index) in jobList" :key="index"> |
||||
|
<uni-swipe-action-item |
||||
|
:right-options="item.status=='2'?detailGiveupOptions:detailOptions" |
||||
|
@click="swipeClick($event,item)"> |
||||
|
<com-return-job-card :dataContent="item" @click='openJobDetail(item)'></com-return-job-card> |
||||
|
</uni-swipe-action-item> |
||||
|
</view> |
||||
|
</uni-swipe-action> |
||||
|
|
||||
|
<job-list-popup ref="jobListPopup" @selectedItem="selectedItem"></job-list-popup> |
||||
|
<job-info-popup ref='jobInfoPopup'></job-info-popup> |
||||
|
|
||||
|
<uni-load-more :status="loadingType" v-if="jobList.length>0" /> |
||||
|
|
||||
|
</view> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { |
||||
|
cancleTakeCustomerReturnJob, |
||||
|
getCustomerReturnJobList, |
||||
|
} from '@/api/request2.js'; |
||||
|
|
||||
|
import { |
||||
|
goHome, |
||||
|
updateTitle |
||||
|
} from '@/common/basic.js'; |
||||
|
|
||||
|
import { |
||||
|
getDetailOption, |
||||
|
getDetailGiveupOption |
||||
|
} from '@/common/array.js'; |
||||
|
|
||||
|
import comEmptyView from '@/mycomponents/common/comEmptyView.vue' |
||||
|
import jobFilter from '@/mycomponents/job/jobFilter.vue' |
||||
|
|
||||
|
import comReturnJobCard from '@/pages/customerReturn/coms/comReturnJobCard.vue' |
||||
|
import jobListPopup from '@/pages/customerReturn/coms/jobListPopup.vue' |
||||
|
import jobInfoPopup from '@/pages/customerReturn/coms/jobInfoPopup.vue' |
||||
|
|
||||
|
export default { |
||||
|
name: 'customerReturn', |
||||
|
components: { |
||||
|
comEmptyView, |
||||
|
jobFilter, |
||||
|
comReturnJobCard, |
||||
|
jobListPopup, |
||||
|
jobInfoPopup |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
jobList: [], |
||||
|
pageNo: 1, |
||||
|
pageSize: 10, |
||||
|
totalCount: 0, |
||||
|
loadingType: "nomore", |
||||
|
checkedToday: false, |
||||
|
checkedWaitTask: false, |
||||
|
todayTime: "", |
||||
|
status: '1,2', //待处理 、进行中 |
||||
|
detailOptions: [], |
||||
|
detailGiveupOptions: [], |
||||
|
}; |
||||
|
}, |
||||
|
|
||||
|
onShow() { |
||||
|
this.getList('refresh'); |
||||
|
}, |
||||
|
|
||||
|
onReady() { |
||||
|
this.detailOptions = getDetailOption(); |
||||
|
this.detailGiveupOptions = getDetailGiveupOption(); |
||||
|
}, |
||||
|
onReachBottom() { |
||||
|
//避免多次触发 |
||||
|
if (this.loadingType == 'loading' || this.loadingType == 'nomore') { |
||||
|
return; |
||||
|
} |
||||
|
this.getList("more"); |
||||
|
}, |
||||
|
|
||||
|
onPullDownRefresh() { |
||||
|
this.getList('refresh'); |
||||
|
}, |
||||
|
|
||||
|
//后退按钮 |
||||
|
onBackPress(options) { |
||||
|
if (options.from === 'navigateBack') { |
||||
|
uni.navigateBack({ |
||||
|
delta: 1 |
||||
|
}) |
||||
|
return false; |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
//返回首页 |
||||
|
onNavigationBarButtonTap(e) { |
||||
|
if (e.index === 0) { |
||||
|
goHome(); |
||||
|
} else if (e.index == 1) { |
||||
|
this.$refs.filter.openFilter(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
methods: { |
||||
|
getList(type) { |
||||
|
let that = this; |
||||
|
uni.showLoading({ |
||||
|
title: "加载中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
this.loadingType = "loading"; |
||||
|
if (type === "refresh") { |
||||
|
this.pageNo = 1; |
||||
|
this.jobList = []; |
||||
|
} |
||||
|
var filters = [] |
||||
|
if (this.checkedToday) { |
||||
|
filters.push({ |
||||
|
column: "request_time", |
||||
|
action: "betweeen", |
||||
|
value: this.todayTime |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
filters.push({ |
||||
|
column: "status", |
||||
|
action: "in", |
||||
|
value: this.status |
||||
|
}) |
||||
|
|
||||
|
var params = { |
||||
|
filters: filters, |
||||
|
pageNo: this.pageNo, |
||||
|
pageSize: this.pageSize, |
||||
|
} |
||||
|
getCustomerReturnJobList(params).then(res => { |
||||
|
uni.hideLoading(); |
||||
|
if (type === "refresh") { |
||||
|
uni.stopPullDownRefresh(); |
||||
|
} |
||||
|
|
||||
|
var list = res.data.list; |
||||
|
this.totalCount = res.data.total |
||||
|
this.loadingType = "loadmore"; |
||||
|
if (list == null || list.length == 0) { |
||||
|
this.loadingType = "nomore"; |
||||
|
return; |
||||
|
} |
||||
|
this.jobList = type === "refresh" ? list : this.jobList.concat(list); |
||||
|
this.pageNo++; |
||||
|
updateTitle("客户退货(" + this.totalCount + ")"); |
||||
|
}).catch(error => { |
||||
|
if (type === "refresh") { |
||||
|
uni.stopPullDownRefresh(); |
||||
|
} |
||||
|
updateTitle("客户退货任务"); |
||||
|
this.loadingType = ""; |
||||
|
uni.hideLoading(); |
||||
|
that.showMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
openJobDetail(item) { |
||||
|
uni.navigateTo({ |
||||
|
url: './returnDetail?id=' + item.id + '&status=' + item.status |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
showItemList(itemList) { |
||||
|
this.$refs.jobListPopup.openPopup(itemList); |
||||
|
}, |
||||
|
|
||||
|
selectedItem(item) { |
||||
|
this.openJobDetail(item); |
||||
|
}, |
||||
|
|
||||
|
swipeClick(e, dataContent) { |
||||
|
if (e.content.text == "详情") { |
||||
|
this.openjobInfoPopup(dataContent); |
||||
|
} else if (e.content.text == "放弃") { |
||||
|
this.$refs.comMessage.showQuestionMessage("确定要放弃当前任务?", |
||||
|
res => { |
||||
|
if (res) { |
||||
|
this.cancleJob(dataContent.id); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
openjobInfoPopup(item) { |
||||
|
this.$refs.jobInfoPopup.openPopup(item) |
||||
|
}, |
||||
|
|
||||
|
cancleJob(id) { |
||||
|
cancleTakeCustomerReturnJob(id).then(res => { |
||||
|
if(res.data){ |
||||
|
this.getList("refresh") |
||||
|
uni.showToast({ |
||||
|
title:"放弃任务成功" |
||||
|
}) |
||||
|
}else { |
||||
|
this.showMessage("放弃任务失败") |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
this.showMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
switchChangeToday(state, creationTime) { |
||||
|
this.checkedToday = state; |
||||
|
this.todayTime = creationTime; |
||||
|
this.getList("refresh"); |
||||
|
}, |
||||
|
|
||||
|
switchChangeWait(state, jobStatus) { |
||||
|
this.checkedWaitTask = state; |
||||
|
this.status = jobStatus; |
||||
|
this.getList("refresh"); |
||||
|
}, |
||||
|
getScanNumber(code) { |
||||
|
this.getDataListByType(code) |
||||
|
}, |
||||
|
getDataListByType(code) { |
||||
|
let that = this; |
||||
|
uni.showLoading({ |
||||
|
title: "加载中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
var filters = [] |
||||
|
filters.push({ |
||||
|
column: "status", |
||||
|
action: "in", |
||||
|
value: '1,2' |
||||
|
}) |
||||
|
filters.push({ |
||||
|
column: "number", |
||||
|
action: "==", |
||||
|
value: code |
||||
|
}) |
||||
|
|
||||
|
var params = { |
||||
|
filters: filters, |
||||
|
pageNo: 1, |
||||
|
pageSize: 100, |
||||
|
} |
||||
|
getCustomerReturnJobList(params).then(res => { |
||||
|
uni.hideLoading(); |
||||
|
if (res.data.list.length == 0) { |
||||
|
that.showMessage('未查找到' + '【' + code + '】的收货任务'); |
||||
|
} else if (res.data.list.length == 1) { |
||||
|
that.openJobDetail(res.data.list[0]); |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
uni.hideLoading(); |
||||
|
that.showMessage(error); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
showMessage(message) { |
||||
|
this.$refs.comMessage.showErrorMessage(message, res => { |
||||
|
if (res) { |
||||
|
|
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="scss"> |
||||
|
|
||||
|
</style> |
@ -0,0 +1,466 @@ |
|||||
|
<template> |
||||
|
<view class="page-wraper"> |
||||
|
<view class=""> |
||||
|
<com-blank-view @goScan='showFromLocationPopup' v-if="detailSource.length==0"></com-blank-view> |
||||
|
</view> |
||||
|
<view class="page-wraper" v-if="detailSource.length>0"> |
||||
|
<view class="page-main"> |
||||
|
<scroll-view scroll-y="true" class="page-main-scroll"> |
||||
|
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> |
||||
|
<view class=""> |
||||
|
<record-com-detail-card :dataContent="item" :index="index" :isShowLocation="true" |
||||
|
@removeItem="removeItem(index,item)" @updateData="updateData" @removePack="removePack"> |
||||
|
</record-com-detail-card> |
||||
|
</view> |
||||
|
</view> |
||||
|
</scroll-view> |
||||
|
</view> |
||||
|
|
||||
|
<view class="page-footer"> |
||||
|
<view class="uni-flex u-col-center space-between padding_10" |
||||
|
style="background-color:ghostwhite; width: 100%; "> |
||||
|
<view class=""> |
||||
|
<requiredLocation title="目标库位" :locationCode="toLocationCode" @getLocation='getToLocationCode' |
||||
|
:locationTypeList="tolocationTypeList"></requiredLocation> |
||||
|
</view> |
||||
|
<view class=" uni-flex uni-row"> |
||||
|
<button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
<win-scan-button @goScan='openScanPopup'></win-scan-button> |
||||
|
</view> |
||||
|
|
||||
|
<win-scan-pack-and-location ref="scanPopup" @getResult='getScanResult' headerType="HPQ,HMQ"> |
||||
|
</win-scan-pack-and-location> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
<win-scan-location ref="scanLocationCode" title="来源库位" @getLocation='getLocation' |
||||
|
:locationTypeList="fromlocationTypeList"></win-scan-location> |
||||
|
</view> |
||||
|
|
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { |
||||
|
getBasicCustomerList, |
||||
|
customerReturnRecordSubmit |
||||
|
} from '@/api/request2.js'; |
||||
|
import { |
||||
|
getInventoryStatusDesc, |
||||
|
getDirectoryItemArray |
||||
|
} from '@/common/directory.js'; |
||||
|
|
||||
|
import { |
||||
|
getPrecisionStrategyList |
||||
|
} from '@/common/balance.js'; |
||||
|
import { |
||||
|
goHome, |
||||
|
updateTitle, |
||||
|
getPackingNumberAndBatchByList, |
||||
|
deepCopyData |
||||
|
} from '@/common/basic.js'; |
||||
|
|
||||
|
import { |
||||
|
getBusinessType, |
||||
|
createItemInfo, |
||||
|
createDetailInfo, |
||||
|
calcHandleQty |
||||
|
} from '@/common/record.js'; |
||||
|
|
||||
|
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
||||
|
import winScanPack from '@/mycomponents/scan/winScanPack.vue' |
||||
|
import requiredLocation from '@/mycomponents/location/requiredLocation.vue' |
||||
|
import comReturnRecord from '@/pages/customerReturn/coms/comReturnRecord.vue' |
||||
|
import comBlankView from '@/mycomponents/common/comBlankView.vue' |
||||
|
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue" |
||||
|
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue" |
||||
|
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' |
||||
|
|
||||
|
|
||||
|
export default { |
||||
|
components: { |
||||
|
winScanButton, |
||||
|
winScanPack, |
||||
|
comReturnRecord, |
||||
|
requiredLocation, |
||||
|
comBlankView, |
||||
|
winScanLocation, |
||||
|
winScanPackAndLocation, |
||||
|
recordComDetailCard |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
id: '', |
||||
|
receiptJob: {}, |
||||
|
received: false, |
||||
|
isShowPackingCode: true, |
||||
|
scanCount: 0, |
||||
|
dataContent: {}, //任务内容 |
||||
|
subList: [], //接口返回的任务subList |
||||
|
detailSource: [], //绑定在页面上的数据源 |
||||
|
locationTypeList: [], |
||||
|
businessType: {}, |
||||
|
fromLocationCode: "", |
||||
|
toLocationCode: "", |
||||
|
fromlocationTypeList: [], |
||||
|
tolocationTypeList: [], |
||||
|
managementList: [], |
||||
|
toWarehouseCode: '', |
||||
|
}; |
||||
|
}, |
||||
|
onLoad(option) { |
||||
|
var typeCode = "CustomerReject" |
||||
|
getBusinessType(typeCode, res => { |
||||
|
if (res.success) { |
||||
|
this.businessType = res.businessType; |
||||
|
this.fromlocationTypeList = res.fromlocationTypeList; |
||||
|
this.tolocationTypeList = res.tolocationTypeList; |
||||
|
this.showFromLocationPopup(); |
||||
|
} else { |
||||
|
this.showErrorMessage(res.message) |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
}, |
||||
|
//返回首页 |
||||
|
onNavigationBarButtonTap(e) { |
||||
|
if (e.index === 0) { |
||||
|
goHome(); |
||||
|
} |
||||
|
}, |
||||
|
//拦截返回按钮事件 |
||||
|
onBackPress(e) {}, |
||||
|
|
||||
|
onPullDownRefresh() {}, |
||||
|
|
||||
|
mounted() { |
||||
|
|
||||
|
}, |
||||
|
methods: { |
||||
|
getScanResult(result) { |
||||
|
let balance = result.balance; |
||||
|
let label = result.label; |
||||
|
let pack = result.package; |
||||
|
var item = this.detailSource.find(res => { |
||||
|
if (res.itemCode == balance.itemCode) { |
||||
|
return res |
||||
|
} |
||||
|
}) |
||||
|
if (item == undefined) { |
||||
|
|
||||
|
var itemp = createItemInfo(balance, pack); |
||||
|
let newDetail = createDetailInfo(balance, pack); // |
||||
|
|
||||
|
itemp.subList.push(newDetail); |
||||
|
this.detailSource.push(itemp) |
||||
|
} else { |
||||
|
var detail = item.subList.find(r => { |
||||
|
if (r.packingNumber == balance.packingNumber && |
||||
|
r.batch == balance.batch && |
||||
|
r.locationCode == balance.locationCode && |
||||
|
r.inventoryStatus == balance.inventoryStatus) { |
||||
|
return r; |
||||
|
} |
||||
|
}) |
||||
|
if (detail == undefined) { |
||||
|
let newDetail = createDetailInfo(balance, pack); |
||||
|
item.subList.push(newDetail); |
||||
|
} else { |
||||
|
if (detail.scaned == true) { |
||||
|
this.showErrorMessage("箱码[" + balance.packingNumber + "批次[" + balance.batch + "]已经在列表中") |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
this.calcHandleQty(); |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
showErrorMessage(message) { |
||||
|
this.$refs.comMessage.showErrorMessage(message, res => { |
||||
|
if (res) { |
||||
|
|
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
calcHandleQty() { |
||||
|
calcHandleQty(this.detailSource) |
||||
|
this.$forceUpdate(); |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
updateData() { |
||||
|
this.calcHandleQty(); |
||||
|
}, |
||||
|
removeItem(index, item) { |
||||
|
this.detailSource.splice(index, 1) |
||||
|
}, |
||||
|
removePack() { |
||||
|
for (var i = 0; i < this.detailSource.length; i++) { |
||||
|
var item = this.detailSource[i]; |
||||
|
if (item.subList.length == 0) { |
||||
|
this.detailSource.splice(i, 1) |
||||
|
} |
||||
|
} |
||||
|
this.updateData(); |
||||
|
}, |
||||
|
|
||||
|
openScanPopup() { |
||||
|
|
||||
|
if (this.fromLocationCode == "") { |
||||
|
this.showFromLocationPopup(); |
||||
|
return |
||||
|
} |
||||
|
this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType); |
||||
|
}, |
||||
|
showFromLocationPopup() { |
||||
|
this.$nextTick(() => { |
||||
|
this.$refs.scanLocationCode.openScanPopup(); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
closeScanPopup() { |
||||
|
if (this.$refs.scanPopup != undefined) { |
||||
|
this.$refs.scanPopup.closeScanPopup(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
scanPopupGetFocus() { |
||||
|
if (this.$refs.scanPopup != undefined) { |
||||
|
this.$refs.scanPopup.getfocus(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
scanLocationCode(location, code) { |
||||
|
this.$refs.comMessage.showQuestionMessage("是否把所有的目标库位都变成默认库位[" + code + "]", res => { |
||||
|
this.toLocationCode = code |
||||
|
this.detailSource.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
detail.toLocationCode = code |
||||
|
}) |
||||
|
}) |
||||
|
}) |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
commit() { |
||||
|
|
||||
|
if (this.toLocationCode == "") { |
||||
|
this.showMessage("请先选择目标库位") |
||||
|
return; |
||||
|
} |
||||
|
if (this.detailSource.length > 0 && this.detailSource[0].subList.length > 0) { |
||||
|
//查询管理模式 |
||||
|
uni.showLoading({ |
||||
|
title: "提交中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
this.managementList = []; |
||||
|
var precisionStrategParams = this.setPrecisionStrategParams() |
||||
|
|
||||
|
getPrecisionStrategyList(precisionStrategParams, res => { |
||||
|
if (res.success) { |
||||
|
this.managementList = res.list; |
||||
|
var params = this.setParams() |
||||
|
console.log("提交" + JSON.stringify(params)) |
||||
|
customerReturnRecordSubmit(params).then(res => { |
||||
|
uni.hideLoading() |
||||
|
if (res.data) { |
||||
|
this.showCommitSuccessMessage("提交成功<br>生成客户退货记录<br>" + res.data) |
||||
|
} else { |
||||
|
this.showErrorMessage("提交失败[" + res.msg + "]") |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
uni.hideLoading() |
||||
|
this.showErrorMessage(error) |
||||
|
}) |
||||
|
|
||||
|
} else { |
||||
|
uni.hideLoading(); |
||||
|
this.showErrorMessage(res.message); |
||||
|
} |
||||
|
|
||||
|
}) |
||||
|
|
||||
|
} else { |
||||
|
this.showErrorMessage("没有要提交的数据,请先扫描") |
||||
|
} |
||||
|
|
||||
|
|
||||
|
}, |
||||
|
|
||||
|
setPrecisionStrategParams() { |
||||
|
var itemList = [] |
||||
|
this.detailSource.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
if (detail.scaned) { |
||||
|
detail.toLocationCode = this.toLocationCode; |
||||
|
var filterResult = itemList.filter(res => { |
||||
|
if (res.itemCode == item.itemCode && |
||||
|
detail.toLocationCode == res.locationCode) { |
||||
|
return res |
||||
|
} |
||||
|
}) |
||||
|
//去掉重复元素 |
||||
|
if (filterResult.length == 0) { |
||||
|
var result = { |
||||
|
itemCode: item.itemCode, |
||||
|
locationCode: detail.toLocationCode |
||||
|
} |
||||
|
itemList.push(result) |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
return itemList; |
||||
|
}, |
||||
|
|
||||
|
setParams() { |
||||
|
var subList = [] |
||||
|
var creator = this.$store.state.user.id |
||||
|
this.detailSource.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
if (detail.scaned) { |
||||
|
var info = getPackingNumberAndBatchByList(this.managementList, detail.itemCode, |
||||
|
detail.packingNumber, detail.toLocationCode, detail.batch); |
||||
|
var submitItem = deepCopyData(detail) |
||||
|
|
||||
|
submitItem.itemCode = detail.itemCode; |
||||
|
submitItem.itemName = detail.package.itemName; |
||||
|
submitItem.itemDesc1 = detail.package.itemDesc1; |
||||
|
submitItem.itemDesc2 = detail.package.itemDesc2; |
||||
|
|
||||
|
submitItem.inventoryStatus = detail.inventoryStatus; |
||||
|
submitItem.toInventoryStatus = detail.inventoryStatus; |
||||
|
|
||||
|
submitItem.fromPackingNumber = info.packingNumber; |
||||
|
submitItem.toPackingNumber = info.packingNumber; |
||||
|
|
||||
|
submitItem.fromContainerNumber = detail.containerNumber; |
||||
|
submitItem.toContainerNumber = detail.containerNumber |
||||
|
|
||||
|
submitItem.fromBatch = info.batch; |
||||
|
submitItem.toBatch = info.batch; |
||||
|
|
||||
|
submitItem.fromLocationCode = detail.locationCode; |
||||
|
submitItem.toLocationCode = detail.toLocationCode; |
||||
|
|
||||
|
submitItem.qty = detail.handleQty; |
||||
|
submitItem.package =""; |
||||
|
subList.push(submitItem) |
||||
|
|
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
this.dataContent.subList = subList; |
||||
|
this.dataContent.creator = creator; |
||||
|
this.dataContent.fromWarehouseCode = this.detailSource[0].subList[0].warehouseCode; |
||||
|
this.dataContent.toWarehouseCode = this.toWarehouseCode; |
||||
|
return this.dataContent; |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
showMessage(message) { |
||||
|
this.$refs.comMessage.showMessage(message, res => { |
||||
|
if (res) {} |
||||
|
}); |
||||
|
}, |
||||
|
showErrorMessage(message) { |
||||
|
this.$refs.comMessage.showErrorMessage(message, res => { |
||||
|
if (res) { |
||||
|
|
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
showScanMessage(message) { |
||||
|
this.$refs.comMessage.showScanMessage(message); |
||||
|
}, |
||||
|
|
||||
|
afterCloseMessage() { |
||||
|
this.scanPopupGetFocus(); |
||||
|
}, |
||||
|
|
||||
|
closeScanMessage() { |
||||
|
this.scanPopupGetFocus(); |
||||
|
}, |
||||
|
getLocation(location, code) { |
||||
|
this.getFromLocationCode(location, code) |
||||
|
}, |
||||
|
getFromLocationCode(location, code) { |
||||
|
this.fromLocationCode = code; |
||||
|
this.openScanPopup(); |
||||
|
}, |
||||
|
getToLocationCode(location, code) { |
||||
|
this.toLocationCode = code; |
||||
|
this.detailSource.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
detail.toLocationCode = code |
||||
|
}) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
showCommitSuccessMessage(hint) { |
||||
|
this.$refs.comMessage.showSuccessMessage(hint, res => { |
||||
|
this.clearData() |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
clearData(){ |
||||
|
this.fromLocationCode = ''; |
||||
|
this.subList = []; |
||||
|
this.detailSource = []; |
||||
|
this.toLocationCode = ''; |
||||
|
this.dataContent = {} |
||||
|
this.toWarehouseCode = "" |
||||
|
}, |
||||
|
|
||||
|
updateData() { |
||||
|
this.calcHandleQty(); |
||||
|
for (var i = 0; i < this.detailSource.length; i++) { |
||||
|
let item = this.detailSource[i]; |
||||
|
if (item.qty == 0) { |
||||
|
this.detailSource.splice(i, 1) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="scss"> |
||||
|
page { |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
background-color: #fff; |
||||
|
} |
||||
|
|
||||
|
.page-wraper { |
||||
|
display: flex; |
||||
|
flex-direction: column; |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
.page-main { |
||||
|
flex: 1; |
||||
|
position: relative; |
||||
|
} |
||||
|
|
||||
|
.page-main-scroll { |
||||
|
position: absolute; |
||||
|
left: 0; |
||||
|
right: 0; |
||||
|
top: 0; |
||||
|
bottom: 0; |
||||
|
} |
||||
|
|
||||
|
.page-main-list { |
||||
|
/* height: 80rpx; |
||||
|
line-height: 80rpx; */ |
||||
|
text-align: center; |
||||
|
background: #e0e0e0; |
||||
|
|
||||
|
} |
||||
|
</style> |
@ -0,0 +1,394 @@ |
|||||
|
<template> |
||||
|
<view> |
||||
|
<com-empty-view v-if="requestList.length==0"></com-empty-view> |
||||
|
<request-filter ref="filter" @switchChangeWait="switchChangeWait" @onScanNumber="getScanNumber" |
||||
|
:checkedWaitTask="checkedWaitTask"> |
||||
|
</request-filter> |
||||
|
<view v-if="requestList.length>0"> |
||||
|
<uni-swipe-action ref="swipeAction"> |
||||
|
<view v-for="(item, index) in requestList" :key="index"> |
||||
|
<uni-swipe-action-item :right-options="item.options" @click="swipeClick($event,item)"> |
||||
|
<com-return-request-card :dataContent="item" @click='openRequestDetail(item)'> |
||||
|
</com-return-request-card> |
||||
|
</uni-swipe-action-item> |
||||
|
</view> |
||||
|
</uni-swipe-action> |
||||
|
<uni-load-more :status="loadingType" v-if="requestList.length>0" /> |
||||
|
<request-info-popup ref='requestInfoPopup'></request-info-popup> |
||||
|
</view> |
||||
|
<requestButton @goScan='openScanDetailPopup'></requestButton> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import requestFilter from '@/mycomponents/request/requestFilter.vue' |
||||
|
import comEmptyView from '@/mycomponents/common/comEmptyView.vue' |
||||
|
import comReturnRequestCard from '@/pages/customerReturn/coms/comReturnRequestCard.vue' |
||||
|
import requestInfoPopup from '@/pages/customerReturn/coms/requestInfoPopup.vue' |
||||
|
import requestButton from '@/mycomponents/button/requestButton.vue' |
||||
|
|
||||
|
import { |
||||
|
goHome, |
||||
|
updateTitle, |
||||
|
clearTirmAndWrap |
||||
|
} from '@/common/basic.js'; |
||||
|
|
||||
|
import { |
||||
|
getCustomerReturnRequestList, |
||||
|
customerReturnRequestClose, |
||||
|
customerReturnRequestApprove, |
||||
|
customerReturnRequestApproveAgree, |
||||
|
customerReturnRequestApproveRefused, |
||||
|
customerReturnRequestHandle, |
||||
|
customerReturnRequestAddAgain |
||||
|
} from '@/api/request2.js'; |
||||
|
import { |
||||
|
getDetailOption, |
||||
|
getDetailAndApproveOption, |
||||
|
getDetailAndApprovePassAndApproveNoOption, |
||||
|
getDetailAndHandleOption, |
||||
|
getDetailAndAddAndCloseOption, |
||||
|
getAddAgainOption |
||||
|
} from '@/common/array.js'; |
||||
|
|
||||
|
export default { |
||||
|
components: { |
||||
|
comEmptyView, |
||||
|
requestFilter, |
||||
|
comReturnRequestCard, |
||||
|
requestInfoPopup, |
||||
|
requestButton |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
requestList: [], |
||||
|
pageNo: 1, |
||||
|
pageSize: 10, |
||||
|
status: "1,2,3,4,5,6", |
||||
|
totalCount: 0, |
||||
|
checkedWaitTask: false, |
||||
|
detailOptions: [], |
||||
|
detailAndApproveOptions: [], |
||||
|
detailAndApprovePassAndApproveNoOption: [], |
||||
|
detailAndHandleOption: [], |
||||
|
detailAndAddAndCloseOption: [], |
||||
|
addAgainOption: [], |
||||
|
showOptions: [], |
||||
|
fromType: "requestType", |
||||
|
loadingType: "nomore", |
||||
|
|
||||
|
}; |
||||
|
}, |
||||
|
onReady() { |
||||
|
this.detailOptions = getDetailOption(); |
||||
|
this.addAgainOption = getAddAgainOption(); |
||||
|
this.detailAndApproveOptions = getDetailAndApproveOption() |
||||
|
this.detailAndApprovePassAndApproveNoOption = getDetailAndApprovePassAndApproveNoOption(), |
||||
|
this.detailAndHandleOption = getDetailAndHandleOption() |
||||
|
this.detailAndAddAndCloseOption = getDetailAndAddAndCloseOption() |
||||
|
|
||||
|
}, |
||||
|
onReachBottom() { |
||||
|
//避免多次触发 |
||||
|
if (this.loadingType == 'loading' || this.loadingType == 'nomore') { |
||||
|
return; |
||||
|
} |
||||
|
this.getList("more"); |
||||
|
}, |
||||
|
|
||||
|
onPullDownRefresh() { |
||||
|
this.getList('refresh'); |
||||
|
}, |
||||
|
onLoad(option) { |
||||
|
this.getList('refresh'); |
||||
|
}, |
||||
|
//返回首页 |
||||
|
onNavigationBarButtonTap(e) { |
||||
|
if (e.index === 0) { |
||||
|
goHome(); |
||||
|
} else if (e.index == 1) { |
||||
|
this.$refs.filter.openFilter(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
mounted() { |
||||
|
|
||||
|
}, |
||||
|
methods: { |
||||
|
requestConfirm(action, item) {}, |
||||
|
|
||||
|
openRequestInfoPopup(item) { |
||||
|
this.$refs.requestInfoPopup.openPopup(item) |
||||
|
}, |
||||
|
openRequestDetail(item) { |
||||
|
uni.navigateTo({ |
||||
|
url: './customerReturnRequestDetail?id=' + item.id |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
getList(type) { |
||||
|
let that = this; |
||||
|
uni.showLoading({ |
||||
|
title: "加载中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
this.loadingType = "loading"; |
||||
|
if (type === "refresh") { |
||||
|
this.pageNo = 1; |
||||
|
this.requestList = []; |
||||
|
} |
||||
|
var filters = [] |
||||
|
filters.push({ |
||||
|
column: "status", |
||||
|
action: "in", |
||||
|
value: this.status |
||||
|
}) |
||||
|
var params = { |
||||
|
filters: filters, |
||||
|
pageNo: this.pageNo, |
||||
|
pageSize: this.pageSize, |
||||
|
} |
||||
|
getCustomerReturnRequestList(params).then(res => { |
||||
|
uni.hideLoading(); |
||||
|
if (type === "refresh") { |
||||
|
uni.stopPullDownRefresh(); |
||||
|
} |
||||
|
|
||||
|
var list = res.data.list; |
||||
|
this.totalCount = res.data.total |
||||
|
this.loadingType = "loadmore"; |
||||
|
if (list == null || list.length == 0) { |
||||
|
this.loadingType = "nomore"; |
||||
|
return; |
||||
|
} |
||||
|
list.forEach(res => { |
||||
|
var options = this.updateOptions(res.status); |
||||
|
res.options = options; |
||||
|
}) |
||||
|
this.requestList = type === "refresh" ? list : this.requestList.concat(list); |
||||
|
|
||||
|
this.pageNo++; |
||||
|
updateTitle("客户退货申请(" + this.totalCount + ")"); |
||||
|
|
||||
|
}).catch(error => { |
||||
|
if (type === "refresh") { |
||||
|
uni.stopPullDownRefresh(); |
||||
|
} |
||||
|
this.loadingType = ""; |
||||
|
updateTitle("客户退货申请"); |
||||
|
uni.hideLoading(); |
||||
|
that.showMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
updateOptions(status) { |
||||
|
if (status == "1") { |
||||
|
this.showOptions = this.detailAndApproveOptions; |
||||
|
} else if (status == "2") { |
||||
|
this.showOptions = this.detailAndApprovePassAndApproveNoOption; |
||||
|
} else if (status == "3") { |
||||
|
this.showOptions = this.detailAndHandleOption; |
||||
|
} else if (status == "4") { |
||||
|
this.showOptions = this.detailAndAddAndCloseOption; |
||||
|
} else if (status == "5") { |
||||
|
this.showOptions = this.addAgainOption; |
||||
|
} else { |
||||
|
this.showOptions = this.detailOptions; |
||||
|
} |
||||
|
return this.showOptions |
||||
|
}, |
||||
|
|
||||
|
openScanDetailPopup() { |
||||
|
uni.navigateTo({ |
||||
|
url: "../request/customerReturnRequestCreate" |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
swipeClick(e, dataContent) { |
||||
|
var text = clearTirmAndWrap(e.content.text) |
||||
|
if (text == "详情") { |
||||
|
this.openRequestInfoPopup(dataContent); |
||||
|
} else if (text == "处理") { |
||||
|
this.showQuestionMessage("确定要处理当前申请吗?", res => { |
||||
|
this.customerReturnRequestHandle(dataContent.id) |
||||
|
}) |
||||
|
} else if (text == "提交审批") { |
||||
|
this.showQuestionMessage("确定要审批当前申请吗?", res => { |
||||
|
this.customerReturnRequestApprove(dataContent.id) |
||||
|
}) |
||||
|
} else if (text == "审批通过") { |
||||
|
this.showQuestionMessage("确定要审批通过当前申请吗?", res => { |
||||
|
this.customerReturnRequestApproveAgree(dataContent.id) |
||||
|
}) |
||||
|
} else if (text == "审批驳回") { |
||||
|
this.showQuestionMessage("确定要审批驳回当前申请吗?", res => { |
||||
|
this.customerReturnRequestApproveRefused(dataContent.id) |
||||
|
}) |
||||
|
} else if (text == "关闭") { |
||||
|
this.showQuestionMessage("确定要关闭当前申请吗?", res => { |
||||
|
this.customerReturnRequestClose(dataContent.id) |
||||
|
}) |
||||
|
} else if (text == "重新添加") { |
||||
|
this.showQuestionMessage("确定要重新添加当前申请吗?", res => { |
||||
|
this.customerReturnRequestAddAgain(dataContent.id) |
||||
|
}) |
||||
|
} |
||||
|
}, |
||||
|
showQuestionMessage(hint, callBack) { |
||||
|
this.$refs.comMessage.showQuestionMessage(hint, |
||||
|
res => { |
||||
|
if (res) { |
||||
|
callBack() |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
switchChangeWait(state, jobStatus) { |
||||
|
this.checkedWaitTask = state; |
||||
|
this.status = jobStatus; |
||||
|
this.getList("refresh"); |
||||
|
}, |
||||
|
|
||||
|
getScanNumber(code) { |
||||
|
this.getDataListByType(code) |
||||
|
}, |
||||
|
|
||||
|
getDataListByType(code) { |
||||
|
let that = this; |
||||
|
uni.showLoading({ |
||||
|
title: "加载中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
var filters = [] |
||||
|
filters.push({ |
||||
|
column: "number", |
||||
|
action: "==", |
||||
|
value: code |
||||
|
}) |
||||
|
|
||||
|
var params = { |
||||
|
filters: filters, |
||||
|
pageNo: 1, |
||||
|
pageSize: 100, |
||||
|
} |
||||
|
getCustomerReturnRequestList(params).then(res => { |
||||
|
uni.hideLoading(); |
||||
|
if (res.data.list.length == 0) { |
||||
|
that.showMessage('未查找到' + '【' + code + '】的收货任务'); |
||||
|
} else if (res.data.list.length == 1) { |
||||
|
that.openRequestDetail(res.data.list[0]); |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
uni.hideLoading(); |
||||
|
that.showMessage(error); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
showMessage(message) { |
||||
|
this.$refs.comMessage.showMessage(message, res => { |
||||
|
if (res) { |
||||
|
|
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
customerReturnRequestApprove(id) { |
||||
|
customerReturnRequestApprove(id).then(res => { |
||||
|
if (res.data) { |
||||
|
uni.showToast({ |
||||
|
title: "申请提交审批成功" |
||||
|
}) |
||||
|
this.getList("refresh") |
||||
|
} else { |
||||
|
this.showMessage("申请提交审批失败") |
||||
|
} |
||||
|
|
||||
|
}).catch(error => { |
||||
|
this.showMessage(error) |
||||
|
}) |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
customerReturnRequestClose(id) { |
||||
|
customerReturnRequestClose(id).then(res => { |
||||
|
if (res.data) { |
||||
|
uni.showToast({ |
||||
|
title: "申请关闭成功" |
||||
|
}) |
||||
|
this.getList("refresh") |
||||
|
} else { |
||||
|
this.showMessage("申请关闭失败") |
||||
|
} |
||||
|
|
||||
|
}).catch(error => { |
||||
|
this.showMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
customerReturnRequestAddAgain(id) { |
||||
|
customerReturnRequestAddAgain(id).then(res => { |
||||
|
if (res.data) { |
||||
|
uni.showToast({ |
||||
|
title: "申请重新添加成功" |
||||
|
}) |
||||
|
this.getList("refresh") |
||||
|
} else { |
||||
|
this.showMessage("申请重新添加失败") |
||||
|
} |
||||
|
|
||||
|
}).catch(error => { |
||||
|
this.showMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
customerReturnRequestApproveAgree(id) { |
||||
|
customerReturnRequestApproveAgree(id).then(res => { |
||||
|
if (res.data) { |
||||
|
uni.showToast({ |
||||
|
title: "申请审批通过成功" |
||||
|
}) |
||||
|
this.getList("refresh") |
||||
|
} else { |
||||
|
this.showMessage("申请审批通过失败") |
||||
|
} |
||||
|
|
||||
|
}).catch(error => { |
||||
|
this.showMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
customerReturnRequestApproveRefused(id) { |
||||
|
customerReturnRequestApproveRefused(id).then(res => { |
||||
|
if (res.data) { |
||||
|
uni.showToast({ |
||||
|
title: "申请审批驳回成功" |
||||
|
}) |
||||
|
this.getList("refresh") |
||||
|
} else { |
||||
|
this.showMessage("申请审批驳回失败") |
||||
|
} |
||||
|
|
||||
|
}).catch(error => { |
||||
|
this.showMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
customerReturnRequestHandle(id) { |
||||
|
customerReturnRequestHandle(id).then(res => { |
||||
|
if (res.data) { |
||||
|
uni.showToast({ |
||||
|
title: "申请处理成功" |
||||
|
}) |
||||
|
this.getList("refresh") |
||||
|
} else { |
||||
|
this.showMessage("申请处理失败") |
||||
|
} |
||||
|
|
||||
|
}).catch(error => { |
||||
|
this.showMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
</style> |
@ -0,0 +1,486 @@ |
|||||
|
<template> |
||||
|
<view class="page-wraper"> |
||||
|
<view class=""> |
||||
|
<com-blank-view @goScan='showFromLocationPopup' v-if="detailSource.length==0"></com-blank-view> |
||||
|
</view> |
||||
|
<view class="page-wraper" v-if="detailSource.length>0"> |
||||
|
<view class="uni-flex uni-row padding title u-col-center" @click="showSelect" style="font-size: 35rpx;"> |
||||
|
<text style="font-size: 32rpx;">客户 : </text> |
||||
|
<view class="uni-flex u-col-center uni-row" @click="showSelect"> |
||||
|
<view class="" style="margin-left: 20rpx;font-size: 32rpx;"> |
||||
|
{{customerName}} |
||||
|
</view> |
||||
|
<u-select v-model="showCustomer" mode="single-column" :list="customerList" @confirm="confirmSelect"> |
||||
|
</u-select> |
||||
|
</view> |
||||
|
</view> |
||||
|
|
||||
|
<view class="page-main"> |
||||
|
|
||||
|
<scroll-view scroll-y="true" class="page-main-scroll"> |
||||
|
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> |
||||
|
<view class=""> |
||||
|
<record-com-detail-card :dataContent="item" :index="index" :isShowLocation="true" |
||||
|
:isShowBalanceQty="false" :isShowToLocation="false" @removeItem="removeItem(index,item)" |
||||
|
@updateData="updateData" @removePack="removePack"> |
||||
|
</record-com-detail-card> |
||||
|
</view> |
||||
|
</view> |
||||
|
</scroll-view> |
||||
|
</view> |
||||
|
|
||||
|
<div class="btn_bottom"> |
||||
|
<view class="" style="display: flex;flex-direction: row;"> |
||||
|
|
||||
|
<!-- <view class=""> |
||||
|
<requiredLocation title="目标库位" :locationCode="toLocationCode" @getLocation='getToLocationCode' |
||||
|
:locationTypeList="tolocationTypeList"></requiredLocation> |
||||
|
</view> --> |
||||
|
<view class=""> |
||||
|
<button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button> |
||||
|
</view> |
||||
|
</view> |
||||
|
</div> |
||||
|
<win-scan-button @goScan='openScanPopup'></win-scan-button> |
||||
|
</view> |
||||
|
|
||||
|
<win-scan-pack-and-location ref="scanPopup" @getResult='getScanResult' headerType="HPQ,HMQ" |
||||
|
:allowModifyLocation="false"> |
||||
|
</win-scan-pack-and-location> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
<win-scan-location ref="scanLocationCode" title="来源库位" @getLocation='getLocation' |
||||
|
:locationTypeList="fromlocationTypeList"></win-scan-location> |
||||
|
</view> |
||||
|
|
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { |
||||
|
calc |
||||
|
} from '@/common/calc' |
||||
|
import { |
||||
|
customerReturnRequestSubmit, |
||||
|
getBasicCustomerList |
||||
|
} from '@/api/request2.js'; |
||||
|
import { |
||||
|
getInventoryStatusDesc, |
||||
|
getDirectoryItemArray |
||||
|
} from '@/common/directory.js'; |
||||
|
|
||||
|
import { |
||||
|
getPrecisionStrategyList |
||||
|
} from '@/common/balance.js'; |
||||
|
import { |
||||
|
goHome, |
||||
|
updateTitle, |
||||
|
deepCopyData, |
||||
|
getPackingNumberAndBatchByList |
||||
|
} from '@/common/basic.js'; |
||||
|
|
||||
|
import { |
||||
|
getBusinessType, |
||||
|
createItemInfo, |
||||
|
createDetailInfo, |
||||
|
calcHandleQty |
||||
|
} from '@/common/record.js'; |
||||
|
|
||||
|
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
||||
|
import winScanPack from '@/mycomponents/scan/winScanPack.vue' |
||||
|
import requiredLocation from '@/mycomponents/location/requiredLocation.vue' |
||||
|
import comReturnRecord from '@/pages/customerReturn/coms/comReturnRecord.vue' |
||||
|
import comBlankView from '@/mycomponents/common/comBlankView.vue' |
||||
|
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue" |
||||
|
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue" |
||||
|
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' |
||||
|
|
||||
|
|
||||
|
export default { |
||||
|
components: { |
||||
|
winScanButton, |
||||
|
winScanPack, |
||||
|
comReturnRecord, |
||||
|
requiredLocation, |
||||
|
comBlankView, |
||||
|
winScanLocation, |
||||
|
winScanPackAndLocation, |
||||
|
recordComDetailCard |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
id: '', |
||||
|
scanCount: 0, |
||||
|
dataContent: {}, //任务内容 |
||||
|
subList: [], //接口返回的任务subList |
||||
|
detailSource: [], //绑定在页面上的数据源 |
||||
|
locationTypeList: [], |
||||
|
businessType: {}, |
||||
|
fromLocationCode: "", |
||||
|
fromLocation: {}, |
||||
|
toLocationCode: "", |
||||
|
fromlocationTypeList: [], |
||||
|
tolocationTypeList: [], |
||||
|
toWarehouseCode: '', |
||||
|
customerCode: '', |
||||
|
showCustomer: false, |
||||
|
customerList: [], |
||||
|
customerName: "请选择退货客户", |
||||
|
customerCode: "" |
||||
|
}; |
||||
|
}, |
||||
|
onLoad(option) { |
||||
|
var typeCode = "CustomerReject" |
||||
|
getBusinessType(typeCode, res => { |
||||
|
if (res.success) { |
||||
|
this.businessType = res.businessType; |
||||
|
this.fromlocationTypeList = res.fromlocationTypeList; |
||||
|
this.tolocationTypeList = res.tolocationTypeList; |
||||
|
this.showFromLocationPopup(); |
||||
|
} else { |
||||
|
this.showErrorMessage(res.message) |
||||
|
} |
||||
|
}); |
||||
|
getBasicCustomerList().then(res => { |
||||
|
if (res.data.length > 0) { |
||||
|
var list = res.data; |
||||
|
list.forEach(item => { |
||||
|
item.label = item.name |
||||
|
item.value = item.code |
||||
|
}) |
||||
|
this.customerList = list; |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
|
||||
|
}) |
||||
|
|
||||
|
}, |
||||
|
//返回首页 |
||||
|
onNavigationBarButtonTap(e) { |
||||
|
if (e.index === 0) { |
||||
|
goHome(); |
||||
|
} |
||||
|
}, |
||||
|
//拦截返回按钮事件 |
||||
|
onBackPress(e) {}, |
||||
|
|
||||
|
onPullDownRefresh() {}, |
||||
|
|
||||
|
mounted() { |
||||
|
|
||||
|
}, |
||||
|
methods: { |
||||
|
getScanResult(result) { |
||||
|
let balance = result.balance; |
||||
|
let label = result.label; |
||||
|
let pack = result.package; |
||||
|
var item = this.detailSource.find(res => { |
||||
|
if (res.itemCode == balance.itemCode) { |
||||
|
return res |
||||
|
} |
||||
|
}) |
||||
|
if (item == undefined) { |
||||
|
var itemp = createItemInfo(balance, pack); |
||||
|
let newDetail = createDetailInfo(balance, pack); // |
||||
|
itemp.subList.push(newDetail); |
||||
|
this.detailSource.push(itemp) |
||||
|
} else { |
||||
|
var detail = item.subList.find(r => { |
||||
|
if (r.packingNumber == balance.packingNumber && |
||||
|
r.batch == balance.batch && |
||||
|
r.locationCode == balance.locationCode && |
||||
|
r.inventoryStatus == balance.inventoryStatus) { |
||||
|
return r; |
||||
|
} |
||||
|
}) |
||||
|
if (detail == undefined) { |
||||
|
let newDetail = createDetailInfo(balance, pack); |
||||
|
item.subList.push(newDetail); |
||||
|
} else { |
||||
|
if (detail.scaned == true) { |
||||
|
this.showErrorMessage("箱码[" + balance.packingNumber + "批次[" + balance.batch + "]已经在列表中") |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
this.calcHandleQty(); |
||||
|
}, |
||||
|
|
||||
|
showErrorMessage(message) { |
||||
|
this.$refs.comMessage.showErrorMessage(message, res => { |
||||
|
if (res) { |
||||
|
|
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
calcHandleQty() { |
||||
|
calcHandleQty(this.detailSource); |
||||
|
this.$forceUpdate(); |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
updateData() { |
||||
|
this.calcHandleQty(); |
||||
|
}, |
||||
|
removeItem(index, item) { |
||||
|
this.detailSource.splice(index, 1) |
||||
|
}, |
||||
|
removePack() { |
||||
|
for (var i = 0; i < this.detailSource.length; i++) { |
||||
|
var item = this.detailSource[i]; |
||||
|
if (item.subList.length == 0) { |
||||
|
this.detailSource.splice(i, 1) |
||||
|
} |
||||
|
} |
||||
|
this.updateData(); |
||||
|
}, |
||||
|
|
||||
|
openScanPopup() { |
||||
|
if (this.fromLocationCode == "") { |
||||
|
this.showFromLocationPopup(); |
||||
|
return |
||||
|
} |
||||
|
this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType); |
||||
|
}, |
||||
|
showFromLocationPopup() { |
||||
|
this.$nextTick(() => { |
||||
|
this.$refs.scanLocationCode.openScanPopup(); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
closeScanPopup() { |
||||
|
if (this.$refs.scanPopup != undefined) { |
||||
|
this.$refs.scanPopup.closeScanPopup(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
scanPopupGetFocus() { |
||||
|
if (this.$refs.scanPopup != undefined) { |
||||
|
this.$refs.scanPopup.getfocus(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
scanLocationCode(location, code) { |
||||
|
this.$refs.comMessage.showQuestionMessage("是否把所有的目标库位都变成默认库位[" + code + "]", res => { |
||||
|
this.toLocationCode = code |
||||
|
this.detailSource.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
detail.toLocationCode = code |
||||
|
}) |
||||
|
}) |
||||
|
}) |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
commit() { |
||||
|
if (this.customerName == ""||this.customerName == "请选择退货客户") { |
||||
|
this.showErrorMessage("请选择退货客户") |
||||
|
return; |
||||
|
} |
||||
|
if (this.detailSource.length > 0 && this.detailSource[0].subList.length > 0) { |
||||
|
//查询管理模式 |
||||
|
uni.showLoading({ |
||||
|
title: "提交中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
//客户退货默认推到hold库 |
||||
|
var params = this.setParams() |
||||
|
console.log("提交" + JSON.stringify(params)) |
||||
|
customerReturnRequestSubmit(params).then(res => { |
||||
|
uni.hideLoading() |
||||
|
if (res.data) { |
||||
|
this.showCommitSuccessMessage("提交成功<br>生成客户退货申请<br>" + res.data) |
||||
|
} else { |
||||
|
this.showErrorMessage("提交失败[" + res.msg + "]") |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
uni.hideLoading() |
||||
|
this.showErrorMessage(error) |
||||
|
}) |
||||
|
} else { |
||||
|
this.showErrorMessage("没有要提交的数据,请先扫描") |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
setPrecisionStrategParams() { |
||||
|
var itemList = [] |
||||
|
this.detailSource.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
if (detail.scaned) { |
||||
|
detail.toLocationCode = this.toLocationCode; |
||||
|
var filterResult = itemList.filter(res => { |
||||
|
if (res.itemCode == item.itemCode && |
||||
|
detail.toLocationCode == res.locationCode) { |
||||
|
return res |
||||
|
} |
||||
|
}) |
||||
|
//去掉重复元素 |
||||
|
if (filterResult.length == 0) { |
||||
|
var result = { |
||||
|
itemCode: item.itemCode, |
||||
|
locationCode: detail.toLocationCode |
||||
|
} |
||||
|
itemList.push(result) |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
return itemList; |
||||
|
}, |
||||
|
|
||||
|
setParams() { |
||||
|
var subList = [] |
||||
|
var creator = this.$store.state.user.id |
||||
|
|
||||
|
|
||||
|
this.detailSource.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
if (detail.scaned) { |
||||
|
var submitItem = deepCopyData(detail) |
||||
|
submitItem.itemCode = detail.itemCode; |
||||
|
submitItem.itemName = detail.package.itemName; |
||||
|
submitItem.itemDesc1 = detail.package.itemDesc1; |
||||
|
submitItem.itemDesc2 = detail.package.itemDesc2; |
||||
|
|
||||
|
submitItem.inventoryStatus = detail.inventoryStatus; |
||||
|
submitItem.toInventoryStatus = 'HOLD'; |
||||
|
|
||||
|
submitItem.fromPackingNumber = detail.packingNumber; |
||||
|
submitItem.toPackingNumber = detail.packingNumber; |
||||
|
|
||||
|
submitItem.fromContainerNumber = detail.containerNumber; |
||||
|
submitItem.toContainerNumber = detail.containerNumber |
||||
|
|
||||
|
submitItem.fromBatch = detail.batch; |
||||
|
submitItem.toBatch = detail.batch; |
||||
|
|
||||
|
submitItem.qty = detail.handleQty; |
||||
|
|
||||
|
submitItem.fromLocationCode = detail.locationCode; |
||||
|
submitItem.toLocationCode = 'HOLD'; |
||||
|
|
||||
|
submitItem.package = "" |
||||
|
|
||||
|
subList.push(submitItem) |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
|
||||
|
this.dataContent.subList = subList; |
||||
|
this.dataContent.creator = creator; |
||||
|
this.dataContent.customerCode = this.customerCode; |
||||
|
this.dataContent.fromWarehouseCode = this.fromLocation.warehouseCode; |
||||
|
this.dataContent.toWarehouseCode = this.toWarehouseCode; |
||||
|
|
||||
|
return this.dataContent; |
||||
|
}, |
||||
|
|
||||
|
showMessage(message) { |
||||
|
this.$refs.comMessage.showMessage(message, res => { |
||||
|
if (res) {} |
||||
|
}); |
||||
|
}, |
||||
|
showErrorMessage(message) { |
||||
|
this.$refs.comMessage.showErrorMessage(message, res => { |
||||
|
if (res) { |
||||
|
|
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
showScanMessage(message) { |
||||
|
this.$refs.comMessage.showScanMessage(message); |
||||
|
}, |
||||
|
|
||||
|
afterCloseMessage() { |
||||
|
this.scanPopupGetFocus(); |
||||
|
}, |
||||
|
|
||||
|
closeScanMessage() { |
||||
|
this.scanPopupGetFocus(); |
||||
|
}, |
||||
|
getLocation(location, code) { |
||||
|
this.getFromLocationCode(location, code) |
||||
|
}, |
||||
|
getFromLocationCode(location, code) { |
||||
|
this.fromLocationCode = code; |
||||
|
this.openScanPopup(); |
||||
|
}, |
||||
|
getToLocationCode(location, code) { |
||||
|
this.toLocationCode = code; |
||||
|
}, |
||||
|
|
||||
|
showCommitSuccessMessage(hint) { |
||||
|
this.$refs.comMessage.showSuccessMessage(hint, res => { |
||||
|
this.clearData() |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
clearData() { |
||||
|
this.fromLocationCode = ''; |
||||
|
this.fromLocation = '' |
||||
|
this.subList = []; |
||||
|
this.detailSource = []; |
||||
|
this.toLocationCode = ''; |
||||
|
this.dataContent = {} |
||||
|
this.toWarehouseCode = "" |
||||
|
this.customerName ="请选择退货客户" |
||||
|
this.customerCode ="" |
||||
|
}, |
||||
|
|
||||
|
updateData() { |
||||
|
this.calcHandleQty(); |
||||
|
for (var i = 0; i < this.detailSource.length; i++) { |
||||
|
let item = this.detailSource[i]; |
||||
|
if (item.qty == 0) { |
||||
|
this.detailSource.splice(i, 1) |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
confirmSelect(e) { |
||||
|
this.customerName = e[0].label |
||||
|
this.customerCode = e[0].value |
||||
|
}, |
||||
|
|
||||
|
showSelect() { |
||||
|
this.showCustomer = true |
||||
|
}, |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="scss"> |
||||
|
page { |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
background-color: #fff; |
||||
|
} |
||||
|
|
||||
|
.page-wraper { |
||||
|
display: flex; |
||||
|
flex-direction: column; |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
.page-main { |
||||
|
flex: 1; |
||||
|
position: relative; |
||||
|
} |
||||
|
|
||||
|
.page-main-scroll { |
||||
|
position: absolute; |
||||
|
left: 0; |
||||
|
right: 0; |
||||
|
top: 0; |
||||
|
bottom: 0; |
||||
|
} |
||||
|
|
||||
|
.page-main-list { |
||||
|
/* height: 80rpx; |
||||
|
line-height: 80rpx; */ |
||||
|
text-align: center; |
||||
|
background: #e0e0e0; |
||||
|
|
||||
|
} |
||||
|
</style> |
@ -0,0 +1,125 @@ |
|||||
|
<template> |
||||
|
<view class="page-wraper"> |
||||
|
<view class="page-header"> |
||||
|
<view class="header_job_top"> |
||||
|
<request-top :dataContent="requestContent"></request-top> |
||||
|
</view> |
||||
|
<view class="header_item"> |
||||
|
客户代码 : {{requestContent.customerCode}} |
||||
|
</view> |
||||
|
<u-line color="#D8D8D8" /> |
||||
|
</view> |
||||
|
<view class="page-main"> |
||||
|
<scroll-view scroll-y="true" class="page-main-scroll"> |
||||
|
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> |
||||
|
<view class=""> |
||||
|
<comRequestDetailCard :dataContent="item" |
||||
|
@openDetail="openDetail"> |
||||
|
</comRequestDetailCard> |
||||
|
</view> |
||||
|
</view> |
||||
|
</scroll-view> |
||||
|
</view> |
||||
|
|
||||
|
<requestDetailInfoPopup ref="jobDetailPopup"></requestDetailInfoPopup> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { |
||||
|
getCustomerReturnRequestDetail, |
||||
|
} from '@/api/request2.js'; |
||||
|
|
||||
|
import { |
||||
|
goHome, |
||||
|
} from '@/common/basic.js'; |
||||
|
|
||||
|
import { |
||||
|
getDataSource, |
||||
|
} from '@/common/detail.js'; |
||||
|
|
||||
|
|
||||
|
import comRequestDetailCard from "@/mycomponents/detail/comRequestDetailCard.vue" |
||||
|
import requestDetailInfoPopup from '@/pages/customerReturn/coms/requestDetailInfoPopup.vue' |
||||
|
import requestTop from "@/mycomponents/request/requestTop.vue" |
||||
|
|
||||
|
export default { |
||||
|
components: { |
||||
|
comRequestDetailCard, |
||||
|
requestDetailInfoPopup, |
||||
|
requestTop |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
id: '', |
||||
|
requestContent: {}, //任务内容 |
||||
|
subList: [], //接口返回的任务details |
||||
|
detailSource: [], //绑定在页面上的数据源 |
||||
|
}; |
||||
|
}, |
||||
|
onLoad(option) { |
||||
|
this.id = option.id; |
||||
|
this.getDetail(); |
||||
|
}, |
||||
|
//返回首页 |
||||
|
onNavigationBarButtonTap(e) { |
||||
|
if (e.index === 0) { |
||||
|
goHome(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
onPullDownRefresh() { |
||||
|
this.getDetail(); |
||||
|
uni.stopPullDownRefresh(); |
||||
|
}, |
||||
|
|
||||
|
mounted() { |
||||
|
|
||||
|
}, |
||||
|
methods: { |
||||
|
getDetail() { |
||||
|
var that = this; |
||||
|
uni.showLoading({ |
||||
|
title: "加载中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
|
||||
|
getCustomerReturnRequestDetail(that.id).then(res => { |
||||
|
uni.hideLoading(); |
||||
|
if (res.data == null) { |
||||
|
that.showMessage('未获取到详情'); |
||||
|
} else { |
||||
|
if (res.data.subList.length > 0) { |
||||
|
that.requestContent = res.data; |
||||
|
that.subList = res.data.subList; |
||||
|
that.detailSource = getDataSource(that.subList); |
||||
|
} else { |
||||
|
that.showMessage('列表数据为0'); |
||||
|
} |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
uni.hideLoading() |
||||
|
this.showMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
showMessage(message) { |
||||
|
this.$refs.comMessage.showMessage(message, res => { |
||||
|
if (res) { |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
openDetail(item) { |
||||
|
this.$refs.jobDetailPopup.openPopup(item) |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="scss"> |
||||
|
|
||||
|
</style> |
@ -0,0 +1,170 @@ |
|||||
|
<template> |
||||
|
<view> |
||||
|
<!-- <requiredLocation title="需求库位" :locationCode="dataContent.toLocationCode" |
||||
|
:isShowEdit="dataContent.allowModifyLocation==1"></requiredLocation> --> |
||||
|
|
||||
|
<view v-for="(item,index) in dataContent.Items"> |
||||
|
<uni-collapse ref="collapse"> |
||||
|
<uni-collapse-item :open="true"> |
||||
|
<template v-slot:title> |
||||
|
<!-- 物品 --> |
||||
|
<item-qty :dataContent="item" :handleQty="item.handleQty"></item-qty> |
||||
|
</template> |
||||
|
<u-line /> |
||||
|
<view v-for="(loacation,index) in item.Locations"> |
||||
|
<view> |
||||
|
<view class="uni-flex uni-row space-between"> |
||||
|
<!-- 推荐库位 --> |
||||
|
<location :locationCode="loacation.fromLocationCode"> |
||||
|
</location> |
||||
|
</view> |
||||
|
<view v-for="(batch,index) in loacation.Batchs"> |
||||
|
<recommend-balance style='margin-left: 20px;' :detail="batch" |
||||
|
:isShowLocation="false" :isShowPack="batch.packingNumber!=null && batch.packingNumber!=''"> |
||||
|
</recommend-balance> |
||||
|
<view class="uni-flex uni-row" v-if='batch.Records.length>0'> |
||||
|
<view class="center " style=" width: 20px; color: #0CC2B6; margin-left: 40px;"> |
||||
|
实际 |
||||
|
</view> |
||||
|
<view class="uni-flex uni-column" style="width: 100%;"> |
||||
|
<view v-for="(record,index) in batch.Records"> |
||||
|
<uni-swipe-action ref="swipeAction"> |
||||
|
<uni-swipe-action-item @click="swipeClick($event,batch,record,index)" |
||||
|
:right-options="scanOptions"> |
||||
|
<handle-balance :detail="record" :isShowLocation="false" |
||||
|
:isShowBatch="batch.packingNumber!=null"> |
||||
|
</handle-balance> |
||||
|
</uni-swipe-action-item> |
||||
|
</uni-swipe-action> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</uni-collapse-item> |
||||
|
</uni-collapse> |
||||
|
</view> |
||||
|
</view> |
||||
|
<balance-qty-edit ref="balanceQtyEdit" @confirm="confirm" :isShowStatus="true"></balance-qty-edit> |
||||
|
<detail-info-popup ref="detailInfoPopup"></detail-info-popup> |
||||
|
<comMessage ref="message"></comMessage> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import itemQty from '@/mycomponents/item/itemQty.vue' |
||||
|
import recommend from '@/mycomponents/recommend/recommend.vue' |
||||
|
import recommendBalance from '@/mycomponents/balance/recommendBalance.vue' |
||||
|
import handleBalance from '@/mycomponents/balance/handleBalance.vue' |
||||
|
import recommendQtyEdit from '@/mycomponents/qty/recommendQtyEdit.vue' |
||||
|
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue' |
||||
|
import requiredLocation from '@/mycomponents/location/requiredLocation.vue' |
||||
|
import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue' |
||||
|
import location from '@/mycomponents/balance/location.vue' |
||||
|
import detailInfoPopup from '@/pages/productionReceipt/coms/detailInfoPopup.vue' |
||||
|
|
||||
|
import { |
||||
|
getDetailOption, |
||||
|
getEditRemoveOption |
||||
|
} from '@/common/array.js'; |
||||
|
|
||||
|
export default { |
||||
|
emits: ['updateData'], |
||||
|
components: { |
||||
|
itemQty, |
||||
|
recommend, |
||||
|
recommendBalance, |
||||
|
handleBalance, |
||||
|
recommendQtyEdit, |
||||
|
requiredLocation, |
||||
|
balanceQtyEdit, |
||||
|
location, |
||||
|
detailInfoPopup |
||||
|
}, |
||||
|
props: { |
||||
|
dataContent: { |
||||
|
type: Object, |
||||
|
default: {} |
||||
|
}, |
||||
|
settingParam: { |
||||
|
type: Object, |
||||
|
default: {} |
||||
|
}, |
||||
|
}, |
||||
|
watch: { |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
data() { |
||||
|
return { |
||||
|
option: [], |
||||
|
showItem: {}, |
||||
|
editItem: {}, |
||||
|
batchItem: {}, |
||||
|
detailOptions: [], |
||||
|
scanOptions: [] |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
mounted() { |
||||
|
this.detailOptions = getDetailOption(); |
||||
|
this.scanOptions = getEditRemoveOption(); |
||||
|
}, |
||||
|
|
||||
|
methods: { |
||||
|
resizeCollapse() { |
||||
|
this.$nextTick(r => { |
||||
|
this.$refs.collapse.forEach(r => { |
||||
|
r.childrens.forEach(i => { |
||||
|
i.init(); |
||||
|
}) |
||||
|
r.resize(); |
||||
|
}) |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
swipeClick(e, batch, record, index) { |
||||
|
if (e.content.text == "编辑") { |
||||
|
this.edit(batch, record) |
||||
|
} else if (e.content.text == "移除") { |
||||
|
this.remove(batch, record, index) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
edit(batch, item) { |
||||
|
let that = this; |
||||
|
that.editItem = item; |
||||
|
that.batchItem = batch; |
||||
|
item.balance.balanceQty=item.balance.qty; |
||||
|
that.$refs.balanceQtyEdit.openEditPopup(item.balance, item.qty); |
||||
|
}, |
||||
|
|
||||
|
detail(item) { |
||||
|
this.showItem = item; |
||||
|
this.$refs.receiptHint.openScanPopup() |
||||
|
}, |
||||
|
remove(batch, record, index) { |
||||
|
this.$refs.message.showQuestionMessage("确定移除扫描信息?", |
||||
|
res => { |
||||
|
if (res) { |
||||
|
batch.Records.splice(index, 1); |
||||
|
this.resizeCollapse(); |
||||
|
this.$emit('updateData', record) |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
confirm(val) { |
||||
|
this.editItem.qty = val; |
||||
|
this.$emit('updateData', this.editItem) |
||||
|
// let qty = 0; |
||||
|
// this.batchItem.Records.forEach(r => { |
||||
|
// qty += Number(r.qty); |
||||
|
// }) |
||||
|
// this.batchItem.handleQty = qty; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
</style> |
@ -0,0 +1,50 @@ |
|||||
|
<template> |
||||
|
<job-com-main-card :dataContent="dataContent"> |
||||
|
<view class="task_item"> |
||||
|
<view class="task_text"> |
||||
|
<view class=""> |
||||
|
申请单号 : {{dataContent.requestNumber}} |
||||
|
</view> |
||||
|
</view> |
||||
|
|
||||
|
<view class="task_text"> |
||||
|
<view class=""> |
||||
|
发货计划单号 : {{dataContent.deliverPlanNumber}} |
||||
|
</view> |
||||
|
</view> |
||||
|
|
||||
|
<view class="task_text"> |
||||
|
<view class=""> |
||||
|
客户代码 : {{dataContent.customerCode}} |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</job-com-main-card> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import jobComMainCard from '@/mycomponents/job/jobComMainCard.vue' |
||||
|
export default { |
||||
|
components: { |
||||
|
jobComMainCard, |
||||
|
}, |
||||
|
data() { |
||||
|
return {}; |
||||
|
}, |
||||
|
|
||||
|
props: { |
||||
|
dataContent: { |
||||
|
type: Object, |
||||
|
default: {} |
||||
|
}, |
||||
|
}, |
||||
|
|
||||
|
methods: { |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss"> |
||||
|
|
||||
|
</style> |
@ -0,0 +1,36 @@ |
|||||
|
<template> |
||||
|
<request-com-main-card :dataContent="dataContent"> |
||||
|
<view class="task_item"> |
||||
|
<view class="task_text"> |
||||
|
客户代码 : {{dataContent.customerCode}} |
||||
|
</view> |
||||
|
</view> |
||||
|
</request-com-main-card> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import requestComMainCard from '@/mycomponents/request/requestComMainCard.vue' |
||||
|
export default { |
||||
|
components: { |
||||
|
requestComMainCard, |
||||
|
}, |
||||
|
data() { |
||||
|
return {}; |
||||
|
}, |
||||
|
|
||||
|
props: { |
||||
|
dataContent: { |
||||
|
type: Object, |
||||
|
default: {} |
||||
|
}, |
||||
|
}, |
||||
|
|
||||
|
methods: { |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss"> |
||||
|
|
||||
|
</style> |
@ -0,0 +1,59 @@ |
|||||
|
<template> |
||||
|
<view class=""> |
||||
|
<uni-collapse ref="collapse"> |
||||
|
<uni-collapse-item :open="true"> |
||||
|
<template v-slot:title> |
||||
|
<view class="page-header" style="font-size: 32rpx;"> |
||||
|
<view class="page-item"> |
||||
|
{{dataContent.customerCode }} ({{dataContent.customerName}}) |
||||
|
</view> |
||||
|
</view> |
||||
|
</template> |
||||
|
<uni-swipe-action ref="swipeAction"> |
||||
|
<view v-for="(item, index) in dataContent.subList" :key="index"> |
||||
|
<uni-swipe-action-item> |
||||
|
<item-qty :dataContent="item"></item-qty> |
||||
|
</uni-swipe-action-item> |
||||
|
</view> |
||||
|
</uni-swipe-action> |
||||
|
</uni-collapse-item> |
||||
|
</uni-collapse> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import uom from '@/mycomponents/qty/uom.vue' |
||||
|
import itemQty from '@/mycomponents/item/itemQty.vue' |
||||
|
export default { |
||||
|
components: { |
||||
|
uom, |
||||
|
itemQty |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
|
||||
|
} |
||||
|
}, |
||||
|
props: { |
||||
|
dataContent: { |
||||
|
type: Object, |
||||
|
default: {} |
||||
|
}, |
||||
|
}, |
||||
|
methods: { |
||||
|
update() { |
||||
|
this.$nextTick(r => { |
||||
|
this.$refs.collapse.resize() |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
</style> |
@ -0,0 +1,297 @@ |
|||||
|
<template> |
||||
|
<view class=""> |
||||
|
<uni-popup ref="popup" :maskClick="false"> |
||||
|
<view class="uni-flex uni-column pop_customer"> |
||||
|
<view class="" style="padding:10rpx"> |
||||
|
<view class="uni-flex u-col-center uni-row space-between" style="padding: 10rpx 10rpx 20rpx 10rpx"> |
||||
|
<view class="" style="font-size: 35rpx;"> |
||||
|
{{title}} |
||||
|
</view> |
||||
|
<image style="width: 35rpx;height: 35rpx;" src="/static/icons/icons_close.svg" |
||||
|
@click="closeRequestPopup()"></image> |
||||
|
</view> |
||||
|
<u-line /> |
||||
|
<view class="uni-flex uni-column" style="background-color: white; "> |
||||
|
<view class="uni-flex uni-column "> |
||||
|
<view class="uni-flex uni-row padding title u-col-center"> |
||||
|
<text>客户 : </text> |
||||
|
<view class="uni-flex u-col-center uni-row" @click="showSelect"> |
||||
|
<view class="" style="margin-left: 20rpx;"> |
||||
|
{{customerName}} |
||||
|
</view> |
||||
|
<u-select v-model="showCustomer" mode="single-column" :list="customerList" |
||||
|
@confirm="confirmSelect"></u-select> |
||||
|
</view> |
||||
|
</view> |
||||
|
<u-line /> |
||||
|
|
||||
|
<view class="uni-flex uni-row padding title u-col-center"> |
||||
|
<text>物料 : </text> |
||||
|
<view class="uni-flex u-col-center uni-row"> |
||||
|
<u-input v-model="itemCode" :focus="itemCodeFocus" :border="true" |
||||
|
placeholder="请输入需求物料" @confirm="itemCodeConfirm" /> |
||||
|
<image src="/static/search.svg" mode="" |
||||
|
style=" width: 40rpx;height: 40rpx;margin-left: 10rpx;" @click="itemCodeClick"> |
||||
|
</image> |
||||
|
|
||||
|
</view> |
||||
|
</view> |
||||
|
<u-line /> |
||||
|
|
||||
|
<view class="uni-flex uni-row padding title u-col-center"> |
||||
|
<text>数量 : </text> |
||||
|
<view class="uni-flex uni-row uni-center" |
||||
|
style="align-items: center;margin-left: 20rpx;"> |
||||
|
<input style="text-align: center;" class="qty_input" v-model="counQty" type="number" |
||||
|
@confirm="confirm()" :focus="numberFocus" @input="checkNum" :maxlength="maxlength" /> |
||||
|
|
||||
|
<uom :uom="uom"></uom> |
||||
|
<!-- <view class="" v-if="stdPackInfo!=undefined" style="display: flex;flex-direction: row;margin-left: 10rpx;"> |
||||
|
(<stdPackQty :dataContent="stdPackInfo"></stdPackQty>) |
||||
|
</view> --> |
||||
|
|
||||
|
</view> |
||||
|
</view> |
||||
|
<u-line /> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class="uni-flex uni-row hide_border"> |
||||
|
<button class="btn_edit_big_cancle" hover-class="btn_edit_big_after" @click="cancel()">取消</button> |
||||
|
<button class="btn_edit_big_confirm" hover-class="btn_edit_big_after" @click="confirm()">确认</button> |
||||
|
</view> |
||||
|
</view> |
||||
|
</uni-popup> |
||||
|
|
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
<selectList ref='selectList' @selectedItem="selectedItem"></selectList> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { |
||||
|
getBasicLocationByCode, |
||||
|
getBasicItemByCode, |
||||
|
getProductionlineItem, |
||||
|
getWorkShopLineStation, |
||||
|
getBasicCustomerList, |
||||
|
} from '@/api/request2.js'; |
||||
|
import { |
||||
|
getLocationTypeName, |
||||
|
getListLocationTypeDesc, |
||||
|
checkDirectoryItemExist |
||||
|
} from '@/common/directory.js'; |
||||
|
import uom from '@/mycomponents/qty/uom.vue' |
||||
|
import balanceStatus from '@/mycomponents/status/balanceStatus.vue' |
||||
|
import selectList from '@/mycomponents/popup/selectList.vue' |
||||
|
|
||||
|
|
||||
|
export default { |
||||
|
components: { |
||||
|
uom, |
||||
|
balanceStatus, |
||||
|
selectList |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
// itemCode: 'CE115F11161AG', |
||||
|
itemCode: '', |
||||
|
itemName: "", |
||||
|
qty: 0, |
||||
|
itemCodeFocus: false, |
||||
|
requestInfo: null, |
||||
|
itemCodeList: [], |
||||
|
isCheckItemCode: false, |
||||
|
counQty: undefined, |
||||
|
editPosition: true, |
||||
|
numberFocus: false, |
||||
|
uom: "", |
||||
|
showCustomer: false, |
||||
|
isModifiedPosition: true, |
||||
|
customerList: [], |
||||
|
customerName: "请选择客户", |
||||
|
customerCode:"", |
||||
|
maxlength:10, |
||||
|
stdPackInfo:undefined |
||||
|
} |
||||
|
}, |
||||
|
props: { |
||||
|
title: { |
||||
|
type: String, |
||||
|
default: '需求信息' |
||||
|
}, |
||||
|
}, |
||||
|
methods: { |
||||
|
checkNum(e) { |
||||
|
let value = e.detail.value; |
||||
|
let dot = value.indexOf('.'); //包含小数点 |
||||
|
let reg = /^[0-9]+$/; //正整数 |
||||
|
if (dot > -1) { |
||||
|
this.maxlength = dot + 7; //长度是小数点后两位 |
||||
|
if (value.length > dot + 7) { |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
if (reg.test(value)) { //如果是正整数不包含小数点 |
||||
|
this.maxlength = 10; |
||||
|
} |
||||
|
this.change(value) |
||||
|
}, |
||||
|
openRequestPopup(editPosition) { |
||||
|
if (this.customerList.length == 0) { |
||||
|
getBasicCustomerList().then(res => { |
||||
|
if (res.data.length > 0) { |
||||
|
var list = res.data; |
||||
|
list.forEach(item => { |
||||
|
item.label = item.name |
||||
|
item.value = item.code |
||||
|
}) |
||||
|
this.customerList = list; |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
|
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
this.editPosition = editPosition; |
||||
|
if (this.isModifiedPosition) { |
||||
|
this.isModifiedPosition = false |
||||
|
} else { |
||||
|
this.itemCode = ""; |
||||
|
this.uom = "" |
||||
|
this.qty = 0 |
||||
|
this.counQty =undefined; |
||||
|
this.itemCodeGetFocus(); |
||||
|
} |
||||
|
|
||||
|
setTimeout(res => { |
||||
|
this.$refs.popup.open('bottom') |
||||
|
}, 500) |
||||
|
}, |
||||
|
closeRequestPopup() { |
||||
|
this.$refs.popup.close() |
||||
|
}, |
||||
|
locationConfirm() { |
||||
|
//查询库位信息 |
||||
|
this.checkLocatioCode(); |
||||
|
}, |
||||
|
itemCodeClick() { |
||||
|
if (this.customerName == "请选择客户") { |
||||
|
this.showErrorMessage("请选择客户") |
||||
|
return |
||||
|
} |
||||
|
this.$refs.selectList.queryList(this.customerCode) |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
itemCodeGetFocus() { |
||||
|
this.itemCodeFocus = true; |
||||
|
}, |
||||
|
itemCodeLoseFocus() { |
||||
|
this.itemCodeFocus = false; |
||||
|
}, |
||||
|
selectedItem(item) { |
||||
|
this.itemCode = item.itemCode; |
||||
|
this.checkItemCode(); |
||||
|
}, |
||||
|
|
||||
|
confirm() { |
||||
|
if (this.itemCode == "" || !this.isCheckItemCode) { |
||||
|
this.showErrorMessage("请输入物料", "itemCode") |
||||
|
return |
||||
|
} |
||||
|
if (this.counQty == undefined) { |
||||
|
this.showErrorMessage("请输入数量") |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
if (this.qty == 0) { |
||||
|
this.showErrorMessage("数量必须大于0") |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
this.callback('add'); |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
confirmSelect(e){ |
||||
|
this.customerName = e[0].label |
||||
|
this.customerCode = e[0].value |
||||
|
}, |
||||
|
|
||||
|
checkItemCode() { |
||||
|
//校验物料 |
||||
|
getBasicItemByCode(this.itemCode).then(res => { |
||||
|
uni.hideLoading(); |
||||
|
if (res.data != null && res.data.list.length > 0) { |
||||
|
this.itemCode = res.data.list[0].code; |
||||
|
this.itemName = res.data.list[0].name |
||||
|
this.isCheckItemCode = true; |
||||
|
this.numberFocus = true |
||||
|
this.uom = res.data.list[0].uom |
||||
|
} else { |
||||
|
this.showErrorMessage('未查找到物料【' + this.itemCode + '】', "itemCode"); |
||||
|
} |
||||
|
|
||||
|
}).catch(error => { |
||||
|
uni.hideLoading(); |
||||
|
this.showErrorMessage(error, "itemCode"); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
callback(action) { |
||||
|
let item = { |
||||
|
customerName :this.customerName, |
||||
|
customerCode:this.customerCode, |
||||
|
itemCode: this.itemCode, |
||||
|
itemName: this.itemName, |
||||
|
uom: this.uom, |
||||
|
qty: this.qty |
||||
|
}; |
||||
|
this.closeRequestPopup(); |
||||
|
this.$emit("confirm", action, item); |
||||
|
}, |
||||
|
|
||||
|
showErrorMessage(message, type) { |
||||
|
setTimeout(r => { |
||||
|
this.$refs.comMessage.showErrorMessage(message, res => { |
||||
|
if (type == "itemCode") { |
||||
|
this.itemCodeGetFocus(); |
||||
|
} else { |
||||
|
this.numberFocus = true; |
||||
|
} |
||||
|
}) |
||||
|
if (type == "itemCode") { |
||||
|
this.itemCode = "" |
||||
|
this.isCheckItemCode = false; |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
itemCodeConfirm() { |
||||
|
this.checkItemCode(); |
||||
|
}, |
||||
|
change(value) { |
||||
|
this.qty = value; |
||||
|
}, |
||||
|
cancel(e) { |
||||
|
this.closeRequestPopup(); |
||||
|
}, |
||||
|
showSelect() { |
||||
|
if (this.editPosition) { |
||||
|
this.showCustomer = true |
||||
|
} |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss"> |
||||
|
.title { |
||||
|
font-size: 30rpx; |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,531 @@ |
|||||
|
<template> |
||||
|
<view> |
||||
|
<uni-popup ref="popup" :maskClick='false'> |
||||
|
<view class=""> |
||||
|
<view class="popup_box"> |
||||
|
<view class="pop_title uni-flex space-between"> |
||||
|
<view class="" style="font-size: 35rpx;"> |
||||
|
扫描箱码 |
||||
|
</view> |
||||
|
|
||||
|
<view class=""> |
||||
|
<image class="fr icons_scan_close" src="/static/icons/icons_scan_close.svg" |
||||
|
@click="closeScanPopup()"></image> |
||||
|
</view> |
||||
|
</view> |
||||
|
|
||||
|
<!-- <view class="uni-flex uni-row" style="align-items: center; |
||||
|
background-color: #fff; |
||||
|
margin-left: 20rpx; |
||||
|
margin-right: 20rpx; |
||||
|
padding:20rpx; |
||||
|
border-radius: 8rpx;"> |
||||
|
<view class="uni-center"> |
||||
|
位置 : |
||||
|
</view> |
||||
|
<view class="" style="width: 75%;padding: 0rpx"> |
||||
|
<view class="uni-flex u-col-center uni-row" @click="showSelect"> |
||||
|
<view class="" style="margin-left: 15rpx;font-size: 30rpx;"> |
||||
|
{{positionInfo}} |
||||
|
</view> |
||||
|
<u-select v-model="show" mode="mutil-column-auto" :list="positionList" :defaultValue="defaultValueList" |
||||
|
@confirm="confirmSelect"></u-select> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
<u-line class='line_color'></u-line> --> |
||||
|
|
||||
|
<view class="uni-flex uni-row" style="align-items: center; |
||||
|
background-color: #fff; |
||||
|
margin-left: 20rpx; |
||||
|
margin-right: 20rpx; |
||||
|
margin-top: 8rpx; |
||||
|
border-radius: 8rpx;"> |
||||
|
<view class="uni-center" style="width: 25%; "> |
||||
|
来源库位 |
||||
|
</view> |
||||
|
<view class="" style="width: 75%; padding: 8rpx;"> |
||||
|
<uni-combox :candidates="fromLocationList" v-model="fromLocationCode" placeholder="请选择库位" |
||||
|
@confirm="fromLocationUpdate"></uni-combox> |
||||
|
</view> |
||||
|
</view> |
||||
|
|
||||
|
<view class=""> |
||||
|
<view class=""> |
||||
|
<win-com-scan ref="comscan" placeholder="箱标签" @getResult="onScan" :clearResult="true" |
||||
|
:headerType="headerType" :isShowHistory="false"> |
||||
|
</win-com-scan> |
||||
|
|
||||
|
<view style="width: 100%;"> |
||||
|
<view style="width: 100%;" v-if="issueRecord.length>0"> |
||||
|
<view class="uni-flex uni-row space-between u-col-center"> |
||||
|
<view class="" style="padding: 10rpx;"> |
||||
|
历史记录 |
||||
|
</view> |
||||
|
<view class="" style="padding-right: 10rpx;"> |
||||
|
<u-icon :name="expendIcon" size="35rpx" @click="expands()"></u-icon> |
||||
|
</view> |
||||
|
</view> |
||||
|
<u-line class='line_color' style='padding-top: 10rpx;padding-bottom: 20rpx;'> |
||||
|
</u-line> |
||||
|
<scroll-view scroll-y="true" class="scroll-view" |
||||
|
v-if="expand&&issueRecord.length>0"> |
||||
|
<view class="uni-flex u-col" v-for="(record,index) in issueRecord"> |
||||
|
<view style="width: 100%;"> |
||||
|
<uni-swipe-action ref="swipeAction"> |
||||
|
<uni-swipe-action-item @click="swipeClick($event,record,index)" |
||||
|
:right-options="scanOptions"> |
||||
|
<view style="padding: 0px 10px"> |
||||
|
<balance :dataContent="record" :isShowLocation="false" |
||||
|
:isShowStdPack="false"></balance> |
||||
|
</view> |
||||
|
</uni-swipe-action-item> |
||||
|
</uni-swipe-action> |
||||
|
<u-line class='line_color'></u-line> |
||||
|
</view> |
||||
|
</view> |
||||
|
</scroll-view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</uni-popup> |
||||
|
<balance-select ref="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
<balance-qty-edit ref="balanceQtyEdit" @confirm="confirm" :isShowStatus="true"></balance-qty-edit> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import winComScan from '@/mycomponents/scan/winComScan.vue' |
||||
|
import balance from '@/mycomponents/balance/balance.vue' |
||||
|
import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue' |
||||
|
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue' |
||||
|
|
||||
|
import { |
||||
|
getDetailOption, |
||||
|
getDetailEditRemoveOption |
||||
|
} from '@/common/array.js'; |
||||
|
|
||||
|
|
||||
|
import { |
||||
|
calc |
||||
|
} from '@/common/calc.js'; |
||||
|
import { |
||||
|
getWorkShopLineStation |
||||
|
} from '@/api/request2.js'; |
||||
|
|
||||
|
import { |
||||
|
getBalanceByManagementPrecision |
||||
|
} from '@/common/balance.js'; |
||||
|
|
||||
|
export default { |
||||
|
name: 'winScanPack', |
||||
|
components: { |
||||
|
winComScan, |
||||
|
balance, |
||||
|
balanceQtyEdit, |
||||
|
balanceSelect |
||||
|
}, |
||||
|
props: { |
||||
|
title: { |
||||
|
type: String, |
||||
|
default: '' |
||||
|
}, |
||||
|
headerType: { |
||||
|
type: String, |
||||
|
default: "HPQ,HMQ" |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
dataContent: {}, |
||||
|
jobContent: {}, |
||||
|
expendIcon: 'arrow-down', |
||||
|
show: false, |
||||
|
scanList: [], |
||||
|
toLocation: null, |
||||
|
toLocationCode: '', |
||||
|
fromLocationList: [], |
||||
|
fromLocationCode: '', |
||||
|
fromLocation: null, |
||||
|
issueRecord: [], //发货历史 |
||||
|
expand: true, |
||||
|
scanOptions: {}, |
||||
|
editItem: {}, |
||||
|
positionInfo: "请选择位置", |
||||
|
positionList: [], |
||||
|
defaultValueList: [], |
||||
|
label: {}, |
||||
|
fromInventoryStatuses: "", |
||||
|
packageInfo: {} |
||||
|
} |
||||
|
}, |
||||
|
created() { |
||||
|
|
||||
|
}, |
||||
|
watch: {}, |
||||
|
mounted() { |
||||
|
this.detailOptions = getDetailOption(); |
||||
|
this.scanOptions = getDetailEditRemoveOption(); |
||||
|
}, |
||||
|
methods: { |
||||
|
openScanPopup(content, jobcontent) { |
||||
|
this.issueRecord = []; |
||||
|
this.dataContent = content; |
||||
|
this.jobContent = jobcontent; |
||||
|
this.initData(); |
||||
|
this.positionInfo = this.jobContent.workShopCode + "-" + this.jobContent.subList[0].productionLineCode + |
||||
|
"-" + this.jobContent.subList[0].workStationCode |
||||
|
setTimeout(res => { |
||||
|
this.$refs.popup.open('bottom') |
||||
|
}, 500) |
||||
|
}, |
||||
|
|
||||
|
closeScanPopup() { |
||||
|
this.$refs.popup.close(); |
||||
|
this.$emit("closeScan") |
||||
|
//清除数据,恢复默认值 |
||||
|
// Object.assign(this.$data, this.$options.data()); |
||||
|
}, |
||||
|
|
||||
|
initData() { |
||||
|
let that = this; |
||||
|
that.fromLocationList = []; |
||||
|
if (that.dataContent != null) { |
||||
|
that.fromInventoryStatuses = this.jobContent.outInventoryStatuses |
||||
|
that.toLocation = that.dataContent[0]; |
||||
|
that.toLocationCode = that.dataContent[0].toLocationCode; |
||||
|
that.fromLocationList = that.getFromLocationList(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
showBalanceSelect(items, packageInfo) { |
||||
|
this.packageInfo = packageInfo; |
||||
|
this.$refs.balanceSelect.openPopup(items); |
||||
|
}, |
||||
|
|
||||
|
getFromLocationList() { |
||||
|
let list = []; |
||||
|
let location = this.dataContent.find(r => r.toLocationCode == this.toLocationCode); |
||||
|
if (location != undefined) { |
||||
|
location.Items.forEach(item => { |
||||
|
item.Locations.forEach(f => { |
||||
|
list.push(f.fromLocationCode) |
||||
|
}) |
||||
|
}) |
||||
|
this.fromLocationCode = list[0]; |
||||
|
return list; |
||||
|
} else { |
||||
|
this.$refs.comMessage.showErrorMessages('需求库位【' + this.toLocationCode + '】不存在', res => { |
||||
|
this.toLocationCode = ''; |
||||
|
}); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
fromLocationUpdate(fromlocation) { |
||||
|
let location = this.fromLocationList.find(r => r == fromlocation) |
||||
|
if (location == undefined) { |
||||
|
this.fromLocationCode = '' |
||||
|
this.showErrorMessage('发货库位【' + fromlocation + '】不存在') |
||||
|
} |
||||
|
}, |
||||
|
onScan(result) { |
||||
|
try { |
||||
|
let that = this; |
||||
|
|
||||
|
if (that.fromLocationCode == '') { |
||||
|
that.showErrorMessage('请选择来源库位', res => { |
||||
|
that.$refs.toLocationCombox.onFocus(); |
||||
|
}); |
||||
|
return; |
||||
|
} |
||||
|
let packageInfo = result.package; |
||||
|
let itemCode = result.label.itemCode; |
||||
|
let packingCode = result.label.packingNumber; |
||||
|
let lot = result.label.batch; |
||||
|
let item = that.toLocation.Items.find(r => r.itemCode == itemCode); |
||||
|
if (item == undefined) { |
||||
|
that.showErrorMessage('未查找到物料【' + itemCode + '】的发货明细', |
||||
|
res => { |
||||
|
that.getfocus(); |
||||
|
} |
||||
|
) |
||||
|
return; |
||||
|
} else { |
||||
|
//查找库存信息 |
||||
|
uni.showLoading({ |
||||
|
title: '加载中', |
||||
|
mask: true |
||||
|
}) |
||||
|
getBalanceByManagementPrecision(result.label, that.fromLocationCode, that.fromInventoryStatuses, |
||||
|
balanceRes => { |
||||
|
if (balanceRes.success) { |
||||
|
if (balanceRes.data.list.length == 0) { |
||||
|
this.showErrorMessage('在来源库位[' + this.fromLocationCode + '],未查找到该包装的库存记录', |
||||
|
res => { |
||||
|
this.packGetFocus(); |
||||
|
}) |
||||
|
} else if (balanceRes.data.list.length == 1) { |
||||
|
let balance = balanceRes.data.list[0]; |
||||
|
this.afterGetBalance(result.label, balance, packageInfo); |
||||
|
} else { |
||||
|
this.label = result.label; |
||||
|
this.showBalanceSelect(balanceRes.data.list, packageInfo); |
||||
|
} |
||||
|
} else { |
||||
|
this.showErrorMessage(balanceRes.message.message); |
||||
|
} |
||||
|
uni.hideLoading(); |
||||
|
}); |
||||
|
} |
||||
|
} catch (e) { |
||||
|
this.showErrorMessage(e.stack) |
||||
|
uni.hideLoading(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
selectBalanceItem(balance) { |
||||
|
this.afterGetBalance(this.label, balance, this.packageInfo); |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
afterGetBalance(label, balance, packageInfo) { |
||||
|
try { |
||||
|
let that = this; |
||||
|
let itemCode = label.itemCode; |
||||
|
let packingCode = label.packingNumber; |
||||
|
let lot = label.batch; |
||||
|
let item = that.toLocation.Items.find(r => r.itemCode == itemCode); |
||||
|
let fromLocation = item.Locations.find(l => l.fromLocationCode == that.fromLocationCode); |
||||
|
if (fromLocation != undefined) { |
||||
|
let batch = fromLocation.Batchs.find(r => r.batch == lot); |
||||
|
if (batch != undefined) { |
||||
|
if (batch.Records == undefined) { |
||||
|
batch.Records = []; |
||||
|
} |
||||
|
|
||||
|
let record = batch.Records.find(r => r.packingNumber == packingCode); |
||||
|
if (record == undefined) { |
||||
|
//如果有推荐箱码 |
||||
|
if (batch.Recommends.length > 0) { |
||||
|
let recommend = batch.Recommends.find(r => r.packingNumber == packingCode); |
||||
|
if (recommend != undefined) { |
||||
|
that.addRecord(batch, label, balance, packageInfo) |
||||
|
} else { |
||||
|
//允许修改箱码 |
||||
|
if (this.jobContent.allowModifyPackingNumber == 'TRUE') { |
||||
|
that.addRecord(batch, label, balance, packageInfo); |
||||
|
} else { |
||||
|
that.showErrorMessage('未查找到该箱码【' + packingCode + '】的明细', |
||||
|
res => { |
||||
|
that.getfocus(); |
||||
|
} |
||||
|
) |
||||
|
} |
||||
|
} |
||||
|
} else { |
||||
|
that.addRecord(batch, label, balance, packageInfo) |
||||
|
} |
||||
|
} else { |
||||
|
that.showErrorMessage('箱码【' + packingCode + '】已经扫描,请继续扫描下一箱', |
||||
|
res => { |
||||
|
that.getfocus(); |
||||
|
} |
||||
|
) |
||||
|
} |
||||
|
} else { |
||||
|
if (this.jobContent.AllowModifyBatch == null) { |
||||
|
this.showQuestionMessage('在【' + that.fromLocationCode + '】库位下,未查找到批次【' + lot + |
||||
|
'】的发货明细,是否要继续发货?', res => { |
||||
|
if (res) { |
||||
|
let batch = that.createBatchInfo(label, balance); |
||||
|
fromLocation.Batchs.unshift(batch); |
||||
|
} |
||||
|
}) |
||||
|
} else { |
||||
|
that.showErrorMessage('未查找到批次【' + lot + '】的发货明细', |
||||
|
res => { |
||||
|
that.getfocus(); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} else { |
||||
|
that.showErrorMessage('未查找到推荐库位【' + that.fromLocationCode + '】的发货明细', |
||||
|
res => { |
||||
|
that.getfocus(); |
||||
|
} |
||||
|
) |
||||
|
} |
||||
|
} catch (e) { |
||||
|
that.showErrorMessage(e.stack, |
||||
|
res => { |
||||
|
that.getfocus(); |
||||
|
} |
||||
|
) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
createBatchInfo(data, balance) { |
||||
|
let batch = { |
||||
|
batch: data.lot, |
||||
|
qty: 0, |
||||
|
uom: data.uom, |
||||
|
handleQty: Number(data.qty), |
||||
|
Records: [] |
||||
|
} |
||||
|
let record = this.creatRecord(data, balance); |
||||
|
batch.Records.push(record); |
||||
|
this.issueRecord.unshift(record) |
||||
|
return batch; |
||||
|
}, |
||||
|
|
||||
|
creatRecord(label, balance, packageInfo) { |
||||
|
balance.stdPackQty = packageInfo.stdPackQty |
||||
|
balance.stdPackUnit = packageInfo.stdPackUnit |
||||
|
let record = { |
||||
|
itemCode: label.itemCode, |
||||
|
packingNumber: label.packingNumber, |
||||
|
batch: label.batch, |
||||
|
qty: Number(label.qty) > Number(balance.qty) ? Number(balance.qty) : Number(label.qty), |
||||
|
uom: balance.uom, |
||||
|
inventoryStatus: balance.inventoryStatus, |
||||
|
balance: balance, |
||||
|
toLocationCode: this.toLocationCode, |
||||
|
supplierCode: label.supplierCode |
||||
|
} |
||||
|
return record; |
||||
|
}, |
||||
|
|
||||
|
calcBatchHandleQty(batch) { |
||||
|
let handleQty = 0; |
||||
|
batch.Records.forEach(res => { |
||||
|
handleQty = calc.add(handleQty,res.qty) |
||||
|
}) |
||||
|
batch.handleQty = handleQty; |
||||
|
}, |
||||
|
|
||||
|
addRecord(batch, label, balance, packageInfo) { |
||||
|
let record = this.creatRecord(label, balance, packageInfo); |
||||
|
batch.Records.push(record); |
||||
|
this.issueRecord.unshift(record) |
||||
|
this.calcBatchHandleQty(batch); |
||||
|
this.getfocus(); |
||||
|
}, |
||||
|
|
||||
|
getfocus() { |
||||
|
if (this.$refs.comscan != undefined) { |
||||
|
this.$refs.comscan.getfocus(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
losefocus() { |
||||
|
if (this.$refs.comscan != undefined) { |
||||
|
this.$refs.comscan.losefocus(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
expands() { |
||||
|
this.expand = !this.expand; |
||||
|
this.expendIcon = this.expand == true ? "arrow-down" : "arrow-up" |
||||
|
}, |
||||
|
|
||||
|
swipeClick(e, item, index) { |
||||
|
if (e.content.text == "详情") { |
||||
|
this.detail(item) |
||||
|
} else if (e.content.text == "编辑") { |
||||
|
this.edit(item) |
||||
|
} else if (e.content.text == "移除") { |
||||
|
this.remove(item, index) |
||||
|
} |
||||
|
}, |
||||
|
edit(item) { |
||||
|
this.editItem = item; |
||||
|
// item.balance.balanceQty = item.balance.qty; |
||||
|
item.balance.balanceQty = item.balance.qty; |
||||
|
this.$refs.balanceQtyEdit.openEditPopup(item.balance, item.qty); |
||||
|
}, |
||||
|
|
||||
|
detail(item) { |
||||
|
this.showItem = item; |
||||
|
this.$refs.receiptHint.openScanPopup() |
||||
|
}, |
||||
|
remove(record, index) { |
||||
|
this.showQuestionMessage("确定移除扫描信息?", |
||||
|
res => { |
||||
|
if (res) { |
||||
|
record.qty = 0; |
||||
|
this.issueRecord.splice(index, 1) |
||||
|
|
||||
|
let item = this.toLocation.Items.find(r => r.itemCode == record.itemCode); |
||||
|
if (item != undefined) { |
||||
|
item.Locations.forEach(l => { |
||||
|
let batch = l.Batchs.find(b => b.packingNumber == record.packingNumber && b |
||||
|
.batch == record.batch); |
||||
|
let rIndex = batch.Records.findIndex(r => r.packingNumber == record |
||||
|
.packingNumber && r |
||||
|
.batch == record.batch); |
||||
|
batch.Records.splice(rIndex, 1); |
||||
|
}) |
||||
|
} |
||||
|
this.$emit('updateData', item); |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
packGetFocus() { |
||||
|
this.$refs.comscan.getfocus(); |
||||
|
}, |
||||
|
packLoseFocus() { |
||||
|
this.$refs.comscan.losefocus(); |
||||
|
}, |
||||
|
showMessage(message, callback) { |
||||
|
setTimeout(r => { |
||||
|
this.packLoseFocus(); |
||||
|
this.$refs.comMessage.showMessage(message, callback); |
||||
|
}) |
||||
|
}, |
||||
|
showErrorMessage(message, callback) { |
||||
|
setTimeout(r => { |
||||
|
this.packLoseFocus(); |
||||
|
this.$refs.comMessage.showErrorMessage(message, callback); |
||||
|
|
||||
|
}) |
||||
|
}, |
||||
|
showQuestionMessage(message, callback) { |
||||
|
setTimeout(r => { |
||||
|
this.packLoseFocus(); |
||||
|
this.$refs.comMessage.showQuestionMessage(message, callback); |
||||
|
}) |
||||
|
}, |
||||
|
confirm(val) { |
||||
|
this.editItem.qty = Number(val); |
||||
|
this.$emit('updateData', this.editItem) |
||||
|
}, |
||||
|
cancle() { |
||||
|
this.closeScanPopup() |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss"> |
||||
|
button { |
||||
|
border: none; |
||||
|
} |
||||
|
|
||||
|
button::after { |
||||
|
border: none |
||||
|
} |
||||
|
|
||||
|
.scroll-view { |
||||
|
overflow-y: scroll; |
||||
|
height: auto; |
||||
|
max-height: 300rpx; |
||||
|
padding: 10rpx; |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,57 @@ |
|||||
|
<template> |
||||
|
<view class=""> |
||||
|
<uni-popup ref="popup"> |
||||
|
<detail-common-info :dataContent="dataContent" @onClose="closePopup"> |
||||
|
<view class=""> |
||||
|
<view class="uni-flex uni-column"> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">销售订单号 : </text> |
||||
|
<text class="text_wrap">{{dataContent.SoNumber}} </text> |
||||
|
</view> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">销售订单行 : </text> |
||||
|
<text class="text_wrap">{{dataContent.SoLine}} </text> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</detail-common-info> |
||||
|
</uni-popup> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import detailCommonInfo from '@/mycomponents/detail/detailCommonInfo.vue' |
||||
|
export default { |
||||
|
components: { |
||||
|
detailCommonInfo |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
dataContent: { |
||||
|
type: Object, |
||||
|
default: {} |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
mounted() {}, |
||||
|
props: {}, |
||||
|
|
||||
|
methods: { |
||||
|
openPopup(val) { |
||||
|
this.dataContent = val; |
||||
|
setTimeout(res => { |
||||
|
this.$refs.popup.open('bottom') |
||||
|
}, 500) |
||||
|
}, |
||||
|
closePopup() { |
||||
|
this.$refs.popup.close() |
||||
|
}, |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
|
||||
|
|
||||
|
</style> |
@ -0,0 +1,76 @@ |
|||||
|
<template> |
||||
|
<view class=""> |
||||
|
<uni-popup ref="popup"> |
||||
|
<job-common-info :dataContent="dataContent" @onClose="closePopup"> |
||||
|
<view class=""> |
||||
|
<view class="uni-flex uni-column"> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">发货计划单号 : </text> |
||||
|
<text class="text_wrap">{{dataContent.DeliverPlanNumber}} </text> |
||||
|
</view> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">客户发货单号 : </text> |
||||
|
<text class="text_wrap">{{dataContent.CustomerDeliverNumber}} </text> |
||||
|
</view> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">客户代码 : </text> |
||||
|
<text class="text_wrap">{{dataContent.CustomerCode}} </text> |
||||
|
</view> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">客户月台代码 : </text> |
||||
|
<text class="text_wrap">{{dataContent.CustomerDockCode}} </text> |
||||
|
</view> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">承运商 : </text> |
||||
|
<text class="text_wrap">{{dataContent.carrierCode}} </text> |
||||
|
</view> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">运输方式 : </text> |
||||
|
<text class="text_wrap">{{dataContent.transferMode}} </text> |
||||
|
</view> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">车牌号 : </text> |
||||
|
<text class="text_wrap">{{dataContent.vehiclePlateNumber}} </text> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
<u-line></u-line> |
||||
|
</job-common-info> |
||||
|
</uni-popup> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import jobCommonInfo from '@/mycomponents/job/jobCommonInfo.vue' |
||||
|
export default { |
||||
|
components: { |
||||
|
jobCommonInfo, |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
dataContent: { |
||||
|
type: Object, |
||||
|
default: {} |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
mounted() {}, |
||||
|
props: {}, |
||||
|
|
||||
|
methods: { |
||||
|
openPopup(val) { |
||||
|
this.dataContent = val; |
||||
|
this.$refs.popup.open('bottom') |
||||
|
}, |
||||
|
closePopup() { |
||||
|
this.$refs.popup.close() |
||||
|
}, |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
|
||||
|
|
||||
|
</style> |
@ -0,0 +1,47 @@ |
|||||
|
<template> |
||||
|
<uni-popup ref="popupItems"> |
||||
|
<com-popup @onClose="closePopup"> |
||||
|
<view v-for="(item, index) in receiptList" :key="index"> |
||||
|
<com-deliver-job-card :dataContent="item" @click='selectItem(item)'></com-deliver-job-card> |
||||
|
<u-line></u-line> |
||||
|
</view> |
||||
|
</com-popup> |
||||
|
</uni-popup> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import comPopup from '@/mycomponents/common/comPopup.vue' |
||||
|
import comDeliverJobCard from '@/pages/deliver/coms/comDeliverJobCard.vue' |
||||
|
|
||||
|
export default { |
||||
|
emits: ["selectedItem"], |
||||
|
components: { |
||||
|
comPopup, |
||||
|
comDeliverJobCard |
||||
|
}, |
||||
|
props: { |
||||
|
|
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
receiptList: [] |
||||
|
} |
||||
|
}, |
||||
|
methods: { |
||||
|
openPopup(items) { |
||||
|
this.receiptList = items; |
||||
|
this.$refs['popupItems'].open("center"); |
||||
|
}, |
||||
|
closePopup() { |
||||
|
this.$refs.popupItems.close() |
||||
|
}, |
||||
|
selectItem(item) { |
||||
|
this.$emit("selectedItem", item); |
||||
|
this.$refs['popupItems'].close(); |
||||
|
}, |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
</style> |
@ -0,0 +1,87 @@ |
|||||
|
<template> |
||||
|
<view class=""> |
||||
|
<uni-popup ref="popup"> |
||||
|
<requestDetailCommonInfo :dataContent="dataContent" @onClose="closePopup"> |
||||
|
<view class=""> |
||||
|
<view class="uni-flex uni-column"> |
||||
|
|
||||
|
|
||||
|
<view class="item"> |
||||
|
<text class="item_title">销售订单号 : </text> |
||||
|
<text class="text_wrap">{{dataContent.soNumber}} </text> |
||||
|
</view> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">销售订单行 : </text> |
||||
|
<text class="text_wrap">{{dataContent.soLine}} </text> |
||||
|
</view> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">包装号 : </text> |
||||
|
<text class="text_wrap">{{dataContent.packingNumber}} </text> |
||||
|
</view> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">器具号 : </text> |
||||
|
<text class="text_wrap">{{dataContent.containerNumber}} </text> |
||||
|
</view> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">批次 : </text> |
||||
|
<text class="text_wrap">{{dataContent.batch}} </text> |
||||
|
</view> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">库存状态 : </text> |
||||
|
<text class="text_wrap">{{dataContent.inventoryStatus}} </text> |
||||
|
</view> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">到库位代码 : </text> |
||||
|
<text class="text_wrap">{{dataContent.toLocationCode}} </text> |
||||
|
</view> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">从货主代码 : </text> |
||||
|
<text class="text_wrap">{{dataContent.fromOwnerCode}} </text> |
||||
|
</view> |
||||
|
<view class="item"> |
||||
|
<text class="item_title">到货主代码 : </text> |
||||
|
<text class="text_wrap">{{dataContent.toOwnerCode}} </text> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</requestDetailCommonInfo> |
||||
|
</uni-popup> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import requestDetailCommonInfo from '@/mycomponents/detail/requestDetailCommonInfo.vue' |
||||
|
export default { |
||||
|
components: { |
||||
|
requestDetailCommonInfo |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
dataContent: { |
||||
|
type: Object, |
||||
|
default: {} |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
mounted() {}, |
||||
|
props: {}, |
||||
|
|
||||
|
methods: { |
||||
|
openPopup(val) { |
||||
|
this.dataContent = val; |
||||
|
setTimeout(res => { |
||||
|
this.$refs.popup.open('bottom') |
||||
|
}, 500) |
||||
|
}, |
||||
|
closePopup() { |
||||
|
this.$refs.popup.close() |
||||
|
}, |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
|
||||
|
|
||||
|
</style> |
@ -0,0 +1,99 @@ |
|||||
|
<template> |
||||
|
<view class=""> |
||||
|
<uni-popup ref="popup"> |
||||
|
<request-common-info :dataContent="dataContent" @onClose="closePopup"> |
||||
|
<view class=""> |
||||
|
<comListItem :dataList="dataList"></comListItem> |
||||
|
</view> |
||||
|
|
||||
|
<u-line></u-line> |
||||
|
</request-common-info> |
||||
|
</uni-popup> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import requestCommonInfo from '@/mycomponents/request/requestCommonInfo.vue' |
||||
|
import comListItem from '@/mycomponents/common/comListItem.vue'; |
||||
|
export default { |
||||
|
components: { |
||||
|
requestCommonInfo, |
||||
|
comListItem |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
dataContent:{}, |
||||
|
dataList:[] |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
mounted() {}, |
||||
|
props: {}, |
||||
|
|
||||
|
methods: { |
||||
|
openPopup(val) { |
||||
|
this.dataContent = val; |
||||
|
this.dataList=[{ |
||||
|
title: '发货计划单号', |
||||
|
content: this.dataContent.deliverPlanNumber |
||||
|
}, { |
||||
|
title: '客户发货单号', |
||||
|
content: this.dataContent.customerDeliverNumber |
||||
|
},{ |
||||
|
title: '客户代码', |
||||
|
content: this.dataContent.customerCode, |
||||
|
},{ |
||||
|
title: '客户月台代码', |
||||
|
content: this.dataContent.customerDockCode, |
||||
|
},{ |
||||
|
title: '承运商', |
||||
|
content: this.dataContent.carrierCode, |
||||
|
},{ |
||||
|
title: '运输方式', |
||||
|
content: this.dataContent.transferMode, |
||||
|
},{ |
||||
|
title: '车牌号', |
||||
|
content: this.dataContent.vehiclePlateNumber, |
||||
|
},{ |
||||
|
title: '从月台代码', |
||||
|
content: this.dataContent.fromDockCode, |
||||
|
},{ |
||||
|
title: '从仓库代码', |
||||
|
content: this.dataContent.fromWarehouseCode, |
||||
|
},{ |
||||
|
title: '到仓库代码', |
||||
|
content: this.dataContent.toWarehouseCode |
||||
|
}, |
||||
|
{ |
||||
|
title: '从库位类型范围', |
||||
|
content: this.dataContent.fromLocationTypes, |
||||
|
type:"locationType" |
||||
|
}, |
||||
|
{ |
||||
|
title: '到库位类型范围', |
||||
|
content: this.dataContent.toLocationTypes, |
||||
|
type:"locationType" |
||||
|
}, |
||||
|
{ |
||||
|
title: '从库区代码范围', |
||||
|
content: this.dataContent.fromAreaCodes |
||||
|
}, |
||||
|
{ |
||||
|
title: '到库区代码范围', |
||||
|
content: this.dataContent.toAreaCodes |
||||
|
}]; |
||||
|
setTimeout(res => { |
||||
|
this.$refs.popup.open('bottom') |
||||
|
}, 500) |
||||
|
}, |
||||
|
closePopup() { |
||||
|
this.$refs.popup.close() |
||||
|
}, |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
|
||||
|
|
||||
|
</style> |
@ -0,0 +1,462 @@ |
|||||
|
<template> |
||||
|
<view class="page-wraper"> |
||||
|
<view class="page-header"> |
||||
|
<view class="header_job_top"> |
||||
|
<job-top :dataContent="jobContent"></job-top> |
||||
|
</view> |
||||
|
<view class="header_item"> |
||||
|
申请单号:{{jobContent.requestNumber}} |
||||
|
</view> |
||||
|
<u-line color="#D8D8D8"></u-line> |
||||
|
<view class="cen_card" style="padding: 5rpx;"> |
||||
|
<view class="cell_box uni-flex uni-row"> |
||||
|
<view class="cell_info"> |
||||
|
<view class="text_lightblue">客户代码</view> |
||||
|
<view>{{jobContent.customerCode}}</view> |
||||
|
</view> |
||||
|
<view class="cell_info"> |
||||
|
<view class="text_lightblue">客户寄售库</view> |
||||
|
<view>{{toLocationCode}}</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
<u-line /> |
||||
|
</view> |
||||
|
</view> |
||||
|
|
||||
|
<view class="page-main"> |
||||
|
<scroll-view scroll-y="true" class=""> |
||||
|
<view v-for="(toLocation, index) in detailSource"> |
||||
|
<comDeliverDetailCard ref='comIssueDetailCard' :dataContent="toLocation" @updateData='updateData'> |
||||
|
</comDeliverDetailCard> |
||||
|
</view> |
||||
|
</scroll-view> |
||||
|
</view> |
||||
|
|
||||
|
<div class="btn_bottom"> |
||||
|
<view class="" style="display: flex;flex-direction: row;"> |
||||
|
<view class=""> |
||||
|
<button class="btn_commit" hover-class="btn_commit_after" @click="submit()">提交</button> |
||||
|
</view> |
||||
|
</view> |
||||
|
</div> |
||||
|
<win-scan-button @goScan='openScanDetailPopup'></win-scan-button> |
||||
|
<comScanDeliverPack ref="comScanIssuePack" @closeScan='closeScan' @updateData='updateData'> |
||||
|
</comScanDeliverPack> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { |
||||
|
getDeliverDetail, |
||||
|
getBasicLocationByCode, |
||||
|
takeDeliverJob, |
||||
|
cancleTakeDeliverJob, |
||||
|
deliverJobSubmit |
||||
|
} from '@/api/request2.js'; |
||||
|
|
||||
|
import { |
||||
|
calc |
||||
|
} from '@/common/calc.js'; |
||||
|
|
||||
|
import { |
||||
|
goHome, |
||||
|
updateTitle, |
||||
|
navigateBack, |
||||
|
getRemoveOption, |
||||
|
getCurrDateTime, |
||||
|
getDirectoryItemArray, |
||||
|
getPackingNumberAndBatch, |
||||
|
} from '@/common/basic.js'; |
||||
|
|
||||
|
import { |
||||
|
getDataSource |
||||
|
} from '@/pages/issue/js/issue.js'; |
||||
|
|
||||
|
import { |
||||
|
getManagementPrecisions |
||||
|
} from '@/common/balance.js'; |
||||
|
|
||||
|
|
||||
|
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue' |
||||
|
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
||||
|
import comDeliverDetailCard from '@/pages/deliver/coms/comDeliverDetailCard.vue' |
||||
|
import comScanDeliverPack from '@/pages/deliver/coms/comScanDeliverPack.vue' |
||||
|
import jobTop from '@/mycomponents/job/jobTop.vue' |
||||
|
|
||||
|
export default { |
||||
|
name: 'issueDetail', |
||||
|
components: { |
||||
|
jobDetailPopup, |
||||
|
winScanButton, |
||||
|
comDeliverDetailCard, |
||||
|
comScanDeliverPack, |
||||
|
jobTop |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
id: '', |
||||
|
jobContent: {}, //任务内容 |
||||
|
subList: [], //接口返回的任务subList |
||||
|
detailSource: [], //绑定在页面上的数据源 |
||||
|
detailOptions: [], |
||||
|
scanOptions: [], |
||||
|
status: "", |
||||
|
toLocationCode: "", |
||||
|
jobStatus:"" |
||||
|
}; |
||||
|
}, |
||||
|
|
||||
|
props: { |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
onLoad(option) { |
||||
|
this.id = option.id; |
||||
|
if (this.id != undefined) { |
||||
|
//新建的任务自动接收 |
||||
|
if (option.status == "1") { |
||||
|
this.receive((callback => { |
||||
|
this.getDetail(); |
||||
|
})); |
||||
|
} else { |
||||
|
this.getDetail(); |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
onNavigationBarButtonTap(e) { |
||||
|
if (e.index === 0) { |
||||
|
goHome(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
//拦截返回按钮事件 |
||||
|
onBackPress(e) { |
||||
|
//已经接收但是没提交任务 |
||||
|
if (e.from == 'backbutton') { |
||||
|
if (this.jobStatus=="2") { |
||||
|
//取消承接任务 |
||||
|
cancleTakeDeliverJob(this.id).then(res => { |
||||
|
uni.navigateBack(); |
||||
|
}).catch(error => { |
||||
|
uni.navigateBack(); |
||||
|
}) |
||||
|
} else { |
||||
|
uni.navigateBack(); |
||||
|
} |
||||
|
|
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
methods: { |
||||
|
//接收 |
||||
|
receive(callback) { |
||||
|
if (this.id != null) { |
||||
|
takeDeliverJob(this.id).then(res => { |
||||
|
callback(); |
||||
|
}).catch(error => { |
||||
|
this.showErrorMessage(error) |
||||
|
}) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
getDetail() { |
||||
|
var that = this; |
||||
|
uni.showLoading({ |
||||
|
title: "加载中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
getDeliverDetail(that.id).then(res => { |
||||
|
uni.hideLoading(); |
||||
|
if (res.data == null) { |
||||
|
that.showMessage('未获取到详情'); |
||||
|
} else { |
||||
|
if (res.data.subList.length > 0) { |
||||
|
that.jobContent = res.data; |
||||
|
that.jobStatus = res.data.status; |
||||
|
|
||||
|
that.subList = res.data.subList; |
||||
|
that.detailSource = getDataSource(that.detailSource, that.subList) |
||||
|
that.toLocationCode = that.subList[0].toLocationCode |
||||
|
that.resizeCollapse(); |
||||
|
} else { |
||||
|
that.showMessage('列表数据为0'); |
||||
|
} |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
uni.hideLoading() |
||||
|
this.showErrorMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
closeScan() { |
||||
|
this.resizeCollapse(); |
||||
|
}, |
||||
|
|
||||
|
resizeCollapse() { |
||||
|
this.$nextTick(r => { |
||||
|
this.$refs.comIssueDetailCard.forEach(r => { |
||||
|
r.resizeCollapse(); |
||||
|
}) |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
|
||||
|
submit() { |
||||
|
uni.showLoading({ |
||||
|
title: "提交中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
|
||||
|
//目前任务只到一个库位 |
||||
|
var itemCodes = [] |
||||
|
let locationCode = this.detailSource[0].toLocationCode |
||||
|
this.detailSource.forEach(toLocationCode => { |
||||
|
toLocationCode.Items.forEach(item => { |
||||
|
itemCodes.push(item.itemCode) |
||||
|
}) |
||||
|
}) |
||||
|
|
||||
|
//使用在途库,不查询管理模式 |
||||
|
if (locationCode == null) { |
||||
|
this.submitJob(); |
||||
|
} else { |
||||
|
//获取管理模式,封装参数 |
||||
|
getManagementPrecisions(itemCodes, locationCode, res => { |
||||
|
if (res.success) { |
||||
|
this.managementList = res.list; |
||||
|
this.submitJob(); |
||||
|
} else { |
||||
|
uni.hideLoading(); |
||||
|
this.showErrorMessage(res.message); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
submitJob() { |
||||
|
var params = this.setParams() |
||||
|
console.log("提交参数", JSON.stringify(params)); |
||||
|
|
||||
|
deliverJobSubmit(params).then(res => { |
||||
|
uni.hideLoading() |
||||
|
if (res.data) { |
||||
|
this.showCommitSuccessMessage("提交成功<br>生成发货记录" + res.data) |
||||
|
} else { |
||||
|
this.showErrorMessage("提交失败[" + res.msg + "]") |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
uni.hideLoading() |
||||
|
this.showErrorMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
setParams() { |
||||
|
var subList = [] |
||||
|
var createTime = getCurrDateTime(); |
||||
|
var creator = this.$store.state.user.id |
||||
|
this.detailSource.forEach(toLocationCode => { |
||||
|
toLocationCode.Items.forEach(item => { |
||||
|
item.Locations.forEach(fromLocation => { |
||||
|
fromLocation.Batchs.forEach(batch => { |
||||
|
let subItem = batch.detail; |
||||
|
subItem.recordList = []; |
||||
|
if (batch.Records.length > 0) { |
||||
|
batch.Records.forEach(r => { |
||||
|
let record = {}; |
||||
|
record.handleQty = r.qty; |
||||
|
record.toContainerNumber = r |
||||
|
.ContainerNumber; |
||||
|
record.toInventoryStatus = r |
||||
|
.inventoryStatus; |
||||
|
record.toLocationCode = subItem |
||||
|
.toLocationCode; |
||||
|
record.supplierCode = r.supplierCode; |
||||
|
|
||||
|
//使用在途库不改变管理模式 |
||||
|
if (this.toLocationCode ==null) { |
||||
|
record.toPackingNumber = r |
||||
|
.packingNumber; |
||||
|
record.toBatch = r.batch; |
||||
|
} else { |
||||
|
var info = getPackingNumberAndBatch( |
||||
|
this.managementList, r |
||||
|
.itemCode, |
||||
|
r.packingNumber, r |
||||
|
.batch); |
||||
|
record.toPackingNumber = info |
||||
|
.packingNumber; |
||||
|
record.toBatch = info.batch; |
||||
|
} |
||||
|
subItem.recordList.push(record); |
||||
|
}) |
||||
|
subList.push(subItem); |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
}) |
||||
|
}) |
||||
|
|
||||
|
this.jobContent.subList = subList |
||||
|
this.jobContent.createTime = createTime; |
||||
|
this.jobContent.creator = creator; |
||||
|
return this.jobContent; |
||||
|
}, |
||||
|
|
||||
|
cancel() { |
||||
|
let that = this; |
||||
|
this.$refs.comMessage.showQuestionMessage('是否要清空已扫描的物料和目标库位信息?', res => { |
||||
|
if (res) { |
||||
|
that.clearInfo(); |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
clearInfo() { |
||||
|
this.dataContent.itemCodeList.forEach(res => { |
||||
|
if (res.recommendList != null) { |
||||
|
res.recommendList.forEach(res1 => { |
||||
|
if (res1.locationCodeList != null) { |
||||
|
res1.locationCodeList.forEach(res2 => { |
||||
|
if (res2.packingCodeList != null) { |
||||
|
res2.packingCodeList.forEach(res3 => { |
||||
|
res3.itemCode = ""; |
||||
|
res3.qty = 0; |
||||
|
}) |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
updateData(record) { |
||||
|
let requestLocation = this.detailSource.find(r => r.toLocationCode == record.toLocationCode); |
||||
|
let item = requestLocation.Items.find(r => r.itemCode == record.itemCode); |
||||
|
let itemHandleQty = 0; |
||||
|
if (item != undefined) { |
||||
|
item.Locations.forEach(l => { |
||||
|
let batch = l.Batchs.find(b => (b.packingNumber == record.packingNumber || b |
||||
|
.packingNumber == null || b.packingNumber == '') && b.batch == |
||||
|
record.batch); |
||||
|
let handleQty = 0; |
||||
|
if (batch != undefined) { |
||||
|
batch.Records.forEach(res => { |
||||
|
handleQty = calc.add(handleQty, res.qty) |
||||
|
}) |
||||
|
batch.handleQty = handleQty; |
||||
|
itemHandleQty = calc.add(itemHandleQty, handleQty) |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
// item.handleQty=itemHandleQty; |
||||
|
}, |
||||
|
|
||||
|
scanPopupGetFocus() { |
||||
|
if (this.$refs.scanPopup != undefined) { |
||||
|
this.$refs.scanPopup.getfocus(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
showMessage(message) { |
||||
|
this.$refs.comMessage.showMessage(message, res => { |
||||
|
if (res) { |
||||
|
this.afterCloseMessage() |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
showErrorMessage(message) { |
||||
|
this.$refs.comMessage.showErrorMessage(message, res => { |
||||
|
if (res) { |
||||
|
this.afterCloseMessage() |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
showScanMessage(message) { |
||||
|
this.$refs.comMessage.showScanMessage(message); |
||||
|
}, |
||||
|
|
||||
|
showCommitSuccess() { |
||||
|
this.$refs.comMessage.showCommitSuccess(); |
||||
|
}, |
||||
|
|
||||
|
showCommitSuccessMessage(hint) { |
||||
|
this.$refs.comMessage.showSuccessMessage(hint, res => { |
||||
|
navigateBack(1) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
showRescanMessage(message) { |
||||
|
this.$refs.comMessage.showRescanMessage(message); |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
afterCloseMessage() { |
||||
|
this.scanPopupGetFocus(); |
||||
|
}, |
||||
|
|
||||
|
showScanMessage(message) { |
||||
|
this.$refs.comMessage.showScanMessage(message); |
||||
|
}, |
||||
|
|
||||
|
closeScanMessage() { |
||||
|
this.scanPopupGetFocus(); |
||||
|
}, |
||||
|
confirm(data) { |
||||
|
this.dataContent = data; |
||||
|
}, |
||||
|
confirmResult(result) { |
||||
|
this.dataContent = result; |
||||
|
this.$forceUpdate(); |
||||
|
}, |
||||
|
openScanDetailPopup() { |
||||
|
var datacontent = {} |
||||
|
//克隆对象,深度克隆,防止双向绑定同一个变量 |
||||
|
// Object.assign(datacontent, this.detailSource); |
||||
|
this.$refs.comScanIssuePack.openScanPopup(this.detailSource, this.jobContent); |
||||
|
}, |
||||
|
closeScanPopup() { |
||||
|
this.updateCommitBtn(); |
||||
|
}, |
||||
|
} |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="scss"> |
||||
|
.uni-numbox__value { |
||||
|
width: 40px; |
||||
|
} |
||||
|
|
||||
|
button[disabled] { |
||||
|
background-color: #3C9CFF; |
||||
|
color: #fff; |
||||
|
opacity: 0.7; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
// /deep/ .input-value { |
||||
|
// font-size: 16px; |
||||
|
// } |
||||
|
|
||||
|
// /deep/ .uni-collapse-item__title-text { |
||||
|
// font-size: 16px; |
||||
|
// } |
||||
|
|
||||
|
// /deep/ .uni-collapse-item--border { |
||||
|
// border-bottom-width: 0px; |
||||
|
// border-bottom-color: #ebeef5; |
||||
|
// } |
||||
|
|
||||
|
// /deep/ .uni-collapse-item--border { |
||||
|
// border-bottom-width: 1px; |
||||
|
// border-bottom-color: #ebeef5; |
||||
|
// } |
||||
|
</style> |
@ -0,0 +1,286 @@ |
|||||
|
<template> |
||||
|
<view class=""> |
||||
|
<com-empty-view v-if="jobList.length==0"></com-empty-view> |
||||
|
<job-filter ref="filter" otherTitle="ASN" @switchChangeToday="switchChangeToday" |
||||
|
@switchChangeWait="switchChangeWait" @onScanNumber="getScanNumber" :checkedToday="checkedToday" |
||||
|
:checkedWaitTask="checkedWaitTask"> |
||||
|
</job-filter> |
||||
|
<view v-if="jobList.length>0"> |
||||
|
<uni-swipe-action ref="swipeAction"> |
||||
|
<view v-for="(item, index) in jobList" :key="index"> |
||||
|
<uni-swipe-action-item |
||||
|
:right-options="item.status=='2'?detailGiveupOptions:detailOptions" |
||||
|
@click="swipeClick($event,item)"> |
||||
|
<com-deliver-job-card :dataContent="item" @click='openJobDetail(item)'></com-deliver-job-card> |
||||
|
</uni-swipe-action-item> |
||||
|
</view> |
||||
|
</uni-swipe-action> |
||||
|
|
||||
|
<job-list-popup ref="jobListPopup" @selectedItem="selectedItem"></job-list-popup> |
||||
|
<job-info-popup ref='jobInfoPopup'></job-info-popup> |
||||
|
|
||||
|
<uni-load-more :status="loadingType" v-if="jobList.length>0" /> |
||||
|
|
||||
|
</view> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
|
||||
|
import { |
||||
|
getDeliverJobList, |
||||
|
cancleTakeDeliverJob |
||||
|
} from '@/api/request2.js'; |
||||
|
|
||||
|
import { |
||||
|
goHome, |
||||
|
updateTitle |
||||
|
} from '@/common/basic.js'; |
||||
|
|
||||
|
import { |
||||
|
getDetailOption, |
||||
|
getDetailGiveupOption |
||||
|
} from '@/common/array.js'; |
||||
|
|
||||
|
import comEmptyView from '@/mycomponents/common/comEmptyView.vue' |
||||
|
import jobFilter from '@/mycomponents/job/jobFilter.vue' |
||||
|
import comDeliverJobCard from '@/pages/deliver/coms/comDeliverJobCard.vue' |
||||
|
import jobListPopup from '@/pages/deliver/coms/jobListPopup.vue' |
||||
|
import jobInfoPopup from '@/pages/deliver/coms/jobInfoPopup.vue' |
||||
|
|
||||
|
|
||||
|
export default { |
||||
|
name: 'Deliver', |
||||
|
components: { |
||||
|
comEmptyView, |
||||
|
jobFilter, |
||||
|
comDeliverJobCard, |
||||
|
jobListPopup, |
||||
|
jobInfoPopup |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
jobList: [], |
||||
|
pageNo: 1, |
||||
|
pageSize: 10, |
||||
|
totalCount: 0, |
||||
|
loadingType: "nomore", |
||||
|
checkedToday: false, |
||||
|
checkedWaitTask: false, |
||||
|
todayTime: "", |
||||
|
status: '1,2', //待处理 、进行中 |
||||
|
detailOptions: [], |
||||
|
detailGiveupOptions: [], |
||||
|
}; |
||||
|
}, |
||||
|
|
||||
|
onShow() { |
||||
|
this.getList('refresh'); |
||||
|
}, |
||||
|
|
||||
|
onReady() { |
||||
|
this.detailOptions = getDetailOption(); |
||||
|
this.detailGiveupOptions = getDetailGiveupOption(); |
||||
|
}, |
||||
|
onReachBottom() { |
||||
|
//避免多次触发 |
||||
|
if (this.loadingType == 'loading' || this.loadingType == 'nomore') { |
||||
|
return; |
||||
|
} |
||||
|
this.getList("more"); |
||||
|
}, |
||||
|
|
||||
|
onPullDownRefresh() { |
||||
|
this.getList('refresh'); |
||||
|
}, |
||||
|
|
||||
|
//后退按钮 |
||||
|
onBackPress(options) { |
||||
|
if (options.from === 'navigateBack') { |
||||
|
uni.navigateBack({ |
||||
|
delta: 1 |
||||
|
}) |
||||
|
return false; |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
//返回首页 |
||||
|
onNavigationBarButtonTap(e) { |
||||
|
if (e.index === 0) { |
||||
|
goHome(); |
||||
|
} else if (e.index == 1) { |
||||
|
this.$refs.filter.openFilter(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
methods: { |
||||
|
getList(type) { |
||||
|
let that = this; |
||||
|
uni.showLoading({ |
||||
|
title: "加载中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
this.loadingType = "loading"; |
||||
|
if (type === "refresh") { |
||||
|
this.pageNo = 1; |
||||
|
this.jobList = []; |
||||
|
} |
||||
|
var filters = [] |
||||
|
if (this.checkedToday) { |
||||
|
filters.push({ |
||||
|
column: "request_time", |
||||
|
action: "betweeen", |
||||
|
value: this.todayTime |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
filters.push({ |
||||
|
column: "status", |
||||
|
action: "in", |
||||
|
value: this.status |
||||
|
}) |
||||
|
|
||||
|
var params = { |
||||
|
filters: filters, |
||||
|
pageNo: this.pageNo, |
||||
|
pageSize: this.pageSize, |
||||
|
} |
||||
|
getDeliverJobList(params).then(res => { |
||||
|
uni.hideLoading(); |
||||
|
if (type === "refresh") { |
||||
|
uni.stopPullDownRefresh(); |
||||
|
} |
||||
|
|
||||
|
var list = res.data.list; |
||||
|
this.totalCount = res.data.total |
||||
|
this.loadingType = "loadmore"; |
||||
|
if (list == null || list.length == 0) { |
||||
|
this.loadingType = "nomore"; |
||||
|
return; |
||||
|
} |
||||
|
this.jobList = type === "refresh" ? list : this.receiptList.concat(list); |
||||
|
this.pageNo++; |
||||
|
updateTitle("制品发货任务(" + this.totalCount + ")"); |
||||
|
|
||||
|
}).catch(error => { |
||||
|
if (type === "refresh") { |
||||
|
uni.stopPullDownRefresh(); |
||||
|
} |
||||
|
updateTitle("制品发货任务"); |
||||
|
this.loadingType = ""; |
||||
|
uni.hideLoading(); |
||||
|
that.showMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
openJobDetail(item) { |
||||
|
uni.navigateTo({ |
||||
|
url: './deliverDetail?id=' + item.id + '&status=' + item.status |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
showItemList(itemList) { |
||||
|
this.$refs.jobListPopup.openPopup(itemList); |
||||
|
}, |
||||
|
|
||||
|
selectedItem(item) { |
||||
|
this.openJobDetail(item); |
||||
|
}, |
||||
|
|
||||
|
swipeClick(e, dataContent) { |
||||
|
if (e.content.text == "详情") { |
||||
|
this.openjobInfoPopup(dataContent); |
||||
|
} else if (e.content.text == "放弃") { |
||||
|
this.$refs.comMessage.showQuestionMessage("确定要放弃当前任务?", |
||||
|
res => { |
||||
|
if (res) { |
||||
|
this.cancleJob(dataContent.id); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
openjobInfoPopup(item) { |
||||
|
this.$refs.jobInfoPopup.openPopup(item) |
||||
|
}, |
||||
|
|
||||
|
cancleJob(id) { |
||||
|
cancleTakeDeliverJob(id).then(res => { |
||||
|
if(res.data){ |
||||
|
this.getList("refresh") |
||||
|
uni.showToast({ |
||||
|
title:"放弃任务成功" |
||||
|
}) |
||||
|
}else { |
||||
|
this.showMessage("放弃任务失败") |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
this.showMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
switchChangeToday(state, creationTime) { |
||||
|
this.checkedToday = state; |
||||
|
this.todayTime = creationTime; |
||||
|
this.getList("refresh"); |
||||
|
}, |
||||
|
|
||||
|
switchChangeWait(state, jobStatus) { |
||||
|
this.checkedWaitTask = state; |
||||
|
this.status = jobStatus; |
||||
|
this.getList("refresh"); |
||||
|
}, |
||||
|
getScanNumber(code) { |
||||
|
this.getDataListByType(code) |
||||
|
}, |
||||
|
getDataListByType(code) { |
||||
|
let that = this; |
||||
|
uni.showLoading({ |
||||
|
title: "加载中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
var filters = [] |
||||
|
filters.push({ |
||||
|
column: "status", |
||||
|
action: "in", |
||||
|
value: '1,2' |
||||
|
}) |
||||
|
filters.push({ |
||||
|
column: "number", |
||||
|
action: "==", |
||||
|
value: code |
||||
|
}) |
||||
|
|
||||
|
var params = { |
||||
|
filters: filters, |
||||
|
pageNo: 1, |
||||
|
pageSize: 100, |
||||
|
} |
||||
|
getDeliverJobList(params).then(res => { |
||||
|
uni.hideLoading(); |
||||
|
if (res.data.list.length == 0) { |
||||
|
that.showMessage('未查找到' + '【' + code + '】的收货任务'); |
||||
|
} else if (res.data.list.length == 1) { |
||||
|
that.openJobDetail(res.data.list[0]); |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
uni.hideLoading(); |
||||
|
that.showMessage(error); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
showMessage(message) { |
||||
|
this.$refs.comMessage.showErrorMessage(message, res => { |
||||
|
if (res) { |
||||
|
|
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="scss"> |
||||
|
|
||||
|
</style> |
@ -0,0 +1,502 @@ |
|||||
|
<template> |
||||
|
<view class="page-wraper"> |
||||
|
<view class=""> |
||||
|
<com-blank-view @goScan='showFromLocationPopup' v-if="detailSource.length==0"></com-blank-view> |
||||
|
</view> |
||||
|
<view class="page-wraper" v-if="detailSource.length>0"> |
||||
|
<view class="page-main"> |
||||
|
<scroll-view scroll-y="true" class="page-main-scroll"> |
||||
|
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> |
||||
|
<view class=""> |
||||
|
<record-com-detail-card :dataContent="item" :index="index" :settingParam="dataContent" |
||||
|
:isShowLocation="true" @removeItem="removeItem(index,item)" @updateData="updateData" |
||||
|
@removePack="removePack"> |
||||
|
</record-com-detail-card> |
||||
|
</view> |
||||
|
<u-line /> |
||||
|
</view> |
||||
|
</scroll-view> |
||||
|
</view> |
||||
|
|
||||
|
<view class="uni-flex uni-row u-col-center" style="width: 100%;"> |
||||
|
<view class="" style=" text-align: center;font-size: 32rpx;font-weight: 700;margin-left: 10rpx;"> |
||||
|
客户 : |
||||
|
</view> |
||||
|
<uni-data-picker v-if="detailSource.length>0" style="padding: 20rpx; background-color:#fff;" |
||||
|
class='uni-data-picker' placeholder="请选择客户" popup-title="选择客户" :localdata="customerList" |
||||
|
@change="reasonChange"> |
||||
|
|
||||
|
</uni-data-picker> |
||||
|
</view> |
||||
|
|
||||
|
<view class="page-footer"> |
||||
|
<view class="uni-flex u-col-center space-between padding_10" |
||||
|
style="background-color:ghostwhite; width: 100%; "> |
||||
|
<view class=""> |
||||
|
<requiredLocation ref='comScanLocation' title="目标库位" :locationCode="toLocationCode" |
||||
|
@getLocation='scanLocationCode' :isShowEdit="true" |
||||
|
:locationTypeList="tolocationTypeList"></requiredLocation> |
||||
|
</view> |
||||
|
<view class=" uni-flex uni-row"> |
||||
|
<button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
<win-scan-button @goScan='openScanPopup'></win-scan-button> |
||||
|
</view> |
||||
|
|
||||
|
<win-scan-pack-and-location ref="scanPopup" @getResult='getScanResult' headerType="HMQ"></win-scan-pack-and-location> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
<win-scan-location ref="scanLocationCode" title="来源库位" @getLocation='getLocation' |
||||
|
:locationTypeList="fromlocationTypeList"></win-scan-location> |
||||
|
</view> |
||||
|
|
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { |
||||
|
getBasicCustomerList, |
||||
|
deliverRecordSubmit |
||||
|
} from '@/api/request2.js'; |
||||
|
import { |
||||
|
goHome, |
||||
|
getPackingNumberAndBatchByList, |
||||
|
deepCopyData |
||||
|
} from '@/common/basic.js'; |
||||
|
|
||||
|
import { |
||||
|
getInventoryStatusDesc, |
||||
|
getDirectoryItemArray |
||||
|
} from '@/common/directory.js'; |
||||
|
|
||||
|
import { |
||||
|
getPrecisionStrategyList |
||||
|
} from '@/common/balance.js'; |
||||
|
|
||||
|
import { |
||||
|
getBusinessType, |
||||
|
createItemInfo, |
||||
|
createDetailInfo, |
||||
|
calcHandleQty |
||||
|
} from '@/common/record.js'; |
||||
|
|
||||
|
|
||||
|
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
||||
|
import winScanPack from '@/mycomponents/scan/winScanPack.vue' |
||||
|
import requiredLocation from '@/mycomponents/location/requiredLocation.vue' |
||||
|
import comBlankView from '@/mycomponents/common/comBlankView.vue' |
||||
|
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue" |
||||
|
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue" |
||||
|
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' |
||||
|
|
||||
|
|
||||
|
export default { |
||||
|
components: { |
||||
|
winScanButton, |
||||
|
winScanPack, |
||||
|
requiredLocation, |
||||
|
comBlankView, |
||||
|
winScanLocation, |
||||
|
winScanPackAndLocation, |
||||
|
recordComDetailCard |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
id: '', |
||||
|
subList: [], //接口返回的任务subList |
||||
|
detailSource: [], //绑定在页面上的数据源 |
||||
|
locationTypeList: [], |
||||
|
fromLocationCode: "", |
||||
|
toLocationCode: "", |
||||
|
fromlocationTypeList: [], |
||||
|
tolocationTypeList: [], |
||||
|
businessType: {}, |
||||
|
customerList: [], |
||||
|
customerText: "", |
||||
|
customerCode : "", |
||||
|
dataContent:{}, |
||||
|
managementList:[] |
||||
|
}; |
||||
|
}, |
||||
|
onLoad(option) { |
||||
|
|
||||
|
var typeCode = "Deliver" |
||||
|
getBusinessType(typeCode, res => { |
||||
|
if (res.success) { |
||||
|
this.businessType = res.businessType; |
||||
|
this.fromlocationTypeList = res.fromlocationTypeList; |
||||
|
this.tolocationTypeList = res.tolocationTypeList; |
||||
|
this.showFromLocationPopup(); |
||||
|
} else { |
||||
|
this.showErrorMessage(res.message) |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
getBasicCustomerList().then(res => { |
||||
|
if (res.data.length > 0) { |
||||
|
var list = res.data; |
||||
|
list.forEach(item => { |
||||
|
item.text = item.name |
||||
|
item.value = item.code |
||||
|
}) |
||||
|
this.customerList = list; |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
this.showErrorMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
//返回首页 |
||||
|
onNavigationBarButtonTap(e) { |
||||
|
if (e.index === 0) { |
||||
|
goHome(); |
||||
|
} |
||||
|
}, |
||||
|
//拦截返回按钮事件 |
||||
|
onBackPress(e) {}, |
||||
|
|
||||
|
onPullDownRefresh() {}, |
||||
|
|
||||
|
mounted() {}, |
||||
|
methods: { |
||||
|
getScanResult(result) { |
||||
|
let balance = result.balance; |
||||
|
let label = result.label; |
||||
|
let pack = result.package; |
||||
|
let labelQty =result.label.qty; |
||||
|
let balanceQty =result.balance.qty; |
||||
|
var item = this.detailSource.find(res => { |
||||
|
if (res.itemCode == balance.itemCode) { |
||||
|
return res |
||||
|
} |
||||
|
}) |
||||
|
if (item == undefined) { |
||||
|
var itemp = createItemInfo(balance, pack); |
||||
|
let newDetail = createDetailInfo(balance, pack); // |
||||
|
itemp.subList.push(newDetail); |
||||
|
this.detailSource.push(itemp) |
||||
|
} else { |
||||
|
var detail = item.subList.find(r => { |
||||
|
if (r.packingNumber == balance.packingNumber && |
||||
|
r.batch == balance.batch && |
||||
|
r.locationCode == balance.locationCode && |
||||
|
r.inventoryStatus == balance.inventoryStatus) { |
||||
|
return r; |
||||
|
} |
||||
|
}) |
||||
|
if (detail == undefined) { |
||||
|
let newDetail = createDetailInfo(balance, pack); |
||||
|
item.subList.push(newDetail); |
||||
|
} else { |
||||
|
if (detail.scaned == true) { |
||||
|
this.showErrorMessage("箱码[" + balance.packingNumber + "批次[" + balance.batch + "]已经在列表中") |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
this.calcHandleQty(); |
||||
|
|
||||
|
}, |
||||
|
showErrorMessage(message) { |
||||
|
this.$refs.comMessage.showErrorMessage(message, res => { |
||||
|
if (res) { |
||||
|
|
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
calcHandleQty() { |
||||
|
calcHandleQty(this.detailSource); |
||||
|
this.$forceUpdate(); |
||||
|
}, |
||||
|
|
||||
|
updateData() { |
||||
|
this.calcHandleQty(); |
||||
|
}, |
||||
|
removeItem(index, item) { |
||||
|
this.detailSource.splice(index, 1) |
||||
|
}, |
||||
|
removePack() { |
||||
|
for (var i = 0; i < this.detailSource.length; i++) { |
||||
|
var item = this.detailSource[i]; |
||||
|
if (item.subList.length == 0) { |
||||
|
this.detailSource.splice(i, 1) |
||||
|
} |
||||
|
} |
||||
|
this.updateData(); |
||||
|
}, |
||||
|
|
||||
|
openScanPopup() { |
||||
|
|
||||
|
if (this.fromLocationCode == "") { |
||||
|
this.showFromLocationPopup(); |
||||
|
return |
||||
|
} |
||||
|
this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType); |
||||
|
}, |
||||
|
|
||||
|
scanLocationCode(location, code) { |
||||
|
this.$refs.comMessage.showQuestionMessage("是否把所有的目标库位都变成默认库位[" + code + "]", res => { |
||||
|
this.toLocationCode = code |
||||
|
this.detailSource.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
detail.toLocationCode = code |
||||
|
}) |
||||
|
}) |
||||
|
}) |
||||
|
}, |
||||
|
showFromLocationPopup() { |
||||
|
this.$nextTick(() => { |
||||
|
this.$refs.scanLocationCode.openScanPopup(); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
closeScanPopup() { |
||||
|
if(this.$refs.scanPopup!=undefined){ |
||||
|
this.$refs.scanPopup.closeScanPopup(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
scanPopupGetFocus() { |
||||
|
if(this.$refs.scanPopup!=undefined){ |
||||
|
this.$refs.scanPopup.getfocus(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
scanLocationCode(location, code) { |
||||
|
this.$refs.comMessage.showQuestionMessage("是否把所有的目标库位都变成默认库位[" + code + "]", res => { |
||||
|
this.toLocationCode = code |
||||
|
this.detailSource.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
detail.toLocationCode = code |
||||
|
}) |
||||
|
}) |
||||
|
}) |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
commit() { |
||||
|
if (this.customerText == "") { |
||||
|
this.showMessage("请先选择客户") |
||||
|
return; |
||||
|
} |
||||
|
console.log("客户", this.customerText) |
||||
|
if (this.toLocationCode == "") { |
||||
|
this.showMessage("请先选择目标库位") |
||||
|
return; |
||||
|
} |
||||
|
if (this.detailSource.length > 0 && this.detailSource[0].subList.length > 0) { |
||||
|
//查询管理模式 |
||||
|
uni.showLoading({ |
||||
|
title: "提交中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
this.managementList = []; |
||||
|
var precisionStrategParams = this.setPrecisionStrategParams() |
||||
|
|
||||
|
getPrecisionStrategyList(precisionStrategParams, res => { |
||||
|
if (res.success) { |
||||
|
this.managementList = res.list; |
||||
|
var params = this.setParams() |
||||
|
console.log("提交" + JSON.stringify(params)) |
||||
|
deliverRecordSubmit(params).then(res => { |
||||
|
uni.hideLoading() |
||||
|
if (res.data) { |
||||
|
this.showCommitSuccessMessage("提交成功<br>生成制品发货记录<br>" + res.data) |
||||
|
} else { |
||||
|
this.showErrorMessage("提交失败[" + res.msg + "]") |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
uni.hideLoading() |
||||
|
this.showErrorMessage(error) |
||||
|
}) |
||||
|
|
||||
|
} else { |
||||
|
uni.hideLoading(); |
||||
|
this.showErrorMessage(res.message); |
||||
|
} |
||||
|
|
||||
|
}) |
||||
|
|
||||
|
} else { |
||||
|
this.showErrorMessage("没有要提交的数据,请先扫描") |
||||
|
} |
||||
|
|
||||
|
|
||||
|
}, |
||||
|
|
||||
|
setPrecisionStrategParams() { |
||||
|
var itemList = [] |
||||
|
this.detailSource.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
if (detail.scaned) { |
||||
|
detail.toLocationCode = this.toLocationCode; |
||||
|
var filterResult = itemList.filter(res => { |
||||
|
if (res.itemCode == item.itemCode && |
||||
|
detail.toLocationCode == res.locationCode) { |
||||
|
return res |
||||
|
} |
||||
|
}) |
||||
|
//去掉重复元素 |
||||
|
if (filterResult.length == 0) { |
||||
|
var result = { |
||||
|
itemCode: item.itemCode, |
||||
|
locationCode: detail.toLocationCode |
||||
|
} |
||||
|
itemList.push(result) |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
return itemList; |
||||
|
}, |
||||
|
|
||||
|
setParams() { |
||||
|
var subList = [] |
||||
|
var creator = this.$store.state.user.id |
||||
|
this.detailSource.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
if (detail.scaned) { |
||||
|
var info = getPackingNumberAndBatchByList(this.managementList, detail.itemCode, |
||||
|
detail.packingNumber, detail.toLocationCode, detail.batch); |
||||
|
var submitItem = deepCopyData(detail) |
||||
|
submitItem.itemCode = detail.itemCode; |
||||
|
submitItem.itemName = detail.package.itemName; |
||||
|
submitItem.itemDesc1 = detail.package.itemDesc1; |
||||
|
submitItem.itemDesc2 = detail.package.itemDesc2; |
||||
|
|
||||
|
submitItem.inventoryStatus = detail.inventoryStatus; |
||||
|
|
||||
|
submitItem.fromPackingNumber = info.packingNumber; |
||||
|
submitItem.toPackingNumber = info.packingNumber; |
||||
|
|
||||
|
submitItem.fromContainerNumber = detail.containerNumber; |
||||
|
submitItem.toContainerNumber = detail.containerNumber |
||||
|
|
||||
|
submitItem.fromBatch = info.batch; |
||||
|
submitItem.toBatch = info.batch; |
||||
|
|
||||
|
submitItem.fromLocationCode = detail.locationCode; |
||||
|
submitItem.toLocationCode = detail.toLocationCode; |
||||
|
|
||||
|
submitItem.qty = detail.handleQty; |
||||
|
submitItem.package =""; |
||||
|
|
||||
|
subList.push(submitItem) |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
this.dataContent.subList = subList; |
||||
|
this.dataContent.creator = creator; |
||||
|
this.dataContent.customerCode = this.customerCode; |
||||
|
this.dataContent.fromWarehouseCode = this.detailSource[0].subList[0].warehouseCode; |
||||
|
this.dataContent.toWarehouseCode = this.toWarehouseCode; |
||||
|
return this.dataContent; |
||||
|
}, |
||||
|
|
||||
|
showMessage(message) { |
||||
|
this.$refs.comMessage.showMessage(message, res => { |
||||
|
if (res) {} |
||||
|
}); |
||||
|
}, |
||||
|
showErrorMessage(message) { |
||||
|
this.$refs.comMessage.showErrorMessage(message, res => { |
||||
|
if (res) { |
||||
|
|
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
showScanMessage(message) { |
||||
|
this.$refs.comMessage.showScanMessage(message); |
||||
|
}, |
||||
|
|
||||
|
afterCloseMessage() { |
||||
|
this.scanPopupGetFocus(); |
||||
|
}, |
||||
|
|
||||
|
closeScanMessage() { |
||||
|
this.scanPopupGetFocus(); |
||||
|
}, |
||||
|
getLocation(location, code) { |
||||
|
this.getFromLocationCode(location, code) |
||||
|
}, |
||||
|
getFromLocationCode(location, code) { |
||||
|
this.fromLocationCode = code; |
||||
|
this.openScanPopup(); |
||||
|
}, |
||||
|
getToLocationCode(location, code) { |
||||
|
this.toLocationCode = code; |
||||
|
}, |
||||
|
|
||||
|
showCommitSuccessMessage(hint) { |
||||
|
this.$refs.comMessage.showSuccessMessage(hint, res => { |
||||
|
this.clearData(); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
clearData(){ |
||||
|
this.fromLocationCode = ''; |
||||
|
this.subList = []; |
||||
|
this.detailSource = []; |
||||
|
this.toLocationCode = ''; |
||||
|
this.dataContent = {} |
||||
|
this.toWarehouseCode = "" |
||||
|
}, |
||||
|
|
||||
|
updateData() { |
||||
|
this.calcHandleQty(); |
||||
|
for (var i = 0; i < this.detailSource.length; i++) { |
||||
|
let item = this.detailSource[i]; |
||||
|
if (item.qty == 0) { |
||||
|
this.detailSource.splice(i, 1) |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
reasonChange(e) { |
||||
|
if (e.detail.value.length == 0) { |
||||
|
this.customerCode = "" |
||||
|
this.customerText = "" |
||||
|
} else { |
||||
|
this.customerCode = e.detail.value[0].value |
||||
|
this.customerText = e.detail.value[0].text |
||||
|
} |
||||
|
}, |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="scss"> |
||||
|
page { |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
background-color: #fff; |
||||
|
} |
||||
|
|
||||
|
.page-wraper { |
||||
|
display: flex; |
||||
|
flex-direction: column; |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
.page-main { |
||||
|
flex: 1; |
||||
|
position: relative; |
||||
|
} |
||||
|
|
||||
|
.page-main-scroll { |
||||
|
position: absolute; |
||||
|
left: 0; |
||||
|
right: 0; |
||||
|
top: 0; |
||||
|
bottom: 0; |
||||
|
} |
||||
|
|
||||
|
.page-main-list { |
||||
|
/* height: 80rpx; |
||||
|
line-height: 80rpx; */ |
||||
|
text-align: center; |
||||
|
background: #e0e0e0; |
||||
|
|
||||
|
} |
||||
|
</style> |
@ -0,0 +1,390 @@ |
|||||
|
<template> |
||||
|
<view> |
||||
|
<com-empty-view v-if="requestList.length==0"></com-empty-view> |
||||
|
<request-filter ref="filter" @switchChangeWait="switchChangeWait" @onScanNumber="getScanNumber" |
||||
|
:checkedWaitTask="checkedWaitTask"> |
||||
|
</request-filter> |
||||
|
<view v-if="requestList.length>0"> |
||||
|
<uni-swipe-action ref="swipeAction"> |
||||
|
<view v-for="(item, index) in requestList" :key="index"> |
||||
|
<uni-swipe-action-item :right-options="item.options" @click="swipeClick($event,item)"> |
||||
|
<com-deliver-request-card :dataContent="item" @click='openRequestDetail(item)'> |
||||
|
</com-deliver-request-card> |
||||
|
</uni-swipe-action-item> |
||||
|
</view> |
||||
|
</uni-swipe-action> |
||||
|
<uni-load-more :status="loadingType" /> |
||||
|
<request-info-popup ref='requestInfoPopup'></request-info-popup> |
||||
|
</view> |
||||
|
<requestButton @goScan='openScanDetailPopup'></requestButton> |
||||
|
</view> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import requestFilter from '@/mycomponents/request/requestFilter.vue' |
||||
|
import comEmptyView from '@/mycomponents/common/comEmptyView.vue' |
||||
|
import requiredLocation from '@/mycomponents/location/requiredLocation.vue' |
||||
|
import comDeliverRequestCard from '@/pages/deliver/coms/comDeliverRequestCard.vue' |
||||
|
import requestInfoPopup from '@/pages/deliver/coms/requestInfoPopup.vue' |
||||
|
import requestButton from '@/mycomponents/button/requestButton.vue' |
||||
|
import { |
||||
|
goHome, |
||||
|
updateTitle |
||||
|
} from '@/common/basic.js'; |
||||
|
import { |
||||
|
getDeliverRequestList, |
||||
|
deliverRequestClose, |
||||
|
deliverRequestApprove, |
||||
|
deliverRequestApproveAgree, |
||||
|
deliverRequestApproveRefused, |
||||
|
deliverRequestHandle, |
||||
|
deliverRequestAddAgain |
||||
|
} from '@/api/request2.js'; |
||||
|
import { |
||||
|
getDetailOption, |
||||
|
getDetailAndApproveOption, |
||||
|
getDetailAndApprovePassAndApproveNoOption, |
||||
|
getDetailAndHandleOption, |
||||
|
getDetailAndAddAndCloseOption, |
||||
|
getAddAgainOption |
||||
|
} from '@/common/array.js'; |
||||
|
|
||||
|
export default { |
||||
|
components: { |
||||
|
comEmptyView, |
||||
|
requestFilter, |
||||
|
requiredLocation, |
||||
|
comDeliverRequestCard, |
||||
|
requestInfoPopup, |
||||
|
requestButton |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
requestList: [], |
||||
|
pageNo: 1, |
||||
|
pageSize: 10, |
||||
|
status: "1,2,3,4,5,6", |
||||
|
totalCount: 0, |
||||
|
checkedWaitTask: false, |
||||
|
detailOptions: [], |
||||
|
detailAndApproveOptions: [], |
||||
|
detailAndApprovePassAndApproveNoOption: [], |
||||
|
detailAndHandleOption: [], |
||||
|
detailAndAddAndCloseOption: [], |
||||
|
addAgainOption: [], |
||||
|
showOptions: [], |
||||
|
fromType: "requestType", |
||||
|
loadingType: "nomore", |
||||
|
|
||||
|
}; |
||||
|
}, |
||||
|
onReady() { |
||||
|
this.detailOptions = getDetailOption(); |
||||
|
this.addAgainOption = getAddAgainOption(); |
||||
|
this.detailAndApproveOptions = getDetailAndApproveOption() |
||||
|
this.detailAndApprovePassAndApproveNoOption = getDetailAndApprovePassAndApproveNoOption(), |
||||
|
this.detailAndHandleOption = getDetailAndHandleOption() |
||||
|
this.detailAndAddAndCloseOption = getDetailAndAddAndCloseOption() |
||||
|
|
||||
|
}, |
||||
|
onReachBottom() { |
||||
|
//避免多次触发 |
||||
|
if (this.loadingType == 'loading' || this.loadingType == 'nomore') { |
||||
|
return; |
||||
|
} |
||||
|
this.getList("more"); |
||||
|
}, |
||||
|
|
||||
|
onPullDownRefresh() { |
||||
|
this.getList('refresh'); |
||||
|
}, |
||||
|
onShow() { |
||||
|
this.getList('refresh'); |
||||
|
}, |
||||
|
//返回首页 |
||||
|
onNavigationBarButtonTap(e) { |
||||
|
if (e.index === 0) { |
||||
|
goHome(); |
||||
|
} else if (e.index == 1) { |
||||
|
this.$refs.filter.openFilter(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
mounted() { |
||||
|
|
||||
|
}, |
||||
|
methods: { |
||||
|
requestConfirm(action, item) { |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
openRequestInfoPopup(item) { |
||||
|
this.$refs.requestInfoPopup.openPopup(item) |
||||
|
}, |
||||
|
openRequestDetail(item) { |
||||
|
uni.navigateTo({ |
||||
|
url: './deliverRequestDetail?id=' + item.id |
||||
|
}); |
||||
|
}, |
||||
|
getList(type) { |
||||
|
let that = this; |
||||
|
uni.showLoading({ |
||||
|
title: "加载中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
this.loadingType = "loading"; |
||||
|
if (type === "refresh") { |
||||
|
this.pageNo = 1; |
||||
|
this.requestList = []; |
||||
|
} |
||||
|
var filters = [] |
||||
|
filters.push({ |
||||
|
column: "status", |
||||
|
action: "in", |
||||
|
value: this.status |
||||
|
}) |
||||
|
var params = { |
||||
|
filters: filters, |
||||
|
pageNo: this.pageNo, |
||||
|
pageSize: this.pageSize, |
||||
|
} |
||||
|
getDeliverRequestList(params).then(res => { |
||||
|
uni.hideLoading(); |
||||
|
if (type === "refresh") { |
||||
|
uni.stopPullDownRefresh(); |
||||
|
} |
||||
|
|
||||
|
var list = res.data.list; |
||||
|
this.totalCount = res.data.total |
||||
|
this.loadingType = "loadmore"; |
||||
|
if (list == null || list.length == 0) { |
||||
|
this.loadingType = "nomore"; |
||||
|
return; |
||||
|
} |
||||
|
list.forEach(res => { |
||||
|
var options = this.updateOptions(res.status); |
||||
|
res.options = options; |
||||
|
}) |
||||
|
this.requestList = type === "refresh" ? list : this.requestList.concat(list); |
||||
|
this.pageNo++; |
||||
|
updateTitle("成品发货申请(" + this.totalCount + ")"); |
||||
|
|
||||
|
}).catch(error => { |
||||
|
updateTitle("成品发货申请"); |
||||
|
uni.hideLoading(); |
||||
|
that.showMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
updateOptions(status) { |
||||
|
if (status == "1") { |
||||
|
this.showOptions = this.detailAndApproveOptions; |
||||
|
} else if (status == "2") { |
||||
|
this.showOptions = this.detailAndApprovePassAndApproveNoOption; |
||||
|
} else if (status == "3") { |
||||
|
this.showOptions = this.detailAndHandleOption; |
||||
|
} else if (status == "4") { |
||||
|
this.showOptions = this.detailAndAddAndCloseOption; |
||||
|
} else if(status == "5"){ |
||||
|
this.showOptions = this.addAgainOption; |
||||
|
}else { |
||||
|
this.showOptions = this.detailOptions; |
||||
|
} |
||||
|
return this.showOptions |
||||
|
}, |
||||
|
|
||||
|
openScanDetailPopup() { |
||||
|
uni.navigateTo({ |
||||
|
url: "./deliverRequestCreate" |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
swipeClick(e, dataContent) { |
||||
|
var text = clearTirmAndWrap(e.content.text) |
||||
|
if (text == "详情") { |
||||
|
this.openRequestInfoPopup(dataContent); |
||||
|
} else if (text == "处理") { |
||||
|
this.showQuestionMessage("确定要处理当前申请吗?",res=>{ |
||||
|
this.deliverRequestHandle(dataContent.id) |
||||
|
}) |
||||
|
} else if (text == "提交审批") { |
||||
|
this.showQuestionMessage("确定要审批当前申请吗?",res=>{ |
||||
|
this.deliverRequestApprove(dataContent.id) |
||||
|
}) |
||||
|
} else if (text=="审批通过") { |
||||
|
this.showQuestionMessage("确定要审批通过当前申请吗?",res=>{ |
||||
|
this.deliverRequestApproveAgree(dataContent.id) |
||||
|
}) |
||||
|
} else if (text == "审批驳回") { |
||||
|
this.showQuestionMessage("确定要审批驳回当前申请吗?",res=>{ |
||||
|
this.deliverRequestApproveRefused(dataContent.id) |
||||
|
}) |
||||
|
} else if (text == "关闭") { |
||||
|
this.showQuestionMessage("确定要关闭当前申请吗?",res=>{ |
||||
|
this.deliverRequestClose(dataContent.id) |
||||
|
}) |
||||
|
}else if(text == "重新添加"){ |
||||
|
this.showQuestionMessage("确定要重新添加当前申请吗?",res=>{ |
||||
|
this.deliverRequestAddAgain(dataContent.id) |
||||
|
}) |
||||
|
} |
||||
|
}, |
||||
|
showQuestionMessage(hint,callBack){ |
||||
|
this.$refs.comMessage.showQuestionMessage(hint, |
||||
|
res => { |
||||
|
if (res) { |
||||
|
callBack() |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
switchChangeWait(state, jobStatus) { |
||||
|
this.checkedWaitTask = state; |
||||
|
this.status = jobStatus; |
||||
|
this.getList("refresh"); |
||||
|
}, |
||||
|
|
||||
|
getScanNumber(code) { |
||||
|
this.getDataListByType(code) |
||||
|
}, |
||||
|
|
||||
|
getDataListByType(code) { |
||||
|
let that = this; |
||||
|
uni.showLoading({ |
||||
|
title: "加载中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
var filters = [] |
||||
|
filters.push({ |
||||
|
column: "number", |
||||
|
action: "==", |
||||
|
value: code |
||||
|
}) |
||||
|
|
||||
|
var params = { |
||||
|
filters: filters, |
||||
|
pageNo: 1, |
||||
|
pageSize: 100, |
||||
|
} |
||||
|
getDeliverRequestList(params).then(res => { |
||||
|
uni.hideLoading(); |
||||
|
if (res.data.list.length == 0) { |
||||
|
that.showMessage('未查找到' + '【' + code + '】的收货任务'); |
||||
|
} else if (res.data.list.length == 1) { |
||||
|
that.openRequestDetail(res.data.list[0]); |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
uni.hideLoading(); |
||||
|
that.showMessage(error); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
showMessage(message) { |
||||
|
this.$refs.comMessage.showMessage(message, res => { |
||||
|
if (res) { |
||||
|
|
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
deliverRequestApprove(id) { |
||||
|
deliverRequestApprove(id).then(res => { |
||||
|
if (res.data) { |
||||
|
uni.showToast({ |
||||
|
title: "申请提交审批成功" |
||||
|
}) |
||||
|
this.getList("refresh") |
||||
|
} else { |
||||
|
this.showMessage("申请提交审批失败") |
||||
|
} |
||||
|
|
||||
|
}).catch(error => { |
||||
|
this.showMessage(error) |
||||
|
}) |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
deliverRequestClose(id) { |
||||
|
deliverRequestClose(id).then(res => { |
||||
|
if (res.data) { |
||||
|
uni.showToast({ |
||||
|
title: "申请关闭成功" |
||||
|
}) |
||||
|
this.getList("refresh") |
||||
|
} else { |
||||
|
this.showMessage("申请关闭失败") |
||||
|
} |
||||
|
|
||||
|
}).catch(error => { |
||||
|
this.showMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
deliverRequestAddAgain(id) { |
||||
|
deliverRequestAddAgain(id).then(res => { |
||||
|
if (res.data) { |
||||
|
uni.showToast({ |
||||
|
title: "申请重新添加成功" |
||||
|
}) |
||||
|
this.getList("refresh") |
||||
|
} else { |
||||
|
this.showMessage("申请重新添加失败") |
||||
|
} |
||||
|
|
||||
|
}).catch(error => { |
||||
|
this.showMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
deliverRequestApproveAgree(id) { |
||||
|
deliverRequestApproveAgree(id).then(res => { |
||||
|
if (res.data) { |
||||
|
uni.showToast({ |
||||
|
title: "申请审批通过成功" |
||||
|
}) |
||||
|
this.getList("refresh") |
||||
|
} else { |
||||
|
this.showMessage("申请审批通过失败") |
||||
|
} |
||||
|
|
||||
|
}).catch(error => { |
||||
|
this.showMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
deliverRequestApproveRefused(id) { |
||||
|
deliverRequestApproveRefused(id).then(res => { |
||||
|
if (res.data) { |
||||
|
uni.showToast({ |
||||
|
title: "申请审批驳回成功" |
||||
|
}) |
||||
|
this.getList("refresh") |
||||
|
} else { |
||||
|
this.showMessage("申请审批驳回失败") |
||||
|
} |
||||
|
|
||||
|
}).catch(error => { |
||||
|
this.showMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
deliverRequestHandle(id) { |
||||
|
deliverRequestHandle(id).then(res => { |
||||
|
if (res.data) { |
||||
|
uni.showToast({ |
||||
|
title: "申请处理成功" |
||||
|
}) |
||||
|
this.getList("refresh") |
||||
|
} else { |
||||
|
this.showMessage("申请处理失败") |
||||
|
} |
||||
|
|
||||
|
}).catch(error => { |
||||
|
this.showMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
</style> |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue