潘超林 hai 6 meses
pai
achega
d013c39926

+ 11 - 1
src/api/manage/product.js

@@ -135,4 +135,14 @@ export function queryUserRelevanceTemplate(query) {
         method: 'get',
         params: query
     })
-}
+}
+
+export function deleteGoodsDrafts(query) {
+    return request({
+        url: '/system/goods/deleteGoodsDrafts',
+        method: 'post',
+        data: query
+    })
+}
+
+

+ 10 - 0
src/api/manage/writeoff.js

@@ -0,0 +1,10 @@
+import request from '@/utils/request'
+
+
+export function queryWriteOffOrder(query) {
+    return request({
+        url: '/system/order/queryWriteOffOrder',
+        method: 'get',
+        params: query
+    })
+}

+ 21 - 3
src/views/manage/sales.vue

@@ -143,9 +143,27 @@
       </el-table-column>
       <el-table-column label="商品名称" align="center" prop="spuName" />
       <el-table-column label="分类" align="center" prop="categoryName" />
-      <el-table-column label="价格(元)" align="center" prop="price" />
-      <el-table-column label="实际库存" align="center" prop="stock"> </el-table-column>
-      <el-table-column label="销量" align="center" prop="saleCount" />
+      <el-table-column label="价格(元)" align="center" prop="price">
+        <template slot-scope="scope">
+          {{ scope.row.price }}/  {{ scope.row.unit }}
+        </template>
+      </el-table-column>
+
+      <el-table-column label="预计库存" align="center" prop="totalPredictStocks">
+        <template slot-scope="scope">
+          {{ scope.row.totalPredictStocks }}{{ scope.row.unit }}
+        </template>
+      </el-table-column>
+      <el-table-column label="实际库存" align="center" prop="stock">
+        <template slot-scope="scope">
+          {{ scope.row.stock }}{{ scope.row.unit }}
+        </template>
+      </el-table-column>
+      <el-table-column label="销量" align="center" prop="saleCount">
+        <template slot-scope="scope">
+          {{ scope.row.saleCount }}{{ scope.row.unit }}
+        </template>
+      </el-table-column>
       <el-table-column label="销售额(元)" align="center" prop="salePrice" />
       <el-table-column label="状态" align="center" prop="spuStatus">
         <template slot-scope="scope">

+ 51 - 12
src/views/product/createProduct.vue

@@ -17,7 +17,7 @@
           <div class="dialog-footer" style="text-align: center">
             <el-button @click="submitCancel">取 消</el-button>
             <el-button type="primary" @click="submitForm" :loading="btnLading"
-              >保 存</el-button
+              >发 布</el-button
             >
 
             <el-button type="primary" @click="submitFormDraft">存入草稿箱</el-button>
@@ -226,6 +226,7 @@
 </template>
 
 <script>
+import { getStoreInfo } from "@/api/common/index";
 import { publishGoods } from "@/api/publish/index";
 import { saveGoodsDraft, queryUserRelevanceTemplate } from "@/api/manage/product";
 import basicInfo from "./module/basic-info.vue";
@@ -233,6 +234,7 @@ import productInfo from "./module/product-info.vue";
 import salesInfo from "./module/sales-info.vue";
 import phoneView from "@/components/phoneView/index.vue";
 import Amap from "@/components/Map/map.vue";
