Browse Source

feat:区域、供应商端招标工作台修改

snow 1 year ago
parent
commit
28fe105198

+ 25 - 27
src/apis/service/serviceParam/business/index.js

@@ -1,30 +1,28 @@
 // 企业客户/供应商账号相关
-import http from "@/apis/axios";
-const api = "admin/";
+import http from '@/apis/axios'
+const api = 'admin/'
 export default {
-    // 列表
-    list: (data, params) => http(api + "customerlist", data, "post", params),
-    // 组织新建
-    zadd: (data, params) => http(api + "customercreate", data, "post", params),
-    // 组织详情
-    zdetail: (data, params) => http(api + "customerselect", data, "post", params),
-    // 组织更新
-    zupdate: (data, params) => http(api + "customerupdate", data, "post", params),
-    // 组织删除
-    zdelete: (data, params) => http(api + "customerdelect", data, "post", params),
-    // 组织状态
-    zstatus: (data, params) => http(api + "customerstatus", data, "post", params),
+  // 列表
+  list: (data, params) => http(api + 'customerlist', data, 'post', params),
+  // 组织新建
+  zadd: (data, params) => http(api + 'customercreate', data, 'post', params),
+  // 组织详情
+  zdetail: (data, params) => http(api + 'customerselect', data, 'post', params),
+  // 组织更新
+  zupdate: (data, params) => http(api + 'customerupdate', data, 'post', params),
+  // 组织删除
+  zdelete: (data, params) => http(api + 'customerdelect', data, 'post', params),
+  // 组织状态
+  zstatus: (data, params) => http(api + 'customerstatus', data, 'post', params),
+  // 企业新建
+  qadd: (data, params) => http(api + 'customarcreate', data, 'post', params),
+  // 企业更新
+  qupdate: (data, params) => http(api + 'customaredit', data, 'post', params),
+  // 企业详情
+  qdetail: (data, params) => http(api + 'customarinfo', data, 'post', params),
+  // 企业删除
+  qdelete: (data, params) => http(api + 'customardelete', data, 'post', params),
+  // 企业状态
+  qstatus: (data, params) => http(api + 'customarstatus', data, 'post', params)
 
-
-    // 企业新建
-    qadd: (data, params) => http(api + "customarcreate", data, "post", params),
-    // 企业更新
-    qupdate: (data, params) => http(api + "customaredit", data, "post", params),
-    // 企业详情
-    qdetail: (data, params) => http(api + "customarinfo", data, "post", params),
-    // 企业删除
-    qdelete: (data, params) => http(api + "customardelete", data, "post", params),
-    // 企业状态
-    qstatus: (data, params) => http(api + "customarstatus", data, "post", params),
-
-};
+}

+ 16 - 11
src/components/globalComponents/search-area/main.vue

