xiaodai2022 hace 2 años
padre
commit
ff79f87b9b

+ 35 - 48
src/views/purchaseIn/purchaseReturn/ShowDataTableColumns.js

@@ -2,92 +2,79 @@ export default [
   {
     prop: "returnCode",
     label: "采购退货单编号",
+    span: 6
   },
   {
     prop: "cgdNo",
     label: "采购单编号",
+    span: 6
   },
   {
     prop: "apply_name",
-    label: "申请人"
+    label: "申请人",
+    span: 6
   },
   {
-    prop: "class_cat",
-    label: "商品分类",
-  },
-  {
-    prop: "good_code",
-    label: "商品编码",
+    prop: "status",
+    label: "状态",
+    _slot_: "status",
+    span: 6
   },
 
   {
-    prop: "good_name",
-    label: "商品名称",
-  },
-  {
-    prop: "wsm_supplier",
-    label: "供应商"
-  },
-  {
-    prop: "wsm_supplierNo",
-    label: "供应商编码"
+    prop: "good_num",
+    label: "总采购数量",
+    span: 6
   },
   {
-    prop: "remark",
-    label: "备注",
-    span:"24",
-    showProp:true
+    prop: "return_num",
+    label: "退货退货数量",
+    span: 6
   },
-
   {
-    prop: "goo_num",
-    label: "总采购数量",
-  },
- {
     prop: "good_price",
     label: "采购单价",
+    span: 6
   },
-
   {
-    prop: "return_num",
-    label: "退货退货数量",
+    prop: "return_price",
+    label: "退货总金额",
+    span: 6
   },
-
-  // {
-  //   prop: "good_price",
-  //   label: "商品单价",
-  // },
   {
-    prop: "good_total",
-    label: "退货总金额",
+    prop: "addtime",
+    label: "创建时间",
+    span: 6
   },
   {
     prop: "post_company",
     label: "物流公司",
-    showProp:true
+    span: 6
   },
   {
     prop: "post_code",
     label: "物流编号",
-    showProp:true
+    span: 12,
   },
   {
-    prop: "post_fee",
-    label: "物流费",
-    showProp:true
+    prop: "return_contactor",
+    label: "退货联系人",
+    span: 6
   },
   {
-    prop: "status",
-    label: "状态",
-    _slot_: "status",
+    prop: "return_mobile",
+    label: "退货联系电话",
+    span: 6
   },
   {
-    prop: "updatetime",
-    label: "更新时间",
+    prop: "return_addr",
+    label: "退货地址",
+    span: 12,
   },
   {
-    prop: "addtime",
-    label: "创建时间",
+    prop: "error_remark",
+    label: "退货备注",
+    span: 24,
   },
 ]
 

+ 15 - 109
src/views/purchaseIn/purchaseReturn/detail.vue

@@ -3,62 +3,6 @@
     <div
       v-if="powers && powers.length > 0 && powers.some((item) => item == '001')"
     >
-      <div class="detail-page-title">
-        <span>采购退货单编号:</span
-        ><span v-if="sitem">{{ sitem.bk_code }}</span>
-        <!-- <el-button
-          v-if="
-            powers.some((item) => item === '015') &&
-            (status === '0' || status === '1' || status === '2')
-          "
-          @click="statusConfirm('-1', '作废该条信息')"
-          type="danger"
-          plain
-          class="fr"
-          :size="'mini'"
-          style="margin: 0 0 0 12px"
-          >作废该条信息</el-button
-        >
-        <el-button
-          @click="statusConfirm('0', '取消审核流程')"
-          plain
-          class="fr"
-          type="primary"
-          :size="'mini'"
-          v-if="status === '1' && powers.some((item) => item == '014')"
-          >取消备库申请</el-button
-        > -->
-      </div>
-
-      <!-- <el-button
-        @click="statusConfirm('-1', '作废该条信息')"
-        type="danger"
-        plain
-        style="margin: 0 0 0 12px"
-        class="fr"
-        :size="'mini'"
-        v-if="
-          status === '1' &&
-          powers.some((item) => item == '015')
-        "
-        >作废该条信息</el-button
-
-      > -->
-      <!-- <status-bar
-        v-if="newTime !== '' && status !== '4'"
-        :newTime="newTime"
-        :options="statusOptions"
-        :status="status"
-      /> -->
-
-      <!-- <add-edit
-        :sitem="sitem"
-        :id="queryId"
-        :newTime="newTime"
-        :type="'1'"
-        @refresh="initData"
-        v-if="newTime != ''"
-      /> -->
       <el-tabs v-model="activeTabs">
         <el-tab-pane label="业务详情" name="1">
           <el-collapse
