|
@@ -8,7 +8,25 @@
|
|
:rules="formRules"
|
|
:rules="formRules"
|
|
label-width="100px"
|
|
label-width="100px"
|
|
>
|
|
>
|
|
- <el-row :gutter="10">
|
|
|
|
|
|
+ <el-row :gutter="10" v-if="JDorder">
|
|
|
|
+ <el-col :span="8">
|
|
|
|
+ <el-form-item label="客户名称" required>
|
|
|
|
+ <el-input placeholder="京东" disabled> </el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="4">
|
|
|
|
+ <el-form-item label="订单类型" required>
|
|
|
|
+ <el-input placeholder="京东订单" disabled> </el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="4">
|
|
|
|
+ <el-form-item label="订单编号" required>
|
|
|
|
+ <el-input v-model="form.code" placeholder="请输入"> </el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
|
|
+
|
|
|
|
+ <el-row :gutter="10" v-else>
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
<el-form-item
|
|
<el-form-item
|
|
:label="$t('order_management.order.customerName')"
|
|
:label="$t('order_management.order.customerName')"
|
|
@@ -50,6 +68,7 @@
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
|
|
+
|
|
<div style="margin-bottom: 20px">
|
|
<div style="margin-bottom: 20px">
|
|
<labelTitle
|
|
<labelTitle
|
|
:content="$t('order_management.order.orderDetails')"
|
|
:content="$t('order_management.order.orderDetails')"
|
|
@@ -61,7 +80,7 @@
|
|
>
|
|
>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-form-item>
|
|
- <el-table :data="form.orderSalesDetailsList">
|
|
|
|
|
|
+ <el-table :data="form.orderDetailsList" v-if="JDorder">
|
|
<el-table-column
|
|
<el-table-column
|
|
:label="$t('order_management.order.productCode')"
|
|
:label="$t('order_management.order.productCode')"
|
|
prop="code"
|
|
prop="code"
|
|
@@ -82,7 +101,60 @@
|
|
<el-table-column label="数量" prop="quantity">
|
|
<el-table-column label="数量" prop="quantity">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
<el-form-item
|
|
<el-form-item
|
|
- :prop="'orderSalesDetailsList.' + scope.$index + '.quantity'"
|
|
|
|
|
|
+ :prop="'orderDetailsList.' + scope.$index + '.quantity'"
|
|
|
|
+ :rules="formRules.quantity"
|
|
|
|
+ :inline-message="true"
|
|
|
|
+ label-width="0"
|
|
|
|
+ >
|
|
|
|
+ <el-input-number
|
|
|
|
+ v-model="scope.row.quantity"
|
|
|
|
+ :label="$t('pleaseInput')"
|
|
|
|
+ style="width: 100%"
|
|
|
|
+ size="mini"
|
|
|
|
+ @change="totalAmount"
|
|
|
|
+ :controls="false"
|
|
|
|
+ :min="1"
|
|
|
|
+ :max="9999"
|
|
|
|
+ >
|
|
|
|
+ </el-input-number>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="小计" prop="subtotal"> </el-table-column>
|
|
|
|
+ <el-table-column
|
|
|
|
+ :label="$t('operation')"
|
|
|
|
+ width="100"
|
|
|
|
+ align="center"
|
|
|
|
+ >
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <el-button type="text" @click="deleteRow(scope.$index)">{{
|
|
|
|
+ $t("delete")
|
|
|
|
+ }}</el-button>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+ <el-table :data="form.orderDetailsList" v-else>
|
|
|
|
+ <el-table-column
|
|
|
|
+ :label="$t('order_management.order.productCode')"
|
|
|
|
+ prop="code"
|
|
|
|
+ >
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column
|
|
|
|
+ :label="$t('order_management.order.productName')"
|
|
|
|
+ prop="name"
|
|
|
|
+ >
|
|
|
|
+ </el-table-column>
|
|
|
|
+
|
|
|
|
+ <el-table-column
|
|
|
|
+ :label="$t('order_management.order.price')"
|
|
|
|
+ prop="price"
|
|
|
|
+ >
|
|
|
|
+ </el-table-column>
|
|
|
|
+
|
|
|
|
+ <el-table-column label="数量" prop="quantity">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <el-form-item
|
|
|
|
+ :prop="'orderDetailsList.' + scope.$index + '.quantity'"
|
|
:rules="formRules.quantity"
|
|
:rules="formRules.quantity"
|
|
:inline-message="true"
|
|
:inline-message="true"
|
|
label-width="0"
|
|
label-width="0"
|
|
@@ -224,10 +296,12 @@
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
- <el-input
|
|
|
|
- v-model="form.detailedAddress"
|
|
|
|
- :placeholder="$t('pleaseInput')"
|
|
|
|
- ></el-input>
|
|
|
|
|
|
+ <el-form-item label-width="0" prop="detailedAddress">
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="form.detailedAddress"
|
|
|
|
+ placeholder="详细地址"
|
|
|
|
+ ></el-input>
|
|
|
|
+ </el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -242,7 +316,7 @@
|
|
>
|
|
>
|
|
</div>
|
|
</div>
|
|
<el-dialog
|
|
<el-dialog
|
|
- :title="$t('orderSelect')"
|
|
|
|
|
|
+ title="物品选择"
|
|
v-if="selectDialog"
|
|
v-if="selectDialog"
|
|
:visible.sync="selectDialog"
|
|
:visible.sync="selectDialog"
|
|
width="80%"
|
|
width="80%"
|
|
@@ -271,6 +345,10 @@ export default {
|
|
type: Object,
|
|
type: Object,
|
|
default: () => {},
|
|
default: () => {},
|
|
},
|
|
},
|
|
|
|
+ JDorder: {
|
|
|
|
+ type: Boolean,
|
|
|
|
+ default: () => false,
|
|
|
|
+ },
|
|
customerSelectList: {
|
|
customerSelectList: {
|
|
type: Array,
|
|
type: Array,
|
|
default: () => [],
|
|
default: () => [],
|
|
@@ -362,6 +440,13 @@ export default {
|
|
trigger: "blur",
|
|
trigger: "blur",
|
|
},
|
|
},
|
|
],
|
|
],
|
|
|
|
+ detailedAddress: [
|
|
|
|
+ {
|
|
|
|
+ required: true,
|
|
|
|
+ message: "请输入详细地址",
|
|
|
|
+ trigger: "blur",
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
quantity: [
|
|
quantity: [
|
|
{
|
|
{
|
|
required: true,
|
|
required: true,
|
|
@@ -382,8 +467,13 @@ export default {
|
|
handleSubmit() {
|
|
handleSubmit() {
|
|
this.$refs.form.validate((valid) => {
|
|
this.$refs.form.validate((valid) => {
|
|
if (valid) {
|
|
if (valid) {
|
|
- if (!this.form.orderSalesDetailsList.length > 0)
|
|
|
|
- return this.msgInfo("请选择您需要的产品");
|
|
|
|
|
|
+ if (this.JDorder) {
|
|
|
|
+ if (!this.form.orderDetailsList.length > 0)
|
|
|
|
+ return this.msgInfo("请选择您需要的产品");
|
|
|
|
+ } else {
|
|
|
|
+ if (!this.form.orderDetailsList.length > 0)
|
|
|
|
+ return this.msgInfo("请选择您需要的产品");
|
|
|
|
+ }
|
|
this.loading = true;
|
|
this.loading = true;
|
|
this.$emit("submit");
|
|
this.$emit("submit");
|
|
}
|
|
}
|
|
@@ -403,33 +493,62 @@ export default {
|
|
});
|
|
});
|
|
},
|
|
},
|
|
handleSelect(row) {
|
|
handleSelect(row) {
|
|
- const flag = this.form.orderSalesDetailsList.some(
|
|
|
|
- (x) => x.productId === row.id
|
|
|
|
- );
|
|
|
|
- if (flag) return this.msgInfo("该产品您已选择");
|
|
|
|
- this.form.orderSalesDetailsList.push({
|
|
|
|
- code: row.code,
|
|
|
|
- name: row.name,
|
|
|
|
- subtotal: "",
|
|
|
|
- productId: row.id,
|
|
|
|
- quantity: undefined,
|
|
|
|
- price: row.purchasePrice,
|
|
|
|
- remark: "",
|
|
|
|
- });
|
|
|
|
|
|
+ if (this.JDorder) {
|
|
|
|
+ const flag = this.form.orderDetailsList.some(
|
|
|
|
+ (x) => x.productId === row.id
|
|
|
|
+ );
|
|
|
|
+ if (flag) return this.msgInfo("该产品您已选择");
|
|
|
|
+ this.form.orderDetailsList.push({
|
|
|
|
+ code: row.code,
|
|
|
|
+ name: row.name,
|
|
|
|
+ subtotal: "",
|
|
|
|
+ productId: row.id,
|
|
|
|
+ quantity: undefined,
|
|
|
|
+ price: row.purchasePrice,
|
|
|
|
+ remark: "",
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ const flag = this.form.orderDetailsList.some(
|
|
|
|
+ (x) => x.productId === row.id
|
|
|
|
+ );
|
|
|
|
+ if (flag) return this.msgInfo("该产品您已选择");
|
|
|
|
+ this.form.orderDetailsList.push({
|
|
|
|
+ code: row.code,
|
|
|
|
+ name: row.name,
|
|
|
|
+ subtotal: "",
|
|
|
|
+ productId: row.id,
|
|
|
|
+ quantity: undefined,
|
|
|
|
+ price: row.purchasePrice,
|
|
|
|
+ remark: "",
|
|
|
|
+ });
|
|
|
|
+ }
|
|
this.msgSuccess(this.$t("addSuccess"));
|
|
this.msgSuccess(this.$t("addSuccess"));
|
|
},
|
|
},
|
|
deleteRow(index) {
|
|
deleteRow(index) {
|
|
- this.form.orderSalesDetailsList.splice(index, 1);
|
|
|
|
|
|
+ if (this.JDorder) {
|
|
|
|
+ this.form.orderDetailsList.splice(index, 1);
|
|
|
|
+ } else {
|
|
|
|
+ this.form.orderDetailsList.splice(index, 1);
|
|
|
|
+ }
|
|
this.msgSuccess(this.$t("deleteSuccess"));
|
|
this.msgSuccess(this.$t("deleteSuccess"));
|
|
this.totalAmount();
|
|
this.totalAmount();
|
|
},
|
|
},
|
|
totalAmount() {
|
|
totalAmount() {
|
|
- this.form.orderSalesDetailsList.forEach((x) => {
|
|
|
|
- x.subtotal = Number(x.quantity) * Number(x.price);
|
|
|
|
- });
|
|
|
|
- this.form.money = this.form.orderSalesDetailsList.reduce((sum, x) => {
|
|
|
|
- return sum + Number(x.subtotal);
|
|
|
|
- }, 0);
|
|
|
|
|
|
+ if (this.JDorder) {
|
|
|
|
+ this.form.orderDetailsList.forEach((x) => {
|
|
|
|
+ x.subtotal = Number(x.quantity) * Number(x.price);
|
|
|
|
+ });
|
|
|
|
+ this.form.money = this.form.orderDetailsList.reduce((sum, x) => {
|
|
|
|
+ return sum + Number(x.subtotal);
|
|
|
|
+ }, 0);
|
|
|
|
+ } else {
|
|
|
|
+ this.form.orderDetailsList.forEach((x) => {
|
|
|
|
+ x.subtotal = Number(x.quantity) * Number(x.price);
|
|
|
|
+ });
|
|
|
|
+ this.form.money = this.form.orderDetailsList.reduce((sum, x) => {
|
|
|
|
+ return sum + Number(x.subtotal);
|
|
|
|
+ }, 0);
|
|
|
|
+ }
|
|
},
|
|
},
|
|
handleSuccess(response, file, fileList) {
|
|
handleSuccess(response, file, fileList) {
|
|
this.form.fileInfoList = fileList;
|
|
this.form.fileInfoList = fileList;
|