xiaodai2022 hace 2 años
padre
commit
6f91fbaca1

+ 15 - 40
src/views/goodStore/goodsOnline/index.vue

@@ -79,11 +79,7 @@
               />
             </el-col>
 
-            <el-col
-              :span="3"
-              class="fr"
-              style="width: 66px; padding: 0 0 0 10px"
-            >
+            <el-col :span="3" class="fr" style="width: 66px; padding: 0 0 0 10px">
               <el-button type="warning" :size="searchSize" @click="restSearch">
                 重置
               </el-button>
@@ -123,11 +119,7 @@
                 @searchChange="brandidsearchChange"
               />
             </el-col>
-            <el-col
-              :span="3"
-              class="fr"
-              style="width: 66px; padding: 0 0 0 10px"
-            >
+            <el-col :span="3" class="fr" style="width: 66px; padding: 0 0 0 10px">
               <el-button type="primary" :size="searchSize" @click="searchList">
                 刷新
               </el-button>
@@ -220,15 +212,10 @@
         <el-tag
           :size="tablebtnSize"
           :type="
-            scope.row.status == '6'
-              ? ''
-              : scope.row.status == '7'
-              ? 'danger'
-              : 'warning'
+            scope.row.status == '6' ? '' : scope.row.status == '7' ? 'danger' : 'warning'
           "
           v-text="
-            (options8.find((item) => item.id == scope.row.status) || {}).name ||
-            '--'
+            (options8.find((item) => item.id == scope.row.status) || {}).name || '--'
           "
         ></el-tag>
       </template>
@@ -237,8 +224,7 @@
           :size="tablebtnSize"
           :type="scope.row.good_type == '0' ? 'warning' : ''"
           v-text="
-            (options1.find((item) => item.id == scope.row.good_type) || {})
-              .name || '--'
+            (options1.find((item) => item.id == scope.row.good_type) || {}).name || '--'
           "
         ></el-tag>
       </template>
@@ -270,9 +256,7 @@
           ></i>
         </el-tooltip>
         <el-tooltip
-          v-if="
-            powers.some((item) => item == '079') && scope.row.status !== '8'
-          "
+          v-if="powers.some((item) => item == '079') && scope.row.status !== '8'"
           effect="dark"
           content="下线商品"
           placement="top"
@@ -293,9 +277,9 @@
         class="demo-ruleForm"
         label-width="80px"
       >
-        <el-form-item label="下线原因" prop="offline_reason" >
+        <el-form-item label="下线原因" prop="offline_reason">
           <el-select
-          style="width:100%"
+            style="width: 100%"
             v-model="donline_form.offline_reason"
             placeholder="请选择下线原因"
           >