@@ -87,66 +31,28 @@
                   ></el-tag>
                 </template>
               </show-data-table>
-              <!-- <purchase-order-addEdit
-            style="padding: 0 0 20px 0"
-            :newTime="newTime"
-            v-if="newTime !== ''"
-            :sitem="sitem"
-            :id="queryId"
-            @refresh="initData()"
-          /> -->
+        
             </el-collapse-item>
-
-            <!-- <el-collapse-item
-              title="业务审核"
-              name="1"
-              v-if="status == '1' && powers.some((item) => item == '043')"
-            >
-              <exam-form
-                :statusList="[]"
+            <el-collapse-item title="商品信息" name="1">
+                  <show-goods-data-table
                 :newTime="newTime"
                 v-if="newTime !== ''"
-                :disabled="false"
-                :isMust="false"
-                @searchChange="examForm"
+                :type="'1'"
+                :skucode="sitem.skuCode"
+                :spucode="sitem.spuCode"
+                :iscgd="true"
               />
             </el-collapse-item>
-
-            <el-collapse-item
-              title="通知财务部门"
-              name="1"
-              v-if="status == '2' && powers.some((item) => item == '039')"
-            >
-              <div style="height: 50px; padding: 0 0px 12px 0">
-                <el-button
-                  type="primary"
-                  class="fr"
-                  size="mini"
-                  @click="statusConfirm('3', '通知财务部门')"
-                  >我已知晓</el-button
-                >
-              </div>
-            </el-collapse-item> -->
-
-            <!-- <el-collapse-item name="3" title="填写退货物流" v-if="status == '2' && powers.some((item) => item == '032')">
-          <purchase-back
-            :sitem="sitem"
-            :id="queryId"
-            :newTime="newTime"
-            v-if="newTime != ''"
-            @refresh="initData"
-          />
-        </el-collapse-item> -->
           </el-collapse>
         </el-tab-pane>
-        <el-tab-pane label="审批记录" name="2">
+        <!-- <el-tab-pane label="审批记录" name="2">
           <process-time-line
             v-if="newTime !== ''"
             :newTime="newTime"
             :type="'CGTHD'"
             :orderCode="queryId"
           />
-        </el-tab-pane>
+        </el-tab-pane> -->
       </el-tabs>
     </div>
     <div v-else>
@@ -193,12 +99,12 @@ export default {
       loading: true,
       sitem: null,
       status: "",
-      // statusOptions: [
-      //   // { value: "0", label: "取消" },
-      //   { value: "1", label: "待业务审核" },
-      //   { value: "2", label: "通知财务部门" },
-      //   { value: "3", label: "采购退货成功" },
-      // ],
+      statusOptions: [
+        // { value: "0", label: "取消" },
+        // { value: "1", label: "待业务审核" },
+        // { value: "2", label: "通知财务部门" },
+        { value: "1", label: "采购退货成功" },
+      ],
     };
   },
   mounted() {

+ 180 - 238
src/views/purchaseIn/workbench/components/baseForm.vue

@@ -8,7 +8,6 @@
     v-loading="loading"
     label-width="85px"
     class="demo-ruleForm"
-    
   >
     <el-row>
       <el-col
@@ -32,8 +31,7 @@
 
           }} -->
           预计成本合计:<span>
-            
-            {{newPrice}}
+            {{ newPrice }}
           </span></span
         >
         <span
@@ -466,7 +464,7 @@
         </el-form-item>
       </el-col>
 
-      <el-col :span="24" v-show="is_noble">
+      <el-col :span="24" v-show="pid === '6'">
         <el-col :span="6">
           <el-form-item label="金属重量" prop="noble_weight">
             <digital-input
