|
@@ -22,7 +22,7 @@
|
|
|
status-icon
|
|
|
:size="'small'"
|
|
|
:rules="rulesThis"
|
|
|
- label-width="110px"
|
|
|
+ label-width="85px"
|
|
|
class="demo-ruleForm"
|
|
|
>
|
|
|
<el-form-item label="起订量" prop="min_num">
|
|
@@ -34,11 +34,22 @@
|
|
|
:position="'right'"
|
|
|
:precision="0"
|
|
|
:controls="false"
|
|
|
+ :size="'small'"
|
|
|
:disabled="id === '007'"
|
|
|
:append="''"
|
|
|
@reschange="min_num_change"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="系统售价" prop="new_sale_price">
|
|
|
+ <el-input
|
|
|
+ placeholder="系统售价"
|
|
|
+ v-loading="search_loading"
|
|
|
+ :disabled="true"
|
|
|
+ v-model="ruleForm.new_sale_price"
|
|
|
+ >
|
|
|
+ <template slot="append">元</template>
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="售价" prop="sale_price">
|
|
|
<digital-input
|
|
|
:values="ruleForm.sale_price"
|
|
@@ -48,6 +59,7 @@
|
|
|
:position="'right'"
|
|
|
:precision="2"
|
|
|
:controls="false"
|
|
|
+ :size="'small'"
|
|
|
:disabled="id === '007'"
|
|
|
:append="'元'"
|
|
|
@reschange="sale_price_change"
|
|
@@ -62,6 +74,7 @@
|
|
|
:position="'right'"
|
|
|
:precision="2"
|
|
|
:controls="false"
|
|
|
+ :size="'small'"
|
|
|
:disabled="id === '007'"
|
|
|
:append="'元'"
|
|
|
@reschange="market_price_change"
|
|
@@ -75,31 +88,36 @@
|
|
|
maxlength="20"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="阶梯使用状态" prop="status">
|
|
|
- <el-radio-group v-model="ruleForm.status">
|
|
|
- <el-radio :label="'1'">启用</el-radio>
|
|
|
- <el-radio :label="'0'">禁用</el-radio>
|
|
|
- </el-radio-group>
|
|
|
- </el-form-item>
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col :span="16">
|
|
|
+ <el-form-item label="状态" prop="status">
|
|
|
+ <el-radio-group v-model="ruleForm.status">
|
|
|
+ <el-radio :label="'1'">启用</el-radio>
|
|
|
+ <el-radio :label="'0'">禁用</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8" style="text-align: right">
|
|
|
+ <el-button :size="'small'" type="primary" @click="submitForm"
|
|
|
+ >保 存
|
|
|
+ </el-button>
|
|
|
+ <el-button @click="showModelThis = false" :size="'small'">{{
|
|
|
+ "取 消"
|
|
|
+ }}</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
</el-form>
|
|
|
</el-col>
|
|
|
- <el-col :span="24" style="text-align: right">
|
|
|
- <el-button :size="'small'" type="primary" @click="submitForm"
|
|
|
- >保 存
|
|
|
- </el-button>
|
|
|
- <el-button @click="showModelThis = false" :size="'small'">{{
|
|
|
- "取 消"
|
|
|
- }}</el-button>
|
|
|
- </el-col>
|
|
|
</el-row>
|
|
|
</el-card>
|
|
|
</el-dialog>
|
|
|
</template>
|
|
|
<script>
|
|
|
import resToken from "@/mixins/resToken";
|
|
|
+import asyncRequest from "@/apis/service/goodStore/goodsOnline";
|
|
|
export default {
|
|
|
name: "brand",
|
|
|
- props: ["showModel", "index", "sitem"],
|
|
|
+ props: ["showModel", "index", "sitem", "spuCode"],
|
|
|
mixins: [resToken],
|
|
|
data() {
|
|
|
const validate_min_num = (rule, value, callback) => {
|
|
@@ -129,8 +147,19 @@ export default {
|
|
|
loading: false,
|
|
|
title: "",
|
|
|
showModelThis: this.showModel,
|
|
|
- ruleForm: {},
|
|
|
+ ruleForm: {
|
|
|
+ id: "",
|
|
|
+ index: "-1",
|
|
|
+ min_num: "0",
|
|
|
+ sale_price: "0",
|
|
|
+ market_price: "0",
|
|
|
+ market_platform: "",
|
|
|
+ new_sale_price: "",
|
|
|
+ status: "1",
|
|
|
+ is_del: "0",
|
|
|
+ },
|
|
|
rulesThis: this.rules,
|
|
|
+ search_loading: false,
|
|
|
rules: {
|
|
|
min_num: [
|
|
|
{
|
|
@@ -179,8 +208,7 @@ export default {
|
|
|
methods: {
|
|
|
async initForm() {
|
|
|
this.loading = true;
|
|
|
- await this.resetFormData();
|
|
|
- console.log(this.index);
|
|
|
+ await this.resetForm();
|
|
|
this.rulesThis = this.rules;
|
|
|
if (this.index + "" === "-1") {
|
|
|
this.title = "添加销售成本阶梯";
|
|
@@ -188,7 +216,6 @@ export default {
|
|
|
this.title = "修改销售成本阶梯";
|
|
|
}
|
|
|
|
|
|
- await this.resetForm();
|
|
|
this.loading = false;
|
|
|
},
|
|
|
async resetForm() {
|
|
@@ -218,9 +245,11 @@ export default {
|
|
|
sale_price: sale_price || "0",
|
|
|
market_price: market_price || "0",
|
|
|
market_platform: market_platform || "",
|
|
|
+ new_sale_price: "",
|
|
|
status: status || "1",
|
|
|
is_del: is_del || "0",
|
|
|
};
|
|
|
+ await this.get_new(this.ruleForm.min_num);
|
|
|
},
|
|
|
|
|
|
async submitForm() {
|
|
@@ -236,9 +265,34 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- min_num_change(e) {
|
|
|
- this.ruleForm.min_num = e;
|
|
|
+ async min_num_change(e) {
|
|
|
+ this.ruleForm.min_num = e + "";
|
|
|
this.$refs.ruleForm.validateField("min_num");
|
|
|
+ await this.get_new(this.ruleForm.min_num);
|
|
|
+ },
|
|
|
+ async get_new(min_num) {
|
|
|
+ if (!this.search_loading) {
|
|
|
+ if (min_num === "" || min_num === "0") {
|
|
|
+ this.ruleForm.new_sale_price = "0";
|
|
|
+ } else {
|
|
|
+ this.search_loading = true;
|
|
|
+ let { code, data, message } = await asyncRequest.goodupprice({
|
|
|
+ min_num: min_num,
|
|
|
+ spuCode: this.spuCode,
|
|
|
+ });
|
|
|
+ this.search_loading = false;
|
|
|
+ if (code === 0) {
|
|
|
+ const { sale_price } = data;
|
|
|
+ this.ruleForm.new_sale_price = sale_price;
|
|
|
+ } else if (code >= 100 && code <= 104) {
|
|
|
+ await this.logout();
|
|
|
+ } else if (code == 1010) {
|
|
|
+ this.ruleForm.new_sale_price = "0";
|
|
|
+ } else {
|
|
|
+ this.$message.warning(message);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
sale_price_change(e) {
|
|
|
this.ruleForm.sale_price = e;
|