123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442 |
- <template>
- <div class="borderless" v-loading="pageLoading">
- <div class="customer-head">
- <div class="customer-back">
- <!-- <i class="back-icon el-icon-arrow-left"></i><i style="font-style:normal">返回管理列表</i>-->
- <el-button
- type="danger"
- style="border: none;background: none;color: red"
- icon="el-icon-arrow-left"
- @click="backToList"
- >返回列表
- </el-button>
- </div>
- <div class="add-customer-btn" v-if="showBut">
- <el-button
- type="primary"
- :disabled="disabled"
- @click="editCustomer"
- size="small"
- :loading="subLoading"
- v-if="detailData.status != 1"
- >{{ form.id ? "确认修改" : "确认新增" }}
- </el-button>
- </div>
- </div>
- <div style="margin-top: 60px;margin-bottom:35px">
- <containerTitle title="基础信息"></containerTitle>
- <basic-container style="margin-bottom: 10px">
- <avue-form ref="form" v-model="form" :option="option">
- <template slot="corpId">
- <select-component
- v-model="form.corpId"
- :configuration="configuration"
- :disabled="detailData.status == 1"
- ></select-component>
- </template>
- <template slot="cname">
- <goods-select
- v-model="form.cname"
- :configuration="goodsConfiguration"
- @getRow="getGoodsRow"
- @returnRow="returnRow"
- :disabled="detailData.status == 1"
- />
- </template>
- </avue-form>
- </basic-container>
- </div>
- </div>
- </template>
- <script>
- import { detail, submit } from "@/api/maintenance/priceLibrary";
- import { contrastObj } from "@/util/contrastData";
- import { orderStates } from "@/enums/order-stauts";
- import _ from "lodash";
- export default {
- name: "detailsPageEdit",
- data() {
- return {
- goodsConfiguration: {
- multipleChoices: false,
- multiple: false,
- collapseTags: false,
- placeholder: "请点击右边按钮选择",
- dicData: [],
- clearable: true
- },
- configuration: {
- multipleChoices: false,
- multiple: false,
- collapseTags: false,
- placeholder: "请点击右边按钮选择",
- dicData: []
- },
- form: {},
- option: {
- menuBtn: false,
- labelWidth: 100,
- column: [
- {
- label: "商品名称",
- prop: "cname",
- rules: [
- {
- required: true,
- message: "",
- trigger: "blur"
- }
- ],
- span: 8
- },
- {
- label: "规格",
- prop: "specs",
- disabled: true,
- span: 8
- },
- {
- label: "产品属性",
- prop: "goodNature",
- span: 8
- },
- {
- label: "供应商",
- prop: "corpId",
- rules: [
- {
- required: true,
- message: "",
- trigger: "blur"
- }
- ],
- span: 8
- },
- {
- label: "币别",
- prop: "currency",
- type: "select",
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=currency",
- props: {
- label: "dictValue",
- value: "dictValue"
- },
- rules: [
- {
- required: true,
- message: "",
- trigger: "blur"
- }
- ],
- span: 8
- },
- {
- label: "FOB系数",
- prop: "coefficient",
- rules: [
- {
- required: true,
- message: "",
- trigger: "blur"
- }
- ],
- span: 8
- },
- {
- label: "价格类型",
- prop: "billType",
- rules: [
- {
- required: true,
- message: "",
- trigger: "blur"
- }
- ],
- type: "select",
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=billType",
- props: {
- label: "dictValue",
- value: "dictKey"
- },
- span: 8
- },
- {
- label: "最新价格",
- prop: "price",
- rules: [
- {
- required: true,
- message: "",
- trigger: "blur"
- }
- ],
- span: 8
- },
- {
- label: "状态",
- prop: "status",
- type: "select",
- dicData: orderStates,
- props: {
- label: "name",
- value: "code"
- },
- rules: [
- {
- required: true,
- message: "",
- trigger: "blur"
- }
- ],
- span: 8
- },
- {
- label: "有效期开始",
- prop: "startTime",
- type: "date",
- format: "yyyy-MM-dd",
- valueFormat: "yyyy-MM-dd 00:00:00",
- rules: [
- {
- required: true,
- message: "",
- trigger: "blur"
- }
- ],
- span: 8
- },
- {
- label: "有效期结束",
- prop: "endTime",
- type: "date",
- format: "yyyy-MM-dd",
- valueFormat: "yyyy-MM-dd 23:59:59",
- rules: [
- {
- required: true,
- message: "",
- trigger: "blur"
- }
- ],
- span: 8
- },
- {
- label: "业务员",
- prop: "person",
- span: 8,
- row: true
- },
- {
- label: "历史价格1",
- prop: "priceOne",
- span: 8,
- disabled: true
- },
- {
- label: "历史日期1",
- prop: "priceOneTime",
- type: "datetime",
- format: "yyyy-MM-dd hh:mm:ss",
- valueFormat: "yyyy-MM-dd hh:mm:ss",
- span: 8,
- disabled: true
- },
- {
- label: "历史价格2",
- prop: "priceTwo",
- span: 8,
- disabled: true
- },
- {
- label: "历史日期2",
- prop: "priceTwoTime",
- type: "datetime",
- format: "yyyy-MM-dd hh:mm:ss",
- valueFormat: "yyyy-MM-dd hh:mm:ss",
- span: 8,
- disabled: true
- },
- {
- label: "历史价格3",
- prop: "priceThree",
- span: 8,
- disabled: true
- },
- {
- label: "历史日期3",
- prop: "priceThreeTime",
- type: "datetime",
- format: "yyyy-MM-dd hh:mm:ss",
- valueFormat: "yyyy-MM-dd hh:mm:ss",
- span: 8,
- disabled: true
- },
- {
- label: "备注",
- prop: "remarks",
- type: "textarea",
- minRows: 2,
- span: 24
- }
- ]
- },
- oldform: {},
- loading: false,
- subLoading: false,
- pageLoading: false,
- showBut: true
- };
- },
- props: {
- detailData: {
- type: Object
- }
- },
- created() {
- if (this.detailData.id) {
- this.getDetail(this.detailData.id);
- }
- if (this.detailData.status == 1) {
- this.option.disabled = true;
- }
- },
- filters: {},
- methods: {
- getDetail(id) {
- this.loading = true;
- this.showBut = false;
- this.pageLoading = true;
- detail(id)
- .then(res => {
- this.form = res.data.data;
- this.oldform = res.data.data;
- })
- .finally(() => {
- this.loading = false;
- this.showBut = true;
- this.pageLoading = false;
- });
- },
- //修改提交触发
- editCustomer(status) {
- this.$refs["form"].validate((valid, done) => {
- done();
- if (valid) {
- this.subLoading = true;
- this.form.tradeType = "CK";
- this.configuration.dicData.forEach(e => {
- if (this.form.corpId == e.id) {
- this.form.corpName = e.cname;
- }
- });
- submit({
- ...this.form
- })
- .then(res => {
- if (res.data.code == 200) {
- this.$message.success(this.form.id ? "修改成功" : "提交成功");
- this.form = res.data.data;
- this.oldform = res.data.data;
- if (status == "goBack") {
- this.$emit("goBack");
- }
- }
- })
- .finally(() => {
- this.subLoading = false;
- });
- } else {
- return false;
- }
- });
- },
- //返回列表
- backToList() {
- if (contrastObj(this.form, this.oldform)) {
- this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- this.editCustomer("goBack");
- })
- .catch(() => {
- this.$emit("goBack");
- });
- } else {
- this.$emit("goBack");
- }
- },
- openReport() {
- this.switchDialog = !this.switchDialog;
- },
- onClose(val) {
- this.switchDialog = val;
- },
- getGoodsRow(row) {
- this.form.itemId = row.id;
- this.form.code = row.code;
- this.form.specs = row.specs;
- },
- returnRow(rows) {
- this.form.itemId = rows[0].id;
- this.form.code = rows[0].code;
- this.form.specs = rows[0].specs;
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .customer-head {
- position: fixed;
- top: 105px;
- width: 100%;
- margin-left: -10px;
- height: 62px;
- background: #ffffff;
- box-shadow: 0 4px 12px 0px rgba(232, 232, 235, 1);
- z-index: 999;
- }
- .customer-back {
- cursor: pointer;
- line-height: 62px;
- font-size: 16px;
- color: #323233;
- font-weight: 400;
- }
- .back-icon {
- line-height: 64px;
- font-size: 20px;
- margin-right: 8px;
- }
- .sell-customer-btn {
- position: fixed;
- right: 244px;
- top: 115px;
- }
- .copy-customer-btn {
- position: fixed;
- right: 140px;
- top: 115px;
- }
- .add-customer-btn {
- position: fixed;
- right: 36px;
- top: 115px;
- }
- ::v-deep .el-form-item {
- margin-bottom: 8px;
- }
- ::v-deep .el-form-item__error {
- display: none;
- }
- ::v-deep .select-component {
- display: flex;
- }
- </style>
|