1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342 |
- <template>
- <div class="detail-container">
- <el-page-header
- @back="goBack"
- :content="listItem ? '编辑' : '新增'"
- ></el-page-header>
- <div class="main-title">
- <div class="title">订单信息</div>
- </div>
- <el-form
- ref="mainForm"
- :model="mainForm"
- :rules="mainFormRules"
- label-width="120px"
- size="small"
- label-position="right"
- >
- <el-row :gutter="20">
- <!-- <el-col :xs="24" :sm="12" :lg="8">
- <el-form-item label="订单号" prop="id">
- <el-input
- v-model="mainForm.id"
- placeholder="订单号"
- readonly
- ></el-input>
- </el-form-item>
- </el-col> -->
- <el-col
- :xs="24"
- :sm="12"
- :lg="8"
- v-if="!listItem"
- @click.native="handleShow"
- >
- <el-form-item label="销售政策编号" prop="policyCode">
- <el-input
- v-model="mainForm.policyCode"
- placeholder="销售政策编号"
- readonly
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="12" :lg="8" v-else>
- <el-form-item label="销售政策编号" prop="policyCode">
- <el-input
- v-model="mainForm.policyCode"
- placeholder="销售政策编号"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="12" :lg="8" style="height: 51px">
- <el-form-item label="单据日期" prop="date">
- <el-date-picker
- v-model="mainForm.date"
- type="date"
- value-format="yyyy-MM-dd"
- style="width: 100%"
- placeholder="选择日期"
- >
- </el-date-picker>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="12" :lg="8">
- <el-form-item label="产品大类" prop="type">
- <el-select
- v-model="mainForm.type"
- placeholder="选择产品大类"
- style="width: 100%"
- >
- <el-option
- v-for="item in typeList"
- :key="item.dictCode"
- :label="item.dictValue"
- :value="item.dictCode"
- ></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="16" :lg="16">
- <el-form-item label="备注" prop="remark">
- <el-input
- v-model="mainForm.remark"
- placeholder="请输入备注"
- ></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <!--
- <el-col :xs="24" :sm="12" :lg="8">
- <el-form-item label="销售政策" prop="id">
- <el-select
- v-model="mainForm.ztype"
- placeholder="选择销售政策"
- style="width: 100%"
- >
- <el-option
- v-for="item in ztypeList"
- :key="item.id"
- :label="item.saleName"
- :value="item.id"
- ></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="12" :lg="8">
- <el-form-item label="销售政策说明" prop="policyRemark">
- <el-input
- v-model="mainForm.policyRemark"
- placeholder="销售政策说明"
- ></el-input>
- </el-form-item>
- </el-col> -->
- </el-row>
- <!--
- <el-row :gutter="20">
- <el-col :xs="24" :sm="12" :lg="8">
- <el-form-item label="业务员" prop="serviceName">
- <el-input
- v-model="mainForm.serviceName"
- placeholder="订单号"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="16" :lg="16">
- <el-form-item label="备注" prop="remark">
- <el-input
- v-model="mainForm.remark"
- placeholder="请输入备注"
- ></el-input>
- </el-form-item>
- </el-col>
- </el-row> -->
- </el-form>
- <div class="main-title">
- <div class="title">货品信息</div>
- <div v-if="!listItem">
- <el-select
- v-model="warehouseValue"
- placeholder="请选择发货仓库"
- size="small"
- style="margin-right: 10px"
- >
- <el-option
- :label="item.name"
- :value="item.id"
- v-for="(item, index) in warehouseList"
- :key="index"
- ></el-option>
- </el-select>
- <el-button
- type="primary"
- size="small"
- icon="el-icon-search"
- @click="checkStock"
- >检查库存</el-button
- >
- <el-divider direction="vertical"></el-divider>
- </div>
- </div>
- <div class="table" style="margin-top: 20px">
- <el-table
- :data="goodsList"
- element-loading-text="Loading"
- border
- fit
- highlight-current-row
- stripe
- max-height="400"
- >
- <el-table-column
- align="center"
- label="序号"
- type="index"
- width="50"
- ></el-table-column>
- <el-table-column
- align="center"
- label="销售类型"
- prop="saleTypeName"
- min-width="100"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- align="center"
- label="存货编码"
- prop="materialCode"
- min-width="100"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- align="center"
- label="产品名称"
- prop="materialName"
- min-width="160"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- align="center"
- label="规格型号"
- prop="specification"
- min-width="160"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- align="center"
- label="单位"
- prop="unit"
- min-width="100"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- align="center"
- label="单价"
- prop="price"
- min-width="100"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- align="center"
- label="数量"
- prop="qty"
- min-width="100"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- <el-input v-model="scope.row.qty" size="small"></el-input>
- </template>
- </el-table-column>
- <el-table-column
- align="center"
- label="订单金额"
- min-width="100"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- {{ scope.row.price * scope.row.qty }}
- </template>
- </el-table-column>
- <el-table-column
- align="center"
- label="返利钱包"
- prop="customerWalletId2"
- min-width="160"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- <el-select
- v-model="scope.row.customerWalletId2"
- placeholder="选择返利钱包"
- size="small"
- @change="changeWallet(scope.$index)"
- >
- <el-option label="不使用" value=""></el-option>
- <el-option
- v-for="item in flWalletList"
- :key="item.customerWalletId"
- :label="item.name"
- :value="item.customerWalletId"
- >
- </el-option>
- </el-select>
- </template>
- </el-table-column>
- <el-table-column
- align="center"
- label="返利金额"
- min-width="100"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- {{
- (scope.row.price * scope.row.qty * (scope.row.rebateRate * 100)) /
- 100 || 0
- }}
- </template>
- </el-table-column>
- <el-table-column
- align="center"
- label="格力折扣"
- min-width="100"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- {{ scope.row.qty * scope.row.discAmount }}
- </template>
- </el-table-column>
- <el-table-column
- align="center"
- label="现金钱包"
- prop="customerWalletId"
- min-width="160"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- <el-select
- v-model="scope.row.customerWalletId"
- placeholder="选择现金钱包"
- size="small"
- >
- <el-option label="不使用" value=""></el-option>
- <el-option
- v-for="item in comxjWalletList(scope.row.walletRelaList)"
- :key="item.customerWalletId"
- :label="item.name"
- :value="item.customerWalletId"
- >
- </el-option>
- </el-select>
- </template>
- </el-table-column>
- <el-table-column
- align="center"
- label="实付金额"
- prop="qty"
- min-width="100"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- {{
- (scope.row.price * scope.row.qty * 100 -
- ((scope.row.price *
- scope.row.qty *
- (scope.row.rebateRate * 100)) /
- 100) *
- 100 -
- ((scope.row.qty * (scope.row.discAmount * 100)) / 100) * 100) /
- 100 || 0
- }}
- </template>
- </el-table-column>
- <el-table-column
- align="center"
- label="是否直调"
- prop="isDirectTransfer"
- min-width="100"
- >
- <template slot-scope="scope">
- <el-checkbox v-model="scope.row.isDirectTransfer"></el-checkbox>
- </template>
- </el-table-column>
- <el-table-column
- align="center"
- label="直调数量"
- prop="directTransferQty"
- min-width="100"
- >
- <template slot-scope="scope">
- <el-input
- v-model="scope.row.directTransferQty"
- size="small"
- ></el-input>
- </template>
- </el-table-column>
- <el-table-column
- align="center"
- label="备注"
- prop="remark"
- min-width="160"
- >
- <template slot-scope="scope">
- <el-input v-model="scope.row.remark" size="small"></el-input>
- </template>
- </el-table-column>
- <el-table-column
- align="center"
- label="税率"
- prop="tax"
- min-width="100"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- align="center"
- label="总仓库"
- prop="status1"
- min-width="100"
- show-overflow-tooltip
- v-if="!listItem"
- >
- <template slot-scope="scope">
- <div>{{ scope.row.status1 | status1Filter }}</div>
- </template>
- </el-table-column>
- <el-table-column
- align="center"
- label="仓库状态"
- prop="status2"
- min-width="100"
- show-overflow-tooltip
- v-if="!listItem"
- >
- <template slot-scope="scope">
- <div>{{ status2Filter(scope.row) }}</div>
- </template>
- </el-table-column>
- <el-table-column align="center" label="操作" width="100" fixed="right">
- <template slot-scope="scope">
- <el-button type="text" @click="deleteItem(scope.$index)"
- >删除</el-button
- >
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div class="page-footer">
- <div class="footer" :class="classObj">
- <el-button type="primary" @click="clickSubmitForm">保 存</el-button>
- <el-popconfirm
- title="确定关闭吗?"
- @onConfirm="goBack"
- style="margin-left: 10px"
- >
- <el-button slot="reference">关 闭</el-button>
- </el-popconfirm>
- </div>
- </div>
- <el-dialog
- :visible.sync="isShowDialog"
- @close="handleClose"
- width="80%"
- title="引用销售政策"
- >
- <template v-if="!cusIndex">
- <el-form
- :model="screenForm"
- ref="screenForm"
- label-width="120px"
- size="small"
- >
- <el-row :gutter="20">
- <el-col :xs="24" :sm="8" :lg="8">
- <el-form-item label="销售政策">
- <el-select
- v-model="screenForm.policyId"
- placeholder="选择销售政策"
- filterable
- style="width: 100%"
- >
- <el-option label="不使用" value=""></el-option>
- <el-option
- v-for="(item,index) in policyList"
- :key="index"
- :label="item.title"
- :value="item.code"
- ></el-option>
- </el-select> </el-form-item
- ></el-col>
- <el-col :xs="24" :sm="8" :lg="8">
- <el-form-item label="销售类型">
- <el-select
- v-model="screenForm.saleTypeCode"
- filterable
- placeholder="选择销售类型"
- style="width: 100%"
- >
- <el-option label="不使用" value=""></el-option>
- <el-option
- v-for="item in ztypeList"
- :key="item.id"
- :label="item.saleName"
- :value="item.saleCode"
- ></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="8" :lg="8" class="tr">
- <el-button
- type="primary"
- size="small"
- @click="handlePolicyTypeList"
- >查询</el-button
- >
- </el-col>
- </el-row>
- </el-form>
- <el-row :gutter="20" style="margin: 10px 0"> 选择限定机型 </el-row>
- <el-table
- v-loading="listLoading"
- :data="dataList"
- element-loading-text="Loading"
- border
- fit
- highlight-current-row
- stripe
- >
- <el-table-column align="center" width="55"
- ><template slot-scope="scope">
- <el-radio
- v-model="radio"
- :label="
- scope.row.id +
- '&' +
- scope.row.policyId +
- '&' +
- scope.row.materialId +
- '&' +
- scope.row.policyConditionId
- "
- >{{ "" }}</el-radio
- >
- </template>
- </el-table-column>
- <template v-for="col in columns">
- <el-table-column
- v-if="col.num"
- align="center"
- :label="col.lable"
- :prop="col.prop"
- :min-width="col.widht"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- <el-input v-model="scope.row.qty" size="small"></el-input>
- </template>
- </el-table-column>
- <el-table-column
- v-else-if="col.jie"
- align="center"
- :label="col.lable"
- :prop="col.prop"
- :min-width="col.widht"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- {{ scope.row.qty * scope.row.price || 0 }}
- </template>
- </el-table-column>
- <el-table-column
- v-else
- align="center"
- :label="col.lable"
- :prop="col.prop"
- :min-width="col.widht"
- show-overflow-tooltip
- >
- </el-table-column>
- </template>
- </el-table>
- <!-- 分页 -->
- <div style="margin: 10px 0;">
- <el-pagination
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :current-page="currentPage"
- :page-sizes="[10]"
- :page-size="10"
- layout="total, sizes, prev, pager, next, jumper"
- :total="dataList.length"
- >
- </el-pagination>
- </div>
- <span slot="footer" class="dialog-footer">
- <el-button type="primary" @click="submitAddGoods">下一步</el-button>
- </span>
- </template>
- <template v-else>
- <el-form
- :model="screenForm"
- ref="screenForm"
- label-width="120px"
- size="small"
- >
- <el-row :gutter="20">
- <el-col :xs="24" :sm="8" :lg="8">
- <el-form-item label="销售政策">
- <el-select
- v-model="screenForm.policyId"
- placeholder="选择销售政策"
- filterable
- style="width: 100%"
- >
- <el-option
- v-for="(item,index) in policyList"
- :key="index"
- :label="item.title"
- :value="item.code"
- ></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="8" :lg="8">
- <el-form-item label="销售类型">
- <el-select
- filterable
- v-model="screenForm.saleTypeCode"
- placeholder="选择销售类型"
- style="width: 100%"
- >
- <el-option label="不使用" value=""></el-option>
- <el-option
- v-for="item in ztypeList"
- :key="item.id"
- :label="item.saleName"
- :value="item.saleCode"
- ></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="8" :lg="8" class="tr">
- <el-button type="primary" size="small">查询</el-button>
- </el-col>
- </el-row>
- </el-form>
- <el-row type="flex" :gutter="20">
- <el-col style="margin: 10px 0">已选择限定机型</el-col>
- <el-col></el-col>
- <el-col></el-col>
- <el-col></el-col>
- <el-col></el-col>
- </el-row>
- <template v-for="(item, index) in popArr">
- <el-table
- v-if="index + 1 == cusIndex"
- v-loading="listLoading"
- :data="popDataArr[cusIndex - 1]"
- element-loading-text="Loading"
- border
- fit
- highlight-current-row
- stripe
- >
- <el-table-column align="center" width="55"
- ><template slot-scope="scope">
- <el-radio
- v-model="radioObj['radio' + cusIndex]"
- :label="scope.row.id"
- >{{ "" }}</el-radio
- >
- </template>
- </el-table-column>
- <template v-for="col in columns">
- <el-table-column
- v-if="col.num"
- align="center"
- :label="col.lable"
- :prop="col.prop"
- :min-width="col.widht"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- <el-input v-model="scope.row.qty" size="small"></el-input>
- </template>
- </el-table-column>
- <el-table-column
- v-else-if="col.jie"
- align="center"
- :label="col.lable"
- :prop="col.prop"
- :min-width="col.widht"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- {{ scope.row.qty * scope.row.price || 0 }}
- </template>
- </el-table-column>
- <el-table-column
- v-else
- align="center"
- :label="col.lable"
- :prop="col.prop"
- :min-width="col.widht"
- show-overflow-tooltip
- >
- </el-table-column>
- </template>
- </el-table>
- <!-- 分页 -->
- <div style="margin: 10px 0;">
- <el-pagination
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :current-page="currentPage"
- :page-sizes="[10]"
- :page-size="10"
- layout="total, sizes, prev, pager, next, jumper"
- :total="popDataArr[cusIndex - 1].length"
- >
- </el-pagination>
- </div>
- </template>
- <span slot="footer" class="dialog-footer">
- <el-button type="primary" @click="cusIndex -= 1">上一步</el-button>
- <el-button
- type="primary"
- @click="handleCondition()"
- v-if="popArr.length != cusIndex"
- >下一步</el-button
- >
- <el-button
- type="primary"
- @click="hanlePopData"
- v-if="popArr.length == cusIndex"
- >完成</el-button
- >
- </span>
- </template>
- </el-dialog>
- </div>
- </template>
- <script>
- import {
- getDetail,
- addData,
- editData,
- getSalesTypeList,
- getGoodsList,
- getWalletList,
- getWarehouseList,
- policyList,
- checkStock,
- typeList,
- getpolicyList,
- getConditionList,
- getConditionDetail,
- getpolicyTypeList,
- } from "@/api/supply/policy";
- import { getDictList } from "@/api/common";
- import { findElem } from "@/utils/util";
- export default {
- name: "RetailForm",
- componentName: "RetailForm",
- props: ["listItem"],
- filters: {
- status1Filter(val) {
- if (val === "" || val === null || val === undefined) return "未检查";
- else if (val === 0) return "无货";
- else if (val > 0 && val <= 30) return val;
- else if (val > 30 && val <= 1000) return "有货";
- else if (val > 1000) return "充足";
- },
- },
- data() {
- return {
- tableData: [
- ],
- currentPage: 1, // 当前页码
- pageSize: 10, // 每页数量
- listTotal: 0, // 列表总数
- cusIndex: 0,
- radio: "",
- pop: "",
- popArr: [],
- mainForm: {
- id: "",
- date: "",
- type: "",
- ztype: "",
- remark: "",
- policyCode: "",
- policyRemark: "",
- policyId: "",
- },
- mainFormRules: {
- date: [
- { required: true, message: "请选择单据日期", trigger: "change" },
- ],
- type: [{ required: true, message: "请选择品类", trigger: "change" }],
- },
- goodsList: [],
- warehouseList: [],
- warehouseValue: "",
- isShowDialog: false,
- screenForm: {
- policyId: "",
- saleTypeCode: "",
- },
- currentPage: 1,
- listTotal: 0,
- salesTypeList: [],
- typeList: [],
- ztypeList: [],
- leftGoodsList: [],
- rightGoodsList: [],
- leftSelection: [],
- rightSelection: [],
- policyList: [],
- xjWalletList: [],
- flWalletList: [],
- dataList: [],
- columns: [
- {
- prop: "saleTypeName",
- lable: "销售类型",
- widht: 160,
- },
- {
- prop: "materialName",
- lable: "货品名称",
- widht: 160,
- },
- {
- prop: "specification",
- lable: "规格型号",
- widht: 160,
- },
- {
- prop: "qty",
- lable: "数量",
- widht: 160,
- num: true,
- },
- {
- prop: "price",
- lable: "单价",
- widht: 160,
- },
- {
- prop: "zong",
- lable: "金额",
- jie: true,
- },
- ],
- listLoading: false,
- popDataArr: [],
- radioObj: {},
- step:0,
- };
- },
- computed: {
- sidebar() {
- return this.$store.state.app.sidebar;
- },
- classObj() {
- return {
- hideSidebar: !this.sidebar.opened,
- openSidebar: this.sidebar.opened,
- };
- },
- comxjWalletList() {
- return (c) => {
- console.log(c);
- const walle = [];
- const ovalVall = c == undefined || !c.length ? [] : c;
- for (let i = 0; i < this.xjWalletList.length; i++) {
- for (let j = 0; j < ovalVall.length; j++) {
- if (this.xjWalletList[i].walletRebateId == ovalVall[j].walletId) {
- walle.push(this.xjWalletList[i]);
- }
- }
- }
- return walle;
- };
- },
- },
- created() {
- this.getDictList();
- this.getWalletList();
- this.getWarehouseList();
- this.getPolicyList();
- this.getTypeList();
- if (this.listItem) {
- this.getDetail();
- }
- },
- methods: {
- // 返回列表
- goBack() {
- this.$emit("backListFormDetail");
- },
- // 获取详情
- getDetail() {
- getDetail({ id: this.listItem.id }).then((res) => {
- let data = res.data;
- this.mainForm.date = data.theTime;
- this.mainForm.type = data.mainId;
- this.mainForm.remark = data.remark;
- data.retailOrderItemList.forEach((item) => {
- item.status1 = "";
- item.status2 = "";
- });
- this.goodsList = data.retailOrderItemList;
- });
- },
- getPolicyList() {
- policyList({
- pageNum: 1,
- pageSize: -1,
- }).then((res) => {
- console.log(res, "tyep");
- this.policyList = res.data.records;
- });
- },
- getTypeList() {
- const params = {
- pageNum: 1,
- pageSize: -1,
- saleCode: "",
- saleName: "",
- status: "",
- };
- typeList(params).then((res) => {
- this.ztypeList = res.data.records;
- console.log(this.ztypeList,'type1111');
- });
- },
- handleSelectiontAllChange(e) {
- console.log(e);
- },
- handleSelectionChange(e) {
- console.log(e);
- },
- // 获取仓库列表
- getWarehouseList() {
- getWarehouseList({
- pageNum: 1,
- pageSize: -1,
- }).then((res) => {
- this.warehouseList = res.data.records;
- });
- },
- // 获取限定机型
- getpolicyTypeList() {
- getpolicyTypeList({
- pageNum: 1,
- pageSize: 10,
- policyId: this.screenForm.policyId,
- saleTypeCode: this.screenForm.saleTypeCode,
- }).then((res) => {
- for (let i = 0; i < res.data.records.length; i++) {
- res.data.records[i].qty = 1;
- }
- this.dataList = res.data.records;
- });
- },
- getMaterialTypeList() {
- getMaterialTypeList({
- pageNum: 1,
- pageSize: 10,
- policyId: this.screenForm.policyId,
- saleTypeCode: this.screenForm.saleTypeCode,
- }).then((res) => {
- });
- },
- handlePolicyTypeList() {
- this.getpolicyTypeList();
- },
- handleShow() {
- this.isShowDialog = true;
- },
- // 获取钱包列表
- getWalletList() {
- getWalletList({
- customerId: JSON.parse(localStorage.getItem("supply_user")).customerId,
- type: "COMMONLY",
- }).then((res) => {
- this.xjWalletList = res.data;
- console.log(res.data, "xxxxx");
- });
- getWalletList({
- customerId: JSON.parse(localStorage.getItem("supply_user")).customerId,
- type: "REBATE",
- }).then((res) => {
- this.flWalletList = res.data;
- console.log(this.flWalletList, "xxccc");
- });
- },
- // 获取销售类型列表
- getSalesTypeList() {
- getSalesTypeList({
- pageNum: 1,
- pageSize: -1,
- }).then((res) => {
- this.salesTypeList = res.data.records;
- });
- },
- getDictList() {
- getDictList({ sysDictEnum: "PRODUCT_TYPE" }).then((res) => {
- this.typeList = res.data;
- });
- },
- // 获取商品列表
- getGoodsList() {
- getGoodsList({
- pageNum: this.currentPage,
- pageSize: 10,
- mainId: this.screenForm.type,
- saleId: this.screenForm.salesType,
- materialCode: this.screenForm.proNum,
- materialName: this.screenForm.proName,
- specification: this.screenForm.proModel,
- price1: this.screenForm.price1,
- price2: this.screenForm.price2,
- }).then((res) => {
- let oldGoodsList = this.goodsList;
- let newGoodsList = res.data.records;
- for (let i = 0; i < oldGoodsList.length; i++) {
- let oldItem = oldGoodsList[i];
- for (let j = 0; j < newGoodsList.length; j++) {
- let newItem = newGoodsList[j];
- if (newItem.materialId === oldItem.materialId) {
- newGoodsList[j].selected = true;
- break;
- }
- }
- }
- res.data.records.forEach((item) => {
- item.materialName = item.name;
- item.materialCode = item.number;
- item.saleTypeName = item.saleName;
- item.unit = item.baseUnit;
- item.price = item.batchPrice;
- item.tax = item.taxRate;
- item.isDirectTransfer = false;
- item.directTransferQty = "";
- item.status1 = "";
- item.status2 = "";
- item.rebateAmount = "";
- item.rebateRate = "";
- item.productPriceId = item.id;
- });
- this.leftGoodsList = res.data.records;
- this.listTotal = res.data.total;
- });
- },
- // 查询重复值并禁选
- checkboxSelect(row, rowIndex) {
- if (row.selected) {
- return false; // 禁用
- } else {
- return true; // 不禁用
- }
- },
- // 点击 选择商品
- openDialog() {
- this.getSalesTypeList();
- this.getGoodsList();
- this.isShowDialog = true;
- },
- // 提交筛选表单
- submitScreenForm() {
- this.currentPage = 1;
- this.getGoodsList();
- },
- // 重置筛选表单
- resetScreenForm() {
- this.$refs.screenForm.resetFields();
- this.currentPage = 1;
- this.getGoodsList();
- },
- // 更改列表当前页
- handleTableCurrentChange(val) {
- this.currentPage = val;
- this.getGoodsList();
- },
- // 关闭 弹窗
- closeDialog() {
- this.isShowDialog = false;
- },
- // 删除
- deleteGoods() {
- let rightGoodsList = this.rightGoodsList;
- let rightSelection = this.rightSelection;
- for (let i = 0; i < rightGoodsList.length; i++) {
- for (let j = 0; j < rightSelection.length; j++) {
- if (rightSelection[j].materialId == rightGoodsList[i].materialId) {
- this.rightGoodsList.splice(i, 1);
- }
- }
- }
- },
- handleCondition() {
- if (Object.values(this.radioObj)[this.cusIndex - 1] !== "") {
- this.popArr.length >= this.cusIndex ? (this.cusIndex += 1) : "";
- const params = this.radio.split("&");
- this.step = this.cusIndex+1
- this.getConditionList(params[3], this.step);
- return;
- } else {
- this.$errorMsg("请选择");
- }
- },
- // 确定 添加产品
- submitAddGoods() {
- if (this.radio) {
- const params = this.radio.split("&");
- this.screenForm.policyId = params[1];
- this.mainForm.policyId = params[1];
- this.cusIndex += 1;
- getpolicyList({
- materialId: params[2],
- policyId: params[1],
- }).then((res) => {
- this.pop = res.data.pop;
- this.popArr = res.data.pop.split(":");
- this.popArr.splice(0, 1);
- console.log;
- for (let i = 0; i < this.popArr.length; i++) {
- this.$set(this.radioObj, "radio" + (i + 1), "");
- }
- this.step = this.cusIndex+1
- this.getConditionList(params[3], this.step );
- });
- } else {
- this.$errorMsg("请选择");
- }
- },
- // 更改每页数量
- handleSizeChange(val) {
- this.pageSize = val;
- this.currentPage = 1;
- const params = this.radio.split("&");
- this.step = this.cusIndex+1
- this.getConditionList(params[3], this.step);
- },
- // 更改当前页
- handleCurrentChange(val) {
- this.currentPage = val;
- const params = this.radio.split("&");
- this.step = this.cusIndex+1
- this.getConditionList(params[3], this.step);
- },
- getConditionList(policyConditionId, popType) {
- getConditionList({
- pageNum: this.currentPage,
- pageSize:this.pageSize,
- policyConditionId,
- popType,
- }).then((res) => {
- for (let i = 0; i < res.data.records.length; i++) {
- res.data.records[i].qty = 1;
- }
- if (this.popDataArr.length) {
- this.popDataArr.splice(this.cusIndex - 1, 1);
- }
- if (this.cusIndex == 0) {
- this.popDataArr = [];
- }
- this.popDataArr.push(res.data.records);
- // console.log(this.popDataArr, "[]", this.radioObj);
- });
- },
- hanlePopData() {
- if (!Object.values(this.radioObj).includes("")) {
- let arrData = [];
- for (let i = 0; i < this.popDataArr.length; i++) {
- arrData = [...arrData, ...this.popDataArr[i]];
- }
- for (let j = 0; j < arrData.length; j++) {
- for (const key in this.radioObj) {
- if (arrData[j].id == this.radioObj[key]) {
- this.goodsList = [...this.goodsList, arrData[j]];
- }
- }
- }
- const params = this.radio.split("&");
- let arr = [];
- for (let k = 0; k < this.dataList.length; k++) {
- if (this.dataList[k].policyId == params[1]) {
- arr = [this.dataList[k]];
- }
- }
- this.goodsList = [...arr, ...this.goodsList];
- this.goodsList.forEach((item) => {
- this.$set(item, "status1", "");
- this.$set(item, "status2", "");
- });
- this.cusIndex = 0;
- this.radio = "";
- this.dataList = [];
- this.screenForm.policyId = "";
- this.screenForm.saleTypeCode = "";
- this.isShowDialog = false;
- } else {
- this.$errorMsg("请选择");
- }
- },
- handleClose() {
- this.cusIndex = 0;
- this.radio = "";
- this.dataList = [];
- this.screenForm.policyId = "";
- this.screenForm.saleTypeCode = "";
- },
- // 删除产品
- deleteItem(index) {
- this.goodsList.splice(index, 1);
- },
- // 修改返利钱包
- changeWallet(index) {
- if (this.goodsList[index].customerWalletId2) {
- let obj = this.flWalletList.find(
- (o) => o.customerWalletId == this.goodsList[index].customerWalletId2
- );
- this.goodsList[index].rebateRate = obj.rebateRate;
- } else {
- this.goodsList[index].rebateRate = "";
- }
- },
- // 检查库存
- checkStock() {
- if (!this.warehouseValue) {
- return this.$errorMsg("请选择仓库");
- }
- if (!this.goodsList) {
- return this.$errorMsg("请添加货品");
- }
- let ids = [];
- this.goodsList.forEach((item) => {
- ids.push(item.materialId);
- });
- checkStock({
- correspondId: this.warehouseValue,
- materialId: ids.join(","),
- }).then((res) => {
- if (res.data) {
- this.goodsList.forEach((item, index) => {
- item.status1 = res.data[index].allStockNum;
- item.status2 = res.data[index].stockNum;
- console.log(item.status1, item.status2);
- });
- }
- });
- },
- status2Filter(item) {
- if (
- item.status2 === "" ||
- item.status2 === null ||
- item.status2 === undefined
- )
- return "未检查";
- else if (item.status2 >= item.qty) return "可用";
- else return "短缺";
- },
- // 保存
- clickSubmitForm() {
- this.$refs.mainForm.validate((valid) => {
- if (valid) {
- // for (let i = 0; i < this.goodsList.length; i++) {
- // console.log(this.goodsList[i].customerWalletId, 45454554);
- // if (!this.goodsList[i].customerWalletId) {
- // this.$errorMsg("请选择现金钱包");
- // return;
- // }
- // }
- let mainName =
- this.typeList[
- findElem(this.typeList, "dictCode", this.mainForm.type)
- ].dictValue;
- let params = {
- theTime: this.mainForm.date + " 00:00:00",
- mainId: this.mainForm.type,
- mainName,
- remark: this.mainForm.remark,
- type: 2, // 1:普通零售单,2:政策零售单
- retailOrderItemList: this.goodsList,
- policyId: this.screenForm.policyId,
- };
- if (this.listItem) {
- params.id = this.listItem.id;
- editData(params).then((res) => {
- this.$successMsg("编辑成功");
- this.goBack();
- this.$parent.getList();
- });
- } else {
- addData(params).then((res) => {
- this.$successMsg("添加成功");
- this.goBack();
- this.$parent.getList();
- });
- }
- }
- });
- },
- },
- };
- </script>
- <style scoped lang="scss">
- .fr{
- margin: 10px;
- overflow: hidden;
- }
- .detail-container {
- width: 100%;
- height: 100%;
- }
- .main-title {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-top: 20px;
- height: 60px;
- border-bottom: 1px solid #dcdfe6;
- margin-bottom: 20px;
- .title {
- font-size: 16px;
- font-weight: 600;
- padding-left: 10px;
- }
- }
- .tables {
- display: flex;
- margin-top: 10px;
- .table {
- width: 45%;
- }
- .buttons {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- padding: 0 10px;
- button {
- margin: 0;
- margin-top: 10px;
- }
- }
- }
- </style>
|