@@ -404,9 +388,8 @@ export default {
     ...mapGetters(["tablebtnSize", "searchSize", "size"]),
     powers() {
       let tran =
-        this.$store.getters.btnList.find(
-          (item) => item.menu_route == "goodsOnline"
-        ) || {};
+        this.$store.getters.btnList.find((item) => item.menu_route == "goodsOnline") ||
+        {};
       if (tran && tran.action && tran.action.length > 0) {
         return tran.action;
       } else {
@@ -431,12 +414,8 @@ export default {
         skuCode: "",
       },
       donline_rules: {
-        offline_reason: [
-          { validator: validate, required: true, trigger: "blur" },
-        ],
-        offline_remark: [
-          { validator: validate, required: true, trigger: "blur" },
-        ],
+        offline_reason: [{ validator: validate, required: true, trigger: "blur" }],
+        offline_remark: [{ validator: validate, required: true, trigger: "blur" }],
       },
       fileUrl: urlConfig.baseURL,
       ruleForm: {
@@ -456,9 +435,7 @@ export default {
           },
         ],
         status: [{ validator: validate, required: true, trigger: "change" }],
-        platform_id: [
-          { validator: validate, required: true, trigger: "change" },
-        ],
+        platform_id: [{ validator: validate, required: true, trigger: "change" }],
       },
       centerDialogVisible: false,
       options1: options1,
@@ -811,7 +788,7 @@ export default {
             exam_status: "8",
           };
           let model = { ...this.donline_form, ...obj };
-          console.log("aaaaa", model);
+          // console.log("aaaaa", model);
 
           const res = await asyncRequest.status(model);
           if (res && res.code === 0) {
@@ -827,7 +804,6 @@ export default {
             this.loading = false;
             this.$message.warning(res.message);
           }
-
         })
         .catch(() => {
           console.log("取消");
@@ -950,5 +926,4 @@ export default {
 };
 </script>
 
-<style lang="scss" scoped>
-</style>
+<style lang="scss" scoped></style>

+ 26 - 18
src/views/youzan/othgoodsOffline/columns.js

@@ -28,12 +28,12 @@ const columns = [
     },
   
     {
-      prop: "creater",
+      prop: "updater",
       label: "操作人",
       minWidth: "155px",
     },
     {
-      prop: "addtime",
+      prop: "updatetime",
       label: "下线时间",
       minWidth: "155px",
     },
@@ -53,40 +53,48 @@ const columns = [
     {
       prop: "spuCode",
       label: "商品成本编号",
-      span: 6
+      span: 8
     },
     {
-      prop: "addtime",
+      prop: "spuCode",
+      label: "上线商品编号",
+      span: 8
+    },
+    {
+      prop: "plat_code",
+      label: "平台商品编号",
+      span: 8
+    },
+    {
+      prop: "updatetime",
       label: "下线时间",
-      span: 6
+      span: 8
     },
     {
-      prop: "creater",
-      label: "申请人",
-      span: 6
+      prop: "platform_name",
+      label: "平台名称",
+      span: 8
     },
     {
-      prop: "result",
-      label: "下线原因",
-      span: 6
+      prop: "updater",
+      label: "申请人",
+      span: 8
     },
+  
     
     {
       prop: "good_name",
       label: "商品名称",
-      span: 24
+    },
+    {
+      prop: "result",
+      label: "下线原因",
     },
     {
       prop: "offline_remark",
       label: "下线备注",
       span: 24
     },
-    {
-      prop: "children_list",
-      label: "下线商品信息",
-      span: 24,
-      _slot_:"children_list"
-    },
   ]
 
   export {

+ 3 - 16
src/views/youzan/othgoodsOffline/detail.vue

@@ -8,20 +8,8 @@
             v-if="newTime !== ''"
             :sitem="list"
             :columns="costArr"
+            :border="true"
           >
-            <template slot="children_list">
-              <el-table :data="list.children_list" size="mini" style="width: 100%">
-                <el-table-column prop="skuCode" label="商品上线编号" min-width="140">
-                </el-table-column>
-                <el-table-column prop="platform_name" label="平台名称" min-width="140">
-                </el-table-column>
-
-                <el-table-column prop="purchease" label="采购人" min-width="90">
-                </el-table-column>
-                <el-table-column prop="creater" label="创建人" min-width="90">
-                </el-table-column>
-              </el-table>
-            </template>
           </show-data-table>
         </el-tab-pane>
       </el-tabs>
@@ -63,7 +51,7 @@ export default {
       //数据
       list: {},
       parmValue: {
-        id: this.$route.query.id,
+        platform_youzan_id: this.$route.query.id,
       },
       activeName: "1",
       newTime: "",
@@ -80,12 +68,11 @@ export default {
       const res = await asyncRequest.goodoffdetail(this.parmValue);
       if (res && res.code === 0 && res.data) {
         this.list = res.data;
-        console.log(this.list);
       } else if (res && res.code >= 100 && res.code <= 104) {
         await this.logout();
       } else {
         this.$message.warning(res.message);
-        this.list = [];
+        this.list = {};
       }
       this.getNewTime();
       this.loading = false;

+ 1 - 1
src/views/youzan/othgoodsOnline/components/online-exam-form.vue

@@ -173,7 +173,7 @@ export default {
   data() {
     return {
       spuCode: "",
-      loading: false,
+      loading: true,
       currentRow: null,
       nakelist: [],
       exam_statusList: [

+ 46 - 101
src/views/youzan/othgoodsOnline/index.vue

@@ -251,7 +251,7 @@
           >
             <i
               class="el-icon-download tb-icon"
-              @click="get_donline(scope.row.platform_youzan_id)"
+              @click="showDonlineDlg(scope.row.platform_youzan_id)"
             ></i>
           </el-tooltip>
         </template>
@@ -264,10 +264,10 @@
           class="demo-ruleForm"
           label-width="80px"
         >
-          <el-form-item label="下线原因" prop="offline_reason">
+          <el-form-item label="下线原因" prop="offline_reason_id">
             <el-select
               style="width: 100%"
-              v-model="donline_form.offline_reason"
+              v-model="donline_form.offline_reason_id"
               placeholder="请选择下线原因"
             >
               <el-option
@@ -389,7 +389,7 @@ export default {
     },
   },
   data() {
-    var validate = (rule, value, callback) => {
+    const validate = (rule, value, callback) => {
       if (value == "") {
         return callback(new Error("必填项不能为空"));
       } else {
@@ -400,13 +400,15 @@ export default {
       dialogFormVisible: false,
       donline_formStOps: [],
       donline_form: {
-        offline_reason: "",
+        offline_reason_id: "",
         offline_remark: "",
-        skuCode: "",
+        platform_youzan_id: "",
       },
       donline_rules: {
-        offline_reason: [{ validator: validate, required: true, trigger: "blur" }],
-        offline_remark: [{ validator: validate, required: true, trigger: "blur" }],
+        offline_reason_id: [
+          { message: "请选择下线原因", required: true, trigger: "change" },
+        ],
+        offline_remark: [{ message: "请输入下线备注", required: true, trigger: "blur" }],
       },
       fileUrl: urlConfig.baseURL,
       ruleForm: {
@@ -539,6 +541,42 @@ export default {
       this.parmValue.page = 1;
       await this.searchList();
     },
+    //点击下线
+    async showDonlineDlg(platform_youzan_id) {
+      this.donline_form = {
+        offline_reason_id: "",
+        offline_remark: "",
+        platform_youzan_id: platform_youzan_id,
+      };
+      this.dialogFormVisible = true;
+    },
+    //商品下线原因 确定
+    async donlineDlg() {
+      await this.$refs.donline_Form.validate(async (valid) => {
+        if (valid) {
+          this.loading = true;
+          const obj = JSON.parse(JSON.stringify(this.donline_form));
+          const res = await asyncRequest.yz_goodoff(obj);
+          this.dialogFormVisible = false;
+          if (res && res.code === 0) {
+            this.loading = false;
+            this.$notify.success({
+              title: res.message,
+              message: "",
+            });
+            await this.searchList();
+          } else if (res && res.code >= 100 && res.code <= 104) {
+            await this.logout();
+          } else {
+            this.loading = false;
+            this.$message.warning(res.message);
+          }
+        } else {
+          console.log("error submit!!");
+          return false;
+        }
+      });
+    },
     //导出
     async goodsExport() {
       if (
@@ -744,100 +782,7 @@ export default {
      * @param {String} id id
      * @param {String} status 0-禁用 1-启用
      */
-    async get_donline(platform_youzan_id) {
-      await this.$confirm(`确定要下线商品?`, {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning",
-      })
-        .then(async () => {
-          this.loading = true;
-          let obj = {
-            platform_youzan_id: platform_youzan_id,
-          };
 
-          const res = await asyncRequest.yz_goodoff(obj);
-          if (res && res.code === 0) {
-            this.loading = false;
-            this.$notify.success({
-              title: res.message,
-              message: "",
-            });
-            await this.searchList();
-          } else if (res && res.code >= 100 && res.code <= 104) {
-            await this.logout();
-          } else {
-            this.loading = false;
-            this.$message.warning(res.message);
-          }
-        })
-        .catch(() => {
-          console.log("取消");
-        });
-    },
-    /**
-     * 启用/禁用
-     * @param {String} id id
-     * @param {String} status 0-禁用 1-启用
-     */
-    async changeStatus(id, status) {
-      await this.$confirm(`确定要改为${status === "1" ? "禁用" : "启用"}?`, {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning",
-      })
-        .then(async () => {
-          this.loading = true;
-          const model = {
-            id: id,
-            status: status === "1" ? "0" : "1",
-          };
-          const res = await asyncRequest.status(model);
-          if (res && res.code === 0) {
-            this.loading = false;
-            this.$notify.success({
-              title: "状态修改成功!",
-              message: "",
-            });
-            await this.searchList();
-          } else if (res && res.code >= 100 && res.code <= 104) {
-            await this.logout();
-          } else {
-            this.loading = false;
-            this.$message.warning(res.message);
-          }
-        })
-        .catch(() => {
-          console.log("取消");
-        });
-    },
-    async deleteItem(code) {
-      await this.$confirm("确定要删除?", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning",
-      })
-        .then(async () => {
-          const model = {
-            codes: [code],
-          };
-          const res = await asyncRequest.delete(model);
-          if (res && res.code === 0) {
-            this.$notify.success({
-              title: "删除成功",
-              message: "",
-            });
-            this.searchList();
-          } else if (res && res.code >= 100 && res.code <= 104) {
-            await this.logout();
-          } else {
-            this.$message.warning(res.message);
-          }
-        })
-        .catch(() => {
-          console.log("取消");
-        });
-    },
     // 刷新表格
     async searchList() {
       if (