qb 8 months ago
parent
commit
ca5a90deda
  1. 8
      src/api/distribution/distributionStockArticle.js
  2. 6
      src/views/distribution/inventory/delivery/SeparateTheList.vue
  3. 119
      src/views/distribution/inventory/delivery/distributionStockArticle.vue

8
src/api/distribution/distributionStockArticle.js

@ -433,3 +433,11 @@ export const $_batchcreatetask = data => {
data,
});
};
//查询是否已经拆单过
export const $_checkordercode = data => {
return request({
url: '/api/logpm-distribution/split-order-task/check-order-code',
method: 'post',
data,
});
};

6
src/views/distribution/inventory/delivery/SeparateTheList.vue

@ -118,9 +118,7 @@ const $router = useRouter();
const $store = useStore();
const details =
reactive <
any >
{
reactive ({
/** 是否开启搜索 */
search: true,
/** 表格搜索条件 */
@ -189,7 +187,7 @@ const details =
/** 查看 */
view: false,
},
};
});
const { search, query, shortcuts, stockupDate, data, loadingObj, selectionList, drawerShow, page } =
toRefs(details);

119
src/views/distribution/inventory/delivery/distributionStockArticle.vue

@ -406,6 +406,11 @@
<!-- 拆单弹窗 -->
<el-dialog v-model="dialogSplitthe" title="新增拆单任务">
<el-button type="primary" @click="newadd">新增</el-button>
<div style="margin-top: 20px" class="el_txt_title">
<el-text>拆单任务:{{ Splittheform.PackageList.length }}</el-text>
<el-text>在库件数:{{ this.dataRwo.handQuantity }}</el-text>
<el-text>拆单件数总数:{{ Totalnumbersplitorders }}</el-text>
</div>
<el-form
:model="Splittheform"
label-width="auto"
@ -423,9 +428,11 @@
>
<el-input-number
v-model="item.taskNumber"
:min="1"
:min="0"
:controls="false"
placeholder="请输入拆单件数"
@change="changeTaskNumber"
:value-on-clear='0'
/>
</el-form-item>
<el-form-item
@ -440,12 +447,7 @@
:prop="`PackageList[${index}.customerTelephone]`"
:rules="ruleForm.customerTelephone"
>
<el-input-number
v-model="item.customerTelephone"
:min="1"
:controls="false"
placeholder="请输入客户电话"
/>
<el-input v-model="item.customerTelephone" placeholder="请输入客户电话" />
</el-form-item>
</div>
<el-form-item
@ -456,6 +458,9 @@
>
<el-input v-model="item.customerAddress" placeholder="请输入客户地址" />
</el-form-item>
<div class="el_delete">
<el-button type="primary" @click="packListdelete(item, index)">删除</el-button>
</div>
</div>
<el-divider />
</template>
@ -488,6 +493,7 @@ import {
postShowOrderCode,
getCollectt,
$_batchcreatetask,
$_checkordercode,
} from '@/api/distribution/distributionStockArticle';
import { getListOwn } from '@/api/distribution/distributionParcelList';
import { addCallDelivery, $_updateBatchClient } from '@/api/distribution/distrilbutionCallDelivery';
@ -511,20 +517,16 @@ export default {
return {
excelForm: {},
excelBox: false,
Totalnumbersplitorders: 0,
dataRwo: {},
ruleForm: {
taskNumber: [
{ required: true, message: '请输入请输入拆单件数', trigger: ['blur', 'change'] },
],
customerName: [
{ required: true, message: '请输入请输入客户名称', trigger: ['blur', 'change'] },
],
taskNumber: [{ required: true, message: '请输入请输入拆单件数', trigger: ['change'] }],
customerName: [{ required: true, message: '请输入请输入客户名称', trigger: ['change'] }],
customerTelephone: [
{ required: true, message: '请输入请输入客户电话', trigger: ['blur', 'change'] },
],
customerAddress: [
{ required: true, message: '请输入请输入客户地址', trigger: ['blur', 'change'] },
{ required: true, message: '请输入请输入客户电话', trigger: ['change'] },
{ validator: this.validatePhone, trigger: 'blur' },
],
customerAddress: [{ required: true, message: '请输入请输入客户地址', trigger: ['change'] }],
},
ruleFormRef: null,
dialogSplitthe: false,
@ -696,6 +698,13 @@ export default {
return ids.join(',');
},
},
watch: {
// item.customerTelephone
'item.customerTelephone'(newValue, aaaa) {
console.log('新值:', newValue);
console.log('旧值:', aaaa);
},
},
methods: {
//
handleExport() {
@ -1205,17 +1214,73 @@ export default {
};
this.Splittheform.PackageList.push(data);
},
//
validatePhone(rule, value, callback) {
const phonePattern = /^1[3-9]\d{9}$/; //
if (!value) {
callback(new Error('请输入客户电话'));
} else if (!phonePattern.test(value)) {
callback(new Error('请输入有效的电话号码'));
} else {
callback();
}
},
//
Splittheorder(row) {
console.log(row);
this.dataRwo = row;
let data={
orderCode:row.orderCode,
}
$_checkordercode(data).then(res=>{
console.log(res,'是否可以拆单');
})
this.dialogSplitthe = true;
},
//
changeTaskNumber() {
this.Totalnumbersplitorders = this.Splittheform.PackageList.reduce(
(accumulator, currentValue) => {
if (!currentValue || currentValue.taskNumber == null) {
return accumulator;
}
return accumulator + currentValue.taskNumber;
},
0
);
},
//
packListdelete(item, index) {
if (this.Splittheform.PackageList.length == 1) {
this.$message({
message: '至少保留一条数据',
type: 'warning',
});
return;
}
ElMessageBox.confirm('是否确认删除?', '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
this.Splittheform.PackageList.splice(index, 1);
})
.catch(() => {});
},
//
Splitordersubmission() {
console.log(this.dataRwo);
this.$refs.ruleFormRef.validate(vialid => {
if (vialid) {
let taskNumberState = this.Splittheform.PackageList.find(item => item.taskNumber == 0);
if (taskNumberState) {
this.$message({
message: '存在拆单数量能为0的任务',
type: 'warning',
});
return;
}
console.log(this.Splittheform.PackageList);
let sum = this.Splittheform.PackageList.reduce((accumulator, currentValue) => {
if (!currentValue || currentValue.taskNumber == null) {
@ -1236,16 +1301,14 @@ export default {
data.push({
stockArticleId: this.dataRwo.id, //ID
orderCode: this.dataRwo.orderCode, //
mallName: this.dataRwo.mallName, //
mallName: this.dataRwo.mallName, //
taskNumber: item.taskNumber, //
taskNumber: item.taskNumber, //
customerName: item.customerName, //
customerTelephone: item.customerTelephone, //
customerAddress: item.customerAddress, //
});
});
// this.dataRwo.handQuantity
console.log(data, '要提交的数据');
$_batchcreatetask(data).then(res => {
console.log(res, '拆单成功');
@ -1654,6 +1717,13 @@ export default {
flex-wrap: wrap;
height: 450px;
overflow-y: scroll;
.el_delete {
text-align: right;
.el-button {
background-color: #f44336;
border: none;
}
}
.el_item_box {
width: 100%;
border: 1px solid #ccc;
@ -1661,7 +1731,7 @@ export default {
margin-top: 10px;
border-radius: 7px;
box-shadow: 1px 1px #ccc;
height: max-content;
.el-form-item {
width: unset;
}
@ -1691,4 +1761,11 @@ export default {
}
}
}
.el_txt_title {
margin-top: 20px;
.el-text {
margin: 0 10px;
font-weight: bold;
}
}
</style>

Loading…
Cancel
Save