潘超林 3 veckor sedan
förälder
incheckning
b8a46e1f15

+ 44 - 0
src/api/manage/coupon.js

@@ -0,0 +1,44 @@
+import request from '@/utils/request'
+
+export function shareRewardList(query) {
+  return request({
+    url: '/system/goods/getReturnVoucherRatio',
+    method: 'get',
+    params: query
+  })
+}
+export function shareRewardSave(query) {
+  return request({
+    url: '/system/goods/returnRatioSaveOrUpdate',
+    method: 'post',
+    data: query
+  })
+}
+export function shareRewardEdit(query) {
+  return request({
+    url: '/system/goods/returnRatioSaveOrUpdate',
+    method: 'post',
+    data: query
+  })
+}
+export function batchRemove(query) {
+  return request({
+    url: '/system/shareReward/batchRemove',
+    method: 'post',
+    data: query
+  })
+}
+export function shareRewardDelete(query) {
+  return request({
+    url: '/system/shareReward/delete',
+    method: 'post',
+    data: query
+  })
+}
+export function getReturnVoucherRatioInfo(query) {
+  return request({
+    url: '/system/goods/getReturnVoucherRatioInfo',
+    method: 'post',
+    data: query
+  })
+}

+ 7 - 1
src/api/manage/material.js

@@ -14,7 +14,13 @@ export function getCityTree(query) {
         params: query
     })
 }
