|
@@ -5,7 +5,6 @@
|
|
|
:model="ruleForm"
|
|
|
status-icon
|
|
|
:rules="rulesThis"
|
|
|
- :label-width="labelWidth || '110px'"
|
|
|
class="demo-ruleForm-goodsOnline"
|
|
|
:size="'mini'"
|
|
|
>
|
|
@@ -34,13 +33,45 @@
|
|
|
:size="'mini'"
|
|
|
:style="{ marginBottom: scope.row.edit ? '13px' : '0' }"
|
|
|
>
|
|
|
- <el-input
|
|
|
- v-model="scope.min_num"
|
|
|
- placeholder="起订量(>=)"
|
|
|
+ <digital-input
|
|
|
+ :values="scope.row.min_num"
|
|
|
+ :placeholder="'起订量(>=)'"
|
|
|
+ :min="0"
|
|
|
+ :max="100000000000"
|
|
|
+ :position="'right'"
|
|
|
+ :precision="0"
|
|
|
+ :controls="false"
|
|
|
+ :append="''"
|
|
|
+ :size="'mini'"
|
|
|
:disabled="!scope.row.edit"
|
|
|
+ @reschange="num_change($event, 'min_num', scope.$index)"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
- <span v-if="!scope.row.edit">{{ scope.row.min_num }}</span>
|
|
|
+ <span v-else>{{ scope.row.min_num }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="new_sale_price"
|
|
|
+ label="系统售价(元)"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-form-item
|
|
|
+ v-if="scope.row.edit"
|
|
|
+ :prop="'good_ladder.' + scope.$index + '.' + 'new_sale_price'"
|
|
|
+ :rules="addrRules.new_sale_price"
|
|
|
+ :size="'mini'"
|
|
|
+ :style="{ marginBottom: scope.row.edit ? '13px' : '0' }"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-loading="scope.row.loading"
|
|
|
+ v-model="scope.row.new_sale_price"
|
|
|
+ placeholder="系统售价"
|
|
|
+ :disabled="true"
|
|
|
+ :size="'mini'"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <span v-else>{{ scope.row.new_sale_price }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="sale_price" label="售价" show-overflow-tooltip>
|
|
@@ -53,12 +84,12 @@
|
|
|
:style="{ marginBottom: scope.row.edit ? '13px' : '0' }"
|
|
|
>
|
|
|
<el-input
|
|
|
- v-model="scope.sale_price"
|
|
|
+ v-model="scope.row.sale_price"
|
|
|
placeholder="售价"
|
|
|
:disabled="!scope.row.edit"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
- <span v-if="!scope.row.edit">{{ scope.row.sale_price }}</span>
|
|
|
+ <span v-else>{{ scope.row.sale_price }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
@@ -75,12 +106,12 @@
|
|
|
:style="{ marginBottom: scope.row.edit ? '13px' : '0' }"
|
|
|
>
|
|
|
<el-input
|
|
|
- v-model="scope.market_price"
|
|
|
+ v-model="scope.row.market_price"
|
|
|
placeholder="市场价"
|
|
|
:disabled="!scope.row.edit"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
- <span v-if="!scope.row.edit">{{ scope.row.market_price }}</span>
|
|
|
+ <span v-else>{{ scope.row.market_price }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
@@ -97,19 +128,35 @@
|
|
|
:style="{ marginBottom: scope.row.edit ? '13px' : '0' }"
|
|
|
>
|
|
|
<el-input
|
|
|
- v-model="scope.market_platform"
|
|
|
+ v-model="scope.row.market_platform"
|
|
|
placeholder="对比平台"
|
|
|
:disabled="!scope.row.edit"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
- <span v-if="!scope.row.edit">{{
|
|
|
- scope.row.market_platform
|
|
|
- }}</span>
|
|
|
+ <span v-else>{{ scope.row.market_platform }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="status" label="状态" show-overflow-tooltip>
|
|
|
<template slot-scope="scope">
|
|
|
+ <el-form-item
|
|
|
+ v-if="scope.row.edit"
|
|
|
+ :prop="'good_ladder.' + scope.$index + '.' + 'status'"
|
|
|
+ :rules="addrRules.status"
|
|
|
+ :size="'mini'"
|
|
|
+ :style="{ marginBottom: scope.row.edit ? '13px' : '0' }"
|
|
|
+ >
|
|
|
+ <el-select v-model="scope.row.status" placeholder="状态">
|
|
|
+ <el-option
|
|
|
+ v-for="item in status_options"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
<el-tag
|
|
|
+ v-else
|
|
|
:size="'mini'"
|
|
|
:type="scope.row.status == '1' ? '' : 'warning'"
|
|
|
>{{ scope.row.status == "1" ? "启用" : "禁用" }}</el-tag
|
|
@@ -122,7 +169,7 @@
|
|
|
<el-tooltip effect="dark" content="添加阶梯" placement="top">
|
|
|
<i
|
|
|
class="el-icon-circle-plus-outline tb-icon fr"
|
|
|
- @click="openCostEdit(-1, {})"
|
|
|
+ @click="openCostEdit(-1)"
|
|
|
></i>
|
|
|
</el-tooltip>
|
|
|
</template>
|
|
@@ -130,7 +177,7 @@
|
|
|
<el-tooltip effect="dark" content="修改" placement="top">
|
|
|
<i
|
|
|
class="el-icon-edit tb-icon"
|
|
|
- @click="openCostEdit(scope.$index, scope.row)"
|
|
|
+ @click="openCostEdit(scope.$index)"
|
|
|
></i>
|
|
|
</el-tooltip>
|
|
|
|
|
@@ -144,14 +191,14 @@
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
<!-- 弹窗 新增/修改 -->
|
|
|
- <cost-form-add-edit
|
|
|
+ <!-- <cost-form-add-edit
|
|
|
:index="costmodelIndex"
|
|
|
:show-model="costshowModel"
|
|
|
:sitem="costsitem"
|
|
|
:spuCode="spuCode"
|
|
|
@refresh="costrefreshEdit"
|
|
|
@cancel="costshowModel = false"
|
|
|
- />
|
|
|
+ /> -->
|
|
|
</el-col>
|
|
|
<el-col :span="24"
|
|
|
><el-form-item label="售价凭证类型" prop="proof_type">
|
|
@@ -302,7 +349,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import costFormAddEdit from "./costFormAddEdit";
|
|
|
+// import costFormAddEdit from "./costFormAddEdit";
|
|
|
import asyncRequest from "@/apis/service/goodStore/goodsOnline";
|
|
|
import showVoucherModel from "@/components/show-voucher-model";
|
|
|
export default {
|
|
@@ -318,7 +365,7 @@ export default {
|
|
|
"sitem",
|
|
|
],
|
|
|
components: {
|
|
|
- costFormAddEdit,
|
|
|
+ // costFormAddEdit,
|
|
|
showVoucherModel,
|
|
|
},
|
|
|
/**
|
|
@@ -380,6 +427,16 @@ export default {
|
|
|
label: "其他",
|
|
|
},
|
|
|
],
|
|
|
+ status_options: [
|
|
|
+ {
|
|
|
+ value: "1",
|
|
|
+ label: "启用",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: "0",
|
|
|
+ label: "禁用",
|
|
|
+ },
|
|
|
+ ],
|
|
|
showModelThis: this.showModel,
|
|
|
pickerOptions: {
|
|
|
disabledDate(time) {
|
|
@@ -495,15 +552,63 @@ export default {
|
|
|
this.loading = false;
|
|
|
},
|
|
|
|
|
|
- openCostEdit(index, sitem) {
|
|
|
- this.costmodelIndex = index;
|
|
|
- this.costsitem = sitem;
|
|
|
- this.costshowModel = true;
|
|
|
+ openCostEdit(index) {
|
|
|
+ let findex = this.ruleForm.good_ladder.findIndex((v) => v.edit === true);
|
|
|
+ if (findex !== -1) {
|
|
|
+ this.$message.warning("当前已有阶梯售价在编辑,请保存后再试!");
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ if (index === -1) {
|
|
|
+ this.ruleForm.good_ladder.push({
|
|
|
+ edit: true,
|
|
|
+ min_num: "",
|
|
|
+ new_sale_price: "",
|
|
|
+ sale_price: "",
|
|
|
+ market_price: "",
|
|
|
+ market_platform: "",
|
|
|
+ status: "1",
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.ruleForm.good_ladder[index].edit = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async get_new(index) {
|
|
|
+ const { min_num, search_loading } = this.ruleForm.good_ladder[index];
|
|
|
+ console.log(this.spuCode);
|
|
|
+ if (!search_loading) {
|
|
|
+ if (min_num === "" || min_num === "0") {
|
|
|
+ this.ruleForm.good_ladder[index].new_sale_price = "0";
|
|
|
+ } else {
|
|
|
+ this.ruleForm.good_ladder[index].search_loading = true;
|
|
|
+ let { code, data, message } = await asyncRequest.goodupprice({
|
|
|
+ min_num: min_num,
|
|
|
+ spuCode: this.spuCode,
|
|
|
+ });
|
|
|
+ this.ruleForm.good_ladder[index].search_loading = false;
|
|
|
+ if (code === 0) {
|
|
|
+ const { sale_price } = data;
|
|
|
+ this.ruleForm.good_ladder[index].new_sale_price = sale_price;
|
|
|
+ } else if (code >= 100 && code <= 104) {
|
|
|
+ await this.logout();
|
|
|
+ } else if (code == 1010) {
|
|
|
+ this.ruleForm.good_ladder[index].new_sale_price = "0";
|
|
|
+ this.$message.warning(message);
|
|
|
+ } else {
|
|
|
+ this.$message.warning(message);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
-
|
|
|
openCostEditDelete(index) {
|
|
|
this.ruleForm.good_ladder.splice(index, 1);
|
|
|
},
|
|
|
+ async num_change(e, key, index) {
|
|
|
+ this.ruleForm.good_ladder[index][key] = e + "" || "0";
|
|
|
+ if (key === "min_num") {
|
|
|
+ await this.get_new(index);
|
|
|
+ }
|
|
|
+ },
|
|
|
//阶梯成本修改
|
|
|
costrefreshEdit(e) {
|
|
|
let item = JSON.parse(JSON.stringify(e));
|