潘超林 6 months ago
parent
commit
8666a4b63e

+ 73 - 77
src/views/manage/order.vue

@@ -205,7 +205,7 @@
           <el-option label="微信支付" value="wechat"> </el-option>
         </el-select>
       </el-form-item>
-      <el-form-item label="配送方式" prop="deliveryType" style="margin-left:60px">
+      <el-form-item label="配送方式" prop="deliveryType" style="margin-left: 60px">
         <el-select
           v-model="queryParams.deliveryType"
           placeholder="请选择支付方式"
@@ -251,24 +251,59 @@
         >
       </el-col> -->
     </el-row>
-
+    <!-- :span-method="objectSpanMethod" -->
     <el-table
       ref="multipleTable"
       v-loading="loading"
       :data="spuList"
-      :span-method="objectSpanMethod"
       @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="商品图片" align="center" prop="skuPic">
+      <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="categoryName">
-      </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>
@@ -277,8 +312,8 @@
           >
         </template>
       </el-table-column>
-      <el-table-column label="包装方式" align="center" prop="packageType">
-      </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">
           {{
@@ -292,46 +327,7 @@
           }}
         </template>
       </el-table-column>
-
-      <el-table-column label="规格名称" align="center" prop="specsName" />
-      <el-table-column label="规格值" align="center" prop="specsValue" />
-      <el-table-column
-        label="实付金额(元)"
-        align="center"
-        prop="paymentAmount"
-        width="150"
-      >
-        <template slot-scope="scope">
-          {{ scope.row.paymentAmount.toFixed(2) }}元
-        </template>
-      </el-table-column>
-      <el-table-column
-        label="订单编号"
-        align="center"
-        prop="userOrderSn"
-        width="200"
-        :show-overflow-tooltip="true"
-      />
-
-      <el-table-column label="买家姓名" align="center" prop="userNick" />
-      <el-table-column label="买家头像" align="center">
-        <template slot-scope="scope">
-          <el-avatar :size="40" :src="scope.row.userHeadUrl"></el-avatar>
-        </template>
-      </el-table-column>
-      <el-table-column label="买家手机号" align="center" prop="userPhone" width="120" />
-
-      <el-table-column
-        label="商品名称"
-        align="center"
-        prop="skuName"
-        width="150"
-        :show-overflow-tooltip="true"
-      >
-      </el-table-column>
-
-      <!-- <el-table-column label="运费(元)" align="center" prop="freightFee" /> -->
-      <el-table-column label="配送方式" align="center" prop="paymentType" width="150">
+      <el-table-column label="配送方式" align="center" prop="paymentType" width="120">
         <template slot-scope="scope">
           {{
             scope.row.deliveryType == "0"
@@ -344,7 +340,7 @@
           }}
         </template>
       </el-table-column>