@@ -505,6 +503,7 @@
               :disabled="type === 'view'"
               style="width: 100%"
               placeholder="启用金价"
+              @change="is_gold_price_change"
             >
               <el-option
                 v-for="group in options5"
@@ -624,25 +623,24 @@
           v-if="ruleForm.good_img"
           class="activity-upload"
         >
-          <div class="btnupload" style="position: relative; margin-left:10px;" v-for="(item,index) in ruleForm.good_img" :key=index>
-            <img
-
-              :src="ruleForm.good_img[index]"
-              class="avatar"
-            />
+          <div
+            class="btnupload"
+            style="position: relative; margin-left: 10px"
+            v-for="(item, index) in ruleForm.good_img"
+            :key="index"
+          >
+            <img :src="ruleForm.good_img[index]" class="avatar" />
             <i
-                        v-if="
-                          type == 'add' ||
-                          type === 'editBase' ||
-                          type === 'edit'
-                        "
-                        class="el-icon-close"
-                        @click="closeImg(index, 'good_img')"
-                      ></i>
-            
+              v-if="type == 'add' || type === 'editBase' || type === 'edit'"
+              class="el-icon-close"
+              @click="closeImg(index, 'good_img')"
+            ></i>
           </div>
           <div v-if="type == 'view' ? false : true">
-             <i  class="el-icon-plus avatar-uploader-icon" style="position: relative; width:50px;height:50px;">
+            <i
+              class="el-icon-plus avatar-uploader-icon"
+              style="position: relative; width: 50px; height: 50px"
+            >
               <file-upload
                 class="Upload"
                 :accept="'.jpg,.png,.jpeg'"
@@ -654,9 +652,6 @@
               ></file-upload>
             </i>
           </div>
-         
-           
-          
         </el-form-item>
         <!-- <i class="el-icon-plus avatar-uploader-icon">
           
