feat(storegoods): 扣重改为扫码提交并展示细码重量
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -6,9 +6,12 @@
|
||||
<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>加工进仓单</view>
|
||||
<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>
|
||||
@@ -24,6 +27,37 @@
|
||||
<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" />
|
||||
@@ -57,6 +91,7 @@
|
||||
<ProcessInDetailList
|
||||
:list="form.item_data"
|
||||
:deletable="canScan"
|
||||
show-tare-columns
|
||||
@delete="onDeleteFineCode"
|
||||
/>
|
||||
|
||||
@@ -95,6 +130,13 @@ export default {
|
||||
ProcessInBinBar,
|
||||
},
|
||||
mixins: [formMixin],
|
||||
data() {
|
||||
return {
|
||||
weightInputStyle: {
|
||||
fontSize: '36rpx',
|
||||
},
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
uni.setNavigationBarTitle({ title: '新增加工进仓单' });
|
||||
this.pageMode = 'add';
|
||||
@@ -109,4 +151,17 @@ 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>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
</view>
|
||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">进仓类型</text>
|
||||
<text>加工进仓单</text>
|
||||
<text>{{ form.in_order_type_name || '加工进仓单' }}</text>
|
||||
</view>
|
||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">加工单位</text>
|
||||
@@ -18,6 +18,34 @@
|
||||
<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>
|
||||
@@ -51,6 +79,7 @@
|
||||
<ProcessInDetailList
|
||||
:list="form.item_data"
|
||||
:deletable="canScan"
|
||||
show-tare-columns
|
||||
@delete="onDeleteFineCode"
|
||||
/>
|
||||
|
||||
@@ -79,6 +108,13 @@ export default {
|
||||
ProcessInBinBar,
|
||||
},
|
||||
mixins: [formMixin],
|
||||
data() {
|
||||
return {
|
||||
weightInputStyle: {
|
||||
fontSize: '36rpx',
|
||||
},
|
||||
};
|
||||
},
|
||||
onLoad(e) {
|
||||
uni.setNavigationBarTitle({ title: '编辑加工进仓单' });
|
||||
this.pageMode = 'edit';
|
||||
@@ -95,4 +131,17 @@ 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>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* 加工进仓单表单 mixin(新增/编辑共用)
|
||||
*
|
||||
* 1. 先填表头(加工单位 / 仓库 / 备注)提交 add,拿到 id 后可扫码
|
||||
* 1. 先填表头(进仓类型 / 加工单位 / 仓库 / 营销体系 / 备注)提交 add,拿到 id 后可扫码
|
||||
* 2. 先扫仓位(getWarehouseBin:传 qr_code + warehouse_id),校验后扫布匹二维码
|
||||
* 3. 扫码走 updateFpmProcessInOrder(arrange_type: 1 录入 / 3 删除,带 warehouse_bin_id)
|
||||
* 3. 扫码走 updateFpmProcessInOrder(arrange_type: 1 录入 / 3 删除,带 warehouse_bin_id、纸筒/包装重量)
|
||||
* 4. 手机扫码成功展示详情后自动再次调起扫码,形成连续扫
|
||||
*/
|
||||
import util from '@/common/util';
|
||||
@@ -15,6 +15,10 @@ import {
|
||||
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,
|
||||
@@ -28,6 +32,7 @@ import {
|
||||
buildScanDetailFromScanResponse,
|
||||
buildScanUpdateParams,
|
||||
pickDefaultWarehouse,
|
||||
validateScanWeights,
|
||||
} from '@/common/storeGoodsProcessIn';
|
||||
|
||||
export default {
|
||||
@@ -49,6 +54,8 @@ export default {
|
||||
auditStatus: 0,
|
||||
processUnitOptions: [],
|
||||
warehouseOptions: [],
|
||||
saleSystemOptions: [],
|
||||
inOrderTypeOptions: IN_ORDER_TYPE_OPTIONS,
|
||||
dropdownLoading: false,
|
||||
/** 仓位 */
|
||||
warehouseBinId: 0,
|
||||
@@ -70,6 +77,10 @@ export default {
|
||||
headerEditable() {
|
||||
return this.pageMode === 'add' && !this.headerSaved;
|
||||
},
|
||||
/** 纸筒/包装重量随扫码提交,保存前后及可扫编辑态均可改 */
|
||||
canEditWeights() {
|
||||
return this.isEditable && (this.headerEditable || this.canScan);
|
||||
},
|
||||
statusActionButtons() {
|
||||
return getFormStatusActionButtons(this.headerSaved, this.orderId, this.auditStatus);
|
||||
},
|
||||
@@ -243,6 +254,7 @@ export default {
|
||||
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);
|
||||
@@ -252,6 +264,10 @@ export default {
|
||||
console.error('加载仓库失败', e);
|
||||
return [];
|
||||
}),
|
||||
this.ensureSaleSystemOptions().catch((e) => {
|
||||
console.error('加载营销体系失败', e);
|
||||
return [];
|
||||
}),
|
||||
]).finally(() => {
|
||||
this.dropdownLoading = false;
|
||||
});
|
||||
@@ -275,6 +291,15 @@ export default {
|
||||
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;
|
||||
});
|
||||
},
|
||||
applyDefaultWarehouse() {
|
||||
const app = getApp();
|
||||
const picked = pickDefaultWarehouse(
|
||||
@@ -286,13 +311,42 @@ export default {
|
||||
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: [],
|
||||
};
|
||||
@@ -336,7 +390,9 @@ export default {
|
||||
this.selectList = list;
|
||||
this.selectShow = true;
|
||||
};
|
||||
if (type === '加工单位') {
|
||||
if (type === '进仓类型') {
|
||||
openPicker(this.inOrderTypeOptions);
|
||||
} else if (type === '加工单位') {
|
||||
this.ensureProcessUnitOptions()
|
||||
.then(openPicker)
|
||||
.catch((e) => this.showError(e.message || '加载加工单位失败'));
|
||||
@@ -344,33 +400,41 @@ export default {
|
||||
this.ensureWarehouseOptions()
|
||||
.then(openPicker)
|
||||
.catch((e) => this.showError(e.message || '加载仓库失败'));
|
||||
} else if (type === '营销体系') {
|
||||
this.ensureSaleSystemOptions()
|
||||
.then(openPicker)
|
||||
.catch((e) => this.showError(e.message || '加载营销体系失败'));
|
||||
}
|
||||
},
|
||||
selectConfirmFun(e) {
|
||||
const item = e[0];
|
||||
if (this.selectType === '加工单位') {
|
||||
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 '请选择仓库名称';
|
||||
const app = getApp();
|
||||
const saleSystemId = app && app.globalData ? app.globalData.PlanDepartmentID : '';
|
||||
if (!saleSystemId) return '缺少营销体系,请重新登录';
|
||||
if (!this.form.sale_system_id) return '请选择营销体系';
|
||||
return '';
|
||||
},
|
||||
buildAddParam() {
|
||||
const app = getApp();
|
||||
return {
|
||||
inOrderType: IN_ORDER_TYPE_PROCESS,
|
||||
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(app.globalData.PlanDepartmentID),
|
||||
sale_system_id: Number(this.form.sale_system_id),
|
||||
remark: this.form.remark || '',
|
||||
item_data: [],
|
||||
};
|
||||
@@ -397,7 +461,7 @@ export default {
|
||||
.then((detail) => {
|
||||
uni.hideLoading();
|
||||
const order = normalizeOrder(detail);
|
||||
this.applyOrder(order);
|
||||
this.applyOrder(order, { keepWeights: true });
|
||||
this.headerSaved = true;
|
||||
this.clearWarehouseBin();
|
||||
this.syncCanScanFromStatus(order.audit_status);
|
||||
@@ -409,10 +473,16 @@ export default {
|
||||
this.showError(e.message || '保存失败');
|
||||
});
|
||||
},
|
||||
applyOrder(order) {
|
||||
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;
|
||||
@@ -444,7 +514,13 @@ export default {
|
||||
},
|
||||
getFineCodeScanCode(fineCode) {
|
||||
if (!fineCode) return '';
|
||||
return fineCode.qr_code || fineCode.scan_code || fineCode.bar_code || '';
|
||||
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) {
|
||||
@@ -468,6 +544,15 @@ export default {
|
||||
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,
|
||||
@@ -475,6 +560,8 @@ export default {
|
||||
arrangeType,
|
||||
// 删除不强制仓位;录入带当前仓位
|
||||
warehouseBinId: isDelete ? 0 : this.warehouseBinId,
|
||||
paperTubeWeight: this.form.paper_tube_weight,
|
||||
packageWeight: this.form.package_weight,
|
||||
}))
|
||||
.then((scanRes) => {
|
||||
this.scanDetail = buildScanDetailFromScanResponse(scanRes);
|
||||
|
||||
@@ -18,6 +18,20 @@
|
||||
<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>
|
||||
@@ -34,6 +48,7 @@
|
||||
<ProcessInDetailList
|
||||
:title="detailTitle"
|
||||
:list="order.item_data"
|
||||
show-tare-columns
|
||||
/>
|
||||
|
||||
<FabricOutFooter :buttons="actionButtons" @action="handleAction" />
|
||||
@@ -126,4 +141,13 @@ 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>
|
||||
|
||||
Reference in New Issue
Block a user