12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640 |
- <template>
- <div class="main-contain">
- <div class="position">
- <bread-crumb :crumbs="crumbs"></bread-crumb>
- </div>
- <div class="app-container" v-loading="loading">
- <div
- style="
- justify-content: space-between;
- margin: 0px 0 12px 0;
- display: flex;
- align-items: center;
- "
- >
- <div style="display:flex;align-items: center;">
- <span style="color: red">*</span><span>供应商:</span>
- <el-select
- v-model="supplier_name"
- style="width: 220px; margin-right: 10px"
- placeholder="请选择"
- :disabled="disabled"
- >
- <el-option
- v-for="item in supplyList"
- :key="item.id"
- :label="item.supplier_name"
- :value="item.id"
- >
- </el-option>
- </el-select>
- <span>单据日期:</span>
- <el-date-picker
- :disabled="disabled"
- size="small"
- v-model="start_time"
- prefix-icon="el-icon-date"
- :editable="false"
- style="width: 196px"
- type="date"
- placeholder="选择日期时间"
- align="right"
- format="yyyy-MM-dd"
- value-format="yyyy-MM-dd"
- ></el-date-picker>
- <!-- <span>交货日期:</span> -->
- <!-- <el-date-picker
- size="small"
- v-model="end_time"
- prefix-icon="el-icon-date"
- :editable="false"
- style="width: 196px;"
- type="date"
- placeholder="选择日期时间"
- align="right"
- format="yyyy-MM-dd"
- value-format="yyyy-MM-dd"
- @change="endTimeChange"
- ></el-date-picker> -->
- <span>单据编码:{{ good_number }}</span>
- </div>
- <div style="display:flex">
- <el-button
- size="small"
- type="primary"
- @click="saveGoodOrder"
- v-show="showOne"
- >保存</el-button
- >
- <el-button
- size="small"
- type="primary"
- @click="updateGoodOrder"
- v-show="showTwo"
- >保存</el-button
- >
- <el-button size="small" type="primary" @click="checkGoodOrder" v-if="is_check == 2" >审核</el-button>
- <el-button size="small" type="primary" @click="MofyGoodOrder" v-if="is_check == 1">反审核</el-button>
- <el-button size="small" type="primary" @click="toClick" v-if="is_check == 1" >生成采购退货单</el-button>
- </div>
- </div>
-
- <el-form :rules="tableRules" :model="recordInfo" ref="tableForm">
- <el-table
- :row-style="{ color: '#303133' }"
- :header-cell-style="{
- backgroundColor: 'rgb(245, 247, 250)',
- color: '#606266',
- }"
- :data="recordInfo.tableList"
- :class="signAndWeighBoxPatients"
- border
- style="width: 100%"
- max-height="450"
- >
- <el-table-column align="center" width="200px">
- <template slot="header" slot-scope="scope">
- <span>商品<span style="color: red">*</span></span>
- </template>
- <template slot-scope="scope">
- <el-form-item
- :prop="'tableList.' + scope.$index + '.name'"
- :rules="tableRules.name"
- >
- <el-select
- v-model="scope.row.name"
- style="width: 160px"
- filterable
- placeholder="请选择商品"
- @change="changeName"
- @input="changeGoodName(scope.$index)"
- :disabled="disabled"
- >
- <el-option
- v-for="(item, index) in tabList"
- :key="index"
- :label="item.supply_name"
- :value="item"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column align="center" width="150px">
- <template slot="header" slot-scope="scope">
- <span>商品类别</span>
- </template>
- <template slot-scope="scope">
- <el-input
- v-model="scope.row.supply_type"
- style="width: 120px"
- :disabled="true"
- placeholder="商品类别"
- ></el-input>
- <div style="visibility: hidden">/</div>
- </template>
- </el-table-column>
- <el-table-column label="规格&单位" align="center" width="150px">
- <template slot-scope="scope">
- <el-input
- v-model="scope.row.supply_specification_name"
- style="width: 120px"
- :disabled="true"
- placeholder="规格&单位"
- ></el-input>
- <div style="visibility: hidden">/</div>
- </template>
- </el-table-column>
- <el-table-column label="单位" align="center" width="120px">
- <template slot="header" slot-scope="scope">
- <span>单位<span style="color: red">*</span></span>
- </template>
- <template slot-scope="scope">
- <el-form-item
- :prop="'tableList.' + scope.$index + '.supply_unit'"
- :rules="tableRules.supply_unit"
- >
- <el-select
- v-model="scope.row.supply_unit"
- style="width: 100px"
- filterable
- placeholder="请选择"
- :disabled="disabled"
- >
- <el-option
- v-for="(item, index) in scope.row.unitList"
- :key="index"
- :label="item.name"
- :value="item.name"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column label="批号" align="center" width="200px">
- <template slot="header" slot-scope="scope">
- <span>批号<span style="color: red">*</span></span>
- </template>
- <template slot-scope="scope">
- <el-form-item
- :prop="'tableList.' + scope.$index + '.supply_batch_number'"
- :rules="tableRules.supply_batch_number"
- >
- <el-input
- v-model="scope.row.supply_batch_number"
- style="width: 180px"
- :disabled="disabled"
- placeholder="请输入批号"
- ></el-input>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column label="有效日期" align="center" width="200px">
- <template slot="header" slot-scope="scope">
- <span>有效日期<span style="color: red">*</span></span>
- </template>
- <template slot-scope="scope">
- <el-form-item
- :prop="'tableList.' + scope.$index + '.supply_expiry_date'"
- :rules="tableRules.supply_expiry_date"
- >
- <el-date-picker
- prefix-icon="el-icon-date"
- style="width: 180px"
- v-model="scope.row.supply_expiry_date"
- type="date"
- placeholder="选择日期时间"
- format="yyyy-MM-dd"
- value-format="yyyy-MM-dd"
- >
- </el-date-picker>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column label="可用库存" align="center" width="150px">
- <template slot-scope="scope">
- <el-input
- v-model="scope.row.supply_total"
- style="width: 100px"
- :disabled="true"
- ></el-input>
- <div style="visibility: hidden">/</div>
- </template>
- </el-table-column>
- <el-table-column label="数量" align="center" width="140px">
- <template slot="header" slot-scope="scope">
- <span>数量<span style="color: red">*</span></span>
- </template>
- <template slot-scope="scope">
- <el-form-item
- :prop="'tableList.' + scope.$index + '.supply_count'"
- :rules="tableRules.supply_count"
- >
- <el-input
- v-model="scope.row.supply_count"
- style="width: 100px"
- :disabled="disabled"
- placeholder="请输入数量"
- ></el-input>
- </el-form-item>
- </template>
- </el-table-column>
-
- <el-table-column label="拆零零售价" align="center" width="180px">
- <template slot-scope="scope">
- <el-input
- v-model="scope.row.min_price"
- style="width: 140px"
- :disabled="disabled"
- placeholder="请输入拆零零售价"
- ></el-input>
- <div style="visibility: hidden">/</div>
- </template>
- </el-table-column>
-
- <el-table-column label="采购单价" align="center" width="180px">
- <template slot-scope="scope">
- <el-input
- v-model="scope.row.supply_price"
- style="width: 140px"
- :disabled="disabled"
- placeholder="请输入采购单价"
- ></el-input>
- <div style="visibility: hidden">/</div>
- </template>
- </el-table-column>
-
- <el-table-column label="采购金额" align="center" width="120px">
- <template slot-scope="scope">
- {{ calculate(scope.row.supply_count * scope.row.supply_price) }}
- <div style="visibility: hidden">/</div>
- </template>
- </el-table-column>
- <el-table-column label="生产日期" align="center" width="200px">
- <template slot="header" slot-scope="scope">
- <span>生产日期<span style="color: red">*</span></span>
- </template>
- <template slot-scope="scope">
- <el-form-item
- :prop="'tableList.' + scope.$index + '.supply_product_date'"
- :rules="tableRules.supply_product_date"
- >
- <el-date-picker
- prefix-icon="el-icon-date"
- style="width: 180px"
- v-model="scope.row.supply_product_date"
- type="date"
- placeholder="选择日期时间"
- format="yyyy-MM-dd"
- value-format="yyyy-MM-dd"
- >
- </el-date-picker>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column label="生产厂家" align="center" width="200px">
- <template slot-scope="scope">
- <el-select
- size="small"
- v-model="scope.row.supply_manufacturer"
- filterable
- :disabled="true"
- >
- <el-option
- v-for="(option, index) in manufactuerList"
- :key="index"
- :label="option.manufacturer_name"
- :value="option.id"
- >
- </el-option>
- </el-select>
- <div style="visibility: hidden">/</div>
- </template>
- </el-table-column>
-
- <el-table-column label="批准文号" align="center" width="200px">
- <template slot-scope="scope">
- <el-input
- v-model="scope.row.supply_license_number"
- style="width: 160px"
- :disabled="true"
- ></el-input>
- <div style="visibility: hidden">/</div>
- </template>
- </el-table-column>
-
- <el-table-column label="关联采购订单号" align="center" width="200px">
- <template slot-scope="scope">
- <el-input
- v-model="scope.row.order_number"
- style="width: 160px"
- :disabled="true"
- ></el-input>
- <div style="visibility: hidden">/</div>
- </template>
- </el-table-column>
-
- <el-table-column label="备注" align="center" width="200px">
- <template slot-scope="scope">
- <el-input
- v-model="scope.row.supply_remake"
- style="width: 160px"
- :disabled="disabled"
- placeholder="请输入备注"
- ></el-input>
- <div style="visibility: hidden">/</div>
- </template>
- </el-table-column>
-
- <el-table-column
- label="操作"
- align="center"
- width="150px"
- fixed="right"
- >
- <template slot-scope="scope">
- <el-tooltip
- class="item"
- effect="dark"
- content="新增"
- placement="top"
- >
- <el-button
- size="mini"
- type="primary"
- icon="el-icon-circle-plus-outline"
- @click="handleEdit(scope.$index, scope.row)"
- >
- </el-button>
- </el-tooltip>
- <el-tooltip
- class="item"
- effect="dark"
- content="删除"
- placement="top"
- >
- <el-button
- size="mini"
- type="danger"
- icon="el-icon-delete"
- @click="handleDelete(scope.$index, scope.row)"
- >
- </el-button>
- </el-tooltip>
- </template>
- </el-table-column>
- </el-table>
- <div style="margin-top: 10px">
- <el-input
- type="textarea"
- :rows="2"
- placeholder="备注信息"
- v-model="return_remark"
- >
- </el-input>
- </div>
- <!-- 审核水印 -->
- <img
- src="@/assets/purchase/Reviewed.png"
- alt="正在加载..."
- class="reviewImg"
- v-show="Reviewed == true"
- />
- </el-form>
- <div>
- <div style="margin-top: 10px">合计:{{ getAllPrice() }} 元</div>
- <div style="margin-top: 10px">
- <span
- >优惠率:<el-input
- style="width: 150px"
- v-model="rate_of_concession"
- @input="addressChange"
- placeholder="请输入优惠率"
- :disabled="disabled"
- ></el-input
- >%</span
- >
-
- <span
- >优惠金额:<el-input
- style="width: 150px"
- v-model="discount_amount"
- @input="count_discount"
- placeholder="请输入优惠金额"
- :disabled="disabled"
- ></el-input
- ></span>
-
- <span
- >本次付款:<el-input
- style="width: 150px"
- v-model="payment"
- @input="count_payment"
- placeholder="请输入本次付款"
- :disabled="disabled"
- ></el-input
- ></span>
-
- <span
- >本次欠款:<el-input
- style="width: 150px"
- v-model="arrearage"
- @input="count_arrearage"
- placeholder="请输入本次欠款"
- :disabled="disabled"
- ></el-input
- ></span>
- </div>
- </div>
- <!-- <Computed :total="total_price" :rate_of_concession="rate_of_concession" :discount_amount="discount_amount"></Computed> -->
- </div>
-
- <!-- <el-dialog
- title="提示"
- :visible.sync="dialogVisible"
- width="30%"
- :before-close="handleClose">
- <span>这是一段信息</span>
- <span slot="footer" class="dialog-footer">
- <el-button @click="dialogVisible = false">取 消</el-button>
- <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
- </span>
- </el-dialog> -->
- </div>
- </template>
-
- <script>
- import Computed from "../../components/Computed/index_1.vue";
- import BreadCrumb from "@/xt_pages/components/bread-crumb";
- import { uParseTime } from "@/utils/tools";
- import {
- getInitOrder,
- checkPurchaseOrder,
- getPurchaseOrderInfo,
- addGoodOrder,
- updateGoodOrder,
- checkGoodOrderById,
- getGoodOrderCountList,
- ModefySupplyWarehousing,
- MofyGoodOrder,
- getSupplyWarehouseOutById,
- UpdateSupplyWahouseingInfo
- } from "@/api/supply";
- export default {
- name: "addPurchaseOrder",
- components: {
- BreadCrumb,
- Computed,
- },
- data() {
- return {
- Reviewed: false,
- crumbs: [
- { path: false, name: "采购单" },
- { path: "/supply/good/order/query", name: "新增采购单" },
- ],
- showTwo: true,
- showOne: false,
- recordInfo: {
- tableList: [],
- },
- keywords: "",
- total: 0,
- multipleSelection: [],
- signAndWeighBoxPatients: "sign-and-weigh-box-patients",
- start_time: "",
- end_time: "",
- page: 1,
- limit: 10,
- goodType: [],
- goodInfo: [],
- org_id: 0,
- types: [],
- tyep_name: "",
- form: {
- manufacturer_id: "",
- },
- tabList: [],
- manufactuerList: [],
- currentIndex: 0,
- goodTypeList: [],
- drugTypeList: [],
- supplier_name: "",
- supplyList: [],
- total_price: 0,
- rate_of_concession: "",
- discount_amount: "",
- start_time: "",
- end_time: "",
- tableRules: {
- name: [{ required: true, message: "商品不能为空", trigger: "blur" }],
- supply_count: [
- { required: true, message: "数量不能为空", trigger: "blur" },
- ],
- supply_batch_number: [
- { required: true, message: "批号不能为空", trigger: "blur" },
- ],
- supply_product_date: [
- { required: true, message: "生产日期不能为空", trigger: "blur" },
- ],
- supply_expiry_date: [
- { required: true, message: "有效日期不能为空", trigger: "blur" },
- ],
- },
- warehousing_id: 0,
- number: "",
- loading: false,
- drugList: [],
- goodList: [],
- id: 0,
- disabled: false,
- is_check: 0,
- dialogVisible: false,
- arrearage: "",
- payment: "",
- good_number: "",
- orderInfo: [],
- showOne: true,
- showTwo: false,
- warese_out_id: 0,
- return_remark: "",
- is_warehouse:0,
- tableDataList:[]
- };
- },
- watch: {
- total_price: function (newval, oldval) {
- if(this.rate_of_concession != ""){
- this.addressChange()
- this.count_payment()
- }
- }
- },
-
- methods: {
- getInitOrder() {
- getInitOrder().then((response) => {
- if (response.data.state == 1) {
- var drugList = response.data.data.drugList;
- this.manufactuerList = response.data.data.manufactuerList;
- this.goodTypeList = response.data.data.goodTypeList;
- this.drugTypeList = response.data.data.drugTypeList;
- this.supplyList = response.data.data.supplyList;
- for (let i = 0; i < drugList.length; i++) {
- for (let z = 0; z < drugList[i].drug_warehouse_info.length; z++) {
- if (drugList[i].max_unit == drugList[i].drug_warehouse_info[z].max_unit) {
- drugList[i].drug_warehouse_info[z].stock_max_number = drugList[i].drug_warehouse_info[z].stock_max_number *drugList[i].min_number;
- }
- }
- for (let j = 0; j < this.manufactuerList.length; j++) {
- if (drugList[i].manufacturer == this.manufactuerList[j].id) {
- drugList[i].manufacturer =
- this.manufactuerList[j].manufacturer_name;
- }
- }
- for (let y = 0; y < this.drugTypeList.length; y++) {
- if (drugList[i].drug_type == this.drugTypeList[y].value) {
- drugList[i].drug_type = this.drugTypeList[y].name;
- }
- }
- drugList[i].supply_name =
- drugList[i].drug_name +
- " " +
- drugList[i].dose +
- drugList[i].dose_unit +
- "*" +
- drugList[i].min_number +
- drugList[i].min_unit +
- "/" +
- drugList[i].max_unit +
- " " +
- drugList[i].manufacturer;
- drugList[i].supply_type = drugList[i].drug_type;
- drugList[i].supply_specification_name =
- drugList[i].dose +
- drugList[i].dose_unit +
- "*" +
- drugList[i].min_number +
- drugList[i].min_unit +
- "/" +
- drugList[i].max_unit;
- drugList[i].supply_total = this.getWarehoseInfo(
- drugList[i].drug_warehouse_info,
- drugList[i].max_unit,
- drugList[i].min_unit,
- drugList[i].min_number
- );
- drugList[i].supply_count = "";
- drugList[i].supply_total_price = "";
- drugList[i].supply_manufacturer = drugList[i].manufacturer;
- drugList[i].supply_license_number = drugList[i].number;
- drugList[i].supply_remake = "";
- drugList[i].type = 1;
- drugList[i].supply_price = drugList[i].last_price;
- drugList[i].min_price = drugList[i].min_price
- drugList[i].name = drugList[i].drug_name;
- if (drugList[i].max_unit != drugList[i].min_unit) {
- drugList[i].unitList = [
- { id: 1, name: "" },
- { id: 2, name: "" },
- ];
- }
- if (drugList[i].max_unit == drugList[i].min_unit) {
- drugList[i].unitList = [{ id: 1, name: "" }];
- }
-
- drugList[i].supply_unit = drugList[i].max_unit;
- for (let j = 0; j < drugList[i].unitList.length; j++) {
- if (drugList[i].max_unit != drugList[i].min_unit) {
- drugList[i].unitList[0].name = drugList[i].max_unit;
- drugList[i].unitList[1].name = drugList[i].min_unit;
- }
- if (drugList[i].max_unit == drugList[i].min_unit) {
- drugList[i].unitList[0].name = drugList[i].max_unit;
- }
- }
- this.tabList.push(drugList[i]);
- }
- this.drugList = drugList;
- var goodList = response.data.data.goodList;
- for (let i = 0; i < goodList.length; i++) {
- for (let j = 0; j < this.manufactuerList.length; j++) {
- if (goodList[i].manufacturer == this.manufactuerList[j].id) {
- goodList[i].manufacturer =
- this.manufactuerList[j].manufacturer_name;
- }
- }
- for (let y = 0; y < this.goodTypeList.length; y++) {
- if (goodList[i].good_type_id == this.goodTypeList[y].id) {
- goodList[i].good_type_id = this.goodTypeList[y].type_name;
- }
- }
- goodList[i].supply_name =goodList[i].good_name +" " +goodList[i].specification_name + " " +
- goodList[i].manufacturer;
- goodList[i].supply_type = goodList[i].good_type_id;
- goodList[i].supply_specification_name =
- goodList[i].specification_name;
- goodList[i].supply_price = goodList[i].buy_price;
- goodList[i].supply_total = this.getTotalStockCount(
- goodList[i].good_warehouse_info
- );
- goodList[i].supply_count = "";
- goodList[i].supply_total_price = "";
- goodList[i].supply_manufacturer = goodList[i].manufacturer;
- goodList[i].supply_license_number = goodList[i].number;
- goodList[i].supply_remake = "";
- goodList[i].type = 2;
- goodList[i].name = goodList[i].good_name;
- goodList[i].unitList = [{ id: 1, name: "" }];
- goodList[i].supply_unit = goodList[i].packing_unit;
- goodList[i].min_price = goodList[i].retail_price
- for (let j = 0; j < goodList[i].unitList.length; j++) {
- goodList[i].unitList[0].name = goodList[i].packing_unit;
- }
- this.tabList.push(goodList[i]);
- }
- this.goodList = goodList;
- }
- });
- },
- changeGoodName(val) {
- console.log("val2332232323323",val)
- this.currentIndex = val;
- },
- changeName(val) {
- for (let i = 0; i < this.recordInfo.tableList.length; i++) {
- if (this.currentIndex == i) {
- this.recordInfo.tableList[i].project_id = val.id;
- this.recordInfo.tableList[i].type = val.type;
- this.recordInfo.tableList[i].name = val.name;
- this.recordInfo.tableList[i].supply_name = val.supply_name;
- this.recordInfo.tableList[i].supply_type = val.supply_type;
- this.recordInfo.tableList[i].supply_specification_name = val.supply_specification_name;
- this.recordInfo.tableList[i].supply_total = val.supply_total;
- this.recordInfo.tableList[i].min_price = val.min_price
- if (val.supply_count == NaN) {
- this.recordInfo.tableList[i].supply_count = "";
- } else {
- this.recordInfo.tableList[i].supply_count = val.supply_count
- ? val.supply_count
- : "";
- }
-
- this.recordInfo.tableList[i].supply_price = val.supply_price
- ? val.supply_price
- : "";
- this.recordInfo.tableList[i].supply_total_price = (
- val.supply_count * val.supply_price
- ).toFixed(2);
- this.recordInfo.tableList[i].supply_manufacturer =
- val.supply_manufacturer;
- this.recordInfo.tableList[i].supply_license_number =
- val.supply_license_number;
- this.recordInfo.tableList[i].supply_remake = val.supply_remake;
- this.recordInfo.tableList[i].is_total = val.is_total;
- this.recordInfo.tableList[i].supply_unit = val.supply_unit;
- this.recordInfo.tableList[i].unitList = val.unitList;
- }
- }
- },
- handleEdit() {
- const tempObj = {};
- tempObj["id"] = 0;
- tempObj["name"] = "";
- tempObj["supply_name"] = "";
- tempObj["supply_type"] = "";
- tempObj["supply_specification_name"] = "";
- tempObj["supply_total"] = "";
- tempObj["supply_count"] = "";
- tempObj["supply_price"] = "";
- tempObj["supply_total_price"] = "";
- tempObj["supply_manufacturer"] = "";
- tempObj["supply_license_number"] = "";
- tempObj["supply_remake"] = "";
- tempObj["type"] = 0;
- tempObj["is_total"] = 1;
- tempObj["project_id"] = 0;
- tempObj["supply_unit"] = "";
- tempObj["supply_batch_number"] = "";
- tempObj["supply_product_date"] = "";
- tempObj["order_number"] = "";
- tempObj["supply_expiry_date"] = "";
- tempObj["manufacturer_id"] = "";
- tempObj["min_price"] = ""
- tempObj["warehouse_info_id"] = 0
- tempObj["warehousing_id"] = 0
- this.recordInfo.tableList.push(tempObj);
- },
- handleDelete: function (index, row) {
- if (this.recordInfo.tableList.length <= 1) {
- this.$message.error("只有一条记录的时候无法删除");
- return;
- } else {
- this.recordInfo.tableList.splice(index, 1);
- }
- },
- getWarehoseInfo(arr, max_unit, min_unit, min_number) {
- var total = 0;
- var max_str = "";
- var min_str = "";
- if (arr.length > 0) {
- for (let i = 0; i < arr.length; i++) {
- total += parseInt(arr[i].stock_max_number + arr[i].stock_min_number);
- }
- }
- if (total < min_number) {
- min_str = total + min_unit;
- }
- if (total == 0) {
- min_str = "";
- max_str = "";
- }
- if (total >= min_number) {
- if (parseInt(total / min_number) != 0) {
- max_str = parseInt(total / min_number) + max_unit;
- }
- if (total % min_number != 0) {
- min_str = (total % min_number) + min_unit;
- }
- }
-
- return max_str + min_str;
-
- },
- getTotalStockCount(arr) {
- var total_count = 0;
- for (let i = 0; i < arr.length; i++) {
- total_count += arr[i].stock_count;
- }
- if(total_count >0){
- return total_count;
- }else{
- return ""
- }
-
- },
-
- calculate: function (val) {
- if (isNaN(val)) {
- return "";
- }
- if (val == 0) {
- return "";
- }
- return Math.round(parseFloat(val) * 100) / 100;
- },
- getTimes(time) {
- if (time === "") {
- return "";
- }
- return uParseTime(time, "{y}-{m}-{d}");
- },
-
- getAllPrice() {
- var total_price = 0;
- for (let i = 0; i < this.recordInfo.tableList.length; i++) {
- total_price +=
- this.recordInfo.tableList[i].supply_price *
- this.recordInfo.tableList[i].supply_count;
- }
- this.total_price = total_price;
- // this.discount_amount = (this.total_price * this.rate_of_concession * 0.01).toFixed(2);
- return total_price.toFixed(2);
- },
- addressChange() {
- var discount_amount = 0;
- if (this.rate_of_concession > 0) {
- discount_amount = (
- (this.rate_of_concession / 100) *
- this.total_price
- ).toFixed(2);
- }
- this.discount_amount = discount_amount;
- if(this.payment > 0) this.count_payment()
-
- },
- count_discount() {
- this.rate_of_concession = (
- this.discount_amount /
- (this.total_price * 0.01)
- ).toFixed(2);
- if(this.payment > 0) this.count_payment()
- },
- count_payment() {
- let arrearage_1 = (this.total_price - this.discount_amount - this.payment).toFixed(2);
- if(arrearage_1 > 0){
- this.arrearage = arrearage_1
- }else{
- this.arrearage = 0
- }
- },
-
- count_arrearage() {
- this.payment = this.total_price - this.arrearage;
- },
- // checkPurchaseOrder() {
- // this.$confirm("是否审核?", {
- // confirmButtonText: "确 定",
- // cancelButtonText: "取 消",
- // type: "warning",
- // }).then(() => {
- // checkPurchaseOrder(this.id).then((response) => {
- // if (response.data.state == 1) {
- // var info = response.data.data.info;
- // this.disabled = true;
- // this.$message.success("审核成功!");
- // this.getPurchaseOrderDetail();
- // }
- // });
- // })
- // .catch(() => {});
- // },
- getPurchaseOrderDetail() {
- var id = this.$route.query.id;
- var ids = this.$route.query.ids;
- getPurchaseOrderInfo(id, ids).then((response) => {
- if (response.data.state == 1) {
- var info = response.data.data.info;
- console.log("采购订单ID")
- this.id = info.id;
- this.supplier_name = info.supplier_id;
- this.rate_of_concession = info.rate_of_concession;
- this.discount_amount = info.discount_amount;
- this.number = info.number;
- var orderInfo = response.data.data.orderInfo;
-
- for (let i = 0; i < orderInfo.length; i++) {
- orderInfo[i].supply_batch_number = "";
- orderInfo[i].supply_product_date = "";
- orderInfo[i].supply_expiry_date = "";
- }
- var drugList = response.data.data.baseList;
- var goodList = response.data.data.goodList;
- for (let i = 0; i < orderInfo.length; i++) {
- orderInfo[i].supply_count = orderInfo[i].count;
- orderInfo[i].supply_price = orderInfo[i].price;
- orderInfo[i].supply_remake = orderInfo[i].remark;
- orderInfo[i].type = orderInfo[i].is_source;
- orderInfo[i].project_id = orderInfo[i].project_id;
- orderInfo[i].supply_unit = orderInfo[i].supply_unit;
- orderInfo[i].order_number = orderInfo[i].order_number;
- orderInfo[i].min_price = ""
- orderInfo[i].supply_total_price = (orderInfo[i].count * orderInfo[i].price).toFixed(2);
- if (orderInfo[i].is_source == 1) {
- for (let j = 0; j < drugList.length; j++) {
- if (orderInfo[i].project_id == drugList[j].id) {
- if (drugList[j].max_unit != drugList[j].min_unit) {
- orderInfo[i].unitList = [
- { id: 1, name: "" },
- { id: 2, name: "" },
- ];
- orderInfo[i].unitList[0].name = drugList[j].max_unit;
- orderInfo[i].unitList[1].name = drugList[j].min_unit;
- }
- if (drugList[j].max_unit == drugList[j].min_unit) {
- orderInfo[i].unitList = [{ id: 1, name: "" }];
- orderInfo[i].unitList[0].name = drugList[j].max_unit;
- }
- }
- }
- }
- if (orderInfo[i].is_source == 2) {
- for (let j = 0; j < goodList.length; j++) {
- if (orderInfo[i].project_id == goodList[j].id) {
- orderInfo[i].unitList = [{ id: 1, name: "" }];
- orderInfo[i].unitList[0].name = goodList[j].packing_unit;
- }
- }
- }
- }
-
- this.recordInfo.tableList = [];
- this.recordInfo.tableList = orderInfo;
- //用来判断是否删除了从采购订单的数据
- this.tableDataList = []
- this.tableDataList = orderInfo
- console.log("changed23323232233232",this.tableDataList)
-
- }
- });
- },
- toPrint() {
- this.$router.push({ path: "/good/order/print?&id=" + this.id });
- },
- saveGoodOrder() {
- if (this.supplier_name == 0 || this.supplier_name == "") {
- this.$message.error("供应商不能为空!");
- this.loading = false;
- return false;
- }
-
- for (let i = 0; i < this.recordInfo.tableList.length; i++) {
- this.recordInfo.tableList[i].supply_count = parseInt(this.recordInfo.tableList[i].supply_count);
- this.recordInfo.tableList[i].supply_price =
- this.recordInfo.tableList[i].supply_price.toString();
- this.recordInfo.tableList[i].supply_total_price =
- this.recordInfo.tableList[i].supply_total_price.toString();
- this.recordInfo.tableList[i].supply_total =
- this.recordInfo.tableList[i].supply_total.toString();
- this.recordInfo.tableList[i].min_price = this.recordInfo.tableList[i].min_price.toString()
-
- for (let j = 0; j < this.manufactuerList.length; j++) {
- if (
- this.recordInfo.tableList[i].supply_manufacturer ==
- this.manufactuerList[j].manufacturer_name
- ) {
- this.recordInfo.tableList[i].manufacturer_id =
- this.manufactuerList[j].id;
- }
- if (
- this.recordInfo.tableList[i].supply_manufacturer ==
- this.manufactuerList[j].id
- ) {
- this.recordInfo.tableList[i].supply_manufacturer =
- this.manufactuerList[j].manufacturer_name;
- }
- }
- }
- var start = this.start_time;
- this.$refs["tableForm"].validate((valid) => {
- if (valid) {
- this.loading = true;
- var warehousing_id = this.$route.query.id;
- //判断是否在采购订单数据中做了删除,如果长度相等则代表没有删除,如果不等则代表做了删除或者新增
- console.log("原数据",this.tableDataList)
- console.log("新数据",this.recordInfo.tableList)
- if(this.tableDataList.length > this.recordInfo.tableList.length){
- warehousing_id = 0
- for(let i=0;i<this.recordInfo.tableList.length;i++){
- this.recordInfo.tableList[i].id = 0
- this.number = ""
- }
- }
-
- var params = {
- stockIn: this.recordInfo.tableList,
- return_remake: this.return_remark,
- };
- // return
- addGoodOrder( params,this.supplier_name,start,this.arrearage,this.payment, warehousing_id,this.number,this.rate_of_concession,this.discount_amount).then((response) => {
- if (response.data.state == 1) {
- this.loading = false;
- this.$message.success("保存成功!");
- this.showOne = false;
- this.showTwo = true;
- var orderInfo = response.data.data.list;
- var warehouseOut = response.data.data.warehouseOut;
- this.is_check = 2
- this.warese_out_id = warehouseOut.id;
- console.log("采购单id2322332",this.warese_out_id)
- this.good_number = warehouseOut.good_number;
- this.rate_of_concession = warehouseOut.rate_of_concession;
- this.discount_amount = warehouseOut.discount_amount;
- this.payment = warehouseOut.payment;
- this.arrearage = warehouseOut.arrearage;
- this.supplier_name = warehouseOut.supplier_id;
- this.return_remake = warehouseOut.return_remake;
- this.warehousing_id = warehouseOut.warehousing_id
- this.id = warehouseOut.id
- this.start_time = this.getTimes(warehouseOut.document_date);
- for (let i = 0; i < orderInfo.length; i++) {
- orderInfo[i].supply_count = orderInfo[i].count;
- orderInfo[i].supply_price = orderInfo[i].price;
- orderInfo[i].supply_remake = orderInfo[i].remark;
- orderInfo[i].type = orderInfo[i].is_source;
- orderInfo[i].project_id = orderInfo[i].project_id;
- orderInfo[i].supply_unit = orderInfo[i].supply_unit;
- orderInfo[i].order_number = orderInfo[i].order_number;
- orderInfo[i].warehouse_info_id = orderInfo[i].warehouse_info_id
- orderInfo[i].warehousing_id = orderInfo[i].warehousing_id
- orderInfo[i].supply_total_price = (
- orderInfo[i].count * orderInfo[i].price
- ).toFixed(2);
- orderInfo[i].supply_expiry_date = this.getTimes(
- orderInfo[i].supply_expiry_date
- );
- orderInfo[i].supply_product_date = this.getTimes(
- orderInfo[i].supply_product_date
- );
- if (orderInfo[i].is_source == 1) {
- for (let j = 0; j < this.drugList.length; j++) {
- if (orderInfo[i].project_id == this.drugList[j].id) {
- if (this.drugList[j].max_unit != this.drugList[j].min_unit) {
- orderInfo[i].unitList = [{ id: 1, name: "" },{ id: 2, name: "" }];
- orderInfo[i].unitList[0].name = this.drugList[j].max_unit;
- orderInfo[i].unitList[1].name = this.drugList[j].min_unit;
- }
- if (this.drugList[j].max_unit == this.drugList[j].min_unit) {
- orderInfo[i].unitList[0].name = this.drugList[j].max_unit;
- }
- }
- }
- }
- if (orderInfo[i].is_source == 2) {
- for (let j = 0; j < this.goodList.length; j++) {
- if (orderInfo[i].project_id == this.goodList[j].id) {
- orderInfo[i].unitList = [{ id: 1, name: "" }];
- orderInfo[i].unitList[0].name = this.goodList[j].packing_unit;
- }
- }
- }
- }
- this.recordInfo.tableList = [];
- this.recordInfo.tableList = orderInfo;
- }
- });
- }
- });
- },
- updateGoodOrder() {
- if (this.supplier_name == 0 || this.supplier_name == "") {
- this.$message.error("供应商不能为空!");
- this.loading = false;
- return false;
- }
- for (let i = 0; i < this.recordInfo.tableList.length; i++) {
- this.recordInfo.tableList[i].supply_count = parseInt(
- this.recordInfo.tableList[i].supply_count
- );
- this.recordInfo.tableList[i].supply_price =
- this.recordInfo.tableList[i].supply_price.toString();
- this.recordInfo.tableList[i].supply_total_price =
- this.recordInfo.tableList[i].supply_total_price.toString();
- this.recordInfo.tableList[i].supply_total =
- this.recordInfo.tableList[i].supply_total.toString();
- this.recordInfo.tableList[i].min_price = this.recordInfo.tableList[i].min_price.toString()
- for (let j = 0; j < this.manufactuerList.length; j++) {
- if (
- this.recordInfo.tableList[i].supply_manufacturer ==
- this.manufactuerList[j].manufacturer_name
- ) {
- this.recordInfo.tableList[i].manufacturer_id =
- this.manufactuerList[j].id;
- }
- if (
- this.recordInfo.tableList[i].supply_manufacturer ==
- this.manufactuerList[j].id
- ) {
- this.recordInfo.tableList[i].supply_manufacturer =
- this.manufactuerList[j].manufacturer_name;
- }
- }
- }
- var start = this.start_time;
- this.$refs["tableForm"].validate((valid) => {
- if (valid) {
- this.loading = true;
- var warehose_out_id = this.$route.query.id;
- var params = {
- stockIn: this.recordInfo.tableList,
- return_remake: this.return_remake,
- };
- console.log("param232332",params)
- updateGoodOrder(
- params,
- this.supplier_name,
- start,
- this.arrearage,
- this.payment,
- warehose_out_id,
- this.number,
- this.rate_of_concession,
- this.discount_amount,
- this.good_number
- ).then((response) => {
- if (response.data.state == 1) {
- this.loading = false;
- this.$message.success("保存成功!");
- }
- });
- }
- });
- },
- checkGoodOrder() {
- var id = this.warese_out_id;
- var warehousing_id = this.id;
- console.log("采购单ID",id)
- console.log("采购订单ID",warehousing_id)
- this.loading = true
- getGoodOrderCountList(id, warehousing_id).then((response) => {
- if (response.data.state == 1) {
- this.$message.success("审核成功!");
- this.Reviewed = true;
- this.disabled = true
- this.is_check = 1
- this.showOne = false;
- this.showTwo = true;
- this.showThree = true;
- this.loading = false
- var purcaseOrder = response.data.data.purcaseOrder;
- var goodOrder = response.data.data.goodOrder;
- var drugList = response.data.data.drugList;
-
- var is_warehouse = 0;
- for (let i = 0; i < purcaseOrder.length; i++) {
- for (let j = 0; j < drugList.length; j++) {
- if (purcaseOrder[i].is_source == 1) {
- if (purcaseOrder[i].supply_unit == drugList[j].max_unit) {
- purcaseOrder[i].count =
- purcaseOrder[i].count * drugList[j].min_number;
- }
- }
- }
- }
-
- for (let i = 0; i < goodOrder.length; i++) {
- for (let j = 0; j < drugList.length; j++) {
- if (goodOrder[i].is_source == 1) {
- if (goodOrder[i].supply_unit == drugList[j].max_unit) {
- goodOrder[i].count =
- goodOrder[i].count * drugList[j].min_number;
- }
- }
- }
- }
-
- let objInfo = {};
- if (goodOrder.length > 0) {
- goodOrder.forEach((item, index) => {
- let { project_id } = item;
- if (!objInfo[project_id]) {
- objInfo[project_id] = {
- project_id,
- child: [],
- count: 0,
- };
- }
- });
- let newArr = Object.values(objInfo);
-
- for (let i = 0; i < goodOrder.length; i++) {
- for (let j = 0; j < newArr.length; j++) {
- if (goodOrder[i].project_id == newArr[j].project_id) {
- newArr[j].child.push(goodOrder[i]);
- }
- }
- }
- console.log("newAr2332232323", newArr);
-
- for (let i = 0; i < newArr.length; i++) {
- for (let j = 0; j < newArr[i].child.length; j++) {
- newArr[i].count += newArr[i].child[j].count;
- }
- }
-
- var arr = [];
- var total = 0;
- var str = "";
-
- //如果采购单有数据,则需要比较数量
- if (newArr.length > 0) {
- for (let i = 0; i < purcaseOrder.length; i++) {
- for (let j = 0; j < newArr.length; j++) {
- if (purcaseOrder[i].project_id == newArr[j].project_id) {
- //根据商品ID比较数量大小,把数量不足的商品ID储存,表示采购单的数量未满足采购订单的数据,部分入库
- if (purcaseOrder[i].count > newArr[j].count) {
- arr.push(purcaseOrder[i].project_id);
- }
- }
- }
- }
- //如果total的长度等于 采购单的长度,怎表示该采购订单已经全部生成,全部入库
- console.log("审核长度2332322323323332",arr)
- if (arr.length == 0) {
- this.is_warehouse = 1;
- this.ModefySupplyWarehousing(this.is_warehouse, warehousing_id);
- }
-
- //部分入库
- if (arr.length > 0) {
- //修改订购单
- this.is_warehouse = 3;
- this.ModefySupplyWarehousing(this.is_warehouse, warehousing_id);
- }
- }
- }
- }
- });
- },
- ModefySupplyWarehousing(is_warehouse, warehousing_id) {
- var params = {
- is_warehouse: this.is_warehouse,
- warehousing_id: this.warehousing_id,
- };
- ModefySupplyWarehousing(params).then((response) => {
- if (response.data.state == 1) {
- var msg = response.data.data.msg;
- }
- });
- },
- MofyGoodOrder() {
- var id = this.warese_out_id;
- console.log("采购单ID",id)
- var warehousing_id = this.id
- console.log("采购订单ID",warehousing_id)
- var params = {
- id: id,
- warehousing_id:warehousing_id,
- };
- MofyGoodOrder(params).then((response) => {
- if (response.data.state == 1) {
- var msg = response.data.data.msg;
- if (msg == 1) {
- this.$message.success("反审核成功!");
- this.is_check = 2
- this.disabled = false
- this.Reviewed = false
-
- }
- if (msg == 2) {
- var cancelList = response.data.data.cancelList
- console.log("cancelLIST2332322332232323",cancelList)
- this.orderList = cancelList
- this.$refs.Popup.dialogVisible = true
- return
- }
-
- var purcaseOrder = response.data.data.purcaseOrder;
- console.log("采购订单", purcaseOrder);
- var goodOrder = response.data.data.goodOrder;
- console.log("采购单", goodOrder);
- var drugList = response.data.data.drugList;
- console.log("druglist23323223", drugList);
- var ids = "";
- // 如果采购单没有数据,则代表改订单第一次生成采购订单数据,未入库
- if (goodOrder.length == 0) {
- var is_warehouse = 2;
- this.ModefySupplyWarehousing(is_warehouse, this.id);
- return
- }
- for (let i = 0; i < purcaseOrder.length; i++) {
- for (let j = 0; j < drugList.length; j++) {
- if (purcaseOrder[i].is_source == 1) {
- if (purcaseOrder[i].supply_unit == drugList[j].max_unit) {
- purcaseOrder[i].count = purcaseOrder[i].count * drugList[j].min_number;
- }
- }
- }
- }
-
- for (let i = 0; i < goodOrder.length; i++) {
- for (let j = 0; j < drugList.length; j++) {
- if (goodOrder[i].is_source == 1) {
- if (goodOrder[i].supply_unit == drugList[j].max_unit) {
- goodOrder[i].count = goodOrder[i].count * drugList[j].min_number;
- }
- }
- }
- }
-
- let objInfo = {};
- if (goodOrder.length > 0) {
- goodOrder.forEach((item, index) => {
- let { project_id } = item;
- if (!objInfo[project_id]) {
- objInfo[project_id] = {
- project_id,
- child: [],
- count: 0,
- };
- }
- });
- let newArr = Object.values(objInfo);
-
- for (let i = 0; i < goodOrder.length; i++) {
- for (let j = 0; j < newArr.length; j++) {
- if (goodOrder[i].project_id == newArr[j].project_id) {
- newArr[j].child.push(goodOrder[i]);
- }
- }
- }
- console.log("newAr2332232323", newArr);
-
- for (let i = 0; i < newArr.length; i++) {
- for (let j = 0; j < newArr[i].child.length; j++) {
- newArr[i].count += newArr[i].child[j].count;
- }
- }
-
- var arr = [];
- var total = 0;
- var str = "";
-
- //如果采购单有数据,则需要比较数量
- if (newArr.length > 0) {
- for (let i = 0; i < purcaseOrder.length; i++) {
- for (let j = 0; j < newArr.length; j++) {
- if (purcaseOrder[i].project_id == newArr[j].project_id) {
- //根据商品ID比较数量大小,如果采购单的数量大于采购订单的数据
- if (purcaseOrder[i].count < newArr[j].count) {
- arr.push(purcaseOrder[i].project_id);
- }
- }
- }
- }
-
- console.log("arr233232233232",arr)
- if (arr.length == 0) {
- //未入库
- var is_warehouse = 2;
- this.ModefySupplyWarehousing(is_warehouse, this.id);
-
- }
- if (arr.length > 0) {
- //部分入库
- var is_warehouse = 3;
- this.ModefySupplyWarehousing(is_warehouse, this.id);
- }
- }
- }
- }
- });
- },
- UpdateSupplyWahouseingInfo() {
- var params = {
- warehousing_id: this.warehousing_id,
- };
- console.log("采购单ID",params)
- UpdateSupplyWahouseingInfo(params).then((response) => {
- if (response.data.state == 1) {
- var msg = response.data.data.msg;
- }
- });
- },
- toClick() {
- //先判断采购单号有没有关联的采购退货单号,如果没有,则为首次生成采购退货单
- if (this.is_check == 2) {
- this.$message.error("该采购单未审核,不能生成退货单数据!");
- return false;
- }
- var id = this.warese_out_id;
- console.log("生成采购单ID22323",id)
- getSupplyWarehouseOutById(id).then((response) => {
- if (response.data.state == 1) {
- var cancelList = response.data.data.cancelList;
- console.log("退库单", cancelList);
- var drugList = response.data.data.drugList;
- console.log("药品列表", drugList);
- var cancelOrderList = response.data.data.cancelOrderList;
- console.log("退库单详情", cancelOrderList);
- var ids =""
- if(cancelList.length == 0){
- this.$router.push({ path: "/good/return/add?id=" +id+"&ids="+ids });
- }
- if (cancelList.length > 0) {
- var outList = response.data.data.outList;
- console.log("购货单2322323",outList)
- for(let i=0;i<outList.length;i++){
- if(outList[i].is_source == 1){
- for(let j=0;j<drugList.length;j++){
- if(outList[i].project_id == drugList[j].id){
- if(outList[i].supply_unit == drugList[j].max_unit){
- outList[i].count = outList[i].count * drugList[j].min_number
- }
-
- }
- }
- }
- }
-
- for(let i=0;i<cancelOrderList.length;i++){
- if(cancelOrderList[i].is_source == 1){
- for(let j=0;j<drugList.length;j++){
- if(cancelOrderList[i].project_id == drugList[j].id){
- if(cancelOrderList[i].supply_unit == drugList[j].max_unit){
- cancelOrderList[i].count = cancelOrderList[i].count * drugList[j].min_number
- }
- }
- }
- }
- }
-
-
-
- let objInfo = {};
- if(cancelOrderList.length >0){
- cancelOrderList.forEach((item, index) => {
- let { project_id } = item;
- if (!objInfo[project_id]) {
- objInfo[project_id] = {
- project_id,
- child: [],
- count: 0,
- };
- }
- });
- let newArr = Object.values(objInfo)
-
- for (let i = 0; i < cancelOrderList.length; i++) {
- for (let j = 0; j < newArr.length; j++) {
- if (cancelOrderList[i].project_id == newArr[j].project_id) {
- newArr[j].child.push(cancelOrderList[i])
- }
- }
-
- }
-
- for (let i = 0; i < newArr.length; i++) {
- for (let j = 0; j < newArr[i].child.length; j++) {
- newArr[i].count += newArr[i].child[j].count;
- }
- }
-
- var arr = []
- var total = 0;
- var str = "";
- //如果采购单有数据,则需要比较数量
- if (newArr.length > 0) {
- for (let i = 0; i < outList.length; i++) {
- for (let j = 0; j < newArr.length; j++) {
- if (outList[i].project_id == newArr[j].project_id) {
- //根据商品ID比较数量大小,把数量不足的商品ID储存,表示退货单的数量未满足采购单的数据,可以继续生成退货单
- if (outList[i].count > newArr[j].count) {
- arr.push(outList[i].project_id);
- }
- }
- }
- }
- //如果total的长度等于 采购单的长度,怎表示该采购订单已经全部生成
-
- if (arr.length == 0) {
- this.$message.error("该订单已全部生成退库单,请知悉!");
- return
- }
- console.log("arr23323232232323",arr)
- if (arr.length > 0) {
- str = arr.join(",");
- this.$router.push({ path: "/good/return/edit?id=" + id + "&ids=" + str});
- }
- }
-
- }
- }
- }
- });
- },
- },
- created() {
- const tempObj = {};
- tempObj["id"] = 0;
- tempObj["name"] = "";
- tempObj["supply_name"] = "";
- tempObj["supply_type"] = "";
- tempObj["supply_specification_name"] = "";
- tempObj["supply_total"] = "";
- tempObj["supply_count"] = "";
- tempObj["supply_price"] = "";
- tempObj["supply_total_price"] = "";
- tempObj["supply_manufacturer"] = "";
- tempObj["supply_license_number"] = "";
- tempObj["supply_remake"] = "";
- tempObj["type"] = 0;
- tempObj["is_total"] = 1;
- tempObj["project_id"] = 0;
- tempObj["supply_unit"] = "";
- tempObj["supply_batch_number"] = "";
- tempObj["supply_product_date"] = "";
- tempObj["order_number"] = "";
- tempObj["supply_expiry_date"] = "";
- tempObj["manufacturer_id"] = "";
- tempObj["min_price"] = ""
- tempObj["warehouse_info_id"] = 0
- tempObj["warehousing_id"] = 0
- this.recordInfo.tableList.push(tempObj);
- this.getInitOrder();
- if (parseInt(this.$route.query.id) > 0) {
- this.getPurchaseOrderDetail();
- }
- this.start_time = this.getTimes(new Date());
- this.end_time = this.getTimes(new Date());
- },
- };
- </script>
-
- <style rel="stylesheet/css" lang="scss" scoped>
- .reviewImg {
- position: fixed;
- left: 50%;
- transform: translateX(-50%);
- top: 30%;
- }
-
- /deep/ .el-table--scrollable-x .el-table__body-wrapper {
- overflow: auto;
- }
- /deep/ .gutter {
- width: 15px !important;
- display: inline-block !important;
- }
- /deep/ .el-table__fixed-right-patch {
- width: 15px !important;
- }
-
- /deep/ .el-table__fixed-right {
- bottom: 0 !important;
- left: auto;
- right: 0;
- }
- /deep/ .el-table__body-wrapper::-webkit-scrollbar {
- width: 15px !important;
- height: 15px !important;
- }
- .information {
- border: 1px #dcdfe6 solid;
- padding: 30px 20px 30px 20px;
-
- .border {
- border-bottom: 1px #dcdfe6 solid;
- margin: 0px 0 20px 0;
- }
- }
-
- .title {
- background: #409eff;
- height: 44px;
- line-height: 44px;
- padding: 0 0 0 10px;
- color: #fff;
- margin: 0 0 10px 0;
- }
-
- .edit_separater {
- border-top: 1px solid rgb(233, 233, 233);
- margin-top: 15px;
- margin-bottom: 15px;
- }
- </style>
-
- <style>
- .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
- font-size: 12px;
- }
-
- .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
- background: #6fb5fa;
- }
-
- .count {
- color: #bd2c00;
- }
- .el-table td,
- .el-table th.is-leaf,
- .el-table--border,
- .el-table--group {
- border-color: #d0d3da;
- }
- .el-table--border::after,
- .el-table--group::after,
- .el-table::before {
- background-color: #d0d3da;
- }
- /* .el-table__fixed-right {
- width: 150px;
- bottom: 20px;
- height: 100%;
- } */
-
- </style>
|