戴艳蓉 3 years ago
parent
commit
22b15492ee

+ 16 - 14
src/components/globalComponents/search-metal-kind/main.vue

@@ -89,27 +89,29 @@ export default {
   },
   methods: {
     async selectChange(e) {
+      console.log(e);
       let index = this.options.findIndex((v) => v.type === e);
       if (index !== -1) {
         let model = {
           id: this.options[index].type,
           code: this.options[index].type,
           label: this.options[index].type_cn,
-          price: "0",
+          // price: "0",
         };
-        const { code, data, message } = await asyncRequest.get_price({
-          type: this.options[index].type,
-        });
-        if (code === 0 && data && data[0]) {
-          let sitem = data[0];
-          const { price } = sitem;
-          model.price = price;
-        } else if (code >= 100 && code <= 104) {
-          await this.logout();
-        } else {
-          this.$message.warning(message);
-          return;
-        }
+        console.log(111);
+        // const { code, data, message } = await asyncRequest.get_price({
+        //   type: this.options[index].type,
+        // });
+        // if (code === 0 && data && data[0]) {
+        //   let sitem = data[0];
+        //   const { price } = sitem;
+        //   model.price = price;
+        // } else if (code >= 100 && code <= 104) {
+        //   await this.logout();
+        // } else {
+        //   this.$message.warning(message);
+        //   return;
+        // }
         this.$emit("searchChange", model);
       } else {
         this.$emit("searchChange", {});

+ 1 - 5
src/views/goodStore/goldPrice/addEdit.vue

@@ -140,11 +140,7 @@ export default {
     noble_metalsearchChange(e) {
       console.log(e);
       const { id, code, label } = e;
-      if (id) {
-        this.ruleForm.type = id;
-      } else {
-        this.ruleForm.type = "";
-      }
+      this.ruleForm.type = id ? id : "";
       this.$refs.ruleForm.validateField("type");
     },
     reschange(e) {

+ 408 - 0
src/views/sellOut/zixunOrder/components/addEditBargain.vue

@@ -0,0 +1,408 @@
+<template>
+  <el-dialog
+    v-loading="loading"
+    :title="title"
+    :center="true"
+    align="left"
+    top="10vh"
+    width="750px"
+    :close-on-click-modal="false"
+    :visible.sync="showModelThis"
+    element-loading-text="拼命加载中"
+    element-loading-spinner="el-icon-loading"
+    element-loading-background="rgba(0, 0, 0, 0.8)"
+    @close="showModelThis = false"
+  >
+    <el-card style="margin-top: -20px">
+      <el-row :gutter="10">
+        <el-col :span="24">
+          <el-form
+            ref="ruleForm"
+            :model="ruleForm"
+            status-icon
+            :rules="rulesThis"
+            label-width="110px"
+            class="demo-ruleForm"
+          >
+            <el-form-item
+              v-if="id === 'add' || isDetail"
+              label="账号"
+              prop="username"
+            >
+              <el-input v-model="ruleForm.username" :disabled="isDetail" />
+            </el-form-item>
+            <el-form-item label="真实姓名" prop="name">
+              <el-input v-model="ruleForm.name" :disabled="isDetail" />
+            </el-form-item>
+            <el-form-item label="手机号" prop="mobile">
+              <el-input v-model="ruleForm.mobile" :disabled="isDetail" />
+            </el-form-item>
+            <el-form-item label="所在部门" prop="itemid">
+              <all-organize
+                :value="ruleForm.itemid"
+                :is-detail="isDetail"
+                :disabled="isDetail"
+                :multiple="true"
+                :checkStrictly="true"
+                :placeholder="'请选择所在部门'"
+                @searchChange="itemidChange"
+              />
+            </el-form-item>
+            <el-form-item label="邮箱" prop="email">
+              <el-input v-model="ruleForm.email" :disabled="isDetail" />
+            </el-form-item>
+
+            <el-form-item label="角色" prop="role_id">
+              <el-radio-group v-model="ruleForm.role_id" :disabled="isDetail">
+                <el-radio
+                  v-for="item in roleList"
+                  :key="item.id"
+                  :label="item.id"
+                  :disabled="item.status !== '1'"
+                  >{{ item.role_name }}</el-radio
+                >
+              </el-radio-group>
+            </el-form-item>
+
+            <el-form-item label="状态" prop="status">
+              <el-switch
+                v-model="ruleForm.status"
+                active-value="1"
+                inactive-value="0"
+                :disabled="isDetail"
+              />
+            </el-form-item>
+          </el-form>
+        </el-col>
+        <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>
+<script>
+import asyncRequest from "@/apis/service/interest/account";
+import resToken from "@/mixins/resToken";
+import {
+  isnumber,
+  isMobile,
+  validEmail,
+  isAlphanumeric,
+  isChinese,
+  isEmoticon,
+  validAlphabets,
+} from "@/utils/validate";
+export default {
+  name: "Account",
+  props: ["showModel", "id", "isDetail", "sitem"],
+  mixins: [resToken],
+  data() {
+    const validateusername = (rule, value, callback) => {
+      if (value === "") {
+        callback(new Error("账号不能为空!"));
+      } else {
+        if (value.length < 6 || value.length > 18) {
+          callback(new Error("账号规则为6~18位数字与字母组合!"));
+        } else {
+          if (isnumber(value)) {
+            callback(new Error("账号规则为6~18位数字与字母组合!"));
+          } else if (validAlphabets(value)) {
+            callback(new Error("账号规则为6~18位数字与字母组合!"));
+          } else if (!isAlphanumeric(value)) {
+            callback(new Error("账号规则为6~18位数字与字母组合!"));
+          } else {
+            callback();
+          }
+        }
+      }
+    };
+    const validatename = (rule, value, callback) => {
+      if (value === "") {
+        callback(new Error("真实姓名不能为空!"));
+      } else {
+        if (value.length < 2 || value.length > 12) {
+          callback(new Error("真实姓名规则为2~12位汉字!"));
+        } else {
+          if (!isChinese(value)) {
+            callback(new Error("真实姓名规则为2~12位汉字!"));
+          } else if (isEmoticon(value)) {
+            callback(new Error("真实姓名规则为2~12位汉字!"));
+          } else {
+            callback();
+          }
+        }
+      }
+    };
+    const validatemobile = (rule, value, callback) => {
+      if (value === "") {
+        callback(new Error("手机号不能为空!"));
+      } else {
+        if (!isMobile(value)) {
+          callback(new Error("手机号格式不正确!"));
+        } else {
+          callback();
+        }
+      }
+    };
+
+    const validateEmail = (rule, value, callback) => {
+      if (value === "") {
+        callback();
+      } else {
+        if (!validEmail(value)) {
+          callback(new Error("邮箱格式不正确!"));
+        } else {
+          callback();
+        }
+      }
+    };
+    return {
+      roleList: [],
+      loading: false,
+      title: "添加账号",
+      organizeList: [],
+      showModelThis: this.showModel,
+      ruleForm: {
+        username: "", // 账号
+        name: "", // 真实姓名
+        mobile: "",
+        email: "",
+        role_id: "",
+        status: "1",
+        itemid: [],
+      },
+      rulesThis: this.rules,
+      rules: {
+        name: [
+          {
+            required: true,
+            validator: validatename,
+            trigger: "blur",
+          },
+        ],
+        username: [
+          {
+            required: true,
+            validator: validateusername,
+            trigger: "blur",
+          },
+        ],
+        mobile: [
+          {
+            required: true,
+            validator: validatemobile,
+            trigger: "blur",
+          },
+        ],
+        email: [
+          {
+            required: false,
+            validator: validateEmail,
+            trigger: "blur",
+          },
+        ],
+        role_id: [
+          {
+            required: true,
+            message: "请选择角色",
+            trigger: "change",
+          },
+        ],
+        itemid: [
+          {
+            type: "array",
+            required: true,
+            message: "请选择所在部门",
+            trigger: "change",
+          },
+        ],
+        status: [
+          {
+            required: true,
+            message: "请选择状态",
+            trigger: "change",
+          },
+        ],
+      },
+    };
+  },
+  watch: {
+    showModel: function (val) {
+      this.showModelThis = val;
+      if (val) {
+        this.initForm();
+      }
+    },
+    showModelThis(val) {
+      if (!val) {
+        this.$emit("cancel");
+      }
+    },
+  },
+  mounted(){},
+  methods: {
+    
+    itemidChange(e) {
+      this.ruleForm.itemid = e;
+      this.$refs.ruleForm.validateField("itemid");
+    },
+    async initForm() {
+      this.loading = true;
+      await this.getClist();
+      await this.getRole();
+      if (this.id === "add") {
+        this.title = "添加账号";
+        this.rulesThis = this.rules;
+        await this.resetForm();
+      } else {
+        if (this.isDetail) {
+          this.title = "账号详情";
+          this.rulesThis = {};
+        } else {
+          this.title = "修改账号";
+          this.rulesThis = this.rules;
+        }
+        await this.resetForm(this.sitem);
+        // await this.initData()
+      }
+      this.loading = false;
+    },
+
+    async getClist() {
+      this.organizeList = [];
+      const res = await asyncRequest.getClist({});
+      if (res && res.code === 0 && res.data) {
+        this.organizeList = res.data;
+        this.recursion(this.organizeList);
+      }
+    },
+    recursion(list) {
+      list.map((v) => {
+        if (v && Array.isArray(v.child)) {
+          v.value = v.id + "";
+          v.label = v.name;
+          if (v.child.length === 0) {
+            delete v["child"];
+          } else {
+            this.recursion(v.child);
+          }
+        }
+        return v;
+      });
+    },
+    async getRole() {
+      const model = {
+        status: "", // 状态
+        level: "", // 姓名
+        role_name: "",
+      };
+      const res = await asyncRequest.getRole(model);
+      if (res && res.code === 0 && res.data) {
+        this.roleList = res.data;
+        this.roleList.map((v1) => {
+          v1.id += "";
+          v1.status += "";
+          return v1;
+        });
+      }
+    },
+    async initData() {
+      const res = await asyncRequest.detail({ id: this.id });
+      if (res && res.code === 0 && res.data) {
+        this.ruleForm = res.data;
+        this.ruleForm.role_id = this.ruleForm.role;
+      } else if (res && res.code >= 100 && res.code <= 104) {
+        await this.logout();
+      } else {
+        this.$message.warning(res.message);
+      }
+    },
+    async resetForm(sitem) {
+      // 重置
+      await this.$nextTick(() => {
+        if (this.$refs.ruleForm) {
+          this.$refs.ruleForm.resetFields();
+          this.$refs.ruleForm.clearValidate();
+          const {
+            username,
+            nickname,
+            mobile,
+            email,
+            roleid,
+            status,
+            depart_code,
+          } = sitem;
+          this.ruleForm = {
+            username: username || "", // 账号
+            name: nickname || "", // 真实姓名
+            mobile: mobile || "",
+            email: email || "",
+            role_id: roleid || "",
+            status: status || "",
+            itemid: depart_code || [],
+          };
+          // console.log(depart_code);
+          // if (this.id === "add" || this.isDetail) {
+          //   this.rules.username[0].required = false;
+          // }
+        }
+      });
+    },
+    async submitForm() {
+      await this.$refs.ruleForm.validate(async (valid) => {
+        if (valid) {
+          this.loading = true;
+          const { username, name, mobile, email, role_id, status, itemid } =
+            JSON.parse(JSON.stringify(this.ruleForm));
+          const model = {
+            id: this.id,
+            username: username || "", // 账号
+            nickname: name || "", // 真实姓名
+            mobile: mobile || "",
+            email: email || "",
+            role: role_id || "",
+            status: status || "",
+            itemid: itemid || [],
+          };
+          let res = {};
+          if (this.id === "add") {
+            delete model["id"];
+            res = await asyncRequest.add(model);
+          } else {
+            res = await asyncRequest.update(model);
+          }
+          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);
+          }
+        } else {
+          console.log("error submit!!");
+          return false;
+        }
+      });
+    },
+  },
+};
+</script>
+
+   <style lang="scss" scoped>
+.account {
+}
+</style>

+ 6 - 2
src/views/sellOut/zixunOrder/components/feedbackList.vue

@@ -72,7 +72,7 @@
               "
             ></i>
           </el-tooltip>
-               <el-tooltip
+          <el-tooltip
             v-if="powers.some((item) => item == '007')"
             effect="dark"
             content="发起议价流程"
@@ -80,7 +80,7 @@
           >
             <i
               class="el-icon-s-flag tb-icon"
-              @click=" "
+              @click="wantBargaining(scope.row)"
             ></i>
           </el-tooltip>
         </template>
@@ -98,11 +98,15 @@ import statusList from "@/assets/js/statusList";
 import asyncRequest from "@/apis/service/sellOut/zixunOrder";
 import { feedbackListCol } from "../columns";
 import { mapGetters } from "vuex";
+import addEditBargain from "./addEditBargain";
 
 export default {
   name: "zixunOrder",
   mixins: [mixinPage, resToken],
   props: ["id", "newTime"],
+  components: {
+    addEditBargain,
+  },
   computed: {
     ...mapGetters(["tablebtnSize", "searchSize", "size"]),
     powers() {