|
@@ -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"
|
|
@@ -26,6 +26,43 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
+ <el-col :span="10">
|
|
|
+ <el-form-item
|
|
|
+ label="租赁时间"
|
|
|
+ prop="time"
|
|
|
+ v-if="OrderForm.type=='TO_C'"
|
|
|
+ :rules="rules.time"
|
|
|
+ >
|
|
|
+ <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">
|
|
|
<el-form-item
|
|
|
label="下单客户"
|
|
@@ -40,6 +77,7 @@
|
|
|
:value="item.id"
|
|
|
/>
|
|
|
</el-select>
|
|
|
+ <el-button type="primary" @click="addCust">新增客户</el-button>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="10">
|
|
@@ -125,7 +163,7 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="10">
|
|
|
- <el-form-item label="配送地址" prop="addres">
|
|
|
+ <el-form-item label="配送地址" prop="province_city_area_address">
|
|
|
<!-- <el-select v-model="OrderForm.addres">
|
|
|
<el-option
|
|
|
v-for="item in marketingList"
|
|
@@ -143,7 +181,7 @@
|
|
|
>
|
|
|
</el-cascader>
|
|
|
<el-input
|
|
|
- v-model="OrderForm.addres"
|
|
|
+ v-model="OrderForm.address"
|
|
|
placeholder="请输入"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
@@ -160,27 +198,6 @@
|
|
|
</div>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
-
|
|
|
- <!-- <el-form-item label="" prop="" :rules="rules.addres">
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="支付时间" prop="payment_time" :rules="rules.payment_time" v-if="OrderForm.payment_status === 'PAY'">
|
|
|
- <el-date-picker v-model="OrderForm.payment_time" value-format="timestamp" type="datetime" :editable="false" :clearable="false" style="width: 100%"/>
|
|
|
- </el-form-item> -->
|
|
|
- <!-- <el-form-item label="自提门店" v-if="OrderForm.delivery_type === 'self_pick'">
|
|
|
- <el-select v-model="OrderForm.store_id">
|
|
|
- <el-option v-for="item in storeList" :key="item.id" :label="item.store_name" :value="item.id"/>
|
|
|
- </el-select>
|
|
|
- </el-form-item> -->
|
|
|
-
|
|
|
- <!-- <el-form-item label="附件" prop="attachment" style="width: 500px">
|
|
|
- <el-upload multiple :action="MixinUploadApi" :file-list="fileList" v-if="!isDetail"
|
|
|
- :on-success="(res) => { OrderForm.attachment = res.url }" :limit="1">
|
|
|
- <el-button size="mini" type="primary">上传</el-button>
|
|
|
- </el-upload>
|
|
|
- <a v-if="OrderForm.attachment" :href="OrderForm.attachment" target="_blank"
|
|
|
- style="color:#409EFF;font-size:12px">下载附件</a>
|
|
|
- </el-form-item> -->
|
|
|
-
|
|
|
<div style="margin-bottom: 10px">
|
|
|
<h3>商品明细</h3>
|
|
|
<div v-if="!isDetail">
|
|
@@ -191,47 +208,11 @@
|
|
|
@click="handleSelectGoods"
|
|
|
>手动选择</el-button
|
|
|
>
|
|
|
- <!-- <el-button class="button" size="mini" @click="handleShowUpdateNum" v-if="!showUpdateNum">
|
|
|
- 设置数量
|
|
|
- </el-button>
|
|
|
- <span v-else>
|
|
|
- <el-input style="width: 70px;" @keydown.enter.native="handleConfirmUpdateNum"
|
|
|
- ref="batchSetNumRef" v-model="batchUpdateNum"></el-input>
|
|
|
- <el-button class="button" size="mini" @click="handleCancelUpdateNum">取消</el-button>
|
|
|
- <el-button class="button" size="mini" type="primary" @click="handleConfirmUpdateNum">确认</el-button>
|
|
|
- </span>
|
|
|
-
|
|
|
- <el-button class="button" size="mini" @click="handleShowUpdateTaxRate" v-if="!showTaxRate">
|
|
|
- 设置税率
|
|
|
- </el-button>
|
|
|
- <span v-else>
|
|
|
- <el-input style="width: 70px;" @keydown.enter.native="handleConfirmUpdateTaxRate" ref="batchSetTaxRateRef"
|
|
|
- v-model="batchTaxRate"></el-input>
|
|
|
- <el-button class="button" size="mini" @click="handleCancelUpdateTaxRate">取消</el-button>
|
|
|
- <el-button class="button" size="mini" type="primary" @click="handleConfirmUpdateTaxRate">确认</el-button>
|
|
|
- </span>
|
|
|
-
|
|
|
- <el-button class="button" size="mini" @click="handleShowUpdateDiscountPrice"
|
|
|
- v-if="!showDiscountPrice">设置优惠金额
|
|
|
- </el-button>
|
|
|
- <span v-else>
|
|
|
- <el-input style="width: 170px;" @keydown.enter.native="handleConfirmUpdateDiscountPrice"
|
|
|
- ref="batchSetDiscountRef" v-model="batchDiscountPrice">
|
|
|
- <template #prepend>
|
|
|
- <el-select v-model="batchDiscountType" style="width: 100px;">
|
|
|
- <el-option :value="0" label="按百分比"></el-option>
|
|
|
- <el-option :value="1" label="按金额"></el-option>
|
|
|
- </el-select>
|
|
|
- </template>
|
|
|
- </el-input>
|
|
|
- <el-button class="button" size="mini" @click="handleCancelUpdateDiscountPrice">取消</el-button>
|
|
|
- <el-button class="button" size="mini" type="primary" @click="handleConfirmUpdateDiscountPrice">确认</el-button>
|
|
|
- </span> -->
|
|
|
</div>
|
|
|
</div>
|
|
|
<div style="display: block">
|
|
|
<el-table
|
|
|
- :data="OrderForm.item_list"
|
|
|
+ :data="OrderForm.product_list"
|
|
|
border
|
|
|
:cell-style="{ textAlign: 'center' }"
|
|
|
@selection-change="handleSelectionChange"
|
|
@@ -271,27 +252,27 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="订单数量">
|
|
|
<template slot-scope="scope">
|
|
|
- {{ scope.row.order }}
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="入库数量">
|
|
|
- <template slot-scope="scope">
|
|
|
- {{ scope.row.inventory_num }}
|
|
|
+ <el-input
|
|
|
+ v-model="scope.row.num"
|
|
|
+ type="number"
|
|
|
+ :min="0"
|
|
|
+ :maxlength="20"
|
|
|
+ ></el-input>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="库存数量">
|
|
|
<template slot-scope="scope">
|
|
|
- {{ scope.row.stock_num }}
|
|
|
+ {{ scope.row.usable_stock }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="差异">
|
|
|
<template slot-scope="scope">
|
|
|
- {{ scope.row.inventory_num - scope.row.stock_num || 0 }}
|
|
|
+ {{scope.row.usable_stock - scope.row.num || 0 }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<!-- <el-table-column label="数量">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-form-item v-if="!isDetail" :prop="'item_list.'+scope.$index+'.num'" :rules="rules.item_list.num" class="tableFormItem">
|
|
|
+ <el-form-item v-if="!isDetail" :prop="'product_list.'+scope.$index+'.num'" :rules="rules.product_list.num" class="tableFormItem">
|
|
|
<el-input v-model="scope.row.num" :maxlength="20" :minlength="1"></el-input>
|
|
|
</el-form-item>
|
|
|
<span v-else>{{ scope.row.num }}</span>
|
|
@@ -299,7 +280,7 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="单价">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-form-item v-if="!isDetail" :prop="'item_list.'+scope.$index+'.price'" :rules="rules.item_list.price" class="tableFormItem">
|
|
|
+ <el-form-item v-if="!isDetail" :prop="'product_list.'+scope.$index+'.price'" :rules="rules.product_list.price" class="tableFormItem">
|
|
|
<el-input v-model="scope.row.price" :maxlength="20" :minlength="1"></el-input>
|
|
|
</el-form-item>
|
|
|
<span v-else>{{ scope.row.price }}</span>
|
|
@@ -312,7 +293,7 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="税率">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-form-item v-if="!isDetail" :prop="'item_list.'+scope.$index+'.tax_rate'" :rules="rules.item_list.tax_rate" class="tableFormItem">
|
|
|
+ <el-form-item v-if="!isDetail" :prop="'product_list.'+scope.$index+'.tax_rate'" :rules="rules.product_list.tax_rate" class="tableFormItem">
|
|
|
<el-input v-model="scope.row.tax_rate" :maxlength="20"></el-input>
|
|
|
</el-form-item>
|
|
|
<span v-else>{{ scope.row.tax_rate }}</span>
|
|
@@ -325,7 +306,7 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="优惠金额">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-form-item v-if="!isDetail" :prop="'item_list.'+scope.$index+'.discount_price'" :rules="rules.item_list.discount_price" class="tableFormItem">
|
|
|
+ <el-form-item v-if="!isDetail" :prop="'product_list.'+scope.$index+'.discount_price'" :rules="rules.product_list.discount_price" class="tableFormItem">
|
|
|
<el-input v-model="scope.row.discount_price"></el-input>
|
|
|
</el-form-item>
|
|
|
<span v-else>{{ scope.row.discount_price }}</span>
|
|
@@ -347,17 +328,11 @@
|
|
|
<el-button
|
|
|
size="mini"
|
|
|
type="danger"
|
|
|
- @click="OrderForm.item_list.splice(scope.$index, 1)"
|
|
|
+ @click="OrderForm.product_list.splice(scope.$index, 1)"
|
|
|
>删除
|
|
|
</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <!-- <div slot="append" style="text-align: right;line-height: 50px;margin-right: 20px;font-size: small">
|
|
|
- 商品金额:{{ OrderForm.total_price.toFixed(2) }}
|
|
|
- 税额:{{ OrderForm.tax_price.toFixed(2) }}
|
|
|
- 优惠金额:{{ OrderForm.discount_price.toFixed(2) }}
|
|
|
- 实付金额:{{ OrderForm.pay_price.toFixed(2) }}
|
|
|
- </div> -->
|
|
|
</el-table>
|
|
|
</div>
|
|
|
<!-- <div class="mx">
|
|
@@ -412,11 +387,61 @@
|
|
|
:loading="formLoading"
|
|
|
>保存</el-button
|
|
|
>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="saveSubmitOrderForm"
|
|
|
+ v-if="!isDetail"
|
|
|
+ :loading="formLoading"
|
|
|
+ >确认并保存</el-button
|
|
|
+ >
|
|
|
<!-- <el-button type="primary" :disabled="false" @click="handleAudit(true)" v-if="isDetail && checkPermission(['order:audit']) && OrderForm.allowable.audit">审核通过</el-button>
|
|
|
<el-button type="danger" :disabled="false" @click="handleAudit(false)" v-if="isDetail && checkPermission(['order:audit']) && OrderForm.allowable.audit">审核驳回</el-button> -->
|
|
|
<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-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-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-form-item label="邮件" prop="email">
|
|
|
+ <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-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-item label="客户联系人" prop="contact ">
|
|
|
+ <el-input v-model="customer.supplierForm.contact " :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>
|
|
|
+ <el-button type="primary" @click="submitSupplierForm">确 定</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -425,21 +450,20 @@ 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_CollectingAccount from "@/api/collectingAccount";
|
|
|
import { RegExp } from "~/ui-utils";
|
|
|
-// import { regionData } from 'element-china-area-data'
|
|
|
import {
|
|
|
provinceAndCityData,
|
|
|
+ pcTextArr,
|
|
|
regionData,
|
|
|
- provinceAndCityDataPlus,
|
|
|
- regionDataPlus,
|
|
|
- CodeToText,
|
|
|
- TextToCode,
|
|
|
+ pcaTextArr,
|
|
|
+ codeToText,
|
|
|
} from "element-china-area-data";
|
|
|
import html2canvas from "html2canvas";
|
|
|
|
|
|
const initOrderForm = {
|
|
|
- item_list: [],
|
|
|
+ product_list: [],
|
|
|
payment_list: [],
|
|
|
tax_price: 0,
|
|
|
total_price: 0,
|
|
@@ -456,7 +480,7 @@ export default {
|
|
|
return {
|
|
|
brcode: false,
|
|
|
options: regionData,
|
|
|
- selectedOptions: [],
|
|
|
+ selectedOptions: [''],
|
|
|
warehouseList: [], // 仓库列表
|
|
|
memberList: [], // 会员列表
|
|
|
marketingList: [], // 销售经理列表
|
|
@@ -475,7 +499,13 @@ export default {
|
|
|
],
|
|
|
id: "",
|
|
|
/** 订单表单*/
|
|
|
- OrderForm: {},
|
|
|
+ OrderForm: {
|
|
|
+ //省市区地址
|
|
|
+ province_city_area:"",
|
|
|
+ //详细信息
|
|
|
+ address:"",
|
|
|
+ province_city_area_address:"",
|
|
|
+ },
|
|
|
formLoading: false,
|
|
|
isDetail: undefined,
|
|
|
multipleSelection: [], // 勾选的商品
|
|
@@ -498,7 +528,7 @@ export default {
|
|
|
payment_status: [this.MixinRequired("支付状态不能为空", "change")],
|
|
|
payment_time: [this.MixinRequired("支付时间不能为空", "change")],
|
|
|
delivery_type: [this.MixinRequired("请选择配送方式", "change")],
|
|
|
- item_list: {
|
|
|
+ product_list: {
|
|
|
num: [
|
|
|
this.MixinRequired("数量不能为空", "change"),
|
|
|
{
|
|
@@ -584,18 +614,73 @@ export default {
|
|
|
// 客户列表
|
|
|
customerList: [],
|
|
|
//
|
|
|
- orderTypeList: [
|
|
|
- {
|
|
|
- label: "商品租赁",
|
|
|
- value: "商品租赁",
|
|
|
- },
|
|
|
- {
|
|
|
- label: "商品售卖",
|
|
|
- value: "商品售卖",
|
|
|
- },
|
|
|
- ],
|
|
|
+ orderTypeList: [],
|
|
|
// 条形码
|
|
|
barcodeValue: "",
|
|
|
+ time:[],
|
|
|
+ //新增客户
|
|
|
+ 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()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ trigger: ['change', '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:[
|
|
|
+ {
|
|
|
+ value: '全部',
|
|
|
+ label: '全部'
|
|
|
+ },{
|
|
|
+ value: '销售客户',
|
|
|
+ label: '销售客户'
|
|
|
+ }, {
|
|
|
+ value: '租赁客户',
|
|
|
+ label: '租赁客户'
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ }
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
@@ -611,12 +696,37 @@ export default {
|
|
|
this.GET_CustomerList();
|
|
|
},
|
|
|
methods: {
|
|
|
+ /** dialog打开后重置form表单校验结果 */
|
|
|
+ handleDialogOpen() {
|
|
|
+ setTimeout(() => { this.$refs['supplierForm'].clearValidate() })
|
|
|
+ this.customer.supplierForm={}
|
|
|
+ },
|
|
|
+ submitSupplierForm() {
|
|
|
+ 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()
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$message.error('表单填写有误,请核对!')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 添加客户
|
|
|
+ addCust(){
|
|
|
+ this.customer.dialogVisible=true
|
|
|
+ },
|
|
|
handleChange(value) {
|
|
|
- /* var loc = "";
|
|
|
- for (let i = 0; i < this.selectedOptions.length; i++) {
|
|
|
- loc += CodeToText[this.selectedOptions[i]];
|
|
|
- } */
|
|
|
- console.log(value); //打印区域码所对应的属性值即中文地址
|
|
|
+ this.OrderForm.province_city_area=value.join(",")
|
|
|
+ console.log(this.OrderForm.province_city_area);
|
|
|
+ /**/
|
|
|
+
|
|
|
+ //打印区域码所对应的属性值即中文地址
|
|
|
},
|
|
|
/** 初始化 */
|
|
|
init() {
|
|
@@ -637,7 +747,7 @@ export default {
|
|
|
/** 清除已选商品明细 */
|
|
|
cleanGoodsList() {
|
|
|
// 切换仓库需要清除已选对应仓库下的商品数据
|
|
|
- this.$set(this.OrderForm, "item_list", []);
|
|
|
+ this.$set(this.OrderForm, "product_list", []);
|
|
|
},
|
|
|
//获取客户列表
|
|
|
GET_CustomerList() {
|
|
@@ -647,6 +757,9 @@ export default {
|
|
|
console.log(this.customerList);
|
|
|
})
|
|
|
.catch(() => {});
|
|
|
+ API_Setting.getPage({dictType:"order_type"}).then(res=>{
|
|
|
+ this.orderTypeList=res.data
|
|
|
+ })
|
|
|
},
|
|
|
/** 获取会员列表 */
|
|
|
GET_MemberList() {
|
|
@@ -704,26 +817,25 @@ export default {
|
|
|
}
|
|
|
|
|
|
const goodsData = await this.$EnPickerGoods({
|
|
|
- goodsApi: "/admin/erp/product",
|
|
|
- selectedIds: this.OrderForm.item_list.map((item) => item.product_id),
|
|
|
+ goodsApi: `/admin/erp/warehouseOut/getGoodByWarehouse/${this.OrderForm.warehouse_id}`,
|
|
|
+ selectedIds: this.OrderForm.product_list.map((item) => item.product_id),
|
|
|
goodsApiParams: { warehouse_id: this.OrderForm.warehouse_id },
|
|
|
});
|
|
|
|
|
|
- this.OrderForm.item_list = goodsData.map((item) => {
|
|
|
+ this.OrderForm.product_list = goodsData.map((item) => {
|
|
|
// 初始化字段,和订单的item字段名保持一致
|
|
|
item.product_id = item.id;
|
|
|
item.product_name = item.name;
|
|
|
item.product_sn = item.sn;
|
|
|
item.product_specification = item.specification;
|
|
|
item.product_unit = item.unit;
|
|
|
- item.num = 1;
|
|
|
+ item.num = 0;
|
|
|
item.discount_price = 0;
|
|
|
// 原价(总)
|
|
|
item.total_price = 0;
|
|
|
// 税额(总)
|
|
|
item.tax_price = 0;
|
|
|
// 合计
|
|
|
- item.pay_price = 0;
|
|
|
|
|
|
return item;
|
|
|
});
|
|
@@ -822,6 +934,7 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ //保存订单
|
|
|
async submitOrderForm() {
|
|
|
// 校验商品明细数据
|
|
|
const valid = await this.$refs.orderFormRef
|
|
@@ -832,7 +945,25 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
const { id } = this.OrderForm;
|
|
|
+ //设置时间
|
|
|
+ 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]
|
|
|
+ }
|
|
|
+ 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
|
|
|
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
|
|
|
+ })
|
|
|
params.order_time = Math.floor(params.order_time / 1000);
|
|
|
params.payment_time = Math.floor(params.payment_time / 1000);
|
|
|
this.formLoading = true;
|
|
@@ -856,6 +987,65 @@ export default {
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
+ //确认并保存订单
|
|
|
+ async saveSubmitOrderForm(){
|
|
|
+ // 校验商品明细数据
|
|
|
+ const valid = await this.$refs.orderFormRef
|
|
|
+ .validate()
|
|
|
+ .catch((err) => err);
|
|
|
+ if (valid !== true) {
|
|
|
+ this.$message.error("表单数据输入有误,请检查!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const { id } = this.OrderForm;
|
|
|
+ //设置时间
|
|
|
+ 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]
|
|
|
+ }
|
|
|
+ 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
|
|
|
+ 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
|
|
|
+ })
|
|
|
+ params.order_time = Math.floor(params.order_time / 1000);
|
|
|
+ params.payment_time = Math.floor(params.payment_time / 1000);
|
|
|
+ this.formLoading = true;
|
|
|
+ if (id) {
|
|
|
+ API_Order.editOrder(id, params)
|
|
|
+ .then((response) => {
|
|
|
+ this.$message.success("修改成功!");
|
|
|
+ API_Order.submit(id).then(res=>{
|
|
|
+ this.$message.success("订单已确认")
|
|
|
+ this.backOrderList();
|
|
|
+ })
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ this.formLoading = false;
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ API_Order.addOrder(params)
|
|
|
+ .then(() => {
|
|
|
+ this.$message.success("添加成功!");
|
|
|
+ /* API_Order.submit(id).then(res=>{
|
|
|
+ this.$message.success("订单已确认") }) */
|
|
|
+ this.backOrderList();
|
|
|
+
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ this.formLoading = false;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
/** 获取仓库 */
|
|
|
GET_WarehouseList() {
|
|
|
API_BasicSetting.getWarehouseListAll({}).then((response) => {
|
|
@@ -888,10 +1078,50 @@ 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.selectedOptions=response.province_city_area.split(",")
|
|
|
this.OrderForm = response;
|
|
|
- this.fileList = response.attachment
|
|
|
+ console.log( this.OrderForm);
|
|
|
+ /* this.fileList = response.attachment
|
|
|
? [{ name: "附件", url: response.attachment }]
|
|
|
- : [];
|
|
|
+ : []; */
|
|
|
this.OrderForm.order_time = Math.floor(
|
|
|
this.OrderForm.order_time * 1000
|
|
|
);
|
|
@@ -904,17 +1134,13 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
watch: {
|
|
|
- "OrderForm.item_list": {
|
|
|
+ "OrderForm.product_list": {
|
|
|
deep: true,
|
|
|
handler(newVal) {
|
|
|
newVal.forEach((item) => {
|
|
|
- // 原价(总)
|
|
|
- item.total_price = item.price * item.num;
|
|
|
// 税额(总)
|
|
|
item.tax_price = item.total_price * item.tax_rate * 0.01;
|
|
|
// 合计
|
|
|
- item.pay_price =
|
|
|
- item.total_price + item.tax_price - item.discount_price;
|
|
|
});
|
|
|
this.OrderForm.total_price = newVal.reduce(
|
|
|
(sum, item) => sum + item.total_price,
|
|
@@ -924,10 +1150,6 @@ export default {
|
|
|
(sum, item) => sum + item.discount_price * 1,
|
|
|
0
|
|
|
);
|
|
|
- this.OrderForm.pay_price = newVal.reduce(
|
|
|
- (sum, item) => sum + item.pay_price,
|
|
|
- 0
|
|
|
- );
|
|
|
this.OrderForm.tax_price = newVal.reduce(
|
|
|
(sum, item) => sum + item.tax_price,
|
|
|
0
|
|
@@ -1031,14 +1253,15 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
.redClass /deep/ .el-form-item__label {
|
|
|
- color: red !important;
|
|
|
+ //color: red !important;
|
|
|
font-weight: 700;
|
|
|
+ width: 500px;
|
|
|
}
|
|
|
/deep/ .el-form-item {
|
|
|
width: 100%;
|
|
|
height: auto;
|
|
|
.el-input {
|
|
|
- width: 200px !important;
|
|
|
+ width: 200px;
|
|
|
}
|
|
|
}
|
|
|
</style>
|