1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290 |
- <template>
- <!-- 添加销售订单 -->
- <div class="addSalePlan">
- <page-title>钢材订单新增</page-title>
- <!-- 订单基础信息 -->
- <el-form
- :inline="true"
- style="margin-top: 1rem;box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04)"
- >
- <el-form-item>
- <label class="el-form-item__label" style="width: auto;">发货单位</label>
- <el-autocomplete
- class="inline-input"
- v-model="shipperName"
- :fetch-suggestions="querySearchCarrier"
- placeholder="请输入发货单位名称"
- :trigger-on-focus="false"
- @select="handleSelectCarrier"
- style="width:245px"
- disabled
- >
- <template slot-scope="{ item }">
- <div class="name">{{ item.shipperName }}</div>
- </template>
- </el-autocomplete>
- </el-form-item>
- <el-form-item>
- <label class="el-form-item__label" style="width: auto;">下单客户</label>
- <el-autocomplete
- class="inline-input"
- v-model="consigneeName"
- :fetch-suggestions="querySearchConsignee"
- placeholder="请输入下单客户名称"
- :trigger-on-focus="false"
- @select="handleSelectConsignee"
- style="width:300px"
- :disabled="consigneeDisable"
- >
- <template slot-scope="{ item }">
- <div class="name">{{ item.consigneeCompanyName }}</div>
- </template>
- </el-autocomplete>
- </el-form-item>
- <el-form-item>
- <label class="el-form-item__label" style="width: auto;">是否自提</label>
- <el-select v-model="values" placeholder="请选择" style="width:60px">
- <el-option
- v-for="item in options"
- :key="item.values"
- :label="item.label"
- :value="item.values"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item>
- <label class="el-form-item__label" style="width: auto;">收款公司</label>
- <el-select v-model="values1" placeholder="请选择" style="width: 255px">
- <el-option
- v-for="item in receivingCompany"
- :key="item.values1"
- :label="item.label1"
- :value="item.values1"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item>
- <label class="el-form-item__label" style="width: auto;">业务员</label>
- <el-select v-model="saleMan" placeholder="请选择" style="width: 90px">
- <el-option
- v-for="item in saleMans"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item>
- <label
- class="el-form-item__label"
- style="width: auto;margin-top: 0.3rem;"
- >摘要</label
- >
- </el-form-item>
- <el-form-item>
- <el-input
- v-model="remarks"
- placeholder="(非必填)"
- style="width: 180px"
- ></el-input>
- </el-form-item>
- </el-form>
- <!-- 车序号基础信息 -->
- <el-form :inline="true" style="margin-top: 1rem;">
- <el-form-item>
- <label class="el-form-item__label" style="width: auto;">收货地址</label>
- <el-autocomplete
- style="width:400px"
- v-model="saleShipperAddressName"
- :fetch-suggestions="querySearchAddress"
- placeholder="请输入内容"
- @select="handleSelectAddress"
- >
- <template slot-scope="{ item }">
- <span class="addr">{{ item.addressPlace }}</span>
- </template>
- </el-autocomplete>
- <el-button type="primary" @click="ondrawerOut">选择</el-button>
- </el-form-item>
- <el-form-item>
- <label
- class="el-form-item__label"
- style="width: auto;margin-top: 0.4rem;"
- >收货客户电话</label
- >
- </el-form-item>
- <el-form-item>
- <el-input
- style="width: 150px"
- v-model="saleOrderConsigneeTel"
- placeholder="(非必填)"
- ></el-input>
- </el-form-item>
- <el-form-item>
- <label
- class="el-form-item__label"
- style="width: auto;margin-top: 0.4rem;"
- >备注</label
- >
- </el-form-item>
- <el-form-item>
- <el-input
- style="width: 180px"
- v-model="truckRemark"
- placeholder="(非必填)"
- ></el-input>
- </el-form-item>
- <el-form-item>
- <label class="el-form-item__label" style="width: auto;"
- >可装货时间</label
- >
- <el-date-picker
- class="textinput3"
- v-model.number="saleDateOfReceipt"
- type="datetime"
- placeholder="选择日期时间"
- disabled
- >
- </el-date-picker>
- </el-form-item>
- </el-form>
- <div class="button-box">
- <el-button type="primary" class="btn" @click="addMaterial"
- ><i class="el-icon-circle-plus-outline"></i>新增物资</el-button
- >
- </div>
- <!-- 车辆拼装物资信息table1 -->
- <div class="selectionTable from">
- <el-table
- :data="materialList"
- border
- style="width: 100%"
- highlight-current-row
- ref="materialTableTop"
- id="table"
- >
- <el-table-column
- v-for="(item, i) in materialTableTop"
- :key="i"
- :prop="item.prop"
- :label="item.label"
- :width="item.width"
- align="center"
- show-overflow-tooltip
- >
- <!-- 插入输入框 -->
- <template slot-scope="scope">
- <template v-if="item.slot">
- <!-- 物资件数 -->
- <template v-if="item.prop == 'orderPlanWeight'">
- <el-input
- class="textinput111"
- v-model.number="scope.row.orderPlanWeight"
- placeholder="(必填)"
- :id="'input' + scope.$index"
- @keyup.up.native="clicks(scope.$index)"
- @keyup.down.native="clickx(scope.$index)"
- @keyup.enter.native="singleDistribute"
- ></el-input>
- </template>
- <!-- 米数 -->
- <template v-if="item.prop == 'meterNumber'">
- <el-input
- v-if="scope.row.haveMeter == 1"
- class="textinput111"
- v-model="scope.row.meterNumber"
- placeholder="(必填)"
- :disabled="scope.row.isDisable == 1"
- ></el-input>
- </template>
- <!-- 分装车数 -->
- <template v-if="item.prop == 'carNumber'">
- <el-input
- v-if="materialList.length == 1"
- class="textinput111"
- v-model.number="scope.row.carNumber"
- placeholder="(非必填)"
- ></el-input>
- </template>
- <!-- 是否磅重销售 -->
- <template v-if="item.prop == 'isPound'">
- <el-select
- v-model="scope.row.isPound"
- placeholder="请选择"
- style="width:65px"
- >
- <el-option
- v-for="item in options2"
- :key="item.values2"
- :label="item.label2"
- :value="item.values2"
- >
- </el-option>
- </el-select>
- </template>
- </template>
- <template v-else>
- <span>{{ scope.row[item.prop] }}</span>
- </template>
- </template>
- </el-table-column>
- <!-- 操作列 -->
- <el-table-column fixed="right" label="操作" width="100">
- <template slot-scope="scope">
- <el-button
- @click.native.prevent="
- deleteMaterialRow(scope.$index, materialList)
- "
- type="text"
- icon="el-icon-close"
- size="big"
- ></el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <!-- 新增物资和生成一车 -->
- <div class="button-box">
- <el-button type="primary" class="btn" @click="singleDistribute"
- >单拼分配到每车</el-button
- >
- <el-button
- type="primary"
- class="btn"
- @click="createACar"
- style="margin-left:20px"
- >添加到订单</el-button
- >
- </div>
- <div style="margin-left: 0.3rem;color:red">(注:一个车序号代表一辆车)</div>
- <!-- 销售订单信息table2 -->
- <div class="selectionTable from">
- <el-table
- :data="selectionList"
- border
- style="width: 100%"
- :span-method="cellMerge"
- highlight-current-row
- @cell-click="goclick"
- >
- <el-table-column
- v-for="(item, i) in tableTop"
- :key="i"
- :prop="item.prop"
- :label="item.label"
- :width="item.width"
- align="center"
- show-overflow-tooltip
- @blur="onblur"
- >
- <template slot="scope" v-if="item.label !== '物资名称'">
- <span>{{ item.label }}</span>
- </template>
- <template slot="scope" v-if="item.label !== '件数'">
- <span>{{ item.label }}</span>
- </template>
- <template slot="scope" v-if="item.label !== '收货地址'">
- <span>{{ item.label }}</span>
- </template>
- <!-- <template slot="scope" v-if="item.label !== '收货日期'">
- <span>{{ item.label }}</span>
- </template> -->
- <template slot="scope" v-if="item.label !== '收货姓名'">
- <span>{{ item.label }}</span>
- </template>
- <template slot="scope" v-if="item.label !== '收货方电话'">
- <span>{{ item.label }}</span>
- </template>
- <!-- 插入输入框 -->
- <template slot-scope="scope">
- <template v-if="item.slot">
- <!-- 物资名称 -->
- <template v-if="item.prop == 'materialName'">
- <el-input
- style="width: 200px"
- v-model="scope.row.materialName"
- disabled
- >
- </el-input>
- <!--更改-->
- <i
- class="el-icon-edit"
- @click="changeMaterial(scope.$index)"
- style="font-size: 20px"
- v-if="isCellClick == 1"
- ></i>
- </template>
- <!--规格型号-->
- <template v-if="item.prop == 'Specification'">
- <el-input
- style="width: 120px"
- class="textinput"
- v-model.number="scope.row.Specification"
- ></el-input>
- </template>
- <!-- 物资件数 -->
- <template v-if="item.prop == 'orderPlanWeight'">
- <el-input
- class="textinput"
- v-model.number="scope.row.orderPlanWeight"
- ></el-input>
- </template>
- <!-- 米数 -->
- <template v-if="item.prop == 'meterNumber'">
- <el-input
- v-if="scope.row.haveMeter == 1"
- class="textinput"
- v-model="scope.row.meterNumber"
- :disabled="scope.row.isDisable == 1"
- ></el-input>
- </template>
- <!-- 是否磅重销售 -->
- <template v-if="item.prop == 'isPound'">
- <el-select
- v-model="scope.row.isPound"
- placeholder="请选择"
- style="width:65px"
- >
- <el-option
- v-for="item in options2"
- :key="item.values2"
- :label="item.label2"
- :value="item.values2"
- >
- </el-option>
- </el-select>
- </template>
- <!-- 收货地址id -->
- <template
- style="width: 300px"
- v-if="item.prop == 'saleShipperAddressName'"
- >
- <el-input
- style="width: 250px"
- v-model="scope.row.saleShipperAddressName"
- disabled
- >
- </el-input>
- <!--增加-->
- <i
- class="el-icon-folder-add"
- @click="ondrawer(scope.row, scope.$index)"
- v-if="isCellClick == 1"
- style="font-size: 20px"
- ></i>
- </template>
- <!-- 收货日期 -->
- <!-- <template v-if="item.prop == 'saleDateOfReceipt'">
- <el-date-picker
- class="textinput3"
- type="date"
- v-model.number="scope.row.saleDateOfReceipt"
- @change="batchUpdateValue(scope.row,scope.$index)"
- style="width:135px"
- ></el-date-picker>
- </template> -->
- <!-- 收货客户电话号码 -->
- <template v-if="item.prop == 'saleOrderConsigneeTel'">
- <el-input
- class="textinput5"
- placeholder="(必填)"
- v-model.number="scope.row.saleOrderConsigneeTel"
- @change="batchUpdateValue(scope.row, scope.$index)"
- ></el-input>
- </template>
- <template v-if="item.prop == 'truckRemark'">
- <el-input
- class="textinput5"
- placeholder="(非必填)"
- v-model.number="scope.row.truckRemark"
- @change="batchUpdateValue(scope.row, scope.$index)"
- ></el-input>
- </template>
- </template>
- <template v-else>
- <span>{{ scope.row[item.prop] }}</span>
- </template>
- </template>
- </el-table-column>
- <!-- 操作列 -->
- <el-table-column
- fixed="right"
- label="操作"
- width="200"
- v-if="isCellClick == 1"
- >
- <template slot-scope="scope">
- <el-button
- @click.native.prevent="deleteRow(scope.$index, selectionList)"
- type="text"
- icon="el-icon-close"
- size="big"
- ></el-button>
- <el-button
- @click.native.prevent="copyRow(scope.$index, scope.row)"
- type="text"
- size="big"
- >复制为一车</el-button
- >
- <el-button
- @click.native.prevent="copyRowflu(scope.$index, scope.row)"
- type="text"
- size="big"
- >复制为分录</el-button
- >
- </template>
- </el-table-column>
- <el-table-column fixed="right" width="80" v-if="isCellClick == 1">
- <template slot-scope="scope">
- <el-button
- @click.native.prevent="copyRowfluAll(scope.$index, scope.row)"
- type="text"
- size="big"
- >复制整车</el-button
- >
- </template>
- </el-table-column>
- </el-table>
- </div>
- <!-- 收货地址弹出框 -->
- <el-dialog title="收货地址" :visible.sync="drawer1" width="90%">
- <el-form :inline="true">
- <el-form-item>
- <label class="el-form-item__label" style="width: auto;">省</label>
- <el-select
- v-model="province"
- filterable
- placeholder="请选择"
- @change="onchangeProvince"
- >
- <el-option
- v-for="item in provinceList"
- :key="item.id"
- :label="item.addressProvince"
- :value="item.id"
- ></el-option>
- </el-select>
- </el-form-item>
- <el-form-item>
- <label class="el-form-item__label" style="width: auto;">市</label>
- <el-select
- v-model="city"
- filterable
- placeholder="请选择"
- @change="onchangeCity"
- >
- <el-option
- v-for="item in cityList"
- :key="item.id"
- :label="item.addressDistrict"
- :value="item.id"
- ></el-option>
- </el-select>
- </el-form-item>
- <el-form-item>
- <label class="el-form-item__label" style="width: auto;">县(区)</label>
- <el-select
- v-model="county"
- filterable
- placeholder="请选择"
- @change="onchangeCounty"
- >
- <el-option
- v-for="item in countyList"
- :key="item.id"
- :label="item.addressTown"
- :value="item.id"
- ></el-option>
- </el-select>
- </el-form-item>
- <el-form-item>
- <label class="el-form-item__label" style="width: auto;"
- >具体收货地址</label
- >
- <el-autocomplete
- class="inline-input"
- v-model="place"
- :fetch-suggestions="querySearch1"
- placeholder="请输入具体收货地址"
- :trigger-on-focus="false"
- @select="handleSelect1"
- >
- </el-autocomplete>
- </el-form-item>
- </el-form>
- <div slot="footer" class="button-box">
- <el-button @click="drawer1 = false">取 消</el-button>
- <el-button type="primary" @click="addAddressClick">确定</el-button>
- </div>
- </el-dialog>
- <!-- 物资选择模态框 -->
- <el-drawer
- title="选择物资信息"
- :visible.sync="table1"
- direction="rtl"
- size="90%"
- :show-close="true"
- >
- <el-form :inline="true" style="margin-top: 0.5rem;">
- <el-form-item>
- <label class="el-form-item__label" style="width: auto;"
- >物资名称/型号</label
- >
- </el-form-item>
- <el-form-item>
- <el-input
- placeholder="请输入物资名称或型号"
- v-model="materialNameText"
- clearable
- ></el-input>
- </el-form-item>
- <el-form-item>
- <label class="el-form-item__label" style="width: auto;">规格</label>
- </el-form-item>
- <el-form-item>
- <el-input
- placeholder="请输入内容"
- v-model="materialSpecificationText"
- clearable
- ><template slot="prepend">Φ</template></el-input
- >
- </el-form-item>
- <el-button
- type="primary"
- class="btn"
- @click="onclick"
- style="margin-left: 4px;"
- ><i class="el-icon-search"></i>查询</el-button
- >
- <el-button type="primary" @click="makeSureMaterial"
- ><i class="el-icon-check"></i>确定</el-button
- >
- </el-form>
- <div class="tablecls">
- <!-- 查询所有的物资 -->
- <dilTable
- v-bind.sync="option"
- @selection-change="selectionChange"
- @rowDbClick="rowDbClick"
- >
- </dilTable>
- </div>
- </el-drawer>
- <!-- 更改行物资 -->
- <el-dialog title="更改物资" :visible.sync="drawer" width="80%">
- <el-form :inline="true" style="margin-top: 0.5rem;">
- <el-form-item>
- <label class="el-form-item__label" style="width: auto;"
- >物资名称/型号</label
- >
- </el-form-item>
- <el-form-item>
- <el-input
- placeholder="请输入物资名称或型号"
- v-model="materialNameText"
- clearable
- ></el-input>
- </el-form-item>
- <el-form-item>
- <label class="el-form-item__label" style="width: auto;">规格</label>
- </el-form-item>
- <el-form-item>
- <el-input
- placeholder="请输入内容"
- v-model="materialSpecificationText"
- clearable
- ><template slot="prepend">Φ</template></el-input
- >
- </el-form-item>
- <el-button
- type="primary"
- class="btn"
- @click="onclick"
- style="margin-left: 4px;"
- ><i class="el-icon-search"></i>查询</el-button
- >
- </el-form>
- <div class="tablecls">
- <!-- 查询所有的物资 -->
- <dilTable
- @rowDbClick="rowDbClick1"
- v-bind.sync="option1"
- @radio-change="currentRadioChange"
- :drawer="drawer"
- >
- </dilTable>
- </div>
- <div class="button-box">
- <el-button @click="closeChangeMaterial">取消更改</el-button>
- <el-button type="primary" @click="makeSureChange">确认更改</el-button>
- </div>
- </el-dialog>
- <!-- 订单确认 -->
- <el-dialog
- title="订单明细 (注*: 请仔细确认订单物资和件数后再提交)"
- :visible.sync="orderMakeSure"
- width="94%"
- >
- <el-form :inline="true" style="margin-top: 0.5rem;">
- <el-form-item>
- <label class="el-form-item__label" style="width: auto;"
- >发货单位:</label
- >
- <el-tag size="big">{{ shipperName }}</el-tag>
- </el-form-item>
- <el-form-item>
- <label class="el-form-item__label" style="width: auto;"
- >下单客户:</label
- >
- <el-tag size="big">{{ consigneeName }}</el-tag>
- </el-form-item>
- <el-form-item>
- <label class="el-form-item__label" style="width: auto;"
- >是否自提:</label
- >
- <el-tag size="big">{{ saleOrderIsselfMention }}</el-tag>
- </el-form-item>
- <el-form-item>
- <label class="el-form-item__label" style="width: auto;"
- >收款公司:</label
- >
- <el-tag size="big">{{ saleOrderReceiveCustomer }}</el-tag>
- </el-form-item>
- <el-form-item>
- <label class="el-form-item__label" style="width: auto;"
- >业务员:</label
- >
- <el-tag size="big">{{ saleManText }}</el-tag>
- </el-form-item>
- <el-form-item>
- <label class="el-form-item__label" style="width: auto;">摘要:</label>
- <el-tag size="big" v-if="remarks != null">{{ remarks }}</el-tag>
- </el-form-item>
- </el-form>
- <!-- 物资明细信息 -->
- <el-table
- :data="selectionList"
- border
- style="width: 100%;margin-top: 0.5rem;"
- :span-method="cellMerge"
- highlight-current-row
- >
- <el-table-column
- v-for="(item, i) in tableTop"
- :key="i"
- :prop="item.prop"
- :label="item.label"
- :width="item.width"
- align="center"
- show-overflow-tooltip
- >
- </el-table-column>
- </el-table>
- <div class="button-box">
- <el-button @click="orderMakeSure = false">返回编辑</el-button>
- <el-button type="primary" @click="sendRequest">提交订单</el-button>
- </div>
- </el-dialog>
- <el-dialog
- title="绑定销售片区(将该单位绑定片区才可以上传金蝶)"
- :visible.sync="isHaveArea"
- width="94%"
- >
- <div class="isHaveArea">
- <el-form>
- <el-form-item>
- <el-label>
- 请选择销售片区
- </el-label>
- <el-autocomplete
- class="inline-input"
- v-model="saleArea"
- :fetch-suggestions="querySearchSaleArea"
- placeholder="请选择销售片区"
- :trigger-on-focus="false"
- @select="handleSelectSaleArea"
- >
- </el-autocomplete>
- </el-form-item>
- </el-form>
- </div>
- <div class="button-box">
- <el-button type="primary" @click="onclikSaleArea">确定</el-button>
- </div>
- </el-dialog>
- <div class="button-box">
- <el-button @click="cancel">取消</el-button>
- <el-button type="primary" @click="makeSure">确定</el-button>
- </div>
- </div>
- </template>
- <script>
- import PageTitle from "@/components/Page/Title";
- import { getCookie } from "@/utils/util.js";
- import { sjTime, isIntegerNumber } from "@/utils/sharedJsFile";
- export default {
- components: { PageTitle },
- data() {
- return {
- saleArea: "",
- isHaveArea: false,
- consigneeDisable: false,
- isCellClick: 0,
- truckRemark: "",
- shipperName: "四川省达州钢铁集团有限责任公司",
- shipperId: 1,
- consigneeName: null,
- consigneeId: null,
- remarks: null,
- saleShipperAddressName: null,
- saleShipperAddressId: null,
- saleDateOfReceipt: null,
- saleOrderConsigneeTel: null,
- //加载
- selectLineLoading: false,
- //物资选中暂存
- materialList1: [],
- //物资信息查询内容
- materialNameText: null,
- materialSpecificationText: null,
- materialModelText: null,
- //物资选中表格
- materialList: [],
- materialTableTop: [
- {
- prop: "materialName",
- label: "物资名称"
- },
- {
- prop: "meterNumber",
- label: "米数",
- slot: true
- },
- {
- prop: "Specification",
- label: "规格型号"
- },
- {
- prop: "orderPlanWeight",
- label: "件数",
- slot: true
- },
- {
- prop: "carNumber",
- label: "分装车数",
- slot: true
- },
- {
- prop: "isPound",
- label: "是否磅重销售",
- slot: true
- }
- ],
- table1: false,
- //最大车序号数
- maxCxh: 1,
- //存放每一行记录的合并数
- spanArr: [],
- //pos是spanArr的索引
- pos: 0,
- //判断是内层还是外层点击的收货地址浏览
- inOrOut: 0,
- //地址输入框的值
- addresText: "",
- //已选中省市县
- address: null,
- //具体地址
- place: null,
- //暂存具体地址
- place1: null,
- //省市县Id
- addressId: null,
- // input: "",
- //物资表格多选
- option: {
- // 表格请求数据的地址
- requestUrl: "/api/v1/uc/getSteelMaterial?apiId=244",
- // 控制显示多选列
- selectionType: "select"
- },
- //物资表格单选
- option1: {
- // 表格请求数据的地址
- requestUrl: "/api/v1/uc/getSteelMaterial?apiId=244",
- // 控制显示单选列
- selectionType: "radio"
- },
- selectionList: [],
- selectionList1: [],
- drawer1: false,
- direction: "rtl",
- form1: {},
- value: undefined,
- frist: {
- requestUrl: "/api/v1/ams/getAddressDeliveryAddress?apiId=255",
- selectionType: "radio",
- mapList: []
- },
- //所有省
- provinceList: [],
- //选中的省
- province: "",
- //所有市
- cityList: [],
- //选中的市
- city: "",
- //所有的县(区)
- countyList: [],
- //选中的县
- county: "",
- options: [
- {
- values: "yes",
- label: "是"
- },
- {
- values: "no",
- label: "否"
- }
- ],
- values: "no",
- //是否磅重销售
- options2: [
- {
- values2: 0,
- label2: "是"
- },
- {
- values2: 1,
- label2: "否"
- }
- ],
- values2: 1,
- receivingCompany: [
- {
- values1: "dzgt",
- label1: "四川省达州钢铁集团有限责任公司"
- },
- {
- values1: "dgsm",
- label1: "四川达钢商贸有限公司"
- },
- {
- values1: "jxjl",
- label1: "江西久隆贸易有限公司"
- },
- {
- values1: "hnht",
- label1: "海南瀚途贸易有限公司"
- }
- ],
- values1: "dzgt",
- saleMan: null,
- saleManText: null,
- saleMans: [],
- tableTop: [
- {
- prop: "cxh",
- label: "车序号",
- width: "50px"
- },
- {
- prop: "materialName",
- label: "物资名称",
- width: "300px",
- slot: true
- },
- {
- prop: "meterNumber",
- label: "米数",
- width: "60px",
- slot: true
- },
- {
- prop: "Specification",
- label: "规格型号",
- width: "140px",
- slot: true
- },
- {
- prop: "orderPlanWeight",
- label: "件数",
- width: "60px",
- slot: true
- },
- {
- prop: "isPound",
- label: "是否磅重销售",
- width: "80px",
- slot: true
- },
- {
- prop: "saleShipperAddressName",
- label: "收货地址",
- width: "400px",
- slot: true
- },
- {
- prop: "saleOrderConsigneeTel",
- label: "收货客户电话",
- width: "120px",
- slot: true
- },
- {
- prop: "truckRemark",
- label: "备注",
- slot: true
- }
- ],
- row: {},
- //打开更改改物资弹出框
- drawer: false,
- //记录为内层打开
- isOpenDrawer: 0,
- //记录修改物资单选行的位置
- indexChangeMaterial: null,
- //记录单选物资Id
- selectedMaterialId: null,
- //记录单选物资名称
- selectedMaterialName: null,
- //记录单选物资规格
- selectedMaterialSpecification: null,
- //记录单选物资型号
- selectedMaterialModel: null,
- //记录单选物资编码
- selectedMaterialCode: null,
- //订单确认
- orderMakeSure: false,
- //是否自提记录字段
- saleOrderIsselfMention: null,
- //收款公司
- saleOrderReceiveCustomer: null,
- //是否忽视收货客户电话字段
- ignoreSaleOrderConsigneeTel: 0,
- restaurants: [],
- saleAreaId: null,
- isNiTui: 0,
- datalistindex: 0,
- temporarylist: []
- };
- },
- created() {
- let loadTime1 = new Date(
- new Date(new Date().toLocaleDateString()).getTime() +
- (3600 * 1000 * 8 - 1)
- ); // 当天8点前
- let loadTime2 = new Date(
- new Date(new Date().toLocaleDateString()).getTime() +
- (3600 * 1000 * 32 - 1)
- ); // 次天8点前
- if (new Date().getTime() - loadTime1 > 0) {
- this.saleDateOfReceipt = loadTime2;
- } else {
- this.saleDateOfReceipt = loadTime1;
- }
- //获取所有的省
- this.getAllProvince();
- //获取所有的业务员
- this.getAllsaleMan();
- },
- mounted() {
- if (getCookie("orgCode") == "shouhuokehu") {
- this.consigneeDisable = true;
- this.axios
- .get("/api/v1/uc/getConsigneeByuserid?userId=" + getCookie("userId"))
- .then(res => {
- console.log(res);
- if (res.status == 200) {
- console.log(res.data);
- this.consigneeName = res.data.consigneeCompanyName;
- this.consigneeId = res.data.consigneeId;
- //带出摘要
- this.axios
- .post("/api/v1/uc/getSaleArea?receiveId=" + this.consigneeId)
- .then(res => {
- this.remarks = res.data.data;
- });
- this.axios
- .post(
- "/api/v1/ams/matchingAddressRecently?receiveId=" +
- this.consigneeId
- )
- .then(res => {
- this.restaurants = res.data.data;
- const place = res.data.data;
- this.saleShipperAddressName =
- place[0].addressProvince +
- place[0].addressDistrict +
- place[0].addressTown +
- place[0].place;
- this.saleShipperAddressId = place[0].shipperAddressId;
- this.place1 = place[0].place;
- this.saleMan = place[0].salerId;
- this.saleOrderConsigneeTel = place[0].saleOrderConsigneeTel;
- });
- }
- });
- }
- },
- methods: {
- handleSelectSaleArea(item) {
- this.saleAreaId = item.areaId;
- this.remarks = item.value;
- },
- onclikSaleArea() {
- if (this.saleAreaId == null) {
- this.$message.warning("请先选择片区");
- return;
- }
- this.axios
- .post("/api/v1/uc/bandSaleArea", {
- areaId: this.saleAreaId,
- receiveId: this.consigneeId
- })
- .then(res => {
- if (res.data.code == "200") {
- this.$message.success("绑定片区成功");
- this.isHaveArea = false;
- } else {
- this.$message.error("绑定片区失败");
- this.isHaveArea = false;
- }
- })
- .catch(() => {
- this.$message.error("绑定片区失败");
- this.isHaveArea = false;
- });
- },
- isReceiveHaveArea(receiveId) {
- this.axios
- .post("/api/v1/uc/isReceiveHaveArea?receiveId=" + receiveId)
- .then(res => {
- if (res.data.code == "201") {
- this.isHaveArea = true;
- }
- });
- },
- querySearchSaleArea(queryString, cb) {
- this.axios
- .post("/api/v1/uc/getSaleAreaByLike?index=" + queryString)
- .then(res => {
- var restaurants = res.data.data;
- console.log(restaurants);
- var results = queryString
- ? restaurants.filter(this.createStateFilterSaleArea(queryString))
- : restaurants;
- cb(results);
- });
- },
- createStateFilterSaleArea(queryString) {
- return restaurants => {
- return (
- restaurants.label.toLowerCase().indexOf(queryString.toLowerCase()) >
- -1
- );
- };
- },
- handleSelectAddress(item) {
- this.saleShipperAddressName = item.addressPlace;
- this.province = item.addressProvince;
- this.city = item.addressDistrict;
- this.county = item.addressTown;
- this.saleShipperAddressId = item.shipperAddressId;
- this.addressId = item.shipperAddressId;
- this.place1 = item.place;
- this.saleOrderConsigneeTel = item.saleOrderConsigneeTel;
- },
- querySearchAddress(queryString, cb) {
- if (this.consigneeId != null) {
- this.axios
- .post(
- "/api/v1/ams/matchingAddressRecently?receiveId=" + this.consigneeId
- )
- .then(res => {
- var restaurants = res.data.data;
- console.log(restaurants);
- var results = queryString
- ? restaurants.filter(this.createStateFilter(queryString))
- : restaurants;
- cb(results);
- });
- }
- },
- createStateFilter(queryString) {
- return restaurants => {
- return (
- restaurants.addressPlace
- .toLowerCase()
- .indexOf(queryString.toLowerCase()) > -1
- );
- };
- },
- onblur() {
- this.isCellClick = 0;
- },
- goclick() {
- this.isCellClick = 1;
- },
- rowDbClick1(row) {
- this.selectedMaterialId = row.materialId;
- this.selectedMaterialName = row.materialName;
- this.selectedMaterialSpecification = row.materialSpecification;
- this.selectedMaterialModel = row.materialModel;
- this.selectedMaterialCode = row.materialCode;
- this.makeSureChange();
- },
- rowDbClick(row) {
- this.materialList1 = [];
- this.materialList1.push(row);
- this.makeSureMaterial();
- },
- //获取所有的业务员数据
- getAllsaleMan() {
- this.axios.get("/api/v1/uc/getSalerList").then(res => {
- this.saleMans = res.data.data;
- });
- },
- //获取所有省数据
- getAllProvince() {
- this.axios.post("/api/v1/uc/getAllProvince").then(res => {
- this.provinceList = res.data.data;
- });
- },
- //省改变
- onchangeProvince() {
- this.axios
- .post(
- "/api/v1/uc/getDistrictByProvince?addressProvince=" +
- this.province +
- "&i=" +
- new Date()
- )
- .then(res => {
- this.cityList = res.data.data;
- // this.city = "";
- // this.county = "";
- });
- },
- //市改变
- onchangeCity() {
- this.axios
- .post(
- "/api/v1/uc/getTownByDistrict?addressDistrict=" +
- this.city +
- "&i=" +
- new Date()
- )
- .then(res => {
- this.countyList = res.data.data;
- });
- },
- //县(区)改变
- onchangeCounty() {
- let mapValue = {
- addressProvince: this.province,
- addressDistrict: this.city,
- addressTown: this.county
- };
- this.axios.post("/api/v1/uc/getPlaceByAllAddress", mapValue).then(res => {
- this.addressId = res.data.data[0].addressId;
- });
- },
- //发货单位弹出层
- handleSelectCarrier(item) {
- this.shipperName = item.shipperName;
- this.shipperId = item.shipperId;
- },
- //以下是发货单位边输边查搜索
- querySearchCarrier(queryString, cb) {
- this.axios
- .post("/api/v1/uc/getRequireUnitName?index=" + queryString)
- .then(res => {
- if (res.data.code == "200") {
- var restaurantsCarrier = res.data.data;
- var results = queryString
- ? restaurantsCarrier.filter(this.createFilterCarrier(queryString))
- : restaurantsCarrier;
- // 调用 callback 返回建议列表的数据
- cb(results);
- }
- });
- },
- createFilterCarrier(queryString) {
- return restaurantsCarrier => {
- return (
- restaurantsCarrier.shipperName
- .toLowerCase()
- .indexOf(queryString.toLowerCase()) > -1
- );
- };
- },
- //以上是发货单位边输边查搜索
- //下单客户弹出层
- handleSelectConsignee(item) {
- this.saleShipperAddressName = null;
- this.saleShipperAddressId = null;
- this.addressId = null;
- this.place1 = null;
- this.saleMan = null;
- this.saleOrderConsigneeTel = null;
- this.province = null;
- this.city = null;
- this.county = null;
- this.consigneeName = item.consigneeCompanyName;
- this.consigneeId = item.consigneeId;
- this.isReceiveHaveArea(this.consigneeId);
- //带出摘要
- this.axios
- .post("/api/v1/uc/getSaleArea?receiveId=" + this.consigneeId)
- .then(res => {
- this.remarks = res.data.data;
- });
- this.axios
- .post(
- "/api/v1/ams/matchingAddressRecently?receiveId=" + this.consigneeId
- )
- .then(res => {
- const place = res.data.data;
- console.log(place);
- this.saleShipperAddressName =
- place[0].addressProvince +
- place[0].addressDistrict +
- place[0].addressTown +
- place[0].place;
- this.saleShipperAddressId = place[0].shipperAddressId;
- this.addressId = place[0].shipperAddressId;
- this.place1 = place[0].place;
- this.saleMan = place[0].salerId;
- this.saleOrderConsigneeTel = place[0].saleOrderConsigneeTel;
- this.province = place[0].addressProvince;
- this.city = place[0].addressDistrict;
- this.county = place[0].addressTown;
- });
- },
- //以下是下单客户边输边查搜索
- querySearchConsignee(queryString, cb) {
- this.axios
- .post("/api/v1/uc/getConsigneeByLike?index=" + queryString)
- .then(res => {
- if (res.data.code == "200") {
- var restaurantsConsignee = res.data.data;
- var results = queryString
- ? restaurantsConsignee.filter(
- this.createFilterConsignee(queryString)
- )
- : restaurantsConsignee;
- // 调用 callback 返回建议列表的数据
- cb(results);
- }
- });
- },
- createFilterConsignee(queryString) {
- return restaurantsConsignee => {
- return (
- restaurantsConsignee.value
- .toLowerCase()
- .indexOf(queryString.toLowerCase()) > -1
- );
- };
- },
- //以上是下单客户边输边查搜索
- //新增物资
- addMaterial() {
- if (!this.shipperName) {
- this.$message.warning("发货单位未填写!");
- } else if (!this.consigneeName) {
- this.$message.warning("下单客户未填写!");
- } else if (!this.consigneeId) {
- this.$message.error("请选择一个下单客户下拉框中的选项!");
- } else if (!this.saleMan) {
- this.$message.warning("业务员未选择!");
- } else {
- this.option.requestUrl =
- "/api/v1/uc/getSteelMaterial?apiId=244&i=" + new Date();
- this.materialNameText = null;
- this.materialSpecificationText = null;
- this.table1 = true;
- }
- },
- //返回选中的物资信息
- selectionChange(selection) {
- this.materialList1 = [];
- this.materialList1 = selection;
- },
- //确认新增物资
- makeSureMaterial() {
- //记录是理重还是磅重
- var getisPound = 1;
- this.materialList1.forEach(e => {
- if (!e.materialSpecification) {
- e.materialSpecification = "";
- }
- if (!e.materialModel) {
- e.materialModel = "";
- }
- //判断物资是否为盘螺或非定尺
- if (
- e.materialName.includes("盘螺") ||
- e.materialName.includes("乱尺") ||
- e.materialName.includes("盘元") ||
- e.materialName.includes("盘圆")
- ) {
- getisPound = 0;
- } else {
- getisPound = 1;
- }
- //若物资为带有盘螺、盘圆、盘元,默认无米数
- if (
- e.materialName.includes("盘螺") ||
- e.materialName.includes("盘圆") ||
- e.materialName.includes("盘元")
- ) {
- var addmap = {
- materialName: e.materialName,
- Specification: e.materialSpecification + e.materialModel,
- materialCode: e.materialCode,
- orderPlanWeight: null,
- meterNumber: null,
- isPound: getisPound,
- //物资Id
- materialId: e.materialId,
- //无米数
- haveMeter: 0
- };
- } else {
- if (e.materialName.includes("米")) {
- var addmap = {
- materialName: e.materialName,
- Specification: e.materialSpecification + e.materialModel,
- materialCode: e.materialCode,
- orderPlanWeight: null,
- meterNumber: Number(e.materialName.replace(/[^0-9]/gi, "")),
- isPound: getisPound,
- //物资Id
- materialId: e.materialId,
- //有米数
- haveMeter: 1,
- isDisable: 1
- };
- } else {
- var addmap = {
- materialName: e.materialName,
- Specification: e.materialSpecification + e.materialModel,
- materialCode: e.materialCode,
- orderPlanWeight: null,
- meterNumber: null,
- isPound: getisPound,
- //物资Id
- materialId: e.materialId,
- //有米数
- haveMeter: 1
- };
- }
- }
- this.materialList.push(addmap);
- });
- this.materialList1 = [];
- this.table1 = false;
- //初始化查询数据
- this.materialNameText = null;
- this.materialSpecificationText = null;
- this.materialModelText = null;
- this.onblur();
- },
- //删除物资行数据
- deleteMaterialRow(index, rows) {
- rows.splice(index, 1);
- this.onblur();
- },
- //删除一车数据
- deleteRow(index, rows) {
- //删除车序号相同的行
- if (this.spanArr[index] == 1) {
- //动态调整车序号
- rows.forEach(e => {
- if (rows[index].cxh < e.cxh) {
- e.cxh -= 1;
- }
- });
- //最大车序号减1
- this.maxCxh -= 1;
- }
- rows.splice(index, 1);
- //调用记录每一行的合并数的方法
- this.getSpanArr(this.selectionList);
- },
- copyRow(index, row) {
- let copyRow = new Object();
- Object.keys(row).forEach(key => {
- copyRow[key] = row[key];
- });
- copyRow.cxh = this.maxCxh;
- this.selectionList.push(copyRow);
- this.getSpanArr(this.selectionList);
- this.maxCxh++;
- },
- copyRowflu(index, row) {
- console.log(index);
- let copyRowflu = new Object();
- Object.keys(row).forEach(key => {
- copyRowflu[key] = row[key];
- });
- this.selectionList.splice(index + 1, 0, copyRowflu);
- // this.selectionList.push(copyRowflu);
- this.getSpanArr(this.selectionList);
- },
- copyRowfluAll(index, row) {
- let arr = [];
- //复制整车,根据车序号去寻找相同的列
- arr = this.selectionList.concat([]).filter((item, index) => {
- return item.cxh == row.cxh;
- });
- arr.forEach(e => {
- let copyRow = new Object();
- Object.keys(e).forEach(key => {
- copyRow[key] = e[key];
- });
- copyRow.cxh = this.maxCxh;
- this.selectionList.push(copyRow);
- });
- this.getSpanArr(this.selectionList);
- this.maxCxh++;
- },
- singleDistribute() {
- let ml = this.materialList.length;
- if (ml == 0) {
- this.$message.warning("请至少填入一车物资");
- return;
- }
- let singleArr = this.materialList;
- this.$confirm(
- `以上${ml}车物资将分配到不同的${ml}车,确定继续分配?`,
- "提醒",
- {
- cancelButtonText: "取消",
- confirmButtonText: "确定",
- center: true
- }
- ).then(() => {
- this.creatArtSingle(singleArr);
- });
- this.isNiTui = 0;
- },
- async creatArtSingle(singleArr) {
- let i = 0;
- singleArr.forEach(e => {
- if (!/(^[1-9]\d*$)/.test(e.orderPlanWeight)) {
- e.orderPlanWeight = null;
- i++;
- }
- });
- if (i != 0) {
- this.$message.error("件数必填且请输入正整数");
- return;
- }
- singleArr.forEach(e => {
- if (e.materialName.includes("定尺")) {
- if (!e.meterNumber) {
- i++;
- }
- }
- });
- if (i != 0) {
- this.$message.error("定尺必须填写米数");
- return;
- }
- if (
- !this.saleOrderConsigneeTel &&
- this.ignoreSaleOrderConsigneeTel == 0
- ) {
- this.$confirm(
- "收货客户电话未填写会导致无法接收车辆发货短信, 是否继续?",
- "提示",
- {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }
- )
- .then(() => {
- this.ignoreSaleOrderConsigneeTel = 1;
- this.addMaterialToSaleOrderSingle();
- })
- .catch(() => {
- this.$message.info("已取消!");
- });
- } else {
- this.addMaterialToSaleOrderSingle();
- }
- },
- addMaterialToSaleOrderSingle() {
- this.materialList.forEach(e => {
- var addmap = {
- cxh: this.maxCxh,
- materialName: e.materialName,
- Specification: e.Specification,
- materialCode: e.materialCode,
- orderPlanWeight: e.orderPlanWeight,
- meterNumber: e.meterNumber,
- isPound: e.isPound,
- saleShipperAddressId: this.saleShipperAddressId,
- place: this.place1,
- saleShipperAddressName: this.saleShipperAddressName,
- saleDateOfReceipt: this.saleDateOfReceipt,
- saleOrderConsigneeTel: this.saleOrderConsigneeTel,
- truckRemark: this.truckRemark,
- materialId: e.materialId,
- haveMeter: e.haveMeter,
- isDisable: e.isDisable
- };
- console.log(addmap);
- this.selectionList.push(addmap);
- //最大车序号加1
- this.maxCxh += 1;
- this.onblur();
- });
- this.materialList = [];
- this.getSpanArr(this.selectionList);
- },
- //准备生成部分订单
- createACar() {
- let i = 0;
- this.materialList.forEach(e => {
- if (!/(^[1-9]\d*$)/.test(e.orderPlanWeight)) {
- e.orderPlanWeight = null;
- i++;
- }
- });
- if (i != 0) {
- this.$message.error("件数必填且请输入正整数");
- return;
- }
- this.materialList.forEach(e => {
- if (e.materialName.includes("定尺")) {
- if (!e.meterNumber) {
- i++;
- }
- }
- });
- if (i != 0) {
- this.$message.error("定尺必须填写米数");
- return;
- }
- if (
- !this.saleOrderConsigneeTel &&
- this.ignoreSaleOrderConsigneeTel == 0
- ) {
- this.$confirm(
- "收货客户电话未填写会导致无法接收车辆发货短信, 是否继续?",
- "提示",
- {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }
- )
- .then(() => {
- this.ignoreSaleOrderConsigneeTel = 1;
- this.addMaterialToSaleOrder();
- })
- .catch(() => {
- this.$message.info("已取消!");
- });
- } else {
- this.addMaterialToSaleOrder();
- }
- this.isNiTui = 0;
- },
- //添加物资到订单
- addMaterialToSaleOrder() {
- console.log(this.materialList);
- if (this.materialList.length == 0) {
- this.$message.warning("请至少为这一车添加一个物资!");
- } else if (!this.saleShipperAddressName && this.values == "no") {
- this.$message.warning("收货地址未填写!");
- } else if (
- this.materialList.length == 1 &&
- this.materialList[0].carNumber != null
- ) {
- var eachOrderPlanWeight =
- this.materialList[0].orderPlanWeight / this.materialList[0].carNumber;
- if (isIntegerNumber(eachOrderPlanWeight)) {
- var e = this.materialList[0];
- for (var i = 0; i < this.materialList[0].carNumber; i++) {
- var addmap = {
- cxh: this.maxCxh,
- materialName: e.materialName,
- Specification: e.Specification,
- materialCode: e.materialCode,
- orderPlanWeight: eachOrderPlanWeight,
- meterNumber: e.meterNumber,
- isPound: e.isPound,
- saleShipperAddressId: this.saleShipperAddressId,
- place: this.place1,
- saleShipperAddressName: this.saleShipperAddressName,
- saleDateOfReceipt: this.saleDateOfReceipt,
- saleOrderConsigneeTel: this.saleOrderConsigneeTel,
- truckRemark: this.truckRemark,
- materialId: e.materialId,
- haveMeter: e.haveMeter,
- isDisable: e.isDisable
- };
- this.selectionList.push(addmap);
- //最大车序号加1
- this.maxCxh += 1;
- }
- //清空materialList
- this.materialList = [];
- //调用记录每一行的合并数的方法
- this.getSpanArr(this.selectionList);
- } else {
- this.$message.warning("分配件数不是整数!");
- }
- } else {
- this.materialList.forEach(e => {
- var addmap = {
- cxh: this.maxCxh,
- materialName: e.materialName,
- Specification: e.Specification,
- materialCode: e.materialCode,
- orderPlanWeight: e.orderPlanWeight,
- meterNumber: e.meterNumber,
- isPound: e.isPound,
- saleShipperAddressId: this.saleShipperAddressId,
- place: this.place1,
- saleShipperAddressName: this.saleShipperAddressName,
- saleDateOfReceipt: this.saleDateOfReceipt,
- saleOrderConsigneeTel: this.saleOrderConsigneeTel,
- truckRemark: this.truckRemark,
- materialId: e.materialId,
- haveMeter: e.haveMeter,
- isDisable: e.isDisable
- };
- console.log(addmap);
- this.selectionList.push(addmap);
- });
- //清空materialList
- this.materialList = [];
- //最大车序号加1
- this.maxCxh += 1;
- //调用记录每一行的合并数的方法
- this.getSpanArr(this.selectionList);
- this.onblur();
- }
- },
- //更改行物资
- changeMaterial(index) {
- this.option1.requestUrl =
- "/api/v1/uc/getSteelMaterial?apiId=244&i=" + new Date();
- this.drawer = true;
- this.materialNameText = null;
- this.materialSpecificationText = null;
- this.isOpenDrawer = 1;
- this.indexChangeMaterial = index;
- },
- //关闭更改行物资
- closeChangeMaterial() {
- this.drawer = false;
- this.isOpenDrawer = 0;
- this.$message.info("取消更改!");
- },
- //单选一行物资
- currentRadioChange(row) {
- this.selectedMaterialId = row.materialId;
- this.selectedMaterialName = row.materialName;
- this.selectedMaterialSpecification = row.materialSpecification;
- this.selectedMaterialModel = row.materialModel;
- this.selectedMaterialCode = row.materialCode;
- },
- //确认物资修改
- makeSureChange() {
- if (!this.selectedMaterialId) {
- this.$message.warning("请先选择一个物资!");
- } else {
- if (!this.selectedMaterialSpecification) {
- this.selectedMaterialSpecification = "";
- }
- if (!this.selectedMaterialModel) {
- this.selectedMaterialModel = "";
- }
- //记录是理重还是磅重
- var getisPound = 1;
- //判断物资是否为盘螺或非定尺
- if (
- this.selectedMaterialName.includes("盘螺") ||
- this.selectedMaterialName.includes("乱尺") ||
- this.selectedMaterialName.includes("盘元") ||
- this.selectedMaterialName.includes("盘圆")
- ) {
- getisPound = 0;
- } else {
- getisPound = 1;
- }
- this.selectionList[
- this.indexChangeMaterial
- ].materialId = this.selectedMaterialId;
- this.selectionList[
- this.indexChangeMaterial
- ].materialName = this.selectedMaterialName;
- this.selectionList[this.indexChangeMaterial].Specification =
- this.selectedMaterialSpecification + this.selectedMaterialModel;
- this.selectionList[
- this.indexChangeMaterial
- ].materialCode = this.selectedMaterialModel;
- this.selectionList[this.indexChangeMaterial].isPound = getisPound;
- //确定更改的物资有无米数
- if (
- this.selectedMaterialName.includes("盘螺") ||
- this.selectedMaterialName.includes("盘圆") ||
- this.selectedMaterialName.includes("盘元")
- ) {
- this.selectionList[this.indexChangeMaterial].haveMeter = 0;
- this.selectionList[this.indexChangeMaterial].meterNumber = null;
- } else {
- if (this.selectedMaterialName.includes("米")) {
- this.selectionList[this.indexChangeMaterial].haveMeter = 1;
- this.selectionList[this.indexChangeMaterial].isDisable = 1;
- this.selectionList[this.indexChangeMaterial].meterNumber = Number(
- this.selectedMaterialName.replace(/[^0-9]/gi, "")
- );
- } else {
- this.selectionList[this.indexChangeMaterial].haveMeter = 1;
- this.selectionList[this.indexChangeMaterial].isDisable = 0;
- this.selectionList[this.indexChangeMaterial].meterNumber = null;
- }
- }
- //重新初始化
- this.indexChangeMaterial = null;
- this.selectedMaterialId = null;
- this.selectedMaterialName = null;
- this.selectedMaterialSpecification = null;
- this.selectedMaterialModel = null;
- this.selectedMaterialCode = null;
- //关闭弹出框
- this.drawer = false;
- this.isOpenDrawer = 0;
- //初始化查询数据
- (this.materialNameText = null),
- (this.materialSpecificationText = null),
- (this.materialModelText = null);
- this.$message.success("成功更改!");
- this.onblur();
- }
- },
- //记录每一行的合并数
- getSpanArr(data) {
- //每次调用方法初始化
- this.spanArr = [];
- for (var i = 0; i < data.length; i++) {
- if (i === 0) {
- this.spanArr.push(1);
- this.pos = 0;
- } else {
- // 判断当前元素与上一个元素是否相同
- if (data[i].cxh === data[i - 1].cxh) {
- this.spanArr[this.pos] += 1;
- this.spanArr.push(0);
- } else {
- this.spanArr.push(1);
- this.pos = i;
- }
- }
- }
- },
- //根据条件合并行
- cellMerge({ row, column, rowIndex, columnIndex }) {
- if (columnIndex === 0) {
- const _row = this.spanArr[rowIndex];
- const _col = _row > 0 ? 1 : 0;
- return {
- rowspan: _row,
- colspan: _col
- };
- }
- if (columnIndex === 6) {
- const _row = this.spanArr[rowIndex];
- const _col = _row > 0 ? 1 : 0;
- return {
- rowspan: _row,
- colspan: _col
- };
- }
- if (columnIndex === 7) {
- const _row = this.spanArr[rowIndex];
- const _col = _row > 0 ? 1 : 0;
- return {
- rowspan: _row,
- colspan: _col
- };
- }
- if (columnIndex === 8) {
- const _row = this.spanArr[rowIndex];
- const _col = _row > 0 ? 1 : 0;
- return {
- rowspan: _row,
- colspan: _col
- };
- }
- if (columnIndex === 10) {
- const _row = this.spanArr[rowIndex];
- const _col = _row > 0 ? 1 : 0;
- return {
- rowspan: _row,
- colspan: _col
- };
- }
- },
- //点击外层收货地址浏览事件
- ondrawerOut() {
- if (this.inOrOut % 2 == 0) {
- this.inOrOut += 1;
- }
- this.frist.requestUrl =
- "/api/v1/ams/getAddressDeliveryAddress?apiId=255&i=" + new Date();
- this.drawer1 = true;
- this.onchangeProvince();
- this.onchangeCity();
- },
- //点击内层收货地址浏览事件
- ondrawer(row, index) {
- if (this.inOrOut % 2 == 1) {
- this.inOrOut += 1;
- }
- this.row = row;
- this.row.index = index;
- this.frist.requestUrl =
- "/api/v1/ams/getAddressDeliveryAddress?apiId=255&i=" + new Date();
- this.drawer1 = true;
- this.onchangeProvince();
- this.onchangeCity();
- },
- //查询全国省市县
- selectAddresClick() {
- if (this.addresText) {
- this.frist.requestUrl =
- "/api/v1/ams/getAddressDeliveryAddress?apiId=255&con=" +
- this.addresText;
- } else {
- this.frist.requestUrl =
- "/api/v1/ams/getAddressDeliveryAddress?apiId=255&i=" + new Date();
- }
- },
- //收货地址弹出层
- handleSelect1(item) {
- console.log(item);
- if (this.isNiTui == 1) {
- this.province = item.province;
- this.city = item.district;
- this.county = item.town;
- this.place1 = item.place;
- this.addressId = item.shipperAddressId;
- this.place = item.place;
- }
- },
- //以下是收货地址边输边查搜索
- querySearch1(queryString, cb) {
- if (this.addressId != null) {
- this.axios
- .post(
- "/api/v1/ams/getRealAddressByLike?addressId=" +
- this.addressId +
- "&index=" +
- queryString
- )
- .then(res => {
- this.isNiTui = 0;
- if (res.data.code == "200") {
- var restaurants = res.data.data;
- var results = queryString
- ? restaurants.filter(this.createFilter1(queryString))
- : restaurants;
- // 调用 callback 返回建议列表的数据
- cb(results);
- }
- });
- } else {
- this.axios
- .post("/api/v1/uc/getPlaceAndAddress?index=" + queryString)
- .then(res => {
- this.isNiTui = 1;
- if (res.data.code == "200") {
- console.log(res.data.data);
- var restaurants = res.data.data;
- var results = queryString
- ? restaurants.filter(this.createFilter1(queryString))
- : restaurants;
- // 调用 callback 返回建议列表的数据
- cb(results);
- }
- });
- }
- },
- createFilter1(queryString) {
- return restaurants => {
- return (
- restaurants.value.toLowerCase().indexOf(queryString.toLowerCase()) >
- -1
- );
- };
- },
- //以上是收货地址边输边查搜索
- //监听收货地址模态框点击事件
- currentRadioChange1(radioList) {
- this.addressId = radioList.addressId;
- this.address = radioList.address;
- },
- //确定收货地址事件
- addAddressClick() {
- //不管是外层还是内层都需要修改,如果存在都需要修改收货客户的电话
- //定义一个正则表达式判断是否有电话
- var est = /\d{11}/g;
- var string2 = this.place.match(est);
- console.log("-----------这是抓取到的数据----------");
- console.log(string2);
- if (string2 != null) {
- for (i = 0; i < string2.length; i++) {
- var reg = /^1[3456789]\d{9}$/;
- if (reg.test(string2[i])) {
- this.saleOrderConsigneeTel = string2;
- }
- }
- }
- if (this.inOrOut % 2 == 0) {
- for (
- var i = this.row.index;
- i < this.spanArr[this.row.index] + this.row.index;
- i++
- ) {
- this.selectionList[i].saleShipperAddressId = this.addressId;
- this.selectionList[i].place = this.place;
- this.selectionList[i].saleShipperAddressName =
- this.province + this.city + this.county + this.place;
- }
- this.drawer1 = false;
- } else {
- this.saleShipperAddressId = this.addressId;
- this.saleShipperAddressName =
- this.province + this.city + this.county + this.place;
- this.drawer1 = false;
- }
- // //初始化
- // this.addressId = null;
- // this.province = null;
- // this.cityList = [];
- // this.city = null;
- // this.countyList = [];
- // this.county = null;
- //暂存具体地址
- this.place1 = this.place;
- // this.place = null;
- // this.addresText = null;
- },
- //批量修改内层值
- batchUpdateValue(row, index) {
- for (var i = index; i < this.spanArr[index] + index; i++) {
- this.selectionList[i].saleOrderConsigneeTel = row.saleOrderConsigneeTel;
- }
- },
- //物资模态框查询
- onclick() {
- if (this.isOpenDrawer == 0) {
- this.option.requestUrl =
- "/api/v1/uc/getSteelMaterial?apiId=244&materialNameText=" +
- this.materialNameText +
- "&materialSpecificationText=" +
- this.materialSpecificationText;
- } else {
- this.option1.requestUrl =
- "/api/v1/uc/getSteelMaterial?apiId=244&materialNameText=" +
- this.materialNameText +
- "&materialSpecificationText=" +
- this.materialSpecificationText;
- }
- },
- // 确定
- async makeSure() {
- if (this.selectionList.length == 0) {
- this.$message.warning("请先填写具体信息");
- return;
- }
- let i = 0;
- this.selectionList.forEach(e => {
- if (!/(^[1-9]\d*$)/.test(e.orderPlanWeight)) {
- e.orderPlanWeight = null;
- i++;
- }
- });
- let flag = 0;
- await this.axios
- .post("/api/v1/ams/queryFormat", this.selectionList)
- .then(res => {
- if (res.data.code == "500") {
- flag = 1;
- }
- });
- if (flag == 1) {
- this.$message.error("规格型号有问题,请重新输入");
- return;
- }
- if (i != 0) {
- this.$message.error("件数必填且请输入正整数");
- return;
- }
- this.selectionList.forEach(e => {
- if (e.materialName.includes("定尺")) {
- if (!e.meterNumber) {
- i++;
- }
- }
- });
- if (i != 0) {
- this.$message.error("定尺必须填写米数");
- return;
- }
- //获取是否自提字段
- this.options.forEach(e => {
- if (this.values == e.values) {
- this.saleOrderIsselfMention = e.label;
- }
- });
- //获取收款公司字段
- this.receivingCompany.forEach(f => {
- if (this.values1 == f.values1) {
- this.saleOrderReceiveCustomer = f.label1;
- }
- });
- //获取业务员姓名
- this.saleMans.forEach(g => {
- if (this.saleMan == g.value) {
- this.saleManText = g.label;
- }
- });
- this.orderMakeSure = true;
- },
- //发送请求
- async sendRequest() {
- this.orderMakeSure = false;
- //是否还有件数未填写
- var orderPlanWeightAllFill = 0;
- //根据规格型号与物资名称获取对应的物资ID||确认规格型号格式是否正确
- //先把暂存区的数据清空
- this.temporarylist = [];
- let flag = 0;
- await this.axios
- .post("/api/v1/ams/queryMaterial", this.selectionList)
- .then(res => {
- if (res.data.code === "500") {
- flag = 1;
- }
- console.log(res.data.code);
- //给暂存区的数据赋值
- this.temporarylist = res.data.data;
- console.log("以下是查询出来的数据");
- console.log(res.data.data);
- });
- if (flag === 1) {
- this.$message.error("规格型号不对");
- return;
- }
- this.selectionList = this.temporarylist;
- //初始化maplist
- var mapList = [];
- this.selectionList.forEach(item => {
- if (!item.orderPlanWeight) {
- orderPlanWeightAllFill++;
- }
- //初始化mapItem
- var mapItem = {
- //车序号
- truckNo: 0,
- //省市县id
- shipperAddressId: 0,
- //具体地址
- place: null,
- //截止日期
- saleDateOfReceipt: null,
- //收货方电话
- saleOrderConsigneeTel: "",
- //车序号物资ID
- materialId: 0,
- //物资件数
- materialNumber: 0,
- //米数
- steelMeters: 0,
- //是否磅重销售
- isPoundSale: 0,
- //备注
- truckRemark: "",
- //物资名称
- materialName: ""
- };
- mapItem.truckNo = item.cxh;
- mapItem.shipperAddressId = item.saleShipperAddressId;
- mapItem.place = item.place;
- mapItem.saleDateOfReceipt = sjTime(item.saleDateOfReceipt);
- mapItem.saleOrderConsigneeTel = item.saleOrderConsigneeTel;
- mapItem.materialId = item.materialId;
- mapItem.materialNumber = item.orderPlanWeight;
- mapItem.steelMeters = item.meterNumber;
- mapItem.isPoundSale = item.isPound;
- mapItem.truckRemark = item.truckRemark;
- mapItem.materialName = item.materialName;
- mapList.push(mapItem);
- });
- let mapValue = {
- shipperId: this.shipperId,
- receiveId: this.consigneeId,
- isSelfMention: this.saleOrderIsselfMention,
- saleOrderReceiveCustomer: this.saleOrderReceiveCustomer,
- salerId: this.saleMan,
- saleRemark: this.remarks,
- mapList: mapList
- };
- console.log(mapValue);
- //所有列件数都填写
- if (orderPlanWeightAllFill == 0) {
- this.axios
- .post("/api/v1/ams/addSteelSaleOrder", mapValue)
- .then(res => {
- if (res.data.code == "200") {
- this.$router.go(-1);
- this.notDebounce = false;
- }
- this.$message.success("新增订单成功!");
- })
- .catch(() => {
- this.$message.error();
- });
- } else {
- this.$message.error("还有物资件数未填写!");
- this.notDebounce = false;
- }
- },
- // 取消
- cancel() {
- this.$router.go(-1);
- },
- //关闭事件
- handleClose(done) {
- this.$confirm("确认关闭?")
- .then(_ => {
- done();
- })
- .catch(_ => {});
- },
- //点击事件(上)
- clicks(index) {
- console.log(index);
- console.log(this.materialList);
- console.log(this.materialList.length - 1);
- console.log("clicks=e", arguments);
- if (index == 0) {
- console.log("向上1");
- //this.datalistindex=this.materialTableTop.length-1
- document
- .getElementById("input" + (this.materialList.length - 1))
- .focus();
- } else {
- console.log("向上2");
- //this.$refs.materialTableTop.bodyWrapper.scrollTop=index
- document.getElementById("input" + (index - 1)).focus();
- }
- },
- //点击事件(下)
- clickx(index) {
- console.log(index);
- console.log(this.materialList);
- console.log(this.materialList.length - 1);
- if (index == this.materialList.length - 1) {
- console.log("向下1");
- document.getElementById("input" + 0).focus();
- } else {
- console.log("向下2");
- //this.datalistindex+=1
- //this.$refs.materialTableTop.bodyWrapper.scrollTop=(index+1)*height
- //var tbl=document.getElementById("table").childNodes[0]
- //tbl.childNodes[len].childNodes[0].childNodes[0].focus()children[3]
- //const rowlist=this.$refs.materialTableTop.$el.children[3].children[1].children[0]
- //.children[1].children[len].children[3].children[0].children[0].children[0].focus()
- //console.log(rowlist)
- var nextInput = document.getElementById("input" + (index + 1));
- nextInput.focus();
- }
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .addSalePlan {
- width: 100%;
- .el-drawer__body {
- overflow: auto;
- }
- .el-drawer__container ::-webkit-scrollbar {
- display: none;
- }
- }
- .form-box,
- .from {
- display: flex;
- align-items: center;
- justify-content: center;
- margin-top: 5px;
- margin-bottom: 20px;
- }
- .button-box {
- display: flex;
- text-align: center;
- align-items: center;
- justify-content: center;
- margin-top: 0.3125rem;
- margin-bottom: 1.25rem;
- }
- .select {
- margin-left: -10rem;
- }
- .demo-form-inline {
- margin-left: 2rem;
- }
- .table_form {
- margin-left: -16rem;
- }
- .textinput111 {
- width: 83px;
- }
- .textinput {
- width: 50px;
- }
- .textinput1 {
- width: 50px;
- text-align: center;
- size: small;
- }
- .textinput2 {
- width: 50px;
- margin-right: 30px;
- }
- .textinput3 {
- width: 190px;
- }
- .textinput4 {
- width: 60px;
- }
- .textinput5 {
- width: 120px;
- }
- </style>
|