-
+export function getCityTreeNew(query) {
+  return request({
+      url: '/getCityTreeNew',
+      method: 'get',
+      params: query
+  })
+}
 export function addFreightTemplate(query) {
     return request({
         url: '/system/freightTemplate/addFreightTemplate',

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 19562 - 0
src/assets/city.json


+ 8 - 6
src/views/manage/components/periodProductDialog.vue

@@ -7,9 +7,9 @@
   >
     <div>
       <el-tabs v-model="queryParams.spuType" @tab-click="handleQuery">
-        <el-tab-pane label="批发商品" name="0"></el-tab-pane>
-        <el-tab-pane label="秒送商品" name="1"></el-tab-pane>
-        <el-tab-pane label="福利商品" name="2"></el-tab-pane>
+        <el-tab-pane label="批发商品" name="2"></el-tab-pane>
+        <el-tab-pane label="秒送商品" name="3"></el-tab-pane>
+        <el-tab-pane label="福利商品" name="4"></el-tab-pane>
       </el-tabs>
       <el-form
         :model="queryParams"
@@ -272,6 +272,7 @@ import { getMerchantClassifyList } from "@/api/sort/index.js";
 import { getGoodsListPage } from "@/api/manage/product";
 import { getClassificationListPage } from "@/api/common/index";
 export default {
+  props: ["isShare"],
   data() {
     return {
       dialogVisible: false,
@@ -286,7 +287,7 @@ export default {
         scope: "",
         benefitType: "",
         isShare: "",
-        spuType: 0,
+        spuType: '2',
       },
       total: 0,
       loading: false,
@@ -306,8 +307,9 @@ export default {
   },
   methods: {
     checkSelectable(row, index) {
-      console.log(row);
-      if (row.isShare == 0) {
+      console.log(row.isShare);
+
+      if (row.isShare == 0 && row.returnVoucherRatio > 0) {
         return !row.disabled;
       }
     },

+ 455 - 0
src/views/member/components/periodProductDialog.vue

@@ -0,0 +1,455 @@
+<template>
+  <el-dialog
+    title="选择商品"
+    :visible.sync="dialogVisible"
+    width="80%"
+    :before-close="handleClose"
+  >
+    <div>
+      <el-tabs v-model="queryParams.spuType" @tab-click="handleQuery">
+        <el-tab-pane label="批发商品" name="2"></el-tab-pane>
+        <el-tab-pane label="秒送商品" name="3"></el-tab-pane>
+        <el-tab-pane label="福利商品" name="4"></el-tab-pane>
+      </el-tabs>
+      <el-form
+        :model="queryParams"
+        ref="queryForm"
+        size="small"
+        :inline="true"
+        label-width="120px"
+      >
+        <el-form-item label="商品名称" prop="spuName">
+          <el-input
+            v-model="queryParams.spuName"
+            placeholder="请输入商品名称"
+            clearable
+            style="width: 240px"
+            @keyup.enter.native="handleQuery"
+          />
+        </el-form-item>
+        <el-form-item label="商品分类" prop="categoryId">
+          <el-cascader
+            v-model="queryParams.categoryId"
+            ref="formCascader"
+            placeholder="请选择分类"
+            :props="categoryprops"
+            style="width: 240px"
+            @change="cascaderChange"
+          />
+        </el-form-item>
+
+        <el-form-item label="店铺分类" prop="merchantClassifyId">
+          <el-cascader
+            v-model="queryParams.merchantClassifyId"
+            ref="formCascader"
+            placeholder="请选择分类"
+            :props="categorypropsmerchant"
+            style="width: 240px"
+            @change="cascadermerchantChange"
+          />
+        </el-form-item>
+
+        <el-form-item label="商品状态" prop="spuStatus">
+          <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>
+            <el-option label="下架" value="1"> </el-option>
+          </el-select>
+        </el-form-item>
+
+        <el-form-item
+          label="销售方式"
+          prop="saleModel"
+          v-if="queryParams.spuType == 0"
+        >
+          <el-select
+            v-model="queryParams.saleModel"
+            placeholder="请选择销售方式"
+            style="width: 240px"
+          >
+            <el-option label="全部" value=""> </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="saleModel"
+          v-if="queryParams.spuType == 1"
+        >
+          <el-select
+            v-model="queryParams.saleModel"
+            placeholder="请选择销售方式"
+            style="width: 240px"
+          >
+            <el-option label="全部" value=""> </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="isShare">
+          <el-select
+            v-model="queryParams.isShare"
+            placeholder="请选择奖励设置"
+            style="width: 240px"
+          >
+            <el-option label="全部" value=""> </el-option>
+            <el-option label="未设置" value="0"> 未设置</el-option>
+            <el-option label="已设置" value="1"> 已设置</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
+        v-loading="loading"
+        :data="tableList"
+        @selection-change="handleSelectionChange"
+        row-key="id"
+      >
+        <!-- shareRate -->
+        <el-table-column
+          type="selection"
+          width="55"
+          align="center"
+          :selectable="checkSelectable"
+        />
+        <el-table-column label="商品图片" align="center">
+          <template slot-scope="scope">
+            <el-image
+              style="width: 60px; height: 60px"
+              :src="scope.row.pic"
+              :preview-src-list="[scope.row.pic]"
+            >
+            </el-image>
+          </template>
+        </el-table-column>
+        <el-table-column
+          label="商品名称"
+          align="center"
+          prop="spuName"
+          :show-overflow-tooltip="true"
+        />
+        <el-table-column label="分类" align="center" prop="categoryName" />
+        <el-table-column
+          label="店铺所属分类"
+          align="center"
+          prop="merchantClassifyName"
+        />
+        <el-table-column label="价格" align="center" width="120">
+          <template slot-scope="scope">
+            {{ scope.row.lowestPrice.toFixed(2) }}/{{ scope.row.unit }}
+          </template>
+        </el-table-column>
+        <el-table-column label="起批量" align="center">
+          <template slot-scope="scope">
+            {{ scope.row.lowestPurchase }}{{ scope.row.unit }}
+          </template>
+        </el-table-column>
+        <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"
+          v-if="queryParams.spuType == 0"
+        >
+          <template slot-scope="scope">
+            <span>
+              {{
+                scope.row.saleModel == 1
+                  ? "普通商品"
+                  : scope.row.saleModel == 2
+                  ? "采集预售"
+                  : scope.row.saleModel == 3
+                  ? "团批秒杀"
+                  : scope.row.saleModel == 4
+                  ? "清库专区"
+                  : scope.row.saleModel == 5
+                  ? "新店福利"
+                  : ""
+              }}
+            </span>
+          </template>
+        </el-table-column>
+        <el-table-column
+          label="销售方式"
+          align="center"
+          v-if="queryParams.spuType == 1"
+        >
+          <template slot-scope="scope">
+            <span>
+              {{
+                scope.row.saleModel == 1
+                  ? "普通商品"
+                  : scope.row.saleModel == 2
+                  ? "预售"
+                  : scope.row.saleModel == 3
+                  ? "团购秒杀"
+                  : scope.row.saleModel == 4
+                  ? "特价"
+                  : scope.row.saleModel == 5
+                  ? "新人福利"
+                  : ""
+              }}
+            </span>
+          </template>
+        </el-table-column>
+        <el-table-column label="商品状态" align="center">
+          <template slot-scope="scope">
+            {{
+              scope.row.spuStatus == 2
+                ? "售罄"
+                : scope.row.spuStatus == 0
+                ? "上架"
+                : scope.row.spuStatus == 1
+                ? "下架"
+                : ""
+            }}
+          </template>
+        </el-table-column>
+        <el-table-column label="奖励设置" align="center">
+          <template slot-scope="scope">
+            {{
+              scope.row.isShare == 0
+                ? "未设置"
+                : scope.row.shareRate
+                ? scope.row.shareRate + "%"
+                : ""
+            }}
+          </template>
+        </el-table-column>
+      </el-table>
+      <pagination
+        v-show="total > 0"
+        :total="total"
+        :page.sync="queryParams.pageNo"
+        :limit.sync="queryParams.pageSize"
+        @pagination="getList"
+      />
+    </div>
+    <span slot="footer" class="dialog-footer">
+      <el-button @click="dialogVisible = false">取 消</el-button>
+      <el-button type="primary" @click="dialogSubmit">确 定</el-button>
+    </span>
+  </el-dialog>
+</template>
+
+<script>
+import { getMerchantClassifyList } from "@/api/sort/index.js";
+import { getGoodsListPage } from "@/api/manage/product";
+import { getClassificationListPage } from "@/api/common/index";
+export default {
+  props: ["isShare"],
+  data() {
+    return {
+      dialogVisible: false,
+      queryParams: {
+        saleModel: "",
+        pageNo: 1,
+        pageSize: 5,
+        spuName: "",
+        categoryId: "",
+        spuStatus: "",
+        saleType: "",
+        scope: "",
+        benefitType: "",
+        isShare: "",
+        spuType: '2',
+      },
+      total: 0,
+      loading: false,
+      tableList: [],
+      categoryprops: {
+        checkStrictly: true,
+        lazy: true,
+        lazyLoad: this.categoryLazyLoad,
+      },
+      categorypropsmerchant: {
+        checkStrictly: true,
+        lazy: true,
+        lazyLoad: this.categoryLazyLoadmerchant,
+      },
+      multipleSelection: [],
+    };
+  },
+  methods: {
+    checkSelectable(row, index) {
+      return row.returnVoucherRatio <= 0;
+    },
+    handleSelectionChange(val) {
+      this.multipleSelection = val;
+    },
+    dialogSubmit() {
+      this.multipleSelection = this.multipleSelection.map((item) => {
+        // 为每个对象添加新字段
+        return { ...item, spuType: this.queryParams.spuType };
+      });
+      this.$emit("productDialogInfo", this.multipleSelection);
+      this.handleClose();
+    },
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    handleQuery() {
+      if (this.queryParams.spuType == 2) {
+        this.queryParams.benefitType = 1;
+      } else {
+        this.queryParams.benefitType = "";
+      }
+      this.getList();
+    },
+    /** 查询参数列表 */
+    getList() {
+      this.loading = true;
+      getGoodsListPage(this.queryParams).then((res) => {
+        this.tableList = res.data.records;
+        this.total = res.data.total;
+        this.loading = false;
+      });
+    },
+    handleClose() {
+      this.dialogVisible = false;
+    },
+    openDialog() {
+      this.dialogVisible = true;
+      this.getList();
+    },
+    cascaderChange(val) {
+      if (val.length == 1) {
+        this.queryParams.categoryId = val[0];
+      } else if (val.length == 2) {
+        this.queryParams.categoryId = val[1];
+      } else if (val.length == 3) {
+        this.queryParams.categoryId = val[2];
+      }
+    },
+    categoryLazyLoad(node, resolve) {
+      let level = node.level;
+      if (!node.data) {
+        getClassificationListPage({ parentId: 0 }).then((res) => {
+          //接口
+          const nodes = Array.from(res.data).map((item, index) => ({
+            value: item.id,
+            label: `${item.className}`,
+            leaf: level >= 2,
+          }));
+          resolve(nodes);
+        });
+      } else if (level == 1) {
+        getClassificationListPage({ parentId: node.data.value }).then((res) => {
+          const nodes = Array.from(res.data).map((item) => ({
+            value: item.id,
+            label: `${item.className}`,
+            leaf: level >= 2,
+            // level: 2,
+          }));
+          resolve(nodes);
+        });
+      } else if (level == 2) {
+        getClassificationListPage({ parentId: node.data.value }).then((res) => {
+          const nodes = Array.from(res.data).map((item) => ({
+            value: item.id,
+            label: `${item.className}`,
+            leaf: level >= 1,
+            level: 1,
+          }));
+          resolve(nodes);
+        });
+      } else {
+        resolve({});
+      }
+    },
+    cascadermerchantChange(val) {
+      if (val.length == 1) {
+        this.queryParams.merchantClassifyId = val[0];
+      } else if (val.length == 2) {
+        this.queryParams.merchantClassifyId = val[1];
+      } else if (val.length == 3) {
+        this.queryParams.merchantClassifyId = val[2];
+      }
+    },
+    categoryLazyLoadmerchant(node, resolve, sortType) {
+      let params = {
+        classifyType: 1,
+      };
+      if (sortType) {
+        params.isDefault = 1;
+      }
+      let level = node.level;
+      if (!node.data) {
+        getMerchantClassifyList(params).then((res) => {
+          //接口
+          const nodes = Array.from(res.data).map((item, index) => ({
+            value: item.id,
+            label: `${item.classifyName}`,
+            leaf: level >= 2,
+          }));
+          // 通过调用resolve将子节点数据返回,通知组件数据加载完成
+          resolve(nodes);
+        });
+      } else if (level == 1) {
+        getMerchantClassifyList({
+          parentId: node.data.value,
+          classifyType: 1,
+        }).then((res) => {
+          const nodes = Array.from(res.data).map((item) => ({
+            value: item.id,
+            label: `${item.classifyName}`,
+            leaf: level >= 2,
+            // level: 2,
+          }));
+          // 通过调用resolve将子节点数据返回,通知组件数据加载完成
+          resolve(nodes);
+        });
+      } else {
+        resolve({});
+      }
+    },
+  },
+};
+</script>
+
+<style>
+.el-cascader-panel
+  > .el-scrollbar:first-child
+  > .el-cascader-menu__wrap
+  > .el-cascader-menu__list
+  > .el-cascader-node
+  > .el-radio {
+  display: block;
+}
+</style>

+ 97 - 88
src/views/member/coupon.vue

@@ -1,114 +1,123 @@
 <template>
-  <div class="app-container">
+  <div style="padding: 20px">
     <div>
-      <h4>设置返券商品返券比例</h4>
-      <el-form
-        :model="queryParams"
-        ref="queryForm"
-        size="small"
-        :inline="true"
-        :rules="rules"
-        label-width="120px"
+      <div class="header">
+        <h3>返券管理</h3>
+        <el-button type="primary" size="small" @click="addInfo">添加</el-button>
+      </div>
+
+      <span style="color: orange"
+        >*选择店铺商品,设置返券比例,已在发布时设置返券比例商品,无法在此设置,可去商品管理编辑。</span
+      >
+    </div>
+    <div>
+      <el-row
+        style="
+          margin-top: 20px;
+          display: flex;
+          flex-direction: row;
+          flex-wrap: wrap;
+          min-height: 250px;
+        "
       >
-        <el-row>
-          <el-col :span="24">
-            <el-form-item label="是否返券" prop="rebateCoupons">
-              <el-switch
-                v-model="queryParams.rebateCoupons"
-                active-color="#13ce66"
-                inactive-color="#ff4949"
-                :active-value="0"
-                :inactive-value="1"
-              >
-              </el-switch> </el-form-item
-          ></el-col>
-          <el-col :span="24">
-            <el-form-item label="返券比例" prop="bl">
-              <el-input
-                oninput="if(value){value=value.replace(/[^\d]/g,1);
-              if(Number(value)<=0){value=0}} if(Number(value)>100){value=100}"
-                v-model="queryParams.bl"
-                placeholder="请输入"
-                clearable
-                style="width: 180px"
-                :max="100"
-                :min="1"
-              >
-                <span slot="suffix">%</span>
-              </el-input>
-              <br />
-              <span style="font-size: 12px; color: orange"
-                >*只针对会员专区返券商品进行设置,用户购买返券商品,反一定金额代金券,返券金额=商品金额*返券比例%</span
-              >
-            </el-form-item>
-          </el-col>
-        </el-row>
-      </el-form>
-      <el-row>
-        <el-col style="text-align: center">
-          <el-button size="mini" type="primary" @click="submitFree"
-            >保存</el-button
-          ></el-col
-        >
+        <el-col :span="12" v-for="(item, index) in list" :key="index">
+          <el-card class="box-card" style="width: 90%">
+            <div
+              style="
+                display: flex;
+                flex-direction: row;
+                align-items: center;
+                justify-content: space-around;
+              "
+            >
+              {{ item.shareName }}
+              <span>返券比例:{{ item.returnVoucherRatio }}%</span>
+              <span>已选择商品:{{ item.returnGoodsNum }}个</span>
+              <div>
+                <el-button type="text" @click="edit(item)">编辑</el-button>
+                <el-button type="text" @click="remove(item)" style="color: red"
+                  >删除</el-button
+                >
+              </div>
+            </div>
+          </el-card>
+        </el-col>
       </el-row>
     </div>
   </div>
 </template>
 
 <script>
-import { setRebateCouponsGoods, getRebateCouponsGoods } from "@/api/manage/product";
-import { getStoreInfo } from "@/api/common/index";
+import { shareRewardList, shareRewardEdit } from "@/api/manage/coupon";
 export default {
   data() {
     return {
-      queryParams: {
-        rebateCoupons: 1,
-        rebateCouponsProportion: "",
-        bl: "",
-      },
-      tableData: [],
-      shopInfo: {},
-      expressType: 0,
-      rules: {
-        rebateCoupons: [{ required: true, message: "请选择是否返券", trigger: "blur" }],
-        bl: [{ required: true, message: "请输入返券比例", trigger: "blur" }],
-      },
+      list: [],
     };
   },
-  created() {
-    this.getInfo();
+  mounted() {
+    this.getList();
   },
-  mounted() {},
   methods: {
-    submitFree() {
-      this.$refs["queryForm"].validate((valid) => {
-        if (valid) {
-          this.queryParams.rebateCouponsProportion = this.queryParams.bl / 100;
-          setRebateCouponsGoods(this.queryParams).then((res) => {
+    getList() {
+      shareRewardList().then((res) => {
+        if (res.code == 200) {
+          this.list = res.data;
+        }
+      });
+    },
+    edit(item) {
+      let index = this.list.length;
+      this.$router.replace({
+        path: "/product/member/couponRecad",
+        query: {
+          item: JSON.stringify({
+            returnVoucherRatioId: item.returnVoucherRatioId,
+            returnVoucherRatio: item.returnVoucherRatio,
+          }),
+        },
+      });
+    },
+    remove(item) {
+      this.$confirm("是否确认删除该返券比例", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          shareRewardEdit({
+            returnVoucherRatioId: item.returnVoucherRatioId,
+            returnVoucherRatio: 0,
+          }).then((res) => {
             if (res.code == 200) {
-              this.$message.success("保存成功!");
-              this.getInfo();
+              this.$message.success("删除成功!");
+              this.getList();
             }
           });
-        } else {
-          console.log("error submit!!");
-          return false;
-        }
-      });
+        })
+        .catch(() => {
+          this.$message({
+            type: "info",
+            message: "已取消删除",
+          });
+        });
     },
-    getInfo() {
-      getRebateCouponsGoods().then((res) => {
-        if (res.code == 200) {
-          this.queryParams.rebateCoupons = res.data.rebateCoupons;
-          this.queryParams.rebateCouponsProportion = (
-            res.data.rebateCouponsProportion * 100
-          ).toFixed(0);
-          this.queryParams.bl = (res.data.rebateCouponsProportion * 100).toFixed(0);
-        }
+    addInfo() {
+      let index = this.list.length;
+      this.$router.replace({
+        path: "/product/member/couponRecad",
+        query: { index },
       });
     },
   },
 };
 </script>
 
-<style></style>
+<style scoped>
+.header {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  justify-content: space-between;
+}
+</style>

+ 360 - 0
src/views/member/couponRecad.vue

@@ -0,0 +1,360 @@
+<template>
+  <div style="padding: 20px">
+    <div>
+      <div class="header">
+        <h3>{{ form.shareName ? form.shareName : "分享奖励设置" }}</h3>
+      </div>
+
+      <span style="color: orange"
+        >*所设置分享奖励比例只对所选商品进行设置!</span
+      >
+    </div>
+
+    <el-form ref="form" :rules="rules" :model="form" label-width="150px">
+      <el-row>
+        <el-col :span="12">
+          <el-form-item
+            label="返券比例(%)"
+            style="margin-top: 30px"
+            prop="returnVoucherRatio"
+          >
+            <el-input-number
+              v-model="form.returnVoucherRatio"
+              style="width: 150px"
+              :controls="false"
+              max="100"
+              min="0"
+            ></el-input-number>
+          </el-form-item>
+        </el-col>
+        <el-col :span="24">
+          <el-form-item label="商品" style="margin-top: 30px">
+            <el-button type="primary" size="small" @click="selectProDuct"
+              >选择商品</el-button
+            >
+          </el-form-item>
+          <div style="margin-left: 30px">
+            已选{{ multipleSelection.length }}件
+            <el-button size="small" style="margin-left: 10px" @click="addRemove"
+              >批量移除</el-button
+            >
+          </div>
+
+          <el-table
+            :data="tableData"
+            style="width: 100%; margin-left: 30px"
+            @selection-change="handleSelectionChange"
+          >
+            <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.pic"
+                  :preview-src-list="[scope.row.pic]"
+                >
+                </el-image>
+              </template>
+            </el-table-column>
+            <el-table-column
+              label="商品名称"
+              align="center"
+              prop="spuName"
+              :show-overflow-tooltip="true"
+            />
+            <el-table-column label="分类" align="center" prop="categoryName" />
+            <el-table-column
+              label="店铺所属分类"
+              align="center"
+              prop="merchantClassifyName"
+            />
+            <el-table-column label="价格" align="center" width="120">
+              <template slot-scope="scope">
+                {{ scope.row.lowestPrice.toFixed(2) }}/{{ scope.row.unit }}
+              </template>
+            </el-table-column>
+            <el-table-column label="起批量" align="center">
+              <template slot-scope="scope">
+                {{ scope.row.lowestPurchase }}{{ scope.row.unit }}
+              </template>
+            </el-table-column>
+            <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">
+              <template slot-scope="scope">
+                <span v-if="scope.row.spuType == 0">
+                  {{
+                    scope.row.saleModel == 1
+                      ? "普通商品"
+                      : scope.row.saleModel == 2
+                      ? "采集预售"
+                      : scope.row.saleModel == 3
+                      ? "团批秒杀"
+                      : scope.row.saleModel == 4
+                      ? "清库专区"
+                      : scope.row.saleModel == 5
+                      ? "新店福利"
+                      : ""
+                  }}
+                </span>
+                <span v-else-if="scope.row.spuType == 1">
+                  {{
+                    scope.row.saleModel == 1
+                      ? "普通商品"
+                      : scope.row.saleModel == 2
+                      ? "预售"
+                      : scope.row.saleModel == 3
+                      ? "团购秒杀"
+                      : scope.row.saleModel == 4
+                      ? "特价"
+                      : scope.row.saleModel == 5
+                      ? "新人福利"
+                      : ""
+                  }}
+                </span>
+                <span v-eles>
+                  {{ scope.row.saleModel == 7 ? "返券商品" : "" }}
+                </span>
+              </template>
+            </el-table-column>
+            <el-table-column label="商品状态" align="center">
+              <template slot-scope="scope">
+                {{
+                  scope.row.spuStatus == 2
+                    ? "售罄"
+                    : scope.row.spuStatus == 0
+                    ? "上架"
+                    : scope.row.spuStatus == 1
+                    ? "下架"
+                    : ""
+                }}
+              </template>
+            </el-table-column>
+
+            <el-table-column
+              v-if="showButton"
+              label="操作"
+              align="center"
+              class-name="small-padding fixed-width"
+              width="100"
+            >
+              <template slot-scope="scope">
+                <el-button
+                  size="mini"
+                  type="text"
+                  @click="remove(scope.row, scope.$index)"
+                  >移除</el-button
+                >
+              </template>
+            </el-table-column>
+          </el-table>
+
+
+        </el-col>
+        <el-col
+          :span="24"
+          style="text-align: center; margin-top: 20px"
+          v-if="showButton"
+        >
+          <el-button type="primary" @click="submitForm">保存</el-button>
+        </el-col>
+      </el-row>
+    </el-form>
+    <productDialog
+      ref="productDialog"
+      @productDialogInfo="productDialogInfo"
+    ></productDialog>
+  </div>
+</template>
+
+<script>
+import {
+  shareRewardSave,
+  batchRemove,
+  shareRewardEdit,
+  getReturnVoucherRatioInfo,
+} from "@/api/manage/coupon";
+import productDialog from "./components/periodProductDialog.vue";
+export default {
+  components: { productDialog },
+  data() {
+    return {
+      showButton: true,
+      form: {
+        proportion: null,
+      },
+      rules: {
+        proportion: [
+          { required: true, message: "请输入分享奖励比例", trigger: "blur" },
+        ],
+      },
+      tableData: [],
+      multipleSelection: [],
+      queryParams: {
+        pageNo: 1,
+        pageSize: 10,
+        isShare: 1,
+        spuIds: null,
+      },
+    };
+  },
+  created() {
+    if (this.$route.query.item) {
+        console.log(this.$route.query.item);
+
+      this.queryParams.spuIds =  JSON.parse(this.$route.query.item).returnVoucherRatioId;
+      this.form = JSON.parse(this.$route.query.item);
+      this.getList();
+    }
+  },
+  mounted() {},
+  methods: {
+    handleSelectionChange(val) {
+      this.multipleSelection = val;
+    },
+    addRemove() {
+      if (this.multipleSelection.length < 1) {
+        this.$message.error("请先选择要移除的商品!");
+        return false;
+      }
+      let ids = [];
+      this.multipleSelection.forEach((e) => {
+        ids.push(e.id);
+      });
+      this.$confirm("是否移除已选商品,移除后, 该商品不可获得返券比例", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          shareRewardEdit({
+            returnVoucherRatioId: this.form.returnVoucherRatioId,
+            returnVoucherRatio: 0,
+          }).then((res) => {
+            if (res.code == 200) {
+              this.$message.success("移除成功!");
+              this.getList();
+            }
+          });
+        })
+        .catch(() => {
+          this.$message({
+            type: "info",
+            message: "已取消删除",
+          });
+        });
+    },
+    remove(row, index) {
+      this.$confirm(
+        "是否移除已选商品,移除后, 该商品不可使用获得分享奖励",
+        "提示",
+        {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning",
+        }
+      )
+        .then(() => {
+          batchRemove({
+            // id: this.$route.query.item.id,
+            selectGoodsIds: row.id,
+          }).then((res) => {
+            if (res.code == 200) {
+              this.$message.success("移除成功!");
+              this.tableData.splice(index, 1);
+            }
+          });
+        })
+        .catch(() => {
+          this.$message({
+            type: "info",
+            message: "已取消删除",
+          });
+        });
+    },
+    productDialogInfo(list) {
+      this.tableData = [...this.tableData, ...list];
+      this.tableData = this.tableData.filter((item, index, self) => {
+        return self.findIndex((t) => t.id === item.id) === index;
+      });
+    },
+    selectProDuct() {
+      this.$refs.productDialog.openDialog();
+    },
+    submitForm() {
+      console.log(this.tableData);
+      if (this.tableData.length < 1) {
+        this.$message.error("请选择可以获得分享奖励的商品!");
+        return;
+      }
+      let ids = [];
+      this.tableData.forEach((e) => {
+        ids.push(e.id);
+      });
+      this.$refs.form.validate((valid) => {
+        if (valid) {
+          if (this.form.id) {
+            this.form.returnVoucherRatioId = ids.toString();
+
+            shareRewardEdit(this.form).then((res) => {
+              if (res.code == 200) {
+                this.$message.success("编辑保存成功!");
+                this.$store.dispatch("tagsView/delView", this.$route);
+                this.$router.replace({ path: "/product/member/coupon" });
+                this.getList();
+              }
+            });
+          } else {
+            this.form.returnVoucherRatioId = ids.toString();
+
+            shareRewardSave(this.form).then((res) => {
+              if (res.code == 200) {
+                this.$message.success("保存成功!");
+                this.$store.dispatch("tagsView/delView", this.$route);
+                this.$router.replace({ path: "/product/member/coupon" });
+                this.getList();
+              }
+            });
+          }
+        } else {
+          console.log("error submit!!");
+          return false;
+        }
+      });
+    },
+    /** 查询参数列表 */
+    getList() {
+      this.loading = true;
+      getReturnVoucherRatioInfo({
+        returnVoucherRatioId: this.form.returnVoucherRatioId,
+      }).then((res) => {
+        this.tableData = res.data;
+        this.loading = false;
+      });
+    },
+  },
+};
+</script>
+
+<style scoped>
+.header {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  justify-content: space-between;
+}
+</style>

+ 1 - 1
src/views/member/module/basic-info.vue

@@ -13,7 +13,7 @@
           <span slot="label">销售方式</span>
           <el-radio-group v-model="form.saleModel" @change="passValue">
             <el-radio :label="6" :value="6">会员商品</el-radio>
-            <el-radio :label="7" :value="7">返券商品</el-radio>
+            <!-- <el-radio :label="7" :value="7">返券商品</el-radio> -->
             <el-radio :label="8" :value="8">业务专员商品</el-radio>
           </el-radio-group>
         </el-form-item>

+ 18 - 2
src/views/product/createProduct.vue

@@ -271,7 +271,7 @@ export default {
       if (this.form.categoryIds.length < 1) {
         this.form.categoryIds = "";
       }
-      if (!this.form.presaleStartTime && !this.form.presaleEndTime) {
+      if (this.form.presaleStartTime && this.form.presaleEndTime) {
         if (this.form.datePicke) {
           this.form.presaleStartTime = moment(
             this.form.datePicker[0]
@@ -279,6 +279,14 @@ export default {
           this.form.presaleEndTime = moment(this.form.datePicker[1]).valueOf();
         }
       }
+      if (this.form.seckillStartTime && this.form.seckillEndTime) {
+        if (this.form.datePickerms) {
+          this.form.seckillStartTime = moment(
+            this.form.datePickerms[0]
+          ).valueOf();
+          this.form.seckillEndTime = moment(this.form.datePickerms[1]).valueOf();
+        }
+      }
       // if (this.form.bannerList?.length > 0) {
       //   this.form.bannerList.shift();
       // }
@@ -359,7 +367,7 @@ export default {
         this.form.categoryId =
           this.form.categoryId[this.form.categoryId.length - 1];
       }
-      if (!this.form.presaleStartTime && !this.form.presaleEndTime) {
+      if (this.form.presaleStartTime && this.form.presaleEndTime) {
         if (this.form.datePicke) {
           this.form.presaleStartTime = moment(
             this.form.datePicker[0]
@@ -367,6 +375,14 @@ export default {
           this.form.presaleEndTime = moment(this.form.datePicker[1]).valueOf();
         }
       }
+      if (this.form.seckillStartTime && this.form.seckillEndTime) {
+        if (this.form.datePickerms) {
+          this.form.seckillStartTime = moment(
+            this.form.datePickerms[0]
+          ).valueOf();
+          this.form.seckillEndTime = moment(this.form.datePickerms[1]).valueOf();
+        }
+      }
       if (this.form.saleModel == 2) {
         this.form.merchantClassifyId = "[217527]";
         this.form.merchantClassifyName = "集采预售";

+ 40 - 3
src/views/product/module/basic-info.vue

@@ -13,9 +13,7 @@
           <span slot="label">销售方式</span>
           <el-radio-group v-model="form.saleType" @change="passValue">
             <el-radio :label="0" :value="0">普通商品</el-radio>
-            <el-radio :label="4" :value="4"
-              >礼包</el-radio
-            >
+            <el-radio :label="4" :value="4">礼包</el-radio>
           </el-radio-group>
         </el-form-item>
       </el-col>
@@ -35,6 +33,21 @@
           </el-radio-group>
         </el-form-item>
       </el-col>
+      <el-col :span="24" v-if="form.saleModel == 3">
+        <el-form-item prop="datePickerms">
+          <span slot="label">秒杀时间</span>
+          <el-date-picker
+            v-model="form.datePickerms"
+            type="datetimerange"
+            range-separator="至"
+            value-format="yyyy-MM-dd HH:mm:ss"
+            start-placeholder="开始日期"
+            end-placeholder="结束日期"
+            @change="pickermsChange"
+          >
+          </el-date-picker>
+        </el-form-item>
+      </el-col>
       <el-col :span="24" v-if="form.saleModel == 2 || form.saleType == 2">
         <el-form-item prop="datePicker">
           <span slot="label">预售时间</span>
@@ -247,6 +260,9 @@ export default {
         datePicker: [
           { required: true, message: "预售时间不能为空", trigger: "blur" },
         ],
+        datePickerms: [
+          { required: true, message: "秒杀时间不能为空", trigger: "blur" },
+        ],
       },
       index: 0,
       shopInfo: {},
@@ -276,6 +292,8 @@ export default {
         categoryName,
         presaleStartTime,
         presaleEndTime,
+        seckillEndTime,
+        seckillStartTime,
       } = record || {};
       // 更新表单数据
       this.form = {
@@ -298,8 +316,22 @@ export default {
         presaleEndTime: presaleEndTime
           ? moment(presaleEndTime).format("yyyy-MM-DD HH:mm:ss")
           : "",
+        seckillStartTime: seckillStartTime
+          ? moment(seckillStartTime).format("yyyy-MM-DD HH:mm:ss")
+          : "",
+        seckillEndTime: seckillEndTime
+          ? moment(seckillEndTime).format("yyyy-MM-DD HH:mm:ss")
+          : "",
       };
 
+      if (seckillStartTime && seckillEndTime) {
+        this.$nextTick(() => {
+          this.$set(this.form, "datePickerms", [
+            this.form.seckillStartTime,
+            this.form.seckillEndTime,
+          ]);
+        });
+      }
       // 更新日期选择器
       if (presaleStartTime && presaleEndTime) {
         this.$nextTick(() => {
@@ -356,6 +388,11 @@ export default {
       this.bannerList.splice(index, 1);
       this.passValue();
     },
+    pickermsChange(val) {
+      this.form.seckillStartTime = moment(val[0]).valueOf();
+      this.form.seckillEndTime = moment(val[1]).valueOf();
+      this.passValue();
+    },
     pickerChange(val) {
       this.form.presaleStartTime = moment(this.form.datePicker[0]).valueOf();
       this.form.presaleEndTime = moment(this.form.datePicker[1]).valueOf();

+ 27 - 1
src/views/product/module/sales-info.vue

@@ -409,6 +409,30 @@
           >%
         </el-form-item>
       </el-col>
+      <el-col :span="24">
+        <el-form-item prop="returnVoucherRatio">
+          <span slot="label"
+            >返券比例(%)
+            <el-tooltip
+              effect="dark"
+              content="返券比例:用户下单该商品后,交易完成后可获得商品金额的X%的代金券奖励,该代金券只可在本店铺使用"
+              placement="top-start"
+            >
+              <i class="el-icon-question"></i>
+            </el-tooltip>
+          </span>
+          <el-input-number
+            v-model="form.returnVoucherRatio"
+            :min="0"
+            :max="100"
+            placeholder="请输入返券比例"
+            :controls="false"
+            @change="passValue"
+          >
+          </el-input-number
+          >%
+        </el-form-item>
+      </el-col>
     </el-row>
     <Amap ref="mapOpen" @address="Mapaddress"></Amap>
   </el-form>
@@ -583,12 +607,14 @@ export default {
         skuList,
         props = [],
         shippingAddrId,
+        returnVoucherRatio,
       } = record || {};
 
       this.form = {
         ...this.form,
-        shippingAddrId:JSON.stringify(shippingAddrId),
+        shippingAddrId: JSON.stringify(shippingAddrId),
         merchantClassifyName,
+        returnVoucherRatio,
         expressType,
         shareRate,
         merchantClassifyIds: merchantClassifyId,

+ 18 - 2
src/views/product/updateProduct.vue

@@ -390,7 +390,7 @@ export default {
     },
 
     submitFormDraft() {
-      if (!this.form.presaleStartTime && !this.form.presaleEndTime) {
+      if (this.form.presaleStartTime && this.form.presaleEndTime) {
         if (this.form.datePicke) {
           this.form.presaleStartTime = moment(
             this.form.datePicker[0]
@@ -398,6 +398,14 @@ export default {
           this.form.presaleEndTime = moment(this.form.datePicker[1]).valueOf();
         }
       }
+      if (this.form.seckillStartTime && this.form.seckillEndTime) {
+        if (this.form.datePickerms) {
+          this.form.seckillStartTime = moment(
+            this.form.datePicker[0]
+          ).valueOf();
+          this.form.seckillEndTime = moment(this.form.datePicker[1]).valueOf();
+        }
+      }
       if (this.form.categoryId?.length > 0) {
         this.form.categoryId =
           this.form.categoryId[this.form.categoryId.length - 1];
@@ -433,7 +441,7 @@ export default {
         return;
       }
       this.btnLading = true;
-      if (!this.form.presaleStartTime && !this.form.presaleEndTime) {
+      if (this.form.presaleStartTime && this.form.presaleEndTime) {
         if (this.form.datePicke) {
           this.form.presaleStartTime = moment(
             this.form.datePicker[0]
@@ -441,6 +449,14 @@ export default {
           this.form.presaleEndTime = moment(this.form.datePicker[1]).valueOf();
         }
       }
+      if (this.form.seckillStartTime && this.form.seckillEndTime) {
+        if (this.form.datePickerms) {
+          this.form.seckillStartTime = moment(
+            this.form.datePicker[0]
+          ).valueOf();
+          this.form.seckillEndTime = moment(this.form.datePicker[1]).valueOf();
+        }
+      }
 
       if (this.form.categoryId?.length > 0) {
         this.form.categoryId =

+ 35 - 12
src/views/productNationwide/createProduct.vue

@@ -11,9 +11,13 @@
             ref="salesRefs"
             :saleType="form.saleType"
             :saleModels="form.saleModel"
+            :salesCategory="form.salesCategory"
           ></salesInfo>
           <el-descriptions title="商品详情" column="1"> </el-descriptions>
-          <productInfo @updateValue="updateValue" ref="productRefs"></productInfo>
+          <productInfo
+            @updateValue="updateValue"
+            ref="productRefs"
+          ></productInfo>
 
           <div class="dialog-footer" style="text-align: center">
             <el-button @click="submitCancel">取 消</el-button>
@@ -21,7 +25,9 @@
               >发 布</el-button
             >
 
-            <el-button type="primary" @click="submitFormDraft">存入草稿箱</el-button>
+            <el-button type="primary" @click="submitFormDraft"
+              >存入草稿箱</el-button
+            >
           </div>
         </el-col>
         <phoneView style="position: absolute; bottom: 50px; right: 50px">
@@ -63,7 +69,9 @@
                     class="price"
                     :key="item"
                     v-for="item in form.skuList ? form.skuList.slice(0, 1) : []"
-                    >{{ item.skuPriceList ? item.skuPriceList[0].price : 0 }}元</span
+                    >{{
+                      item.skuPriceList ? item.skuPriceList[0].price : 0
+                    }}元</span
                   >
 
                   <span>/{{ form.unit }}</span>
@@ -76,7 +84,9 @@
               <div v-for="(item, index) in form.skuList" :key="index">
                 <div class="price_info">
                   <span
-                    >{{ item.skuSpecsList[0] ? item.skuSpecsList[0].specsName : "" }}
+                    >{{
+                      item.skuSpecsList[0] ? item.skuSpecsList[0].specsName : ""
+                    }}
                     {{
                       item.skuSpecsList[0].specsValue
                         ? item.skuSpecsList[0].specsValue
@@ -113,7 +123,8 @@
                     }}/{{ form.unit }}起购</span
                   >
                   <span style="font-size: 14px"
-                    >库存:{{ item.stock + item.predictStocks }}{{ form.unit }}</span
+                    >库存:{{ item.stock + item.predictStocks
+                    }}{{ form.unit }}</span
                   >
                 </div>
               </div>
@@ -131,7 +142,11 @@
                   <el-col :span="24">
                     <el-form-item label="发货地" prop="spuName">
                       <div style="width: 185px">
-                        {{ form.shippingAddrBean ? form.shippingAddrBean.addr : "" }}
+                        {{
+                          form.shippingAddrBean
+                            ? form.shippingAddrBean.addr
+                            : ""
+                        }}
                         {{
                           form.shippingAddrBean
                             ? form.shippingAddrBean.addrDetail
@@ -229,7 +244,10 @@
 <script>
 import { getStoreInfo } from "@/api/common/index";
 import { publishGoods } from "@/api/publish/index";
-import { saveGoodsDraft, queryUserRelevanceTemplate } from "@/api/manage/product";
+import {
+  saveGoodsDraft,
+  queryUserRelevanceTemplate,
+} 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";
@@ -248,14 +266,17 @@ export default {
   methods: {
     submitFormDraft() {
       if (this.form.categoryId?.length > 0) {
-        this.form.categoryId = this.form.categoryId[this.form.categoryId.length - 1];
+        this.form.categoryId =
+          this.form.categoryId[this.form.categoryId.length - 1];
       }
       if (this.form.categoryIds.length < 1) {
         this.form.categoryIds = "";
       }
       if (!this.form.presaleStartTime && !this.form.presaleEndTime) {
         if (this.form.datePicke) {
-          this.form.presaleStartTime = moment(this.form.datePicker[0]).valueOf();
+          this.form.presaleStartTime = moment(
+            this.form.datePicker[0]
+          ).valueOf();
           this.form.presaleEndTime = moment(this.form.datePicker[1]).valueOf();
         }
       }
@@ -263,7 +284,6 @@ export default {
       //   this.form.bannerList.shift();
       // }
 
-
       saveGoodsDraft(this.form).then((res) => {
         if (res.code == 200) {
           this.$message.success(`发布成功!请前往草稿箱查看`);
@@ -327,11 +347,14 @@ export default {
       //   return;
       // }
       if (this.form.categoryId?.length > 0) {
-        this.form.categoryId = this.form.categoryId[this.form.categoryId.length - 1];
+        this.form.categoryId =
+          this.form.categoryId[this.form.categoryId.length - 1];
       }
       if (!this.form.presaleStartTime && !this.form.presaleEndTime) {
         if (this.form.datePicke) {
-          this.form.presaleStartTime = moment(this.form.datePicker[0]).valueOf();
+          this.form.presaleStartTime = moment(
+            this.form.datePicker[0]
+          ).valueOf();
           this.form.presaleEndTime = moment(this.form.datePicker[1]).valueOf();
         }
       }

+ 37 - 0
src/views/productNationwide/module/basic-info.vue

@@ -32,6 +32,27 @@
         </el-form-item>
       </el-col>
 
+      <el-col :span="24" v-if="form.saleModel == 1">
+        <el-form-item prop="vehicleSalesCategory">
+          <span slot="label">类别</span>
+          <el-radio-group
+            v-model="form.vehicleSalesCategory"
+            @change="passValue"
+          >
+            <el-radio :label="0" :name="0">经销商</el-radio>
+            <el-radio :label="1" :name="1">厂家直供</el-radio>
+          </el-radio-group>
+        </el-form-item>
+      </el-col>
+      <el-col :span="24" v-if="form.saleModel == 2">
+        <el-form-item prop="salesCategory">
+          <span slot="label">售卖类别</span>
+          <el-radio-group v-model="form.salesCategory" @change="passValue">
+            <el-radio label="0" name="0">单独商品</el-radio>
+            <el-radio label="1" name="1">果园预售</el-radio>
+          </el-radio-group>
+        </el-form-item>
+      </el-col>
       <el-col :span="24" v-if="form.saleModel == 2">
         <el-form-item prop="djzfPicker">
           <span slot="label">定金支付时间</span>
@@ -272,6 +293,14 @@ export default {
             trigger: "blur",
           },
         ],
+
+        vehicleSalesCategory: [
+          {
+            required: true,
+            message: "请选择售卖类别",
+            trigger: "blur",
+          },
+        ],
       },
       index: 0,
       shopInfo: {},
@@ -282,6 +311,8 @@ export default {
   },
   methods: {
     getFormInfo(record, type) {
+      console.log("11111111111111111", record);
+
       // 重置表单基础数据
       this.actionType = type === "cg" ? "" : "edit";
       // this.form.datePicker = [];
@@ -306,10 +337,14 @@ export default {
         balancePayStartTime,
         balancePayEndTime,
         presaleEndStatus,
+        vehicleSalesCategory,
+        salesCategory,
       } = record || {};
       // 更新表单数据
       this.form = {
         ...this.form,
+        vehicleSalesCategory,
+        salesCategory: JSON.stringify(salesCategory),
         categoryId,
         categoryIds,
         carpoolSuccessTime,
@@ -348,6 +383,8 @@ export default {
           : "",
         presaleEndStatus,
       };
+      console.log("111111111111111111", this.form);
+
       if (downPayStartTime && downPayEndTime) {
         this.$nextTick(() => {
           this.$set(this.form, "djzfPicker", [

+ 145 - 29
src/views/productNationwide/module/sales-info.vue

@@ -19,31 +19,7 @@
           />
         </el-form-item>
       </el-col>
-      <!-- <el-col :span="24">
-        <el-form-item prop="giftDesc" label="快递类型">
-          <el-radio
-            v-model="form.expressType"
-            :label="0"
-            :value="0"
-            @change="passValue"
-            >水果特惠</el-radio
-          >
-          <el-radio
-            v-model="form.expressType"
-            :label="1"
-            :value="1"
-            @change="passValue"
-            >生鲜特快</el-radio
-          >
-          <el-radio
-            v-model="form.expressType"
-            :label="2"
-            :value="2"
-            @change="passValue"
-            >京东标快</el-radio
-          >
-        </el-form-item>
-      </el-col> -->
+
       <el-col :span="24">
         <el-form-item prop="unit">
           <span slot="label">计量单位</span>
@@ -274,6 +250,87 @@
                   <el-option label="付款72小时之内" value="付款72小时之内" />
                 </el-select>
               </el-form-item>
+
+              <template v-if="salesCategory == 1">
+                <el-form-item>
+                  <span slot="label">产地</span>
+                  <el-cascader
+                    v-model="form.producerIds"
+                    :options="areaoptions"
+                    @change="handleChange"
+                    ref="cascader"
+                    :props="propsarea"
+                    collapse-tags
+                  ></el-cascader>
+                </el-form-item>
+                <el-form-item prop="producerAddrDetail">
+                  <span slot="label">详细地址</span>
+                  <el-input
+                    @input="passValue"
+                    v-model="form.producerAddrDetail"
+                    placeholder="请输入产地详细地址"
+                    clearable
+                  >
+                  </el-input>
+                </el-form-item>
+                <el-form-item prop="squareMeasureUnit">
+                  <span slot="label">面积单位</span>
+                  <el-select
+                    v-model="form.squareMeasureUnit"
+                    placeholder="请选择面积单位"
+                    @change="passValue"
+                  >
+                    <el-option label="平方米" value="平方米"> </el-option>
+                    <el-option label="公顷" value="公顷"> </el-option>
+                  </el-select>
+                </el-form-item>
+                <el-form-item prop="squareMeasure">
+                  <span slot="label">面积</span>
+                  <el-input
+                    @input="passValue"
+                    v-model="form.squareMeasure"
+                    placeholder="请输入面积"
+                    clearable
+                  >
+                    <template slot="suffix">
+                      {{ form.squareMeasureUnit }}</template
+                    >
+                  </el-input>
+                </el-form-item>
+                <el-form-item prop="yield">
+                  <span slot="label">产量单位</span>
+
+                  <el-select
+                    v-model="form.yieldUnit"
+                    placeholder="请选择产量单位"
+                    @change="passValue"
+                  >
+                    <el-option label="千克" value="千克"> </el-option>
+                    <el-option label="吨" value="吨"> </el-option>
+                  </el-select>
+                </el-form-item>
+                <el-form-item prop="yields">
+                  <span slot="label">产量</span>
+                  <el-input
+                    @input="passValue"
+                    v-model="form.yields"
+                    placeholder="请输入产量"
+                    clearable
+                  >
+                    <template slot="suffix">{{ form.yieldUnit }}</template>
+                  </el-input>
+                </el-form-item>
+                <el-form-item prop="variety">
+                  <span slot="label">品种</span>
+                  <el-input
+                    @input="passValue"
+                    v-model="form.variety"
+                    placeholder="请输入品种名称"
+                    clearable
+                  >
+                  </el-input>
+                </el-form-item>
+              </template>
             </div>
 
             <el-form-item
@@ -403,19 +460,45 @@
           >%
         </el-form-item>
       </el-col>
+      <el-col :span="24">
+        <el-form-item prop="returnVoucherRatio">
+          <span slot="label"
+            >返券比例(%)
+            <el-tooltip
+              effect="dark"
+              content="返券比例:用户下单该商品后,交易完成后可获得商品金额的X%的代金券奖励,该代金券只可在本店铺使用"
+              placement="top-start"
+            >
+              <i class="el-icon-question"></i>
+            </el-tooltip>
+          </span>
+          <el-input-number
+            v-model="form.returnVoucherRatio"
+            :min="0"
+            :max="100"
+            placeholder="请输入返券比例"
+            :controls="false"
+            @change="passValue"
+          >
+          </el-input-number
+          >%
+        </el-form-item>
+      </el-col>
     </el-row>
     <Amap ref="mapOpen" @address="Mapaddress"></Amap>
   </el-form>
 </template>
 
 <script>
+import cityJson from "@/assets/city.json";
 import { getMerchantClassifyList } from "@/api/sort/index.js";
 import { getStoreInfo } from "@/api/common/index";
+import { getCityTreeNew } from "@/api/manage/material.js";
 import Amap from "@/components/Map/map.vue";
 import { getDict } from "@/api/common/index.js";
 import { dxAddressList } from "@/api/manage/address";
 export default {
-  props: ["data", "saleType", "saleModels"],
+  props: ["data", "saleType", "saleModels", "salesCategory"],
   components: { Amap },
   data() {
     return {
@@ -442,6 +525,7 @@ export default {
         merchantClassifyIds: [],
         merchantClassifyName: "",
         shippingAddrId: "",
+        yields: "",
       },
       addr: "",
       measure: [],
@@ -470,7 +554,11 @@ export default {
           { required: true, message: "店铺所属分类不能为空", trigger: "blur" },
         ],
       },
-
+      propsarea: {
+        label: "name",
+        value: "code",
+        children: "childList",
+      },
       shopInfo: {},
       saleType: undefined,
       sj: true,
@@ -484,6 +572,7 @@ export default {
         value: "value",
       },
       options: [],
+      areaoptions: [],
     };
   },
   watch: {
@@ -494,11 +583,22 @@ export default {
     },
   },
   mounted() {
+    this.getArea();
     this.getInfo();
     this.getdictImpl();
     this.getAreaList();
   },
   methods: {
+    getArea() {
+      console.log(cityJson);
+      this.areaoptions = cityJson;
+    },
+    handleChange(val) {
+      const cascader = this.$refs.cascader;
+      const selectedLabels = cascader.getCheckedNodes();
+      this.form.producerAddr = selectedLabels[0].pathLabels.join("");
+    },
+
     areaAdd() {
       this.$router.push({ path: "/manage/manage/address/index" });
     },
@@ -576,14 +676,30 @@ export default {
         shippingTimeDesc,
         freeShipping,
         skuList,
+        returnVoucherRatio,
+        producerAddr,
+        producerAddrDetail,
+        squareMeasure,
+        squareMeasureUnit,
+        variety,
+        producerIds,
+        yieldUnit,
         props = [], // 默认空数组避免后续判断
       } = record;
 
       // 更新表单数据
       this.form = {
+        producerIds: JSON.parse(producerIds).map(String),
         ...this.form, // 保留原有属性
+        producerAddr,
+        yieldUnit,
+        squareMeasure,
+        producerAddrDetail,
+        squareMeasureUnit,
+        variety,
         shippingAddrId: JSON.stringify(shippingAddrId),
         merchantClassifyName,
+        returnVoucherRatio,
         expressType,
         shareRate,
         merchantClassifyIds: merchantClassifyId,
@@ -606,8 +722,8 @@ export default {
           provinceCode: record.provinceCode,
         },
       };
-
-      console.log(this.form);
+      this.form.yields = record.yield;
+      console.log('zzz',this.form);
 
       // 独立处理特殊属性
       this.saleModel = saleModel;

+ 7 - 0
src/views/productNationwide/updateProduct.vue

@@ -15,6 +15,7 @@
             @updateValue="updateValue"
             @skuRemove="skuRemove"
             :saleModels="form.saleModel"
+            :salesCategory="form.salesCategory"
           ></salesInfo>
           <el-descriptions title="商品详情" column="1"> </el-descriptions>
           <productInfo
@@ -394,6 +395,9 @@ export default {
     },
 
     submitFormDraft() {
+      if (this.form.producerIds) {
+        this.form.producerIds = this.form.producerIds.toString();
+      }
       if (!this.form.presaleStartTime && !this.form.presaleEndTime) {
         if (this.form.datePicke) {
           this.form.presaleStartTime = moment(
@@ -440,6 +444,9 @@ export default {
       //   this.$message.error(`请选择发货地址的省市区!`);
       //   return;
       // }
+      if (this.form.producerIds) {
+        this.form.producerIds = this.form.producerIds.toString();
+      }
       this.btnLading = true;
       if (!this.form.presaleStartTime && !this.form.presaleEndTime) {
         if (this.form.datePicke) {

+ 30 - 28
src/views/shipping/module/sales-info.vue

@@ -4,7 +4,7 @@
     ref="queryForm"
     size="small"
     :inline="true"
-    label-width="120px"
+    label-width="140px"
     :rules="rules"
   >
     <el-row>
@@ -19,31 +19,7 @@
           />
         </el-form-item>
       </el-col>
-      <!-- <el-col :span="24">
-        <el-form-item prop="giftDesc" label="快递类型">
-          <el-radio
-            v-model="form.expressType"
-            :label="0"
-            :value="0"
-            @change="passValue"
-            >水果特惠</el-radio
-          >
-          <el-radio
-            v-model="form.expressType"
-            :label="1"
-            :value="1"
-            @change="passValue"
-            >生鲜特快</el-radio
-          >
-          <el-radio
-            v-model="form.expressType"
-            :label="2"
-            :value="2"
-            @change="passValue"
-            >京东标快</el-radio
-          >
-        </el-form-item>
-      </el-col> -->
+
       <el-col :span="24">
         <el-form-item prop="unit">
           <span slot="label">计量单位</span>
@@ -136,7 +112,7 @@
               </template>
             </el-table-column>
 
-            <el-table-column label="原价" width="160" >
+            <el-table-column label="原价" width="160">
               <template slot-scope="scope">
                 <el-input-number
                   :controls="false"
@@ -149,7 +125,7 @@
                 </el-input-number>
               </template>
             </el-table-column>
-            <el-table-column label="现价" width="160" >
+            <el-table-column label="现价" width="160">
               <template slot-scope="scope">
                 <el-input-number
                   :controls="false"
@@ -334,6 +310,30 @@
           >%
         </el-form-item>
       </el-col>
+      <el-col :span="24">
+        <el-form-item prop="returnVoucherRatio">
+          <span slot="label"
+            >返券比例(%)
+            <el-tooltip
+              effect="dark"
+              content="返券比例:用户下单该商品后,交易完成后可获得商品金额的X%的代金券奖励,该代金券只可在本店铺使用"
+              placement="top-start"
+            >
+              <i class="el-icon-question"></i>
+            </el-tooltip>
+          </span>
+          <el-input-number
+            v-model="form.returnVoucherRatio"
+            :min="0"
+            :max="100"
+            placeholder="请输入返券比例"
+            :controls="false"
+            @change="passValue"
+          >
+          </el-input-number
+          >%
+        </el-form-item>
+      </el-col>
     </el-row>
     <Amap ref="mapOpen" @address="Mapaddress"></Amap>
   </el-form>
@@ -511,11 +511,13 @@ export default {
         props = [],
         shippingAddrId,
         logisticsTemplateId,
+        returnVoucherRatio,
       } = record || {};
 
       this.form = {
         ...this.form,
         logisticsTemplateId,
+        returnVoucherRatio,
         shippingAddrId: JSON.stringify(shippingAddrId),
         merchantClassifyName,
         expressType,

+ 20 - 2
src/views/transmission/createProduct.vue

@@ -289,7 +289,7 @@ export default {
       if (this.form.categoryIds.length < 1) {
         this.form.categoryIds = "";
       }
-      if (!this.form.presaleStartTime && !this.form.presaleEndTime) {
+      if (this.form.presaleStartTime && this.form.presaleEndTime) {
         if (this.form.datePicke) {
           this.form.presaleStartTime = moment(
             this.form.datePicker[0]
@@ -297,6 +297,14 @@ export default {
           this.form.presaleEndTime = moment(this.form.datePicker[1]).valueOf();
         }
       }
+      if (this.form.seckillStartTime && this.form.seckillEndTime) {
+        if (this.form.datePickerms) {
+          this.form.seckillStartTime = moment(
+            this.form.datePicker[0]
+          ).valueOf();
+          this.form.seckillEndTime = moment(this.form.datePicker[1]).valueOf();
+        }
+      }
       if (this.form.saleModel == 2) {
         this.form.merchantClassifyId = "[217524]";
         this.form.merchantClassifyName = "预售专区";
@@ -377,7 +385,7 @@ export default {
         this.form.categoryId =
           this.form.categoryId[this.form.categoryId.length - 1];
       }
-      if (!this.form.presaleStartTime && !this.form.presaleEndTime) {
+      if (this.form.presaleStartTime && this.form.presaleEndTime) {
         if (this.form.datePicke) {
           this.form.presaleStartTime = moment(
             this.form.datePicker[0]
@@ -385,6 +393,16 @@ export default {
           this.form.presaleEndTime = moment(this.form.datePicker[1]).valueOf();
         }
       }
+      if (this.form.seckillStartTime && this.form.seckillEndTime) {
+        if (this.form.datePickerms) {
+          this.form.seckillStartTime = moment(
+            this.form.datePickerms[0]
+          ).valueOf();
+          this.form.seckillEndTime = moment(
+            this.form.datePickerms[1]
+          ).valueOf();
+        }
+      }
       if (this.form.saleModel == 2) {
         this.form.merchantClassifyId = "[217524]";
         this.form.merchantClassifyName = "预售专区";

+ 80 - 4
src/views/transmission/module/basic-info.vue

@@ -24,6 +24,36 @@
           </el-radio-group>
         </el-form-item>
       </el-col>
+      <el-col :span="24" v-if="form.saleModel == 2">
+        <el-form-item prop="datePicker">
+          <span slot="label">预售时间</span>
+          <el-date-picker
+            v-model="form.datePicker"
+            type="datetimerange"
+            range-separator="至"
+            value-format="yyyy-MM-dd HH:mm:ss"
+            start-placeholder="开始日期"
+            end-placeholder="结束日期"
+            @change="pickerChange"
+          >
+          </el-date-picker>
+        </el-form-item>
+      </el-col>
+      <el-col :span="24" v-if="form.saleModel == 3">
+        <el-form-item prop="datePickerms">
+          <span slot="label">秒杀时间</span>
+          <el-date-picker
+            v-model="form.datePickerms"
+            type="datetimerange"
+            range-separator="至"
+            value-format="yyyy-MM-dd HH:mm:ss"
+            start-placeholder="开始日期"
+            end-placeholder="结束日期"
+            @change="pickermsChange"
+          >
+          </el-date-picker>
+        </el-form-item>
+      </el-col>
       <el-col :span="24">
         <el-form-item prop="categoryId">
           <span slot="label">商品分类</span>
@@ -193,6 +223,9 @@ export default {
         datePicker: [
           { required: true, message: "预售时间不能为空", trigger: "blur" },
         ],
+        datePickerms: [
+          { required: true, message: "秒杀时间不能为空", trigger: "blur" },
+        ],
       },
       index: 0,
       shopInfo: {},
@@ -206,6 +239,19 @@ export default {
   },
 
   methods: {
+    pickerChange(val) {
+      this.form.presaleStartTime = moment(this.form.datePicker[0]).valueOf();
+      this.form.presaleEndTime = moment(this.form.datePicker[1]).valueOf();
+      this.passValue();
+    },
+    pickermsChange(val) {
+      console.log(this.form.datePickerms);
+
+      this.form.seckillStartTime = moment(val[0]).valueOf();
+      this.form.seckillEndTime = moment(val[1]).valueOf();
+      this.passValue();
+    },
+
     getFormInfo(record = {}, type) {
       // 设置操作类型
       this.actionType = type === "cg" ? "" : "edit";
@@ -224,6 +270,10 @@ export default {
         bannerList = [],
         pic,
         categoryName,
+        seckillEndTime,
+        seckillStartTime,
+        presaleStartTime,
+        presaleEndTime,
       } = record;
 
       // 更新表单数据
@@ -242,8 +292,37 @@ export default {
         bannerList,
         pic,
         categoryName,
+        presaleStartTime: presaleStartTime
+          ? moment(presaleStartTime).format("yyyy-MM-DD HH:mm:ss")
+          : "",
+        presaleEndTime: presaleEndTime
+          ? moment(presaleEndTime).format("yyyy-MM-DD HH:mm:ss")
+          : "",
+        seckillStartTime: seckillStartTime
+          ? moment(seckillStartTime).format("yyyy-MM-DD HH:mm:ss")
+          : "",
+        seckillEndTime: seckillEndTime
+          ? moment(seckillEndTime).format("yyyy-MM-DD HH:mm:ss")
+          : "",
       };
 
+      if (seckillStartTime && seckillEndTime) {
+        this.$nextTick(() => {
+          this.$set(this.form, "datePickerms", [
+            this.form.seckillStartTime,
+            this.form.seckillEndTime,
+          ]);
+        });
+      }
+
+      if (presaleStartTime && presaleEndTime) {
+        this.$nextTick(() => {
+          this.$set(this.form, "datePicker", [
+            this.form.presaleStartTime,
+            this.form.presaleEndTime,
+          ]);
+        });
+      }
       // 更新分类名称
       this.categoryName = categoryName;
 
@@ -255,6 +334,7 @@ export default {
         this.bannerList = [...(bannerList || [])];
       }
     },
+
     beforeAvatarUpload(file) {
       const isJPG = file.type === "image/jpeg" || "image/png" || "image/jpg";
       const isLt2M = file.size / 1024 / 1024 < 2;
@@ -294,11 +374,7 @@ export default {
       getStoreInfo().then((res) => {
         if (res.code == 200) {
           this.shopInfo = res.data;
-          // this.form.scope = res.data.scope;
-          // if (res.data.scope == 1) {
           this.form.saleType = 0;
-          // this.form.saleModel = 1;
-          // }
         }
       });
     },

+ 26 - 0
src/views/transmission/module/sales-info.vue

@@ -294,6 +294,30 @@
           >%
         </el-form-item>
       </el-col>
+      <el-col :span="24">
+        <el-form-item prop="returnVoucherRatio">
+          <span slot="label"
+            >返券比例(%)
+            <el-tooltip
+              effect="dark"
+              content="返券比例:用户下单该商品后,交易完成后可获得商品金额的X%的代金券奖励,该代金券只可在本店铺使用"
+              placement="top-start"
+            >
+              <i class="el-icon-question"></i>
+            </el-tooltip>
+          </span>
+          <el-input-number
+            v-model="form.returnVoucherRatio"
+            :min="0"
+            :max="100"
+            placeholder="请输入返券比例"
+            :controls="false"
+            @change="passValue"
+          >
+          </el-input-number
+          >%
+        </el-form-item>
+      </el-col>
     </el-row>
   </el-form>
 </template>
@@ -443,6 +467,7 @@ export default {
         freeShipping,
         skuList,
         shareRate,
+        returnVoucherRatio
       } = record;
 
       this.saleModel = saleModel;
@@ -455,6 +480,7 @@ export default {
         merchantClassifyIds: JSON.parse(merchantClassifyId),
         merchantClassifyName,
         lookSalesVolume,
+        returnVoucherRatio,
         unit,
         shippingAddr,
         packing,

+ 20 - 2
src/views/transmission/updateProduct.vue

@@ -423,7 +423,7 @@ export default {
     },
 
     submitFormDraft() {
-      if (!this.form.presaleStartTime && !this.form.presaleEndTime) {
+      if (this.form.presaleStartTime && this.form.presaleEndTime) {
         if (this.form.datePicke) {
           this.form.presaleStartTime = moment(
             this.form.datePicker[0]
@@ -431,6 +431,14 @@ export default {
           this.form.presaleEndTime = moment(this.form.datePicker[1]).valueOf();
         }
       }
+      if (this.form.seckillStartTime && this.form.seckillEndTime) {
+        if (this.form.datePickerms) {
+          this.form.seckillStartTime = moment(
+            this.form.datePicker[0]
+          ).valueOf();
+          this.form.seckillEndTime = moment(this.form.datePicker[1]).valueOf();
+        }
+      }
       if (this.form.categoryId?.length > 0) {
         this.form.categoryId =
           this.form.categoryId[this.form.categoryId.length - 1];
@@ -481,7 +489,7 @@ export default {
       // }
       this.btnLading = true;
 
-      if (!this.form.presaleStartTime && !this.form.presaleEndTime) {
+      if (this.form.presaleStartTime && this.form.presaleEndTime) {
         if (this.form.datePicke) {
           this.form.presaleStartTime = moment(
             this.form.datePicker[0]
@@ -489,6 +497,16 @@ export default {
           this.form.presaleEndTime = moment(this.form.datePicker[1]).valueOf();
         }
       }
+      console.log(1);
+
+      if (this.form.seckillStartTime && this.form.seckillEndTime) {
+        if (this.form.datePickerms) {
+          this.form.seckillStartTime = moment(
+            this.form.datePickerms[0]
+          ).valueOf();
+          this.form.seckillEndTime = moment(this.form.datePickerms[1]).valueOf();
+        }
+      }
 
       if (this.form.categoryId?.length > 0) {
         this.form.categoryId =