|
@@ -16,7 +16,7 @@
|
|
|
<el-col :span="10">
|
|
|
<el-form-item label="订单类型" prop="type" :rules="rules.type">
|
|
|
<!-- @change="cleanGoodsList" -->
|
|
|
- <el-select v-model="OrderForm.type" clearable>
|
|
|
+ <el-select v-model="OrderForm.type" clearable>
|
|
|
<el-option
|
|
|
v-for="(item, index) in orderTypeList"
|
|
|
:key="index"
|
|
@@ -30,37 +30,38 @@
|
|
|
<el-form-item
|
|
|
label="租赁时间"
|
|
|
prop="time"
|
|
|
- v-if="OrderForm.type=='TO_C'"
|
|
|
:rules="rules.time"
|
|
|
+ v-if="OrderForm.type == 'TO_C'"
|
|
|
>
|
|
|
- <el-date-picker
|
|
|
- v-model="time"
|
|
|
- type="daterange"
|
|
|
- align="center"
|
|
|
- :editable="false"
|
|
|
- unlink-panels
|
|
|
- :clearable="false"
|
|
|
- :default-time="['00:00:00', '23:59:59']"
|
|
|
- range-separator="-"
|
|
|
- start-placeholder="开始日期"
|
|
|
- end-placeholder="结束日期"
|
|
|
- value-format="yyyy-MM-dd hh:mm:ss"
|
|
|
- :picker-options="{
|
|
|
- disabledDate(time) {
|
|
|
- return (
|
|
|
- time.getTime()<=
|
|
|
- new Date(
|
|
|
- new Date().getFullYear(),
|
|
|
- new Date().getMonth(),
|
|
|
- new Date().getDate()
|
|
|
- ).getTime() -
|
|
|
- 86400000
|
|
|
- );
|
|
|
- },
|
|
|
- shortcuts: MixinPickerShortcuts,
|
|
|
- }"
|
|
|
- >
|
|
|
- </el-date-picker>
|
|
|
+ <!-- -->
|
|
|
+ <el-date-picker
|
|
|
+ v-model="time"
|
|
|
+ type="daterange"
|
|
|
+ align="center"
|
|
|
+ :editable="false"
|
|
|
+ unlink-panels
|
|
|
+ :clearable="false"
|
|
|
+ :default-time="['00:00:00', '23:59:59']"
|
|
|
+ range-separator="-"
|
|
|
+ start-placeholder="开始日期"
|
|
|
+ end-placeholder="结束日期"
|
|
|
+ value-format="yyyy-MM-dd hh:mm:ss"
|
|
|
+ :picker-options="{
|
|
|
+ disabledDate(time) {
|
|
|
+ return (
|
|
|
+ time.getTime() <=
|
|
|
+ new Date(
|
|
|
+ new Date().getFullYear(),
|
|
|
+ new Date().getMonth(),
|
|
|
+ new Date().getDate()
|
|
|
+ ).getTime() -
|
|
|
+ 86400000
|
|
|
+ );
|
|
|
+ },
|
|
|
+ shortcuts: MixinPickerShortcuts,
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ </el-date-picker>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="10">
|
|
@@ -98,16 +99,22 @@
|
|
|
</el-col>
|
|
|
<el-col :span="10">
|
|
|
<el-form-item
|
|
|
- label="付款金额:"
|
|
|
+ label="应付金额:"
|
|
|
prop="pay_price"
|
|
|
:rules="rules.pay_price"
|
|
|
>
|
|
|
- <span>{{ '¥'+3340 }}</span>
|
|
|
- <span>实付价格:</span>
|
|
|
- <!-- <span>折扣:<el-input placeholder="请输入"></el-input>
|
|
|
- </span> -->
|
|
|
+ <span>{{ "¥" + price }}</span>
|
|
|
+ <span
|
|
|
+ >折扣:<el-input
|
|
|
+ placeholder="请输入"
|
|
|
+ v-model="discount"
|
|
|
+ onKeyUp="value=value.replace(/^((0\.[1-9]{1})|(([1-9]{1})(\.\d{1})?))$/,'')"
|
|
|
+ style="width: 70px"
|
|
|
+ ></el-input>
|
|
|
+ </span>
|
|
|
+ <span>实付金额:</span>
|
|
|
<el-input
|
|
|
- v-model="OrderForm.pay_price"
|
|
|
+ v-model="OrderForm.real_price"
|
|
|
placeholder="请输入"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
@@ -226,42 +233,46 @@
|
|
|
<el-table-column type="selection" width="40" align="center" />
|
|
|
<el-table-column label="商品编号">
|
|
|
<template slot-scope="scope">
|
|
|
- {{ scope.row.sn }}
|
|
|
+ {{ scope.row.goods_vo.sn }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="商品名称">
|
|
|
<template slot-scope="scope">
|
|
|
- {{ scope.row.name }}
|
|
|
+ {{ scope.row.goods_vo.name }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="条码">
|
|
|
<template slot-scope="scope">
|
|
|
- {{ scope.row.bar_code }}
|
|
|
+ <span v-if="!id"> {{ scope.row.bar_code }}</span>
|
|
|
+ <span v-else> {{ scope.row.product_vo.bar_code }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="序列号">
|
|
|
<template slot-scope="scope">
|
|
|
- {{ scope.row.sn_code }}
|
|
|
+ <span v-if="!id"> {{ scope.row.sn_code }}</span>
|
|
|
+ <span v-else> {{ scope.row.product_vo.sn_code }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="规格型号">
|
|
|
<template slot-scope="scope">
|
|
|
- {{ scope.row.goods_style }}
|
|
|
+ <span v-if="!id">{{ scope.row.spec_name.join("/") }}</span>
|
|
|
+ <span v-else>{{ scope.row.product_vo.spec_name.join("/") }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="单位">
|
|
|
<template slot-scope="scope">
|
|
|
- {{ scope.row.goods_unit }}
|
|
|
+ <span v-if="!id"> {{ scope.row.unit }}</span>
|
|
|
+ <span v-else> {{ scope.row.product_vo.unit }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="订单数量">
|
|
|
<template slot-scope="scope">
|
|
|
<el-input
|
|
|
- v-model="scope.row.num"
|
|
|
- type="number"
|
|
|
- :min="0"
|
|
|
- :maxlength="20"
|
|
|
- ></el-input>
|
|
|
+ v-model="scope.row.num"
|
|
|
+ type="number"
|
|
|
+ :min="0"
|
|
|
+ :maxlength="20"
|
|
|
+ ></el-input>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="库存数量">
|
|
@@ -271,7 +282,7 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="差异">
|
|
|
<template slot-scope="scope">
|
|
|
- {{scope.row.usable_stock - scope.row.num || 0 }}
|
|
|
+ {{ scope.row.usable_stock - scope.row.num || 0 }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<!-- <el-table-column label="数量">
|
|
@@ -403,44 +414,84 @@
|
|
|
<el-button @click="roBack()" :disabled="false">返回</el-button>
|
|
|
</div>
|
|
|
</el-form>
|
|
|
- <el-dialog title="添加客户信息" :visible.sync="customer.dialogVisible" width="1100px"
|
|
|
- @open="handleDialogOpen" :modal-append-to-body="false" :close-on-click-modal="false" :close-on-press-escape="false">
|
|
|
- <el-form :model="customer.supplierForm" :rules="customer.supplierRules" ref="supplierForm" label-width="120px" inline>
|
|
|
- <el-form-item label="公司名称" prop="name">
|
|
|
- <el-input v-model="customer.supplierForm.name" :minlength="2" :maxlength="20" clearable
|
|
|
- placeholder="请输入公司名称"></el-input>
|
|
|
+ <el-dialog
|
|
|
+ title="添加客户信息"
|
|
|
+ :visible.sync="customer.dialogVisible"
|
|
|
+ width="1100px"
|
|
|
+ @open="handleDialogOpen"
|
|
|
+ :modal-append-to-body="false"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :close-on-press-escape="false"
|
|
|
+ >
|
|
|
+ <el-form
|
|
|
+ :model="customer.supplierForm"
|
|
|
+ :rules="customer.supplierRules"
|
|
|
+ ref="supplierForm"
|
|
|
+ label-width="120px"
|
|
|
+ inline
|
|
|
+ >
|
|
|
+ <el-form-item label="公司名称" prop="name">
|
|
|
+ <el-input
|
|
|
+ v-model="customer.supplierForm.name"
|
|
|
+ :minlength="2"
|
|
|
+ :maxlength="20"
|
|
|
+ clearable
|
|
|
+ placeholder="请输入公司名称"
|
|
|
+ ></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="客户联系人" prop="contact ">
|
|
|
- <el-input v-model="customer.supplierForm.contact " :minlength="2" :maxlength="20" clearable
|
|
|
- placeholder="请输入客户联系人"></el-input>
|
|
|
+ <el-input
|
|
|
+ v-model="customer.supplierForm.contact"
|
|
|
+ :minlength="2"
|
|
|
+ :maxlength="20"
|
|
|
+ clearable
|
|
|
+ placeholder="请输入客户联系人"
|
|
|
+ ></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="性别" prop="gender">
|
|
|
- <el-radio v-model="customer.supplierForm.gender" label="男">男</el-radio>
|
|
|
- <el-radio v-model="customer.supplierForm.gender" label="女">女</el-radio>
|
|
|
+ <el-radio v-model="customer.supplierForm.gender" label="男"
|
|
|
+ >男</el-radio
|
|
|
+ >
|
|
|
+ <el-radio v-model="customer.supplierForm.gender" label="女"
|
|
|
+ >女</el-radio
|
|
|
+ >
|
|
|
</el-form-item>
|
|
|
<el-form-item label="手机号码" prop="mobile">
|
|
|
- <el-input v-model="customer.supplierForm.mobile" :minlength="2" :maxlength="20" clearable
|
|
|
- placeholder="请输入手机号码"></el-input>
|
|
|
- </el-form-item>
|
|
|
+ <el-input
|
|
|
+ v-model="customer.supplierForm.mobile"
|
|
|
+ :minlength="2"
|
|
|
+ :maxlength="20"
|
|
|
+ clearable
|
|
|
+ placeholder="请输入手机号码"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="邮件" prop="email">
|
|
|
- <el-input v-model="customer.supplierForm.email" :minlength="2" :maxlength="20" clearable
|
|
|
- placeholder="请输入电子邮件"></el-input>
|
|
|
+ <el-input
|
|
|
+ v-model="customer.supplierForm.email"
|
|
|
+ :minlength="2"
|
|
|
+ :maxlength="20"
|
|
|
+ clearable
|
|
|
+ placeholder="请输入电子邮件"
|
|
|
+ ></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="客户类别" prop="type">
|
|
|
- <el-select v-model="customer.supplierForm.type" placeholder="请选择客户类别">
|
|
|
- <el-option
|
|
|
- v-for="item in customer.options"
|
|
|
- :key="item.value"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
+ <el-select
|
|
|
+ v-model="customer.supplierForm.type"
|
|
|
+ placeholder="请选择客户类别"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in customer.options"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
<!-- <el-form-item label="状态" prop="status">
|
|
|
<el-input v-model="customer.supplierForm.status" :minlength="2" :maxlength="20" clearable
|
|
|
placeholder="请输入客户状态"></el-input>
|
|
|
</el-form-item> -->
|
|
|
-
|
|
|
</el-form>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
<el-button @click="customer.dialogVisible = false">取 消</el-button>
|
|
@@ -455,7 +506,7 @@ import { mapGetters } from "vuex";
|
|
|
import * as API_Order from "@/api/order";
|
|
|
import * as API_BasicSetting from "@/api/basicSetting";
|
|
|
import * as API_Member from "@/api/member";
|
|
|
-import * as API_Setting from '@/api/setting'
|
|
|
+import * as API_Setting from "@/api/setting";
|
|
|
import * as API_CollectingAccount from "@/api/collectingAccount";
|
|
|
import { RegExp } from "~/ui-utils";
|
|
|
import {
|
|
@@ -485,7 +536,7 @@ export default {
|
|
|
return {
|
|
|
brcode: false,
|
|
|
options: regionData,
|
|
|
- selectedOptions: [''],
|
|
|
+ selectedOptions: [""],
|
|
|
warehouseList: [], // 仓库列表
|
|
|
memberList: [], // 会员列表
|
|
|
marketingList: [], // 销售经理列表
|
|
@@ -505,11 +556,11 @@ export default {
|
|
|
id: "",
|
|
|
/** 订单表单*/
|
|
|
OrderForm: {
|
|
|
- //省市区地址
|
|
|
- province_city_area:"",
|
|
|
+ //省市区地址
|
|
|
+ province_city_area: "",
|
|
|
//详细信息
|
|
|
- address:"",
|
|
|
- province_city_area_address:"",
|
|
|
+ address: "",
|
|
|
+ province_city_area_address: "",
|
|
|
},
|
|
|
formLoading: false,
|
|
|
isDetail: undefined,
|
|
@@ -532,7 +583,7 @@ export default {
|
|
|
order_time: [this.MixinRequired("下单时间不能为空", "change")],
|
|
|
payment_status: [this.MixinRequired("支付状态不能为空", "change")],
|
|
|
payment_time: [this.MixinRequired("支付时间不能为空", "change")],
|
|
|
- // delivery_type: [this.MixinRequired("请选择配送方式", "change")],
|
|
|
+ // delivery_type: [this.MixinRequired("请选择配送方式", "change")],
|
|
|
product_list: {
|
|
|
num: [
|
|
|
this.MixinRequired("数量不能为空", "change"),
|
|
@@ -622,59 +673,67 @@ export default {
|
|
|
orderTypeList: [],
|
|
|
// 条形码
|
|
|
barcodeValue: "",
|
|
|
- time:[],
|
|
|
+ time: [],
|
|
|
//新增客户
|
|
|
- customer:{
|
|
|
- dialogVisible:false,
|
|
|
+ customer: {
|
|
|
+ dialogVisible: false,
|
|
|
supplierRules: {
|
|
|
- custom_sn: [
|
|
|
- this.MixinRequired('请输入客户编号!'),
|
|
|
- { min: 2, max: 20, message: '长度在 2 到 20 个字符' },
|
|
|
- {
|
|
|
- validator: (rule, value, callback) => {
|
|
|
- if (value && !RegExp.userName.test(value)) {
|
|
|
- callback(new Error('只支持汉字、字母、数字、“-”、“_”的组合!'))
|
|
|
- } else {
|
|
|
- callback()
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- ],
|
|
|
- postal_address: [this.MixinRequired('请输入通讯地址!')],
|
|
|
- telephone: [
|
|
|
- this.MixinRequired('请输入联系电话!'),
|
|
|
- {
|
|
|
- validator: (rule, value, callback) => {
|
|
|
- if (!RegExp.mobile.test(value)) {
|
|
|
- callback(new Error('联系电话格式有误!'))
|
|
|
- } else {
|
|
|
- callback()
|
|
|
- }
|
|
|
+ custom_sn: [
|
|
|
+ this.MixinRequired("请输入客户编号!"),
|
|
|
+ { min: 2, max: 20, message: "长度在 2 到 20 个字符" },
|
|
|
+ {
|
|
|
+ validator: (rule, value, callback) => {
|
|
|
+ if (value && !RegExp.userName.test(value)) {
|
|
|
+ callback(
|
|
|
+ new Error("只支持汉字、字母、数字、“-”、“_”的组合!")
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ callback();
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
- trigger: ['change', 'blur']
|
|
|
- }
|
|
|
- ],
|
|
|
- name: [this.MixinRequired('请输入联系人!')],
|
|
|
- mobile: [
|
|
|
- this.MixinRequired('请输入手机号码!'),
|
|
|
- {
|
|
|
- validator: (rule, value, callback) => {
|
|
|
- if (!RegExp.mobile.test(value)) {
|
|
|
- callback(new Error('手机号码格式有误!'))
|
|
|
- } else {
|
|
|
- callback()
|
|
|
- }
|
|
|
+ ],
|
|
|
+ postal_address: [this.MixinRequired("请输入通讯地址!")],
|
|
|
+ telephone: [
|
|
|
+ this.MixinRequired("请输入联系电话!"),
|
|
|
+ {
|
|
|
+ validator: (rule, value, callback) => {
|
|
|
+ if (!RegExp.mobile.test(value)) {
|
|
|
+ callback(new Error("联系电话格式有误!"));
|
|
|
+ } else {
|
|
|
+ callback();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ trigger: ["change", "blur"],
|
|
|
},
|
|
|
- trigger: ['change', 'blur']
|
|
|
- }
|
|
|
- ],
|
|
|
- gender:[{required: true, message: '请选择性别', trigger: 'change' }],
|
|
|
- type:[{ required: true, message: '请选择客户类别', trigger: 'change' }],
|
|
|
- contact:[{ required: true, message: '请输入客户联系人', trigger: 'blur' }],
|
|
|
+ ],
|
|
|
+ name: [this.MixinRequired("请输入联系人!")],
|
|
|
+ mobile: [
|
|
|
+ this.MixinRequired("请输入手机号码!"),
|
|
|
+ {
|
|
|
+ validator: (rule, value, callback) => {
|
|
|
+ if (!RegExp.mobile.test(value)) {
|
|
|
+ callback(new Error("手机号码格式有误!"));
|
|
|
+ } else {
|
|
|
+ callback();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ trigger: ["change", "blur"],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ gender: [
|
|
|
+ { required: true, message: "请选择性别", trigger: "change" },
|
|
|
+ ],
|
|
|
+ type: [
|
|
|
+ { required: true, message: "请选择客户类别", trigger: "change" },
|
|
|
+ ],
|
|
|
+ contact: [
|
|
|
+ { required: true, message: "请输入客户联系人", trigger: "blur" },
|
|
|
+ ],
|
|
|
},
|
|
|
- supplierForm:{},
|
|
|
- options:[
|
|
|
- /* {
|
|
|
+ supplierForm: {},
|
|
|
+ options: [
|
|
|
+ /* {
|
|
|
value: '全部',
|
|
|
label: '全部'
|
|
|
},{
|
|
@@ -684,8 +743,10 @@ export default {
|
|
|
value: '租赁客户',
|
|
|
label: '租赁客户'
|
|
|
}, */
|
|
|
- ]
|
|
|
- }
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ //折扣
|
|
|
+ discount: 0,
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
@@ -703,35 +764,37 @@ export default {
|
|
|
methods: {
|
|
|
/** dialog打开后重置form表单校验结果 */
|
|
|
handleDialogOpen() {
|
|
|
- setTimeout(() => { this.$refs['supplierForm'].clearValidate() })
|
|
|
- this.customer.supplierForm={}
|
|
|
+ setTimeout(() => {
|
|
|
+ this.$refs["supplierForm"].clearValidate();
|
|
|
+ });
|
|
|
+ this.customer.supplierForm = {};
|
|
|
},
|
|
|
submitSupplierForm() {
|
|
|
- this.$refs['supplierForm'].validate((valid) => {
|
|
|
+ this.$refs["supplierForm"].validate((valid) => {
|
|
|
if (valid) {
|
|
|
- const { id } = this.customer.supplierForm
|
|
|
- const params = this.MixinClone(this.customer.supplierForm)
|
|
|
- API_BasicSetting.addCustomer(params).then(() => {
|
|
|
- this.customer.dialogVisible = false
|
|
|
- this.$message.success('添加成功!')
|
|
|
- this.GET_CustomerList()
|
|
|
- })
|
|
|
+ const { id } = this.customer.supplierForm;
|
|
|
+ const params = this.MixinClone(this.customer.supplierForm);
|
|
|
+ API_BasicSetting.addCustomer(params).then(() => {
|
|
|
+ this.customer.dialogVisible = false;
|
|
|
+ this.$message.success("添加成功!");
|
|
|
+ this.GET_CustomerList();
|
|
|
+ });
|
|
|
} else {
|
|
|
- this.$message.error('表单填写有误,请核对!')
|
|
|
- return false
|
|
|
+ this.$message.error("表单填写有误,请核对!");
|
|
|
+ return false;
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
},
|
|
|
// 添加客户
|
|
|
- addCust(){
|
|
|
- this.customer.dialogVisible=true
|
|
|
+ addCust() {
|
|
|
+ this.customer.dialogVisible = true;
|
|
|
},
|
|
|
handleChange(value) {
|
|
|
- this.OrderForm.province_city_area=value.join(",")
|
|
|
+ this.OrderForm.province_city_area = value.join(",");
|
|
|
console.log(this.OrderForm.province_city_area);
|
|
|
/**/
|
|
|
|
|
|
- //打印区域码所对应的属性值即中文地址
|
|
|
+ //打印区域码所对应的属性值即中文地址
|
|
|
},
|
|
|
/** 初始化 */
|
|
|
init() {
|
|
@@ -762,9 +825,9 @@ export default {
|
|
|
console.log(this.customerList);
|
|
|
})
|
|
|
.catch(() => {});
|
|
|
- API_Setting.getPage({dictType:"order_type"}).then(res=>{
|
|
|
- this.orderTypeList=res.data
|
|
|
- })
|
|
|
+ API_Setting.getPage({ dictType: "order_type" }).then((res) => {
|
|
|
+ this.orderTypeList = res.data;
|
|
|
+ });
|
|
|
},
|
|
|
/** 获取会员列表 */
|
|
|
GET_MemberList() {
|
|
@@ -778,12 +841,15 @@ export default {
|
|
|
},
|
|
|
/** 获取销售经理列表 */
|
|
|
GET_MarketingList() {
|
|
|
- API_BasicSetting.getMarketingManagerList({
|
|
|
+ /* API_BasicSetting.getMarketingManagerList({
|
|
|
page_no: 1,
|
|
|
page_size: -1,
|
|
|
disable_flag: 0,
|
|
|
}).then((response) => {
|
|
|
this.marketingList = response.data;
|
|
|
+ }); */
|
|
|
+ API_BasicSetting.getUserByDept().then((res) => {
|
|
|
+ this.marketingList = res;
|
|
|
});
|
|
|
},
|
|
|
/** 获取自提门店列表 */
|
|
@@ -822,12 +888,13 @@ export default {
|
|
|
}
|
|
|
|
|
|
const goodsData = await this.$EnPickerGoods({
|
|
|
- goodsApi: `/admin/erp/warehouseOut/getGoodByWarehouse/${this.OrderForm.warehouse_id}`,
|
|
|
+ goodsApi: `/admin/erp/warehouseOut/getGoodByWarehouse/${this.OrderForm.warehouse_id}/${this.OrderForm.type}`,
|
|
|
selectedIds: this.OrderForm.product_list.map((item) => item.product_id),
|
|
|
- goodsApiParams: { warehouse_id: this.OrderForm.warehouse_id },
|
|
|
+ goodsApiParams: { order_type: this.OrderForm.type },
|
|
|
});
|
|
|
|
|
|
- this.OrderForm.product_list = goodsData.map((item) => {
|
|
|
+ this.OrderForm.product_list = goodsData;
|
|
|
+ /* .map((item) => {
|
|
|
// 初始化字段,和订单的item字段名保持一致
|
|
|
item.product_id = item.id;
|
|
|
item.product_name = item.name;
|
|
@@ -843,14 +910,14 @@ export default {
|
|
|
// 合计
|
|
|
|
|
|
return item;
|
|
|
- });
|
|
|
+ }); */
|
|
|
},
|
|
|
/** 添加支付方式 */
|
|
|
handleInsertPayment() {
|
|
|
const defaultCollectingAccount = this.collectingAccountList.findLast(
|
|
|
(item) => item.default_flag === true
|
|
|
);
|
|
|
- /* this.OrderForm.payment_list.push({
|
|
|
+ /* this.OrderForm.payment_list.push({
|
|
|
collecting_account_id: defaultCollectingAccount
|
|
|
? defaultCollectingAccount.id
|
|
|
: null,
|
|
@@ -954,21 +1021,32 @@ export default {
|
|
|
delete this.OrderForm.start_time;
|
|
|
delete this.OrderForm.end_time;
|
|
|
if (this.time) {
|
|
|
- this.OrderForm.start_time = this.time[0]
|
|
|
- this.OrderForm.end_time = this.time[1]
|
|
|
+ this.OrderForm.start_time = this.time[0];
|
|
|
+ this.OrderForm.end_time = this.time[1];
|
|
|
}
|
|
|
delete this.time;
|
|
|
var loc = "";
|
|
|
- for (let i = 0; i < this.selectedOptions.length; i++) {
|
|
|
- loc += codeToText[this.selectedOptions[i]]+',';
|
|
|
- }
|
|
|
- this.OrderForm.province_city_area_address=loc+this.OrderForm.address
|
|
|
+ for (let i = 0; i < this.selectedOptions.length; i++) {
|
|
|
+ loc += codeToText[this.selectedOptions[i]] + ",";
|
|
|
+ }
|
|
|
+ this.OrderForm.province_city_area_address = loc + this.OrderForm.address;
|
|
|
const params = this.MixinClone(this.OrderForm);
|
|
|
- params.item_list=params.product_list
|
|
|
- /**/ params.product_list.map(el=>{
|
|
|
- el.goods_id=el.id
|
|
|
- el.id=""
|
|
|
- })
|
|
|
+ params.product_list = params.product_list.map((el) => {
|
|
|
+ el.product_id = el.id;
|
|
|
+ el.id = "";
|
|
|
+ return el;
|
|
|
+ });
|
|
|
+ /* params.item_list = params.product_list;
|
|
|
+ params.product_list.map((el) => {
|
|
|
+ el.goods_id = el.id;
|
|
|
+ el.id = "";
|
|
|
+ });*/
|
|
|
+ params.price = this.price;
|
|
|
+ params.real_price = Number(params.real_price);
|
|
|
+ /* params.product_list.map((el) => {
|
|
|
+ return (el.product_id = el.id);
|
|
|
+ }); */
|
|
|
+ params.item_list = params.product_list;
|
|
|
params.order_time = Math.floor(params.order_time / 1000);
|
|
|
params.payment_time = Math.floor(params.payment_time / 1000);
|
|
|
this.formLoading = true;
|
|
@@ -993,9 +1071,9 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
//确认并保存订单
|
|
|
- async saveSubmitOrderForm(){
|
|
|
- // 校验商品明细数据
|
|
|
- const valid = await this.$refs.orderFormRef
|
|
|
+ async saveSubmitOrderForm() {
|
|
|
+ // 校验商品明细数据
|
|
|
+ const valid = await this.$refs.orderFormRef
|
|
|
.validate()
|
|
|
.catch((err) => err);
|
|
|
if (valid !== true) {
|
|
@@ -1007,22 +1085,28 @@ export default {
|
|
|
delete this.OrderForm.start_time;
|
|
|
delete this.OrderForm.end_time;
|
|
|
if (this.time) {
|
|
|
- this.OrderForm.start_time = this.time[0]
|
|
|
- this.OrderForm.end_time = this.time[1]
|
|
|
+ this.OrderForm.start_time = this.time[0];
|
|
|
+ this.OrderForm.end_time = this.time[1];
|
|
|
}
|
|
|
delete this.time;
|
|
|
var loc = "";
|
|
|
- for (let i = 0; i < this.selectedOptions.length; i++) {
|
|
|
- loc += codeToText[this.selectedOptions[i]]+',';
|
|
|
- }
|
|
|
- this.OrderForm.province_city_area_address=loc+this.OrderForm.address
|
|
|
+ for (let i = 0; i < this.selectedOptions.length; i++) {
|
|
|
+ loc += codeToText[this.selectedOptions[i]] + ",";
|
|
|
+ }
|
|
|
+ this.OrderForm.province_city_area_address = loc + this.OrderForm.address;
|
|
|
const params = this.MixinClone(this.OrderForm);
|
|
|
- console.log(params);
|
|
|
- params.item_list=params.product_list
|
|
|
- /**/ params.product_list.map(el=>{
|
|
|
- el.goods_id=el.id
|
|
|
- el.id=""
|
|
|
- })
|
|
|
+ params.product_list = params.product_list.map((el) => {
|
|
|
+ el.product_id = el.id;
|
|
|
+ el.id = "";
|
|
|
+ return el;
|
|
|
+ });
|
|
|
+ params.price = this.price;
|
|
|
+ params.real_price = Number(params.real_price);
|
|
|
+ params.item_list = params.product_list;
|
|
|
+ /* params.product_list.map((el) => {
|
|
|
+ el.goods_id = el.id;
|
|
|
+ el.id = "";
|
|
|
+ });*/
|
|
|
params.order_time = Math.floor(params.order_time / 1000);
|
|
|
params.payment_time = Math.floor(params.payment_time / 1000);
|
|
|
this.formLoading = true;
|
|
@@ -1030,10 +1114,10 @@ export default {
|
|
|
API_Order.editOrder(id, params)
|
|
|
.then((response) => {
|
|
|
this.$message.success("修改成功!");
|
|
|
- API_Order.submit(id).then(res=>{
|
|
|
- this.$message.success("订单已确认")
|
|
|
+ API_Order.submit(id).then((res) => {
|
|
|
+ this.$message.success("订单已确认");
|
|
|
this.backOrderList();
|
|
|
- })
|
|
|
+ });
|
|
|
})
|
|
|
.finally(() => {
|
|
|
this.formLoading = false;
|
|
@@ -1043,9 +1127,10 @@ export default {
|
|
|
.then((res) => {
|
|
|
this.$message.success("添加成功!");
|
|
|
console.log(res);
|
|
|
- /**/API_Order.submit(res).then(res=>{
|
|
|
- this.$message.success("订单已确认") })
|
|
|
- this.backOrderList();
|
|
|
+ /**/ API_Order.submit(res).then((res) => {
|
|
|
+ this.$message.success("订单已确认");
|
|
|
+ });
|
|
|
+ this.backOrderList();
|
|
|
})
|
|
|
.finally(() => {
|
|
|
this.formLoading = false;
|
|
@@ -1057,9 +1142,9 @@ export default {
|
|
|
API_BasicSetting.getWarehouseListAll({}).then((response) => {
|
|
|
this.warehouseList = response;
|
|
|
});
|
|
|
- API_Setting.getPage({ dictType: "customer_type"}).then(res=>{
|
|
|
- this.customer.options=res.data
|
|
|
- })
|
|
|
+ API_Setting.getPage({ dictType: "customer_type" }).then((res) => {
|
|
|
+ this.customer.options = res.data;
|
|
|
+ });
|
|
|
},
|
|
|
/** 审核 */
|
|
|
async handleAudit(isPass, remark) {
|
|
@@ -1087,53 +1172,58 @@ export default {
|
|
|
/** 获取订单详情 */
|
|
|
GET_OrderDetail() {
|
|
|
API_Order.getOrderDetail(this.id).then((response) => {
|
|
|
- response.product_list=response.item_list.map(el=>{
|
|
|
- el.allow_sn=el.goods_vo.allow_sn
|
|
|
- el.bar_code=el.goods_vo.bar_code
|
|
|
- el.brand_id=el.goods_vo.brand_id
|
|
|
- el.brand_name=el.goods_vo.brand_name
|
|
|
- el.category_id=el.goods_vo.category_id
|
|
|
- el.category_ids=el.goods_vo.category_ids
|
|
|
- el.category_name=el.goods_vo.category_name
|
|
|
- el.cost_price=el.goods_vo.cost_price
|
|
|
- el.create_time=el.goods_vo.create_time
|
|
|
- el.creator=el.goods_vo.creator
|
|
|
- el.description=el.goods_vo.description
|
|
|
- el.en_name=el.goods_vo.en_name
|
|
|
- el.freight_template_id=el.goods_vo.freight_template_id
|
|
|
- el.goods_style=el.goods_vo.goods_style
|
|
|
- el.goods_unit=el.goods_vo.goods_unit
|
|
|
- el.goods_unit=el.goods_vo.goods_unit
|
|
|
- el.have_spec=el.goods_vo.have_spec
|
|
|
- el.hire_or_sail=el.goods_vo.hire_or_sail
|
|
|
- el.id=el.goods_vo.id
|
|
|
- el.image=el.goods_vo.image
|
|
|
- el.image_list=el.goods_vo.image_list
|
|
|
- el.label_names=el.goods_vo.label_names
|
|
|
- el.market_enable=el.goods_vo.market_enable
|
|
|
- el.mkt_price=el.goods_vo.mkt_price
|
|
|
- el.name=el.goods_vo.name
|
|
|
- el.params_list=el.goods_vo.params_list
|
|
|
- el.price=el.goods_vo.price
|
|
|
- el.sn=el.goods_vo.sn
|
|
|
- el.sn_code=el.goods_vo.sn_code
|
|
|
- el.sort=el.goods_vo.sort
|
|
|
- el.update_time=el.goods_vo.update_time
|
|
|
- el.updater=el.goods_vo.updater
|
|
|
- el.usable_stock=el.goods_vo.usable_stock
|
|
|
- el.video=el.goods_vo.video
|
|
|
- return el
|
|
|
- })
|
|
|
+ /**/ this.price = response.price;
|
|
|
+ response.product_list = response.item_list; /* .map((el) => {
|
|
|
+ el.allow_sn = el.goods_vo.allow_sn;
|
|
|
+ el.bar_code = el.goods_vo.bar_code;
|
|
|
+ el.brand_id = el.goods_vo.brand_id;
|
|
|
+ el.brand_name = el.goods_vo.brand_name;
|
|
|
+ el.category_id = el.goods_vo.category_id;
|
|
|
+ el.category_ids = el.goods_vo.category_ids;
|
|
|
+ el.category_name = el.goods_vo.category_name;
|
|
|
+ el.cost_price = el.goods_vo.cost_price;
|
|
|
+ el.create_time = el.goods_vo.create_time;
|
|
|
+ el.creator = el.goods_vo.creator;
|
|
|
+ el.description = el.goods_vo.description;
|
|
|
+ el.en_name = el.goods_vo.en_name;
|
|
|
+ el.freight_template_id = el.goods_vo.freight_template_id;
|
|
|
+ el.goods_style = el.goods_vo.goods_style;
|
|
|
+ el.goods_unit = el.goods_vo.goods_unit;
|
|
|
+ el.goods_unit = el.goods_vo.goods_unit;
|
|
|
+ el.have_spec = el.goods_vo.have_spec;
|
|
|
+ el.hire_or_sail = el.goods_vo.hire_or_sail;
|
|
|
+ el.id = el.goods_vo.id;
|
|
|
+ el.image = el.goods_vo.image;
|
|
|
+ el.image_list = el.goods_vo.image_list;
|
|
|
+ el.label_names = el.goods_vo.label_names;
|
|
|
+ el.market_enable = el.goods_vo.market_enable;
|
|
|
+ el.mkt_price = el.goods_vo.mkt_price;
|
|
|
+ el.name = el.goods_vo.name;
|
|
|
+ el.params_list = el.goods_vo.params_list;
|
|
|
+ el.price = el.goods_vo.price;
|
|
|
+ el.sn = el.goods_vo.sn;
|
|
|
+ el.sn_code = el.goods_vo.sn_code;
|
|
|
+ el.sort = el.goods_vo.sort;
|
|
|
+ el.update_time = el.goods_vo.update_time;
|
|
|
+ el.updater = el.goods_vo.updater;
|
|
|
+ el.usable_stock = el.goods_vo.usable_stock;
|
|
|
+ el.video = el.goods_vo.video;
|
|
|
+ return el;
|
|
|
+ }); */
|
|
|
|
|
|
- this.selectedOptions=response.province_city_area.split(",")
|
|
|
+ this.selectedOptions = response.province_city_area.split(",");
|
|
|
this.OrderForm = response;
|
|
|
- console.log( this.OrderForm);
|
|
|
- /* this.fileList = response.attachment
|
|
|
+ console.log(this.OrderForm.product_list);
|
|
|
+ /* this.fileList = response.attachment
|
|
|
? [{ name: "附件", url: response.attachment }]
|
|
|
- : []; */
|
|
|
+ : [];
|
|
|
this.OrderForm.order_time = Math.floor(
|
|
|
this.OrderForm.order_time * 1000
|
|
|
- );
|
|
|
+ );*/
|
|
|
+ if (response.type == "TO_C") {
|
|
|
+ this.time.push(response.start_time);
|
|
|
+ this.time.push(response.end_time);
|
|
|
+ }
|
|
|
if (this.OrderForm.payment_time) {
|
|
|
this.OrderForm.payment_time = Math.floor(
|
|
|
this.OrderForm.payment_time * 1000
|
|
@@ -1142,19 +1232,65 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ price() {
|
|
|
+ let total = 0;
|
|
|
+ if(!this.OrderForm.product_list) return
|
|
|
+ if (!this.id) {
|
|
|
+ if (this.OrderForm.type == "TO_C") {
|
|
|
+ var start = new Date(this.time[1]); // 将起始日期字符串转换为Date对象
|
|
|
+ var end = new Date(this.time[0]); // 将结束日期字符串转换为Date对象
|
|
|
+ var timeDiff = Math.abs(end.getTime() - start.getTime()); // 获取时间差(单位:毫秒)
|
|
|
+ var monthDiff = Math.ceil(timeDiff / (24 * 60 * 60 * 1000)); // 根据每个月平均天数进行近似计算
|
|
|
+ this.OrderForm.product_list.map((item) => {
|
|
|
+ total += item.day_price * item.num * monthDiff;
|
|
|
+ });
|
|
|
+ return total;
|
|
|
+ } else {
|
|
|
+ this.OrderForm.product_list.map((item) => {
|
|
|
+ total += item.price * item.num;
|
|
|
+ });
|
|
|
+ return total;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (this.OrderForm.type == "TO_C") {
|
|
|
+ var start = new Date(this.time[1]); // 将起始日期字符串转换为Date对象
|
|
|
+ var end = new Date(this.time[0]); // 将结束日期字符串转换为Date对象
|
|
|
+ var timeDiff = Math.abs(end.getTime() - start.getTime()); // 获取时间差(单位:毫秒)
|
|
|
+ var monthDiff = Math.ceil(timeDiff / (24 * 60 * 60 * 1000)); // 根据每个月平均天数进行近似计算
|
|
|
+ this.OrderForm.product_list.map((item) => {
|
|
|
+ total += item.product_vo.day_price * item.num * monthDiff;
|
|
|
+ });
|
|
|
+ return total;
|
|
|
+ } else {
|
|
|
+ this.OrderForm.product_list.map((item) => {
|
|
|
+ total += item.product_vo.price * item.num;
|
|
|
+ });
|
|
|
+ return total;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
watch: {
|
|
|
+ discount: {
|
|
|
+ deep: true,
|
|
|
+ handler(newVal) {
|
|
|
+ this.OrderForm.pay_price = this.price * newVal;
|
|
|
+ },
|
|
|
+ },
|
|
|
"OrderForm.product_list": {
|
|
|
deep: true,
|
|
|
handler(newVal) {
|
|
|
newVal.forEach((item) => {
|
|
|
- // 税额(总)
|
|
|
- item.tax_price = item.total_price * item.tax_rate * 0.01;
|
|
|
- // 合计
|
|
|
+ /* item.sum=item.price*item.num
|
|
|
+ return console.log(item.sum+=); */
|
|
|
});
|
|
|
/* this.OrderForm.total_price = newVal.reduce(
|
|
|
(sum, item) => sum + item.total_price,
|
|
|
0
|
|
|
- );
|
|
|
+ ); // 税额(总)
|
|
|
+ item.tax_price = item.total_price * item.tax_rate * 0.01;
|
|
|
+ // 合计
|
|
|
this.OrderForm.discount_price = newVal.reduce(
|
|
|
(sum, item) => sum + item.discount_price * 1,
|
|
|
0
|