@@ -30,7 +30,7 @@ import resToken from "@/mixins/resToken";
 export default {
   name: "SearchArea",
   mixins: [resToken],
-  props: ["size", "value", "placeholder", "isDetail", "disabled", "names", "level"],
+  props: ["size", "value", "placeholder", "isDetail", "disabled", "names", "level",'detailSelect'],
   /**
    * 属性集合
    * @param {String}        size             : 组件大小            非必填
@@ -58,12 +58,15 @@ export default {
     };
   },
   watch: {
-    names: function (val, old) {
+    names: {
+      handler:function (val, old) {
       // console.log(val, old, this.isDetail, "1");
-      this.searchName = val;
-      if (this.isDetail && this.searchName) {
-        this.remoteMethod(this.searchName);
-      }
+        this.searchName = val;
+        if (this.isDetail && (Array.isArray(this.searchName) && this.searchName[0])) {
+          this.remoteMethod(Array.isArray(this.searchName) ? this.searchName[0] : this.searchName,true);
+        }
+      },
+      immediate:true
     },
   },
   mounted() {
@@ -73,11 +76,9 @@ export default {
   },
   methods: {
     async selectChange(e) {
-      // console.log(e);
+      console.log(e)
       if (e && e.length > 0) {
         const index = this.options.findIndex((v) => v.code + "" === e[0] + "");
-
-        // console.log(index);
         if (index !== -1) {
           const { code, search_name, info } = this.options[index];
           const { province, city, area } = info;
@@ -110,15 +111,19 @@ export default {
         this.$emit("searchChange", {});
       }
     },
-    async remoteMethod(query) {
+    async remoteMethod(query,formDetail = false) {
       this.selectLoading = true;
       if (query !== "") {
         this.options = [];
         this.formValue.name = query;
-        const { code, data, message } = await asyncRequest.list(this.formValue);
+        const { code, data, message } = await asyncRequest.list({
+          ...this.formValue,
+          level:this.level
+        });
 
         if (code === 0) {
           this.options = data;
+          if(this.detailSelect && formDetail && data.length > 0){ this.selectChange([data[0].code])}
         } else if (code >= 100 && code <= 104) {
           await this.logout();
         } else {

+ 2 - 0
src/components/globalComponents/search-customer/main.vue

@@ -69,8 +69,10 @@ export default {
     async selectChange(e) {
       if (e && e.length > 0) {
         const index = this.options.findIndex((v) => v.companyNo === e[0])
+        console.log(this.options[0])
         if (index !== -1) {
           const model = {
+            area: this.options[index].area,
             id: this.options[index].id,
             code: this.options[index].companyNo,
             label: this.options[index].companyName

+ 7 - 7
src/views/netOrderEntry/prestoreRecordingOrders/template.js

@@ -16,7 +16,7 @@ const mapTemplateToTable = {
   '采购单价': 'cgd_price',
   '采购总额': 'cgd_total',
   '采购毛利率': 'cgd_tax',
-  'PO编号': 'poCode',
+  '平台订单号': 'poCode',
   '收货人': 'contactor',
   '联系电话': 'mobile',
   '联系地址': 'addr',
@@ -53,7 +53,7 @@ export const PROPERTYS = {
   MOBILE: getTableProperty('联系电话'),
   ADDR: getTableProperty('联系地址'),
   SEND_TIME: getTableProperty('发货时间'),
-  PO_CODE: getTableProperty('PO编号'),
+  PO_CODE: getTableProperty('平台订单号'),
   CGD_TOTAL: getTableProperty('采购总额'),
   WORK_CODE: getTableProperty('单据号')
 }
@@ -76,7 +76,7 @@ export const template = [
     '采购单价': '30.00',
     '采购总额': '3000',
     '采购毛利率': '6',
-    'PO编号': 'PO206020230400240002',
+    '平台订单号': 'PO206020230400240002',
     '收货人': '张三',
     '联系电话': '19955554444',
     '联系地址': 'xx市xx区xx街道',
@@ -187,7 +187,7 @@ export const columns = [
   },
   {
     prop: PROPERTYS.PO_CODE,
-    label: 'PO编号',
+    label: '平台订单号',
     'width': '150px',
     required: true
   },
@@ -302,15 +302,15 @@ export const intNumberFields = [
 ]
 
 export const helper = {
-  fields(sourceObject) {
+  fields: function(sourceObject) {
     return Object.keys(sourceObject)
   },
-  values(sourceObject, fields, index = 0) {
+  values: function(sourceObject, fields, index = 0) {
     return fields.map(field => {
       return sourceObject[field][index]
     })
   },
-  write(sourceObject, fields) {
+  write: function(sourceObject, fields) {
     return fields.reduce((prev, currentKey) => ({
       ...prev,
       [currentKey]: sourceObject[currentKey]

+ 7 - 0
src/views/sellOut/zixunOrder/columns.js

@@ -250,6 +250,13 @@ const rules = {
   ]
 }
 const edutRules = {
+  area: [
+    {
+      required: true,
+      message: '请选择收货区域',
+      trigger: 'blur'
+    }
+  ],
   companyNo: [
     {
       required: true,

+ 44 - 3
src/views/sellOut/zixunOrder/components/addEditForm.vue

@@ -154,6 +154,23 @@
           </el-table>
         </el-form-item>
       </el-col>
+
+      <el-col :span="24">
+        <el-form-item label="收货区域" prop="area">
+            <search-area
+              :value="areaCode"
+              :disabled="isDetail == '007' || !ruleForm.customer_name"
+              :size="'mini'"
+              :is-detail="true"
+              :detail-select="true"
+              :level="2"
+              :names="areaLabel"
+              :placeholder="'收货区域'"
+              @searchChange="areasearchChange"
+            />
+        </el-form-item>
+      </el-col>
+
       <el-col :span="24">
         <el-form-item label="竞价商品要求" class="clear" required>
           <el-table :data="tableData" stripe border :size="'mini'" style="width: 100%">
@@ -328,6 +345,8 @@ export default {
   },
   data() {
     return {
+      areaCode:[],
+      areaLabel:[],
       showProjectModel: false,
       multipleSelection: [],
       fnewTime: "",
@@ -367,6 +386,7 @@ export default {
         use_desc: "",
         budget_total: "",
         arrtime: "",
+        area:[]
       },
       rulesThis: this.rules,
       projectColumns,
@@ -380,6 +400,13 @@ export default {
             trigger: "change",
           },
         ],
+        area:[
+          {
+            required:true,
+            message:'请选择收货区域',
+            trigger:'blur'
+          }
+        ],
         khNo: [
           {
             type: "array",
@@ -443,6 +470,12 @@ export default {
         this.initForm();
       }
     },
+    'ruleForm.khNo'(value){
+      if(Array.isArray(value) && value.length > 0) return
+        this.areaCode = []
+        this.areaLabel = []
+        this.ruleForm.area = ""
+    }
   },
   methods: {
     onCompanyChange(){ //MARK
@@ -513,7 +546,6 @@ export default {
       this.multipleSelection = val;
     },
     editGoodRefresh(e) {
-      console.log(e);
       const { index } = e;
       if (index + "" === "-1") {
         this.tableData.push(JSON.parse(JSON.stringify(e)));
@@ -561,6 +593,7 @@ export default {
             budget_total: "",
             arrtime: "",
             pay_id: pay_id || "",
+            area:""
           };
           this.tableData =
             ladder && ladder.length > 0 ? JSON.parse(JSON.stringify(ladder)) : [];
@@ -572,6 +605,12 @@ export default {
         }
       });
     },
+    areasearchChange(e) {
+      const { id, label } = e
+      this.areaCode = e && id ? [id] : []
+      this.ruleForm.area = label
+      this.$refs.ruleForm.validateField('area')
+    },
     async submitForm() {
       await this.$refs.ruleForm.validate(async (valid) => {
         if (valid) {
@@ -602,6 +641,7 @@ export default {
           model.projectNo = model.projectNo.toString();
           model.ladder = [];
           model.companyNo = this.currentCompany
+          model.area = Array.isArray(model.area) ? model.area[0] : model.area
           
           let list = JSON.parse(JSON.stringify(this.tableData));
           list.forEach((e) => {
@@ -640,7 +680,6 @@ export default {
             model.ladder.push(im);
           });
 
-          console.log(model);
           const { code, data, message } = await asyncRequest.add(model);
           this.loading = false;
           if (code === 0) {
@@ -789,9 +828,11 @@ export default {
     },
     //购买方公司选择
     customerChange(e) {
-      const { id, code, label } = e;
+      const { id, code, label ,area} = e;
+      console.log(`method:customerChange - ${area}`)
       this.ruleForm.khNo = code ? [code] : [];
       this.ruleForm.customer_name = label ? label : "";
+      this.areaLabel = area && area !== '不限区域' ? [area] : []
       this.$refs.ruleForm.validateField("khNo");
     },
     getNewTime() {

+ 41 - 6
src/views/sellOut/zixunOrder/components/editForm.vue

@@ -97,6 +97,22 @@
           />
         </el-form-item>
       </el-col>
+      <el-col :span="24">
+        <el-form-item label="收货区域" prop="area">
+            <search-area
+              :value="areaCode"
+              :is-detail="type === 'view' || type === 'edit' || type === 'copy-edit'"
+              :disabled="type === 'view' || type === 'edit'"
+              :size="'mini'"
+              :detail-select="true"
+              :level="2"
+              :names="areaLabel"
+              :placeholder="'收货区域'"
+              @searchChange="areasearchChange"
+            />
+        </el-form-item>
+      </el-col>
+
       <el-col :span="24" v-show="ruleForm.is_project === '1'">
         <el-form-item label="项目信息" prop="projectNo" class="clear">
           <show-data-table
@@ -203,7 +219,8 @@
               </el-select>
             </el-form-item>
           </el-col>
-          <el-col :span="6">
+
+          <el-col :span="6" style="margin-bottom:1px">
             <el-form-item label="预算单价" prop="budget_price">
               <digital-input
                 :values="ruleForm.budget_price"
@@ -222,7 +239,7 @@
               />
             </el-form-item>
           </el-col>
-          <el-col :span="4">
+          <el-col :span="4" style="margin-bottom:1px">
             <el-form-item label="数量" prop="num" label-width="60px">
               <digital-input
                 :values="ruleForm.num"
@@ -242,7 +259,7 @@
             </el-form-item>
           </el-col>
 
-          <el-col :span="8">
+            <el-col :span="8">
             <el-form-item label="品牌" prop="brand_id">
               <search-brand
                 :value="ruleForm.brand_id"
@@ -303,6 +320,7 @@
               />
             </el-form-item>
           </el-col>
+
           <el-col :span="12">
             <el-form-item label="商品分类" prop="cat_id">
               <search-sort
@@ -634,6 +652,8 @@ export default {
   },
   data() {
     return {
+      areaCode:[],
+      areaLabel:[],
       od_form: null,
       projectColumns,
       companyName:'',
@@ -731,6 +751,7 @@ export default {
         remark: "",
         metal_id: "",
         gold_price: "",
+        area:""
       },
       rulesThis: this.rules,
       // 验证规则
@@ -786,6 +807,12 @@ export default {
       this.ruleForm[key] = e + "" || "0";
       this.$refs.ruleForm.validateField(key);
     },
+    areasearchChange(e) {
+      const { id, label } = e
+      this.areaCode = e && id ? [id] : []
+      this.ruleForm.area = label
+      this.$refs.ruleForm.validateField('area')
+    },
     sch_is_noble() {
       this.rulesThis["projectNo"][0].required = this.ruleForm.is_project === "1";
       this.$refs.ruleForm.validateField("projectNo");
@@ -865,7 +892,8 @@ export default {
             p_good_img,
             p_arrtime,
             specinfo,
-            enclosure_file
+            enclosure_file,
+            area
           } = JSON.parse(JSON.stringify(this.sitem));
 
           this.unit_name = unit_name;
@@ -899,7 +927,7 @@ export default {
             is_project: is_project || "0", //竞价类型 1销售2竞价,
             projectNo: projectNo || "", //项目编号
             khNo: khNo ? [khNo] : [], //客户编号
-            khname: khname || "", //客户名称
+            khname: khname ? [khname] : [], //客户名称
             companyNo: companyNo || this.business_companyNo || "",
             endtime: endtime || "", //竞价截止时间
             platform_code: platform_code || "", //平台id
@@ -938,7 +966,11 @@ export default {
             gold_price: gold_price || "",
             unit: unit ? [unit] : [],
             enclosure_file: enclosure_file || "",
+            area
           };
+
+          this.areaLabel = area ? [area] : []
+
           // console.log(this.ruleForm)
           this.pay_name = pay_id + "" == "0" ? "不选择" : pay_name;
           if (this.ruleForm.projectNo) {
@@ -1157,6 +1189,7 @@ export default {
             };
             model.specinfo.push(am);
           });
+
           delete model["pendtime"];
           delete model["arrtime"];
           delete model["puse_desc"];
@@ -1181,6 +1214,7 @@ export default {
             model['ladder'][0] = ladderItem
           }
 
+          model.area = this.ruleForm.area
           const res = await api(model)
           this.loading = false;
           if (res && res.code === 0) {
@@ -1234,9 +1268,10 @@ export default {
     },
     //购买方公司选择
     customerChange(e) {
-      const { id, code, label } = e;
+      const { id, code, label, area } = e;
       this.ruleForm.khNo = code ? [code] : [];
       this.ruleForm.customer_name = label ? label : "";
+      this.areaLabel = area && area !== '不限区域' ? [area] : []
       this.$refs.ruleForm.validateField("khNo");
     },
     //贵金属种类选择

+ 229 - 199
src/views/serviceParam/business/addEdit.vue

@@ -57,24 +57,26 @@
                     :disabled="isDetail == '007'"
                     placeholder="组织名称"
                     maxlength="50"
-                    ><template v-if="organName" slot="prepend">{{
-                      organName
-                    }}</template></el-input
-                  >
+                  ><template v-if="organName" slot="prepend">{{
+                    organName
+                  }}</template></el-input>
                 </el-form-item>
               </el-col>
               <el-col v-if="ruleForm.region === '1'" :span="16">
                 <el-form-item label="企业所在区域:" label-width="130px" prop="code">
-                  <search-area
-                    :value="ruleForm.code"
-                    :disabled="isDetail == '007'"
-                    :size="'mini'"
-                    :isDetail="true"
-                    :level="2"
-                    :names="ruleForm.area"
-                    :placeholder="'企业所在区域'"
-                    @searchChange="areasearchChange"
-                  />
+                  <div style="display:flex;">
+                    <el-radio v-model="area" label="0" @change="handleFreedomAreaChange">不限</el-radio>
+                    <search-area
+                      :value="ruleForm.code"
+                      :disabled="isDetail == '007'"
+                      :size="'mini'"
+                      :is-detail="true"
+                      :level="2"
+                      :names="ruleForm.area"
+                      :placeholder="'企业所在区域'"
+                      @searchChange="areasearchChange"
+                    />
+                  </div>
                 </el-form-item>
               </el-col>
               <el-col v-if="ruleForm.region === '1'" :span="24">
@@ -84,10 +86,9 @@
                     :disabled="isDetail == '007'"
                     placeholder="企业名称"
                     maxlength="50"
-                    ><template v-if="organName" slot="prepend">{{
-                      organName
-                    }}</template></el-input
-                  >
+                  ><template v-if="organName" slot="prepend">{{
+                    organName
+                  }}</template></el-input>
                 </el-form-item>
               </el-col>
               <el-col
@@ -161,11 +162,11 @@
               </el-col>
               <el-col :span="24" style="text-align: right">
                 <el-button
-                  size="mini"
                   v-if="isDetail !== '007'"
+                  size="mini"
                   type="primary"
                   @click="submitForm"
-                  >保 存
+                >保 存
                 </el-button>
                 <el-button size="mini" @click="showModelThis = false">{{
                   isDetail == "007" ? "关 闭" : "取 消"
@@ -179,182 +180,209 @@
   </el-dialog>
 </template>
 <script>
-import resToken from "@/mixins/resToken";
-import asyncRequest from "@/apis/service/serviceParam/business";
-import contactModal from "./contactModal";
+import resToken from '@/mixins/resToken'
+import asyncRequest from '@/apis/service/serviceParam/business'
+import contactModal from './contactModal'
 export default {
-  name: "GoodsBack",
+  name: 'GoodsBack',
   components: {
-    contactModal,
+    contactModal
   },
   mixins: [resToken],
-  props: ["showModel", "isDetail", "id", "organ", "kh"],
+  props: ['showModel', 'isDetail', 'id', 'organ', 'kh'],
   data() {
+    const validator = function(rule, value, callback) {
+      const isValueValid = Array.isArray(value) && value.length > 0
+      if (!isValueValid && this.area !== '0') {
+        callback(new Error('企业所在区域不能为空'))
+      } else {
+        callback()
+      }
+    }
+
     return {
+      area: '',
       findex: -1,
       sitem: null,
       editModel: false,
       loading: false,
-      title: "添加企业/组织",
+      title: '添加企业/组织',
       showModelThis: this.showModel,
       ruleForm: {},
       rulesThis: this.rules,
-      organName: "",
+      organName: '',
       tableData: [],
       old_tableData: [],
       rules: {
         region: [
           {
             required: true,
-            message: "请选择组织/企业",
-            trigger: "change",
-          },
+            message: '请选择组织/企业',
+            trigger: 'change'
+          }
         ],
         code: [
           {
             required: true,
-            message: "企业所在区域不能为空",
-            trigger: "blur",
-          },
+            message: '企业所在区域不能为空',
+            trigger: 'blur',
+            validator: validator.bind(this)
+          }
         ],
         name: [
           {
             required: true,
-            message: "组织名称不能为空",
-            trigger: "blur",
-          },
+            message: '组织名称不能为空',
+            trigger: 'blur'
+          }
         ],
         companyName: [
           {
             required: false,
-            message: "企业名称不能为空",
-            trigger: "blur",
-          },
-        ],
-      },
-    };
+            message: '企业名称不能为空',
+            trigger: 'blur'
+          }
+        ]
+      }
+    }
   },
   watch: {
-    showModel: function (val) {
-      this.showModelThis = val;
+    showModel: function(val) {
+      this.showModelThis = val
       if (val) {
-        this.initForm();
+        this.initForm()
       }
     },
     showModelThis(val) {
       if (!val) {
-        this.$emit("cancel");
+        this.$emit('cancel')
       }
     },
+    area(val) {
+      if (val) this.ruleForm.code = ''
+    },
+    'ruleForm.code': {
+      handler(val) {
+        if (val) this.area = ''
+      },
+      deep: true
+    }
   },
   methods: {
+    handleFreedomAreaChange() {
+      this.$nextTick(() => this.$refs.ruleForm.validateField('code'))
+    },
     async initForm() {
-      this.loading = true;
-      this.tableData = [];
-      this.old_tableData = [];
-      this.organName = "";
-      await this.resetForm();
-      if (this.isDetail === "003") {
-        this.title = "添加企业/组织";
-        this.rulesThis = this.rules;
-      } else if (this.isDetail === "005") {
-        this.title = "修改企业/组织";
-        this.rulesThis = this.rules;
-        await this.initData();
+      this.loading = true
+      this.tableData = []
+      this.old_tableData = []
+      this.organName = ''
+      await this.resetForm()
+      if (this.isDetail === '003') {
+        this.title = '添加企业/组织'
+        this.rulesThis = this.rules
+      } else if (this.isDetail === '005') {
+        this.title = '修改企业/组织'
+        this.rulesThis = this.rules
+        await this.initData()
       } else {
-        this.title = "查看企业/组织";
-        this.rulesThis = {};
-        await this.initData();
+        this.title = '查看企业/组织'
+        this.rulesThis = {}
+        await this.initData()
       }
-      this.setOrganName();
-      this.loading = false;
+      this.setOrganName()
+      this.loading = false
     },
     setOrganName() {
-      this.organName = "";
+      this.organName = ''
       if (this.organ && this.organ.length > 1) {
         this.organ.forEach((e) => {
-          if (e.id !== "0") {
-            console.log(e.name);
-            this.organName += e.name;
-            this.ruleForm.pid = e.id;
+          if (e.id !== '0') {
+            this.organName += e.name
+            this.ruleForm.pid = e.id
           }
-        });
+        })
       } else {
-        this.organName = "";
+        this.organName = ''
       }
-      const { companyName } = this.ruleForm;
-      const isok = companyName.indexOf(this.organName) == 0;
+      const { companyName } = this.ruleForm
+      const isok = companyName.indexOf(this.organName) == 0
       if (isok) {
-        const str = companyName;
+        const str = companyName
         this.ruleForm.companyName = str.substring(
           this.organName.length,
           this.ruleForm.companyName.length
-        );
+        )
       }
-      console.log(isok);
     },
     openEdit(index, sitem) {
-      this.findex = index;
-      this.sitem = sitem;
-      this.editModel = true;
+      this.findex = index
+      this.sitem = sitem
+      this.editModel = true
     },
     openDelete(index) {
-      this.tableData.splice(index, 1);
+      this.tableData.splice(index, 1)
     },
     async resetForm() {
       await this.$nextTick(() => {
         if (this.$refs.ruleForm) {
-          this.$refs.ruleForm.resetFields();
-          this.$refs.ruleForm.clearValidate();
+          this.$refs.ruleForm.resetFields()
+          this.$refs.ruleForm.clearValidate()
           this.ruleForm = {
-            id: "",
-            pid: "0",
-            region: "0",
-            name: "",
-            companyName: "",
+            id: '',
+            pid: '0',
+            region: '0',
+            name: '',
+            companyName: '',
             code: [],
-            area: "",
-          };
+            area: ''
+          }
         }
-      });
+      })
     },
     async initData() {
-      console.log(this.kh, this.id);
-      let res = {};
-      if (this.kh + "" === "0") {
-        res = await asyncRequest.zdetail({ id: this.id });
+      let res = {}
+      if (this.kh + '' === '0') {
+        res = await asyncRequest.zdetail({ id: this.id })
       } else {
-        res = await asyncRequest.qdetail({ companyNo: this.id });
+        res = await asyncRequest.qdetail({ companyNo: this.id })
       }
-      const { code, data, message } = res;
+      const { code, data, message } = res
       if (code === 0) {
-        const { pid, name, pname, companyName, parent, member, id } = data;
-        console.log(data);
-        this.organName = pname;
+        const { pid, name, pname, companyName, parent, member, id, middle, branch, area } = data
+        this.organName = pname
+
+        const isFreedom = String(middle) === '0' && String(branch) === '0' && String(area) === '不限区域'
+        // console.log(middle, branch, area, isFreedom)
+        if (isFreedom) this.area = '0'
+
         this.ruleForm = {
           id: id,
-          region: this.kh + "" || "0",
-          pid: parent || pid || "0",
-          name: name || "",
-          companyName: companyName || "",
-        };
+          region: this.kh + '' || '0',
+          pid: parent || pid || '0',
+          name: name || '',
+          companyName: companyName || '',
+          code: isFreedom || !middle ? [] : [middle],
+          area: area ? [area] : []
+        }
+
         if (member && member.length > 0) {
-          this.old_tableData = JSON.parse(JSON.stringify(member));
-          this.tableData = JSON.parse(JSON.stringify(member));
+          this.old_tableData = JSON.parse(JSON.stringify(member))
+          this.tableData = JSON.parse(JSON.stringify(member))
         } else {
-          this.old_tableData = [];
-          this.tableData = [];
+          this.old_tableData = []
+          this.tableData = []
         }
-        this.$refs.ruleForm.resetFields();
-        this.$refs.ruleForm.clearValidate();
+        this.$refs.ruleForm.resetFields()
+        this.$refs.ruleForm.clearValidate()
       } else if (code >= 100 && code <= 104) {
-        await this.logout();
+        await this.logout()
       } else {
-        this.$message.warning(message);
+        this.$message.warning(message)
       }
     },
     contactRefresh(e) {
-      this.editModel = false;
+      this.editModel = false
       const {
         index,
         contactor,
@@ -365,126 +393,128 @@ export default {
         qqaccount,
         email,
         id,
-        is_del,
-      } = e;
-      if (index + "" === "-1") {
-        this.tableData.push(e);
+        is_del
+      } = e
+      if (index + '' === '-1') {
+        this.tableData.push(e)
       } else {
-        const findex = parseInt(index);
-        this.tableData[findex].contactor = contactor || "";
-        this.tableData[findex].commobile = commobile || "";
-        this.tableData[findex].position = position || "";
-        this.tableData[findex].comdepart = comdepart || "";
-        this.tableData[findex].wxaccount = wxaccount || "";
-        this.tableData[findex].qqaccount = qqaccount || "";
-        this.tableData[findex].email = email || "";
-        this.tableData[findex].id = id || "";
-        this.tableData[findex].is_del = is_del || "0";
+        const findex = parseInt(index)
+        this.tableData[findex].contactor = contactor || ''
+        this.tableData[findex].commobile = commobile || ''
+        this.tableData[findex].position = position || ''
+        this.tableData[findex].comdepart = comdepart || ''
+        this.tableData[findex].wxaccount = wxaccount || ''
+        this.tableData[findex].qqaccount = qqaccount || ''
+        this.tableData[findex].email = email || ''
+        this.tableData[findex].id = id || ''
+        this.tableData[findex].is_del = is_del || '0'
       }
     },
     areasearchChange(e) {
-      console.log(e);
-      const { id, city_code, province_code, label } = e;
-      this.ruleForm.code = e && id ? [id] : [];
-      this.ruleForm.area = e && id ? label : "";
-      this.ruleForm.branch = e && id ? province_code : "";
-      this.ruleForm.middle = e && id ? city_code : "";
-      this.$refs.ruleForm.validateField("code");
+      const { id, city_code, province_code, label } = e
+      this.ruleForm.code = e && id ? [id] : []
+      this.ruleForm.area = e && id ? label : ''
+      this.ruleForm.branch = e && id ? province_code : ''
+      this.ruleForm.middle = e && id ? city_code : ''
+      console.log(label, '--------')
+      this.$refs.ruleForm.validateField('code')
     },
     async submitForm() {
-      await this.$refs.ruleForm.validate(async (valid) => {
+      await this.$refs.ruleForm.validate(async(valid) => {
         if (valid) {
           if (this.loading) {
-            return;
+            return
           }
-          this.loading = true;
-          const { id, pid, name, companyName, code: area_code, area } = this.ruleForm;
-          let res = {};
-          if (this.ruleForm.region === "0") {
+          this.loading = true
+          const { id, pid, name, companyName, code: area_code, area } = this.ruleForm
+          let res = {}
+          if (this.ruleForm.region === '0') {
             const zitem = {
               id: id,
               pid: pid,
-              name: name,
-            };
-            if (this.isDetail === "003") {
-              delete zitem["id"];
-              res = await asyncRequest.zadd(zitem);
+              name: name
+            }
+            if (this.isDetail === '003') {
+              delete zitem['id']
+              res = await asyncRequest.zadd(zitem)
             } else {
-              res = await asyncRequest.zupdate(zitem);
+              res = await asyncRequest.zupdate(zitem)
             }
           } else {
             if (this.tableData.length === 0) {
-              this.$message.warning("至少填写一个联系人!");
-              this.loading = false;
-              return;
+              this.$message.warning('至少填写一个联系人!')
+              this.loading = false
+              return
             }
             const qitem = {
               id: id,
               companyName: this.organName + companyName,
               parent: pid,
-              branch: area_code,
-              middle: area_code,
-              area: area,
-              customer_member: this.getCustomer(),
-            };
-
-            if (this.isDetail === "003") {
-              delete qitem["id"];
-              res = await asyncRequest.qadd(qitem);
+              branch: this.area === '0' ? '0' : area_code[0],
+              middle: this.area === '0' ? '0' : area_code[0],
+              area: this.area === '0' ? '不限区域' : area,
+              customer_member: this.getCustomer()
+            }
+            // console.log(qitem)
+            // this.loading = false
+            // return
+            if (this.isDetail === '003') {
+              delete qitem['id']
+              res = await asyncRequest.qadd(qitem)
             } else {
-              res = await asyncRequest.qupdate(qitem);
+              res = await asyncRequest.qupdate(qitem)
             }
           }
-          this.loading = false;
-          const { code, data, message } = res;
+          this.loading = false
+          const { code, data, message } = res
           if (code === 0) {
-            const title = this.isDetail === "003" ? "添加成功!" : "修改成功!";
+            const title = this.isDetail === '003' ? '添加成功!' : '修改成功!'
             this.$notify.success({
               title,
-              message: "",
-            });
-            this.showModelThis = false;
+              message: ''
+            })
+            this.showModelThis = false
             // 刷新
-            this.$emit("refresh");
+            this.$emit('refresh')
           } else if (code >= 100 && code <= 104) {
-            await this.logout();
+            await this.logout()
           } else {
-            this.$message.warning(message);
+            this.$message.warning(message)
           }
         } else {
-          console.log("error submit!!");
-          return false;
+          console.log('error submit!!')
+          return false
         }
-      });
+      })
     },
     getCustomer() {
-      const list = JSON.parse(JSON.stringify(this.tableData));
-      const oldlist = JSON.parse(JSON.stringify(this.old_tableData));
-      const hasIDlist = [];
+      const list = JSON.parse(JSON.stringify(this.tableData))
+      const oldlist = JSON.parse(JSON.stringify(this.old_tableData))
+      const hasIDlist = []
       list.forEach((a) => {
-        if (a.id !== "") {
-          hasIDlist.push(a);
+        if (a.id !== '') {
+          hasIDlist.push(a)
         }
-      });
-      const newList = [];
-      const resList = [];
+      })
+      const newList = []
+      const resList = []
       oldlist.forEach((a, ai) => {
-        let item = null;
-        const index = hasIDlist.findIndex((b) => a.id + "" === b.id + "");
+        let item = null
+        const index = hasIDlist.findIndex((b) => a.id + '' === b.id + '')
         if (index === -1) {
-          item = JSON.parse(JSON.stringify(a));
-          item.is_del = "1";
+          item = JSON.parse(JSON.stringify(a))
+          item.is_del = '1'
         } else {
-          item = JSON.parse(JSON.stringify(hasIDlist[index]));
+          item = JSON.parse(JSON.stringify(hasIDlist[index]))
         }
-        newList.push(item);
-      });
+        newList.push(item)
+      })
       list.forEach((b) => {
-        if (b.id === "") {
-          b.is_del = "0";
-          newList.push(b);
+        if (b.id === '') {
+          b.is_del = '0'
+          newList.push(b)
         }
-      });
+      })
       newList.forEach((a) => {
         const m = {
           id: a.id,
@@ -495,16 +525,16 @@ export default {
           wxaccount: a.wxaccount,
           qqaccount: a.qqaccount,
           email: a.email,
-          is_del: a.is_del || "0",
-          status: a.status || "1",
-        };
-        resList.push(m);
-      });
+          is_del: a.is_del || '0',
+          status: a.status || '1'
+        }
+        resList.push(m)
+      })
 
-      return resList;
-    },
-  },
-};
+      return resList
+    }
+  }
+}
 </script>
 
 <style lang="scss" scoped>

+ 1 - 2
src/views/supplierPurchaseIn/supplierWorkbench/components/baseForm.vue

@@ -14,8 +14,7 @@
         <span>
           预计成本合计:<span>
             {{ newPrice }}
-          </span></span
-        >
+          </span></span>
         <span class="fl" style="height: 28px; font-size: 16px; line-height: 28px">{{
           title
         }}</span>

+ 163 - 87
src/views/supplierPurchaseIn/supplierWorkbench/detail.vue

@@ -10,104 +10,169 @@
             <div class="left-card" v-if="sitem">
               <div class="page-main-title">招标任务信息</div>
               <ul class="page-main-ul clear">
-                <li>任务单号:</li>
-                <li>{{ queryId }}</li>
-                <li>截止时间:</li>
-                <li>{{ sitem.endtime }}</li>
+                <li>
+                  <p>任务单号:</p>
+                  <p>{{ queryId }}</p>
+                </li>
+
+                <li>
+                    <p>截止时间:</p>
+                   <p>{{ sitem.endtime }}</p>
+                </li>
                 <!-- <li>剩余时间:</li>
                 <li>2020-09-20 17:00:00</li> -->
-                <li>购买数量:</li>
-                <li>{{ sitem.num }}{{ sitem.unit_name }}</li>
-                <li>预算单价:</li>
-                <li>{{ sitem.original_price }}元</li>
-                <li>竞价人:</li>
-                <li>{{ sitem.salesman }}</li>
-                <li>到货时间:</li>
-                <li>{{ sitem.arrival_time }}</li>
-                <li>公司编号:</li>
-                <li>{{ sitem.companyNo }}</li>
-                <li>公司编码:</li>
-                <li>{{ sitem.company }}</li>
-                <li>客户名称:</li>
-                <li>{{ sitem.khname }}</li>
-                <li>所属平台:</li>
-                <li>{{ sitem.platform_name }}</li>
+                <li>
+                  <p>购买数量:</p>
+                   <p>{{ sitem.num }}{{ sitem.unit_name }}</p>
+                </li>
+                <li>
+                  <p>预算单价:</p>
+                  <p>{{ sitem.original_price }}元</p>
+                </li>
+                <li>
+                  <p>竞价人:</p>
+                  <p>{{ sitem.salesman }}</p>
+                </li>
+                <li>
+                  <p>到货时间:</p>
+                   <p>{{ sitem.arrival_time }}</p>
+                </li>
+                
+                <li>
+                  <p>公司编号:</p>
+                  <p>{{ sitem.companyNo }}</p>
+                </li>
+
+                <li>
+                  <p>公司名称:</p>
+                  <p>{{ sitem.company }}</p>
+                </li>
+                <li>
+                  <p>客户收货地址:</p>
+                  <p>{{ sitem.area }}</p>
+                </li>
+                <li>
+                  <p>所属平台:</p>
+                  <p>{{ sitem.platform_name }}</p>
+                </li>
               </ul>
             </div>
             <div class="left-card" v-if="sitem">
               <div class="page-main-title">商品要求</div>
               <ul class="page-main-ul clear">
-                <li>商品名称:</li>
-                <li>{{ sitem.good_name }}</li>
-                <li v-if="sitem.good_img">商品图片:</li>
-                <li v-if="sitem.good_img">
-                  <img
-                    v-viewer
-                    :src="sitem.good_img"
-                    class="hover"
-                    style="width: 20px; height: 20px; display: inline-block"
-                  />
+                <li>
+                  <p>商品名称:</p>
+                  <p>{{ sitem.good_name }}</p>
+                </li>
+                <li  v-if="sitem.good_img">
+                  <p>商品图片:</p>
+                  <p>
+                    <img
+                      v-viewer
+                      :src="sitem.good_img"
+                      class="hover"
+                      style="width: 20px; height: 20px; display: inline-block"
+                    />
+                  </p>
+                </li>
+                 <li>
+                  <p>商品分类:</p>
+                  <p>{{ sitem.can_name }}</p>
                 </li>
-                <li>商品分类:</li>
-                <li>{{ sitem.can_name }}</li>
-                <li>商品品牌:</li>
-                <li>{{ sitem.brand ? sitem.brand : "无要求" }}</li>
-                <li>商品规格:</li>
                 <li>
-                  <el-table
-                    :data="sitem.specinfo"
-                    border
-                    stripe
-                    :size="'mini'"
-                    style="width: 100%"
-                  >
-                    <el-table-column
-                      prop="spec_name"
-                      label="类型:值"
-                      show-overflow-tooltip
-                    >
-                      <template slot-scope="scope">
-                        {{ scope.row.spec_name }}:{{ scope.row.spec_value_name }}
-                      </template></el-table-column
+                  <p>商品品牌:</p>
+                  <p>{{ sitem.brand ? sitem.brand : "无要求" }}</p>
+                </li>
+                <li>
+                  <p>商品规格:</p>
+                  <p>
+                    <el-table
+                      :data="sitem.specinfo"
+                      border
+                      stripe
+                      :size="'mini'"
+                      style="width: 100%"
                     >
-                  </el-table>
+                      <el-table-column
+                        prop="spec_name"
+                        label="类型:值"
+                        show-overflow-tooltip
+                      >
+                        <template slot-scope="scope">
+                          {{ scope.row.spec_name }}:{{ scope.row.spec_value_name }}
+                        </template></el-table-column
+                      >
+                    </el-table>
+                  </p>
+                </li>
+                <li>
+                  <p>总重量:</p>
+                  <p>{{ sitem.total_weight }}g</p>
+                </li>
+                
+                <li>
+                  <p>是否多地:</p>
+                  <p>{{ sitem.is_addrs + "" === "1" ? "多地" : "一地" }}</p>
+                </li>
+                
+                <li>
+                  <p>是否定制:</p>
+                   <p>{{ sitem.is_custom + "" === "1" ? "定制" : "非定制" }}</p>
                 </li>
-                <li>总重量:</li>
-                <li>{{ sitem.total_weight }}g</li>
-                <li>是否多地:</li>
-                <li>{{ sitem.is_addrs + "" === "1" ? "多地" : "一地" }}</li>
-                <li>是否定制:</li>
-                <li>{{ sitem.is_custom + "" === "1" ? "定制" : "非定制" }}</li>
 
-                <li v-if="sitem.is_metal">启用金价:</li>
                 <li v-if="sitem.is_metal">
-                  {{ sitem.is_gold_price + "" === "1" ? "启用" : "不启用" }}
+                  <p>启用金价:</p>
+                   <p>
+                    {{ sitem.is_gold_price + "" === "1" ? "启用" : "不启用" }}
+                   </p>
                 </li>
-                <li v-if="sitem.is_metal">配置要求:</li>
-                <li v-if="sitem.is_metal">{{ sitem.config }}</li>
 
-                <li v-if="sitem.is_metal">金属克重:</li>
-                <li v-if="sitem.is_metal">{{ sitem.specs_weight }}g</li>
-                <li v-if="sitem.is_metal">其他要求:</li>
                 <li v-if="sitem.is_metal">
-                  {{ sitem.other_config }}
+                  <p>配置要求:</p>
+                  <p>{{ sitem.config }}</p>
                 </li>
-                <li v-if="sitem.is_metal">金属种类:</li>
+
                 <li v-if="sitem.is_metal">
-                  {{ sitem.metal_name }}
+                  <p v-if="sitem.is_metal">金属克重:</p>
+                  <p v-if="sitem.is_metal">{{ sitem.specs_weight }}g</p>
+                </li>
+
+                <li v-if="sitem.is_metal">
+                  <p v-if="sitem.is_metal">其他要求:</p>
+                  <p v-if="sitem.is_metal">
+                    {{ sitem.other_config }}
+                  </p>
+                </li>
+                
+                <li>
+                  <li v-if="sitem.is_metal">金属种类:</li>
+                  <li v-if="sitem.is_metal">
+                   {{ sitem.metal_name }}
+                  </li>
+                </li>
+
+                <li v-if="sitem && sitem.cost_desc">
+                  <p v-if="sitem && sitem.cost_desc">工艺说明:</p>
+                  <p v-if="sitem && sitem.cost_desc">{{ sitem.cost_desc }}</p>
+                </li>
+
+                <li>
+                  <p>产品用途:</p>
+                  <p>{{ sitem.use_desc }}</p>
+                </li>
+
+                <li>
+                  <p>商品备注:</p>
+                  <p>{{ sitem.remark }}</p>
                 </li>
 
-                <li v-if="sitem && sitem.cost_desc">工艺说明:</li>
-                <li v-if="sitem && sitem.cost_desc">{{ sitem.cost_desc }}</li>
-                <li>产品用途:</li>
-                <li>{{ sitem.use_desc }}</li>
-                <li>商品备注:</li>
-                <li>{{ sitem.remark }}</li>
-                <li>商品附件:</li>
                 <li v-if="sitem && sitem.enclosure_file">
-                  <a :href="sitem.enclosure_file" download="附件" class="fl"
-                    >点击下载附件</a
-                  >
+                  <p>商品附件:</p>
+                  <p>
+                    <a :href="sitem.enclosure_file" download="附件" class="fl"
+                      >点击下载附件</a
+                   >
+                  </p>
                 </li>
               </ul>
             </div>
@@ -441,7 +506,7 @@ export default {
       position: absolute;
       top: 16px;
       left: 16px;
-      width: 220px;
+      width: 240px;
       overflow: hidden;
       height: calc(100vh - 82px);
       .left-main {
@@ -456,7 +521,7 @@ export default {
     }
     .p-right {
       top: 16px;
-      right: 16px;
+      right: 0px;
       width: calc(100% - 258px);
       height: calc(100vh - 276px);
       overflow-y: scroll;
@@ -512,19 +577,30 @@ export default {
         border-bottom: 1px solid rgba(242, 242, 242, 1);
       }
       .page-main-ul {
-        padding: 10px 16px 16px 16px;
+        padding: 10px 10px 10px 10px;
         li {
-          float: left;
+          display: flex;
+          // float: left;
           font-size: 12px;
           line-height: 25px;
 
-          &:nth-child(2n + 1) {
-            width: 60px;
-            text-align: right;
-          }
-          &:nth-child(2n + 2) {
-            width: calc(100% - 60px);
+          p{
+            &:first-child{
+              text-align:right;
+              width:85px
+            }
+
+            &:last-child{
+              flex:1;
+            }
           }
+          // &:nth-child(2n + 1) {
+          //   width:60px;
+          //   text-align: right;
+          // }
+          // &:nth-child(2n + 2) {
+          //   width: calc(100% - 80px);
+          // }
         }
       }
     }