@@ -724,6 +719,7 @@ export default {
 
   data() {
     return {
+      pid: "",
       cat_id_name: "",
       supplierNo: "",
       brand_name: "",
@@ -762,15 +758,11 @@ export default {
       r4: "",
 
       //成本合算
-      newPrice:0,
+      newPrice: 0,
     };
   },
   mounted() {
-    this.$nextTick(() => {});
     this.initForm();
-    
-    
-    // this.computedCost();
   },
   methods: {
     //图片悬浮删除
@@ -794,56 +786,6 @@ export default {
       m = Math.pow(10, Math.max(r1, r2));
       return (arg1 * m + arg2 * m) / m;
     },
-    // accAdd(arg1, arg2, arg3, arg4, arg5, arg6, arg7) {
-    //   var r1, r2, r3, r4, r5, r6, r7, m;
-    //   console.log(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
-    //   try {
-    //     r1 = arg1.toString().split(".")[1].length;
-    //   } catch (e) {
-    //     r1 = 0;
-    //   }
-    //   try {
-    //     r2 = arg2.toString().split(".")[1].length;
-    //   } catch (e) {
-    //     r2 = 0;
-    //   }
-    //   try {
-    //     r3 = arg3.toString().split(".")[1].length;
-    //   } catch (e) {
-    //     r3 = 0;
-    //   }
-    //   try {
-    //     r4 = arg4.toString().split(".")[1].length;
-    //   } catch (e) {
-    //     r4 = 0;
-    //   }
-    //   try {
-    //     r5 = arg5.toString().split(".")[1].length;
-    //   } catch (e) {
-    //     r5 = 0;
-    //   }
-    //   try {
-    //     r6 = arg6.toString().split(".")[1].length;
-    //   } catch (e) {
-    //     r6 = 0;
-    //   }
-    //   try {
-    //     r7 = arg7.toString().split(".")[1].length;
-    //   } catch (e) {
-    //     r7 = 0;
-    //   }
-    //   m = Math.pow(10, Math.max(r1, r2, r3, r4, r5, r6, r7));
-    //   return (
-    //     (arg1 * m +
-    //       arg2 * m +
-    //       arg3 * m +
-    //       arg4 * m +
-    //       arg5 * m +
-    //       arg6 * m +
-    //       arg7 * m) /
-    //     m
-    //   );
-    // },
 
     //乘法精度问题
     accMul(arg1, arg2) {
@@ -881,7 +823,6 @@ export default {
     },
     async initForm() {
       this.supplierNo = [];
-      console.log(this.id);
       this.loading = true;
       if (this.type === "add") {
         this.title = "新建采返商品";
@@ -890,7 +831,6 @@ export default {
       } else {
         this.title = "采返商品详情";
       }
-      console.log(this.type);
       this.resetFormData();
       this.rulesThis = this.rules;
       await this.resetForm();
@@ -899,61 +839,44 @@ export default {
         await this.initData();
       }
       //调用实时金价获取接口
-        
-        this.golpricelast(this.ruleForm.metal_id)
-        //调用成本合算计算函数
-        // this.computedCost()
+      this.golpricelast();
+      //调用成本合算计算函数
+      // this.computedCost()
       this.setrules();
       this.loading = false;
     },
 
     computedCost() {
-      //        (this.ruleForm.demo_fee/this.askItem.num)+
-      //       (this.ruleForm.open_fee/this.askItem.num)+
-      //       (this.ruleForm.noble_weight*this.newGoldPrice)+
-      //       (this.ruleForm.cost_fee*this.ruleForm.noble_weight)+
-      //       this.ruleForm.pakge_fee+
-      //       this.ruleForm.mark_fee+
-      //       this.ruleForm.cert_fee+this.ruleForm.nake_fee+this.ruleForm.delivery_fee
-
-      //  let price = this.accDiv(this.ruleForm.demo_fee,this.askItem.num)
-      //  let price = this.accDiv(this.ruleForm.open_fee,this.askItem.num)
-
-      // console.log(this.askItem.num)
-      
-      this.$nextTick(() => {
-        this.r1 = this.accMul(this.ruleForm.noble_weight, this.newGoldPrice);
-        this.r2 = this.accMul(
-          this.ruleForm.cost_fee,
-          this.ruleForm.noble_weight
+      const { num } = this.askItem;
+      const {
+        demo_fee,
+        open_fee,
+        noble_weight,
+        cost_fee,
+        pakge_fee,
+        mark_fee,
+        cert_fee,
+        nake_fee,
+        delivery_fee,
+      } = this.ruleForm;
+      let a = this.accDiv(demo_fee, num); // 打样费/购买数量
+      let b = this.accDiv(open_fee, num); //开模费/购买数量
+      let c = this.accMul(noble_weight, this.newGoldPrice); //金属重量* 最新金价
+      let d = this.accMul(cost_fee, noble_weight); //工艺费* 金属重量
+      let e = this.accAdd(pakge_fee, mark_fee); //包装费+加标费
+      let f = this.accAdd(cert_fee, nake_fee); //证书费+产品裸价
+      if (this.is_noble) {
+        this.newPrice = this.accAdd(
+          this.accAdd(this.accAdd(a, b), this.accAdd(c, d)),
+          this.accAdd(this.accAdd(e, f), delivery_fee)
         );
-        this.r3 = this.accDiv(this.ruleForm.demo_fee, this.askItem.num);
-        this.r4 = this.accDiv(this.ruleForm.open_fee, this.askItem.num);
-
-        // this.accAdd(this.r1,this.r2)
-        // this.accAdd(this.r3,this.r4)
-        // this.accAdd(this.ruleForm.pakge_fee,this.ruleForm.mark_fee)
-        // this.accAdd(this.ruleForm.cert_fee,this.ruleForm.nake_fee)
-        // this.accAdd(this.ruleForm.delivery_fee,)
-
-       let price =  this.accAdd(
-            this.ruleForm.delivery_fee,
-            this.accAdd(
-              this.accAdd(
-                this.accAdd(
-                  this.accAdd(this.r1, this.r2),
-                  this.accAdd(this.r3, this.r4)
-                ),
-                this.accAdd(this.ruleForm.pakge_fee, this.ruleForm.mark_fee)
-              ),
-              this.accAdd(this.ruleForm.cert_fee, this.ruleForm.nake_fee)
-            )
-          );
-          price = price.toFixed(2)
-
-          this.newPrice = price;
-          console.log("aaaaaaaaaaaaaaaaaaa",price)
-      });
+      } else {
+        this.newPrice = this.accAdd(
+          this.accAdd(this.accAdd(a, b), this.accAdd(e, f)),
+          delivery_fee
+        );
+      }
+      console.log(new Date().valueOf() + this.newPrice);
     },
 
     number_change(e, key) {
@@ -966,7 +889,6 @@ export default {
       const { code, message, data } = await asyncRequest.good_detail({
         bidNo: this.editId,
       });
-      console.log(data);
       if (code === 0) {
         const {
           bidNo,
@@ -1016,12 +938,15 @@ export default {
         this.cat_id_name = "";
         if (cat_info && cat_info.length) {
           cat_info.forEach((e, ei) => {
+            if (ei === 0) {
+              this.pid = e.id;
+            }
             this.cat_id_name += `${ei !== 0 ? "_" : ""}${e.name}`;
           });
         }
         this.supplierNo_name = supplierName || "";
-        console.log(this.supplierNo_name);
-        this.is_noble = this.askItem.is_metal;
+        this.is_noble = is_gold_price === "1" && this.pid === "6";
+        // this.is_noble = this.askItem.is_metal;
         this.brand_name = brand_name || "";
         this.unit_name = unit || "";
         this.ruleForm = {
@@ -1042,7 +967,6 @@ export default {
           origin_place: origin_place ? origin_place.split(",") : [],
           delivery_place: delivery_place ? delivery_place.split(",") : [],
 
-          
           cert_fee: cert_fee || "0.00",
           pakge_fee: pakge_fee || "0.00",
           cost_fee: cost_fee || "0.00",
@@ -1069,8 +993,6 @@ export default {
         if (this.is_noble) {
           this.ruleForm.nake_fee = "0";
         }
-        
-        
       } else if (code >= 100 && code <= 104) {
         await this.logout();
       } else {
@@ -1078,61 +1000,66 @@ export default {
       }
     },
     async submitForm() {
-      if(this.ruleForm.good_img.length>10){
-        this.$message.warning("上传图片不能超过10张")
+      if (this.is_noble) {
+        this.ruleForm.nake_fee = "0";
+      }
+       this.computedCost();
+      if (this.ruleForm.good_img.length > 10) {
+        this.$message.warning("上传图片不能超过10张");
         return;
       }
       await this.$refs.ruleForm.validate(async (valid) => {
         if (valid) {
-          this.loading = true;
-          if (this.spec_tableData.length === 0) {
-            this.$message.warning("请填写规格!");
-            this.loading = false;
-            return;
-          }
-          let model = JSON.parse(JSON.stringify(this.ruleForm));
-          model.cat_id = model.cat_id[model.cat_id.length - 1];
-          model.brandid = model.brandid.toString();
-          model.supplierNo = model.supplierNo.toString();
-          model.origin_place = model.origin_place.toString();
-          model.delivery_place = model.delivery_place.toString();
+          if (!this.loading) {
+            this.loading = true;
+            if (this.spec_tableData.length === 0) {
+              this.$message.warning("请填写规格!");
+              this.loading = false;
+              return;
+            }
+            let model = JSON.parse(JSON.stringify(this.ruleForm));
+            model.cat_id = model.cat_id[model.cat_id.length - 1];
+            model.brandid = model.brandid.toString();
+            model.supplierNo = model.supplierNo.toString();
+            model.origin_place = model.origin_place.toString();
+            model.delivery_place = model.delivery_place.toString();
 
-          
-          model.unit_id = model.unit_id.toString();
-          model.config = model.config.toString();
-          model.tax = parseInt(model.tax + "") + "";
-          model.specinfo = [];
-          let list = JSON.parse(JSON.stringify(this.spec_tableData));
-          list.forEach((a) => {
-            let am = {
-              specid: a.specid,
-              spec_value_id: a.spec_value_id,
-            };
-            model.specinfo.push(am);
-          });
-          console.log(model);
-          let res = {};
-          if (this.type === "add") {
-            delete model["bidNo"];
-            res = await asyncRequest.good_add(model);
-          } else {
-            res = await asyncRequest.good_update(model);
-          }
-          console.log(res);
-          this.loading = false;
-          if (res && res.code === 0) {
-            const title = this.type === "add" ? "新建成功!" : "修改成功!";
-            this.$notify.success({
-              title: title,
-              message: "",
+            model.unit_id = model.unit_id.toString();
+            model.config = model.config.toString();
+            model.tax = parseInt(model.tax + "") + "";
+            model.specinfo = [];
+            let list = JSON.parse(JSON.stringify(this.spec_tableData));
+            list.forEach((a) => {
+              let am = {
+                specid: a.specid,
+                spec_value_id: a.spec_value_id,
+              };
+              model.specinfo.push(am);
             });
-            this.showModelThis = false;
-            // 刷新
-            this.$emit("refresh");
-          } else if (res && res.code >= 100 && res.code <= 104) {
-            await this.logout();
-          } else {
-            this.$message.warning(res.message);
+            console.log(model);
+            let res = {};
+            if (this.type === "add") {
+              delete model["bidNo"];
+              res = await asyncRequest.good_add(model);
+            } else {
+              res = await asyncRequest.good_update(model);
+            }
+            console.log(res);
+            this.loading = false;
+            if (res && res.code === 0) {
+              const title = this.type === "add" ? "新建成功!" : "修改成功!";
+              this.$notify.success({
+                title: 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!!");
@@ -1149,14 +1076,23 @@ export default {
           this.$refs.ruleForm.clearValidate();
           this.spec_tableData = [];
           console.log(this.askItem);
-          // const { can_id_arr } = this.askItem;
-          this.is_noble = this.askItem.is_metal;
+          this.is_noble = false;
+          const { can_id_arr, is_gold_price } = this.askItem;
+          can_id_arr.forEach((e, index) => {
+            if (index == 0) {
+              this.pid = e;
+            }
+          });
+          if (this.pid === "6" && is_gold_price === "1") {
+            this.is_noble = true;
+          }
           this.cat_id_name = this.type === "add" ? this.askItem.can_name : "";
-
           this.brand_name = "";
           // this.type === "add" ? this.askItem.brand : "";
           this.unit_name = "";
-          let good_img = this.askItem.good_img ? this.askItem.good_img.split(",") : []
+          let good_img = this.askItem.good_img
+            ? this.askItem.good_img.split(",")
+            : [];
           //this.type === "add" ? this.askItem.unit_name : "";
           this.ruleForm = {
             infoNo: this.id || "",
@@ -1176,7 +1112,7 @@ export default {
             tax: "",
             supply_area: "",
             origin_place: [],
-            delivery_place:[],
+            delivery_place: [],
             cert_fee: "0.00",
             pakge_fee: "0.00",
             cost_fee: "0.00",
@@ -1240,26 +1176,38 @@ export default {
     //分类选择
     async cat_id_change(e) {
       const { pid, id, label } = e;
+      this.pid = pid || "";
       this.ruleForm.cat_id = id ? [id] : [];
-      this.is_noble = pid === "6";
+
       this.$refs.ruleForm.validateField("cat_id");
+      const { is_gold_price } = this.ruleForm;
+      this.is_noble = this.pid === "6" && is_gold_price === "1";
       this.setrules();
-      this.ruleForm.nake_fee = "0";
+      if (this.is_noble) {
+        this.ruleForm.nake_fee = "0";
+      }
+      this.computedCost();
     },
     setrules() {
-      let list = [
-        "noble_weight",
-        "metal_id",
-        "is_gold_price",
-        "is_diff",
-        "config",
-        "other_config",
-      ];
-      for (let i = 0; i < list.length; i++) {
-        this.rules[list[i]][0].required = this.is_noble;
+      let list1 = ["noble_weight", "is_gold_price", "is_diff"];
+      for (let i = 0; i < list1.length; i++) {
+        this.rules[list1[i]][0].required = this.is_noble;
+      }
+      let list2 = ["metal_id", "config", "other_config"];
+      for (let i = 0; i < list2.length; i++) {
+        this.rules[list2[i]][0].required = this.pid === "6";
       }
     },
-
+    is_gold_price_change() {
+      const { is_gold_price } = this.ruleForm;
+      this.$refs.ruleForm.validateField("is_gold_price");
+      this.is_noble = this.pid === "6" && is_gold_price === "1";
+      this.setrules();
+      if (this.is_noble) {
+        this.ruleForm.nake_fee = "0";
+      }
+      this.computedCost();
+    },
     //品牌选择
     brandidsearchChange(e) {
       const { id, code, label } = e;
@@ -1299,7 +1247,6 @@ export default {
     //金属种类选择
     //需修改,未改完
     async metal_idsearchChange(e) {
-      
       this.loading = true;
       const { id, code, label } = e;
       if (id) {
@@ -1308,39 +1255,36 @@ export default {
         this.ruleForm.metal_id = "";
       }
       this.$refs.ruleForm.validateField("metal_id");
-      
 
       //获取实时金价
-      this.golpricelast(e.id)
-      
+      this.golpricelast();
+
       this.loading = false;
     },
     //获取实时金价
-    async golpricelast(id){
-      
-      if (!id) {
-        // this.ruleForm.metal_id = this.askItem.gold_price;
-        // console.log(this.ruleForm.metal_id ,"1111111111111111111111")
-        
+    async golpricelast() {
+      const { metal_id } = this.ruleForm;
+      if (metal_id === "" && metal_id === "0") {
         this.newGoldPrice = 0;
+        this.computedCost();
         return;
       }
-      const res = await asyncRequest.golpricelast({ type: id });
-      console.log(res)
-      if (res && res.code === 0) {
-        if(res.data.length<=0){
+      const { code, data } = await asyncRequest.golpricelast({
+        type: metal_id,
+      });
+      if (code === 0) {
+        if (data.length !== 1) {
           this.newGoldPrice = 0;
-        }else{
-          this.newGoldPrice = res.data[0].price;
+        } else {
+          this.newGoldPrice = data[0].price;
         }
-        
-
-        this.computedCost();
-        
-      } else if (res && res.code >= 100 && res.code <= 104) {
+      } else if (code >= 100 && code <= 104) {
+        this.newGoldPrice = 0;
         await this.logout();
       } else {
+        this.newGoldPrice = 0;
       }
+      this.computedCost();
     },
 
     //仓库省市区
@@ -1354,8 +1298,6 @@ export default {
       this.$refs.ruleForm.validateField("delivery_place");
     },
 
-    
-
     //图片上传成功
     async UploadSuccessEventgood_img(data) {
       await this.UploadSuccessEvent(1, data);
@@ -1363,8 +1305,8 @@ export default {
 
     //图片上传成功
     async UploadSuccessEvent(type, data) {
-      if(this.ruleForm.good_img.length>10){
-        this.$message.warning("上传图片最多不能超过10张")
+      if (this.ruleForm.good_img.length > 10) {
+        this.$message.warning("上传图片最多不能超过10张");
         return;
       }
       const { url } = data;
@@ -1378,7 +1320,7 @@ export default {
           this.ruleForm.good_img.push(url);
           this.$refs.ruleForm.validateField("good_img");
         }
-        console.log(this.ruleForm.good_img.length)
+        console.log(this.ruleForm.good_img.length);
         this.$message.success("图片上传成功!");
       }
     },
@@ -1437,7 +1379,7 @@ export default {
         tax: "",
         supply_area: "",
         origin_place: [],
-        delivery_place:[],
+        delivery_place: [],
         cert_fee: "0.00",
         pakge_fee: "0.00",
         cost_fee: "0.00",
@@ -1482,7 +1424,7 @@ export default {
         tax: "",
         supply_area: "",
         origin_place: [],
-        delivery_place:[],
+        delivery_place: [],
         cert_fee: "0.00",
         pakge_fee: "0.00",
         cost_fee: "0.00",
@@ -1523,14 +1465,14 @@ export default {
   }
 }
 i.el-icon-close {
-            position: absolute;
-            z-index: 2;
-            top: 0;
-            right: 0;
-            color: #63cbe7;
-            font-weight: bold;
-            cursor: pointer;
-          }
+  position: absolute;
+  z-index: 2;
+  top: 0;
+  right: 0;
+  color: #63cbe7;
+  font-weight: bold;
+  cursor: pointer;
+}
 
 // /deep/ .fileUp {
 //       opacity: 10 !important;