Explorar o código

优惠券管理模块 平台优惠券加上限制商家使用已完成

hzj18279462576@163.com hai 9 meses
pai
achega
9d079e7b7e

+ 2 - 1
config/index.js

@@ -23,10 +23,11 @@ module.exports = {
     // 代理列表, 是否开启代理通过[./dev.env.js]配置
     proxyTable: devEnv.OPEN_PROXY === false ? {} : {
       '/proxyApi': {
-        // target: 'https://mxys.chuanghai-tech.com/sqx_fast/', // 线上
         // target: 'http://192.168.161.190:8171/sqx_fast/', // 线上
 
         target: 'https://mxys.chuanghai-tech.com/wm-test/wm-api',// 测试
+        // target: 'https://mxys.chuanghai-tech.com/sqx_fast/', // 线上
+
         // target: 'http://iyfpk3.natappfree.cc/sqx_fast',// 开发
         changeOrigin: true,
         pathRewrite: {

+ 2 - 2
src/main.js

@@ -31,9 +31,9 @@ Vue.use(Viewer, {
     zIndex: 99999 // 设置图片预览组件的层级,确保能在其他组件之上
   }
 });
-Vue.prototype.Tupiantou ='https://mxys.chuanghai-tech.com/sqx_fast/alioss/upload'//线上
+// Vue.prototype.Tupiantou ='https://mxys.chuanghai-tech.com/sqx_fast/alioss/upload'//线上
 // Vue.prototype.Tupiantou ='http://192.168.161.190:8171/sqx_fast/alioss/upload'//线上
-// Vue.prototype.Tupiantou ="https://mxys.chuanghai-tech.com/wm-test/wm-api/sqx_fast/alioss/upload"; //线下
+Vue.prototype.Tupiantou ="https://mxys.chuanghai-tech.com/wm-test/wm-api/sqx_fast/alioss/upload"; //线下
 Vue.prototype.Tupian = function(img) {
   return "https://mxys.chuanghai-tech.com/wmfile" + img;
   // return "http://192.168.161.190:8171/wmfile" + img;

+ 7 - 1
src/utils/httpRequest.js

@@ -44,6 +44,12 @@ http.interceptors.response.use(
       clearLoginInfo();
       router.push({ name: "login" });
     }
+    // console.log(
+    //   decrypt(
+    //     urlSafeBase64Decode("RPX3_v1bTP4fLfrEMWHegP8rSwSecprw4V9bjXLnqKU=")
+    //   ),
+    //   "11111111111111111111111111"
+    // );
 
     if (ifShangxian == 1) {
       // console.log(response.data,'导出',response.data.type)
@@ -73,7 +79,7 @@ http.adornUrl = actionName => {
 
   // return 'http://192.168.161.190:8171/sqx_fast/' + actionName
   // return 'https://mxys.chuanghai-tech.com/sqx_fast/' + actionName; //  线上
-  return "https://mxys.chuanghai-tech.com/wm-test/wm-api/sqx_fast/" + actionName;// 测试
+  return "https://mxys.chuanghai-tech.com/wm-test/wm-api/sqx_fast/" + actionName; // 测试
 };
 
 http.adornUrl2 = actionName => {

+ 521 - 168
src/views/coupon/coupon.vue

@@ -221,7 +221,7 @@
       </el-tab-pane>
     </el-tabs>
 
-    <!-- 添加优惠券 -->
+    <!-- 查看优惠券日志 -->
     <el-dialog
       title="查看优惠券日志"
       custom-class="couponLog"
@@ -273,177 +273,328 @@
     </el-dialog>
 
     <!-- 添加优惠券 -->
-    <el-dialog title="添加优惠券" :visible.sync="dialogFormVisible" center>
-      <div style="margin-bottom: 10px;" v-if="this.shopId == -1">
-        <span style="width: 200px;display: inline-block;text-align: right;"
-          >商铺名称:</span
-        >
-        <el-input
-          v-model="shopNames"
-          placeholder="请选择商铺"
-          style="width:50%;"
-          @focus="selectUserId"
-        ></el-input>
-      </div>
-      <div style="margin-bottom: 10px;">
-        <span style="width: 200px;display: inline-block;text-align: right;"
-          >优惠券名称:</span
-        >
-        <el-input
-          style="width:50%;"
-          v-model="couponName"
-          type="text"
-          placeholder="请输入优惠券名称"
-        ></el-input>
-      </div>
-      <div style="margin-bottom: 10px;">
-        <span style="width: 200px;display: inline-block;text-align: right;"
-          >图片:</span
-        >
-        <!-- <el-input style="width:50%;" v-model="couponPicture" type="text" placeholder="请输入图片"></el-input> -->
-        <div
-          style=" width:148px;height:148px;background-color: #fbfdff; border: 1px dashed #c0ccda;border-radius: 6px;text-align: center;line-height: 148px;display: inline-block;"
-        >
-          <el-upload
-            class="avatar-uploader"
-            v-model="couponPicture"
-            :action="Tupiantou"
-            :show-file-list="false"
-            :on-success="handleAvatarSuccess1"
-            :before-upload="beforeAvatarUpload"
+    <el-dialog
+      customClass="discount"
+      title="添加优惠券"
+      :visible.sync="dialogFormVisible"
+      center
+    >
+      <div style="display: flex;justify-content: center;">
+        <div>
+          <div style="margin-bottom: 10px;" v-if="this.shopId == -1">
+            <span style="width:150px;display: inline-block;text-align: right;"
+              >商铺名称:</span
+            >
+            <el-input
+              v-model="shopNames"
+              placeholder="请选择商铺"
+              style="width:50%;"
+              @focus="selectUserId"
+            ></el-input>
+          </div>
+          <div style="margin-bottom: 10px;">
+            <span style="width: 150px;display: inline-block;text-align: right;"
+              >优惠券名称:</span
+            >
+            <el-input
+              style="width:50%;"
+              v-model="couponName"
+              type="text"
+              placeholder="请输入优惠券名称"
+            ></el-input>
+          </div>
+          <div style="margin-bottom: 10px;">
+            <span style="width: 150px;display: inline-block;text-align: right;"
+              >图片:</span
+            >
+            <!-- <el-input style="width:50%;" v-model="couponPicture" type="text" placeholder="请输入图片"></el-input> -->
+            <div
+              style=" width:148px;height:148px;background-color: #fbfdff; border: 1px dashed #c0ccda;border-radius: 6px;text-align: center;line-height: 148px;display: inline-block;"
+            >
+              <el-upload
+                class="avatar-uploader"
+                v-model="couponPicture"
+                :action="Tupiantou"
+                :show-file-list="false"
+                :on-success="handleAvatarSuccess1"
+                :before-upload="beforeAvatarUpload"
+              >
+                <img
+                  v-if="couponPicture"
+                  :src="couponPicture"
+                  class="avatar"
+                  style="width: 148px;height: 148px;"
+                />
+                <i
+                  v-else
+                  class="el-icon-plus avatar-uploader-icon"
+                  style="font-size: 28px;color: #8c939d"
+                ></i>
+              </el-upload>
+            </div>
+          </div>
+          <div style="margin-bottom: 10px;">
+            <span style="width: 150px;display: inline-block;text-align: right;"
+              >优惠券金额:</span
+            >
+            <el-input
+              style="width:50%;"
+              v-model="money"
+              type="text"
+              placeholder="请输入优惠券金额"
+            ></el-input>
+          </div>
+          <div style="margin-bottom: 10px;">
+            <span style="width: 150px;display: inline-block;text-align: right;"
+              >最低消费:</span
+            >
+            <el-input
+              style="width:50%;"
+              v-model="minMoney"
+              type="text"
+              placeholder="请输入最低消费"
+            ></el-input>
+          </div>
+          <div style="margin-bottom: 10px;">
+            <span style="width: 150px;display: inline-block;text-align: right;"
+              >有效天数:</span
+            >
+            <el-input
+              style="width:50%;"
+              v-model="endDate"
+              type="text"
+              placeholder="请输入有效天数"
+            ></el-input>
+          </div>
+          <div style="margin-bottom: 10px;" v-if="this.shopId == 0">
+            <span style="width: 150px;display: inline-block;text-align: right;"
+              >兑换积分:</span
+            >
+            <el-input
+              style="width:50%;"
+              v-model="needIntegral"
+              type="text"
+              placeholder="请输入兑换积分"
+            ></el-input>
+          </div>
+          <span style="color: red;margin-left: 32px;"
+            >兑换积分初始值为100,是必填项,不填则默认向所有用户发券</span
           >
-            <img
-              v-if="couponPicture"
-              :src="couponPicture"
-              class="avatar"
-              style="width: 148px;height: 148px;"
-            />
-            <i
-              v-else
-              class="el-icon-plus avatar-uploader-icon"
-              style="font-size: 28px;color: #8c939d"
-            ></i>
-          </el-upload>
+        </div>
+        <div v-loading="allShopLoading" v-if="this.shopId == 0">
+          <div style="width: 500px;height: 200px;">
+            <div style="margin-bottom: 10px;">
+              <span
+                style="width: 150px;display: inline-block;text-align: right;"
+                >使用范围:</span
+              >
+              <el-checkbox
+                @change="checkChange($event, '不限制')"
+                v-model="allMerchant"
+                >不限制</el-checkbox
+              >
+              <el-checkbox
+                @change="checkChange($event, '部分商家')"
+                v-model="someMerchant"
+                >部分商家</el-checkbox
+              >
+            </div>
+            <div style="margin:0 0 10px 80px;" v-if="someMerchant">
+              <el-input
+                v-model="selectName"
+                placeholder="请输入商铺名称"
+                style="width:50%;"
+                clearable
+                @change="shopNameSeache"
+              ></el-input>
+              <!-- <el-button
+              style="margin-left: 15px"
+              size="medium"
+              type="primary"
+              icon="document"
+              @click="shopNameSeache"
+              >查询
+            </el-button> -->
+            </div>
+            <div
+              v-if="someMerchant"
+              style="margin:0 0 10px 80px;height: 300px;border: 1px solid #ccc;overflow: auto;"
+              @scroll="handleTreeScroll"
+            >
+              <el-tree
+                class="shop"
+                ref="tree"
+                :data="dataTree"
+                show-checkbox
+                node-key="shopId"
+                :props="defaultProps"
+                @check="treeCheck"
+              ></el-tree>
+              <div style="text-align: center;" v-if="allShopListShow">
+                数据已全部加载完
+              </div>
+            </div>
+            <div style="margin-bottom: 10px;" v-if="someMerchant">
+              <span
+                style="width: 130px;display: inline-block;text-align: right;"
+                >已选择</span
+              ><span style="color: red;">{{ selectMerchant.length }}</span
+              >个商家
+            </div>
+          </div>
         </div>
       </div>
-      <div style="margin-bottom: 10px;">
-        <span style="width: 200px;display: inline-block;text-align: right;"
-          >优惠券金额:</span
-        >
-        <el-input
-          style="width:50%;"
-          v-model="money"
-          type="text"
-          placeholder="请输入优惠券金额"
-        ></el-input>
-      </div>
-      <div style="margin-bottom: 10px;">
-        <span style="width: 200px;display: inline-block;text-align: right;"
-          >最低消费:</span
-        >
-        <el-input
-          style="width:50%;"
-          v-model="minMoney"
-          type="text"
-          placeholder="请输入最低消费"
-        ></el-input>
-      </div>
-      <div style="margin-bottom: 10px;">
-        <span style="width: 200px;display: inline-block;text-align: right;"
-          >有效天数:</span
-        >
-        <el-input
-          style="width:50%;"
-          v-model="endDate"
-          type="text"
-          placeholder="请输入有效天数"
-        ></el-input>
-      </div>
-      <div style="margin-bottom: 10px;" v-if="this.shopId == 0">
-        <span style="width: 200px;display: inline-block;text-align: right;"
-          >兑换积分:</span
-        >
-        <el-input
-          style="width:50%;"
-          v-model="needIntegral"
-          type="text"
-          placeholder="请输入兑换积分"
-        ></el-input>
-      </div>
-      <span style="color: red;margin-left: 142px;"
-        >兑换积分初始值为100,是必填项,不填则默认向所有用户发券</span
-      >
       <div slot="footer" class="dialog-footer">
         <el-button @click="dialogFormVisible = false">取 消</el-button>
         <el-button type="primary" @click="StairNoticeTo()">确 定</el-button>
       </div>
     </el-dialog>
     <!-- 修改优惠券 -->
-    <el-dialog title="修改优惠券" :visible.sync="dialogFormVisible1" center>
-      <el-form :model="form">
-        <el-form-item
-          label="商铺名称:"
-          :label-width="formLabelWidth"
-          v-if="this.shopId == -1"
-        >
-          <el-input
-            v-model="shopNames"
-            placeholder="请选择商铺"
-            style="width:50%;"
-            @focus="selectUserId"
-          >
-          </el-input>
-        </el-form-item>
-        <el-form-item label="优惠券名称:" :label-width="formLabelWidth">
-          <el-input v-model="form.couponName" style="width:65%;"></el-input>
-        </el-form-item>
-        <el-form-item label="图片:" :label-width="formLabelWidth">
-          <!-- <el-input v-model="form.campusDetails" style="width:65%;"></el-input> -->
-          <div
-            style=" width:148px;height:148px;background-color: #fbfdff; border: 1px dashed #c0ccda;border-radius: 6px;text-align: center;line-height: 148px;display: inline-block;"
-          >
-            <el-upload
-              class="avatar-uploader"
-              v-model="form.couponPicture"
-              :action="Tupiantou"
-              :show-file-list="false"
-              :on-success="handleAvatarSuccess2"
-              :before-upload="beforeAvatarUpload"
-            >
-              <img
-                v-if="form.couponPicture"
-                :src="form.couponPicture"
-                class="avatar"
-                style="width: 148px;height: 148px;"
-              />
-              <i
-                v-else
-                class="el-icon-plus avatar-uploader-icon"
-                style="font-size: 28px;color: #8c939d"
-              ></i>
-            </el-upload>
+    <el-dialog
+      customClass="discount"
+      title="修改优惠券"
+      :visible.sync="dialogFormVisible1"
+      center
+      :before-close="compileClose"
+    >
+      <div style="display: flex;justify-content: center;">
+        <el-form :model="form">
+          <div style="display: flex;justify-content: center;">
+            <div>
+              <el-form-item
+                label="商铺名称:"
+                :label-width="formLabelWidth"
+                v-if="this.shopId == -1"
+              >
+                <el-input
+                  v-model="shopNames"
+                  placeholder="请选择商铺"
+                  style="width:50%;"
+                  @focus="selectUserId"
+                >
+                </el-input>
+              </el-form-item>
+              <el-form-item label="优惠券名称:" :label-width="formLabelWidth">
+                <el-input
+                  v-model="form.couponName"
+                  style="width:65%;"
+                ></el-input>
+              </el-form-item>
+              <el-form-item label="图片:" :label-width="formLabelWidth">
+                <!-- <el-input v-model="form.campusDetails" style="width:65%;"></el-input> -->
+                <div
+                  style=" width:148px;height:148px;background-color: #fbfdff; border: 1px dashed #c0ccda;border-radius: 6px;text-align: center;line-height: 148px;display: inline-block;"
+                >
+                  <el-upload
+                    class="avatar-uploader"
+                    v-model="form.couponPicture"
+                    :action="Tupiantou"
+                    :show-file-list="false"
+                    :on-success="handleAvatarSuccess2"
+                    :before-upload="beforeAvatarUpload"
+                  >
+                    <img
+                      v-if="form.couponPicture"
+                      :src="form.couponPicture"
+                      class="avatar"
+                      style="width: 148px;height: 148px;"
+                    />
+                    <i
+                      v-else
+                      class="el-icon-plus avatar-uploader-icon"
+                      style="font-size: 28px;color: #8c939d"
+                    ></i>
+                  </el-upload>
+                </div>
+              </el-form-item>
+              <el-form-item label="优惠券金额:" :label-width="formLabelWidth">
+                <el-input v-model="form.money" style="width:65%;"></el-input>
+              </el-form-item>
+              <el-form-item label="最低消费:" :label-width="formLabelWidth">
+                <el-input v-model="form.minMoney" style="width:65%;"></el-input>
+              </el-form-item>
+              <el-form-item label="有效天数:" :label-width="formLabelWidth">
+                <el-input v-model="form.endDate" style="width:65%;"></el-input>
+              </el-form-item>
+              <el-form-item
+                label="兑换积分:"
+                :label-width="formLabelWidth"
+                v-if="this.shopId == 0"
+              >
+                <el-input
+                  v-model="form.needIntegral"
+                  style="width:65%;"
+                ></el-input>
+              </el-form-item>
+              <span style="color: red;margin-left: 32px;"
+                >兑换积分初始值为100,是必填项,不填则默认向所有用户发券</span
+              >
+            </div>
+            <div v-loading="allShopLoading" v-if="this.shopId == 0">
+              <div style="width: 500px;height: 200px;">
+                <div style="margin-bottom: 10px;">
+                  <span
+                    style="width: 150px;display: inline-block;text-align: right;"
+                    >使用范围:</span
+                  >
+                  <el-checkbox
+                    @change="checkChange($event, '不限制')"
+                    v-model="allMerchant"
+                    >不限制</el-checkbox
+                  >
+                  <el-checkbox
+                    @change="checkChange($event, '部分商家')"
+                    v-model="someMerchant"
+                    >部分商家</el-checkbox
+                  >
+                </div>
+                <div style="margin:0 0 10px 80px;" v-if="someMerchant">
+                  <el-input
+                    v-model="selectName"
+                    placeholder="请输入商铺名称"
+                    style="width:50%;"
+                    clearable
+                    @change="shopNameSeache"
+                  ></el-input>
+                  <!-- <el-button
+              style="margin-left: 15px"
+              size="medium"
+              type="primary"
+              icon="document"
+              @click="shopNameSeache"
+              >查询
+            </el-button> -->
+                </div>
+                <div
+                  v-if="someMerchant"
+                  style="margin:0 0 10px 80px;height: 300px;border: 1px solid #ccc;overflow: auto;"
+                  @scroll="handleTreeScroll"
+                >
+                  <el-tree
+                    class="shop"
+                    ref="tree"
+                    :data="dataTree"
+                    show-checkbox
+                    node-key="shopId"
+                    :props="defaultProps"
+                    @check="treeCheck"
+                  ></el-tree>
+                  <div style="text-align: center;" v-if="allShopListShow">
+                    数据已全部加载完
+                  </div>
+                </div>
+                <div style="margin-bottom: 10px;" v-if="someMerchant">
+                  <span
+                    style="width: 130px;display: inline-block;text-align: right;"
+                    >已选择</span
+                  ><span style="color: red;">{{ selectMerchant.length }}</span
+                  >个商家
+                </div>
+              </div>
+            </div>
           </div>
-        </el-form-item>
-        <el-form-item label="优惠券金额:" :label-width="formLabelWidth">
-          <el-input v-model="form.money" style="width:65%;"></el-input>
-        </el-form-item>
-        <el-form-item label="最低消费:" :label-width="formLabelWidth">
-          <el-input v-model="form.minMoney" style="width:65%;"></el-input>
-        </el-form-item>
-        <el-form-item label="有效天数:" :label-width="formLabelWidth">
-          <el-input v-model="form.endDate" style="width:65%;"></el-input>
-        </el-form-item>
-        <el-form-item
-          label="兑换积分:"
-          :label-width="formLabelWidth"
-          v-if="this.shopId == 0"
-        >
-          <el-input v-model="form.needIntegral" style="width:65%;"></el-input>
-        </el-form-item>
-        <span style="color: red;margin-left: 120px;"
-          >兑换积分初始值为100,是必填项,不填则默认向所有用户发券</span
-        >
-      </el-form>
+        </el-form>
+      </div>
       <div slot="footer" class="dialog-footer">
         <el-button @click="dialogFormVisible1 = false">取 消</el-button>
         <el-button type="primary" @click="CompileNoticeTo()">确 定</el-button>
@@ -740,6 +891,26 @@ export default {
       minMoney: "",
       money: "",
       needIntegral: "100",
+
+      // 使用范围
+      allMerchant: false,
+      someMerchant: false,
+      dataTree: [],
+      defaultProps: {
+        label: "shopName",
+        value: "shopId"
+      },
+      merchantPage: 1,
+      merchantLimit: 20,
+      selectName: "",
+      allShopListShow: false, // 商家下拉全部加载完成
+      allShopLoading: true, // 商家下拉数据加载中
+      merchantList: [],
+      usedShopId: "",
+      selectMerchant: [], // 勾选中的数据
+      merchantTotalPage: 1,
+      merchantSelectTotal: "",
+
       form: {
         couponId: "",
         couponName: "",
@@ -874,15 +1045,33 @@ export default {
       this.money = "";
       this.needIntegral = "100";
       this.shopNames = "";
+
+      this.merchantPage = 1;
+      this.merchantList = [];
+      this.selectMerchant = [];
+      this.allMerchant = false;
+      this.someMerchant = false;
+      this.allShopListShow = false;
+
       if (this.shopId === 0) {
         this.shopIds = 0;
+        this.merchantData();
       } else {
         this.shopIds = "";
       }
 
+      // 重置滚动位置
+      // this.$nextTick(() => {
+      //   console.log(document.querySelector('.shop'));
+      //   // document.querySelector('.el-tree__body-wrapper')
+      //   const treeWrapper = this.$refs.tree;
+      //   if (treeWrapper) {
+      //     treeWrapper.scrollTop = 0; // 重置滚动位置
+      //   }
+      // });
       this.dialogFormVisible = true;
     },
-    // 添加优惠券
+    // 确定添加优惠券
     StairNoticeTo() {
       if (this.couponName == "") {
         this.$notify({
@@ -930,7 +1119,26 @@ export default {
         return;
       }
 
+      if (this.shopId == 0) {
+        if (!this.allMerchant && !this.someMerchant) {
+          this.$notify({
+            title: "提示",
+            duration: 1800,
+            message: "商家不能为空",
+            type: "warning"
+          });
+          return;
+        }
+      }
+
       if (this.shopId === 0) {
+        this.usedShopId = "";
+        if (this.allMerchant) {
+          this.usedShopId = 0;
+        }
+        if (this.someMerchant) {
+          this.usedShopId = this.selectMerchant.join(",");
+        }
         if (this.needIntegral == "") {
           this.$notify({
             title: "提示",
@@ -940,8 +1148,9 @@ export default {
           });
           return;
         }
+      } else {
+        this.usedShopId = "";
       }
-
       this.$http({
         url: this.$http.adornUrl("admin/coupon/issueCoupon"),
         method: "post",
@@ -953,7 +1162,8 @@ export default {
           money: this.money,
           needIntegral: this.needIntegral,
           shopId: this.shopIds,
-          sysUserId: this.userId
+          sysUserId: this.userId,
+          usedShopId: this.usedShopId
         })
       }).then(({ data }) => {
         if (data.code == 0) {
@@ -976,8 +1186,107 @@ export default {
         }
       });
     },
+    checkChange(val, title) {
+      console.log(val, title);
+      if (val) {
+        if (title == "不限制") {
+          this.someMerchant = false;
+        }
+        if (title == "部分商家") {
+          this.allMerchant = false;
+          // this.merchantData();
+        }
+      }
+      this.$nextTick(() => {
+        if (this.$refs.tree) {
+          this.$refs.tree.setCheckedKeys(this.selectMerchant);
+        }
+      });
+    },
+    treeCheck(checkedNodes, checkedKeys) {
+      console.log(checkedKeys.checkedKeys);
+      this.selectMerchant = checkedKeys.checkedKeys;
+    },
+    // 平台优惠券 弹窗 搜索商铺
+    shopNameSeache() {
+      this.merchantPage = 1;
+      this.merchantData();
+    },
+
+    // 商铺列表
+    merchantData(title) {
+      this.allShopLoading = true;
+      this.$http({
+        url: this.$http.adornUrl("admin/goods/selectAllShop"),
+        method: "get",
+        params: this.$http.adornParams({
+          page: this.merchantPage,
+          limit: this.merchantLimit,
+          shopName: this.selectName
+        })
+      }).then(({ data }) => {
+        console.log(data, "店铺名称列表");
+        if (data.code == 0) {
+          if (title == "滚动") {
+            this.dataTree = [...this.dataTree, ...data.data.list];
+          } else {
+            this.dataTree = data.data.list;
+          }
+          console.log(this.selectMerchant, "选择的数据");
+          if (this.$refs.tree) {
+            this.$refs.tree.setCheckedKeys(this.selectMerchant);
+          }
+          this.merchantTotalPage = data.data.totalPage;
+          this.allShopLoading = false;
+        }
+      });
+    },
+    // 树形组件滚动操作
+    handleTreeScroll(event) {
+      const { scrollTop, scrollHeight, clientHeight } = event.target;
+      // 判断是否滚动到底部
+      if (scrollTop + clientHeight >= scrollHeight) {
+        console.log("滚动到底部了");
+        // 在这里执行你需要的逻辑,比如加载更多数据
+        if (this.merchantPage >= this.merchantTotalPage) {
+          // this.$message({
+          //   title: "提示",
+          //   duration: 1800,
+          //   message: "数据已全部加载完",
+          //   type: "warning"
+          // });
+          this.allShopListShow = true;
+          return;
+        }
+        this.merchantPage++;
+        console.log(this.merchantPage, "后");
+
+        this.merchantData("滚动");
+      }
+    },
+
     // 修改优惠券
     compile(index, rows) {
+      this.selectMerchant = [];
+      console.log(rows);
+      this.merchantPage = 1;
+      this.merchantData();
+      if (rows.usedShopId == 0) {
+        this.usedShopId = 0;
+        this.allMerchant = true;
+        this.someMerchant = false;
+      } else if (rows.usedShopId != null && rows.usedShopId != 0) {
+        this.usedShopId = rows.usedShopId;
+        this.selectMerchant = rows.usedShopId.split(",");
+        this.allMerchant = false;
+        this.someMerchant = true;
+      } else {
+        this.usedShopId = "";
+        this.allMerchant = false;
+        this.someMerchant = false;
+      }
+      this.allShopListShow = false;
+
       this.form.couponName = rows.couponName;
       this.form.couponPicture = rows.couponPicture;
       this.form.endDate = rows.endDate;
@@ -989,7 +1298,20 @@ export default {
       this.shopIds = rows.shopId;
       this.dialogFormVisible1 = true;
     },
-    // 修改优惠券
+    compileClose() {
+      if (this.shopId == 0 && this.someMerchant) {
+        this.$nextTick(() => {
+          const treeWrapper = this.$refs.tree.$el.querySelector(".el-tree");
+          if (treeWrapper) {
+            treeWrapper.scrollTop = 0;
+          }
+        });
+      }
+      this.dialogFormVisible1 = false;
+      this.allMerchant = false;
+      this.someMerchant = false;
+    },
+    // 确定修改优惠券
     CompileNoticeTo() {
       if (this.form.campusName == "") {
         this.$notify({
@@ -1036,9 +1358,27 @@ export default {
         });
         return;
       }
+      if (this.shopId == 0) {
+        if (!this.allMerchant && !this.someMerchant) {
+          this.$notify({
+            title: "提示",
+            duration: 1800,
+            message: "商家不能为空",
+            type: "warning"
+          });
+          return;
+        }
+      }
 
       if (this.shopId === 0) {
-        if (this.form.needIntegral == "") {
+        this.usedShopId = "";
+        if (this.allMerchant) {
+          this.usedShopId = 0;
+        }
+        if (this.someMerchant) {
+          this.usedShopId = this.selectMerchant.join(",");
+        }
+        if (this.needIntegral == "") {
           this.$notify({
             title: "提示",
             duration: 1800,
@@ -1047,6 +1387,8 @@ export default {
           });
           return;
         }
+      } else {
+        this.usedShopId = "";
       }
       this.$http({
         url: this.$http.adornUrl("admin/coupon/updateCoupon"),
@@ -1060,7 +1402,8 @@ export default {
           money: this.form.money,
           needIntegral: this.form.needIntegral,
           shopId: this.shopIds,
-          sysUserId: this.userId
+          sysUserId: this.userId,
+          usedShopId: this.usedShopId
         })
       }).then(({ data }) => {
         if (data.code == 0) {
@@ -1477,4 +1820,14 @@ export default {
 .couponLog {
   width: 60%;
 }
+.discount {
+  width: 1000px;
+  .shop {
+    .el-tree-node__content {
+      .is-leaf.el-tree-node__expand-icon {
+        // display: none;
+      }
+    }
+  }
+}
 </style>

+ 2 - 0
src/views/main-navbar.vue

@@ -224,6 +224,8 @@
         })
       },
       defineCallBack() {
+        console.log("调用此接口");
+
         this.$http({
           url: this.$http.adornUrl('admin/ordermessage/allcheckOrderMessage'),
           method: 'post',

+ 159 - 29
src/views/mission/mission.vue

@@ -524,10 +524,26 @@
         <el-table-column prop="remark" label="订单备注" width="150">
         </el-table-column>
 
-        <el-table-column prop="createTime" label="创建时间" width="100"></el-table-column>
-        <el-table-column prop="payTime" label="支付时间" width="100"></el-table-column>
-        <el-table-column prop="receivingTime" label="接单时间" width="100"></el-table-column>
-        <el-table-column prop="finishTime" label="订单完成时间" width="120"></el-table-column>
+        <el-table-column
+          prop="createTime"
+          label="创建时间"
+          width="100"
+        ></el-table-column>
+        <el-table-column
+          prop="payTime"
+          label="支付时间"
+          width="100"
+        ></el-table-column>
+        <el-table-column
+          prop="receivingTime"
+          label="接单时间"
+          width="100"
+        ></el-table-column>
+        <el-table-column
+          prop="finishTime"
+          label="订单完成时间"
+          width="120"
+        ></el-table-column>
         <el-table-column prop="payType" label="支付方式" width="100">
           <template slot-scope="scope">
             <span v-if="scope.row.payType === 1">微信</span>
@@ -548,7 +564,59 @@
         ></el-table-column> -->
         <el-table-column fixed="right" prop="status" label="状态" width="100">
           <template slot-scope="scope">
-            <span style="color: #4f9dec;" v-if="scope.row.status === 0"
+            <span v-if="scope.row.indentState == 2">
+              <span style="color: #4f9dec;" v-if="scope.row.status === 3">
+                待骑手接单
+              </span>
+              <span style="color: #4f9dec;" v-if="scope.row.status === 6">
+                制作中
+              </span>
+            </span>
+
+            <span
+              style="color: #4f9dec;"
+              v-else-if="
+                scope.row.indentState == 3 || scope.row.indentState == 4
+              "
+            >
+              <span v-if="scope.row.indentState == 3">
+                骑手已接单
+              </span>
+              <span v-if="scope.row.indentState == 4">
+                骑手配送中
+              </span>
+            </span>
+
+            <span v-else>
+              <span style="color: #4f9dec;" v-if="scope.row.status === 0"
+                >待结算</span
+              >
+              <span
+                style="color: #4f9dec;"
+                v-if="scope.row.status === 1 || scope.row.status === 2"
+                >待支付</span
+              >
+
+              <span style="color: #4f9dec;" v-if="scope.row.status === 3">
+                {{ scope.row.orderType == 1 ? "待取餐" : "待配送" }}
+              </span>
+
+              <span style="color: #4f9dec;" v-if="scope.row.status === 4"
+                >已完成</span
+              >
+              <span style="color: #999;" v-if="scope.row.status === 5"
+                >已取消</span
+              >
+              <span style="color: #999;" v-if="scope.row.status === 6">制作中</span>
+              <span style="color: #999;" v-if="scope.row.status === 7"
+                >商家待接单</span
+              >
+              <span style="color: #999;" v-if="scope.row.status === 8"
+                >商家已拒单</span
+              >
+            </span>
+
+            <!-- <span style="color: #4f9dec;" v-if="scope.row.status === 0"
               >待结算</span
             >
             <span
@@ -557,24 +625,56 @@
               >待支付</span
             >
 
-            <span style="color: #4f9dec;" v-if="scope.row.status === 3">
-              {{ scope.row.orderType == 1 ? "待取餐" : "待配送" }}
+            <span
+              style="color: #4f9dec;"
+              v-if="scope.row.status === 3 && scope.row.indentState != 11"
+            >
+              <span v-if="scope.row.indentState == 2">
+                待骑手接单
+              </span>
+              <span v-else-if="scope.row.indentState == 3">
+                骑手已接单
+              </span>
+              <span v-else-if="scope.row.indentState == 4">
+                骑手配送中
+              </span>
             </span>
+            <span
+              v-else-if="scope.row.status === 3 && scope.row.indentState == 11"
+              >{{ scope.row.orderType == 1 ? "待取餐" : "待配送" }}</span
+            >
+
             <span style="color: #4f9dec;" v-if="scope.row.status === 4"
               >已完成</span
             >
             <span style="color: #999;" v-if="scope.row.status === 5"
               >已取消</span
             >
-            <span style="color: #999;" v-if="scope.row.status === 6"
+
+            <span
+              style="color: #999;"
+              v-if="scope.row.status === 6 && scope.row.indentState != 11"
+            >
+              <span v-if="scope.row.indentState == 2">
+                待骑手接单
+              </span>
+              <span v-else-if="scope.row.indentState == 3">
+                骑手已接单
+              </span>
+              <span v-else-if="scope.row.indentState == 4">
+                骑手配送中
+              </span>
+            </span>
+            <span v-if="scope.row.status === 6 && scope.row.indentState == 11"
               >制作中</span
             >
+
             <span style="color: #999;" v-if="scope.row.status === 7"
               >商家待接单</span
             >
             <span style="color: #999;" v-if="scope.row.status === 8"
               >商家已拒单</span
-            >
+            > -->
           </template>
         </el-table-column>
         <el-table-column
@@ -1416,11 +1516,14 @@ export default {
       startTime: "",
       endTime: "",
       payStartTime: [
-          dayjs()
-            .subtract(6, "day").startOf('day')
-            .format("YYYY-MM-DD HH:mm:ss"),
-          dayjs().endOf('day').format("YYYY-MM-DD HH:mm:ss")
-        ], //支付开始时间
+        dayjs()
+          .subtract(6, "day")
+          .startOf("day")
+          .format("YYYY-MM-DD HH:mm:ss"),
+        dayjs()
+          .endOf("day")
+          .format("YYYY-MM-DD HH:mm:ss")
+      ], //支付开始时间
       payEndTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
       refundStartTime: "",
       refundEndTime: "",
@@ -1834,11 +1937,14 @@ export default {
       this.refundStartTime = "";
       this.refundEndTime = "";
       this.payStartTime = [
-          dayjs()
-            .subtract(6, "day").startOf('day')
-            .format("YYYY-MM-DD HH:mm:ss"),
-          dayjs().endOf('day').format("YYYY-MM-DD HH:mm:ss")
-        ];
+        dayjs()
+          .subtract(6, "day")
+          .startOf("day")
+          .format("YYYY-MM-DD HH:mm:ss"),
+        dayjs()
+          .endOf("day")
+          .format("YYYY-MM-DD HH:mm:ss")
+      ];
       this.payEndTime = dayjs().format("YYYY-MM-DD");
       this.stationName = "";
       this.spEarningTypeId = "";
@@ -2459,12 +2565,18 @@ export default {
           this.status = this.$route.params.refund;
           this.payStartTime = "";
           // this.payEndTime = "";
-          this.refundStartTime = [this.$route.params.dayId + " " + "00:00:00",this.$route.params.dayId + " " + "23:59:59"];
+          this.refundStartTime = [
+            this.$route.params.dayId + " " + "00:00:00",
+            this.$route.params.dayId + " " + "23:59:59"
+          ];
           // this.refundEndTime = this.$route.params.dayId + " " + "23:59:59";
           this.taskdataSelect();
         } else if (this.$route.params.refund == 15) {
           this.status = this.$route.params.refund;
-          this.payStartTime = [this.$route.params.dayId + " " + "00:00:00",this.$route.params.dayId + " " + "23:59:59"];
+          this.payStartTime = [
+            this.$route.params.dayId + " " + "00:00:00",
+            this.$route.params.dayId + " " + "23:59:59"
+          ];
           // this.payEndTime = this.$route.params.dayId + " " + "23:59:59";
           this.refundStartTime = "";
           // this.refundEndTime = "";
@@ -2484,7 +2596,10 @@ export default {
           this.payStartTime = "";
           // this.payEndTime = "";
           this.shopName = this.$route.params.shopName;
-          this.refundStartTime = [this.$route.params.dayId + " " + "00:00:00",this.$route.params.dayId + " " + "23:59:59"];
+          this.refundStartTime = [
+            this.$route.params.dayId + " " + "00:00:00",
+            this.$route.params.dayId + " " + "23:59:59"
+          ];
           // this.refundEndTime = this.$route.params.dayId + " " + "23:59:59";
           this.taskdataSelect();
         }
@@ -2495,9 +2610,12 @@ export default {
         // this.refundEndTime = "";
         this.payStartTime = [
           dayjs()
-            .subtract(6, "day").startOf('day')
+            .subtract(6, "day")
+            .startOf("day")
             .format("YYYY-MM-DD HH:mm:ss"),
-          dayjs().endOf('day').format("YYYY-MM-DD HH:mm:ss")
+          dayjs()
+            .endOf("day")
+            .format("YYYY-MM-DD HH:mm:ss")
         ];
         // this.payEndTime = dayjs().format("YYYY-MM-DD");
         // this.taskdataSelect();
@@ -2525,13 +2643,19 @@ export default {
           this.status = this.$route.params.refund;
           this.payStartTime = "";
           // this.payEndTime = "";
-          this.refundStartTime = [this.$route.params.dayId + " " + "00:00:00",this.$route.params.dayId + " " + "23:59:59"];
+          this.refundStartTime = [
+            this.$route.params.dayId + " " + "00:00:00",
+            this.$route.params.dayId + " " + "23:59:59"
+          ];
           // this.refundStartTime = this.$route.params.dayId + " " + "00:00:00";
           // this.refundEndTime = this.$route.params.dayId + " " + "23:59:59";
           this.taskdataSelect();
         } else if (this.$route.params.refund == 15) {
           this.status = this.$route.params.refund;
-          this.payStartTime = [this.$route.params.dayId + " " + "00:00:00",this.$route.params.dayId + " " + "23:59:59"];
+          this.payStartTime = [
+            this.$route.params.dayId + " " + "00:00:00",
+            this.$route.params.dayId + " " + "23:59:59"
+          ];
           // this.payStartTime = this.$route.params.dayId + " " + "00:00:00";
           // this.payEndTime = this.$route.params.dayId + " " + "23:59:59";
           this.refundStartTime = "";
@@ -2552,7 +2676,10 @@ export default {
           this.payStartTime = "";
           // this.payEndTime = "";
           this.shopName = this.$route.params.shopName;
-          this.refundStartTime =[ this.$route.params.dayId + " " + "00:00:00",this.$route.params.dayId + " " + "23:59:59"];
+          this.refundStartTime = [
+            this.$route.params.dayId + " " + "00:00:00",
+            this.$route.params.dayId + " " + "23:59:59"
+          ];
           // this.refundStartTime = this.$route.params.dayId + " " + "00:00:00";
           // this.refundEndTime = this.$route.params.dayId + " " + "23:59:59";
           this.taskdataSelect();
@@ -2564,9 +2691,12 @@ export default {
         // this.refundEndTime = "";
         this.payStartTime = [
           dayjs()
-            .subtract(6, "day").startOf('day')
+            .subtract(6, "day")
+            .startOf("day")
             .format("YYYY-MM-DD HH:mm:ss"),
-          dayjs().endOf('day').format("YYYY-MM-DD HH:mm:ss")
+          dayjs()
+            .endOf("day")
+            .format("YYYY-MM-DD HH:mm:ss")
         ];
         // this.payEndTime = dayjs().format("YYYY-MM-DD");
         this.taskdataSelect();

+ 274 - 240
src/views/modules/sys/user-add-or-update.vue

@@ -1,240 +1,274 @@
-<template>
-  <el-dialog
-    :title="!dataForm.id ? '新增' : '修改'"
-    :close-on-click-modal="false"
-    :visible.sync="visible">
-    <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
-      <el-form-item label="用户名" prop="userName">
-        <el-input v-model="dataForm.userName" placeholder="登录帐号"></el-input>
-      </el-form-item>
-      <el-form-item label="密码" prop="password" :class="{ 'is-required': !dataForm.id }">
-        <el-input v-model="dataForm.password" type="password" placeholder="密码"></el-input>
-      </el-form-item>
-      <el-form-item label="确认密码" prop="comfirmPassword" :class="{ 'is-required': !dataForm.id }">
-        <el-input v-model="dataForm.comfirmPassword" type="password" placeholder="确认密码"></el-input>
-      </el-form-item>
-      <el-form-item label="邮箱" prop="email">
-        <el-input v-model="dataForm.email" placeholder="邮箱"></el-input>
-      </el-form-item>
-      <el-form-item label="手机号" prop="mobile">
-        <el-input v-model="dataForm.mobile" placeholder="手机号"></el-input>
-      </el-form-item>
-      <el-form-item label="角色" size="mini" prop="roleIdList">
-        <el-checkbox-group v-model="dataForm.roleIdList" @change="changes">
-          <el-checkbox v-for="role in roleList" :key="role.roleId" :label="role.roleId">{{ role.roleName }}</el-checkbox>
-        </el-checkbox-group>
-      </el-form-item>
-      <el-form-item label="商铺" size="mini" prop="shopIdList" v-if="show">
-      	<el-checkbox-group v-model="dataForm.shopIdList" >
-      		<el-checkbox v-for="role in manageList" :key="role.shopId" :label="role.shopId">
-      			{{ role.shopName }}</el-checkbox>
-      	</el-checkbox-group>
-      </el-form-item>
-      <el-form-item label="状态" size="mini" prop="status">
-        <el-radio-group v-model="dataForm.status">
-          <el-radio :label="0">禁用</el-radio>
-          <el-radio :label="1">正常</el-radio>
-        </el-radio-group>
-      </el-form-item>
-    </el-form>
-    <span slot="footer" class="dialog-footer">
-      <el-button @click="visible = false">取消</el-button>
-      <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
-    </span>
-  </el-dialog>
-</template>
-
-<script>
-  import { isEmail, isMobile } from '@/utils/validate'
-  export default {
-    data () {
-      var validatePassword = (rule, value, callback) => {
-        if (!this.dataForm.id && !/\S/.test(value)) {
-          callback(new Error('密码不能为空'))
-        } else {
-          callback()
-        }
-      }
-      var validateComfirmPassword = (rule, value, callback) => {
-        if (!this.dataForm.id && !/\S/.test(value)) {
-          callback(new Error('确认密码不能为空'))
-        } else if (this.dataForm.password !== value) {
-          callback(new Error('确认密码与密码输入不一致'))
-        } else {
-          callback()
-        }
-      }
-      var validateEmail = (rule, value, callback) => {
-        if (!isEmail(value)) {
-          callback(new Error('邮箱格式错误'))
-        } else {
-          callback()
-        }
-      }
-      var validateMobile = (rule, value, callback) => {
-        if (!isMobile(value)) {
-          callback(new Error('手机号格式错误'))
-        } else {
-          callback()
-        }
-      }
-      return {
-        visible: false,
-        roleList: [],
-        dataForm: {
-          id: 0,
-          userName: '',
-          password: '',
-          comfirmPassword: '',
-          salt: '',
-          email: '',
-          mobile: '',
-          roleIdList: [],
-          shopIdList: [],
-          status: 1,
-
-        },
-        dataRule: {
-          userName: [
-            { required: true, message: '用户名不能为空', trigger: 'blur' }
-          ],
-          password: [
-            { validator: validatePassword, trigger: 'blur' }
-          ],
-          comfirmPassword: [
-            { validator: validateComfirmPassword, trigger: 'blur' }
-          ],
-          email: [
-            { required: true, message: '邮箱不能为空', trigger: 'blur' },
-            { validator: validateEmail, trigger: 'blur' }
-          ],
-          mobile: [
-            { required: true, message: '手机号不能为空', trigger: 'blur' },
-            { validator: validateMobile, trigger: 'blur' }
-          ]
-        },
-        show:false
-      }
-    },
-    methods: {
-      init (id) {
-        this.dataForm.id = id || 0
-        this.$http({
-          url: this.$http.adornUrl('sys/role/select'),
-          method: 'get',
-          params: this.$http.adornParams()
-        }).then(({data}) => {
-          this.roleList = data && data.code === 0 ? data.list : []
-        }).then(() => {
-          this.visible = true
-          this.$nextTick(() => {
-            this.$refs['dataForm'].resetFields()
-          })
-        }).then(() => {
-          if (this.dataForm.id) {
-            this.$http({
-              url: this.$http.adornUrl(`sys/user/info/${this.dataForm.id}`),
-              method: 'get',
-              params: this.$http.adornParams()
-            }).then(({data}) => {
-              if (data && data.code === 0) {
-                this.dataForm.userName = data.user.username
-                this.dataForm.salt = data.user.salt
-                this.dataForm.email = data.user.email
-                this.dataForm.mobile = data.user.mobile
-                this.dataForm.roleIdList = data.user.roleIdList
-                this.dataForm.shopIdList = data.user.shopIdList
-                this.dataForm.status = data.user.status
-                var shows = 1
-                for(var i in data.user.roleIdList){
-                	if(data.user.roleIdList[i]===12){
-                		shows = 2
-                	}
-                }
-                if(shows==2){
-                	this.show = true
-                }
-                if(shows==1){
-                	this.show = false
-                }
-              }
-            })
-          }
-        })
-      },
-      // 获取店铺数据列表
-      homeSelect(id) {
-      	this.$http({
-      		url: this.$http.adornUrl('admin/goods/selectAllShopList'),
-      		method: 'get',
-      		params: this.$http.adornParams({
-      		})
-      	}).then(({
-      		data
-      	}) => {
-      		let returnData = data.data;
-      		this.manageList = returnData
-      	})
-      },
-      changes(val){
-        console.log('val',val)
-      	var shows = 1
-      	for(var i in val){
-      		if(val[i]===12){
-      			shows = 2
-      		}
-      	}
-      	if(shows==2){
-      		this.show = true
-      	}
-      	if(shows==1){
-      		this.show = false
-      	}
-      },
-      // 表单提交
-      dataFormSubmit () {
-        this.$refs['dataForm'].validate((valid) => {
-          if (valid) {
-			if(this.dataForm.roleIdList.length<1){
-								this.$message({
-								  message: '请选择角色',
-								  type: 'error',
-								  duration: 1500,
-								})
-			}else{
-				this.$http({
-				  url: this.$http.adornUrl(`/sys/user/${!this.dataForm.id ? 'save' : 'update'}`),
-				  method: 'post',
-				  data: this.$http.adornData({
-					'userId': this.dataForm.id || undefined,
-					'username': this.dataForm.userName,
-					'password': this.dataForm.password,
-					'salt': this.dataForm.salt,
-					'email': this.dataForm.email,
-					'mobile': this.dataForm.mobile,
-					'status': this.dataForm.status,
-					'roleIdList': this.dataForm.roleIdList,
-          'shopIdList': this.dataForm.shopIdList
-				  })
-				}).then(({data}) => {
-				  if (data && data.code === 0) {
-					this.$message({
-					  message: '操作成功',
-					  type: 'success',
-					  duration: 1500,
-					  onClose: () => {
-						this.visible = false
-						this.$emit('refreshDataList')
-					  }
-					})
-				  } else {
-					this.$message.error(data.msg)
-				  }
-				})
-			}
-          }
-        })
-      }
-    }
-  }
-</script>
+<template>
+  <el-dialog
+    :title="!dataForm.id ? '新增' : '修改'"
+    :close-on-click-modal="false"
+    :visible.sync="visible"
+  >
+    <el-form
+      :model="dataForm"
+      :rules="dataRule"
+      ref="dataForm"
+      @keyup.enter.native="dataFormSubmit()"
+      label-width="80px"
+    >
+      <el-form-item label="用户名" prop="userName">
+        <el-input v-model="dataForm.userName" placeholder="登录帐号"></el-input>
+      </el-form-item>
+      <el-form-item
+        label="密码"
+        prop="password"
+        :class="{ 'is-required': !dataForm.id }"
+      >
+        <el-input
+          v-model="dataForm.password"
+          type="password"
+          placeholder="密码"
+        ></el-input>
+      </el-form-item>
+      <el-form-item
+        label="确认密码"
+        prop="comfirmPassword"
+        :class="{ 'is-required': !dataForm.id }"
+      >
+        <el-input
+          v-model="dataForm.comfirmPassword"
+          type="password"
+          placeholder="确认密码"
+        ></el-input>
+      </el-form-item>
+      <el-form-item label="邮箱" prop="email">
+        <el-input v-model="dataForm.email" placeholder="邮箱"></el-input>
+      </el-form-item>
+      <el-form-item label="手机号" prop="mobile">
+        <el-input v-model="dataForm.mobile" placeholder="手机号"></el-input>
+      </el-form-item>
+      <el-form-item label="角色" size="mini" prop="roleIdList">
+        <el-checkbox-group v-model="dataForm.roleIdList" @change="changes">
+          <el-checkbox
+            v-for="role in roleList"
+            :key="role.roleId"
+            :label="role.roleId"
+            >{{ role.roleName }}</el-checkbox
+          >
+        </el-checkbox-group>
+      </el-form-item>
+      <el-form-item label="商铺" size="mini" prop="shopIdList" v-if="show">
+        <el-checkbox-group v-model="dataForm.shopIdList">
+          <el-checkbox
+            v-for="role in manageList"
+            :key="role.shopId"
+            :label="role.shopId"
+          >
+            {{ role.shopName }}</el-checkbox
+          >
+        </el-checkbox-group>
+      </el-form-item>
+      <el-form-item label="状态" size="mini" prop="status">
+        <el-radio-group v-model="dataForm.status">
+          <el-radio :label="0">禁用</el-radio>
+          <el-radio :label="1">正常</el-radio>
+        </el-radio-group>
+      </el-form-item>
+    </el-form>
+    <span slot="footer" class="dialog-footer">
+      <el-button @click="visible = false">取消</el-button>
+      <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
+    </span>
+  </el-dialog>
+</template>
+
+<script>
+import { isEmail, isMobile } from "@/utils/validate";
+export default {
+  data() {
+    var validatePassword = (rule, value, callback) => {
+      if (!this.dataForm.id && !/\S/.test(value)) {
+        callback(new Error("密码不能为空"));
+      } else {
+        callback();
+      }
+    };
+    var validateComfirmPassword = (rule, value, callback) => {
+      if (!this.dataForm.id && !/\S/.test(value)) {
+        callback(new Error("确认密码不能为空"));
+      } else if (this.dataForm.password !== value) {
+        callback(new Error("确认密码与密码输入不一致"));
+      } else {
+        callback();
+      }
+    };
+    var validateEmail = (rule, value, callback) => {
+      if (!isEmail(value)) {
+        callback(new Error("邮箱格式错误"));
+      } else {
+        callback();
+      }
+    };
+    var validateMobile = (rule, value, callback) => {
+      if (!isMobile(value)) {
+        callback(new Error("手机号格式错误"));
+      } else {
+        callback();
+      }
+    };
+    return {
+      visible: false,
+      roleList: [],
+      dataForm: {
+        id: 0,
+        userName: "",
+        password: "",
+        comfirmPassword: "",
+        salt: "",
+        email: "",
+        mobile: "",
+        roleIdList: [],
+        shopIdList: [],
+        status: 1
+      },
+      dataRule: {
+        userName: [
+          { required: true, message: "用户名不能为空", trigger: "blur" }
+        ],
+        password: [{ validator: validatePassword, trigger: "blur" }],
+        comfirmPassword: [
+          { validator: validateComfirmPassword, trigger: "blur" }
+        ],
+        email: [
+          { required: true, message: "邮箱不能为空", trigger: "blur" },
+          { validator: validateEmail, trigger: "blur" }
+        ],
+        mobile: [
+          { required: true, message: "手机号不能为空", trigger: "blur" },
+          { validator: validateMobile, trigger: "blur" }
+        ]
+      },
+      show: false
+    };
+  },
+  methods: {
+    init(id) {
+      this.dataForm.id = id || 0;
+      this.$http({
+        url: this.$http.adornUrl("sys/role/select"),
+        method: "get",
+        params: this.$http.adornParams()
+      })
+        .then(({ data }) => {
+          this.roleList = data && data.code === 0 ? data.list : [];
+        })
+        .then(() => {
+          this.visible = true;
+          this.$nextTick(() => {
+            this.$refs["dataForm"].resetFields();
+          });
+        })
+        .then(() => {
+          if (this.dataForm.id) {
+            this.$http({
+              url: this.$http.adornUrl(`sys/user/info/${this.dataForm.id}`),
+              method: "get",
+              params: this.$http.adornParams()
+            }).then(({ data }) => {
+              console.log(data,"修改账号");
+
+              if (data && data.code === 0) {
+                this.dataForm.userName = data.user.username;
+                this.dataForm.salt = data.user.salt;
+                this.dataForm.email = data.user.email;
+                this.dataForm.mobile = data.user.mobile;
+                this.dataForm.roleIdList = data.user.roleIdList;
+                this.dataForm.shopIdList = data.user.shopIdList;
+                this.dataForm.status = data.user.status;
+                var shows = 1;
+                for (var i in data.user.roleIdList) {
+                  if (data.user.roleIdList[i] === 12) {
+                    shows = 2;
+                  }
+                }
+                if (shows == 2) {
+                  this.show = true;
+                }
+                if (shows == 1) {
+                  this.show = false;
+                }
+              }
+            });
+          }
+        });
+    },
+    // 获取店铺数据列表
+    homeSelect(id) {
+      this.$http({
+        url: this.$http.adornUrl("admin/goods/selectAllShopList"),
+        method: "get",
+        params: this.$http.adornParams({})
+      }).then(({ data }) => {
+        let returnData = data.data;
+        this.manageList = returnData;
+      });
+    },
+    changes(val) {
+      console.log("val", val);
+      var shows = 1;
+      for (var i in val) {
+        if (val[i] === 12) {
+          shows = 2;
+        }
+      }
+      if (shows == 2) {
+        this.show = true;
+      }
+      if (shows == 1) {
+        this.show = false;
+      }
+    },
+    // 表单提交
+    dataFormSubmit() {
+      this.$refs["dataForm"].validate(valid => {
+        if (valid) {
+          if (this.dataForm.roleIdList.length < 1) {
+            this.$message({
+              message: "请选择角色",
+              type: "error",
+              duration: 1500
+            });
+          } else {
+            this.$http({
+              url: this.$http.adornUrl(
+                `/sys/user/${!this.dataForm.id ? "save" : "update"}`
+              ),
+              method: "post",
+              data: this.$http.adornData({
+                userId: this.dataForm.id || undefined,
+                username: this.dataForm.userName,
+                password: this.dataForm.password,
+                salt: this.dataForm.salt,
+                email: this.dataForm.email,
+                mobile: this.dataForm.mobile,
+                status: this.dataForm.status,
+                roleIdList: this.dataForm.roleIdList,
+                shopIdList: this.dataForm.shopIdList
+              })
+            }).then(({ data }) => {
+              if (data && data.code === 0) {
+                this.$message({
+                  message: "操作成功",
+                  type: "success",
+                  duration: 1500,
+                  onClose: () => {
+                    this.visible = false;
+                    this.$emit("refreshDataList");
+                  }
+                });
+              } else {
+                this.$message.error(data.msg);
+              }
+            });
+          }
+        }
+      });
+    }
+  }
+};
+</script>

+ 56 - 525
src/views/servicePackage/packageOrder.vue

@@ -7,7 +7,7 @@
         @keydown.enter.native="select"
         clearable
         placeholder="请输入套餐名称"
-        v-model="shopName"
+        v-model="search.loversSetName"
       >
       </el-input
       >&nbsp;&nbsp;&nbsp;&nbsp;
@@ -18,7 +18,7 @@
         @keydown.enter.native="select"
         clearable
         placeholder="请输入购买用户手机号"
-        v-model="skuName"
+        v-model="search.receiverPhone"
       >
       </el-input
       >&nbsp;&nbsp;&nbsp;&nbsp;
@@ -29,7 +29,7 @@
         @keydown.enter.native="select"
         clearable
         placeholder="请输入收货人手机号"
-        v-model="skuName"
+        v-model="search.receiverPhone"
       >
       </el-input
       >&nbsp;&nbsp;&nbsp;&nbsp;
@@ -39,22 +39,22 @@
         @keydown.enter.native="select"
         clearable
         placeholder="请输入收货人姓名"
-        v-model="skuName"
+        v-model="search.receiverName"
       >
       </el-input
       >&nbsp;&nbsp;&nbsp;&nbsp;
       <span>状态:</span>
       <el-select
-        v-model="skuName"
+        v-model="search.activeStatus"
         placeholder="请选择状态
         "
         style="width:150px;"
       >
-        <el-option label="待使用" value="待使用"></el-option>
-        <el-option label="使用中" value="使用中"></el-option>
-        <el-option label="已使用" value="已使用"></el-option>
-        <el-option label="已过期" value="已过期"></el-option>
-      </el-select>&nbsp;&nbsp;&nbsp;&nbsp;
+        <el-option label="待支付" value="0"></el-option>
+        <el-option label="待使用" value="1"></el-option>
+        <el-option label="使用中" value="2"></el-option>
+        <el-option label="已使用" value="3"></el-option> </el-select
+      >&nbsp;&nbsp;&nbsp;&nbsp;
 
       <el-button
         style="margin-left:15px;"
@@ -84,7 +84,8 @@
     <el-table v-loading="tableDataLoading" :data="typeDatas.list" row-key="id">
       <el-table-column type="index" label="编号" width="80"> </el-table-column>
       <el-table-column label="购买套餐" prop="shopName"> </el-table-column>
-      <el-table-column prop="ruleName" label="购买用户手机号"> </el-table-column>
+      <el-table-column prop="ruleName" label="购买用户手机号">
+      </el-table-column>
       <el-table-column label="收货人姓名" prop="skuInfo">
         <!-- <template slot-scope="scope">
           <div v-for="(item, index) in scope.row.ruleValue" :key="index">
@@ -98,24 +99,42 @@
       <el-table-column prop="ruleName" label="收货人手机号"> </el-table-column>
       <el-table-column prop="value" label="收货地址"> </el-table-column>
       <el-table-column prop="value" label="套餐订单id"> </el-table-column>
-      <el-table-column prop="value" label="未使用订单详情时间"> </el-table-column>
-      <el-table-column prop="value" label="已使用订单详情时间"> </el-table-column>
+      <el-table-column prop="value" label="未使用订单详情时间">
+      </el-table-column>
+      <el-table-column prop="value" label="已使用订单详情时间">
+      </el-table-column>
       <el-table-column prop="value" label="例假周期长度"> </el-table-column>
       <el-table-column prop="value" label="例假经期长度"> </el-table-column>
-      <el-table-column prop="value" label="上一次例假开始时间"> </el-table-column>
+      <el-table-column prop="value" label="上一次例假开始时间">
+      </el-table-column>
       <el-table-column prop="value" label="购买价格"> </el-table-column>
       <el-table-column prop="value" label="有效期"> </el-table-column>
       <el-table-column prop="value" label="状态"> </el-table-column>
       <el-table-column prop="value" label="状态更新时间"> </el-table-column>
       <el-table-column label="操作" width="180">
         <template slot-scope="scope">
-          <el-button size="mini" type="primary" :disabled="!isAuth('specification:update')" @click="updates(scope.row)">
+          <el-button
+            size="mini"
+            type="primary"
+            :disabled="!isAuth('specification:update')"
+            @click="updates(scope.row)"
+          >
             订单详情
           </el-button>
-          <el-button size="mini" type="primary" :disabled="!isAuth('specification:update')" @click="updates(scope.row)">
+          <el-button
+            size="mini"
+            type="primary"
+            :disabled="!isAuth('specification:update')"
+            @click="updates(scope.row)"
+          >
             编辑
           </el-button>
-          <el-button size="mini" type="danger" :disabled="!isAuth('specification:delete')" @click="deletes(scope.row)">
+          <el-button
+            size="mini"
+            type="danger"
+            :disabled="!isAuth('specification:delete')"
+            @click="deletes(scope.row)"
+          >
             删除
           </el-button>
         </template>
@@ -127,214 +146,7 @@
         :total="typeDatas.totalCount">
       </el-pagination>
     </div> -->
-    <!-- 添加规格 -->
-    <el-dialog
-      title="添加规格"
-      customClass="customWidth"
-      :visible.sync="dialogFormVisible"
-    >
-      <div style="margin-bottom: 10px;">
-        <span style="width: 80px;display: inline-block;text-align: right;"
-          >规格标题:</span
-        >
-        <el-input
-          style="width:200px"
-          v-model="ruleName"
-          placeholder="请输入标题名称 例:衣服"
-        ></el-input>
-      </div>
-      <div style="margin:40px 0 0 73px;">
-        <div
-          class="ruleitem"
-          v-for="(item, index) in this.ruleValue"
-          :key="index"
-        >
-          <div>
-            {{ item.value }}
-            <span @click="deleterule(index)">
-              <icon-svg name="schu" class="ruleicon"></icon-svg>
-            </span>
-          </div>
-          <div>
-            <el-tag
-              :key="tag"
-              v-for="(tag, j) in item.detail.split(',')"
-              closable
-              :disable-transitions="false"
-              @close="handleClose(tag, j, item)"
-            >
-              {{ tag }}
-            </el-tag>
-            <el-input
-              class="input-new-tag"
-              v-model="inputValues[index]"
-              ref="saveTagInput"
-              size="small"
-              style="width:120px;"
-              placeholder="请输入属性名"
-              @keyup.enter.native="handleInputConfirm(index, item)"
-            >
-            </el-input>
-            <el-button
-              class="button-new-tag"
-              size="small"
-              @click="handleInputConfirm(index, item)"
-              >添加</el-button
-            >
-          </div>
-        </div>
-      </div>
-      <div style="margin:30px 0 0 83px;">
-        <div v-if="isshow" class="btn_specif">
-          <el-button type="primary" @click="btnToclick()">添加新规格</el-button>
-        </div>
-      </div>
-      <div style="margin:10px 0 0 0px;">
-        <div
-          v-if="!isshow"
-          style="margin-top: 20px;"
-          :visible.sync="dialogFormVisible"
-        >
-          <div style="display: inline-block;">
-            <span style="width: 80px;display: inline-block;text-align: right;"
-              >规格:</span
-            >
-            <el-input
-              style="width:50%;"
-              v-model="releobject.value"
-              placeholder="例:颜色"
-            ></el-input>
-          </div>
-          <div style="display: inline-block;">
-            <span style="width: 80px;display: inline-block;text-align: right;"
-              >规格值:</span
-            >
-            <el-input
-              style="width:50%;"
-              v-model="releobject.detail"
-              placeholder="例:黑色"
-            ></el-input>
-          </div>
-          <div style="display: inline-block;">
-            <el-button type="primary" @click="speciTo()">确 定</el-button>
-            <el-button @click="speciTotwo()">取 消</el-button>
-          </div>
-        </div>
-      </div>
-      <div slot="footer" class="dialog-footer">
-        <el-button @click="dialogFormVisible = false">取 消</el-button>
-        <el-button type="primary" @click="specificationTo()">确 定</el-button>
-      </div>
-    </el-dialog>
-    <!-- 修改规格 -->
-    <el-dialog
-      title="修改规格"
-      customClass="customWidth"
-      :visible.sync="dialogFormVisible1"
-    >
-      <div style="color:red;">
-        此处修改的规格不会改变已生成的商品,如想更改商品信息请去商品列表更新商品
-      </div>
-      <el-form :model="form">
-        <el-form-item label="规格标题:">
-          <el-input
-            v-model="form.ruleName"
-            style="width:200px;"
-            placeholder="请输入分类名称"
-          ></el-input>
-        </el-form-item>
-        <el-form-item>
-          <div style="margin-left:73px;">
-            <div
-              class="ruleitem"
-              v-for="(item, index) in form.ruleValue"
-              :key="index"
-            >
-              <div>
-                {{ item.value }}
-                <span @click="deleterule1(index)">
-                  <icon-svg name="schu" class="ruleicon"></icon-svg>
-                </span>
-              </div>
-              <div>
-                <el-tag
-                  :key="tag"
-                  v-for="(tag, j) in item.detail.split(',')"
-                  closable
-                  :disable-transitions="false"
-                  @close="handleClose1(tag, j, item)"
-                >
-                  {{ tag }}
-                </el-tag>
-                <el-input
-                  class="input-new-tag"
-                  v-model="inputValues[index]"
-                  ref="saveTagInput"
-                  size="small"
-                  style="width:120px;"
-                  placeholder="请输入属性名"
-                  @keyup.enter.native="handleInputConfirm1(index, item)"
-                >
-                </el-input>
-                <el-button
-                  class="button-new-tag"
-                  size="small"
-                  @click="handleInputConfirm(index, item)"
-                  >添加</el-button
-                >
-              </div>
-            </div>
-          </div>
-        </el-form-item>
-        <el-form-item>
-          <div style="margin-left:83px;">
-            <div v-if="isshow" class="btn_specif">
-              <el-button type="primary" @click="btnToclick1()"
-                >添加新规格</el-button
-              >
-            </div>
-          </div>
-          <div style="margin-top:10px;">
-            <div
-              v-if="!isshow"
-              style="margin-top: 20px;"
-              :visible.sync="dialogFormVisible"
-            >
-              <div style="display: inline-block;">
-                <span
-                  style="width: 100px;display: inline-block;text-align: right;"
-                  >规格:</span
-                >
-                <el-input
-                  style="width:50%;"
-                  v-model="releobject.value"
-                  placeholder="请输入规格"
-                ></el-input>
-              </div>
-              <div style="display: inline-block;">
-                <span
-                  style="width: 100px;display: inline-block;text-align: right;"
-                  >规格值:</span
-                >
-                <el-input
-                  style="width:50%;"
-                  v-model="releobject.detail"
-                  placeholder="请输入规格值"
-                ></el-input>
-              </div>
-              <div style="display: inline-block;">
-                <el-button type="primary" @click="speciTo1()">确 定</el-button>
-                <el-button @click="speciTotwo1()">取 消</el-button>
-              </div>
-            </div>
-          </div>
-        </el-form-item>
-      </el-form>
-      <div slot="footer" class="dialog-footer">
-        <el-button @click="dialogFormVisible1 = false">取 消</el-button>
-        <el-button type="primary" @click="amendNoticeTo()">确 定</el-button>
-      </div>
-    </el-dialog>
+
     <div style="text-align: center;margin-top: 10px;">
       <el-pagination
         @size-change="handleSizeChange"
@@ -358,21 +170,15 @@ export default {
       size: 10,
       page: 1,
       limit: 10,
-      ruleName: "",
-      releobject: {
-        value: "",
-        detail: ""
-      },
-      detailarr: [],
-      detsilshow: true,
-      inputVisible: false,
-      inputValues: {
-        inputValue0: "",
-        inputValue1: "",
-        inputValue2: "",
-        inputValue3: "",
-        inputValue4: "",
-        inputValue5: ""
+      typeDatas: { list: [], total: 10 },
+      tableDataLoading:false,
+      search: {
+        userId: "", // 用户id,用户端不用传
+        orderNumber: "", //订单编号
+        loversSetName: "", //套餐名称
+        receiverName: "", //收货人姓名
+        receiverPhone: "", //收货人电话
+        activeStatus: "" //订单激活状态;0待支付、1待使用、2使用中、3已使用
       },
       ruleValue: [],
       dynamicTags: [],
@@ -381,284 +187,18 @@ export default {
         ruleName: "",
         ruleValue: [],
         createTime: ""
-      },
-      isshow: true,
-      formLabelWidth: "100px",
-      tableDataLoading: false,
-      dialogFormVisible1: false,
-      dialogFormVisible: false,
-      typeDatas: {
-        list: [],
-        total: 0
-      },
-
-      shopName: "",
-      skuName: "", // 规格属性名
-      info: {
-        stockDate: [
-          dayjs()
-            .subtract(1, "day")
-            .startOf("day")
-            .format("YYYY-MM-DD HH:mm:ss"),
-          dayjs()
-            .subtract(1, "day")
-            .endOf("day")
-            .format("YYYY-MM-DD HH:mm:ss")
-        ] //日期
       }
     };
   },
   methods: {
     handleSizeChange(val) {
-      this.size = val;
+      this.limit = val;
       this.dataSelect();
     },
     handleCurrentChange(val) {
       this.page = val;
       this.dataSelect();
     },
-    deleterule(index) {
-      this.ruleValue.splice(index, 1);
-    },
-    btnToclick() {
-      this.isshow = false;
-      this.releobject.value = "";
-      this.releobject.detail = "";
-    },
-    speciTotwo() {
-      this.isshow = true;
-      this.releobject.value = "";
-      this.releobject.detail = "";
-    },
-    speciTo() {
-      if (this.ruleName == "") {
-        this.$message({
-          title: "提示",
-          type: "error",
-          duration: 1800,
-          message: "请输入标题名称",
-          type: "warning"
-        });
-        return;
-      }
-      if (this.releobject.value == "") {
-        this.$message({
-          title: "提示",
-          type: "error",
-          duration: 1800,
-          message: "请输入规格",
-          type: "warning"
-        });
-        return;
-      }
-      if (this.releobject.detail == "") {
-        this.$message({
-          title: "提示",
-          duration: 1800,
-          type: "error",
-          message: "请输入规格值",
-          type: "warning"
-        });
-        return;
-      }
-
-      this.ruleValue.push({
-        value: this.releobject.value,
-        detail: this.releobject.detail
-      });
-      this.isshow = true;
-      this.releobject.value = "";
-      this.releobject.detail = "";
-    },
-    handleClose(tag, j, item) {
-      var detailarr = item.detail.split(",");
-      detailarr.splice(j, 1);
-      if (detailarr.length < 1) {
-        this.$message({
-          title: "提示",
-          type: "error",
-          duration: 1800,
-          message: "规格值至少要有一个",
-          type: "warning"
-        });
-        return;
-      } else {
-        item.detail = String(detailarr);
-      }
-    },
-    handleInputConfirm(index, item) {
-      let inputValue = this.inputValues[index];
-      if (inputValue) {
-        var detailarr = item.detail.split(",");
-        detailarr.push(inputValue);
-        for (var i = 0; i < detailarr.length; i++) {
-          for (var j = 0; j < detailarr.length; j++) {
-            if (detailarr[i] == detailarr[j] && i != j) {
-              detailarr.splice(j, 1);
-            }
-          }
-        }
-        item.detail = String(detailarr);
-        this.inputValues[index] = "";
-      }
-      this.inputVisible = false;
-    },
-    // 添加规格弹框
-    addNotice() {
-      this.ruleName = "";
-      this.ruleValue = [];
-      this.isshow = true;
-      this.releobject.value = "";
-      this.releobject.detail = "";
-      this.dialogFormVisible = true;
-    },
-    // 添加规格
-    specificationTo() {
-      if (this.ruleName == "") {
-        this.$message({
-          title: "提示",
-          type: "error",
-          duration: 1800,
-          message: "请输入标题名称",
-          type: "warning"
-        });
-        return;
-      }
-      if (this.ruleValue.length == 0) {
-        this.$message({
-          title: "提示",
-          type: "error",
-          duration: 1800,
-          message: "请至少添加一种规格",
-          type: "warning"
-        });
-        return;
-      }
-      this.$http({
-        url: this.$http.adornUrl("selfGoodsRule/save"),
-        method: "post",
-        data: this.$http.adornData({
-          ruleName: this.ruleName,
-          ruleValue: this.ruleValue
-        })
-      }).then(({ data }) => {
-        if (data.code == 0) {
-          this.dialogFormVisible = false;
-          this.$message({
-            message: "操作成功",
-            type: "success",
-            duration: 1500,
-            onClose: () => {
-              this.ruleName = "";
-              this.ruleValue = [];
-              this.dataSelect();
-            }
-          });
-        } else {
-          this.$message({
-            message: data.msg,
-            type: "error",
-            duration: 1500,
-            onClose: () => {}
-          });
-        }
-      });
-    },
-    // 修改弹框
-    updates(rows) {
-      this.dialogFormVisible1 = true;
-      this.form.id = rows.id;
-      this.form.ruleName = rows.ruleName;
-      this.form.ruleValue = rows.ruleValue;
-      this.form.createTime = rows.createTime;
-    },
-    // 修改商品规格
-    amendNoticeTo() {
-      this.$http({
-        url: this.$http.adornUrl("selfGoodsRule/update"),
-        method: "post",
-        data: this.$http.adornData({
-          id: this.form.id,
-          ruleName: this.form.ruleName,
-          ruleValue: this.form.ruleValue,
-          createTime: this.form.createTime
-        })
-      }).then(({ data }) => {
-        if (data.code == 0) {
-          this.dialogFormVisible1 = false;
-          this.$message({
-            message: "操作成功",
-            type: "success",
-            duration: 1500,
-            onClose: () => {
-              this.dataSelect();
-            }
-          });
-        } else {
-          this.$message({
-            message: data.msg,
-            type: "error",
-            duration: 1500,
-            onClose: () => {}
-          });
-        }
-      });
-    },
-    btnToclick1() {
-      this.isshow = false;
-      this.releobject.value = "";
-      this.releobject.detail = "";
-    },
-    speciTotwo1() {
-      this.isshow = true;
-      this.releobject.value = "";
-      this.releobject.detail = "";
-    },
-    deleterule1(index) {
-      this.form.ruleValue.splice(index, 1);
-    },
-    speciTo1() {
-      this.form.ruleValue.push({
-        value: this.releobject.value,
-        detail: this.releobject.detail
-      });
-      this.isshow = true;
-      this.releobject.value = "";
-      this.releobject.detail = "";
-    },
-    handleClose1(tag, j, item) {
-      var detailarr = item.detail.split(",");
-      detailarr.splice(j, 1);
-      if (detailarr.length < 1) {
-        this.$message({
-          title: "提示",
-          type: "error",
-          duration: 1800,
-          message: "规格值至少要有一个",
-          type: "warning"
-        });
-        return;
-      } else {
-        item.detail = String(detailarr);
-      }
-    },
-    handleInputConfirm1(index, item) {
-      let inputValue = this.inputValues[index];
-      if (inputValue) {
-        var detailarr = item.detail.split(",");
-        detailarr.push(inputValue);
-        for (var i = 0; i < detailarr.length; i++) {
-          for (var j = 0; j < detailarr.length; j++) {
-            if (detailarr[i] == detailarr[j] && i != j) {
-              detailarr.splice(j, 1);
-            }
-          }
-        }
-        item.detail = String(detailarr);
-        this.inputValues[index] = "";
-      }
-      this.inputVisible = false;
-    },
     // 删除分类
     deletes(row) {
       this.$confirm(`确定删除此条信息?`, "提示", {
@@ -698,32 +238,23 @@ export default {
     // 获取数据
     dataSelect() {
       this.tableDataLoading = true;
-      console.log(
-        {
-          page: this.page,
-          limit: this.size,
-          shopName: this.shopName,
-          skuName: this.skuName,
-          startTime: this.info.stockDate[0],
-          endTime: this.info.stockDate[1]
-        },
-        "查询参数"
-      );
 
       this.$http({
-        url: this.$http.adornUrl("app/order/goods-sku-sales-count"),
+        url: this.$http.adornUrl("admin/lovers-set-order/pages"),
         method: "get",
         params: this.$http.adornParams({
           page: this.page,
           limit: this.size,
-          shopName: this.shopName,
-          skuName: this.skuName,
-          startTime: this.info.stockDate[0],
-          endTime: this.info.stockDate[1]
+          userId: this.search.userId,
+          orderNumber: this.search.orderNumber,
+          loversSetName: this.search.loversSetName,
+          receiverName: this.search.receiverName,
+          receiverPhone: this.search.receiverPhone,
+          activeStatus: this.search.activeStatus
         })
       }).then(({ data }) => {
-        console.log(data, "规格销量");
-
+        console.log(data, "套餐订单分页");
+        // if(data.code==0){}
         this.tableDataLoading = false;
         let returnData = data.data;
         this.typeDatas.list = returnData.list;

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1304 - 318
src/views/servicePackage/servicePackage.vue


+ 2 - 0
src/views/shopAutonym/shopAutonym.vue

@@ -840,6 +840,8 @@ export default {
           shopType: this.shopType
         })
       }).then(({ data }) => {
+        console.log(data.data);
+
         this.tableDataLoading = false;
         let returnData = data.data;
         this.tableData = returnData;

+ 86 - 10
src/views/shopsList/shopsList.vue

@@ -316,6 +316,17 @@
             </el-button>
           </template>
         </el-table-column>
+        <el-table-column label="是否隐藏商家" width="120" fixed="right">
+          <template slot-scope="scope">
+            <el-switch
+              v-model="scope.row.isConceal"
+              @change="isConcealChange(scope.row)"
+              :active-value="1"
+              :inactive-value="0"
+            >
+            </el-switch>
+          </template>
+        </el-table-column>
         <el-table-column label="操作" width="230" fixed="right">
           <template slot-scope="scope">
             <el-button
@@ -526,8 +537,10 @@
         >
         <el-select
           v-model="shopType"
+          multiple
+          clearable
           style="width:50%;"
-          @change="shopTypeSelect()"
+          @change="shopTypeSelect"
         >
           <el-option
             v-for="item in typeDatas2"
@@ -1646,7 +1659,7 @@ export default {
       facility: 1,
       shopUserId: "",
       shopUserName: "",
-      mchId:'',  // 商铺商户号
+      mchId: "", // 商铺商户号
       shopPhone: "", //商户关联手机号
       snCode: "",
 
@@ -1752,7 +1765,7 @@ export default {
     addNotice() {
       this.titles = "添加";
       this.shopId = "";
-      this.mchId="";
+      this.mchId = "";
       this.shopName = "";
       this.shopNotice = "";
       this.shopType = "";
@@ -1928,7 +1941,7 @@ export default {
       }
       var datas = {};
       datas.shopName = this.shopName;
-      datas.mchId=this.mchId;
+      datas.mchId = this.mchId;
       datas.businessHours = this.openTime;
       datas.shopBanner = this.img.toString();
       datas.lockHours = this.closeTime;
@@ -1958,7 +1971,8 @@ export default {
       datas.phone = this.shopPhone;
 
       // datas.isSupplier=1; // 是否为供货商
-      datas.shopTypeId = this.shopType;
+      // datas.shopTypeId = this.shopType;
+      datas.shopTypeId = this.shopType.join(","); // 店铺类型改为多选
       datas.shopLable = this.labels.toString();
       datas.bannedFlag = this.bannedFlag;
       // datas.reservation0penFlag='1'
@@ -1970,7 +1984,7 @@ export default {
         var url = "admin/goods/updateGoodsShop";
         datas.shopId = this.shopId;
       }
-      // console.log(datas,'jjkkk')
+      console.log(datas, "jjkkk");
       this.$http({
         url: this.$http.adornUrl(url),
         method: "post",
@@ -1998,10 +2012,12 @@ export default {
     },
     // 修改弹框
     updates(index, rows) {
+      console.log(rows, "dfsf");
+
       this.titles = "修改";
       this.shopId = rows.shopId;
       this.shopName = rows.shopName;
-      this.mchId=rows.mchId;
+      this.mchId = rows.mchId;
       if (rows.shopNotice) {
         this.shopNotice = rows.shopNotice;
       } else {
@@ -2026,7 +2042,13 @@ export default {
       this.city = rows.city;
       this.province = rows.province;
       this.district = rows.district;
-      this.shopType = rows.shopTypeId;
+      // this.shopType = rows.shopTypeId;
+      if (rows.shopTypeId) {
+        this.shopType = rows.shopTypeId.split(",").map(i => {
+          return Number(i);
+        }); // 店铺类型改为多选
+      }
+
       this.bannedFlag = rows.bannedFlag;
       if (rows.errandMoney) {
         this.errandMoney = rows.errandMoney;
@@ -2288,6 +2310,7 @@ export default {
               ","
             );
           }
+          data.data.list[i].isConceal == 1 ? 1 : 0;
         }
         let returnData = data.data;
         this.typeDatas = returnData;
@@ -2503,6 +2526,7 @@ export default {
         this.tableDataLoading = false;
         let returnData = data.data;
         this.typeDatas2 = returnData;
+        console.log(this.typeDatas2, "店铺数据");
       });
     },
     // 添加类型
@@ -2631,7 +2655,9 @@ export default {
       }
       console.log(this.$refs["cascaderAddr"].currentLabels);
     },
-    shopTypeSelect() {},
+    shopTypeSelect(val) {
+      console.log(val);
+    },
     // 修改保证金
     rechargenone(row, index) {
       this.shopId = row.shopId;
@@ -2785,9 +2811,11 @@ export default {
       });
     },
     updateMima(row) {
-      console.log("修改密码");
+      console.log("修改密码", row);
       this.init(row.adminUserId);
       this.dialogFormVisible5 = true;
+      this.newPassword = "";
+      this.querenPassword = "";
     },
     init(id) {
       this.$http({
@@ -2795,6 +2823,7 @@ export default {
         method: "get",
         params: this.$http.adornParams()
       }).then(({ data }) => {
+        console.log(data);
         if (data && data.code === 0) {
           this.dataForm.userName = data.user.username;
           this.dataForm.salt = data.user.salt;
@@ -2809,6 +2838,13 @@ export default {
     },
     // 确认修改
     updatePassword() {
+      console.log({
+        userId: this.dataForm.id,
+        // 'username': this.dataForm.userName,
+        password: this.dataForm.password,
+        salt: this.dataForm.salt
+      });
+
       if (this.newPassword == "" || this.querenPassword == "") {
         this.$notify({
           title: "提示",
@@ -2843,6 +2879,8 @@ export default {
           //  'shopIdList': this.dataForm.shopIdList
         })
       }).then(({ data }) => {
+        console.log(data);
+
         if (data && data.code === 0) {
           this.$message({
             message: "操作成功",
@@ -3369,6 +3407,44 @@ export default {
         }
       });
     },
+
+    // 是否隐藏商家
+    isConcealChange(row) {
+      console.log(row);
+      this.$http({
+        url: this.$http.adornUrl("admin/goods/updateGoodsShop"),
+        method: "post",
+        data: this.$http.adornData({
+          isConceal: row.isConceal,
+          isRecommend: row.isRecommend,
+          shopId: row.shopId,
+          isSupplier: row.isSupplier,
+          messageConfiguration: row.messageConfiguration
+        })
+      }).then(({ data }) => {
+        if (data.code == 0) {
+          this.dialogFormVisible1 = false;
+          this.$message({
+            message: "操作成功",
+            type: "success",
+            duration: 1500,
+            onClose: () => {
+              this.dataSelect();
+            }
+          });
+        } else {
+          this.$message({
+            message: data.msg,
+            type: "warning",
+            duration: 1500,
+            onClose: () => {
+              this.dataSelect();
+            }
+          });
+        }
+      });
+    },
+
     // 减免开关
     onFlag() {
       if (this.exemptErrandFlag == 1) {