123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146 |
- <template>
- <div>
- <zj-form-container ref="formRef" :form-data="formData" :form-rules="formRules">
- <zj-form-module title="调拨单" :form-data="formData" :form-items="formItems" label-width="100px" :column="3" />
- <zj-form-module title="调拨单明细" :form-items="detailData" label-width="0" :column="3" />
- <zj-form-module
- v-if="moduleType === 2"
- style="height: 100%;"
- title="物流费用"
- :form-items="formLogisticsData"
- label-width="0"
- :column="3"
- />
- <zj-form-module
- v-if="moduleType === 3"
- title="审核信息"
- :form-data="formData"
- :form-items="formExamine"
- label-width="100px"
- :column="3"
- />
- </zj-form-container>
- <el-dialog title="添加产品" :visible.sync="visible" width="60%" :append-to-body="true" @close="visible = false">
- <div style="height: 600px">
- <template-page
- ref="pageRef"
- style="height: 100%"
- :get-list="getList"
- :column-parsing="columnParsing"
- :table-attributes="tableAttributes"
- :table-events="tableEvents"
- />
- </div>
- <span slot="footer">
- <el-button type="primary" @click="handleAddData">提交</el-button>
- </span>
- </el-dialog>
- <!-- 新增 -->
- <div v-if="!comDisabled">
- <template v-if="moduleType === 1">
- <el-button type="primary" size="mini" @click="onSubmit('WAIT')">提交</el-button>
- <!-- <el-button size="mini" @click="onSubmit('SAVE')">保存</el-button> -->
- </template>
- <template v-else>
- <el-button type="primary" size="mini" @click="onSubmit">编辑</el-button>
- </template>
- <el-button size="mini" @click="onReset">重置</el-button>
- </div>
- <!-- 审核 /详情-->
- <div v-if="moduleType === 3 || moduleType === 2">
- <el-button v-if="moduleType === 3" type="primary" size="mini" @click="onExamine('OK')">同意</el-button>
- <el-button v-if="formData.status === 'OK'" size="mini" @click="onInvoice('WAIT')">反审</el-button>
- </div>
- </div>
- </template>
- <script>
- import TemplatePage from '@/components/template/template-page-1.vue'
- import { getcustomerFrontList } from '@/api/stock'
- import { getListCostBillV2 } from '@/api/logisticsBill'
- import { debounce } from '@/utils/common'
- import { getStagecustomerListV2, getDealerListV2 } from '@/api/basic_data/dealer'
- import {
- addCustomerTransfer,
- updateCustomerTransfer,
- getCustomerTransferDetail,
- examineCustomerTransfer,
- setNeExamine
- } from '@/api/transferOrder'
- import { mapGetters } from 'vuex'
- export default {
- components: { TemplatePage },
- props: {
- edit: {
- type: Boolean,
- default: false
- },
- detailsId: {
- type: String,
- default: null
- },
- moduleType: {
- type: Number,
- default: null
- }
- },
- data() {
- return {
- visible: false,
- // 表格属性
- tableAttributes: {
- // 启用勾选列
- selectColumn: true,
- selectable: this.selectable
- }, // 关闭新增弹窗
- // 表格事件
- tableEvents: {
- 'selection-change': this.selectionChange
- },
- itemTableEvents: { 'selection-change': this.itemSelectionChange },
- defaultTableAttributes: {
- border: true,
- headerCellClassName: 'headerRowColor',
- size: 'mini',
- 'summary-method': this.$getSummaries,
- 'show-summary': true
- },
- recordSelected: [],
- formData: {
- customerNumber: '',
- customerName: '',
- transferTime: '',
- createBy: '',
- transferCustomerNumber: '',
- transferCustomerName: '',
- stockType: '',
- createTime: '',
- notes: ''
- },
- formRules: {
- customerNumber: [{ required: true, message: '请输入', trigger: 'blur' }],
- customerName: [{ required: true, message: '请输入', trigger: 'blur' }],
- transferTime: [{ required: true, message: '请选择', trigger: 'change' }],
- transferCustomerNumber: [{ required: true, message: '请输入', trigger: 'blur' }],
- transferCustomerName: [{ required: true, message: '请选择', trigger: 'change' }],
- stockType: [{ required: true, message: '请输入', trigger: 'blur' }]
- },
- fileType: ['word', 'excel', 'ppt', 'pdf'],
- fileList: [],
- fileList2: [],
- srcList: [],
- dict: [],
- mainContractList: [],
- serviceProviderList: [],
- filetype: [],
- authList: [],
- selectData: [],
- itemRecordSelected: [],
- sonCustomerList: [],
- logisticsData: [],
- sonCustomerNumberList: [],
- sonCustomerNameList: [],
- setDisabled: {
- disabledDate: time => {
- return time.getTime() < new Date() - 24 * 3600 * 1000
- }
- }
- }
- },
- computed: {
- ...mapGetters(['customerNumber', 'customerName']),
- comDisabled() {
- // 禁止
- return !!~[2, 3].indexOf(this.moduleType || 1)
- },
- formItems() {
- return [
- {
- name: 'el-input',
- md: 6,
- attributes: { disabled: true, placeholder: '请输入' },
- formItemAttributes: { label: '商家编号', prop: 'customerNumber' }
- },
- {
- name: 'el-input',
- md: 6,
- attributes: { disabled: true, placeholder: '请输入' },
- formItemAttributes: { label: '商家名称', prop: 'customerName' }
- },
- {
- name: 'el-date-picker',
- md: 6,
- attributes: {
- type: 'datetime',
- style: { width: '100%' },
- placeholder: '选择日期时间',
- valueFormat: 'yyyy-MM-dd HH:mm:ss',
- disabled: this.comDisabled,
- pickerOptions: this.setDisabled
- },
- formItemAttributes: { label: '调整日期', prop: 'transferTime' }
- },
- {
- name: 'el-input',
- md: 6,
- attributes: { disabled: true, placeholder: '系统自动生成' },
- formItemAttributes: { label: '制单人', prop: 'createBy' }
- },
- {
- name: 'el-select',
- options: this.sonCustomerNumberList,
- events: {
- change: e => this.handleChange(e, 'transferCustomerNumber')
- },
- md: 6,
- attributes: {
- clearable: true,
- filterable: true,
- disabled: this.comDisabled
- },
- formItemAttributes: { label: '商家编号', prop: 'transferCustomerNumber' }
- },
- {
- name: 'el-select',
- options: this.sonCustomerNameList,
- md: 6,
- events: {
- change: e => this.handleChange(e, 'transferCustomerName')
- },
- attributes: {
- clearable: true,
- filterable: true,
- disabled: this.comDisabled
- },
- formItemAttributes: { label: '商家名称', prop: 'transferCustomerName' }
- },
- {
- name: 'el-select',
- md: 6,
- options: [
- { label: '嘉贤前置仓', value: 'JIAXIAN' }
- // { label: '商家仓', value: 'SHANGJIA' }
- ],
- attributes: { disabled: this.comDisabled, placeholder: '请输入' },
- formItemAttributes: { label: '调拨仓库', prop: 'stockType' }
- },
- {
- name: 'el-input',
- md: 6,
- attributes: { disabled: true, placeholder: '系统自动生成' },
- formItemAttributes: { label: '制单时间', prop: 'createTime' }
- },
- {
- name: 'el-input',
- md: 24,
- attributes: { type: 'textarea', style: { width: '100%' }, disabled: this.comDisabled, placeholder: '请输入' },
- formItemAttributes: { label: '备注', prop: 'notes' }
- }
- ]
- },
- formExamine() {
- return [
- {
- name: 'el-input',
- md: 6,
- attributes: { disabled: true },
- formItemAttributes: { label: '审核人', prop: 'approvalName' }
- },
- {
- name: 'el-input',
- md: 6,
- attributes: { disabled: true },
- formItemAttributes: { label: '审核时间', prop: 'approvalTime' }
- },
- {
- name: 'el-input',
- md: 24,
- attributes: { type: 'textarea', style: { width: '100%' }, placeholder: '请输入' },
- formItemAttributes: { label: '备注', prop: 'approvalRemark' }
- }
- ]
- },
- columns() {
- return [
- {
- columnAttributes: {
- label: '产品名称',
- prop: 'materialName'
- }
- },
- {
- columnAttributes: {
- label: '产品编码',
- prop: 'materialOldNumber'
- }
- },
- {
- columnAttributes: {
- label: '规格型号',
- prop: 'specification',
- width: 300
- }
- },
- ...(() => {
- if (~[1].indexOf(this.moduleType)) {
- return [
- {
- columnAttributes: {
- label: '可调拨库存数',
- prop: 'frontStockNum'
- }
- }
- ]
- }
- return []
- })(),
- {
- columnAttributes: {
- label: '调拨数量',
- prop: 'qty'
- },
- render: (h, { row, index }) => {
- return (
- <div style='margin:0 20px'>
- <el-input
- type='number'
- disabled={this.comDisabled}
- value={row.qty}
- // onInput={e => (row.qty = e)}
- onInput={value => {
- row.qty = value
- this.debounceChange(value, index)
- }}
- placeholder='调拨数量'
- size='mini'
- ></el-input>
- </div>
- )
- }
- },
- {
- columnAttributes: {
- label: '备注',
- prop: 'notes'
- },
- render: (h, { row }) => {
- return (
- <el-input
- type='text'
- value={row.notes}
- disabled={this.comDisabled}
- onInput={e => (row.notes = e)}
- placeholder='备注'
- size='mini'
- ></el-input>
- )
- }
- },
- {
- columnAttributes: {
- label: '调拨仓库',
- prop: 'stockName'
- }
- },
- {
- columnAttributes: {
- label: '操作',
- prop: ''
- },
- render: (h, { index }) => {
- return (
- <div>
- {!this.comDisabled ? (
- <el-button
- type='text'
- size='default'
- onClick={() => {
- this.handleDel(index)
- }}
- >
- 删除
- </el-button>
- ) : null}
- </div>
- )
- }
- }
- ]
- },
- detailData() {
- return [
- ...[
- !this.comDisabled
- ? {
- name: 'slot-component',
- md: 24,
- attributes: { disabled: false },
- formItemAttributes: { label: '', prop: '' },
- render: () => {
- return (
- <div>
- <el-button
- size='mini'
- onClick={() => {
- this.visible = true
- this.recordSelected = []
- }}
- >
- 添加
- </el-button>
- <el-button size='mini' onClick={() => this.handleAllDel()}>
- 删除
- </el-button>
- </div>
- )
- }
- }
- : {}
- ],
- {
- name: 'slot-component',
- md: 24,
- attributes: { disabled: false },
- formItemAttributes: { label: '', prop: '' },
- render: (h, { props }) => {
- var { value } = props
- return (
- <zj-table
- isDrop={true}
- columns={this.columns}
- tableData={this.selectData}
- tableAttributes={{ border: true, selectColumn: !this.comDisabled }}
- tableEvents={this.itemTableEvents}
- ></zj-table>
- )
- }
- }
- ]
- },
- formLogistics() {
- return [
- {
- columnAttributes: {
- label: '补贴费用',
- prop: 'allowanceCost',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '所属销售公司类型',
- prop: 'belongCompanyType',
- width: 200
- },
- render: (h, { row }) => {
- const { belongCompanyType } = row
- const typeObj = {
- GE_JIANG: '格匠',
- GUANG_ZHOU: '广州销售公司',
- FO_SHAN: '佛山销售公司',
- OTHER: '其他销售公司'
- }
- return <div>{typeObj[belongCompanyType]}</div>
- }
- },
- {
- columnAttributes: {
- label: '运费结算系数',
- prop: 'coefficient',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '备注',
- prop: 'comment',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '最终运费',
- prop: 'cost',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '客户名称',
- prop: 'customerName',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '客户电话',
- prop: 'customerPhone',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '无法生成的原因',
- prop: 'errorResult',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '是否已经对过帐',
- prop: 'isAccountChecking',
- width: 200
- },
- render: (h, { row }) => {
- const { isAccountChecking } = row
- return <div>{+isAccountChecking ? '是' : '否'}</div>
- }
- },
- {
- columnAttributes: {
- label: '是否已经审核',
- prop: 'isAudit',
- width: 200
- },
- render: (h, { row }) => {
- const { isAudit } = row
- return <div>{+isAudit ? '是' : '否'}</div>
- }
- },
- {
- columnAttributes: {
- label: '是否完结',
- prop: 'isFinish',
- width: 200
- },
- render: (h, { row }) => {
- const { isFinish } = row
- return <div>{+isFinish ? '已经完结' : '未完结'}</div>
- }
- },
- {
- columnAttributes: {
- label: '实际是否卸货',
- prop: 'isRealUnload',
- width: 200
- },
- render: (h, { row }) => {
- const { isRealUnload } = row
- return <div>{+isRealUnload ? '是' : '否'}</div>
- }
- },
- {
- columnAttributes: {
- label: '实际是否上楼',
- prop: 'isRealUpstairs',
- width: 200
- },
- render: (h, { row }) => {
- const { isRealUpstairs } = row
- return <div>{+isRealUpstairs ? '是' : '否'}</div>
- }
- },
- {
- columnAttributes: {
- label: '是否卸货',
- prop: 'isUnload',
- width: 200
- },
- render: (h, { row }) => {
- const { isUnload } = row
- return <div>{+isUnload ? '是' : '否'}</div>
- }
- },
- {
- columnAttributes: {
- label: '是否上楼',
- prop: 'isUpstairs',
- width: 200
- },
- render: (h, { row }) => {
- const { isUpstairs } = row
- return <div>{+isUpstairs ? '是' : '否'}</div>
- }
- },
- {
- columnAttributes: {
- label: '物料名称',
- prop: 'materialCode',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '计费分类',
- prop: 'materialCostType',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '产品名称',
- prop: 'materialName',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '规格型号',
- prop: 'materialSpecification',
- width: 350
- }
- },
- {
- columnAttributes: {
- label: '物料类型',
- prop: 'materialType',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '商家编码',
- prop: 'merchantCode',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '商家名称',
- prop: 'merchantName',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '订单号',
- prop: 'orderCode',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '订单时间',
- prop: 'orderDate',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '订单类型',
- prop: 'orderType',
- width: 200
- },
- render: (h, { row }) => {
- const { orderType } = row
- const typeObj = {
- TOB: '商家机工程机类型',
- ALL: '所有类型,广州的订单统一 开单价',
- TOC: '佛山销售销售订单类型公司'
- }
- return <div>{typeObj[orderType]}</div>
- }
- },
- {
- columnAttributes: {
- label: '订单类型细分',
- prop: 'orderTypeDetail',
- width: 200
- },
- render: (h, { row }) => {
- const { orderType } = row
- const typeObj = {
- PICKING_UP_ORDER: '前置仓提货订单',
- SALE_ORDER: '销售订单',
- MERCHANT_WAREHOUSE_ORDER: '商家仓订单',
- PROJECT_ORDER: '工程机订单',
- SALE_RETURN_ORDER: '销售退货单'
- }
- return <div>{typeObj[orderType]}</div>
- }
- },
- {
- columnAttributes: {
- label: '收货送货地址',
- prop: 'receiptAddress',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '退货单号',
- prop: 'returnOrderCode',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '补贴结算系数',
- prop: 'subsidyCoefficient',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '嘉贤创建时间',
- prop: 'time',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '费用汇总',
- prop: 'totalCost',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '单价计算',
- prop: 'unitPrice',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '卸货上楼结算系数',
- prop: 'unloadUpstairsCoefficient',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '上楼卸货费用',
- prop: 'unloadUpstairsCost',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '发货仓库编码',
- prop: 'warehouseCode',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '发货仓库名称',
- prop: 'warehouseName',
- width: 200
- }
- }
- ]
- },
- formOutbound() {
- return [
- {
- columnAttributes: {
- label: '条码',
- prop: 'barCode',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '出库时间',
- prop: 'consignerTime',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '出库时间',
- prop: 'consignerTimeV2',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '创建人',
- prop: 'createBy',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '创建时间',
- prop: 'createTime',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '送货时间',
- prop: 'deliveryTime',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '送货时间',
- prop: 'deliveryTimeV2',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '条码唯一id',
- prop: 'id',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '物料代码',
- prop: 'materialCode',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '物料类型',
- prop: 'materialType',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '销售订单号',
- prop: 'orderNumber',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '收货人',
- prop: 'receiptCompany',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '商家名称',
- prop: 'salesCompany',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '规格',
- prop: 'specification',
- width: 350
- }
- },
- {
- columnAttributes: {
- label: '更新人',
- prop: 'updateBy',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '修改时间',
- prop: 'updateTime',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '发货仓库名称',
- prop: 'warehouse',
- width: 200
- }
- }
- ]
- },
- formLogisticsData() {
- return [
- {
- name: 'slot-component',
- md: 24,
- attributes: { disabled: false },
- formItemAttributes: { label: '', prop: '' },
- render: (h, { props }) => {
- var { value } = props
- return (
- <zj-table
- tableAttributes={{ maxHeight: '600px', ...this.defaultTableAttributes }}
- isDrop={true}
- columns={this.formLogistics}
- tableData={this.logisticsData}
- tableEvents={this.itemTableEvents}
- ></zj-table>
- )
- }
- }
- ]
- }
- },
- mounted() {
- this.getStagecustomerListV2()
- if (this.detailsId) {
- getCustomerTransferDetail({ id: this.detailsId }).then(res => {
- this.formData = res.data
- this.selectData = res.data.orders.map(k => {
- k.disabledId = k.customerStockId
- k.stockName = '嘉贤前置仓'
- return k
- })
- delete this.formData.orders
- if (this.detailsId && this.moduleType === 2) {
- getListCostBillV2({
- pageNum: 1,
- pageSize: -1,
- params: [
- {
- param: 'order_code',
- compare: '=',
- value: this.formData.jiaxianOrderId
- }
- ]
- }).then(res => {
- res.data.records.forEach(item => {
- item.sums1 = ['orderHasSendQty', 'subsidyCoefficient', 'unloadUpstairsCoefficient', 'coefficient']
- item.sums2 = ['cost', 'unitPrice', 'totalCost', 'allowanceCost']
- })
- this.logisticsData = res.data.records
- })
- }
- })
- }
- },
- methods: {
- debounceChange: debounce(function(val, index) {
- if (val <= 0) {
- this.selectData[index].qty = 1
- } else {
- this.selectData[index].qty = parseInt(val)
- }
- }, 500),
- // 列表请求函数
- getList(...p) {
- this.recordSelected = []
- return getcustomerFrontList(...p)
- },
- // 表格列解析渲染数据更改
- columnParsing(item, defaultData) {
- return defaultData
- }, // 监听勾选变化
- selectionChange(data) {
- this.recordSelected = data
- },
- itemSelectionChange(data) {
- this.itemRecordSelected = data
- },
- selectable(row) {
- if (this.selectData.length) {
- for (let j = 0; j < this.selectData.length; j++) {
- if (row.id === this.selectData[j].disabledId) {
- this.$set(row, 'disabledId', this.selectData[j].disabledId)
- }
- }
- }
- if (!row.disabledId) {
- return true
- } else {
- return false
- }
- },
- getStagecustomerListV2() {
- this.formData.customerNumber = this.customerNumber
- this.formData.customerName = this.customerName
- getStagecustomerListV2({
- pageNum: 1,
- pageSize: -1,
- params: [
- {
- param: 'a.higher_prant_number',
- compare: '=',
- value: this.customerNumber || ''
- }
- ]
- }).then(res => {
- this.sonCustomerList = res.data.records
- this.sonCustomerNameList = res.data.records.map(k => {
- return {
- label: k.name,
- value: k.id
- }
- })
- this.sonCustomerNumberList = res.data.records.map(k => {
- return {
- label: k.number,
- value: k.id
- }
- })
- if (this.detailsId && this.sonCustomerList.length) {
- const transfer = this.sonCustomerList.find(k => k.number === this.formData.transferCustomerNumber)
- this.formData.transferCustomerNumber = transfer.id
- this.formData.transferCustomerName = transfer.id
- }
- })
- },
- handleAddData() {
- this.selectData = [...this.selectData, ...this.recordSelected]
- for (let i = 0; i < this.$refs.pageRef.$children[0].tableData.length; i++) {
- for (let j = 0; j < this.selectData.length; j++) {
- if (this.$refs.pageRef.$children[0].tableData[i].id == this.selectData[j].id) {
- this.$set(this.$refs.pageRef.$children[0].tableData[i], 'disabledId', this.selectData[j].id)
- }
- }
- }
- this.selectData = this.selectData.map(k => {
- return {
- materialCode: k.materialCode,
- materialId: '',
- materialName: k.materialName,
- materialOldNumber: k.materialOldNumber,
- notes: '',
- qty: 0,
- frontStockNum: k.frontStockNum,
- specification: k.specification,
- disabledId: k.disabledId,
- stockName: '嘉贤前置仓',
- customerStockId: k.disabledId
- }
- })
- this.visible = false
- this.handleClearSelection()
- },
- handleAllDel() {
- if (this.itemRecordSelected.length) {
- if (this.$refs.pageRef) {
- for (let i = 0; i < this.$refs.pageRef.$children[0].tableData.length; i++) {
- for (let j = 0; j < this.itemRecordSelected.length; j++) {
- if (this.$refs.pageRef.$children[0].tableData[i].id === this.itemRecordSelected[j].disabledId) {
- this.$set(this.$refs.pageRef.$children[0].tableData[i], 'disabledId', null)
- }
- }
- }
- }
- for (let j = 0; j < this.itemRecordSelected.length; j++) {
- for (let k = 0; k < this.selectData.length; k++) {
- if (this.selectData[k].disabledId === this.itemRecordSelected[j].disabledId) {
- this.selectData.splice(k, 1)
- }
- }
- }
- this.handleClearSelection()
- } else {
- this.$errorMsg('请选择删除项')
- }
- },
- handleDel(index) {
- if (this.$refs.pageRef) {
- for (let i = 0; i < this.$refs.pageRef.$children[0].tableData.length; i++) {
- if (this.$refs.pageRef.$children[0].tableData[i].id === this.selectData[index].disabledId) {
- this.$set(this.$refs.pageRef.$children[0].tableData[i], 'disabledId', null)
- }
- }
- }
- this.selectData.splice(index, 1)
- this.handleClearSelection()
- },
- handleClearSelection() {
- this.recordSelected = []
- this.$refs.pageRef && this.$refs.pageRef.refreshList()
- },
- handleChange(e) {
- if (e) {
- this.formData.transferCustomerName = e
- this.formData.transferCustomerNumber = e
- } else {
- this.formData.transferCustomerNumber = ''
- this.formData.transferCustomerName = ''
- }
- },
- handlerefreshList() {
- this.$emit('refresh')
- this.onClose()
- },
- onClose() {
- this.formData = {}
- this.selectData = []
- this.$emit('close')
- },
- onReset() {
- this.$refs.formRef.resetFields()
- this.selectData = []
- },
- onSubmit(type = null) {
- this.$refs.formRef.validate(valid => {
- for (let i = 0; i < this.selectData.length; i++) {
- if (this.selectData[i].qty <= 0) {
- this.$errorMsg('调拨数量不能小于1')
- return
- }
- }
- const transfer = this.sonCustomerList.find(
- k => k.id === (this.formData.transferCustomerNumber || this.formData.transferCustomerName)
- )
- console.log(transfer, 999)
- if (valid) {
- const params = {
- ...this.formData,
- orders: this.selectData,
- transferCustomerNumber: transfer.number,
- transferCustomerName: transfer.name
- }
- if (this.moduleType === 1) {
- params.status = type
- addCustomerTransfer(params).then(() => {
- this.$successMsg(type === 'SAVE' ? '保存成功' : '新增成功')
- this.handlerefreshList()
- })
- } else {
- updateCustomerTransfer(params).then(() => {
- this.$successMsg('编辑成功')
- this.handlerefreshList()
- })
- }
- } else {
- console.log('error submit!!')
- return false
- }
- })
- },
- onExamine(type = null) {
- examineCustomerTransfer({
- id: this.detailsId,
- status: type
- }).then(() => {
- this.$successMsg('审核成功')
- this.handlerefreshList()
- })
- },
- onInvoice(type = null) {
- setNeExamine({
- id: this.detailsId,
- status: type
- }).then(() => {
- this.$successMsg('反审成功')
- this.handlerefreshList()
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .header1style {
- text-align: right;
- font-size: 12px;
- color: red;
- line-height: 18px;
- }
- </style>
|