Ver Fonte

feat:自选成交商品添加至商品成本

snow há 1 ano atrás
pai
commit
c5275df96c

+ 1 - 1
src/apis/service/goodStore/dealGoodsPool/index.js

@@ -6,5 +6,5 @@ export default {
   list: (data, params) => http(api + "zixunlist", data, "post", params),
   // 添加
   online_add: (data, params) => http(api + "gooduponlinezixun", data, "post", params),
-
+  goodupbaseiczx: (data, params) => http(api + "goodupbaseiczx", data, "post", params),
 };

+ 1 - 1
src/views/goodStore/dealGoodsPool/addEdit.vue

@@ -212,7 +212,7 @@ export default {
   },
   watch: {
     isFiexed() {
-      if (this.ruleForm.is_fixed === "0") {
+      if (this.ruleForm.is_fiexed === "0") {
         this.ruleForm.is_fixed = "";
       }
     },

+ 98 - 97
src/views/goodStore/dealGoodsPool/index.vue

@@ -1,80 +1,38 @@
 <template>
   <div class="dealGoodsPool pagePadding">
-    <ex-table
-      v-loading="loading"
-      v-if=" powers.some((i) => i == '001')"
-      :table="table"
-      :data="tableData"
-      :columns="columns"
-      :page="pageInfo"
-      :size="size"
-      @page-curr-change="handlePageChange"
-      @page-size-change="handleSizeChange"
-      @screen-reset="
+    <ex-table v-loading="loading" v-if="powers.some((i) => i == '001')" :table="table" :data="tableData"
+      :columns="columns" :page="pageInfo" :size="size" @page-curr-change="handlePageChange"
+      @page-size-change="handleSizeChange" @screen-reset="
         pageInfo.curr = 1;
-        parmValue.page = 1;
-        searchList();
-      "
-      @screen-submit="
-        pageInfo.curr = 1;
-        parmValue.page = 1;
-        searchList();
-      "
-      @selection="selection_change"
-    >
+      parmValue.page = 1;
+      searchList();
+      " @screen-submit="
+  pageInfo.curr = 1;
+parmValue.page = 1;
+searchList();
+" @selection="selection_change">
       <template #table-header="{}">
         <div style="width: 100%">
           <el-row style="padding: 0 0 0 80px">
             <el-col :span="6" style="width: 293px">
-              <period-date-picker
-                :type="1"
-                :width="'135px'"
-                :size="searchSize"
-                :start="parmValue.start"
-                :end="parmValue.end"
-                @timeReturned="handleTime"
-              />
+              <period-date-picker :type="1" :width="'135px'" :size="searchSize" :start="parmValue.start"
+                :end="parmValue.end" @timeReturned="handleTime" />
             </el-col>
             <el-col :span="6" style="width: 250px; padding: 0 0 0 10px">
-              <el-input
-                :size="searchSize"
-                style="100%"
-                v-model="parmValue.spuCode"
-                :maxlength="40"
-                clearable
-                placeholder="商品编码"
-                @blur="
+              <el-input :size="searchSize" style="100%" v-model="parmValue.spuCode" :maxlength="40" clearable
+                placeholder="商品编码" @blur="
                   pageInfo.curr = 1;
-                  parmValue.page = 1;
-                  searchList();
-                "
-              ></el-input>
+                parmValue.page = 1;
+                searchList();
+                "></el-input>
             </el-col>
             <el-col :span="6" style="width: 280px; padding: 0 0 0 10px">
-              <el-input
-                :size="searchSize"
-                style="100%"
-                v-model="parmValue.good_name"
-                :maxlength="40"
-                clearable
-                placeholder="商品名称"
-                @blur="
+              <el-input :size="searchSize" style="100%" v-model="parmValue.good_name" :maxlength="40" clearable
+                placeholder="商品名称" @blur="
                   pageInfo.curr = 1;
-                  parmValue.page = 1;
-                  searchList();
-                "
-              ></el-input>
-            </el-col>
-            <el-col
-              :span="3"
-              class="fr"
-              style="width: 110px; padding: 0 0 0 10px"
-              v-if="powers.some((i) => i == '055') && !isSupertube"
-            >
-              <el-button :size="searchSize" type="warning" style="float: right" @click="add_online">
-                <i class="el-icon-circle-plus-outline"></i>
-                <span>商品上线</span>
-              </el-button>
+                parmValue.page = 1;
+                searchList();
+                "></el-input>
             </el-col>
             <el-col :span="3" class="fr" style="width: 66px; padding: 0 0 0 10px">
               <el-button type="primary" :size="searchSize" @click="searchList">刷新</el-button>
@@ -83,6 +41,20 @@
               <el-button type="warning" :size="searchSize" @click="restSearch">重置</el-button>
             </el-col>
           </el-row>
+
+          <el-row>
+            <el-col :span="3" class="fr" style="width: 260px; padding: 10px 0 0 10px">
+              <el-button :size="searchSize" type="warning" style="float: right" @click="add_online"  v-if="powers.some((i) => i == '055') && !isSupertube">
+                <i class="el-icon-circle-plus-outline"></i>
+                <span>商品上线</span>
+              </el-button>
+
+              <el-button :size="searchSize" type="warning" style="float: right;margin-right:10px" @click="add_cost"  v-if="powers.some((i) => i == '003') && !isSupertube">
+                <i class="el-icon-circle-plus-outline"></i>
+                <span>添加到商品成本</span>
+              </el-button>
+            </el-col>
+          </el-row>
           <!-- <el-row> -->
           <!-- <el-col :span="4" style="width: 518px">
               <el-input
@@ -139,47 +111,23 @@
         ></el-tag>
       </template>-->
       <template #good_type="{ scope }">
-        <el-tag
-          :size="tablebtnSize"
-          :type="scope.row.good_type == '0' ? 'warning' : ''"
-          v-text="
-            (options1.find((item) => item.id == scope.row.good_type) || {})
-              .name || '--'
-          "
-        ></el-tag>
+        <el-tag :size="tablebtnSize" :type="scope.row.good_type == '0' ? 'warning' : ''" v-text="(options1.find((item) => item.id == scope.row.good_type) || {})
+            .name || '--'
+          "></el-tag>
       </template>
 
       <template #operation="{ scope }">
-        <el-tooltip
-          v-if="powers.some((i) => i == '007')"
-          effect="dark"
-          content="详情"
-          placement="top"
-        >
+        <el-tooltip v-if="powers.some((i) => i == '007')" effect="dark" content="详情" placement="top">
           <i class="el-icon-view tb-icon" @click="show_view(scope.row)"></i>
         </el-tooltip>
       </template>
     </ex-table>
     <no-auth v-else></no-auth>
-    <show-goods-data-table-modal
-      :showModel="visible"
-      :type="'3'"
-      :title="row.dtitle"
-      :skuCode="row.skuCode"
-      :spuCode="row.spuCode"
-      :iscgd="false"
-      @cancel="visible = false"
-    />
+    <show-goods-data-table-modal :showModel="visible" :type="'3'" :title="row.dtitle" :skuCode="row.skuCode"
+      :spuCode="row.spuCode" :iscgd="false" @cancel="visible = false" />
 
-    <add-edit
-      :id="''"
-      :isNobleMetal="isNobleMetal"
-      :sitem="changeList"
-      :show-model="showModel"
-      :is-detail="false"
-      @refresh="showModel = false,searchList()"
-      @cancel="showModel = false"
-    />
+    <add-edit :id="''" :isNobleMetal="isNobleMetal" :sitem="changeList" :show-model="showModel" :is-detail="false"
+      @refresh="showModel = false, searchList()" @cancel="showModel = false" />
   </div>
 </template>
 <script>
@@ -281,6 +229,60 @@ export default {
     this.searchList();
   },
   methods: {
+    add_cost() {
+      if (this.changeList.length === 0) {
+        this.$message.warning("至少选择一个商品!");
+        return;
+      }
+      if (this.changeList.length > 100) {
+        this.$message.warning("商品数量不能超过100!");
+        return;
+      }
+
+      this.$confirm("是否确认将选中商品添加至商品成本").then(async () => {
+        const codes = this.changeList.map(({ spuCode }) => spuCode);
+
+        const { data, code, message } = await asyncRequest.goodupbaseiczx({ codes })
+
+        if (code === 0) {
+          this.$notify.success({
+            title: "已成功添加至商品成本!",
+            message: ""
+          });
+          this.showModelThis = false;
+          // 刷新
+          this.searchList();
+        } else if (code >= 100 && code <= 104) {
+          await this.logout();
+        } else if (code === 1009) {
+          let resList = JSON.parse(JSON.stringify(data));
+
+          let htmlList = "<ul>";
+          resList.forEach(v => {
+            htmlList += `<li>
+          <img src='${v.good_img}' style='width: 20px; height: 20px'
+                  class='hover'
+                  v-viewer/>
+                  <span>${v.good_name}__</span>`;
+            const { speclist } = v;
+            let str = "<span>";
+            speclist.forEach((a, ai) => {
+              str += `${ai !== 0 ? "--" : ""}${a.spec_name}[${a.spec_value
+                }]`;
+            });
+            htmlList += str + "</span>" + `</li>`;
+          });
+          htmlList += "</ul>";
+          this.$notify({
+            title: "以下商品已上线或已经在审批流程中!",
+            dangerouslyUseHTMLString: true,
+            message: htmlList
+          });
+        } else {
+          this.$message.warning(message);
+        }
+      })
+    },
     //点击商品上线
     add_online() {
       if (this.changeList.length === 0) {
@@ -364,7 +366,6 @@ export default {
       };
       this.searchList();
     },
-
     //供应商选择
     async supplierNosearchChange(e) {
       console.log(e);