|
@@ -1482,22 +1482,38 @@ export default {
|
|
|
return model;
|
|
|
},
|
|
|
//商品分类选择
|
|
|
- goods_class_change(e) {
|
|
|
- const { value, item } = e;
|
|
|
- const { cat_desc } = item;
|
|
|
- this.ruleForm.cat_id = value || [];
|
|
|
+ async goods_class_change(e) {
|
|
|
+ this.ruleForm.cat_id = e || [];
|
|
|
this.$refs.ruleForm.validateField("cat_id");
|
|
|
- this.ruleForm.after_sales = cat_desc || "";
|
|
|
- this.$refs.ruleForm.validateField("after_sales");
|
|
|
let isok = false;
|
|
|
- if (value.length > 0) {
|
|
|
- value.forEach((i) => {
|
|
|
+ if (this.ruleForm.cat_id.length > 0) {
|
|
|
+ this.ruleForm.cat_id.forEach((i) => {
|
|
|
if (i === "8") {
|
|
|
isok = true;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
this.is_noble = isok;
|
|
|
+
|
|
|
+ if (this.ruleForm.cat_id.length > 0) {
|
|
|
+ let key = this.ruleForm.cat_id[this.ruleForm.cat_id.length - 1];
|
|
|
+ await this.get_sales(key);
|
|
|
+ } else {
|
|
|
+ this.ruleForm.after_sales = "";
|
|
|
+ this.$refs.ruleForm.validateField("after_sales");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async get_sales(keyId) {
|
|
|
+ const { code, data, message } = await asyncRequest.catinfo({ id: keyId });
|
|
|
+ if (code === 0) {
|
|
|
+ const { cat_desc } = data;
|
|
|
+ this.ruleForm.after_sales = cat_desc || "";
|
|
|
+ this.$refs.ruleForm.validateField("after_sales");
|
|
|
+ } else if (code >= 100 && code <= 104) {
|
|
|
+ await this.logout();
|
|
|
+ } else {
|
|
|
+ this.$message.warning(message);
|
|
|
+ }
|
|
|
},
|
|
|
//商品品牌选择
|
|
|
brandidsearchChange(e) {
|