+import moment from "moment";
 export default {
   components: { Amap, phoneView, basicInfo, salesInfo, productInfo },
   data() {
@@ -242,11 +244,39 @@ export default {
       btnLading: false,
     };
   },
+  mounted() {
+    this.getInfo();
+  },
   methods: {
+    getInfo() {
+      getStoreInfo().then((res) => {
+        if (res.code == 200) {
+          if (res.data.scope == 0) {
+            if (this.form.saleType == 2) {
+              this.$refs.salesRefs.setShowCom(true);
+            } else {
+              this.$refs.salesRefs.setShowCom(false);
+            }
+          } else {
+            this.$refs.salesRefs.setShowCom(true);
+          }
+        }
+      });
+    },
     submitFormDraft() {
+      if (this.form.categoryId) {
+        this.form.categoryId = this.form.categoryId[this.form.categoryId.length - 1];
+      }
+      if (this.form.presaleStartTime && this.form.presaleEndTime) {
+        this.form.presaleStartTime = moment(this.form.datePicker[0]).valueOf();
+        this.form.presaleEndTime = moment(this.form.datePicker[1]).valueOf();
+      }
+      if (this.form.bannerList?.length > 0) {
+        this.form.bannerList.shift();
+      }
       saveGoodsDraft(this.form).then((res) => {
         if (res.code == 200) {
-          this.$message.success(`保存成功!请前往草稿箱查看`);
+          this.$message.success(`发布成功!请前往草稿箱查看`);
           this.$store.dispatch("tagsView/delView", this.$route); //关闭当前页
           this.$router.replace({ path: "/product/product/index" });
         }
@@ -270,16 +300,20 @@ export default {
         });
     },
     async submitForm() {
+      let bool = false;
       queryUserRelevanceTemplate().then((res) => {
         if (res.code == 200) {
-          if (!res.data) {
-            this.$message.success(
-              "您未设置同城运费规则,请先暂存草稿箱,待设置同城运费规则后再次进行发布!"
-            );
-            return false;
+          if (res.data) {
+            bool = res.data;
           }
         }
       });
+      if (bool) {
+        this.$message.error(
+          "您未设置同城运费规则,请先暂存草稿箱,待设置同城运费规则后再次进行发布!"
+        );
+        return;
+      }
       let basic = await this.$refs.basicRefs.formvalidate();
       if (basic) {
         let sales = await this.$refs.salesRefs.formvalidate();
@@ -298,7 +332,13 @@ export default {
         this.$message.error(`商品规格不能为空`);
         return;
       }
-
+      if (this.form.categoryId) {
+        this.form.categoryId = this.form.categoryId[this.form.categoryId.length - 1];
+      }
+      if (this.form.presaleStartTime && this.form.presaleEndTime) {
+        this.form.presaleStartTime = moment(this.form.datePicker[0]).valueOf();
+        this.form.presaleEndTime = moment(this.form.datePicker[1]).valueOf();
+      }
       if (this.form.bannerList?.length > 0) {
         this.form.bannerList.shift();
       }
@@ -316,14 +356,13 @@ export default {
     },
     updateValue(val) {
       this.form = { ...this.form, ...val };
-      console.log("this.form", this.form);
-
-      if (this.form.saleType == 2 && this.form.scope == 0) {
+      if (this.form.saleType == 2) {
+        this.$refs.salesRefs.setShowCom(true);
+      } else if (this.form.scope == 0) {
         this.$refs.salesRefs.setShowCom(false);
       } else {
         this.$refs.salesRefs.setShowCom(true);
       }
-
       this.headerImg = [];
       if (val.vid || this.form.vid) {
         this.headerImg.push({

+ 139 - 55
src/views/product/list/allProduct.vue

@@ -22,13 +22,18 @@
           v-model="queryParams.categoryId"
           ref="formCascader"
           placeholder="请选择分类"
-          :props="categoryprops"   style="width: 240px"
+          :props="categoryprops"
+          style="width: 240px"
           @change="cascaderChange"
         />
       </el-form-item>
 
       <el-form-item label="商品状态" prop="spuStatus">
-        <el-select v-model="queryParams.spuStatus" placeholder="请选择商品状态"    style="width: 240px">
+        <el-select
+          v-model="queryParams.spuStatus"
+          placeholder="请选择商品状态"
+          style="width: 240px"
+        >
           <el-option label="全部" value=""> </el-option>
           <el-option label="售罄" value="2"> </el-option>
           <el-option label="上架" value="0"> </el-option>
@@ -36,26 +41,33 @@
         </el-select>
       </el-form-item>
       <el-form-item label="销售方式" prop="saleType">
-        <el-select v-model="queryParams.saleType" placeholder="请选择销售方式"    style="width: 240px">
+        <el-select
+          v-model="queryParams.saleType"
+          placeholder="请选择销售方式"
+          style="width: 240px"
+        >
           <el-option label="全部" value=""> </el-option>
-          <el-option label="整车" value="0" v-if="shopInfo.scope==0"> </el-option>
-          <el-option label="拼车" value="2" v-if="shopInfo.scope==0"> </el-option>
-          <el-option label="礼包商品" value="4" v-if="shopInfo.scope==1"> </el-option>
-          <el-option label="普通商品" value="0" v-if="shopInfo.scope==1"> </el-option>
+          <el-option label="整车" value="0" v-if="shopInfo.scope == 0"> </el-option>
+          <el-option label="拼车" value="2" v-if="shopInfo.scope == 0"> </el-option>
+          <el-option label="礼包商品" value="4" v-if="shopInfo.scope == 1"> </el-option>
+          <el-option label="普通商品" value="0" v-if="shopInfo.scope == 1"> </el-option>
         </el-select>
       </el-form-item>
-      <el-form-item label="关联活动商品" prop="promotionTitle">
-        <el-select v-model="queryParams.promotionTitle" placeholder="请选择关联活动商品"    style="width: 240px">
+      <el-form-item label="关联活动商品" prop="promotionTag">
+        <el-select
+          v-model="queryParams.promotionTag"
+          placeholder="请选择关联活动商品"
+          style="width: 240px"
+        >
           <el-option label="全部" value=""> </el-option>
-          <el-option label="年货节" value="年货节"> </el-option>
+          <el-option label="年货节" value="1"> </el-option>
         </el-select>
       </el-form-item>
-      <el-form-item label="是否为特价商品" prop="scope">
-        <el-select v-model="queryParams.scope" placeholder="请选择关联活动商品"    style="width: 240px">
+      <el-form-item label="是否为特价商品" prop="scope" v-if="shopInfo.scope == 1">
+        <el-select v-model="queryParams.scope" placeholder="请选择" style="width: 240px">
           <el-option label="全部" value=""> </el-option>
           <el-option label="是" value="1"> </el-option>
           <el-option label="否" value="0"> </el-option>
-          
         </el-select>
       </el-form-item>
 
@@ -95,7 +107,9 @@
           </el-button>
           <el-dropdown-menu slot="dropdown">
             <el-dropdown-item @click.native="BatchRemove">批量删除</el-dropdown-item>
-            <el-dropdown-item @click.native="handleEvents">批量加入活动</el-dropdown-item>
+            <el-dropdown-item @click.native="handleEvents" v-if="shopInfo.scope == 1"
+              >批量加入活动</el-dropdown-item
+            >
             <el-dropdown-item @click.native="handleExport">批量导出</el-dropdown-item>
             <el-dropdown-item @click.native="handleDelist">批量下架</el-dropdown-item>
           </el-dropdown-menu>
@@ -138,37 +152,59 @@
           {{ scope.row.lowestPurchase }}{{ scope.row.unit }}
         </template>
       </el-table-column>
-      <el-table-column label="库存" align="center">
+
+      <el-table-column label="预计库存" align="center">
+        <template slot-scope="scope">
+          {{ scope.row.totalPredictStocks ? scope.row.totalPredictStocks : 0
+          }}{{ scope.row.unit }}
+        </template>
+      </el-table-column>
+      <el-table-column label="实际库存" align="center">
         <template slot-scope="scope">
           {{ scope.row.totalStocks }}{{ scope.row.unit }}
         </template>
       </el-table-column>
-      <el-table-column label="销量" align="center" prop="salesVolume"> </el-table-column>
+      <el-table-column label="展示销量" align="center" prop="lookSalesVolume">
+      </el-table-column>
       <!-- <el-table-column label="分销比例" align="center" prop="shareRate" /> -->
-      <el-table-column label="销售模式" align="center">
+      <el-table-column label="销售模式" align="center" v-if="shopInfo.scope == 0">
         <template slot-scope="scope">
-          {{ scope.row.saleModel == 1 ? "现货" : "预售" }}
+          <span v-if="scope.row.scope == 0">
+            {{ scope.row.saleModel == 1 ? "现货" : "预售" }}
+          </span>
+          <span v-else> </span>
         </template>
       </el-table-column>
       <el-table-column label="销售方式" align="center">
         <template slot-scope="scope">
-          {{
-            scope.row.saleType == 0
-              ? "整车"
-              : scope.row.saleType == 1
-              ? "零售"
-              : scope.row.saleType == 2
-              ? "拼车"
-              : scope.row.saleType == 3
-              ? "一件代发"
-              : ""
-          }}
+          <span v-if="scope.row.scope == 1">
+            {{
+              scope.row.saleType == 0 ? "普通商品" : scope.row.saleType == 4 ? "礼包" : ""
+            }}
+          </span>
+          <span v-else-if="scope.row.scope == 0">
+            {{
+              scope.row.saleType == 0
+                ? "整车"
+                : scope.row.saleType == 1
+                ? "零售"
+                : scope.row.saleType == 2
+                ? "拼车"
+                : scope.row.saleType == 3
+                ? "一件代发"
+                : ""
+            }}
+          </span>
+          <span v-else> </span>
         </template>
       </el-table-column>
       <el-table-column label="关联活动" align="center" prop="promotionTitle">
+        <template slot-scope="scope">
+          {{ scope.row.promotionTag === "1" ? "年货节" : "" }}
+        </template>
       </el-table-column>
 
-      <el-table-column label="发布状态" align="center">
+      <!-- <el-table-column label="发布状态" align="center">
         <template slot-scope="scope">
           {{
             scope.row.releaseStatus == 0
@@ -178,7 +214,7 @@
               : ""
           }}
         </template>
-      </el-table-column>
+      </el-table-column> -->
       <el-table-column label="商品属性" align="center" width="150">
         <template slot-scope="scope">
           <div v-for="(item, index) in scope.row.propNew" :key="index">
@@ -203,6 +239,13 @@
           }}
         </template>
       </el-table-column>
+
+      <el-table-column label="是否特价" align="center">
+        <template slot-scope="scope">
+          {{ scope.row.scope == 2 ? "是" : "否" }}
+        </template>
+      </el-table-column>
+
       <el-table-column
         label="操作"
         align="center"
@@ -218,7 +261,7 @@
             >预览</el-button
           >
           <el-button
-            v-if="scope.row.scope == 1"
+            v-if="scope.row.scope == 1 && !scope.row.promotionTitle"
             size="mini"
             type="text"
             @click="handleBargain(scope.row)"
@@ -287,6 +330,7 @@
       title="活动列表"
       :visible.sync="dialogVisible"
       :before-close="dialogVisible == false"
+      width="60%"
     >
       <el-table
         :data="eventList"
@@ -301,8 +345,24 @@
         </el-table-column>
         <el-table-column prop="title" label="活动名称"> </el-table-column>
         <el-table-column prop="intro" label="活动介绍"> </el-table-column>
-        <el-table-column prop="startTime" label="开始时间"> </el-table-column>
-        <el-table-column prop="endTime" label="结束时间"> </el-table-column>
+        <el-table-column prop="startTime" label="开始时间">
+          <template slot-scope="scope">
+            {{
+              scope.row.startTime
+                ? $moment(scope.row.startTime).format("YYYY-MM-DD HH:mm:ss")
+                : ""
+            }}
+          </template>
+        </el-table-column>
+        <el-table-column prop="endTime" label="结束时间">
+          <template slot-scope="scope">
+            {{
+              scope.row.endTime
+                ? $moment(scope.row.endTime).format("YYYY-MM-DD HH:mm:ss")
+                : ""
+            }}-
+          </template>
+        </el-table-column>
         <el-table-column prop="tag" label="是否使用代金券">
           <template slot-scope="scope">
             <el-tag>
@@ -328,27 +388,29 @@
       title="设为特价商品"
       :visible.sync="bargainVisible"
       :before-close="bargainVisible == false"
-      width="60%"
+      width="80%"
     >
       <el-table
-        :data="speList.skuList"
+        :data="speList ? speList.skuList : []"
         row-key="id"
         @current-change="eventsChange"
         highlight-current-row
       >
         <el-table-column prop="title" label="规格名称">
           <template slot-scope="scope">
-            {{ scope.row.skuSpecsList[0].specsName }}
+            {{ scope.row.skuSpecsList ? scope.row.skuSpecsList[0].specsName : "" }}
           </template>
         </el-table-column>
         <el-table-column prop="title" label="规格内容">
           <template slot-scope="scope">
-            {{ scope.row.skuSpecsList[0].specsValue }}
+            {{ scope.row.skuSpecsList ? scope.row.skuSpecsList[0].specsValue : "" }}
           </template>
         </el-table-column>
         <el-table-column prop="title" label="单价">
           <template slot-scope="scope">
-            {{ scope.row.skuPriceList[0].originalPrice }}元/{{ speList.unit }}
+            {{
+              scope.row.skuPriceList ? scope.row.skuPriceList[0].originalPrice : ""
+            }}元/{{ speList.unit }}
           </template>
         </el-table-column>
         <el-table-column prop="title" label="优惠价">
@@ -413,6 +475,7 @@
 </template>
 
 <script>
+import moment from "moment";
 import {
   getGoodsListPage,
   getGoodsInfo,
@@ -526,17 +589,22 @@ export default {
         if (res.code == 200) {
           let params = res.data;
           this.speList = params;
-
           this.speList.skuList.forEach((e) => {
-            e.skuPriceList[0].price = undefined;
+            e.skuPriceList[0].price = "";
             if (!e.limitationDto) {
-              e.limitationDto = {
-                dayCount: undefined,
-                oneCount: undefined,
-                totalCount: undefined,
-              };
+              this.$set(e, "limitationDto", {
+                dayCount: "",
+                oneCount: "",
+                totalCount: "",
+              });
+              // e.limitationDto = {
+              //   dayCount: "",
+              //   oneCount: "",
+              //   totalCount: "",
+              // };
             }
           });
+          this.$forceUpdate();
           this.bargainVisible = true;
         }
       });
@@ -581,6 +649,16 @@ export default {
         this.$message.error("请选择要参与活动的商品!");
         return;
       }
+
+      for (let index = 0; index < this.multipleSelection.length; index++) {
+        if (
+          this.multipleSelection[index].promotionTitle ||
+          this.multipleSelection[index].scope == 2
+        ) {
+          this.$message.error("所选商品包含已参加活动商品,无法批量加入活动,请重新选择");
+          return;
+        }
+      }
       this.dialogVisible = true;
       promotionList({
         pageNo: 1,
@@ -655,6 +733,13 @@ export default {
         this.$message.error("请选择要导出的商品!");
         return;
       }
+      for (let index = 0; index < this.multipleSelection.length; index++) {
+        if (this.multipleSelection[index].spuStatus == 1) {
+          this.$message.error("所选商品包含已下架商品,无法批量下架,请重新选择");
+          return;
+        }
+      }
+
       let ids = [];
       this.multipleSelection.forEach((e) => {
         ids.push(e.id);
@@ -700,7 +785,7 @@ export default {
       this.multipleSelection.forEach((e) => {
         ids.push(e.id);
       });
-      this.queryParams.spuId = ids.toString();
+      this.queryParams.spuIds = ids.toString();
       this.download(
         "system/goods/export",
         {
@@ -819,14 +904,13 @@ export default {
       });
     },
     handleUpdate(record) {
-      getGoodsInfo({ spuId: record.id }).then((res) => {
-        if (res.code == 200) {
-          let params = res.data;
-          this.$router.push({
-            path: "/product/product/updateProduct",
-            query: { params },
-          });
-        }
+      let params = {
+        id: record.id,
+        type: "all",
+      };
+      this.$router.push({
+        path: "/product/product/updateProduct",
+        query: { params },
       });
     },
     computePrice(data) {

+ 96 - 66
src/views/product/list/draftProduct.vue

@@ -1,15 +1,15 @@
 <template>
   <div class="app-container">
-    <!-- <el-form
+    <el-form
       :model="queryParams"
       ref="queryForm"
       size="small"
       :inline="true"
       label-width="80px"
     >
-      <el-form-item label="商品名称" prop="spuName">
+      <el-form-item label="商品名称" prop="title">
         <el-input
-          v-model="queryParams.spuName"
+          v-model="queryParams.title"
           placeholder="请输入商品名称"
           clearable
           style="width: 240px"
@@ -23,87 +23,78 @@
         >
         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
       </el-form-item>
-    </el-form> -->
+    </el-form>
+    <el-col :span="1.5">
+      <el-button
+        type="danger"
+        :disabled="multipleSelection.length < 1"
+        plain
+        size="mini"
+        @click="handleRemoves"
+        >批量删除</el-button
+      >
+    </el-col>
 
-    <el-table v-loading="loading" :data="configList" row-key="id">
-      <!-- <el-table-column type="selection" width="55" align="center" /> -->
+    <el-table
+      v-loading="loading"
+      :data="configList"
+      @selection-change="handleSelectionChange"
+      row-key="goodsDraftId"
+    >
+      <el-table-column type="selection" width="55" align="center" />
       <el-table-column label="商品图片" align="center">
         <template slot-scope="scope">
           <el-image
             style="width: 60px; height: 60px"
-            :src="scope.row.goodsDto.pic"
-            :preview-src-list="[scope.row.goodsDto.pic]"
+            :src="scope.row.pic"
+            :preview-src-list="[scope.row.pic]"
           >
           </el-image>
         </template>
       </el-table-column>
       <el-table-column label="商品名称" align="center">
         <template slot-scope="scope">
-          {{ scope.row.goodsDto.title }}
+          {{ scope.row.title }}
         </template>
       </el-table-column>
       <el-table-column label="分类" align="center">
         <template slot-scope="scope">
-          {{ scope.row.goodsDto.categoryName }}
+          {{ scope.row.categoryName }}
         </template>
       </el-table-column>
       <el-table-column label="价格" align="center">
         <template slot-scope="scope">
-          {{ scope.row.goodsDto.skuList[0].skuPriceList[0].price }}/{{
-            scope.row.goodsDto.unit
+          {{ scope.row.skuList ? scope.row.skuList[0].skuPriceList[0].price : "" }}/{{
+            scope.row.unit
           }}
         </template>
       </el-table-column>
 
       <el-table-column label="起批量" align="center">
         <template slot-scope="scope">
-          {{ scope.row.goodsDto.skuList[0].skuPriceList[0].minPurchase
-          }}{{ scope.row.goodsDto.unit }}
+          {{ scope.row.skuList ? scope.row.skuList[0].skuPriceList[0].minPurchase : ""
+          }}{{ scope.row.unit }}
         </template>
       </el-table-column>
       <el-table-column label="库存" align="center">
         <template slot-scope="scope">
-          {{ scope.row.goodsDto.skuList[0].stock }}{{ scope.row.goodsDto.unit }}
+          {{ scope.row.skuList ? scope.row.skuList[0].stock + "/" + scope.row.unit : "" }}
         </template>
       </el-table-column>
       <el-table-column label="经营区域" align="center">
         <template slot-scope="scope">
-          {{
-            scope.row.goodsDto.scope == 0
-              ? "全国"
-              : scope.row.goodsDto.scope == 1
-              ? "同城"
-              : "特价"
-          }}
+          {{ scope.row.scope == 0 ? "全国" : scope.row.scope == 1 ? "同城" : "特价" }}
         </template>
       </el-table-column>
-
       <el-table-column label="销售模式" align="center">
         <template slot-scope="scope">
-          {{
-            scope.row.goodsDto.saleModel == 1
-              ? "现货"
-              : scope.row.goodsDto.saleModel == 2
-              ? "预售"
-              : ""
-          }}
+          <span v-if="scope.row.scope == 0">
+            {{ scope.row.saleModel == 1 ? "现货" : "预售" }}
+          </span>
+          <span v-else> </span>
         </template>
       </el-table-column>
-      <!-- <el-table-column label="销售方式" align="center">
-        <template slot-scope="scope">
-          {{
-            scope.row.goodsDto.saleType == 0
-              ? "整车"
-              : scope.row.goodsDto.saleType == 1
-              ? "同城"
-              : scope.row.goodsDto.saleType == 2
-              ? "拼车"
-              : scope.row.goodsDto.saleType == 3
-              ? "一件代发"
-              : ""
-          }}  
-        </template>
-      </el-table-column> --> 
+
       <el-table-column
         label="操作"
         align="center"
@@ -136,41 +127,54 @@
 
 <script>
 import {
-  getGoodsListPage,
-  getGoodsInfo,
-  GoodsUpOrDown,
-  editGoods,
-  getGoodsDraftById,
-  goodsRemove,
   deleteGoodsDraft,
   getGoodsDraftByUserId,
+  deleteGoodsDrafts,
 } from "@/api/manage/product";
+import { getStoreInfo } from "@/api/common/index";
 export default {
   name: "product",
   data() {
     return {
       // 遮罩层
-      loading: true,
+      loading: false,
       configList: [],
       // 查询参数
+      multipleSelection: [],
       queryParams: {
         pageNo: 1,
         pageSize: 10,
+        title: "",
       },
       // 表单参数
       form: {},
+      shopInfo: {},
     };
   },
   mounted() {
     this.getList();
+    this.getInfo();
   },
   methods: {
+    getInfo() {
+      getStoreInfo().then((res) => {
+        if (res.code == 200) {
+          this.shopInfo = res.data;
+        }
+      });
+    },
     /** 查询参数列表 */
     getList() {
       this.loading = true;
-      getGoodsDraftByUserId().then((res) => {
-        this.configList = res.data;
-        console.log(this.configList);
+      this.configList = [];
+      getGoodsDraftByUserId(this.queryParams).then((res) => {
+        for (let index = 0; index < res.data.length; index++) {
+          res.data[index] = res.data[index].goodsDto;
+          this.configList.push(res.data[index]);
+        }
+        // this.configList = res.data;
+        console.log("1231231", this.configList);
+
         this.loading = false;
       });
     },
@@ -182,7 +186,7 @@ export default {
       })
         .then(() => {
           deleteGoodsDraft({
-            id: record.id,
+            id: record.goodsDraftId,
           }).then((res) => {
             if (res.code == 200) {
               this.$message.success(`删除成功!`);
@@ -197,8 +201,37 @@ export default {
           });
         });
     },
+    handleRemoves() {
+      this.$confirm("是否确认批量删除草稿箱?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          let ids = [];
 
+          for (let index = 0; index < this.multipleSelection.length; index++) {
+            console.log("xzcz", this.multipleSelection[index]);
+            ids.push(this.multipleSelection[index].goodsDraftId);
+          }
+          deleteGoodsDrafts({
+            ids: ids.toString(),
+          }).then((res) => {
+            if (res.code == 200) {
+              this.$message.success(`删除成功!`);
+              this.getList();
+            }
+          });
+        })
+        .catch(() => {
+          this.$message({
+            type: "info",
+            message: "已取消操作",
+          });
+        });
+    },
     handleSelectionChange(val) {
+      console.log(val);
       this.multipleSelection = val;
     },
 
@@ -219,20 +252,17 @@ export default {
     },
     /** 重置按钮操作 */
     resetQuery() {
-      this.dateRange = [];
       this.resetForm("queryForm");
       this.handleQuery();
     },
     handleUpdate(record) {
-      getGoodsDraftById({ id: record.id }).then((res) => {
-        if (res.code == 200) {
-          let params = res.data.goodsDto;
-          params.goodsDraftId=record.id
-          this.$router.push({
-            path: "/product/product/updateProduct",
-            query: { params },
-          });
-        }
+      let params = {
+        id: record.goodsDraftId,
+        type: "draft",
+      };
+      this.$router.push({
+        path: "/product/product/updateProduct",
+        query: { params },
       });
     },
   },

+ 62 - 81
src/views/product/module/basic-info.vue

@@ -8,16 +8,6 @@
     :rules="rules"
   >
     <el-row>
-      <!-- <el-col :span="24">
-          <el-form-item>
-            <span slot="label"><span class="required">*</span> 经营区域</span>
-            <el-radio-group v-model="form.scope" @change="passValue">
-              <el-radio :label="0" v-if="shopInfo.scope == 0">全国</el-radio>
-              <el-radio :label="1" v-if="shopInfo.scope == 1">同城</el-radio>
-              <el-radio :label="2" v-if="shopInfo.scope == 1">特价</el-radio>
-            </el-radio-group>
-          </el-form-item>
-        </el-col> -->
       <el-col :span="24">
         <el-form-item prop="saleType">
           <span slot="label">销售方式</span>
@@ -48,13 +38,13 @@
         <el-form-item prop="datePicker">
           <span slot="label">预售时间</span>
           <el-date-picker
-            v-model="datePicker"
+            v-model="form.datePicker"
             type="datetimerange"
             range-separator="至"
             value-format="yyyy-MM-dd HH:mm:ss"
             start-placeholder="开始日期"
             end-placeholder="结束日期"
-            @change="picker"
+            @change="pickerChange"
           >
           </el-date-picker>
         </el-form-item>
@@ -191,6 +181,7 @@ import { getStoreInfo } from "@/api/common/index";
 import { getClassificationListPage } from "@/api/common/index.js";
 import { getToken } from "@/utils/auth";
 import axios from "axios";
+import moment from "moment";
 export default {
   props: ["data"],
   components: { draggable },
@@ -209,6 +200,7 @@ export default {
         pic: "",
         categoryName: "",
         categoryIds: [],
+        datePicker: [],
         presaleStartTime: "",
         presaleEndTime: "",
       },
@@ -233,66 +225,64 @@ export default {
         carpoolSuccessTime: [
           { required: true, message: "拼车成功时间不能为空", trigger: "blur" },
         ],
+        datePicker: [{ required: true, message: "预售时间不能为空", trigger: "blur" }],
       },
       index: 0,
       shopInfo: {},
-      datePicker: [],
       categoryName: "",
       radio: "",
     };
   },
-  watch: {
-    //监听info对象
-    data: {
-      handler(newVal, oldVal) {
-        //监听info对象变化
-        if (newVal) {
-          for (const key in this.form) {
-            this.form[key] = newVal[key];
-          }
-          this.form.carpoolSuccessTime = newVal.carpoolSuccessTime;
-          this.form.scope = newVal.scope;
-          this.form.saleType = newVal.saleType;
-          this.form.saleModel = newVal.saleModel;
-          this.form.categoryId = newVal.categoryId;
-          this.form.title = newVal.title;
-          this.form.giftDesc = newVal.giftDesc;
-          this.form.vid = newVal.vid;
-          this.form.bannerList = newVal.bannerList;
-          this.form.pic = newVal.pic;
-          this.form.categoryName = newVal.categoryName;
-          this.form.categoryIds = newVal.categoryIds;
-          this.form.presaleStartTime = newVal.presaleStartTime;
-          this.form.presaleEndTime = newVal.presaleEndTime;
-          this.bannerList = [];
-          this.datePicker = [];
-          if (newVal.presaleStartTime && newVal.presaleEndTime) {
-            this.datePicker.push(newVal.presaleStartTime);
-            this.datePicker.push(newVal.presaleEndTime);
-          } else {
-            this.datePicker = [];
-          }
-          if (this.form.bannerList?.length > 0) {
-            this.bannerList = this.form.bannerList;
-          }
-          // if (this.form.pic) {
-          //   this.bannerList.unshift({
-          //     url: this.form.pic,
-          //   });
-          // }
-          console.log("111", this.form);
-        }
-      },
-      deep: true, //深度监听
-      immediate: true,
-    },
-  },
-
   created() {
     this.getInfo();
   },
 
   methods: {
+    getFormInfo(record) {
+      this.form.datePicker = [];
+      this.form.categoryId = record.categoryId;
+      this.form.categoryIds = record.categoryIds;
+      this.form.carpoolSuccessTime = record.carpoolSuccessTime;
+      this.form.scope = record.scope;
+      this.form.saleType = record.saleType;
+      this.form.saleModel = record.saleModel;
+      this.form.title = record.title;
+      this.form.giftDesc = record.giftDesc;
+      this.form.vid = record.vid;
+      this.form.bannerList = record.bannerList;
+      this.form.pic = record.pic;
+      this.form.categoryName = record.categoryName;
+      this.categoryName = record.categoryName;
+      if (record.presaleEndTime && record.presaleStartTime) {
+        this.form.presaleStartTime = moment(record.presaleStartTime).format(
+          "yyyy-MM-DD HH:mm:ss"
+        );
+        this.form.presaleEndTime = moment(record.presaleEndTime).format(
+          "yyyy-MM-DD HH:mm:ss"
+        );
+        this.$nextTick(() => {
+          this.$set(this.form, "datePicker", [
+            this.form.presaleStartTime,
+            this.form.presaleEndTime,
+          ]);
+        });
+      } else {
+        this.form.presaleStartTime = "";
+        this.form.presaleEndTime = "";
+      }
+      this.bannerList = [];
+      if (this.form.bannerList?.length > 0) {
+        this.bannerList = this.form.bannerList;
+      }
+      if (this.form.pic) {
+        this.bannerList.unshift({
+          fileUrl: record.pic,
+          sort: 1,
+        });
+      }
+      this.$forceUpdate();
+    },
+
     beforeAvatarUpload(file) {
       const isJPG = file.type === "image/jpeg" || "image/png" || "image/jpg";
       const isLt2M = file.size / 1024 / 1024 < 2;
@@ -306,8 +296,6 @@ export default {
     },
 
     formvalidate() {
-      console.log(this.bannerList);
-
       let that = this;
       return new Promise((resolve) => {
         that.$refs.queryForm.validate((valid, row) => {
@@ -330,9 +318,7 @@ export default {
       this.bannerList.splice(index, 1);
       this.passValue();
     },
-    picker() {
-      this.form.presaleStartTime = this.datePicker[0];
-      this.form.presaleEndTime = this.datePicker[1];
+    pickerChange() {
       this.passValue();
     },
     getInfo() {
@@ -374,25 +360,20 @@ export default {
       this.passValue();
     },
     cascaderChange(val) {
-      let nodes = this.$refs.formCascader.getCheckedNodes();
-      this.form.categoryName = nodes[0].label;
-      // this.form.categoryIds = val;
-      let list = [];
-      val.forEach((e) => {
-        list.push(parseInt(e));
+      this.$nextTick(() => {
+        const dom = document.getElementsByClassName("el-radio is-checked");
+        //这里我把dom打出来看了 最后一个选项才是我选中的节点 即[length-1] 有的博主写的是 第一个元素 即[0] 大家自行尝试
+        let radioDom = dom[dom.length - 1];
+        const brother = radioDom.nextElementSibling;
+        brother.click();
+        let nodes = this.$refs.formCascader.getCheckedNodes();
+        this.form.categoryName = nodes[0].label;
+        this.form.categoryIds = val;
+        this.form.categoryIds = JSON.stringify(this.form.categoryIds);
+        this.passValue();
       });
-      this.form.categoryIds = JSON.stringify(list);
-      if (val.length == 1) {
-        this.form.categoryId = val[0];
-      } else if (val.length == 2) {
-        this.form.categoryId = val[1];
-      } else if (val.length == 3) {
-        this.form.categoryId = val[2];
-      }
-      this.passValue();
     },
     categoryLazyLoad(node, resolve) {
-      let that = this;
       let level = node.level;
       if (!node.data) {
         getClassificationListPage({ parentId: 0 }).then((res) => {

+ 36 - 37
src/views/product/module/product-info.vue

@@ -1,5 +1,12 @@
 <template>
-  <el-form :model="form" ref="queryForm" size="small"     :rules="rules" :inline="true" label-width="120px">
+  <el-form
+    :model="form"
+    ref="queryForm"
+    size="small"
+    :rules="rules"
+    :inline="true"
+    label-width="120px"
+  >
     <el-row>
       <el-col :span="24">
         <el-form-item prop="spuDesc">
@@ -56,7 +63,7 @@
       <el-col :span="24">
         <el-form-item prop="spuStatus">
           <span slot="label"> 发布状态</span>
-          <el-radio-group v-model="form.spuStatus">
+          <el-radio-group v-model="form.spuStatus" @change="radioChange">
             <el-radio :label="0" :value="0">上架</el-radio>
             <el-radio :label="1" :value="1">下架</el-radio>
           </el-radio-group>
@@ -90,46 +97,35 @@ export default {
       },
     };
   },
-  watch: {
-    //监听info对象
-    data: {
-      handler(newVal, oldVal) {
-        //监听info对象变化
-        if (newVal) {
-          this.form.spuDesc = newVal.spuDesc;
-          this.spuDetailList = [];
-          this.specialList = [];
-          if (newVal.spuDetailList) {
-            newVal.spuDetailList.forEach((e) => {
-              this.spuDetailList.push({
-                url: e.fileUrl,
-                id: e.id,
-                sort: e.sort,
-              });
-            });
-          }
-          if (newVal.specialList) {
-            newVal.specialList.forEach((e) => {
-              this.specialList.push({
-                url: e.fileUrl,
-                id: e.id,
-                sort: e.sort,
-              });
-            });
-          }
-        }
-      },
-      deep: true, //深度监听
-      immediate: true,
+  methods: {
+    getFormInfo(record) {
+      this.form.spuDesc = record.spuDesc;
+      this.spuDetailList = [];
+      this.specialList = [];
+      if (record.spuDetailList) {
+        record.spuDetailList.forEach((e) => {
+          this.spuDetailList.push({
+            url: e.fileUrl,
+            id: e.id,
+            sort: e.sort,
+          });
+        });
+      }
+      if (record.specialList) {
+        record.specialList.forEach((e) => {
+          this.specialList.push({
+            url: e.fileUrl,
+            id: e.id,
+            sort: e.sort,
+          });
+        });
+      }
     },
-  },
 
-  methods: {
     formvalidate() {
-      let that=this
+      let that = this;
       return new Promise((resolve) => {
         that.$refs.queryForm.validate((valid) => {
-          console.log(valid);
           if (valid) {
             resolve(valid);
           } else {
@@ -144,6 +140,9 @@ export default {
         });
       });
     },
+    radioChange() {
+      this.passValue();
+    },
     passValue() {
       if (this.specialList) {
         this.form.specialList = [];

+ 125 - 92
src/views/product/module/sales-info.vue

@@ -9,6 +9,17 @@
   >
     <el-row>
       <el-col :span="24">
+        <el-form-item prop="lookSalesVolume">
+          <span slot="label">展示销量</span>
+          <el-input
+            v-model="form.lookSalesVolume"
+            placeholder="请输入展示销量"
+            clearable
+            @input="passValue"
+          />
+        </el-form-item>
+      </el-col>
+      <el-col :span="24">
         <el-form-item prop="unit">
           <span slot="label">计量单位</span>
           <el-select v-model="form.unit" placeholder="请选择" @change="passValue">
@@ -38,8 +49,8 @@
                   placeholder="请输入规格名称"
                   clearable
                   maxlength="8"
-                  show-word-limit
                   @input="passValue"
+                  show-word-limit
                 />
               </template>
             </el-table-column>
@@ -55,12 +66,25 @@
                 />
               </template>
             </el-table-column>
-            <el-table-column prop="name" label="库存" width="140">
+            <el-table-column prop="name" label="预计库存" width="160">
+              <template slot-scope="scope">
+                <el-input-number
+                  :controls="false"
+                  v-model="scope.row.predictStock"
+                  placeholder="预计库存"
+                  clearable
+                  @input="passValue"
+                >
+                  <template slot="suffix"> {{ form.unit }} </template>
+                </el-input-number>
+              </template>
+            </el-table-column>
+            <el-table-column prop="name" label="实际库存" width="140">
               <template slot-scope="scope">
                 <el-input-number
                   :controls="false"
                   v-model="scope.row.stock"
-                  placeholder="库存"
+                  placeholder="实际库存"
                   clearable
                   @input="passValue"
                 >
@@ -140,24 +164,11 @@
                 {{ computePrice(scope.row) }}元/{{ form.unit }}
               </template>
             </el-table-column>
-            <el-table-column label="净重量(kg)" width="160">
+            <!-- <el-table-column label="是否上架">
               <template slot-scope="scope">
-                <el-input-number
-                  :controls="false"
-                  v-model="scope.row.weight"
-                  placeholder="净重量"
-                  clearable
-                  @input="passValue"
-                >
-                  <template slot="suffix"> /Kg </template>
-                </el-input-number>
-              </template>
-            </el-table-column>
-            <el-table-column label="是否上架">
-              <template slot-scope="scope">
-                <el-switch v-model="sj"> </el-switch>
+                <el-switch v-model="scope.row.sj"> </el-switch>
               </template>
-            </el-table-column>
+            </el-table-column> -->
 
             <el-table-column prop="address" label="操作">
               <template slot-scope="scope">
@@ -170,6 +181,7 @@
               </template>
             </el-table-column>
           </el-table>
+
           <el-table
             :data="form.skuList"
             style="width: 100%; margin-top: 20px"
@@ -182,8 +194,8 @@
                   placeholder="请输入规格名称"
                   clearable
                   maxlength="8"
-                  show-word-limit
                   @input="passValue"
+                  show-word-limit
                 />
               </template>
             </el-table-column>
@@ -194,17 +206,30 @@
                   placeholder="规格内容"
                   clearable
                   maxlength="8"
-                  show-word-limit
                   @input="passValue"
+                  show-word-limit
                 />
               </template>
             </el-table-column>
-            <el-table-column prop="name" label="库存" width="160">
+            <el-table-column prop="name" label="实际库存" width="160">
               <template slot-scope="scope">
                 <el-input-number
                   :controls="false"
                   v-model="scope.row.stock"
-                  placeholder="库存"
+                  placeholder="实际库存"
+                  clearable
+                  @input="passValue"
+                >
+                  <template slot="suffix"> {{ form.unit }} </template>
+                </el-input-number>
+              </template>
+            </el-table-column>
+            <el-table-column prop="name" label="预计库存" width="160">
+              <template slot-scope="scope">
+                <el-input-number
+                  :controls="false"
+                  v-model="scope.row.predictStock"
+                  placeholder="预计库存"
                   clearable
                   @input="passValue"
                 >
@@ -282,7 +307,9 @@
             <el-table-column prop="address" label="商品单价" width="80" v-else>
               <template slot-scope="scope">
                 {{
-                  scope.row.skuPriceList[0].price ? scope.row.skuPriceList[0].price.toFixed(2) : 0
+                  scope.row.skuPriceList[0].price
+                    ? scope.row.skuPriceList[0].price.toFixed(2)
+                    : 0
                 }}
                 元/{{ form.unit }}
               </template>
@@ -300,11 +327,11 @@
                 </el-input-number>
               </template>
             </el-table-column>
-            <el-table-column label="是否上架">
+            <!-- <el-table-column label="是否上架">
               <template slot-scope="scope">
-                <el-switch v-model="sj"> </el-switch>
+                <el-switch v-model="scope.row.sj"> </el-switch>
               </template>
-            </el-table-column>
+            </el-table-column> -->
             <el-table-column prop="address" label="操作" width="160">
               <template slot-scope="scope">
                 <el-button
@@ -373,7 +400,6 @@
                     clearable
                     maxlength="8"
                     show-word-limit
-                    @input="passValue"
                     style="width: 200px"
                   />
                   <el-input
@@ -396,23 +422,21 @@
             </el-form-item>
           </div>
           <div class="item1" style="width: 180px">
-            <span @click="addattribute">
+            <span @click="addattribute" style="cursor: pointer">
               <i class="el-icon-plus" size="22"></i>自定义添加商品属性</span
             >
           </div>
         </el-form-item>
       </el-col>
-      <el-col :span="24" style="margin-top: 20px" v-if="showCom">
+      <el-col :span="24" style="margin-top: 20px" v-if="!showCom">
         <el-form-item prop="freeShipping">
           <span slot="label">运费</span>
           <div class="main1">
-            <el-radio-group
-              v-model="form.freeShipping"
-              class="radios"
-              @change="passValue"
-            >
-              <el-radio :label="0">双方协商后卖家进行修改,买家和订单一起支付</el-radio>
-              <el-radio :label="1">全国包邮,由卖家承担运费</el-radio>
+            <el-radio-group v-model="form.freeShipping" class="radios">
+              <el-radio :label="0" :value="0"
+                >双方协商后卖家进行修改,买家和订单一起支付</el-radio
+              >
+              <el-radio :label="1" :value="1">全国包邮,由卖家承担运费</el-radio>
             </el-radio-group>
           </div>
         </el-form-item>
@@ -442,7 +466,7 @@
             placeholder="请输入详细地址"
             v-model="form.shippingAddrBean.addrDetail"
             style="width: 700px"
-            @input="passValue"
+            @blur="passValue"
           >
           </el-input>
         </el-form-item>
@@ -464,6 +488,8 @@ export default {
       form: {
         unit: "斤",
         props: [],
+        freeShipping: 0,
+        lookSalesVolume: "",
         shippingAddrBean: {
           addr: "",
           addrDetail: "",
@@ -497,7 +523,6 @@ export default {
       shopInfo: {},
       saleType: undefined,
       sj: true,
-
       showCom: true,
     };
   },
@@ -505,51 +530,42 @@ export default {
     this.getInfo();
     this.getdictImpl();
   },
-  watch: {
-    //监听info对象
-    data: {
-      handler(newVal, oldVal) {
-        //监听info对象变化
-        if (newVal) {
-          this.addr = newVal.shippingAddr;
-          this.form.shippingAddrBean = {
-            addr: newVal.shippingAddr,
-            addrDetail: newVal.shippingAddrString
-              ? newVal.shippingAddrString.split(newVal.shippingAddr)[1]
-              : "",
-            cityCode: newVal.cityCode,
-            countyCode: newVal.countyCode,
-            latitude: newVal.latitude,
-            longitude: newVal.longitude,
-            provinceCode: newVal.provinceCode,
-          };
-          this.form.props = newVal.props;
-          this.form.unit = newVal.unit;
-          this.form.shippingAddr = newVal.shippingAddr;
-          this.form.packing = newVal.packing;
-          this.form.shippingTimeDesc = newVal.shippingTimeDesc;
-          this.form.freeShipping = newVal.freeShipping;
-          this.form.skuList = newVal.skuList;
-          if (this.shopInfo.scope == 0) {
-            this.form.freeShipping = newVal.freeShipping;
-          }
-        }
-      },
-      deep: true, //深度监听
-      immediate: true,
-    },
-    saleType: {
-      handler(newVal, oldVal) {
-        console.log("123123", newVal);
-        this.saleType = newVal;
-      },
-    },
-  },
+
   methods: {
+    getFormInfo(record) {
+      this.addr = record.shippingAddr;
+      this.form.shippingAddrBean = {
+        addr: record.shippingAddr,
+        addrDetail: record.shippingAddrBean
+          ? record.shippingAddrBean.addrDetail
+          : undefined,
+        cityCode: record.cityCode,
+        countyCode: record.countyCode,
+        latitude: record.latitude,
+        longitude: record.longitude,
+        provinceCode: record.provinceCode,
+      };
+      if (record.props && record.props?.length < 1) {
+        this.form.props = [];
+      } else if (!record.props) {
+        this.form.props = [];
+      } else {
+        this.form.props = record.props;
+      }
+      this.form.lookSalesVolume = record.lookSalesVolume;
+      this.form.unit = record.unit;
+      this.form.shippingAddr = record.shippingAddr;
+      this.form.packing = record.packing;
+      this.form.shippingTimeDesc = record.shippingTimeDesc;
+      if (this.form.freeShipping) {
+        this.form.freeShipping = record.freeShipping;
+      }
+
+      this.form.skuList = record.skuList;
+    },
+
     setShowCom(val) {
       this.showCom = val;
-      console.log(this.showCom);
-      
     },
     compilatePrice(data) {
       if (data.price) {
@@ -564,7 +580,6 @@ export default {
       let that = this;
       return new Promise((resolve) => {
         that.$refs.queryForm.validate((valid) => {
-          console.log(valid);
           if (valid) {
             resolve(valid);
           } else {
@@ -616,11 +631,10 @@ export default {
           return 0;
         }
       } else {
-        console.log("1231231", data);
       }
     },
 
-    passValue(val) {
+    passValue() {
       if (this.shopInfo.scope == 0) {
         this.form.skuList.forEach((e) => {
           e.skuPriceList.forEach((a) => {
@@ -643,7 +657,7 @@ export default {
 
     Mapaddress(data) {
       this.form.shippingAddr = data.pname + data.cityname + data.adname;
-      this.form.shippingAddrBean.addr = data.pname + data.cityname + data.adname;
+      this.form.shippingAddrBean.addr = data.address;
       // this.form.shippingAddrBean.addrDetail = data.name ? data.name : undefined;
       this.form.shippingAddrBean.cityCode = data.cityCode;
       this.form.shippingAddrBean.countyCode = data.adcode;
@@ -654,17 +668,26 @@ export default {
       this.form.shippingAddrBean.provinceCode = data.pcode;
       this.addr = data.address;
       this.$refs.mapOpen.closeMap();
-      this.passValue();
+      // this.passValue();
     },
     selectAddr() {
       this.$refs.mapOpen.loadMap();
     },
     addattribute() {
-      this.form.props.push({
-        name: "",
-        id: "",
-        value: "",
-      });
+      if (this.form.prop?.length > 0) {
+        this.form.props.push({
+          name: "",
+          id: "",
+          value: "",
+        });
+      } else {
+        this.form.prop = [];
+        this.form.props.push({
+          name: "",
+          id: "",
+          value: "",
+        });
+      }
     },
     removeAttribute(record, index) {
       this.form.props.splice(index, 1);
@@ -677,6 +700,7 @@ export default {
       this.form.skuList.push({
         stock: undefined,
         weight: undefined,
+        sj: true,
         skuCost: {
           purchaseFee: undefined,
           laborFee: undefined,
@@ -704,7 +728,16 @@ export default {
   },
 };
 </script>
-
+<style>
+.el-upload-list__item {
+  transition: none !important;
+  -webkit-transition: nonne !important;
+}
+.el-upload-list__item-name {
+  transition: none !important;
+  -webkit-transition: nonne !important;
+}
+</style>
 <style scoped>
 /deep/ .el-radio-group {
   display: flex;

+ 167 - 61
src/views/product/updateProduct.vue

@@ -4,17 +4,23 @@
       <el-row style="padding-top: 20px">
         <el-col :span="24">
           <el-descriptions title="基本信息" column="1"> </el-descriptions>
-          <basicInfo ref="basicRefs" @updateValue="updateValue" :data="form"></basicInfo>
+          <basicInfo ref="basicRefs" @updateValue="updateValue"></basicInfo>
           <el-descriptions title="销售信息" column="1"> </el-descriptions>
-          <salesInfo ref="salesRefs" @updateValue="updateValue" :data="form"></salesInfo>
-
+          <salesInfo ref="salesRefs" @updateValue="updateValue"></salesInfo>
           <el-descriptions title="商品详情" column="1"> </el-descriptions>
-          <productInfo  ref="productRefs" @updateValue="updateValue" :data="form"></productInfo>
+          <productInfo ref="productRefs" @updateValue="updateValue"></productInfo>
+
           <div class="dialog-footer" style="text-align: center">
             <el-button @click="submitCancel">取 消</el-button>
-            <el-button type="primary" @click="submitForm"  :loading="btnLading">保 存</el-button>
-
-            <el-button type="primary" @click="submitFormDraft">存入草稿箱</el-button>
+            <el-button type="primary" @click="submitForm" :loading="btnLading"
+              >发 布</el-button
+            >
+            <el-button
+              type="primary"
+              @click="submitFormDraft"
+              v-if="$route.query.params.type == 'draft'"
+              >存入草稿箱</el-button
+            >
           </div>
         </el-col>
         <phoneView style="position: absolute; bottom: 50px; right: 50px">
@@ -221,55 +227,136 @@
 
 <script>
 import { publishGoods } from "@/api/publish/index";
-import { saveGoodsDraft, updateGoods } from "@/api/manage/product";
+import { getStoreInfo } from "@/api/common/index";
+import {
+  saveGoodsDraft,
+  updateGoods,
+  getGoodsInfo,
+  getGoodsDraftById,
+} from "@/api/manage/product";
 import basicInfo from "./module/basic-info.vue";
 import productInfo from "./module/product-info.vue";
 import salesInfo from "./module/sales-info.vue";
 import phoneView from "@/components/phoneView/index.vue";
 import Amap from "@/components/Map/map.vue";
+import moment from "moment";
 export default {
   components: { Amap, phoneView, basicInfo, salesInfo, productInfo },
   data() {
     return {
       form: {},
       headerImg: [],
-      btnLading:false,
+      btnLading: false,
     };
   },
   mounted() {
+    this.getInfo();
     if (this.$route.query.params) {
-      this.form = this.$route.query.params;
-      this.headerImg = [];
-      console.log(1);
-
-      if (this.form.vid) {
-        this.headerImg.push({
-          type: "video",
-          src: this.form.vid,
-          sort: 1,
-        });
-      }
-      if (this.form.pic) {
-        this.headerImg.push({
-          type: "img",
-          src: this.form.pic,
-          sort: 2,
+      if (this.$route.query.params.type == "draft") {
+        this.form.goodsDraftId = this.$route.query.params.id;
+        getGoodsDraftById({ goodsDraftId: this.$route.query.params.id }).then((res) => {
+          if (res.code == 200) {
+            this.form = res.data.goodsDto;
+            this.form.goodsDraftId = this.$route.query.params.id;
+            this.headerImg = [];
+            if (this.form.vid) {
+              this.headerImg.push({
+                type: "video",
+                src: this.form.vid,
+                sort: 1,
+              });
+            }
+            if (this.form.pic) {
+              this.headerImg.push({
+                type: "img",
+                src: this.form.pic,
+                sort: 2,
+              });
+            }
+            this.headerImg = this.unique(this.headerImg);
+            if (this.form.bannerList?.length > 0) {
+              this.form.bannerList.forEach((e, index) => {
+                this.headerImg.push({
+                  type: "img",
+                  src: e.fileUrl,
+                  sort: index + 4,
+                });
+              });
+            }
+            this.headerImg.sort((a, b) => a.sort - b.sort); //排序 视频在最前面>封面>商品banner
+            if (this.form.scope == 0) {
+              this.$refs.salesRefs.setShowCom(false);
+            } else if (this.form.saleType == 2 && this.form.scope == 0) {
+              this.$refs.salesRefs.setShowCom(false);
+            } else {
+              this.$refs.salesRefs.setShowCom(true);
+            }
+            this.$refs.basicRefs.getFormInfo(this.form);
+            this.$refs.salesRefs.getFormInfo(this.form);
+            this.$refs.productRefs.getFormInfo(this.form);
+          }
         });
-      }
-      this.headerImg = this.unique(this.headerImg);
-      if (this.form.bannerList?.length > 0) {
-        this.form.bannerList.forEach((e, index) => {
-          this.headerImg.push({
-            type: "img",
-            src: e.fileUrl,
-            sort: index + 4,
-          });
+      } else {
+        getGoodsInfo({ spuId: this.$route.query.params.id }).then((res) => {
+          if (res.code == 200) {
+            this.form = res.data;
+            this.headerImg = [];
+            if (this.form.vid) {
+              this.headerImg.push({
+                type: "video",
+                src: this.form.vid,
+                sort: 1,
+              });
+            }
+            if (this.form.pic) {
+              this.headerImg.push({
+                type: "img",
+                src: this.form.pic,
+                sort: 2,
+              });
+            }
+            this.headerImg = this.unique(this.headerImg);
+            if (this.form.bannerList?.length > 0) {
+              this.form.bannerList.forEach((e, index) => {
+                this.headerImg.push({
+                  type: "img",
+                  src: e.fileUrl,
+                  sort: index + 4,
+                });
+              });
+            }
+            this.headerImg.sort((a, b) => a.sort - b.sort); //排序 视频在最前面>封面>商品banner
+            if (this.form.scope == 0) {
+              this.$refs.salesRefs.setShowCom(false);
+            } else if (this.form.saleType == 2 && this.form.scope == 0) {
+              this.$refs.salesRefs.setShowCom(false);
+            } else {
+              this.$refs.salesRefs.setShowCom(true);
+            }
+            this.$refs.basicRefs.getFormInfo(this.form);
+            this.$refs.salesRefs.getFormInfo(this.form);
+            this.$refs.productRefs.getFormInfo(this.form);
+          }
         });
       }
-      this.headerImg.sort((a, b) => a.sort - b.sort); //排序 视频在最前面>封面>商品banner
     }
   },
   methods: {
+    getInfo() {
+      getStoreInfo().then((res) => {
+        if (res.code == 200) {
+          if (res.data.scope == 0) {
+            if (this.form.saleType == 2) {
+              this.$refs.salesRefs.setShowCom(true);
+            } else {
+              this.$refs.salesRefs.setShowCom(false);
+            }
+          } else {
+            this.$refs.salesRefs.setShowCom(true);
+          }
+        }
+      });
+    },
     submitCancel() {
       this.$confirm("是否取消发布,所填写的信息将会消失?", "提示", {
         confirmButtonText: "确定",
@@ -289,6 +376,16 @@ export default {
     },
 
     submitFormDraft() {
+      if (this.form.presaleStartTime && this.form.presaleEndTime) {
+        this.form.presaleStartTime = moment(this.form.datePicker[0]).valueOf();
+        this.form.presaleEndTime = moment(this.form.datePicker[1]).valueOf();
+      }
+      if (this.form.categoryId?.length > 0) {
+        this.form.categoryId = this.form.categoryId[this.form.categoryId.length - 1];
+      }
+      if (this.form.bannerList?.length > 0) {
+        this.form.bannerList.shift();
+      }
       saveGoodsDraft(this.form).then((res) => {
         if (res.code == 200) {
           this.$message.success(`保存成功!请前往草稿箱查看`);
@@ -316,42 +413,52 @@ export default {
         this.$message.error(`商品规格不能为空`);
         return;
       }
-
-     
       if (this.form.bannerList?.length > 0) {
         this.form.bannerList.shift();
       }
       this.btnLading = true;
-      publishGoods(this.form).then((res) => {
-        if (res.code == 200) {
-          this.btnLading = false;
-          this.$message.success(`发布成功!`);
-          this.$store.dispatch("tagsView/delView", this.$route); //关闭当前页
-          this.$router.replace({ path: "/product/product/index" });
-        }else{
-          this.btnLading = false;
-        }
-      });
-      this.btnLading=true
-      updateGoods(this.form).then((res) => {
-        if (res.code == 200) {
-          this.btnLading=false
-          this.$message.success(`编辑成功!`);
-          this.$store.dispatch("tagsView/delView", this.$route); //关闭当前页
-          this.$router.replace({ path: "/product/product/index" });
-        }else{
-          this.btnLading=false
-        }
-      });
+      if (this.form.presaleStartTime && this.form.presaleEndTime) {
+        this.form.presaleStartTime = moment(this.form.datePicker[0]).valueOf();
+        this.form.presaleEndTime = moment(this.form.datePicker[1]).valueOf();
+      }
+      if (this.form.categoryId) {
+        this.form.categoryId = this.form.categoryId[this.form.categoryId.length - 1];
+      }
+
+      if (this.form.id) {
+        updateGoods(this.form).then((res) => {
+          if (res.code == 200) {
+            this.btnLading = false;
+            this.$message.success(`编辑成功!`);
+            this.$store.dispatch("tagsView/delView", this.$route); //关闭当前页
+            this.$router.replace({ path: "/product/product/index" });
+          } else {
+            this.btnLading = false;
+          }
+        });
+      } else {
+        publishGoods(this.form).then((res) => {
+          if (res.code == 200) {
+            this.btnLading = false;
+            this.$message.success(`发布成功!`);
+            this.$store.dispatch("tagsView/delView", this.$route); //关闭当前页
+            this.$router.replace({ path: "/product/product/index" });
+          } else {
+            this.btnLading = false;
+          }
+        });
+      }
     },
     updateValue(val) {
       this.form = { ...this.form, ...val };
-      console.log(this.form);
-      if (this.form.saleType == 2 && this.form.scope == 0) {
+      if (this.form.saleType == 2) {
+        this.$refs.salesRefs.setShowCom(true);
+      } else if (this.form.scope == 0) {
         this.$refs.salesRefs.setShowCom(false);
       } else {
         this.$refs.salesRefs.setShowCom(true);
       }
+
       this.headerImg = [];
       if (val.vid || this.form.vid) {
         this.headerImg.push({
@@ -369,7 +476,6 @@ export default {
           });
         });
       }
-
       this.headerImg.sort((a, b) => a.sort - b.sort); //排序 视频在最前面>封面>商品banner
     },
     unique(arr) {

+ 581 - 0
src/views/writeoff/index.vue

@@ -0,0 +1,581 @@
+<template>
+  <div class="app-container">
+    <el-form
+      :model="queryParams"
+      ref="queryForm"
+      size="small"
+      :inline="true"
+      v-show="showSearch"
+      label-width="80px"
+    >
+      <el-form-item label="商品名称" prop="spuName">
+        <el-input
+          v-model="queryParams.spuName"
+          placeholder="请输入商品名称"
+          clearable
+          style="width: 180px"
+        />
+      </el-form-item>
+      <el-form-item label="订单编号" prop="userOrderSn">
+        <el-input
+          v-model="queryParams.userOrderSn"
+          placeholder="请输入订单编号"
+          clearable
+          style="width: 180px"
+        />
+      </el-form-item>
+      <el-form-item label="买家手机号" prop="userPhone" label-width="140px">
+        <el-input
+          v-model="queryParams.userPhone"
+          placeholder="请输入下单用户手机号"
+          clearable
+          style="width: 180px"
+        />
+      </el-form-item>
+      <el-form-item label="下单时间" prop="createTime">
+        <el-date-picker
+          v-model="queryParams.createTime"
+          value-format="yyyy-MM-dd"
+          format="yyyy-MM-dd"
+          type="date"
+          placeholder="请选择下单时间"
+        >
+        </el-date-picker>
+      </el-form-item>
+
+      <el-form-item label="订单状态" prop="orderStatusKey">
+        <el-select
+          v-model="queryParams.orderStatusKey"
+          placeholder="请选择订单状态"
+          style="width: 180px"
+        >
+          <el-option label="待发货" value="WAIT_DELIVERY"> </el-option>
+          <el-option label="待收货" value="WAIT_RECEIVE"> </el-option>
+          <el-option label="待付款" value="WAIT_PAY"> </el-option>
+          <el-option label="已完成" value="COMPLETE"> </el-option>
+          <el-option label="已取消/申请售后" value="CANCEL"> </el-option>
+          <el-option label="待发布货运信息" value="WAIT_PUBLISH_INVOICE"> </el-option>
+          <el-option label="等待司机接单" value="WAIT_DRIVER_ERCEIVE"> </el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="售后状态" prop="afterSaleStatus">
+        <el-select
+          v-model="queryParams.afterSaleStatus"
+          placeholder="请选择售后状态"
+          style="width: 180px"
+        >
+          <el-option label="未申请" value="0"> </el-option>
+          <el-option label="已申请" value="1"> </el-option>
+          <el-option label="审核失败" value="2"> </el-option>
+          <el-option label="审核成功(退款中)" value="3"> </el-option>
+          <el-option label="退款成功" value="4"> </el-option>
+          <el-option label="退款失败(联系客服解决)" value="5"> </el-option>
+        </el-select>
+      </el-form-item>
+
+      <el-form-item label="支付方式" prop="paymentType">
+        <el-select
+          v-model="queryParams.paymentType"
+          placeholder="请选择支付方式"
+          style="width: 180px"
+        >
+          <el-option label="支付宝" value="alipay"> </el-option>
+          <el-option label="微信支付" value="wechat"> </el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="配送方式" prop="deliveryType" style="margin-left: 60px">
+        <el-select
+          v-model="queryParams.deliveryType"
+          placeholder="请选择支付方式"
+          style="width: 180px"
+        >
+          <el-option label="自提" value="0"> </el-option>
+          <el-option label="同城下单" value="1"> </el-option>
+          <el-option label="异地下单" value="2"> </el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"
+          >搜索</el-button
+        >
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+    <el-table
+      ref="multipleTable"
+      v-loading="loading"
+      :data="spuList"
+      @selection-change="handleSelectionChange"
+      row-key="id"
+    >
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="序号" type="index" />
+      <el-table-column
+        label="订单编号"
+        align="center"
+        prop="userOrderSn"
+        width="150"
+        :show-overflow-tooltip="true"
+      />
+      
+      <el-table-column label="核销人Id" align="center" prop="verifierUserId" width="100" />
+      <el-table-column label="商品名称" align="center" prop="skuName" width="100" />
+      <!-- <el-table-column label="商品图片" align="center" prop="skuPic">
+          <template slot-scope="scope">
+            <el-image :src="scope.row.skuPic" style="width: 60px; height: 60px"> </el-image>
+          </template>
+        </el-table-column> -->
+      <!-- <el-table-column label="商品分类" align="center" prop="categoryName" width="150">
+        </el-table-column> -->
+      <el-table-column
+        label="实付金额(元)"
+        align="center"
+        prop="paymentAmount"
+        width="100"
+      >
+        <template slot-scope="scope">
+          {{ scope.row.paymentAmount.toFixed(2) }}元
+        </template>
+      </el-table-column>
+
+      <el-table-column
+        label="收货人姓名"
+        align="center"
+        prop="consigneeContactName"
+        width="100"
+      />
+      <el-table-column
+        label="收货人手机号"
+        align="center"
+        prop="consigneeContactMobile"
+        width="110"
+      />
+
+      <el-table-column label="下单人姓名" align="center" prop="userNick" width="120" />
+      <el-table-column label="下单人ID" align="center" prop="userId" width="100" />
+      <el-table-column label="下单时间" align="center" prop="createTime" width="160" />
+      <el-table-column label="单价/数量" align="center" prop="price">
+        <template slot-scope="scope">
+          <span>
+            {{ scope.row.price }}元 <br />
+            共{{ scope.row.quantity }}{{ scope.row.unit }}</span
+          >
+        </template>
+      </el-table-column>
+      <!-- <el-table-column label="包装方式" align="center" prop="packageType">
+        </el-table-column> -->
+      <el-table-column label="支付方式" align="center" prop="packageType">
+        <template slot-scope="scope">
+          {{
+            scope.row.paymentType == "alipay"
+              ? "支付宝支付"
+              : scope.row.paymentType == "wechat"
+              ? "微信支付"
+              : scope.row.paymentType == "card"
+              ? "银行卡支付"
+              : ""
+          }}
+        </template>
+      </el-table-column>
+      <el-table-column label="配送方式" align="center" prop="paymentType" width="120">
+        <template slot-scope="scope">
+          {{
+            scope.row.deliveryType == "0"
+              ? "自提"
+              : scope.row.deliveryType == "1"
+              ? "同城下单"
+              : scope.row.deliveryType == "2"
+              ? "异地下单"
+              : ""
+          }}
+        </template>
+      </el-table-column>
+      <el-table-column label="订单状态" align="center" width="120">
+        <template slot-scope="scope">
+          {{
+            scope.row.orderStatus == 0
+              ? "待商家确认修改运费"
+              : scope.row.orderStatus == 10
+              ? "等待买家支付"
+              : scope.row.orderStatus == 20
+              ? "等待商家发布货运信息"
+              : scope.row.orderStatus == 90
+              ? "等待司机接单"
+              : scope.row.orderStatus == 100
+              ? "等待司机支付保证金"
+              : scope.row.orderStatus == 110
+              ? "等待司机装货"
+              : scope.row.orderStatus == 120
+              ? "已装货,运输中"
+              : scope.row.orderStatus == 30
+              ? "司机已到达,等待买家签收"
+              : scope.row.orderStatus == 40
+              ? "买家已收货"
+              : scope.row.orderStatus == 50
+              ? "已取消"
+              : scope.row.orderStatus == 60
+              ? "退款中"
+              : scope.row.orderStatus == 70
+              ? "退款成功"
+              : scope.row.orderStatus == 80
+              ? "退款失败"
+              : scope.row.orderStatus == 130
+              ? "待处理售后"
+              : scope.row.orderStatus == 140
+              ? "已处理售后"
+              : ""
+          }}
+        </template>
+      </el-table-column>
+      <el-table-column label="售后状态" align="center">
+        <template slot-scope="scope">
+          {{
+            scope.row.afterSaleStatus == 0
+              ? "未申请"
+              : scope.row.afterSaleStatus == 1
+              ? "已申请"
+              : scope.row.afterSaleStatus == 2
+              ? "审核失败"
+              : scope.row.afterSaleStatus == 3
+              ? "审核成功(退款中)"
+              : scope.row.afterSaleStatus == 4
+              ? "退款成功"
+              : scope.row.afterSaleStatus == 5
+              ? "退款失败(联系客服解决)"
+              : ""
+          }}
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" align="center" width="150">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            @click="handleDetail(scope.row)"
+            v-hasPermi="['writeoff:detail']"
+            >订单详情</el-button
+          >
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total > 0"
+      :total="total"
+      :page.sync="queryParams.pageNo"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+    <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
+      <el-descriptions title="订单详情" column="3">
+        <el-descriptions-item label="订单编号">{{
+          detailInfo ? detailInfo.userOrderSn : ""
+        }}</el-descriptions-item>
+        <el-descriptions-item label="订单状态">
+          {{
+            detailInfo
+              ? detailInfo.orderStatus == 0
+                ? "待商家确认修改运费"
+                : detailInfo.orderStatus == 10
+                ? "等待买家支付"
+                : detailInfo.orderStatus == 20
+                ? "等待商家发布货运信息"
+                : detailInfo.orderStatus == 90
+                ? "等待司机接单"
+                : detailInfo.orderStatus == 100
+                ? "等待司机支付保证金"
+                : detailInfo.orderStatus == 110
+                ? "等待司机装货"
+                : detailInfo.orderStatus == 120
+                ? "已装货,运输中"
+                : detailInfo.orderStatus == 30
+                ? "司机已到达,等待买家签收"
+                : detailInfo.orderStatus == 40
+                ? "买家已收货"
+                : detailInfo.orderStatus == 50
+                ? "已取消"
+                : detailInfo.orderStatus == 60
+                ? "退款中"
+                : detailInfo.orderStatus == 70
+                ? "退款成功"
+                : detailInfo.orderStatus == 80
+                ? "退款失败"
+                : detailInfo.orderStatus == 130
+                ? "待处理售后"
+                : detailInfo.orderStatus == 140
+                ? "已处理售后"
+                : ""
+              : ""
+          }}</el-descriptions-item
+        >
+        <el-descriptions-item label="配送方式">{{
+          detailInfo
+            ? detailInfo.deliveryMethod == -1
+              ? "未选择"
+              : detailInfo.deliveryMethod == 0
+              ? "线下发货"
+              : detailInfo.deliveryMethod == 1
+              ? "平台找司机"
+              : ""
+            : ""
+        }}</el-descriptions-item>
+        <el-descriptions-item label="支付方式">
+          {{
+            detailInfo
+              ? detailInfo.paymentType == "alipay"
+                ? "支付宝"
+                : detailInfo.paymentType == "wechat"
+                ? "微信支付"
+                : detailInfo.paymentType == "card"
+                ? "银行卡支付"
+                : ""
+              : ""
+          }}</el-descriptions-item
+        >
+        <el-descriptions-item label="下单时间">
+          {{ parseTime(detailInfo.createTime) }}</el-descriptions-item
+        >
+        <el-descriptions-item label="付款时间">
+          {{ parseTime(detailInfo.paymentTime) }}
+        </el-descriptions-item>
+        <el-descriptions-item label="担保服务费">
+          {{ detailInfo ? detailInfo.serviceFee : "" }}
+        </el-descriptions-item>
+        <el-descriptions-item label="运费(元)">
+          {{ detailInfo ? detailInfo.freightFee : "" }}</el-descriptions-item
+        >
+        <el-descriptions-item label="实付款(元)">
+          {{ detailInfo ? detailInfo.paymentAmount : "" }}
+        </el-descriptions-item>
+      </el-descriptions>
+      <el-descriptions title="物流信息" column="3">
+        <el-descriptions-item label="运单号">
+          {{ detailInfo ? detailInfo.orderSn : "" }}</el-descriptions-item
+        >
+        <el-descriptions-item label="司机">{{
+          detailInfo ? detailInfo.driverUservalue : ""
+        }}</el-descriptions-item>
+        <el-descriptions-item label="车型">{{
+          detailInfo ? detailInfo.carType : ""
+        }}</el-descriptions-item>
+        <el-descriptions-item label="车牌号"
+          >{{ detailInfo ? detailInfo.plateNo : "" }}
+        </el-descriptions-item>
+        <el-descriptions-item label="司机电话">{{
+          detailInfo ? detailInfo.driverPhone : ""
+        }}</el-descriptions-item>
+        <el-descriptions-item label="装货时间">
+          {{ detailInfo ? detailInfo.shipmentTime : "" }}</el-descriptions-item
+        >
+        <el-descriptions-item label="送达时间">
+          {{ detailInfo ? detailInfo.arriveTime : "" }}</el-descriptions-item
+        >
+      </el-descriptions>
+      <el-descriptions title="买家信息" column="3">
+        <el-descriptions-item label="昵称">{{
+          detailInfo ? detailInfo.userNick : ""
+        }}</el-descriptions-item>
+        <el-descriptions-item label="头像">
+          <el-avatar
+            v-if="detailInfo.userHeadUrl"
+            :size="30"
+            :src="detailInfo.userHeadUrl"
+          ></el-avatar
+        ></el-descriptions-item>
+        <el-descriptions-item label="收货人">{{
+          detailInfo ? detailInfo.consigneeContactName : ""
+        }}</el-descriptions-item>
+        <el-descriptions-item label="手机号">
+          {{ detailInfo ? detailInfo.userPhone : "" }}</el-descriptions-item
+        >
+        <el-descriptions-item label="备注">
+          {{ detailInfo ? detailInfo.orderRemark : "" }}</el-descriptions-item
+        >
+        <el-descriptions-item label="收货地址"
+          >{{ detailInfo ? detailInfo.consigneeAddressDetail : "" }}
+        </el-descriptions-item>
+      </el-descriptions>
+      <el-descriptions title="商品信息" column="3"> </el-descriptions>
+      <el-table :data="detailInfo.orderGoodInfoList" style="width: 100%">
+        <el-table-column prop="skuName" label="商品名称"> </el-table-column>
+        <el-table-column prop="skuName" label="商品图片">
+          <template slot-scope="scope">
+            <el-image :src="scope.row.skuPic" style="width: 50px; height: 50px">
+            </el-image>
+          </template>
+        </el-table-column>
+        <el-table-column prop="price" label="商品单价(元)"> </el-table-column>
+        <el-table-column prop="quantity" label="下单数量"> </el-table-column>
+        <el-table-column prop="totalPrice" label="总金额(元)"> </el-table-column>
+      </el-table>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { userOrderInfo } from "@/api/manage/order";
+import { queryWriteOffOrder } from "@/api/manage/writeoff";
+import { listUser } from "@/api/system/user";
+export default {
+  name: "writeoff",
+  data() {
+    return {
+      equipmentOpen: false,
+      // 遮罩层
+      loading: false,
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 参数表格数据
+      spuList: [],
+      // 弹出层标题
+      title: "订单详情",
+      // 是否显示弹出层
+      open: false,
+      // 日期范围
+      dateRange: [],
+      // 查询参数
+      queryParams: {
+        pageNo: 1,
+        pageSize: 10,
+        spuName: "",
+        userOrderSn: "",
+        userPhone: "",
+        createTime: "",
+        orderStatusKey: "",
+        afterSaleStatus: "",
+        paymentType: "",
+        verifierUserId: "",
+      },
+      form: {},
+      // 表单校验
+      rules: {
+        configValue: [{ required: true, message: "参数键值不能为空", trigger: "blur" }],
+      },
+      detailInfo: {},
+      dialogLoding: false,
+      printList: [],
+      verifierUserIds: [],
+    };
+  },
+  mounted() {
+    this.getUserList();
+  },
+  methods: {
+    getUserList() {
+      this.verifierUserIds = [];
+      listUser({ pageNo: 1, pageSize: 999 }).then((res) => {
+        if (res.code == 200) {
+          let list = res.data.records;
+          for (let index = 0; index < list.length; index++) {
+            if (list[index].roleName == "核销员") {
+              this.verifierUserIds.push(list[index].id);
+            }
+          }
+          this.queryParams.verifierUserId = this.verifierUserIds.toString();
+          this.getList();
+        }
+      });
+    },
+    getList() {
+      this.loading = true;
+      queryWriteOffOrder(this.addDateRange(this.queryParams, this.dateRange)).then(
+        (response) => {
+          if (response.code == 200) {
+            let list = response.data.records;
+            let totalList = [];
+            for (let i = 0; i < list.length; i++) {
+              if (list[i].goodsInfo) {
+                var goods = JSON.parse(list[i].goodsInfo);
+                for (let a = 0; a < goods.length; a++) {
+                  let bb = {};
+                  if (goods[a].specsValue.length > 0) {
+                    for (let s = 0; s < goods[a].specsValue.length; s++) {
+                      bb = {
+                        ...list[i],
+                        ...goods[a],
+                        ...goods[a].specsValue[s],
+                      };
+                      totalList.push(bb);
+                    }
+                  } else {
+                    bb = {
+                      ...list[i],
+                      ...goods[a],
+                    };
+                    totalList.push(bb);
+                  }
+                }
+              }
+            }
+            this.spuList = totalList;
+            this.total = response.data.total;
+            this.loading = false;
+          }
+        }
+      );
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNo = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.dateRange = [];
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+
+    handleDetail(record) {
+      this.title = "商品详情";
+      this.open = true;
+      this.dialogLoding = true;
+      userOrderInfo(record.id)
+        .then((res) => {
+          if (res.code == 200) {
+            this.detailInfo = res.data;
+            this.dialogLoding = false;
+          }
+        })
+        .catch((err) => {
+          this.dialogLoding = false;
+          console.log(err);
+        });
+    },
+  },
+};
+</script>
+<style scoped lang="scss">
+.header {
+  margin-bottom: 30px;
+  .item {
+    height: 100px;
+  }
+  .row {
+    display: flex;
+    flex-direction: row;
+    justify-content: space-between;
+    align-items: center;
+    .count {
+      padding: 10px;
+      font-size: 20px;
+      font-weight: 500;
+    }
+    .zz {
+      font-size: 14px;
+      color: red;
+      padding: 0px 10px;
+    }
+  }
+}
+</style>

+ 1 - 1
vue.config.js

@@ -36,7 +36,7 @@ module.exports = {
     proxy: {
       // detail: https://cli.vuejs.org/config/#devserver-proxy
       [process.env.VUE_APP_BASE_API]: {
-        target: `http://192.168.1.69:30023/merchant`,
+        target: `http://192.168.3.107:30023/merchant`,
         changeOrigin: true,
         pathRewrite: {
           ['^' + process.env.VUE_APP_BASE_API]: ''