|
@@ -183,6 +183,23 @@
|
|
|
:is-detail="id !== 'add'"
|
|
|
/> </el-form-item
|
|
|
></el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="商品分类" prop="cat_f">
|
|
|
+ <el-select
|
|
|
+ v-model="ruleForm.cat_f"
|
|
|
+ style="width: 100%"
|
|
|
+ :disabled="isDetail"
|
|
|
+ placeholder="请选择商品分类"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="(item, index) in options"
|
|
|
+ :key="item.cat_name + index"
|
|
|
+ :label="item.cat_name"
|
|
|
+ :value="item.cat_name"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select> </el-form-item
|
|
|
+ ></el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="商品名称" prop="goodName">
|
|
|
<el-input
|
|
@@ -250,18 +267,20 @@
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
+ <el-col :span="12" style="text-align: right;padding:5px 0 0 0">
|
|
|
+ <el-button
|
|
|
+ :size="'mini'"
|
|
|
+ v-if="!isDetail"
|
|
|
+ type="primary"
|
|
|
+ @click="submitForm"
|
|
|
+ >保 存
|
|
|
+ </el-button>
|
|
|
+ <el-button :size="'mini'" @click="showModelThis = false">{{
|
|
|
+ isDetail ? "关 闭" : "取 消"
|
|
|
+ }}</el-button>
|
|
|
+ </el-col>
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
- <el-row>
|
|
|
- <el-col :span="24" style="text-align: right">
|
|
|
- <el-button v-if="!isDetail" type="primary" @click="submitForm"
|
|
|
- >保 存
|
|
|
- </el-button>
|
|
|
- <el-button @click="showModelThis = false">{{
|
|
|
- isDetail ? "关 闭" : "取 消"
|
|
|
- }}</el-button>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
</el-card>
|
|
|
</el-dialog>
|
|
|
</template>
|
|
@@ -292,6 +311,7 @@ export default {
|
|
|
searchName3: "",
|
|
|
searchName4: "",
|
|
|
company_img: "",
|
|
|
+ options: [],
|
|
|
bm: "",
|
|
|
roleList: [],
|
|
|
loading: false,
|
|
@@ -327,6 +347,13 @@ export default {
|
|
|
trigger: "blur",
|
|
|
},
|
|
|
],
|
|
|
+ cat_f: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "请选择商品分类",
|
|
|
+ trigger: "change",
|
|
|
+ },
|
|
|
+ ],
|
|
|
supplierNo: [
|
|
|
{
|
|
|
type: "array",
|
|
@@ -497,6 +524,7 @@ export default {
|
|
|
await this.resetForm();
|
|
|
await this.initData();
|
|
|
}
|
|
|
+ await this.getCatList();
|
|
|
this.loading = false;
|
|
|
},
|
|
|
async initData() {
|
|
@@ -528,6 +556,7 @@ export default {
|
|
|
sequenceNo,
|
|
|
knName,
|
|
|
tax,
|
|
|
+ cat_f,
|
|
|
rateid,
|
|
|
} = res.data;
|
|
|
this.searchName1 = knName;
|
|
@@ -547,6 +576,7 @@ export default {
|
|
|
contactor: contactor,
|
|
|
mobile: mobile,
|
|
|
addr: addr,
|
|
|
+ cat_f: cat_f || "",
|
|
|
sendtime: sendtime,
|
|
|
goodName: goodName,
|
|
|
goodPice: goodPice * 1,
|
|
@@ -584,6 +614,7 @@ export default {
|
|
|
contactor: "",
|
|
|
mobile: "",
|
|
|
addr: "",
|
|
|
+ cat_f: "",
|
|
|
sendtime: "",
|
|
|
goodName: "",
|
|
|
goodPice: 0,
|
|
@@ -600,6 +631,22 @@ export default {
|
|
|
setNum(s) {
|
|
|
return s ? parseFloat(s + "").toFixed(2) : "0";
|
|
|
},
|
|
|
+ async getCatList() {
|
|
|
+ this.options = [];
|
|
|
+ let model = {
|
|
|
+ pid: "",
|
|
|
+ level: "1",
|
|
|
+ };
|
|
|
+ const res = await asyncRequest.getcat(model);
|
|
|
+ if (res && res.code === 0) {
|
|
|
+ this.options = res.data;
|
|
|
+ // console.log(res);
|
|
|
+ } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
+ await this.logout();
|
|
|
+ } else {
|
|
|
+ this.$message.warning(res.message);
|
|
|
+ }
|
|
|
+ },
|
|
|
async submitForm() {
|
|
|
await this.$refs.ruleForm.validate(async (valid) => {
|
|
|
if (valid) {
|
|
@@ -615,6 +662,7 @@ export default {
|
|
|
this.loading = false;
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
obj.companyNo = obj.companyNo[0];
|
|
|
obj.khNo = obj.khNo[0];
|
|
|
obj.supplierNo = obj.supplierNo[0];
|
|
@@ -625,28 +673,21 @@ export default {
|
|
|
for (let key in obj) {
|
|
|
obj[key] = obj[key] + "";
|
|
|
}
|
|
|
- let res = {};
|
|
|
- if (this.id === "add") {
|
|
|
- delete obj["id"];
|
|
|
- res = await asyncRequest.add(obj);
|
|
|
- } else {
|
|
|
- res = await asyncRequest.update(obj);
|
|
|
- }
|
|
|
- console.log(res);
|
|
|
- this.loading = false;
|
|
|
- if (res && res.code === 0) {
|
|
|
- const title = this.id === "add" ? "添加成功!" : "修改成功!";
|
|
|
- this.$notify.success({
|
|
|
- title,
|
|
|
- message: "",
|
|
|
- });
|
|
|
- this.showModelThis = false;
|
|
|
- // 刷新
|
|
|
- this.$emit("refresh");
|
|
|
- } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
- await this.logout();
|
|
|
+ let cgd_tax = Number(obj.cgd_tax);
|
|
|
+ if (cgd_tax === 0) {
|
|
|
+ this.$confirm("当前采购毛利率为0,是否提交?", "温馨提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ })
|
|
|
+ .then(async () => {
|
|
|
+ await this.httpSubmit(obj);
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
} else {
|
|
|
- this.$message.warning(res.message);
|
|
|
+ await this.httpSubmit(obj);
|
|
|
}
|
|
|
} else {
|
|
|
console.log("error submit!!");
|
|
@@ -654,6 +695,30 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ async httpSubmit(obj) {
|
|
|
+ let res = {};
|
|
|
+ if (this.id === "add") {
|
|
|
+ delete obj["id"];
|
|
|
+ res = await asyncRequest.add(obj);
|
|
|
+ } else {
|
|
|
+ res = await asyncRequest.update(obj);
|
|
|
+ }
|
|
|
+ this.loading = false;
|
|
|
+ if (res && res.code === 0) {
|
|
|
+ const title = this.id === "add" ? "添加成功!" : "修改成功!";
|
|
|
+ this.$notify.success({
|
|
|
+ title,
|
|
|
+ message: "",
|
|
|
+ });
|
|
|
+ this.showModelThis = false;
|
|
|
+ // 刷新
|
|
|
+ this.$emit("refresh");
|
|
|
+ } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
+ await this.logout();
|
|
|
+ } else {
|
|
|
+ this.$message.warning(res.message);
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|