|
@@ -4,7 +4,7 @@
|
|
|
:title="title"
|
|
|
:center="true"
|
|
|
align="left"
|
|
|
- top="10vh"
|
|
|
+ top="8vh"
|
|
|
width="900px"
|
|
|
:close-on-click-modal="false"
|
|
|
:visible.sync="showModelThis"
|
|
@@ -29,13 +29,17 @@
|
|
|
@selection-change="handleSelectionChange($event, 0)"
|
|
|
>
|
|
|
<el-table-column type="selection" width="40" align="center" />
|
|
|
- <el-table-column prop="name" label="日期" width="120" />
|
|
|
- <el-table-column prop="name" label="姓名" width="120" />
|
|
|
<el-table-column
|
|
|
- prop="address"
|
|
|
- label="地址"
|
|
|
+ prop="wsm_supplier"
|
|
|
+ label="发货仓库"
|
|
|
show-overflow-tooltip
|
|
|
- />
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.wsm_supplier }}/{{ scope.row.wsm_name }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="num" label="下单数量" width="150" />
|
|
|
+ <el-table-column prop="original_price" label="销售价" width="110" />
|
|
|
</el-table>
|
|
|
</el-col>
|
|
|
<el-col :span="24">
|
|
@@ -52,61 +56,150 @@
|
|
|
@selection-change="handleSelectionChange($event, 1)"
|
|
|
>
|
|
|
<el-table-column type="selection" width="40" align="center" />
|
|
|
- <el-table-column prop="name" label="日期" width="120" />
|
|
|
- <el-table-column prop="name" label="姓名" width="120" />
|
|
|
<el-table-column
|
|
|
- prop="address"
|
|
|
- label="地址"
|
|
|
- show-overflow-tooltip
|
|
|
+ prop="receipt_quantity"
|
|
|
+ label="总数量"
|
|
|
+ width="100"
|
|
|
/>
|
|
|
+ <el-table-column prop="arrive_time" label="最晚到货时间" />
|
|
|
+ <el-table-column prop="contactor" label="收件人" width="60" />
|
|
|
+ <el-table-column prop="mobile" label="联系电话" width="105" />
|
|
|
+ <el-table-column
|
|
|
+ prop="contactor"
|
|
|
+ label="收件地址"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.addr_info }}{{ scope.row.addr }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <!-- <el-table-column prop="post_fee" label="物流费" width="100" /> -->
|
|
|
</el-table>
|
|
|
</el-col>
|
|
|
- <!-- <el-col :span="5" style="text-align: right">
|
|
|
- <el-button type="primary" @click="submitForm">保 存 </el-button>
|
|
|
- <el-button @click="showModelThis = false">关 闭</el-button>
|
|
|
- </el-col> -->
|
|
|
+ <el-form
|
|
|
+ ref="ruleForm"
|
|
|
+ :model="ruleForm"
|
|
|
+ status-icon
|
|
|
+ :rules="rulesThis"
|
|
|
+ label-width="90px"
|
|
|
+ class="demo-ruleForm"
|
|
|
+ >
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="发货数量" prop="send_num">
|
|
|
+ <el-input v-model="ruleForm.send_num" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="物流费用" prop="post_fee">
|
|
|
+ <el-input v-model="ruleForm.post_fee" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="物流公司" prop="post_name">
|
|
|
+ <el-input v-model="ruleForm.post_name" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="物流单号" prop="post_code">
|
|
|
+ <el-input v-model="ruleForm.post_code" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-col :span="24" style="text-align: right">
|
|
|
+ <el-button type="primary" @click="submitForm">保 存 </el-button>
|
|
|
+ <el-button @click="showModelThis = false">关 闭</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-form>
|
|
|
</el-row>
|
|
|
</el-card>
|
|
|
</el-dialog>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import asyncRequest from "@/apis/service/purchaseIn/purchaseOrder/detail";
|
|
|
+import asyncRequest from "@/apis/service/sellOut/salesOrder/detail";
|
|
|
import resToken from "@/mixins/resToken";
|
|
|
+import { isnumber, isnumber2, isAlphanumeric } from "@/utils/validate";
|
|
|
export default {
|
|
|
name: "Account",
|
|
|
props: ["showModel", "id", "sitem"],
|
|
|
mixins: [resToken],
|
|
|
data() {
|
|
|
+ const validatePrice = (rule, value, callback) => {
|
|
|
+ if (value === "") {
|
|
|
+ callback(new Error("不能为空!"));
|
|
|
+ } else {
|
|
|
+ if (isnumber2(value)) {
|
|
|
+ callback();
|
|
|
+ } else {
|
|
|
+ callback(new Error("仅支持整数或两位小数!"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ const validateWeight = (rule, value, callback) => {
|
|
|
+ if (value === "") {
|
|
|
+ callback(new Error("不能为空!"));
|
|
|
+ } else {
|
|
|
+ if (!isnumber(value)) {
|
|
|
+ callback(new Error("仅支持整数!"));
|
|
|
+ } else {
|
|
|
+ callback();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ const validateCode = (rule, value, callback) => {
|
|
|
+ if (value === "") {
|
|
|
+ callback(new Error("不能为空!"));
|
|
|
+ } else {
|
|
|
+ if (!isAlphanumeric(value)) {
|
|
|
+ callback(new Error("仅支持字母和数字!"));
|
|
|
+ } else {
|
|
|
+ callback();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
return {
|
|
|
roleList: [],
|
|
|
tableData: [],
|
|
|
tableData1: [],
|
|
|
loading: false,
|
|
|
title: "新建销售出库单",
|
|
|
- organizeList: [],
|
|
|
+ list1: [],
|
|
|
+ list0: [],
|
|
|
showModelThis: this.showModel,
|
|
|
rulesThis: {},
|
|
|
+ rules: {
|
|
|
+ send_num: {
|
|
|
+ required: true,
|
|
|
+ validator: validateWeight,
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ post_name: {
|
|
|
+ required: true,
|
|
|
+ trigger: "blur",
|
|
|
+ message: "请输入物流公司",
|
|
|
+ },
|
|
|
+ post_code: {
|
|
|
+ required: true,
|
|
|
+ validator: validateCode,
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ post_fee: {
|
|
|
+ required: true,
|
|
|
+ validator: validatePrice,
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ },
|
|
|
supplierName: "",
|
|
|
good_price: "0",
|
|
|
lasttime: "",
|
|
|
ruleForm: {
|
|
|
- nake_fee: "", //裸价
|
|
|
- wsm_code: "", //仓库
|
|
|
- supplier_code: "", //供应商
|
|
|
- supplierNo: [], //采购供应商编码
|
|
|
- good_num: "",
|
|
|
- expecttime: "",
|
|
|
- weight: "",
|
|
|
- now_god_price: "",
|
|
|
- teach_fee: "",
|
|
|
- pakge_fee: "",
|
|
|
- mark_fee: "",
|
|
|
- cert_fee: "",
|
|
|
- delivery_fee: "",
|
|
|
- open_fee: "",
|
|
|
- diff_weight: "",
|
|
|
- diff_fee: "",
|
|
|
- remark: "",
|
|
|
+ post_name: "", //裸价
|
|
|
+ post_code: "", //仓库
|
|
|
+ post_fee: "", //供应商
|
|
|
+ send_num: "", //采购供应商编码
|
|
|
+ addrid: "",
|
|
|
+ orderCode: "",
|
|
|
+ wsm_code: "",
|
|
|
},
|
|
|
};
|
|
|
},
|
|
@@ -129,74 +222,43 @@ export default {
|
|
|
},
|
|
|
|
|
|
handleSelectionChange(e, type) {
|
|
|
- // console.log(e);
|
|
|
- // console.log(type);
|
|
|
+ if (type === 0) {
|
|
|
+ this.list0 = e;
|
|
|
+ this.ruleForm.wsm_code = e && e.length > 0 ? e[0].wsm_code : "";
|
|
|
+ } else {
|
|
|
+ this.list1 = e;
|
|
|
+ this.ruleForm.addrid = e && e.length > 0 ? e[0].id : "";
|
|
|
+ }
|
|
|
+ console.log(type);
|
|
|
+ console.log(this.ruleForm.wsm_code, this.ruleForm.addrid);
|
|
|
+ console.log(this.ruleForm);
|
|
|
},
|
|
|
async initForm() {
|
|
|
this.loading = true;
|
|
|
- this.rulesThis = {};
|
|
|
+ this.list0 = [];
|
|
|
+ this.list1 = [];
|
|
|
+ this.rulesThis = this.rules;
|
|
|
await this.resetForm();
|
|
|
this.loading = false;
|
|
|
},
|
|
|
- // 选择供应商
|
|
|
- selectSupplier(e) {
|
|
|
- if (e && e.id) {
|
|
|
- this.ruleForm.supplierNo = [e.code];
|
|
|
- } else {
|
|
|
- this.ruleForm.supplierNo = [];
|
|
|
- this.ruleForm.stock_code = [];
|
|
|
- }
|
|
|
- this.$refs.ruleForm.validateField("supplierNo ");
|
|
|
- },
|
|
|
+
|
|
|
//初始化表单
|
|
|
async resetForm() {
|
|
|
await this.$nextTick(() => {
|
|
|
if (this.$refs.ruleForm) {
|
|
|
this.$refs.ruleForm.resetFields();
|
|
|
this.$refs.ruleForm.clearValidate();
|
|
|
- const {
|
|
|
- good_price,
|
|
|
- nake_fee,
|
|
|
- wsm_code,
|
|
|
- supplierNo,
|
|
|
- weight,
|
|
|
- now_god_price,
|
|
|
- teach_fee,
|
|
|
- pakge_fee,
|
|
|
- mark_fee,
|
|
|
- cert_fee,
|
|
|
- delivery_fee,
|
|
|
- open_fee,
|
|
|
- diff_weight,
|
|
|
- diff_fee,
|
|
|
- remark,
|
|
|
- good_num,
|
|
|
- supplier_name,
|
|
|
- lasttime,
|
|
|
- } = this.sitem;
|
|
|
- this.good_price = good_price || "0";
|
|
|
- this.supplierName = supplier_name;
|
|
|
- this.lasttime = lasttime || "";
|
|
|
+ const { addrs, info, orderCode } = this.sitem;
|
|
|
+ this.tableData = info;
|
|
|
+ this.tableData1 = addrs;
|
|
|
this.ruleForm = {
|
|
|
- cgdNo: this.id,
|
|
|
- nake_fee: nake_fee || "0", //裸价
|
|
|
- wsm_code: wsm_code || "", //仓库
|
|
|
- cgder_id: "",
|
|
|
- supplierNo: supplierNo ? [supplierNo] : [], //采购供应商
|
|
|
- good_num: good_num || "0",
|
|
|
- expecttime: lasttime || "", //预计入库时间
|
|
|
- weight: weight ? parseInt(weight + "") + "" : "0", //贵金属重量
|
|
|
- now_god_price: now_god_price || "10", //实时金价
|
|
|
- teach_fee: teach_fee || "0", //工艺费
|
|
|
- pakge_fee: pakge_fee || "0", //包装费
|
|
|
- mark_fee: mark_fee || "0", //加标费
|
|
|
- cert_fee: cert_fee || "0", //证书费
|
|
|
- delivery_fee: delivery_fee || "0", //物流费
|
|
|
- open_fee: open_fee || "0", //开模费
|
|
|
- diff_weight: diff_weight ? parseInt(diff_weight + "") + "" : "0", //工差重量
|
|
|
- diff_fee: diff_fee || "0", //工差金额
|
|
|
- remark: remark,
|
|
|
- good_price: "",
|
|
|
+ post_name: "顺丰",
|
|
|
+ post_code: "xxx2322",
|
|
|
+ post_fee: "20",
|
|
|
+ send_num: "10",
|
|
|
+ addrid: "",
|
|
|
+ orderCode: orderCode || "",
|
|
|
+ wsm_code: "",
|
|
|
};
|
|
|
}
|
|
|
});
|
|
@@ -207,11 +269,34 @@ export default {
|
|
|
if (valid) {
|
|
|
this.loading = true;
|
|
|
const item = JSON.parse(JSON.stringify(this.ruleForm));
|
|
|
- item.supplierNo = item.supplierNo.toString();
|
|
|
-
|
|
|
- console.log(item);
|
|
|
-
|
|
|
- const res = await asyncRequest.update(item);
|
|
|
+ if (this.list0.length === 0) {
|
|
|
+ this.$message.warning("请选择发货仓库!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (this.list1.length === 0) {
|
|
|
+ this.$message.warning("请选择收货地址!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (this.list0.length !== 1) {
|
|
|
+ this.$message.warning("只能选择一个发货仓库!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (this.list1.length !== 1) {
|
|
|
+ this.$message.warning("只能选择一个收货地址!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let cNum = parseInt(this.list0[0].num);
|
|
|
+ let aNum = parseInt(this.list1[0].send_num);
|
|
|
+ let num = parseInt(this.ruleForm.send_num);
|
|
|
+ if (num > cNum) {
|
|
|
+ this.$message.warning("发货数量不能大于仓库出货数量!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (num > aNum) {
|
|
|
+ this.$message.warning("发货数量不能大于收货地址总数量!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const res = await asyncRequest.saleout(item);
|
|
|
this.loading = false;
|
|
|
if (res && res.code === 0) {
|
|
|
this.$notify.success({
|