-      <el-table-column label="订单状态" align="center">
+      <el-table-column label="订单状态" align="center" width="120">
         <template slot-scope="scope">
           {{
             scope.row.orderStatus == 0
@@ -731,34 +727,34 @@ export default {
     printOrderBtn() {
       this.equipmentOpen = true;
     },
-    objectSpanMethod({ row, column, rowIndex, columnIndex }) {
-      if (
-        columnIndex === 0 ||
-        columnIndex === 8 ||
-        columnIndex === 9 ||
-        columnIndex === 10 ||
-        columnIndex === 11 ||
-        columnIndex === 12 ||
-        columnIndex === 16 ||
-        columnIndex === 14 ||
-        columnIndex === 13 ||
-        columnIndex === 15 ||
-        columnIndex === 16 ||
-        columnIndex === 17
-      ) {
-        if (rowIndex === 0 || row.userOrderSn != this.spuList[rowIndex - 1].userOrderSn) {
-          let rowspan = 0;
-          this.spuList.forEach((element) => {
-            if (element.userOrderSn === row.userOrderSn) {
-              rowspan++;
-            }
-          });
-          return [rowspan, 1];
-        } else {
-          return [0, 0];
-        }
-      }
-    },
+    // objectSpanMethod({ row, column, rowIndex, columnIndex }) {
+    //   if (
+    //     columnIndex === 0 ||
+    //     columnIndex === 8 ||
+    //     columnIndex === 9 ||
+    //     columnIndex === 10 ||
+    //     columnIndex === 11 ||
+    //     columnIndex === 12 ||
+    //     columnIndex === 16 ||
+    //     columnIndex === 14 ||
+    //     columnIndex === 13 ||
+    //     columnIndex === 15 ||
+    //     columnIndex === 16 ||
+    //     columnIndex === 17
+    //   ) {
+    //     if (rowIndex === 0 || row.userOrderSn != this.spuList[rowIndex - 1].userOrderSn) {
+    //       let rowspan = 0;
+    //       this.spuList.forEach((element) => {
+    //         if (element.userOrderSn === row.userOrderSn) {
+    //           rowspan++;
+    //         }
+    //       });
+    //       return [rowspan, 1];
+    //     } else {
+    //       return [0, 0];
+    //     }
+    //   }
+    // },
     getstatisticsOrder() {
       statisticsOrderNum().then((res) => {
         if (res.code == 200) {

+ 6 - 1
src/views/product/createProduct.vue

@@ -315,10 +315,15 @@ export default {
       });
     },
     updateValue(val) {
-      console.log("skuList", val);
       this.form = { ...this.form, ...val };
       console.log("this.form", this.form);
 
+      if (this.form.saleType == 2 && 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({

+ 38 - 19
src/views/product/module/basic-info.vue

@@ -155,7 +155,10 @@
               <div class="item" v-for="(item, index) in this.bannerList" :key="index">
                 <div class="fmt" v-if="index == 0">封面图</div>
                 <div class="gb" @click="removeImg(index)">X</div>
-                <img :src="item.url" style="width: 70px; height: 70px" />
+                <img
+                  :src="item.url || item.fileUrl"
+                  style="width: 70px; height: 70px; border-radius: 10px"
+                />
               </div>
             </draggable>
             <!-- <div class="fmt" v-if="index == 0">封面图</div>
@@ -224,7 +227,9 @@ export default {
         categoryId: [{ required: true, message: "分类不能为空", trigger: "blur" }],
         title: [{ required: true, message: "商品名称不能为空", trigger: "blur" }],
         giftDesc: [{ required: true, message: "礼包描述不能为空", trigger: "blur" }],
-        bannerList: [{ required: true, message: "商品图最低上传两张图片", trigger: "blur" }],
+        bannerList: [
+          { required: true, message: "商品图最低上传两张图片", trigger: "blur" },
+        ],
         carpoolSuccessTime: [
           { required: true, message: "拼车成功时间不能为空", trigger: "blur" },
         ],
@@ -245,22 +250,36 @@ export default {
           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.form.bannerList = [];
-          this.datePicker = [newVal.presaleStartTime, newVal.presaleEndTime];
-          if (this.form.bannerList?.length > 0) {
-            this.form.bannerList.forEach((e) => {
-              this.bannerList.push({
-                url: e.fileUrl,
-              });
-            });
+          this.datePicker = [];
+          if (newVal.presaleStartTime && newVal.presaleEndTime) {
+            this.datePicker.push(newVal.presaleStartTime);
+            this.datePicker.push(newVal.presaleEndTime);
+          } else {
+            this.datePicker = [];
           }
-          if (this.form.pic) {
-            this.bannerList.unshift({
-              url: this.form.pic,
-            });
+          if (this.form.bannerList?.length > 0) {
+            this.bannerList = this.form.bannerList;
           }
-          this.categoryName = this.form.categoryName;
+          // if (this.form.pic) {
+          //   this.bannerList.unshift({
+          //     url: this.form.pic,
+          //   });
+          // }
           console.log("111", this.form);
         }
       },
@@ -297,11 +316,9 @@ export default {
           } else {
             for (const key in row) {
               for (let index = 0; index < row[key].length; index++) {
-                
                 this.$message.error(row[key][index].message);
                 return;
               }
-    
             }
             resolve(valid);
           }
@@ -339,13 +356,12 @@ export default {
       if (this.bannerList?.length > 1) {
         for (let index = 0; index < this.bannerList.length; index++) {
           this.form.bannerList.push({
-            fileUrl: this.bannerList[index].url,
+            fileUrl: this.bannerList[index].url || this.bannerList[index].fileUrl,
             sort: this.bannerList[index].name,
           });
         }
         this.form.pic = this.bannerList[0].url;
       }
-
       this.$emit("updateValue", this.form);
     },
 
@@ -462,6 +478,7 @@ export default {
 <style scoped>
 .item {
   position: relative;
+  margin-right: 10px;
 }
 .gb {
   position: absolute;
@@ -470,6 +487,8 @@ export default {
   cursor: pointer;
 }
 .fmt {
+  border-bottom-left-radius: 10px;
+  border-bottom-right-radius: 10px;
   position: absolute;
   width: 70px;
   height: 20px;

+ 43 - 25
src/views/product/module/sales-info.vue

@@ -31,7 +31,7 @@
             style="width: 100%; margin-top: 20px"
             v-if="shopInfo.scope == 0"
           >
-            <el-table-column prop="name" label="规格名称" width="160">
+            <el-table-column prop="name" label="规格名称" width="140">
               <template slot-scope="scope">
                 <el-input
                   v-model="scope.row.skuSpecsList[0].specsName"
@@ -43,7 +43,7 @@
                 />
               </template>
             </el-table-column>
-            <el-table-column prop="address" label="规格内容" width="160">
+            <el-table-column prop="address" label="规格内容" width="140">
               <template slot-scope="scope">
                 <el-input
                   v-model="scope.row.skuSpecsList[0].specsValue"
@@ -55,7 +55,7 @@
                 />
               </template>
             </el-table-column>
-            <el-table-column prop="name" label="库存" width="160">
+            <el-table-column prop="name" label="库存" width="140">
               <template slot-scope="scope">
                 <el-input-number
                   :controls="false"
@@ -68,7 +68,7 @@
                 </el-input-number>
               </template>
             </el-table-column>
-            <el-table-column prop="address" label="起批量" width="160">
+            <el-table-column prop="address" label="起批量" width="140">
               <template slot-scope="scope">
                 <el-input-number
                   :controls="false"
@@ -83,7 +83,7 @@
                 </el-input-number>
               </template>
             </el-table-column>
-            <el-table-column prop="address" label="收购价" width="160">
+            <el-table-column prop="address" label="收购价" width="140">
               <template slot-scope="scope">
                 <el-input-number
                   :controls="false"
@@ -96,7 +96,7 @@
                 </el-input-number>
               </template>
             </el-table-column>
-            <el-table-column prop="address" label="人工费" width="160">
+            <el-table-column prop="address" label="人工费" width="140">
               <template slot-scope="scope">
                 <el-input-number
                   :controls="false"
@@ -109,7 +109,7 @@
                 </el-input-number>
               </template>
             </el-table-column>
-            <el-table-column prop="address" label="代办费" width="160">
+            <el-table-column prop="address" label="代办费" width="140">
               <template slot-scope="scope">
                 <el-input-number
                   :controls="false"
@@ -122,7 +122,7 @@
                 </el-input-number>
               </template>
             </el-table-column>
-            <el-table-column prop="address" label="材料费" width="160">
+            <el-table-column prop="address" label="材料费" width="140">
               <template slot-scope="scope">
                 <el-input-number
                   :controls="false"
@@ -140,12 +140,12 @@
                 {{ computePrice(scope.row) }}元/{{ form.unit }}
               </template>
             </el-table-column>
-            <el-table-column label="规格重量" width="160">
+            <el-table-column label="净重量(kg)" width="160">
               <template slot-scope="scope">
                 <el-input-number
                   :controls="false"
                   v-model="scope.row.weight"
-                  placeholder="请输入单个规格重量"
+                  placeholder="重量"
                   clearable
                   @input="passValue"
                 >
@@ -153,7 +153,13 @@
                 </el-input-number>
               </template>
             </el-table-column>
-            <el-table-column prop="address" label="操作" width="160">
+            <el-table-column label="是否上架">
+              <template slot-scope="scope">
+                <el-switch v-model="sj"> </el-switch>
+              </template>
+            </el-table-column>
+
+            <el-table-column prop="address" label="操作">
               <template slot-scope="scope">
                 <el-button
                   type="text"
@@ -276,12 +282,12 @@
             <el-table-column prop="address" label="商品单价" width="80" v-else>
               <template slot-scope="scope">
                 {{
-                  scope.row.skuPriceList[0].price ? scope.row.skuPriceList[0].price : 0
+                  scope.row.skuPriceList[0].price ? scope.row.skuPriceList[0].price.toFixed(2) : 0
                 }}
                 元/{{ form.unit }}
               </template>
             </el-table-column>
-            <el-table-column label="净重量" width="160">
+            <el-table-column label="净重量(kg )" width="160">
               <template slot-scope="scope">
                 <el-input-number
                   :controls="false"
@@ -294,6 +300,11 @@
                 </el-input-number>
               </template>
             </el-table-column>
+            <el-table-column label="是否上架">
+              <template slot-scope="scope">
+                <el-switch v-model="sj"> </el-switch>
+              </template>
+            </el-table-column>
             <el-table-column prop="address" label="操作" width="160">
               <template slot-scope="scope">
                 <el-button
@@ -391,7 +402,7 @@
           </div>
         </el-form-item>
       </el-col>
-      <el-col :span="24" style="margin-top: 20px" v-if="shopInfo.scope == 0">
+      <el-col :span="24" style="margin-top: 20px" v-if="showCom">
         <el-form-item prop="freeShipping">
           <span slot="label">运费</span>
           <div class="main1">
@@ -485,6 +496,9 @@ export default {
       },
       shopInfo: {},
       saleType: undefined,
+      sj: true,
+
+      showCom: true,
     };
   },
   mounted() {
@@ -532,13 +546,18 @@ export default {
     },
   },
   methods: {
+    setShowCom(val) {
+      this.showCom = val;
+      console.log(this.showCom);
+      
+    },
     compilatePrice(data) {
       if (data.price) {
-        return data.price;
+        return data.price.toFixed(2);
       } else if (data.originalPrice) {
-        return data.originalPrice;
+        return data.originalPrice.toFixed(2);
       } else if (data.originalPrice && data.price) {
-        return data.price;
+        return data.price.toFixed(2);
       }
     },
     formvalidate() {
@@ -588,11 +607,11 @@ export default {
           data.skuCost.materialFee
         ) {
           return (
-            parseInt(data.skuCost.purchaseFee) +
-            parseInt(data.skuCost.laborFee) +
-            parseInt(data.skuCost.agencyFee) +
-            parseInt(data.skuCost.materialFee)
-          );
+            Number(data.skuCost.purchaseFee) +
+            Number(data.skuCost.laborFee) +
+            Number(data.skuCost.agencyFee) +
+            Number(data.skuCost.materialFee)
+          ).toFixed(2);
         } else {
           return 0;
         }
@@ -600,7 +619,7 @@ export default {
         console.log("1231231", data);
       }
     },
-   
+
     passValue(val) {
       if (this.shopInfo.scope == 0) {
         this.form.skuList.forEach((e) => {
@@ -610,8 +629,7 @@ export default {
             a.lowestPrice = this.computePrice(e);
           });
         });
-      } 
-      else {
+      } else {
         if (this.saleType != 4) {
           this.form.skuList.forEach((e) => {
             e.skuPriceList.forEach((a) => {

+ 6 - 42
src/views/product/updateProduct.vue

@@ -317,48 +317,7 @@ export default {
         return;
       }
 
-      // if (this.form.scope === "") {
-      //   this.$message.error(`经营区域不能为空!`);
-      //   return;
-      // } else if (this.form.saleType === "") {
-      //   this.$message.error(`销售方式不能为空`);
-      //   return;
-      // } else if (this.form.saleType === "") {
-      //   this.$message.error(`销售方式不能为空`);
-      //   return;
-      // } else if (this.form.categoryId === "") {
-      //   this.$message.error(`商品分类不能为空`);
-      //   return;
-      // } else if (this.form.pic === "") {
-      //   this.$message.error(`商品封面图不能为空`);
-      //   return;
-      // } else if (this.form.unit === "") {
-      //   this.$message.error(`商品封面图不能为空`);
-      //   return;
-      // } else if (this.form.skuList === "") {
-      //   this.$message.error(`商品规格不能为空`);
-      //   return;
-      // } else if (this.form.packing === "") {
-      //   this.$message.error(`包装方式不能为空`);
-      //   return;
-      // } else if (this.form.shippingTimeDesc === "") {
-      //   this.$message.error(`发货时间不能为空`);
-      //   return;
-      // } else if (this.form.freeShipping === "") {
-      //   this.$message.error(`运费不能为空`);
-      //   return;
-      // } else if (this.form.shippingAddr === "") {
-      //   this.$message.error(`发货地址不能为空`);
-      //   return;
-      // } else if (this.form.spuDesc === "") {
-      //   this.$message.error(`商品介绍不能为空`);
-      //   return;
-      // } else if (this.form.saleModel === "2") {
-      //   if (this.form.presaleStartTime === "" || this.form.presaleEndTime === "") {
-      //     this.$message.error(`预售时间不能为空`);
-      //     return;
-      //   }
-      // }
+     
       if (this.form.bannerList?.length > 0) {
         this.form.bannerList.shift();
       }
@@ -388,6 +347,11 @@ export default {
     updateValue(val) {
       this.form = { ...this.form, ...val };
       console.log(this.form);
+      if (this.form.saleType == 2 && 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({