Compare commits
49
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7382154a8d | ||
|
|
b861487d9d | ||
|
|
6273ec0f19 | ||
|
|
4825cd13f2 | ||
|
|
036b331e9a | ||
|
|
5557819e64 | ||
|
|
69608b92d7 | ||
|
|
c6084e8b2c | ||
|
|
cc2d0218b5 | ||
|
|
ec57e43b25 | ||
|
|
f084afafcc | ||
|
|
a1caee64f7 | ||
|
|
0710e7cccf | ||
|
|
81618150ab | ||
|
|
7b11fc60c8 | ||
|
|
2764b27118 | ||
|
|
3ea99ce92f | ||
|
|
f56c40bb6d | ||
|
|
2903972e55 | ||
|
|
917d028ca0 | ||
|
|
7cf50486ef | ||
|
|
51222f608a | ||
|
|
fc6a514076 | ||
|
|
92b89f145c | ||
|
|
9e70b4a1f3 | ||
|
|
8243a82aa7 | ||
|
|
8f42cea11b | ||
|
|
b259e0c2e7 | ||
|
|
30e20853df | ||
|
|
6688fb3867 | ||
|
|
d9d1458b58 | ||
|
|
4faf1bf41a | ||
|
|
2347b84a8a | ||
|
|
8ec38126e6 | ||
|
|
55f13bb47b | ||
|
|
e785a99b7d | ||
|
|
470a474d70 | ||
|
|
9fffe228d5 | ||
|
|
e7827c4714 | ||
|
|
fc6e9915a6 | ||
|
|
ab9d199fe3 | ||
|
|
863f0fe850 | ||
|
|
ce5f5a956f | ||
|
|
c94a009caf | ||
|
|
12187283cc | ||
|
|
0e105c78e1 | ||
|
|
e1ac017a3c | ||
|
|
066f1c623c | ||
|
|
d660d6fcf1 |
@@ -1,37 +0,0 @@
|
|||||||
---
|
|
||||||
description: PDA 小屏界面字号与排版标准(以手动进仓页为准)
|
|
||||||
alwaysApply: true
|
|
||||||
---
|
|
||||||
|
|
||||||
# PDA 字号标准
|
|
||||||
|
|
||||||
本项目面向工业 PDA 小屏。新增/改版业务页时,**以后台手动进仓页**(`storeFabricManualIn.vue`)的字号为准,不要用偏小的默认字号。
|
|
||||||
|
|
||||||
共用变量:`@import '@/common/pda-typography.scss';`(或等价路径)。
|
|
||||||
|
|
||||||
## 字号(rpx)
|
|
||||||
|
|
||||||
| 用途 | 字号 | 变量 |
|
|
||||||
|------|------|------|
|
|
||||||
| 表单标签 / 正文 / 输入值 | **36** | `$pda-font-body` |
|
|
||||||
| 扫码输入框 | **36** | `$pda-font-body` |
|
|
||||||
| 占位提示 | **34** | `$pda-font-placeholder` |
|
|
||||||
| 行内操作(取消/修改) | **34** | `$pda-font-action` |
|
|
||||||
| 单位角标(如 KG) | **32** | `$pda-font-unit` |
|
|
||||||
| 顶栏次要文字(设置等) | **32** | `$pda-font-nav-sub` |
|
|
||||||
| 主按钮文字 | **36** | `$pda-font-button` |
|
|
||||||
| 弹层标题 / 选项 | **36** | `$pda-font-popup-title` / `$pda-font-popup-item` |
|
|
||||||
| 弹层取消 / 空态 | **34** | `$pda-font-popup-sub` |
|
|
||||||
|
|
||||||
## 行高与触控
|
|
||||||
|
|
||||||
- 列表行最小高度约 **100rpx**,可略加上下 padding
|
|
||||||
- 扫码输入框高度约 **100rpx**
|
|
||||||
- 主按钮高度约 **92rpx**
|
|
||||||
- 标签列宽约 **200rpx**(中文四字标签)
|
|
||||||
|
|
||||||
## 注意
|
|
||||||
|
|
||||||
- 登录环境选择、出仓明细等已放大过的页面,新改动保持不低于上表
|
|
||||||
- 不要为了“好看”再缩小字号;宁可少露内容、可滚动,也要可读
|
|
||||||
- 选择类弹层(如 `SearchSelectPopup`)与表单页使用同一套字号
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
NODE_ENV = production
|
NODE_ENV = production
|
||||||
VUE_APP_ENV_NAME = zhoushang环境
|
VUE_APP_ENV_NAME = zhoushang环境
|
||||||
VUE_APP_UPGRADE_NAME = erp_pda_zhoushang_zhichang
|
VUE_APP_UPGRADE_NAME = erp_pda_zhoushang
|
||||||
VUE_APP_UPGRADE_CDN_PREFIX = https://zsfzcdn.yushangfangzhi.com/version/erp_pda_zhoushang_zhichang
|
VUE_APP_PRODUCTION_API_URL = https://zsfz.yushangfangzhi.com/hcscm/pda/v1
|
||||||
VUE_APP_PRODUCTION_API_URL = https://zszc.yushangfangzhi.com/hcscm_weave/pda/v1
|
VUE_APP_DEV_API_URL = https://zsfz.yushangfangzhi.com/hcscm/pda/v1
|
||||||
VUE_APP_DEV_API_URL = https://zszc.yushangfangzhi.com/hcscm_weave/pda/v1
|
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
NODE_ENV = development
|
||||||
|
VUE_APP_ENV_NAME = 本地穿透环境
|
||||||
|
VUE_APP_UPGRADE_NAME = erp_pda_dev
|
||||||
|
VUE_APP_PRODUCTION_API_URL = https://2yd52gx88533.vicp.fun/hcscm/pda/v1
|
||||||
|
VUE_APP_DEV_API_URL = https://2yd52gx88533.vicp.fun/hcscm/pda/v1
|
||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
NODE_ENV = development
|
NODE_ENV = development
|
||||||
VUE_APP_ENV_NAME = zhisheng环境
|
VUE_APP_ENV_NAME = zhisheng环境
|
||||||
VUE_APP_UPGRADE_NAME = erp_pda_pre
|
VUE_APP_UPGRADE_NAME = erp_pda_pre
|
||||||
VUE_APP_PRODUCTION_API_URL = https://hcscmpre.zzfzyc.com/hcscm_weave/pda/v1
|
VUE_APP_PRODUCTION_API_URL = https://hcscmpre.zzfzyc.com/hcscm/pda/v1
|
||||||
VUE_APP_DEV_API_URL = https://hcscmpre.zzfzyc.com/hcscm_weave/pda/v1
|
VUE_APP_DEV_API_URL = https://hcscmpre.zzfzyc.com/hcscm/pda/v1
|
||||||
|
|||||||
+3
-4
@@ -1,6 +1,5 @@
|
|||||||
NODE_ENV = production
|
NODE_ENV = production
|
||||||
VUE_APP_ENV_NAME = zhoushang环境
|
VUE_APP_ENV_NAME = zhoushang环境
|
||||||
VUE_APP_UPGRADE_NAME = erp_pda_zhoushang_zhichang
|
VUE_APP_UPGRADE_NAME = erp_pda_zhoushang
|
||||||
VUE_APP_UPGRADE_CDN_PREFIX = https://zsfzcdn.yushangfangzhi.com/version/erp_pda_zhoushang_zhichang
|
VUE_APP_PRODUCTION_API_URL = https://zsfz.yushangfangzhi.com/hcscm/pda/v1
|
||||||
VUE_APP_PRODUCTION_API_URL = https://zszc.yushangfangzhi.com/hcscm_weave/pda/v1
|
VUE_APP_DEV_API_URL = https://zsfz.yushangfangzhi.com/hcscm/pda/v1
|
||||||
VUE_APP_DEV_API_URL = https://zszc.yushangfangzhi.com/hcscm_weave/pda/v1
|
|
||||||
|
|||||||
@@ -100,4 +100,39 @@ pack.json内容如下:详情可访问 [CLI uni-app发行 - Android/iOS云打
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
### 云服务器走CICD 打包:
|
### 云服务器走CICD 打包:
|
||||||
需要下载 [Linux HBuilderX Cli](https://ask.dcloud.net.cn/article/41469)
|
需要下载 [Linux HBuilderX Cli](https://ask.dcloud.net.cn/article/41469)
|
||||||
|
|
||||||
|
### 上传 PDA 安装包
|
||||||
|
|
||||||
|
云打包得到 APK 后,用命令行上传,等价于 ERP「开发者资源上传」里的安装包上传。周尚环境的登录和签名走 `https://zsfz.yushangfangzhi.com/hcscm`,安装包进入 `zhoushang` 空间。
|
||||||
|
|
||||||
|
先把 `src/manifest.json` 的 `versionName`、`versionCode` 改成新版本,再打包。安装包里的版本号必须和上传文件名一致,否则 PDA 会反复提示升级。
|
||||||
|
|
||||||
|
```
|
||||||
|
npm run upload:apk -- --file D:\path\你的.apk --target test
|
||||||
|
npm run upload:apk -- --file D:\path\你的.apk --target prod
|
||||||
|
```
|
||||||
|
|
||||||
|
`npm` 后面的 `--` 只是分隔符,用来把 `--file`、`--target` 传给脚本。也可以不经过 npm:
|
||||||
|
|
||||||
|
```
|
||||||
|
node scripts/upload-apk.js --file D:\path\你的.apk --target test
|
||||||
|
```
|
||||||
|
|
||||||
|
运行后输入 ERP 手机号和密码获取 token。账号下有多个账套时,再按序号选一次。
|
||||||
|
|
||||||
|
`--target` 只决定 APK 放到哪套 CDN,没有别的差别。生产环境的 PDA 也可以从测试 CDN 下载并安装。
|
||||||
|
|
||||||
|
| 参数 | 说明 |
|
||||||
|
|---|---|
|
||||||
|
| `--target test` | 周尚环境固定上传到 `https://zsfzcdn.yushangfangzhi.com` |
|
||||||
|
| `--target prod` | 其他环境的正式 CDN:`https://hcscm.cdn.zzfzyc.com` |
|
||||||
|
| `--mode` | 默认 `zhoushang`。可选 `zhoushang`、`zhisheng`、`mes`、`cjt` |
|
||||||
|
| `--version` | 可选。不传则用 `src/manifest.json` 的 `versionName` |
|
||||||
|
|
||||||
|
场景值取对应 `.env.{mode}` 里的 `VUE_APP_UPGRADE_NAME`。保存路径为 `/version/{场景值}/{版本号}.apk`。版本包上传成功后,同一份安装包会再传到 `/version/{场景值}/latest.apk`。本分支默认场景是 `.env.zhoushang` 的 `erp_pda_zhoushang`,上传成功后会打印完整下载地址,例如:
|
||||||
|
|
||||||
|
```
|
||||||
|
https://zsfzcdn.yushangfangzhi.com/version/erp_pda_zhoushang/1.1.9.apk
|
||||||
|
https://zsfzcdn.yushangfangzhi.com/version/erp_pda_zhoushang/latest.apk
|
||||||
|
```
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
"build:app-plus:zhisheng": "cross-env NODE_ENV=production UNI_PLATFORM=app-plus vue-cli-service uni-build --mode zhisheng",
|
"build:app-plus:zhisheng": "cross-env NODE_ENV=production UNI_PLATFORM=app-plus vue-cli-service uni-build --mode zhisheng",
|
||||||
"build:app-plus:zhoushang": "cross-env NODE_ENV=production UNI_PLATFORM=app-plus vue-cli-service uni-build --mode zhoushang",
|
"build:app-plus:zhoushang": "cross-env NODE_ENV=production UNI_PLATFORM=app-plus vue-cli-service uni-build --mode zhoushang",
|
||||||
"build:app-plus:mes": "cross-env NODE_ENV=production UNI_PLATFORM=app-plus vue-cli-service uni-build --mode mes",
|
"build:app-plus:mes": "cross-env NODE_ENV=production UNI_PLATFORM=app-plus vue-cli-service uni-build --mode mes",
|
||||||
|
"build:app-plus:devlocal": "cross-env NODE_ENV=production UNI_PLATFORM=app-plus vue-cli-service uni-build --mode devlocal",
|
||||||
"build:custom": "cross-env NODE_ENV=production uniapp-cli custom",
|
"build:custom": "cross-env NODE_ENV=production uniapp-cli custom",
|
||||||
"build:h5": "cross-env NODE_ENV=production UNI_PLATFORM=h5 vue-cli-service uni-build",
|
"build:h5": "cross-env NODE_ENV=production UNI_PLATFORM=h5 vue-cli-service uni-build",
|
||||||
"build:mp-360": "cross-env NODE_ENV=production UNI_PLATFORM=mp-360 vue-cli-service uni-build",
|
"build:mp-360": "cross-env NODE_ENV=production UNI_PLATFORM=mp-360 vue-cli-service uni-build",
|
||||||
@@ -30,6 +31,7 @@
|
|||||||
"dev:app-plus": "cross-env NODE_ENV=development UNI_PLATFORM=app-plus vue-cli-service uni-build --watch",
|
"dev:app-plus": "cross-env NODE_ENV=development UNI_PLATFORM=app-plus vue-cli-service uni-build --watch",
|
||||||
"dev:app-plus:zhisheng": "cross-env NODE_ENV=development UNI_PLATFORM=app-plus vue-cli-service uni-build --watch --mode zhisheng",
|
"dev:app-plus:zhisheng": "cross-env NODE_ENV=development UNI_PLATFORM=app-plus vue-cli-service uni-build --watch --mode zhisheng",
|
||||||
"dev:app-plus:mes": "cross-env NODE_ENV=development UNI_PLATFORM=app-plus vue-cli-service uni-build --watch --mode mes",
|
"dev:app-plus:mes": "cross-env NODE_ENV=development UNI_PLATFORM=app-plus vue-cli-service uni-build --watch --mode mes",
|
||||||
|
"dev:app-plus:devlocal": "cross-env NODE_ENV=development UNI_PLATFORM=app-plus vue-cli-service uni-build --watch --mode devlocal",
|
||||||
"dev:custom": "cross-env NODE_ENV=development uniapp-cli custom",
|
"dev:custom": "cross-env NODE_ENV=development uniapp-cli custom",
|
||||||
"dev:h5": "cross-env NODE_ENV=development UNI_PLATFORM=h5 vue-cli-service uni-serve",
|
"dev:h5": "cross-env NODE_ENV=development UNI_PLATFORM=h5 vue-cli-service uni-serve",
|
||||||
"dev:mp-360": "cross-env NODE_ENV=development UNI_PLATFORM=mp-360 vue-cli-service uni-build --watch",
|
"dev:mp-360": "cross-env NODE_ENV=development UNI_PLATFORM=mp-360 vue-cli-service uni-build --watch",
|
||||||
|
|||||||
@@ -22,16 +22,17 @@ const readline = require('readline');
|
|||||||
|
|
||||||
const ROOT = path.resolve(__dirname, '..');
|
const ROOT = path.resolve(__dirname, '..');
|
||||||
const UPYUN_API = 'https://v0.api.upyun.com';
|
const UPYUN_API = 'https://v0.api.upyun.com';
|
||||||
const DEFAULT_API_BASE = 'https://hcscmtest.zzfzyc.com/hcscm_weave';
|
const DEFAULT_API_BASE = 'https://hcscmtest.zzfzyc.com/hcscm';
|
||||||
const DEFAULT_CDN_HOST = {
|
const DEFAULT_CDN_HOST = {
|
||||||
test: 'https://testhcscm.cdn.zzfzyc.com',
|
test: 'https://testhcscm.cdn.zzfzyc.com',
|
||||||
prod: 'https://hcscm.cdn.zzfzyc.com',
|
prod: 'https://hcscm.cdn.zzfzyc.com',
|
||||||
};
|
};
|
||||||
/** 织厂环境签到 zhoushang 空间,下载域名与 ERP 相同 */
|
/** 周尚环境的安装包签到 zhoushang 空间,下载域名是 zsfzcdn */
|
||||||
const MODE_UPLOAD = {
|
const MODE_UPLOAD = {
|
||||||
zhoushang: {
|
zhoushang: {
|
||||||
apiBase: 'https://zszc.yushangfangzhi.com/hcscm_weave',
|
apiBase: 'https://zsfz.yushangfangzhi.com/hcscm',
|
||||||
cdnHost: 'https://zsfzcdn.yushangfangzhi.com',
|
cdnHost: 'https://zsfzcdn.yushangfangzhi.com',
|
||||||
|
/** 该环境只有 status=1 返回了 zhoushang 空间,正式状态没有可用 bucket */
|
||||||
status: 1,
|
status: 1,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
+43
-13
@@ -6,6 +6,7 @@ import { audioManager } from '@/utils/audioManager'
|
|||||||
|
|
||||||
import util from '@/common/util.js';
|
import util from '@/common/util.js';
|
||||||
import md5 from '@/common/md5.js';
|
import md5 from '@/common/md5.js';
|
||||||
|
import { getLoginData, restoreUserSession } from '@/common/userSession.js';
|
||||||
import { ensureScanConfigAfterLogin } from '@/common/scanAutoConfig.js';
|
import { ensureScanConfigAfterLogin } from '@/common/scanAutoConfig.js';
|
||||||
export default {
|
export default {
|
||||||
globalData: {
|
globalData: {
|
||||||
@@ -26,6 +27,7 @@ import { audioManager } from '@/utils/audioManager'
|
|||||||
|
|
||||||
onLaunch() {
|
onLaunch() {
|
||||||
console.log('App Launch');
|
console.log('App Launch');
|
||||||
|
restoreUserSession();
|
||||||
|
|
||||||
// 初始化音频管理器
|
// 初始化音频管理器
|
||||||
audioManager.init();
|
audioManager.init();
|
||||||
@@ -33,7 +35,7 @@ import { audioManager } from '@/utils/audioManager'
|
|||||||
this.$store.dispatch('initNotification');
|
this.$store.dispatch('initNotification');
|
||||||
|
|
||||||
// 已登录且本地无扫码配置时,自动匹配一次
|
// 已登录且本地无扫码配置时,自动匹配一次
|
||||||
const loginData = uni.getStorageSync('RemoteTokenData');
|
const loginData = getLoginData();
|
||||||
if (loginData && loginData.token && this.$u && this.$u.api) {
|
if (loginData && loginData.token && this.$u && this.$u.api) {
|
||||||
ensureScanConfigAfterLogin(this.$u.api).catch((error) => {
|
ensureScanConfigAfterLogin(this.$u.api).catch((error) => {
|
||||||
console.log('启动时自动匹配扫码设置失败', error);
|
console.log('启动时自动匹配扫码设置失败', error);
|
||||||
@@ -67,7 +69,7 @@ import { audioManager } from '@/utils/audioManager'
|
|||||||
.textCenter {
|
.textCenter {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 15px;
|
font-size: 16px;
|
||||||
color: #808080;
|
color: #808080;
|
||||||
margin-top: 88rpx;
|
margin-top: 88rpx;
|
||||||
}
|
}
|
||||||
@@ -114,7 +116,7 @@ import { audioManager } from '@/utils/audioManager'
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
font-size: 15px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.flex-white-plr26-column {
|
.flex-white-plr26-column {
|
||||||
@@ -123,7 +125,7 @@ import { audioManager } from '@/utils/audioManager'
|
|||||||
padding-right: 26rpx;
|
padding-right: 26rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
font-size: 15px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bdb_f5 {
|
.bdb_f5 {
|
||||||
@@ -164,12 +166,12 @@ import { audioManager } from '@/utils/audioManager'
|
|||||||
|
|
||||||
.redXingh {
|
.redXingh {
|
||||||
color: #FF0000;
|
color: #FF0000;
|
||||||
font-size: 14px;
|
font-size: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bluecolor {
|
.bluecolor {
|
||||||
color: #0000FF;
|
color: #0000FF;
|
||||||
font-size: 16px;
|
font-size: 17px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.udropdown {
|
.udropdown {
|
||||||
@@ -183,7 +185,7 @@ import { audioManager } from '@/utils/audioManager'
|
|||||||
.width276 {
|
.width276 {
|
||||||
width: 546rpx;
|
width: 546rpx;
|
||||||
color: #c5c5c5;
|
color: #c5c5c5;
|
||||||
font-size: 14px;
|
font-size: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cBlack {
|
.cBlack {
|
||||||
@@ -194,7 +196,7 @@ import { audioManager } from '@/utils/audioManager'
|
|||||||
margin-bottom: -10rpx;
|
margin-bottom: -10rpx;
|
||||||
margin-top: 16rpx;
|
margin-top: 16rpx;
|
||||||
padding-left: 26rpx;
|
padding-left: 26rpx;
|
||||||
font-size: 30rpx;
|
font-size: 32rpx;
|
||||||
color: #555555;
|
color: #555555;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
@@ -202,7 +204,7 @@ import { audioManager } from '@/utils/audioManager'
|
|||||||
.width242 {
|
.width242 {
|
||||||
width: 484rpx;
|
width: 484rpx;
|
||||||
color: #c5c5c5;
|
color: #c5c5c5;
|
||||||
font-size: 14px;
|
font-size: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.myCard {
|
.myCard {
|
||||||
@@ -220,7 +222,7 @@ import { audioManager } from '@/utils/audioManager'
|
|||||||
.cardRow {
|
.cardRow {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
font-size: 14px;
|
font-size: 15px;
|
||||||
margin-bottom: 8rpx;
|
margin-bottom: 8rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,7 +242,7 @@ import { audioManager } from '@/utils/audioManager'
|
|||||||
}
|
}
|
||||||
|
|
||||||
.cardTopName {
|
.cardTopName {
|
||||||
font-size: 16px;
|
font-size: 17px;
|
||||||
margin-bottom: 8rpx;
|
margin-bottom: 8rpx;
|
||||||
color: #000000;
|
color: #000000;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
@@ -274,7 +276,7 @@ import { audioManager } from '@/utils/audioManager'
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
font-size: 15px;
|
font-size: 16px;
|
||||||
color: #007AFF;
|
color: #007AFF;
|
||||||
margin-top: 12rpx;
|
margin-top: 12rpx;
|
||||||
margin-bottom: 16rpx;
|
margin-bottom: 16rpx;
|
||||||
@@ -288,7 +290,7 @@ import { audioManager } from '@/utils/audioManager'
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
right: 26rpx;
|
right: 26rpx;
|
||||||
bottom: 80rpx;
|
bottom: 80rpx;
|
||||||
font-size: 15px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fzrLeft {
|
.fzrLeft {
|
||||||
@@ -368,4 +370,32 @@ import { audioManager } from '@/utils/audioManager'
|
|||||||
height: 32rpx;
|
height: 32rpx;
|
||||||
background-color: #EEEEEE;
|
background-color: #EEEEEE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* PDA:放大 u-select 确认/取消按钮点击区域 */
|
||||||
|
.u-select__header {
|
||||||
|
height: 110rpx !important;
|
||||||
|
padding: 0 16rpx !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-select__header__btn {
|
||||||
|
font-size: 36rpx !important;
|
||||||
|
line-height: 110rpx !important;
|
||||||
|
padding: 0 40rpx !important;
|
||||||
|
min-width: 140rpx;
|
||||||
|
text-align: center;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-select__search,
|
||||||
|
.u-action-sheet-search,
|
||||||
|
.u-dropdown-item__search {
|
||||||
|
height: 88rpx !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-select__search__input,
|
||||||
|
.u-action-sheet-search__input,
|
||||||
|
.u-dropdown-item__search__input {
|
||||||
|
font-size: 32rpx !important;
|
||||||
|
height: 88rpx !important;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
+9
-25
@@ -7,10 +7,9 @@ export const isDevelopment = process.env.NODE_ENV === 'development'
|
|||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
upgradeName: process.env.VUE_APP_UPGRADE_NAME || 'erp_pda',
|
upgradeName: process.env.VUE_APP_UPGRADE_NAME || 'erp_pda',
|
||||||
upgradeCdnPrefix: process.env.VUE_APP_UPGRADE_CDN_PREFIX || '',
|
|
||||||
|
|
||||||
// 产品名称
|
// 产品名称
|
||||||
productName: '浩拓技术',
|
productName: '浩拓ERP',
|
||||||
|
|
||||||
// 公司名称
|
// 公司名称
|
||||||
companyName: '浩拓科技',
|
companyName: '浩拓科技',
|
||||||
@@ -21,36 +20,21 @@ const config = {
|
|||||||
// 环境判断
|
// 环境判断
|
||||||
isDevelopment: isDevelopment,
|
isDevelopment: isDevelopment,
|
||||||
|
|
||||||
// 生产环境API URL(服务名段 hcscm_weave)
|
// 生产环境API URL(服务名段 hcscm)
|
||||||
productionApiUrl: process.env.VUE_APP_PRODUCTION_API_URL,
|
productionApiUrl: process.env.VUE_APP_PRODUCTION_API_URL,
|
||||||
|
|
||||||
// 开发环境API URL选项(仅替换 //域名/ 后第一个路径段 hcscm → hcscm_weave,不改域名)
|
// 开发环境API URL选项(服务名段 hcscm)
|
||||||
devApiUrlOptions: [
|
devApiUrlOptions: [
|
||||||
{ label: '测试环境', value: 'https://hcscmtest.zzfzyc.com/hcscm_weave/pda/v1' },
|
{ label: '测试环境', value: 'https://hcscmtest.zzfzyc.com/hcscm/pda/v1' },
|
||||||
{ label: '正式环境', value: process.env.VUE_APP_PRODUCTION_API_URL },
|
{ label: '本地环境', value: 'http://192.168.1.66:7010/hcscm/pda/v1' },
|
||||||
{ label: '本地环境', value: 'http://192.168.1.97:7010/hcscm_weave/pda/v1' },
|
{ label: '本地穿透', value: 'https://2yd52gx88533.vicp.fun/hcscm/pda/v1' },
|
||||||
|
{ label: '正式环境', value: process.env.VUE_APP_PRODUCTION_API_URL },
|
||||||
{ label: '自定义', value: 'custom' }
|
{ label: '自定义', value: 'custom' }
|
||||||
]
|
]
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function resolveUpgradeDownloadUrl(downloadUrl) {
|
// 设置后台接口服务的基础地址 - 使用动态API URL
|
||||||
const raw = String(downloadUrl || '').trim();
|
// config.baseUrl = 'https://aidex.vip/api'; // 注释掉固定的baseUrl
|
||||||
const prefix = String(config.upgradeCdnPrefix || '').trim().replace(/\/+$/, '');
|
|
||||||
if (!raw || !prefix) {
|
|
||||||
return raw;
|
|
||||||
}
|
|
||||||
const path = raw.split('?')[0].split('#')[0];
|
|
||||||
const fileName = path.split('/').filter(Boolean).pop() || '';
|
|
||||||
if (!fileName || !/\.apk$/i.test(fileName)) {
|
|
||||||
return raw;
|
|
||||||
}
|
|
||||||
return `${prefix}/${fileName}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getDefaultApiUrl() {
|
|
||||||
const prod = config.devApiUrlOptions.find(item => item.label === '正式环境');
|
|
||||||
return (prod && prod.value) || config.productionApiUrl || 'https://zszc.yushangfangzhi.com/server/hcscm_weave/pda/v1';
|
|
||||||
}
|
|
||||||
|
|
||||||
export default config;
|
export default config;
|
||||||
|
|||||||
+83
-17
@@ -8,13 +8,26 @@ const install = (Vue, vm) => {
|
|||||||
const config = vm.vuex_config;
|
const config = vm.vuex_config;
|
||||||
console.log('install u',config)
|
console.log('install u',config)
|
||||||
|
|
||||||
// 坯布出仓单接口前缀(apiurl 已在 config.js 统一配置为 hcscm_weave 服务)
|
// 接口前缀统一走 hcscm(apiurl 已在 config.js 配置为 hcscm 服务)
|
||||||
|
const getApiUrl = () => String(vm.$store.state.apiurl || '');
|
||||||
|
|
||||||
const GFM_OTHER_DELIVERY_PREFIX = '/grey_fabric_manage/gfmOtherDeliveryOrder/';
|
const GFM_OTHER_DELIVERY_PREFIX = '/grey_fabric_manage/gfmOtherDeliveryOrder/';
|
||||||
const gfmOtherDeliveryUrl = (name) => (vm.$store.state.apiurl || '') + GFM_OTHER_DELIVERY_PREFIX + name;
|
const gfmOtherDeliveryUrl = (name) => getApiUrl() + GFM_OTHER_DELIVERY_PREFIX + name;
|
||||||
|
|
||||||
// 坯布库存接口前缀
|
|
||||||
const GFM_WAREHOUSE_PREFIX = '/grey_fabric_manage/gfmWarehouse/';
|
const GFM_WAREHOUSE_PREFIX = '/grey_fabric_manage/gfmWarehouse/';
|
||||||
const gfmWarehouseUrl = (name) => (vm.$store.state.apiurl || '') + GFM_WAREHOUSE_PREFIX + name;
|
const gfmWarehouseUrl = (name) => getApiUrl() + GFM_WAREHOUSE_PREFIX + name;
|
||||||
|
|
||||||
|
const FPM_PROCESS_IN_PREFIX = '/product/fpmProcessInOrder/';
|
||||||
|
const fpmProcessInUrl = (name) => getApiUrl() + FPM_PROCESS_IN_PREFIX + name;
|
||||||
|
|
||||||
|
const FPM_PROCESS_RETURN_IN_PREFIX = '/product/fpmProcessReturnInOrder/';
|
||||||
|
const fpmProcessReturnInUrl = (name) => getApiUrl() + FPM_PROCESS_RETURN_IN_PREFIX + name;
|
||||||
|
|
||||||
|
const FPM_PROCESS_OUT_PREFIX = '/product/fpmProcessOutOrder/';
|
||||||
|
const fpmProcessOutUrl = (name) => getApiUrl() + FPM_PROCESS_OUT_PREFIX + name;
|
||||||
|
|
||||||
|
const FPM_PRC_IN_PREFIX = '/product/fpmPrcInOrder/';
|
||||||
|
const fpmPrcInUrl = (name) => getApiUrl() + FPM_PRC_IN_PREFIX + name;
|
||||||
|
|
||||||
// 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
|
// 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
|
||||||
vm.$u.api = {
|
vm.$u.api = {
|
||||||
@@ -46,27 +59,76 @@ const install = (Vue, vm) => {
|
|||||||
detailList: (params = {}) => vm.$u.get(gfmWarehouseUrl('getGfmWarehouseList'), params),
|
detailList: (params = {}) => vm.$u.get(gfmWarehouseUrl('getGfmWarehouseList'), params),
|
||||||
},
|
},
|
||||||
|
|
||||||
// PDA 生产进仓(排产单细码扫码进仓)
|
// 加工进仓单
|
||||||
productionScheduleOrder: {
|
fpmProcessInOrder: {
|
||||||
getScanFineCodeDetail: (params = {}) => vm.$u.get('/produce/productionScheduleOrder/getScanFineCodeDetail', params),
|
list: (params = {}) => vm.$u.get(fpmProcessInUrl('getFpmProcessInOrderList'), params),
|
||||||
scanInWarehouseFineCode: (params = {}) => vm.$u.putJson('/produce/productionScheduleOrder/scanInWarehouseFineCode', params),
|
detail: (params = {}) => vm.$u.get(fpmProcessInUrl('getFpmProcessInOrder'), params),
|
||||||
|
add: (params = {}) => vm.$u.postJson(fpmProcessInUrl('addFpmProcessInOrder'), params),
|
||||||
|
scanUpdate: (params = {}) => vm.$u.putJson(fpmProcessInUrl('updateFpmProcessInOrder'), params),
|
||||||
|
statusPass: (params = {}) => vm.$u.putJson(fpmProcessInUrl('updateFpmProcessInOrderStatusPass'), params),
|
||||||
|
statusWait: (params = {}) => vm.$u.putJson(fpmProcessInUrl('updateFpmProcessInOrderStatusWait'), params),
|
||||||
|
statusReject: (params = {}) => vm.$u.putJson(fpmProcessInUrl('updateFpmProcessInOrderStatusReject'), params),
|
||||||
|
statusCancel: (params = {}) => vm.$u.putJson(fpmProcessInUrl('updateFpmProcessInOrderStatusCancel'), params),
|
||||||
},
|
},
|
||||||
|
|
||||||
// 营销体系下拉(路径相对 apiurl:.../pda/v1/saleSystem/getSaleSystemDropdownList)
|
// 加工退货进仓单
|
||||||
|
fpmProcessReturnInOrder: {
|
||||||
|
list: (params = {}) => vm.$u.get(fpmProcessReturnInUrl('getFpmProcessReturnInOrderList'), params),
|
||||||
|
detail: (params = {}) => vm.$u.get(fpmProcessReturnInUrl('getFpmProcessReturnInOrder'), params),
|
||||||
|
add: (params = {}) => vm.$u.postJson(fpmProcessReturnInUrl('addFpmProcessReturnInOrder'), params),
|
||||||
|
scanUpdate: (params = {}) => vm.$u.putJson(fpmProcessReturnInUrl('updateFpmProcessReturnInOrder'), params),
|
||||||
|
statusPass: (params = {}) => vm.$u.putJson(fpmProcessReturnInUrl('updateFpmProcessReturnInOrderStatusPass'), params),
|
||||||
|
statusWait: (params = {}) => vm.$u.putJson(fpmProcessReturnInUrl('updateFpmProcessReturnInOrderStatusWait'), params),
|
||||||
|
statusReject: (params = {}) => vm.$u.putJson(fpmProcessReturnInUrl('updateFpmProcessReturnInOrderStatusReject'), params),
|
||||||
|
statusCancel: (params = {}) => vm.$u.putJson(fpmProcessReturnInUrl('updateFpmProcessReturnInOrderStatusCancel'), params),
|
||||||
|
},
|
||||||
|
|
||||||
|
// 加工出仓单
|
||||||
|
fpmProcessOutOrder: {
|
||||||
|
list: (params = {}) => vm.$u.get(fpmProcessOutUrl('getFpmProcessOutOrderList'), params),
|
||||||
|
detail: (params = {}) => vm.$u.get(fpmProcessOutUrl('getFpmProcessOutOrder'), params),
|
||||||
|
add: (params = {}) => vm.$u.postJson(fpmProcessOutUrl('addFpmProcessOutOrder'), params),
|
||||||
|
scanUpdate: (params = {}) => vm.$u.putJson(fpmProcessOutUrl('updateFpmProcessOutOrder'), params),
|
||||||
|
statusPass: (params = {}) => vm.$u.putJson(fpmProcessOutUrl('updateFpmProcessOutOrderStatusPass'), params),
|
||||||
|
statusWait: (params = {}) => vm.$u.putJson(fpmProcessOutUrl('updateFpmProcessOutOrderStatusWait'), params),
|
||||||
|
statusReject: (params = {}) => vm.$u.putJson(fpmProcessOutUrl('updateFpmProcessOutOrderStatusReject'), params),
|
||||||
|
statusCancel: (params = {}) => vm.$u.putJson(fpmProcessOutUrl('updateFpmProcessOutOrderStatusCancel'), params),
|
||||||
|
/** 加工出仓类型枚举:正常加工出仓 / 回修加工出仓 */
|
||||||
|
getOutTypeEnum: (params = {}) => vm.$u.get(getApiUrl() + '/product/enum/getProcessOutTypeTypeEnum', params),
|
||||||
|
},
|
||||||
|
|
||||||
|
// 成品采购进仓单
|
||||||
|
fpmPrcInOrder: {
|
||||||
|
list: (params = {}) => vm.$u.get(fpmPrcInUrl('getFpmPrcInOrderList'), params),
|
||||||
|
detail: (params = {}) => vm.$u.get(fpmPrcInUrl('getFpmPrcInOrder'), params),
|
||||||
|
add: (params = {}) => vm.$u.postJson(fpmPrcInUrl('addFpmPrcInOrder'), params),
|
||||||
|
scanUpdate: (params = {}) => vm.$u.putJson(fpmPrcInUrl('updateFpmPrcInOrder'), params),
|
||||||
|
statusPass: (params = {}) => vm.$u.putJson(fpmPrcInUrl('updateFpmPrcInOrderStatusPass'), params),
|
||||||
|
statusWait: (params = {}) => vm.$u.putJson(fpmPrcInUrl('updateFpmPrcInOrderStatusWait'), params),
|
||||||
|
statusReject: (params = {}) => vm.$u.putJson(fpmPrcInUrl('updateFpmPrcInOrderStatusReject'), params),
|
||||||
|
statusCancel: (params = {}) => vm.$u.putJson(fpmPrcInUrl('updateFpmPrcInOrderStatusCancel'), params),
|
||||||
|
},
|
||||||
|
|
||||||
|
// 物理仓库下拉
|
||||||
|
physicalWarehouse: {
|
||||||
|
getDropdownList: (params = {}) => vm.$u.get('/warehouse/physicalWarehouse/getPhysicalWarehouseDropdownList', params),
|
||||||
|
},
|
||||||
|
|
||||||
|
// 仓位查询(Request: qr_code / warehouse_id / name;Response: GetPhysicalWarehouseBinData)
|
||||||
|
warehouseBin: {
|
||||||
|
getByQrCode: (params = {}) => vm.$u.get('/warehouse/warehouseBin/getWarehouseBin', params),
|
||||||
|
},
|
||||||
|
|
||||||
|
// 营销体系下拉
|
||||||
saleSystem: {
|
saleSystem: {
|
||||||
getDropdownList: (params = {}) => vm.$u.get('/saleSystem/getSaleSystemDropdownList', params),
|
getDropdownList: (params = {}) => vm.$u.get(getApiUrl() + '/saleSystem/getSaleSystemDropdownList', params),
|
||||||
},
|
},
|
||||||
|
|
||||||
// 往来单位列表(路径相对 apiurl:.../pda/v1/business_unit/list)
|
// 往来单位列表
|
||||||
businessUnit: {
|
businessUnit: {
|
||||||
list: (params = {}) => vm.$u.get('/business_unit/list', params),
|
list: (params = {}) => vm.$u.get('/business_unit/list', params),
|
||||||
},
|
},
|
||||||
|
|
||||||
// 员工枚举(路径相对 apiurl:.../pda/v1/employee/list_enum)
|
|
||||||
employee: {
|
|
||||||
listEnum: (params = {}) => vm.$u.get('/employee/list_enum', params),
|
|
||||||
},
|
|
||||||
|
|
||||||
// 字典明细枚举(路径相对 apiurl:.../pda/v1/dictionaryDetail/getDictionaryDetailEnumList)
|
// 字典明细枚举(路径相对 apiurl:.../pda/v1/dictionaryDetail/getDictionaryDetailEnumList)
|
||||||
dictionary: {
|
dictionary: {
|
||||||
getDetailEnumList: (params = {}) => vm.$u.get('/dictionaryDetail/getDictionaryDetailEnumList', params),
|
getDetailEnumList: (params = {}) => vm.$u.get('/dictionaryDetail/getDictionaryDetailEnumList', params),
|
||||||
@@ -80,6 +142,10 @@ const install = (Vue, vm) => {
|
|||||||
// PDA登录接口
|
// PDA登录接口
|
||||||
pdaLogin: (params = {}) => vm.$u.postJson('/login', params),
|
pdaLogin: (params = {}) => vm.$u.postJson('/login', params),
|
||||||
pdaLogout: (params = {}) => vm.$u.postJson('/logout', params),
|
pdaLogout: (params = {}) => vm.$u.postJson('/logout', params),
|
||||||
|
// 修改密码:PUT pda/v1/user/updatePassword
|
||||||
|
updatePassword: (params = {}) => vm.$u.putJson('/user/updatePassword', params),
|
||||||
|
// 登录后获取当前用户信息、菜单与按钮权限
|
||||||
|
pdaGetInformation: (params = {}) => vm.$u.get('/information', params),
|
||||||
// 获取配布单列表
|
// 获取配布单列表
|
||||||
getFpmArrangeOrderList: (params = {}) => vm.$u.get('/product/fpmArrangeOrder/getFpmArrangeOrderList', params),
|
getFpmArrangeOrderList: (params = {}) => vm.$u.get('/product/fpmArrangeOrder/getFpmArrangeOrderList', params),
|
||||||
// 获取成品配布单详情
|
// 获取成品配布单详情
|
||||||
@@ -114,7 +180,7 @@ const install = (Vue, vm) => {
|
|||||||
// 个人信息修改
|
// 个人信息修改
|
||||||
user: {
|
user: {
|
||||||
saveUserInfo: (params = {}) => vm.$u.post(config.productionApiUrl+'/mobile/user/saveUserInfo', params),
|
saveUserInfo: (params = {}) => vm.$u.post(config.productionApiUrl+'/mobile/user/saveUserInfo', params),
|
||||||
infoSavePwd: (params = {}) => vm.$u.put('/system/user/profile/updatePwd', params),
|
infoSavePwd: (params = {}) => vm.$u.put(config.productionApiUrl+'/system/user/profile/updatePwd', params),
|
||||||
infoSavePqa: (params = {}) => vm.$u.post(config.productionApiUrl+'/sys/user/infoSavePqa', params),
|
infoSavePqa: (params = {}) => vm.$u.post(config.productionApiUrl+'/sys/user/infoSavePqa', params),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
* Copyright (c) 2013-Now http://aidex.vip All rights reserved.
|
* Copyright (c) 2013-Now http://aidex.vip All rights reserved.
|
||||||
*/
|
*/
|
||||||
// 此处第二个参数vm,就是我们在页面使用的this,你可以通过vm获取vuex等操作
|
// 此处第二个参数vm,就是我们在页面使用的this,你可以通过vm获取vuex等操作
|
||||||
|
import { clearUserSession } from '@/common/userSession.js';
|
||||||
|
|
||||||
const install = (Vue, vm) => {
|
const install = (Vue, vm) => {
|
||||||
// 通用请求头设定
|
// 通用请求头设定
|
||||||
const ajaxHeader = 'x-ajax';
|
const ajaxHeader = 'x-ajax';
|
||||||
@@ -22,9 +24,16 @@ const install = (Vue, vm) => {
|
|||||||
|
|
||||||
// 请求拦截,配置Token等参数
|
// 请求拦截,配置Token等参数
|
||||||
Vue.prototype.$u.http.interceptor.request = (req) => {
|
Vue.prototype.$u.http.interceptor.request = (req) => {
|
||||||
console.log('request', req);
|
const reqUrl = req && req.url ? String(req.url) : '';
|
||||||
console.log('baseUrl', vm.$store.state.apiurl);
|
const isAbsolute = /^https?:\/\//i.test(reqUrl);
|
||||||
console.log('完整URL', vm.$store.state.apiurl + req.url);
|
const fullUrl = isAbsolute ? reqUrl : (vm.$store.state.apiurl + reqUrl);
|
||||||
|
// 用 JSON 字符串输出,避免 HBuilderX 控制台对象被截断、点击 URL 跳浏览器
|
||||||
|
console.log('request => ' + JSON.stringify({
|
||||||
|
url: fullUrl,
|
||||||
|
method: req.method,
|
||||||
|
data: req.data,
|
||||||
|
header: req.header
|
||||||
|
}, null, 2));
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
// Android 5.x 等老 PDA 不信任 Let's Encrypt 新证书链,关闭校验证书
|
// Android 5.x 等老 PDA 不信任 Let's Encrypt 新证书链,关闭校验证书
|
||||||
req.sslVerify = false;
|
req.sslVerify = false;
|
||||||
@@ -40,8 +49,9 @@ const install = (Vue, vm) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 设定传递 Token 认证参数 aidex
|
// 设定传递 Token 认证参数 aidex
|
||||||
if (!req.header[sessionIdHeader] && vm.vuex_token){
|
if (!req.header[sessionIdHeader]){
|
||||||
req.header[sessionIdHeader] = vm.vuex_token;
|
const loginData = uni.getStorageSync('RemoteTokenData');
|
||||||
|
req.header[sessionIdHeader] = vm.vuex_token || (loginData && loginData.token) || '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// 为节省流量,记住我数据不是每次都发送的,当会话失效后,尝试重试登录 aidex
|
// 为节省流量,记住我数据不是每次都发送的,当会话失效后,尝试重试登录 aidex
|
||||||
@@ -62,44 +72,32 @@ const install = (Vue, vm) => {
|
|||||||
// 处理401未授权状态码
|
// 处理401未授权状态码
|
||||||
if (res.statusCode === 401) {
|
if (res.statusCode === 401) {
|
||||||
vm.$u.toast('登录已过期,请重新登录');
|
vm.$u.toast('登录已过期,请重新登录');
|
||||||
// 清除token和用户信息
|
clearUserSession();
|
||||||
uni.removeStorageSync('token');
|
|
||||||
vm.$u.vuex('vuex_token', '');
|
|
||||||
vm.$u.vuex('vuex_user', {});
|
|
||||||
// 跳转到登录页面
|
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url: '/pages/sys/login/index'
|
url: '/pages/sys/login/index'
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
console.log('res',res)
|
// 非业务 JSON(如 404 page not found)
|
||||||
const rejectWithMessage = (message) => {
|
|
||||||
const text = String(message || '请求失败').trim() || '请求失败';
|
|
||||||
vm.$u.toast(text);
|
|
||||||
return Promise.reject(new Error(text));
|
|
||||||
};
|
|
||||||
// HTTP 非 200(如 404)时直接报错,避免把字符串/HTML 当业务 data 解析
|
|
||||||
if (res.statusCode && res.statusCode !== 200) {
|
if (res.statusCode && res.statusCode !== 200) {
|
||||||
let message = `请求失败(${res.statusCode})`;
|
const msg = (res.data && res.data.msg) || `请求失败(${res.statusCode})`;
|
||||||
if (typeof res.data === 'string' && res.data.trim()) {
|
vm.$u.toast(msg);
|
||||||
message = res.data.trim().slice(0, 120);
|
return Promise.reject(new Error(msg));
|
||||||
} else if (res.data && typeof res.data === 'object') {
|
|
||||||
message = res.data.msg || res.data.message || message;
|
|
||||||
}
|
|
||||||
return rejectWithMessage(message);
|
|
||||||
}
|
}
|
||||||
if (res.data === undefined || res.data === null || res.data === '') {
|
console.log('res',res)
|
||||||
const errMsg = String((res && res.errMsg) || '');
|
if (!(res.data)){
|
||||||
const isNetworkError = res.statusCode === -1
|
vm.$u.toast('未连接到服务器')
|
||||||
|| /Unable to resolve host|Failed to connect|request:fail|timeout|网络/i.test(errMsg);
|
return Promise.reject(new Error('未连接到服务器'));
|
||||||
const message = isNetworkError ? '当前没有网络,请检查网络后重试' : '未连接到服务器';
|
|
||||||
return rejectWithMessage(message);
|
|
||||||
}
|
}
|
||||||
if (typeof res.data !== 'object') {
|
if (typeof res.data !== 'object') {
|
||||||
return rejectWithMessage(String(res.data).slice(0, 120));
|
const msg = '接口返回异常';
|
||||||
|
vm.$u.toast(msg);
|
||||||
|
return Promise.reject(new Error(msg));
|
||||||
}
|
}
|
||||||
if (res.data.code !== 0) {
|
|
||||||
return rejectWithMessage(res.data.msg || res.data.message || '请求失败');
|
if(res.data.code !== 0) {
|
||||||
|
vm.$u.toast(res.data.msg)
|
||||||
|
return Promise.reject(new Error(res.data.msg))
|
||||||
}
|
}
|
||||||
let data = res.data.data;
|
let data = res.data.data;
|
||||||
console.log('data',data)
|
console.log('data',data)
|
||||||
|
|||||||
@@ -0,0 +1,149 @@
|
|||||||
|
@import '@/common/pda-typography.scss';
|
||||||
|
|
||||||
|
page { background-color: #F8F8F8; }
|
||||||
|
.filterBar { display: flex; align-items: center; padding: 16rpx 20rpx; background: #fff; gap: 16rpx; }
|
||||||
|
.filterBtn {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
min-width: 88rpx;
|
||||||
|
min-height: 76rpx;
|
||||||
|
padding: 8rpx 10rpx;
|
||||||
|
border: 2rpx solid transparent;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-size: $pda-font-nav-sub;
|
||||||
|
line-height: 1.2;
|
||||||
|
color: #666;
|
||||||
|
background: #f5f6f8;
|
||||||
|
}
|
||||||
|
.filter-active {
|
||||||
|
color: #2979ff !important;
|
||||||
|
background: #d6e8ff !important;
|
||||||
|
border-color: #2979ff !important;
|
||||||
|
}
|
||||||
|
.filterBtn__icon {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.filterBtn__badge {
|
||||||
|
position: absolute;
|
||||||
|
top: -8rpx;
|
||||||
|
right: -10rpx;
|
||||||
|
width: 18rpx;
|
||||||
|
height: 18rpx;
|
||||||
|
border: 4rpx solid #fff;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #ff4d4f;
|
||||||
|
box-sizing: content-box;
|
||||||
|
}
|
||||||
|
.filterPanel {
|
||||||
|
min-height: 100%;
|
||||||
|
padding: 32rpx 28rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.filterTitle {
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
font-size: $pda-font-popup-title;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #202328;
|
||||||
|
}
|
||||||
|
.filterItem { margin-bottom: 28rpx; }
|
||||||
|
.filterLabel {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 14rpx;
|
||||||
|
font-size: $pda-font-body;
|
||||||
|
line-height: 1.35;
|
||||||
|
color: #555b66;
|
||||||
|
}
|
||||||
|
.filterInput {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
min-height: $pda-row-min-height;
|
||||||
|
padding: 0 18rpx;
|
||||||
|
background: #f5f6f8;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
::v-deep .filterInput .u-input__input {
|
||||||
|
font-size: $pda-font-body !important;
|
||||||
|
color: #202328;
|
||||||
|
}
|
||||||
|
::v-deep .filterInput .u-input__input::placeholder {
|
||||||
|
font-size: $pda-font-placeholder;
|
||||||
|
color: #aeb4bf;
|
||||||
|
}
|
||||||
|
.filterValue {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
min-height: $pda-row-min-height;
|
||||||
|
padding: 0 18rpx;
|
||||||
|
background: #f5f6f8;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-size: $pda-font-body;
|
||||||
|
color: #202328;
|
||||||
|
}
|
||||||
|
.dateRow {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10rpx;
|
||||||
|
}
|
||||||
|
.datePicker {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
.dateInput {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
min-height: $pda-row-min-height;
|
||||||
|
padding: 0 8rpx;
|
||||||
|
background: #f5f6f8;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-size: $pda-font-body;
|
||||||
|
color: #202328;
|
||||||
|
text-align: center;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.dateInput--placeholder {
|
||||||
|
font-size: $pda-font-placeholder;
|
||||||
|
color: #7d8490;
|
||||||
|
}
|
||||||
|
.dateSeparator {
|
||||||
|
flex-shrink: 0;
|
||||||
|
font-size: $pda-font-body;
|
||||||
|
color: #555b66;
|
||||||
|
}
|
||||||
|
.filterActions {
|
||||||
|
display: flex;
|
||||||
|
gap: 20rpx;
|
||||||
|
margin-top: 40rpx;
|
||||||
|
}
|
||||||
|
.filterActions .u-btn {
|
||||||
|
flex: 1;
|
||||||
|
height: $pda-button-height !important;
|
||||||
|
line-height: $pda-button-height !important;
|
||||||
|
padding: 0 !important;
|
||||||
|
font-size: $pda-font-button !important;
|
||||||
|
}
|
||||||
|
::v-deep .pdaSelect .u-select__header {
|
||||||
|
height: $pda-row-min-height;
|
||||||
|
}
|
||||||
|
::v-deep .pdaSelect .u-select__header__btn,
|
||||||
|
::v-deep .pdaSelect .u-select__header__title,
|
||||||
|
::v-deep .pdaSelect .u-select__body__picker-view__item {
|
||||||
|
font-size: $pda-font-popup-item !important;
|
||||||
|
}
|
||||||
|
::v-deep .pdaSelect .u-select__search__input {
|
||||||
|
font-size: $pda-font-body !important;
|
||||||
|
}
|
||||||
|
::v-deep .pdaSelect .u-select__loading,
|
||||||
|
::v-deep .pdaSelect .u-select__empty {
|
||||||
|
font-size: $pda-font-popup-sub !important;
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
export function hasFilterValue(value) {
|
||||||
|
if (value === '' || value === null || value === undefined) return false;
|
||||||
|
if (typeof value === 'string') return value.trim() !== '';
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function normalizeAuditStatus(value) {
|
||||||
|
if (!hasFilterValue(value) && value !== 0) return '';
|
||||||
|
const status = Number(value);
|
||||||
|
return Number.isNaN(status) ? '' : status;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isActiveFilterState(filters) {
|
||||||
|
if (!filters) return false;
|
||||||
|
return Object.keys(filters).some((key) => {
|
||||||
|
if (/_name$/.test(key)) return false;
|
||||||
|
return hasFilterValue(filters[key]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function normalizeFilterState(value, defaults) {
|
||||||
|
const filters = { ...defaults };
|
||||||
|
if (!value || typeof value !== 'object' || Array.isArray(value)) return filters;
|
||||||
|
|
||||||
|
Object.keys(filters).forEach((key) => {
|
||||||
|
if (key === 'audit_status') return;
|
||||||
|
if (typeof value[key] === 'string' || typeof value[key] === 'number') {
|
||||||
|
filters[key] = value[key];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.keys(filters).forEach((key) => {
|
||||||
|
if (!key.endsWith('_id') || hasFilterValue(filters[key])) return;
|
||||||
|
const nameKey = `${key.slice(0, -3)}_name`;
|
||||||
|
if (nameKey in filters) filters[nameKey] = '';
|
||||||
|
});
|
||||||
|
if (Object.prototype.hasOwnProperty.call(value, 'audit_status')) {
|
||||||
|
filters.audit_status = normalizeAuditStatus(value.audit_status);
|
||||||
|
}
|
||||||
|
return filters;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function withSelectedOption(list, selectedValue, selectedLabel) {
|
||||||
|
const rows = Array.isArray(list) ? list.slice() : [];
|
||||||
|
const exists = rows.some((item) => String(item.value) === String(selectedValue));
|
||||||
|
if (hasFilterValue(selectedValue) && !exists) {
|
||||||
|
rows.unshift({ value: selectedValue, label: selectedLabel || String(selectedValue) });
|
||||||
|
}
|
||||||
|
return [{ value: '', label: '全部' }].concat(rows);
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
/**
|
||||||
|
* 从往来单位等列表接口中取出数组。
|
||||||
|
* 兼容拦截器解包后的 { list, total },以及完整响应
|
||||||
|
* { data: { code, data: { list, total } } }。
|
||||||
|
*/
|
||||||
|
export function extractList(data, depth = 0) {
|
||||||
|
if (!data || depth > 6) return [];
|
||||||
|
if (Array.isArray(data)) return data;
|
||||||
|
if (Array.isArray(data.list)) return data.list;
|
||||||
|
if (Array.isArray(data.items)) return data.items;
|
||||||
|
if (Array.isArray(data.records)) return data.records;
|
||||||
|
if (data.data && typeof data.data === 'object') return extractList(data.data, depth + 1);
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 将下拉/列表接口响应转为 u-select 所需的 { value, label } */
|
||||||
|
export function mapToSelectOptions(data) {
|
||||||
|
return extractList(data).filter((item) => item && typeof item === 'object').map((item) => ({
|
||||||
|
value: item.id != null ? item.id : item.value,
|
||||||
|
label: item.name || item.label || item.code || (item.id != null ? String(item.id) : ''),
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下拉远程搜索:把关键字写入接口常用的 name 参数。
|
||||||
|
* 空关键字时不带 name,让后端返回默认列表。
|
||||||
|
*/
|
||||||
|
export function withNameParam(params, keyword) {
|
||||||
|
const next = Object.assign({}, params || {});
|
||||||
|
const name = String(keyword || '').trim();
|
||||||
|
if (name) next.name = name;
|
||||||
|
else delete next.name;
|
||||||
|
return next;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const REMOTE_SELECT_TYPES = [
|
||||||
|
'染厂',
|
||||||
|
'加工单位',
|
||||||
|
'供应商',
|
||||||
|
'仓库名称',
|
||||||
|
'营销体系',
|
||||||
|
];
|
||||||
|
|
||||||
|
export function isRemoteSelectType(type) {
|
||||||
|
return REMOTE_SELECT_TYPES.indexOf(type) !== -1;
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
import { isRemoteSelectType } from '@/common/remoteSelect';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表单页远程下拉搜索。
|
||||||
|
* 使用方需实现 fetchRemoteSelectOptions(type, keyword),返回 { value, label }[]。
|
||||||
|
*
|
||||||
|
* 注意:不要用 `_` / `$` 前缀的 data 字段名——Vue2 不会代理到 this,
|
||||||
|
* `++this._xxx` 会得到 NaN,导致列表不更新、loading 不关。
|
||||||
|
*/
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
selectSearching: false,
|
||||||
|
selectSearchSeq: 0,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
isRemoteSelect() {
|
||||||
|
return isRemoteSelectType(this.selectType);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
isRemoteSelectType,
|
||||||
|
openSelectPicker(type, cachedList) {
|
||||||
|
this.selectType = type;
|
||||||
|
this.selectList = Array.isArray(cachedList) ? cachedList.slice() : [];
|
||||||
|
this.selectShow = true;
|
||||||
|
},
|
||||||
|
onSelectSearch(keyword) {
|
||||||
|
if (!isRemoteSelectType(this.selectType)) return;
|
||||||
|
if (typeof this.fetchRemoteSelectOptions !== 'function') return;
|
||||||
|
const seq = ++this.selectSearchSeq;
|
||||||
|
this.selectSearching = true;
|
||||||
|
const finish = () => {
|
||||||
|
if (seq === this.selectSearchSeq) this.selectSearching = false;
|
||||||
|
};
|
||||||
|
Promise.resolve()
|
||||||
|
.then(() => this.fetchRemoteSelectOptions(this.selectType, keyword))
|
||||||
|
.then((list) => {
|
||||||
|
if (seq !== this.selectSearchSeq) return;
|
||||||
|
this.selectList = Array.isArray(list) ? list.slice() : [];
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
if (seq !== this.selectSearchSeq) return;
|
||||||
|
if (typeof this.showError === 'function') {
|
||||||
|
this.showError((e && e.message) || '搜索失败');
|
||||||
|
} else {
|
||||||
|
uni.showToast({ title: (e && e.message) || '搜索失败', icon: 'none' });
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(finish, finish);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -35,11 +35,7 @@ export async function ensureScanConfigAfterLogin(api) {
|
|||||||
if (result.skipped) {
|
if (result.skipped) {
|
||||||
console.log('本地已有扫码设置,跳过自动匹配', result.config && result.config.name);
|
console.log('本地已有扫码设置,跳过自动匹配', result.config && result.config.name);
|
||||||
} else if (result.saved) {
|
} else if (result.saved) {
|
||||||
if (result.reason === 'rematch_n5s_from_seuic') {
|
console.log('已自动写入扫码设置', result.config && result.config.name);
|
||||||
console.log('N5S 误识别为东集,已纠正为', result.config && result.config.name);
|
|
||||||
} else {
|
|
||||||
console.log('已自动写入扫码设置', result.config && result.config.name);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
console.log('自动匹配扫码设置未写入', result.reason);
|
console.log('自动匹配扫码设置未写入', result.reason);
|
||||||
}
|
}
|
||||||
|
|||||||
+55
-178
@@ -4,9 +4,6 @@ export const DICTIONARY_TYPE_SCANNER = 10046;
|
|||||||
|
|
||||||
export const PHONE_SCAN_BRAND = 'phone';
|
export const PHONE_SCAN_BRAND = 'phone';
|
||||||
|
|
||||||
// 历史误用 brand=newland 表示东集;真正的新大陆是 nlscan
|
|
||||||
const LEGACY_SEUIC_BRANDS = ['newland', '东集', 'idata'];
|
|
||||||
|
|
||||||
export const PHONE_SCAN_CONFIG = {
|
export const PHONE_SCAN_CONFIG = {
|
||||||
brand: PHONE_SCAN_BRAND,
|
brand: PHONE_SCAN_BRAND,
|
||||||
name: '手机扫码',
|
name: '手机扫码',
|
||||||
@@ -16,17 +13,16 @@ export const PHONE_SCAN_CONFIG = {
|
|||||||
/** 内置扫码配置:补 needSetup,并在字典拉不到时兜底 */
|
/** 内置扫码配置:补 needSetup,并在字典拉不到时兜底 */
|
||||||
export const BUILTIN_SCANNER_CONFIGS = [
|
export const BUILTIN_SCANNER_CONFIGS = [
|
||||||
{
|
{
|
||||||
brand: 'seuic',
|
brand: 'newland',
|
||||||
name: '东大集成(AUTOID)',
|
name: '东大集成',
|
||||||
action: 'com.android.server.scannerservice.broadcast',
|
action: 'com.android.server.scannerservice.broadcast',
|
||||||
dataKey: 'scannerdata',
|
dataKey: 'scannerdata',
|
||||||
needSetup: true,
|
needSetup: true,
|
||||||
setupAction: 'com.android.scanner.service_settings',
|
setupAction: 'com.android.scanner.service_settings',
|
||||||
setupParams: {
|
setupParams: {
|
||||||
barcode_send_mode: 'BROADCAST',
|
|
||||||
action_barcode_broadcast: 'com.android.server.scannerservice.broadcast',
|
action_barcode_broadcast: 'com.android.server.scannerservice.broadcast',
|
||||||
key_barcode_broadcast: 'scannerdata',
|
key_barcode_broadcast: 'scannerdata',
|
||||||
endchar: 'NONE',
|
endchar: 'ENTER',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -36,13 +32,6 @@ export const BUILTIN_SCANNER_CONFIGS = [
|
|||||||
dataKey: 'data',
|
dataKey: 'data',
|
||||||
needSetup: false,
|
needSetup: false,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
brand: 'urovo',
|
|
||||||
name: '优博讯',
|
|
||||||
action: 'android.intent.ACTION_DECODE_DATA',
|
|
||||||
dataKey: 'barcode_string',
|
|
||||||
needSetup: false,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
brand: 'nlscan',
|
brand: 'nlscan',
|
||||||
name: '新大陆',
|
name: '新大陆',
|
||||||
@@ -51,11 +40,24 @@ export const BUILTIN_SCANNER_CONFIGS = [
|
|||||||
needSetup: false,
|
needSetup: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// N5S 部分固件走智联天地兼容广播,而不是 nlscan.action
|
brand: 'urovo',
|
||||||
brand: 'nlscan_compat',
|
name: '优博讯',
|
||||||
name: '新大陆(兼容广播)',
|
action: 'android.intent.ACTION_DECODE_DATA',
|
||||||
action: 'android.intent.action.RECEIVE_SCANDATA_BROADCAST',
|
dataKey: 'barcode_string',
|
||||||
dataKey: 'android.intent.extra.SCAN_BROADCAST_DATA',
|
needSetup: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
brand: 'idata',
|
||||||
|
name: '盈达',
|
||||||
|
action: 'android.intent.action.SCANRESULT',
|
||||||
|
dataKey: 'value',
|
||||||
|
needSetup: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
brand: 'iData',
|
||||||
|
name: '海雅达',
|
||||||
|
action: 'com.android.scanner.broadcast',
|
||||||
|
dataKey: 'scandata',
|
||||||
needSetup: false,
|
needSetup: false,
|
||||||
},
|
},
|
||||||
{ ...PHONE_SCAN_CONFIG },
|
{ ...PHONE_SCAN_CONFIG },
|
||||||
@@ -70,58 +72,39 @@ const DETECT_RULES = [
|
|||||||
packages: ['com.sunmi.scanner', 'woyou.aidlservice.jiuiv5'],
|
packages: ['com.sunmi.scanner', 'woyou.aidlservice.jiuiv5'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
matchNames: ['新大陆', '新大陆(兼容广播)'],
|
matchNames: ['新大陆'],
|
||||||
matchActions: [
|
matchActions: ['nlscan.action.SCANNER_RESULT'],
|
||||||
'nlscan.action.SCANNER_RESULT',
|
keywords: ['newland', 'nls', 'nlscan'],
|
||||||
'android.intent.action.RECEIVE_SCANDATA_BROADCAST',
|
packages: ['com.nlscan.barcodescanner', 'com.newland'],
|
||||||
],
|
|
||||||
// N5S 机型常标成 alps/zltd,不能只靠 newland 关键字
|
|
||||||
keywords: ['newland', 'nls', 'nlscan', 'n5s', 'zltd'],
|
|
||||||
models: ['n5s', 'n5'],
|
|
||||||
packages: [
|
|
||||||
'com.nlscan.barcodescanner',
|
|
||||||
'com.newland',
|
|
||||||
'com.nlscan.android.scan.service',
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
matchNames: ['优博讯'],
|
matchNames: ['优博讯'],
|
||||||
matchActions: ['android.intent.ACTION_DECODE_DATA'],
|
matchActions: ['android.intent.ACTION_DECODE_DATA'],
|
||||||
keywords: ['urovo', 'ubx'],
|
keywords: ['urovo'],
|
||||||
packages: ['com.urovo', 'com.ubx'],
|
packages: ['com.urovo', 'com.ubx'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
matchNames: ['盈达'],
|
matchNames: ['盈达'],
|
||||||
matchActions: ['android.intent.action.SCANRESULT'],
|
matchActions: ['android.intent.action.SCANRESULT'],
|
||||||
keywords: ['idata', 'yingda'],
|
keywords: ['idata', 'yingda'],
|
||||||
packages: ['com.idata'],
|
packages: ['com.idata', 'com.android.scanner'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
matchNames: ['海雅达'],
|
matchNames: ['海雅达'],
|
||||||
matchActions: ['com.android.scanner.broadcast'],
|
matchActions: ['com.android.scanner.broadcast'],
|
||||||
keywords: ['haiyada'],
|
keywords: ['iData', 'seui', 'haiyada'],
|
||||||
packages: [],
|
packages: ['com.android.scanner'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
matchNames: ['东大集成(AUTOID)', '东大集成', '东集'],
|
matchNames: ['东大集成', '东集'],
|
||||||
matchActions: ['com.android.server.scannerservice.broadcast'],
|
matchActions: ['com.android.server.scannerservice.broadcast'],
|
||||||
keywords: ['seuic', 'autoid', 'eastcom', '东集', '东大'],
|
keywords: ['seuic', 'eastcom', 'newland', 'nls'],
|
||||||
packages: ['com.seuic.scanner'],
|
packages: ['com.android.scanner', 'com.seuic.scanner'],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const PDA_DEVICE_KEYWORDS = [
|
const PDA_DEVICE_KEYWORDS = [
|
||||||
'newland', 'nls', 'nlscan', 'n5s', 'zltd', 'sunmi', 'urovo', 'ubx', 'zebra', 'honeywell',
|
'newland', 'nls', 'sunmi', 'urovo', 'honeywell', 'idata', 'seuic', 'zebra', 'ubx',
|
||||||
'idata', 'seuic', 'autoid', '东集', '东大',
|
|
||||||
];
|
|
||||||
|
|
||||||
/** 明确机型 → 优先品牌,避免通用东集广播抢分 */
|
|
||||||
const MODEL_PREFERRED_BRANDS = [
|
|
||||||
{
|
|
||||||
models: ['n5s'],
|
|
||||||
brands: ['nlscan', 'nlscan_compat'],
|
|
||||||
score: 220,
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const NO_SETUP_HINT_KEY = 'pda_scan_config_hint_shown';
|
const NO_SETUP_HINT_KEY = 'pda_scan_config_hint_shown';
|
||||||
@@ -130,28 +113,6 @@ export function isPhoneScanConfig(config) {
|
|||||||
return !!(config && (config.isPhoneScan || config.brand === PHONE_SCAN_BRAND));
|
return !!(config && (config.isPhoneScan || config.brand === PHONE_SCAN_BRAND));
|
||||||
}
|
}
|
||||||
|
|
||||||
function migrateLegacySeuicBrand(config) {
|
|
||||||
if (!config || isPhoneScanConfig(config)) {
|
|
||||||
return config;
|
|
||||||
}
|
|
||||||
const brand = String(config.brand || '');
|
|
||||||
const name = String(config.name || '');
|
|
||||||
const action = String(config.action || '');
|
|
||||||
// 历史内置配置把东集误标成 brand=newland;真正的新大陆是 nlscan
|
|
||||||
const isLegacySeuicLabel = LEGACY_SEUIC_BRANDS.includes(brand) || name === '东集';
|
|
||||||
if (!isLegacySeuicLabel) {
|
|
||||||
return config;
|
|
||||||
}
|
|
||||||
if (action.includes('nlscan')) {
|
|
||||||
return config;
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
...config,
|
|
||||||
brand: 'seuic',
|
|
||||||
name: (!name || name === '东集') ? '东大集成(AUTOID)' : name,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function enrichFromBuiltinConfig(config, builtinConfigs = []) {
|
function enrichFromBuiltinConfig(config, builtinConfigs = []) {
|
||||||
if (!config || !builtinConfigs.length) {
|
if (!config || !builtinConfigs.length) {
|
||||||
return config;
|
return config;
|
||||||
@@ -160,13 +121,7 @@ function enrichFromBuiltinConfig(config, builtinConfigs = []) {
|
|||||||
const builtin = builtinConfigs.find((item) => {
|
const builtin = builtinConfigs.find((item) => {
|
||||||
return item.action === config.action
|
return item.action === config.action
|
||||||
|| item.name === config.name
|
|| item.name === config.name
|
||||||
|| item.brand === config.brand
|
|| item.brand === config.brand;
|
||||||
|| (item.brand === 'seuic' && (
|
|
||||||
String(config.name || '').includes('东大')
|
|
||||||
|| String(config.name || '').includes('东集')
|
|
||||||
|| String(config.name || '').includes('AUTOID')
|
|
||||||
|| String(config.action || '').includes('scannerservice.broadcast')
|
|
||||||
));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!builtin) {
|
if (!builtin) {
|
||||||
@@ -175,13 +130,13 @@ function enrichFromBuiltinConfig(config, builtinConfigs = []) {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
...config,
|
...config,
|
||||||
needSetup: builtin.needSetup,
|
needSetup: config.needSetup != null ? config.needSetup : builtin.needSetup,
|
||||||
setupAction: builtin.setupAction || '',
|
setupAction: config.setupAction || builtin.setupAction || '',
|
||||||
setupParams: builtin.setupParams || null,
|
setupParams: config.setupParams || builtin.setupParams || null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function normalizeConfig(raw, builtinConfigs = []) {
|
export function normalizeConfig(raw, builtinConfigs = BUILTIN_SCANNER_CONFIGS) {
|
||||||
if (!raw || typeof raw !== 'object') return null;
|
if (!raw || typeof raw !== 'object') return null;
|
||||||
|
|
||||||
const brand = String(raw.brand || raw.id || raw.dictionary_detail_id || raw.name || '');
|
const brand = String(raw.brand || raw.id || raw.dictionary_detail_id || raw.name || '');
|
||||||
@@ -191,7 +146,7 @@ export function normalizeConfig(raw, builtinConfigs = []) {
|
|||||||
return { ...PHONE_SCAN_CONFIG };
|
return { ...PHONE_SCAN_CONFIG };
|
||||||
}
|
}
|
||||||
|
|
||||||
let config = {
|
const config = enrichFromBuiltinConfig({
|
||||||
brand,
|
brand,
|
||||||
name: raw.name || '',
|
name: raw.name || '',
|
||||||
action: raw.action || raw.code || '',
|
action: raw.action || raw.code || '',
|
||||||
@@ -199,10 +154,7 @@ export function normalizeConfig(raw, builtinConfigs = []) {
|
|||||||
needSetup: raw.needSetup != null ? raw.needSetup : !!raw.need_setup,
|
needSetup: raw.needSetup != null ? raw.needSetup : !!raw.need_setup,
|
||||||
setupAction: raw.setupAction || raw.setup_action || '',
|
setupAction: raw.setupAction || raw.setup_action || '',
|
||||||
setupParams: raw.setupParams || raw.setup_params || null,
|
setupParams: raw.setupParams || raw.setup_params || null,
|
||||||
};
|
}, builtinConfigs);
|
||||||
|
|
||||||
config = migrateLegacySeuicBrand(config);
|
|
||||||
config = enrichFromBuiltinConfig(config, builtinConfigs);
|
|
||||||
|
|
||||||
if (!config.brand || !config.action || !config.dataKey) {
|
if (!config.brand || !config.action || !config.dataKey) {
|
||||||
return null;
|
return null;
|
||||||
@@ -211,29 +163,24 @@ export function normalizeConfig(raw, builtinConfigs = []) {
|
|||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function mapDictionaryToScannerConfig(raw, builtinConfigs = []) {
|
export function mapDictionaryToScannerConfig(raw, builtinConfigs = BUILTIN_SCANNER_CONFIGS) {
|
||||||
return normalizeConfig(raw, builtinConfigs);
|
return normalizeConfig(raw, builtinConfigs);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getScanConfig(builtinConfigs = []) {
|
export function getScanConfig(builtinConfigs = BUILTIN_SCANNER_CONFIGS) {
|
||||||
try {
|
try {
|
||||||
const data = uni.getStorageSync(STORAGE_KEY);
|
const data = uni.getStorageSync(STORAGE_KEY);
|
||||||
const normalized = normalizeConfig(data, builtinConfigs);
|
return normalizeConfig(data, builtinConfigs);
|
||||||
// 旧 brand=newland(东集) 迁移后写回,避免下次仍读到错误 brand
|
|
||||||
if (normalized && data && String(data.brand || '') !== String(normalized.brand || '')) {
|
|
||||||
try {
|
|
||||||
uni.setStorageSync(STORAGE_KEY, normalized);
|
|
||||||
} catch (e) {
|
|
||||||
console.log('迁移扫码枪配置写回失败', e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return normalized;
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('读取扫码枪配置失败', e);
|
console.log('读取扫码枪配置失败', e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function hasLocalScanConfig(builtinConfigs = BUILTIN_SCANNER_CONFIGS) {
|
||||||
|
return !!getScanConfig(builtinConfigs);
|
||||||
|
}
|
||||||
|
|
||||||
export function saveScanConfig(config) {
|
export function saveScanConfig(config) {
|
||||||
const normalized = normalizeConfig(config);
|
const normalized = normalizeConfig(config);
|
||||||
if (!normalized) {
|
if (!normalized) {
|
||||||
@@ -272,7 +219,7 @@ export function mergeScannerConfigs(remoteConfigs = []) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
(remoteConfigs || []).forEach((raw) => {
|
(remoteConfigs || []).forEach((raw) => {
|
||||||
const normalized = mapDictionaryToScannerConfig(raw, BUILTIN_SCANNER_CONFIGS);
|
const normalized = mapDictionaryToScannerConfig(raw);
|
||||||
if (!normalized || isPhoneScanConfig(normalized)) return;
|
if (!normalized || isPhoneScanConfig(normalized)) return;
|
||||||
configMap.set(normalized.action || normalized.brand, normalized);
|
configMap.set(normalized.action || normalized.brand, normalized);
|
||||||
});
|
});
|
||||||
@@ -300,7 +247,7 @@ export function getDeviceIdentity() {
|
|||||||
export function isPdaDevice() {
|
export function isPdaDevice() {
|
||||||
const identity = getDeviceIdentity();
|
const identity = getDeviceIdentity();
|
||||||
const text = `${identity.manufacturer} ${identity.model} ${identity.brand}`;
|
const text = `${identity.manufacturer} ${identity.model} ${identity.brand}`;
|
||||||
return PDA_DEVICE_KEYWORDS.some((keyword) => text.includes(String(keyword).toLowerCase()));
|
return PDA_DEVICE_KEYWORDS.some((keyword) => text.includes(keyword.toLowerCase()));
|
||||||
}
|
}
|
||||||
|
|
||||||
function findDetectRule(config) {
|
function findDetectRule(config) {
|
||||||
@@ -345,57 +292,6 @@ function canResolveBroadcast(action) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isModelMatch(identity, models = []) {
|
|
||||||
const model = String((identity && identity.model) || '').toLowerCase();
|
|
||||||
if (!model) return false;
|
|
||||||
return (models || []).some((item) => model === item || model.includes(item));
|
|
||||||
}
|
|
||||||
|
|
||||||
function getModelPreferredBoost(config, identity) {
|
|
||||||
if (!config || isPhoneScanConfig(config)) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
const brand = String(config.brand || '');
|
|
||||||
for (let i = 0; i < MODEL_PREFERRED_BRANDS.length; i += 1) {
|
|
||||||
const rule = MODEL_PREFERRED_BRANDS[i];
|
|
||||||
if (!isModelMatch(identity, rule.models)) continue;
|
|
||||||
if ((rule.brands || []).includes(brand)) {
|
|
||||||
return Number(rule.score) || 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 新大陆 N5S / 智联天地 N5S:机型名常为 n5s,厂商可能是 newland/zltd/alps */
|
|
||||||
export function isNewlandN5sDevice(identity = getDeviceIdentity()) {
|
|
||||||
const model = String((identity && identity.model) || '').toLowerCase();
|
|
||||||
const text = `${identity.manufacturer || ''} ${identity.brand || ''} ${model}`.toLowerCase();
|
|
||||||
if (model === 'n5s' || model.includes('n5s')) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return text.includes('n5s') && (
|
|
||||||
text.includes('newland')
|
|
||||||
|| text.includes('zltd')
|
|
||||||
|| text.includes('nlscan')
|
|
||||||
|| text.includes('alps')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function isWrongSeuicOnNewlandDevice(config, identity = getDeviceIdentity()) {
|
|
||||||
if (!config || isPhoneScanConfig(config)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!isNewlandN5sDevice(identity) && !isModelMatch(identity, ['n5s'])) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
const brand = String(config.brand || '');
|
|
||||||
const action = String(config.action || '');
|
|
||||||
return brand === 'seuic'
|
|
||||||
|| action.includes('scannerservice.broadcast')
|
|
||||||
|| String(config.name || '').includes('东集')
|
|
||||||
|| String(config.name || '').includes('东大');
|
|
||||||
}
|
|
||||||
|
|
||||||
function scoreScannerConfig(config, identity) {
|
function scoreScannerConfig(config, identity) {
|
||||||
if (!config || isPhoneScanConfig(config)) {
|
if (!config || isPhoneScanConfig(config)) {
|
||||||
return 0;
|
return 0;
|
||||||
@@ -416,19 +312,6 @@ function scoreScannerConfig(config, identity) {
|
|||||||
if ((rule.keywords || []).some((keyword) => deviceText.includes(String(keyword).toLowerCase()))) {
|
if ((rule.keywords || []).some((keyword) => deviceText.includes(String(keyword).toLowerCase()))) {
|
||||||
score += 40;
|
score += 40;
|
||||||
}
|
}
|
||||||
if (isModelMatch(identity, rule.models || [])) {
|
|
||||||
score += 80;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
score += getModelPreferredBoost(config, identity);
|
|
||||||
|
|
||||||
// 明确是 N5S 时,压低东集通用广播抢分
|
|
||||||
if (isNewlandN5sDevice(identity) && (
|
|
||||||
config.brand === 'seuic'
|
|
||||||
|| String(config.action || '').includes('scannerservice.broadcast')
|
|
||||||
)) {
|
|
||||||
score = Math.min(score, 30);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return score;
|
return score;
|
||||||
@@ -439,7 +322,7 @@ function scoreScannerConfig(config, identity) {
|
|||||||
*/
|
*/
|
||||||
export function matchBestScanConfig(candidateConfigs = []) {
|
export function matchBestScanConfig(candidateConfigs = []) {
|
||||||
const configs = (candidateConfigs || [])
|
const configs = (candidateConfigs || [])
|
||||||
.map((item) => normalizeConfig(item, BUILTIN_SCANNER_CONFIGS))
|
.map((item) => normalizeConfig(item))
|
||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
const pdaConfigs = configs.filter((item) => !isPhoneScanConfig(item));
|
const pdaConfigs = configs.filter((item) => !isPhoneScanConfig(item));
|
||||||
const identity = getDeviceIdentity();
|
const identity = getDeviceIdentity();
|
||||||
@@ -466,16 +349,12 @@ export function matchBestScanConfig(candidateConfigs = []) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 仅本地没有有效配置时,自动匹配并写入扫描设置。
|
* 仅本地没有有效配置时,自动匹配并写入扫描设置
|
||||||
* 若本地误把 N5S 识别成东集,则强制重配。
|
|
||||||
* @returns {{ saved: boolean, config: object|null, skipped: boolean, reason?: string }}
|
* @returns {{ saved: boolean, config: object|null, skipped: boolean, reason?: string }}
|
||||||
*/
|
*/
|
||||||
export function autoConfigureScanSettings({ remoteConfigs = [] } = {}) {
|
export function autoConfigureScanSettings({ remoteConfigs = [] } = {}) {
|
||||||
const existing = getScanConfig(BUILTIN_SCANNER_CONFIGS);
|
const existing = getScanConfig();
|
||||||
const identity = getDeviceIdentity();
|
if (existing) {
|
||||||
const forceRematch = !!(existing && isWrongSeuicOnNewlandDevice(existing, identity));
|
|
||||||
|
|
||||||
if (existing && !forceRematch) {
|
|
||||||
return {
|
return {
|
||||||
saved: false,
|
saved: false,
|
||||||
skipped: true,
|
skipped: true,
|
||||||
@@ -490,7 +369,7 @@ export function autoConfigureScanSettings({ remoteConfigs = [] } = {}) {
|
|||||||
return {
|
return {
|
||||||
saved: false,
|
saved: false,
|
||||||
skipped: false,
|
skipped: false,
|
||||||
config: existing || null,
|
config: null,
|
||||||
reason: 'no_match',
|
reason: 'no_match',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -500,8 +379,6 @@ export function autoConfigureScanSettings({ remoteConfigs = [] } = {}) {
|
|||||||
saved,
|
saved,
|
||||||
skipped: false,
|
skipped: false,
|
||||||
config: matched,
|
config: matched,
|
||||||
reason: saved
|
reason: saved ? 'saved' : 'save_failed',
|
||||||
? (forceRematch ? 'rematch_n5s_from_seuic' : 'saved')
|
|
||||||
: 'save_failed',
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-83
@@ -19,13 +19,14 @@ export default {
|
|||||||
registeredBrands: [],
|
registeredBrands: [],
|
||||||
remoteScannerConfigs: [],
|
remoteScannerConfigs: [],
|
||||||
usePhoneScanFallback: false,
|
usePhoneScanFallback: false,
|
||||||
|
phoneScanPanelOpen: false,
|
||||||
_scanCallback: null,
|
_scanCallback: null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
getScannerConfigs() {
|
getScannerConfigs() {
|
||||||
return BUILTIN_SCANNER_CONFIGS;
|
return BUILTIN_SCANNER_CONFIGS.map((item) => ({ ...item }));
|
||||||
},
|
},
|
||||||
|
|
||||||
getPhoneScanConfig() {
|
getPhoneScanConfig() {
|
||||||
@@ -72,63 +73,29 @@ export default {
|
|||||||
return configs.length ? configs[0] : null;
|
return configs.length ? configs[0] : null;
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 停止手机连续扫码(含 Ba-Scanner) */
|
closePhoneScanPanel() {
|
||||||
stopPhoneScanContinuous() {
|
this.phoneScanPanelOpen = false;
|
||||||
this._phoneScanContinuousActive = false;
|
},
|
||||||
// #ifdef APP-PLUS
|
|
||||||
try {
|
/** 半屏连续扫:再次点击同一入口则收起 */
|
||||||
const scanner = uni.requireNativePlugin('Ba-Scanner');
|
togglePhoneScanPanel() {
|
||||||
if (scanner && typeof scanner.onClose === 'function') {
|
this.phoneScanPanelOpen = !this.phoneScanPanelOpen;
|
||||||
scanner.onClose();
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
// 未购买/未打包原生插件时忽略
|
|
||||||
}
|
|
||||||
// #endif
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* 打开手机扫码
|
|
||||||
* @param {{ continuous?: boolean, callback?: Function, fail?: Function, scanType?: string[], hintText?: string, scanTimeSpace?: number }} options
|
|
||||||
* continuous=true 时优先用 Ba-Scanner 连续扫;无插件则扫完自动再开相机
|
|
||||||
*/
|
|
||||||
openPhoneScan(options = {}) {
|
openPhoneScan(options = {}) {
|
||||||
const callback = options.callback || this._scanCallback;
|
const callback = options.callback || this._scanCallback;
|
||||||
const continuous = !!options.continuous;
|
|
||||||
this._phoneScanContinuousActive = continuous;
|
|
||||||
|
|
||||||
// #ifdef APP-PLUS
|
|
||||||
if (continuous && this.openBaScannerContinuous(options, callback)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
// #ifdef APP-PLUS || MP-WEIXIN
|
// #ifdef APP-PLUS || MP-WEIXIN
|
||||||
uni.scanCode({
|
uni.scanCode({
|
||||||
scanType: options.scanType || ['qrCode', 'barCode'],
|
scanType: options.scanType || ['qrCode', 'barCode'],
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
const result = this.handleScanResult(res.result, callback);
|
this.handleScanResult(res.result, callback);
|
||||||
if (!continuous || !this._phoneScanContinuousActive) return;
|
|
||||||
Promise.resolve(result)
|
|
||||||
.catch(() => null)
|
|
||||||
.then(() => {
|
|
||||||
if (!this._phoneScanContinuousActive || !this.isPageActive) return;
|
|
||||||
setTimeout(() => {
|
|
||||||
if (!this._phoneScanContinuousActive || !this.isPageActive) return;
|
|
||||||
this.openPhoneScan(options);
|
|
||||||
}, Number(options.scanTimeSpace) > 0 ? Number(options.scanTimeSpace) : 400);
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
console.error('手机扫码失败:', err);
|
console.error('手机扫码失败:', err);
|
||||||
this._phoneScanContinuousActive = false;
|
|
||||||
if (options.fail) {
|
if (options.fail) {
|
||||||
options.fail(err);
|
options.fail(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 用户取消不打扰
|
|
||||||
const msg = (err && (err.errMsg || err.message)) || '';
|
|
||||||
if (/cancel|取消/i.test(msg)) return;
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '扫码失败',
|
title: '扫码失败',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
@@ -146,41 +113,6 @@ export default {
|
|||||||
// #endif
|
// #endif
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* Ba-Scanner 连续扫码(插件市场 id=9669)
|
|
||||||
* @returns {boolean} 是否已成功唤起原生连续扫
|
|
||||||
*/
|
|
||||||
openBaScannerContinuous(options = {}, callback) {
|
|
||||||
// #ifdef APP-PLUS
|
|
||||||
try {
|
|
||||||
const scanner = uni.requireNativePlugin('Ba-Scanner');
|
|
||||||
if (!scanner || typeof scanner.onScan !== 'function') return false;
|
|
||||||
scanner.onScan(
|
|
||||||
{
|
|
||||||
isContinuous: true,
|
|
||||||
scanTimeSpace: Number(options.scanTimeSpace) > 0 ? Number(options.scanTimeSpace) : 1500,
|
|
||||||
isShowVibrate: options.isShowVibrate !== false,
|
|
||||||
isShowBeep: !!options.isShowBeep,
|
|
||||||
isShowToast: false,
|
|
||||||
isShowPhotoAlbum: options.isShowPhotoAlbum !== false,
|
|
||||||
hintText: options.hintText || '扫二维码/条形码,可连续扫',
|
|
||||||
barcodeFormats: options.barcodeFormats || ['QR Code', 'Code 128', 'Code 39', 'EAN-13', 'EAN-8'],
|
|
||||||
},
|
|
||||||
(ret) => {
|
|
||||||
if (!ret || !ret.result) return;
|
|
||||||
if (!this._phoneScanContinuousActive) return;
|
|
||||||
this.handleScanResult(ret.result, callback);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
return true;
|
|
||||||
} catch (e) {
|
|
||||||
console.warn('Ba-Scanner 不可用,回退 uni.scanCode', e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// #endif
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
|
|
||||||
triggerScan() {
|
triggerScan() {
|
||||||
if (this.usePhoneScanFallback) {
|
if (this.usePhoneScanFallback) {
|
||||||
this.openPhoneScan();
|
this.openPhoneScan();
|
||||||
@@ -339,12 +271,11 @@ export default {
|
|||||||
console.log("扫码结果:", cleanCode);
|
console.log("扫码结果:", cleanCode);
|
||||||
|
|
||||||
if (scanCallback) {
|
if (scanCallback) {
|
||||||
return scanCallback(cleanCode);
|
scanCallback(cleanCode);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("处理扫码结果时出错:", error);
|
console.error("处理扫码结果时出错:", error);
|
||||||
}
|
}
|
||||||
return undefined;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
unregisterScanBroadcast() {
|
unregisterScanBroadcast() {
|
||||||
@@ -396,13 +327,12 @@ export default {
|
|||||||
|
|
||||||
onHide() {
|
onHide() {
|
||||||
this.isPageActive = false;
|
this.isPageActive = false;
|
||||||
// 不在 onHide 里关 Ba-Scanner:打开原生扫码页也会触发 hide,误关会打断连续扫
|
this.closePhoneScanPanel();
|
||||||
// 无插件回退模式靠 isPageActive 控制是否自动再开相机
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onUnload() {
|
onUnload() {
|
||||||
this.isPageActive = false;
|
this.isPageActive = false;
|
||||||
this.stopPhoneScanContinuous();
|
this.closePhoneScanPanel();
|
||||||
this.unregisterScanBroadcast();
|
this.unregisterScanBroadcast();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
@import '@/common/pda-typography.scss';
|
||||||
|
|
||||||
|
.statusTag {
|
||||||
|
flex-shrink: 0;
|
||||||
|
font-size: $pda-font-body;
|
||||||
|
line-height: 1.25;
|
||||||
|
padding: 10rpx 22rpx;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.status-0 { background: #d9d9d9; color: #434343; }
|
||||||
|
.status-1 { background: #fa8c16; color: #fff; }
|
||||||
|
.status-2 { background: #52c41a; color: #fff; }
|
||||||
|
.status-3 { background: #f5222d; color: #fff; }
|
||||||
|
.status-4 { background: #8c8c8c; color: #fff; }
|
||||||
@@ -18,6 +18,13 @@ export const AUDIT_STATUS = {
|
|||||||
export const DRAFT_AUDIT_STATUS = 0;
|
export const DRAFT_AUDIT_STATUS = 0;
|
||||||
export const DRAFT_AUDIT_STATUS_NAME = '待保存';
|
export const DRAFT_AUDIT_STATUS_NAME = '待保存';
|
||||||
|
|
||||||
|
/** 将接口状态统一为数字,避免字符串导致按钮判断失效 */
|
||||||
|
export function toAuditStatus(status) {
|
||||||
|
const n = Number(status);
|
||||||
|
return Number.isFinite(n) ? n : DRAFT_AUDIT_STATUS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
export const AUDIT_STATUS_MAP = {
|
export const AUDIT_STATUS_MAP = {
|
||||||
1: '待审核',
|
1: '待审核',
|
||||||
2: '已审核',
|
2: '已审核',
|
||||||
@@ -46,12 +53,13 @@ export const FABRIC_INFO_FIELDS = [
|
|||||||
|
|
||||||
/** 细码表格列(不含操作列) */
|
/** 细码表格列(不含操作列) */
|
||||||
export const FINE_CODE_TABLE_COLUMNS = [
|
export const FINE_CODE_TABLE_COLUMNS = [
|
||||||
{ label: '序号', key: 'seq', width: 90 },
|
{ label: '序号', key: 'seq', width: 80 },
|
||||||
{ label: '卷号', key: 'roll_no', width: 110 },
|
{ label: '卷号', key: 'roll_no', width: 110 },
|
||||||
|
{ label: '外部卷号', key: 'extern_volume_number', width: 140 },
|
||||||
{ label: '匹数', key: 'roll', width: 100 },
|
{ label: '匹数', key: 'roll', width: 100 },
|
||||||
{ label: '数量(重量)', key: 'weight', width: 160 },
|
{ label: '数量(重量)', key: 'weight', width: 140 },
|
||||||
{ label: '条码', key: 'bar_code', width: 280 },
|
{ label: '条码', key: 'bar_code', width: 280 },
|
||||||
{ label: '仓位', key: 'position', width: 140 },
|
{ label: '仓位', key: 'position', width: 130 },
|
||||||
];
|
];
|
||||||
|
|
||||||
/** 审核状态变更操作配置(apiKey 对应 gfmOtherDeliveryOrder 下的方法名) */
|
/** 审核状态变更操作配置(apiKey 对应 gfmOtherDeliveryOrder 下的方法名) */
|
||||||
@@ -61,19 +69,6 @@ export const STATUS_ACTION_CONFIG = {
|
|||||||
unapprove: { status: AUDIT_STATUS.PENDING, msg: '确认消审该单据?', apiKey: 'statusWait' },
|
unapprove: { status: AUDIT_STATUS.PENDING, msg: '确认消审该单据?', apiKey: 'statusWait' },
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 审核 / 消审 / 作废成功后播放的语音文案 */
|
|
||||||
export const STATUS_ACTION_VOICE = {
|
|
||||||
approve: '审核成功',
|
|
||||||
unapprove: '消审成功',
|
|
||||||
void: '作废成功',
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 将接口状态统一为数字,避免字符串导致按钮判断失效 */
|
|
||||||
export function toAuditStatus(status) {
|
|
||||||
const n = Number(status);
|
|
||||||
return Number.isFinite(n) ? n : DRAFT_AUDIT_STATUS;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 出仓类型:当前后端仅提供「坯布其他出货单」一种类型的接口
|
// 出仓类型:当前后端仅提供「坯布其他出货单」一种类型的接口
|
||||||
export const BILL_TYPES = [
|
export const BILL_TYPES = [
|
||||||
{ value: 'other', label: '坯布其他出货单' },
|
{ value: 'other', label: '坯布其他出货单' },
|
||||||
@@ -82,8 +77,8 @@ export const BILL_TYPES = [
|
|||||||
/** 列表分页拉取每页条数 */
|
/** 列表分页拉取每页条数 */
|
||||||
export const LIST_PAGE_SIZE = 100;
|
export const LIST_PAGE_SIZE = 100;
|
||||||
|
|
||||||
/** 往来单位类型:染厂(接收单位下拉筛选) */
|
/** 往来单位类型:染厂(染厂下拉筛选) */
|
||||||
export const BUSINESS_UNIT_TYPE_DYEING_FACTORY = 12;
|
export const BUSINESS_UNIT_TYPE_DYE_FACTORY = 12;
|
||||||
|
|
||||||
export function getStatusOptions() {
|
export function getStatusOptions() {
|
||||||
return Object.keys(AUDIT_STATUS_MAP).map((value) => ({
|
return Object.keys(AUDIT_STATUS_MAP).map((value) => ({
|
||||||
@@ -92,14 +87,7 @@ export function getStatusOptions() {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 将下拉/列表接口响应转为 u-select 所需的 { value, label } */
|
export { mapToSelectOptions } from '@/common/remoteSelect';
|
||||||
export function mapToSelectOptions(data) {
|
|
||||||
const list = Array.isArray(data) ? data : (data && (data.list || data.items || data.records)) || [];
|
|
||||||
return list.map((item) => ({
|
|
||||||
value: item.id,
|
|
||||||
label: item.name || item.label || item.code || String(item.id),
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
// 匹数:后端以 0.01 匹存储(乘以100的整数),展示需除以100
|
// 匹数:后端以 0.01 匹存储(乘以100的整数),展示需除以100
|
||||||
export function formatRoll(value) {
|
export function formatRoll(value) {
|
||||||
@@ -132,14 +120,12 @@ export function getFineCodeDisplayWeight(fineCode) {
|
|||||||
*/
|
*/
|
||||||
export function normalizeOrder(order) {
|
export function normalizeOrder(order) {
|
||||||
if (!order) return null;
|
if (!order) return null;
|
||||||
const normalizedItems = (order.item_data || []).map((item) => normalizeItem(item));
|
const itemData = groupItemData((order.item_data || []).map((item) => normalizeItem(item)));
|
||||||
const itemData = groupItemData(normalizedItems);
|
|
||||||
const auditStatus = toAuditStatus(order.audit_status);
|
|
||||||
return {
|
return {
|
||||||
id: order.id,
|
id: order.id,
|
||||||
order_no: order.order_no || '',
|
order_no: order.order_no || '',
|
||||||
audit_status: auditStatus,
|
audit_status: toAuditStatus(order.audit_status),
|
||||||
audit_status_name: order.audit_status_name || AUDIT_STATUS_MAP[auditStatus] || '',
|
audit_status_name: order.audit_status_name || AUDIT_STATUS_MAP[toAuditStatus(order.audit_status)] || '',
|
||||||
// 表头
|
// 表头
|
||||||
sale_system_id: order.sale_system_id || '',
|
sale_system_id: order.sale_system_id || '',
|
||||||
sale_system_name: order.sale_system_name || '',
|
sale_system_name: order.sale_system_name || '',
|
||||||
@@ -158,59 +144,26 @@ export function normalizeOrder(order) {
|
|||||||
total_roll: formatRoll(order.total_roll),
|
total_roll: formatRoll(order.total_roll),
|
||||||
total_weight: formatWeightKg(order.total_weight),
|
total_weight: formatWeightKg(order.total_weight),
|
||||||
item_data: itemData,
|
item_data: itemData,
|
||||||
summary_rows: buildSummaryRows(normalizedItems),
|
|
||||||
_raw: order,
|
_raw: order,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 扫码区下方汇总表列(与出仓明细表一致,可横向滑动) */
|
/** 扫码详情区表格列 */
|
||||||
export const SUMMARY_TABLE_COLUMNS = [
|
export const SCAN_DETAIL_TABLE_COLUMNS = [
|
||||||
{ label: '坯布编号', key: 'grey_fabric_code', width: 200 },
|
{ label: '坯布编号', key: 'grey_fabric_code', width: 160 },
|
||||||
{ label: '坯布名称', key: 'grey_fabric_name', width: 240 },
|
{ label: '坯布名称', key: 'grey_fabric_name', width: 160 },
|
||||||
{ label: '纱批', key: 'yarn_batch', width: 180 },
|
{ label: '纱批', key: 'yarn_batch', width: 130 },
|
||||||
{ label: '机台号', key: 'machine_number', width: 160 },
|
{ label: '机号', key: 'machine_number', width: 110 },
|
||||||
{ label: '条数', key: 'roll', width: 140 },
|
{ label: '条数', key: 'roll', width: 90 },
|
||||||
{ label: '重量', key: 'weight', width: 160 },
|
{ label: '重量', key: 'weight', width: 110 },
|
||||||
];
|
];
|
||||||
|
|
||||||
/** 汇总行归类:坯布编号 + 名称 + 纱批 + 机台号 */
|
/** 扫码详情区可勾选锁定维度(对应 PDAScanGfmOtherDeliveryOrderParam 的 *_lock;勾选后参与表格分组并随扫码请求传给后端) */
|
||||||
export function getSummaryGroupKey(item) {
|
|
||||||
return [
|
|
||||||
item.grey_fabric_code || '',
|
|
||||||
item.grey_fabric_name || '',
|
|
||||||
item.yarn_batch || '',
|
|
||||||
item.machine_number || '',
|
|
||||||
].join('|');
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 按坯布、纱批、机台号汇总条数和重量,供扫码区表格展示 */
|
|
||||||
export function buildSummaryRows(items) {
|
|
||||||
const grouped = new Map();
|
|
||||||
(items || []).forEach((item) => {
|
|
||||||
const groupKey = getSummaryGroupKey(item);
|
|
||||||
const existing = grouped.get(groupKey);
|
|
||||||
if (!existing) {
|
|
||||||
grouped.set(groupKey, {
|
|
||||||
...item,
|
|
||||||
group_key: groupKey,
|
|
||||||
fine_codes: [...(item.fine_codes || [])],
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
existing.fine_codes.push(...(item.fine_codes || []));
|
|
||||||
existing.roll = Number((Number(existing.roll || 0) + Number(item.roll || 0)).toFixed(2));
|
|
||||||
existing.weight = Number((Number(existing.weight || 0) + Number(item.weight || 0)).toFixed(2));
|
|
||||||
});
|
|
||||||
return Array.from(grouped.values());
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 扫码详情区汇总维度(勾选后随扫码请求把对应 lock 字段传给后端) */
|
|
||||||
export const SCAN_GROUP_OPTIONS = [
|
export const SCAN_GROUP_OPTIONS = [
|
||||||
{ key: 'produce_order_no', label: '合同' },
|
{ key: 'produce_order_no', label: '合同' },
|
||||||
{ key: 'grey_fabric_code', label: '布编' },
|
{ key: 'grey_fabric_code', label: '布编' },
|
||||||
{ key: 'yarn_batch', label: '纱批' },
|
{ key: 'yarn_batch', label: '纱批' },
|
||||||
{ key: 'machine_number', label: '机号' },
|
{ key: 'machine_number', label: '机号' },
|
||||||
{ key: 'volume_number', label: '布号' },
|
|
||||||
{ key: 'grey_fabric_level_name', label: '等级' },
|
{ key: 'grey_fabric_level_name', label: '等级' },
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -223,6 +176,32 @@ export const SCAN_MERGE_FIELD_MAP = {
|
|||||||
grey_fabric_level_name: 'grey_fabric_level_id_lock',
|
grey_fabric_level_name: 'grey_fabric_level_id_lock',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** 扫码锁定维度不匹配时的语音文案(按匹配优先级排列) */
|
||||||
|
const SCAN_MISMATCH_VOICE_RULES = [
|
||||||
|
{ patterns: ['机台', '机号', 'machine_number'], voice: '机台不同' },
|
||||||
|
{ patterns: ['纱批', 'yarn_batch'], voice: '纱批不同' },
|
||||||
|
{ patterns: ['合同号', '合同', '生产通知单', 'produce_order'], voice: '合同号不同' },
|
||||||
|
{ patterns: ['布编', 'grey_fabric_code'], voice: '布编不同' },
|
||||||
|
{ patterns: ['等级', 'grey_fabric_level', 'level'], voice: '等级不同' },
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据后端错误信息解析锁定维度不匹配的播报文案
|
||||||
|
* @param {string} message
|
||||||
|
* @returns {string} 如「机台不同」;无法识别则返回空串
|
||||||
|
*/
|
||||||
|
export function resolveScanMismatchVoice(message) {
|
||||||
|
const msg = String(message || '');
|
||||||
|
if (!msg) return '';
|
||||||
|
for (let i = 0; i < SCAN_MISMATCH_VOICE_RULES.length; i++) {
|
||||||
|
const rule = SCAN_MISMATCH_VOICE_RULES[i];
|
||||||
|
if (rule.patterns.some((p) => msg.indexOf(p) !== -1)) {
|
||||||
|
return rule.voice;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
/** 构建扫码新增/删除请求参数(勾选锁定维度时附带当前详情区字段值) */
|
/** 构建扫码新增/删除请求参数(勾选锁定维度时附带当前详情区字段值) */
|
||||||
export function buildScanUpdateParams({ id, scanCode, scanType, groupKeys = [], detail = {} }) {
|
export function buildScanUpdateParams({ id, scanCode, scanType, groupKeys = [], detail = {} }) {
|
||||||
const params = {
|
const params = {
|
||||||
@@ -254,6 +233,7 @@ export function getEmptyScanDetail() {
|
|||||||
yarn_batch: '',
|
yarn_batch: '',
|
||||||
machine_number: '',
|
machine_number: '',
|
||||||
volume_number: '',
|
volume_number: '',
|
||||||
|
extern_volume_number: '',
|
||||||
grey_fabric_level_id: [],
|
grey_fabric_level_id: [],
|
||||||
grey_fabric_level_name: '',
|
grey_fabric_level_name: '',
|
||||||
weight: 0,
|
weight: 0,
|
||||||
@@ -287,6 +267,9 @@ export function buildScanDetailFromOrderResponse(order) {
|
|||||||
yarn_batch: raw.yarn_batch || '',
|
yarn_batch: raw.yarn_batch || '',
|
||||||
machine_number: raw.machine_number || '',
|
machine_number: raw.machine_number || '',
|
||||||
volume_number: raw.volume_number || '',
|
volume_number: raw.volume_number || '',
|
||||||
|
extern_volume_number: raw.extern_volume_number != null && raw.extern_volume_number !== ''
|
||||||
|
? String(raw.extern_volume_number)
|
||||||
|
: '',
|
||||||
grey_fabric_level_id: raw.grey_fabric_level_id || [],
|
grey_fabric_level_id: raw.grey_fabric_level_id || [],
|
||||||
grey_fabric_level_name: raw.grey_fabric_level_name || '',
|
grey_fabric_level_name: raw.grey_fabric_level_name || '',
|
||||||
weight: 0,
|
weight: 0,
|
||||||
@@ -338,6 +321,7 @@ export function buildScanDetailFromContext(context, order) {
|
|||||||
yarn_batch: item.yarn_batch || '',
|
yarn_batch: item.yarn_batch || '',
|
||||||
machine_number: item.machine_number || '',
|
machine_number: item.machine_number || '',
|
||||||
volume_number: fineCode.fabric_piece_code || fineCode.roll_no || fineCode.bar_code || '',
|
volume_number: fineCode.fabric_piece_code || fineCode.roll_no || fineCode.bar_code || '',
|
||||||
|
extern_volume_number: fineCode.extern_volume_number || '',
|
||||||
grey_fabric_level_name: item.grey_fabric_level_name || '',
|
grey_fabric_level_name: item.grey_fabric_level_name || '',
|
||||||
weight: getFineCodeDisplayWeight(fineCode),
|
weight: getFineCodeDisplayWeight(fineCode),
|
||||||
scanned_roll: Number(scannedRoll.toFixed(2)),
|
scanned_roll: Number(scannedRoll.toFixed(2)),
|
||||||
@@ -347,6 +331,56 @@ export function buildScanDetailFromContext(context, order) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function aggregateScanTableRows(rows, keys) {
|
||||||
|
const map = new Map();
|
||||||
|
rows.forEach((row) => {
|
||||||
|
const groupId = keys.map((k) => row[k] || '').join('|');
|
||||||
|
const existing = map.get(groupId);
|
||||||
|
if (!existing) {
|
||||||
|
map.set(groupId, { ...row, roll: 0, raw_weight: 0 });
|
||||||
|
}
|
||||||
|
const agg = map.get(groupId);
|
||||||
|
agg.roll = Number((agg.roll + Number(row.roll || 0)).toFixed(2));
|
||||||
|
agg.raw_weight = Number(agg.raw_weight || 0) + Number(row.raw_weight || 0);
|
||||||
|
});
|
||||||
|
return Array.from(map.values()).map((row) => ({
|
||||||
|
...row,
|
||||||
|
weight: formatWeightKg(row.raw_weight),
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 构建扫码详情区汇总表格数据 */
|
||||||
|
export function buildScanDetailTableRows(itemData, groupKeys = []) {
|
||||||
|
const rows = [];
|
||||||
|
(itemData || []).forEach((item) => {
|
||||||
|
(item.fine_codes || []).forEach((fc) => {
|
||||||
|
rows.push({
|
||||||
|
customer_name: item.customer_name || '',
|
||||||
|
produce_order_no: item.produce_order_no || item.contract_no || '',
|
||||||
|
grey_fabric_code: item.grey_fabric_code || '',
|
||||||
|
grey_fabric_name: item.grey_fabric_name || '',
|
||||||
|
yarn_batch: item.yarn_batch || '',
|
||||||
|
machine_number: item.machine_number || '',
|
||||||
|
volume_number: fc.roll_no || fc.fabric_piece_code || '',
|
||||||
|
grey_fabric_level_name: item.grey_fabric_level_name || '',
|
||||||
|
roll: fc.roll || 0,
|
||||||
|
raw_weight: fc.raw_weight != null ? fc.raw_weight : 0,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
if (!rows.length) return [];
|
||||||
|
const keys = (groupKeys || []).filter(Boolean);
|
||||||
|
if (!keys.length) {
|
||||||
|
return aggregateScanTableRows(rows, ['grey_fabric_code', 'grey_fabric_name', 'yarn_batch', 'machine_number']);
|
||||||
|
}
|
||||||
|
return aggregateScanTableRows(rows, keys);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getScanDetailTableWidth(columns) {
|
||||||
|
const total = (columns || []).reduce((sum, col) => sum + (col.width || 120), 0);
|
||||||
|
return `${total}rpx`;
|
||||||
|
}
|
||||||
|
|
||||||
export function normalizeItem(item) {
|
export function normalizeItem(item) {
|
||||||
const machineStockRaw = item.machine_stock_roll ?? item.machine_stock ?? item.machine_inventory_roll;
|
const machineStockRaw = item.machine_stock_roll ?? item.machine_stock ?? item.machine_inventory_roll;
|
||||||
return {
|
return {
|
||||||
@@ -374,6 +408,9 @@ export function normalizeItem(item) {
|
|||||||
fine_codes: (item.item_fc_data || []).map((fc) => ({
|
fine_codes: (item.item_fc_data || []).map((fc) => ({
|
||||||
id: fc.id,
|
id: fc.id,
|
||||||
roll_no: fc.volume_number || '',
|
roll_no: fc.volume_number || '',
|
||||||
|
extern_volume_number: fc.extern_volume_number != null && fc.extern_volume_number !== ''
|
||||||
|
? String(fc.extern_volume_number)
|
||||||
|
: '',
|
||||||
fabric_piece_code: fc.fabric_piece_code || '',
|
fabric_piece_code: fc.fabric_piece_code || '',
|
||||||
bar_code: fc.fabric_piece_code || fc.bar_code || '',
|
bar_code: fc.fabric_piece_code || fc.bar_code || '',
|
||||||
position: fc.position || '',
|
position: fc.position || '',
|
||||||
@@ -461,7 +498,7 @@ export function fetchAllOrderList(listFn, params = {}, pageSize = LIST_PAGE_SIZE
|
|||||||
return loadPage(1, []);
|
return loadPage(1, []);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 新增/编辑页底部:审核、作废 / 已审核时消审 */
|
/** 新增/编辑页底部:审核、作废 */
|
||||||
export function getFormStatusActionButtons(headerSaved, orderId, status) {
|
export function getFormStatusActionButtons(headerSaved, orderId, status) {
|
||||||
if (!headerSaved || !orderId) return [];
|
if (!headerSaved || !orderId) return [];
|
||||||
const s = toAuditStatus(status);
|
const s = toAuditStatus(status);
|
||||||
@@ -500,14 +537,12 @@ export function orderToFormFields(order) {
|
|||||||
delivery_time: order.delivery_time,
|
delivery_time: order.delivery_time,
|
||||||
remark: order.remark,
|
remark: order.remark,
|
||||||
item_data: order.item_data,
|
item_data: order.item_data,
|
||||||
summary_rows: order.summary_rows || [],
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getFineCodeTableColumns(readonly) {
|
export function getFineCodeTableColumns(readonly) {
|
||||||
const cols = [...FINE_CODE_TABLE_COLUMNS];
|
const cols = [...FINE_CODE_TABLE_COLUMNS];
|
||||||
// 操作列放前面,避免 PDA 小屏横向滚动后才看到删除
|
if (!readonly) cols.push({ label: '操作', key: 'action', width: 100 });
|
||||||
if (!readonly) cols.splice(1, 0, { label: '操作', key: 'action', width: 160 });
|
|
||||||
return cols;
|
return cols;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -515,6 +550,7 @@ export function mapFineCodeTableRows(list, readonly) {
|
|||||||
return (list || []).map((item, index) => ({
|
return (list || []).map((item, index) => ({
|
||||||
seq: index + 1,
|
seq: index + 1,
|
||||||
roll_no: item.roll_no || '-',
|
roll_no: item.roll_no || '-',
|
||||||
|
extern_volume_number: item.extern_volume_number || '-',
|
||||||
roll: item.roll != null && item.roll !== '' ? item.roll : '-',
|
roll: item.roll != null && item.roll !== '' ? item.roll : '-',
|
||||||
weight: item.weight != null && item.weight !== '' ? `${item.weight}` : '-',
|
weight: item.weight != null && item.weight !== '' ? `${item.weight}` : '-',
|
||||||
bar_code: item.bar_code || '-',
|
bar_code: item.bar_code || '-',
|
||||||
@@ -533,7 +569,7 @@ export function getFineCodeTableWidth(columns) {
|
|||||||
* @param {Vue} vm 页面实例,需有 $u.api 与 showError
|
* @param {Vue} vm 页面实例,需有 $u.api 与 showError
|
||||||
* @param {{ orderId: number, action: string, onSuccess?: Function }} options
|
* @param {{ orderId: number, action: string, onSuccess?: Function }} options
|
||||||
*/
|
*/
|
||||||
export function confirmOrderStatusAction(vm, { orderId, action, onSuccess, onCancel }) {
|
export function confirmOrderStatusAction(vm, { orderId, action, onSuccess }) {
|
||||||
const cfg = STATUS_ACTION_CONFIG[action];
|
const cfg = STATUS_ACTION_CONFIG[action];
|
||||||
if (!cfg || !orderId) return;
|
if (!cfg || !orderId) return;
|
||||||
const api = vm.$u.api.gfmOtherDeliveryOrder;
|
const api = vm.$u.api.gfmOtherDeliveryOrder;
|
||||||
@@ -543,10 +579,7 @@ export function confirmOrderStatusAction(vm, { orderId, action, onSuccess, onCan
|
|||||||
title: '提示',
|
title: '提示',
|
||||||
content: cfg.msg,
|
content: cfg.msg,
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
if (!res.confirm) {
|
if (!res.confirm) return;
|
||||||
if (typeof onCancel === 'function') onCancel();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
uni.showLoading({ title: '处理中...' });
|
uni.showLoading({ title: '处理中...' });
|
||||||
requestFn(buildStatusParam(orderId, cfg.status))
|
requestFn(buildStatusParam(orderId, cfg.status))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
|||||||
@@ -53,16 +53,17 @@ export const STOCK_TABLE_COLUMNS = [
|
|||||||
|
|
||||||
/** 细码明细表格列 */
|
/** 细码明细表格列 */
|
||||||
export const WAREHOUSE_DETAIL_COLUMNS = [
|
export const WAREHOUSE_DETAIL_COLUMNS = [
|
||||||
{ label: '序号', key: 'seq', width: 70 },
|
{ label: '序号', key: 'seq', width: 80 },
|
||||||
{ label: '卷号', key: 'volume_number', width: 90 },
|
{ label: '卷号', key: 'volume_number', width: 110 },
|
||||||
{ label: '匹数', key: 'roll', width: 90 },
|
{ label: '外部卷号', key: 'extern_volume_number', width: 140 },
|
||||||
{ label: '数量(KG)', key: 'weight', width: 110 },
|
{ label: '匹数', key: 'roll', width: 100 },
|
||||||
{ label: '条码', key: 'bar_code', width: 240 },
|
{ label: '数量(KG)', key: 'weight', width: 130 },
|
||||||
{ label: '仓位', key: 'position', width: 100 },
|
{ label: '条码', key: 'bar_code', width: 280 },
|
||||||
{ label: '颜色', key: 'gray_fabric_color_name', width: 100 },
|
{ label: '仓位', key: 'position', width: 120 },
|
||||||
{ label: '织厂', key: 'supplier_name', width: 120 },
|
{ label: '颜色', key: 'gray_fabric_color_name', width: 120 },
|
||||||
{ label: '机台', key: 'machine_number', width: 90 },
|
{ label: '织厂', key: 'supplier_name', width: 140 },
|
||||||
{ label: '库龄(天)', key: 'days_of_age', width: 90 },
|
{ label: '机台', key: 'machine_number', width: 100 },
|
||||||
|
{ label: '库龄(天)', key: 'days_of_age', width: 110 },
|
||||||
];
|
];
|
||||||
|
|
||||||
export function formatStockWeightWithUnit(weight, unitName) {
|
export function formatStockWeightWithUnit(weight, unitName) {
|
||||||
@@ -244,6 +245,7 @@ export function mapWarehouseDetailRows(list = []) {
|
|||||||
return (list || []).map((item, index) => ({
|
return (list || []).map((item, index) => ({
|
||||||
seq: index + 1,
|
seq: index + 1,
|
||||||
volume_number: item.volume_number || '-',
|
volume_number: item.volume_number || '-',
|
||||||
|
extern_volume_number: item.extern_volume_number || '-',
|
||||||
roll: item.num != null && item.num !== '' ? formatRoll(item.num) : '-',
|
roll: item.num != null && item.num !== '' ? formatRoll(item.num) : '-',
|
||||||
weight: item.weight != null && item.weight !== '' ? formatWeightKg(item.weight) : '-',
|
weight: item.weight != null && item.weight !== '' ? formatWeightKg(item.weight) : '-',
|
||||||
bar_code: item.bar_code || item.fabric_piece_code || '-',
|
bar_code: item.bar_code || item.fabric_piece_code || '-',
|
||||||
|
|||||||
@@ -0,0 +1,472 @@
|
|||||||
|
/**
|
||||||
|
* 加工进仓单常量与数据工具
|
||||||
|
*
|
||||||
|
* 真实接口请求统一注册在 src/common/http.api.js 的 vm.$u.api.fpmProcessInOrder 下。
|
||||||
|
*/
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
|
export const AUDIT_STATUS = {
|
||||||
|
PENDING: 1,
|
||||||
|
APPROVED: 2,
|
||||||
|
REJECTED: 3,
|
||||||
|
VOIDED: 4,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const DRAFT_AUDIT_STATUS = 0;
|
||||||
|
export const DRAFT_AUDIT_STATUS_NAME = '待保存';
|
||||||
|
|
||||||
|
/** 将接口状态统一为数字,避免字符串导致按钮判断失效 */
|
||||||
|
export function toAuditStatus(status) {
|
||||||
|
const n = Number(status);
|
||||||
|
return Number.isFinite(n) ? n : DRAFT_AUDIT_STATUS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const AUDIT_STATUS_MAP = {
|
||||||
|
1: '待审核',
|
||||||
|
2: '已审核',
|
||||||
|
3: '已驳回',
|
||||||
|
4: '已作废',
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 操作类型:1录入 3删除 */
|
||||||
|
export const ARRANGE_TYPE = {
|
||||||
|
IN: 1,
|
||||||
|
DEL: 3,
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 入仓类型:加工进仓单 */
|
||||||
|
export const IN_ORDER_TYPE_PROCESS = 5;
|
||||||
|
|
||||||
|
/** 入仓类型:返修进仓 */
|
||||||
|
export const IN_ORDER_TYPE_REPAIR = 6;
|
||||||
|
|
||||||
|
export const IN_ORDER_TYPE_MAP = {
|
||||||
|
[IN_ORDER_TYPE_PROCESS]: '加工进仓单',
|
||||||
|
[IN_ORDER_TYPE_REPAIR]: '返修进仓',
|
||||||
|
};
|
||||||
|
|
||||||
|
export const IN_ORDER_TYPE_OPTIONS = [
|
||||||
|
{ value: IN_ORDER_TYPE_PROCESS, label: IN_ORDER_TYPE_MAP[IN_ORDER_TYPE_PROCESS] },
|
||||||
|
{ value: IN_ORDER_TYPE_REPAIR, label: IN_ORDER_TYPE_MAP[IN_ORDER_TYPE_REPAIR] },
|
||||||
|
];
|
||||||
|
|
||||||
|
/** 默认纸筒重量(公斤,表单展示值) */
|
||||||
|
export const DEFAULT_PAPER_TUBE_WEIGHT = 0.3;
|
||||||
|
|
||||||
|
/** 默认包装重量(公斤,表单展示值) */
|
||||||
|
export const DEFAULT_PACKAGE_WEIGHT = 0.15;
|
||||||
|
|
||||||
|
/** 往来单位类型:加工单位 */
|
||||||
|
export const BUSINESS_UNIT_TYPE_PROCESS = 12;
|
||||||
|
|
||||||
|
/** 成品物理仓类型 */
|
||||||
|
export const WAREHOUSE_TYPE_FINISHED = 103;
|
||||||
|
|
||||||
|
/** 默认仓库名称 */
|
||||||
|
export const DEFAULT_WAREHOUSE_NAME = '成品仓';
|
||||||
|
|
||||||
|
export const LIST_PAGE_SIZE = 100;
|
||||||
|
|
||||||
|
export const STATUS_ACTION_CONFIG = {
|
||||||
|
approve: { status: AUDIT_STATUS.APPROVED, msg: '确认审核该单据?', apiKey: 'statusPass' },
|
||||||
|
void: { status: AUDIT_STATUS.VOIDED, msg: '确认作废该单据?', apiKey: 'statusCancel' },
|
||||||
|
unapprove: { status: AUDIT_STATUS.PENDING, msg: '确认消审该单据?', apiKey: 'statusWait' },
|
||||||
|
};
|
||||||
|
|
||||||
|
export function getStatusOptions() {
|
||||||
|
return Object.keys(AUDIT_STATUS_MAP).map((value) => ({
|
||||||
|
value,
|
||||||
|
label: AUDIT_STATUS_MAP[value],
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
export { mapToSelectOptions } from '@/common/remoteSelect';
|
||||||
|
|
||||||
|
/** 匹数:后端 ×100 存储 */
|
||||||
|
export function formatRoll(value) {
|
||||||
|
const n = Number(value || 0) / 100;
|
||||||
|
return Number.isInteger(n) ? n : Number(n.toFixed(2));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 数量(公斤):后端 ×10000 存储 */
|
||||||
|
export function formatWeightKg(value) {
|
||||||
|
const n = Number(value || 0) / 10000;
|
||||||
|
return Number(n.toFixed(2));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 公斤展示值转后端存储(×10000) */
|
||||||
|
export function toWeightStorage(value) {
|
||||||
|
return Math.round(Number(value || 0) * 10000);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function normalizeOrder(order) {
|
||||||
|
if (!order) return null;
|
||||||
|
return {
|
||||||
|
id: order.id,
|
||||||
|
order_no: order.order_no || '',
|
||||||
|
audit_status: toAuditStatus(order.audit_status),
|
||||||
|
audit_status_name: order.audit_status_name || AUDIT_STATUS_MAP[toAuditStatus(order.audit_status)] || '',
|
||||||
|
process_unit_id: order.process_unit_id || '',
|
||||||
|
process_name: order.process_name || '',
|
||||||
|
warehouse_id: order.warehouse_id || '',
|
||||||
|
warehouse_name: order.warehouse_name || '',
|
||||||
|
sale_system_id: order.sale_system_id || '',
|
||||||
|
sale_system_name: order.sale_system_name || '',
|
||||||
|
in_order_type: order.in_order_type || IN_ORDER_TYPE_PROCESS,
|
||||||
|
in_order_type_name: order.in_order_type_name
|
||||||
|
|| IN_ORDER_TYPE_MAP[order.in_order_type]
|
||||||
|
|| IN_ORDER_TYPE_MAP[IN_ORDER_TYPE_PROCESS],
|
||||||
|
paper_tube_weight: formatWeightKg(order.paper_tube_weight),
|
||||||
|
package_weight: formatWeightKg(order.package_weight),
|
||||||
|
remark: order.remark || '',
|
||||||
|
warehouse_in_time: (order.warehouse_in_time || '').slice(0, 10),
|
||||||
|
creator_name: order.creator_name || '',
|
||||||
|
create_time: order.create_time || '',
|
||||||
|
auditor_name: order.auditor_name || '',
|
||||||
|
audit_time: order.audit_time || '',
|
||||||
|
total_roll: formatRoll(order.total_roll),
|
||||||
|
total_weight: formatWeightKg(order.total_weight),
|
||||||
|
total_length: formatRoll(order.total_length),
|
||||||
|
item_data: (order.item_data || []).map(normalizeItem),
|
||||||
|
_raw: order,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function normalizeFineCode(fc) {
|
||||||
|
if (!fc) return null;
|
||||||
|
const weightRaw = fc.base_unit_weight != null
|
||||||
|
? fc.base_unit_weight
|
||||||
|
: (fc.settle_weight != null ? fc.settle_weight : fc.weight);
|
||||||
|
const qrCode = fc.qr_code || fc.long_code || '';
|
||||||
|
const barCode = fc.bar_code || fc.digital_code || fc.short_code || '';
|
||||||
|
return {
|
||||||
|
id: fc.id,
|
||||||
|
volume_number: fc.volume_number != null && fc.volume_number !== '' ? String(fc.volume_number) : '',
|
||||||
|
extern_volume_number: fc.extern_volume_number != null && fc.extern_volume_number !== ''
|
||||||
|
? String(fc.extern_volume_number)
|
||||||
|
: '',
|
||||||
|
roll: formatRoll(fc.roll),
|
||||||
|
weight: formatWeightKg(weightRaw),
|
||||||
|
bar_code: barCode,
|
||||||
|
qr_code: qrCode,
|
||||||
|
digital_code: fc.digital_code || '',
|
||||||
|
long_code: fc.long_code || '',
|
||||||
|
short_code: fc.short_code || '',
|
||||||
|
dye_factory_dyelot_number: fc.dye_factory_dyelot_number || fc.dyelot_number || '',
|
||||||
|
warehouse_bin_name: fc.warehouse_bin_name || '',
|
||||||
|
shelf_no: fc.shelf_no || '',
|
||||||
|
scan_code: qrCode || barCode || '',
|
||||||
|
paper_tube_weight: fc.paper_tube_weight != null && fc.paper_tube_weight !== ''
|
||||||
|
? formatWeightKg(fc.paper_tube_weight)
|
||||||
|
: null,
|
||||||
|
package_weight: fc.package_weight != null && fc.package_weight !== ''
|
||||||
|
? formatWeightKg(fc.package_weight)
|
||||||
|
: null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function normalizeItem(item) {
|
||||||
|
return {
|
||||||
|
id: item.id,
|
||||||
|
quote_order_no: item.quote_order_no || '',
|
||||||
|
product_code: item.product_code || '',
|
||||||
|
product_name: item.product_name || '',
|
||||||
|
product_color_code: item.product_color_code || '',
|
||||||
|
product_color_name: item.product_color_name || '',
|
||||||
|
dye_factory_dyelot_number: item.dye_factory_dyelot_number || '',
|
||||||
|
dye_factory_color_code: item.dye_factory_color_code || '',
|
||||||
|
in_roll: formatRoll(item.in_roll),
|
||||||
|
in_weight: formatWeightKg(item.in_weight),
|
||||||
|
item_fc_data: (item.item_fc_data || []).map(normalizeFineCode).filter(Boolean),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 明细分组:成品编号 → 成品色号 → 细码
|
||||||
|
*/
|
||||||
|
export function buildItemGroups(items) {
|
||||||
|
const productMap = new Map();
|
||||||
|
(items || []).forEach((item) => {
|
||||||
|
const productKey = item.product_code || '-';
|
||||||
|
if (!productMap.has(productKey)) {
|
||||||
|
productMap.set(productKey, {
|
||||||
|
group_key: `p:${productKey}`,
|
||||||
|
product_code: item.product_code || '',
|
||||||
|
product_name: item.product_name || '',
|
||||||
|
in_roll: 0,
|
||||||
|
in_weight: 0,
|
||||||
|
colors: new Map(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const productGroup = productMap.get(productKey);
|
||||||
|
if (!productGroup.product_name && item.product_name) {
|
||||||
|
productGroup.product_name = item.product_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
const colorKey = item.product_color_code || item.product_color_name || '-';
|
||||||
|
if (!productGroup.colors.has(colorKey)) {
|
||||||
|
productGroup.colors.set(colorKey, {
|
||||||
|
group_key: `p:${productKey}|c:${colorKey}`,
|
||||||
|
product_color_code: item.product_color_code || '',
|
||||||
|
product_color_name: item.product_color_name || '',
|
||||||
|
quote_order_no: item.quote_order_no || '',
|
||||||
|
dye_factory_dyelot_number: item.dye_factory_dyelot_number || '',
|
||||||
|
in_roll: 0,
|
||||||
|
in_weight: 0,
|
||||||
|
fine_codes: [],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const colorGroup = productGroup.colors.get(colorKey);
|
||||||
|
productGroup.in_roll = Number((productGroup.in_roll + Number(item.in_roll || 0)).toFixed(2));
|
||||||
|
productGroup.in_weight = Number((productGroup.in_weight + Number(item.in_weight || 0)).toFixed(2));
|
||||||
|
colorGroup.in_roll = Number((colorGroup.in_roll + Number(item.in_roll || 0)).toFixed(2));
|
||||||
|
colorGroup.in_weight = Number((colorGroup.in_weight + Number(item.in_weight || 0)).toFixed(2));
|
||||||
|
if (item.quote_order_no) colorGroup.quote_order_no = item.quote_order_no;
|
||||||
|
if (item.dye_factory_dyelot_number) {
|
||||||
|
colorGroup.dye_factory_dyelot_number = item.dye_factory_dyelot_number;
|
||||||
|
}
|
||||||
|
if (!colorGroup.product_color_name && item.product_color_name) {
|
||||||
|
colorGroup.product_color_name = item.product_color_name;
|
||||||
|
}
|
||||||
|
colorGroup.fine_codes.push(...(item.item_fc_data || []));
|
||||||
|
});
|
||||||
|
|
||||||
|
return Array.from(productMap.values()).map((product) => ({
|
||||||
|
group_key: product.group_key,
|
||||||
|
product_code: product.product_code,
|
||||||
|
product_name: product.product_name,
|
||||||
|
in_roll: product.in_roll,
|
||||||
|
in_weight: product.in_weight,
|
||||||
|
colors: Array.from(product.colors.values()),
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getEmptyScanDetail() {
|
||||||
|
return {
|
||||||
|
quote_order_no: '',
|
||||||
|
dyelot_number: '',
|
||||||
|
volume_number: '',
|
||||||
|
extern_volume_number: '',
|
||||||
|
product_code: '',
|
||||||
|
product_color_code: '',
|
||||||
|
order_roll: 0,
|
||||||
|
item_roll: 0,
|
||||||
|
order_weight: 0,
|
||||||
|
item_weight: 0,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 刚扫细码的数量(公斤存储值):优先细码 weight */
|
||||||
|
function pickScannedFineWeight(res) {
|
||||||
|
if (!res) return 0;
|
||||||
|
if (res.weight != null && res.weight !== '') return res.weight;
|
||||||
|
if (res.base_unit_weight != null && res.base_unit_weight !== '') return res.base_unit_weight;
|
||||||
|
if (res.settle_weight != null && res.settle_weight !== '') return res.settle_weight;
|
||||||
|
if (res.actually_weight != null && res.actually_weight !== '') return res.actually_weight;
|
||||||
|
return res.item_weight;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 从扫码接口返回构建详情区(匹数÷100,数量÷10000) */
|
||||||
|
export function buildScanDetailFromScanResponse(res) {
|
||||||
|
if (!res) return getEmptyScanDetail();
|
||||||
|
return {
|
||||||
|
quote_order_no: res.quote_order_no || '',
|
||||||
|
dyelot_number: res.dyelot_number || '',
|
||||||
|
volume_number: res.volume_number != null && res.volume_number !== '' ? String(res.volume_number) : '',
|
||||||
|
extern_volume_number: res.extern_volume_number != null && res.extern_volume_number !== ''
|
||||||
|
? String(res.extern_volume_number)
|
||||||
|
: '',
|
||||||
|
product_code: res.product_code || '',
|
||||||
|
product_color_code: res.product_color_code || '',
|
||||||
|
// 本单匹数/数量:整单合计(扫码后会再以详情 total_* 覆盖)
|
||||||
|
order_roll: formatRoll(res.order_roll != null ? res.order_roll : res.total_roll),
|
||||||
|
item_roll: formatRoll(res.item_roll != null ? res.item_roll : res.roll),
|
||||||
|
order_weight: formatWeightKg(res.order_weight != null ? res.order_weight : res.total_weight),
|
||||||
|
// 本行数量:刚扫这条细码的重量(weight),不是明细行合计
|
||||||
|
item_weight: formatWeightKg(pickScannedFineWeight(res)),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 校验纸筒/包装重量(扫码时提交) */
|
||||||
|
export function validateScanWeights(paperTubeWeight, packageWeight) {
|
||||||
|
if (paperTubeWeight === '' || paperTubeWeight == null) {
|
||||||
|
return '请输入纸筒重量';
|
||||||
|
}
|
||||||
|
if (Number.isNaN(Number(paperTubeWeight))) return '纸筒重量格式不正确';
|
||||||
|
if (packageWeight === '' || packageWeight == null) {
|
||||||
|
return '请输入包装重量';
|
||||||
|
}
|
||||||
|
if (Number.isNaN(Number(packageWeight))) return '包装重量格式不正确';
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 构建扫码请求参数(纸筒/包装重量在扫码时提交,公斤值需 ×10000) */
|
||||||
|
export function buildScanUpdateParams({
|
||||||
|
id,
|
||||||
|
scanCode,
|
||||||
|
arrangeType,
|
||||||
|
warehouseBinId,
|
||||||
|
paperTubeWeight,
|
||||||
|
packageWeight,
|
||||||
|
}) {
|
||||||
|
const code = (scanCode || '').trim();
|
||||||
|
const params = {
|
||||||
|
id: Number(id),
|
||||||
|
arrange_type: arrangeType,
|
||||||
|
paper_tube_weight: toWeightStorage(paperTubeWeight),
|
||||||
|
package_weight: toWeightStorage(packageWeight),
|
||||||
|
};
|
||||||
|
if (warehouseBinId) {
|
||||||
|
params.warehouse_bin_id = Number(warehouseBinId);
|
||||||
|
}
|
||||||
|
// 长度大于25走二维码,否则走条码
|
||||||
|
if (code.length > 25) {
|
||||||
|
params.qr_code = code;
|
||||||
|
} else {
|
||||||
|
params.bar_code = code;
|
||||||
|
}
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function buildStatusParam(id) {
|
||||||
|
return { id: String(id) };
|
||||||
|
}
|
||||||
|
|
||||||
|
export function formatDisplayTime(value, format = 'YYYY-MM-DD') {
|
||||||
|
if (!value) return '';
|
||||||
|
const parsed = dayjs(value);
|
||||||
|
return parsed.isValid() ? parsed.format(format) : String(value).slice(0, 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function canScanAtStatus(status) {
|
||||||
|
const s = toAuditStatus(status);
|
||||||
|
return s === AUDIT_STATUS.PENDING || s === AUDIT_STATUS.REJECTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isLockedOrderStatus(status) {
|
||||||
|
const s = toAuditStatus(status);
|
||||||
|
return s === AUDIT_STATUS.APPROVED || s === AUDIT_STATUS.VOIDED;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function fetchAllOrderList(listFn, params = {}, pageSize = LIST_PAGE_SIZE) {
|
||||||
|
const pickBatch = (res) => {
|
||||||
|
if (Array.isArray(res)) return res;
|
||||||
|
if (!res || typeof res !== 'object') return [];
|
||||||
|
return res.list || res.records || res.items || [];
|
||||||
|
};
|
||||||
|
const loadPage = (page, acc) => listFn({ ...params, page, size: pageSize })
|
||||||
|
.then((res) => {
|
||||||
|
const batch = pickBatch(res);
|
||||||
|
if (!batch.length) return acc;
|
||||||
|
// 一次返回超过 pageSize:后端忽略分页,视为全量,避免死循环翻页
|
||||||
|
if (batch.length > pageSize) return acc.concat(batch);
|
||||||
|
// 翻页后与首页首条相同:后端忽略 page,避免死循环
|
||||||
|
if (
|
||||||
|
page > 1
|
||||||
|
&& acc.length
|
||||||
|
&& batch[0]
|
||||||
|
&& acc[0]
|
||||||
|
&& String(batch[0].id) === String(acc[0].id)
|
||||||
|
) {
|
||||||
|
return acc;
|
||||||
|
}
|
||||||
|
const merged = acc.concat(batch);
|
||||||
|
const total = !Array.isArray(res) && res != null ? Number(res.total) : NaN;
|
||||||
|
if (!Number.isNaN(total) && merged.length >= total) return merged;
|
||||||
|
if (batch.length < pageSize) return merged;
|
||||||
|
return loadPage(page + 1, merged);
|
||||||
|
});
|
||||||
|
return loadPage(1, []);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getFormStatusActionButtons(headerSaved, orderId, status) {
|
||||||
|
if (!headerSaved || !orderId) return [];
|
||||||
|
const s = toAuditStatus(status);
|
||||||
|
if (s === AUDIT_STATUS.APPROVED) {
|
||||||
|
return [{ label: '消审', action: 'unapprove' }];
|
||||||
|
}
|
||||||
|
if (!canScanAtStatus(s)) return [];
|
||||||
|
return [
|
||||||
|
{ label: '审核', action: 'approve' },
|
||||||
|
{ label: '作废', action: 'void' },
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getViewStatusActionButtons(status) {
|
||||||
|
const s = toAuditStatus(status);
|
||||||
|
if (s === AUDIT_STATUS.PENDING || s === AUDIT_STATUS.REJECTED) {
|
||||||
|
return [
|
||||||
|
{ label: '编辑', action: 'edit' },
|
||||||
|
{ label: '审核', action: 'approve' },
|
||||||
|
{ label: '作废', action: 'void' },
|
||||||
|
];
|
||||||
|
}
|
||||||
|
if (s === AUDIT_STATUS.APPROVED) {
|
||||||
|
return [{ label: '消审', action: 'unapprove' }];
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
export function orderToFormFields(order) {
|
||||||
|
return {
|
||||||
|
order_no: order.order_no,
|
||||||
|
process_unit_id: order.process_unit_id,
|
||||||
|
process_name: order.process_name,
|
||||||
|
warehouse_id: order.warehouse_id,
|
||||||
|
warehouse_name: order.warehouse_name,
|
||||||
|
sale_system_id: order.sale_system_id,
|
||||||
|
sale_system_name: order.sale_system_name,
|
||||||
|
in_order_type: order.in_order_type || IN_ORDER_TYPE_PROCESS,
|
||||||
|
in_order_type_name: order.in_order_type_name
|
||||||
|
|| IN_ORDER_TYPE_MAP[order.in_order_type]
|
||||||
|
|| IN_ORDER_TYPE_MAP[IN_ORDER_TYPE_PROCESS],
|
||||||
|
paper_tube_weight: String(DEFAULT_PAPER_TUBE_WEIGHT),
|
||||||
|
package_weight: String(DEFAULT_PACKAGE_WEIGHT),
|
||||||
|
remark: order.remark,
|
||||||
|
item_data: order.item_data,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 从仓库下拉中选出默认成品仓 */
|
||||||
|
export function pickDefaultWarehouse(options, loginWarehouseId, loginWarehouseName) {
|
||||||
|
const list = options || [];
|
||||||
|
const byName = list.find((item) => item.label === DEFAULT_WAREHOUSE_NAME);
|
||||||
|
if (byName) return byName;
|
||||||
|
if (loginWarehouseId) {
|
||||||
|
const byId = list.find((item) => String(item.value) === String(loginWarehouseId));
|
||||||
|
if (byId) return byId;
|
||||||
|
if (loginWarehouseName) {
|
||||||
|
return { value: loginWarehouseId, label: loginWarehouseName };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list[0] || null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 确认并执行审核状态变更
|
||||||
|
*/
|
||||||
|
export function confirmOrderStatusAction(vm, { orderId, action, onSuccess }) {
|
||||||
|
const cfg = STATUS_ACTION_CONFIG[action];
|
||||||
|
if (!cfg || !orderId) return;
|
||||||
|
const api = vm.$u.api.fpmProcessInOrder;
|
||||||
|
const requestFn = api[cfg.apiKey];
|
||||||
|
if (typeof requestFn !== 'function') return;
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: cfg.msg,
|
||||||
|
success: (res) => {
|
||||||
|
if (!res.confirm) return;
|
||||||
|
uni.showLoading({ title: '处理中...' });
|
||||||
|
requestFn(buildStatusParam(orderId))
|
||||||
|
.then(() => {
|
||||||
|
if (typeof onSuccess === 'function') return onSuccess();
|
||||||
|
uni.hideLoading();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
uni.hideLoading();
|
||||||
|
if (vm.showError) vm.showError(e.message || '操作失败');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,408 @@
|
|||||||
|
/**
|
||||||
|
* 加工出仓单常量与数据工具
|
||||||
|
*
|
||||||
|
* 真实接口请求统一注册在 src/common/http.api.js 的 vm.$u.api.fpmProcessOutOrder 下。
|
||||||
|
*/
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
|
export const AUDIT_STATUS = {
|
||||||
|
PENDING: 1,
|
||||||
|
APPROVED: 2,
|
||||||
|
REJECTED: 3,
|
||||||
|
VOIDED: 4,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const DRAFT_AUDIT_STATUS = 0;
|
||||||
|
export const DRAFT_AUDIT_STATUS_NAME = '待保存';
|
||||||
|
|
||||||
|
/** 将接口状态统一为数字,避免字符串导致按钮判断失效 */
|
||||||
|
export function toAuditStatus(status) {
|
||||||
|
const n = Number(status);
|
||||||
|
return Number.isFinite(n) ? n : DRAFT_AUDIT_STATUS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const AUDIT_STATUS_MAP = {
|
||||||
|
1: '待审核',
|
||||||
|
2: '已审核',
|
||||||
|
3: '已驳回',
|
||||||
|
4: '已作废',
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 操作类型:1录入 3删除 */
|
||||||
|
export const ARRANGE_TYPE = {
|
||||||
|
IN: 1,
|
||||||
|
DEL: 3,
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 出仓类型:正常加工出仓 WarehouseGoodOutTypeProcess = 5 */
|
||||||
|
export const OUT_ORDER_TYPE_PROCESS = 5;
|
||||||
|
export const OUT_ORDER_TYPE_PROCESS_NAME = '正常加工出仓';
|
||||||
|
/** 出仓类型:回修加工出仓 WarehouseGoodOutTypeProcessRepair = 8 */
|
||||||
|
export const OUT_ORDER_TYPE_REPAIR = 8;
|
||||||
|
export const OUT_ORDER_TYPE_REPAIR_NAME = '回修加工出仓';
|
||||||
|
|
||||||
|
/** 往来单位类型:加工单位 */
|
||||||
|
export const BUSINESS_UNIT_TYPE_PROCESS = 12;
|
||||||
|
|
||||||
|
/** 成品物理仓类型 */
|
||||||
|
export const WAREHOUSE_TYPE_FINISHED = 103;
|
||||||
|
|
||||||
|
/** 默认仓库名称 */
|
||||||
|
export const DEFAULT_WAREHOUSE_NAME = '成品仓';
|
||||||
|
|
||||||
|
export const LIST_PAGE_SIZE = 100;
|
||||||
|
|
||||||
|
export const STATUS_ACTION_CONFIG = {
|
||||||
|
approve: { status: AUDIT_STATUS.APPROVED, msg: '确认审核该单据?', apiKey: 'statusPass' },
|
||||||
|
void: { status: AUDIT_STATUS.VOIDED, msg: '确认作废该单据?', apiKey: 'statusCancel' },
|
||||||
|
unapprove: { status: AUDIT_STATUS.PENDING, msg: '确认消审该单据?', apiKey: 'statusWait' },
|
||||||
|
};
|
||||||
|
|
||||||
|
export function getStatusOptions() {
|
||||||
|
return Object.keys(AUDIT_STATUS_MAP).map((value) => ({
|
||||||
|
value,
|
||||||
|
label: AUDIT_STATUS_MAP[value],
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
export { mapToSelectOptions } from '@/common/remoteSelect';
|
||||||
|
|
||||||
|
/** 匹数:后端 ×100 存储 */
|
||||||
|
export function formatRoll(value) {
|
||||||
|
const n = Number(value || 0) / 100;
|
||||||
|
return Number.isInteger(n) ? n : Number(n.toFixed(2));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 数量(公斤):后端 ×10000 存储 */
|
||||||
|
export function formatWeightKg(value) {
|
||||||
|
const n = Number(value || 0) / 10000;
|
||||||
|
return Number(n.toFixed(2));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function normalizeOrder(order) {
|
||||||
|
if (!order) return null;
|
||||||
|
return {
|
||||||
|
id: order.id,
|
||||||
|
order_no: order.order_no || '',
|
||||||
|
audit_status: toAuditStatus(order.audit_status),
|
||||||
|
audit_status_name: order.audit_status_name || AUDIT_STATUS_MAP[toAuditStatus(order.audit_status)] || '',
|
||||||
|
process_unit_id: order.process_unit_id || '',
|
||||||
|
process_name: order.process_name || '',
|
||||||
|
warehouse_id: order.warehouse_id || '',
|
||||||
|
warehouse_name: order.warehouse_name || '',
|
||||||
|
sale_system_id: order.sale_system_id || '',
|
||||||
|
sale_system_name: order.sale_system_name || '',
|
||||||
|
out_order_type: order.out_order_type || OUT_ORDER_TYPE_PROCESS,
|
||||||
|
out_order_type_name: order.out_order_type_name || OUT_ORDER_TYPE_PROCESS_NAME,
|
||||||
|
remark: order.remark || '',
|
||||||
|
warehouse_out_time: (order.warehouse_out_time || '').slice(0, 10),
|
||||||
|
creator_name: order.creator_name || '',
|
||||||
|
create_time: order.create_time || '',
|
||||||
|
auditor_name: order.auditor_name || '',
|
||||||
|
audit_time: order.audit_time || '',
|
||||||
|
total_roll: formatRoll(order.total_roll),
|
||||||
|
total_weight: formatWeightKg(order.total_weight),
|
||||||
|
total_length: formatRoll(order.total_length),
|
||||||
|
item_data: (order.item_data || []).map(normalizeItem),
|
||||||
|
_raw: order,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function normalizeFineCode(fc) {
|
||||||
|
if (!fc) return null;
|
||||||
|
// 出仓细码数量:优先基本单位公斤,其次结算数量
|
||||||
|
const weightRaw = fc.base_unit_weight != null
|
||||||
|
? fc.base_unit_weight
|
||||||
|
: (fc.settle_weight != null ? fc.settle_weight : fc.weight);
|
||||||
|
const qrCode = fc.qr_code || '';
|
||||||
|
const digitalCode = fc.digital_code || '';
|
||||||
|
const barCode = fc.bar_code || digitalCode || '';
|
||||||
|
return {
|
||||||
|
id: fc.id,
|
||||||
|
volume_number: fc.volume_number != null && fc.volume_number !== '' ? String(fc.volume_number) : '',
|
||||||
|
extern_volume_number: fc.extern_volume_number != null && fc.extern_volume_number !== ''
|
||||||
|
? String(fc.extern_volume_number)
|
||||||
|
: '',
|
||||||
|
roll: formatRoll(fc.roll),
|
||||||
|
weight: formatWeightKg(weightRaw),
|
||||||
|
bar_code: barCode,
|
||||||
|
qr_code: qrCode,
|
||||||
|
digital_code: digitalCode,
|
||||||
|
dye_factory_dyelot_number: fc.dye_factory_dyelot_number || fc.dyelot_number || '',
|
||||||
|
warehouse_bin_name: fc.warehouse_bin_name || '',
|
||||||
|
shelf_no: fc.shelf_no || '',
|
||||||
|
// 删除扫码优先二维码
|
||||||
|
scan_code: qrCode || barCode || digitalCode || '',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function normalizeItem(item) {
|
||||||
|
// 明细数量字段:OpenAPI 为 total_weight / settle_weight(×10000),匹数为 out_roll(×100)
|
||||||
|
const weightRaw = item.total_weight != null
|
||||||
|
? item.total_weight
|
||||||
|
: (item.settle_weight != null ? item.settle_weight : item.out_weight);
|
||||||
|
return {
|
||||||
|
id: item.id,
|
||||||
|
quote_order_no: item.quote_order_no || '',
|
||||||
|
product_code: item.product_code || '',
|
||||||
|
product_name: item.product_name || '',
|
||||||
|
product_color_code: item.product_color_code || '',
|
||||||
|
product_color_name: item.product_color_name || '',
|
||||||
|
dye_factory_dyelot_number: item.dye_factory_dyelot_number || '',
|
||||||
|
dye_factory_color_code: item.dye_factory_color_code || '',
|
||||||
|
out_roll: formatRoll(item.out_roll),
|
||||||
|
out_weight: formatWeightKg(weightRaw),
|
||||||
|
item_fc_data: (item.item_fc_data || []).map(normalizeFineCode).filter(Boolean),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 明细分组:成品编号 → 成品色号 → 细码
|
||||||
|
*/
|
||||||
|
export function buildItemGroups(items) {
|
||||||
|
const productMap = new Map();
|
||||||
|
(items || []).forEach((item) => {
|
||||||
|
const productKey = item.product_code || '-';
|
||||||
|
if (!productMap.has(productKey)) {
|
||||||
|
productMap.set(productKey, {
|
||||||
|
group_key: `p:${productKey}`,
|
||||||
|
product_code: item.product_code || '',
|
||||||
|
product_name: item.product_name || '',
|
||||||
|
out_roll: 0,
|
||||||
|
out_weight: 0,
|
||||||
|
colors: new Map(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const productGroup = productMap.get(productKey);
|
||||||
|
if (!productGroup.product_name && item.product_name) {
|
||||||
|
productGroup.product_name = item.product_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
const colorKey = item.product_color_code || item.product_color_name || '-';
|
||||||
|
if (!productGroup.colors.has(colorKey)) {
|
||||||
|
productGroup.colors.set(colorKey, {
|
||||||
|
group_key: `p:${productKey}|c:${colorKey}`,
|
||||||
|
product_color_code: item.product_color_code || '',
|
||||||
|
product_color_name: item.product_color_name || '',
|
||||||
|
quote_order_no: item.quote_order_no || '',
|
||||||
|
dye_factory_dyelot_number: item.dye_factory_dyelot_number || '',
|
||||||
|
out_roll: 0,
|
||||||
|
out_weight: 0,
|
||||||
|
fine_codes: [],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const colorGroup = productGroup.colors.get(colorKey);
|
||||||
|
productGroup.out_roll = Number((productGroup.out_roll + Number(item.out_roll || 0)).toFixed(2));
|
||||||
|
productGroup.out_weight = Number((productGroup.out_weight + Number(item.out_weight || 0)).toFixed(2));
|
||||||
|
colorGroup.out_roll = Number((colorGroup.out_roll + Number(item.out_roll || 0)).toFixed(2));
|
||||||
|
colorGroup.out_weight = Number((colorGroup.out_weight + Number(item.out_weight || 0)).toFixed(2));
|
||||||
|
if (item.quote_order_no) colorGroup.quote_order_no = item.quote_order_no;
|
||||||
|
if (item.dye_factory_dyelot_number) {
|
||||||
|
colorGroup.dye_factory_dyelot_number = item.dye_factory_dyelot_number;
|
||||||
|
}
|
||||||
|
if (!colorGroup.product_color_name && item.product_color_name) {
|
||||||
|
colorGroup.product_color_name = item.product_color_name;
|
||||||
|
}
|
||||||
|
colorGroup.fine_codes.push(...(item.item_fc_data || []));
|
||||||
|
});
|
||||||
|
|
||||||
|
return Array.from(productMap.values()).map((product) => ({
|
||||||
|
group_key: product.group_key,
|
||||||
|
product_code: product.product_code,
|
||||||
|
product_name: product.product_name,
|
||||||
|
out_roll: product.out_roll,
|
||||||
|
out_weight: product.out_weight,
|
||||||
|
colors: Array.from(product.colors.values()),
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getEmptyScanDetail() {
|
||||||
|
return {
|
||||||
|
quote_order_no: '',
|
||||||
|
dyelot_number: '',
|
||||||
|
volume_number: '',
|
||||||
|
extern_volume_number: '',
|
||||||
|
product_code: '',
|
||||||
|
product_color_code: '',
|
||||||
|
order_roll: 0,
|
||||||
|
item_roll: 0,
|
||||||
|
order_weight: 0,
|
||||||
|
item_weight: 0,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 从扫码接口返回构建详情区(匹数÷100,数量÷10000) */
|
||||||
|
export function buildScanDetailFromScanResponse(res) {
|
||||||
|
if (!res) return getEmptyScanDetail();
|
||||||
|
return {
|
||||||
|
quote_order_no: res.quote_order_no || '',
|
||||||
|
dyelot_number: res.dyelot_number || '',
|
||||||
|
volume_number: res.volume_number != null && res.volume_number !== '' ? String(res.volume_number) : '',
|
||||||
|
extern_volume_number: res.extern_volume_number != null && res.extern_volume_number !== ''
|
||||||
|
? String(res.extern_volume_number)
|
||||||
|
: '',
|
||||||
|
product_code: res.product_code || '',
|
||||||
|
product_color_code: res.product_color_code || '',
|
||||||
|
// 本单匹数/数量:整单合计(扫码后会再以详情 total_* 覆盖)
|
||||||
|
order_roll: formatRoll(res.order_roll != null ? res.order_roll : res.total_roll),
|
||||||
|
item_roll: formatRoll(res.item_roll != null ? res.item_roll : res.roll),
|
||||||
|
order_weight: formatWeightKg(res.order_weight != null ? res.order_weight : res.total_weight),
|
||||||
|
item_weight: formatWeightKg(res.item_weight != null ? res.item_weight : res.weight),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 构建扫码请求参数 */
|
||||||
|
export function buildScanUpdateParams({ id, scanCode, arrangeType, warehouseBinId }) {
|
||||||
|
const code = (scanCode || '').trim();
|
||||||
|
const params = {
|
||||||
|
id: Number(id),
|
||||||
|
arrange_type: arrangeType,
|
||||||
|
};
|
||||||
|
if (warehouseBinId) {
|
||||||
|
params.warehouse_bin_id = Number(warehouseBinId);
|
||||||
|
}
|
||||||
|
// 长度大于25走二维码,否则走条码
|
||||||
|
if (code.length > 25) {
|
||||||
|
params.qr_code = code;
|
||||||
|
} else {
|
||||||
|
params.bar_code = code;
|
||||||
|
}
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function buildStatusParam(id) {
|
||||||
|
return { id: String(id) };
|
||||||
|
}
|
||||||
|
|
||||||
|
export function formatDisplayTime(value, format = 'YYYY-MM-DD') {
|
||||||
|
if (!value) return '';
|
||||||
|
const parsed = dayjs(value);
|
||||||
|
return parsed.isValid() ? parsed.format(format) : String(value).slice(0, 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function canScanAtStatus(status) {
|
||||||
|
const s = toAuditStatus(status);
|
||||||
|
return s === AUDIT_STATUS.PENDING || s === AUDIT_STATUS.REJECTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isLockedOrderStatus(status) {
|
||||||
|
const s = toAuditStatus(status);
|
||||||
|
return s === AUDIT_STATUS.APPROVED || s === AUDIT_STATUS.VOIDED;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function fetchAllOrderList(listFn, params = {}, pageSize = LIST_PAGE_SIZE) {
|
||||||
|
const pickBatch = (res) => {
|
||||||
|
if (Array.isArray(res)) return res;
|
||||||
|
if (!res || typeof res !== 'object') return [];
|
||||||
|
return res.list || res.records || res.items || [];
|
||||||
|
};
|
||||||
|
const loadPage = (page, acc) => listFn({ ...params, page, size: pageSize })
|
||||||
|
.then((res) => {
|
||||||
|
const batch = pickBatch(res);
|
||||||
|
if (!batch.length) return acc;
|
||||||
|
// 一次返回超过 pageSize:后端忽略分页,视为全量,避免死循环翻页
|
||||||
|
if (batch.length > pageSize) return acc.concat(batch);
|
||||||
|
// 翻页后与首页首条相同:后端忽略 page,避免死循环
|
||||||
|
if (
|
||||||
|
page > 1
|
||||||
|
&& acc.length
|
||||||
|
&& batch[0]
|
||||||
|
&& acc[0]
|
||||||
|
&& String(batch[0].id) === String(acc[0].id)
|
||||||
|
) {
|
||||||
|
return acc;
|
||||||
|
}
|
||||||
|
const merged = acc.concat(batch);
|
||||||
|
const total = !Array.isArray(res) && res != null ? Number(res.total) : NaN;
|
||||||
|
if (!Number.isNaN(total) && merged.length >= total) return merged;
|
||||||
|
if (batch.length < pageSize) return merged;
|
||||||
|
return loadPage(page + 1, merged);
|
||||||
|
});
|
||||||
|
return loadPage(1, []);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getFormStatusActionButtons(headerSaved, orderId, status) {
|
||||||
|
if (!headerSaved || !orderId) return [];
|
||||||
|
const s = toAuditStatus(status);
|
||||||
|
if (s === AUDIT_STATUS.APPROVED) {
|
||||||
|
return [{ label: '消审', action: 'unapprove' }];
|
||||||
|
}
|
||||||
|
if (!canScanAtStatus(s)) return [];
|
||||||
|
return [
|
||||||
|
{ label: '审核', action: 'approve' },
|
||||||
|
{ label: '作废', action: 'void' },
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getViewStatusActionButtons(status) {
|
||||||
|
const s = toAuditStatus(status);
|
||||||
|
if (s === AUDIT_STATUS.PENDING || s === AUDIT_STATUS.REJECTED) {
|
||||||
|
return [
|
||||||
|
{ label: '编辑', action: 'edit' },
|
||||||
|
{ label: '审核', action: 'approve' },
|
||||||
|
{ label: '作废', action: 'void' },
|
||||||
|
];
|
||||||
|
}
|
||||||
|
if (s === AUDIT_STATUS.APPROVED) {
|
||||||
|
return [{ label: '消审', action: 'unapprove' }];
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
export function orderToFormFields(order) {
|
||||||
|
return {
|
||||||
|
order_no: order.order_no,
|
||||||
|
out_order_type: order.out_order_type || OUT_ORDER_TYPE_PROCESS,
|
||||||
|
out_order_type_name: order.out_order_type_name || OUT_ORDER_TYPE_PROCESS_NAME,
|
||||||
|
process_unit_id: order.process_unit_id,
|
||||||
|
process_name: order.process_name,
|
||||||
|
warehouse_id: order.warehouse_id,
|
||||||
|
warehouse_name: order.warehouse_name,
|
||||||
|
remark: order.remark,
|
||||||
|
item_data: order.item_data,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 从仓库下拉中选出默认成品仓 */
|
||||||
|
export function pickDefaultWarehouse(options, loginWarehouseId, loginWarehouseName) {
|
||||||
|
const list = options || [];
|
||||||
|
const byName = list.find((item) => item.label === DEFAULT_WAREHOUSE_NAME);
|
||||||
|
if (byName) return byName;
|
||||||
|
if (loginWarehouseId) {
|
||||||
|
const byId = list.find((item) => String(item.value) === String(loginWarehouseId));
|
||||||
|
if (byId) return byId;
|
||||||
|
if (loginWarehouseName) {
|
||||||
|
return { value: loginWarehouseId, label: loginWarehouseName };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list[0] || null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 确认并执行审核状态变更
|
||||||
|
*/
|
||||||
|
export function confirmOrderStatusAction(vm, { orderId, action, onSuccess }) {
|
||||||
|
const cfg = STATUS_ACTION_CONFIG[action];
|
||||||
|
if (!cfg || !orderId) return;
|
||||||
|
const api = vm.$u.api.fpmProcessOutOrder;
|
||||||
|
const requestFn = api[cfg.apiKey];
|
||||||
|
if (typeof requestFn !== 'function') return;
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: cfg.msg,
|
||||||
|
success: (res) => {
|
||||||
|
if (!res.confirm) return;
|
||||||
|
uni.showLoading({ title: '处理中...' });
|
||||||
|
requestFn(buildStatusParam(orderId))
|
||||||
|
.then(() => {
|
||||||
|
if (typeof onSuccess === 'function') return onSuccess();
|
||||||
|
uni.hideLoading();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
uni.hideLoading();
|
||||||
|
if (vm.showError) vm.showError(e.message || '操作失败');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,402 @@
|
|||||||
|
/**
|
||||||
|
* 加工退货进仓单常量与数据工具
|
||||||
|
*
|
||||||
|
* 真实接口请求统一注册在 src/common/http.api.js 的 vm.$u.api.fpmProcessReturnInOrder 下。
|
||||||
|
*/
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
|
export const AUDIT_STATUS = {
|
||||||
|
PENDING: 1,
|
||||||
|
APPROVED: 2,
|
||||||
|
REJECTED: 3,
|
||||||
|
VOIDED: 4,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const DRAFT_AUDIT_STATUS = 0;
|
||||||
|
export const DRAFT_AUDIT_STATUS_NAME = '待保存';
|
||||||
|
|
||||||
|
/** 将接口状态统一为数字,避免字符串导致按钮判断失效 */
|
||||||
|
export function toAuditStatus(status) {
|
||||||
|
const n = Number(status);
|
||||||
|
return Number.isFinite(n) ? n : DRAFT_AUDIT_STATUS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const AUDIT_STATUS_MAP = {
|
||||||
|
1: '待审核',
|
||||||
|
2: '已审核',
|
||||||
|
3: '已驳回',
|
||||||
|
4: '已作废',
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 操作类型:1录入 3删除 */
|
||||||
|
export const ARRANGE_TYPE = {
|
||||||
|
IN: 1,
|
||||||
|
DEL: 3,
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 入仓类型:加工退货进仓单 */
|
||||||
|
export const IN_ORDER_TYPE_PROCESS_RETURN = 9;
|
||||||
|
|
||||||
|
/** 往来单位类型:加工单位 */
|
||||||
|
export const BUSINESS_UNIT_TYPE_PROCESS = 12;
|
||||||
|
|
||||||
|
/** 成品物理仓类型 */
|
||||||
|
export const WAREHOUSE_TYPE_FINISHED = 103;
|
||||||
|
|
||||||
|
/** 默认仓库名称 */
|
||||||
|
export const DEFAULT_WAREHOUSE_NAME = '成品仓';
|
||||||
|
|
||||||
|
export const LIST_PAGE_SIZE = 100;
|
||||||
|
|
||||||
|
export const STATUS_ACTION_CONFIG = {
|
||||||
|
approve: { status: AUDIT_STATUS.APPROVED, msg: '确认审核该单据?', apiKey: 'statusPass' },
|
||||||
|
void: { status: AUDIT_STATUS.VOIDED, msg: '确认作废该单据?', apiKey: 'statusCancel' },
|
||||||
|
unapprove: { status: AUDIT_STATUS.PENDING, msg: '确认消审该单据?', apiKey: 'statusWait' },
|
||||||
|
};
|
||||||
|
|
||||||
|
export function getStatusOptions() {
|
||||||
|
return Object.keys(AUDIT_STATUS_MAP).map((value) => ({
|
||||||
|
value,
|
||||||
|
label: AUDIT_STATUS_MAP[value],
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
export { mapToSelectOptions } from '@/common/remoteSelect';
|
||||||
|
|
||||||
|
/** 匹数:后端 ×100 存储 */
|
||||||
|
export function formatRoll(value) {
|
||||||
|
const n = Number(value || 0) / 100;
|
||||||
|
return Number.isInteger(n) ? n : Number(n.toFixed(2));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 数量(公斤):后端 ×10000 存储 */
|
||||||
|
export function formatWeightKg(value) {
|
||||||
|
const n = Number(value || 0) / 10000;
|
||||||
|
return Number(n.toFixed(2));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function normalizeOrder(order) {
|
||||||
|
if (!order) return null;
|
||||||
|
return {
|
||||||
|
id: order.id,
|
||||||
|
order_no: order.order_no || '',
|
||||||
|
audit_status: toAuditStatus(order.audit_status),
|
||||||
|
audit_status_name: order.audit_status_name || AUDIT_STATUS_MAP[toAuditStatus(order.audit_status)] || '',
|
||||||
|
process_unit_id: order.process_unit_id || order.biz_unit_id || '',
|
||||||
|
process_name: order.process_name || order.biz_unit_name || '',
|
||||||
|
warehouse_id: order.warehouse_id || '',
|
||||||
|
warehouse_name: order.warehouse_name || '',
|
||||||
|
sale_system_id: order.sale_system_id || '',
|
||||||
|
sale_system_name: order.sale_system_name || '',
|
||||||
|
in_order_type: order.in_order_type || IN_ORDER_TYPE_PROCESS_RETURN,
|
||||||
|
in_order_type_name: order.in_order_type_name || '加工退货进仓单',
|
||||||
|
remark: order.remark || '',
|
||||||
|
warehouse_in_time: (order.warehouse_in_time || '').slice(0, 10),
|
||||||
|
creator_name: order.creator_name || '',
|
||||||
|
create_time: order.create_time || '',
|
||||||
|
auditor_name: order.auditor_name || '',
|
||||||
|
audit_time: order.audit_time || '',
|
||||||
|
total_roll: formatRoll(order.total_roll),
|
||||||
|
total_weight: formatWeightKg(order.total_weight),
|
||||||
|
total_length: formatRoll(order.total_length),
|
||||||
|
item_data: (order.item_data || []).map(normalizeItem),
|
||||||
|
_raw: order,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function normalizeFineCode(fc) {
|
||||||
|
if (!fc) return null;
|
||||||
|
const weightRaw = fc.base_unit_weight != null
|
||||||
|
? fc.base_unit_weight
|
||||||
|
: (fc.settle_weight != null ? fc.settle_weight : fc.weight);
|
||||||
|
return {
|
||||||
|
id: fc.id,
|
||||||
|
volume_number: fc.volume_number != null && fc.volume_number !== '' ? String(fc.volume_number) : '',
|
||||||
|
extern_volume_number: fc.extern_volume_number != null && fc.extern_volume_number !== ''
|
||||||
|
? String(fc.extern_volume_number)
|
||||||
|
: '',
|
||||||
|
roll: formatRoll(fc.roll),
|
||||||
|
weight: formatWeightKg(weightRaw),
|
||||||
|
bar_code: fc.bar_code || '',
|
||||||
|
qr_code: fc.qr_code || '',
|
||||||
|
dye_factory_dyelot_number: fc.dye_factory_dyelot_number || fc.dyelot_number || '',
|
||||||
|
warehouse_bin_name: fc.warehouse_bin_name || '',
|
||||||
|
shelf_no: fc.shelf_no || '',
|
||||||
|
scan_code: fc.qr_code || fc.bar_code || '',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function normalizeItem(item) {
|
||||||
|
return {
|
||||||
|
id: item.id,
|
||||||
|
quote_order_no: item.quote_order_no || '',
|
||||||
|
product_code: item.product_code || '',
|
||||||
|
product_name: item.product_name || '',
|
||||||
|
product_color_code: item.product_color_code || '',
|
||||||
|
product_color_name: item.product_color_name || '',
|
||||||
|
dye_factory_dyelot_number: item.dye_factory_dyelot_number || '',
|
||||||
|
dye_factory_color_code: item.dye_factory_color_code || '',
|
||||||
|
in_roll: formatRoll(item.in_roll),
|
||||||
|
in_weight: formatWeightKg(item.in_weight),
|
||||||
|
item_fc_data: (item.item_fc_data || []).map(normalizeFineCode).filter(Boolean),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 明细分组:成品编号 → 成品色号 → 细码
|
||||||
|
*/
|
||||||
|
export function buildItemGroups(items) {
|
||||||
|
const productMap = new Map();
|
||||||
|
(items || []).forEach((item) => {
|
||||||
|
const productKey = item.product_code || '-';
|
||||||
|
if (!productMap.has(productKey)) {
|
||||||
|
productMap.set(productKey, {
|
||||||
|
group_key: `p:${productKey}`,
|
||||||
|
product_code: item.product_code || '',
|
||||||
|
product_name: item.product_name || '',
|
||||||
|
in_roll: 0,
|
||||||
|
in_weight: 0,
|
||||||
|
colors: new Map(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const productGroup = productMap.get(productKey);
|
||||||
|
if (!productGroup.product_name && item.product_name) {
|
||||||
|
productGroup.product_name = item.product_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
const colorKey = item.product_color_code || item.product_color_name || '-';
|
||||||
|
if (!productGroup.colors.has(colorKey)) {
|
||||||
|
productGroup.colors.set(colorKey, {
|
||||||
|
group_key: `p:${productKey}|c:${colorKey}`,
|
||||||
|
product_color_code: item.product_color_code || '',
|
||||||
|
product_color_name: item.product_color_name || '',
|
||||||
|
quote_order_no: item.quote_order_no || '',
|
||||||
|
dye_factory_dyelot_number: item.dye_factory_dyelot_number || '',
|
||||||
|
in_roll: 0,
|
||||||
|
in_weight: 0,
|
||||||
|
fine_codes: [],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const colorGroup = productGroup.colors.get(colorKey);
|
||||||
|
productGroup.in_roll = Number((productGroup.in_roll + Number(item.in_roll || 0)).toFixed(2));
|
||||||
|
productGroup.in_weight = Number((productGroup.in_weight + Number(item.in_weight || 0)).toFixed(2));
|
||||||
|
colorGroup.in_roll = Number((colorGroup.in_roll + Number(item.in_roll || 0)).toFixed(2));
|
||||||
|
colorGroup.in_weight = Number((colorGroup.in_weight + Number(item.in_weight || 0)).toFixed(2));
|
||||||
|
if (item.quote_order_no) colorGroup.quote_order_no = item.quote_order_no;
|
||||||
|
if (item.dye_factory_dyelot_number) {
|
||||||
|
colorGroup.dye_factory_dyelot_number = item.dye_factory_dyelot_number;
|
||||||
|
}
|
||||||
|
if (!colorGroup.product_color_name && item.product_color_name) {
|
||||||
|
colorGroup.product_color_name = item.product_color_name;
|
||||||
|
}
|
||||||
|
colorGroup.fine_codes.push(...(item.item_fc_data || []));
|
||||||
|
});
|
||||||
|
|
||||||
|
return Array.from(productMap.values()).map((product) => ({
|
||||||
|
group_key: product.group_key,
|
||||||
|
product_code: product.product_code,
|
||||||
|
product_name: product.product_name,
|
||||||
|
in_roll: product.in_roll,
|
||||||
|
in_weight: product.in_weight,
|
||||||
|
colors: Array.from(product.colors.values()),
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getEmptyScanDetail() {
|
||||||
|
return {
|
||||||
|
quote_order_no: '',
|
||||||
|
dyelot_number: '',
|
||||||
|
volume_number: '',
|
||||||
|
extern_volume_number: '',
|
||||||
|
product_code: '',
|
||||||
|
product_color_code: '',
|
||||||
|
order_roll: 0,
|
||||||
|
item_roll: 0,
|
||||||
|
order_weight: 0,
|
||||||
|
item_weight: 0,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 刚扫细码的数量(公斤存储值):优先细码 weight */
|
||||||
|
function pickScannedFineWeight(res) {
|
||||||
|
if (!res) return 0;
|
||||||
|
if (res.weight != null && res.weight !== '') return res.weight;
|
||||||
|
if (res.base_unit_weight != null && res.base_unit_weight !== '') return res.base_unit_weight;
|
||||||
|
if (res.settle_weight != null && res.settle_weight !== '') return res.settle_weight;
|
||||||
|
if (res.actually_weight != null && res.actually_weight !== '') return res.actually_weight;
|
||||||
|
return res.item_weight;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 从扫码接口返回构建详情区(匹数÷100,数量÷10000) */
|
||||||
|
export function buildScanDetailFromScanResponse(res) {
|
||||||
|
if (!res) return getEmptyScanDetail();
|
||||||
|
return {
|
||||||
|
quote_order_no: res.quote_order_no || '',
|
||||||
|
dyelot_number: res.dyelot_number || '',
|
||||||
|
volume_number: res.volume_number != null && res.volume_number !== '' ? String(res.volume_number) : '',
|
||||||
|
extern_volume_number: res.extern_volume_number != null && res.extern_volume_number !== ''
|
||||||
|
? String(res.extern_volume_number)
|
||||||
|
: '',
|
||||||
|
product_code: res.product_code || '',
|
||||||
|
product_color_code: res.product_color_code || '',
|
||||||
|
// 本单匹数/数量:整单合计(扫码后会再以详情 total_* 覆盖)
|
||||||
|
order_roll: formatRoll(res.order_roll != null ? res.order_roll : res.total_roll),
|
||||||
|
item_roll: formatRoll(res.item_roll != null ? res.item_roll : res.roll),
|
||||||
|
order_weight: formatWeightKg(res.order_weight != null ? res.order_weight : res.total_weight),
|
||||||
|
item_weight: formatWeightKg(pickScannedFineWeight(res)),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 构建扫码请求参数 */
|
||||||
|
export function buildScanUpdateParams({ id, scanCode, arrangeType, warehouseBinId }) {
|
||||||
|
const code = (scanCode || '').trim();
|
||||||
|
const params = {
|
||||||
|
id: Number(id),
|
||||||
|
arrange_type: arrangeType,
|
||||||
|
};
|
||||||
|
if (warehouseBinId) {
|
||||||
|
params.warehouse_bin_id = Number(warehouseBinId);
|
||||||
|
}
|
||||||
|
// 长度大于25走二维码,否则走条码
|
||||||
|
if (code.length > 25) {
|
||||||
|
params.qr_code = code;
|
||||||
|
} else {
|
||||||
|
params.bar_code = code;
|
||||||
|
}
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function buildStatusParam(id) {
|
||||||
|
return { id: String(id) };
|
||||||
|
}
|
||||||
|
|
||||||
|
export function formatDisplayTime(value, format = 'YYYY-MM-DD') {
|
||||||
|
if (!value) return '';
|
||||||
|
const parsed = dayjs(value);
|
||||||
|
return parsed.isValid() ? parsed.format(format) : String(value).slice(0, 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function canScanAtStatus(status) {
|
||||||
|
const s = toAuditStatus(status);
|
||||||
|
return s === AUDIT_STATUS.PENDING || s === AUDIT_STATUS.REJECTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isLockedOrderStatus(status) {
|
||||||
|
const s = toAuditStatus(status);
|
||||||
|
return s === AUDIT_STATUS.APPROVED || s === AUDIT_STATUS.VOIDED;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function fetchAllOrderList(listFn, params = {}, pageSize = LIST_PAGE_SIZE) {
|
||||||
|
const pickBatch = (res) => {
|
||||||
|
if (Array.isArray(res)) return res;
|
||||||
|
if (!res || typeof res !== 'object') return [];
|
||||||
|
return res.list || res.records || res.items || [];
|
||||||
|
};
|
||||||
|
const loadPage = (page, acc) => listFn({ ...params, page, size: pageSize })
|
||||||
|
.then((res) => {
|
||||||
|
const batch = pickBatch(res);
|
||||||
|
if (!batch.length) return acc;
|
||||||
|
// 一次返回超过 pageSize:后端忽略分页,视为全量,避免死循环翻页
|
||||||
|
if (batch.length > pageSize) return acc.concat(batch);
|
||||||
|
// 翻页后与首页首条相同:后端忽略 page,避免死循环
|
||||||
|
if (
|
||||||
|
page > 1
|
||||||
|
&& acc.length
|
||||||
|
&& batch[0]
|
||||||
|
&& acc[0]
|
||||||
|
&& String(batch[0].id) === String(acc[0].id)
|
||||||
|
) {
|
||||||
|
return acc;
|
||||||
|
}
|
||||||
|
const merged = acc.concat(batch);
|
||||||
|
const total = !Array.isArray(res) && res != null ? Number(res.total) : NaN;
|
||||||
|
if (!Number.isNaN(total) && merged.length >= total) return merged;
|
||||||
|
if (batch.length < pageSize) return merged;
|
||||||
|
return loadPage(page + 1, merged);
|
||||||
|
});
|
||||||
|
return loadPage(1, []);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getFormStatusActionButtons(headerSaved, orderId, status) {
|
||||||
|
if (!headerSaved || !orderId) return [];
|
||||||
|
const s = toAuditStatus(status);
|
||||||
|
if (s === AUDIT_STATUS.APPROVED) {
|
||||||
|
return [{ label: '消审', action: 'unapprove' }];
|
||||||
|
}
|
||||||
|
if (!canScanAtStatus(s)) return [];
|
||||||
|
return [
|
||||||
|
{ label: '审核', action: 'approve' },
|
||||||
|
{ label: '作废', action: 'void' },
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getViewStatusActionButtons(status) {
|
||||||
|
const s = toAuditStatus(status);
|
||||||
|
if (s === AUDIT_STATUS.PENDING || s === AUDIT_STATUS.REJECTED) {
|
||||||
|
return [
|
||||||
|
{ label: '编辑', action: 'edit' },
|
||||||
|
{ label: '审核', action: 'approve' },
|
||||||
|
{ label: '作废', action: 'void' },
|
||||||
|
];
|
||||||
|
}
|
||||||
|
if (s === AUDIT_STATUS.APPROVED) {
|
||||||
|
return [{ label: '消审', action: 'unapprove' }];
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
export function orderToFormFields(order) {
|
||||||
|
return {
|
||||||
|
order_no: order.order_no,
|
||||||
|
process_unit_id: order.process_unit_id,
|
||||||
|
process_name: order.process_name,
|
||||||
|
warehouse_id: order.warehouse_id,
|
||||||
|
warehouse_name: order.warehouse_name,
|
||||||
|
remark: order.remark,
|
||||||
|
item_data: order.item_data,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 从仓库下拉中选出默认成品仓 */
|
||||||
|
export function pickDefaultWarehouse(options, loginWarehouseId, loginWarehouseName) {
|
||||||
|
const list = options || [];
|
||||||
|
const byName = list.find((item) => item.label === DEFAULT_WAREHOUSE_NAME);
|
||||||
|
if (byName) return byName;
|
||||||
|
if (loginWarehouseId) {
|
||||||
|
const byId = list.find((item) => String(item.value) === String(loginWarehouseId));
|
||||||
|
if (byId) return byId;
|
||||||
|
if (loginWarehouseName) {
|
||||||
|
return { value: loginWarehouseId, label: loginWarehouseName };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list[0] || null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 确认并执行审核状态变更
|
||||||
|
*/
|
||||||
|
export function confirmOrderStatusAction(vm, { orderId, action, onSuccess }) {
|
||||||
|
const cfg = STATUS_ACTION_CONFIG[action];
|
||||||
|
if (!cfg || !orderId) return;
|
||||||
|
const api = vm.$u.api.fpmProcessReturnInOrder;
|
||||||
|
const requestFn = api[cfg.apiKey];
|
||||||
|
if (typeof requestFn !== 'function') return;
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: cfg.msg,
|
||||||
|
success: (res) => {
|
||||||
|
if (!res.confirm) return;
|
||||||
|
uni.showLoading({ title: '处理中...' });
|
||||||
|
requestFn(buildStatusParam(orderId))
|
||||||
|
.then(() => {
|
||||||
|
if (typeof onSuccess === 'function') return onSuccess();
|
||||||
|
uni.hideLoading();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
uni.hideLoading();
|
||||||
|
if (vm.showError) vm.showError(e.message || '操作失败');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,490 @@
|
|||||||
|
/**
|
||||||
|
* 成品采购进仓单常量与数据工具
|
||||||
|
*
|
||||||
|
* 真实接口请求统一注册在 src/common/http.api.js 的 vm.$u.api.fpmPrcInOrder 下。
|
||||||
|
*/
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
|
export const AUDIT_STATUS = {
|
||||||
|
PENDING: 1,
|
||||||
|
APPROVED: 2,
|
||||||
|
REJECTED: 3,
|
||||||
|
VOIDED: 4,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const DRAFT_AUDIT_STATUS = 0;
|
||||||
|
export const DRAFT_AUDIT_STATUS_NAME = '待保存';
|
||||||
|
|
||||||
|
/** 将接口状态统一为数字,避免字符串导致按钮判断失效 */
|
||||||
|
export function toAuditStatus(status) {
|
||||||
|
const n = Number(status);
|
||||||
|
return Number.isFinite(n) ? n : DRAFT_AUDIT_STATUS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const AUDIT_STATUS_MAP = {
|
||||||
|
1: '待审核',
|
||||||
|
2: '已审核',
|
||||||
|
3: '已驳回',
|
||||||
|
4: '已作废',
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 操作类型:1录入 3删除 */
|
||||||
|
export const ARRANGE_TYPE = {
|
||||||
|
IN: 1,
|
||||||
|
DEL: 3,
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 入仓类型:采购进仓单 */
|
||||||
|
export const IN_ORDER_TYPE_PURCHASE = 4;
|
||||||
|
|
||||||
|
export const IN_ORDER_TYPE_MAP = {
|
||||||
|
[IN_ORDER_TYPE_PURCHASE]: '采购进仓单',
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 订单类型:1大货 2剪板 3客订大货 4客订剪板 */
|
||||||
|
export const SALE_MODE = {
|
||||||
|
BULK: 1,
|
||||||
|
SHEAR: 2,
|
||||||
|
CUSTOMER_BULK: 3,
|
||||||
|
CUSTOMER_SHEAR: 4,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const SALE_MODE_MAP = {
|
||||||
|
[SALE_MODE.BULK]: '大货',
|
||||||
|
[SALE_MODE.SHEAR]: '剪板',
|
||||||
|
[SALE_MODE.CUSTOMER_BULK]: '客订大货',
|
||||||
|
[SALE_MODE.CUSTOMER_SHEAR]: '客订剪板',
|
||||||
|
};
|
||||||
|
|
||||||
|
export const SALE_MODE_OPTIONS = [
|
||||||
|
{ value: SALE_MODE.BULK, label: SALE_MODE_MAP[SALE_MODE.BULK] },
|
||||||
|
{ value: SALE_MODE.SHEAR, label: SALE_MODE_MAP[SALE_MODE.SHEAR] },
|
||||||
|
{ value: SALE_MODE.CUSTOMER_BULK, label: SALE_MODE_MAP[SALE_MODE.CUSTOMER_BULK] },
|
||||||
|
{ value: SALE_MODE.CUSTOMER_SHEAR, label: SALE_MODE_MAP[SALE_MODE.CUSTOMER_SHEAR] },
|
||||||
|
];
|
||||||
|
|
||||||
|
/** 往来单位类型:成品供应商 */
|
||||||
|
export const BUSINESS_UNIT_TYPE_PRODUCT_SUPPLIER = 15;
|
||||||
|
|
||||||
|
/** 成品物理仓类型 */
|
||||||
|
export const WAREHOUSE_TYPE_FINISHED = 103;
|
||||||
|
|
||||||
|
/** 默认仓库名称 */
|
||||||
|
export const DEFAULT_WAREHOUSE_NAME = '成品仓';
|
||||||
|
|
||||||
|
/** 默认纸筒重量(公斤,表单展示值) */
|
||||||
|
export const DEFAULT_PAPER_TUBE_WEIGHT = 0.3;
|
||||||
|
|
||||||
|
/** 默认包装重量(公斤,表单展示值) */
|
||||||
|
export const DEFAULT_PACKAGE_WEIGHT = 0.15;
|
||||||
|
|
||||||
|
export const LIST_PAGE_SIZE = 100;
|
||||||
|
|
||||||
|
export const STATUS_ACTION_CONFIG = {
|
||||||
|
approve: { status: AUDIT_STATUS.APPROVED, msg: '确认审核该单据?', apiKey: 'statusPass' },
|
||||||
|
void: { status: AUDIT_STATUS.VOIDED, msg: '确认作废该单据?', apiKey: 'statusCancel' },
|
||||||
|
unapprove: { status: AUDIT_STATUS.PENDING, msg: '确认消审该单据?', apiKey: 'statusWait' },
|
||||||
|
};
|
||||||
|
|
||||||
|
export function getStatusOptions() {
|
||||||
|
return Object.keys(AUDIT_STATUS_MAP).map((value) => ({
|
||||||
|
value,
|
||||||
|
label: AUDIT_STATUS_MAP[value],
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
export { mapToSelectOptions } from '@/common/remoteSelect';
|
||||||
|
|
||||||
|
/** 匹数:后端 ×100 存储 */
|
||||||
|
export function formatRoll(value) {
|
||||||
|
const n = Number(value || 0) / 100;
|
||||||
|
return Number.isInteger(n) ? n : Number(n.toFixed(2));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 数量(公斤):后端 ×10000 存储 */
|
||||||
|
export function formatWeightKg(value) {
|
||||||
|
const n = Number(value || 0) / 10000;
|
||||||
|
return Number(n.toFixed(2));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 公斤展示值转后端存储(×10000) */
|
||||||
|
export function toWeightStorage(value) {
|
||||||
|
return Math.round(Number(value || 0) * 10000);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function normalizeOrder(order) {
|
||||||
|
if (!order) return null;
|
||||||
|
return {
|
||||||
|
id: order.id,
|
||||||
|
order_no: order.order_no || '',
|
||||||
|
audit_status: toAuditStatus(order.audit_status),
|
||||||
|
audit_status_name: order.audit_status_name || AUDIT_STATUS_MAP[toAuditStatus(order.audit_status)] || '',
|
||||||
|
biz_unit_id: order.biz_unit_id || '',
|
||||||
|
biz_unit_name: order.biz_unit_name || '',
|
||||||
|
warehouse_id: order.warehouse_id || '',
|
||||||
|
warehouse_name: order.warehouse_name || '',
|
||||||
|
sale_system_id: order.sale_system_id || '',
|
||||||
|
sale_system_name: order.sale_system_name || '',
|
||||||
|
sale_mode: order.sale_mode || '',
|
||||||
|
sale_mode_name: order.sale_mode_name || SALE_MODE_MAP[order.sale_mode] || '',
|
||||||
|
in_order_type: order.in_order_type || IN_ORDER_TYPE_PURCHASE,
|
||||||
|
in_order_type_name: order.in_order_type_name
|
||||||
|
|| IN_ORDER_TYPE_MAP[order.in_order_type]
|
||||||
|
|| IN_ORDER_TYPE_MAP[IN_ORDER_TYPE_PURCHASE],
|
||||||
|
paper_tube_weight: formatWeightKg(order.paper_tube_weight),
|
||||||
|
package_weight: formatWeightKg(order.package_weight),
|
||||||
|
remark: order.remark || '',
|
||||||
|
warehouse_in_time: (order.warehouse_in_time || '').slice(0, 10),
|
||||||
|
creator_name: order.creator_name || '',
|
||||||
|
create_time: order.create_time || '',
|
||||||
|
auditor_name: order.auditor_name || '',
|
||||||
|
audit_time: order.audit_time || '',
|
||||||
|
total_roll: formatRoll(order.total_roll),
|
||||||
|
total_weight: formatWeightKg(order.total_weight),
|
||||||
|
total_length: formatRoll(order.total_length),
|
||||||
|
item_data: (order.item_data || []).map(normalizeItem),
|
||||||
|
_raw: order,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function normalizeFineCode(fc) {
|
||||||
|
if (!fc) return null;
|
||||||
|
const weightRaw = fc.base_unit_weight != null
|
||||||
|
? fc.base_unit_weight
|
||||||
|
: (fc.settle_weight != null ? fc.settle_weight : fc.weight);
|
||||||
|
const qrCode = fc.qr_code || fc.long_code || '';
|
||||||
|
const barCode = fc.bar_code || fc.digital_code || fc.short_code || '';
|
||||||
|
return {
|
||||||
|
id: fc.id,
|
||||||
|
volume_number: fc.volume_number != null && fc.volume_number !== '' ? String(fc.volume_number) : '',
|
||||||
|
extern_volume_number: fc.extern_volume_number != null && fc.extern_volume_number !== ''
|
||||||
|
? String(fc.extern_volume_number)
|
||||||
|
: '',
|
||||||
|
roll: formatRoll(fc.roll),
|
||||||
|
weight: formatWeightKg(weightRaw),
|
||||||
|
bar_code: barCode,
|
||||||
|
qr_code: qrCode,
|
||||||
|
digital_code: fc.digital_code || '',
|
||||||
|
long_code: fc.long_code || '',
|
||||||
|
short_code: fc.short_code || '',
|
||||||
|
dye_factory_dyelot_number: fc.dye_factory_dyelot_number || fc.dyelot_number || '',
|
||||||
|
warehouse_bin_name: fc.warehouse_bin_name || '',
|
||||||
|
shelf_no: fc.shelf_no || '',
|
||||||
|
scan_code: qrCode || barCode || '',
|
||||||
|
paper_tube_weight: fc.paper_tube_weight != null && fc.paper_tube_weight !== ''
|
||||||
|
? formatWeightKg(fc.paper_tube_weight)
|
||||||
|
: null,
|
||||||
|
package_weight: fc.package_weight != null && fc.package_weight !== ''
|
||||||
|
? formatWeightKg(fc.package_weight)
|
||||||
|
: null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function normalizeItem(item) {
|
||||||
|
const weightRaw = item.in_weight != null ? item.in_weight : item.total_weight;
|
||||||
|
return {
|
||||||
|
id: item.id,
|
||||||
|
quote_order_no: item.quote_order_no || '',
|
||||||
|
product_code: item.product_code || '',
|
||||||
|
product_name: item.product_name || '',
|
||||||
|
product_color_code: item.product_color_code || '',
|
||||||
|
product_color_name: item.product_color_name || '',
|
||||||
|
dye_factory_dyelot_number: item.dye_factory_dyelot_number || '',
|
||||||
|
dye_factory_color_code: item.dye_factory_color_code || '',
|
||||||
|
in_roll: formatRoll(item.in_roll),
|
||||||
|
in_weight: formatWeightKg(weightRaw),
|
||||||
|
item_fc_data: (item.item_fc_data || []).map(normalizeFineCode).filter(Boolean),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 明细分组:成品编号 → 成品色号 → 细码
|
||||||
|
*/
|
||||||
|
export function buildItemGroups(items) {
|
||||||
|
const productMap = new Map();
|
||||||
|
(items || []).forEach((item) => {
|
||||||
|
const productKey = item.product_code || '-';
|
||||||
|
if (!productMap.has(productKey)) {
|
||||||
|
productMap.set(productKey, {
|
||||||
|
group_key: `p:${productKey}`,
|
||||||
|
product_code: item.product_code || '',
|
||||||
|
product_name: item.product_name || '',
|
||||||
|
in_roll: 0,
|
||||||
|
in_weight: 0,
|
||||||
|
colors: new Map(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const productGroup = productMap.get(productKey);
|
||||||
|
if (!productGroup.product_name && item.product_name) {
|
||||||
|
productGroup.product_name = item.product_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
const colorKey = item.product_color_code || item.product_color_name || '-';
|
||||||
|
if (!productGroup.colors.has(colorKey)) {
|
||||||
|
productGroup.colors.set(colorKey, {
|
||||||
|
group_key: `p:${productKey}|c:${colorKey}`,
|
||||||
|
product_color_code: item.product_color_code || '',
|
||||||
|
product_color_name: item.product_color_name || '',
|
||||||
|
quote_order_no: item.quote_order_no || '',
|
||||||
|
dye_factory_dyelot_number: item.dye_factory_dyelot_number || '',
|
||||||
|
in_roll: 0,
|
||||||
|
in_weight: 0,
|
||||||
|
fine_codes: [],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const colorGroup = productGroup.colors.get(colorKey);
|
||||||
|
productGroup.in_roll = Number((productGroup.in_roll + Number(item.in_roll || 0)).toFixed(2));
|
||||||
|
productGroup.in_weight = Number((productGroup.in_weight + Number(item.in_weight || 0)).toFixed(2));
|
||||||
|
colorGroup.in_roll = Number((colorGroup.in_roll + Number(item.in_roll || 0)).toFixed(2));
|
||||||
|
colorGroup.in_weight = Number((colorGroup.in_weight + Number(item.in_weight || 0)).toFixed(2));
|
||||||
|
if (item.quote_order_no) colorGroup.quote_order_no = item.quote_order_no;
|
||||||
|
if (item.dye_factory_dyelot_number) {
|
||||||
|
colorGroup.dye_factory_dyelot_number = item.dye_factory_dyelot_number;
|
||||||
|
}
|
||||||
|
if (!colorGroup.product_color_name && item.product_color_name) {
|
||||||
|
colorGroup.product_color_name = item.product_color_name;
|
||||||
|
}
|
||||||
|
colorGroup.fine_codes.push(...(item.item_fc_data || []));
|
||||||
|
});
|
||||||
|
|
||||||
|
return Array.from(productMap.values()).map((product) => ({
|
||||||
|
group_key: product.group_key,
|
||||||
|
product_code: product.product_code,
|
||||||
|
product_name: product.product_name,
|
||||||
|
in_roll: product.in_roll,
|
||||||
|
in_weight: product.in_weight,
|
||||||
|
colors: Array.from(product.colors.values()),
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getEmptyScanDetail() {
|
||||||
|
return {
|
||||||
|
quote_order_no: '',
|
||||||
|
dyelot_number: '',
|
||||||
|
volume_number: '',
|
||||||
|
extern_volume_number: '',
|
||||||
|
product_code: '',
|
||||||
|
product_color_code: '',
|
||||||
|
order_roll: 0,
|
||||||
|
item_roll: 0,
|
||||||
|
order_weight: 0,
|
||||||
|
item_weight: 0,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 刚扫细码的数量(公斤存储值):优先细码 weight */
|
||||||
|
function pickScannedFineWeight(res) {
|
||||||
|
if (!res) return 0;
|
||||||
|
if (res.weight != null && res.weight !== '') return res.weight;
|
||||||
|
if (res.base_unit_weight != null && res.base_unit_weight !== '') return res.base_unit_weight;
|
||||||
|
if (res.settle_weight != null && res.settle_weight !== '') return res.settle_weight;
|
||||||
|
if (res.actually_weight != null && res.actually_weight !== '') return res.actually_weight;
|
||||||
|
return res.item_weight;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 从扫码接口返回构建详情区(匹数÷100,数量÷10000) */
|
||||||
|
export function buildScanDetailFromScanResponse(res) {
|
||||||
|
if (!res) return getEmptyScanDetail();
|
||||||
|
return {
|
||||||
|
quote_order_no: res.quote_order_no || '',
|
||||||
|
dyelot_number: res.dyelot_number || '',
|
||||||
|
volume_number: res.volume_number != null && res.volume_number !== '' ? String(res.volume_number) : '',
|
||||||
|
extern_volume_number: res.extern_volume_number != null && res.extern_volume_number !== ''
|
||||||
|
? String(res.extern_volume_number)
|
||||||
|
: '',
|
||||||
|
product_code: res.product_code || '',
|
||||||
|
product_color_code: res.product_color_code || '',
|
||||||
|
// 本单匹数/数量:整单合计(扫码后会再以详情 total_* 覆盖)
|
||||||
|
order_roll: formatRoll(res.order_roll != null ? res.order_roll : res.total_roll),
|
||||||
|
item_roll: formatRoll(res.item_roll != null ? res.item_roll : res.roll),
|
||||||
|
order_weight: formatWeightKg(res.order_weight != null ? res.order_weight : res.total_weight),
|
||||||
|
// 本行数量:刚扫这条细码的重量(weight),不是明细行合计
|
||||||
|
item_weight: formatWeightKg(pickScannedFineWeight(res)),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 校验纸筒/包装重量(扫码时提交) */
|
||||||
|
export function validateScanWeights(paperTubeWeight, packageWeight) {
|
||||||
|
if (paperTubeWeight === '' || paperTubeWeight == null) {
|
||||||
|
return '请输入纸筒重量';
|
||||||
|
}
|
||||||
|
if (Number.isNaN(Number(paperTubeWeight))) return '纸筒重量格式不正确';
|
||||||
|
if (packageWeight === '' || packageWeight == null) {
|
||||||
|
return '请输入包装重量';
|
||||||
|
}
|
||||||
|
if (Number.isNaN(Number(packageWeight))) return '包装重量格式不正确';
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 构建扫码请求参数(纸筒/包装重量在扫码时提交,公斤值需 ×10000) */
|
||||||
|
export function buildScanUpdateParams({
|
||||||
|
id,
|
||||||
|
scanCode,
|
||||||
|
arrangeType,
|
||||||
|
warehouseBinId,
|
||||||
|
paperTubeWeight,
|
||||||
|
packageWeight,
|
||||||
|
}) {
|
||||||
|
const code = (scanCode || '').trim();
|
||||||
|
const params = {
|
||||||
|
id: Number(id),
|
||||||
|
arrange_type: arrangeType,
|
||||||
|
paper_tube_weight: toWeightStorage(paperTubeWeight),
|
||||||
|
package_weight: toWeightStorage(packageWeight),
|
||||||
|
};
|
||||||
|
if (warehouseBinId) {
|
||||||
|
params.warehouse_bin_id = Number(warehouseBinId);
|
||||||
|
}
|
||||||
|
// 长度大于25走二维码,否则走条码
|
||||||
|
if (code.length > 25) {
|
||||||
|
params.qr_code = code;
|
||||||
|
} else {
|
||||||
|
params.bar_code = code;
|
||||||
|
}
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function buildStatusParam(id) {
|
||||||
|
return { id: String(id) };
|
||||||
|
}
|
||||||
|
|
||||||
|
export function formatDisplayTime(value, format = 'YYYY-MM-DD') {
|
||||||
|
if (!value) return '';
|
||||||
|
const parsed = dayjs(value);
|
||||||
|
return parsed.isValid() ? parsed.format(format) : String(value).slice(0, 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function canScanAtStatus(status) {
|
||||||
|
const s = toAuditStatus(status);
|
||||||
|
return s === AUDIT_STATUS.PENDING || s === AUDIT_STATUS.REJECTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isLockedOrderStatus(status) {
|
||||||
|
const s = toAuditStatus(status);
|
||||||
|
return s === AUDIT_STATUS.APPROVED || s === AUDIT_STATUS.VOIDED;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function fetchAllOrderList(listFn, params = {}, pageSize = LIST_PAGE_SIZE) {
|
||||||
|
const pickBatch = (res) => {
|
||||||
|
if (Array.isArray(res)) return res;
|
||||||
|
if (!res || typeof res !== 'object') return [];
|
||||||
|
return res.list || res.records || res.items || [];
|
||||||
|
};
|
||||||
|
const loadPage = (page, acc) => listFn({ ...params, page, size: pageSize })
|
||||||
|
.then((res) => {
|
||||||
|
const batch = pickBatch(res);
|
||||||
|
if (!batch.length) return acc;
|
||||||
|
// 一次返回超过 pageSize:后端忽略分页,视为全量,避免死循环翻页
|
||||||
|
if (batch.length > pageSize) return acc.concat(batch);
|
||||||
|
// 翻页后与首页首条相同:后端忽略 page,避免死循环
|
||||||
|
if (
|
||||||
|
page > 1
|
||||||
|
&& acc.length
|
||||||
|
&& batch[0]
|
||||||
|
&& acc[0]
|
||||||
|
&& String(batch[0].id) === String(acc[0].id)
|
||||||
|
) {
|
||||||
|
return acc;
|
||||||
|
}
|
||||||
|
const merged = acc.concat(batch);
|
||||||
|
const total = !Array.isArray(res) && res != null ? Number(res.total) : NaN;
|
||||||
|
if (!Number.isNaN(total) && merged.length >= total) return merged;
|
||||||
|
if (batch.length < pageSize) return merged;
|
||||||
|
return loadPage(page + 1, merged);
|
||||||
|
});
|
||||||
|
return loadPage(1, []);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getFormStatusActionButtons(headerSaved, orderId, status) {
|
||||||
|
if (!headerSaved || !orderId) return [];
|
||||||
|
const s = toAuditStatus(status);
|
||||||
|
if (s === AUDIT_STATUS.APPROVED) {
|
||||||
|
return [{ label: '消审', action: 'unapprove' }];
|
||||||
|
}
|
||||||
|
if (!canScanAtStatus(s)) return [];
|
||||||
|
return [
|
||||||
|
{ label: '审核', action: 'approve' },
|
||||||
|
{ label: '作废', action: 'void' },
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getViewStatusActionButtons(status) {
|
||||||
|
const s = toAuditStatus(status);
|
||||||
|
if (s === AUDIT_STATUS.PENDING || s === AUDIT_STATUS.REJECTED) {
|
||||||
|
return [
|
||||||
|
{ label: '编辑', action: 'edit' },
|
||||||
|
{ label: '审核', action: 'approve' },
|
||||||
|
{ label: '作废', action: 'void' },
|
||||||
|
];
|
||||||
|
}
|
||||||
|
if (s === AUDIT_STATUS.APPROVED) {
|
||||||
|
return [{ label: '消审', action: 'unapprove' }];
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
export function orderToFormFields(order) {
|
||||||
|
return {
|
||||||
|
order_no: order.order_no,
|
||||||
|
biz_unit_id: order.biz_unit_id,
|
||||||
|
biz_unit_name: order.biz_unit_name,
|
||||||
|
warehouse_id: order.warehouse_id,
|
||||||
|
warehouse_name: order.warehouse_name,
|
||||||
|
sale_system_id: order.sale_system_id,
|
||||||
|
sale_system_name: order.sale_system_name,
|
||||||
|
sale_mode: order.sale_mode || '',
|
||||||
|
sale_mode_name: order.sale_mode_name || SALE_MODE_MAP[order.sale_mode] || '',
|
||||||
|
in_order_type: order.in_order_type || IN_ORDER_TYPE_PURCHASE,
|
||||||
|
in_order_type_name: order.in_order_type_name
|
||||||
|
|| IN_ORDER_TYPE_MAP[order.in_order_type]
|
||||||
|
|| IN_ORDER_TYPE_MAP[IN_ORDER_TYPE_PURCHASE],
|
||||||
|
paper_tube_weight: String(DEFAULT_PAPER_TUBE_WEIGHT),
|
||||||
|
package_weight: String(DEFAULT_PACKAGE_WEIGHT),
|
||||||
|
remark: order.remark,
|
||||||
|
item_data: order.item_data,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 从仓库下拉中选出默认成品仓 */
|
||||||
|
export function pickDefaultWarehouse(options, loginWarehouseId, loginWarehouseName) {
|
||||||
|
const list = options || [];
|
||||||
|
const byName = list.find((item) => item.label === DEFAULT_WAREHOUSE_NAME);
|
||||||
|
if (byName) return byName;
|
||||||
|
if (loginWarehouseId) {
|
||||||
|
const byId = list.find((item) => String(item.value) === String(loginWarehouseId));
|
||||||
|
if (byId) return byId;
|
||||||
|
if (loginWarehouseName) {
|
||||||
|
return { value: loginWarehouseId, label: loginWarehouseName };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list[0] || null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 确认并执行审核状态变更
|
||||||
|
*/
|
||||||
|
export function confirmOrderStatusAction(vm, { orderId, action, onSuccess }) {
|
||||||
|
const cfg = STATUS_ACTION_CONFIG[action];
|
||||||
|
if (!cfg || !orderId) return;
|
||||||
|
const api = vm.$u.api.fpmPrcInOrder;
|
||||||
|
const requestFn = api[cfg.apiKey];
|
||||||
|
if (typeof requestFn !== 'function') return;
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: cfg.msg,
|
||||||
|
success: (res) => {
|
||||||
|
if (!res.confirm) return;
|
||||||
|
uni.showLoading({ title: '处理中...' });
|
||||||
|
requestFn(buildStatusParam(orderId))
|
||||||
|
.then(() => {
|
||||||
|
if (typeof onSuccess === 'function') return onSuccess();
|
||||||
|
uni.hideLoading();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
uni.hideLoading();
|
||||||
|
if (vm.showError) vm.showError(e.message || '操作失败');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
/**
|
||||||
|
* Android PDA 语音播报(系统 TextToSpeech)
|
||||||
|
* App 端可用;非 App 环境静默跳过。
|
||||||
|
*/
|
||||||
|
let ttsInstance = null;
|
||||||
|
let ttsReady = false;
|
||||||
|
let ttsInitStarted = false;
|
||||||
|
const pendingQueue = [];
|
||||||
|
|
||||||
|
function flushPending() {
|
||||||
|
if (!ttsReady || !ttsInstance) return;
|
||||||
|
while (pendingQueue.length) {
|
||||||
|
const text = pendingQueue.shift();
|
||||||
|
doSpeak(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function doSpeak(text) {
|
||||||
|
if (!ttsInstance || !text) return;
|
||||||
|
try {
|
||||||
|
const TextToSpeech = plus.android.importClass('android.speech.tts.TextToSpeech');
|
||||||
|
// QUEUE_FLUSH:打断当前播报,立即播新内容
|
||||||
|
ttsInstance.speak(String(text), TextToSpeech.QUEUE_FLUSH, null);
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('[tts] speak failed', e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function initTts() {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
if (ttsInitStarted || typeof plus === 'undefined') return;
|
||||||
|
if (plus.os.name !== 'Android') return;
|
||||||
|
ttsInitStarted = true;
|
||||||
|
try {
|
||||||
|
const main = plus.android.runtimeMainActivity();
|
||||||
|
const TextToSpeech = plus.android.importClass('android.speech.tts.TextToSpeech');
|
||||||
|
const Locale = plus.android.importClass('java.util.Locale');
|
||||||
|
ttsInstance = new TextToSpeech(
|
||||||
|
main,
|
||||||
|
plus.android.implements('android.speech.tts.TextToSpeech$OnInitListener', {
|
||||||
|
onInit(status) {
|
||||||
|
if (status === TextToSpeech.SUCCESS) {
|
||||||
|
try {
|
||||||
|
ttsInstance.setLanguage(Locale.CHINA);
|
||||||
|
ttsInstance.setSpeechRate(1.0);
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('[tts] setLanguage failed', e);
|
||||||
|
}
|
||||||
|
ttsReady = true;
|
||||||
|
flushPending();
|
||||||
|
} else {
|
||||||
|
console.warn('[tts] init status not SUCCESS', status);
|
||||||
|
ttsReady = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('[tts] init failed', e);
|
||||||
|
ttsInitStarted = false;
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 播报中文文本;TTS 未就绪时先入队,初始化成功后补播。
|
||||||
|
* @param {string} text
|
||||||
|
*/
|
||||||
|
export function speak(text) {
|
||||||
|
const content = (text || '').trim();
|
||||||
|
if (!content) return;
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
if (typeof plus === 'undefined' || plus.os.name !== 'Android') return;
|
||||||
|
if (!ttsInitStarted) initTts();
|
||||||
|
if (ttsReady && ttsInstance) {
|
||||||
|
doSpeak(content);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
pendingQueue.push(content);
|
||||||
|
// 避免异常堆积
|
||||||
|
if (pendingQueue.length > 5) pendingQueue.splice(0, pendingQueue.length - 5);
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
|
|
||||||
|
export function stopSpeak() {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
if (!ttsInstance) return;
|
||||||
|
try {
|
||||||
|
ttsInstance.stop();
|
||||||
|
} catch (e) {
|
||||||
|
/* ignore */
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
@@ -0,0 +1,155 @@
|
|||||||
|
/**
|
||||||
|
* 登录会话:token、用户信息、菜单/按钮权限
|
||||||
|
*/
|
||||||
|
import store from '@/store/index.js';
|
||||||
|
|
||||||
|
const TOKEN_KEY = 'RemoteTokenData';
|
||||||
|
const USER_TOKEN_KEY = 'userToken';
|
||||||
|
const INFORMATION_KEY = 'PdaUserInformation';
|
||||||
|
|
||||||
|
function commitVuex(name, value) {
|
||||||
|
store.commit('$uStore', { name, value });
|
||||||
|
}
|
||||||
|
|
||||||
|
function applyGlobalData(patch) {
|
||||||
|
try {
|
||||||
|
const app = getApp();
|
||||||
|
if (!app || !app.globalData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Object.keys(patch).forEach((key) => {
|
||||||
|
app.globalData[key] = patch[key];
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
console.log('applyGlobalData error', e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getLoginData() {
|
||||||
|
return uni.getStorageSync(TOKEN_KEY) || null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getUserInformation() {
|
||||||
|
return uni.getStorageSync(INFORMATION_KEY) || null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function applyLoginData(loginData) {
|
||||||
|
if (!loginData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uni.setStorageSync(TOKEN_KEY, loginData);
|
||||||
|
uni.setStorageSync(USER_TOKEN_KEY, { Token: loginData.token });
|
||||||
|
if (loginData.token) {
|
||||||
|
commitVuex('vuex_token', loginData.token);
|
||||||
|
}
|
||||||
|
applyGlobalData({
|
||||||
|
Token: loginData.token || '',
|
||||||
|
EmployeeID: loginData.employee_id != null ? loginData.employee_id : (loginData.user_id || 0),
|
||||||
|
LoginID: loginData.user_id || 0,
|
||||||
|
LoginName: loginData.user_name || '',
|
||||||
|
UserName: loginData.user_name || '',
|
||||||
|
PlanDepartmentID: loginData.default_sale_system_id || 0,
|
||||||
|
PlanDepartmentName: loginData.default_sale_system_name || '',
|
||||||
|
StoreNameID: loginData.default_physical_warehouse_id || 0,
|
||||||
|
StoreName: loginData.default_physical_warehouse_name || '',
|
||||||
|
IsSaleUserStatus: 0,
|
||||||
|
UserGroup: '',
|
||||||
|
StoreTypeNo: ''
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function applyUserInformation(info) {
|
||||||
|
if (!info) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uni.setStorageSync(INFORMATION_KEY, info);
|
||||||
|
const profile = {
|
||||||
|
userName: info.user_name || '',
|
||||||
|
user_id: info.user_id,
|
||||||
|
user_name: info.user_name || '',
|
||||||
|
avatar: info.avatar_url || '',
|
||||||
|
avatar_url: info.avatar_url || '',
|
||||||
|
employee_id: info.employee_id,
|
||||||
|
department_id: info.department_id,
|
||||||
|
department_name: info.department_name || '',
|
||||||
|
phone: info.phone || '',
|
||||||
|
default_sale_system_id: info.default_sale_system_id,
|
||||||
|
default_sale_system_name: info.default_sale_system_name || '',
|
||||||
|
default_customer_id: info.default_customer_id,
|
||||||
|
default_customer_name: info.default_customer_name || '',
|
||||||
|
role_id: info.role_id || []
|
||||||
|
};
|
||||||
|
commitVuex('vuex_user', profile);
|
||||||
|
applyGlobalData({
|
||||||
|
EmployeeID: info.employee_id != null ? info.employee_id : (info.user_id || 0),
|
||||||
|
LoginID: info.user_id || 0,
|
||||||
|
LoginName: info.user_name || '',
|
||||||
|
UserName: info.user_name || '',
|
||||||
|
PlanDepartmentID: info.default_sale_system_id || 0,
|
||||||
|
PlanDepartmentName: info.default_sale_system_name || ''
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function restoreUserSession() {
|
||||||
|
const loginData = getLoginData();
|
||||||
|
if (loginData && loginData.token) {
|
||||||
|
applyLoginData(loginData);
|
||||||
|
}
|
||||||
|
const info = getUserInformation();
|
||||||
|
if (info) {
|
||||||
|
applyUserInformation(info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function clearUserSession() {
|
||||||
|
uni.removeStorageSync(TOKEN_KEY);
|
||||||
|
uni.removeStorageSync(USER_TOKEN_KEY);
|
||||||
|
uni.removeStorageSync(INFORMATION_KEY);
|
||||||
|
uni.removeStorageSync('token');
|
||||||
|
commitVuex('vuex_token', '');
|
||||||
|
commitVuex('vuex_user', {});
|
||||||
|
applyGlobalData({
|
||||||
|
Token: '',
|
||||||
|
EmployeeID: 0,
|
||||||
|
LoginID: 0,
|
||||||
|
LoginName: '',
|
||||||
|
UserName: '',
|
||||||
|
PlanDepartmentID: 0,
|
||||||
|
PlanDepartmentName: '',
|
||||||
|
StoreNameID: 0,
|
||||||
|
StoreName: '',
|
||||||
|
IsSaleUserStatus: 0,
|
||||||
|
UserGroup: '',
|
||||||
|
StoreTypeNo: ''
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function hasResourceRouter(name) {
|
||||||
|
if (!name) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
const info = getUserInformation();
|
||||||
|
if (!info) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
const names = info.resource_router_names;
|
||||||
|
if (!Array.isArray(names)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return names.indexOf(name) !== -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function hasButtonCode(code) {
|
||||||
|
if (!code) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
const info = getUserInformation();
|
||||||
|
if (!info) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
const codes = info.button_codes;
|
||||||
|
if (!Array.isArray(codes)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return codes.indexOf(code) !== -1;
|
||||||
|
}
|
||||||
+54
-55
@@ -2,6 +2,7 @@
|
|||||||
* 通用公共js库,主要定义api接口,auth apikey 常量值和通用函数
|
* 通用公共js库,主要定义api接口,auth apikey 常量值和通用函数
|
||||||
*/
|
*/
|
||||||
import store from '@/store/index.js';
|
import store from '@/store/index.js';
|
||||||
|
import { speak } from './tts.js';
|
||||||
|
|
||||||
// var apiurl = 'http://192.168.1.66:50002/hcscm/pda/v1/'; //开发环境 添
|
// var apiurl = 'http://192.168.1.66:50002/hcscm/pda/v1/'; //开发环境 添
|
||||||
// var apiurl = 'http://192.168.1.55:50002/hcscm/pda/v1/'; //开发环境 添
|
// var apiurl = 'http://192.168.1.55:50002/hcscm/pda/v1/'; //开发环境 添
|
||||||
@@ -332,7 +333,56 @@ function createAudio(src) {
|
|||||||
let successAudio = undefined;
|
let successAudio = undefined;
|
||||||
let errorAudio = undefined;
|
let errorAudio = undefined;
|
||||||
|
|
||||||
function playSuccessAudio() {
|
/** 审核类操作成功时的固定播报 */
|
||||||
|
function statusSuccessVoice(action) {
|
||||||
|
const map = {
|
||||||
|
approve: '审核成功',
|
||||||
|
void: '作废成功',
|
||||||
|
unapprove: '消审成功',
|
||||||
|
};
|
||||||
|
return map[action] || '操作成功';
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 成功/失败提示音约 0.9 秒,播完再朗读,避免提示音抢走语音 */
|
||||||
|
let speakFeedbackTimer = null;
|
||||||
|
|
||||||
|
function voiceContent(text, fallback) {
|
||||||
|
let content = String(text == null ? '' : text)
|
||||||
|
.replace(/[\r\n\t]/g, '')
|
||||||
|
.replace(/[!!。..??;;,,、]/g, '')
|
||||||
|
.trim();
|
||||||
|
if (!content || content.length > 32) content = fallback;
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearSpeakFeedbackTimer() {
|
||||||
|
if (!speakFeedbackTimer) return;
|
||||||
|
clearTimeout(speakFeedbackTimer);
|
||||||
|
speakFeedbackTimer = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function speakFeedback(text, fallback) {
|
||||||
|
const content = voiceContent(text, fallback);
|
||||||
|
clearSpeakFeedbackTimer();
|
||||||
|
speakFeedbackTimer = setTimeout(() => {
|
||||||
|
speakFeedbackTimer = null;
|
||||||
|
speak(content);
|
||||||
|
}, 1100);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 只播人声,不播提示音 */
|
||||||
|
function speakNow(text, fallback) {
|
||||||
|
clearSpeakFeedbackTimer();
|
||||||
|
if (successAudio) successAudio.stop();
|
||||||
|
speak(voiceContent(text, fallback));
|
||||||
|
}
|
||||||
|
|
||||||
|
function playSuccessAudio(text, options) {
|
||||||
|
if (options && options.voiceOnly) {
|
||||||
|
speakNow(text, '成功');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
speakFeedback(text, '成功');
|
||||||
if (!successAudio) {
|
if (!successAudio) {
|
||||||
//console.log("create success");
|
//console.log("create success");
|
||||||
successAudio = createAudio('/static/audio/appright.wav');
|
successAudio = createAudio('/static/audio/appright.wav');
|
||||||
@@ -349,7 +399,8 @@ function playSuccessAudio() {
|
|||||||
successAudio.play();
|
successAudio.play();
|
||||||
}
|
}
|
||||||
|
|
||||||
function playErrorAudio() {
|
function playErrorAudio(text) {
|
||||||
|
speakFeedback(text, '失败');
|
||||||
if (!errorAudio) {
|
if (!errorAudio) {
|
||||||
//console.log("create error");
|
//console.log("create error");
|
||||||
errorAudio = createAudio('/static/audio/apperror.wav');
|
errorAudio = createAudio('/static/audio/apperror.wav');
|
||||||
@@ -366,58 +417,6 @@ function playErrorAudio() {
|
|||||||
errorAudio.play();
|
errorAudio.play();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 固定中文提示语音
|
|
||||||
const SPEAK_AUDIO = {
|
|
||||||
'扫码出仓成功': '/static/audio/scan_out_ok.mp3',
|
|
||||||
'删除成功': '/static/audio/delete_ok.mp3',
|
|
||||||
'提交成功': '/static/audio/submit_ok.mp3',
|
|
||||||
'审核成功': '/static/audio/audit_ok.mp3',
|
|
||||||
'作废成功': '/static/audio/void_ok.mp3',
|
|
||||||
'扫码成功': '/static/audio/scan_ok.wav',
|
|
||||||
'进仓成功': '/static/audio/in_ok.wav',
|
|
||||||
};
|
|
||||||
|
|
||||||
const speakAudioMap = {};
|
|
||||||
|
|
||||||
function stopOtherSpeak(exceptText) {
|
|
||||||
Object.keys(speakAudioMap).forEach((key) => {
|
|
||||||
if (key === exceptText || !speakAudioMap[key]) return;
|
|
||||||
try {
|
|
||||||
speakAudioMap[key].stop();
|
|
||||||
} catch (e) {}
|
|
||||||
});
|
|
||||||
if (successAudio) {
|
|
||||||
try {
|
|
||||||
successAudio.stop();
|
|
||||||
} catch (e) {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function playSpeak(text) {
|
|
||||||
const src = SPEAK_AUDIO[text];
|
|
||||||
if (!src) return;
|
|
||||||
stopOtherSpeak(text);
|
|
||||||
const prev = speakAudioMap[text];
|
|
||||||
if (prev) {
|
|
||||||
try {
|
|
||||||
prev.stop();
|
|
||||||
prev.destroy();
|
|
||||||
} catch (e) {}
|
|
||||||
speakAudioMap[text] = undefined;
|
|
||||||
}
|
|
||||||
const audio = uni.createInnerAudioContext();
|
|
||||||
audio.autoplay = true;
|
|
||||||
audio.src = src;
|
|
||||||
audio.onError((res) => {
|
|
||||||
console.log('语音播放失败', text, res && res.errMsg);
|
|
||||||
try {
|
|
||||||
audio.destroy();
|
|
||||||
} catch (e) {}
|
|
||||||
if (speakAudioMap[text] === audio) speakAudioMap[text] = undefined;
|
|
||||||
});
|
|
||||||
speakAudioMap[text] = audio;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
get apiurl() {
|
get apiurl() {
|
||||||
@@ -430,5 +429,5 @@ export default {
|
|||||||
parGetData,
|
parGetData,
|
||||||
playSuccessAudio,
|
playSuccessAudio,
|
||||||
playErrorAudio,
|
playErrorAudio,
|
||||||
playSpeak,
|
statusSuccessVoice,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<view>{{ item.bill_type_name }}</view>
|
<view>{{ item.bill_type_name }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="cardRow">
|
<view class="cardRow">
|
||||||
<view>接收单位:</view>
|
<view>染厂:</view>
|
||||||
<view>{{ item.business_unit_name || '-' }}</view>
|
<view>{{ item.business_unit_name || '-' }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="cardRow">
|
<view class="cardRow">
|
||||||
@@ -46,21 +46,15 @@ export default {
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped lang="scss">
|
||||||
|
@import '@/common/status-tag.scss';
|
||||||
|
|
||||||
.cardTopName {
|
.cardTopName {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
gap: 16rpx;
|
||||||
|
overflow: visible;
|
||||||
|
white-space: normal;
|
||||||
}
|
}
|
||||||
.statusTag {
|
|
||||||
font-size: 24rpx;
|
|
||||||
padding: 4rpx 12rpx;
|
|
||||||
border-radius: 6rpx;
|
|
||||||
font-weight: normal;
|
|
||||||
}
|
|
||||||
.status-0 { background: #f0f0f0; color: #666; }
|
|
||||||
.status-1 { background: #fff7e6; color: #fa8c16; }
|
|
||||||
.status-2 { background: #f6ffed; color: #52c41a; }
|
|
||||||
.status-3 { background: #fff1f0; color: #f5222d; }
|
|
||||||
.status-4 { background: #f5f5f5; color: #999; }
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
<template>
|
||||||
|
<view class="myCard">
|
||||||
|
<view class="cardTopName">
|
||||||
|
<text>{{ item.order_no }}</text>
|
||||||
|
<text class="statusTag" :class="'status-' + item.audit_status">{{ item.audit_status_name }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="cardRow">
|
||||||
|
<view>加工单位:</view>
|
||||||
|
<view>{{ item.process_name || '-' }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="cardRow">
|
||||||
|
<view>仓库名称:</view>
|
||||||
|
<view>{{ item.warehouse_name || '-' }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="cardRow">
|
||||||
|
<view>匹数总计:</view>
|
||||||
|
<view>{{ item.total_roll != null ? item.total_roll : '-' }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="cardRow">
|
||||||
|
<view>创 建 人:</view>
|
||||||
|
<view>{{ item.create_user_name }} {{ formatTime(item.create_time, 'YYYY-MM-DD') }}</view>
|
||||||
|
</view>
|
||||||
|
<view v-if="item.auditor_name" class="cardRow">
|
||||||
|
<view>审 核 人:</view>
|
||||||
|
<view>{{ item.auditor_name }} {{ formatTime(item.audit_date, 'YYYY-MM-DD') }}</view>
|
||||||
|
</view>
|
||||||
|
<view v-if="!isDetail && !isSelect" class="lookDetail">
|
||||||
|
<text>查看详情</text>
|
||||||
|
<u-icon name="arrow-right" size="36" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { formatDisplayTime } from '@/common/storeGoodsProcessIn';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
item: { type: Object, default: () => ({}) },
|
||||||
|
index: { type: Number, default: 0 },
|
||||||
|
isSelect: { type: Boolean, default: false },
|
||||||
|
isDetail: { type: Boolean, default: false },
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
formatTime: formatDisplayTime,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
@import '@/common/status-tag.scss';
|
||||||
|
|
||||||
|
.cardTopName {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 16rpx;
|
||||||
|
overflow: visible;
|
||||||
|
white-space: normal;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
<template>
|
||||||
|
<view class="myCard">
|
||||||
|
<view class="cardTopName">
|
||||||
|
<text>{{ item.order_no }}</text>
|
||||||
|
<text class="statusTag" :class="'status-' + item.audit_status">{{ item.audit_status_name }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="cardRow">
|
||||||
|
<view>出仓类型:</view>
|
||||||
|
<view>{{ item.out_order_type_name || '-' }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="cardRow">
|
||||||
|
<view>加工单位:</view>
|
||||||
|
<view>{{ item.process_name || '-' }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="cardRow">
|
||||||
|
<view>仓库名称:</view>
|
||||||
|
<view>{{ item.warehouse_name || '-' }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="cardRow">
|
||||||
|
<view>匹数总计:</view>
|
||||||
|
<view>{{ item.total_roll != null ? item.total_roll : '-' }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="cardRow">
|
||||||
|
<view>创 建 人:</view>
|
||||||
|
<view>{{ item.create_user_name }} {{ formatTime(item.create_time, 'YYYY-MM-DD') }}</view>
|
||||||
|
</view>
|
||||||
|
<view v-if="item.auditor_name" class="cardRow">
|
||||||
|
<view>审 核 人:</view>
|
||||||
|
<view>{{ item.auditor_name }} {{ formatTime(item.audit_date, 'YYYY-MM-DD') }}</view>
|
||||||
|
</view>
|
||||||
|
<view v-if="!isDetail && !isSelect" class="lookDetail">
|
||||||
|
<text>查看详情</text>
|
||||||
|
<u-icon name="arrow-right" size="36" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { formatDisplayTime } from '@/common/storeGoodsProcessOut';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
item: { type: Object, default: () => ({}) },
|
||||||
|
index: { type: Number, default: 0 },
|
||||||
|
isSelect: { type: Boolean, default: false },
|
||||||
|
isDetail: { type: Boolean, default: false },
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
formatTime: formatDisplayTime,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
@import '@/common/status-tag.scss';
|
||||||
|
|
||||||
|
.cardTopName {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 16rpx;
|
||||||
|
overflow: visible;
|
||||||
|
white-space: normal;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
<template>
|
||||||
|
<view class="myCard">
|
||||||
|
<view class="cardTopName">
|
||||||
|
<text>{{ item.order_no }}</text>
|
||||||
|
<text class="statusTag" :class="'status-' + item.audit_status">{{ item.audit_status_name }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="cardRow">
|
||||||
|
<view>加工单位:</view>
|
||||||
|
<view>{{ item.process_name || '-' }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="cardRow">
|
||||||
|
<view>仓库名称:</view>
|
||||||
|
<view>{{ item.warehouse_name || '-' }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="cardRow">
|
||||||
|
<view>匹数总计:</view>
|
||||||
|
<view>{{ item.total_roll != null ? item.total_roll : '-' }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="cardRow">
|
||||||
|
<view>创 建 人:</view>
|
||||||
|
<view>{{ item.create_user_name }} {{ formatTime(item.create_time, 'YYYY-MM-DD') }}</view>
|
||||||
|
</view>
|
||||||
|
<view v-if="item.auditor_name" class="cardRow">
|
||||||
|
<view>审 核 人:</view>
|
||||||
|
<view>{{ item.auditor_name }} {{ formatTime(item.audit_date, 'YYYY-MM-DD') }}</view>
|
||||||
|
</view>
|
||||||
|
<view v-if="!isDetail && !isSelect" class="lookDetail">
|
||||||
|
<text>查看详情</text>
|
||||||
|
<u-icon name="arrow-right" size="36" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { formatDisplayTime } from '@/common/storeGoodsProcessReturnIn';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
item: { type: Object, default: () => ({}) },
|
||||||
|
index: { type: Number, default: 0 },
|
||||||
|
isSelect: { type: Boolean, default: false },
|
||||||
|
isDetail: { type: Boolean, default: false },
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
formatTime: formatDisplayTime,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
@import '@/common/status-tag.scss';
|
||||||
|
|
||||||
|
.cardTopName {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 16rpx;
|
||||||
|
overflow: visible;
|
||||||
|
white-space: normal;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
<template>
|
||||||
|
<view class="myCard">
|
||||||
|
<view class="cardTopName">
|
||||||
|
<text>{{ item.order_no }}</text>
|
||||||
|
<text class="statusTag" :class="'status-' + item.audit_status">{{ item.audit_status_name }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="cardRow">
|
||||||
|
<view>供 应 商:</view>
|
||||||
|
<view>{{ item.biz_unit_name || '-' }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="cardRow">
|
||||||
|
<view>仓库名称:</view>
|
||||||
|
<view>{{ item.warehouse_name || '-' }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="cardRow">
|
||||||
|
<view>匹数总计:</view>
|
||||||
|
<view>{{ item.total_roll != null ? item.total_roll : '-' }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="cardRow">
|
||||||
|
<view>创 建 人:</view>
|
||||||
|
<view>{{ item.create_user_name }} {{ formatTime(item.create_time, 'YYYY-MM-DD') }}</view>
|
||||||
|
</view>
|
||||||
|
<view v-if="item.auditor_name" class="cardRow">
|
||||||
|
<view>审 核 人:</view>
|
||||||
|
<view>{{ item.auditor_name }} {{ formatTime(item.audit_date, 'YYYY-MM-DD') }}</view>
|
||||||
|
</view>
|
||||||
|
<view v-if="!isDetail && !isSelect" class="lookDetail">
|
||||||
|
<text>查看详情</text>
|
||||||
|
<u-icon name="arrow-right" size="36" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { formatDisplayTime } from '@/common/storeGoodsPurchaseIn';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
item: { type: Object, default: () => ({}) },
|
||||||
|
index: { type: Number, default: 0 },
|
||||||
|
isSelect: { type: Boolean, default: false },
|
||||||
|
isDetail: { type: Boolean, default: false },
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
formatTime: formatDisplayTime,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
@import '@/common/status-tag.scss';
|
||||||
|
|
||||||
|
.cardTopName {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 16rpx;
|
||||||
|
overflow: visible;
|
||||||
|
white-space: normal;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
<text class="plus-barcode-panel__close" @click.stop="close">收起</text>
|
<text class="plus-barcode-panel__close" @click.stop="close">收起</text>
|
||||||
</view>
|
</view>
|
||||||
<!-- #ifdef APP-PLUS -->
|
<!-- #ifdef APP-PLUS -->
|
||||||
<view :id="holderId" class="plus-barcode-panel__holder" />
|
<view :id="barcodeViewId" class="plus-barcode-panel__holder" />
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
<!-- #ifndef APP-PLUS -->
|
<!-- #ifndef APP-PLUS -->
|
||||||
<view class="plus-barcode-panel__fallback">
|
<view class="plus-barcode-panel__fallback">
|
||||||
@@ -30,7 +30,6 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
barcodeSeq += 1;
|
barcodeSeq += 1;
|
||||||
return {
|
return {
|
||||||
holderId: `plusBarcodeHolder_${barcodeSeq}`,
|
|
||||||
barcodeViewId: `plusBarcodeView_${barcodeSeq}`,
|
barcodeViewId: `plusBarcodeView_${barcodeSeq}`,
|
||||||
_barcode: null,
|
_barcode: null,
|
||||||
_restartTimer: null,
|
_restartTimer: null,
|
||||||
@@ -77,6 +76,11 @@ export default {
|
|||||||
try {
|
try {
|
||||||
const pages = getCurrentPages();
|
const pages = getCurrentPages();
|
||||||
const page = pages[pages.length - 1];
|
const page = pages[pages.length - 1];
|
||||||
|
const vm = page && (page.$vm || page);
|
||||||
|
const scope = (vm && vm.$scope) || (page && page.$scope);
|
||||||
|
if (scope && typeof scope.$getAppWebview === 'function') {
|
||||||
|
return scope.$getAppWebview();
|
||||||
|
}
|
||||||
if (page && typeof page.$getAppWebview === 'function') {
|
if (page && typeof page.$getAppWebview === 'function') {
|
||||||
return page.$getAppWebview();
|
return page.$getAppWebview();
|
||||||
}
|
}
|
||||||
@@ -95,26 +99,44 @@ export default {
|
|||||||
}
|
}
|
||||||
this._creating = true;
|
this._creating = true;
|
||||||
this._active = true;
|
this._active = true;
|
||||||
// 等占位区域完成布局后再量位置,避免 Android 上 rect 为 0
|
// 等占位节点挂到页面后再创建,避免 view 层报 Not Found: Page[-1]
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (!this.visible || !this._active) {
|
if (!this.visible || !this._active) {
|
||||||
this._creating = false;
|
this._creating = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uni.createSelectorQuery()
|
this.measureHolder(0);
|
||||||
.in(this)
|
}, 200);
|
||||||
.select('.plus-barcode-panel__holder')
|
// #endif
|
||||||
.boundingClientRect((rect) => {
|
},
|
||||||
|
measureHolder(attempt) {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
const query = uni.createSelectorQuery().in(this);
|
||||||
|
query.select(`#${this.barcodeViewId}`)
|
||||||
|
.boundingClientRect((rect) => {
|
||||||
|
if (!this.visible || !this._active) {
|
||||||
this._creating = false;
|
this._creating = false;
|
||||||
if (!this.visible || !this._active) return;
|
return;
|
||||||
if (!rect || !rect.width || !rect.height) {
|
}
|
||||||
uni.showToast({ title: '扫码区域未就绪', icon: 'none' });
|
if (!rect || !rect.width || !rect.height) {
|
||||||
|
if (attempt < 8) {
|
||||||
|
setTimeout(() => this.measureHolder(attempt + 1), 150);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.createBarcode(rect);
|
const sys = uni.getSystemInfoSync();
|
||||||
})
|
this._creating = false;
|
||||||
.exec();
|
this.createBarcode({
|
||||||
}, 80);
|
top: (sys.statusBarHeight || 0) + 44,
|
||||||
|
left: 0,
|
||||||
|
width: sys.windowWidth || 300,
|
||||||
|
height: 220,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this._creating = false;
|
||||||
|
this.createBarcode(rect);
|
||||||
|
})
|
||||||
|
.exec();
|
||||||
// #endif
|
// #endif
|
||||||
},
|
},
|
||||||
createBarcode(rect) {
|
createBarcode(rect) {
|
||||||
@@ -125,15 +147,20 @@ export default {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.destroyNative(false);
|
this.destroyNative(false);
|
||||||
|
const width = Math.max(Math.round(rect.width), 1);
|
||||||
|
const height = Math.max(Math.round(rect.height), 1);
|
||||||
|
const top = Math.max(0, Math.round(rect.top || 0));
|
||||||
|
const left = Math.max(0, Math.round(rect.left || 0));
|
||||||
try {
|
try {
|
||||||
|
// 使用独立 id 覆盖在占位区域上,避免和页面节点 id 冲突导致 Not Found
|
||||||
const barcode = plus.barcode.create(
|
const barcode = plus.barcode.create(
|
||||||
this.barcodeViewId,
|
`plusBarcodeNative_${Date.now()}`,
|
||||||
this.filters && this.filters.length ? this.filters : DEFAULT_FILTERS,
|
this.filters && this.filters.length ? this.filters : DEFAULT_FILTERS,
|
||||||
{
|
{
|
||||||
top: `${Math.round(rect.top)}px`,
|
top: `${top}px`,
|
||||||
left: `${Math.round(rect.left)}px`,
|
left: `${left}px`,
|
||||||
width: `${Math.round(rect.width)}px`,
|
width: `${width}px`,
|
||||||
height: `${Math.round(rect.height)}px`,
|
height: `${height}px`,
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
background: '#000000',
|
background: '#000000',
|
||||||
frameColor: '#2979ff',
|
frameColor: '#2979ff',
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ export default {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
.popupTitle {
|
.popupTitle {
|
||||||
font-size: 32rpx;
|
font-size: 34rpx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin-bottom: 20rpx;
|
margin-bottom: 20rpx;
|
||||||
@@ -58,7 +58,7 @@ export default {
|
|||||||
display: flex;
|
display: flex;
|
||||||
padding: 16rpx 0;
|
padding: 16rpx 0;
|
||||||
border-bottom: 1rpx solid #f0f0f0;
|
border-bottom: 1rpx solid #f0f0f0;
|
||||||
font-size: 28rpx;
|
font-size: 30rpx;
|
||||||
}
|
}
|
||||||
.label {
|
.label {
|
||||||
width: 180rpx;
|
width: 180rpx;
|
||||||
|
|||||||
@@ -1,36 +1,135 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<view v-if="title" class="fabric-out-sectionTitle">{{ title }}</view>
|
<view class="summary-title">{{ title }}</view>
|
||||||
<slot name="before-list" />
|
<slot name="before-list" />
|
||||||
<view class="fabric-out-detailList">
|
<view class="summary-wrap">
|
||||||
<view
|
<scroll-view scroll-x class="summary-scroll">
|
||||||
v-for="row in list"
|
<t-table v-if="list.length" border="1" border-color="#e5e5e5" :style="{ width: tableWidth }">
|
||||||
:key="row.group_key || row.id"
|
<t-tr class="summary-head" font-size="18" color="#666666" align="left">
|
||||||
class="fabric-out-detailCard"
|
<t-th v-for="col in columns" :key="col.key" :style="cellStyle(col)">{{ col.label }}</t-th>
|
||||||
>
|
</t-tr>
|
||||||
<view class="fabric-out-detailRow" @click="$emit('fabric-info', row)">
|
<t-tr
|
||||||
<text>{{ row.grey_fabric_code }}#{{ row.grey_fabric_name }}</text>
|
v-for="row in list"
|
||||||
<u-icon name="arrow-right" size="32" color="#888" />
|
:key="row.group_key || row.id"
|
||||||
</view>
|
font-size="18"
|
||||||
<view class="fabric-out-detailMeta">
|
color="#333333"
|
||||||
<text>匹数:{{ row.roll }}</text>
|
align="left"
|
||||||
<text>重量:{{ row.weight }}KG</text>
|
@click="$emit('fabric-info', row)"
|
||||||
<u-button type="primary" size="mini" @click="$emit('fine-code', row)">细码</u-button>
|
>
|
||||||
</view>
|
<t-td :style="cellStyle(columns[0])">{{ row.grey_fabric_code || '-' }}</t-td>
|
||||||
</view>
|
<t-td :style="cellStyle(columns[1])">{{ row.grey_fabric_name || '-' }}</t-td>
|
||||||
|
<t-td :style="cellStyle(columns[2])">{{ displayNum(row.roll) }}</t-td>
|
||||||
|
<t-td :style="cellStyle(columns[3])">{{ displayNum(row.weight) }}</t-td>
|
||||||
|
<t-td class="summary-action" :style="cellStyle(columns[4])" @click.stop="$emit('fine-code', row)">细码</t-td>
|
||||||
|
</t-tr>
|
||||||
|
<t-tr class="summary-total" font-size="18" color="#333333" align="left">
|
||||||
|
<t-td :style="cellStyle(columns[0])">合计</t-td>
|
||||||
|
<t-td :style="cellStyle(columns[1])"></t-td>
|
||||||
|
<t-td :style="cellStyle(columns[2])">{{ totalRoll }}</t-td>
|
||||||
|
<t-td :style="cellStyle(columns[3])">{{ totalWeight }}</t-td>
|
||||||
|
<t-td :style="cellStyle(columns[4])"></t-td>
|
||||||
|
</t-tr>
|
||||||
|
</t-table>
|
||||||
|
<view v-else class="summary-empty">暂无出仓明细</view>
|
||||||
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import tTable from '@/components/t-table/t-table.vue';
|
||||||
|
import tTh from '@/components/t-table/t-th.vue';
|
||||||
|
import tTr from '@/components/t-table/t-tr.vue';
|
||||||
|
import tTd from '@/components/t-table/t-td.vue';
|
||||||
|
|
||||||
|
const COLUMNS = [
|
||||||
|
{ key: 'grey_fabric_code', label: '坯布编号', width: 220 },
|
||||||
|
{ key: 'grey_fabric_name', label: '坯布名称', width: 260 },
|
||||||
|
{ key: 'roll', label: '匹数', width: 140 },
|
||||||
|
{ key: 'weight', label: '重量', width: 160 },
|
||||||
|
{ key: 'action', label: '操作', width: 140 },
|
||||||
|
];
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
components: { tTable, tTh, tTr, tTd },
|
||||||
props: {
|
props: {
|
||||||
list: { type: Array, default: () => [] },
|
list: { type: Array, default: () => [] },
|
||||||
title: { type: String, default: '' },
|
title: { type: String, default: '出仓细码' },
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
columns() {
|
||||||
|
return COLUMNS;
|
||||||
|
},
|
||||||
|
tableWidth() {
|
||||||
|
const total = COLUMNS.reduce((sum, col) => sum + col.width, 0);
|
||||||
|
return `${total}rpx`;
|
||||||
|
},
|
||||||
|
totalRoll() {
|
||||||
|
return this.sumField('roll');
|
||||||
|
},
|
||||||
|
totalWeight() {
|
||||||
|
return this.sumField('weight');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
cellStyle(col) {
|
||||||
|
const width = `${col.width}rpx`;
|
||||||
|
return {
|
||||||
|
width,
|
||||||
|
minWidth: width,
|
||||||
|
maxWidth: width,
|
||||||
|
flex: `0 0 ${width}`,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
displayNum(val) {
|
||||||
|
if (val === 0) return '0';
|
||||||
|
return val != null && val !== '' ? val : '-';
|
||||||
|
},
|
||||||
|
sumField(key) {
|
||||||
|
const total = (this.list || []).reduce((sum, row) => sum + Number(row[key] || 0), 0);
|
||||||
|
return Number(total.toFixed(2));
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@import '@/pages/storefabric/storeFabricBusinessOutPage.scss';
|
@import '@/common/pda-typography.scss';
|
||||||
|
|
||||||
|
.summary-title {
|
||||||
|
font-size: $pda-font-body;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 24rpx 26rpx 12rpx;
|
||||||
|
border-left: 6rpx solid #007AFF;
|
||||||
|
margin: 20rpx 26rpx 0;
|
||||||
|
}
|
||||||
|
.summary-wrap {
|
||||||
|
margin: 0 26rpx 16rpx;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.summary-scroll {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
::v-deep .t-th,
|
||||||
|
::v-deep .t-td {
|
||||||
|
box-sizing: border-box;
|
||||||
|
min-height: $pda-row-min-height;
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
::v-deep .summary-head {
|
||||||
|
background: #f7f8fa;
|
||||||
|
}
|
||||||
|
::v-deep .summary-total {
|
||||||
|
background: #fff7e6;
|
||||||
|
}
|
||||||
|
::v-deep .summary-action {
|
||||||
|
color: #2979ff;
|
||||||
|
}
|
||||||
|
.summary-empty {
|
||||||
|
padding: 28rpx 16rpx;
|
||||||
|
font-size: $pda-font-placeholder;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -11,19 +11,18 @@
|
|||||||
@confirm="$emit('scan')"
|
@confirm="$emit('scan')"
|
||||||
/>
|
/>
|
||||||
<view
|
<view
|
||||||
v-if="scanning"
|
v-if="showPhoneScan && scanning"
|
||||||
class="fabric-out-scanClose"
|
class="fabric-out-scanClose"
|
||||||
@click.stop="$emit('phone-scan')"
|
@click.stop="$emit('phone-scan')"
|
||||||
>
|
>关闭扫码</view>
|
||||||
关闭扫码
|
<u-icon
|
||||||
</view>
|
v-else-if="showPhoneScan"
|
||||||
<view
|
class="fabric-out-phoneScanIcon"
|
||||||
v-else
|
name="scan"
|
||||||
class="fabric-out-toolbarIcon"
|
size="44"
|
||||||
@click.stop="$emit('phone-scan')"
|
color="#2979ff"
|
||||||
>
|
@click="$emit('phone-scan')"
|
||||||
<u-icon name="scan" size="44" color="#595959" />
|
/>
|
||||||
</view>
|
|
||||||
<checkbox-group @change="$emit('delete-mode-change', $event)">
|
<checkbox-group @change="$emit('delete-mode-change', $event)">
|
||||||
<label class="fabric-out-delCheck">
|
<label class="fabric-out-delCheck">
|
||||||
<checkbox :checked="deleteMode" />删除
|
<checkbox :checked="deleteMode" />删除
|
||||||
@@ -43,6 +42,7 @@ export default {
|
|||||||
deleteMode: { type: Boolean, default: false },
|
deleteMode: { type: Boolean, default: false },
|
||||||
message: { type: String, default: '' },
|
message: { type: String, default: '' },
|
||||||
disabledTip: { type: String, default: '当前状态不可扫码' },
|
disabledTip: { type: String, default: '当前状态不可扫码' },
|
||||||
|
showPhoneScan: { type: Boolean, default: false },
|
||||||
scanning: { type: Boolean, default: false },
|
scanning: { type: Boolean, default: false },
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -52,16 +52,8 @@ export default {
|
|||||||
@import '@/pages/storefabric/storeFabricBusinessOutPage.scss';
|
@import '@/pages/storefabric/storeFabricBusinessOutPage.scss';
|
||||||
@import '@/common/pda-typography.scss';
|
@import '@/common/pda-typography.scss';
|
||||||
|
|
||||||
.fabric-out-toolbarIcon {
|
.fabric-out-phoneScanIcon {
|
||||||
display: flex;
|
margin-left: 16rpx;
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
width: 72rpx;
|
|
||||||
height: 72rpx;
|
|
||||||
margin-left: 8rpx;
|
|
||||||
border-radius: 8rpx;
|
|
||||||
border: 1rpx solid #d9d9d9;
|
|
||||||
background: #f7f7f7;
|
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
.fabric-out-scanClose {
|
.fabric-out-scanClose {
|
||||||
|
|||||||
@@ -12,14 +12,12 @@
|
|||||||
<text class="fabric-out-scanDetailLabel">客户:</text>
|
<text class="fabric-out-scanDetailLabel">客户:</text>
|
||||||
<text class="fabric-out-scanDetailValue">{{ detail.customer_name || '' }}</text>
|
<text class="fabric-out-scanDetailValue">{{ detail.customer_name || '' }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="fabric-out-scanDetailRow">
|
<view class="fabric-out-scanDetailRow fabric-out-scanDetailRow--2col">
|
||||||
<view class="fabric-out-scanDetailCheck" @click="toggleGroup('produce_order_no')">
|
<view class="fabric-out-scanDetailCheck" @click="toggleGroup('produce_order_no')">
|
||||||
<checkbox :checked="isGroupChecked('produce_order_no')" />
|
<checkbox :checked="isGroupChecked('produce_order_no')" />
|
||||||
<text class="fabric-out-scanDetailLabel">生产通知单:</text>
|
<text class="fabric-out-scanDetailLabel">生产通知单:</text>
|
||||||
<text class="fabric-out-scanDetailValue">{{ detail.produce_order_no || '' }}</text>
|
<text class="fabric-out-scanDetailValue">{{ detail.produce_order_no || '' }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
|
||||||
<view class="fabric-out-scanDetailRow">
|
|
||||||
<view class="fabric-out-scanDetailCheck" @click="toggleGroup('grey_fabric_code')">
|
<view class="fabric-out-scanDetailCheck" @click="toggleGroup('grey_fabric_code')">
|
||||||
<checkbox :checked="isGroupChecked('grey_fabric_code')" />
|
<checkbox :checked="isGroupChecked('grey_fabric_code')" />
|
||||||
<text class="fabric-out-scanDetailLabel">布编:</text>
|
<text class="fabric-out-scanDetailLabel">布编:</text>
|
||||||
@@ -43,12 +41,15 @@
|
|||||||
<text class="fabric-out-scanDetailLabel">机号:</text>
|
<text class="fabric-out-scanDetailLabel">机号:</text>
|
||||||
<text class="fabric-out-scanDetailValue">{{ detail.machine_number || '' }}</text>
|
<text class="fabric-out-scanDetailValue">{{ detail.machine_number || '' }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="fabric-out-scanDetailCheck" @click="toggleGroup('volume_number')">
|
<view class="fabric-out-scanDetailCell">
|
||||||
<checkbox :checked="isGroupChecked('volume_number')" />
|
|
||||||
<text class="fabric-out-scanDetailLabel">布号:</text>
|
<text class="fabric-out-scanDetailLabel">布号:</text>
|
||||||
<text class="fabric-out-scanDetailValue">{{ detail.volume_number || '' }}</text>
|
<text class="fabric-out-scanDetailValue">{{ detail.volume_number || '' }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="fabric-out-scanDetailRow">
|
||||||
|
<text class="fabric-out-scanDetailLabel">外部卷号:</text>
|
||||||
|
<text class="fabric-out-scanDetailValue">{{ detail.extern_volume_number || '-' }}</text>
|
||||||
|
</view>
|
||||||
<view class="fabric-out-scanDetailRow fabric-out-scanDetailRow--2col">
|
<view class="fabric-out-scanDetailRow fabric-out-scanDetailRow--2col">
|
||||||
<view class="fabric-out-scanDetailCheck" @click="toggleGroup('grey_fabric_level_name')">
|
<view class="fabric-out-scanDetailCheck" @click="toggleGroup('grey_fabric_level_name')">
|
||||||
<checkbox :checked="isGroupChecked('grey_fabric_level_name')" />
|
<checkbox :checked="isGroupChecked('grey_fabric_level_name')" />
|
||||||
@@ -60,20 +61,75 @@
|
|||||||
<text class="fabric-out-scanDetailValue">{{ formatWeight(detail.weight) }}Kg</text>
|
<text class="fabric-out-scanDetailValue">{{ formatWeight(detail.weight) }}Kg</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<scroll-view scroll-x class="fabric-out-scanDetailTableScroll">
|
||||||
|
<view class="fabric-out-scanDetailTable" :style="{ width: tableWidth }">
|
||||||
|
<view class="fabric-out-scanDetailTableRow fabric-out-scanDetailTableHead">
|
||||||
|
<view
|
||||||
|
v-for="col in columns"
|
||||||
|
:key="col.key"
|
||||||
|
class="fabric-out-scanDetailTableCell"
|
||||||
|
:style="cellStyle(col)"
|
||||||
|
>{{ col.label }}</view>
|
||||||
|
</view>
|
||||||
|
<view v-if="!tableRows.length" class="fabric-out-scanDetailEmpty">暂无数据~~</view>
|
||||||
|
<view
|
||||||
|
v-for="(row, rowIndex) in tableRows"
|
||||||
|
:key="rowIndex"
|
||||||
|
class="fabric-out-scanDetailTableRow"
|
||||||
|
>
|
||||||
|
<view
|
||||||
|
v-for="col in columns"
|
||||||
|
:key="col.key"
|
||||||
|
class="fabric-out-scanDetailTableCell"
|
||||||
|
:style="cellStyle(col)"
|
||||||
|
>{{ formatCell(row, col.key) }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import {
|
||||||
|
SCAN_DETAIL_TABLE_COLUMNS,
|
||||||
|
SCAN_GROUP_OPTIONS,
|
||||||
|
getScanDetailTableWidth,
|
||||||
|
buildScanDetailTableRows,
|
||||||
|
} from '@/common/storeFabricBusinessOut';
|
||||||
|
|
||||||
|
const LOCKABLE_GROUP_KEYS = SCAN_GROUP_OPTIONS.map((item) => item.key);
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
detail: { type: Object, default: () => ({}) },
|
detail: { type: Object, default: () => ({}) },
|
||||||
|
itemData: { type: Array, default: () => [] },
|
||||||
groupKeys: { type: Array, default: () => [] },
|
groupKeys: { type: Array, default: () => [] },
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
columns() {
|
||||||
|
return SCAN_DETAIL_TABLE_COLUMNS;
|
||||||
|
},
|
||||||
|
tableWidth() {
|
||||||
|
return getScanDetailTableWidth(this.columns);
|
||||||
|
},
|
||||||
|
tableRows() {
|
||||||
|
return buildScanDetailTableRows(this.itemData, this.groupKeys);
|
||||||
|
},
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
cellStyle(col) {
|
||||||
|
return {
|
||||||
|
width: `${col.width}rpx`,
|
||||||
|
minWidth: `${col.width}rpx`,
|
||||||
|
maxWidth: `${col.width}rpx`,
|
||||||
|
};
|
||||||
|
},
|
||||||
isGroupChecked(key) {
|
isGroupChecked(key) {
|
||||||
return (this.groupKeys || []).includes(key);
|
return (this.groupKeys || []).includes(key);
|
||||||
},
|
},
|
||||||
toggleGroup(key) {
|
toggleGroup(key) {
|
||||||
|
if (!LOCKABLE_GROUP_KEYS.includes(key)) return;
|
||||||
const next = [...(this.groupKeys || [])];
|
const next = [...(this.groupKeys || [])];
|
||||||
const index = next.indexOf(key);
|
const index = next.indexOf(key);
|
||||||
if (index >= 0) next.splice(index, 1);
|
if (index >= 0) next.splice(index, 1);
|
||||||
@@ -91,6 +147,11 @@ export default {
|
|||||||
const n = Number(value || 0);
|
const n = Number(value || 0);
|
||||||
return Number(n.toFixed(2));
|
return Number(n.toFixed(2));
|
||||||
},
|
},
|
||||||
|
formatCell(row, key) {
|
||||||
|
if (key === 'roll') return this.formatRoll(row.roll);
|
||||||
|
if (key === 'weight') return this.formatWeight(row.weight);
|
||||||
|
return row[key] || '';
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,140 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view class="fabric-out-summary">
|
|
||||||
<scroll-view scroll-x class="fabric-out-summaryScroll">
|
|
||||||
<view class="fabric-out-summaryInner" :style="{ width: tableWidth }">
|
|
||||||
<t-table border="1" border-color="#e1e1e1">
|
|
||||||
<t-tr font-size="18" color="#3e3e3e" align="center">
|
|
||||||
<t-th
|
|
||||||
v-for="col in headers"
|
|
||||||
:key="col.key"
|
|
||||||
align="center"
|
|
||||||
>
|
|
||||||
<view class="fabric-out-th" :style="cellStyle(col)">{{ col.label }}</view>
|
|
||||||
</t-th>
|
|
||||||
</t-tr>
|
|
||||||
<t-tr
|
|
||||||
v-for="(row, rowIndex) in contents"
|
|
||||||
:key="row.group_key || rowIndex"
|
|
||||||
font-size="18"
|
|
||||||
color="#333"
|
|
||||||
align="center"
|
|
||||||
>
|
|
||||||
<t-td
|
|
||||||
v-for="col in headers"
|
|
||||||
:key="col.key"
|
|
||||||
align="center"
|
|
||||||
>
|
|
||||||
<view
|
|
||||||
class="fabric-out-td"
|
|
||||||
:style="cellStyle(col)"
|
|
||||||
@click="onCellClick(col.key, row)"
|
|
||||||
>{{ formatCell(row, col.key) }}</view>
|
|
||||||
</t-td>
|
|
||||||
</t-tr>
|
|
||||||
</t-table>
|
|
||||||
</view>
|
|
||||||
</scroll-view>
|
|
||||||
<view v-if="!contents.length" class="fabric-out-summaryEmpty">暂无数据~~</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import tTable from '@/components/t-table/t-table.vue';
|
|
||||||
import tTr from '@/components/t-table/t-tr.vue';
|
|
||||||
import tTh from '@/components/t-table/t-th.vue';
|
|
||||||
import tTd from '@/components/t-table/t-td.vue';
|
|
||||||
import { SUMMARY_TABLE_COLUMNS } from '@/common/storeFabricBusinessOut';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
components: { tTable, tTr, tTh, tTd },
|
|
||||||
props: {
|
|
||||||
rows: { type: Array, default: () => [] },
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
headers() {
|
|
||||||
return SUMMARY_TABLE_COLUMNS;
|
|
||||||
},
|
|
||||||
tableWidth() {
|
|
||||||
const total = this.headers.reduce((sum, col) => sum + (col.width || 160), 0);
|
|
||||||
return `${total}rpx`;
|
|
||||||
},
|
|
||||||
contents() {
|
|
||||||
return (this.rows || []).map((row) => ({
|
|
||||||
...row,
|
|
||||||
grey_fabric_code: row.grey_fabric_code || '',
|
|
||||||
grey_fabric_name: row.grey_fabric_name || '',
|
|
||||||
yarn_batch: row.yarn_batch || '',
|
|
||||||
machine_number: row.machine_number || '',
|
|
||||||
roll: row.roll != null && row.roll !== '' ? String(row.roll) : '0',
|
|
||||||
weight: row.weight != null && row.weight !== '' ? String(row.weight) : '0',
|
|
||||||
}));
|
|
||||||
},
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
cellStyle(col) {
|
|
||||||
const width = `${col.width || 160}rpx`;
|
|
||||||
return {
|
|
||||||
width,
|
|
||||||
minWidth: width,
|
|
||||||
maxWidth: width,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
formatCell(row, key) {
|
|
||||||
const val = row[key];
|
|
||||||
if (val === 0) return '0';
|
|
||||||
return val != null && val !== '' ? val : '-';
|
|
||||||
},
|
|
||||||
onCellClick(key, row) {
|
|
||||||
this.$emit('cell-click', { key, lineData: row });
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped lang="scss">
|
|
||||||
@import '@/common/pda-typography.scss';
|
|
||||||
|
|
||||||
.fabric-out-summary {
|
|
||||||
background: #fff;
|
|
||||||
margin-top: 16rpx;
|
|
||||||
}
|
|
||||||
.fabric-out-summaryScroll {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
.fabric-out-summaryInner {
|
|
||||||
min-width: 100%;
|
|
||||||
}
|
|
||||||
.fabric-out-summary ::v-deep .t-table {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
.fabric-out-summary ::v-deep .t-th,
|
|
||||||
.fabric-out-summary ::v-deep .t-td {
|
|
||||||
flex: 0 0 auto;
|
|
||||||
width: auto;
|
|
||||||
padding: 0;
|
|
||||||
min-height: $pda-row-min-height;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
.fabric-out-th,
|
|
||||||
.fabric-out-td {
|
|
||||||
box-sizing: border-box;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
min-height: $pda-row-min-height;
|
|
||||||
padding: 16rpx 12rpx;
|
|
||||||
font-size: $pda-font-body;
|
|
||||||
word-break: break-all;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
.fabric-out-th {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
.fabric-out-summaryEmpty {
|
|
||||||
text-align: center;
|
|
||||||
color: #999;
|
|
||||||
font-size: $pda-font-body;
|
|
||||||
line-height: $pda-row-min-height;
|
|
||||||
background: #fff;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -21,17 +21,11 @@
|
|||||||
:class="{ actionCell: col.key === 'action' && !readonly }"
|
:class="{ actionCell: col.key === 'action' && !readonly }"
|
||||||
:style="cellStyle(col)"
|
:style="cellStyle(col)"
|
||||||
@click="onCellTap(col.key, rowIndex)"
|
@click="onCellTap(col.key, rowIndex)"
|
||||||
>
|
>{{ row[col.key] }}</view>
|
||||||
<text
|
|
||||||
v-if="col.key === 'action' && !readonly"
|
|
||||||
class="deleteBtn"
|
|
||||||
>{{ row[col.key] }}</text>
|
|
||||||
<template v-else>{{ row[col.key] }}</template>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
<view v-if="!readonly && list.length" class="tableTip">点击「删除」将调用扫码删除接口</view>
|
<view v-if="!readonly && list.length" class="tableTip">点击「操作」列删除,将调用扫码删除接口</view>
|
||||||
</view>
|
</view>
|
||||||
</u-popup>
|
</u-popup>
|
||||||
</template>
|
</template>
|
||||||
@@ -64,10 +58,10 @@ export default {
|
|||||||
return getFineCodeTableWidth(this.columns);
|
return getFineCodeTableWidth(this.columns);
|
||||||
},
|
},
|
||||||
tableScrollHeight() {
|
tableScrollHeight() {
|
||||||
const rowHeight = 56;
|
const rowHeight = 68;
|
||||||
const headerHeight = 56;
|
const headerHeight = 68;
|
||||||
const total = headerHeight + this.list.length * rowHeight;
|
const total = headerHeight + this.list.length * rowHeight;
|
||||||
return `${Math.min(Math.max(total, 112), 480)}rpx`;
|
return `${Math.min(Math.max(total, 136), 520)}rpx`;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -87,11 +81,9 @@ export default {
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped>
|
||||||
@import '@/common/pda-typography.scss';
|
|
||||||
|
|
||||||
.popupWrap {
|
.popupWrap {
|
||||||
padding: 28rpx 16rpx 32rpx;
|
padding: 24rpx 16rpx 30rpx;
|
||||||
max-height: 80vh;
|
max-height: 80vh;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -99,18 +91,18 @@ export default {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
.popupTitle {
|
.popupTitle {
|
||||||
font-size: $pda-font-popup-title;
|
font-size: 34rpx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin-bottom: 24rpx;
|
margin-bottom: 20rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
.emptyTip {
|
.emptyTip {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: #999;
|
color: #999;
|
||||||
padding: 48rpx 0;
|
padding: 40rpx 0;
|
||||||
font-size: $pda-font-popup-sub;
|
font-size: 30rpx;
|
||||||
}
|
}
|
||||||
.tableScroll {
|
.tableScroll {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -126,7 +118,6 @@ export default {
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
flex-wrap: nowrap;
|
flex-wrap: nowrap;
|
||||||
align-items: stretch;
|
|
||||||
border-bottom: 1rpx solid #e1e1e1;
|
border-bottom: 1rpx solid #e1e1e1;
|
||||||
}
|
}
|
||||||
.tableRow:last-child {
|
.tableRow:last-child {
|
||||||
@@ -140,12 +131,8 @@ export default {
|
|||||||
}
|
}
|
||||||
.tableCell {
|
.tableCell {
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
min-height: $pda-row-min-height;
|
|
||||||
padding: 16rpx 10rpx;
|
padding: 16rpx 10rpx;
|
||||||
font-size: $pda-font-popup-item;
|
font-size: 28rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
border-right: 1rpx solid #e1e1e1;
|
border-right: 1rpx solid #e1e1e1;
|
||||||
@@ -159,28 +146,13 @@ export default {
|
|||||||
.headCell {
|
.headCell {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: #3e3e3e;
|
color: #3e3e3e;
|
||||||
min-height: 80rpx;
|
|
||||||
}
|
}
|
||||||
.actionCell {
|
.actionCell {
|
||||||
padding: 12rpx 8rpx;
|
|
||||||
}
|
|
||||||
.deleteBtn {
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
min-width: 120rpx;
|
|
||||||
min-height: 72rpx;
|
|
||||||
padding: 0 20rpx;
|
|
||||||
border-radius: 8rpx;
|
|
||||||
background: #fff1f0;
|
|
||||||
border: 1rpx solid #ffa39e;
|
|
||||||
color: #f5222d;
|
color: #f5222d;
|
||||||
font-size: $pda-font-action;
|
|
||||||
line-height: 1.2;
|
|
||||||
}
|
}
|
||||||
.tableTip {
|
.tableTip {
|
||||||
margin-top: 20rpx;
|
margin-top: 16rpx;
|
||||||
font-size: $pda-font-popup-sub;
|
font-size: 26rpx;
|
||||||
color: #999;
|
color: #999;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
<template>
|
||||||
|
<view class="order-header-fold">
|
||||||
|
<view class="order-header-fold__bar" @click="toggle">
|
||||||
|
<text class="order-header-fold__title">单据信息</text>
|
||||||
|
<text v-if="summary" class="order-header-fold__summary">{{ summary }}</text>
|
||||||
|
<text class="order-header-fold__action">{{ value ? '展开' : '收起' }}</text>
|
||||||
|
</view>
|
||||||
|
<view v-show="!value">
|
||||||
|
<slot />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
value: { type: Boolean, default: false },
|
||||||
|
summary: { type: String, default: '' },
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
toggle() {
|
||||||
|
this.$emit('input', !this.value);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
@import '@/common/pda-typography.scss';
|
||||||
|
|
||||||
|
.order-header-fold__bar {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
min-height: $pda-row-min-height;
|
||||||
|
margin: 16rpx 26rpx 0;
|
||||||
|
padding: 0 24rpx;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
}
|
||||||
|
.order-header-fold__title {
|
||||||
|
font-size: $pda-font-body;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #1a1a1a;
|
||||||
|
}
|
||||||
|
.order-header-fold__summary {
|
||||||
|
flex: 1;
|
||||||
|
margin-left: 16rpx;
|
||||||
|
font-size: $pda-font-action;
|
||||||
|
color: #666;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.order-header-fold__action {
|
||||||
|
margin-left: auto;
|
||||||
|
padding-left: 16rpx;
|
||||||
|
font-size: $pda-font-action;
|
||||||
|
color: #2979ff;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -22,7 +22,9 @@ export default {
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped lang="scss">
|
||||||
|
@import '@/common/status-tag.scss';
|
||||||
|
|
||||||
.statusRow {
|
.statusRow {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -32,18 +34,7 @@ export default {
|
|||||||
border-bottom: 1rpx solid #f5f5f5;
|
border-bottom: 1rpx solid #f5f5f5;
|
||||||
}
|
}
|
||||||
.statusLabel {
|
.statusLabel {
|
||||||
font-size: 40rpx;
|
font-size: $pda-font-body;
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
.statusTag {
|
|
||||||
font-size: 34rpx;
|
|
||||||
padding: 4rpx 12rpx;
|
|
||||||
border-radius: 6rpx;
|
|
||||||
font-weight: normal;
|
|
||||||
}
|
|
||||||
.status-0 { background: #f0f0f0; color: #666; }
|
|
||||||
.status-1 { background: #fff7e6; color: #fa8c16; }
|
|
||||||
.status-2 { background: #f6ffed; color: #52c41a; }
|
|
||||||
.status-3 { background: #fff1f0; color: #f5222d; }
|
|
||||||
.status-4 { background: #f5f5f5; color: #999; }
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,199 +0,0 @@
|
|||||||
<template>
|
|
||||||
<u-popup v-model="visible" mode="bottom" :safe-area-inset-bottom="true" border-radius="16">
|
|
||||||
<view class="search-select" :style="{ maxHeight: panelMaxHeight + 'px' }">
|
|
||||||
<view class="search-select__bar">
|
|
||||||
<text class="search-select__title">{{ title }}</text>
|
|
||||||
<text class="search-select__cancel" @click="visible = false">取消</text>
|
|
||||||
</view>
|
|
||||||
<view class="search-select__search">
|
|
||||||
<u-search v-model="keyword" :placeholder="placeholder" :show-action="false" />
|
|
||||||
</view>
|
|
||||||
<scroll-view
|
|
||||||
scroll-y
|
|
||||||
class="search-select__list"
|
|
||||||
:style="{ height: listHeight + 'px' }"
|
|
||||||
:enable-back-to-top="false"
|
|
||||||
>
|
|
||||||
<view v-if="!filteredList.length" class="search-select__empty">暂无匹配数据</view>
|
|
||||||
<view
|
|
||||||
v-for="item in filteredList"
|
|
||||||
:key="String(item.value)"
|
|
||||||
class="search-select__item"
|
|
||||||
:class="{ 'is-selected': multiple && isPicked(item) }"
|
|
||||||
@click="onItemClick(item)"
|
|
||||||
>
|
|
||||||
<text class="search-select__item-label">{{ item.label }}</text>
|
|
||||||
<text v-if="multiple && isPicked(item)" class="search-select__check">已选</text>
|
|
||||||
</view>
|
|
||||||
</scroll-view>
|
|
||||||
<view v-if="multiple" class="search-select__footer">
|
|
||||||
<view class="search-select__ok" @click="confirmMultiple">确定</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</u-popup>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
props: {
|
|
||||||
show: { type: Boolean, default: false },
|
|
||||||
title: { type: String, default: '请选择' },
|
|
||||||
placeholder: { type: String, default: '请输入名称搜索' },
|
|
||||||
list: { type: Array, default: () => [] },
|
|
||||||
multiple: { type: Boolean, default: false },
|
|
||||||
selected: { type: Array, default: () => [] },
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
keyword: '',
|
|
||||||
panelMaxHeight: 520,
|
|
||||||
listHeight: 360,
|
|
||||||
picked: [],
|
|
||||||
};
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
visible: {
|
|
||||||
get() { return this.show; },
|
|
||||||
set(val) { this.$emit('update:show', val); },
|
|
||||||
},
|
|
||||||
filteredList() {
|
|
||||||
const keyword = (this.keyword || '').trim().toLowerCase();
|
|
||||||
if (!keyword) return this.list;
|
|
||||||
return this.list.filter((item) => String(item.label || '').toLowerCase().includes(keyword));
|
|
||||||
},
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
show(val) {
|
|
||||||
if (val) {
|
|
||||||
this.keyword = '';
|
|
||||||
this.picked = (this.selected || []).map((item) => String(item));
|
|
||||||
this.calcHeight();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.calcHeight();
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
calcHeight() {
|
|
||||||
try {
|
|
||||||
const sys = uni.getSystemInfoSync();
|
|
||||||
const winH = sys.windowHeight || 600;
|
|
||||||
// 弹层约占屏高 65%,列表为弹层去掉标题+搜索后的剩余高度
|
|
||||||
this.panelMaxHeight = Math.floor(winH * 0.65);
|
|
||||||
const chrome = this.multiple ? 230 : 140;
|
|
||||||
this.listHeight = Math.max(220, this.panelMaxHeight - chrome);
|
|
||||||
} catch (e) {
|
|
||||||
this.panelMaxHeight = 520;
|
|
||||||
this.listHeight = this.multiple ? 280 : 360;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
isPicked(item) {
|
|
||||||
return this.picked.includes(String(item.value));
|
|
||||||
},
|
|
||||||
onItemClick(item) {
|
|
||||||
if (!this.multiple) {
|
|
||||||
this.confirm(item);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const key = String(item.value);
|
|
||||||
if (this.picked.includes(key)) {
|
|
||||||
this.picked = this.picked.filter((value) => value !== key);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.picked = this.picked.concat(key);
|
|
||||||
},
|
|
||||||
confirm(item) {
|
|
||||||
this.visible = false;
|
|
||||||
this.$emit('confirm', item);
|
|
||||||
},
|
|
||||||
confirmMultiple() {
|
|
||||||
const selected = (this.list || []).filter((item) => this.isPicked(item));
|
|
||||||
this.visible = false;
|
|
||||||
this.$emit('confirm', selected);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped lang="scss">
|
|
||||||
@import '@/common/pda-typography.scss';
|
|
||||||
|
|
||||||
.search-select {
|
|
||||||
background: #fff;
|
|
||||||
padding-bottom: 20rpx;
|
|
||||||
box-sizing: border-box;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
.search-select__bar {
|
|
||||||
flex-shrink: 0;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
padding: 24rpx 30rpx 12rpx;
|
|
||||||
}
|
|
||||||
.search-select__title {
|
|
||||||
font-size: $pda-font-popup-title;
|
|
||||||
font-weight: bold;
|
|
||||||
color: #202328;
|
|
||||||
}
|
|
||||||
.search-select__cancel {
|
|
||||||
font-size: $pda-font-popup-sub;
|
|
||||||
color: #888;
|
|
||||||
}
|
|
||||||
.search-select__search {
|
|
||||||
flex-shrink: 0;
|
|
||||||
padding: 0 24rpx 12rpx;
|
|
||||||
}
|
|
||||||
.search-select__list {
|
|
||||||
width: 100%;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
.search-select__empty {
|
|
||||||
padding: 80rpx 0;
|
|
||||||
text-align: center;
|
|
||||||
color: #999;
|
|
||||||
font-size: $pda-font-popup-sub;
|
|
||||||
}
|
|
||||||
.search-select__item {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
min-height: $pda-row-min-height;
|
|
||||||
padding: 20rpx 30rpx;
|
|
||||||
box-sizing: border-box;
|
|
||||||
font-size: $pda-font-popup-item;
|
|
||||||
color: #202328;
|
|
||||||
border-bottom: 1px solid #f2f2f2;
|
|
||||||
}
|
|
||||||
.search-select__item-label {
|
|
||||||
flex: 1;
|
|
||||||
min-width: 0;
|
|
||||||
font-size: $pda-font-popup-item;
|
|
||||||
color: #202328;
|
|
||||||
}
|
|
||||||
.search-select__item.is-selected .search-select__item-label {
|
|
||||||
color: #2f78e6;
|
|
||||||
}
|
|
||||||
.search-select__check {
|
|
||||||
flex-shrink: 0;
|
|
||||||
margin-left: 16rpx;
|
|
||||||
font-size: $pda-font-action;
|
|
||||||
color: #2f78e6;
|
|
||||||
}
|
|
||||||
.search-select__footer {
|
|
||||||
flex-shrink: 0;
|
|
||||||
padding: 16rpx 30rpx 8rpx;
|
|
||||||
}
|
|
||||||
.search-select__ok {
|
|
||||||
height: $pda-button-height;
|
|
||||||
line-height: $pda-button-height;
|
|
||||||
text-align: center;
|
|
||||||
font-size: $pda-font-button;
|
|
||||||
color: #fff;
|
|
||||||
background: #2979ff;
|
|
||||||
border-radius: 46rpx;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,14 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="warehouse-table-wrap" :class="{ 'is-auto-height': isAutoHeight }">
|
<view class="warehouse-table-wrap">
|
||||||
<wyb-table
|
<scroll-view scroll-x class="tableScrollX">
|
||||||
ref="table"
|
<wyb-table
|
||||||
:headers="headers"
|
ref="table"
|
||||||
:contents="contents"
|
:headers="headers"
|
||||||
:width="tableWidth"
|
:contents="contents"
|
||||||
:height="height"
|
:width="tableWidth"
|
||||||
:first-line-fixed="firstLineFixed"
|
:height="height"
|
||||||
@onCellClick="onCellClick"
|
:first-line-fixed="firstLineFixed"
|
||||||
/>
|
@onCellClick="onCellClick"
|
||||||
|
/>
|
||||||
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -20,14 +22,10 @@ export default {
|
|||||||
props: {
|
props: {
|
||||||
headers: { type: Array, default: () => [] },
|
headers: { type: Array, default: () => [] },
|
||||||
contents: { type: Array, default: () => [] },
|
contents: { type: Array, default: () => [] },
|
||||||
// auto:高度随内容撑开,纵向滚动交给外层 scroll-view,避免与下拉刷新抢手势
|
|
||||||
height: { type: String, default: 'auto' },
|
height: { type: String, default: 'auto' },
|
||||||
firstLineFixed: { type: Boolean, default: false },
|
firstLineFixed: { type: Boolean, default: true },
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
isAutoHeight() {
|
|
||||||
return !this.height || this.height === 'auto';
|
|
||||||
},
|
|
||||||
tableWidth() {
|
tableWidth() {
|
||||||
const total = (this.headers || []).reduce((sum, col) => sum + (col.width || 160), 0);
|
const total = (this.headers || []).reduce((sum, col) => sum + (col.width || 160), 0);
|
||||||
return `${total}rpx`;
|
return `${total}rpx`;
|
||||||
@@ -48,10 +46,7 @@ export default {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
}
|
}
|
||||||
/* 取消表格内部纵向滚动,只保留横向;纵向由页面 scroll-view 处理 */
|
.tableScrollX {
|
||||||
.is-auto-height ::v-deep .wyb-table-scroll-view {
|
width: 100%;
|
||||||
height: auto !important;
|
|
||||||
overflow-x: auto;
|
|
||||||
overflow-y: visible;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -0,0 +1,294 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<view class="summary-title">{{ title }}</view>
|
||||||
|
<slot name="before-list" />
|
||||||
|
<view class="summary-wrap">
|
||||||
|
<scroll-view scroll-x class="summary-scroll">
|
||||||
|
<t-table v-if="rows.length" border="1" border-color="#e5e5e5" :style="{ width: tableWidth }">
|
||||||
|
<t-tr class="summary-head" font-size="18" color="#666666" align="left">
|
||||||
|
<t-th v-for="col in columns" :key="col.key" :style="cellStyle(col)">{{ col.label }}</t-th>
|
||||||
|
</t-tr>
|
||||||
|
<t-tr
|
||||||
|
v-for="row in rows"
|
||||||
|
:key="row.group_key"
|
||||||
|
font-size="18"
|
||||||
|
color="#333333"
|
||||||
|
align="left"
|
||||||
|
:class="{ 'summary-row--open': expandedKey === row.group_key }"
|
||||||
|
@click="toggleRow(row.group_key)"
|
||||||
|
>
|
||||||
|
<t-td v-for="col in columns" :key="col.key" :style="cellStyle(col)">{{ formatCell(row, col.key) }}</t-td>
|
||||||
|
</t-tr>
|
||||||
|
<t-tr class="summary-total" font-size="18" color="#333333" align="left">
|
||||||
|
<t-td v-for="col in columns" :key="col.key" :style="cellStyle(col)">{{ totalCell(col.key) }}</t-td>
|
||||||
|
</t-tr>
|
||||||
|
</t-table>
|
||||||
|
<view v-else class="summary-empty">{{ emptyText }}</view>
|
||||||
|
</scroll-view>
|
||||||
|
|
||||||
|
<view v-if="expandedRow" class="summary-fine">
|
||||||
|
<view class="summary-fineTitle">
|
||||||
|
细码({{ expandedRow.fine_codes.length }})
|
||||||
|
<text class="summary-fineHint">{{ expandedKey ? '点击行收起' : '' }}</text>
|
||||||
|
</view>
|
||||||
|
<view v-if="!expandedRow.fine_codes.length" class="summary-empty">暂无细码</view>
|
||||||
|
<scroll-view v-else scroll-x class="summary-scroll">
|
||||||
|
<t-table border="1" border-color="#e5e5e5" :style="{ width: fineTableWidth }">
|
||||||
|
<t-tr class="summary-head" font-size="18" color="#666666" align="left">
|
||||||
|
<t-th v-for="col in fineCols" :key="col.key" :style="cellStyle(col)">{{ col.label }}</t-th>
|
||||||
|
</t-tr>
|
||||||
|
<t-tr
|
||||||
|
v-for="(fc, fcIndex) in expandedRow.fine_codes"
|
||||||
|
:key="fc.id || fcIndex"
|
||||||
|
font-size="18"
|
||||||
|
color="#333333"
|
||||||
|
align="left"
|
||||||
|
>
|
||||||
|
<t-td
|
||||||
|
v-for="col in fineCols"
|
||||||
|
:key="col.key"
|
||||||
|
:class="{ 'summary-action': col.key === 'action' }"
|
||||||
|
:style="cellStyle(col)"
|
||||||
|
@click="onFineCellTap(col.key, fc)"
|
||||||
|
>{{ formatFineCell(fc, col.key) }}</t-td>
|
||||||
|
</t-tr>
|
||||||
|
</t-table>
|
||||||
|
</scroll-view>
|
||||||
|
<view v-if="deletable && expandedRow.fine_codes.length" class="summary-tip">
|
||||||
|
点击「删除」移除对应细码
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import tTable from '@/components/t-table/t-table.vue';
|
||||||
|
import tTh from '@/components/t-table/t-th.vue';
|
||||||
|
import tTr from '@/components/t-table/t-tr.vue';
|
||||||
|
import tTd from '@/components/t-table/t-td.vue';
|
||||||
|
|
||||||
|
const SUMMARY_COLUMNS = [
|
||||||
|
{ label: '成品编号', key: 'product_code', width: 260 },
|
||||||
|
{ label: '色号', key: 'product_color_code', width: 220 },
|
||||||
|
{ label: '匹数', key: 'roll', width: 140 },
|
||||||
|
{ label: '数量', key: 'weight', width: 160 },
|
||||||
|
{ label: '染整单', key: 'quote_order_no', width: 260 },
|
||||||
|
{ label: '缸号', key: 'dye_factory_dyelot_number', width: 220 },
|
||||||
|
];
|
||||||
|
|
||||||
|
const FINE_COLUMNS = [
|
||||||
|
{ label: '卷号', key: 'volume_number', width: 140 },
|
||||||
|
{ label: '外部卷号', key: 'extern_volume_number', width: 180 },
|
||||||
|
{ label: '匹数', key: 'roll', width: 120 },
|
||||||
|
{ label: '数量', key: 'weight', width: 150 },
|
||||||
|
{ label: '仓位', key: 'warehouse_bin_name', width: 180 },
|
||||||
|
{ label: '缸号', key: 'dye_factory_dyelot_number', width: 200 },
|
||||||
|
];
|
||||||
|
|
||||||
|
const TARE_COLUMNS = [
|
||||||
|
{ label: '纸筒重量', key: 'paper_tube_weight', width: 180 },
|
||||||
|
{ label: '包装重量', key: 'package_weight', width: 180 },
|
||||||
|
];
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: { tTable, tTh, tTr, tTd },
|
||||||
|
props: {
|
||||||
|
groups: { type: Array, default: () => [] },
|
||||||
|
title: { type: String, default: '明细' },
|
||||||
|
emptyText: { type: String, default: '暂无明细' },
|
||||||
|
rollKey: { type: String, default: 'in_roll' },
|
||||||
|
weightKey: { type: String, default: 'in_weight' },
|
||||||
|
deletable: { type: Boolean, default: false },
|
||||||
|
showTareColumns: { type: Boolean, default: false },
|
||||||
|
showBarCode: { type: Boolean, default: false },
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
expandedKey: '',
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
columns() {
|
||||||
|
return SUMMARY_COLUMNS;
|
||||||
|
},
|
||||||
|
rows() {
|
||||||
|
const rows = [];
|
||||||
|
(this.groups || []).forEach((product) => {
|
||||||
|
(product.colors || []).forEach((color) => {
|
||||||
|
rows.push({
|
||||||
|
group_key: color.group_key,
|
||||||
|
product_code: product.product_code || '',
|
||||||
|
product_name: product.product_name || '',
|
||||||
|
product_color_code: color.product_color_code || '',
|
||||||
|
product_color_name: color.product_color_name || '',
|
||||||
|
quote_order_no: color.quote_order_no || '',
|
||||||
|
dye_factory_dyelot_number: color.dye_factory_dyelot_number || '',
|
||||||
|
roll: color[this.rollKey],
|
||||||
|
weight: color[this.weightKey],
|
||||||
|
fine_codes: color.fine_codes || [],
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return rows;
|
||||||
|
},
|
||||||
|
expandedRow() {
|
||||||
|
return this.rows.find((row) => row.group_key === this.expandedKey) || null;
|
||||||
|
},
|
||||||
|
fineCols() {
|
||||||
|
const cols = [...FINE_COLUMNS];
|
||||||
|
if (this.showBarCode) {
|
||||||
|
const idx = cols.findIndex((col) => col.key === 'weight');
|
||||||
|
cols.splice(idx + 1, 0, { label: '条码', key: 'bar_code', width: 280 });
|
||||||
|
}
|
||||||
|
if (this.showTareColumns) {
|
||||||
|
const idx = cols.findIndex((col) => col.key === 'weight');
|
||||||
|
cols.splice(idx + 1, 0, ...TARE_COLUMNS);
|
||||||
|
}
|
||||||
|
if (this.deletable) {
|
||||||
|
cols.push({ label: '操作', key: 'action', width: 120 });
|
||||||
|
}
|
||||||
|
return cols;
|
||||||
|
},
|
||||||
|
tableWidth() {
|
||||||
|
return this.sumWidth(this.columns);
|
||||||
|
},
|
||||||
|
fineTableWidth() {
|
||||||
|
return this.sumWidth(this.fineCols);
|
||||||
|
},
|
||||||
|
totalRoll() {
|
||||||
|
return this.sumField('roll');
|
||||||
|
},
|
||||||
|
totalWeight() {
|
||||||
|
return this.sumField('weight');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
rows() {
|
||||||
|
if (this.expandedKey && !this.rows.some((row) => row.group_key === this.expandedKey)) {
|
||||||
|
this.expandedKey = '';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
sumWidth(cols) {
|
||||||
|
const total = cols.reduce((sum, col) => sum + (col.width || 120), 0);
|
||||||
|
return `${total}rpx`;
|
||||||
|
},
|
||||||
|
sumField(key) {
|
||||||
|
const total = this.rows.reduce((sum, row) => sum + Number(row[key] || 0), 0);
|
||||||
|
return Number(total.toFixed(2));
|
||||||
|
},
|
||||||
|
cellStyle(col) {
|
||||||
|
const width = `${col.width}rpx`;
|
||||||
|
return {
|
||||||
|
width,
|
||||||
|
minWidth: width,
|
||||||
|
maxWidth: width,
|
||||||
|
flex: `0 0 ${width}`,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
joinName(code, name) {
|
||||||
|
const main = code || '-';
|
||||||
|
return name ? `${main} ${name}` : main;
|
||||||
|
},
|
||||||
|
formatCell(row, key) {
|
||||||
|
if (key === 'product_code') return this.joinName(row.product_code, row.product_name);
|
||||||
|
if (key === 'product_color_code') return this.joinName(row.product_color_code, row.product_color_name);
|
||||||
|
if (key === 'roll' || key === 'weight') {
|
||||||
|
const val = row[key];
|
||||||
|
if (val === 0) return '0';
|
||||||
|
return val != null && val !== '' ? val : '-';
|
||||||
|
}
|
||||||
|
const val = row[key];
|
||||||
|
if (val === 0) return '0';
|
||||||
|
return val != null && val !== '' ? val : '-';
|
||||||
|
},
|
||||||
|
totalCell(key) {
|
||||||
|
if (key === 'product_code') return '合计';
|
||||||
|
if (key === 'roll') return this.totalRoll;
|
||||||
|
if (key === 'weight') return this.totalWeight;
|
||||||
|
return '';
|
||||||
|
},
|
||||||
|
toggleRow(key) {
|
||||||
|
this.expandedKey = this.expandedKey === key ? '' : key;
|
||||||
|
},
|
||||||
|
formatFineCell(fc, key) {
|
||||||
|
if (key === 'action') return '删除';
|
||||||
|
const val = fc[key];
|
||||||
|
if (val === 0) return '0';
|
||||||
|
return val != null && val !== '' ? val : '-';
|
||||||
|
},
|
||||||
|
onFineCellTap(key, fc) {
|
||||||
|
if (!this.deletable || key !== 'action') return;
|
||||||
|
this.$emit('delete', fc);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
@import '@/common/pda-typography.scss';
|
||||||
|
|
||||||
|
.summary-title {
|
||||||
|
font-size: $pda-font-body;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 24rpx 26rpx 12rpx;
|
||||||
|
border-left: 6rpx solid #007AFF;
|
||||||
|
margin: 20rpx 26rpx 0;
|
||||||
|
}
|
||||||
|
.summary-wrap {
|
||||||
|
margin: 0 26rpx 16rpx;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.summary-scroll {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
::v-deep .t-th,
|
||||||
|
::v-deep .t-td {
|
||||||
|
box-sizing: border-box;
|
||||||
|
min-height: $pda-row-min-height;
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
::v-deep .summary-head {
|
||||||
|
background: #f7f8fa;
|
||||||
|
}
|
||||||
|
::v-deep .summary-row--open {
|
||||||
|
background: #f0f7ff;
|
||||||
|
}
|
||||||
|
::v-deep .summary-total {
|
||||||
|
background: #fff7e6;
|
||||||
|
}
|
||||||
|
::v-deep .summary-action {
|
||||||
|
color: #f5222d;
|
||||||
|
}
|
||||||
|
.summary-empty {
|
||||||
|
padding: 28rpx 16rpx;
|
||||||
|
font-size: $pda-font-placeholder;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
.summary-fine {
|
||||||
|
padding: 8rpx 0 16rpx;
|
||||||
|
}
|
||||||
|
.summary-fineTitle {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 12rpx 16rpx 8rpx;
|
||||||
|
font-size: $pda-font-action;
|
||||||
|
color: #2979ff;
|
||||||
|
}
|
||||||
|
.summary-fineHint {
|
||||||
|
color: #999;
|
||||||
|
font-size: $pda-font-popup-sub;
|
||||||
|
}
|
||||||
|
.summary-action {
|
||||||
|
color: #f5222d;
|
||||||
|
}
|
||||||
|
.summary-tip {
|
||||||
|
padding: 8rpx 16rpx 0;
|
||||||
|
font-size: $pda-font-popup-sub;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<view v-if="canScan" class="flex-white-plr26 ptb20 bdb_f5 fabric-out-scanRow process-in-binRow">
|
||||||
|
<text class="mr26 process-in-binLabel">仓位<text class="redXingh">*</text></text>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
:value="code"
|
||||||
|
class="fabric-out-scanInput"
|
||||||
|
placeholder="请先扫描仓位"
|
||||||
|
@input="$emit('code-input', $event.detail.value)"
|
||||||
|
@confirm="$emit('confirm')"
|
||||||
|
/>
|
||||||
|
<text v-if="name" class="process-in-binName">{{ name }}</text>
|
||||||
|
<view
|
||||||
|
v-if="showPhoneScan && scanning"
|
||||||
|
class="fabric-out-scanClose"
|
||||||
|
@click.stop="$emit('phone-scan')"
|
||||||
|
>关闭扫码</view>
|
||||||
|
<u-icon
|
||||||
|
v-else-if="showPhoneScan"
|
||||||
|
class="fabric-out-phoneScanIcon"
|
||||||
|
name="scan"
|
||||||
|
size="44"
|
||||||
|
color="#2979ff"
|
||||||
|
@click="$emit('phone-scan')"
|
||||||
|
/>
|
||||||
|
<text v-if="binId" class="process-in-binClear" @click="$emit('clear')">更换</text>
|
||||||
|
</view>
|
||||||
|
<view v-else-if="showDisabledTip" class="fabric-out-scanTip">{{ disabledTip }}</view>
|
||||||
|
<view v-if="canScan && !binId" class="fabric-out-scanTip">请先扫描仓位,再扫描布匹二维码</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
canScan: { type: Boolean, default: false },
|
||||||
|
binId: { type: [Number, String], default: 0 },
|
||||||
|
code: { type: String, default: '' },
|
||||||
|
name: { type: String, default: '' },
|
||||||
|
showPhoneScan: { type: Boolean, default: false },
|
||||||
|
scanning: { type: Boolean, default: false },
|
||||||
|
showDisabledTip: { type: Boolean, default: true },
|
||||||
|
disabledTip: { type: String, default: '请先提交保存后再扫仓位' },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
@import '@/pages/storefabric/storeFabricBusinessOutPage.scss';
|
||||||
|
@import '@/common/pda-typography.scss';
|
||||||
|
|
||||||
|
.process-in-binRow {
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
.process-in-binLabel {
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
.fabric-out-phoneScanIcon {
|
||||||
|
margin-left: 16rpx;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
.fabric-out-scanClose {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-left: 8rpx;
|
||||||
|
padding: 0 16rpx;
|
||||||
|
height: 72rpx;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
border: 1rpx solid #2979ff;
|
||||||
|
background: #eaf2ff;
|
||||||
|
color: #2979ff;
|
||||||
|
font-size: $pda-font-action;
|
||||||
|
flex-shrink: 0;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.process-in-binName {
|
||||||
|
margin-left: 12rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333;
|
||||||
|
max-width: 200rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.process-in-binClear {
|
||||||
|
margin-left: 16rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #2979ff;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<template>
|
||||||
|
<FineCodeSummaryTable
|
||||||
|
:groups="groups"
|
||||||
|
:title="title"
|
||||||
|
:empty-text="emptyText"
|
||||||
|
roll-key="in_roll"
|
||||||
|
weight-key="in_weight"
|
||||||
|
:deletable="deletable"
|
||||||
|
:show-tare-columns="showTareColumns"
|
||||||
|
@delete="$emit('delete', $event)"
|
||||||
|
>
|
||||||
|
<slot name="before-list" slot="before-list" />
|
||||||
|
</FineCodeSummaryTable>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import FineCodeSummaryTable from '@/components/storegoods/FineCodeSummaryTable.vue';
|
||||||
|
import { buildItemGroups } from '@/common/storeGoodsProcessIn';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: { FineCodeSummaryTable },
|
||||||
|
props: {
|
||||||
|
list: { type: Array, default: () => [] },
|
||||||
|
title: { type: String, default: '进仓明细' },
|
||||||
|
emptyText: { type: String, default: '暂无进仓明细' },
|
||||||
|
deletable: { type: Boolean, default: false },
|
||||||
|
showTareColumns: { type: Boolean, default: false },
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
groups() {
|
||||||
|
return buildItemGroups(this.list);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<template>
|
||||||
|
<view class="fabric-out-scanDetail">
|
||||||
|
<view class="fabric-out-scanDetailRow fabric-out-scanDetailRow--2col">
|
||||||
|
<text class="fabric-out-scanDetailCell">染整单号:{{ detail.quote_order_no || '-' }}</text>
|
||||||
|
<text class="fabric-out-scanDetailCell">缸号:{{ detail.dyelot_number || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="fabric-out-scanDetailRow fabric-out-scanDetailRow--2col">
|
||||||
|
<text class="fabric-out-scanDetailCell">卷号:{{ detail.volume_number || '-' }}</text>
|
||||||
|
<text class="fabric-out-scanDetailCell">外部卷号:{{ detail.extern_volume_number || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="fabric-out-scanDetailRow fabric-out-scanDetailRow--2col">
|
||||||
|
<text class="fabric-out-scanDetailCell">成品编号:{{ detail.product_code || '-' }}</text>
|
||||||
|
<text class="fabric-out-scanDetailCell">成品色号:{{ detail.product_color_code || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="fabric-out-scanDetailRow fabric-out-scanDetailRow--2col">
|
||||||
|
<text class="fabric-out-scanDetailCell">本行数量:{{ detail.item_weight != null ? detail.item_weight : '-' }}</text>
|
||||||
|
<text class="fabric-out-scanDetailCell">本单匹数:{{ detail.order_roll != null ? detail.order_roll : '-' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="fabric-out-scanDetailRow">
|
||||||
|
<text class="fabric-out-scanDetailLabel">本单数量:</text>
|
||||||
|
<text class="fabric-out-scanDetailValue">{{ detail.order_weight != null ? detail.order_weight : '-' }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
detail: { type: Object, default: () => ({}) },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
@import '@/pages/storefabric/storeFabricBusinessOutPage.scss';
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<template>
|
||||||
|
<FineCodeSummaryTable
|
||||||
|
:groups="groups"
|
||||||
|
:title="title"
|
||||||
|
empty-text="暂无出仓明细"
|
||||||
|
roll-key="out_roll"
|
||||||
|
weight-key="out_weight"
|
||||||
|
:deletable="deletable"
|
||||||
|
show-bar-code
|
||||||
|
@delete="$emit('delete', $event)"
|
||||||
|
>
|
||||||
|
<slot name="before-list" slot="before-list" />
|
||||||
|
</FineCodeSummaryTable>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import FineCodeSummaryTable from '@/components/storegoods/FineCodeSummaryTable.vue';
|
||||||
|
import { buildItemGroups } from '@/common/storeGoodsProcessOut';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: { FineCodeSummaryTable },
|
||||||
|
props: {
|
||||||
|
list: { type: Array, default: () => [] },
|
||||||
|
title: { type: String, default: '出仓明细' },
|
||||||
|
deletable: { type: Boolean, default: false },
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
groups() {
|
||||||
|
return buildItemGroups(this.list);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<template>
|
||||||
|
<view class="fabric-out-scanDetail">
|
||||||
|
<view class="fabric-out-scanDetailRow fabric-out-scanDetailRow--2col">
|
||||||
|
<text class="fabric-out-scanDetailCell">染整单号:{{ detail.quote_order_no || '-' }}</text>
|
||||||
|
<text class="fabric-out-scanDetailCell">缸号:{{ detail.dyelot_number || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="fabric-out-scanDetailRow fabric-out-scanDetailRow--2col">
|
||||||
|
<text class="fabric-out-scanDetailCell">卷号:{{ detail.volume_number || '-' }}</text>
|
||||||
|
<text class="fabric-out-scanDetailCell">外部卷号:{{ detail.extern_volume_number || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="fabric-out-scanDetailRow fabric-out-scanDetailRow--2col">
|
||||||
|
<text class="fabric-out-scanDetailCell">成品编号:{{ detail.product_code || '-' }}</text>
|
||||||
|
<text class="fabric-out-scanDetailCell">成品色号:{{ detail.product_color_code || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="fabric-out-scanDetailRow fabric-out-scanDetailRow--2col">
|
||||||
|
<text class="fabric-out-scanDetailCell">本行匹数:{{ detail.item_roll != null ? detail.item_roll : '-' }}</text>
|
||||||
|
<text class="fabric-out-scanDetailCell">本行数量:{{ detail.item_weight != null ? detail.item_weight : '-' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="fabric-out-scanDetailRow fabric-out-scanDetailRow--2col">
|
||||||
|
<text class="fabric-out-scanDetailCell">本单匹数:{{ detail.order_roll != null ? detail.order_roll : '-' }}</text>
|
||||||
|
<text class="fabric-out-scanDetailCell">本单数量:{{ detail.order_weight != null ? detail.order_weight : '-' }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
detail: { type: Object, default: () => ({}) },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
@import '@/pages/storefabric/storeFabricBusinessOutPage.scss';
|
||||||
|
</style>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="t-td" :style="{ 'border-width': thBorder + 'px','border-color':borderColor ,'font-size':fontSize+'px' ,'color':color,'justify-content':tdAlignCpd}">
|
<view class="t-td" :style="{ 'border-width': thBorder + 'px','border-color':borderColor ,'font-size':fontSize+'px' ,'color':color,'justify-content':tdAlignCpd}" @click="$emit('click', $event)">
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="t-tr">
|
<view class="t-tr" @click="$emit('click', $event)">
|
||||||
<view v-if="isCheck" class="t-check-box" :style="{ 'border-width': thBorder + 'px' ,'border-color':borderColor}">
|
<view v-if="isCheck" class="t-check-box" :style="{ 'border-width': thBorder + 'px' ,'border-color':borderColor}">
|
||||||
<checkbox-group @change="checkboxChange">
|
<checkbox-group @change="checkboxChange">
|
||||||
<checkbox :value="checkboxData.value + ''" :checked="checkboxData.checked" />
|
<checkbox :value="checkboxData.value + ''" :checked="checkboxData.checked" />
|
||||||
|
|||||||
@@ -0,0 +1,247 @@
|
|||||||
|
<template>
|
||||||
|
<u-popup mode="bottom" :border-radius="borderRadius" :popup="false" v-model="value" :maskCloseAble="maskCloseAble"
|
||||||
|
length="auto" :safeAreaInsetBottom="safeAreaInsetBottom" @close="popupClose" :z-index="uZIndex">
|
||||||
|
<view class="u-tips u-border-bottom" v-if="tips.text" :style="[tipsStyle]">
|
||||||
|
{{tips.text}}
|
||||||
|
</view>
|
||||||
|
<view class="u-action-sheet-search" v-if="showSearch" @tap.stop>
|
||||||
|
<u-icon name="search" size="32" color="#909399"></u-icon>
|
||||||
|
<input
|
||||||
|
class="u-action-sheet-search__input"
|
||||||
|
:value="keyword"
|
||||||
|
:placeholder="searchPlaceholder"
|
||||||
|
confirm-type="search"
|
||||||
|
:adjust-position="true"
|
||||||
|
@input="onSearchInput"
|
||||||
|
/>
|
||||||
|
<u-icon
|
||||||
|
v-if="keyword"
|
||||||
|
name="close-circle-fill"
|
||||||
|
size="28"
|
||||||
|
color="#c0c4cc"
|
||||||
|
@tap.stop="clearSearch"
|
||||||
|
></u-icon>
|
||||||
|
</view>
|
||||||
|
<scroll-view scroll-y class="u-action-sheet-scroll">
|
||||||
|
<view
|
||||||
|
v-for="(item, index) in displayList"
|
||||||
|
:key="item._originIndex"
|
||||||
|
@touchmove.stop.prevent
|
||||||
|
@tap="itemClick(item._originIndex)"
|
||||||
|
:style="[itemStyle(item._originIndex)]"
|
||||||
|
class="u-action-sheet-item u-line-1"
|
||||||
|
:class="[index < displayList.length - 1 ? 'u-border-bottom' : '']"
|
||||||
|
:hover-stay-time="150"
|
||||||
|
>
|
||||||
|
<text>{{item.text}}</text>
|
||||||
|
<text class="u-action-sheet-item__subtext u-line-1" v-if="item.subText">{{item.subText}}</text>
|
||||||
|
</view>
|
||||||
|
<view v-if="!displayList.length" class="u-action-sheet-empty">无匹配选项</view>
|
||||||
|
</scroll-view>
|
||||||
|
<view class="u-gab" v-if="cancelBtn">
|
||||||
|
</view>
|
||||||
|
<view @touchmove.stop.prevent class="u-actionsheet-cancel u-action-sheet-item" hover-class="u-hover-class"
|
||||||
|
:hover-stay-time="150" v-if="cancelBtn" @tap="close">{{cancelText}}</view>
|
||||||
|
</u-popup>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
/**
|
||||||
|
* actionSheet 操作菜单(本地覆盖:选项支持搜索)
|
||||||
|
* @description 本组件用于从底部弹出一个操作菜单,供用户选择并返回结果。
|
||||||
|
* @tutorial https://www.uviewui.com/components/actionSheet.html
|
||||||
|
* @property {Array<Object>} list 按钮的文字数组,见官方文档示例
|
||||||
|
* @property {Boolean} show-search 是否显示搜索框(默认true)
|
||||||
|
* @property {String} search-placeholder 搜索框占位文字
|
||||||
|
* @event {Function} click 点击ActionSheet列表项时触发,返回原始列表下标
|
||||||
|
* @example <u-action-sheet :list="list" @click="click" v-model="show"></u-action-sheet>
|
||||||
|
*/
|
||||||
|
export default {
|
||||||
|
name: "u-action-sheet",
|
||||||
|
props: {
|
||||||
|
maskCloseAble: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
list: {
|
||||||
|
type: Array,
|
||||||
|
default () {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tips: {
|
||||||
|
type: Object,
|
||||||
|
default () {
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
color: '',
|
||||||
|
fontSize: '26'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cancelBtn: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
safeAreaInsetBottom: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
value: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
borderRadius: {
|
||||||
|
type: [String, Number],
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
zIndex: {
|
||||||
|
type: [String, Number],
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
cancelText: {
|
||||||
|
type: String,
|
||||||
|
default: '取消'
|
||||||
|
},
|
||||||
|
showSearch: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
searchPlaceholder: {
|
||||||
|
type: String,
|
||||||
|
default: '搜索'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
keyword: ''
|
||||||
|
};
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
value(val) {
|
||||||
|
if (val) this.keyword = '';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
tipsStyle() {
|
||||||
|
let style = {};
|
||||||
|
if (this.tips.color) style.color = this.tips.color;
|
||||||
|
if (this.tips.fontSize) style.fontSize = this.tips.fontSize + 'rpx';
|
||||||
|
return style;
|
||||||
|
},
|
||||||
|
itemStyle() {
|
||||||
|
return (index) => {
|
||||||
|
let style = {};
|
||||||
|
const item = this.list[index];
|
||||||
|
if (!item) return style;
|
||||||
|
if (item.color) style.color = item.color;
|
||||||
|
if (item.fontSize) style.fontSize = item.fontSize + 'rpx';
|
||||||
|
if (item.disabled) style.color = '#c0c4cc';
|
||||||
|
return style;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
uZIndex() {
|
||||||
|
return this.zIndex ? this.zIndex : this.$u.zIndex.popup;
|
||||||
|
},
|
||||||
|
displayList() {
|
||||||
|
const keyword = (this.keyword || '').trim().toLowerCase();
|
||||||
|
return (this.list || []).reduce((arr, item, index) => {
|
||||||
|
const text = String((item && item.text) || '');
|
||||||
|
const subText = String((item && item.subText) || '');
|
||||||
|
if (!keyword || text.toLowerCase().indexOf(keyword) !== -1 || subText.toLowerCase().indexOf(keyword) !== -1) {
|
||||||
|
arr.push(Object.assign({}, item, { _originIndex: index }));
|
||||||
|
}
|
||||||
|
return arr;
|
||||||
|
}, []);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
onSearchInput(e) {
|
||||||
|
this.keyword = e && e.detail && e.detail.value != null ? e.detail.value : '';
|
||||||
|
},
|
||||||
|
clearSearch() {
|
||||||
|
this.keyword = '';
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
this.popupClose();
|
||||||
|
this.$emit('close');
|
||||||
|
},
|
||||||
|
popupClose() {
|
||||||
|
this.keyword = '';
|
||||||
|
this.$emit('input', false);
|
||||||
|
},
|
||||||
|
itemClick(index) {
|
||||||
|
if(this.list[index] && this.list[index].disabled) return;
|
||||||
|
this.$emit('click', index);
|
||||||
|
this.$emit('input', false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
@import "~uview-ui/libs/css/style.components.scss";
|
||||||
|
|
||||||
|
.u-tips {
|
||||||
|
font-size: 26rpx;
|
||||||
|
text-align: center;
|
||||||
|
padding: 34rpx 0;
|
||||||
|
line-height: 1;
|
||||||
|
color: $u-tips-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-action-sheet-search {
|
||||||
|
@include vue-flex;
|
||||||
|
align-items: center;
|
||||||
|
margin: 16rpx 24rpx;
|
||||||
|
padding: 0 24rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
&__input {
|
||||||
|
flex: 1;
|
||||||
|
height: 80rpx;
|
||||||
|
margin-left: 12rpx;
|
||||||
|
font-size: 30rpx;
|
||||||
|
color: #303133;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-action-sheet-scroll {
|
||||||
|
max-height: 600rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-action-sheet-empty {
|
||||||
|
text-align: center;
|
||||||
|
padding: 60rpx 0;
|
||||||
|
font-size: 30rpx;
|
||||||
|
color: #909399;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-action-sheet-item {
|
||||||
|
@include vue-flex;
|
||||||
|
line-height: 1;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 32rpx;
|
||||||
|
padding: 34rpx 0;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-action-sheet-item__subtext {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: $u-tips-color;
|
||||||
|
margin-top: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-gab {
|
||||||
|
height: 12rpx;
|
||||||
|
background-color: rgb(234, 234, 236);
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-actionsheet-cancel {
|
||||||
|
color: $u-main-color;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,186 @@
|
|||||||
|
<template>
|
||||||
|
<view class="u-dropdown-item" v-if="active" @touchmove.stop.prevent="() => {}" @tap.stop.prevent="() => {}">
|
||||||
|
<block v-if="!$slots.default && !$slots.$default">
|
||||||
|
<view class="u-dropdown-item__search" v-if="showSearch" @tap.stop>
|
||||||
|
<u-icon name="search" size="28" color="#909399"></u-icon>
|
||||||
|
<input
|
||||||
|
class="u-dropdown-item__search__input"
|
||||||
|
:value="keyword"
|
||||||
|
:placeholder="searchPlaceholder"
|
||||||
|
confirm-type="search"
|
||||||
|
:adjust-position="true"
|
||||||
|
@input="onSearchInput"
|
||||||
|
/>
|
||||||
|
<u-icon
|
||||||
|
v-if="keyword"
|
||||||
|
name="close-circle-fill"
|
||||||
|
size="28"
|
||||||
|
color="#c0c4cc"
|
||||||
|
@tap.stop="clearSearch"
|
||||||
|
></u-icon>
|
||||||
|
</view>
|
||||||
|
<scroll-view scroll-y="true" :style="{
|
||||||
|
height: $u.addUnit(height)
|
||||||
|
}">
|
||||||
|
<view class="u-dropdown-item__options">
|
||||||
|
<u-cell-group>
|
||||||
|
<u-cell-item @click="cellClick(item.value)" :arrow="false" :title="item.label" v-for="(item, index) in filteredOptions"
|
||||||
|
:key="index" :title-style="{
|
||||||
|
color: value == item.value ? activeColor : inactiveColor
|
||||||
|
}">
|
||||||
|
<u-icon v-if="value == item.value" name="checkbox-mark" :color="activeColor" size="32"></u-icon>
|
||||||
|
</u-cell-item>
|
||||||
|
</u-cell-group>
|
||||||
|
<view v-if="!filteredOptions.length" class="u-dropdown-item__empty">无匹配选项</view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
</block>
|
||||||
|
<slot v-else />
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
/**
|
||||||
|
* dropdown-item 下拉菜单(本地覆盖:选项支持搜索)
|
||||||
|
* @description 该组件一般用于向下展开菜单,同时可切换多个选项卡的场景
|
||||||
|
* @tutorial http://uviewui.com/components/dropdown.html
|
||||||
|
* @property {String | Number} v-model 双向绑定选项卡选择值
|
||||||
|
* @property {String} title 菜单项标题
|
||||||
|
* @property {Array[Object]} options 选项数据,如果传入了默认slot,此参数无效
|
||||||
|
* @property {Boolean} show-search 是否显示搜索框(默认true)
|
||||||
|
* @property {String} search-placeholder 搜索框占位文字
|
||||||
|
* @example <u-dropdown-item title="标题"></u-dropdown-item>
|
||||||
|
*/
|
||||||
|
export default {
|
||||||
|
name: 'u-dropdown-item',
|
||||||
|
props: {
|
||||||
|
value: {
|
||||||
|
type: [Number, String, Array],
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
type: [String, Number],
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
type: Array,
|
||||||
|
default () {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
disabled: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
height: {
|
||||||
|
type: [Number, String],
|
||||||
|
default: 'auto'
|
||||||
|
},
|
||||||
|
showSearch: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
searchPlaceholder: {
|
||||||
|
type: String,
|
||||||
|
default: '搜索'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
active: false,
|
||||||
|
activeColor: '#2979ff',
|
||||||
|
inactiveColor: '#606266',
|
||||||
|
keyword: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
propsChange() {
|
||||||
|
return `${this.title}-${this.disabled}`;
|
||||||
|
},
|
||||||
|
filteredOptions() {
|
||||||
|
const keyword = (this.keyword || '').trim().toLowerCase();
|
||||||
|
const list = this.options || [];
|
||||||
|
if (!keyword) return list;
|
||||||
|
return list.filter(item => {
|
||||||
|
const label = String(item && item.label != null ? item.label : '');
|
||||||
|
const value = String(item && item.value != null ? item.value : '');
|
||||||
|
return label.toLowerCase().indexOf(keyword) !== -1 || value.toLowerCase().indexOf(keyword) !== -1;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
propsChange() {
|
||||||
|
if (this.parent) this.parent.init();
|
||||||
|
},
|
||||||
|
active(val) {
|
||||||
|
if (!val) this.keyword = '';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.parent = false;
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
onSearchInput(e) {
|
||||||
|
this.keyword = e && e.detail && e.detail.value != null ? e.detail.value : '';
|
||||||
|
},
|
||||||
|
clearSearch() {
|
||||||
|
this.keyword = '';
|
||||||
|
},
|
||||||
|
init() {
|
||||||
|
let parent = this.$u.$parent.call(this, 'u-dropdown');
|
||||||
|
if (parent) {
|
||||||
|
this.parent = parent;
|
||||||
|
this.activeColor = parent.activeColor;
|
||||||
|
this.inactiveColor = parent.inactiveColor;
|
||||||
|
let exist = parent.children.find(val => {
|
||||||
|
return this === val;
|
||||||
|
})
|
||||||
|
if (!exist) parent.children.push(this);
|
||||||
|
if (parent.children.length == 1) this.active = true;
|
||||||
|
parent.menuList.push({
|
||||||
|
title: this.title,
|
||||||
|
disabled: this.disabled
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cellClick(value) {
|
||||||
|
this.$emit('input', value);
|
||||||
|
this.parent.close();
|
||||||
|
this.$emit('change', value);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
@import "~uview-ui/libs/css/style.components.scss";
|
||||||
|
|
||||||
|
.u-dropdown-item__search {
|
||||||
|
@include vue-flex;
|
||||||
|
align-items: center;
|
||||||
|
margin: 16rpx 24rpx 0;
|
||||||
|
padding: 0 24rpx;
|
||||||
|
height: 72rpx;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
&__input {
|
||||||
|
flex: 1;
|
||||||
|
height: 72rpx;
|
||||||
|
margin-left: 12rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #303133;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-dropdown-item__empty {
|
||||||
|
text-align: center;
|
||||||
|
padding: 40rpx 0;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #909399;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
borderRight: index === headers.length - 1 || (!showVertBorder && index !== 0) ? 'none' : '1px solid' + borderColor,
|
borderRight: index === headers.length - 1 || (!showVertBorder && index !== 0) ? 'none' : '1px solid' + borderColor,
|
||||||
zIndex: index === 0 ? 20 : 0,
|
zIndex: index === 0 ? 20 : 0,
|
||||||
left: index === 0 && firstLineFixed ? (enableCheck ? checkColWidth + 'rpx' : 0) : 'auto',
|
left: index === 0 && firstLineFixed ? (enableCheck ? checkColWidth + 'rpx' : 0) : 'auto',
|
||||||
position: index === 0 && firstLineFixed ? 'sticky' : 'static'}">
|
position: index === 0 ? 'sticky' : 'static'}">
|
||||||
<text :style="{marginLeft: autoSortShow(index) && textAlign !== 'left' ? fontSize[0] * 0.65 + 'rpx' : 0}">
|
<text :style="{marginLeft: autoSortShow(index) && textAlign !== 'left' ? fontSize[0] * 0.65 + 'rpx' : 0}">
|
||||||
{{item.label || emptyString}}
|
{{item.label || emptyString}}
|
||||||
</text>
|
</text>
|
||||||
@@ -534,7 +534,7 @@
|
|||||||
fontSize: {
|
fontSize: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default() {
|
default() {
|
||||||
return [20]
|
return [28]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
defaultColWidth: {
|
defaultColWidth: {
|
||||||
@@ -548,7 +548,7 @@
|
|||||||
minHeight: {
|
minHeight: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default() {
|
default() {
|
||||||
return [70]
|
return [84]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
headerBgColor: {
|
headerBgColor: {
|
||||||
|
|||||||
+4
-4
@@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name" : "浩拓织厂",
|
"name" : "浩拓ERP",
|
||||||
"appid" : "__UNI__F79F300",
|
"appid" : "__UNI__F79F300",
|
||||||
"description" : "周尚-浩拓织厂",
|
"description" : "浩拓ERP",
|
||||||
"versionName" : "1.1.26",
|
"versionName" : "1.1.21",
|
||||||
"versionCode" : 126,
|
"versionCode" : 121,
|
||||||
"transformPx" : false,
|
"transformPx" : false,
|
||||||
"app-plus" : {
|
"app-plus" : {
|
||||||
"optimization" : {
|
"optimization" : {
|
||||||
|
|||||||
@@ -0,0 +1,119 @@
|
|||||||
|
import {
|
||||||
|
hasFilterValue,
|
||||||
|
normalizeAuditStatus,
|
||||||
|
isActiveFilterState,
|
||||||
|
normalizeFilterState,
|
||||||
|
withSelectedOption,
|
||||||
|
} from '@/common/listFilter';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
appliedFilters: null,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
hasActiveFilter() {
|
||||||
|
return isActiveFilterState(this.appliedFilters || this.filters);
|
||||||
|
},
|
||||||
|
filterIconColor() {
|
||||||
|
return this.hasActiveFilter ? '#2979ff' : '#666666';
|
||||||
|
},
|
||||||
|
statusSelectDefault() {
|
||||||
|
const list = this.statusSelectList || [];
|
||||||
|
const index = list.findIndex(
|
||||||
|
(item) => String(item.value) === String(this.filters && this.filters.audit_status)
|
||||||
|
);
|
||||||
|
return [index >= 0 ? index : 0];
|
||||||
|
},
|
||||||
|
unitSelectDefault() {
|
||||||
|
const selectedValue = this.getUnitSelectValue();
|
||||||
|
const index = (this.unitSelectList || []).findIndex(
|
||||||
|
(item) => String(item.value) === String(selectedValue)
|
||||||
|
);
|
||||||
|
return [index >= 0 ? index : 0];
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
hasFilterValue,
|
||||||
|
getDefaultFilters() {
|
||||||
|
return typeof this.createDefaultFilters === 'function'
|
||||||
|
? this.createDefaultFilters()
|
||||||
|
: {};
|
||||||
|
},
|
||||||
|
getUnitSelectValue() {
|
||||||
|
const type = this.unitSelectType;
|
||||||
|
const filters = this.filters || {};
|
||||||
|
if (type === 'warehouse') return filters.warehouse_id;
|
||||||
|
if (type === 'delivery') return filters.delivery_unit_id;
|
||||||
|
if (type === 'business') return filters.business_unit_id;
|
||||||
|
if (type === 'supplier') return filters.supplier_id;
|
||||||
|
if (type === 'process') return filters.process_unit_id;
|
||||||
|
return filters.process_unit_id || filters.supplier_id || filters.business_unit_id || '';
|
||||||
|
},
|
||||||
|
getUnitSelectLabel() {
|
||||||
|
const type = this.unitSelectType;
|
||||||
|
const filters = this.filters || {};
|
||||||
|
if (type === 'warehouse') return filters.warehouse_name;
|
||||||
|
if (type === 'delivery') return filters.delivery_unit_name;
|
||||||
|
if (type === 'business') return filters.business_unit_name;
|
||||||
|
if (type === 'supplier') return filters.supplier_name;
|
||||||
|
if (type === 'process') return filters.process_name;
|
||||||
|
return filters.process_name || filters.supplier_name || filters.business_unit_name || '';
|
||||||
|
},
|
||||||
|
restoreFilterCache() {
|
||||||
|
const defaults = this.getDefaultFilters();
|
||||||
|
try {
|
||||||
|
const cached = this.filterStorageKey ? uni.getStorageSync(this.filterStorageKey) : null;
|
||||||
|
if (!cached || typeof cached !== 'object' || Array.isArray(cached)) {
|
||||||
|
this.filters = { ...defaults };
|
||||||
|
this.appliedFilters = { ...defaults };
|
||||||
|
this.saveFilterCache();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const filters = normalizeFilterState(cached, defaults);
|
||||||
|
this.filters = { ...filters };
|
||||||
|
this.appliedFilters = { ...filters };
|
||||||
|
} catch (e) {
|
||||||
|
this.filters = { ...defaults };
|
||||||
|
this.appliedFilters = { ...defaults };
|
||||||
|
}
|
||||||
|
},
|
||||||
|
saveFilterCache() {
|
||||||
|
if (!this.filterStorageKey) return;
|
||||||
|
try {
|
||||||
|
uni.setStorageSync(this.filterStorageKey, { ...this.appliedFilters });
|
||||||
|
} catch (e) {
|
||||||
|
// 缓存失败不影响列表筛选
|
||||||
|
}
|
||||||
|
},
|
||||||
|
commitFilters() {
|
||||||
|
const filters = normalizeFilterState(this.filters, this.getDefaultFilters());
|
||||||
|
this.filters = { ...filters };
|
||||||
|
this.appliedFilters = { ...filters };
|
||||||
|
this.saveFilterCache();
|
||||||
|
this.loadList();
|
||||||
|
},
|
||||||
|
applySearch() {
|
||||||
|
this.commitFilters();
|
||||||
|
},
|
||||||
|
cancelFilterEdit() {
|
||||||
|
this.filters = { ...(this.appliedFilters || this.getDefaultFilters()) };
|
||||||
|
},
|
||||||
|
applyFilter() {
|
||||||
|
this.commitFilters();
|
||||||
|
this.filterShow = false;
|
||||||
|
},
|
||||||
|
resetFilter() {
|
||||||
|
this.filters = this.getDefaultFilters();
|
||||||
|
},
|
||||||
|
onStatusConfirm(e) {
|
||||||
|
this.filters.audit_status = normalizeAuditStatus((e[0] || {}).value);
|
||||||
|
},
|
||||||
|
applyUnitSelectList(list, preserveSelected = true) {
|
||||||
|
const selectedValue = preserveSelected ? this.getUnitSelectValue() : '';
|
||||||
|
const selectedLabel = preserveSelected ? this.getUnitSelectLabel() : '';
|
||||||
|
this.unitSelectList = withSelectedOption(list, selectedValue, selectedLabel);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
+123
-10
@@ -1,6 +1,8 @@
|
|||||||
{
|
{
|
||||||
"easycom": {
|
"easycom": {
|
||||||
"^u-select$": "@/components/u-select/u-select.vue",
|
"^u-select$": "@/components/u-select/u-select.vue",
|
||||||
|
"^u-action-sheet$": "@/components/u-action-sheet/u-action-sheet.vue",
|
||||||
|
"^u-dropdown-item$": "@/components/u-dropdown-item/u-dropdown-item.vue",
|
||||||
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
|
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
|
||||||
},
|
},
|
||||||
"pages": [
|
"pages": [
|
||||||
@@ -422,14 +424,126 @@
|
|||||||
"enablePullDownRefresh": false
|
"enablePullDownRefresh": false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
},{
|
||||||
|
"path" : "pages/storegoods/storeGoodsProcessInList",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "加工进仓列表",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
},{
|
||||||
|
"path" : "pages/storegoods/storeGoodsProcessInAdd",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "新增加工进仓单",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
},{
|
||||||
|
"path" : "pages/storegoods/storeGoodsProcessInEdit",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "编辑加工进仓单",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
},{
|
||||||
|
"path" : "pages/storegoods/storeGoodsProcessInView",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "查看加工进仓单",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
},{
|
||||||
|
"path" : "pages/storegoods/storeGoodsPurchaseInList",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "成品采购进仓",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
},{
|
||||||
|
"path" : "pages/storegoods/storeGoodsPurchaseInAdd",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "新增采购进仓单",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
},{
|
||||||
|
"path" : "pages/storegoods/storeGoodsPurchaseInEdit",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "编辑采购进仓单",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
},{
|
||||||
|
"path" : "pages/storegoods/storeGoodsPurchaseInView",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "采购进仓单详情",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
},{
|
||||||
|
"path" : "pages/storegoods/storeGoodsProcessReturnInList",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "加工退货进仓列表",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
},{
|
||||||
|
"path" : "pages/storegoods/storeGoodsProcessReturnInAdd",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "新增加工退货进仓单",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
},{
|
||||||
|
"path" : "pages/storegoods/storeGoodsProcessReturnInEdit",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "编辑加工退货进仓单",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
},{
|
||||||
|
"path" : "pages/storegoods/storeGoodsProcessReturnInView",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "查看加工退货进仓单",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
},{
|
||||||
|
"path" : "pages/storegoods/storeGoodsProcessOutList",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "加工出仓列表",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
},{
|
||||||
|
"path" : "pages/storegoods/storeGoodsProcessOutAdd",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "新增加工出仓单",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
},{
|
||||||
|
"path" : "pages/storegoods/storeGoodsProcessOutEdit",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "编辑加工出仓单",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
},{
|
||||||
|
"path" : "pages/storegoods/storeGoodsProcessOutView",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "查看加工出仓单",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
},{
|
},{
|
||||||
"path" : "pages/storegoods/storeGoodsBusinessIn",
|
"path" : "pages/storegoods/storeGoodsBusinessIn",
|
||||||
"style" :
|
"style" :
|
||||||
{
|
{
|
||||||
"navigationBarTitleText": "成品进仓",
|
"navigationBarTitleText": "成品进仓",
|
||||||
"enablePullDownRefresh": false
|
"enablePullDownRefresh": false
|
||||||
}
|
}
|
||||||
|
|
||||||
},{
|
},{
|
||||||
"path" : "pages/storegoods/storeGoodsBusinessInAdd",
|
"path" : "pages/storegoods/storeGoodsBusinessInAdd",
|
||||||
"style" :
|
"style" :
|
||||||
@@ -570,7 +684,7 @@
|
|||||||
"navigationBarTitleText": "",
|
"navigationBarTitleText": "",
|
||||||
"enablePullDownRefresh": false
|
"enablePullDownRefresh": false
|
||||||
}
|
}
|
||||||
},{
|
},{
|
||||||
"path" : "pages/storefabric/storeFabricBusinessOutList",
|
"path" : "pages/storefabric/storeFabricBusinessOutList",
|
||||||
"style" :
|
"style" :
|
||||||
{
|
{
|
||||||
@@ -578,13 +692,6 @@
|
|||||||
"enablePullDownRefresh": false
|
"enablePullDownRefresh": false
|
||||||
}
|
}
|
||||||
},{
|
},{
|
||||||
"path": "pages/storefabric/storeFabricManualIn",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "手动进仓",
|
|
||||||
"navigationStyle": "custom",
|
|
||||||
"enablePullDownRefresh": false
|
|
||||||
}
|
|
||||||
},{
|
|
||||||
"path" : "pages/storefabric/storeFabricBusinessOutAdd",
|
"path" : "pages/storefabric/storeFabricBusinessOutAdd",
|
||||||
"style" :
|
"style" :
|
||||||
{
|
{
|
||||||
@@ -808,6 +915,12 @@
|
|||||||
"backgroundColor": "#ffffff",
|
"backgroundColor": "#ffffff",
|
||||||
"borderStyle": "white",
|
"borderStyle": "white",
|
||||||
"list": [
|
"list": [
|
||||||
|
// {
|
||||||
|
// "pagePath": "pages/sys/home/index",
|
||||||
|
// "iconPath": "static/aidex/tabbar/home_1.png",
|
||||||
|
// "selectedIconPath": "static/aidex/tabbar/home_2.png",
|
||||||
|
// "text": "首页"
|
||||||
|
// },
|
||||||
{
|
{
|
||||||
"pagePath": "pages/sys/workbench/index",
|
"pagePath": "pages/sys/workbench/index",
|
||||||
"iconPath": "static/aidex/tabbar/apply_1.png",
|
"iconPath": "static/aidex/tabbar/apply_1.png",
|
||||||
|
|||||||
@@ -58,10 +58,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.u-cell_title {
|
.u-cell_title {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
min-width: 655rpx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.u-border-bottom:last-child:after {
|
.u-border-bottom:last-child:after {
|
||||||
|
|||||||
@@ -15,10 +15,22 @@
|
|||||||
<u-form-item>
|
<u-form-item>
|
||||||
<text class="title" style="width: 200px">备注内容:{{ BillRemark }}</text>
|
<text class="title" style="width: 200px">备注内容:{{ BillRemark }}</text>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
|
<PlusBarcodePanel
|
||||||
|
v-if="usePhoneScanFallback"
|
||||||
|
:visible.sync="phoneScanPanelOpen"
|
||||||
|
hint-text="连续扫码配布,扫完可继续下一条"
|
||||||
|
:scan-time-space="1200"
|
||||||
|
@success="onPlusBarcodeSuccess"
|
||||||
|
/>
|
||||||
<u-form-item label-width="130" label="条码资料:">
|
<u-form-item label-width="130" label="条码资料:">
|
||||||
<input type="text" v-model="QRBarCode" maxlength="-1" style="width: 170px" @confirm="SalePickBillDetailScan" />
|
<input type="text" v-model="QRBarCode" maxlength="-1" style="width: 170px" @confirm="SalePickBillDetailScan" />
|
||||||
|
<text
|
||||||
|
v-if="usePhoneScanFallback && phoneScanPanelOpen"
|
||||||
|
class="phone-scan-close"
|
||||||
|
@click.stop="handlePhoneScan"
|
||||||
|
>关闭扫码</text>
|
||||||
<u-icon
|
<u-icon
|
||||||
v-if="usePhoneScanFallback"
|
v-else-if="usePhoneScanFallback"
|
||||||
name="scan"
|
name="scan"
|
||||||
size="44"
|
size="44"
|
||||||
color="#2979ff"
|
color="#2979ff"
|
||||||
@@ -44,6 +56,9 @@
|
|||||||
<text class="title" style="width: 200px">成品缸号:{{ CrockNo }}</text>
|
<text class="title" style="width: 200px">成品缸号:{{ CrockNo }}</text>
|
||||||
<text class="title" style="width: 200px">成品卷号:{{ GoodsBillNo }}</text>
|
<text class="title" style="width: 200px">成品卷号:{{ GoodsBillNo }}</text>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
|
<u-form-item>
|
||||||
|
<text class="title" style="width: 200px">外部卷号:{{ ExternVolumeNumber }}</text>
|
||||||
|
</u-form-item>
|
||||||
<u-form-item>
|
<u-form-item>
|
||||||
<text class="title">{{ BillDataMessage }}</text>
|
<text class="title">{{ BillDataMessage }}</text>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
@@ -80,8 +95,10 @@ import util, {
|
|||||||
} from "../../common/util";
|
} from "../../common/util";
|
||||||
import wybTable from "@/components/wyb-table/wyb-table.vue";
|
import wybTable from "@/components/wyb-table/wyb-table.vue";
|
||||||
import scanMixin from "@/common/scanMixin.js";
|
import scanMixin from "@/common/scanMixin.js";
|
||||||
|
import PlusBarcodePanel from "@/components/common/PlusBarcodePanel.vue";
|
||||||
let that = "";
|
let that = "";
|
||||||
export default {
|
export default {
|
||||||
|
components: { PlusBarcodePanel },
|
||||||
mixins: [scanMixin],
|
mixins: [scanMixin],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -110,6 +127,7 @@ export default {
|
|||||||
GoodsCodeName: "",
|
GoodsCodeName: "",
|
||||||
CrockNo: "",
|
CrockNo: "",
|
||||||
GoodsBillNo: "",
|
GoodsBillNo: "",
|
||||||
|
ExternVolumeNumber: "",
|
||||||
BillSumRoll: 0,
|
BillSumRoll: 0,
|
||||||
BillSumQty: 0,
|
BillSumQty: 0,
|
||||||
BillSumMQty: 0,
|
BillSumMQty: 0,
|
||||||
@@ -211,14 +229,17 @@ export default {
|
|||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
handlePhoneScan() {
|
handlePhoneScan() {
|
||||||
this.openPhoneScan();
|
this.togglePhoneScanPanel();
|
||||||
|
},
|
||||||
|
onPlusBarcodeSuccess(scanResult) {
|
||||||
|
this.handleScanResult(scanResult, this._scanCallback);
|
||||||
},
|
},
|
||||||
|
|
||||||
playSuccess() {
|
playSuccess(text) {
|
||||||
util.playSuccessAudio();
|
util.playSuccessAudio(text);
|
||||||
},
|
},
|
||||||
playError() {
|
playError(text) {
|
||||||
util.playErrorAudio();
|
util.playErrorAudio(text);
|
||||||
},
|
},
|
||||||
|
|
||||||
handleAllCrockNoChange() {
|
handleAllCrockNoChange() {
|
||||||
@@ -285,7 +306,7 @@ export default {
|
|||||||
},
|
},
|
||||||
// 添加通用错误提示方法
|
// 添加通用错误提示方法
|
||||||
showError(message) {
|
showError(message) {
|
||||||
this.playError();
|
this.playError(message);
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: message,
|
content: message,
|
||||||
@@ -294,7 +315,7 @@ export default {
|
|||||||
},
|
},
|
||||||
// 添加成功提示方法
|
// 添加成功提示方法
|
||||||
showSuccess(message) {
|
showSuccess(message) {
|
||||||
this.playSuccess();
|
this.playSuccess(message);
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: message,
|
title: message,
|
||||||
icon: 'success'
|
icon: 'success'
|
||||||
@@ -360,13 +381,13 @@ export default {
|
|||||||
|
|
||||||
if (res.data.code == 0 && res.data.msg == "success") {
|
if (res.data.code == 0 && res.data.msg == "success") {
|
||||||
var aResultData = res.data.data;
|
var aResultData = res.data.data;
|
||||||
this.playSuccess();
|
|
||||||
this.FabricGoodsNo = aResultData.product_code;
|
this.FabricGoodsNo = aResultData.product_code;
|
||||||
this.FabricGoodsName = aResultData.product_name;
|
this.FabricGoodsName = aResultData.product_name;
|
||||||
this.GoodsCodeNo = aResultData.product_color_code;
|
this.GoodsCodeNo = aResultData.product_color_code;
|
||||||
this.GoodsCodeName = aResultData.product_color_name;
|
this.GoodsCodeName = aResultData.product_color_name;
|
||||||
this.CrockNo = aResultData.dyelot_number;
|
this.CrockNo = aResultData.dyelot_number;
|
||||||
this.GoodsBillNo = aResultData.volume_number;
|
this.GoodsBillNo = aResultData.volume_number;
|
||||||
|
this.ExternVolumeNumber = aResultData.extern_volume_number || '';
|
||||||
this.QRBarCode = "";
|
this.QRBarCode = "";
|
||||||
|
|
||||||
if (aBarCodeDelStatus == 1) {
|
if (aBarCodeDelStatus == 1) {
|
||||||
@@ -396,7 +417,7 @@ export default {
|
|||||||
// 提交按钮方法
|
// 提交按钮方法
|
||||||
submitBtnFun: function () {
|
submitBtnFun: function () {
|
||||||
if (this.BillMasterID == 0) {
|
if (this.BillMasterID == 0) {
|
||||||
this.playError();
|
this.playError("单号为空,不能提交");
|
||||||
this.BillDataMessage = "单号为空,不能提交";
|
this.BillDataMessage = "单号为空,不能提交";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -433,15 +454,15 @@ export default {
|
|||||||
console.log('outFpmArrangeOrder res', res)
|
console.log('outFpmArrangeOrder res', res)
|
||||||
if (res) {
|
if (res) {
|
||||||
this.BillDataMessage = "成功生成出仓单!";
|
this.BillDataMessage = "成功生成出仓单!";
|
||||||
this.playSuccess();
|
this.playSuccess("提交成功");
|
||||||
} else {
|
} else {
|
||||||
this.playError();
|
this.playError("提交生成出仓单出错");
|
||||||
this.BillDataMessage = "提交生成出仓单出错!" + res.msg;
|
this.BillDataMessage = "提交生成出仓单出错!" + res.msg;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
this.submitLoading = false
|
this.submitLoading = false
|
||||||
this.playError();
|
this.playError("连接服务器出错");
|
||||||
this.BillDataMessage = "连接服务器出错,请检查后台服务是否启动!";
|
this.BillDataMessage = "连接服务器出错,请检查后台服务是否启动!";
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -450,6 +471,18 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
.phone-scan-close {
|
||||||
|
margin-left: 8px;
|
||||||
|
padding: 0 12px;
|
||||||
|
height: 36px;
|
||||||
|
line-height: 36px;
|
||||||
|
border: 1px solid #2979ff;
|
||||||
|
border-radius: 4px;
|
||||||
|
color: #2979ff;
|
||||||
|
background: #eaf2ff;
|
||||||
|
font-size: 34rpx;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
page {
|
page {
|
||||||
background-color: #f8f8f8;
|
background-color: #f8f8f8;
|
||||||
padding-bottom: 260rpx;
|
padding-bottom: 260rpx;
|
||||||
|
|||||||
@@ -1,138 +1,218 @@
|
|||||||
<template>
|
<template>
|
||||||
|
|
||||||
<view class="fabric-out-page">
|
<view class="fabric-out-page">
|
||||||
<view v-if="showHeaderToggle" class="fabric-out-headerBar" @click="toggleHeader">
|
|
||||||
<view class="fabric-out-headerBarMain">
|
<OrderHeaderFold v-model="headerCollapsed" :summary="form.order_no || '保存后自动生成'">
|
||||||
<text class="fabric-out-headerBarTitle">单据信息</text>
|
|
||||||
<text v-if="form.order_no" class="fabric-out-headerBarSub">{{ form.order_no }}</text>
|
<OrderStatusBar class="fabric-out-mt32" :status="displayAuditStatus" :name="displayAuditStatusName" />
|
||||||
</view>
|
|
||||||
<view class="fabric-out-headerBarAction">
|
|
||||||
<text>{{ headerExpanded ? '收起' : '展开' }}</text>
|
|
||||||
<u-icon class="fabric-out-headerBarIcon" :name="headerExpanded ? 'arrow-up' : 'arrow-down'" size="32" color="#2979ff"></u-icon>
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
</view>
|
|
||||||
|
<text class="mr26">出仓类型</text>
|
||||||
|
|
||||||
|
<view>{{ getBillTypeName() }}</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view v-show="headerExpanded">
|
<view @click="pickerSelectFun('染厂')" class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
<OrderStatusBar class="fabric-out-mt32" :status="displayAuditStatus" :name="displayAuditStatusName" />
|
|
||||||
|
<text class="mr26">染厂<text class="redXingh">*</text></text>
|
||||||
|
|
||||||
|
<view :class="form.business_unit_name ? '' : 'cBlack'">
|
||||||
|
|
||||||
|
{{ form.business_unit_name || '请选择' }}
|
||||||
|
|
||||||
|
<u-icon v-if="headerEditable" class="ml26" name="arrow-right" size="40" color="#888888"></u-icon>
|
||||||
|
|
||||||
<view class="flex-white-plr26 ptb10 bdb_f5">
|
|
||||||
<text class="mr26">出仓单号</text>
|
|
||||||
<u-input disabled placeholder="保存后自动生成" v-model="form.order_no" />
|
|
||||||
</view>
|
|
||||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
|
||||||
<text class="mr26">出仓类型</text>
|
|
||||||
<view>{{ getBillTypeName() }}</view>
|
|
||||||
</view>
|
|
||||||
<view @click="pickerSelectFun('接收单位')" class="flex-white-plr26 ptb20 bdb_f5">
|
|
||||||
<text class="mr26">接收单位<text class="redXingh">*</text></text>
|
|
||||||
<view :class="form.business_unit_name ? '' : 'cBlack'">
|
|
||||||
{{ form.business_unit_name || '请选择' }}
|
|
||||||
<u-icon v-if="headerEditable" class="ml26" name="arrow-right" size="40" color="#888888"></u-icon>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
|
||||||
<text class="mr26">{{ dateLabel }}<text class="redXingh">*</text></text>
|
|
||||||
<picker mode="date" :value="form.delivery_time" :disabled="!headerEditable" @change="bindDateChange">
|
|
||||||
<view>{{ form.delivery_time }}</view>
|
|
||||||
</picker>
|
|
||||||
</view>
|
|
||||||
<view class="flex-white-plr26-column ptb20 mt32">
|
|
||||||
<view style="margin-bottom: 8rpx;"><text>单据备注</text></view>
|
|
||||||
<u-input v-model="form.remark" :disabled="!headerEditable" type="textarea" :border="true" :height="100" :auto-height="true" />
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view v-if="showScanSection">
|
|
||||||
|
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
|
||||||
|
<text class="mr26">{{ dateLabel }}<text class="redXingh">*</text></text>
|
||||||
|
|
||||||
|
<picker mode="date" :value="form.delivery_time" :disabled="!headerEditable" @change="bindDateChange">
|
||||||
|
|
||||||
|
<view>{{ form.delivery_time }}</view>
|
||||||
|
|
||||||
|
</picker>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<view class="flex-white-plr26-column ptb20 mt32">
|
||||||
|
|
||||||
|
<view style="margin-bottom: 8rpx;"><text>单据备注</text></view>
|
||||||
|
|
||||||
|
<u-input v-model="form.remark" :disabled="!headerEditable" type="textarea" :border="true" :height="100" :auto-height="true" />
|
||||||
|
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</OrderHeaderFold>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<FabricOutDetailList
|
||||||
|
|
||||||
|
:list="form.item_data"
|
||||||
|
|
||||||
|
@fabric-info="openFabricInfo"
|
||||||
|
|
||||||
|
@fine-code="openFineCode"
|
||||||
|
|
||||||
|
>
|
||||||
|
|
||||||
<PlusBarcodePanel
|
<PlusBarcodePanel
|
||||||
ref="plusBarcodePanel"
|
slot="before-list"
|
||||||
:visible.sync="phoneScanPanelOpen"
|
:visible.sync="phoneScanPanelOpen"
|
||||||
hint-text="连续扫码出仓,扫完可继续下一条"
|
hint-text="连续扫码出仓,扫完可继续下一条"
|
||||||
:scan-time-space="1200"
|
:scan-time-space="1200"
|
||||||
@success="onPlusBarcodeSuccess"
|
@success="onPlusBarcodeSuccess"
|
||||||
/>
|
/>
|
||||||
<FabricOutScanBar
|
<FabricOutScanBar
|
||||||
|
slot="before-list"
|
||||||
:can-scan="canScan"
|
:can-scan="canScan"
|
||||||
:value="QRBarCode"
|
:value="QRBarCode"
|
||||||
:delete-mode="BarCodeDelStatus"
|
:delete-mode="BarCodeDelStatus"
|
||||||
:message="BillDataMessage"
|
:message="BillDataMessage"
|
||||||
disabled-tip="请先提交保存后再扫码"
|
disabled-tip="请先提交保存后再扫码"
|
||||||
|
:show-phone-scan="usePhoneScanFallback"
|
||||||
:scanning="phoneScanPanelOpen"
|
:scanning="phoneScanPanelOpen"
|
||||||
@input="QRBarCode = $event"
|
@input="QRBarCode = $event"
|
||||||
@scan="handleScan"
|
@scan="handleScan"
|
||||||
@phone-scan="handlePhoneScan"
|
@phone-scan="handlePhoneScan"
|
||||||
@delete-mode-change="BarCodeDelChange"
|
@delete-mode-change="BarCodeDelChange"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<FabricOutScanDetail
|
<FabricOutScanDetail
|
||||||
|
slot="before-list"
|
||||||
:detail="scanDetail"
|
:detail="scanDetail"
|
||||||
|
:item-data="form.item_data"
|
||||||
:group-keys="scanGroupKeys"
|
:group-keys="scanGroupKeys"
|
||||||
@group-change="scanGroupKeys = $event"
|
@group-change="scanGroupKeys = $event"
|
||||||
/>
|
/>
|
||||||
<FabricOutSummaryTable
|
|
||||||
:rows="form.summary_rows"
|
</FabricOutDetailList>
|
||||||
@cell-click="onSummaryCellClick"
|
|
||||||
/>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<FabricOutFooter
|
<FabricOutFooter
|
||||||
|
|
||||||
v-if="!headerSaved"
|
v-if="!headerSaved"
|
||||||
|
|
||||||
:buttons="[{ label: '提交保存', action: 'save' }]"
|
:buttons="[{ label: '提交保存', action: 'save' }]"
|
||||||
|
|
||||||
single
|
single
|
||||||
|
|
||||||
@action="submitSave"
|
@action="submitSave"
|
||||||
/>
|
|
||||||
<FabricOutFooter
|
|
||||||
v-else
|
|
||||||
:buttons="statusActionButtons"
|
|
||||||
@action="handleStatusAction"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<search-select-popup
|
<FabricOutFooter
|
||||||
:show.sync="selectShow"
|
|
||||||
title="选择接收单位"
|
v-else
|
||||||
placeholder="请输入染厂名称"
|
|
||||||
:list="selectList"
|
:buttons="statusActionButtons"
|
||||||
@confirm="selectConfirmFun"
|
|
||||||
|
@action="handleStatusAction"
|
||||||
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<u-select v-model="selectShow" :list="selectList" :remote="isRemoteSelect" :loading="selectSearching" @search="onSelectSearch" @confirm="selectConfirmFun"></u-select>
|
||||||
|
|
||||||
<FabricInfoPopup :show.sync="fabricInfoShow" :data="currentFabricInfo" />
|
<FabricInfoPopup :show.sync="fabricInfoShow" :data="currentFabricInfo" />
|
||||||
|
|
||||||
<FineCodePopup :show.sync="fineCodeShow" :list="currentFineCodes" :readonly="false" @delete="onDeleteFineCode" />
|
<FineCodePopup :show.sync="fineCodeShow" :list="currentFineCodes" :readonly="false" @delete="onDeleteFineCode" />
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import formMixin from './storeFabricBusinessOutMixin.js';
|
import formMixin from './storeFabricBusinessOutMixin.js';
|
||||||
|
|
||||||
import FabricInfoPopup from '@/components/storefabric/FabricInfoPopup.vue';
|
import FabricInfoPopup from '@/components/storefabric/FabricInfoPopup.vue';
|
||||||
|
|
||||||
import FineCodePopup from '@/components/storefabric/FineCodePopup.vue';
|
import FineCodePopup from '@/components/storefabric/FineCodePopup.vue';
|
||||||
|
|
||||||
import OrderStatusBar from '@/components/storefabric/OrderStatusBar.vue';
|
import OrderStatusBar from '@/components/storefabric/OrderStatusBar.vue';
|
||||||
|
|
||||||
|
import OrderHeaderFold from '@/components/storefabric/OrderHeaderFold.vue';
|
||||||
|
|
||||||
|
import FabricOutDetailList from '@/components/storefabric/FabricOutDetailList.vue';
|
||||||
|
|
||||||
import FabricOutScanBar from '@/components/storefabric/FabricOutScanBar.vue';
|
import FabricOutScanBar from '@/components/storefabric/FabricOutScanBar.vue';
|
||||||
|
|
||||||
import FabricOutScanDetail from '@/components/storefabric/FabricOutScanDetail.vue';
|
import FabricOutScanDetail from '@/components/storefabric/FabricOutScanDetail.vue';
|
||||||
import FabricOutSummaryTable from '@/components/storefabric/FabricOutSummaryTable.vue';
|
|
||||||
import FabricOutFooter from '@/components/storefabric/FabricOutFooter.vue';
|
import FabricOutFooter from '@/components/storefabric/FabricOutFooter.vue';
|
||||||
import SearchSelectPopup from '@/components/storefabric/SearchSelectPopup.vue';
|
|
||||||
import PlusBarcodePanel from '@/components/common/PlusBarcodePanel.vue';
|
import PlusBarcodePanel from '@/components/common/PlusBarcodePanel.vue';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
FabricInfoPopup,
|
|
||||||
FineCodePopup,
|
|
||||||
OrderStatusBar,
|
|
||||||
FabricOutScanBar,
|
|
||||||
FabricOutScanDetail,
|
|
||||||
FabricOutSummaryTable,
|
|
||||||
FabricOutFooter,
|
|
||||||
SearchSelectPopup,
|
|
||||||
PlusBarcodePanel,
|
PlusBarcodePanel,
|
||||||
|
|
||||||
|
FabricInfoPopup,
|
||||||
|
|
||||||
|
FineCodePopup,
|
||||||
|
|
||||||
|
OrderStatusBar,
|
||||||
|
|
||||||
|
OrderHeaderFold,
|
||||||
|
|
||||||
|
FabricOutDetailList,
|
||||||
|
|
||||||
|
FabricOutScanBar,
|
||||||
|
|
||||||
|
FabricOutScanDetail,
|
||||||
|
|
||||||
|
FabricOutFooter,
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
mixins: [formMixin],
|
mixins: [formMixin],
|
||||||
|
|
||||||
onLoad() {
|
onLoad() {
|
||||||
|
|
||||||
uni.setNavigationBarTitle({ title: '新增坯布出仓单' });
|
uni.setNavigationBarTitle({ title: '新增坯布出仓单' });
|
||||||
|
|
||||||
this.pageMode = 'add';
|
this.pageMode = 'add';
|
||||||
|
|
||||||
this.loadBaseDropdowns();
|
this.loadBaseDropdowns();
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|
||||||
@import '@/pages/storefabric/storeFabricBusinessOutPage.scss';
|
@import '@/pages/storefabric/storeFabricBusinessOutPage.scss';
|
||||||
|
|
||||||
page {
|
page {
|
||||||
background-color: #F8F8F8;
|
background-color: #F8F8F8;
|
||||||
padding-bottom: 260rpx;
|
padding-bottom: 260rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,53 +1,44 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="fabric-out-page">
|
<view class="fabric-out-page">
|
||||||
<view v-if="showHeaderToggle" class="fabric-out-headerBar" @click="toggleHeader">
|
<OrderHeaderFold v-model="headerCollapsed" :summary="form.order_no">
|
||||||
<view class="fabric-out-headerBarMain">
|
<OrderStatusBar class="fabric-out-mt32" :status="displayAuditStatus" :name="displayAuditStatusName" />
|
||||||
<text class="fabric-out-headerBarTitle">单据信息</text>
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
<text v-if="form.order_no" class="fabric-out-headerBarSub">{{ form.order_no }}</text>
|
<text class="mr26">出仓类型</text>
|
||||||
</view>
|
<text>{{ getBillTypeName() }}</text>
|
||||||
<view class="fabric-out-headerBarAction">
|
|
||||||
<text>{{ headerExpanded ? '收起' : '展开' }}</text>
|
|
||||||
<u-icon class="fabric-out-headerBarIcon" :name="headerExpanded ? 'arrow-up' : 'arrow-down'" size="32" color="#2979ff"></u-icon>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
<view v-show="headerExpanded">
|
<text class="mr26">染厂</text>
|
||||||
<OrderStatusBar class="fabric-out-mt32" :status="displayAuditStatus" :name="displayAuditStatusName" />
|
<text>{{ form.business_unit_name || '-' }}</text>
|
||||||
<view class="flex-white-plr26 ptb10 bdb_f5">
|
|
||||||
<text class="mr26">出仓单号</text>
|
|
||||||
<text>{{ form.order_no }}</text>
|
|
||||||
</view>
|
|
||||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
|
||||||
<text class="mr26">出仓类型</text>
|
|
||||||
<text>{{ getBillTypeName() }}</text>
|
|
||||||
</view>
|
|
||||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
|
||||||
<text class="mr26">接收单位</text>
|
|
||||||
<text>{{ form.business_unit_name || '-' }}</text>
|
|
||||||
</view>
|
|
||||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
|
||||||
<text class="mr26">{{ dateLabel }}</text>
|
|
||||||
<text>{{ form.delivery_time }}</text>
|
|
||||||
</view>
|
|
||||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
|
||||||
<text class="mr26">单据备注</text>
|
|
||||||
<text>{{ form.remark || '-' }}</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">{{ dateLabel }}</text>
|
||||||
|
<text>{{ form.delivery_time }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">单据备注</text>
|
||||||
|
<text>{{ form.remark || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
</OrderHeaderFold>
|
||||||
|
|
||||||
<view v-if="showScanSection">
|
<FabricOutDetailList
|
||||||
|
:list="form.item_data"
|
||||||
|
@fabric-info="openFabricInfo"
|
||||||
|
@fine-code="openFineCode"
|
||||||
|
>
|
||||||
<PlusBarcodePanel
|
<PlusBarcodePanel
|
||||||
ref="plusBarcodePanel"
|
slot="before-list"
|
||||||
:visible.sync="phoneScanPanelOpen"
|
:visible.sync="phoneScanPanelOpen"
|
||||||
hint-text="连续扫码出仓,扫完可继续下一条"
|
hint-text="连续扫码出仓,扫完可继续下一条"
|
||||||
:scan-time-space="1200"
|
:scan-time-space="1200"
|
||||||
@success="onPlusBarcodeSuccess"
|
@success="onPlusBarcodeSuccess"
|
||||||
/>
|
/>
|
||||||
<FabricOutScanBar
|
<FabricOutScanBar
|
||||||
|
slot="before-list"
|
||||||
:can-scan="canScan"
|
:can-scan="canScan"
|
||||||
:value="QRBarCode"
|
:value="QRBarCode"
|
||||||
:delete-mode="BarCodeDelStatus"
|
:delete-mode="BarCodeDelStatus"
|
||||||
:message="BillDataMessage"
|
:message="BillDataMessage"
|
||||||
|
:show-phone-scan="usePhoneScanFallback"
|
||||||
:scanning="phoneScanPanelOpen"
|
:scanning="phoneScanPanelOpen"
|
||||||
@input="QRBarCode = $event"
|
@input="QRBarCode = $event"
|
||||||
@scan="handleScan"
|
@scan="handleScan"
|
||||||
@@ -55,25 +46,17 @@
|
|||||||
@delete-mode-change="BarCodeDelChange"
|
@delete-mode-change="BarCodeDelChange"
|
||||||
/>
|
/>
|
||||||
<FabricOutScanDetail
|
<FabricOutScanDetail
|
||||||
|
slot="before-list"
|
||||||
:detail="scanDetail"
|
:detail="scanDetail"
|
||||||
|
:item-data="form.item_data"
|
||||||
:group-keys="scanGroupKeys"
|
:group-keys="scanGroupKeys"
|
||||||
@group-change="scanGroupKeys = $event"
|
@group-change="scanGroupKeys = $event"
|
||||||
/>
|
/>
|
||||||
<FabricOutSummaryTable
|
</FabricOutDetailList>
|
||||||
:rows="form.summary_rows"
|
|
||||||
@cell-click="onSummaryCellClick"
|
|
||||||
/>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<FabricOutFooter :buttons="statusActionButtons" @action="handleStatusAction" />
|
<FabricOutFooter :buttons="statusActionButtons" @action="handleStatusAction" />
|
||||||
|
|
||||||
<search-select-popup
|
<u-select v-model="selectShow" :list="selectList" :remote="isRemoteSelect" :loading="selectSearching" @search="onSelectSearch" @confirm="selectConfirmFun"></u-select>
|
||||||
:show.sync="selectShow"
|
|
||||||
title="选择接收单位"
|
|
||||||
placeholder="请输入染厂名称"
|
|
||||||
:list="selectList"
|
|
||||||
@confirm="selectConfirmFun"
|
|
||||||
/>
|
|
||||||
<FabricInfoPopup :show.sync="fabricInfoShow" :data="currentFabricInfo" />
|
<FabricInfoPopup :show.sync="fabricInfoShow" :data="currentFabricInfo" />
|
||||||
<FineCodePopup :show.sync="fineCodeShow" :list="currentFineCodes" :readonly="false" @delete="onDeleteFineCode" />
|
<FineCodePopup :show.sync="fineCodeShow" :list="currentFineCodes" :readonly="false" @delete="onDeleteFineCode" />
|
||||||
</view>
|
</view>
|
||||||
@@ -84,36 +67,34 @@ import formMixin from './storeFabricBusinessOutMixin.js';
|
|||||||
import FabricInfoPopup from '@/components/storefabric/FabricInfoPopup.vue';
|
import FabricInfoPopup from '@/components/storefabric/FabricInfoPopup.vue';
|
||||||
import FineCodePopup from '@/components/storefabric/FineCodePopup.vue';
|
import FineCodePopup from '@/components/storefabric/FineCodePopup.vue';
|
||||||
import OrderStatusBar from '@/components/storefabric/OrderStatusBar.vue';
|
import OrderStatusBar from '@/components/storefabric/OrderStatusBar.vue';
|
||||||
|
import OrderHeaderFold from '@/components/storefabric/OrderHeaderFold.vue';
|
||||||
|
import FabricOutDetailList from '@/components/storefabric/FabricOutDetailList.vue';
|
||||||
import FabricOutScanBar from '@/components/storefabric/FabricOutScanBar.vue';
|
import FabricOutScanBar from '@/components/storefabric/FabricOutScanBar.vue';
|
||||||
import FabricOutScanDetail from '@/components/storefabric/FabricOutScanDetail.vue';
|
import FabricOutScanDetail from '@/components/storefabric/FabricOutScanDetail.vue';
|
||||||
import FabricOutSummaryTable from '@/components/storefabric/FabricOutSummaryTable.vue';
|
|
||||||
import FabricOutFooter from '@/components/storefabric/FabricOutFooter.vue';
|
import FabricOutFooter from '@/components/storefabric/FabricOutFooter.vue';
|
||||||
import SearchSelectPopup from '@/components/storefabric/SearchSelectPopup.vue';
|
|
||||||
import PlusBarcodePanel from '@/components/common/PlusBarcodePanel.vue';
|
import PlusBarcodePanel from '@/components/common/PlusBarcodePanel.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
PlusBarcodePanel,
|
||||||
FabricInfoPopup,
|
FabricInfoPopup,
|
||||||
FineCodePopup,
|
FineCodePopup,
|
||||||
OrderStatusBar,
|
OrderStatusBar,
|
||||||
|
OrderHeaderFold,
|
||||||
|
FabricOutDetailList,
|
||||||
FabricOutScanBar,
|
FabricOutScanBar,
|
||||||
FabricOutScanDetail,
|
FabricOutScanDetail,
|
||||||
FabricOutSummaryTable,
|
|
||||||
FabricOutFooter,
|
FabricOutFooter,
|
||||||
SearchSelectPopup,
|
|
||||||
PlusBarcodePanel,
|
|
||||||
},
|
},
|
||||||
mixins: [formMixin],
|
mixins: [formMixin],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
pageMode: 'edit',
|
headerCollapsed: true,
|
||||||
headerExpanded: false,
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
uni.setNavigationBarTitle({ title: '编辑坯布出仓单' });
|
uni.setNavigationBarTitle({ title: '编辑坯布出仓单' });
|
||||||
this.pageMode = 'edit';
|
this.pageMode = 'edit';
|
||||||
this.headerExpanded = false;
|
|
||||||
if (e.id) {
|
if (e.id) {
|
||||||
this.loadOrder(Number(e.id), { rejectIfLocked: true });
|
this.loadOrder(Number(e.id), { rejectIfLocked: true });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,18 @@
|
|||||||
@custom="applySearch"
|
@custom="applySearch"
|
||||||
@clear="applySearch"
|
@clear="applySearch"
|
||||||
/>
|
/>
|
||||||
<view class="filterBtn" :class="{ 'filterBtn--active': hasActiveFilter }" @click="filterShow = true">
|
<view
|
||||||
|
class="filterBtn"
|
||||||
|
:class="{ 'filter-active': hasActiveFilter }"
|
||||||
|
@click="filterShow = true"
|
||||||
|
>
|
||||||
<view class="filterBtn__icon">
|
<view class="filterBtn__icon">
|
||||||
<u-icon name="list" size="44" :color="hasActiveFilter ? '#2979ff' : '#666'"></u-icon>
|
<u-icon
|
||||||
|
:key="hasActiveFilter ? 'on' : 'off'"
|
||||||
|
name="list"
|
||||||
|
size="44"
|
||||||
|
:color="hasActiveFilter ? '#2979ff' : '#666'"
|
||||||
|
></u-icon>
|
||||||
<view v-if="hasActiveFilter" class="filterBtn__badge"></view>
|
<view v-if="hasActiveFilter" class="filterBtn__badge"></view>
|
||||||
</view>
|
</view>
|
||||||
<text>筛选</text>
|
<text>筛选</text>
|
||||||
@@ -61,12 +70,12 @@
|
|||||||
</picker>
|
</picker>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="filterItem" @click="openDeliveryUnitSelect">
|
<!-- <view class="filterItem" @click="openDeliveryUnitSelect">-->
|
||||||
<text class="filterLabel">出仓单位</text>
|
<!-- <text class="filterLabel">出仓单位</text>-->
|
||||||
<view class="filterValue">{{ deliveryUnitLabel || '全部' }} <u-icon name="arrow-right" size="36"></u-icon></view>
|
<!-- <view class="filterValue">{{ deliveryUnitLabel || '全部' }} <u-icon name="arrow-right" size="28"></u-icon></view>-->
|
||||||
</view>
|
<!-- </view>-->
|
||||||
<view class="filterItem" @click="openBusinessUnitSelect">
|
<view class="filterItem" @click="openBusinessUnitSelect">
|
||||||
<text class="filterLabel">接收单位</text>
|
<text class="filterLabel">染厂</text>
|
||||||
<view class="filterValue">{{ businessUnitLabel || '全部' }} <u-icon name="arrow-right" size="36"></u-icon></view>
|
<view class="filterValue">{{ businessUnitLabel || '全部' }} <u-icon name="arrow-right" size="36"></u-icon></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="filterItem" @click="openStatusSelect">
|
<view class="filterItem" @click="openStatusSelect">
|
||||||
@@ -91,37 +100,41 @@
|
|||||||
<u-select
|
<u-select
|
||||||
class="pdaSelect"
|
class="pdaSelect"
|
||||||
v-model="unitSelectShow"
|
v-model="unitSelectShow"
|
||||||
title="选择出仓单位"
|
title="选择染厂"
|
||||||
:list="unitSelectList"
|
:list="unitSelectList"
|
||||||
:default-value="unitSelectDefault"
|
:default-value="unitSelectDefault"
|
||||||
|
remote
|
||||||
|
:loading="selectSearching"
|
||||||
|
@search="onUnitSearch"
|
||||||
@confirm="onUnitConfirm"
|
@confirm="onUnitConfirm"
|
||||||
></u-select>
|
></u-select>
|
||||||
<search-select-popup
|
|
||||||
:show.sync="businessUnitSelectShow"
|
|
||||||
title="选择接收单位"
|
|
||||||
placeholder="请输入染厂名称"
|
|
||||||
:list="businessUnitSelectList"
|
|
||||||
@confirm="onBusinessUnitConfirm"
|
|
||||||
/>
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import addBtn from '@/components/addBtn/addBtn.vue';
|
import addBtn from '@/components/addBtn/addBtn.vue';
|
||||||
import FabricOutItem from '@/components/card/storeFabricBusinessOutItem.vue';
|
import FabricOutItem from '@/components/card/storeFabricBusinessOutItem.vue';
|
||||||
import SearchSelectPopup from '@/components/storefabric/SearchSelectPopup.vue';
|
|
||||||
import {
|
import {
|
||||||
getStatusOptions,
|
getStatusOptions,
|
||||||
AUDIT_STATUS,
|
AUDIT_STATUS,
|
||||||
AUDIT_STATUS_MAP,
|
AUDIT_STATUS_MAP,
|
||||||
BILL_TYPES,
|
BILL_TYPES,
|
||||||
BUSINESS_UNIT_TYPE_DYEING_FACTORY,
|
BUSINESS_UNIT_TYPE_DYE_FACTORY,
|
||||||
formatRoll,
|
formatRoll,
|
||||||
mapToSelectOptions,
|
mapToSelectOptions,
|
||||||
fetchAllOrderList,
|
fetchAllOrderList,
|
||||||
} from '@/common/storeFabricBusinessOut';
|
} from '@/common/storeFabricBusinessOut';
|
||||||
|
import { withNameParam } from '@/common/remoteSelect';
|
||||||
|
|
||||||
const FILTER_STORAGE_KEY = 'storeFabricBusinessOutListFilters';
|
const FILTER_STORAGE_KEY = 'storeFabricBusinessOutListFilters_v2';
|
||||||
|
|
||||||
|
const hasFilterValue = (value) => value !== '' && value !== null && value !== undefined;
|
||||||
|
|
||||||
|
const normalizeAuditStatus = (value) => {
|
||||||
|
if (!hasFilterValue(value)) return '';
|
||||||
|
const status = Number(value);
|
||||||
|
return Number.isNaN(status) ? '' : status;
|
||||||
|
};
|
||||||
|
|
||||||
const createDefaultFilters = () => ({
|
const createDefaultFilters = () => ({
|
||||||
order_no: '',
|
order_no: '',
|
||||||
@@ -139,17 +152,21 @@ const normalizeFilters = (value) => {
|
|||||||
if (!value || typeof value !== 'object' || Array.isArray(value)) return filters;
|
if (!value || typeof value !== 'object' || Array.isArray(value)) return filters;
|
||||||
|
|
||||||
Object.keys(filters).forEach((key) => {
|
Object.keys(filters).forEach((key) => {
|
||||||
|
if (key === 'audit_status') return;
|
||||||
if (typeof value[key] === 'string' || typeof value[key] === 'number') {
|
if (typeof value[key] === 'string' || typeof value[key] === 'number') {
|
||||||
filters[key] = value[key];
|
filters[key] = value[key];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (!filters.delivery_unit_id) filters.delivery_unit_name = '';
|
if (!filters.delivery_unit_id) filters.delivery_unit_name = '';
|
||||||
if (!filters.business_unit_id) filters.business_unit_name = '';
|
if (!filters.business_unit_id) filters.business_unit_name = '';
|
||||||
|
if (Object.prototype.hasOwnProperty.call(value, 'audit_status')) {
|
||||||
|
filters.audit_status = normalizeAuditStatus(value.audit_status);
|
||||||
|
}
|
||||||
return filters;
|
return filters;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { addBtn, FabricOutItem, SearchSelectPopup },
|
components: { addBtn, FabricOutItem },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
list: [],
|
list: [],
|
||||||
@@ -158,11 +175,13 @@ export default {
|
|||||||
filterShow: false,
|
filterShow: false,
|
||||||
statusSelectShow: false,
|
statusSelectShow: false,
|
||||||
unitSelectShow: false,
|
unitSelectShow: false,
|
||||||
businessUnitSelectShow: false,
|
|
||||||
unitSelectType: '',
|
unitSelectType: '',
|
||||||
deliveryUnitOptions: [],
|
deliveryUnitOptions: [],
|
||||||
businessUnitOptions: [],
|
businessUnitOptions: [],
|
||||||
unitOptionsLoading: false,
|
unitOptionsLoading: false,
|
||||||
|
selectSearching: false,
|
||||||
|
unitSearchSeq: 0,
|
||||||
|
unitSelectList: [{ value: '', label: '全部' }],
|
||||||
billTypeName: (BILL_TYPES[0] || {}).label || '坯布其他出货单',
|
billTypeName: (BILL_TYPES[0] || {}).label || '坯布其他出货单',
|
||||||
filters: createDefaultFilters(),
|
filters: createDefaultFilters(),
|
||||||
appliedFilters: createDefaultFilters(),
|
appliedFilters: createDefaultFilters(),
|
||||||
@@ -183,12 +202,6 @@ export default {
|
|||||||
businessUnitLabel() {
|
businessUnitLabel() {
|
||||||
return this.filters.business_unit_name || '';
|
return this.filters.business_unit_name || '';
|
||||||
},
|
},
|
||||||
unitSelectList() {
|
|
||||||
return [{ value: '', label: '全部' }, ...this.deliveryUnitOptions];
|
|
||||||
},
|
|
||||||
businessUnitSelectList() {
|
|
||||||
return [{ value: '', label: '全部' }, ...this.businessUnitOptions];
|
|
||||||
},
|
|
||||||
statusSelectDefault() {
|
statusSelectDefault() {
|
||||||
const index = this.statusSelectList.findIndex(
|
const index = this.statusSelectList.findIndex(
|
||||||
(item) => String(item.value) === String(this.filters.audit_status)
|
(item) => String(item.value) === String(this.filters.audit_status)
|
||||||
@@ -196,20 +209,23 @@ export default {
|
|||||||
return [index >= 0 ? index : 0];
|
return [index >= 0 ? index : 0];
|
||||||
},
|
},
|
||||||
unitSelectDefault() {
|
unitSelectDefault() {
|
||||||
|
const selectedValue = this.unitSelectType === 'delivery'
|
||||||
|
? this.filters.delivery_unit_id
|
||||||
|
: this.filters.business_unit_id;
|
||||||
const index = this.unitSelectList.findIndex(
|
const index = this.unitSelectList.findIndex(
|
||||||
(item) => String(item.value) === String(this.filters.delivery_unit_id)
|
(item) => String(item.value) === String(selectedValue)
|
||||||
);
|
);
|
||||||
return [index >= 0 ? index : 0];
|
return [index >= 0 ? index : 0];
|
||||||
},
|
},
|
||||||
hasActiveFilter() {
|
hasActiveFilter() {
|
||||||
const filters = this.appliedFilters;
|
const filters = this.appliedFilters || {};
|
||||||
return Boolean(
|
return Boolean(
|
||||||
String(filters.order_no || '').trim()
|
String(filters.order_no || '').trim()
|
||||||
|| filters.start_date
|
|| filters.start_date
|
||||||
|| filters.end_date
|
|| filters.end_date
|
||||||
|| filters.delivery_unit_id
|
|| filters.delivery_unit_id
|
||||||
|| filters.business_unit_id
|
|| filters.business_unit_id
|
||||||
|| (filters.audit_status !== '' && filters.audit_status !== null)
|
|| hasFilterValue(filters.audit_status)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -228,12 +244,21 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
restoreFilterCache() {
|
restoreFilterCache() {
|
||||||
try {
|
try {
|
||||||
const filters = normalizeFilters(uni.getStorageSync(FILTER_STORAGE_KEY));
|
const cached = uni.getStorageSync(FILTER_STORAGE_KEY);
|
||||||
|
if (!cached || typeof cached !== 'object' || Array.isArray(cached)) {
|
||||||
|
const filters = createDefaultFilters();
|
||||||
|
this.filters = { ...filters };
|
||||||
|
this.appliedFilters = { ...filters };
|
||||||
|
this.saveFilterCache();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const filters = normalizeFilters(cached);
|
||||||
this.filters = { ...filters };
|
this.filters = { ...filters };
|
||||||
this.appliedFilters = { ...filters };
|
this.appliedFilters = { ...filters };
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.filters = createDefaultFilters();
|
const filters = createDefaultFilters();
|
||||||
this.appliedFilters = createDefaultFilters();
|
this.filters = { ...filters };
|
||||||
|
this.appliedFilters = { ...filters };
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
saveFilterCache() {
|
saveFilterCache() {
|
||||||
@@ -270,7 +295,7 @@ export default {
|
|||||||
},
|
},
|
||||||
loadBusinessUnitOptions() {
|
loadBusinessUnitOptions() {
|
||||||
if (this.businessUnitOptions.length) return Promise.resolve(this.businessUnitOptions);
|
if (this.businessUnitOptions.length) return Promise.resolve(this.businessUnitOptions);
|
||||||
return this.$u.api.businessUnit.list({ unit_type_id: BUSINESS_UNIT_TYPE_DYEING_FACTORY })
|
return this.$u.api.businessUnit.list({ unit_type_id: BUSINESS_UNIT_TYPE_DYE_FACTORY })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.businessUnitOptions = mapToSelectOptions(res);
|
this.businessUnitOptions = mapToSelectOptions(res);
|
||||||
return this.businessUnitOptions;
|
return this.businessUnitOptions;
|
||||||
@@ -280,44 +305,62 @@ export default {
|
|||||||
return this.businessUnitOptions;
|
return this.businessUnitOptions;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
applyUnitSelectList(list, preserveSelected = true) {
|
||||||
|
const rows = Array.isArray(list) ? list.slice() : [];
|
||||||
|
if (preserveSelected) {
|
||||||
|
const isDelivery = this.unitSelectType === 'delivery';
|
||||||
|
const selectedValue = isDelivery
|
||||||
|
? this.filters.delivery_unit_id
|
||||||
|
: this.filters.business_unit_id;
|
||||||
|
const selectedLabel = isDelivery
|
||||||
|
? this.filters.delivery_unit_name
|
||||||
|
: this.filters.business_unit_name;
|
||||||
|
const selectedExists = rows.some(
|
||||||
|
(item) => String(item.value) === String(selectedValue)
|
||||||
|
);
|
||||||
|
if (selectedValue !== '' && selectedValue !== null && selectedValue !== undefined && !selectedExists) {
|
||||||
|
rows.unshift({ value: selectedValue, label: selectedLabel || String(selectedValue) });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.unitSelectList = [{ value: '', label: '全部' }].concat(rows);
|
||||||
|
},
|
||||||
openUnitSelect(type) {
|
openUnitSelect(type) {
|
||||||
if (this.unitOptionsLoading) return;
|
this.unitSelectType = type;
|
||||||
this.unitOptionsLoading = true;
|
const cache = type === 'delivery' ? this.deliveryUnitOptions : this.businessUnitOptions;
|
||||||
const loadFn = type === 'delivery' ? this.loadDeliveryUnitOptions : this.loadBusinessUnitOptions;
|
this.applyUnitSelectList(cache);
|
||||||
loadFn.call(this)
|
this.unitSelectShow = true;
|
||||||
.then((list) => {
|
},
|
||||||
if (!list.length) {
|
onUnitSearch(keyword) {
|
||||||
uni.showToast({ title: '暂无可选单位', icon: 'none' });
|
const seq = ++this.unitSearchSeq;
|
||||||
return;
|
const isDelivery = this.unitSelectType === 'delivery';
|
||||||
|
const empty = !String(keyword || '').trim();
|
||||||
|
this.selectSearching = true;
|
||||||
|
const params = isDelivery ? {} : { unit_type_id: BUSINESS_UNIT_TYPE_DYE_FACTORY };
|
||||||
|
this.$u.api.businessUnit.list(withNameParam(params, keyword))
|
||||||
|
.then((res) => {
|
||||||
|
if (seq !== this.unitSearchSeq) return;
|
||||||
|
const list = mapToSelectOptions(res);
|
||||||
|
if (empty) {
|
||||||
|
if (isDelivery) this.deliveryUnitOptions = list;
|
||||||
|
else this.businessUnitOptions = list;
|
||||||
}
|
}
|
||||||
this.unitSelectType = type;
|
this.applyUnitSelectList(list, empty);
|
||||||
this.unitSelectShow = true;
|
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.catch((e) => {
|
||||||
this.unitOptionsLoading = false;
|
if (seq !== this.unitSearchSeq) return;
|
||||||
|
uni.showToast({ title: (e && e.message) || '搜索失败', icon: 'none' });
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
if (seq === this.unitSearchSeq) this.selectSearching = false;
|
||||||
|
}, () => {
|
||||||
|
if (seq === this.unitSearchSeq) this.selectSearching = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
openDeliveryUnitSelect() {
|
openDeliveryUnitSelect() {
|
||||||
this.openUnitSelect('delivery');
|
this.openUnitSelect('delivery');
|
||||||
},
|
},
|
||||||
openBusinessUnitSelect() {
|
openBusinessUnitSelect() {
|
||||||
if (this.unitOptionsLoading) return;
|
this.openUnitSelect('business');
|
||||||
this.unitOptionsLoading = true;
|
|
||||||
this.loadBusinessUnitOptions()
|
|
||||||
.then((list) => {
|
|
||||||
if (!list.length) {
|
|
||||||
uni.showToast({ title: '暂无可选单位', icon: 'none' });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.businessUnitSelectShow = true;
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
this.unitOptionsLoading = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
onBusinessUnitConfirm(item) {
|
|
||||||
this.filters.business_unit_id = item.value;
|
|
||||||
this.filters.business_unit_name = item.value ? item.label : '';
|
|
||||||
},
|
},
|
||||||
onUnitConfirm(e) {
|
onUnitConfirm(e) {
|
||||||
const item = e[0] || {};
|
const item = e[0] || {};
|
||||||
@@ -333,7 +376,7 @@ export default {
|
|||||||
const filters = this.appliedFilters;
|
const filters = this.appliedFilters;
|
||||||
const params = {};
|
const params = {};
|
||||||
if (filters.order_no) params.order_no = filters.order_no;
|
if (filters.order_no) params.order_no = filters.order_no;
|
||||||
if (filters.audit_status !== '' && filters.audit_status !== null) {
|
if (hasFilterValue(filters.audit_status)) {
|
||||||
params.audit_status = filters.audit_status;
|
params.audit_status = filters.audit_status;
|
||||||
}
|
}
|
||||||
fetchAllOrderList((p) => this.$u.api.gfmOtherDeliveryOrder.list(p), params)
|
fetchAllOrderList((p) => this.$u.api.gfmOtherDeliveryOrder.list(p), params)
|
||||||
@@ -384,13 +427,12 @@ export default {
|
|||||||
this.loadList();
|
this.loadList();
|
||||||
},
|
},
|
||||||
goView(item) {
|
goView(item) {
|
||||||
const page = Number(item.audit_status) === AUDIT_STATUS.PENDING
|
uni.navigateTo({ url: `./storeFabricBusinessOutView?id=${item.id}` });
|
||||||
? 'storeFabricBusinessOutEdit'
|
|
||||||
: 'storeFabricBusinessOutView';
|
|
||||||
uni.navigateTo({ url: `./${page}?id=${item.id}` });
|
|
||||||
},
|
},
|
||||||
openStatusSelect() { this.statusSelectShow = true; },
|
openStatusSelect() { this.statusSelectShow = true; },
|
||||||
onStatusConfirm(e) { this.filters.audit_status = e[0].value; },
|
onStatusConfirm(e) {
|
||||||
|
this.filters.audit_status = normalizeAuditStatus((e[0] || {}).value);
|
||||||
|
},
|
||||||
resetFilter() {
|
resetFilter() {
|
||||||
this.filters = createDefaultFilters();
|
this.filters = createDefaultFilters();
|
||||||
},
|
},
|
||||||
@@ -403,146 +445,5 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
@import '@/common/pda-typography.scss';
|
@import '@/common/list-filter.scss';
|
||||||
|
|
||||||
page { background-color: #F8F8F8; }
|
|
||||||
.filterBar { display: flex; align-items: center; padding: 16rpx 20rpx; background: #fff; gap: 16rpx; }
|
|
||||||
.filterBtn {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
min-width: 88rpx;
|
|
||||||
min-height: 76rpx;
|
|
||||||
padding: 6rpx 8rpx;
|
|
||||||
border: 2rpx solid transparent;
|
|
||||||
border-radius: 10rpx;
|
|
||||||
box-sizing: border-box;
|
|
||||||
font-size: $pda-font-nav-sub;
|
|
||||||
line-height: 1.2;
|
|
||||||
color: #666;
|
|
||||||
transition: color 0.2s, background-color 0.2s, border-color 0.2s;
|
|
||||||
}
|
|
||||||
.filterBtn--active {
|
|
||||||
color: #2979ff;
|
|
||||||
background: #eef5ff;
|
|
||||||
border-color: #9fc5ff;
|
|
||||||
}
|
|
||||||
.filterBtn__icon {
|
|
||||||
position: relative;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
.filterBtn__badge {
|
|
||||||
position: absolute;
|
|
||||||
top: -3rpx;
|
|
||||||
right: -7rpx;
|
|
||||||
width: 13rpx;
|
|
||||||
height: 13rpx;
|
|
||||||
border: 3rpx solid #fff;
|
|
||||||
border-radius: 50%;
|
|
||||||
background: #ff4d4f;
|
|
||||||
box-sizing: content-box;
|
|
||||||
}
|
|
||||||
.filterPanel {
|
|
||||||
min-height: 100%;
|
|
||||||
padding: 32rpx 28rpx;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
.filterTitle {
|
|
||||||
margin-bottom: 30rpx;
|
|
||||||
font-size: $pda-font-popup-title;
|
|
||||||
font-weight: bold;
|
|
||||||
color: #202328;
|
|
||||||
}
|
|
||||||
.filterItem { margin-bottom: 28rpx; }
|
|
||||||
.filterLabel {
|
|
||||||
display: block;
|
|
||||||
margin-bottom: 14rpx;
|
|
||||||
font-size: $pda-font-body;
|
|
||||||
line-height: 1.35;
|
|
||||||
color: #555b66;
|
|
||||||
}
|
|
||||||
.filterInput {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
min-height: $pda-row-min-height;
|
|
||||||
padding: 0 18rpx;
|
|
||||||
background: #f5f6f8;
|
|
||||||
border-radius: 8rpx;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
::v-deep .filterInput .u-input__input {
|
|
||||||
font-size: $pda-font-body !important;
|
|
||||||
color: #202328;
|
|
||||||
}
|
|
||||||
::v-deep .filterInput .u-input__input::placeholder {
|
|
||||||
font-size: $pda-font-placeholder;
|
|
||||||
color: #aeb4bf;
|
|
||||||
}
|
|
||||||
.filterValue {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
min-height: $pda-row-min-height;
|
|
||||||
padding: 0 18rpx;
|
|
||||||
background: #f5f6f8;
|
|
||||||
border-radius: 8rpx;
|
|
||||||
box-sizing: border-box;
|
|
||||||
font-size: $pda-font-body;
|
|
||||||
color: #202328;
|
|
||||||
}
|
|
||||||
.dateRow {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 10rpx;
|
|
||||||
}
|
|
||||||
.datePicker {
|
|
||||||
flex: 1;
|
|
||||||
min-width: 0;
|
|
||||||
}
|
|
||||||
.dateInput {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
min-height: $pda-row-min-height;
|
|
||||||
padding: 0 8rpx;
|
|
||||||
background: #f5f6f8;
|
|
||||||
border-radius: 8rpx;
|
|
||||||
box-sizing: border-box;
|
|
||||||
font-size: $pda-font-body;
|
|
||||||
color: #202328;
|
|
||||||
text-align: center;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
.dateInput--placeholder {
|
|
||||||
font-size: $pda-font-placeholder;
|
|
||||||
color: #7d8490;
|
|
||||||
}
|
|
||||||
.dateSeparator {
|
|
||||||
flex-shrink: 0;
|
|
||||||
font-size: $pda-font-body;
|
|
||||||
color: #555b66;
|
|
||||||
}
|
|
||||||
.filterActions {
|
|
||||||
display: flex;
|
|
||||||
gap: 20rpx;
|
|
||||||
margin-top: 40rpx;
|
|
||||||
}
|
|
||||||
.filterActions .u-btn {
|
|
||||||
flex: 1;
|
|
||||||
height: $pda-button-height !important;
|
|
||||||
line-height: $pda-button-height !important;
|
|
||||||
padding: 0 !important;
|
|
||||||
font-size: $pda-font-button !important;
|
|
||||||
}
|
|
||||||
::v-deep .pdaSelect .u-select__header {
|
|
||||||
height: $pda-row-min-height;
|
|
||||||
}
|
|
||||||
::v-deep .pdaSelect .u-select__header__btn,
|
|
||||||
::v-deep .pdaSelect .u-select__header__title,
|
|
||||||
::v-deep .pdaSelect .u-select__body__picker-view__item {
|
|
||||||
font-size: $pda-font-popup-item !important;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -3,17 +3,21 @@
|
|||||||
*
|
*
|
||||||
* 业务说明:
|
* 业务说明:
|
||||||
* 1. 后端当前仅提供「坯布其他出货单」一种类型的接口,故出仓类型固定为 other,
|
* 1. 后端当前仅提供「坯布其他出货单」一种类型的接口,故出仓类型固定为 other,
|
||||||
* 表头保留接收单位(business_unit) / 出货日期 / 备注 等字段。
|
* 表头保留染厂(business_unit) / 出货日期 / 备注 等字段。
|
||||||
* 2. 用户先填写表头并「提交保存」(addGfmOtherDeliveryOrder),拿到出仓单 id 后才显示扫码区和汇总表;
|
* 2. 用户先填写表头并「提交保存」(addGfmOtherDeliveryOrder),拿到出仓单 id 后即可扫码;
|
||||||
* 扫码新增/删除细码走 updateGfmOtherDeliveryOrder;勾选锁定维度时附带 *_lock 字段,操作后用返回的最新详情刷新。
|
* 扫码新增/删除细码走 updateGfmOtherDeliveryOrder;勾选锁定维度时附带 *_lock 字段,操作后用返回的最新详情刷新。
|
||||||
* 3. 后端没有「修改表头」接口,保存成功或编辑进入后表头变为只读,并默认收起,仅可扫码维护细码。
|
* 3. 后端没有「修改表头」接口,保存成功或编辑进入后表头变为只读,仅可扫码维护细码。
|
||||||
*/
|
*/
|
||||||
import util from '@/common/util';
|
import util from '@/common/util';
|
||||||
import scanMixin from '@/common/scanMixin.js';
|
import scanMixin from '@/common/scanMixin.js';
|
||||||
|
import PlusBarcodePanel from '@/components/common/PlusBarcodePanel.vue';
|
||||||
|
import remoteSelectMixin from '@/common/remoteSelectMixin.js';
|
||||||
|
import { withNameParam } from '@/common/remoteSelect';
|
||||||
|
import { initTts, speak } from '@/common/tts.js';
|
||||||
import {
|
import {
|
||||||
AUDIT_STATUS_MAP,
|
AUDIT_STATUS_MAP,
|
||||||
BILL_TYPES,
|
BILL_TYPES,
|
||||||
BUSINESS_UNIT_TYPE_DYEING_FACTORY,
|
BUSINESS_UNIT_TYPE_DYE_FACTORY,
|
||||||
normalizeOrder,
|
normalizeOrder,
|
||||||
mapToSelectOptions,
|
mapToSelectOptions,
|
||||||
getFineCodeScanCode,
|
getFineCodeScanCode,
|
||||||
@@ -22,7 +26,6 @@ import {
|
|||||||
getFormStatusActionButtons,
|
getFormStatusActionButtons,
|
||||||
orderToFormFields,
|
orderToFormFields,
|
||||||
confirmOrderStatusAction,
|
confirmOrderStatusAction,
|
||||||
STATUS_ACTION_VOICE,
|
|
||||||
DRAFT_AUDIT_STATUS,
|
DRAFT_AUDIT_STATUS,
|
||||||
DRAFT_AUDIT_STATUS_NAME,
|
DRAFT_AUDIT_STATUS_NAME,
|
||||||
getEmptyScanDetail,
|
getEmptyScanDetail,
|
||||||
@@ -32,18 +35,19 @@ import {
|
|||||||
buildScanUpdateParams,
|
buildScanUpdateParams,
|
||||||
getOrderDisplayWeight,
|
getOrderDisplayWeight,
|
||||||
getFineCodeDisplayWeight,
|
getFineCodeDisplayWeight,
|
||||||
|
resolveScanMismatchVoice,
|
||||||
} from '@/common/storeFabricBusinessOut';
|
} from '@/common/storeFabricBusinessOut';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mixins: [scanMixin],
|
components: { PlusBarcodePanel },
|
||||||
|
mixins: [scanMixin, remoteSelectMixin],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
pageMode: 'add',
|
pageMode: 'add',
|
||||||
orderId: 0,
|
orderId: 0,
|
||||||
form: this.getEmptyForm(),
|
form: this.getEmptyForm(),
|
||||||
headerSaved: false,
|
headerSaved: false,
|
||||||
// 新增未保存时展开表头;保存后及编辑进入时收起
|
headerCollapsed: false,
|
||||||
headerExpanded: true,
|
|
||||||
selectShow: false,
|
selectShow: false,
|
||||||
selectList: [],
|
selectList: [],
|
||||||
selectType: '',
|
selectType: '',
|
||||||
@@ -64,7 +68,6 @@ export default {
|
|||||||
auditStatus: 0,
|
auditStatus: 0,
|
||||||
businessUnitOptions: [],
|
businessUnitOptions: [],
|
||||||
dropdownLoading: false,
|
dropdownLoading: false,
|
||||||
phoneScanPanelOpen: false,
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -78,14 +81,6 @@ export default {
|
|||||||
headerEditable() {
|
headerEditable() {
|
||||||
return this.pageMode === 'add' && !this.headerSaved;
|
return this.pageMode === 'add' && !this.headerSaved;
|
||||||
},
|
},
|
||||||
/** 已保存或编辑页才提供收起/展开 */
|
|
||||||
showHeaderToggle() {
|
|
||||||
return this.pageMode === 'edit' || this.headerSaved;
|
|
||||||
},
|
|
||||||
/** 未保存只填表头;保存后才出现扫码区与汇总表 */
|
|
||||||
showScanSection() {
|
|
||||||
return this.headerSaved;
|
|
||||||
},
|
|
||||||
dateLabel() {
|
dateLabel() {
|
||||||
return '出货日期';
|
return '出货日期';
|
||||||
},
|
},
|
||||||
@@ -104,6 +99,7 @@ export default {
|
|||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.isPageActive = true;
|
this.isPageActive = true;
|
||||||
|
initTts();
|
||||||
if (this.canScan && this.isEditable) {
|
if (this.canScan && this.isEditable) {
|
||||||
this.registerScanBroadcast((scanResult) => {
|
this.registerScanBroadcast((scanResult) => {
|
||||||
this.QRBarCode = scanResult.trim().replace(/[\r\n]/g, '');
|
this.QRBarCode = scanResult.trim().replace(/[\r\n]/g, '');
|
||||||
@@ -113,12 +109,10 @@ export default {
|
|||||||
},
|
},
|
||||||
onHide() {
|
onHide() {
|
||||||
this.isPageActive = false;
|
this.isPageActive = false;
|
||||||
this.closePhoneScanPanel();
|
|
||||||
this.unregisterScanBroadcast();
|
this.unregisterScanBroadcast();
|
||||||
},
|
},
|
||||||
onUnload() {
|
onUnload() {
|
||||||
this.isPageActive = false;
|
this.isPageActive = false;
|
||||||
this.closePhoneScanPanel();
|
|
||||||
this.unregisterScanBroadcast();
|
this.unregisterScanBroadcast();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -127,10 +121,7 @@ export default {
|
|||||||
this.showError('请先提交保存后再扫码');
|
this.showError('请先提交保存后再扫码');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.phoneScanPanelOpen = !this.phoneScanPanelOpen;
|
this.togglePhoneScanPanel();
|
||||||
},
|
|
||||||
closePhoneScanPanel() {
|
|
||||||
this.phoneScanPanelOpen = false;
|
|
||||||
},
|
},
|
||||||
onPlusBarcodeSuccess(scanResult) {
|
onPlusBarcodeSuccess(scanResult) {
|
||||||
this.QRBarCode = String(scanResult || '').trim().replace(/[\r\n]/g, '');
|
this.QRBarCode = String(scanResult || '').trim().replace(/[\r\n]/g, '');
|
||||||
@@ -162,12 +153,21 @@ export default {
|
|||||||
},
|
},
|
||||||
ensureBusinessUnitOptions() {
|
ensureBusinessUnitOptions() {
|
||||||
if (this.businessUnitOptions.length) return Promise.resolve(this.businessUnitOptions);
|
if (this.businessUnitOptions.length) return Promise.resolve(this.businessUnitOptions);
|
||||||
return this.$u.api.businessUnit.list({ unit_type_id: BUSINESS_UNIT_TYPE_DYEING_FACTORY })
|
return this.$u.api.businessUnit.list({ unit_type_id: BUSINESS_UNIT_TYPE_DYE_FACTORY })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.businessUnitOptions = mapToSelectOptions(res);
|
this.businessUnitOptions = mapToSelectOptions(res);
|
||||||
return this.businessUnitOptions;
|
return this.businessUnitOptions;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
fetchRemoteSelectOptions(type, keyword) {
|
||||||
|
if (type !== '染厂') return Promise.resolve([]);
|
||||||
|
return this.$u.api.businessUnit.list(withNameParam({ unit_type_id: BUSINESS_UNIT_TYPE_DYE_FACTORY }, keyword))
|
||||||
|
.then((res) => {
|
||||||
|
const list = mapToSelectOptions(res);
|
||||||
|
if (!String(keyword || '').trim()) this.businessUnitOptions = list;
|
||||||
|
return list;
|
||||||
|
});
|
||||||
|
},
|
||||||
getEmptyForm() {
|
getEmptyForm() {
|
||||||
return {
|
return {
|
||||||
order_no: '',
|
order_no: '',
|
||||||
@@ -176,13 +176,8 @@ export default {
|
|||||||
delivery_time: this.$u.timeFormat(new Date(), 'yyyy-mm-dd'),
|
delivery_time: this.$u.timeFormat(new Date(), 'yyyy-mm-dd'),
|
||||||
remark: '',
|
remark: '',
|
||||||
item_data: [],
|
item_data: [],
|
||||||
summary_rows: [],
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
toggleHeader() {
|
|
||||||
if (!this.showHeaderToggle) return;
|
|
||||||
this.headerExpanded = !this.headerExpanded;
|
|
||||||
},
|
|
||||||
loadOrder(id, options = {}) {
|
loadOrder(id, options = {}) {
|
||||||
const { rejectIfLocked = false } = options;
|
const { rejectIfLocked = false } = options;
|
||||||
return this.$u.api.gfmOtherDeliveryOrder.detail({ id })
|
return this.$u.api.gfmOtherDeliveryOrder.detail({ id })
|
||||||
@@ -200,6 +195,7 @@ export default {
|
|||||||
this.orderId = order.id;
|
this.orderId = order.id;
|
||||||
this.auditStatus = order.audit_status;
|
this.auditStatus = order.audit_status;
|
||||||
this.headerSaved = true;
|
this.headerSaved = true;
|
||||||
|
this.headerCollapsed = true;
|
||||||
this.form = orderToFormFields(order);
|
this.form = orderToFormFields(order);
|
||||||
this.refreshScanDetailTotals(order);
|
this.refreshScanDetailTotals(order);
|
||||||
this.syncCanScanFromStatus(order.audit_status);
|
this.syncCanScanFromStatus(order.audit_status);
|
||||||
@@ -213,31 +209,23 @@ export default {
|
|||||||
},
|
},
|
||||||
pickerSelectFun(type) {
|
pickerSelectFun(type) {
|
||||||
if (!this.headerEditable) return;
|
if (!this.headerEditable) return;
|
||||||
this.selectType = type;
|
if (type === '染厂') {
|
||||||
const openPicker = (list) => {
|
this.openSelectPicker(type, this.businessUnitOptions);
|
||||||
if (!list.length) {
|
return;
|
||||||
this.showError('暂无可选数据');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.selectList = list;
|
|
||||||
this.selectShow = true;
|
|
||||||
};
|
|
||||||
if (type === '接收单位') {
|
|
||||||
this.ensureBusinessUnitOptions()
|
|
||||||
.then(openPicker)
|
|
||||||
.catch((e) => this.showError(e.message || '加载单位列表失败'));
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
selectConfirmFun(item) {
|
selectConfirmFun(e) {
|
||||||
if (!item || this.selectType !== '接收单位') return;
|
const item = e[0];
|
||||||
this.form.business_unit_id = item.value;
|
if (this.selectType === '染厂') {
|
||||||
this.form.business_unit_name = item.label;
|
this.form.business_unit_id = item.value;
|
||||||
|
this.form.business_unit_name = item.label;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
bindDateChange(e) {
|
bindDateChange(e) {
|
||||||
this.form.delivery_time = e.detail.value;
|
this.form.delivery_time = e.detail.value;
|
||||||
},
|
},
|
||||||
validateForm() {
|
validateForm() {
|
||||||
if (!this.form.business_unit_id) return '请选择接收单位';
|
if (!this.form.business_unit_id) return '请选择染厂';
|
||||||
if (!this.form.delivery_time) return '请选择出货日期';
|
if (!this.form.delivery_time) return '请选择出货日期';
|
||||||
return '';
|
return '';
|
||||||
},
|
},
|
||||||
@@ -272,9 +260,9 @@ export default {
|
|||||||
const order = normalizeOrder(detail);
|
const order = normalizeOrder(detail);
|
||||||
this.applyOrder(order);
|
this.applyOrder(order);
|
||||||
this.headerSaved = true;
|
this.headerSaved = true;
|
||||||
this.headerExpanded = false;
|
this.headerCollapsed = true;
|
||||||
this.syncCanScanFromStatus(order.audit_status);
|
this.syncCanScanFromStatus(order.audit_status);
|
||||||
this.showSuccess('保存成功,可以扫码', '提交成功');
|
this.showSuccess('保存成功,可以扫码', '保存成功', { voiceOnly: true });
|
||||||
this.registerOrderScanBroadcast();
|
this.registerOrderScanBroadcast();
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
@@ -329,14 +317,14 @@ export default {
|
|||||||
if (!this.canScan || !this.orderId) {
|
if (!this.canScan || !this.orderId) {
|
||||||
this.showError('请先提交保存后再扫码');
|
this.showError('请先提交保存后再扫码');
|
||||||
this.QRBarCode = '';
|
this.QRBarCode = '';
|
||||||
return Promise.resolve();
|
return;
|
||||||
}
|
}
|
||||||
if (!code) {
|
if (!code) {
|
||||||
this.QRBarCode = '';
|
this.QRBarCode = '';
|
||||||
return Promise.resolve();
|
return;
|
||||||
}
|
}
|
||||||
const scanType = this.BarCodeDelStatus ? 2 : 1;
|
const scanType = this.BarCodeDelStatus ? 2 : 1;
|
||||||
return this.doScanUpdate(code, scanType);
|
this.doScanUpdate(code, scanType);
|
||||||
},
|
},
|
||||||
BarCodeDelChange(e) {
|
BarCodeDelChange(e) {
|
||||||
this.BarCodeDelStatus = (e.detail.value || []).length > 0;
|
this.BarCodeDelStatus = (e.detail.value || []).length > 0;
|
||||||
@@ -356,22 +344,27 @@ export default {
|
|||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
const order = normalizeOrder(detail);
|
const order = normalizeOrder(detail);
|
||||||
this.form.item_data = order.item_data;
|
this.form.item_data = order.item_data;
|
||||||
this.form.summary_rows = order.summary_rows || [];
|
|
||||||
this.auditStatus = order.audit_status;
|
this.auditStatus = order.audit_status;
|
||||||
this.applyScanDetail(scanCode, order, scanType);
|
this.applyScanDetail(scanCode, order, scanType);
|
||||||
if (refreshFineCodes) {
|
if (refreshFineCodes) {
|
||||||
const rows = order.summary_rows || [];
|
const row = order.item_data.find((i) => (i.group_key || String(i.id)) === this.currentGroupKey);
|
||||||
const row = rows.find((i) => i.group_key === this.currentGroupKey);
|
this.currentFineCodes = row ? [...row.fine_codes] : [];
|
||||||
this.currentFineCodes = row ? [...(row.fine_codes || [])] : [];
|
|
||||||
}
|
}
|
||||||
this.BillDataMessage = scanType === 2 ? '删除成功' : '扫码出仓成功';
|
this.BillDataMessage = scanType === 2 ? '删除成功' : '扫描成功';
|
||||||
this.QRBarCode = '';
|
this.QRBarCode = '';
|
||||||
if (scanType === 2) this.showSuccess('删除成功', '删除成功');
|
if (scanType === 2) {
|
||||||
else util.playSpeak('扫码出仓成功');
|
speak('已删除出仓');
|
||||||
|
uni.showToast({ title: '删除成功', icon: 'success' });
|
||||||
|
} else {
|
||||||
|
speak('成功');
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
this.showError(e.message || (scanType === 2 ? '删除失败' : '扫码失败'));
|
const message = e.message || (scanType === 2 ? '删除失败' : '扫码失败');
|
||||||
|
const mismatchVoice = resolveScanMismatchVoice(message);
|
||||||
|
speak(mismatchVoice || (scanType === 2 ? '删除失败' : '扫码失败'));
|
||||||
|
uni.showToast({ title: message, icon: 'none', duration: 2500 });
|
||||||
this.QRBarCode = '';
|
this.QRBarCode = '';
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -384,15 +377,6 @@ export default {
|
|||||||
this.currentFineCodes = [...(row.fine_codes || [])];
|
this.currentFineCodes = [...(row.fine_codes || [])];
|
||||||
this.fineCodeShow = true;
|
this.fineCodeShow = true;
|
||||||
},
|
},
|
||||||
onSummaryCellClick(event) {
|
|
||||||
const row = event && event.lineData;
|
|
||||||
if (!row) return;
|
|
||||||
if (event.key === 'grey_fabric_code' || event.key === 'grey_fabric_name') {
|
|
||||||
this.openFabricInfo(row);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.openFineCode(row);
|
|
||||||
},
|
|
||||||
onDeleteFineCode(fineCode) {
|
onDeleteFineCode(fineCode) {
|
||||||
if (this.isReadonly || !this.canScan) return;
|
if (this.isReadonly || !this.canScan) return;
|
||||||
const scanCode = getFineCodeScanCode(fineCode);
|
const scanCode = getFineCodeScanCode(fineCode);
|
||||||
@@ -420,18 +404,16 @@ export default {
|
|||||||
if (!order) return;
|
if (!order) return;
|
||||||
this.applyOrder(order);
|
this.applyOrder(order);
|
||||||
this.syncCanScanFromStatus(order.audit_status);
|
this.syncCanScanFromStatus(order.audit_status);
|
||||||
const voice = STATUS_ACTION_VOICE[action] || '';
|
this.showSuccess(util.statusSuccessVoice(action));
|
||||||
this.showSuccess(voice || '操作成功', voice);
|
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
showError(message) {
|
showError(message, options = {}) {
|
||||||
util.playErrorAudio();
|
if (!options.skipErrorAudio) util.playErrorAudio(message);
|
||||||
uni.showModal({ title: '提示', content: message, showCancel: false });
|
uni.showModal({ title: '提示', content: message, showCancel: false });
|
||||||
},
|
},
|
||||||
showSuccess(message, speakText) {
|
showSuccess(message, voiceText, options) {
|
||||||
if (speakText) util.playSpeak(speakText);
|
util.playSuccessAudio(voiceText || message, options);
|
||||||
else util.playSuccessAudio();
|
|
||||||
uni.showToast({ title: message, icon: 'success' });
|
uni.showToast({ title: message, icon: 'success' });
|
||||||
},
|
},
|
||||||
getBillTypeName() {
|
getBillTypeName() {
|
||||||
|
|||||||
@@ -6,66 +6,8 @@
|
|||||||
.fabric-out-mt32 {
|
.fabric-out-mt32 {
|
||||||
margin-top: 32rpx;
|
margin-top: 32rpx;
|
||||||
}
|
}
|
||||||
.fabric-out-headerBar {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
min-height: 100rpx;
|
|
||||||
padding: 16rpx 26rpx;
|
|
||||||
background: #fff;
|
|
||||||
border-bottom: 1rpx solid #f5f5f5;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
.fabric-out-headerBarMain {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
min-width: 0;
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
.fabric-out-headerBarTitle {
|
|
||||||
font-size: 40rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
color: #333;
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
.fabric-out-headerBarSub {
|
|
||||||
margin-left: 16rpx;
|
|
||||||
font-size: 36rpx;
|
|
||||||
color: #666;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
.fabric-out-headerBarAction {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
flex-shrink: 0;
|
|
||||||
margin-left: 16rpx;
|
|
||||||
font-size: 36rpx;
|
|
||||||
color: #2979ff;
|
|
||||||
}
|
|
||||||
.fabric-out-headerBarIcon {
|
|
||||||
margin-left: 8rpx;
|
|
||||||
}
|
|
||||||
.fabric-out-page .flex-white-plr26,
|
|
||||||
.fabric-out-page .flex-white-plr26-column,
|
|
||||||
.fabric-out-page .flex-white-plr26 text,
|
|
||||||
.fabric-out-page .flex-white-plr26 view,
|
|
||||||
.fabric-out-page .u-input__input,
|
|
||||||
.fabric-out-page .uni-input-input,
|
|
||||||
.fabric-out-page .uni-textarea-textarea {
|
|
||||||
font-size: 40rpx;
|
|
||||||
}
|
|
||||||
.fabric-out-page .redXingh {
|
|
||||||
font-size: 40rpx;
|
|
||||||
}
|
|
||||||
.fabric-out-page .u-btn {
|
|
||||||
font-size: 36rpx !important;
|
|
||||||
height: 88rpx;
|
|
||||||
line-height: 88rpx;
|
|
||||||
}
|
|
||||||
.fabric-out-sectionTitle {
|
.fabric-out-sectionTitle {
|
||||||
font-size: 42rpx;
|
font-size: 32rpx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
padding: 24rpx 26rpx 12rpx;
|
padding: 24rpx 26rpx 12rpx;
|
||||||
border-left: 6rpx solid #007AFF;
|
border-left: 6rpx solid #007AFF;
|
||||||
@@ -74,7 +16,7 @@
|
|||||||
.fabric-out-scanTip {
|
.fabric-out-scanTip {
|
||||||
padding: 20rpx 26rpx;
|
padding: 20rpx 26rpx;
|
||||||
color: #fa8c16;
|
color: #fa8c16;
|
||||||
font-size: 36rpx;
|
font-size: 28rpx;
|
||||||
background: #fff7e6;
|
background: #fff7e6;
|
||||||
margin: 16rpx 26rpx;
|
margin: 16rpx 26rpx;
|
||||||
border-radius: 8rpx;
|
border-radius: 8rpx;
|
||||||
@@ -82,7 +24,7 @@
|
|||||||
.fabric-out-msgTip {
|
.fabric-out-msgTip {
|
||||||
padding: 12rpx 26rpx;
|
padding: 12rpx 26rpx;
|
||||||
color: #52c41a;
|
color: #52c41a;
|
||||||
font-size: 36rpx;
|
font-size: 28rpx;
|
||||||
}
|
}
|
||||||
.fabric-out-detailList {
|
.fabric-out-detailList {
|
||||||
padding: 0 26rpx;
|
padding: 0 26rpx;
|
||||||
@@ -97,7 +39,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
font-size: 38rpx;
|
font-size: 30rpx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
padding-bottom: 12rpx;
|
padding-bottom: 12rpx;
|
||||||
border-bottom: 1rpx solid #f0f0f0;
|
border-bottom: 1rpx solid #f0f0f0;
|
||||||
@@ -107,7 +49,7 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 20rpx;
|
gap: 20rpx;
|
||||||
padding-top: 12rpx;
|
padding-top: 12rpx;
|
||||||
font-size: 36rpx;
|
font-size: 28rpx;
|
||||||
color: #666;
|
color: #666;
|
||||||
}
|
}
|
||||||
.fabric-out-scanRow {
|
.fabric-out-scanRow {
|
||||||
@@ -124,7 +66,7 @@
|
|||||||
.fabric-out-delCheck {
|
.fabric-out-delCheck {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
font-size: 36rpx;
|
font-size: 28rpx;
|
||||||
color: #666;
|
color: #666;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
@@ -140,7 +82,7 @@
|
|||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
padding: 16rpx 20rpx;
|
padding: 16rpx 20rpx;
|
||||||
border-bottom: 1rpx solid #f0f0f0;
|
border-bottom: 1rpx solid #f0f0f0;
|
||||||
font-size: 36rpx;
|
font-size: 28rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
.fabric-out-scanDetailRow--2col {
|
.fabric-out-scanDetailRow--2col {
|
||||||
@@ -166,6 +108,34 @@
|
|||||||
color: #333;
|
color: #333;
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
}
|
}
|
||||||
|
.fabric-out-scanDetailTableScroll {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.fabric-out-scanDetailTable {
|
||||||
|
min-width: 100%;
|
||||||
|
}
|
||||||
|
.fabric-out-scanDetailTableRow {
|
||||||
|
display: flex;
|
||||||
|
border-bottom: 1rpx solid #f0f0f0;
|
||||||
|
}
|
||||||
|
.fabric-out-scanDetailTableHead {
|
||||||
|
background: #f5f5f5;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.fabric-out-scanDetailTableCell {
|
||||||
|
padding: 16rpx 10rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333;
|
||||||
|
text-align: center;
|
||||||
|
box-sizing: border-box;
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
.fabric-out-scanDetailEmpty {
|
||||||
|
padding: 24rpx;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
.fabric-out-submitView {
|
.fabric-out-submitView {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 16rpx 26rpx 26rpx;
|
padding: 16rpx 26rpx 26rpx;
|
||||||
|
|||||||
@@ -1,17 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="fabric-out-page">
|
<view class="fabric-out-page">
|
||||||
|
<OrderHeaderFold v-model="headerCollapsed" :summary="order.order_no">
|
||||||
<OrderStatusBar class="fabric-out-mt32" :status="order.audit_status" :name="order.audit_status_name" />
|
<OrderStatusBar class="fabric-out-mt32" :status="order.audit_status" :name="order.audit_status_name" />
|
||||||
|
|
||||||
<view class="flex-white-plr26 ptb10 bdb_f5">
|
|
||||||
<text class="mr26">出仓单号</text>
|
|
||||||
<text>{{ order.order_no }}</text>
|
|
||||||
</view>
|
|
||||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
<text class="mr26">出仓类型</text>
|
<text class="mr26">出仓类型</text>
|
||||||
<text>{{ billTypeName }}</text>
|
<text>{{ billTypeName }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
<text class="mr26">接收单位</text><text>{{ order.business_unit_name }}</text>
|
<text class="mr26">染厂</text><text>{{ order.business_unit_name }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
<text class="mr26">出货日期</text><text>{{ formatTime(order.delivery_time) }}</text>
|
<text class="mr26">出货日期</text><text>{{ formatTime(order.delivery_time) }}</text>
|
||||||
@@ -25,6 +21,7 @@
|
|||||||
<view v-if="order.auditer_name" class="flex-white-plr26 ptb20 bdb_f5">
|
<view v-if="order.auditer_name" class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
<text class="mr26">审核人</text><text>{{ order.auditer_name }} {{ formatTime(order.audit_time, 'YYYY-MM-DD') }}</text>
|
<text class="mr26">审核人</text><text>{{ order.auditer_name }} {{ formatTime(order.audit_time, 'YYYY-MM-DD') }}</text>
|
||||||
</view>
|
</view>
|
||||||
|
</OrderHeaderFold>
|
||||||
|
|
||||||
<FabricOutDetailList
|
<FabricOutDetailList
|
||||||
:title="detailTitle"
|
:title="detailTitle"
|
||||||
@@ -45,6 +42,7 @@ import util from '@/common/util';
|
|||||||
import FabricInfoPopup from '@/components/storefabric/FabricInfoPopup.vue';
|
import FabricInfoPopup from '@/components/storefabric/FabricInfoPopup.vue';
|
||||||
import FineCodePopup from '@/components/storefabric/FineCodePopup.vue';
|
import FineCodePopup from '@/components/storefabric/FineCodePopup.vue';
|
||||||
import OrderStatusBar from '@/components/storefabric/OrderStatusBar.vue';
|
import OrderStatusBar from '@/components/storefabric/OrderStatusBar.vue';
|
||||||
|
import OrderHeaderFold from '@/components/storefabric/OrderHeaderFold.vue';
|
||||||
import FabricOutDetailList from '@/components/storefabric/FabricOutDetailList.vue';
|
import FabricOutDetailList from '@/components/storefabric/FabricOutDetailList.vue';
|
||||||
import FabricOutFooter from '@/components/storefabric/FabricOutFooter.vue';
|
import FabricOutFooter from '@/components/storefabric/FabricOutFooter.vue';
|
||||||
import {
|
import {
|
||||||
@@ -53,13 +51,13 @@ import {
|
|||||||
getViewStatusActionButtons,
|
getViewStatusActionButtons,
|
||||||
confirmOrderStatusAction,
|
confirmOrderStatusAction,
|
||||||
formatDisplayTime,
|
formatDisplayTime,
|
||||||
STATUS_ACTION_VOICE,
|
|
||||||
} from '@/common/storeFabricBusinessOut';
|
} from '@/common/storeFabricBusinessOut';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { FabricInfoPopup, FineCodePopup, OrderStatusBar, FabricOutDetailList, FabricOutFooter },
|
components: { FabricInfoPopup, FineCodePopup, OrderStatusBar, OrderHeaderFold, FabricOutDetailList, FabricOutFooter },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
headerCollapsed: true,
|
||||||
orderId: 0,
|
orderId: 0,
|
||||||
order: {},
|
order: {},
|
||||||
billTypeName: (BILL_TYPES[0] || {}).label || '坯布其他出货单',
|
billTypeName: (BILL_TYPES[0] || {}).label || '坯布其他出货单',
|
||||||
@@ -119,20 +117,25 @@ export default {
|
|||||||
confirmOrderStatusAction(this, {
|
confirmOrderStatusAction(this, {
|
||||||
orderId: this.orderId,
|
orderId: this.orderId,
|
||||||
action,
|
action,
|
||||||
onSuccess: () => this.$u.api.gfmOtherDeliveryOrder.detail({ id: this.orderId })
|
onSuccess: () => {
|
||||||
.then((res) => {
|
uni.hideLoading();
|
||||||
uni.hideLoading();
|
const voice = util.statusSuccessVoice(action);
|
||||||
const order = normalizeOrder(res);
|
util.playSuccessAudio(voice);
|
||||||
if (order) this.order = order;
|
uni.showToast({ title: voice, icon: 'success' });
|
||||||
const voice = STATUS_ACTION_VOICE[action] || '';
|
if (action === 'unapprove') {
|
||||||
if (voice) util.playSpeak(voice);
|
uni.redirectTo({ url: `./storeFabricBusinessOutEdit?id=${this.orderId}` });
|
||||||
else util.playSuccessAudio();
|
return;
|
||||||
uni.showToast({ title: voice || '操作成功', icon: 'success' });
|
}
|
||||||
}),
|
return this.$u.api.gfmOtherDeliveryOrder.detail({ id: this.orderId })
|
||||||
|
.then((res) => {
|
||||||
|
const order = normalizeOrder(res);
|
||||||
|
if (order) this.order = order;
|
||||||
|
});
|
||||||
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
showError(message) {
|
showError(message) {
|
||||||
util.playErrorAudio();
|
util.playErrorAudio(message);
|
||||||
uni.showModal({ title: '提示', content: message, showCancel: false });
|
uni.showModal({ title: '提示', content: message, showCancel: false });
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,691 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view class="manual-in">
|
|
||||||
<common-navbar title="手动进仓">
|
|
||||||
<template #right>
|
|
||||||
<view class="manual-in__setting" @click="navToSetting">
|
|
||||||
<u-icon name="setting" color="#333333" size="34"></u-icon>
|
|
||||||
<text>设置</text>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
</common-navbar>
|
|
||||||
|
|
||||||
<PlusBarcodePanel
|
|
||||||
ref="plusBarcodePanel"
|
|
||||||
:visible.sync="phoneScanPanelOpen"
|
|
||||||
hint-text="先扫描布票,再填写信息后确认进仓"
|
|
||||||
:scan-time-space="1200"
|
|
||||||
@success="onPlusBarcodeSuccess"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<view class="manual-in__scan">
|
|
||||||
<input
|
|
||||||
class="manual-in__scan-input"
|
|
||||||
type="text"
|
|
||||||
confirm-type="done"
|
|
||||||
:confirm-hold="true"
|
|
||||||
:focus="scanFocus"
|
|
||||||
v-model="scanCode"
|
|
||||||
placeholder="请先扫描布票编码"
|
|
||||||
placeholder-class="manual-in__placeholder"
|
|
||||||
@confirm="onScanConfirm"
|
|
||||||
/>
|
|
||||||
<view
|
|
||||||
v-if="scanCode"
|
|
||||||
class="manual-in__scan-icon"
|
|
||||||
@click.stop="clearScanCode"
|
|
||||||
>
|
|
||||||
<u-icon name="close-circle-fill" size="44" color="#bfbfbf" />
|
|
||||||
</view>
|
|
||||||
<view
|
|
||||||
v-if="phoneScanPanelOpen"
|
|
||||||
class="manual-in__scan-close"
|
|
||||||
@click.stop="handlePhoneScan"
|
|
||||||
>
|
|
||||||
关闭扫码
|
|
||||||
</view>
|
|
||||||
<view
|
|
||||||
v-else
|
|
||||||
class="manual-in__scan-icon"
|
|
||||||
@click.stop="handlePhoneScan"
|
|
||||||
>
|
|
||||||
<u-icon name="scan" size="44" color="#595959" />
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="manual-in__panel">
|
|
||||||
<view class="manual-in__row">
|
|
||||||
<text class="manual-in__label">布票编码</text>
|
|
||||||
<text class="manual-in__value">{{ detail.fabric_piece_code || '-' }}</text>
|
|
||||||
</view>
|
|
||||||
<view class="manual-in__row">
|
|
||||||
<text class="manual-in__label">生产单号</text>
|
|
||||||
<text class="manual-in__value">{{ detail.production_order_no || '-' }}</text>
|
|
||||||
</view>
|
|
||||||
<view class="manual-in__row">
|
|
||||||
<text class="manual-in__label">机台</text>
|
|
||||||
<text class="manual-in__value">{{ detail.machine_number || '-' }}</text>
|
|
||||||
</view>
|
|
||||||
<view class="manual-in__row">
|
|
||||||
<text class="manual-in__label">布种名称</text>
|
|
||||||
<text class="manual-in__value">{{ detail.grey_fabric_name || '-' }}</text>
|
|
||||||
</view>
|
|
||||||
<view class="manual-in__row">
|
|
||||||
<text class="manual-in__label">坯布编号</text>
|
|
||||||
<text class="manual-in__value">{{ detail.grey_fabric_code || '-' }}</text>
|
|
||||||
</view>
|
|
||||||
<view class="manual-in__row">
|
|
||||||
<text class="manual-in__label">卷号</text>
|
|
||||||
<text class="manual-in__value">{{ detail.volume_number != null && detail.volume_number !== '' ? detail.volume_number : '-' }}</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="manual-in__panel manual-in__panel--form">
|
|
||||||
<view class="manual-in__row manual-in__row--input" @click="openInspectorPicker">
|
|
||||||
<text class="manual-in__label">查布工</text>
|
|
||||||
<view class="manual-in__right">
|
|
||||||
<text :class="detail.inspector_name ? 'manual-in__field-text' : 'manual-in__placeholder'">
|
|
||||||
{{ detail.inspector_name || '请选择查布工' }}
|
|
||||||
</text>
|
|
||||||
<text class="manual-in__action" @click.stop="clearInspector">取消</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="manual-in__row manual-in__row--input">
|
|
||||||
<text class="manual-in__label">重量</text>
|
|
||||||
<view class="manual-in__right">
|
|
||||||
<input
|
|
||||||
class="manual-in__field"
|
|
||||||
type="digit"
|
|
||||||
v-model="weightKg"
|
|
||||||
placeholder="请输入"
|
|
||||||
placeholder-class="manual-in__placeholder"
|
|
||||||
/>
|
|
||||||
<text class="manual-in__unit">KG</text>
|
|
||||||
<text class="manual-in__action" @click="clearWeight">取消</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="manual-in__row manual-in__row--input" @click="openLevelPicker">
|
|
||||||
<text class="manual-in__label">等级</text>
|
|
||||||
<view class="manual-in__right">
|
|
||||||
<text :class="levelDisplayName ? 'manual-in__field-text' : 'manual-in__placeholder'">
|
|
||||||
{{ levelDisplayName || '请选择等级' }}
|
|
||||||
</text>
|
|
||||||
<text class="manual-in__action" @click.stop="clearLevel">取消</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="manual-in__row manual-in__row--input">
|
|
||||||
<text class="manual-in__label">存放仓位</text>
|
|
||||||
<view class="manual-in__right">
|
|
||||||
<input
|
|
||||||
class="manual-in__field"
|
|
||||||
type="text"
|
|
||||||
v-model="warehouseBinName"
|
|
||||||
placeholder="/"
|
|
||||||
placeholder-class="manual-in__placeholder"
|
|
||||||
/>
|
|
||||||
<text class="manual-in__action" @click="editWarehouseBin">修改</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="manual-in__footer">
|
|
||||||
<u-button
|
|
||||||
type="primary"
|
|
||||||
:loading="submitting"
|
|
||||||
:disabled="submitting || loadingDetail"
|
|
||||||
@click="submitInWarehouse"
|
|
||||||
>
|
|
||||||
确认进仓
|
|
||||||
</u-button>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<SearchSelectPopup
|
|
||||||
:show.sync="levelPickerShow"
|
|
||||||
title="选择等级"
|
|
||||||
placeholder="请输入等级名称"
|
|
||||||
:list="levelOptions"
|
|
||||||
multiple
|
|
||||||
:selected="detail.grey_fabric_level_id"
|
|
||||||
@confirm="onLevelConfirm"
|
|
||||||
/>
|
|
||||||
<SearchSelectPopup
|
|
||||||
:show.sync="inspectorPickerShow"
|
|
||||||
title="选择查布工"
|
|
||||||
placeholder="请输入查布工姓名"
|
|
||||||
:list="inspectorOptions"
|
|
||||||
@confirm="onInspectorConfirm"
|
|
||||||
/>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import CommonNavbar from '@/components/common-navbar/index';
|
|
||||||
import SearchSelectPopup from '@/components/storefabric/SearchSelectPopup.vue';
|
|
||||||
import PlusBarcodePanel from '@/components/common/PlusBarcodePanel.vue';
|
|
||||||
import scanMixin from '@/common/scanMixin.js';
|
|
||||||
import util from '@/common/util.js';
|
|
||||||
import { formatWeightKg } from '@/common/storeFabricBusinessOut.js';
|
|
||||||
|
|
||||||
// 坯布等级字典 id(与后台字典配置一致)
|
|
||||||
const DICTIONARY_TYPE_GREY_FABRIC_LEVEL = 10025;
|
|
||||||
// 查布工岗位 duty(验布/查布相关)
|
|
||||||
const INSPECTOR_DUTY = '20004,20011';
|
|
||||||
const WEIGHT_SCALE = 10000;
|
|
||||||
|
|
||||||
function emptyDetail() {
|
|
||||||
return {
|
|
||||||
fabric_piece_code: '',
|
|
||||||
production_order_no: '',
|
|
||||||
machine_number: '',
|
|
||||||
grey_fabric_name: '',
|
|
||||||
grey_fabric_code: '',
|
|
||||||
inspection_weight: null,
|
|
||||||
grey_fabric_level_id: [],
|
|
||||||
grey_fabric_level_name: '',
|
|
||||||
inspector_id: null,
|
|
||||||
inspector_name: '',
|
|
||||||
volume_number: '',
|
|
||||||
grey_fabric_id: '',
|
|
||||||
id: '',
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function toWeightInt(kg) {
|
|
||||||
const raw = String(kg == null ? '' : kg).trim();
|
|
||||||
if (!raw) return null;
|
|
||||||
const n = Number(raw);
|
|
||||||
if (!Number.isFinite(n) || n <= 0) return null;
|
|
||||||
return Math.round(n * WEIGHT_SCALE);
|
|
||||||
}
|
|
||||||
|
|
||||||
function formatDisplayWeightKg(value) {
|
|
||||||
if (value == null || value === '') return '';
|
|
||||||
const n = Number(value);
|
|
||||||
if (!Number.isFinite(n) || n <= 0) return '';
|
|
||||||
return String(formatWeightKg(n));
|
|
||||||
}
|
|
||||||
|
|
||||||
function normalizeLevelIds(value) {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
return value.map((item) => Number(item)).filter((item) => Number.isFinite(item));
|
|
||||||
}
|
|
||||||
if (value == null || value === '') return [];
|
|
||||||
const n = Number(value);
|
|
||||||
return Number.isFinite(n) ? [n] : [];
|
|
||||||
}
|
|
||||||
|
|
||||||
export default {
|
|
||||||
components: { CommonNavbar, SearchSelectPopup, PlusBarcodePanel },
|
|
||||||
mixins: [scanMixin],
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
scanCode: '',
|
|
||||||
scanFocus: true,
|
|
||||||
submitting: false,
|
|
||||||
loadingDetail: false,
|
|
||||||
warehouseBinId: null,
|
|
||||||
warehouseBinName: '',
|
|
||||||
weightKg: '',
|
|
||||||
detail: emptyDetail(),
|
|
||||||
levelPickerShow: false,
|
|
||||||
levelOptions: [],
|
|
||||||
levelOptionsLoaded: false,
|
|
||||||
inspectorPickerShow: false,
|
|
||||||
inspectorOptions: [],
|
|
||||||
inspectorOptionsLoaded: false,
|
|
||||||
phoneScanPanelOpen: false,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
levelDisplayName() {
|
|
||||||
if (this.detail.grey_fabric_level_name) return this.detail.grey_fabric_level_name;
|
|
||||||
const ids = normalizeLevelIds(this.detail.grey_fabric_level_id);
|
|
||||||
if (!ids.length) return '';
|
|
||||||
const nameMap = {};
|
|
||||||
this.levelOptions.forEach((item) => {
|
|
||||||
nameMap[String(item.value)] = item.label;
|
|
||||||
});
|
|
||||||
return ids.map((id) => nameMap[String(id)]).filter(Boolean).join('、');
|
|
||||||
},
|
|
||||||
},
|
|
||||||
onLoad() {
|
|
||||||
this.registerScanBroadcast(this.handleScanCode);
|
|
||||||
this.loadLevelOptions();
|
|
||||||
this.loadInspectorOptions();
|
|
||||||
},
|
|
||||||
onShow() {
|
|
||||||
this.isPageActive = true;
|
|
||||||
this.refocusScanInput(50);
|
|
||||||
},
|
|
||||||
onHide() {
|
|
||||||
this.isPageActive = false;
|
|
||||||
this.closePhoneScanPanel();
|
|
||||||
},
|
|
||||||
onUnload() {
|
|
||||||
this.isPageActive = false;
|
|
||||||
this.closePhoneScanPanel();
|
|
||||||
clearTimeout(this._scanFocusTimer);
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
refocusScanInput(delay = 120) {
|
|
||||||
clearTimeout(this._scanFocusTimer);
|
|
||||||
this.scanFocus = false;
|
|
||||||
this._scanFocusTimer = setTimeout(() => {
|
|
||||||
this.scanFocus = true;
|
|
||||||
}, delay);
|
|
||||||
},
|
|
||||||
closePhoneScanPanel() {
|
|
||||||
this.phoneScanPanelOpen = false;
|
|
||||||
},
|
|
||||||
onPlusBarcodeSuccess(scanResult) {
|
|
||||||
return this.handleScanCode(scanResult);
|
|
||||||
},
|
|
||||||
navToSetting() {
|
|
||||||
uni.navigateTo({ url: '/pages/sys/user/scan-settings' });
|
|
||||||
},
|
|
||||||
clearWeight() {
|
|
||||||
this.weightKg = '';
|
|
||||||
this.detail.inspection_weight = null;
|
|
||||||
},
|
|
||||||
clearLevel() {
|
|
||||||
this.detail.grey_fabric_level_id = [];
|
|
||||||
this.detail.grey_fabric_level_name = '';
|
|
||||||
},
|
|
||||||
clearInspector() {
|
|
||||||
this.detail.inspector_id = null;
|
|
||||||
this.detail.inspector_name = '';
|
|
||||||
},
|
|
||||||
editWarehouseBin() {
|
|
||||||
uni.showModal({
|
|
||||||
title: '存放仓位',
|
|
||||||
editable: true,
|
|
||||||
placeholderText: '请输入仓位名称',
|
|
||||||
content: this.warehouseBinName || '',
|
|
||||||
success: (res) => {
|
|
||||||
if (!res.confirm) return;
|
|
||||||
this.warehouseBinName = (res.content || '').trim();
|
|
||||||
this.warehouseBinId = null;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
},
|
|
||||||
async loadLevelOptions() {
|
|
||||||
try {
|
|
||||||
const res = await this.$u.api.dictionary.getDetailEnumList({
|
|
||||||
dictionary_id: DICTIONARY_TYPE_GREY_FABRIC_LEVEL,
|
|
||||||
status: 1,
|
|
||||||
size: 200,
|
|
||||||
});
|
|
||||||
const list = Array.isArray(res) ? res : (Array.isArray(res && res.list) ? res.list : []);
|
|
||||||
this.levelOptions = list
|
|
||||||
.map((item) => ({
|
|
||||||
value: item.id,
|
|
||||||
label: item.name || item.code || String(item.id),
|
|
||||||
}))
|
|
||||||
.filter((item) => item.value != null);
|
|
||||||
this.levelOptionsLoaded = true;
|
|
||||||
} catch (error) {
|
|
||||||
console.log('加载坯布等级枚举失败', error);
|
|
||||||
this.levelOptions = [];
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async openLevelPicker() {
|
|
||||||
if (!this.levelOptionsLoaded || !this.levelOptions.length) {
|
|
||||||
await this.loadLevelOptions();
|
|
||||||
}
|
|
||||||
if (!this.levelOptions.length) {
|
|
||||||
this.$u.toast('暂无等级可选,请检查等级字典配置');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.levelPickerShow = true;
|
|
||||||
},
|
|
||||||
onLevelConfirm(items) {
|
|
||||||
const list = Array.isArray(items) ? items : (items ? [items] : []);
|
|
||||||
this.detail.grey_fabric_level_id = list
|
|
||||||
.map((item) => Number(item.value))
|
|
||||||
.filter((item) => Number.isFinite(item));
|
|
||||||
this.detail.grey_fabric_level_name = list
|
|
||||||
.map((item) => item.label)
|
|
||||||
.filter(Boolean)
|
|
||||||
.join('、');
|
|
||||||
},
|
|
||||||
async loadInspectorOptions() {
|
|
||||||
try {
|
|
||||||
const res = await this.$u.api.employee.listEnum({
|
|
||||||
size: 50,
|
|
||||||
duty: INSPECTOR_DUTY,
|
|
||||||
});
|
|
||||||
const list = Array.isArray(res) ? res : (Array.isArray(res && res.list) ? res.list : []);
|
|
||||||
this.inspectorOptions = list
|
|
||||||
.map((item) => ({
|
|
||||||
value: item.id,
|
|
||||||
label: item.name || item.employee_name || item.real_name || item.code || String(item.id),
|
|
||||||
}))
|
|
||||||
.filter((item) => item.value != null);
|
|
||||||
this.inspectorOptionsLoaded = true;
|
|
||||||
} catch (error) {
|
|
||||||
console.log('加载查布工枚举失败', error);
|
|
||||||
this.inspectorOptions = [];
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async openInspectorPicker() {
|
|
||||||
if (!this.inspectorOptionsLoaded || !this.inspectorOptions.length) {
|
|
||||||
await this.loadInspectorOptions();
|
|
||||||
}
|
|
||||||
if (!this.inspectorOptions.length) {
|
|
||||||
this.$u.toast('暂无查布工可选');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.inspectorPickerShow = true;
|
|
||||||
},
|
|
||||||
onInspectorConfirm(item) {
|
|
||||||
if (!item) return;
|
|
||||||
this.detail.inspector_id = Number(item.value);
|
|
||||||
this.detail.inspector_name = item.label || '';
|
|
||||||
},
|
|
||||||
handleScanCode(scanResult) {
|
|
||||||
const code = String(scanResult || '').trim().replace(/[\r\n]/g, '');
|
|
||||||
if (!code) return;
|
|
||||||
this.fetchScanDetail(code);
|
|
||||||
},
|
|
||||||
clearScanCode() {
|
|
||||||
this.scanCode = '';
|
|
||||||
this.refocusScanInput();
|
|
||||||
},
|
|
||||||
handlePhoneScan() {
|
|
||||||
this.phoneScanPanelOpen = !this.phoneScanPanelOpen;
|
|
||||||
},
|
|
||||||
onScanConfirm() {
|
|
||||||
const code = String(this.scanCode || '').trim();
|
|
||||||
if (!code) {
|
|
||||||
this.$u.toast('请扫描或输入布票编码');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.fetchScanDetail(code);
|
|
||||||
},
|
|
||||||
validateBeforeSubmit() {
|
|
||||||
const fabricPieceCode = String(this.detail.fabric_piece_code || this.scanCode || '').trim();
|
|
||||||
if (!fabricPieceCode) {
|
|
||||||
return '请先扫描或输入布票编码';
|
|
||||||
}
|
|
||||||
const inspectorName = String(this.detail.inspector_name || '').trim();
|
|
||||||
if (!inspectorName && (this.detail.inspector_id == null || this.detail.inspector_id === '')) {
|
|
||||||
return '请选择查布工';
|
|
||||||
}
|
|
||||||
if (toWeightInt(this.weightKg) == null) {
|
|
||||||
return '请输入有效重量';
|
|
||||||
}
|
|
||||||
return '';
|
|
||||||
},
|
|
||||||
async fetchScanDetail(code) {
|
|
||||||
if (this.loadingDetail || this.submitting) return;
|
|
||||||
this.loadingDetail = true;
|
|
||||||
this.scanCode = code;
|
|
||||||
try {
|
|
||||||
const res = await this.$u.api.productionScheduleOrder.getScanFineCodeDetail({
|
|
||||||
fabric_piece_code: code,
|
|
||||||
});
|
|
||||||
this.applyScanDetail(res, code);
|
|
||||||
} catch (error) {
|
|
||||||
console.log('扫码获取细码失败', error);
|
|
||||||
const kept = this.keepFormFields();
|
|
||||||
this.detail = {
|
|
||||||
...emptyDetail(),
|
|
||||||
fabric_piece_code: code,
|
|
||||||
...kept,
|
|
||||||
};
|
|
||||||
this.scanCode = '';
|
|
||||||
this.refocusScanInput(200);
|
|
||||||
} finally {
|
|
||||||
this.loadingDetail = false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
keepFormFields() {
|
|
||||||
return {
|
|
||||||
grey_fabric_level_id: normalizeLevelIds(this.detail.grey_fabric_level_id),
|
|
||||||
grey_fabric_level_name: this.detail.grey_fabric_level_name || '',
|
|
||||||
inspector_id: this.detail.inspector_id,
|
|
||||||
inspector_name: this.detail.inspector_name || '',
|
|
||||||
};
|
|
||||||
},
|
|
||||||
applyScanDetail(res, fallbackCode) {
|
|
||||||
const data = res || {};
|
|
||||||
const kept = this.keepFormFields();
|
|
||||||
this.detail = {
|
|
||||||
...emptyDetail(),
|
|
||||||
fabric_piece_code: data.fabric_piece_code || fallbackCode || '',
|
|
||||||
production_order_no: data.production_order_no || '',
|
|
||||||
machine_number: data.machine_number || '',
|
|
||||||
grey_fabric_name: data.grey_fabric_name || '',
|
|
||||||
grey_fabric_code: data.grey_fabric_code || '',
|
|
||||||
inspection_weight: toWeightInt(this.weightKg),
|
|
||||||
volume_number: data.volume_number != null && data.volume_number !== '' ? data.volume_number : null,
|
|
||||||
...kept,
|
|
||||||
};
|
|
||||||
this.scanCode = this.detail.fabric_piece_code;
|
|
||||||
},
|
|
||||||
async submitInWarehouse() {
|
|
||||||
const err = this.validateBeforeSubmit();
|
|
||||||
if (err) {
|
|
||||||
this.$u.toast(err);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const fabricPieceCode = String(this.detail.fabric_piece_code || this.scanCode || '').trim();
|
|
||||||
const actualWeight = toWeightInt(this.weightKg);
|
|
||||||
const levelIds = normalizeLevelIds(this.detail.grey_fabric_level_id);
|
|
||||||
if (this.submitting) return;
|
|
||||||
this.submitting = true;
|
|
||||||
try {
|
|
||||||
const payload = {
|
|
||||||
fabric_piece_code: fabricPieceCode,
|
|
||||||
actual_weight: actualWeight,
|
|
||||||
electronic_scale_weight: actualWeight,
|
|
||||||
};
|
|
||||||
if (levelIds.length) {
|
|
||||||
payload.grey_fabric_level_id = levelIds;
|
|
||||||
}
|
|
||||||
const inspectorName = String(this.detail.inspector_name || '').trim();
|
|
||||||
if (inspectorName) {
|
|
||||||
payload.inspector_name = inspectorName;
|
|
||||||
}
|
|
||||||
if (this.detail.inspector_id != null && this.detail.inspector_id !== '') {
|
|
||||||
payload.inspector_id = Number(this.detail.inspector_id);
|
|
||||||
}
|
|
||||||
const binName = String(this.warehouseBinName || '').trim();
|
|
||||||
if (binName && binName !== '/') {
|
|
||||||
payload.warehouse_bin_name = binName;
|
|
||||||
}
|
|
||||||
if (this.warehouseBinId != null && this.warehouseBinId !== '') {
|
|
||||||
payload.warehouse_bin_id = Number(this.warehouseBinId);
|
|
||||||
}
|
|
||||||
const res = await this.$u.api.productionScheduleOrder.scanInWarehouseFineCode(payload);
|
|
||||||
if (res) {
|
|
||||||
this.detail.volume_number = res.volume_number != null ? res.volume_number : this.detail.volume_number;
|
|
||||||
this.detail.grey_fabric_id = res.grey_fabric_id != null ? res.grey_fabric_id : this.detail.grey_fabric_id;
|
|
||||||
this.detail.id = res.id != null ? res.id : this.detail.id;
|
|
||||||
if (res.fabric_piece_code) {
|
|
||||||
this.detail.fabric_piece_code = res.fabric_piece_code;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const volumeText = res && res.volume_number != null ? `,卷号 ${res.volume_number}` : '';
|
|
||||||
util.playSpeak('进仓成功');
|
|
||||||
this.$u.toast(`进仓成功${volumeText}`);
|
|
||||||
this.resetForNextScan();
|
|
||||||
} catch (error) {
|
|
||||||
console.log('手动进仓失败', error);
|
|
||||||
this.scanCode = '';
|
|
||||||
this.refocusScanInput(200);
|
|
||||||
} finally {
|
|
||||||
this.submitting = false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
resetForNextScan() {
|
|
||||||
const kept = this.keepFormFields();
|
|
||||||
this.scanCode = '';
|
|
||||||
this.detail = {
|
|
||||||
...emptyDetail(),
|
|
||||||
...kept,
|
|
||||||
};
|
|
||||||
// toast 会抢焦点,稍后再聚焦,方便连续扫码
|
|
||||||
this.refocusScanInput(600);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
@import '@/common/pda-typography.scss';
|
|
||||||
|
|
||||||
.manual-in {
|
|
||||||
min-height: 100vh;
|
|
||||||
background: #f5f6f8;
|
|
||||||
padding-bottom: calc(160rpx + env(safe-area-inset-bottom));
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.manual-in__setting {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 8rpx;
|
|
||||||
font-size: $pda-font-nav-sub;
|
|
||||||
color: #333;
|
|
||||||
}
|
|
||||||
|
|
||||||
.manual-in__scan {
|
|
||||||
margin: 16rpx 0;
|
|
||||||
padding: 0 28rpx;
|
|
||||||
background: #fff;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 12rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.manual-in__scan-input {
|
|
||||||
flex: 1;
|
|
||||||
min-width: 0;
|
|
||||||
height: $pda-scan-input-height;
|
|
||||||
font-size: $pda-font-body;
|
|
||||||
color: #202328;
|
|
||||||
}
|
|
||||||
|
|
||||||
.manual-in__scan-icon {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
width: 72rpx;
|
|
||||||
height: 72rpx;
|
|
||||||
flex-shrink: 0;
|
|
||||||
border-radius: 8rpx;
|
|
||||||
border: 1rpx solid #d9d9d9;
|
|
||||||
background: #f7f7f7;
|
|
||||||
}
|
|
||||||
|
|
||||||
.manual-in__scan-close {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
height: 72rpx;
|
|
||||||
padding: 0 16rpx;
|
|
||||||
flex-shrink: 0;
|
|
||||||
border-radius: 8rpx;
|
|
||||||
border: 1rpx solid #2979ff;
|
|
||||||
background: #eaf2ff;
|
|
||||||
color: #2979ff;
|
|
||||||
font-size: $pda-font-action;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.manual-in__placeholder {
|
|
||||||
color: #b0b4bb;
|
|
||||||
font-size: $pda-font-placeholder;
|
|
||||||
}
|
|
||||||
|
|
||||||
.manual-in__panel {
|
|
||||||
background: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.manual-in__panel--form {
|
|
||||||
margin-top: 16rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.manual-in__footer {
|
|
||||||
position: fixed;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
padding: 20rpx 28rpx calc(20rpx + env(safe-area-inset-bottom));
|
|
||||||
background: #fff;
|
|
||||||
box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.06);
|
|
||||||
box-sizing: border-box;
|
|
||||||
z-index: 20;
|
|
||||||
|
|
||||||
::v-deep .u-btn {
|
|
||||||
height: $pda-button-height !important;
|
|
||||||
font-size: $pda-font-button !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.manual-in__row {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
min-height: $pda-row-min-height;
|
|
||||||
padding: 12rpx 28rpx;
|
|
||||||
border-bottom: 1rpx solid #eceff3;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.manual-in__row--input {
|
|
||||||
justify-content: space-between;
|
|
||||||
}
|
|
||||||
|
|
||||||
.manual-in__label {
|
|
||||||
width: $pda-label-width;
|
|
||||||
flex-shrink: 0;
|
|
||||||
font-size: $pda-font-body;
|
|
||||||
color: #666;
|
|
||||||
}
|
|
||||||
|
|
||||||
.manual-in__value {
|
|
||||||
flex: 1;
|
|
||||||
font-size: $pda-font-body;
|
|
||||||
color: #202328;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
.manual-in__right {
|
|
||||||
flex: 1;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: flex-end;
|
|
||||||
gap: 18rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.manual-in__field {
|
|
||||||
flex: 1;
|
|
||||||
min-width: 0;
|
|
||||||
text-align: right;
|
|
||||||
font-size: $pda-font-body;
|
|
||||||
color: #202328;
|
|
||||||
}
|
|
||||||
|
|
||||||
.manual-in__field-text {
|
|
||||||
flex: 1;
|
|
||||||
min-width: 0;
|
|
||||||
text-align: right;
|
|
||||||
font-size: $pda-font-body;
|
|
||||||
color: #202328;
|
|
||||||
word-break: break-all;
|
|
||||||
}
|
|
||||||
|
|
||||||
.manual-in__unit {
|
|
||||||
font-size: $pda-font-unit;
|
|
||||||
color: #666;
|
|
||||||
padding: 6rpx 14rpx;
|
|
||||||
border: 1rpx solid #d7dbe3;
|
|
||||||
border-radius: 8rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.manual-in__action {
|
|
||||||
font-size: $pda-font-action;
|
|
||||||
color: #2f78e6;
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -186,15 +186,15 @@ page { background-color: #F8F8F8; }
|
|||||||
border-radius: 12rpx;
|
border-radius: 12rpx;
|
||||||
}
|
}
|
||||||
.infoTitle {
|
.infoTitle {
|
||||||
font-size: 30rpx;
|
font-size: 32rpx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
margin-bottom: 16rpx;
|
margin-bottom: 16rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
.infoRow {
|
.infoRow {
|
||||||
display: flex;
|
display: flex;
|
||||||
font-size: 26rpx;
|
font-size: 28rpx;
|
||||||
padding: 8rpx 0;
|
padding: 10rpx 0;
|
||||||
}
|
}
|
||||||
.infoLabel {
|
.infoLabel {
|
||||||
width: 160rpx;
|
width: 160rpx;
|
||||||
@@ -208,8 +208,8 @@ page { background-color: #F8F8F8; }
|
|||||||
}
|
}
|
||||||
.summaryBar {
|
.summaryBar {
|
||||||
margin: 16rpx 24rpx 0;
|
margin: 16rpx 24rpx 0;
|
||||||
padding: 12rpx 16rpx;
|
padding: 14rpx 16rpx;
|
||||||
font-size: 26rpx;
|
font-size: 28rpx;
|
||||||
color: #666;
|
color: #666;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 8rpx;
|
border-radius: 8rpx;
|
||||||
@@ -241,8 +241,8 @@ page { background-color: #F8F8F8; }
|
|||||||
}
|
}
|
||||||
.tableCell {
|
.tableCell {
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
padding: 12rpx 8rpx;
|
padding: 16rpx 10rpx;
|
||||||
font-size: 22rpx;
|
font-size: 28rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
border-right: 1rpx solid #e1e1e1;
|
border-right: 1rpx solid #e1e1e1;
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
<WarehouseDataTable
|
<WarehouseDataTable
|
||||||
:headers="tableHeaders"
|
:headers="tableHeaders"
|
||||||
:contents="tableContents"
|
:contents="tableContents"
|
||||||
height="auto"
|
:height="tableHeight"
|
||||||
@row-click="goStockList"
|
@row-click="goStockList"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
@@ -56,6 +56,7 @@ import {
|
|||||||
GROUP_TABLE_COLUMNS,
|
GROUP_TABLE_COLUMNS,
|
||||||
buildGroupListQuery,
|
buildGroupListQuery,
|
||||||
buildStockListNavigateQuery,
|
buildStockListNavigateQuery,
|
||||||
|
calcTableHeight,
|
||||||
fetchAllWarehouseList,
|
fetchAllWarehouseList,
|
||||||
mapGroupTableRow,
|
mapGroupTableRow,
|
||||||
sumStockTotals,
|
sumStockTotals,
|
||||||
@@ -84,6 +85,9 @@ export default {
|
|||||||
totals() {
|
totals() {
|
||||||
return sumStockTotals(this.list);
|
return sumStockTotals(this.list);
|
||||||
},
|
},
|
||||||
|
tableHeight() {
|
||||||
|
return calcTableHeight(this.tableContents.length);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
uni.setNavigationBarTitle({ title: '坯布库存' });
|
uni.setNavigationBarTitle({ title: '坯布库存' });
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
<WarehouseDataTable
|
<WarehouseDataTable
|
||||||
:headers="tableHeaders"
|
:headers="tableHeaders"
|
||||||
:contents="tableContents"
|
:contents="tableContents"
|
||||||
height="auto"
|
:height="tableHeight"
|
||||||
@row-click="goDetail"
|
@row-click="goDetail"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
@@ -50,6 +50,7 @@ import {
|
|||||||
STOCK_TABLE_COLUMNS,
|
STOCK_TABLE_COLUMNS,
|
||||||
buildDetailNavigateQuery,
|
buildDetailNavigateQuery,
|
||||||
buildStockListQuery,
|
buildStockListQuery,
|
||||||
|
calcTableHeight,
|
||||||
fetchAllWarehouseList,
|
fetchAllWarehouseList,
|
||||||
mapStockTableRow,
|
mapStockTableRow,
|
||||||
parsePageQuery,
|
parsePageQuery,
|
||||||
@@ -83,6 +84,9 @@ export default {
|
|||||||
totals() {
|
totals() {
|
||||||
return sumStockTotals(this.list);
|
return sumStockTotals(this.list);
|
||||||
},
|
},
|
||||||
|
tableHeight() {
|
||||||
|
return calcTableHeight(this.tableContents.length, { maxPx: 9999 });
|
||||||
|
},
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
const parsed = parsePageQuery(options || {});
|
const parsed = parsePageQuery(options || {});
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
<u-form-item>
|
<u-form-item>
|
||||||
<text class="title" style="width:200px;">成品缸号:{{CrockNo}}</text>
|
<text class="title" style="width:200px;">成品缸号:{{CrockNo}}</text>
|
||||||
<text class="title" style="width:200px;">缸号卷号:{{GoodsBillNo}}</text>
|
<text class="title" style="width:200px;">缸号卷号:{{GoodsBillNo}}</text>
|
||||||
|
<text class="title" style="width:200px;">外部卷号:{{ExternVolumeNumber}}</text>
|
||||||
|
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item>
|
<u-form-item>
|
||||||
@@ -113,6 +114,7 @@
|
|||||||
GoodsCodeName: '',
|
GoodsCodeName: '',
|
||||||
CrockNo: '',
|
CrockNo: '',
|
||||||
GoodsBillNo: '',
|
GoodsBillNo: '',
|
||||||
|
ExternVolumeNumber: '',
|
||||||
GoodsQty: 0,
|
GoodsQty: 0,
|
||||||
testFocus0: false,
|
testFocus0: false,
|
||||||
testFocus1: true,
|
testFocus1: true,
|
||||||
@@ -281,6 +283,7 @@
|
|||||||
this.GoodsCodeName = aResultData.GoodsCodeName;
|
this.GoodsCodeName = aResultData.GoodsCodeName;
|
||||||
this.CrockNo = aResultData.CrockNo;
|
this.CrockNo = aResultData.CrockNo;
|
||||||
this.GoodsBillNo = aResultData.GoodsBillNo;
|
this.GoodsBillNo = aResultData.GoodsBillNo;
|
||||||
|
this.ExternVolumeNumber = aResultData.extern_volume_number || aResultData.ExternVolumeNumber || '';
|
||||||
this.GoodsQty = aResultData.GoodsQty;
|
this.GoodsQty = aResultData.GoodsQty;
|
||||||
this.BillSumRoll = parseFloat(aResultData.BillSumRoll);
|
this.BillSumRoll = parseFloat(aResultData.BillSumRoll);
|
||||||
this.BillSumQty = parseFloat(aResultData.BillSumQty);
|
this.BillSumQty = parseFloat(aResultData.BillSumQty);
|
||||||
|
|||||||
@@ -29,10 +29,22 @@
|
|||||||
</view>
|
</view>
|
||||||
<u-input v-model="Remark" maxlength="-1" type="textarea" :border="true" :height="100" :auto-height="true" />
|
<u-input v-model="Remark" maxlength="-1" type="textarea" :border="true" :height="100" :auto-height="true" />
|
||||||
</view>
|
</view>
|
||||||
|
<PlusBarcodePanel
|
||||||
|
v-if="usePhoneScanFallback"
|
||||||
|
:visible.sync="phoneScanPanelOpen"
|
||||||
|
hint-text="连续扫码盘点,扫完可继续下一条"
|
||||||
|
:scan-time-space="1200"
|
||||||
|
@success="onPlusBarcodeSuccess"
|
||||||
|
/>
|
||||||
<u-form-item label-width="150" label="条码资料:">
|
<u-form-item label-width="150" label="条码资料:">
|
||||||
<input type="text" maxlength="-1" v-model="QRBarCode" style="width:200px;" @confirm="GoodsCheckBillDetailScan" />
|
<input type="text" maxlength="-1" v-model="QRBarCode" style="width:200px;" @confirm="GoodsCheckBillDetailScan" />
|
||||||
|
<text
|
||||||
|
v-if="usePhoneScanFallback && phoneScanPanelOpen"
|
||||||
|
class="phone-scan-close"
|
||||||
|
@click.stop="handlePhoneScan"
|
||||||
|
>关闭扫码</text>
|
||||||
<u-icon
|
<u-icon
|
||||||
v-if="usePhoneScanFallback"
|
v-else-if="usePhoneScanFallback"
|
||||||
name="scan"
|
name="scan"
|
||||||
size="44"
|
size="44"
|
||||||
color="#2979ff"
|
color="#2979ff"
|
||||||
@@ -57,6 +69,7 @@
|
|||||||
<u-form-item>
|
<u-form-item>
|
||||||
<text class="title" style="width:200px;">成品缸号:{{CrockNo}}</text>
|
<text class="title" style="width:200px;">成品缸号:{{CrockNo}}</text>
|
||||||
<text class="title" style="width:200px;">缸号卷号:{{GoodsBillNo}}</text>
|
<text class="title" style="width:200px;">缸号卷号:{{GoodsBillNo}}</text>
|
||||||
|
<text class="title" style="width:200px;">外部卷号:{{ExternVolumeNumber}}</text>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item>
|
<u-form-item>
|
||||||
<text class="title" style="width:200px;">本架盘前:{{BillSumOldRoll}}条</text>
|
<text class="title" style="width:200px;">本架盘前:{{BillSumOldRoll}}条</text>
|
||||||
@@ -105,8 +118,10 @@
|
|||||||
playErrorAudio
|
playErrorAudio
|
||||||
} from '../../common/util';
|
} from '../../common/util';
|
||||||
import scanMixin from '@/common/scanMixin.js';
|
import scanMixin from '@/common/scanMixin.js';
|
||||||
|
import PlusBarcodePanel from '@/components/common/PlusBarcodePanel.vue';
|
||||||
import wybTable from '@/components/wyb-table/wyb-table.vue';
|
import wybTable from '@/components/wyb-table/wyb-table.vue';
|
||||||
export default {
|
export default {
|
||||||
|
components: { PlusBarcodePanel },
|
||||||
mixins: [scanMixin],
|
mixins: [scanMixin],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -146,6 +161,7 @@
|
|||||||
GoodsCodeName: '',
|
GoodsCodeName: '',
|
||||||
CrockNo: '',
|
CrockNo: '',
|
||||||
GoodsBillNo: '',
|
GoodsBillNo: '',
|
||||||
|
ExternVolumeNumber: '',
|
||||||
GoodsQty: 0,
|
GoodsQty: 0,
|
||||||
BillSumOldRoll: 0,
|
BillSumOldRoll: 0,
|
||||||
BillSumNewRoll: 0,
|
BillSumNewRoll: 0,
|
||||||
@@ -243,12 +259,31 @@
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handlePhoneScan() {
|
handlePhoneScan() {
|
||||||
this.openPhoneScan();
|
this.togglePhoneScanPanel();
|
||||||
|
},
|
||||||
|
onPlusBarcodeSuccess(scanResult) {
|
||||||
|
const code = String(scanResult || '').replace(/\s+/g, '').replace(/[\r\n]/g, '');
|
||||||
|
if (!code) return;
|
||||||
|
if (!this.StoreName) {
|
||||||
|
this.showError('请先选择仓库');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!this.StoreStationNo) {
|
||||||
|
this.StoreStationNo = code;
|
||||||
|
this.$nextTick(() => this.GetStoreStationName());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!this.GoodsCheckBillID) {
|
||||||
|
this.showError('请先提交');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.QRBarCode = code;
|
||||||
|
this.$nextTick(() => this.GoodsCheckBillDetailScan());
|
||||||
},
|
},
|
||||||
|
|
||||||
// 添加通用错误提示方法
|
// 添加通用错误提示方法
|
||||||
showError(message) {
|
showError(message) {
|
||||||
this.playError();
|
this.playError(message);
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: message,
|
content: message,
|
||||||
@@ -258,7 +293,7 @@
|
|||||||
|
|
||||||
// 添加成功提示方法
|
// 添加成功提示方法
|
||||||
showSuccess(message) {
|
showSuccess(message) {
|
||||||
this.playSuccess();
|
this.playSuccess(message);
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: message,
|
title: message,
|
||||||
icon: 'success'
|
icon: 'success'
|
||||||
@@ -267,11 +302,11 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
playSuccess() {
|
playSuccess(text) {
|
||||||
util.playSuccessAudio();
|
util.playSuccessAudio(text);
|
||||||
},
|
},
|
||||||
playError() {
|
playError(text) {
|
||||||
util.playErrorAudio();
|
util.playErrorAudio(text);
|
||||||
},
|
},
|
||||||
|
|
||||||
BarCodeDelChange: function() {
|
BarCodeDelChange: function() {
|
||||||
@@ -594,6 +629,7 @@
|
|||||||
this.GoodsCodeName = aResultData.product_color_name;
|
this.GoodsCodeName = aResultData.product_color_name;
|
||||||
this.CrockNo = aResultData.dyelot_number;
|
this.CrockNo = aResultData.dyelot_number;
|
||||||
this.GoodsBillNo = aResultData.volume_number;
|
this.GoodsBillNo = aResultData.volume_number;
|
||||||
|
this.ExternVolumeNumber = aResultData.extern_volume_number || '';
|
||||||
this.GoodsQty = aResultData.weight / 10000;
|
this.GoodsQty = aResultData.weight / 10000;
|
||||||
this.BillSumOldRoll = aResultData.warehouse_bin_check_before_roll/100;
|
this.BillSumOldRoll = aResultData.warehouse_bin_check_before_roll/100;
|
||||||
this.BillSumNewRoll = aResultData.warehouse_bin_check_roll/100;
|
this.BillSumNewRoll = aResultData.warehouse_bin_check_roll/100;
|
||||||
@@ -689,6 +725,18 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
.phone-scan-close {
|
||||||
|
margin-left: 8px;
|
||||||
|
padding: 0 12px;
|
||||||
|
height: 36px;
|
||||||
|
line-height: 36px;
|
||||||
|
border: 1px solid #2979ff;
|
||||||
|
border-radius: 4px;
|
||||||
|
color: #2979ff;
|
||||||
|
background: #eaf2ff;
|
||||||
|
font-size: 34rpx;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
page {
|
page {
|
||||||
background-color: #F8F8F8;
|
background-color: #F8F8F8;
|
||||||
padding-bottom: 260rpx;
|
padding-bottom: 260rpx;
|
||||||
|
|||||||
@@ -9,11 +9,23 @@
|
|||||||
<text class="title" style="width:200px;">仓库名称:{{ StoreName }}</text>
|
<text class="title" style="width:200px;">仓库名称:{{ StoreName }}</text>
|
||||||
<text class="title" style="width:200px;">仓位名称:{{ StoreStationName }}</text>
|
<text class="title" style="width:200px;">仓位名称:{{ StoreStationName }}</text>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
|
<PlusBarcodePanel
|
||||||
|
v-if="usePhoneScanFallback"
|
||||||
|
:visible.sync="phoneScanPanelOpen"
|
||||||
|
hint-text="连续扫码盘点,扫完可继续下一条"
|
||||||
|
:scan-time-space="1200"
|
||||||
|
@success="onPlusBarcodeSuccess"
|
||||||
|
/>
|
||||||
<u-form-item label-width="150" label="条码资料:">
|
<u-form-item label-width="150" label="条码资料:">
|
||||||
<input type="text" v-model="QRBarCode" maxlength="-1" style="width:200px;"
|
<input type="text" v-model="QRBarCode" maxlength="-1" style="width:200px;"
|
||||||
@confirm="GoodsCheckBillDetailScan" />
|
@confirm="GoodsCheckBillDetailScan" />
|
||||||
|
<text
|
||||||
|
v-if="usePhoneScanFallback && phoneScanPanelOpen"
|
||||||
|
class="phone-scan-close"
|
||||||
|
@click.stop="handlePhoneScan"
|
||||||
|
>关闭扫码</text>
|
||||||
<u-icon
|
<u-icon
|
||||||
v-if="usePhoneScanFallback"
|
v-else-if="usePhoneScanFallback"
|
||||||
name="scan"
|
name="scan"
|
||||||
size="44"
|
size="44"
|
||||||
color="#2979ff"
|
color="#2979ff"
|
||||||
@@ -38,6 +50,7 @@
|
|||||||
<u-form-item>
|
<u-form-item>
|
||||||
<text class="title" style="width:200px;">成品缸号:{{ CrockNo }}</text>
|
<text class="title" style="width:200px;">成品缸号:{{ CrockNo }}</text>
|
||||||
<text class="title" style="width:200px;">缸号卷号:{{ GoodsBillNo }}</text>
|
<text class="title" style="width:200px;">缸号卷号:{{ GoodsBillNo }}</text>
|
||||||
|
<text class="title" style="width:200px;">外部卷号:{{ ExternVolumeNumber }}</text>
|
||||||
|
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item>
|
<u-form-item>
|
||||||
@@ -77,9 +90,11 @@ import util, {
|
|||||||
playErrorAudio
|
playErrorAudio
|
||||||
} from '../../common/util';
|
} from '../../common/util';
|
||||||
import scanMixin from '@/common/scanMixin.js';
|
import scanMixin from '@/common/scanMixin.js';
|
||||||
|
import PlusBarcodePanel from '@/components/common/PlusBarcodePanel.vue';
|
||||||
import wybTable from '@/components/wyb-table/wyb-table.vue';
|
import wybTable from '@/components/wyb-table/wyb-table.vue';
|
||||||
//let that = '';
|
//let that = '';
|
||||||
export default {
|
export default {
|
||||||
|
components: { PlusBarcodePanel },
|
||||||
mixins: [scanMixin],
|
mixins: [scanMixin],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -106,6 +121,7 @@ export default {
|
|||||||
GoodsCodeName: '',
|
GoodsCodeName: '',
|
||||||
CrockNo: '',
|
CrockNo: '',
|
||||||
GoodsBillNo: '',
|
GoodsBillNo: '',
|
||||||
|
ExternVolumeNumber: '',
|
||||||
GoodsQty: 0,
|
GoodsQty: 0,
|
||||||
StoreStationNameFocus: false,
|
StoreStationNameFocus: false,
|
||||||
BillSumOldRoll: 0,
|
BillSumOldRoll: 0,
|
||||||
@@ -176,12 +192,15 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handlePhoneScan() {
|
handlePhoneScan() {
|
||||||
this.openPhoneScan();
|
this.togglePhoneScanPanel();
|
||||||
|
},
|
||||||
|
onPlusBarcodeSuccess(scanResult) {
|
||||||
|
this.handleScanResult(scanResult, this._scanCallback);
|
||||||
},
|
},
|
||||||
|
|
||||||
// 添加通用错误提示方法
|
// 添加通用错误提示方法
|
||||||
showError(message) {
|
showError(message) {
|
||||||
this.playError();
|
this.playError(message);
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: message,
|
content: message,
|
||||||
@@ -189,11 +208,11 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
playSuccess() {
|
playSuccess(text) {
|
||||||
util.playSuccessAudio();
|
util.playSuccessAudio(text);
|
||||||
},
|
},
|
||||||
playError() {
|
playError(text) {
|
||||||
util.playErrorAudio();
|
util.playErrorAudio(text);
|
||||||
},
|
},
|
||||||
|
|
||||||
BarCodeDelChange: function () {
|
BarCodeDelChange: function () {
|
||||||
@@ -251,6 +270,7 @@ export default {
|
|||||||
this.GoodsCodeName = aResultData.product_color_name;
|
this.GoodsCodeName = aResultData.product_color_name;
|
||||||
this.CrockNo = aResultData.dyelot_number;
|
this.CrockNo = aResultData.dyelot_number;
|
||||||
this.GoodsBillNo = aResultData.volume_number;
|
this.GoodsBillNo = aResultData.volume_number;
|
||||||
|
this.ExternVolumeNumber = aResultData.extern_volume_number || '';
|
||||||
this.GoodsQty = aResultData.weight / 10000;
|
this.GoodsQty = aResultData.weight / 10000;
|
||||||
this.BillSumOldRoll = aResultData.warehouse_bin_check_before_roll / 100;
|
this.BillSumOldRoll = aResultData.warehouse_bin_check_before_roll / 100;
|
||||||
this.BillSumNewRoll = aResultData.warehouse_bin_check_roll / 100;
|
this.BillSumNewRoll = aResultData.warehouse_bin_check_roll / 100;
|
||||||
@@ -372,6 +392,18 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
.phone-scan-close {
|
||||||
|
margin-left: 8px;
|
||||||
|
padding: 0 12px;
|
||||||
|
height: 36px;
|
||||||
|
line-height: 36px;
|
||||||
|
border: 1px solid #2979ff;
|
||||||
|
border-radius: 4px;
|
||||||
|
color: #2979ff;
|
||||||
|
background: #eaf2ff;
|
||||||
|
font-size: 34rpx;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
page {
|
page {
|
||||||
background-color: #F8F8F8;
|
background-color: #F8F8F8;
|
||||||
padding-bottom: 260rpx;
|
padding-bottom: 260rpx;
|
||||||
|
|||||||
@@ -75,6 +75,7 @@
|
|||||||
<u-form-item>
|
<u-form-item>
|
||||||
<text class="title" style="width:200px;">成品缸号:{{CrockNo}}</text>
|
<text class="title" style="width:200px;">成品缸号:{{CrockNo}}</text>
|
||||||
<text class="title" style="width:200px;">缸号卷号:{{GoodsBillNo}}</text>
|
<text class="title" style="width:200px;">缸号卷号:{{GoodsBillNo}}</text>
|
||||||
|
<text class="title" style="width:200px;">外部卷号:{{ExternVolumeNumber}}</text>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item>
|
<u-form-item>
|
||||||
<text class="title" style="width:200px;">本单条数:{{BillSumRoll}}条</text>
|
<text class="title" style="width:200px;">本单条数:{{BillSumRoll}}条</text>
|
||||||
@@ -161,6 +162,7 @@
|
|||||||
GoodsCodeName: '',
|
GoodsCodeName: '',
|
||||||
CrockNo: '',
|
CrockNo: '',
|
||||||
GoodsBillNo: '',
|
GoodsBillNo: '',
|
||||||
|
ExternVolumeNumber: '',
|
||||||
GoodsQty: 0,
|
GoodsQty: 0,
|
||||||
testFocus0: false,
|
testFocus0: false,
|
||||||
testFocus1: true,
|
testFocus1: true,
|
||||||
@@ -903,6 +905,7 @@
|
|||||||
this.GoodsCodeName = aResultData.GoodsCodeName;
|
this.GoodsCodeName = aResultData.GoodsCodeName;
|
||||||
this.CrockNo = aResultData.CrockNo;
|
this.CrockNo = aResultData.CrockNo;
|
||||||
this.GoodsBillNo = aResultData.GoodsBillNo;
|
this.GoodsBillNo = aResultData.GoodsBillNo;
|
||||||
|
this.ExternVolumeNumber = aResultData.extern_volume_number || aResultData.ExternVolumeNumber || '';
|
||||||
this.GoodsQty = aResultData.GoodsQty;
|
this.GoodsQty = aResultData.GoodsQty;
|
||||||
this.BillSumRoll = parseFloat(aResultData.BillSumRoll);
|
this.BillSumRoll = parseFloat(aResultData.BillSumRoll);
|
||||||
this.BillSumQty = parseFloat(aResultData.BillSumQty);
|
this.BillSumQty = parseFloat(aResultData.BillSumQty);
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
<u-form-item>
|
<u-form-item>
|
||||||
<text class="title" style="width:200px;">成品缸号:{{CrockNo}}</text>
|
<text class="title" style="width:200px;">成品缸号:{{CrockNo}}</text>
|
||||||
<text class="title" style="width:200px;">缸号卷号:{{GoodsBillNo}}</text>
|
<text class="title" style="width:200px;">缸号卷号:{{GoodsBillNo}}</text>
|
||||||
|
<text class="title" style="width:200px;">外部卷号:{{ExternVolumeNumber}}</text>
|
||||||
|
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item>
|
<u-form-item>
|
||||||
@@ -115,6 +116,7 @@
|
|||||||
GoodsCodeName: '',
|
GoodsCodeName: '',
|
||||||
CrockNo: '',
|
CrockNo: '',
|
||||||
GoodsBillNo: '',
|
GoodsBillNo: '',
|
||||||
|
ExternVolumeNumber: '',
|
||||||
GoodsQty: 0,
|
GoodsQty: 0,
|
||||||
testFocus0: false,
|
testFocus0: false,
|
||||||
testFocus1: true,
|
testFocus1: true,
|
||||||
@@ -283,6 +285,7 @@
|
|||||||
this.GoodsCodeName = aResultData.GoodsCodeName;
|
this.GoodsCodeName = aResultData.GoodsCodeName;
|
||||||
this.CrockNo = aResultData.CrockNo;
|
this.CrockNo = aResultData.CrockNo;
|
||||||
this.GoodsBillNo = aResultData.GoodsBillNo;
|
this.GoodsBillNo = aResultData.GoodsBillNo;
|
||||||
|
this.ExternVolumeNumber = aResultData.extern_volume_number || aResultData.ExternVolumeNumber || '';
|
||||||
this.GoodsQty = aResultData.GoodsQty;
|
this.GoodsQty = aResultData.GoodsQty;
|
||||||
this.BillSumRoll = parseFloat(aResultData.BillSumRoll);
|
this.BillSumRoll = parseFloat(aResultData.BillSumRoll);
|
||||||
this.BillSumQty = parseFloat(aResultData.BillSumQty);
|
this.BillSumQty = parseFloat(aResultData.BillSumQty);
|
||||||
|
|||||||
@@ -78,6 +78,7 @@
|
|||||||
<u-form-item>
|
<u-form-item>
|
||||||
<text class="title" style="width:200px;">成品缸号:{{CrockNo}}</text>
|
<text class="title" style="width:200px;">成品缸号:{{CrockNo}}</text>
|
||||||
<text class="title" style="width:200px;">缸号卷号:{{GoodsBillNo}}</text>
|
<text class="title" style="width:200px;">缸号卷号:{{GoodsBillNo}}</text>
|
||||||
|
<text class="title" style="width:200px;">外部卷号:{{ExternVolumeNumber}}</text>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item>
|
<u-form-item>
|
||||||
<text class="title" style="width:200px;">本单条数:{{BillSumRoll}}条</text>
|
<text class="title" style="width:200px;">本单条数:{{BillSumRoll}}条</text>
|
||||||
@@ -164,6 +165,7 @@
|
|||||||
GoodsCodeName: '',
|
GoodsCodeName: '',
|
||||||
CrockNo: '',
|
CrockNo: '',
|
||||||
GoodsBillNo: '',
|
GoodsBillNo: '',
|
||||||
|
ExternVolumeNumber: '',
|
||||||
GoodsQty: 0,
|
GoodsQty: 0,
|
||||||
testFocus0: false,
|
testFocus0: false,
|
||||||
testFocus1: true,
|
testFocus1: true,
|
||||||
@@ -816,6 +818,7 @@
|
|||||||
this.GoodsCodeName = aResultData.GoodsCodeName;
|
this.GoodsCodeName = aResultData.GoodsCodeName;
|
||||||
this.CrockNo = aResultData.CrockNo;
|
this.CrockNo = aResultData.CrockNo;
|
||||||
this.GoodsBillNo = aResultData.GoodsBillNo;
|
this.GoodsBillNo = aResultData.GoodsBillNo;
|
||||||
|
this.ExternVolumeNumber = aResultData.extern_volume_number || aResultData.ExternVolumeNumber || '';
|
||||||
this.GoodsQty = aResultData.GoodsQty;
|
this.GoodsQty = aResultData.GoodsQty;
|
||||||
this.BillSumRoll = parseFloat(aResultData.BillSumRoll);
|
this.BillSumRoll = parseFloat(aResultData.BillSumRoll);
|
||||||
this.BillSumQty = parseFloat(aResultData.BillSumQty);
|
this.BillSumQty = parseFloat(aResultData.BillSumQty);
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
<u-form-item>
|
<u-form-item>
|
||||||
<text class="title" style="width:200px;">成品缸号:{{CrockNo}}</text>
|
<text class="title" style="width:200px;">成品缸号:{{CrockNo}}</text>
|
||||||
<text class="title" style="width:200px;">缸号卷号:{{GoodsBillNo}}</text>
|
<text class="title" style="width:200px;">缸号卷号:{{GoodsBillNo}}</text>
|
||||||
|
<text class="title" style="width:200px;">外部卷号:{{ExternVolumeNumber}}</text>
|
||||||
|
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item>
|
<u-form-item>
|
||||||
@@ -113,6 +114,7 @@
|
|||||||
GoodsCodeName: '',
|
GoodsCodeName: '',
|
||||||
CrockNo: '',
|
CrockNo: '',
|
||||||
GoodsBillNo: '',
|
GoodsBillNo: '',
|
||||||
|
ExternVolumeNumber: '',
|
||||||
GoodsQty: 0,
|
GoodsQty: 0,
|
||||||
testFocus0: false,
|
testFocus0: false,
|
||||||
testFocus1: true,
|
testFocus1: true,
|
||||||
@@ -281,6 +283,7 @@
|
|||||||
this.GoodsCodeName = aResultData.GoodsCodeName;
|
this.GoodsCodeName = aResultData.GoodsCodeName;
|
||||||
this.CrockNo = aResultData.CrockNo;
|
this.CrockNo = aResultData.CrockNo;
|
||||||
this.GoodsBillNo = aResultData.GoodsBillNo;
|
this.GoodsBillNo = aResultData.GoodsBillNo;
|
||||||
|
this.ExternVolumeNumber = aResultData.extern_volume_number || aResultData.ExternVolumeNumber || '';
|
||||||
this.GoodsQty = aResultData.GoodsQty;
|
this.GoodsQty = aResultData.GoodsQty;
|
||||||
this.BillSumRoll = parseFloat(aResultData.BillSumRoll);
|
this.BillSumRoll = parseFloat(aResultData.BillSumRoll);
|
||||||
this.BillSumQty = parseFloat(aResultData.BillSumQty);
|
this.BillSumQty = parseFloat(aResultData.BillSumQty);
|
||||||
|
|||||||
@@ -66,6 +66,7 @@
|
|||||||
<u-form-item>
|
<u-form-item>
|
||||||
<text class="title" style="width:200px;">成品缸号:{{CrockNo}}</text>
|
<text class="title" style="width:200px;">成品缸号:{{CrockNo}}</text>
|
||||||
<text class="title" style="width:200px;">缸号卷号:{{GoodsBillNo}}</text>
|
<text class="title" style="width:200px;">缸号卷号:{{GoodsBillNo}}</text>
|
||||||
|
<text class="title" style="width:200px;">外部卷号:{{ExternVolumeNumber}}</text>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item>
|
<u-form-item>
|
||||||
<text class="title" style="width:200px;">本单条数:{{BillSumRoll}}条</text>
|
<text class="title" style="width:200px;">本单条数:{{BillSumRoll}}条</text>
|
||||||
@@ -155,6 +156,7 @@
|
|||||||
GoodsCodeName: '',
|
GoodsCodeName: '',
|
||||||
CrockNo: '',
|
CrockNo: '',
|
||||||
GoodsBillNo: '',
|
GoodsBillNo: '',
|
||||||
|
ExternVolumeNumber: '',
|
||||||
GoodsQty: 0,
|
GoodsQty: 0,
|
||||||
FromStoreStationFocus: false,
|
FromStoreStationFocus: false,
|
||||||
ToStoreStationFocus: true,
|
ToStoreStationFocus: true,
|
||||||
@@ -711,6 +713,7 @@
|
|||||||
this.GoodsCodeName = aResultData.GoodsCodeName;
|
this.GoodsCodeName = aResultData.GoodsCodeName;
|
||||||
this.CrockNo = aResultData.CrockNo;
|
this.CrockNo = aResultData.CrockNo;
|
||||||
this.GoodsBillNo = aResultData.GoodsBillNo;
|
this.GoodsBillNo = aResultData.GoodsBillNo;
|
||||||
|
this.ExternVolumeNumber = aResultData.extern_volume_number || aResultData.ExternVolumeNumber || '';
|
||||||
this.GoodsQty = aResultData.GoodsQty;
|
this.GoodsQty = aResultData.GoodsQty;
|
||||||
this.GoodsCodeSumRoll = parseFloat(aResultData.GoodsCodeSumRoll);
|
this.GoodsCodeSumRoll = parseFloat(aResultData.GoodsCodeSumRoll);
|
||||||
this.GoodsCodeSumQty = parseFloat(aResultData.GoodsCodeSumQty);
|
this.GoodsCodeSumQty = parseFloat(aResultData.GoodsCodeSumQty);
|
||||||
|
|||||||
@@ -48,6 +48,7 @@
|
|||||||
<u-form-item>
|
<u-form-item>
|
||||||
<text class="title" style="width:200px;">成品缸号:{{CrockNo}}</text>
|
<text class="title" style="width:200px;">成品缸号:{{CrockNo}}</text>
|
||||||
<text class="title" style="width:200px;">缸号卷号:{{GoodsBillNo}}</text>
|
<text class="title" style="width:200px;">缸号卷号:{{GoodsBillNo}}</text>
|
||||||
|
<text class="title" style="width:200px;">外部卷号:{{ExternVolumeNumber}}</text>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item>
|
<u-form-item>
|
||||||
<text class="title" style="width:200px;">本单条数:{{BillSumRoll}}条</text>
|
<text class="title" style="width:200px;">本单条数:{{BillSumRoll}}条</text>
|
||||||
@@ -119,6 +120,7 @@
|
|||||||
GoodsCodeName: '',
|
GoodsCodeName: '',
|
||||||
CrockNo: '',
|
CrockNo: '',
|
||||||
GoodsBillNo: '',
|
GoodsBillNo: '',
|
||||||
|
ExternVolumeNumber: '',
|
||||||
GoodsQty: 0,
|
GoodsQty: 0,
|
||||||
FromStoreStationFocus: false,
|
FromStoreStationFocus: false,
|
||||||
ToStoreStationFocus: true,
|
ToStoreStationFocus: true,
|
||||||
@@ -360,6 +362,7 @@
|
|||||||
this.GoodsCodeName = aResultData.GoodsCodeName;
|
this.GoodsCodeName = aResultData.GoodsCodeName;
|
||||||
this.CrockNo = aResultData.CrockNo;
|
this.CrockNo = aResultData.CrockNo;
|
||||||
this.GoodsBillNo = aResultData.GoodsBillNo;
|
this.GoodsBillNo = aResultData.GoodsBillNo;
|
||||||
|
this.ExternVolumeNumber = aResultData.extern_volume_number || aResultData.ExternVolumeNumber || '';
|
||||||
this.GoodsQty = aResultData.GoodsQty;
|
this.GoodsQty = aResultData.GoodsQty;
|
||||||
this.GoodsCodeSumRoll = parseFloat(aResultData.GoodsCodeSumRoll);
|
this.GoodsCodeSumRoll = parseFloat(aResultData.GoodsCodeSumRoll);
|
||||||
this.GoodsCodeSumQty = parseFloat(aResultData.GoodsCodeSumQty);
|
this.GoodsCodeSumQty = parseFloat(aResultData.GoodsCodeSumQty);
|
||||||
|
|||||||
@@ -23,11 +23,23 @@
|
|||||||
<checkbox ref="checkBoxRef" :checked="AllStoreStationScanStatus">整架</checkbox>
|
<checkbox ref="checkBoxRef" :checked="AllStoreStationScanStatus">整架</checkbox>
|
||||||
</checkbox-group>
|
</checkbox-group>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
|
<PlusBarcodePanel
|
||||||
|
v-if="usePhoneScanFallback"
|
||||||
|
:visible.sync="phoneScanPanelOpen"
|
||||||
|
hint-text="连续扫码移仓,扫完可继续下一条"
|
||||||
|
:scan-time-space="1200"
|
||||||
|
@success="onPlusBarcodeSuccess"
|
||||||
|
/>
|
||||||
<u-form-item label-width="150" label="条码资料:" :class="{ 'input-highlight': shouldHighlightQR }">
|
<u-form-item label-width="150" label="条码资料:" :class="{ 'input-highlight': shouldHighlightQR }">
|
||||||
<input type="text" v-model="QRBarCode" maxlength="-1" style="width:150px;"
|
<input type="text" v-model="QRBarCode" maxlength="-1" style="width:150px;"
|
||||||
@confirm="GoodsStoreStationMoveScan" />
|
@confirm="GoodsStoreStationMoveScan" />
|
||||||
|
<text
|
||||||
|
v-if="usePhoneScanFallback && phoneScanPanelOpen"
|
||||||
|
class="phone-scan-close"
|
||||||
|
@click.stop="handlePhoneScan"
|
||||||
|
>关闭扫码</text>
|
||||||
<u-icon
|
<u-icon
|
||||||
v-if="usePhoneScanFallback"
|
v-else-if="usePhoneScanFallback"
|
||||||
name="scan"
|
name="scan"
|
||||||
size="44"
|
size="44"
|
||||||
color="#2979ff"
|
color="#2979ff"
|
||||||
@@ -49,6 +61,7 @@
|
|||||||
<u-form-item>
|
<u-form-item>
|
||||||
<text class="title" style="width:200px;">成品缸号:{{ CrockNo }}</text>
|
<text class="title" style="width:200px;">成品缸号:{{ CrockNo }}</text>
|
||||||
<text class="title" style="width:200px;">缸号卷号:{{ GoodsBillNo }}</text>
|
<text class="title" style="width:200px;">缸号卷号:{{ GoodsBillNo }}</text>
|
||||||
|
<text class="title" style="width:200px;">外部卷号:{{ ExternVolumeNumber }}</text>
|
||||||
|
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item>
|
<u-form-item>
|
||||||
@@ -82,7 +95,9 @@ import util, {
|
|||||||
} from '../../common/util';
|
} from '../../common/util';
|
||||||
import wybTable from '@/components/wyb-table/wyb-table.vue';
|
import wybTable from '@/components/wyb-table/wyb-table.vue';
|
||||||
import scanMixin from '@/common/scanMixin.js';
|
import scanMixin from '@/common/scanMixin.js';
|
||||||
|
import PlusBarcodePanel from '@/components/common/PlusBarcodePanel.vue';
|
||||||
export default {
|
export default {
|
||||||
|
components: { PlusBarcodePanel },
|
||||||
mixins: [scanMixin],
|
mixins: [scanMixin],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -110,6 +125,7 @@ export default {
|
|||||||
GoodsCodeName: '',
|
GoodsCodeName: '',
|
||||||
CrockNo: '',
|
CrockNo: '',
|
||||||
GoodsBillNo: '',
|
GoodsBillNo: '',
|
||||||
|
ExternVolumeNumber: '',
|
||||||
GoodsQty: 0,
|
GoodsQty: 0,
|
||||||
FromStoreStationFocus: false,
|
FromStoreStationFocus: false,
|
||||||
QRBarCodeFocus: false,
|
QRBarCodeFocus: false,
|
||||||
@@ -181,14 +197,17 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handlePhoneScan() {
|
handlePhoneScan() {
|
||||||
this.openPhoneScan();
|
this.togglePhoneScanPanel();
|
||||||
|
},
|
||||||
|
onPlusBarcodeSuccess(scanResult) {
|
||||||
|
this.handleScanResult(scanResult, this._scanCallback);
|
||||||
},
|
},
|
||||||
|
|
||||||
playSuccess() {
|
playSuccess() {
|
||||||
util.playSuccessAudio();
|
util.playSuccessAudio();
|
||||||
},
|
},
|
||||||
playError() {
|
playError(text) {
|
||||||
util.playErrorAudio();
|
util.playErrorAudio(text);
|
||||||
},
|
},
|
||||||
|
|
||||||
// 自定义扫码处理回调 - 处理本页面特有的扫码逻辑
|
// 自定义扫码处理回调 - 处理本页面特有的扫码逻辑
|
||||||
@@ -266,7 +285,7 @@ export default {
|
|||||||
|
|
||||||
// 添加一个通用的错误提示方法
|
// 添加一个通用的错误提示方法
|
||||||
showError(message) {
|
showError(message) {
|
||||||
this.playError();
|
this.playError(message);
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: message,
|
content: message,
|
||||||
@@ -446,6 +465,7 @@ export default {
|
|||||||
this.GoodsCodeName = aResultData.product_color_name;
|
this.GoodsCodeName = aResultData.product_color_name;
|
||||||
this.CrockNo = aResultData.dyelot_number;
|
this.CrockNo = aResultData.dyelot_number;
|
||||||
this.GoodsBillNo = aResultData.volume_number;
|
this.GoodsBillNo = aResultData.volume_number;
|
||||||
|
this.ExternVolumeNumber = aResultData.extern_volume_number || '';
|
||||||
this.GoodsQty = aResultData.weight / 10000;
|
this.GoodsQty = aResultData.weight / 10000;
|
||||||
this.StoreStationSumRoll = aResultData.warehouse_bin_roll / 100;
|
this.StoreStationSumRoll = aResultData.warehouse_bin_roll / 100;
|
||||||
this.StoreStationSumQty = aResultData.warehouse_bin_weight / 10000;
|
this.StoreStationSumQty = aResultData.warehouse_bin_weight / 10000;
|
||||||
@@ -508,6 +528,18 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
.phone-scan-close {
|
||||||
|
margin-left: 8px;
|
||||||
|
padding: 0 12px;
|
||||||
|
height: 36px;
|
||||||
|
line-height: 36px;
|
||||||
|
border: 1px solid #2979ff;
|
||||||
|
border-radius: 4px;
|
||||||
|
color: #2979ff;
|
||||||
|
background: #eaf2ff;
|
||||||
|
font-size: 34rpx;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
.first {
|
.first {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,176 @@
|
|||||||
|
<template>
|
||||||
|
<view class="fabric-out-page">
|
||||||
|
<OrderHeaderFold v-model="headerCollapsed" :summary="form.order_no || '保存后自动生成'">
|
||||||
|
<OrderStatusBar class="fabric-out-mt32" :status="displayAuditStatus" :name="displayAuditStatusName" />
|
||||||
|
<view @click="pickerSelectFun('进仓类型')" class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">进仓类型<text class="redXingh">*</text></text>
|
||||||
|
<view :class="form.in_order_type_name ? '' : 'cBlack'">
|
||||||
|
{{ form.in_order_type_name || '请选择' }}
|
||||||
|
<u-icon v-if="headerEditable" class="ml26" name="arrow-right" size="40" color="#888888"></u-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view @click="pickerSelectFun('加工单位')" class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">加工单位<text class="redXingh">*</text></text>
|
||||||
|
<view :class="form.process_name ? '' : 'cBlack'">
|
||||||
|
{{ form.process_name || '请选择' }}
|
||||||
|
<u-icon v-if="headerEditable" class="ml26" name="arrow-right" size="40" color="#888888"></u-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view @click="pickerSelectFun('仓库名称')" class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">仓库名称<text class="redXingh">*</text></text>
|
||||||
|
<view :class="form.warehouse_name ? '' : 'cBlack'">
|
||||||
|
{{ form.warehouse_name || '请选择' }}
|
||||||
|
<u-icon v-if="headerEditable" class="ml26" name="arrow-right" size="40" color="#888888"></u-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26 ptb10 bdb_f5 process-in-weight-row">
|
||||||
|
<view class="process-in-weight-col">
|
||||||
|
<text class="mr16">纸筒重量</text>
|
||||||
|
<u-input
|
||||||
|
v-model="form.paper_tube_weight"
|
||||||
|
type="digit"
|
||||||
|
:disabled="!canEditWeights"
|
||||||
|
placeholder="1.5"
|
||||||
|
:custom-style="weightInputStyle"
|
||||||
|
placeholder-style="color: #c0c4cc; font-size: 36rpx;"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
<view class="process-in-weight-col">
|
||||||
|
<text class="mr16">包装重量</text>
|
||||||
|
<u-input
|
||||||
|
v-model="form.package_weight"
|
||||||
|
type="digit"
|
||||||
|
:disabled="!canEditWeights"
|
||||||
|
placeholder="0.3"
|
||||||
|
:custom-style="weightInputStyle"
|
||||||
|
placeholder-style="color: #c0c4cc; font-size: 36rpx;"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view @click="pickerSelectFun('营销体系')" class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">营销体系<text class="redXingh">*</text></text>
|
||||||
|
<view :class="form.sale_system_name ? '' : 'cBlack'">
|
||||||
|
{{ form.sale_system_name || '请选择' }}
|
||||||
|
<u-icon v-if="headerEditable" class="ml26" name="arrow-right" size="40" color="#888888"></u-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26-column ptb20 mt32">
|
||||||
|
<view style="margin-bottom: 8rpx;"><text>单据备注</text></view>
|
||||||
|
<u-input v-model="form.remark" :disabled="!headerEditable" type="textarea" :border="true" :height="100" :auto-height="true" />
|
||||||
|
</view>
|
||||||
|
</OrderHeaderFold>
|
||||||
|
|
||||||
|
<PlusBarcodePanel
|
||||||
|
:visible.sync="phoneScanPanelOpen"
|
||||||
|
:hint-text="phoneScanHint"
|
||||||
|
:scan-time-space="1200"
|
||||||
|
@success="onPlusBarcodeSuccess"
|
||||||
|
/>
|
||||||
|
<ProcessInBinBar
|
||||||
|
:can-scan="canScan"
|
||||||
|
:bin-id="warehouseBinId"
|
||||||
|
:code="warehouseBinCode"
|
||||||
|
:name="warehouseBinName"
|
||||||
|
:show-phone-scan="canScan"
|
||||||
|
:scanning="phoneScanPanelOpen && phoneScanTarget === 'bin'"
|
||||||
|
@code-input="warehouseBinCode = $event"
|
||||||
|
@confirm="resolveWarehouseBin"
|
||||||
|
@phone-scan="handleBinPhoneScan"
|
||||||
|
@clear="clearWarehouseBin"
|
||||||
|
/>
|
||||||
|
<FabricOutScanBar
|
||||||
|
:can-scan="showQrScanBar"
|
||||||
|
:value="QRBarCode"
|
||||||
|
:delete-mode="BarCodeDelStatus"
|
||||||
|
:message="BillDataMessage"
|
||||||
|
:disabled-tip="qrDisabledTip"
|
||||||
|
:show-phone-scan="canScanQr"
|
||||||
|
:scanning="phoneScanPanelOpen && phoneScanTarget === 'qr'"
|
||||||
|
@input="QRBarCode = $event"
|
||||||
|
@scan="handleScan"
|
||||||
|
@phone-scan="handlePhoneScan"
|
||||||
|
@delete-mode-change="BarCodeDelChange"
|
||||||
|
/>
|
||||||
|
<ProcessInScanDetail :detail="scanDetail" />
|
||||||
|
|
||||||
|
<ProcessInDetailList
|
||||||
|
:list="form.item_data"
|
||||||
|
:deletable="canScan"
|
||||||
|
show-tare-columns
|
||||||
|
@delete="onDeleteFineCode"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<FabricOutFooter
|
||||||
|
v-if="!headerSaved"
|
||||||
|
:buttons="[{ label: '提交保存', action: 'save' }]"
|
||||||
|
single
|
||||||
|
@action="submitSave"
|
||||||
|
/>
|
||||||
|
<FabricOutFooter
|
||||||
|
v-else
|
||||||
|
:buttons="statusActionButtons"
|
||||||
|
@action="handleStatusAction"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<u-select v-model="selectShow" :list="selectList" :remote="isRemoteSelect" :loading="selectSearching" @search="onSelectSearch" @confirm="selectConfirmFun"></u-select>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import formMixin from './storeGoodsProcessInMixin.js';
|
||||||
|
import OrderStatusBar from '@/components/storefabric/OrderStatusBar.vue';
|
||||||
|
import OrderHeaderFold from '@/components/storefabric/OrderHeaderFold.vue';
|
||||||
|
import FabricOutScanBar from '@/components/storefabric/FabricOutScanBar.vue';
|
||||||
|
import FabricOutFooter from '@/components/storefabric/FabricOutFooter.vue';
|
||||||
|
import ProcessInScanDetail from '@/components/storegoods/ProcessInScanDetail.vue';
|
||||||
|
import ProcessInDetailList from '@/components/storegoods/ProcessInDetailList.vue';
|
||||||
|
import ProcessInBinBar from '@/components/storegoods/ProcessInBinBar.vue';
|
||||||
|
import PlusBarcodePanel from '@/components/common/PlusBarcodePanel.vue';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
PlusBarcodePanel,
|
||||||
|
OrderStatusBar,
|
||||||
|
OrderHeaderFold,
|
||||||
|
FabricOutScanBar,
|
||||||
|
FabricOutFooter,
|
||||||
|
ProcessInScanDetail,
|
||||||
|
ProcessInDetailList,
|
||||||
|
ProcessInBinBar,
|
||||||
|
},
|
||||||
|
mixins: [formMixin],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
weightInputStyle: {
|
||||||
|
fontSize: '36rpx',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
uni.setNavigationBarTitle({ title: '新增加工进仓单' });
|
||||||
|
this.pageMode = 'add';
|
||||||
|
this.loadBaseDropdowns();
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
@import '@/pages/storefabric/storeFabricBusinessOutPage.scss';
|
||||||
|
page {
|
||||||
|
background-color: #F8F8F8;
|
||||||
|
padding-bottom: 260rpx;
|
||||||
|
}
|
||||||
|
.process-in-weight-row {
|
||||||
|
gap: 20rpx;
|
||||||
|
}
|
||||||
|
.process-in-weight-col {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
min-width: 0;
|
||||||
|
|
||||||
|
::v-deep .u-input__input {
|
||||||
|
font-size: 36rpx !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,157 @@
|
|||||||
|
<template>
|
||||||
|
<view class="fabric-out-page">
|
||||||
|
<OrderHeaderFold v-model="headerCollapsed" :summary="form.order_no">
|
||||||
|
<OrderStatusBar class="fabric-out-mt32" :status="displayAuditStatus" :name="displayAuditStatusName" />
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">进仓类型</text>
|
||||||
|
<text>{{ form.in_order_type_name || '加工进仓单' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">加工单位</text>
|
||||||
|
<text>{{ form.process_name || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">仓库名称</text>
|
||||||
|
<text>{{ form.warehouse_name || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26 ptb10 bdb_f5 process-in-weight-row">
|
||||||
|
<view class="process-in-weight-col">
|
||||||
|
<text class="mr16">纸筒重量</text>
|
||||||
|
<u-input
|
||||||
|
v-model="form.paper_tube_weight"
|
||||||
|
type="digit"
|
||||||
|
:disabled="!canEditWeights"
|
||||||
|
placeholder="1.5"
|
||||||
|
:custom-style="weightInputStyle"
|
||||||
|
placeholder-style="color: #c0c4cc; font-size: 36rpx;"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
<view class="process-in-weight-col">
|
||||||
|
<text class="mr16">包装重量</text>
|
||||||
|
<u-input
|
||||||
|
v-model="form.package_weight"
|
||||||
|
type="digit"
|
||||||
|
:disabled="!canEditWeights"
|
||||||
|
placeholder="0.3"
|
||||||
|
:custom-style="weightInputStyle"
|
||||||
|
placeholder-style="color: #c0c4cc; font-size: 36rpx;"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">营销体系</text>
|
||||||
|
<text>{{ form.sale_system_name || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">单据备注</text>
|
||||||
|
<text>{{ form.remark || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
</OrderHeaderFold>
|
||||||
|
|
||||||
|
<PlusBarcodePanel
|
||||||
|
:visible.sync="phoneScanPanelOpen"
|
||||||
|
:hint-text="phoneScanHint"
|
||||||
|
:scan-time-space="1200"
|
||||||
|
@success="onPlusBarcodeSuccess"
|
||||||
|
/>
|
||||||
|
<ProcessInBinBar
|
||||||
|
:can-scan="canScan"
|
||||||
|
:bin-id="warehouseBinId"
|
||||||
|
:code="warehouseBinCode"
|
||||||
|
:name="warehouseBinName"
|
||||||
|
:show-phone-scan="canScan"
|
||||||
|
:scanning="phoneScanPanelOpen && phoneScanTarget === 'bin'"
|
||||||
|
@code-input="warehouseBinCode = $event"
|
||||||
|
@confirm="resolveWarehouseBin"
|
||||||
|
@phone-scan="handleBinPhoneScan"
|
||||||
|
@clear="clearWarehouseBin"
|
||||||
|
/>
|
||||||
|
<FabricOutScanBar
|
||||||
|
:can-scan="showQrScanBar"
|
||||||
|
:value="QRBarCode"
|
||||||
|
:delete-mode="BarCodeDelStatus"
|
||||||
|
:message="BillDataMessage"
|
||||||
|
:disabled-tip="qrDisabledTip"
|
||||||
|
:show-phone-scan="canScanQr"
|
||||||
|
:scanning="phoneScanPanelOpen && phoneScanTarget === 'qr'"
|
||||||
|
@input="QRBarCode = $event"
|
||||||
|
@scan="handleScan"
|
||||||
|
@phone-scan="handlePhoneScan"
|
||||||
|
@delete-mode-change="BarCodeDelChange"
|
||||||
|
/>
|
||||||
|
<ProcessInScanDetail :detail="scanDetail" />
|
||||||
|
|
||||||
|
<ProcessInDetailList
|
||||||
|
:list="form.item_data"
|
||||||
|
:deletable="canScan"
|
||||||
|
show-tare-columns
|
||||||
|
@delete="onDeleteFineCode"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<FabricOutFooter :buttons="statusActionButtons" @action="handleStatusAction" />
|
||||||
|
|
||||||
|
<u-select v-model="selectShow" :list="selectList" :remote="isRemoteSelect" :loading="selectSearching" @search="onSelectSearch" @confirm="selectConfirmFun"></u-select>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import formMixin from './storeGoodsProcessInMixin.js';
|
||||||
|
import OrderStatusBar from '@/components/storefabric/OrderStatusBar.vue';
|
||||||
|
import OrderHeaderFold from '@/components/storefabric/OrderHeaderFold.vue';
|
||||||
|
import FabricOutScanBar from '@/components/storefabric/FabricOutScanBar.vue';
|
||||||
|
import FabricOutFooter from '@/components/storefabric/FabricOutFooter.vue';
|
||||||
|
import ProcessInScanDetail from '@/components/storegoods/ProcessInScanDetail.vue';
|
||||||
|
import ProcessInDetailList from '@/components/storegoods/ProcessInDetailList.vue';
|
||||||
|
import ProcessInBinBar from '@/components/storegoods/ProcessInBinBar.vue';
|
||||||
|
import PlusBarcodePanel from '@/components/common/PlusBarcodePanel.vue';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
PlusBarcodePanel,
|
||||||
|
OrderStatusBar,
|
||||||
|
OrderHeaderFold,
|
||||||
|
FabricOutScanBar,
|
||||||
|
FabricOutFooter,
|
||||||
|
ProcessInScanDetail,
|
||||||
|
ProcessInDetailList,
|
||||||
|
ProcessInBinBar,
|
||||||
|
},
|
||||||
|
mixins: [formMixin],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
headerCollapsed: true,
|
||||||
|
weightInputStyle: {
|
||||||
|
fontSize: '36rpx',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
onLoad(e) {
|
||||||
|
uni.setNavigationBarTitle({ title: '编辑加工进仓单' });
|
||||||
|
this.pageMode = 'edit';
|
||||||
|
if (e.id) {
|
||||||
|
this.loadOrder(Number(e.id), { rejectIfLocked: true });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
@import '@/pages/storefabric/storeFabricBusinessOutPage.scss';
|
||||||
|
page {
|
||||||
|
background-color: #F8F8F8;
|
||||||
|
padding-bottom: 260rpx;
|
||||||
|
}
|
||||||
|
.process-in-weight-row {
|
||||||
|
gap: 20rpx;
|
||||||
|
}
|
||||||
|
.process-in-weight-col {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
min-width: 0;
|
||||||
|
|
||||||
|
::v-deep .u-input__input {
|
||||||
|
font-size: 36rpx !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,275 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<view class="filterBar">
|
||||||
|
<u-search v-model="filters.order_no" placeholder="进仓单号" :show-action="false" @search="applySearch" @custom="applySearch" @clear="applySearch" />
|
||||||
|
<view class="filterBtn" :class="{ 'filter-active': hasActiveFilter }" @click="filterShow = true">
|
||||||
|
<view class="filterBtn__icon">
|
||||||
|
<u-icon :key="filterIconColor" name="list" size="44" :color="filterIconColor"></u-icon>
|
||||||
|
<view v-if="hasActiveFilter" class="filterBtn__badge"></view>
|
||||||
|
</view>
|
||||||
|
<text>筛选</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<scroll-view scroll-y :style="{ height: scrollHeight }" refresher-enabled
|
||||||
|
:refresher-triggered="triggered" @refresherrefresh="onRefresh">
|
||||||
|
<dataNull v-if="list.length === 0" src="/src/static/img/chahua/gjNull.png"
|
||||||
|
title="暂无加工进仓单" title1="请点击右下角按钮新增">
|
||||||
|
</dataNull>
|
||||||
|
<view v-for="(item, index) in list" :key="item.id" @click="goView(item)">
|
||||||
|
<ProcessInItem :item="item" :index="index" />
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
|
||||||
|
<addBtn url="./storeGoodsProcessInAdd"></addBtn>
|
||||||
|
|
||||||
|
<u-popup v-model="filterShow" mode="right" width="580rpx" :safe-area-inset-bottom="true" @close="cancelFilterEdit">
|
||||||
|
<view class="filterPanel">
|
||||||
|
<view class="filterTitle">筛选条件</view>
|
||||||
|
<view class="filterItem">
|
||||||
|
<text class="filterLabel">进仓单号</text>
|
||||||
|
<view class="filterInput">
|
||||||
|
<u-input v-model="filters.order_no" placeholder="请输入进仓单号" :height="100" :custom-style="{ fontSize: '36rpx', color: '#202328' }" placeholder-style="color: #aeb4bf; font-size: 34rpx;" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="filterItem" @click="openProcessUnitSelect">
|
||||||
|
<text class="filterLabel">加工单位</text>
|
||||||
|
<view class="filterValue">{{ processUnitLabel || '全部' }} <u-icon name="arrow-right" size="36"></u-icon></view>
|
||||||
|
</view>
|
||||||
|
<view class="filterItem" @click="openWarehouseSelect">
|
||||||
|
<text class="filterLabel">仓库</text>
|
||||||
|
<view class="filterValue">{{ warehouseLabel || '全部' }} <u-icon name="arrow-right" size="36"></u-icon></view>
|
||||||
|
</view>
|
||||||
|
<view class="filterItem" @click="openStatusSelect">
|
||||||
|
<text class="filterLabel">订单状态</text>
|
||||||
|
<view class="filterValue">{{ statusLabel || '全部' }} <u-icon name="arrow-right" size="36"></u-icon></view>
|
||||||
|
</view>
|
||||||
|
<view class="filterActions">
|
||||||
|
<u-button type="warning" size="medium" @click="resetFilter">重置</u-button>
|
||||||
|
<u-button type="primary" size="medium" @click="applyFilter">确定</u-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
|
|
||||||
|
<u-select class="pdaSelect" v-model="statusSelectShow" title="选择订单状态" :list="statusSelectList" :default-value="statusSelectDefault" @confirm="onStatusConfirm"></u-select>
|
||||||
|
<u-select class="pdaSelect" v-model="unitSelectShow" :list="unitSelectList" :default-value="unitSelectDefault" remote :loading="selectSearching" @search="onUnitSearch" @confirm="onUnitConfirm"></u-select>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import addBtn from '@/components/addBtn/addBtn.vue';
|
||||||
|
import ProcessInItem from '@/components/card/storeGoodsProcessInItem.vue';
|
||||||
|
import {
|
||||||
|
getStatusOptions,
|
||||||
|
AUDIT_STATUS,
|
||||||
|
AUDIT_STATUS_MAP,
|
||||||
|
BUSINESS_UNIT_TYPE_PROCESS,
|
||||||
|
WAREHOUSE_TYPE_FINISHED,
|
||||||
|
formatRoll,
|
||||||
|
mapToSelectOptions,
|
||||||
|
fetchAllOrderList,
|
||||||
|
} from '@/common/storeGoodsProcessIn';
|
||||||
|
import { withNameParam } from '@/common/remoteSelect';
|
||||||
|
import listFilterMixin from '@/mixins/listFilterMixin';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: { addBtn, ProcessInItem },
|
||||||
|
mixins: [listFilterMixin],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
list: [],
|
||||||
|
scrollHeight: '667px',
|
||||||
|
triggered: false,
|
||||||
|
listLoading: false,
|
||||||
|
filterShow: false,
|
||||||
|
statusSelectShow: false,
|
||||||
|
unitSelectShow: false,
|
||||||
|
unitSelectType: '',
|
||||||
|
processUnitOptions: [],
|
||||||
|
warehouseOptions: [],
|
||||||
|
unitOptionsLoading: false,
|
||||||
|
selectSearching: false,
|
||||||
|
unitSearchSeq: 0,
|
||||||
|
unitSelectList: [{ value: '', label: '全部' }],
|
||||||
|
filterStorageKey: 'storeGoodsProcessInListFilters_v2',
|
||||||
|
filters: {
|
||||||
|
order_no: '',
|
||||||
|
process_unit_id: '',
|
||||||
|
process_name: '',
|
||||||
|
warehouse_id: '',
|
||||||
|
warehouse_name: '',
|
||||||
|
audit_status: AUDIT_STATUS.PENDING,
|
||||||
|
},
|
||||||
|
statusSelectList: [
|
||||||
|
{ value: '', label: '全部' },
|
||||||
|
...getStatusOptions(),
|
||||||
|
],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
statusLabel() {
|
||||||
|
if (this.filters.audit_status === '' || this.filters.audit_status === null) return '';
|
||||||
|
return AUDIT_STATUS_MAP[Number(this.filters.audit_status)] || '';
|
||||||
|
},
|
||||||
|
processUnitLabel() {
|
||||||
|
return this.filters.process_name || '';
|
||||||
|
},
|
||||||
|
warehouseLabel() {
|
||||||
|
return this.filters.warehouse_name || '';
|
||||||
|
},
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
uni.setNavigationBarTitle({ title: '加工进仓列表' });
|
||||||
|
this.restoreFilterCache();
|
||||||
|
uni.getSystemInfo({
|
||||||
|
success: (res) => {
|
||||||
|
this.scrollHeight = `${res.windowHeight - 50}px`;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
this.loadList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
createDefaultFilters() {
|
||||||
|
return {
|
||||||
|
order_no: '',
|
||||||
|
process_unit_id: '',
|
||||||
|
process_name: '',
|
||||||
|
warehouse_id: '',
|
||||||
|
warehouse_name: '',
|
||||||
|
audit_status: AUDIT_STATUS.PENDING,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
loadProcessUnitOptions() {
|
||||||
|
if (this.processUnitOptions.length) return Promise.resolve(this.processUnitOptions);
|
||||||
|
return this.$u.api.businessUnit.list({ unit_type_id: BUSINESS_UNIT_TYPE_PROCESS })
|
||||||
|
.then((res) => {
|
||||||
|
this.processUnitOptions = mapToSelectOptions(res);
|
||||||
|
return this.processUnitOptions;
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.processUnitOptions = [];
|
||||||
|
return this.processUnitOptions;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
loadWarehouseOptions() {
|
||||||
|
if (this.warehouseOptions.length) return Promise.resolve(this.warehouseOptions);
|
||||||
|
return this.$u.api.physicalWarehouse.getDropdownList({ warehouse_type_id: WAREHOUSE_TYPE_FINISHED })
|
||||||
|
.then((res) => {
|
||||||
|
this.warehouseOptions = mapToSelectOptions(res);
|
||||||
|
return this.warehouseOptions;
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.warehouseOptions = [];
|
||||||
|
return this.warehouseOptions;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
openUnitSelect(type) {
|
||||||
|
this.unitSelectType = type;
|
||||||
|
const cache = type === 'warehouse' ? this.warehouseOptions : this.processUnitOptions;
|
||||||
|
this.applyUnitSelectList(cache);
|
||||||
|
this.unitSelectShow = true;
|
||||||
|
},
|
||||||
|
onUnitSearch(keyword) {
|
||||||
|
const seq = ++this.unitSearchSeq;
|
||||||
|
const type = this.unitSelectType;
|
||||||
|
const empty = !String(keyword || '').trim();
|
||||||
|
this.selectSearching = true;
|
||||||
|
const req = type === 'warehouse'
|
||||||
|
? this.$u.api.physicalWarehouse.getDropdownList(withNameParam({ warehouse_type_id: WAREHOUSE_TYPE_FINISHED }, keyword))
|
||||||
|
: this.$u.api.businessUnit.list(withNameParam({ unit_type_id: BUSINESS_UNIT_TYPE_PROCESS }, keyword));
|
||||||
|
req.then((res) => {
|
||||||
|
if (seq !== this.unitSearchSeq) return;
|
||||||
|
const list = mapToSelectOptions(res);
|
||||||
|
if (empty) {
|
||||||
|
if (type === 'warehouse') this.warehouseOptions = list;
|
||||||
|
else this.processUnitOptions = list;
|
||||||
|
}
|
||||||
|
this.applyUnitSelectList(list, empty);
|
||||||
|
}).catch((e) => {
|
||||||
|
if (seq !== this.unitSearchSeq) return;
|
||||||
|
uni.showToast({ title: (e && e.message) || '搜索失败', icon: 'none' });
|
||||||
|
}).then(() => {
|
||||||
|
if (seq === this.unitSearchSeq) this.selectSearching = false;
|
||||||
|
}, () => {
|
||||||
|
if (seq === this.unitSearchSeq) this.selectSearching = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
openProcessUnitSelect() {
|
||||||
|
this.openUnitSelect('process');
|
||||||
|
},
|
||||||
|
openWarehouseSelect() {
|
||||||
|
this.openUnitSelect('warehouse');
|
||||||
|
},
|
||||||
|
onUnitConfirm(e) {
|
||||||
|
const item = e[0] || {};
|
||||||
|
if (this.unitSelectType === 'warehouse') {
|
||||||
|
this.filters.warehouse_id = item.value;
|
||||||
|
this.filters.warehouse_name = item.value ? item.label : '';
|
||||||
|
} else {
|
||||||
|
this.filters.process_unit_id = item.value;
|
||||||
|
this.filters.process_name = item.value ? item.label : '';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
loadList() {
|
||||||
|
if (this.listLoading) return;
|
||||||
|
this.listLoading = true;
|
||||||
|
const filters = this.appliedFilters || this.filters;
|
||||||
|
const params = {};
|
||||||
|
if (filters.order_no) params.order_no = filters.order_no;
|
||||||
|
if (filters.process_unit_id) params.process_unit_id = filters.process_unit_id;
|
||||||
|
if (filters.warehouse_id) params.warehouse_id = filters.warehouse_id;
|
||||||
|
if (this.hasFilterValue(filters.audit_status)) {
|
||||||
|
params.audit_status = filters.audit_status;
|
||||||
|
}
|
||||||
|
fetchAllOrderList((p) => this.$u.api.fpmProcessInOrder.list(p), params)
|
||||||
|
.then((rows) => {
|
||||||
|
this.list = rows.map(this.mapToCard);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
this.list = [];
|
||||||
|
uni.showToast({ title: err.message || '加载失败', icon: 'none' });
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.listLoading = false;
|
||||||
|
this.triggered = false;
|
||||||
|
// 避免并发请求下 uView 全局 loading 遮罩关不掉
|
||||||
|
uni.hideLoading();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
mapToCard(order) {
|
||||||
|
return {
|
||||||
|
id: order.id,
|
||||||
|
order_no: order.order_no || '',
|
||||||
|
process_unit_id: order.process_unit_id || '',
|
||||||
|
process_name: order.process_name || '',
|
||||||
|
warehouse_id: order.warehouse_id || '',
|
||||||
|
warehouse_name: order.warehouse_name || '',
|
||||||
|
create_user_name: order.creator_name || '',
|
||||||
|
create_time: order.create_time || '',
|
||||||
|
auditor_name: order.auditor_name || '',
|
||||||
|
audit_date: order.audit_time || '',
|
||||||
|
audit_status: order.audit_status,
|
||||||
|
audit_status_name: order.audit_status_name || AUDIT_STATUS_MAP[order.audit_status] || '',
|
||||||
|
total_roll: formatRoll(order.total_roll),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
onRefresh() {
|
||||||
|
this.triggered = true;
|
||||||
|
this.loadList();
|
||||||
|
},
|
||||||
|
goView(item) {
|
||||||
|
const page = Number(item.audit_status) === 1
|
||||||
|
? 'storeGoodsProcessInEdit'
|
||||||
|
: 'storeGoodsProcessInView';
|
||||||
|
uni.navigateTo({ url: `./${page}?id=${item.id}` });
|
||||||
|
},
|
||||||
|
openStatusSelect() { this.statusSelectShow = true; },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
@import '@/common/list-filter.scss';
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,707 @@
|
|||||||
|
/**
|
||||||
|
* 加工进仓单表单 mixin(新增/编辑共用)
|
||||||
|
*
|
||||||
|
* 1. 先填表头(进仓类型 / 加工单位 / 仓库 / 营销体系 / 备注)提交 add,拿到 id 后可扫码
|
||||||
|
* 2. 先扫仓位(getWarehouseBin:传 qr_code + warehouse_id),校验后扫布匹二维码
|
||||||
|
* 3. 扫码走 updateFpmProcessInOrder(arrange_type: 1 录入 / 3 删除,带 warehouse_bin_id、纸筒/包装重量)
|
||||||
|
* 4. 手机扫码成功展示详情后自动再次调起扫码,形成连续扫
|
||||||
|
*/
|
||||||
|
import util from '@/common/util';
|
||||||
|
import scanMixin from '@/common/scanMixin.js';
|
||||||
|
import PlusBarcodePanel from '@/components/common/PlusBarcodePanel.vue';
|
||||||
|
import remoteSelectMixin from '@/common/remoteSelectMixin.js';
|
||||||
|
import { withNameParam } from '@/common/remoteSelect';
|
||||||
|
import { initTts, speak } from '@/common/tts.js';
|
||||||
|
import {
|
||||||
|
AUDIT_STATUS_MAP,
|
||||||
|
ARRANGE_TYPE,
|
||||||
|
BUSINESS_UNIT_TYPE_PROCESS,
|
||||||
|
WAREHOUSE_TYPE_FINISHED,
|
||||||
|
IN_ORDER_TYPE_PROCESS,
|
||||||
|
IN_ORDER_TYPE_MAP,
|
||||||
|
IN_ORDER_TYPE_OPTIONS,
|
||||||
|
DEFAULT_PAPER_TUBE_WEIGHT,
|
||||||
|
DEFAULT_PACKAGE_WEIGHT,
|
||||||
|
normalizeOrder,
|
||||||
|
mapToSelectOptions,
|
||||||
|
canScanAtStatus,
|
||||||
|
isLockedOrderStatus,
|
||||||
|
getFormStatusActionButtons,
|
||||||
|
orderToFormFields,
|
||||||
|
confirmOrderStatusAction,
|
||||||
|
DRAFT_AUDIT_STATUS,
|
||||||
|
DRAFT_AUDIT_STATUS_NAME,
|
||||||
|
getEmptyScanDetail,
|
||||||
|
buildScanDetailFromScanResponse,
|
||||||
|
buildScanUpdateParams,
|
||||||
|
pickDefaultWarehouse,
|
||||||
|
validateScanWeights,
|
||||||
|
} from '@/common/storeGoodsProcessIn';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: { PlusBarcodePanel },
|
||||||
|
mixins: [scanMixin, remoteSelectMixin],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
pageMode: 'add',
|
||||||
|
orderId: 0,
|
||||||
|
form: this.getEmptyForm(),
|
||||||
|
headerSaved: false,
|
||||||
|
headerCollapsed: false,
|
||||||
|
selectShow: false,
|
||||||
|
selectList: [],
|
||||||
|
selectType: '',
|
||||||
|
canScan: false,
|
||||||
|
QRBarCode: '',
|
||||||
|
BarCodeDelStatus: false,
|
||||||
|
BillDataMessage: '',
|
||||||
|
scanDetail: getEmptyScanDetail(),
|
||||||
|
auditStatus: 0,
|
||||||
|
processUnitOptions: [],
|
||||||
|
warehouseOptions: [],
|
||||||
|
saleSystemOptions: [],
|
||||||
|
inOrderTypeOptions: IN_ORDER_TYPE_OPTIONS,
|
||||||
|
dropdownLoading: false,
|
||||||
|
/** 仓位 */
|
||||||
|
warehouseBinId: 0,
|
||||||
|
warehouseBinCode: '',
|
||||||
|
warehouseBinName: '',
|
||||||
|
/** 手机连续扫码开关:成功后自动再调起;取消/失败则关闭 */
|
||||||
|
phoneContinuousScan: false,
|
||||||
|
/** 手机扫当前目标:bin | qr */
|
||||||
|
phoneScanTarget: 'bin',
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
isReadonly() {
|
||||||
|
return this.pageMode === 'view';
|
||||||
|
},
|
||||||
|
isEditable() {
|
||||||
|
return this.pageMode === 'add' || this.pageMode === 'edit';
|
||||||
|
},
|
||||||
|
headerEditable() {
|
||||||
|
return this.pageMode === 'add' && !this.headerSaved;
|
||||||
|
},
|
||||||
|
/** 纸筒/包装重量随扫码提交,保存前后及可扫编辑态均可改 */
|
||||||
|
canEditWeights() {
|
||||||
|
return this.isEditable && (this.headerEditable || this.canScan);
|
||||||
|
},
|
||||||
|
statusActionButtons() {
|
||||||
|
return getFormStatusActionButtons(this.headerSaved, this.orderId, this.auditStatus);
|
||||||
|
},
|
||||||
|
displayAuditStatus() {
|
||||||
|
if (this.pageMode === 'add' && !this.headerSaved) return DRAFT_AUDIT_STATUS;
|
||||||
|
return this.auditStatus;
|
||||||
|
},
|
||||||
|
displayAuditStatusName() {
|
||||||
|
if (this.pageMode === 'add' && !this.headerSaved) return DRAFT_AUDIT_STATUS_NAME;
|
||||||
|
return AUDIT_STATUS_MAP[this.auditStatus] || '';
|
||||||
|
},
|
||||||
|
/** 录入需先选仓位;删除模式仅需单据可扫 */
|
||||||
|
canScanQr() {
|
||||||
|
if (!this.canScan) return false;
|
||||||
|
if (this.BarCodeDelStatus) return true;
|
||||||
|
return !!this.warehouseBinId;
|
||||||
|
},
|
||||||
|
/** 扫码栏在可扫状态下始终展示(含删除勾选) */
|
||||||
|
showQrScanBar() {
|
||||||
|
return this.canScan;
|
||||||
|
},
|
||||||
|
qrDisabledTip() {
|
||||||
|
if (!this.canScan) return '请先提交保存后再扫码';
|
||||||
|
if (!this.warehouseBinId && !this.BarCodeDelStatus) return '请先扫描仓位后再扫布匹二维码';
|
||||||
|
return '当前状态不可扫码';
|
||||||
|
},
|
||||||
|
phoneScanHint() {
|
||||||
|
return this.phoneScanTarget === 'bin'
|
||||||
|
? '请扫描仓位,成功后自动扫布飞'
|
||||||
|
: '连续扫描布飞二维码,扫完可继续下一条';
|
||||||
|
},
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
this.isPageActive = true;
|
||||||
|
initTts();
|
||||||
|
if (this.canScan && this.isEditable) {
|
||||||
|
this.registerOrderScanBroadcast();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onHide() {
|
||||||
|
this.isPageActive = false;
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
this.unregisterScanBroadcast();
|
||||||
|
},
|
||||||
|
onUnload() {
|
||||||
|
this.isPageActive = false;
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
this.unregisterScanBroadcast();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
clearWarehouseBin() {
|
||||||
|
this.warehouseBinId = 0;
|
||||||
|
this.warehouseBinCode = '';
|
||||||
|
this.warehouseBinName = '';
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
this._phoneBinLocked = false;
|
||||||
|
this._pendingFabricCode = '';
|
||||||
|
if (this.phoneScanTarget === 'bin') this.closePhoneScanPanel();
|
||||||
|
},
|
||||||
|
/** 重扫仓位:先清空输入框再填入,避免残留旧码拼接 */
|
||||||
|
applyWarehouseBinScan(scanResult) {
|
||||||
|
const code = String(scanResult || '').trim().replace(/[\r\n]/g, '');
|
||||||
|
if (!code) return;
|
||||||
|
this.warehouseBinCode = '';
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.warehouseBinCode = code;
|
||||||
|
this.$nextTick(() => this.resolveWarehouseBin());
|
||||||
|
});
|
||||||
|
},
|
||||||
|
openHalfScreenScan(target) {
|
||||||
|
if (this.phoneScanPanelOpen && this.phoneScanTarget === target) {
|
||||||
|
this.closePhoneScanPanel();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
if (target === 'bin') this._phoneBinLocked = false;
|
||||||
|
this.phoneScanTarget = target;
|
||||||
|
this.phoneScanPanelOpen = true;
|
||||||
|
},
|
||||||
|
onPlusBarcodeSuccess(scanResult) {
|
||||||
|
const code = String(scanResult || '').trim().replace(/[\r\n]/g, '');
|
||||||
|
if (!code) return;
|
||||||
|
if (this.phoneScanTarget === 'bin') {
|
||||||
|
if (this._phoneBinLocked) {
|
||||||
|
if (!this.warehouseBinId) {
|
||||||
|
this._pendingFabricCode = code;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.phoneScanTarget = 'qr';
|
||||||
|
} else {
|
||||||
|
this._phoneBinLocked = true;
|
||||||
|
this._pendingFabricCode = '';
|
||||||
|
this.applyWarehouseBinScan(code);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.QRBarCode = code;
|
||||||
|
this.$nextTick(() => this.handleScan());
|
||||||
|
},
|
||||||
|
handleBinPhoneScan() {
|
||||||
|
if (!this.canScan || !this.orderId) {
|
||||||
|
this.showError('请先提交保存后再扫码');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.openHalfScreenScan('bin');
|
||||||
|
},
|
||||||
|
handlePhoneScan() {
|
||||||
|
if (!this.canScan || !this.orderId) {
|
||||||
|
this.showError('请先提交保存后再扫码');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 删除模式可直接扫布匹码;录入模式无仓位时先扫仓位
|
||||||
|
if (!this.BarCodeDelStatus && !this.warehouseBinId) {
|
||||||
|
this.handleBinPhoneScan();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.openHalfScreenScan('qr');
|
||||||
|
},
|
||||||
|
openContinuousPhoneScan() {
|
||||||
|
if (this.phoneScanPanelOpen) return;
|
||||||
|
if (!this.phoneContinuousScan || !this.canScanQr || !this.isPageActive) {
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.openPhoneScan({
|
||||||
|
callback: (scanResult) => {
|
||||||
|
this.QRBarCode = String(scanResult || '').trim().replace(/[\r\n]/g, '');
|
||||||
|
this.$nextTick(() => this.handleScan({ fromPhone: true }));
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
scheduleNextPhoneScan() {
|
||||||
|
if (this.phoneScanPanelOpen) return;
|
||||||
|
if (!this.phoneContinuousScan || !this.canScanQr || !this.isPageActive) {
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
this.openContinuousPhoneScan();
|
||||||
|
}, 400);
|
||||||
|
},
|
||||||
|
registerOrderScanBroadcast() {
|
||||||
|
this.registerScanBroadcast((scanResult) => {
|
||||||
|
const code = String(scanResult || '').trim().replace(/[\r\n]/g, '');
|
||||||
|
if (!code) return;
|
||||||
|
// 删除模式:直接按布匹码删除;未扫仓位时枪扫优先解析为仓位
|
||||||
|
if (!this.BarCodeDelStatus && !this.warehouseBinId) {
|
||||||
|
this.applyWarehouseBinScan(code);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.QRBarCode = code;
|
||||||
|
this.$nextTick(() => this.handleScan());
|
||||||
|
});
|
||||||
|
},
|
||||||
|
resolveWarehouseBin() {
|
||||||
|
const code = (this.warehouseBinCode || '').trim();
|
||||||
|
if (!this.canScan || !this.orderId) {
|
||||||
|
this.showError('请先提交保存后再扫码');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!code) return;
|
||||||
|
if (!this.form.warehouse_id) {
|
||||||
|
this.showError('单据缺少仓库信息');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uni.showLoading({ title: '识别仓位...' });
|
||||||
|
return this.$u.api.warehouseBin.getByQrCode({
|
||||||
|
qr_code: code,
|
||||||
|
warehouse_id: Number(this.form.warehouse_id),
|
||||||
|
})
|
||||||
|
.then((data) => {
|
||||||
|
uni.hideLoading();
|
||||||
|
if (!data || !data.id) {
|
||||||
|
throw new Error('未识别到仓位');
|
||||||
|
}
|
||||||
|
// 返回 physical_warehouse_id,与单据仓库校验
|
||||||
|
if (
|
||||||
|
data.physical_warehouse_id
|
||||||
|
&& String(data.physical_warehouse_id) !== String(this.form.warehouse_id)
|
||||||
|
) {
|
||||||
|
this.warehouseBinId = 0;
|
||||||
|
this.warehouseBinName = '';
|
||||||
|
throw new Error('该仓位不属于当前仓库');
|
||||||
|
}
|
||||||
|
this.warehouseBinId = data.id;
|
||||||
|
this.warehouseBinCode = data.code || data.qr_code || code;
|
||||||
|
this.warehouseBinName = data.name || '';
|
||||||
|
this.BillDataMessage = '';
|
||||||
|
speak('仓位成功');
|
||||||
|
uni.showToast({ title: '仓位识别成功', icon: 'success' });
|
||||||
|
if (this.phoneScanPanelOpen) this.phoneScanTarget = 'qr';
|
||||||
|
this._phoneBinLocked = false;
|
||||||
|
const pending = this._pendingFabricCode;
|
||||||
|
this._pendingFabricCode = '';
|
||||||
|
if (pending && this.phoneScanPanelOpen) {
|
||||||
|
this.QRBarCode = pending;
|
||||||
|
this.$nextTick(() => this.handleScan());
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
uni.hideLoading();
|
||||||
|
this._phoneBinLocked = false;
|
||||||
|
this._pendingFabricCode = '';
|
||||||
|
this.warehouseBinId = 0;
|
||||||
|
this.warehouseBinCode = '';
|
||||||
|
this.warehouseBinName = '';
|
||||||
|
this.showError(e.message || '仓位识别失败');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
syncCanScanFromStatus(status) {
|
||||||
|
const nextCanScan = this.isEditable && canScanAtStatus(status);
|
||||||
|
if (this.canScan && !nextCanScan) {
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
this.closePhoneScanPanel();
|
||||||
|
this.unregisterScanBroadcast();
|
||||||
|
}
|
||||||
|
this.canScan = nextCanScan;
|
||||||
|
},
|
||||||
|
loadBaseDropdowns() {
|
||||||
|
if (this.dropdownLoading) return Promise.resolve();
|
||||||
|
this.dropdownLoading = true;
|
||||||
|
if (this.headerEditable) this.applyDefaultSaleSystem();
|
||||||
|
return Promise.all([
|
||||||
|
this.ensureProcessUnitOptions().catch((e) => {
|
||||||
|
console.error('加载加工单位失败', e);
|
||||||
|
return [];
|
||||||
|
}),
|
||||||
|
this.ensureWarehouseOptions().catch((e) => {
|
||||||
|
console.error('加载仓库失败', e);
|
||||||
|
return [];
|
||||||
|
}),
|
||||||
|
this.ensureSaleSystemOptions().catch((e) => {
|
||||||
|
console.error('加载营销体系失败', e);
|
||||||
|
return [];
|
||||||
|
}),
|
||||||
|
]).finally(() => {
|
||||||
|
this.dropdownLoading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
ensureProcessUnitOptions() {
|
||||||
|
if (this.processUnitOptions.length) return Promise.resolve(this.processUnitOptions);
|
||||||
|
return this.$u.api.businessUnit.list({ unit_type_id: BUSINESS_UNIT_TYPE_PROCESS })
|
||||||
|
.then((res) => {
|
||||||
|
this.processUnitOptions = mapToSelectOptions(res);
|
||||||
|
return this.processUnitOptions;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
ensureWarehouseOptions() {
|
||||||
|
if (this.warehouseOptions.length) return Promise.resolve(this.warehouseOptions);
|
||||||
|
return this.$u.api.physicalWarehouse.getDropdownList({ warehouse_type_id: WAREHOUSE_TYPE_FINISHED })
|
||||||
|
.then((res) => {
|
||||||
|
this.warehouseOptions = mapToSelectOptions(res);
|
||||||
|
if (this.headerEditable && !this.form.warehouse_id) {
|
||||||
|
this.applyDefaultWarehouse();
|
||||||
|
}
|
||||||
|
return this.warehouseOptions;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
ensureSaleSystemOptions() {
|
||||||
|
if (this.saleSystemOptions.length) return Promise.resolve(this.saleSystemOptions);
|
||||||
|
return this.$u.api.saleSystem.getDropdownList()
|
||||||
|
.then((res) => {
|
||||||
|
this.saleSystemOptions = mapToSelectOptions(res);
|
||||||
|
if (this.headerEditable) this.applyDefaultSaleSystem();
|
||||||
|
return this.saleSystemOptions;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
fetchRemoteSelectOptions(type, keyword) {
|
||||||
|
const empty = !String(keyword || '').trim();
|
||||||
|
if (type === '加工单位') {
|
||||||
|
return this.$u.api.businessUnit.list(withNameParam({ unit_type_id: BUSINESS_UNIT_TYPE_PROCESS }, keyword))
|
||||||
|
.then((res) => {
|
||||||
|
const list = mapToSelectOptions(res);
|
||||||
|
if (empty) this.processUnitOptions = list;
|
||||||
|
return list;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (type === '仓库名称') {
|
||||||
|
return this.$u.api.physicalWarehouse.getDropdownList(withNameParam({ warehouse_type_id: WAREHOUSE_TYPE_FINISHED }, keyword))
|
||||||
|
.then((res) => {
|
||||||
|
const list = mapToSelectOptions(res);
|
||||||
|
if (empty) this.warehouseOptions = list;
|
||||||
|
return list;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (type === '营销体系') {
|
||||||
|
return this.$u.api.saleSystem.getDropdownList(withNameParam({}, keyword))
|
||||||
|
.then((res) => {
|
||||||
|
const list = mapToSelectOptions(res);
|
||||||
|
if (empty) this.saleSystemOptions = list;
|
||||||
|
return list;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return Promise.resolve([]);
|
||||||
|
},
|
||||||
|
applyDefaultWarehouse() {
|
||||||
|
const app = getApp();
|
||||||
|
const picked = pickDefaultWarehouse(
|
||||||
|
this.warehouseOptions,
|
||||||
|
app && app.globalData ? app.globalData.StoreNameID : '',
|
||||||
|
app && app.globalData ? app.globalData.StoreName : '',
|
||||||
|
);
|
||||||
|
if (!picked) return;
|
||||||
|
this.form.warehouse_id = picked.value;
|
||||||
|
this.form.warehouse_name = picked.label;
|
||||||
|
},
|
||||||
|
applyDefaultSaleSystem() {
|
||||||
|
if (this.form.sale_system_id) {
|
||||||
|
if (!this.form.sale_system_name && this.saleSystemOptions.length) {
|
||||||
|
const found = this.saleSystemOptions.find(
|
||||||
|
(item) => String(item.value) === String(this.form.sale_system_id),
|
||||||
|
);
|
||||||
|
if (found) this.form.sale_system_name = found.label;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const app = getApp();
|
||||||
|
const gd = app && app.globalData ? app.globalData : {};
|
||||||
|
const id = gd.PlanDepartmentID;
|
||||||
|
if (!id) return;
|
||||||
|
this.form.sale_system_id = id;
|
||||||
|
this.form.sale_system_name = gd.PlanDepartmentName || '';
|
||||||
|
if (!this.form.sale_system_name && this.saleSystemOptions.length) {
|
||||||
|
const found = this.saleSystemOptions.find((item) => String(item.value) === String(id));
|
||||||
|
if (found) this.form.sale_system_name = found.label;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getEmptyForm() {
|
||||||
|
const app = getApp();
|
||||||
|
const gd = app && app.globalData ? app.globalData : {};
|
||||||
|
return {
|
||||||
|
order_no: '',
|
||||||
|
process_unit_id: '',
|
||||||
|
process_name: '',
|
||||||
|
warehouse_id: '',
|
||||||
|
warehouse_name: '',
|
||||||
|
sale_system_id: gd.PlanDepartmentID || '',
|
||||||
|
sale_system_name: gd.PlanDepartmentName || '',
|
||||||
|
in_order_type: IN_ORDER_TYPE_PROCESS,
|
||||||
|
in_order_type_name: IN_ORDER_TYPE_MAP[IN_ORDER_TYPE_PROCESS],
|
||||||
|
paper_tube_weight: String(DEFAULT_PAPER_TUBE_WEIGHT),
|
||||||
|
package_weight: String(DEFAULT_PACKAGE_WEIGHT),
|
||||||
|
remark: '',
|
||||||
|
item_data: [],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
loadOrder(id, options = {}) {
|
||||||
|
const { rejectIfLocked = false } = options;
|
||||||
|
return this.$u.api.fpmProcessInOrder.detail({ id })
|
||||||
|
.then((res) => {
|
||||||
|
const order = normalizeOrder(res);
|
||||||
|
if (!order) {
|
||||||
|
this.showError('单据不存在');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (rejectIfLocked && isLockedOrderStatus(order.audit_status)) {
|
||||||
|
this.showError('当前状态不可编辑');
|
||||||
|
setTimeout(() => uni.navigateBack(), 1500);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
this.orderId = order.id;
|
||||||
|
this.auditStatus = order.audit_status;
|
||||||
|
this.headerSaved = true;
|
||||||
|
this.headerCollapsed = true;
|
||||||
|
this.form = orderToFormFields(order);
|
||||||
|
this.clearWarehouseBin();
|
||||||
|
this.syncCanScanFromStatus(order.audit_status);
|
||||||
|
if (this.canScan) this.registerOrderScanBroadcast();
|
||||||
|
return order;
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
this.showError(e.message || '加载单据失败');
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
pickerSelectFun(type) {
|
||||||
|
if (!this.headerEditable) return;
|
||||||
|
if (type === '进仓类型') {
|
||||||
|
this.selectType = type;
|
||||||
|
if (!this.inOrderTypeOptions.length) {
|
||||||
|
this.showError('暂无可选数据');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.selectList = this.inOrderTypeOptions;
|
||||||
|
this.selectShow = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const cache = {
|
||||||
|
'加工单位': this.processUnitOptions,
|
||||||
|
'仓库名称': this.warehouseOptions,
|
||||||
|
'营销体系': this.saleSystemOptions,
|
||||||
|
};
|
||||||
|
if (cache[type]) this.openSelectPicker(type, cache[type]);
|
||||||
|
},
|
||||||
|
selectConfirmFun(e) {
|
||||||
|
const item = e[0];
|
||||||
|
if (this.selectType === '进仓类型') {
|
||||||
|
this.form.in_order_type = item.value;
|
||||||
|
this.form.in_order_type_name = item.label;
|
||||||
|
} else if (this.selectType === '加工单位') {
|
||||||
|
this.form.process_unit_id = item.value;
|
||||||
|
this.form.process_name = item.label;
|
||||||
|
} else if (this.selectType === '仓库名称') {
|
||||||
|
this.form.warehouse_id = item.value;
|
||||||
|
this.form.warehouse_name = item.label;
|
||||||
|
} else if (this.selectType === '营销体系') {
|
||||||
|
this.form.sale_system_id = item.value;
|
||||||
|
this.form.sale_system_name = item.label;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
validateForm() {
|
||||||
|
if (!this.form.in_order_type) return '请选择进仓类型';
|
||||||
|
if (!this.form.process_unit_id) return '请选择加工单位';
|
||||||
|
if (!this.form.warehouse_id) return '请选择仓库名称';
|
||||||
|
if (!this.form.sale_system_id) return '请选择营销体系';
|
||||||
|
return '';
|
||||||
|
},
|
||||||
|
buildAddParam() {
|
||||||
|
return {
|
||||||
|
inOrderType: Number(this.form.in_order_type),
|
||||||
|
process_unit_id: Number(this.form.process_unit_id),
|
||||||
|
warehouse_id: Number(this.form.warehouse_id),
|
||||||
|
sale_system_id: Number(this.form.sale_system_id),
|
||||||
|
remark: this.form.remark || '',
|
||||||
|
item_data: [],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
submitSave() {
|
||||||
|
if (this.headerSaved) {
|
||||||
|
this.showError('表头已保存,请直接扫码');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const err = this.validateForm();
|
||||||
|
if (err) {
|
||||||
|
this.showError(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uni.showLoading({ title: '保存中...' });
|
||||||
|
this.$u.api.fpmProcessInOrder.add(this.buildAddParam())
|
||||||
|
.then((res) => {
|
||||||
|
this.orderId = (res && res.id) || 0;
|
||||||
|
if (!this.orderId) {
|
||||||
|
throw new Error('保存失败,未返回单据ID');
|
||||||
|
}
|
||||||
|
return this.$u.api.fpmProcessInOrder.detail({ id: this.orderId });
|
||||||
|
})
|
||||||
|
.then((detail) => {
|
||||||
|
uni.hideLoading();
|
||||||
|
const order = normalizeOrder(detail);
|
||||||
|
this.applyOrder(order, { keepWeights: true });
|
||||||
|
this.headerSaved = true;
|
||||||
|
this.headerCollapsed = true;
|
||||||
|
this.clearWarehouseBin();
|
||||||
|
this.syncCanScanFromStatus(order.audit_status);
|
||||||
|
this.showSuccess('保存成功,请先扫描仓位', '保存成功', { voiceOnly: true });
|
||||||
|
this.registerOrderScanBroadcast();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
uni.hideLoading();
|
||||||
|
this.showError(e.message || '保存失败');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
applyOrder(order, options = {}) {
|
||||||
|
if (!order) return;
|
||||||
|
this.auditStatus = order.audit_status;
|
||||||
|
const paperTubeWeight = this.form.paper_tube_weight;
|
||||||
|
const packageWeight = this.form.package_weight;
|
||||||
|
Object.assign(this.form, orderToFormFields(order));
|
||||||
|
if (options.keepWeights) {
|
||||||
|
this.form.paper_tube_weight = paperTubeWeight;
|
||||||
|
this.form.package_weight = packageWeight;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleScan(options = {}) {
|
||||||
|
const fromPhone = !!options.fromPhone;
|
||||||
|
const code = (this.QRBarCode || '').trim();
|
||||||
|
if (!this.canScan || !this.orderId) {
|
||||||
|
this.showError('请先提交保存后再扫码');
|
||||||
|
this.QRBarCode = '';
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const isDelete = this.BarCodeDelStatus;
|
||||||
|
if (!isDelete && !this.warehouseBinId) {
|
||||||
|
this.showError('请先扫描仓位');
|
||||||
|
this.QRBarCode = '';
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!code) {
|
||||||
|
this.QRBarCode = '';
|
||||||
|
if (fromPhone) this.scheduleNextPhoneScan();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const arrangeType = isDelete ? ARRANGE_TYPE.DEL : ARRANGE_TYPE.IN;
|
||||||
|
this.doScanUpdate(code, arrangeType, { fromPhone });
|
||||||
|
},
|
||||||
|
BarCodeDelChange(e) {
|
||||||
|
this.BarCodeDelStatus = (e.detail.value || []).length > 0;
|
||||||
|
this.BillDataMessage = this.BarCodeDelStatus ? '删除模式:扫描细码即可删除' : '';
|
||||||
|
},
|
||||||
|
getFineCodeScanCode(fineCode) {
|
||||||
|
if (!fineCode) return '';
|
||||||
|
return fineCode.qr_code
|
||||||
|
|| fineCode.long_code
|
||||||
|
|| fineCode.scan_code
|
||||||
|
|| fineCode.digital_code
|
||||||
|
|| fineCode.bar_code
|
||||||
|
|| fineCode.short_code
|
||||||
|
|| '';
|
||||||
|
},
|
||||||
|
onDeleteFineCode(fineCode) {
|
||||||
|
if (!this.canScan || !this.orderId) {
|
||||||
|
this.showError('当前状态不可删除');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const scanCode = this.getFineCodeScanCode(fineCode);
|
||||||
|
if (!scanCode) {
|
||||||
|
this.showError('该细码缺少条码,无法删除');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: `确认删除细码 ${scanCode}?`,
|
||||||
|
success: (res) => {
|
||||||
|
if (!res.confirm) return;
|
||||||
|
this.doScanUpdate(scanCode, ARRANGE_TYPE.DEL);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
doScanUpdate(scanCode, arrangeType, options = {}) {
|
||||||
|
const { fromPhone = false } = options;
|
||||||
|
const isDelete = arrangeType === ARRANGE_TYPE.DEL;
|
||||||
|
if (!isDelete) {
|
||||||
|
const weightErr = validateScanWeights(this.form.paper_tube_weight, this.form.package_weight);
|
||||||
|
if (weightErr) {
|
||||||
|
this.showError(weightErr);
|
||||||
|
this.QRBarCode = '';
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
uni.showLoading({ title: isDelete ? '删除中...' : '处理中...' });
|
||||||
|
return this.$u.api.fpmProcessInOrder.scanUpdate(buildScanUpdateParams({
|
||||||
|
id: this.orderId,
|
||||||
|
scanCode,
|
||||||
|
arrangeType,
|
||||||
|
// 删除不强制仓位;录入带当前仓位
|
||||||
|
warehouseBinId: isDelete ? 0 : this.warehouseBinId,
|
||||||
|
paperTubeWeight: this.form.paper_tube_weight,
|
||||||
|
packageWeight: this.form.package_weight,
|
||||||
|
}))
|
||||||
|
.then((scanRes) => {
|
||||||
|
this.scanDetail = buildScanDetailFromScanResponse(scanRes);
|
||||||
|
this.BillDataMessage = isDelete ? '删除成功' : '扫描成功';
|
||||||
|
this.QRBarCode = '';
|
||||||
|
if (isDelete) {
|
||||||
|
speak('已删除');
|
||||||
|
uni.showToast({ title: '删除成功', icon: 'success' });
|
||||||
|
} else {
|
||||||
|
speak('成功');
|
||||||
|
}
|
||||||
|
return this.$u.api.fpmProcessInOrder.detail({ id: this.orderId })
|
||||||
|
.then((detail) => {
|
||||||
|
const order = normalizeOrder(detail);
|
||||||
|
if (order) {
|
||||||
|
this.form.item_data = order.item_data;
|
||||||
|
this.auditStatus = order.audit_status;
|
||||||
|
// 本单匹数/本单数量:取这张单的总匹数、总数量
|
||||||
|
this.scanDetail = {
|
||||||
|
...this.scanDetail,
|
||||||
|
order_roll: order.total_roll,
|
||||||
|
order_weight: order.total_weight,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => null);
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
uni.hideLoading();
|
||||||
|
if (fromPhone) this.scheduleNextPhoneScan();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
uni.hideLoading();
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
const message = e.message || (isDelete ? '删除失败' : '扫码失败');
|
||||||
|
speak(isDelete ? '删除失败' : '扫码失败');
|
||||||
|
uni.showToast({ title: message, icon: 'none', duration: 2500 });
|
||||||
|
this.QRBarCode = '';
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleStatusAction(action) {
|
||||||
|
confirmOrderStatusAction(this, {
|
||||||
|
orderId: this.orderId,
|
||||||
|
action,
|
||||||
|
onSuccess: () => this.$u.api.fpmProcessInOrder.detail({ id: this.orderId })
|
||||||
|
.then((detail) => {
|
||||||
|
uni.hideLoading();
|
||||||
|
const order = normalizeOrder(detail);
|
||||||
|
if (!order) return;
|
||||||
|
this.applyOrder(order);
|
||||||
|
this.syncCanScanFromStatus(order.audit_status);
|
||||||
|
this.showSuccess(util.statusSuccessVoice(action));
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
},
|
||||||
|
showError(message) {
|
||||||
|
util.playErrorAudio(message);
|
||||||
|
uni.showModal({ title: '提示', content: message, showCancel: false });
|
||||||
|
},
|
||||||
|
showSuccess(message, voiceText, options) {
|
||||||
|
util.playSuccessAudio(voiceText || message, options);
|
||||||
|
uni.showToast({ title: message, icon: 'success' });
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -0,0 +1,159 @@
|
|||||||
|
<template>
|
||||||
|
<view class="fabric-out-page">
|
||||||
|
<OrderHeaderFold v-model="headerCollapsed" :summary="order.order_no">
|
||||||
|
<OrderStatusBar class="fabric-out-mt32" :status="order.audit_status" :name="order.audit_status_name" />
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">进仓类型</text>
|
||||||
|
<text>{{ order.in_order_type_name || '加工进仓单' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">加工单位</text>
|
||||||
|
<text>{{ order.process_name || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">仓库名称</text>
|
||||||
|
<text>{{ order.warehouse_name || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5 process-in-weight-row">
|
||||||
|
<view class="process-in-weight-col">
|
||||||
|
<text class="mr16">纸筒重量</text>
|
||||||
|
<text>{{ order.paper_tube_weight != null ? order.paper_tube_weight : '-' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="process-in-weight-col">
|
||||||
|
<text class="mr16">包装重量</text>
|
||||||
|
<text>{{ order.package_weight != null ? order.package_weight : '-' }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">营销体系</text>
|
||||||
|
<text>{{ order.sale_system_name || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">单据备注</text>
|
||||||
|
<text>{{ order.remark || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">创建人</text>
|
||||||
|
<text>{{ order.creator_name }} {{ formatTime(order.create_time, 'YYYY-MM-DD') }}</text>
|
||||||
|
</view>
|
||||||
|
<view v-if="order.auditor_name" class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">审核人</text>
|
||||||
|
<text>{{ order.auditor_name }} {{ formatTime(order.audit_time, 'YYYY-MM-DD') }}</text>
|
||||||
|
</view>
|
||||||
|
</OrderHeaderFold>
|
||||||
|
|
||||||
|
<ProcessInDetailList
|
||||||
|
:title="detailTitle"
|
||||||
|
:list="order.item_data"
|
||||||
|
show-tare-columns
|
||||||
|
/>
|
||||||
|
|
||||||
|
<FabricOutFooter :buttons="actionButtons" @action="handleAction" />
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import util from '@/common/util';
|
||||||
|
import OrderStatusBar from '@/components/storefabric/OrderStatusBar.vue';
|
||||||
|
import OrderHeaderFold from '@/components/storefabric/OrderHeaderFold.vue';
|
||||||
|
import FabricOutFooter from '@/components/storefabric/FabricOutFooter.vue';
|
||||||
|
import ProcessInDetailList from '@/components/storegoods/ProcessInDetailList.vue';
|
||||||
|
import {
|
||||||
|
normalizeOrder,
|
||||||
|
getViewStatusActionButtons,
|
||||||
|
confirmOrderStatusAction,
|
||||||
|
formatDisplayTime,
|
||||||
|
} from '@/common/storeGoodsProcessIn';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: { OrderStatusBar, OrderHeaderFold, FabricOutFooter, ProcessInDetailList },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
orderId: 0,
|
||||||
|
headerCollapsed: true,
|
||||||
|
order: { item_data: [] },
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
actionButtons() {
|
||||||
|
return getViewStatusActionButtons(this.order.audit_status);
|
||||||
|
},
|
||||||
|
detailTitle() {
|
||||||
|
return `进仓明细(共 ${this.order.total_roll || 0} 匹)`;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
onLoad(e) {
|
||||||
|
uni.setNavigationBarTitle({ title: '查看加工进仓单' });
|
||||||
|
if (e.id) {
|
||||||
|
this.orderId = Number(e.id);
|
||||||
|
this.refreshOrder();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
if (this.orderId) this.refreshOrder();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
formatTime: formatDisplayTime,
|
||||||
|
refreshOrder() {
|
||||||
|
this.$u.api.fpmProcessInOrder.detail({ id: this.orderId })
|
||||||
|
.then((res) => {
|
||||||
|
const order = normalizeOrder(res);
|
||||||
|
if (!order) {
|
||||||
|
this.showError('单据不存在');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.order = order;
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
this.showError(err.message || '加载单据失败');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleAction(action) {
|
||||||
|
if (action === 'edit') {
|
||||||
|
uni.navigateTo({ url: `./storeGoodsProcessInEdit?id=${this.orderId}` });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
confirmOrderStatusAction(this, {
|
||||||
|
orderId: this.orderId,
|
||||||
|
action,
|
||||||
|
onSuccess: () => {
|
||||||
|
uni.hideLoading();
|
||||||
|
const voice = util.statusSuccessVoice(action);
|
||||||
|
util.playSuccessAudio(voice);
|
||||||
|
uni.showToast({ title: voice, icon: 'success' });
|
||||||
|
if (action === 'unapprove') {
|
||||||
|
uni.redirectTo({ url: `./storeGoodsProcessInEdit?id=${this.orderId}` });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return this.$u.api.fpmProcessInOrder.detail({ id: this.orderId })
|
||||||
|
.then((res) => {
|
||||||
|
const order = normalizeOrder(res);
|
||||||
|
if (order) this.order = order;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
showError(message) {
|
||||||
|
util.playErrorAudio(message);
|
||||||
|
uni.showModal({ title: '提示', content: message, showCancel: false });
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
@import '@/pages/storefabric/storeFabricBusinessOutPage.scss';
|
||||||
|
page {
|
||||||
|
background-color: #F8F8F8;
|
||||||
|
padding-bottom: 260rpx;
|
||||||
|
}
|
||||||
|
.process-in-weight-row {
|
||||||
|
gap: 20rpx;
|
||||||
|
}
|
||||||
|
.process-in-weight-col {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,110 @@
|
|||||||
|
<template>
|
||||||
|
<view class="fabric-out-page">
|
||||||
|
<OrderHeaderFold v-model="headerCollapsed" :summary="form.order_no || '保存后自动生成'">
|
||||||
|
<OrderStatusBar class="fabric-out-mt32" :status="displayAuditStatus" :name="displayAuditStatusName" />
|
||||||
|
<view @click="pickerSelectFun('出仓类型')" class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">出仓类型<text class="redXingh">*</text></text>
|
||||||
|
<view :class="form.out_order_type_name ? '' : 'cBlack'">
|
||||||
|
{{ form.out_order_type_name || '请选择' }}
|
||||||
|
<u-icon v-if="headerEditable" class="ml26" name="arrow-right" size="40" color="#888888"></u-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view @click="pickerSelectFun('加工单位')" class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">加工单位<text class="redXingh">*</text></text>
|
||||||
|
<view :class="form.process_name ? '' : 'cBlack'">
|
||||||
|
{{ form.process_name || '请选择' }}
|
||||||
|
<u-icon v-if="headerEditable" class="ml26" name="arrow-right" size="40" color="#888888"></u-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view @click="pickerSelectFun('仓库名称')" class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">仓库名称<text class="redXingh">*</text></text>
|
||||||
|
<view :class="form.warehouse_name ? '' : 'cBlack'">
|
||||||
|
{{ form.warehouse_name || '请选择' }}
|
||||||
|
<u-icon v-if="headerEditable" class="ml26" name="arrow-right" size="40" color="#888888"></u-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26-column ptb20 mt32">
|
||||||
|
<view style="margin-bottom: 8rpx;"><text>单据备注</text></view>
|
||||||
|
<u-input v-model="form.remark" :disabled="!headerEditable" type="textarea" :border="true" :height="100" :auto-height="true" />
|
||||||
|
</view>
|
||||||
|
</OrderHeaderFold>
|
||||||
|
|
||||||
|
<PlusBarcodePanel
|
||||||
|
:visible.sync="phoneScanPanelOpen"
|
||||||
|
hint-text="连续扫码出仓,扫完可继续下一条"
|
||||||
|
:scan-time-space="1200"
|
||||||
|
@success="onPlusBarcodeSuccess"
|
||||||
|
/>
|
||||||
|
<FabricOutScanBar
|
||||||
|
:can-scan="showQrScanBar"
|
||||||
|
:value="QRBarCode"
|
||||||
|
:delete-mode="BarCodeDelStatus"
|
||||||
|
:message="BillDataMessage"
|
||||||
|
:disabled-tip="qrDisabledTip"
|
||||||
|
:show-phone-scan="canScanQr"
|
||||||
|
:scanning="phoneScanPanelOpen"
|
||||||
|
@input="QRBarCode = $event"
|
||||||
|
@scan="handleScan"
|
||||||
|
@phone-scan="handlePhoneScan"
|
||||||
|
@delete-mode-change="BarCodeDelChange"
|
||||||
|
/>
|
||||||
|
<ProcessOutScanDetail :detail="scanDetail" />
|
||||||
|
|
||||||
|
<ProcessOutDetailList
|
||||||
|
:list="form.item_data"
|
||||||
|
:deletable="canScan"
|
||||||
|
@delete="onDeleteFineCode"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<FabricOutFooter
|
||||||
|
v-if="!headerSaved"
|
||||||
|
:buttons="[{ label: '提交保存', action: 'save' }]"
|
||||||
|
single
|
||||||
|
@action="submitSave"
|
||||||
|
/>
|
||||||
|
<FabricOutFooter
|
||||||
|
v-else
|
||||||
|
:buttons="statusActionButtons"
|
||||||
|
@action="handleStatusAction"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<u-select v-model="selectShow" :list="selectList" :remote="isRemoteSelect" :loading="selectSearching" @search="onSelectSearch" @confirm="selectConfirmFun"></u-select>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import formMixin from './storeGoodsProcessOutMixin.js';
|
||||||
|
import OrderStatusBar from '@/components/storefabric/OrderStatusBar.vue';
|
||||||
|
import OrderHeaderFold from '@/components/storefabric/OrderHeaderFold.vue';
|
||||||
|
import FabricOutScanBar from '@/components/storefabric/FabricOutScanBar.vue';
|
||||||
|
import FabricOutFooter from '@/components/storefabric/FabricOutFooter.vue';
|
||||||
|
import ProcessOutScanDetail from '@/components/storegoods/ProcessOutScanDetail.vue';
|
||||||
|
import ProcessOutDetailList from '@/components/storegoods/ProcessOutDetailList.vue';
|
||||||
|
import PlusBarcodePanel from '@/components/common/PlusBarcodePanel.vue';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
PlusBarcodePanel,
|
||||||
|
OrderStatusBar,
|
||||||
|
OrderHeaderFold,
|
||||||
|
FabricOutScanBar,
|
||||||
|
FabricOutFooter,
|
||||||
|
ProcessOutScanDetail,
|
||||||
|
ProcessOutDetailList,
|
||||||
|
},
|
||||||
|
mixins: [formMixin],
|
||||||
|
onLoad() {
|
||||||
|
uni.setNavigationBarTitle({ title: '新增加工出仓单' });
|
||||||
|
this.pageMode = 'add';
|
||||||
|
this.loadBaseDropdowns();
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
@import '@/pages/storefabric/storeFabricBusinessOutPage.scss';
|
||||||
|
page {
|
||||||
|
background-color: #F8F8F8;
|
||||||
|
padding-bottom: 260rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
<template>
|
||||||
|
<view class="fabric-out-page">
|
||||||
|
<OrderHeaderFold v-model="headerCollapsed" :summary="form.order_no">
|
||||||
|
<OrderStatusBar class="fabric-out-mt32" :status="displayAuditStatus" :name="displayAuditStatusName" />
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">出仓类型</text>
|
||||||
|
<text>{{ form.out_order_type_name || '正常加工出仓' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">加工单位</text>
|
||||||
|
<text>{{ form.process_name || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">仓库名称</text>
|
||||||
|
<text>{{ form.warehouse_name || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">单据备注</text>
|
||||||
|
<text>{{ form.remark || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
</OrderHeaderFold>
|
||||||
|
|
||||||
|
<PlusBarcodePanel
|
||||||
|
:visible.sync="phoneScanPanelOpen"
|
||||||
|
hint-text="连续扫码出仓,扫完可继续下一条"
|
||||||
|
:scan-time-space="1200"
|
||||||
|
@success="onPlusBarcodeSuccess"
|
||||||
|
/>
|
||||||
|
<FabricOutScanBar
|
||||||
|
:can-scan="showQrScanBar"
|
||||||
|
:value="QRBarCode"
|
||||||
|
:delete-mode="BarCodeDelStatus"
|
||||||
|
:message="BillDataMessage"
|
||||||
|
:disabled-tip="qrDisabledTip"
|
||||||
|
:show-phone-scan="canScanQr"
|
||||||
|
:scanning="phoneScanPanelOpen"
|
||||||
|
@input="QRBarCode = $event"
|
||||||
|
@scan="handleScan"
|
||||||
|
@phone-scan="handlePhoneScan"
|
||||||
|
@delete-mode-change="BarCodeDelChange"
|
||||||
|
/>
|
||||||
|
<ProcessOutScanDetail :detail="scanDetail" />
|
||||||
|
|
||||||
|
<ProcessOutDetailList
|
||||||
|
:list="form.item_data"
|
||||||
|
:deletable="canScan"
|
||||||
|
@delete="onDeleteFineCode"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<FabricOutFooter :buttons="statusActionButtons" @action="handleStatusAction" />
|
||||||
|
|
||||||
|
<u-select v-model="selectShow" :list="selectList" :remote="isRemoteSelect" :loading="selectSearching" @search="onSelectSearch" @confirm="selectConfirmFun"></u-select>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import formMixin from './storeGoodsProcessOutMixin.js';
|
||||||
|
import OrderStatusBar from '@/components/storefabric/OrderStatusBar.vue';
|
||||||
|
import OrderHeaderFold from '@/components/storefabric/OrderHeaderFold.vue';
|
||||||
|
import FabricOutScanBar from '@/components/storefabric/FabricOutScanBar.vue';
|
||||||
|
import FabricOutFooter from '@/components/storefabric/FabricOutFooter.vue';
|
||||||
|
import ProcessOutScanDetail from '@/components/storegoods/ProcessOutScanDetail.vue';
|
||||||
|
import ProcessOutDetailList from '@/components/storegoods/ProcessOutDetailList.vue';
|
||||||
|
import PlusBarcodePanel from '@/components/common/PlusBarcodePanel.vue';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
PlusBarcodePanel,
|
||||||
|
OrderStatusBar,
|
||||||
|
OrderHeaderFold,
|
||||||
|
FabricOutScanBar,
|
||||||
|
FabricOutFooter,
|
||||||
|
ProcessOutScanDetail,
|
||||||
|
ProcessOutDetailList,
|
||||||
|
},
|
||||||
|
mixins: [formMixin],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
headerCollapsed: true,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
onLoad(e) {
|
||||||
|
uni.setNavigationBarTitle({ title: '编辑加工出仓单' });
|
||||||
|
this.pageMode = 'edit';
|
||||||
|
if (e.id) {
|
||||||
|
this.loadOrder(Number(e.id), { rejectIfLocked: true });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
@import '@/pages/storefabric/storeFabricBusinessOutPage.scss';
|
||||||
|
page {
|
||||||
|
background-color: #F8F8F8;
|
||||||
|
padding-bottom: 260rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,277 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<view class="filterBar">
|
||||||
|
<u-search v-model="filters.order_no" placeholder="出仓单号" :show-action="false" @search="applySearch" @custom="applySearch" @clear="applySearch" />
|
||||||
|
<view class="filterBtn" :class="{ 'filter-active': hasActiveFilter }" @click="filterShow = true">
|
||||||
|
<view class="filterBtn__icon">
|
||||||
|
<u-icon :key="filterIconColor" name="list" size="44" :color="filterIconColor"></u-icon>
|
||||||
|
<view v-if="hasActiveFilter" class="filterBtn__badge"></view>
|
||||||
|
</view>
|
||||||
|
<text>筛选</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<scroll-view scroll-y :style="{ height: scrollHeight }" refresher-enabled
|
||||||
|
:refresher-triggered="triggered" @refresherrefresh="onRefresh">
|
||||||
|
<dataNull v-if="list.length === 0" src="/src/static/img/chahua/gjNull.png"
|
||||||
|
title="暂无加工出仓单" title1="请点击右下角按钮新增">
|
||||||
|
</dataNull>
|
||||||
|
<view v-for="(item, index) in list" :key="item.id" @click="goView(item)">
|
||||||
|
<ProcessOutItem :item="item" :index="index" />
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
|
||||||
|
<addBtn url="./storeGoodsProcessOutAdd"></addBtn>
|
||||||
|
|
||||||
|
<u-popup v-model="filterShow" mode="right" width="580rpx" :safe-area-inset-bottom="true" @close="cancelFilterEdit">
|
||||||
|
<view class="filterPanel">
|
||||||
|
<view class="filterTitle">筛选条件</view>
|
||||||
|
<view class="filterItem">
|
||||||
|
<text class="filterLabel">出仓单号</text>
|
||||||
|
<view class="filterInput">
|
||||||
|
<u-input v-model="filters.order_no" placeholder="请输入出仓单号" :height="100" :custom-style="{ fontSize: '36rpx', color: '#202328' }" placeholder-style="color: #aeb4bf; font-size: 34rpx;" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="filterItem" @click="openProcessUnitSelect">
|
||||||
|
<text class="filterLabel">加工单位</text>
|
||||||
|
<view class="filterValue">{{ processUnitLabel || '全部' }} <u-icon name="arrow-right" size="36"></u-icon></view>
|
||||||
|
</view>
|
||||||
|
<view class="filterItem" @click="openWarehouseSelect">
|
||||||
|
<text class="filterLabel">仓库</text>
|
||||||
|
<view class="filterValue">{{ warehouseLabel || '全部' }} <u-icon name="arrow-right" size="36"></u-icon></view>
|
||||||
|
</view>
|
||||||
|
<view class="filterItem" @click="openStatusSelect">
|
||||||
|
<text class="filterLabel">订单状态</text>
|
||||||
|
<view class="filterValue">{{ statusLabel || '全部' }} <u-icon name="arrow-right" size="36"></u-icon></view>
|
||||||
|
</view>
|
||||||
|
<view class="filterActions">
|
||||||
|
<u-button type="warning" size="medium" @click="resetFilter">重置</u-button>
|
||||||
|
<u-button type="primary" size="medium" @click="applyFilter">确定</u-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
|
|
||||||
|
<u-select class="pdaSelect" v-model="statusSelectShow" title="选择订单状态" :list="statusSelectList" :default-value="statusSelectDefault" @confirm="onStatusConfirm"></u-select>
|
||||||
|
<u-select class="pdaSelect" v-model="unitSelectShow" :list="unitSelectList" :default-value="unitSelectDefault" remote :loading="selectSearching" @search="onUnitSearch" @confirm="onUnitConfirm"></u-select>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import addBtn from '@/components/addBtn/addBtn.vue';
|
||||||
|
import ProcessOutItem from '@/components/card/storeGoodsProcessOutItem.vue';
|
||||||
|
import {
|
||||||
|
getStatusOptions,
|
||||||
|
AUDIT_STATUS,
|
||||||
|
AUDIT_STATUS_MAP,
|
||||||
|
BUSINESS_UNIT_TYPE_PROCESS,
|
||||||
|
WAREHOUSE_TYPE_FINISHED,
|
||||||
|
formatRoll,
|
||||||
|
mapToSelectOptions,
|
||||||
|
fetchAllOrderList,
|
||||||
|
} from '@/common/storeGoodsProcessOut';
|
||||||
|
import { withNameParam } from '@/common/remoteSelect';
|
||||||
|
import listFilterMixin from '@/mixins/listFilterMixin';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: { addBtn, ProcessOutItem },
|
||||||
|
mixins: [listFilterMixin],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
list: [],
|
||||||
|
scrollHeight: '667px',
|
||||||
|
triggered: false,
|
||||||
|
listLoading: false,
|
||||||
|
filterShow: false,
|
||||||
|
statusSelectShow: false,
|
||||||
|
unitSelectShow: false,
|
||||||
|
unitSelectType: '',
|
||||||
|
processUnitOptions: [],
|
||||||
|
warehouseOptions: [],
|
||||||
|
unitOptionsLoading: false,
|
||||||
|
selectSearching: false,
|
||||||
|
unitSearchSeq: 0,
|
||||||
|
unitSelectList: [{ value: '', label: '全部' }],
|
||||||
|
filterStorageKey: 'storeGoodsProcessOutListFilters_v2',
|
||||||
|
filters: {
|
||||||
|
order_no: '',
|
||||||
|
process_unit_id: '',
|
||||||
|
process_name: '',
|
||||||
|
warehouse_id: '',
|
||||||
|
warehouse_name: '',
|
||||||
|
audit_status: AUDIT_STATUS.PENDING,
|
||||||
|
},
|
||||||
|
statusSelectList: [
|
||||||
|
{ value: '', label: '全部' },
|
||||||
|
...getStatusOptions(),
|
||||||
|
],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
statusLabel() {
|
||||||
|
if (this.filters.audit_status === '' || this.filters.audit_status === null) return '';
|
||||||
|
return AUDIT_STATUS_MAP[Number(this.filters.audit_status)] || '';
|
||||||
|
},
|
||||||
|
processUnitLabel() {
|
||||||
|
return this.filters.process_name || '';
|
||||||
|
},
|
||||||
|
warehouseLabel() {
|
||||||
|
return this.filters.warehouse_name || '';
|
||||||
|
},
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
uni.setNavigationBarTitle({ title: '加工出仓列表' });
|
||||||
|
this.restoreFilterCache();
|
||||||
|
uni.getSystemInfo({
|
||||||
|
success: (res) => {
|
||||||
|
this.scrollHeight = `${res.windowHeight - 50}px`;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
this.loadList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
createDefaultFilters() {
|
||||||
|
return {
|
||||||
|
order_no: '',
|
||||||
|
process_unit_id: '',
|
||||||
|
process_name: '',
|
||||||
|
warehouse_id: '',
|
||||||
|
warehouse_name: '',
|
||||||
|
audit_status: AUDIT_STATUS.PENDING,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
loadProcessUnitOptions() {
|
||||||
|
if (this.processUnitOptions.length) return Promise.resolve(this.processUnitOptions);
|
||||||
|
return this.$u.api.businessUnit.list({ unit_type_id: BUSINESS_UNIT_TYPE_PROCESS })
|
||||||
|
.then((res) => {
|
||||||
|
this.processUnitOptions = mapToSelectOptions(res);
|
||||||
|
return this.processUnitOptions;
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.processUnitOptions = [];
|
||||||
|
return this.processUnitOptions;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
loadWarehouseOptions() {
|
||||||
|
if (this.warehouseOptions.length) return Promise.resolve(this.warehouseOptions);
|
||||||
|
return this.$u.api.physicalWarehouse.getDropdownList({ warehouse_type_id: WAREHOUSE_TYPE_FINISHED })
|
||||||
|
.then((res) => {
|
||||||
|
this.warehouseOptions = mapToSelectOptions(res);
|
||||||
|
return this.warehouseOptions;
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.warehouseOptions = [];
|
||||||
|
return this.warehouseOptions;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
openUnitSelect(type) {
|
||||||
|
this.unitSelectType = type;
|
||||||
|
const cache = type === 'warehouse' ? this.warehouseOptions : this.processUnitOptions;
|
||||||
|
this.applyUnitSelectList(cache);
|
||||||
|
this.unitSelectShow = true;
|
||||||
|
},
|
||||||
|
onUnitSearch(keyword) {
|
||||||
|
const seq = ++this.unitSearchSeq;
|
||||||
|
const type = this.unitSelectType;
|
||||||
|
const empty = !String(keyword || '').trim();
|
||||||
|
this.selectSearching = true;
|
||||||
|
const req = type === 'warehouse'
|
||||||
|
? this.$u.api.physicalWarehouse.getDropdownList(withNameParam({ warehouse_type_id: WAREHOUSE_TYPE_FINISHED }, keyword))
|
||||||
|
: this.$u.api.businessUnit.list(withNameParam({ unit_type_id: BUSINESS_UNIT_TYPE_PROCESS }, keyword));
|
||||||
|
req.then((res) => {
|
||||||
|
if (seq !== this.unitSearchSeq) return;
|
||||||
|
const list = mapToSelectOptions(res);
|
||||||
|
if (empty) {
|
||||||
|
if (type === 'warehouse') this.warehouseOptions = list;
|
||||||
|
else this.processUnitOptions = list;
|
||||||
|
}
|
||||||
|
this.applyUnitSelectList(list, empty);
|
||||||
|
}).catch((e) => {
|
||||||
|
if (seq !== this.unitSearchSeq) return;
|
||||||
|
uni.showToast({ title: (e && e.message) || '搜索失败', icon: 'none' });
|
||||||
|
}).then(() => {
|
||||||
|
if (seq === this.unitSearchSeq) this.selectSearching = false;
|
||||||
|
}, () => {
|
||||||
|
if (seq === this.unitSearchSeq) this.selectSearching = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
openProcessUnitSelect() {
|
||||||
|
this.openUnitSelect('process');
|
||||||
|
},
|
||||||
|
openWarehouseSelect() {
|
||||||
|
this.openUnitSelect('warehouse');
|
||||||
|
},
|
||||||
|
onUnitConfirm(e) {
|
||||||
|
const item = e[0] || {};
|
||||||
|
if (this.unitSelectType === 'warehouse') {
|
||||||
|
this.filters.warehouse_id = item.value;
|
||||||
|
this.filters.warehouse_name = item.value ? item.label : '';
|
||||||
|
} else {
|
||||||
|
this.filters.process_unit_id = item.value;
|
||||||
|
this.filters.process_name = item.value ? item.label : '';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
loadList() {
|
||||||
|
if (this.listLoading) return;
|
||||||
|
this.listLoading = true;
|
||||||
|
const filters = this.appliedFilters || this.filters;
|
||||||
|
const params = {};
|
||||||
|
if (filters.order_no) params.order_no = filters.order_no;
|
||||||
|
if (filters.process_unit_id) params.process_unit_id = filters.process_unit_id;
|
||||||
|
if (filters.warehouse_id) params.warehouse_id = filters.warehouse_id;
|
||||||
|
if (this.hasFilterValue(filters.audit_status)) {
|
||||||
|
params.audit_status = filters.audit_status;
|
||||||
|
}
|
||||||
|
fetchAllOrderList((p) => this.$u.api.fpmProcessOutOrder.list(p), params)
|
||||||
|
.then((rows) => {
|
||||||
|
this.list = rows.map(this.mapToCard);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
this.list = [];
|
||||||
|
uni.showToast({ title: err.message || '加载失败', icon: 'none' });
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.listLoading = false;
|
||||||
|
this.triggered = false;
|
||||||
|
// 避免并发请求下 uView 全局 loading 遮罩关不掉
|
||||||
|
uni.hideLoading();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
mapToCard(order) {
|
||||||
|
return {
|
||||||
|
id: order.id,
|
||||||
|
order_no: order.order_no || '',
|
||||||
|
out_order_type: order.out_order_type || '',
|
||||||
|
out_order_type_name: order.out_order_type_name || '',
|
||||||
|
process_unit_id: order.process_unit_id || '',
|
||||||
|
process_name: order.process_name || '',
|
||||||
|
warehouse_id: order.warehouse_id || '',
|
||||||
|
warehouse_name: order.warehouse_name || '',
|
||||||
|
create_user_name: order.creator_name || '',
|
||||||
|
create_time: order.create_time || '',
|
||||||
|
auditor_name: order.auditor_name || '',
|
||||||
|
audit_date: order.audit_time || '',
|
||||||
|
audit_status: order.audit_status,
|
||||||
|
audit_status_name: order.audit_status_name || AUDIT_STATUS_MAP[order.audit_status] || '',
|
||||||
|
total_roll: formatRoll(order.total_roll),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
onRefresh() {
|
||||||
|
this.triggered = true;
|
||||||
|
this.loadList();
|
||||||
|
},
|
||||||
|
goView(item) {
|
||||||
|
const page = Number(item.audit_status) === 1
|
||||||
|
? 'storeGoodsProcessOutEdit'
|
||||||
|
: 'storeGoodsProcessOutView';
|
||||||
|
uni.navigateTo({ url: `./${page}?id=${item.id}` });
|
||||||
|
},
|
||||||
|
openStatusSelect() { this.statusSelectShow = true; },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
@import '@/common/list-filter.scss';
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,515 @@
|
|||||||
|
/**
|
||||||
|
* 加工出仓单表单 mixin(新增/编辑共用)
|
||||||
|
*
|
||||||
|
* 1. 先填表头(加工单位 / 仓库 / 备注)提交 add,拿到 id 后可扫码
|
||||||
|
* 2. 扫码走 updateFpmProcessOutOrder(arrange_type: 1 录入 / 3 删除),不扫仓位
|
||||||
|
* 3. 手机扫码成功展示详情后自动再次调起扫码,形成连续扫
|
||||||
|
*/
|
||||||
|
import util from '@/common/util';
|
||||||
|
import scanMixin from '@/common/scanMixin.js';
|
||||||
|
import PlusBarcodePanel from '@/components/common/PlusBarcodePanel.vue';
|
||||||
|
import remoteSelectMixin from '@/common/remoteSelectMixin.js';
|
||||||
|
import { withNameParam } from '@/common/remoteSelect';
|
||||||
|
import { initTts, speak } from '@/common/tts.js';
|
||||||
|
import {
|
||||||
|
AUDIT_STATUS_MAP,
|
||||||
|
ARRANGE_TYPE,
|
||||||
|
BUSINESS_UNIT_TYPE_PROCESS,
|
||||||
|
WAREHOUSE_TYPE_FINISHED,
|
||||||
|
OUT_ORDER_TYPE_PROCESS,
|
||||||
|
OUT_ORDER_TYPE_PROCESS_NAME,
|
||||||
|
normalizeOrder,
|
||||||
|
mapToSelectOptions,
|
||||||
|
canScanAtStatus,
|
||||||
|
isLockedOrderStatus,
|
||||||
|
getFormStatusActionButtons,
|
||||||
|
orderToFormFields,
|
||||||
|
confirmOrderStatusAction,
|
||||||
|
DRAFT_AUDIT_STATUS,
|
||||||
|
DRAFT_AUDIT_STATUS_NAME,
|
||||||
|
getEmptyScanDetail,
|
||||||
|
buildScanDetailFromScanResponse,
|
||||||
|
buildScanUpdateParams,
|
||||||
|
pickDefaultWarehouse,
|
||||||
|
formatDisplayTime,
|
||||||
|
} from '@/common/storeGoodsProcessOut';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: { PlusBarcodePanel },
|
||||||
|
mixins: [scanMixin, remoteSelectMixin],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
pageMode: 'add',
|
||||||
|
orderId: 0,
|
||||||
|
form: this.getEmptyForm(),
|
||||||
|
headerSaved: false,
|
||||||
|
headerCollapsed: false,
|
||||||
|
selectShow: false,
|
||||||
|
selectList: [],
|
||||||
|
selectType: '',
|
||||||
|
canScan: false,
|
||||||
|
QRBarCode: '',
|
||||||
|
BarCodeDelStatus: false,
|
||||||
|
BillDataMessage: '',
|
||||||
|
scanDetail: getEmptyScanDetail(),
|
||||||
|
auditStatus: 0,
|
||||||
|
processUnitOptions: [],
|
||||||
|
warehouseOptions: [],
|
||||||
|
outOrderTypeOptions: [],
|
||||||
|
dropdownLoading: false,
|
||||||
|
/** 手机连续扫码开关:成功后自动再调起;取消/失败则关闭 */
|
||||||
|
phoneContinuousScan: false,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
isReadonly() {
|
||||||
|
return this.pageMode === 'view';
|
||||||
|
},
|
||||||
|
isEditable() {
|
||||||
|
return this.pageMode === 'add' || this.pageMode === 'edit';
|
||||||
|
},
|
||||||
|
headerEditable() {
|
||||||
|
return this.pageMode === 'add' && !this.headerSaved;
|
||||||
|
},
|
||||||
|
statusActionButtons() {
|
||||||
|
return getFormStatusActionButtons(this.headerSaved, this.orderId, this.auditStatus);
|
||||||
|
},
|
||||||
|
displayAuditStatus() {
|
||||||
|
if (this.pageMode === 'add' && !this.headerSaved) return DRAFT_AUDIT_STATUS;
|
||||||
|
return this.auditStatus;
|
||||||
|
},
|
||||||
|
displayAuditStatusName() {
|
||||||
|
if (this.pageMode === 'add' && !this.headerSaved) return DRAFT_AUDIT_STATUS_NAME;
|
||||||
|
return AUDIT_STATUS_MAP[this.auditStatus] || '';
|
||||||
|
},
|
||||||
|
canScanQr() {
|
||||||
|
return this.canScan;
|
||||||
|
},
|
||||||
|
showQrScanBar() {
|
||||||
|
return this.canScan;
|
||||||
|
},
|
||||||
|
qrDisabledTip() {
|
||||||
|
if (!this.canScan) return '请先提交保存后再扫码';
|
||||||
|
return '当前状态不可扫码';
|
||||||
|
},
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
this.isPageActive = true;
|
||||||
|
initTts();
|
||||||
|
if (this.canScan && this.isEditable) {
|
||||||
|
this.registerOrderScanBroadcast();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onHide() {
|
||||||
|
this.isPageActive = false;
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
this.unregisterScanBroadcast();
|
||||||
|
},
|
||||||
|
onUnload() {
|
||||||
|
this.isPageActive = false;
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
this.unregisterScanBroadcast();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handlePhoneScan() {
|
||||||
|
if (!this.canScan || !this.orderId) {
|
||||||
|
this.showError('请先提交保存后再扫码');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
this.togglePhoneScanPanel();
|
||||||
|
},
|
||||||
|
onPlusBarcodeSuccess(scanResult) {
|
||||||
|
this.QRBarCode = String(scanResult || '').trim().replace(/[\r\n]/g, '');
|
||||||
|
this.$nextTick(() => this.handleScan());
|
||||||
|
},
|
||||||
|
openContinuousPhoneScan() {
|
||||||
|
if (this.phoneScanPanelOpen) return;
|
||||||
|
if (!this.phoneContinuousScan || !this.canScanQr || !this.isPageActive) {
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.openPhoneScan({
|
||||||
|
callback: (scanResult) => {
|
||||||
|
this.QRBarCode = String(scanResult || '').trim().replace(/[\r\n]/g, '');
|
||||||
|
this.$nextTick(() => this.handleScan({ fromPhone: true }));
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
scheduleNextPhoneScan() {
|
||||||
|
if (this.phoneScanPanelOpen) return;
|
||||||
|
if (!this.phoneContinuousScan || !this.canScanQr || !this.isPageActive) {
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
this.openContinuousPhoneScan();
|
||||||
|
}, 400);
|
||||||
|
},
|
||||||
|
registerOrderScanBroadcast() {
|
||||||
|
this.registerScanBroadcast((scanResult) => {
|
||||||
|
const code = String(scanResult || '').trim().replace(/[\r\n]/g, '');
|
||||||
|
if (!code) return;
|
||||||
|
this.QRBarCode = code;
|
||||||
|
this.$nextTick(() => this.handleScan());
|
||||||
|
});
|
||||||
|
},
|
||||||
|
syncCanScanFromStatus(status) {
|
||||||
|
const nextCanScan = this.isEditable && canScanAtStatus(status);
|
||||||
|
if (this.canScan && !nextCanScan) {
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
this.closePhoneScanPanel();
|
||||||
|
this.unregisterScanBroadcast();
|
||||||
|
}
|
||||||
|
this.canScan = nextCanScan;
|
||||||
|
},
|
||||||
|
loadBaseDropdowns() {
|
||||||
|
if (this.dropdownLoading) return Promise.resolve();
|
||||||
|
this.dropdownLoading = true;
|
||||||
|
return Promise.all([
|
||||||
|
this.ensureOutOrderTypeOptions().catch((e) => {
|
||||||
|
console.error('加载出仓类型失败', e);
|
||||||
|
return [];
|
||||||
|
}),
|
||||||
|
this.ensureProcessUnitOptions().catch((e) => {
|
||||||
|
console.error('加载加工单位失败', e);
|
||||||
|
return [];
|
||||||
|
}),
|
||||||
|
this.ensureWarehouseOptions().catch((e) => {
|
||||||
|
console.error('加载仓库失败', e);
|
||||||
|
return [];
|
||||||
|
}),
|
||||||
|
]).finally(() => {
|
||||||
|
this.dropdownLoading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
ensureOutOrderTypeOptions() {
|
||||||
|
if (this.outOrderTypeOptions.length) return Promise.resolve(this.outOrderTypeOptions);
|
||||||
|
return this.$u.api.fpmProcessOutOrder.getOutTypeEnum()
|
||||||
|
.then((res) => {
|
||||||
|
this.outOrderTypeOptions = mapToSelectOptions(res);
|
||||||
|
if (this.headerEditable && !this.form.out_order_type) {
|
||||||
|
this.applyDefaultOutOrderType();
|
||||||
|
}
|
||||||
|
return this.outOrderTypeOptions;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
applyDefaultOutOrderType() {
|
||||||
|
const list = this.outOrderTypeOptions || [];
|
||||||
|
const preferred = list.find((item) => Number(item.value) === OUT_ORDER_TYPE_PROCESS) || list[0];
|
||||||
|
if (!preferred) return;
|
||||||
|
this.form.out_order_type = preferred.value;
|
||||||
|
this.form.out_order_type_name = preferred.label;
|
||||||
|
},
|
||||||
|
ensureProcessUnitOptions() {
|
||||||
|
if (this.processUnitOptions.length) return Promise.resolve(this.processUnitOptions);
|
||||||
|
return this.$u.api.businessUnit.list({ unit_type_id: BUSINESS_UNIT_TYPE_PROCESS })
|
||||||
|
.then((res) => {
|
||||||
|
this.processUnitOptions = mapToSelectOptions(res);
|
||||||
|
return this.processUnitOptions;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
ensureWarehouseOptions() {
|
||||||
|
if (this.warehouseOptions.length) return Promise.resolve(this.warehouseOptions);
|
||||||
|
return this.$u.api.physicalWarehouse.getDropdownList({ warehouse_type_id: WAREHOUSE_TYPE_FINISHED })
|
||||||
|
.then((res) => {
|
||||||
|
this.warehouseOptions = mapToSelectOptions(res);
|
||||||
|
if (this.headerEditable && !this.form.warehouse_id) {
|
||||||
|
this.applyDefaultWarehouse();
|
||||||
|
}
|
||||||
|
return this.warehouseOptions;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
fetchRemoteSelectOptions(type, keyword) {
|
||||||
|
const empty = !String(keyword || '').trim();
|
||||||
|
if (type === '加工单位') {
|
||||||
|
return this.$u.api.businessUnit.list(withNameParam({ unit_type_id: BUSINESS_UNIT_TYPE_PROCESS }, keyword))
|
||||||
|
.then((res) => {
|
||||||
|
const list = mapToSelectOptions(res);
|
||||||
|
if (empty) this.processUnitOptions = list;
|
||||||
|
return list;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (type === '仓库名称') {
|
||||||
|
return this.$u.api.physicalWarehouse.getDropdownList(withNameParam({ warehouse_type_id: WAREHOUSE_TYPE_FINISHED }, keyword))
|
||||||
|
.then((res) => {
|
||||||
|
const list = mapToSelectOptions(res);
|
||||||
|
if (empty) this.warehouseOptions = list;
|
||||||
|
return list;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return Promise.resolve([]);
|
||||||
|
},
|
||||||
|
applyDefaultWarehouse() {
|
||||||
|
const app = getApp();
|
||||||
|
const picked = pickDefaultWarehouse(
|
||||||
|
this.warehouseOptions,
|
||||||
|
app && app.globalData ? app.globalData.StoreNameID : '',
|
||||||
|
app && app.globalData ? app.globalData.StoreName : '',
|
||||||
|
);
|
||||||
|
if (!picked) return;
|
||||||
|
this.form.warehouse_id = picked.value;
|
||||||
|
this.form.warehouse_name = picked.label;
|
||||||
|
},
|
||||||
|
getEmptyForm() {
|
||||||
|
return {
|
||||||
|
order_no: '',
|
||||||
|
out_order_type: OUT_ORDER_TYPE_PROCESS,
|
||||||
|
out_order_type_name: OUT_ORDER_TYPE_PROCESS_NAME,
|
||||||
|
process_unit_id: '',
|
||||||
|
process_name: '',
|
||||||
|
warehouse_id: '',
|
||||||
|
warehouse_name: '',
|
||||||
|
remark: '',
|
||||||
|
item_data: [],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
loadOrder(id, options = {}) {
|
||||||
|
const { rejectIfLocked = false } = options;
|
||||||
|
return this.$u.api.fpmProcessOutOrder.detail({ id })
|
||||||
|
.then((res) => {
|
||||||
|
const order = normalizeOrder(res);
|
||||||
|
if (!order) {
|
||||||
|
this.showError('单据不存在');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (rejectIfLocked && isLockedOrderStatus(order.audit_status)) {
|
||||||
|
this.showError('当前状态不可编辑');
|
||||||
|
setTimeout(() => uni.navigateBack(), 1500);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
this.orderId = order.id;
|
||||||
|
this.auditStatus = order.audit_status;
|
||||||
|
this.headerSaved = true;
|
||||||
|
this.headerCollapsed = true;
|
||||||
|
this.form = orderToFormFields(order);
|
||||||
|
this.syncCanScanFromStatus(order.audit_status);
|
||||||
|
if (this.canScan) this.registerOrderScanBroadcast();
|
||||||
|
return order;
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
this.showError(e.message || '加载单据失败');
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
pickerSelectFun(type) {
|
||||||
|
if (!this.headerEditable) return;
|
||||||
|
if (type === '出仓类型') {
|
||||||
|
this.selectType = type;
|
||||||
|
const openPicker = (list) => {
|
||||||
|
if (!list.length) {
|
||||||
|
this.showError('暂无可选数据');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.selectList = list;
|
||||||
|
this.selectShow = true;
|
||||||
|
};
|
||||||
|
this.ensureOutOrderTypeOptions()
|
||||||
|
.then(openPicker)
|
||||||
|
.catch((e) => this.showError(e.message || '加载出仓类型失败'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const cache = {
|
||||||
|
'加工单位': this.processUnitOptions,
|
||||||
|
'仓库名称': this.warehouseOptions,
|
||||||
|
};
|
||||||
|
if (cache[type]) this.openSelectPicker(type, cache[type]);
|
||||||
|
},
|
||||||
|
selectConfirmFun(e) {
|
||||||
|
const item = e[0];
|
||||||
|
if (this.selectType === '出仓类型') {
|
||||||
|
this.form.out_order_type = item.value;
|
||||||
|
this.form.out_order_type_name = item.label;
|
||||||
|
} else if (this.selectType === '加工单位') {
|
||||||
|
this.form.process_unit_id = item.value;
|
||||||
|
this.form.process_name = item.label;
|
||||||
|
} else if (this.selectType === '仓库名称') {
|
||||||
|
this.form.warehouse_id = item.value;
|
||||||
|
this.form.warehouse_name = item.label;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
validateForm() {
|
||||||
|
if (!this.form.out_order_type) return '请选择出仓类型';
|
||||||
|
if (!this.form.process_unit_id) return '请选择加工单位';
|
||||||
|
if (!this.form.warehouse_id) return '请选择仓库名称';
|
||||||
|
const app = getApp();
|
||||||
|
const saleSystemId = app && app.globalData ? app.globalData.PlanDepartmentID : '';
|
||||||
|
if (!saleSystemId) return '缺少营销体系,请重新登录';
|
||||||
|
return '';
|
||||||
|
},
|
||||||
|
buildAddParam() {
|
||||||
|
const app = getApp();
|
||||||
|
return {
|
||||||
|
// OpenAPI: product.AddFpmProcessOutOrderParam
|
||||||
|
out_order_type: Number(this.form.out_order_type),
|
||||||
|
process_unit_id: Number(this.form.process_unit_id),
|
||||||
|
warehouse_id: Number(this.form.warehouse_id),
|
||||||
|
sale_system_id: Number(app.globalData.PlanDepartmentID),
|
||||||
|
warehouse_out_time: formatDisplayTime(new Date(), 'YYYY-MM-DD'),
|
||||||
|
remark: this.form.remark || '',
|
||||||
|
item_data: [],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
submitSave() {
|
||||||
|
if (this.headerSaved) {
|
||||||
|
this.showError('表头已保存,请直接扫码');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const err = this.validateForm();
|
||||||
|
if (err) {
|
||||||
|
this.showError(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uni.showLoading({ title: '保存中...' });
|
||||||
|
this.$u.api.fpmProcessOutOrder.add(this.buildAddParam())
|
||||||
|
.then((res) => {
|
||||||
|
this.orderId = (res && res.id) || 0;
|
||||||
|
if (!this.orderId) {
|
||||||
|
throw new Error('保存失败,未返回单据ID');
|
||||||
|
}
|
||||||
|
return this.$u.api.fpmProcessOutOrder.detail({ id: this.orderId });
|
||||||
|
})
|
||||||
|
.then((detail) => {
|
||||||
|
uni.hideLoading();
|
||||||
|
const order = normalizeOrder(detail);
|
||||||
|
this.applyOrder(order);
|
||||||
|
this.headerSaved = true;
|
||||||
|
this.headerCollapsed = true;
|
||||||
|
this.syncCanScanFromStatus(order.audit_status);
|
||||||
|
this.showSuccess('保存成功,请开始扫码', '保存成功', { voiceOnly: true });
|
||||||
|
this.registerOrderScanBroadcast();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
uni.hideLoading();
|
||||||
|
this.showError(e.message || '保存失败');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
applyOrder(order) {
|
||||||
|
if (!order) return;
|
||||||
|
this.auditStatus = order.audit_status;
|
||||||
|
Object.assign(this.form, orderToFormFields(order));
|
||||||
|
},
|
||||||
|
handleScan(options = {}) {
|
||||||
|
const fromPhone = !!options.fromPhone;
|
||||||
|
const code = (this.QRBarCode || '').trim();
|
||||||
|
if (!this.canScan || !this.orderId) {
|
||||||
|
this.showError('请先提交保存后再扫码');
|
||||||
|
this.QRBarCode = '';
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!code) {
|
||||||
|
this.QRBarCode = '';
|
||||||
|
if (fromPhone) this.scheduleNextPhoneScan();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const arrangeType = this.BarCodeDelStatus ? ARRANGE_TYPE.DEL : ARRANGE_TYPE.IN;
|
||||||
|
this.doScanUpdate(code, arrangeType, { fromPhone });
|
||||||
|
},
|
||||||
|
BarCodeDelChange(e) {
|
||||||
|
this.BarCodeDelStatus = (e.detail.value || []).length > 0;
|
||||||
|
this.BillDataMessage = this.BarCodeDelStatus ? '删除模式:扫描细码即可删除' : '';
|
||||||
|
},
|
||||||
|
getFineCodeScanCode(fineCode) {
|
||||||
|
if (!fineCode) return '';
|
||||||
|
return fineCode.qr_code
|
||||||
|
|| fineCode.scan_code
|
||||||
|
|| fineCode.digital_code
|
||||||
|
|| fineCode.bar_code
|
||||||
|
|| '';
|
||||||
|
},
|
||||||
|
onDeleteFineCode(fineCode) {
|
||||||
|
if (!this.canScan || !this.orderId) {
|
||||||
|
this.showError('当前状态不可删除');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const scanCode = this.getFineCodeScanCode(fineCode);
|
||||||
|
if (!scanCode) {
|
||||||
|
this.showError('该细码缺少条码,无法删除');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: `确认删除细码 ${scanCode}?`,
|
||||||
|
success: (res) => {
|
||||||
|
if (!res.confirm) return;
|
||||||
|
this.doScanUpdate(scanCode, ARRANGE_TYPE.DEL);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
doScanUpdate(scanCode, arrangeType, options = {}) {
|
||||||
|
const { fromPhone = false } = options;
|
||||||
|
const isDelete = arrangeType === ARRANGE_TYPE.DEL;
|
||||||
|
uni.showLoading({ title: isDelete ? '删除中...' : '处理中...' });
|
||||||
|
return this.$u.api.fpmProcessOutOrder.scanUpdate(buildScanUpdateParams({
|
||||||
|
id: this.orderId,
|
||||||
|
scanCode,
|
||||||
|
arrangeType,
|
||||||
|
}))
|
||||||
|
.then((scanRes) => {
|
||||||
|
this.scanDetail = buildScanDetailFromScanResponse(scanRes);
|
||||||
|
this.BillDataMessage = isDelete ? '删除成功' : '扫描成功';
|
||||||
|
this.QRBarCode = '';
|
||||||
|
if (isDelete) {
|
||||||
|
speak('已删除');
|
||||||
|
uni.showToast({ title: '删除成功', icon: 'success' });
|
||||||
|
} else {
|
||||||
|
speak('成功');
|
||||||
|
}
|
||||||
|
return this.$u.api.fpmProcessOutOrder.detail({ id: this.orderId })
|
||||||
|
.then((detail) => {
|
||||||
|
const order = normalizeOrder(detail);
|
||||||
|
if (order) {
|
||||||
|
this.form.item_data = order.item_data;
|
||||||
|
this.auditStatus = order.audit_status;
|
||||||
|
// 本单匹数/本单数量:取这张单的总匹数、总数量
|
||||||
|
this.scanDetail = {
|
||||||
|
...this.scanDetail,
|
||||||
|
order_roll: order.total_roll,
|
||||||
|
order_weight: order.total_weight,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => null);
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
uni.hideLoading();
|
||||||
|
if (fromPhone) this.scheduleNextPhoneScan();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
uni.hideLoading();
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
const message = e.message || (isDelete ? '删除失败' : '扫码失败');
|
||||||
|
speak(isDelete ? '删除失败' : '扫码失败');
|
||||||
|
uni.showToast({ title: message, icon: 'none', duration: 2500 });
|
||||||
|
this.QRBarCode = '';
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleStatusAction(action) {
|
||||||
|
confirmOrderStatusAction(this, {
|
||||||
|
orderId: this.orderId,
|
||||||
|
action,
|
||||||
|
onSuccess: () => this.$u.api.fpmProcessOutOrder.detail({ id: this.orderId })
|
||||||
|
.then((detail) => {
|
||||||
|
uni.hideLoading();
|
||||||
|
const order = normalizeOrder(detail);
|
||||||
|
if (!order) return;
|
||||||
|
this.applyOrder(order);
|
||||||
|
this.syncCanScanFromStatus(order.audit_status);
|
||||||
|
this.showSuccess(util.statusSuccessVoice(action));
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
},
|
||||||
|
showError(message) {
|
||||||
|
util.playErrorAudio(message);
|
||||||
|
uni.showModal({ title: '提示', content: message, showCancel: false });
|
||||||
|
},
|
||||||
|
showSuccess(message, voiceText, options) {
|
||||||
|
util.playSuccessAudio(voiceText || message, options);
|
||||||
|
uni.showToast({ title: message, icon: 'success' });
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -0,0 +1,135 @@
|
|||||||
|
<template>
|
||||||
|
<view class="fabric-out-page">
|
||||||
|
<OrderHeaderFold v-model="headerCollapsed" :summary="order.order_no">
|
||||||
|
<OrderStatusBar class="fabric-out-mt32" :status="order.audit_status" :name="order.audit_status_name" />
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">出仓类型</text>
|
||||||
|
<text>{{ order.out_order_type_name || '正常加工出仓' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">加工单位</text>
|
||||||
|
<text>{{ order.process_name || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">仓库名称</text>
|
||||||
|
<text>{{ order.warehouse_name || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">单据备注</text>
|
||||||
|
<text>{{ order.remark || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">创建人</text>
|
||||||
|
<text>{{ order.creator_name }} {{ formatTime(order.create_time, 'YYYY-MM-DD') }}</text>
|
||||||
|
</view>
|
||||||
|
<view v-if="order.auditor_name" class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">审核人</text>
|
||||||
|
<text>{{ order.auditor_name }} {{ formatTime(order.audit_time, 'YYYY-MM-DD') }}</text>
|
||||||
|
</view>
|
||||||
|
</OrderHeaderFold>
|
||||||
|
|
||||||
|
<ProcessOutDetailList
|
||||||
|
:title="detailTitle"
|
||||||
|
:list="order.item_data"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<FabricOutFooter :buttons="actionButtons" @action="handleAction" />
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import util from '@/common/util';
|
||||||
|
import OrderStatusBar from '@/components/storefabric/OrderStatusBar.vue';
|
||||||
|
import OrderHeaderFold from '@/components/storefabric/OrderHeaderFold.vue';
|
||||||
|
import FabricOutFooter from '@/components/storefabric/FabricOutFooter.vue';
|
||||||
|
import ProcessOutDetailList from '@/components/storegoods/ProcessOutDetailList.vue';
|
||||||
|
import {
|
||||||
|
normalizeOrder,
|
||||||
|
getViewStatusActionButtons,
|
||||||
|
confirmOrderStatusAction,
|
||||||
|
formatDisplayTime,
|
||||||
|
} from '@/common/storeGoodsProcessOut';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: { OrderStatusBar, OrderHeaderFold, FabricOutFooter, ProcessOutDetailList },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
orderId: 0,
|
||||||
|
headerCollapsed: true,
|
||||||
|
order: { item_data: [] },
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
actionButtons() {
|
||||||
|
return getViewStatusActionButtons(this.order.audit_status);
|
||||||
|
},
|
||||||
|
detailTitle() {
|
||||||
|
return `出仓明细(共 ${this.order.total_roll || 0} 匹)`;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
onLoad(e) {
|
||||||
|
uni.setNavigationBarTitle({ title: '查看加工出仓单' });
|
||||||
|
if (e.id) {
|
||||||
|
this.orderId = Number(e.id);
|
||||||
|
this.refreshOrder();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
if (this.orderId) this.refreshOrder();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
formatTime: formatDisplayTime,
|
||||||
|
refreshOrder() {
|
||||||
|
this.$u.api.fpmProcessOutOrder.detail({ id: this.orderId })
|
||||||
|
.then((res) => {
|
||||||
|
const order = normalizeOrder(res);
|
||||||
|
if (!order) {
|
||||||
|
this.showError('单据不存在');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.order = order;
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
this.showError(err.message || '加载单据失败');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleAction(action) {
|
||||||
|
if (action === 'edit') {
|
||||||
|
uni.navigateTo({ url: `./storeGoodsProcessOutEdit?id=${this.orderId}` });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
confirmOrderStatusAction(this, {
|
||||||
|
orderId: this.orderId,
|
||||||
|
action,
|
||||||
|
onSuccess: () => {
|
||||||
|
uni.hideLoading();
|
||||||
|
const voice = util.statusSuccessVoice(action);
|
||||||
|
util.playSuccessAudio(voice);
|
||||||
|
uni.showToast({ title: voice, icon: 'success' });
|
||||||
|
if (action === 'unapprove') {
|
||||||
|
uni.redirectTo({ url: `./storeGoodsProcessOutEdit?id=${this.orderId}` });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return this.$u.api.fpmProcessOutOrder.detail({ id: this.orderId })
|
||||||
|
.then((res) => {
|
||||||
|
const order = normalizeOrder(res);
|
||||||
|
if (order) this.order = order;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
showError(message) {
|
||||||
|
util.playErrorAudio(message);
|
||||||
|
uni.showModal({ title: '提示', content: message, showCancel: false });
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
@import '@/pages/storefabric/storeFabricBusinessOutPage.scss';
|
||||||
|
page {
|
||||||
|
background-color: #F8F8F8;
|
||||||
|
padding-bottom: 260rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,121 @@
|
|||||||
|
<template>
|
||||||
|
<view class="fabric-out-page">
|
||||||
|
<OrderHeaderFold v-model="headerCollapsed" :summary="form.order_no || '保存后自动生成'">
|
||||||
|
<OrderStatusBar class="fabric-out-mt32" :status="displayAuditStatus" :name="displayAuditStatusName" />
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">进仓类型</text>
|
||||||
|
<view>加工退货进仓单</view>
|
||||||
|
</view>
|
||||||
|
<view @click="pickerSelectFun('加工单位')" class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">加工单位<text class="redXingh">*</text></text>
|
||||||
|
<view :class="form.process_name ? '' : 'cBlack'">
|
||||||
|
{{ form.process_name || '请选择' }}
|
||||||
|
<u-icon v-if="headerEditable" class="ml26" name="arrow-right" size="40" color="#888888"></u-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view @click="pickerSelectFun('仓库名称')" class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">仓库名称<text class="redXingh">*</text></text>
|
||||||
|
<view :class="form.warehouse_name ? '' : 'cBlack'">
|
||||||
|
{{ form.warehouse_name || '请选择' }}
|
||||||
|
<u-icon v-if="headerEditable" class="ml26" name="arrow-right" size="40" color="#888888"></u-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26-column ptb20 mt32">
|
||||||
|
<view style="margin-bottom: 8rpx;"><text>单据备注</text></view>
|
||||||
|
<u-input v-model="form.remark" :disabled="!headerEditable" type="textarea" :border="true" :height="100" :auto-height="true" />
|
||||||
|
</view>
|
||||||
|
</OrderHeaderFold>
|
||||||
|
|
||||||
|
<PlusBarcodePanel
|
||||||
|
:visible.sync="phoneScanPanelOpen"
|
||||||
|
:hint-text="phoneScanHint"
|
||||||
|
:scan-time-space="1200"
|
||||||
|
@success="onPlusBarcodeSuccess"
|
||||||
|
/>
|
||||||
|
<ProcessInBinBar
|
||||||
|
:can-scan="canScan"
|
||||||
|
:bin-id="warehouseBinId"
|
||||||
|
:code="warehouseBinCode"
|
||||||
|
:name="warehouseBinName"
|
||||||
|
:show-phone-scan="canScan"
|
||||||
|
:scanning="phoneScanPanelOpen && phoneScanTarget === 'bin'"
|
||||||
|
@code-input="warehouseBinCode = $event"
|
||||||
|
@confirm="resolveWarehouseBin"
|
||||||
|
@phone-scan="handleBinPhoneScan"
|
||||||
|
@clear="clearWarehouseBin"
|
||||||
|
/>
|
||||||
|
<FabricOutScanBar
|
||||||
|
:can-scan="showQrScanBar"
|
||||||
|
:value="QRBarCode"
|
||||||
|
:delete-mode="BarCodeDelStatus"
|
||||||
|
:message="BillDataMessage"
|
||||||
|
:disabled-tip="qrDisabledTip"
|
||||||
|
:show-phone-scan="canScanQr"
|
||||||
|
:scanning="phoneScanPanelOpen && phoneScanTarget === 'qr'"
|
||||||
|
@input="QRBarCode = $event"
|
||||||
|
@scan="handleScan"
|
||||||
|
@phone-scan="handlePhoneScan"
|
||||||
|
@delete-mode-change="BarCodeDelChange"
|
||||||
|
/>
|
||||||
|
<ProcessInScanDetail :detail="scanDetail" />
|
||||||
|
|
||||||
|
<ProcessInDetailList
|
||||||
|
:list="form.item_data"
|
||||||
|
:deletable="canScan"
|
||||||
|
@delete="onDeleteFineCode"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<FabricOutFooter
|
||||||
|
v-if="!headerSaved"
|
||||||
|
:buttons="[{ label: '提交保存', action: 'save' }]"
|
||||||
|
single
|
||||||
|
@action="submitSave"
|
||||||
|
/>
|
||||||
|
<FabricOutFooter
|
||||||
|
v-else
|
||||||
|
:buttons="statusActionButtons"
|
||||||
|
@action="handleStatusAction"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<u-select v-model="selectShow" :list="selectList" :remote="isRemoteSelect" :loading="selectSearching" @search="onSelectSearch" @confirm="selectConfirmFun"></u-select>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import formMixin from './storeGoodsProcessReturnInMixin.js';
|
||||||
|
import OrderStatusBar from '@/components/storefabric/OrderStatusBar.vue';
|
||||||
|
import OrderHeaderFold from '@/components/storefabric/OrderHeaderFold.vue';
|
||||||
|
import FabricOutScanBar from '@/components/storefabric/FabricOutScanBar.vue';
|
||||||
|
import FabricOutFooter from '@/components/storefabric/FabricOutFooter.vue';
|
||||||
|
import ProcessInScanDetail from '@/components/storegoods/ProcessInScanDetail.vue';
|
||||||
|
import ProcessInDetailList from '@/components/storegoods/ProcessInDetailList.vue';
|
||||||
|
import ProcessInBinBar from '@/components/storegoods/ProcessInBinBar.vue';
|
||||||
|
import PlusBarcodePanel from '@/components/common/PlusBarcodePanel.vue';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
PlusBarcodePanel,
|
||||||
|
OrderStatusBar,
|
||||||
|
OrderHeaderFold,
|
||||||
|
FabricOutScanBar,
|
||||||
|
FabricOutFooter,
|
||||||
|
ProcessInScanDetail,
|
||||||
|
ProcessInDetailList,
|
||||||
|
ProcessInBinBar,
|
||||||
|
},
|
||||||
|
mixins: [formMixin],
|
||||||
|
onLoad() {
|
||||||
|
uni.setNavigationBarTitle({ title: '新增加工退货进仓单' });
|
||||||
|
this.pageMode = 'add';
|
||||||
|
this.loadBaseDropdowns();
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
@import '@/pages/storefabric/storeFabricBusinessOutPage.scss';
|
||||||
|
page {
|
||||||
|
background-color: #F8F8F8;
|
||||||
|
padding-bottom: 260rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
<template>
|
||||||
|
<view class="fabric-out-page">
|
||||||
|
<OrderHeaderFold v-model="headerCollapsed" :summary="form.order_no">
|
||||||
|
<OrderStatusBar class="fabric-out-mt32" :status="displayAuditStatus" :name="displayAuditStatusName" />
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">进仓类型</text>
|
||||||
|
<text>加工退货进仓单</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">加工单位</text>
|
||||||
|
<text>{{ form.process_name || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">仓库名称</text>
|
||||||
|
<text>{{ form.warehouse_name || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">单据备注</text>
|
||||||
|
<text>{{ form.remark || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
</OrderHeaderFold>
|
||||||
|
|
||||||
|
<PlusBarcodePanel
|
||||||
|
:visible.sync="phoneScanPanelOpen"
|
||||||
|
:hint-text="phoneScanHint"
|
||||||
|
:scan-time-space="1200"
|
||||||
|
@success="onPlusBarcodeSuccess"
|
||||||
|
/>
|
||||||
|
<ProcessInBinBar
|
||||||
|
:can-scan="canScan"
|
||||||
|
:bin-id="warehouseBinId"
|
||||||
|
:code="warehouseBinCode"
|
||||||
|
:name="warehouseBinName"
|
||||||
|
:show-phone-scan="canScan"
|
||||||
|
:scanning="phoneScanPanelOpen && phoneScanTarget === 'bin'"
|
||||||
|
@code-input="warehouseBinCode = $event"
|
||||||
|
@confirm="resolveWarehouseBin"
|
||||||
|
@phone-scan="handleBinPhoneScan"
|
||||||
|
@clear="clearWarehouseBin"
|
||||||
|
/>
|
||||||
|
<FabricOutScanBar
|
||||||
|
:can-scan="showQrScanBar"
|
||||||
|
:value="QRBarCode"
|
||||||
|
:delete-mode="BarCodeDelStatus"
|
||||||
|
:message="BillDataMessage"
|
||||||
|
:disabled-tip="qrDisabledTip"
|
||||||
|
:show-phone-scan="canScanQr"
|
||||||
|
:scanning="phoneScanPanelOpen && phoneScanTarget === 'qr'"
|
||||||
|
@input="QRBarCode = $event"
|
||||||
|
@scan="handleScan"
|
||||||
|
@phone-scan="handlePhoneScan"
|
||||||
|
@delete-mode-change="BarCodeDelChange"
|
||||||
|
/>
|
||||||
|
<ProcessInScanDetail :detail="scanDetail" />
|
||||||
|
|
||||||
|
<ProcessInDetailList
|
||||||
|
:list="form.item_data"
|
||||||
|
:deletable="canScan"
|
||||||
|
@delete="onDeleteFineCode"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<FabricOutFooter :buttons="statusActionButtons" @action="handleStatusAction" />
|
||||||
|
|
||||||
|
<u-select v-model="selectShow" :list="selectList" :remote="isRemoteSelect" :loading="selectSearching" @search="onSelectSearch" @confirm="selectConfirmFun"></u-select>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import formMixin from './storeGoodsProcessReturnInMixin.js';
|
||||||
|
import OrderStatusBar from '@/components/storefabric/OrderStatusBar.vue';
|
||||||
|
import OrderHeaderFold from '@/components/storefabric/OrderHeaderFold.vue';
|
||||||
|
import FabricOutScanBar from '@/components/storefabric/FabricOutScanBar.vue';
|
||||||
|
import FabricOutFooter from '@/components/storefabric/FabricOutFooter.vue';
|
||||||
|
import ProcessInScanDetail from '@/components/storegoods/ProcessInScanDetail.vue';
|
||||||
|
import ProcessInDetailList from '@/components/storegoods/ProcessInDetailList.vue';
|
||||||
|
import ProcessInBinBar from '@/components/storegoods/ProcessInBinBar.vue';
|
||||||
|
import PlusBarcodePanel from '@/components/common/PlusBarcodePanel.vue';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
PlusBarcodePanel,
|
||||||
|
OrderStatusBar,
|
||||||
|
OrderHeaderFold,
|
||||||
|
FabricOutScanBar,
|
||||||
|
FabricOutFooter,
|
||||||
|
ProcessInScanDetail,
|
||||||
|
ProcessInDetailList,
|
||||||
|
ProcessInBinBar,
|
||||||
|
},
|
||||||
|
mixins: [formMixin],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
headerCollapsed: true,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
onLoad(e) {
|
||||||
|
uni.setNavigationBarTitle({ title: '编辑加工退货进仓单' });
|
||||||
|
this.pageMode = 'edit';
|
||||||
|
if (e.id) {
|
||||||
|
this.loadOrder(Number(e.id), { rejectIfLocked: true });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
@import '@/pages/storefabric/storeFabricBusinessOutPage.scss';
|
||||||
|
page {
|
||||||
|
background-color: #F8F8F8;
|
||||||
|
padding-bottom: 260rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,275 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<view class="filterBar">
|
||||||
|
<u-search v-model="filters.order_no" placeholder="进仓单号" :show-action="false" @search="applySearch" @custom="applySearch" @clear="applySearch" />
|
||||||
|
<view class="filterBtn" :class="{ 'filter-active': hasActiveFilter }" @click="filterShow = true">
|
||||||
|
<view class="filterBtn__icon">
|
||||||
|
<u-icon :key="filterIconColor" name="list" size="44" :color="filterIconColor"></u-icon>
|
||||||
|
<view v-if="hasActiveFilter" class="filterBtn__badge"></view>
|
||||||
|
</view>
|
||||||
|
<text>筛选</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<scroll-view scroll-y :style="{ height: scrollHeight }" refresher-enabled
|
||||||
|
:refresher-triggered="triggered" @refresherrefresh="onRefresh">
|
||||||
|
<dataNull v-if="list.length === 0" src="/src/static/img/chahua/gjNull.png"
|
||||||
|
title="暂无加工退货进仓单" title1="请点击右下角按钮新增">
|
||||||
|
</dataNull>
|
||||||
|
<view v-for="(item, index) in list" :key="item.id" @click="goView(item)">
|
||||||
|
<ProcessReturnInItem :item="item" :index="index" />
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
|
||||||
|
<addBtn url="./storeGoodsProcessReturnInAdd"></addBtn>
|
||||||
|
|
||||||
|
<u-popup v-model="filterShow" mode="right" width="580rpx" :safe-area-inset-bottom="true" @close="cancelFilterEdit">
|
||||||
|
<view class="filterPanel">
|
||||||
|
<view class="filterTitle">筛选条件</view>
|
||||||
|
<view class="filterItem">
|
||||||
|
<text class="filterLabel">进仓单号</text>
|
||||||
|
<view class="filterInput">
|
||||||
|
<u-input v-model="filters.order_no" placeholder="请输入进仓单号" :height="100" :custom-style="{ fontSize: '36rpx', color: '#202328' }" placeholder-style="color: #aeb4bf; font-size: 34rpx;" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="filterItem" @click="openProcessUnitSelect">
|
||||||
|
<text class="filterLabel">加工单位</text>
|
||||||
|
<view class="filterValue">{{ processUnitLabel || '全部' }} <u-icon name="arrow-right" size="36"></u-icon></view>
|
||||||
|
</view>
|
||||||
|
<view class="filterItem" @click="openWarehouseSelect">
|
||||||
|
<text class="filterLabel">仓库</text>
|
||||||
|
<view class="filterValue">{{ warehouseLabel || '全部' }} <u-icon name="arrow-right" size="36"></u-icon></view>
|
||||||
|
</view>
|
||||||
|
<view class="filterItem" @click="openStatusSelect">
|
||||||
|
<text class="filterLabel">订单状态</text>
|
||||||
|
<view class="filterValue">{{ statusLabel || '全部' }} <u-icon name="arrow-right" size="36"></u-icon></view>
|
||||||
|
</view>
|
||||||
|
<view class="filterActions">
|
||||||
|
<u-button type="warning" size="medium" @click="resetFilter">重置</u-button>
|
||||||
|
<u-button type="primary" size="medium" @click="applyFilter">确定</u-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
|
|
||||||
|
<u-select class="pdaSelect" v-model="statusSelectShow" title="选择订单状态" :list="statusSelectList" :default-value="statusSelectDefault" @confirm="onStatusConfirm"></u-select>
|
||||||
|
<u-select class="pdaSelect" v-model="unitSelectShow" :list="unitSelectList" :default-value="unitSelectDefault" remote :loading="selectSearching" @search="onUnitSearch" @confirm="onUnitConfirm"></u-select>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import addBtn from '@/components/addBtn/addBtn.vue';
|
||||||
|
import ProcessReturnInItem from '@/components/card/storeGoodsProcessReturnInItem.vue';
|
||||||
|
import {
|
||||||
|
getStatusOptions,
|
||||||
|
AUDIT_STATUS,
|
||||||
|
AUDIT_STATUS_MAP,
|
||||||
|
BUSINESS_UNIT_TYPE_PROCESS,
|
||||||
|
WAREHOUSE_TYPE_FINISHED,
|
||||||
|
formatRoll,
|
||||||
|
mapToSelectOptions,
|
||||||
|
fetchAllOrderList,
|
||||||
|
} from '@/common/storeGoodsProcessReturnIn';
|
||||||
|
import { withNameParam } from '@/common/remoteSelect';
|
||||||
|
import listFilterMixin from '@/mixins/listFilterMixin';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: { addBtn, ProcessReturnInItem },
|
||||||
|
mixins: [listFilterMixin],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
list: [],
|
||||||
|
scrollHeight: '667px',
|
||||||
|
triggered: false,
|
||||||
|
listLoading: false,
|
||||||
|
filterShow: false,
|
||||||
|
statusSelectShow: false,
|
||||||
|
unitSelectShow: false,
|
||||||
|
unitSelectType: '',
|
||||||
|
processUnitOptions: [],
|
||||||
|
warehouseOptions: [],
|
||||||
|
unitOptionsLoading: false,
|
||||||
|
selectSearching: false,
|
||||||
|
unitSearchSeq: 0,
|
||||||
|
unitSelectList: [{ value: '', label: '全部' }],
|
||||||
|
filterStorageKey: 'storeGoodsProcessReturnInListFilters_v2',
|
||||||
|
filters: {
|
||||||
|
order_no: '',
|
||||||
|
process_unit_id: '',
|
||||||
|
process_name: '',
|
||||||
|
warehouse_id: '',
|
||||||
|
warehouse_name: '',
|
||||||
|
audit_status: AUDIT_STATUS.PENDING,
|
||||||
|
},
|
||||||
|
statusSelectList: [
|
||||||
|
{ value: '', label: '全部' },
|
||||||
|
...getStatusOptions(),
|
||||||
|
],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
statusLabel() {
|
||||||
|
if (this.filters.audit_status === '' || this.filters.audit_status === null) return '';
|
||||||
|
return AUDIT_STATUS_MAP[Number(this.filters.audit_status)] || '';
|
||||||
|
},
|
||||||
|
processUnitLabel() {
|
||||||
|
return this.filters.process_name || '';
|
||||||
|
},
|
||||||
|
warehouseLabel() {
|
||||||
|
return this.filters.warehouse_name || '';
|
||||||
|
},
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
uni.setNavigationBarTitle({ title: '加工退货进仓列表' });
|
||||||
|
this.restoreFilterCache();
|
||||||
|
uni.getSystemInfo({
|
||||||
|
success: (res) => {
|
||||||
|
this.scrollHeight = `${res.windowHeight - 50}px`;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
this.loadList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
createDefaultFilters() {
|
||||||
|
return {
|
||||||
|
order_no: '',
|
||||||
|
process_unit_id: '',
|
||||||
|
process_name: '',
|
||||||
|
warehouse_id: '',
|
||||||
|
warehouse_name: '',
|
||||||
|
audit_status: AUDIT_STATUS.PENDING,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
loadProcessUnitOptions() {
|
||||||
|
if (this.processUnitOptions.length) return Promise.resolve(this.processUnitOptions);
|
||||||
|
return this.$u.api.businessUnit.list({ unit_type_id: BUSINESS_UNIT_TYPE_PROCESS })
|
||||||
|
.then((res) => {
|
||||||
|
this.processUnitOptions = mapToSelectOptions(res);
|
||||||
|
return this.processUnitOptions;
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.processUnitOptions = [];
|
||||||
|
return this.processUnitOptions;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
loadWarehouseOptions() {
|
||||||
|
if (this.warehouseOptions.length) return Promise.resolve(this.warehouseOptions);
|
||||||
|
return this.$u.api.physicalWarehouse.getDropdownList({ warehouse_type_id: WAREHOUSE_TYPE_FINISHED })
|
||||||
|
.then((res) => {
|
||||||
|
this.warehouseOptions = mapToSelectOptions(res);
|
||||||
|
return this.warehouseOptions;
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.warehouseOptions = [];
|
||||||
|
return this.warehouseOptions;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
openUnitSelect(type) {
|
||||||
|
this.unitSelectType = type;
|
||||||
|
const cache = type === 'warehouse' ? this.warehouseOptions : this.processUnitOptions;
|
||||||
|
this.applyUnitSelectList(cache);
|
||||||
|
this.unitSelectShow = true;
|
||||||
|
},
|
||||||
|
onUnitSearch(keyword) {
|
||||||
|
const seq = ++this.unitSearchSeq;
|
||||||
|
const type = this.unitSelectType;
|
||||||
|
const empty = !String(keyword || '').trim();
|
||||||
|
this.selectSearching = true;
|
||||||
|
const req = type === 'warehouse'
|
||||||
|
? this.$u.api.physicalWarehouse.getDropdownList(withNameParam({ warehouse_type_id: WAREHOUSE_TYPE_FINISHED }, keyword))
|
||||||
|
: this.$u.api.businessUnit.list(withNameParam({ unit_type_id: BUSINESS_UNIT_TYPE_PROCESS }, keyword));
|
||||||
|
req.then((res) => {
|
||||||
|
if (seq !== this.unitSearchSeq) return;
|
||||||
|
const list = mapToSelectOptions(res);
|
||||||
|
if (empty) {
|
||||||
|
if (type === 'warehouse') this.warehouseOptions = list;
|
||||||
|
else this.processUnitOptions = list;
|
||||||
|
}
|
||||||
|
this.applyUnitSelectList(list, empty);
|
||||||
|
}).catch((e) => {
|
||||||
|
if (seq !== this.unitSearchSeq) return;
|
||||||
|
uni.showToast({ title: (e && e.message) || '搜索失败', icon: 'none' });
|
||||||
|
}).then(() => {
|
||||||
|
if (seq === this.unitSearchSeq) this.selectSearching = false;
|
||||||
|
}, () => {
|
||||||
|
if (seq === this.unitSearchSeq) this.selectSearching = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
openProcessUnitSelect() {
|
||||||
|
this.openUnitSelect('process');
|
||||||
|
},
|
||||||
|
openWarehouseSelect() {
|
||||||
|
this.openUnitSelect('warehouse');
|
||||||
|
},
|
||||||
|
onUnitConfirm(e) {
|
||||||
|
const item = e[0] || {};
|
||||||
|
if (this.unitSelectType === 'warehouse') {
|
||||||
|
this.filters.warehouse_id = item.value;
|
||||||
|
this.filters.warehouse_name = item.value ? item.label : '';
|
||||||
|
} else {
|
||||||
|
this.filters.process_unit_id = item.value;
|
||||||
|
this.filters.process_name = item.value ? item.label : '';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
loadList() {
|
||||||
|
if (this.listLoading) return;
|
||||||
|
this.listLoading = true;
|
||||||
|
const filters = this.appliedFilters || this.filters;
|
||||||
|
const params = {};
|
||||||
|
if (filters.order_no) params.order_no = filters.order_no;
|
||||||
|
if (filters.process_unit_id) params.supplier_id = filters.process_unit_id;
|
||||||
|
if (filters.warehouse_id) params.warehouse_id = filters.warehouse_id;
|
||||||
|
if (this.hasFilterValue(filters.audit_status)) {
|
||||||
|
params.audit_status = filters.audit_status;
|
||||||
|
}
|
||||||
|
fetchAllOrderList((p) => this.$u.api.fpmProcessReturnInOrder.list(p), params)
|
||||||
|
.then((rows) => {
|
||||||
|
this.list = rows.map(this.mapToCard);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
this.list = [];
|
||||||
|
uni.showToast({ title: err.message || '加载失败', icon: 'none' });
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.listLoading = false;
|
||||||
|
this.triggered = false;
|
||||||
|
// 避免并发请求下 uView 全局 loading 遮罩关不掉
|
||||||
|
uni.hideLoading();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
mapToCard(order) {
|
||||||
|
return {
|
||||||
|
id: order.id,
|
||||||
|
order_no: order.order_no || '',
|
||||||
|
process_unit_id: order.process_unit_id || order.biz_unit_id || '',
|
||||||
|
process_name: order.process_name || order.biz_unit_name || '',
|
||||||
|
warehouse_id: order.warehouse_id || '',
|
||||||
|
warehouse_name: order.warehouse_name || '',
|
||||||
|
create_user_name: order.creator_name || '',
|
||||||
|
create_time: order.create_time || '',
|
||||||
|
auditor_name: order.auditor_name || '',
|
||||||
|
audit_date: order.audit_time || '',
|
||||||
|
audit_status: order.audit_status,
|
||||||
|
audit_status_name: order.audit_status_name || AUDIT_STATUS_MAP[order.audit_status] || '',
|
||||||
|
total_roll: formatRoll(order.total_roll),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
onRefresh() {
|
||||||
|
this.triggered = true;
|
||||||
|
this.loadList();
|
||||||
|
},
|
||||||
|
goView(item) {
|
||||||
|
const page = Number(item.audit_status) === 1
|
||||||
|
? 'storeGoodsProcessReturnInEdit'
|
||||||
|
: 'storeGoodsProcessReturnInView';
|
||||||
|
uni.navigateTo({ url: `./${page}?id=${item.id}` });
|
||||||
|
},
|
||||||
|
openStatusSelect() { this.statusSelectShow = true; },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
@import '@/common/list-filter.scss';
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,607 @@
|
|||||||
|
/**
|
||||||
|
* 加工退货进仓单表单 mixin(新增/编辑共用)
|
||||||
|
*
|
||||||
|
* 1. 先填表头(加工单位 / 仓库 / 备注)提交 add,拿到 id 后可扫码
|
||||||
|
* 2. 先扫仓位(getWarehouseBin:传 qr_code + warehouse_id),校验后扫布匹二维码
|
||||||
|
* 3. 扫码走 updateFpmProcessReturnInOrder(arrange_type: 1 录入 / 3 删除,带 warehouse_bin_id)
|
||||||
|
* 4. 手机扫码成功展示详情后自动再次调起扫码,形成连续扫
|
||||||
|
*/
|
||||||
|
import util from '@/common/util';
|
||||||
|
import scanMixin from '@/common/scanMixin.js';
|
||||||
|
import PlusBarcodePanel from '@/components/common/PlusBarcodePanel.vue';
|
||||||
|
import remoteSelectMixin from '@/common/remoteSelectMixin.js';
|
||||||
|
import { withNameParam } from '@/common/remoteSelect';
|
||||||
|
import { initTts, speak } from '@/common/tts.js';
|
||||||
|
import {
|
||||||
|
AUDIT_STATUS_MAP,
|
||||||
|
ARRANGE_TYPE,
|
||||||
|
BUSINESS_UNIT_TYPE_PROCESS,
|
||||||
|
WAREHOUSE_TYPE_FINISHED,
|
||||||
|
IN_ORDER_TYPE_PROCESS_RETURN,
|
||||||
|
normalizeOrder,
|
||||||
|
mapToSelectOptions,
|
||||||
|
canScanAtStatus,
|
||||||
|
isLockedOrderStatus,
|
||||||
|
getFormStatusActionButtons,
|
||||||
|
orderToFormFields,
|
||||||
|
confirmOrderStatusAction,
|
||||||
|
DRAFT_AUDIT_STATUS,
|
||||||
|
DRAFT_AUDIT_STATUS_NAME,
|
||||||
|
getEmptyScanDetail,
|
||||||
|
buildScanDetailFromScanResponse,
|
||||||
|
buildScanUpdateParams,
|
||||||
|
pickDefaultWarehouse,
|
||||||
|
} from '@/common/storeGoodsProcessReturnIn';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: { PlusBarcodePanel },
|
||||||
|
mixins: [scanMixin, remoteSelectMixin],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
pageMode: 'add',
|
||||||
|
orderId: 0,
|
||||||
|
form: this.getEmptyForm(),
|
||||||
|
headerSaved: false,
|
||||||
|
headerCollapsed: false,
|
||||||
|
selectShow: false,
|
||||||
|
selectList: [],
|
||||||
|
selectType: '',
|
||||||
|
canScan: false,
|
||||||
|
QRBarCode: '',
|
||||||
|
BarCodeDelStatus: false,
|
||||||
|
BillDataMessage: '',
|
||||||
|
scanDetail: getEmptyScanDetail(),
|
||||||
|
auditStatus: 0,
|
||||||
|
processUnitOptions: [],
|
||||||
|
warehouseOptions: [],
|
||||||
|
dropdownLoading: false,
|
||||||
|
/** 仓位 */
|
||||||
|
warehouseBinId: 0,
|
||||||
|
warehouseBinCode: '',
|
||||||
|
warehouseBinName: '',
|
||||||
|
/** 手机连续扫码开关:成功后自动再调起;取消/失败则关闭 */
|
||||||
|
phoneContinuousScan: false,
|
||||||
|
/** 手机扫当前目标:bin | qr */
|
||||||
|
phoneScanTarget: 'bin',
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
isReadonly() {
|
||||||
|
return this.pageMode === 'view';
|
||||||
|
},
|
||||||
|
isEditable() {
|
||||||
|
return this.pageMode === 'add' || this.pageMode === 'edit';
|
||||||
|
},
|
||||||
|
headerEditable() {
|
||||||
|
return this.pageMode === 'add' && !this.headerSaved;
|
||||||
|
},
|
||||||
|
statusActionButtons() {
|
||||||
|
return getFormStatusActionButtons(this.headerSaved, this.orderId, this.auditStatus);
|
||||||
|
},
|
||||||
|
displayAuditStatus() {
|
||||||
|
if (this.pageMode === 'add' && !this.headerSaved) return DRAFT_AUDIT_STATUS;
|
||||||
|
return this.auditStatus;
|
||||||
|
},
|
||||||
|
displayAuditStatusName() {
|
||||||
|
if (this.pageMode === 'add' && !this.headerSaved) return DRAFT_AUDIT_STATUS_NAME;
|
||||||
|
return AUDIT_STATUS_MAP[this.auditStatus] || '';
|
||||||
|
},
|
||||||
|
/** 录入需先选仓位;删除模式仅需单据可扫 */
|
||||||
|
canScanQr() {
|
||||||
|
if (!this.canScan) return false;
|
||||||
|
if (this.BarCodeDelStatus) return true;
|
||||||
|
return !!this.warehouseBinId;
|
||||||
|
},
|
||||||
|
/** 扫码栏在可扫状态下始终展示(含删除勾选) */
|
||||||
|
showQrScanBar() {
|
||||||
|
return this.canScan;
|
||||||
|
},
|
||||||
|
qrDisabledTip() {
|
||||||
|
if (!this.canScan) return '请先提交保存后再扫码';
|
||||||
|
if (!this.warehouseBinId && !this.BarCodeDelStatus) return '请先扫描仓位后再扫布匹二维码';
|
||||||
|
return '当前状态不可扫码';
|
||||||
|
},
|
||||||
|
phoneScanHint() {
|
||||||
|
return this.phoneScanTarget === 'bin'
|
||||||
|
? '请扫描仓位,成功后自动扫布飞'
|
||||||
|
: '连续扫描布飞二维码,扫完可继续下一条';
|
||||||
|
},
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
this.isPageActive = true;
|
||||||
|
initTts();
|
||||||
|
if (this.canScan && this.isEditable) {
|
||||||
|
this.registerOrderScanBroadcast();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onHide() {
|
||||||
|
this.isPageActive = false;
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
this.unregisterScanBroadcast();
|
||||||
|
},
|
||||||
|
onUnload() {
|
||||||
|
this.isPageActive = false;
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
this.unregisterScanBroadcast();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
clearWarehouseBin() {
|
||||||
|
this.warehouseBinId = 0;
|
||||||
|
this.warehouseBinCode = '';
|
||||||
|
this.warehouseBinName = '';
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
this._phoneBinLocked = false;
|
||||||
|
this._pendingFabricCode = '';
|
||||||
|
if (this.phoneScanTarget === 'bin') this.closePhoneScanPanel();
|
||||||
|
},
|
||||||
|
/** 重扫仓位:先清空输入框再填入,避免残留旧码拼接 */
|
||||||
|
applyWarehouseBinScan(scanResult) {
|
||||||
|
const code = String(scanResult || '').trim().replace(/[\r\n]/g, '');
|
||||||
|
if (!code) return;
|
||||||
|
this.warehouseBinCode = '';
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.warehouseBinCode = code;
|
||||||
|
this.$nextTick(() => this.resolveWarehouseBin());
|
||||||
|
});
|
||||||
|
},
|
||||||
|
openHalfScreenScan(target) {
|
||||||
|
if (this.phoneScanPanelOpen && this.phoneScanTarget === target) {
|
||||||
|
this.closePhoneScanPanel();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
if (target === 'bin') this._phoneBinLocked = false;
|
||||||
|
this.phoneScanTarget = target;
|
||||||
|
this.phoneScanPanelOpen = true;
|
||||||
|
},
|
||||||
|
onPlusBarcodeSuccess(scanResult) {
|
||||||
|
const code = String(scanResult || '').trim().replace(/[\r\n]/g, '');
|
||||||
|
if (!code) return;
|
||||||
|
if (this.phoneScanTarget === 'bin') {
|
||||||
|
if (this._phoneBinLocked) {
|
||||||
|
if (!this.warehouseBinId) {
|
||||||
|
this._pendingFabricCode = code;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.phoneScanTarget = 'qr';
|
||||||
|
} else {
|
||||||
|
this._phoneBinLocked = true;
|
||||||
|
this._pendingFabricCode = '';
|
||||||
|
this.applyWarehouseBinScan(code);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.QRBarCode = code;
|
||||||
|
this.$nextTick(() => this.handleScan());
|
||||||
|
},
|
||||||
|
handleBinPhoneScan() {
|
||||||
|
if (!this.canScan || !this.orderId) {
|
||||||
|
this.showError('请先提交保存后再扫码');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.openHalfScreenScan('bin');
|
||||||
|
},
|
||||||
|
handlePhoneScan() {
|
||||||
|
if (!this.canScan || !this.orderId) {
|
||||||
|
this.showError('请先提交保存后再扫码');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 删除模式可直接扫布匹码;录入模式无仓位时先扫仓位
|
||||||
|
if (!this.BarCodeDelStatus && !this.warehouseBinId) {
|
||||||
|
this.handleBinPhoneScan();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.openHalfScreenScan('qr');
|
||||||
|
},
|
||||||
|
openContinuousPhoneScan() {
|
||||||
|
if (this.phoneScanPanelOpen) return;
|
||||||
|
if (!this.phoneContinuousScan || !this.canScanQr || !this.isPageActive) {
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.openPhoneScan({
|
||||||
|
callback: (scanResult) => {
|
||||||
|
this.QRBarCode = String(scanResult || '').trim().replace(/[\r\n]/g, '');
|
||||||
|
this.$nextTick(() => this.handleScan({ fromPhone: true }));
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
scheduleNextPhoneScan() {
|
||||||
|
if (this.phoneScanPanelOpen) return;
|
||||||
|
if (!this.phoneContinuousScan || !this.canScanQr || !this.isPageActive) {
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
this.openContinuousPhoneScan();
|
||||||
|
}, 400);
|
||||||
|
},
|
||||||
|
registerOrderScanBroadcast() {
|
||||||
|
this.registerScanBroadcast((scanResult) => {
|
||||||
|
const code = String(scanResult || '').trim().replace(/[\r\n]/g, '');
|
||||||
|
if (!code) return;
|
||||||
|
// 删除模式:直接按布匹码删除;未扫仓位时枪扫优先解析为仓位
|
||||||
|
if (!this.BarCodeDelStatus && !this.warehouseBinId) {
|
||||||
|
this.applyWarehouseBinScan(code);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.QRBarCode = code;
|
||||||
|
this.$nextTick(() => this.handleScan());
|
||||||
|
});
|
||||||
|
},
|
||||||
|
resolveWarehouseBin() {
|
||||||
|
const code = (this.warehouseBinCode || '').trim();
|
||||||
|
if (!this.canScan || !this.orderId) {
|
||||||
|
this.showError('请先提交保存后再扫码');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!code) return;
|
||||||
|
if (!this.form.warehouse_id) {
|
||||||
|
this.showError('单据缺少仓库信息');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uni.showLoading({ title: '识别仓位...' });
|
||||||
|
return this.$u.api.warehouseBin.getByQrCode({
|
||||||
|
qr_code: code,
|
||||||
|
warehouse_id: Number(this.form.warehouse_id),
|
||||||
|
})
|
||||||
|
.then((data) => {
|
||||||
|
uni.hideLoading();
|
||||||
|
if (!data || !data.id) {
|
||||||
|
throw new Error('未识别到仓位');
|
||||||
|
}
|
||||||
|
// 返回 physical_warehouse_id,与单据仓库校验
|
||||||
|
if (
|
||||||
|
data.physical_warehouse_id
|
||||||
|
&& String(data.physical_warehouse_id) !== String(this.form.warehouse_id)
|
||||||
|
) {
|
||||||
|
this.warehouseBinId = 0;
|
||||||
|
this.warehouseBinName = '';
|
||||||
|
throw new Error('该仓位不属于当前仓库');
|
||||||
|
}
|
||||||
|
this.warehouseBinId = data.id;
|
||||||
|
this.warehouseBinCode = data.code || data.qr_code || code;
|
||||||
|
this.warehouseBinName = data.name || '';
|
||||||
|
this.BillDataMessage = '';
|
||||||
|
speak('仓位成功');
|
||||||
|
uni.showToast({ title: '仓位识别成功', icon: 'success' });
|
||||||
|
if (this.phoneScanPanelOpen) this.phoneScanTarget = 'qr';
|
||||||
|
this._phoneBinLocked = false;
|
||||||
|
const pending = this._pendingFabricCode;
|
||||||
|
this._pendingFabricCode = '';
|
||||||
|
if (pending && this.phoneScanPanelOpen) {
|
||||||
|
this.QRBarCode = pending;
|
||||||
|
this.$nextTick(() => this.handleScan());
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
uni.hideLoading();
|
||||||
|
this._phoneBinLocked = false;
|
||||||
|
this._pendingFabricCode = '';
|
||||||
|
this.warehouseBinId = 0;
|
||||||
|
this.warehouseBinCode = '';
|
||||||
|
this.warehouseBinName = '';
|
||||||
|
this.showError(e.message || '仓位识别失败');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
syncCanScanFromStatus(status) {
|
||||||
|
const nextCanScan = this.isEditable && canScanAtStatus(status);
|
||||||
|
if (this.canScan && !nextCanScan) {
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
this.closePhoneScanPanel();
|
||||||
|
this.unregisterScanBroadcast();
|
||||||
|
}
|
||||||
|
this.canScan = nextCanScan;
|
||||||
|
},
|
||||||
|
loadBaseDropdowns() {
|
||||||
|
if (this.dropdownLoading) return Promise.resolve();
|
||||||
|
this.dropdownLoading = true;
|
||||||
|
return Promise.all([
|
||||||
|
this.ensureProcessUnitOptions().catch((e) => {
|
||||||
|
console.error('加载加工单位失败', e);
|
||||||
|
return [];
|
||||||
|
}),
|
||||||
|
this.ensureWarehouseOptions().catch((e) => {
|
||||||
|
console.error('加载仓库失败', e);
|
||||||
|
return [];
|
||||||
|
}),
|
||||||
|
]).finally(() => {
|
||||||
|
this.dropdownLoading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
ensureProcessUnitOptions() {
|
||||||
|
if (this.processUnitOptions.length) return Promise.resolve(this.processUnitOptions);
|
||||||
|
return this.$u.api.businessUnit.list({ unit_type_id: BUSINESS_UNIT_TYPE_PROCESS })
|
||||||
|
.then((res) => {
|
||||||
|
this.processUnitOptions = mapToSelectOptions(res);
|
||||||
|
return this.processUnitOptions;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
ensureWarehouseOptions() {
|
||||||
|
if (this.warehouseOptions.length) return Promise.resolve(this.warehouseOptions);
|
||||||
|
return this.$u.api.physicalWarehouse.getDropdownList({ warehouse_type_id: WAREHOUSE_TYPE_FINISHED })
|
||||||
|
.then((res) => {
|
||||||
|
this.warehouseOptions = mapToSelectOptions(res);
|
||||||
|
if (this.headerEditable && !this.form.warehouse_id) {
|
||||||
|
this.applyDefaultWarehouse();
|
||||||
|
}
|
||||||
|
return this.warehouseOptions;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
fetchRemoteSelectOptions(type, keyword) {
|
||||||
|
const empty = !String(keyword || '').trim();
|
||||||
|
if (type === '加工单位') {
|
||||||
|
return this.$u.api.businessUnit.list(withNameParam({ unit_type_id: BUSINESS_UNIT_TYPE_PROCESS }, keyword))
|
||||||
|
.then((res) => {
|
||||||
|
const list = mapToSelectOptions(res);
|
||||||
|
if (empty) this.processUnitOptions = list;
|
||||||
|
return list;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (type === '仓库名称') {
|
||||||
|
return this.$u.api.physicalWarehouse.getDropdownList(withNameParam({ warehouse_type_id: WAREHOUSE_TYPE_FINISHED }, keyword))
|
||||||
|
.then((res) => {
|
||||||
|
const list = mapToSelectOptions(res);
|
||||||
|
if (empty) this.warehouseOptions = list;
|
||||||
|
return list;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return Promise.resolve([]);
|
||||||
|
},
|
||||||
|
applyDefaultWarehouse() {
|
||||||
|
const app = getApp();
|
||||||
|
const picked = pickDefaultWarehouse(
|
||||||
|
this.warehouseOptions,
|
||||||
|
app && app.globalData ? app.globalData.StoreNameID : '',
|
||||||
|
app && app.globalData ? app.globalData.StoreName : '',
|
||||||
|
);
|
||||||
|
if (!picked) return;
|
||||||
|
this.form.warehouse_id = picked.value;
|
||||||
|
this.form.warehouse_name = picked.label;
|
||||||
|
},
|
||||||
|
getEmptyForm() {
|
||||||
|
return {
|
||||||
|
order_no: '',
|
||||||
|
process_unit_id: '',
|
||||||
|
process_name: '',
|
||||||
|
warehouse_id: '',
|
||||||
|
warehouse_name: '',
|
||||||
|
remark: '',
|
||||||
|
item_data: [],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
loadOrder(id, options = {}) {
|
||||||
|
const { rejectIfLocked = false } = options;
|
||||||
|
return this.$u.api.fpmProcessReturnInOrder.detail({ id })
|
||||||
|
.then((res) => {
|
||||||
|
const order = normalizeOrder(res);
|
||||||
|
if (!order) {
|
||||||
|
this.showError('单据不存在');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (rejectIfLocked && isLockedOrderStatus(order.audit_status)) {
|
||||||
|
this.showError('当前状态不可编辑');
|
||||||
|
setTimeout(() => uni.navigateBack(), 1500);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
this.orderId = order.id;
|
||||||
|
this.auditStatus = order.audit_status;
|
||||||
|
this.headerSaved = true;
|
||||||
|
this.headerCollapsed = true;
|
||||||
|
this.form = orderToFormFields(order);
|
||||||
|
this.clearWarehouseBin();
|
||||||
|
this.syncCanScanFromStatus(order.audit_status);
|
||||||
|
if (this.canScan) this.registerOrderScanBroadcast();
|
||||||
|
return order;
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
this.showError(e.message || '加载单据失败');
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
pickerSelectFun(type) {
|
||||||
|
if (!this.headerEditable) return;
|
||||||
|
const cache = {
|
||||||
|
'加工单位': this.processUnitOptions,
|
||||||
|
'仓库名称': this.warehouseOptions,
|
||||||
|
};
|
||||||
|
if (cache[type]) this.openSelectPicker(type, cache[type]);
|
||||||
|
},
|
||||||
|
selectConfirmFun(e) {
|
||||||
|
const item = e[0];
|
||||||
|
if (this.selectType === '加工单位') {
|
||||||
|
this.form.process_unit_id = item.value;
|
||||||
|
this.form.process_name = item.label;
|
||||||
|
} else if (this.selectType === '仓库名称') {
|
||||||
|
this.form.warehouse_id = item.value;
|
||||||
|
this.form.warehouse_name = item.label;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
validateForm() {
|
||||||
|
if (!this.form.process_unit_id) return '请选择加工单位';
|
||||||
|
if (!this.form.warehouse_id) return '请选择仓库名称';
|
||||||
|
const app = getApp();
|
||||||
|
const saleSystemId = app && app.globalData ? app.globalData.PlanDepartmentID : '';
|
||||||
|
if (!saleSystemId) return '缺少营销体系,请重新登录';
|
||||||
|
return '';
|
||||||
|
},
|
||||||
|
buildAddParam() {
|
||||||
|
const app = getApp();
|
||||||
|
return {
|
||||||
|
inOrderType: IN_ORDER_TYPE_PROCESS_RETURN,
|
||||||
|
biz_unit_id: Number(this.form.process_unit_id),
|
||||||
|
warehouse_id: Number(this.form.warehouse_id),
|
||||||
|
sale_system_id: Number(app.globalData.PlanDepartmentID),
|
||||||
|
remark: this.form.remark || '',
|
||||||
|
item_data: [],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
submitSave() {
|
||||||
|
if (this.headerSaved) {
|
||||||
|
this.showError('表头已保存,请直接扫码');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const err = this.validateForm();
|
||||||
|
if (err) {
|
||||||
|
this.showError(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uni.showLoading({ title: '保存中...' });
|
||||||
|
this.$u.api.fpmProcessReturnInOrder.add(this.buildAddParam())
|
||||||
|
.then((res) => {
|
||||||
|
this.orderId = (res && res.id) || 0;
|
||||||
|
if (!this.orderId) {
|
||||||
|
throw new Error('保存失败,未返回单据ID');
|
||||||
|
}
|
||||||
|
return this.$u.api.fpmProcessReturnInOrder.detail({ id: this.orderId });
|
||||||
|
})
|
||||||
|
.then((detail) => {
|
||||||
|
uni.hideLoading();
|
||||||
|
const order = normalizeOrder(detail);
|
||||||
|
this.applyOrder(order);
|
||||||
|
this.headerSaved = true;
|
||||||
|
this.headerCollapsed = true;
|
||||||
|
this.clearWarehouseBin();
|
||||||
|
this.syncCanScanFromStatus(order.audit_status);
|
||||||
|
this.showSuccess('保存成功,请先扫描仓位', '保存成功', { voiceOnly: true });
|
||||||
|
this.registerOrderScanBroadcast();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
uni.hideLoading();
|
||||||
|
this.showError(e.message || '保存失败');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
applyOrder(order) {
|
||||||
|
if (!order) return;
|
||||||
|
this.auditStatus = order.audit_status;
|
||||||
|
Object.assign(this.form, orderToFormFields(order));
|
||||||
|
},
|
||||||
|
handleScan(options = {}) {
|
||||||
|
const fromPhone = !!options.fromPhone;
|
||||||
|
const code = (this.QRBarCode || '').trim();
|
||||||
|
if (!this.canScan || !this.orderId) {
|
||||||
|
this.showError('请先提交保存后再扫码');
|
||||||
|
this.QRBarCode = '';
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const isDelete = this.BarCodeDelStatus;
|
||||||
|
if (!isDelete && !this.warehouseBinId) {
|
||||||
|
this.showError('请先扫描仓位');
|
||||||
|
this.QRBarCode = '';
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!code) {
|
||||||
|
this.QRBarCode = '';
|
||||||
|
if (fromPhone) this.scheduleNextPhoneScan();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const arrangeType = isDelete ? ARRANGE_TYPE.DEL : ARRANGE_TYPE.IN;
|
||||||
|
this.doScanUpdate(code, arrangeType, { fromPhone });
|
||||||
|
},
|
||||||
|
BarCodeDelChange(e) {
|
||||||
|
this.BarCodeDelStatus = (e.detail.value || []).length > 0;
|
||||||
|
this.BillDataMessage = this.BarCodeDelStatus ? '删除模式:扫描细码即可删除' : '';
|
||||||
|
},
|
||||||
|
getFineCodeScanCode(fineCode) {
|
||||||
|
if (!fineCode) return '';
|
||||||
|
return fineCode.qr_code || fineCode.scan_code || fineCode.bar_code || '';
|
||||||
|
},
|
||||||
|
onDeleteFineCode(fineCode) {
|
||||||
|
if (!this.canScan || !this.orderId) {
|
||||||
|
this.showError('当前状态不可删除');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const scanCode = this.getFineCodeScanCode(fineCode);
|
||||||
|
if (!scanCode) {
|
||||||
|
this.showError('该细码缺少条码,无法删除');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: `确认删除细码 ${scanCode}?`,
|
||||||
|
success: (res) => {
|
||||||
|
if (!res.confirm) return;
|
||||||
|
this.doScanUpdate(scanCode, ARRANGE_TYPE.DEL);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
doScanUpdate(scanCode, arrangeType, options = {}) {
|
||||||
|
const { fromPhone = false } = options;
|
||||||
|
const isDelete = arrangeType === ARRANGE_TYPE.DEL;
|
||||||
|
uni.showLoading({ title: isDelete ? '删除中...' : '处理中...' });
|
||||||
|
return this.$u.api.fpmProcessReturnInOrder.scanUpdate(buildScanUpdateParams({
|
||||||
|
id: this.orderId,
|
||||||
|
scanCode,
|
||||||
|
arrangeType,
|
||||||
|
// 删除不强制仓位;录入带当前仓位
|
||||||
|
warehouseBinId: isDelete ? 0 : this.warehouseBinId,
|
||||||
|
}))
|
||||||
|
.then((scanRes) => {
|
||||||
|
this.scanDetail = buildScanDetailFromScanResponse(scanRes);
|
||||||
|
this.BillDataMessage = isDelete ? '删除成功' : '扫描成功';
|
||||||
|
this.QRBarCode = '';
|
||||||
|
if (isDelete) {
|
||||||
|
speak('已删除');
|
||||||
|
uni.showToast({ title: '删除成功', icon: 'success' });
|
||||||
|
} else {
|
||||||
|
speak('成功');
|
||||||
|
}
|
||||||
|
return this.$u.api.fpmProcessReturnInOrder.detail({ id: this.orderId })
|
||||||
|
.then((detail) => {
|
||||||
|
const order = normalizeOrder(detail);
|
||||||
|
if (order) {
|
||||||
|
this.form.item_data = order.item_data;
|
||||||
|
this.auditStatus = order.audit_status;
|
||||||
|
// 本单匹数/本单数量:取这张单的总匹数、总数量
|
||||||
|
this.scanDetail = {
|
||||||
|
...this.scanDetail,
|
||||||
|
order_roll: order.total_roll,
|
||||||
|
order_weight: order.total_weight,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => null);
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
uni.hideLoading();
|
||||||
|
if (fromPhone) this.scheduleNextPhoneScan();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
uni.hideLoading();
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
const message = e.message || (isDelete ? '删除失败' : '扫码失败');
|
||||||
|
speak(isDelete ? '删除失败' : '扫码失败');
|
||||||
|
uni.showToast({ title: message, icon: 'none', duration: 2500 });
|
||||||
|
this.QRBarCode = '';
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleStatusAction(action) {
|
||||||
|
confirmOrderStatusAction(this, {
|
||||||
|
orderId: this.orderId,
|
||||||
|
action,
|
||||||
|
onSuccess: () => this.$u.api.fpmProcessReturnInOrder.detail({ id: this.orderId })
|
||||||
|
.then((detail) => {
|
||||||
|
uni.hideLoading();
|
||||||
|
const order = normalizeOrder(detail);
|
||||||
|
if (!order) return;
|
||||||
|
this.applyOrder(order);
|
||||||
|
this.syncCanScanFromStatus(order.audit_status);
|
||||||
|
this.showSuccess(util.statusSuccessVoice(action));
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
},
|
||||||
|
showError(message) {
|
||||||
|
util.playErrorAudio(message);
|
||||||
|
uni.showModal({ title: '提示', content: message, showCancel: false });
|
||||||
|
},
|
||||||
|
showSuccess(message, voiceText, options) {
|
||||||
|
util.playSuccessAudio(voiceText || message, options);
|
||||||
|
uni.showToast({ title: message, icon: 'success' });
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -0,0 +1,135 @@
|
|||||||
|
<template>
|
||||||
|
<view class="fabric-out-page">
|
||||||
|
<OrderHeaderFold v-model="headerCollapsed" :summary="order.order_no">
|
||||||
|
<OrderStatusBar class="fabric-out-mt32" :status="order.audit_status" :name="order.audit_status_name" />
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">进仓类型</text>
|
||||||
|
<text>{{ order.in_order_type_name || '加工退货进仓单' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">加工单位</text>
|
||||||
|
<text>{{ order.process_name || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">仓库名称</text>
|
||||||
|
<text>{{ order.warehouse_name || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">单据备注</text>
|
||||||
|
<text>{{ order.remark || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">创建人</text>
|
||||||
|
<text>{{ order.creator_name }} {{ formatTime(order.create_time, 'YYYY-MM-DD') }}</text>
|
||||||
|
</view>
|
||||||
|
<view v-if="order.auditor_name" class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">审核人</text>
|
||||||
|
<text>{{ order.auditor_name }} {{ formatTime(order.audit_time, 'YYYY-MM-DD') }}</text>
|
||||||
|
</view>
|
||||||
|
</OrderHeaderFold>
|
||||||
|
|
||||||
|
<ProcessInDetailList
|
||||||
|
:title="detailTitle"
|
||||||
|
:list="order.item_data"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<FabricOutFooter :buttons="actionButtons" @action="handleAction" />
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import util from '@/common/util';
|
||||||
|
import OrderStatusBar from '@/components/storefabric/OrderStatusBar.vue';
|
||||||
|
import OrderHeaderFold from '@/components/storefabric/OrderHeaderFold.vue';
|
||||||
|
import FabricOutFooter from '@/components/storefabric/FabricOutFooter.vue';
|
||||||
|
import ProcessInDetailList from '@/components/storegoods/ProcessInDetailList.vue';
|
||||||
|
import {
|
||||||
|
normalizeOrder,
|
||||||
|
getViewStatusActionButtons,
|
||||||
|
confirmOrderStatusAction,
|
||||||
|
formatDisplayTime,
|
||||||
|
} from '@/common/storeGoodsProcessReturnIn';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: { OrderStatusBar, OrderHeaderFold, FabricOutFooter, ProcessInDetailList },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
orderId: 0,
|
||||||
|
headerCollapsed: true,
|
||||||
|
order: { item_data: [] },
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
actionButtons() {
|
||||||
|
return getViewStatusActionButtons(this.order.audit_status);
|
||||||
|
},
|
||||||
|
detailTitle() {
|
||||||
|
return `进仓明细(共 ${this.order.total_roll || 0} 匹)`;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
onLoad(e) {
|
||||||
|
uni.setNavigationBarTitle({ title: '查看加工退货进仓单' });
|
||||||
|
if (e.id) {
|
||||||
|
this.orderId = Number(e.id);
|
||||||
|
this.refreshOrder();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
if (this.orderId) this.refreshOrder();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
formatTime: formatDisplayTime,
|
||||||
|
refreshOrder() {
|
||||||
|
this.$u.api.fpmProcessReturnInOrder.detail({ id: this.orderId })
|
||||||
|
.then((res) => {
|
||||||
|
const order = normalizeOrder(res);
|
||||||
|
if (!order) {
|
||||||
|
this.showError('单据不存在');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.order = order;
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
this.showError(err.message || '加载单据失败');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleAction(action) {
|
||||||
|
if (action === 'edit') {
|
||||||
|
uni.navigateTo({ url: `./storeGoodsProcessReturnInEdit?id=${this.orderId}` });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
confirmOrderStatusAction(this, {
|
||||||
|
orderId: this.orderId,
|
||||||
|
action,
|
||||||
|
onSuccess: () => {
|
||||||
|
uni.hideLoading();
|
||||||
|
const voice = util.statusSuccessVoice(action);
|
||||||
|
util.playSuccessAudio(voice);
|
||||||
|
uni.showToast({ title: voice, icon: 'success' });
|
||||||
|
if (action === 'unapprove') {
|
||||||
|
uni.redirectTo({ url: `./storeGoodsProcessReturnInEdit?id=${this.orderId}` });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return this.$u.api.fpmProcessReturnInOrder.detail({ id: this.orderId })
|
||||||
|
.then((res) => {
|
||||||
|
const order = normalizeOrder(res);
|
||||||
|
if (order) this.order = order;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
showError(message) {
|
||||||
|
util.playErrorAudio(message);
|
||||||
|
uni.showModal({ title: '提示', content: message, showCancel: false });
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
@import '@/pages/storefabric/storeFabricBusinessOutPage.scss';
|
||||||
|
page {
|
||||||
|
background-color: #F8F8F8;
|
||||||
|
padding-bottom: 260rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,176 @@
|
|||||||
|
<template>
|
||||||
|
<view class="fabric-out-page">
|
||||||
|
<OrderHeaderFold v-model="headerCollapsed" :summary="form.order_no || '保存后自动生成'">
|
||||||
|
<OrderStatusBar class="fabric-out-mt32" :status="displayAuditStatus" :name="displayAuditStatusName" />
|
||||||
|
<view @click="pickerSelectFun('供应商')" class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">供应商<text class="redXingh">*</text></text>
|
||||||
|
<view :class="form.biz_unit_name ? '' : 'cBlack'">
|
||||||
|
{{ form.biz_unit_name || '请选择' }}
|
||||||
|
<u-icon v-if="headerEditable" class="ml26" name="arrow-right" size="40" color="#888888"></u-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view @click="pickerSelectFun('仓库名称')" class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">仓库名称<text class="redXingh">*</text></text>
|
||||||
|
<view :class="form.warehouse_name ? '' : 'cBlack'">
|
||||||
|
{{ form.warehouse_name || '请选择' }}
|
||||||
|
<u-icon v-if="headerEditable" class="ml26" name="arrow-right" size="40" color="#888888"></u-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26 ptb10 bdb_f5 process-in-weight-row">
|
||||||
|
<view class="process-in-weight-col">
|
||||||
|
<text class="mr16">纸筒重量</text>
|
||||||
|
<u-input
|
||||||
|
v-model="form.paper_tube_weight"
|
||||||
|
type="digit"
|
||||||
|
:disabled="!canEditWeights"
|
||||||
|
placeholder="1.5"
|
||||||
|
:custom-style="weightInputStyle"
|
||||||
|
placeholder-style="color: #c0c4cc; font-size: 36rpx;"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
<view class="process-in-weight-col">
|
||||||
|
<text class="mr16">包装重量</text>
|
||||||
|
<u-input
|
||||||
|
v-model="form.package_weight"
|
||||||
|
type="digit"
|
||||||
|
:disabled="!canEditWeights"
|
||||||
|
placeholder="0.3"
|
||||||
|
:custom-style="weightInputStyle"
|
||||||
|
placeholder-style="color: #c0c4cc; font-size: 36rpx;"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view @click="pickerSelectFun('营销体系')" class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">营销体系<text class="redXingh">*</text></text>
|
||||||
|
<view :class="form.sale_system_name ? '' : 'cBlack'">
|
||||||
|
{{ form.sale_system_name || '请选择' }}
|
||||||
|
<u-icon v-if="headerEditable" class="ml26" name="arrow-right" size="40" color="#888888"></u-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view @click="pickerSelectFun('订单类型')" class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">订单类型<text class="redXingh">*</text></text>
|
||||||
|
<view :class="form.sale_mode_name ? '' : 'cBlack'">
|
||||||
|
{{ form.sale_mode_name || '请选择' }}
|
||||||
|
<u-icon v-if="headerEditable" class="ml26" name="arrow-right" size="40" color="#888888"></u-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26-column ptb20 mt32">
|
||||||
|
<view style="margin-bottom: 8rpx;"><text>单据备注</text></view>
|
||||||
|
<u-input v-model="form.remark" :disabled="!headerEditable" type="textarea" :border="true" :height="100" :auto-height="true" />
|
||||||
|
</view>
|
||||||
|
</OrderHeaderFold>
|
||||||
|
|
||||||
|
<PlusBarcodePanel
|
||||||
|
:visible.sync="phoneScanPanelOpen"
|
||||||
|
:hint-text="phoneScanHint"
|
||||||
|
:scan-time-space="1200"
|
||||||
|
@success="onPlusBarcodeSuccess"
|
||||||
|
/>
|
||||||
|
<ProcessInBinBar
|
||||||
|
:can-scan="canScan"
|
||||||
|
:bin-id="warehouseBinId"
|
||||||
|
:code="warehouseBinCode"
|
||||||
|
:name="warehouseBinName"
|
||||||
|
:show-phone-scan="canScan"
|
||||||
|
:scanning="phoneScanPanelOpen && phoneScanTarget === 'bin'"
|
||||||
|
@code-input="warehouseBinCode = $event"
|
||||||
|
@confirm="resolveWarehouseBin"
|
||||||
|
@phone-scan="handleBinPhoneScan"
|
||||||
|
@clear="clearWarehouseBin"
|
||||||
|
/>
|
||||||
|
<FabricOutScanBar
|
||||||
|
:can-scan="showQrScanBar"
|
||||||
|
:value="QRBarCode"
|
||||||
|
:delete-mode="BarCodeDelStatus"
|
||||||
|
:message="BillDataMessage"
|
||||||
|
:disabled-tip="qrDisabledTip"
|
||||||
|
:show-phone-scan="canScanQr"
|
||||||
|
:scanning="phoneScanPanelOpen && phoneScanTarget === 'qr'"
|
||||||
|
@input="QRBarCode = $event"
|
||||||
|
@scan="handleScan"
|
||||||
|
@phone-scan="handlePhoneScan"
|
||||||
|
@delete-mode-change="BarCodeDelChange"
|
||||||
|
/>
|
||||||
|
<ProcessInScanDetail :detail="scanDetail" />
|
||||||
|
|
||||||
|
<ProcessInDetailList
|
||||||
|
:list="form.item_data"
|
||||||
|
:deletable="canScan"
|
||||||
|
show-tare-columns
|
||||||
|
@delete="onDeleteFineCode"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<FabricOutFooter
|
||||||
|
v-if="!headerSaved"
|
||||||
|
:buttons="[{ label: '提交保存', action: 'save' }]"
|
||||||
|
single
|
||||||
|
@action="submitSave"
|
||||||
|
/>
|
||||||
|
<FabricOutFooter
|
||||||
|
v-else
|
||||||
|
:buttons="statusActionButtons"
|
||||||
|
@action="handleStatusAction"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<u-select v-model="selectShow" :list="selectList" :remote="isRemoteSelect" :loading="selectSearching" @search="onSelectSearch" @confirm="selectConfirmFun"></u-select>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import formMixin from './storeGoodsPurchaseInMixin.js';
|
||||||
|
import OrderStatusBar from '@/components/storefabric/OrderStatusBar.vue';
|
||||||
|
import OrderHeaderFold from '@/components/storefabric/OrderHeaderFold.vue';
|
||||||
|
import FabricOutScanBar from '@/components/storefabric/FabricOutScanBar.vue';
|
||||||
|
import FabricOutFooter from '@/components/storefabric/FabricOutFooter.vue';
|
||||||
|
import ProcessInScanDetail from '@/components/storegoods/ProcessInScanDetail.vue';
|
||||||
|
import ProcessInDetailList from '@/components/storegoods/ProcessInDetailList.vue';
|
||||||
|
import ProcessInBinBar from '@/components/storegoods/ProcessInBinBar.vue';
|
||||||
|
import PlusBarcodePanel from '@/components/common/PlusBarcodePanel.vue';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
PlusBarcodePanel,
|
||||||
|
OrderStatusBar,
|
||||||
|
OrderHeaderFold,
|
||||||
|
FabricOutScanBar,
|
||||||
|
FabricOutFooter,
|
||||||
|
ProcessInScanDetail,
|
||||||
|
ProcessInDetailList,
|
||||||
|
ProcessInBinBar,
|
||||||
|
},
|
||||||
|
mixins: [formMixin],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
weightInputStyle: {
|
||||||
|
fontSize: '36rpx',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
uni.setNavigationBarTitle({ title: '新增采购进仓单' });
|
||||||
|
this.pageMode = 'add';
|
||||||
|
this.loadBaseDropdowns();
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
@import '@/pages/storefabric/storeFabricBusinessOutPage.scss';
|
||||||
|
page {
|
||||||
|
background-color: #F8F8F8;
|
||||||
|
padding-bottom: 260rpx;
|
||||||
|
}
|
||||||
|
.process-in-weight-row {
|
||||||
|
gap: 20rpx;
|
||||||
|
}
|
||||||
|
.process-in-weight-col {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
min-width: 0;
|
||||||
|
|
||||||
|
::v-deep .u-input__input {
|
||||||
|
font-size: 36rpx !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,157 @@
|
|||||||
|
<template>
|
||||||
|
<view class="fabric-out-page">
|
||||||
|
<OrderHeaderFold v-model="headerCollapsed" :summary="form.order_no">
|
||||||
|
<OrderStatusBar class="fabric-out-mt32" :status="displayAuditStatus" :name="displayAuditStatusName" />
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">供应商</text>
|
||||||
|
<text>{{ form.biz_unit_name || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">仓库名称</text>
|
||||||
|
<text>{{ form.warehouse_name || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26 ptb10 bdb_f5 process-in-weight-row">
|
||||||
|
<view class="process-in-weight-col">
|
||||||
|
<text class="mr16">纸筒重量</text>
|
||||||
|
<u-input
|
||||||
|
v-model="form.paper_tube_weight"
|
||||||
|
type="digit"
|
||||||
|
:disabled="!canEditWeights"
|
||||||
|
placeholder="1.5"
|
||||||
|
:custom-style="weightInputStyle"
|
||||||
|
placeholder-style="color: #c0c4cc; font-size: 36rpx;"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
<view class="process-in-weight-col">
|
||||||
|
<text class="mr16">包装重量</text>
|
||||||
|
<u-input
|
||||||
|
v-model="form.package_weight"
|
||||||
|
type="digit"
|
||||||
|
:disabled="!canEditWeights"
|
||||||
|
placeholder="0.3"
|
||||||
|
:custom-style="weightInputStyle"
|
||||||
|
placeholder-style="color: #c0c4cc; font-size: 36rpx;"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">营销体系</text>
|
||||||
|
<text>{{ form.sale_system_name || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">订单类型</text>
|
||||||
|
<text>{{ form.sale_mode_name || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">单据备注</text>
|
||||||
|
<text>{{ form.remark || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
</OrderHeaderFold>
|
||||||
|
|
||||||
|
<PlusBarcodePanel
|
||||||
|
:visible.sync="phoneScanPanelOpen"
|
||||||
|
:hint-text="phoneScanHint"
|
||||||
|
:scan-time-space="1200"
|
||||||
|
@success="onPlusBarcodeSuccess"
|
||||||
|
/>
|
||||||
|
<ProcessInBinBar
|
||||||
|
:can-scan="canScan"
|
||||||
|
:bin-id="warehouseBinId"
|
||||||
|
:code="warehouseBinCode"
|
||||||
|
:name="warehouseBinName"
|
||||||
|
:show-phone-scan="canScan"
|
||||||
|
:scanning="phoneScanPanelOpen && phoneScanTarget === 'bin'"
|
||||||
|
@code-input="warehouseBinCode = $event"
|
||||||
|
@confirm="resolveWarehouseBin"
|
||||||
|
@phone-scan="handleBinPhoneScan"
|
||||||
|
@clear="clearWarehouseBin"
|
||||||
|
/>
|
||||||
|
<FabricOutScanBar
|
||||||
|
:can-scan="showQrScanBar"
|
||||||
|
:value="QRBarCode"
|
||||||
|
:delete-mode="BarCodeDelStatus"
|
||||||
|
:message="BillDataMessage"
|
||||||
|
:disabled-tip="qrDisabledTip"
|
||||||
|
:show-phone-scan="canScanQr"
|
||||||
|
:scanning="phoneScanPanelOpen && phoneScanTarget === 'qr'"
|
||||||
|
@input="QRBarCode = $event"
|
||||||
|
@scan="handleScan"
|
||||||
|
@phone-scan="handlePhoneScan"
|
||||||
|
@delete-mode-change="BarCodeDelChange"
|
||||||
|
/>
|
||||||
|
<ProcessInScanDetail :detail="scanDetail" />
|
||||||
|
|
||||||
|
<ProcessInDetailList
|
||||||
|
:list="form.item_data"
|
||||||
|
:deletable="canScan"
|
||||||
|
show-tare-columns
|
||||||
|
@delete="onDeleteFineCode"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<FabricOutFooter :buttons="statusActionButtons" @action="handleStatusAction" />
|
||||||
|
|
||||||
|
<u-select v-model="selectShow" :list="selectList" :remote="isRemoteSelect" :loading="selectSearching" @search="onSelectSearch" @confirm="selectConfirmFun"></u-select>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import formMixin from './storeGoodsPurchaseInMixin.js';
|
||||||
|
import OrderStatusBar from '@/components/storefabric/OrderStatusBar.vue';
|
||||||
|
import OrderHeaderFold from '@/components/storefabric/OrderHeaderFold.vue';
|
||||||
|
import FabricOutScanBar from '@/components/storefabric/FabricOutScanBar.vue';
|
||||||
|
import FabricOutFooter from '@/components/storefabric/FabricOutFooter.vue';
|
||||||
|
import ProcessInScanDetail from '@/components/storegoods/ProcessInScanDetail.vue';
|
||||||
|
import ProcessInDetailList from '@/components/storegoods/ProcessInDetailList.vue';
|
||||||
|
import ProcessInBinBar from '@/components/storegoods/ProcessInBinBar.vue';
|
||||||
|
import PlusBarcodePanel from '@/components/common/PlusBarcodePanel.vue';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
PlusBarcodePanel,
|
||||||
|
OrderStatusBar,
|
||||||
|
OrderHeaderFold,
|
||||||
|
FabricOutScanBar,
|
||||||
|
FabricOutFooter,
|
||||||
|
ProcessInScanDetail,
|
||||||
|
ProcessInDetailList,
|
||||||
|
ProcessInBinBar,
|
||||||
|
},
|
||||||
|
mixins: [formMixin],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
headerCollapsed: true,
|
||||||
|
weightInputStyle: {
|
||||||
|
fontSize: '36rpx',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
onLoad(e) {
|
||||||
|
uni.setNavigationBarTitle({ title: '编辑采购进仓单' });
|
||||||
|
this.pageMode = 'edit';
|
||||||
|
if (e.id) {
|
||||||
|
this.loadOrder(Number(e.id), { rejectIfLocked: true });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
@import '@/pages/storefabric/storeFabricBusinessOutPage.scss';
|
||||||
|
page {
|
||||||
|
background-color: #F8F8F8;
|
||||||
|
padding-bottom: 260rpx;
|
||||||
|
}
|
||||||
|
.process-in-weight-row {
|
||||||
|
gap: 20rpx;
|
||||||
|
}
|
||||||
|
.process-in-weight-col {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
min-width: 0;
|
||||||
|
|
||||||
|
::v-deep .u-input__input {
|
||||||
|
font-size: 36rpx !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,275 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<view class="filterBar">
|
||||||
|
<u-search v-model="filters.order_no" placeholder="进仓单号" :show-action="false" @search="applySearch" @custom="applySearch" @clear="applySearch" />
|
||||||
|
<view class="filterBtn" :class="{ 'filter-active': hasActiveFilter }" @click="filterShow = true">
|
||||||
|
<view class="filterBtn__icon">
|
||||||
|
<u-icon :key="filterIconColor" name="list" size="44" :color="filterIconColor"></u-icon>
|
||||||
|
<view v-if="hasActiveFilter" class="filterBtn__badge"></view>
|
||||||
|
</view>
|
||||||
|
<text>筛选</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<scroll-view scroll-y :style="{ height: scrollHeight }" refresher-enabled
|
||||||
|
:refresher-triggered="triggered" @refresherrefresh="onRefresh">
|
||||||
|
<dataNull v-if="list.length === 0" src="/src/static/img/chahua/gjNull.png"
|
||||||
|
title="暂无采购进仓单" title1="请点击右下角按钮新增">
|
||||||
|
</dataNull>
|
||||||
|
<view v-for="(item, index) in list" :key="item.id" @click="goView(item)">
|
||||||
|
<PurchaseInItem :item="item" :index="index" />
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
|
||||||
|
<addBtn url="./storeGoodsPurchaseInAdd"></addBtn>
|
||||||
|
|
||||||
|
<u-popup v-model="filterShow" mode="right" width="580rpx" :safe-area-inset-bottom="true" @close="cancelFilterEdit">
|
||||||
|
<view class="filterPanel">
|
||||||
|
<view class="filterTitle">筛选条件</view>
|
||||||
|
<view class="filterItem">
|
||||||
|
<text class="filterLabel">进仓单号</text>
|
||||||
|
<view class="filterInput">
|
||||||
|
<u-input v-model="filters.order_no" placeholder="请输入进仓单号" :height="100" :custom-style="{ fontSize: '36rpx', color: '#202328' }" placeholder-style="color: #aeb4bf; font-size: 34rpx;" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="filterItem" @click="openSupplierSelect">
|
||||||
|
<text class="filterLabel">供应商</text>
|
||||||
|
<view class="filterValue">{{ supplierLabel || '全部' }} <u-icon name="arrow-right" size="36"></u-icon></view>
|
||||||
|
</view>
|
||||||
|
<view class="filterItem" @click="openWarehouseSelect">
|
||||||
|
<text class="filterLabel">仓库</text>
|
||||||
|
<view class="filterValue">{{ warehouseLabel || '全部' }} <u-icon name="arrow-right" size="36"></u-icon></view>
|
||||||
|
</view>
|
||||||
|
<view class="filterItem" @click="openStatusSelect">
|
||||||
|
<text class="filterLabel">订单状态</text>
|
||||||
|
<view class="filterValue">{{ statusLabel || '全部' }} <u-icon name="arrow-right" size="36"></u-icon></view>
|
||||||
|
</view>
|
||||||
|
<view class="filterActions">
|
||||||
|
<u-button type="warning" size="medium" @click="resetFilter">重置</u-button>
|
||||||
|
<u-button type="primary" size="medium" @click="applyFilter">确定</u-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
|
|
||||||
|
<u-select class="pdaSelect" v-model="statusSelectShow" title="选择订单状态" :list="statusSelectList" :default-value="statusSelectDefault" @confirm="onStatusConfirm"></u-select>
|
||||||
|
<u-select class="pdaSelect" v-model="unitSelectShow" :list="unitSelectList" :default-value="unitSelectDefault" remote :loading="selectSearching" @search="onUnitSearch" @confirm="onUnitConfirm"></u-select>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import addBtn from '@/components/addBtn/addBtn.vue';
|
||||||
|
import PurchaseInItem from '@/components/card/storeGoodsPurchaseInItem.vue';
|
||||||
|
import {
|
||||||
|
getStatusOptions,
|
||||||
|
AUDIT_STATUS,
|
||||||
|
AUDIT_STATUS_MAP,
|
||||||
|
BUSINESS_UNIT_TYPE_PRODUCT_SUPPLIER,
|
||||||
|
WAREHOUSE_TYPE_FINISHED,
|
||||||
|
formatRoll,
|
||||||
|
mapToSelectOptions,
|
||||||
|
fetchAllOrderList,
|
||||||
|
} from '@/common/storeGoodsPurchaseIn';
|
||||||
|
import { withNameParam } from '@/common/remoteSelect';
|
||||||
|
import listFilterMixin from '@/mixins/listFilterMixin';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: { addBtn, PurchaseInItem },
|
||||||
|
mixins: [listFilterMixin],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
list: [],
|
||||||
|
scrollHeight: '667px',
|
||||||
|
triggered: false,
|
||||||
|
listLoading: false,
|
||||||
|
filterShow: false,
|
||||||
|
statusSelectShow: false,
|
||||||
|
unitSelectShow: false,
|
||||||
|
unitSelectType: '',
|
||||||
|
supplierOptions: [],
|
||||||
|
warehouseOptions: [],
|
||||||
|
unitOptionsLoading: false,
|
||||||
|
selectSearching: false,
|
||||||
|
unitSearchSeq: 0,
|
||||||
|
unitSelectList: [{ value: '', label: '全部' }],
|
||||||
|
filterStorageKey: 'storeGoodsPurchaseInListFilters_v2',
|
||||||
|
filters: {
|
||||||
|
order_no: '',
|
||||||
|
supplier_id: '',
|
||||||
|
supplier_name: '',
|
||||||
|
warehouse_id: '',
|
||||||
|
warehouse_name: '',
|
||||||
|
audit_status: AUDIT_STATUS.PENDING,
|
||||||
|
},
|
||||||
|
statusSelectList: [
|
||||||
|
{ value: '', label: '全部' },
|
||||||
|
...getStatusOptions(),
|
||||||
|
],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
statusLabel() {
|
||||||
|
if (this.filters.audit_status === '' || this.filters.audit_status === null) return '';
|
||||||
|
return AUDIT_STATUS_MAP[Number(this.filters.audit_status)] || '';
|
||||||
|
},
|
||||||
|
supplierLabel() {
|
||||||
|
return this.filters.supplier_name || '';
|
||||||
|
},
|
||||||
|
warehouseLabel() {
|
||||||
|
return this.filters.warehouse_name || '';
|
||||||
|
},
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
uni.setNavigationBarTitle({ title: '成品采购进仓' });
|
||||||
|
this.restoreFilterCache();
|
||||||
|
uni.getSystemInfo({
|
||||||
|
success: (res) => {
|
||||||
|
this.scrollHeight = `${res.windowHeight - 50}px`;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
this.loadList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
createDefaultFilters() {
|
||||||
|
return {
|
||||||
|
order_no: '',
|
||||||
|
supplier_id: '',
|
||||||
|
supplier_name: '',
|
||||||
|
warehouse_id: '',
|
||||||
|
warehouse_name: '',
|
||||||
|
audit_status: AUDIT_STATUS.PENDING,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
loadSupplierOptions() {
|
||||||
|
if (this.supplierOptions.length) return Promise.resolve(this.supplierOptions);
|
||||||
|
return this.$u.api.businessUnit.list({ unit_type_id: BUSINESS_UNIT_TYPE_PRODUCT_SUPPLIER })
|
||||||
|
.then((res) => {
|
||||||
|
this.supplierOptions = mapToSelectOptions(res);
|
||||||
|
return this.supplierOptions;
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.supplierOptions = [];
|
||||||
|
return this.supplierOptions;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
loadWarehouseOptions() {
|
||||||
|
if (this.warehouseOptions.length) return Promise.resolve(this.warehouseOptions);
|
||||||
|
return this.$u.api.physicalWarehouse.getDropdownList({ warehouse_type_id: WAREHOUSE_TYPE_FINISHED })
|
||||||
|
.then((res) => {
|
||||||
|
this.warehouseOptions = mapToSelectOptions(res);
|
||||||
|
return this.warehouseOptions;
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.warehouseOptions = [];
|
||||||
|
return this.warehouseOptions;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
openUnitSelect(type) {
|
||||||
|
this.unitSelectType = type;
|
||||||
|
const cache = type === 'warehouse' ? this.warehouseOptions : this.supplierOptions;
|
||||||
|
this.applyUnitSelectList(cache);
|
||||||
|
this.unitSelectShow = true;
|
||||||
|
},
|
||||||
|
onUnitSearch(keyword) {
|
||||||
|
const seq = ++this.unitSearchSeq;
|
||||||
|
const type = this.unitSelectType;
|
||||||
|
const empty = !String(keyword || '').trim();
|
||||||
|
this.selectSearching = true;
|
||||||
|
const req = type === 'warehouse'
|
||||||
|
? this.$u.api.physicalWarehouse.getDropdownList(withNameParam({ warehouse_type_id: WAREHOUSE_TYPE_FINISHED }, keyword))
|
||||||
|
: this.$u.api.businessUnit.list(withNameParam({ unit_type_id: BUSINESS_UNIT_TYPE_PRODUCT_SUPPLIER }, keyword));
|
||||||
|
req.then((res) => {
|
||||||
|
if (seq !== this.unitSearchSeq) return;
|
||||||
|
const list = mapToSelectOptions(res);
|
||||||
|
if (empty) {
|
||||||
|
if (type === 'warehouse') this.warehouseOptions = list;
|
||||||
|
else this.supplierOptions = list;
|
||||||
|
}
|
||||||
|
this.applyUnitSelectList(list, empty);
|
||||||
|
}).catch((e) => {
|
||||||
|
if (seq !== this.unitSearchSeq) return;
|
||||||
|
uni.showToast({ title: (e && e.message) || '搜索失败', icon: 'none' });
|
||||||
|
}).then(() => {
|
||||||
|
if (seq === this.unitSearchSeq) this.selectSearching = false;
|
||||||
|
}, () => {
|
||||||
|
if (seq === this.unitSearchSeq) this.selectSearching = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
openSupplierSelect() {
|
||||||
|
this.openUnitSelect('supplier');
|
||||||
|
},
|
||||||
|
openWarehouseSelect() {
|
||||||
|
this.openUnitSelect('warehouse');
|
||||||
|
},
|
||||||
|
onUnitConfirm(e) {
|
||||||
|
const item = e[0] || {};
|
||||||
|
if (this.unitSelectType === 'warehouse') {
|
||||||
|
this.filters.warehouse_id = item.value;
|
||||||
|
this.filters.warehouse_name = item.value ? item.label : '';
|
||||||
|
} else {
|
||||||
|
this.filters.supplier_id = item.value;
|
||||||
|
this.filters.supplier_name = item.value ? item.label : '';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
loadList() {
|
||||||
|
if (this.listLoading) return;
|
||||||
|
this.listLoading = true;
|
||||||
|
const filters = this.appliedFilters || this.filters;
|
||||||
|
const params = {};
|
||||||
|
if (filters.order_no) params.order_no = filters.order_no;
|
||||||
|
if (filters.supplier_id) params.supplier_id = filters.supplier_id;
|
||||||
|
if (filters.warehouse_id) params.warehouse_id = filters.warehouse_id;
|
||||||
|
if (this.hasFilterValue(filters.audit_status)) {
|
||||||
|
params.audit_status = filters.audit_status;
|
||||||
|
}
|
||||||
|
fetchAllOrderList((p) => this.$u.api.fpmPrcInOrder.list(p), params)
|
||||||
|
.then((rows) => {
|
||||||
|
this.list = rows.map(this.mapToCard);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
this.list = [];
|
||||||
|
uni.showToast({ title: err.message || '加载失败', icon: 'none' });
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.listLoading = false;
|
||||||
|
this.triggered = false;
|
||||||
|
// 避免并发请求下 uView 全局 loading 遮罩关不掉
|
||||||
|
uni.hideLoading();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
mapToCard(order) {
|
||||||
|
return {
|
||||||
|
id: order.id,
|
||||||
|
order_no: order.order_no || '',
|
||||||
|
biz_unit_id: order.biz_unit_id || '',
|
||||||
|
biz_unit_name: order.biz_unit_name || '',
|
||||||
|
warehouse_id: order.warehouse_id || '',
|
||||||
|
warehouse_name: order.warehouse_name || '',
|
||||||
|
create_user_name: order.creator_name || '',
|
||||||
|
create_time: order.create_time || '',
|
||||||
|
auditor_name: order.auditor_name || '',
|
||||||
|
audit_date: order.audit_time || '',
|
||||||
|
audit_status: order.audit_status,
|
||||||
|
audit_status_name: order.audit_status_name || AUDIT_STATUS_MAP[order.audit_status] || '',
|
||||||
|
total_roll: formatRoll(order.total_roll),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
onRefresh() {
|
||||||
|
this.triggered = true;
|
||||||
|
this.loadList();
|
||||||
|
},
|
||||||
|
goView(item) {
|
||||||
|
const page = Number(item.audit_status) === 1
|
||||||
|
? 'storeGoodsPurchaseInEdit'
|
||||||
|
: 'storeGoodsPurchaseInView';
|
||||||
|
uni.navigateTo({ url: `./${page}?id=${item.id}` });
|
||||||
|
},
|
||||||
|
openStatusSelect() { this.statusSelectShow = true; },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
@import '@/common/list-filter.scss';
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,712 @@
|
|||||||
|
/**
|
||||||
|
* 成品采购进仓单表单 mixin(新增/编辑共用)
|
||||||
|
*
|
||||||
|
* 1. 先填表头(供应商 / 仓库 / 营销体系 / 订单类型 / 备注)提交 add,拿到 id 后可扫码
|
||||||
|
* 2. 先扫仓位(getWarehouseBin:传 qr_code + warehouse_id),校验后扫布匹二维码
|
||||||
|
* 3. 扫码走 updateFpmPrcInOrder(arrange_type: 1 录入 / 3 删除,带 warehouse_bin_id、纸筒/包装重量)
|
||||||
|
* 4. 手机扫码成功展示详情后自动再次调起扫码,形成连续扫
|
||||||
|
*/
|
||||||
|
import util from '@/common/util';
|
||||||
|
import scanMixin from '@/common/scanMixin.js';
|
||||||
|
import PlusBarcodePanel from '@/components/common/PlusBarcodePanel.vue';
|
||||||
|
import remoteSelectMixin from '@/common/remoteSelectMixin.js';
|
||||||
|
import { withNameParam } from '@/common/remoteSelect';
|
||||||
|
import { initTts, speak } from '@/common/tts.js';
|
||||||
|
import {
|
||||||
|
AUDIT_STATUS_MAP,
|
||||||
|
ARRANGE_TYPE,
|
||||||
|
BUSINESS_UNIT_TYPE_PRODUCT_SUPPLIER,
|
||||||
|
WAREHOUSE_TYPE_FINISHED,
|
||||||
|
IN_ORDER_TYPE_PURCHASE,
|
||||||
|
IN_ORDER_TYPE_MAP,
|
||||||
|
SALE_MODE,
|
||||||
|
SALE_MODE_MAP,
|
||||||
|
SALE_MODE_OPTIONS,
|
||||||
|
DEFAULT_PAPER_TUBE_WEIGHT,
|
||||||
|
DEFAULT_PACKAGE_WEIGHT,
|
||||||
|
normalizeOrder,
|
||||||
|
mapToSelectOptions,
|
||||||
|
canScanAtStatus,
|
||||||
|
isLockedOrderStatus,
|
||||||
|
getFormStatusActionButtons,
|
||||||
|
orderToFormFields,
|
||||||
|
confirmOrderStatusAction,
|
||||||
|
DRAFT_AUDIT_STATUS,
|
||||||
|
DRAFT_AUDIT_STATUS_NAME,
|
||||||
|
getEmptyScanDetail,
|
||||||
|
buildScanDetailFromScanResponse,
|
||||||
|
buildScanUpdateParams,
|
||||||
|
pickDefaultWarehouse,
|
||||||
|
validateScanWeights,
|
||||||
|
} from '@/common/storeGoodsPurchaseIn';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: { PlusBarcodePanel },
|
||||||
|
mixins: [scanMixin, remoteSelectMixin],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
pageMode: 'add',
|
||||||
|
orderId: 0,
|
||||||
|
form: this.getEmptyForm(),
|
||||||
|
headerSaved: false,
|
||||||
|
headerCollapsed: false,
|
||||||
|
selectShow: false,
|
||||||
|
selectList: [],
|
||||||
|
selectType: '',
|
||||||
|
canScan: false,
|
||||||
|
QRBarCode: '',
|
||||||
|
BarCodeDelStatus: false,
|
||||||
|
BillDataMessage: '',
|
||||||
|
scanDetail: getEmptyScanDetail(),
|
||||||
|
auditStatus: 0,
|
||||||
|
supplierOptions: [],
|
||||||
|
warehouseOptions: [],
|
||||||
|
saleSystemOptions: [],
|
||||||
|
saleModeOptions: SALE_MODE_OPTIONS,
|
||||||
|
dropdownLoading: false,
|
||||||
|
/** 仓位 */
|
||||||
|
warehouseBinId: 0,
|
||||||
|
warehouseBinCode: '',
|
||||||
|
warehouseBinName: '',
|
||||||
|
/** 手机连续扫码开关:成功后自动再调起;取消/失败则关闭 */
|
||||||
|
phoneContinuousScan: false,
|
||||||
|
/** 手机扫当前目标:bin | qr */
|
||||||
|
phoneScanTarget: 'bin',
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
isReadonly() {
|
||||||
|
return this.pageMode === 'view';
|
||||||
|
},
|
||||||
|
isEditable() {
|
||||||
|
return this.pageMode === 'add' || this.pageMode === 'edit';
|
||||||
|
},
|
||||||
|
headerEditable() {
|
||||||
|
return this.pageMode === 'add' && !this.headerSaved;
|
||||||
|
},
|
||||||
|
/** 纸筒/包装重量随扫码提交,保存前后及可扫编辑态均可改 */
|
||||||
|
canEditWeights() {
|
||||||
|
return this.isEditable && (this.headerEditable || this.canScan);
|
||||||
|
},
|
||||||
|
statusActionButtons() {
|
||||||
|
return getFormStatusActionButtons(this.headerSaved, this.orderId, this.auditStatus);
|
||||||
|
},
|
||||||
|
displayAuditStatus() {
|
||||||
|
if (this.pageMode === 'add' && !this.headerSaved) return DRAFT_AUDIT_STATUS;
|
||||||
|
return this.auditStatus;
|
||||||
|
},
|
||||||
|
displayAuditStatusName() {
|
||||||
|
if (this.pageMode === 'add' && !this.headerSaved) return DRAFT_AUDIT_STATUS_NAME;
|
||||||
|
return AUDIT_STATUS_MAP[this.auditStatus] || '';
|
||||||
|
},
|
||||||
|
/** 录入需先选仓位;删除模式仅需单据可扫 */
|
||||||
|
canScanQr() {
|
||||||
|
if (!this.canScan) return false;
|
||||||
|
if (this.BarCodeDelStatus) return true;
|
||||||
|
return !!this.warehouseBinId;
|
||||||
|
},
|
||||||
|
/** 扫码栏在可扫状态下始终展示(含删除勾选) */
|
||||||
|
showQrScanBar() {
|
||||||
|
return this.canScan;
|
||||||
|
},
|
||||||
|
qrDisabledTip() {
|
||||||
|
if (!this.canScan) return '请先提交保存后再扫码';
|
||||||
|
if (!this.warehouseBinId && !this.BarCodeDelStatus) return '请先扫描仓位后再扫布匹二维码';
|
||||||
|
return '当前状态不可扫码';
|
||||||
|
},
|
||||||
|
phoneScanHint() {
|
||||||
|
return this.phoneScanTarget === 'bin'
|
||||||
|
? '请扫描仓位,成功后自动扫布飞'
|
||||||
|
: '连续扫描布飞二维码,扫完可继续下一条';
|
||||||
|
},
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
this.isPageActive = true;
|
||||||
|
initTts();
|
||||||
|
if (this.canScan && this.isEditable) {
|
||||||
|
this.registerOrderScanBroadcast();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onHide() {
|
||||||
|
this.isPageActive = false;
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
this.unregisterScanBroadcast();
|
||||||
|
},
|
||||||
|
onUnload() {
|
||||||
|
this.isPageActive = false;
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
this.unregisterScanBroadcast();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
clearWarehouseBin() {
|
||||||
|
this.warehouseBinId = 0;
|
||||||
|
this.warehouseBinCode = '';
|
||||||
|
this.warehouseBinName = '';
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
this._phoneBinLocked = false;
|
||||||
|
this._pendingFabricCode = '';
|
||||||
|
if (this.phoneScanTarget === 'bin') this.closePhoneScanPanel();
|
||||||
|
},
|
||||||
|
/** 重扫仓位:先清空输入框再填入,避免残留旧码拼接 */
|
||||||
|
applyWarehouseBinScan(scanResult) {
|
||||||
|
const code = String(scanResult || '').trim().replace(/[\r\n]/g, '');
|
||||||
|
if (!code) return;
|
||||||
|
this.warehouseBinCode = '';
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.warehouseBinCode = code;
|
||||||
|
this.$nextTick(() => this.resolveWarehouseBin());
|
||||||
|
});
|
||||||
|
},
|
||||||
|
openHalfScreenScan(target) {
|
||||||
|
if (this.phoneScanPanelOpen && this.phoneScanTarget === target) {
|
||||||
|
this.closePhoneScanPanel();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
if (target === 'bin') this._phoneBinLocked = false;
|
||||||
|
this.phoneScanTarget = target;
|
||||||
|
this.phoneScanPanelOpen = true;
|
||||||
|
},
|
||||||
|
onPlusBarcodeSuccess(scanResult) {
|
||||||
|
const code = String(scanResult || '').trim().replace(/[\r\n]/g, '');
|
||||||
|
if (!code) return;
|
||||||
|
if (this.phoneScanTarget === 'bin') {
|
||||||
|
if (this._phoneBinLocked) {
|
||||||
|
if (!this.warehouseBinId) {
|
||||||
|
this._pendingFabricCode = code;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.phoneScanTarget = 'qr';
|
||||||
|
} else {
|
||||||
|
this._phoneBinLocked = true;
|
||||||
|
this._pendingFabricCode = '';
|
||||||
|
this.applyWarehouseBinScan(code);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.QRBarCode = code;
|
||||||
|
this.$nextTick(() => this.handleScan());
|
||||||
|
},
|
||||||
|
handleBinPhoneScan() {
|
||||||
|
if (!this.canScan || !this.orderId) {
|
||||||
|
this.showError('请先提交保存后再扫码');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.openHalfScreenScan('bin');
|
||||||
|
},
|
||||||
|
handlePhoneScan() {
|
||||||
|
if (!this.canScan || !this.orderId) {
|
||||||
|
this.showError('请先提交保存后再扫码');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 删除模式可直接扫布匹码;录入模式无仓位时先扫仓位
|
||||||
|
if (!this.BarCodeDelStatus && !this.warehouseBinId) {
|
||||||
|
this.handleBinPhoneScan();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.openHalfScreenScan('qr');
|
||||||
|
},
|
||||||
|
openContinuousPhoneScan() {
|
||||||
|
if (this.phoneScanPanelOpen) return;
|
||||||
|
if (!this.phoneContinuousScan || !this.canScanQr || !this.isPageActive) {
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.openPhoneScan({
|
||||||
|
callback: (scanResult) => {
|
||||||
|
this.QRBarCode = String(scanResult || '').trim().replace(/[\r\n]/g, '');
|
||||||
|
this.$nextTick(() => this.handleScan({ fromPhone: true }));
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
scheduleNextPhoneScan() {
|
||||||
|
if (this.phoneScanPanelOpen) return;
|
||||||
|
if (!this.phoneContinuousScan || !this.canScanQr || !this.isPageActive) {
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
this.openContinuousPhoneScan();
|
||||||
|
}, 400);
|
||||||
|
},
|
||||||
|
registerOrderScanBroadcast() {
|
||||||
|
this.registerScanBroadcast((scanResult) => {
|
||||||
|
const code = String(scanResult || '').trim().replace(/[\r\n]/g, '');
|
||||||
|
if (!code) return;
|
||||||
|
// 删除模式:直接按布匹码删除;未扫仓位时枪扫优先解析为仓位
|
||||||
|
if (!this.BarCodeDelStatus && !this.warehouseBinId) {
|
||||||
|
this.applyWarehouseBinScan(code);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.QRBarCode = code;
|
||||||
|
this.$nextTick(() => this.handleScan());
|
||||||
|
});
|
||||||
|
},
|
||||||
|
resolveWarehouseBin() {
|
||||||
|
const code = (this.warehouseBinCode || '').trim();
|
||||||
|
if (!this.canScan || !this.orderId) {
|
||||||
|
this.showError('请先提交保存后再扫码');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!code) return;
|
||||||
|
if (!this.form.warehouse_id) {
|
||||||
|
this.showError('单据缺少仓库信息');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uni.showLoading({ title: '识别仓位...' });
|
||||||
|
return this.$u.api.warehouseBin.getByQrCode({
|
||||||
|
qr_code: code,
|
||||||
|
warehouse_id: Number(this.form.warehouse_id),
|
||||||
|
})
|
||||||
|
.then((data) => {
|
||||||
|
uni.hideLoading();
|
||||||
|
if (!data || !data.id) {
|
||||||
|
throw new Error('未识别到仓位');
|
||||||
|
}
|
||||||
|
// 返回 physical_warehouse_id,与单据仓库校验
|
||||||
|
if (
|
||||||
|
data.physical_warehouse_id
|
||||||
|
&& String(data.physical_warehouse_id) !== String(this.form.warehouse_id)
|
||||||
|
) {
|
||||||
|
this.warehouseBinId = 0;
|
||||||
|
this.warehouseBinName = '';
|
||||||
|
throw new Error('该仓位不属于当前仓库');
|
||||||
|
}
|
||||||
|
this.warehouseBinId = data.id;
|
||||||
|
this.warehouseBinCode = data.code || data.qr_code || code;
|
||||||
|
this.warehouseBinName = data.name || '';
|
||||||
|
this.BillDataMessage = '';
|
||||||
|
speak('仓位成功');
|
||||||
|
uni.showToast({ title: '仓位识别成功', icon: 'success' });
|
||||||
|
if (this.phoneScanPanelOpen) this.phoneScanTarget = 'qr';
|
||||||
|
this._phoneBinLocked = false;
|
||||||
|
const pending = this._pendingFabricCode;
|
||||||
|
this._pendingFabricCode = '';
|
||||||
|
if (pending && this.phoneScanPanelOpen) {
|
||||||
|
this.QRBarCode = pending;
|
||||||
|
this.$nextTick(() => this.handleScan());
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
uni.hideLoading();
|
||||||
|
this._phoneBinLocked = false;
|
||||||
|
this._pendingFabricCode = '';
|
||||||
|
this.warehouseBinId = 0;
|
||||||
|
this.warehouseBinCode = '';
|
||||||
|
this.warehouseBinName = '';
|
||||||
|
this.showError(e.message || '仓位识别失败');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
syncCanScanFromStatus(status) {
|
||||||
|
const nextCanScan = this.isEditable && canScanAtStatus(status);
|
||||||
|
if (this.canScan && !nextCanScan) {
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
this.closePhoneScanPanel();
|
||||||
|
this.unregisterScanBroadcast();
|
||||||
|
}
|
||||||
|
this.canScan = nextCanScan;
|
||||||
|
},
|
||||||
|
loadBaseDropdowns() {
|
||||||
|
if (this.dropdownLoading) return Promise.resolve();
|
||||||
|
this.dropdownLoading = true;
|
||||||
|
if (this.headerEditable) this.applyDefaultSaleSystem();
|
||||||
|
return Promise.all([
|
||||||
|
this.ensureSupplierOptions().catch((e) => {
|
||||||
|
console.error('加载供应商失败', e);
|
||||||
|
return [];
|
||||||
|
}),
|
||||||
|
this.ensureWarehouseOptions().catch((e) => {
|
||||||
|
console.error('加载仓库失败', e);
|
||||||
|
return [];
|
||||||
|
}),
|
||||||
|
this.ensureSaleSystemOptions().catch((e) => {
|
||||||
|
console.error('加载营销体系失败', e);
|
||||||
|
return [];
|
||||||
|
}),
|
||||||
|
]).finally(() => {
|
||||||
|
this.dropdownLoading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
ensureSupplierOptions() {
|
||||||
|
if (this.supplierOptions.length) return Promise.resolve(this.supplierOptions);
|
||||||
|
return this.$u.api.businessUnit.list({ unit_type_id: BUSINESS_UNIT_TYPE_PRODUCT_SUPPLIER })
|
||||||
|
.then((res) => {
|
||||||
|
this.supplierOptions = mapToSelectOptions(res);
|
||||||
|
return this.supplierOptions;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
ensureWarehouseOptions() {
|
||||||
|
if (this.warehouseOptions.length) return Promise.resolve(this.warehouseOptions);
|
||||||
|
return this.$u.api.physicalWarehouse.getDropdownList({ warehouse_type_id: WAREHOUSE_TYPE_FINISHED })
|
||||||
|
.then((res) => {
|
||||||
|
this.warehouseOptions = mapToSelectOptions(res);
|
||||||
|
if (this.headerEditable && !this.form.warehouse_id) {
|
||||||
|
this.applyDefaultWarehouse();
|
||||||
|
}
|
||||||
|
return this.warehouseOptions;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
ensureSaleSystemOptions() {
|
||||||
|
if (this.saleSystemOptions.length) return Promise.resolve(this.saleSystemOptions);
|
||||||
|
return this.$u.api.saleSystem.getDropdownList()
|
||||||
|
.then((res) => {
|
||||||
|
this.saleSystemOptions = mapToSelectOptions(res);
|
||||||
|
if (this.headerEditable) this.applyDefaultSaleSystem();
|
||||||
|
return this.saleSystemOptions;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
fetchRemoteSelectOptions(type, keyword) {
|
||||||
|
const empty = !String(keyword || '').trim();
|
||||||
|
if (type === '供应商') {
|
||||||
|
return this.$u.api.businessUnit.list(withNameParam({ unit_type_id: BUSINESS_UNIT_TYPE_PRODUCT_SUPPLIER }, keyword))
|
||||||
|
.then((res) => {
|
||||||
|
const list = mapToSelectOptions(res);
|
||||||
|
if (empty) this.supplierOptions = list;
|
||||||
|
return list;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (type === '仓库名称') {
|
||||||
|
return this.$u.api.physicalWarehouse.getDropdownList(withNameParam({ warehouse_type_id: WAREHOUSE_TYPE_FINISHED }, keyword))
|
||||||
|
.then((res) => {
|
||||||
|
const list = mapToSelectOptions(res);
|
||||||
|
if (empty) this.warehouseOptions = list;
|
||||||
|
return list;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (type === '营销体系') {
|
||||||
|
return this.$u.api.saleSystem.getDropdownList(withNameParam({}, keyword))
|
||||||
|
.then((res) => {
|
||||||
|
const list = mapToSelectOptions(res);
|
||||||
|
if (empty) this.saleSystemOptions = list;
|
||||||
|
return list;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return Promise.resolve([]);
|
||||||
|
},
|
||||||
|
applyDefaultWarehouse() {
|
||||||
|
const app = getApp();
|
||||||
|
const picked = pickDefaultWarehouse(
|
||||||
|
this.warehouseOptions,
|
||||||
|
app && app.globalData ? app.globalData.StoreNameID : '',
|
||||||
|
app && app.globalData ? app.globalData.StoreName : '',
|
||||||
|
);
|
||||||
|
if (!picked) return;
|
||||||
|
this.form.warehouse_id = picked.value;
|
||||||
|
this.form.warehouse_name = picked.label;
|
||||||
|
},
|
||||||
|
applyDefaultSaleSystem() {
|
||||||
|
if (this.form.sale_system_id) {
|
||||||
|
if (!this.form.sale_system_name && this.saleSystemOptions.length) {
|
||||||
|
const found = this.saleSystemOptions.find(
|
||||||
|
(item) => String(item.value) === String(this.form.sale_system_id),
|
||||||
|
);
|
||||||
|
if (found) this.form.sale_system_name = found.label;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const app = getApp();
|
||||||
|
const gd = app && app.globalData ? app.globalData : {};
|
||||||
|
const id = gd.PlanDepartmentID;
|
||||||
|
if (!id) return;
|
||||||
|
this.form.sale_system_id = id;
|
||||||
|
this.form.sale_system_name = gd.PlanDepartmentName || '';
|
||||||
|
if (!this.form.sale_system_name && this.saleSystemOptions.length) {
|
||||||
|
const found = this.saleSystemOptions.find((item) => String(item.value) === String(id));
|
||||||
|
if (found) this.form.sale_system_name = found.label;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getEmptyForm() {
|
||||||
|
const app = getApp();
|
||||||
|
const gd = app && app.globalData ? app.globalData : {};
|
||||||
|
return {
|
||||||
|
order_no: '',
|
||||||
|
biz_unit_id: '',
|
||||||
|
biz_unit_name: '',
|
||||||
|
warehouse_id: '',
|
||||||
|
warehouse_name: '',
|
||||||
|
sale_system_id: gd.PlanDepartmentID || '',
|
||||||
|
sale_system_name: gd.PlanDepartmentName || '',
|
||||||
|
sale_mode: SALE_MODE.BULK,
|
||||||
|
sale_mode_name: SALE_MODE_MAP[SALE_MODE.BULK],
|
||||||
|
in_order_type: IN_ORDER_TYPE_PURCHASE,
|
||||||
|
in_order_type_name: IN_ORDER_TYPE_MAP[IN_ORDER_TYPE_PURCHASE],
|
||||||
|
paper_tube_weight: String(DEFAULT_PAPER_TUBE_WEIGHT),
|
||||||
|
package_weight: String(DEFAULT_PACKAGE_WEIGHT),
|
||||||
|
remark: '',
|
||||||
|
item_data: [],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
loadOrder(id, options = {}) {
|
||||||
|
const { rejectIfLocked = false } = options;
|
||||||
|
return this.$u.api.fpmPrcInOrder.detail({ id })
|
||||||
|
.then((res) => {
|
||||||
|
const order = normalizeOrder(res);
|
||||||
|
if (!order) {
|
||||||
|
this.showError('单据不存在');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (rejectIfLocked && isLockedOrderStatus(order.audit_status)) {
|
||||||
|
this.showError('当前状态不可编辑');
|
||||||
|
setTimeout(() => uni.navigateBack(), 1500);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
this.orderId = order.id;
|
||||||
|
this.auditStatus = order.audit_status;
|
||||||
|
this.headerSaved = true;
|
||||||
|
this.headerCollapsed = true;
|
||||||
|
this.form = orderToFormFields(order);
|
||||||
|
this.clearWarehouseBin();
|
||||||
|
this.syncCanScanFromStatus(order.audit_status);
|
||||||
|
if (this.canScan) this.registerOrderScanBroadcast();
|
||||||
|
return order;
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
this.showError(e.message || '加载单据失败');
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
pickerSelectFun(type) {
|
||||||
|
if (!this.headerEditable) return;
|
||||||
|
if (type === '订单类型') {
|
||||||
|
this.selectType = type;
|
||||||
|
if (!this.saleModeOptions.length) {
|
||||||
|
this.showError('暂无可选数据');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.selectList = this.saleModeOptions;
|
||||||
|
this.selectShow = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const cache = {
|
||||||
|
'供应商': this.supplierOptions,
|
||||||
|
'仓库名称': this.warehouseOptions,
|
||||||
|
'营销体系': this.saleSystemOptions,
|
||||||
|
};
|
||||||
|
if (cache[type]) this.openSelectPicker(type, cache[type]);
|
||||||
|
},
|
||||||
|
selectConfirmFun(e) {
|
||||||
|
const item = e[0];
|
||||||
|
if (this.selectType === '供应商') {
|
||||||
|
this.form.biz_unit_id = item.value;
|
||||||
|
this.form.biz_unit_name = item.label;
|
||||||
|
} else if (this.selectType === '仓库名称') {
|
||||||
|
this.form.warehouse_id = item.value;
|
||||||
|
this.form.warehouse_name = item.label;
|
||||||
|
} else if (this.selectType === '营销体系') {
|
||||||
|
this.form.sale_system_id = item.value;
|
||||||
|
this.form.sale_system_name = item.label;
|
||||||
|
} else if (this.selectType === '订单类型') {
|
||||||
|
this.form.sale_mode = item.value;
|
||||||
|
this.form.sale_mode_name = item.label;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
validateForm() {
|
||||||
|
if (!this.form.biz_unit_id) return '请选择供应商';
|
||||||
|
if (!this.form.warehouse_id) return '请选择仓库名称';
|
||||||
|
if (!this.form.sale_system_id) return '请选择营销体系';
|
||||||
|
if (!this.form.sale_mode) return '请选择订单类型';
|
||||||
|
return '';
|
||||||
|
},
|
||||||
|
buildAddParam() {
|
||||||
|
return {
|
||||||
|
inOrderType: IN_ORDER_TYPE_PURCHASE,
|
||||||
|
biz_unit_id: Number(this.form.biz_unit_id),
|
||||||
|
warehouse_id: Number(this.form.warehouse_id),
|
||||||
|
sale_system_id: Number(this.form.sale_system_id),
|
||||||
|
sale_mode: Number(this.form.sale_mode),
|
||||||
|
remark: this.form.remark || '',
|
||||||
|
item_data: [],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
submitSave() {
|
||||||
|
if (this.headerSaved) {
|
||||||
|
this.showError('表头已保存,请直接扫码');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const err = this.validateForm();
|
||||||
|
if (err) {
|
||||||
|
this.showError(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uni.showLoading({ title: '保存中...' });
|
||||||
|
this.$u.api.fpmPrcInOrder.add(this.buildAddParam())
|
||||||
|
.then((res) => {
|
||||||
|
this.orderId = (res && res.id) || 0;
|
||||||
|
if (!this.orderId) {
|
||||||
|
throw new Error('保存失败,未返回单据ID');
|
||||||
|
}
|
||||||
|
return this.$u.api.fpmPrcInOrder.detail({ id: this.orderId });
|
||||||
|
})
|
||||||
|
.then((detail) => {
|
||||||
|
uni.hideLoading();
|
||||||
|
const order = normalizeOrder(detail);
|
||||||
|
this.applyOrder(order, { keepWeights: true });
|
||||||
|
this.headerSaved = true;
|
||||||
|
this.headerCollapsed = true;
|
||||||
|
this.clearWarehouseBin();
|
||||||
|
this.syncCanScanFromStatus(order.audit_status);
|
||||||
|
this.showSuccess('保存成功,请先扫描仓位', '保存成功', { voiceOnly: true });
|
||||||
|
this.registerOrderScanBroadcast();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
uni.hideLoading();
|
||||||
|
this.showError(e.message || '保存失败');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
applyOrder(order, options = {}) {
|
||||||
|
if (!order) return;
|
||||||
|
this.auditStatus = order.audit_status;
|
||||||
|
const paperTubeWeight = this.form.paper_tube_weight;
|
||||||
|
const packageWeight = this.form.package_weight;
|
||||||
|
Object.assign(this.form, orderToFormFields(order));
|
||||||
|
if (options.keepWeights) {
|
||||||
|
this.form.paper_tube_weight = paperTubeWeight;
|
||||||
|
this.form.package_weight = packageWeight;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleScan(options = {}) {
|
||||||
|
const fromPhone = !!options.fromPhone;
|
||||||
|
const code = (this.QRBarCode || '').trim();
|
||||||
|
if (!this.canScan || !this.orderId) {
|
||||||
|
this.showError('请先提交保存后再扫码');
|
||||||
|
this.QRBarCode = '';
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const isDelete = this.BarCodeDelStatus;
|
||||||
|
if (!isDelete && !this.warehouseBinId) {
|
||||||
|
this.showError('请先扫描仓位');
|
||||||
|
this.QRBarCode = '';
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!code) {
|
||||||
|
this.QRBarCode = '';
|
||||||
|
if (fromPhone) this.scheduleNextPhoneScan();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const arrangeType = isDelete ? ARRANGE_TYPE.DEL : ARRANGE_TYPE.IN;
|
||||||
|
this.doScanUpdate(code, arrangeType, { fromPhone });
|
||||||
|
},
|
||||||
|
BarCodeDelChange(e) {
|
||||||
|
this.BarCodeDelStatus = (e.detail.value || []).length > 0;
|
||||||
|
this.BillDataMessage = this.BarCodeDelStatus ? '删除模式:扫描细码即可删除' : '';
|
||||||
|
},
|
||||||
|
getFineCodeScanCode(fineCode) {
|
||||||
|
if (!fineCode) return '';
|
||||||
|
return fineCode.qr_code
|
||||||
|
|| fineCode.long_code
|
||||||
|
|| fineCode.scan_code
|
||||||
|
|| fineCode.digital_code
|
||||||
|
|| fineCode.bar_code
|
||||||
|
|| fineCode.short_code
|
||||||
|
|| '';
|
||||||
|
},
|
||||||
|
onDeleteFineCode(fineCode) {
|
||||||
|
if (!this.canScan || !this.orderId) {
|
||||||
|
this.showError('当前状态不可删除');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const scanCode = this.getFineCodeScanCode(fineCode);
|
||||||
|
if (!scanCode) {
|
||||||
|
this.showError('该细码缺少条码,无法删除');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: `确认删除细码 ${scanCode}?`,
|
||||||
|
success: (res) => {
|
||||||
|
if (!res.confirm) return;
|
||||||
|
this.doScanUpdate(scanCode, ARRANGE_TYPE.DEL);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
doScanUpdate(scanCode, arrangeType, options = {}) {
|
||||||
|
const { fromPhone = false } = options;
|
||||||
|
const isDelete = arrangeType === ARRANGE_TYPE.DEL;
|
||||||
|
if (!isDelete) {
|
||||||
|
const weightErr = validateScanWeights(this.form.paper_tube_weight, this.form.package_weight);
|
||||||
|
if (weightErr) {
|
||||||
|
this.showError(weightErr);
|
||||||
|
this.QRBarCode = '';
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
uni.showLoading({ title: isDelete ? '删除中...' : '处理中...' });
|
||||||
|
return this.$u.api.fpmPrcInOrder.scanUpdate(buildScanUpdateParams({
|
||||||
|
id: this.orderId,
|
||||||
|
scanCode,
|
||||||
|
arrangeType,
|
||||||
|
// 删除不强制仓位;录入带当前仓位
|
||||||
|
warehouseBinId: isDelete ? 0 : this.warehouseBinId,
|
||||||
|
paperTubeWeight: this.form.paper_tube_weight,
|
||||||
|
packageWeight: this.form.package_weight,
|
||||||
|
}))
|
||||||
|
.then((scanRes) => {
|
||||||
|
this.scanDetail = buildScanDetailFromScanResponse(scanRes);
|
||||||
|
this.BillDataMessage = isDelete ? '删除成功' : '扫描成功';
|
||||||
|
this.QRBarCode = '';
|
||||||
|
if (isDelete) {
|
||||||
|
speak('已删除');
|
||||||
|
uni.showToast({ title: '删除成功', icon: 'success' });
|
||||||
|
} else {
|
||||||
|
speak('成功');
|
||||||
|
}
|
||||||
|
return this.$u.api.fpmPrcInOrder.detail({ id: this.orderId })
|
||||||
|
.then((detail) => {
|
||||||
|
const order = normalizeOrder(detail);
|
||||||
|
if (order) {
|
||||||
|
this.form.item_data = order.item_data;
|
||||||
|
this.auditStatus = order.audit_status;
|
||||||
|
// 本单匹数/本单数量:取这张单的总匹数、总数量
|
||||||
|
this.scanDetail = {
|
||||||
|
...this.scanDetail,
|
||||||
|
order_roll: order.total_roll,
|
||||||
|
order_weight: order.total_weight,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => null);
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
uni.hideLoading();
|
||||||
|
if (fromPhone) this.scheduleNextPhoneScan();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
uni.hideLoading();
|
||||||
|
this.phoneContinuousScan = false;
|
||||||
|
const message = e.message || (isDelete ? '删除失败' : '扫码失败');
|
||||||
|
speak(isDelete ? '删除失败' : '扫码失败');
|
||||||
|
uni.showToast({ title: message, icon: 'none', duration: 2500 });
|
||||||
|
this.QRBarCode = '';
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleStatusAction(action) {
|
||||||
|
confirmOrderStatusAction(this, {
|
||||||
|
orderId: this.orderId,
|
||||||
|
action,
|
||||||
|
onSuccess: () => this.$u.api.fpmPrcInOrder.detail({ id: this.orderId })
|
||||||
|
.then((detail) => {
|
||||||
|
uni.hideLoading();
|
||||||
|
const order = normalizeOrder(detail);
|
||||||
|
if (!order) return;
|
||||||
|
this.applyOrder(order);
|
||||||
|
this.syncCanScanFromStatus(order.audit_status);
|
||||||
|
this.showSuccess(util.statusSuccessVoice(action));
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
},
|
||||||
|
showError(message) {
|
||||||
|
util.playErrorAudio(message);
|
||||||
|
uni.showModal({ title: '提示', content: message, showCancel: false });
|
||||||
|
},
|
||||||
|
showSuccess(message, voiceText, options) {
|
||||||
|
util.playSuccessAudio(voiceText || message, options);
|
||||||
|
uni.showToast({ title: message, icon: 'success' });
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user