Commit 10d96af8 by liangjianmin

style(search): 优化搜索框图标显示和样式调整

- 修改搜索框中搜索图标的样式类名,提高图标显示准确性
- 调整清除图标的显示条件,支持输入值为空时也能显示清除按钮
- 优化扫描扫码功能点击响应逻辑,确保扫码功能正常触发
- 新增理货操作区域样式,保持与 tallyReceive/operate 样式一致
- 整体样式调整,提升界面统一性和用户体验
parent 8145374b
......@@ -210,6 +210,323 @@
}
}
// 理货操作区域(与 tallyReceive/operate 样式一致)
.tally-operate-section {
padding: 100rpx 15rpx 0 15rpx;
.section {
margin-top: 15rpx;
padding: 18rpx 22rpx 100px 22rpx;
background-color: #ffffff;
.field-item {
position: relative;
flex-wrap: wrap;
.is-watch {
position: absolute;
right: 0;
top: 109rpx;
width: 40rpx;
height: 40rpx;
font-size: 12rpx;
color: #000;
border: 1px solid #1969f9;
border-radius: 50%;
opacity: 0.8;
}
.item {
flex: 0 0 50%;
margin-bottom: 8rpx;
.label {
width: 98rpx;
font-size: 16rpx;
color: #919399;
}
.text {
font-size: 16rpx;
color: #1969f9;
margin-left: 6rpx;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
max-width: 176rpx;
}
.tt {
font-size: 16rpx;
color: #484b59;
margin-left: 6rpx;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
max-width: 176rpx;
}
.desc {
font-size: 16rpx;
color: #484b59;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
margin-left: 6rpx;
}
}
}
.bor {
height: 1px;
background-color: #f0f0f2;
margin-bottom: 17rpx;
}
.item-tit {
font-size: 20rpx;
color: #292b33;
margin-bottom: 18rpx;
transition: all 0.2s ease;
text:first-child {
margin-right: 32rpx;
}
.curr {
position: relative;
color: #1969f9;
font-weight: bold;
&::after {
content: '';
background-color: #1969f9;
width: 51%;
height: 2px;
position: absolute;
bottom: -10rpx;
left: 0;
right: 0;
margin: 0 auto;
}
}
}
.form-input {
.tally-tips-row {
margin-bottom: 10rpx;
}
.input-title {
margin-bottom: 10rpx;
.input-title-t1 {
font-size: 16rpx;
color: #f00;
font-weight: bold;
margin-right: 5rpx;
}
.input-title-t2 {
font-size: 16rpx;
color: #484b59;
font-weight: bold;
}
}
.input-box-wrap {
margin-bottom: 17rpx;
.input-box {
.uni-input {
width: 278rpx;
height: 43rpx;
background: #ffffff;
border-radius: 10rpx;
border: 1px solid #1969f9;
text-indent: 15rpx;
font-size: 16rpx;
}
}
.pick-box {
position: relative;
.uni-input {
width: 278rpx;
height: 43rpx;
line-height: 43rpx;
background: #ffffff;
border-radius: 10rpx;
border: 1px solid #1969f9;
text-indent: 15rpx;
font-size: 16rpx;
}
.uni-arrow {
position: absolute;
right: 13rpx;
top: 18rpx;
width: 14rpx;
height: 9rpx;
background: url('https://img.ichunt.com/images/ichunt/202304/10/e4c72319ad41ce1425f71cc6ec35f111.png') no-repeat center;
background-size: contain;
margin-left: 12rpx;
}
}
}
}
.h2 {
font-size: 17rpx;
color: #484b59;
font-weight: bold;
margin-bottom: 10rpx;
.tt {
font-size: 17rpx;
color: #919399;
font-weight: normal;
}
.num {
.t1 {
font-size: 13rpx;
color: #1969f9;
}
.t2 {
font-size: 13rpx;
color: #919399;
}
}
}
.pic-list {
flex-wrap: wrap;
margin-bottom: 18rpx;
.default {
width: 120rpx;
height: 120rpx;
background: #f5f5f7;
border-radius: 10rpx;
margin-right: 15rpx;
.iconfont {
font-size: 60rpx;
color: #c6c7cc;
}
}
.box {
position: relative;
width: 120rpx;
height: 120rpx;
background: #f5f5f7;
border-radius: 10rpx;
margin-right: 15rpx;
margin-bottom: 15rpx;
image {
width: 120rpx;
height: 120rpx;
}
.iconfont {
position: absolute;
right: 0;
top: 0;
font-size: 30rpx;
color: #ff3700;
z-index: 9;
}
}
}
.print {
margin-bottom: 27rpx;
.check-box-icon {
width: 20rpx;
height: 20rpx;
background: url('https://img.ichunt.com/images/ichunt/202304/11/0bf30da3e8ce6c476c210173b5f13d51.png') no-repeat center;
background-size: contain;
display: block;
&.curr {
background: url('https://img.ichunt.com/images/ichunt/202304/11/71a74e52e94bcf2e89f8df9817d494c6.png') no-repeat center;
background-size: contain;
}
}
.tt {
font-size: 17rpx;
color: #484b59;
margin-left: 10rpx;
}
}
.textarea-box {
width: 100%;
textarea {
width: 100%;
height: 85rpx;
padding: 10rpx 15rpx;
background: #f5f5f7;
border-radius: 10rpx;
font-size: 16rpx;
box-sizing: border-box;
}
}
}
.fix-btn {
position: fixed;
bottom: 0;
width: 100%;
left: 0;
z-index: 999;
.btn1 {
width: 40%;
height: 75rpx;
background: #ffffff;
.check-box-icon {
width: 20rpx;
height: 20rpx;
background: url('https://img.ichunt.com/images/ichunt/202304/11/0bf30da3e8ce6c476c210173b5f13d51.png') no-repeat center;
background-size: contain;
display: block;
&.curr {
background: url('https://img.ichunt.com/images/ichunt/202304/11/71a74e52e94bcf2e89f8df9817d494c6.png') no-repeat center;
background-size: contain;
}
}
.text {
margin-left: 10rpx;
font-size: 20rpx;
color: #484b59;
}
}
.btn2 {
width: 60%;
height: 75rpx;
background: #1969f9;
font-size: 23rpx;
color: #ffffff;
}
}
}
.popup-content-sn {
background-color: #f1f4f6;
padding: 28rpx 24rpx 24rpx 24rpx;
......
......@@ -13,10 +13,10 @@
<!-- 搜索输入框区域 -->
<view class="input-wrapper row bothSide verCenter" :class="{ 'full-width': !showPicker }">
<view class="input-content row verCenter">
<text class="search-icon iconfont icon-juxing11" @click="handleSearchIconClick"></text>
<text class="search-icon iconfont icon-juxing1" @click="handleSearchIconClick"></text>
<input class="search-input" :placeholder="placeholder" :placeholder-style="placeholderStyle" :focus="inputFocus" v-model="inputValue" @input="handleInput" maxlength="-1" />
</view>
<text class="clear-icon iconfont icon-a-juxing111" @click="handleClearInput" v-if="showClearIcon"></text>
<text class="clear-icon iconfont icon-a-juxing11" @click="handleClearInput" v-if="showClearIcon || !!inputValue"></text>
</view>
</view>
</template>
......
......@@ -161,6 +161,304 @@
</view>
</view>
</uni-drawer>
<!-- 理货操作区域(非拆货时在当前页面展示,参考 tallyReceive/operate) -->
<view class="tally-operate-section" v-if="tallyStep === 1">
<view class="section" v-if="tallyDetail">
<view class="field-item row">
<view class="is-watch row rowCenter verCenter" v-if="tallyDetail.is_watch == 1">看货</view>
<view class="item row verCenter">
<text class="label">入库单号:</text>
<text class="text">{{ tallyDetail.stock_in_sn }}</text>
</view>
<view class="item row verCenter">
<text class="label">入 仓 号:</text>
<text class="text">{{ tallyDetail.inhouse }}</text>
</view>
<template v-if="tallyDetail.box_sn">
<view class="item row verCenter">
<text class="label">物流单号:</text>
<text class="text">{{ tallyDetail.tracking_no }}</text>
</view>
<view class="item row verCenter">
<text class="label">箱号:</text>
<text class="text">{{ tallyDetail.box_sn }}</text>
</view>
</template>
<template v-else>
<view class="item row verCenter" style="flex: 0 0 100%;">
<text class="label">物流单号:</text>
<text class="text">{{ tallyDetail.tracking_no }}</text>
</view>
</template>
<view class="item row verCenter">
<text class="label">到货时间:</text>
<text class="tt">{{ tallyDetail.arrival_time_cn }}</text>
</view>
<view class="item row verCenter" style="margin-bottom: 17rpx;">
<text class="label">到货操作人:</text>
<text class="tt">{{ tallyDetail.arrival_name }}</text>
</view>
</view>
<view class="bor"></view>
<view class="item-tit row verCenter">
<template v-if="tallyDetail.sku_id > 0">
<text v-for="(v, idx) in tallyTabItems" :key="idx" :class="{ curr: tallyCurr == idx }" @click="tallyCurr = idx">{{ v }}</text>
</template>
<template v-else>
<text>货品信息</text>
</template>
</view>
<template v-if="tallyCurr == 0">
<view class="field-item row">
<template v-if="tallyDetail.sku_id > 0">
<view class="item row verCenter">
<text class="label">货品编码:</text>
<text class="tt" style="max-width: 100%;">{{ tallyDetail.goods_sn }}</text>
</view>
<view class="item row verCenter">
<text class="label">自营货品ID:</text>
<text class="tt" style="max-width: 100%;">{{ tallyDetail.sku_id }}</text>
</view>
</template>
<template v-else>
<view class="item row verCenter" style="flex: 0 0 100%;">
<text class="label">货品编码:</text>
<text class="tt" style="max-width: 100%;">{{ tallyDetail.goods_sn }}</text>
</view>
</template>
<view class="item row verCenter" style="flex: 0 0 100%;">
<text class="label">货品名称:</text>
<text class="tt" style="max-width: 100%;">{{ tallyDetail.goods_name }}</text>
</view>
<view class="item row verCenter" style="flex: 0 0 100%;">
<text class="label">标准品牌:</text>
<text class="tt" style="max-width: 100%;">{{ tallyDetail.brand_name }}</text>
</view>
<view class="item row verCenter">
<text class="label">货品品质:</text>
<text class="tt">{{ tallyDetail.quality_cn }}</text>
</view>
<view class="item row verCenter">
<text class="label">预期数量:</text>
<text class="tt">{{ tallyDetail.expect_qty }}</text>
</view>
<view class="item row verCenter">
<text class="label">单 位:</text>
<text class="tt">{{ tallyDetail.goods_unit }}</text>
</view>
<view class="item row verCenter">
<text class="label">待理货数量:</text>
<text class="tt" style="color: #f98119;font-weight: bold;">{{ tallyDetail.wait_tally_qty }}</text>
</view>
<view class="item row verCenter">
<text class="label">是否质检:</text>
<text class="text" style="font-weight: bold;">{{ tallyDetail.is_qc_cn }}</text>
</view>
<view class="item row verCenter">
<text class="label">库存类型:</text>
<text class="tt">{{ tallyDetail.stock_type_cn }}</text>
</view>
<view class="item row verCenter" v-if="tallyDetail.sku_id > 0">
<text class="label">包装:</text>
<text class="tt">{{ tallyDetail.packing_cn }} - {{ tallyDetail.mpq }}</text>
</view>
<view class="item row verCenter">
<text class="label">销售员:</text>
<text class="tt">{{ tallyDetail.sale_user }}</text>
</view>
<view class="item row verCenter">
<text class="label">采购员:</text>
<text class="tt">{{ tallyDetail.purchase_user }}/{{ tallyDetail.purchase_department_name }}</text>
</view>
<view class="item row verCenter" style="flex: 0 0 100%;">
<text class="label">客户:</text>
<text class="text" style="font-weight: bold;max-width: 491rpx;">{{ tallyDetail.customer_name }}</text>
</view>
<view class="item row" style="flex: 0 0 100%;" v-if="tallyDetail.customer_material_number">
<text class="label" style="width: 112rpx;">客户物料编码:</text>
<text class="tt" style="max-width: 491rpx;">{{ tallyDetail.customer_material_number }}</text>
</view>
<view class="item row" style="flex: 0 0 100%;" v-if="tallyDetail.pack_requeire">
<text class="label" style="width: 112rpx;">包装要求:</text>
<text class="tt" style="max-width: 491rpx;color: red;">{{ tallyDetail.pack_requeire }}</text>
</view>
<view class="item row" style="flex: 0 0 100%;" v-if="tallyDetail.is_need_three_qc">
<text class="label" style="width: 112rpx;">需三方送检:</text>
<text class="tt" style="max-width: 491rpx;color: red;">需三方送检</text>
</view>
<view class="item row verCenter" style="flex: 0 0 100%;">
<text class="label">供应商:</text>
<text class="tt" style="max-width: 491rpx;">{{ tallyDetail.supplier_name }}</text>
</view>
<view class="item row" style="flex: 0 0 100%;">
<text class="label">上游备注:</text>
<text class="desc" style="max-width: 491rpx;color: #f00;">{{ tallyDetail.stock_in_upstream_remark }}</text>
</view>
<view class="item row" style="flex: 0 0 100%;">
<text class="label">明细备注:</text>
<text class="desc" style="max-width: 491rpx;color: #f00;">{{ tallyDetail.upstream_remark }}</text>
</view>
</view>
<!-- 理货表单 -->
<view class="form-input">
<view class="tally-tips-row" v-if="tallyIsTips">
<text style="color: red;font-size:16rpx;">⚠注意:理货数与待理货数不一致</text>
</view>
<view class="row bothSide verCenter input-box-wrap">
<view>
<view class="input-title">
<text class="input-title-t1">*</text>
<text class="input-title-t2">理货数量:</text>
</view>
<view class="input-box"><input type="number" class="uni-input" placeholder-style="color:#919399" placeholder="请输入理货数量" v-model="tallyFormParams.tally_qty" @input="handleTallyInputNumber($event, tallyDetail.wait_tally_qty)" /></view>
</view>
<view>
<view class="input-title">
<text class="input-title-t1" v-if="tallyIsDcRequired">*</text>
<text class="input-title-t2">D / C:</text>
</view>
<view class="input-box"><input type="text" class="uni-input" placeholder-style="color:#919399" placeholder="请输入D/C" v-model="tallyFormParams.date_code" /></view>
</view>
</view>
<view class="row bothSide verCenter input-box-wrap">
<view>
<view class="input-title">
<text class="input-title-t1" v-if="tallyDetail.stock_in_type == 4">*</text>
<text class="input-title-t2">COO:</text>
</view>
<view class="pick-box">
<picker @change="bindTallyPickerChange($event, 'coo')" :value="tallyCooIndex" :range="tallyUseOption" :range-key="'name'">
<view class="row verCenter">
<view class="uni-input">{{ tallyCooIndex == -1 ? '请选择' : tallyUseOption[tallyCooIndex].name }}</view>
<view class="uni-arrow"></view>
</view>
</picker>
</view>
</view>
<view>
<view class="input-title">
<text class="input-title-t1" v-if="tallyDetail.stock_in_type == 4">*</text>
<text class="input-title-t2">COD:</text>
</view>
<view class="pick-box">
<picker @change="bindTallyPickerChange($event, 'cod')" :value="tallyCodIndex" :range="tallyUseOption" :range-key="'name'">
<view class="row verCenter">
<view class="uni-input">{{ tallyCodIndex == -1 ? '请选择' : tallyUseOption[tallyCodIndex].name }}</view>
<view class="uni-arrow"></view>
</view>
</picker>
</view>
</view>
</view>
</view>
<!-- 理货照片 -->
<view class="h2 row bothSide verCenter" style="margin-top: 34rpx;">
<view>
<text>理货照片:</text>
<text class="tt">最多只支持{{ maxImageCount }}张图</text>
</view>
<view class="num">
<text class="t1">{{ tallyImageList.length }}</text>
<text class="t2">/{{ maxImageCount }}</text>
</view>
</view>
<view class="pic-list row">
<template v-if="tallyImageList.length > 0">
<view class="box" v-for="(item, index) in tallyImageList" :key="index">
<image :src="item" mode="aspectFill" @click="previewImage(tallyImageList, index)"></image>
<text class="iconfont icon-a-juxing11" @click="deleteTallyPic(index)"></text>
</view>
</template>
<view class="default row rowCenter verCenter" @click="chooseTallyImage()" v-if="tallyImageList.length < maxImageCount"><text class="iconfont icon-a-juxing3"></text></view>
</view>
<p style="color: red;font-size: 17rpx;margin-bottom: 10rpx;" v-if="tallyDetail.is_watch == 1">选中包含有采购需看货的物料,建议上传理货照片!</p>
<view class="print row verCenter" @click="tallyPicFlag = !tallyPicFlag; tallyFormParams.is_mobile_default_img = tallyPicFlag ? 1 : 0;">
<text class="check-box-icon" :class="{ curr: tallyPicFlag }"></text>
<text class="tt">整单照片</text>
</view>
<!-- 理货备注 -->
<view class="h2">理货备注:</view>
<view class="textarea-box"><textarea placeholder-style="color:#919399" placeholder="请输入理货备注" v-model="tallyFormParams.tally_remark" /></view>
</template>
<!-- 其他信息 tab(深圳自营) -->
<template v-else>
<view class="field-item row">
<view class="item row verCenter" style="flex: 0 0 100%;" v-if="tallyDetail.sku_id">
<text class="label">自营货品ID:</text>
<text class="text" style="max-width: 100%;">{{ tallyDetail.sku_id }}</text>
</view>
<view class="item row verCenter">
<text class="label">货品名称:</text>
<text class="tt">{{ tallyDetail.goods_name }}</text>
</view>
<view class="item row verCenter">
<text class="label">标准品牌:</text>
<text class="tt">{{ tallyDetail.brand_name }}</text>
</view>
<view class="item row verCenter">
<text class="label">包装方式:</text>
<text class="tt">{{ tallyDetail.packing_cn }}</text>
</view>
<view class="item row verCenter">
<text class="label">标准包装量:</text>
<text class="tt">{{ tallyDetail.mpq }}</text>
</view>
<view class="item row verCenter" style="flex: 0 0 100%;">
<text class="label" style="width: 128rpx;">单位长宽高:</text>
<text class="tt" style="max-width: 100%;">{{ tallyDetail.unit_length }}&nbsp;*{{ tallyDetail.unit_width }}&nbsp;*{{ tallyDetail.unit_high }}</text>
</view>
<view class="item row verCenter">
<text class="label" style="width: 113rpx;">单位净重:</text>
<text class="tt">{{ tallyDetail.unit_net_weight }}</text>
</view>
<view class="item row verCenter">
<text class="label" style="width: 113rpx;">单位毛重:</text>
<text class="tt">{{ tallyDetail.unit_gross_weight }}</text>
</view>
<view class="item row verCenter" style="flex: 0 0 100%;">
<text class="label" style="width: 128rpx;">标准包装长宽高:</text>
<text class="tt" style="max-width: 100%;">{{ tallyDetail.standard_length }}&nbsp;*{{ tallyDetail.standard_width }}&nbsp;*{{ tallyDetail.standard_high }}</text>
</view>
<view class="item row verCenter">
<text class="label" style="width: 113rpx;">标准包装净重:</text>
<text class="tt">{{ tallyDetail.standard_net_weight }}</text>
</view>
<view class="item row verCenter">
<text class="label" style="width: 113rpx;">标准包装毛重:</text>
<text class="tt">{{ tallyDetail.standard_gross_weight }}</text>
</view>
<view class="item row verCenter">
<text class="label">其他属性:</text>
<text class="tt">{{ tallyDetail.picking_other_attr }}</text>
</view>
<view class="item row verCenter">
<text class="label">销售员:</text>
<text class="tt">{{ tallyDetail.sale_user }}</text>
</view>
<view class="item row verCenter">
<text class="label">采购员:</text>
<text class="tt">{{ tallyDetail.purchase_user }}</text>
</view>
<view class="item row verCenter" style="flex: 0 0 100%;">
<text class="label">客户:</text>
<text class="text" style="font-weight: bold;max-width: 491rpx;">{{ tallyDetail.customer_name }}</text>
</view>
<view class="item row verCenter" style="flex: 0 0 100%;">
<text class="label">供应商:</text>
<text class="tt" style="max-width: 491rpx;">{{ tallyDetail.supplier_name }}</text>
</view>
</view>
</template>
</view>
<!-- 底部操作栏 -->
<view class="fix-btn row verCenter">
<view class="btn1 row rowCenter verCenter" @click="tallyPrintFlag = !tallyPrintFlag; tallyFormParams.is_print = tallyPrintFlag ? 1 : 0;" style="width: 40%;">
<text class="check-box-icon" :class="{ curr: tallyPrintFlag }"></text>
<text class="text">打印入库标签</text>
</view>
<view class="btn2 row rowCenter verCenter" @click="createTallyReceiveSubmit" style="width: 60%;">理 货</view>
</view>
</view>
<!-- 待理货任务弹窗 -->
<uni-popup ref="popupTally" background-color="#F1F4F6">
<view class="popup-content-sn">
......@@ -222,12 +520,14 @@
keyword: '',
order_sn: '',
stock_in_id: '',
stock_in_item_id: '',
goods_type: '',
parsed_origin: '',
parsed_qty: '',
isRequestSent: false,
tallyList: [],
tallySelectedIndex: -1,
tallyStep: 0, // 0=扫码阶段 1=理货操作阶段
// 自营到货登记相关
indicatorDots: true,
autoplay: false,
......@@ -247,9 +547,52 @@
grossWeightSize: ['kg', 'g'],
grossWeightSizeIndex: 0,
otherAttrList: [],
pendingStockInId: null
pendingStockInId: null,
// 理货操作相关(与 tallyReceive/operate 一致)
img_upload_url: uni.getStorageSync('img_upload_url') || 'http://image.liexindev.net',
tallyDetail: null,
tallyCurr: 0,
tallyTabItems: ['货品信息', '其他信息'],
tallyPrintFlag: true,
tallyPicFlag: false,
tallyIsTips: false,
maxImageCount: 100,
tallyImageList: [],
tallyServerImageList: [],
tallyCooIndex: -1,
tallyCodIndex: -1,
tallyUseOption: [],
tallyFormParams: {
tally_qty: '',
date_code: '',
coo: '',
cod: '',
image_ids: '',
tally_remark: '',
is_print: 1,
is_mobile_default_img: 0,
is_batch: 0,
mpq: '',
purpose_type: 0
}
};
},
computed: {
tallyIsDcRequired() {
if (!this.tallyDetail) return false;
var { stock_in_type, stock_type } = this.tallyDetail;
return (stock_in_type == 1 && (stock_type == 2 || stock_type == 3));
}
},
watch: {
tallyServerImageList(arr) {
if (arr.length > 0) {
this.tallyFormParams.image_ids = arr.join(',');
} else {
this.tallyFormParams.image_ids = '';
}
}
},
methods: {
/**
* 搜索输入防抖处理
......@@ -336,7 +679,9 @@
// 入库单状态"已到货"(2),直接进入理货页,无需弹窗
if (item.stock_in_status === 2) {
this.stock_in_id = item.stock_in_id;
// TODO: 跳转到入库单明细理货页,等待后续指示
this.stock_in_item_id = item.stock_in_item_id;
this.pendingStockInId = item.stock_in_id;
this.enterTallyMode(item);
return;
}
// 入库单状态"新创建"(1),自动选中并弹窗
......@@ -384,16 +729,20 @@
}
var selectedItem = this.tallyList[this.tallySelectedIndex];
this.stock_in_id = selectedItem.stock_in_id;
this.stock_in_item_id = selectedItem.stock_in_item_id;
this.pendingStockInId = selectedItem.stock_in_id;
this.$refs.popupTally.close();
// 入库单状态"新创建"(1)需要到货登记
// 入库单状态"新创建"(1)需要先到货登记,再进入理货
if (selectedItem.stock_in_status === 1) {
this.addStockInRegister(selectedItem);
return;
}
// 入库单状态"已到货"(2)直接进入理货
// TODO: 进入理货页逻辑等待后续指示
if (selectedItem.stock_in_status === 2) {
this.enterTallyMode(selectedItem);
return;
}
},
/**
* 到货登记:判断是否自营且第一次入库
......@@ -420,13 +769,14 @@
});
},
/**
* 直接执行到货登记(非第一次入库)
* 直接执行到货登记(非第一次入库),成功后进入理货
*/
doStockInRegister() {
var selectedItem = this.tallyList[this.tallySelectedIndex] || this.tallyList[0];
this.request(API.addStockInRegister, 'POST', { stock_in_id: JSON.stringify([this.pendingStockInId]) }, true).then(res => {
if (res.code === 0) {
uni.showToast({ title: '登记成功', icon: 'success' });
this.clearInput();
this.enterTallyMode(selectedItem);
} else {
uni.showModal({
title: '提示',
......@@ -536,7 +886,7 @@
}
},
/**
* 自营资料提交 + 到货登记
* 自营资料提交 + 到货登记,成功后进入理货
*/
saveZyGoodsDataSubmit() {
var isEmptyMpq = this.saveZyGoodsParams.every(obj => obj.hasOwnProperty('mpq') && obj.mpq !== '');
......@@ -558,13 +908,14 @@
});
if (hasError) return;
var selectedItem = this.tallyList[this.tallySelectedIndex] || this.tallyList[0];
this.request(API.saveZyGoodsData, 'POST', { list: JSON.stringify(this.saveZyGoodsParams) }, true).then(res => {
if (res.code === 0) {
this.request(API.addStockInRegister, 'POST', { stock_in_id: JSON.stringify([this.pendingStockInId]) }, true).then(res => {
if (res.code === 0) {
uni.showToast({ title: '登记成功', icon: 'success' });
this.closeZyDrawer();
this.clearInput();
this.enterTallyMode(selectedItem);
} else {
uni.showModal({ title: '提示', content: res.msg, showCancel: false });
}
......@@ -574,16 +925,289 @@
}
});
},
// ==================== 理货操作相关方法(参考 tallyReceive/operate) ====================
/**
* 进入理货模式
* is_apart=1 拆货 -> 跳转 tallyReceive/operate 页面
* is_apart=0 非拆货 -> 当前页面展示理货表单
*/
enterTallyMode(selectedItem) {
if (selectedItem.is_apart == 1) {
uni.navigateTo({
url: '/pages/tallyReceive/operate?stock_in_item_id=' + selectedItem.stock_in_item_id +
'&stock_in_id=' + selectedItem.stock_in_id +
'&flag=fast&qty=' + this.parsed_qty +
'&origin=' + this.parsed_origin + '&batch='
});
} else {
this.tallyStep = 1;
this.getTallyData();
}
},
/**
* 获取待理货详情数据(接口与 tallyReceive/operate 一致)
*/
getTallyData() {
this.request(API.waitTallyReceiveList, 'POST', {
page: 1,
limit: 1,
stock_in_item_id: this.stock_in_item_id
}, false).then(res => {
if (res.code === 0) {
if (res.data.list.length > 0) {
this.tallyDetail = res.data.list[0];
this.tallyFormParams.tally_qty = res.data.list[0].wait_tally_qty;
this.tallyFormParams.date_code = res.data.list[0].expect_date_code;
if (res.data.list[0].mobile_default_img) {
this.tallyImageList = res.data.list[0].mobile_default_img.split(',');
} else {
this.tallyImageList = [];
}
// 扫码快速填充
if (this.parsed_qty) {
this.tallyFormParams.tally_qty = this.parsed_qty;
this.tallyIsTips = res.data.list[0].wait_tally_qty != Number(this.parsed_qty);
}
this.getTallyUseOption(res.data.list[0].coo, res.data.list[0].cod);
} else {
uni.showToast({ title: '该订单号没有理货数据', icon: 'none' });
}
} else {
uni.showToast({ title: res.msg, icon: 'error' });
}
});
},
/**
* 获取产地COO/COD选项并自动匹配
* @param {String} coo 上游传入的产地
* @param {String} cod 上游传入的COD
*/
getTallyUseOption(coo, cod) {
this.request(API.getUseOption, 'GET', { type: 'coo' }, false).then(res => {
if (res.code === 0 && res.data.length > 0) {
this.tallyUseOption = res.data;
if (coo) {
var cooIndex = res.data.findIndex(item => item.name.split('|').includes(coo));
if (cooIndex != -1) {
this.tallyCooIndex = cooIndex;
this.tallyFormParams.coo = res.data[cooIndex].value;
}
}
if (cod) {
var codIndex = res.data.findIndex(item => item.name.split('|').includes(cod));
if (codIndex != -1) {
this.tallyCodIndex = codIndex;
this.tallyFormParams.cod = res.data[codIndex].value;
}
}
if (this.parsed_origin) {
var originIndex = res.data.findIndex(item => item.name.split('|').includes(this.parsed_origin));
if (originIndex != -1) {
this.tallyCooIndex = originIndex;
this.tallyFormParams.coo = res.data[originIndex].value;
}
}
}
});
},
/**
* 理货表单 picker 选择变更
* @param {Object} e picker事件对象
* @param {String} type 类型:coo 或 cod
*/
bindTallyPickerChange(e, type) {
if (type == 'coo') {
this.tallyCooIndex = e.detail.value;
this.tallyFormParams.coo = this.tallyUseOption[e.detail.value].value;
} else if (type == 'cod') {
this.tallyCodIndex = e.detail.value;
this.tallyFormParams.cod = this.tallyUseOption[e.detail.value].value;
}
},
/**
* 监听理货数量输入,超过待理货数量时自动修正
*/
handleTallyInputNumber: debounce(function (event, wait_tally_qty) {
var waitQty = Number(wait_tally_qty);
var val = event.target.value * 1;
if (val > waitQty) {
this.tallyFormParams.tally_qty = waitQty;
}
this.tallyIsTips = val != waitQty;
}, 500),
/**
* 选择并上传理货图片(压缩后上传至OSS)
*/
chooseTallyImage() {
uni.chooseImage({
count: this.maxImageCount,
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: chooseImageRes => {
uni.showLoading({ title: '上传中...' });
var imagePaths = chooseImageRes.tempFilePaths;
var maxNum = Number(imagePaths.length) + Number(this.tallyImageList.length);
if (maxNum > this.maxImageCount) {
uni.hideLoading();
uni.showToast({ title: '图片不超过' + this.maxImageCount + '张', icon: 'none' });
return;
}
imagePaths.forEach(imagePath => {
uni.compressImage({
src: imagePath,
quality: 60,
success: compressedRes => {
uni.uploadFile({
url: this.img_upload_url + '/uploadImage?sys_type=4',
filePath: compressedRes.tempFilePath,
name: 'file',
timeout: 6000,
header: { 'Content-Type': 'multipart/form-data' },
success: uploadFileRes => {
this.tallyImageList.push(compressedRes.tempFilePath);
uni.hideLoading();
var data = JSON.parse(uploadFileRes.data);
if (data.code === 0) {
this.tallyServerImageList.push(data.data.oss_image_url);
} else {
uni.showToast({ title: data.msg, icon: 'none' });
}
},
fail: () => {
uni.hideLoading();
uni.showToast({ title: '上传图片失败', icon: 'none' });
}
});
}
});
});
}
});
},
/**
* 删除理货图片
* @param {Number} index 图片索引
*/
deleteTallyPic(index) {
this.tallyImageList.splice(index, 1);
this.tallyServerImageList.splice(index, 1);
},
/**
* 预览图片
* @param {Array} imgs 图片列表
* @param {Number} index 当前图片索引
*/
previewImage(imgs, index) {
uni.previewImage({ current: index, urls: imgs });
},
/**
* 理货提交(校验表单后调用 createTallyReceive 接口)
* 全部理货完成 -> 回到扫码状态
* 部分理货完成 -> 提示可继续理货
*/
createTallyReceiveSubmit() {
if (!this.tallyFormParams.tally_qty) {
uni.showModal({ title: '提示', content: '请填写理货数量', showCancel: false });
return;
}
if (this.tallyIsDcRequired && !this.tallyFormParams.date_code) {
uni.showModal({ title: '提示', content: '请填写D/C', showCancel: false });
return;
}
// 深圳2号仓 D/C 必须为四位数字
if (this.tallyDetail.warehouse_id == 9) {
var dcRegex = /^\d{4}$/;
if (!dcRegex.test(this.tallyFormParams.date_code)) {
uni.showModal({ title: '提示', content: 'D/C必须为四位数字', showCancel: false });
return;
}
}
var wait_tally_qty = Number(this.tallyDetail.wait_tally_qty);
var params = {
stock_in_id: this.stock_in_id,
stock_in_item_id: this.stock_in_item_id,
tally_qty: this.tallyFormParams.tally_qty,
date_code: this.tallyFormParams.date_code,
tally_remark: this.tallyFormParams.tally_remark,
image_ids: this.tallyFormParams.image_ids,
coo: this.tallyFormParams.coo,
cod: this.tallyFormParams.cod,
is_mobile_default_img: this.tallyFormParams.is_mobile_default_img,
is_print: this.tallyFormParams.is_print,
is_batch: this.tallyFormParams.is_batch,
mpq: this.tallyFormParams.mpq,
purpose_type: this.tallyFormParams.purpose_type
};
this.request(API.createTallyReceive, 'POST', params, true).then(res => {
if (res.code === 0) {
if (wait_tally_qty == this.tallyFormParams.tally_qty) {
uni.showToast({ title: '全部理货成功', icon: 'success' });
setTimeout(() => { this.clearInput(); }, 2000);
} else {
uni.showModal({
title: '提示',
content: '理货成功,点击确定可继续理货',
showCancel: false,
success: res => {
if (res.confirm) {
this.resetTallyForm();
this.getTallyData();
}
}
});
}
} else {
uni.showModal({ title: '提示', content: res.msg, showCancel: false });
}
});
},
/**
* 重置理货表单数据(继续理货时调用)
*/
resetTallyForm() {
this.tallyFormParams = {
tally_qty: '',
date_code: '',
coo: '',
cod: '',
image_ids: '',
tally_remark: '',
is_print: 1,
is_mobile_default_img: 0,
is_batch: 0,
mpq: '',
purpose_type: 0
};
this.tallyImageList = [];
this.tallyServerImageList = [];
this.tallyCooIndex = -1;
this.tallyCodIndex = -1;
this.tallyIsTips = false;
this.tallyPicFlag = false;
},
/**
* 清空输入并重新聚焦
* 清空所有输入和状态,回到扫码初始状态并重新聚焦
*/
clearInput() {
this.keyword = '';
this.goods_type = '';
this.order_sn = '';
this.stock_in_id = '';
this.stock_in_item_id = '';
this.parsed_origin = '';
this.parsed_qty = '';
this.tallyStep = 0;
this.tallyDetail = null;
this.tallyCurr = 0;
this.resetTallyForm();
this.is_focus = false;
setTimeout(() => { this.is_focus = true; }, 200);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment