浏览代码

超级会员迁移

zhengjinyi 2 年之前
父节点
当前提交
2a0fc75d45

+ 4 - 12
src/views/index.vue

@@ -1,19 +1,11 @@
 <template>
-  <keep-alive :include="cachedViews">
-    <router-view :key="key" />
-  </keep-alive>
+  <div id="app">
+    <router-view />
+  </div>
 </template>
 
 <script>
 export default {
-  name: 'AppChildMain',
-  computed: {
-    cachedViews() {
-      return this.$store.state.tagsView.cachedViews
-    },
-    key() {
-      return this.$route.path
-    }
-  }
+  name: 'App'
 }
 </script>

+ 96 - 78
src/views/member/coupon/edit.vue

@@ -9,28 +9,39 @@
     <div v-else class="filter-container">
       <div class="filter-control">
         <span>优惠月份:</span>
-        <el-date-picker
-          v-model="time"
-          type="monthrange"
-          range-separator="至"
-          start-placeholder="开始月份"
-          end-placeholder="结束月份"
+        <el-input
+          v-model="formParams.month"
+          placeholder="开始月份"
+          clearable
+          suffix-icon="el-icon-date"
+          :disabled="true"
+          style="width:100px;"
+        />
+        -
+        <el-input
+          v-model="formParams.endMonth"
+          placeholder="结束月份"
+          clearable
+          suffix-icon="el-icon-date"
+          :disabled="true"
+          style="width:100px;"
         />
         <el-button type="primary" icon="el-icon-plus" size="mini" :disabled="disabled" style="margin-left: 30px;" @click="handleAddList">新增优惠券</el-button>
       </div>
     </div>
     <el-form ref="couponFrom" :model="form" label-width="100px">
       <div v-for="(formItem,index) in form.formList" :key="formItem.key" class="form-cell" :data-key="formItem.key">
-        <el-form-item :label="`优惠券${index+1}:`" style="margin-bottom: 10px;">
+        <el-form-item :label="`优惠券${index+1}:`" style="margin-bottom: 10px;" :rules="rules.couponType">
           <el-radio-group v-model="formItem.couponType">
             <el-radio :label="0">活动券</el-radio>
             <el-radio :label="1">品类券</el-radio>
             <el-radio :label="3">店铺券</el-radio>
           </el-radio-group>
         </el-form-item>
-        <el-form-item label="供应商" :hidden="formItem.couponType === 3 ? false : true" style="margin-bottom: 10px;">
+        <el-form-item label="供应商" :prop="`formList.${index}.shopData`" :hidden="formItem.couponType === 3 ? false : true" :rules="rules.shopData">
           <template v-if="formItem.shopData && formItem.shopData.length === 0">
             <el-button type="primary" autofocussize="mini" size="mini" icon="el-icon-plus" @click="handleShopDialogVisible(index)">选择供应商</el-button>
+            <el-checkbox-group v-show="false" v-model="formItem.shopData" />
           </template>
           <template v-else>
             <el-table :data="formItem.shopData" border width="1000">
@@ -56,66 +67,69 @@
             <template slot="prepend" style="padding: 0 10px;">订单商品总额满:</template>
           </el-input>
         </el-form-item>
-        <el-form-item label="优惠商品:" :hidden="formItem.couponType === 0 ? false : true" style="margin-bottom: 10px;">
+        <el-form-item label="优惠商品:" :hidden="formItem.couponType === 0 ? false : true" style="margin-bottom: 10px;" :rules="rules.productType">
           <el-radio-group v-model="formItem.productType">
             <el-radio :label="'1'">全商城商品</el-radio>
             <el-radio :label="'2'">指定商品</el-radio>
           </el-radio-group>
         </el-form-item>
-        <el-form-item :hidden="formItem.productType === '2'&& formItem.couponType === 0 ? false : true" style="margin-bottom: 10px;">
-          <el-button type="primary" icon="el-icon-sort" size="mini" :disabled="disabled3(formItem.associateList)" @click="handleOnInputBlur(formItem,index)">一键排序</el-button>
-          <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleGoodDialogVisible(index)">添加商品</el-button>
-          <el-table v-show="formItem.associateList && formItem.associateList.length>0" :data="formItem.associateList" border>
-            <el-table-column property="mainImage" label="商品图片" align="center" width="80">
-              <template slot-scope="{ row }">
-                <el-popover
-                  placement="top-start"
-                  title=""
-                  width="180"
-                  trigger="hover"
-                >
-                  <img :src="row.mainImage" alt="" style="width:150px;height:150px;">
-                  <img slot="reference" :src="row.mainImage" alt="" style="width:30px;height:30px;">
-                </el-popover>
-              </template>
-            </el-table-column>
-            <el-table-column property="name" label="商品名称" align="center" />
-            <el-table-column property="shopName" label="供应商" align="center" />
-            <el-table-column label="网站状态" align="center" width="80">
-              <template slot-scope="scope">
-                <el-switch
-                  v-model="scope.row.pcStatus"
-                  active-color="#1890ff"
-                  inactive-color="#DCDFE6"
-                  active-value="1"
-                  inactive-value="0"
-                />
-              </template>
-            </el-table-column>
-            <el-table-column label="小程序状态" align="center" width="100">
-              <template slot-scope="scope">
-                <el-switch
-                  v-model="scope.row.appletsStatus"
-                  active-color="#1890ff"
-                  inactive-color="#DCDFE6"
-                  active-value="1"
-                  inactive-value="0"
-                />
-              </template>
-            </el-table-column>
-            <el-table-column label="排序" align="center" width="100">
-              <template slot-scope="{row}">
-                <el-input v-model="row.sort" maxlength="4" minlength="1" />
-              </template>
-            </el-table-column>
-            <el-table-column label="操作" align="center">
-              <template slot-scope="scope">
-                <el-button type="text" @click="handleDeletePros(formItem,scope.$index)">删除</el-button>
-              </template>
-            </el-table-column>
-          </el-table>
-        </el-form-item>
-        <el-form-item label="优惠品类:" :hidden="formItem.couponType ===1 ? false : true" style="margin-bottom: 10px;">
+        <template v-if="formItem.productType === '2'&& formItem.couponType === 0">
+          <el-form-item label="商品信息" :prop="`formList.${index}.associateList`" :rules="rules.associateList">
+            <el-button type="primary" icon="el-icon-sort" size="mini" :disabled="disabled3(formItem.associateList)" @click="handleOnInputBlur(formItem,index)">一键排序</el-button>
+            <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleGoodDialogVisible(index)">添加商品</el-button>
+            <el-checkbox-group v-show="false" v-model="formItem.associateList" />
+            <el-table v-show="formItem.associateList && formItem.associateList.length>0" :data="formItem.associateList" border>
+              <el-table-column property="mainImage" label="商品图片" align="center" width="80">
+                <template slot-scope="{ row }">
+                  <el-popover
+                    placement="top-start"
+                    title=""
+                    width="180"
+                    trigger="hover"
+                  >
+                    <img :src="row.mainImage" alt="" style="width:150px;height:150px;">
+                    <img slot="reference" :src="row.mainImage" alt="" style="width:30px;height:30px;">
+                  </el-popover>
+                </template>
+              </el-table-column>
+              <el-table-column property="name" label="商品名称" align="center" />
+              <el-table-column property="shopName" label="供应商" align="center" />
+              <el-table-column label="网站状态" align="center" width="80">
+                <template slot-scope="scope">
+                  <el-switch
+                    v-model="scope.row.pcStatus"
+                    active-color="#1890ff"
+                    inactive-color="#DCDFE6"
+                    active-value="1"
+                    inactive-value="0"
+                  />
+                </template>
+              </el-table-column>
+              <el-table-column label="小程序状态" align="center" width="100">
+                <template slot-scope="scope">
+                  <el-switch
+                    v-model="scope.row.appletsStatus"
+                    active-color="#1890ff"
+                    inactive-color="#DCDFE6"
+                    active-value="1"
+                    inactive-value="0"
+                  />
+                </template>
+              </el-table-column>
+              <el-table-column label="排序" align="center" width="100">
+                <template slot-scope="{row}">
+                  <el-input v-model="row.sort" maxlength="4" minlength="1" />
+                </template>
+              </el-table-column>
+              <el-table-column label="操作" align="center">
+                <template slot-scope="scope">
+                  <el-button type="text" @click="handleDeletePros(formItem,scope.$index)">删除</el-button>
+                </template>
+              </el-table-column>
+            </el-table>
+          </el-form-item>
+        </template>
+        <el-form-item label="优惠品类:" :hidden="formItem.couponType ===1 ? false : true" :rules="rules.categoryType">
           <el-radio-group v-model="formItem.categoryType">
             <el-radio :label="'1'">产品</el-radio>
             <el-radio :label="'2'">仪器</el-radio>
@@ -183,6 +197,12 @@ export default {
       dialogShopVisible: false,
       dialogGoodVisible: false,
       rules: {
+        couponType: [{ required: true, message: '请选择优惠券类型', trigger: 'blur' }],
+        shopId: [{ required: true, message: '请选择供应商', trigger: 'blur' }],
+        productType: [{ required: true, message: '请选择优惠商品', trigger: 'blur' }],
+        shopData: [{ required: true, type: 'array', message: '请添加一个供应商', trigger: ['change'] }],
+        associateList: [{ required: true, type: 'array', message: '请至少添加一个商品', trigger: ['change'] }],
+        categoryType: [{ required: true, message: '请选择优惠品类', trigger: 'blur' }],
         couponAmount: [{ required: true, message: '优惠券金额不能为空', trigger: 'blur' }],
         touchPrice: [{ required: true, message: '优惠条件不能为空', trigger: 'blur' }]
       },
@@ -216,21 +236,19 @@ export default {
       const res = await svipCoupon({ id: id, configure: configure })
       const data = res.data.svipcouponForm
       this.formParams = { ...this.formParams, ...data }
-      this.form.formList = data.coupons
-      if (type === 'add') {
-        if (data.coupons.length > 0) {
-          this.delFlag = true
-          this.form.formList = data.coupons.map((el) => {
-            el.shopData = []
-            if (el.shop) {
-              el.shopData.push(el.shop)
-            }
-            return el
-          })
-        } else {
-          for (let i = 0; i <= 2; i++) {
-            this.form.formList.push(defaultForm())
+      if (data.coupons.length > 0) {
+        this.delFlag = true
+        this.form.formList = data.coupons.map((el) => {
+          el.shopData = []
+          if (el.shop) {
+            el.shopData.push(el.shop)
           }
+          return el
+        })
+        console.log('formList', this.form.formList)
+      } else {
+        for (let i = 0; i <= 2; i++) {
+          this.form.formList.push(defaultForm())
         }
       }
     },
@@ -287,7 +305,7 @@ export default {
             if (this.editType === 'add') {
               this.formParams.configure = 1
             } else {
-              this.formParams.configure = 1
+              this.formParams.configure = 0
             }
             this.saveVipCoupon(this.formParams)
           })

+ 4 - 4
src/views/member/coupon/list.vue

@@ -14,10 +14,10 @@
         <span>优惠状态:</span>
         <el-select v-model="listQuery.status" style="width:120px;" clearable @change="getList">
           <el-option value="" label="请选择" />
-          <el-option :value="0" label="未生效" />
-          <el-option :value="1" label="已生效" />
-          <el-option :value="2" label="已关闭" />
-          <el-option :value="3" label="已失效" />
+          <el-option value="0" label="未生效" />
+          <el-option value="1" label="已生效" />
+          <el-option value="2" label="已关闭" />
+          <el-option value="3" label="已失效" />
         </el-select>
       </div>
       <div class="filter-control">

+ 68 - 23
src/views/member/member/list.vue

@@ -42,15 +42,14 @@
               <el-option value="" label="请选择" />
               <el-option :value="0" label="系统赠送" />
               <el-option :value="1" label="1个月" />
-              <el-option :value="1" label="3个月" />
-              <el-option :value="1" label="12个月" />
+              <el-option :value="3" label="3个月" />
+              <el-option :value="12" label="12个月" />
             </el-select>
           </div>
           <div class="filter-control">
             <span>会员状态:</span>
             <el-select v-model="listQuery.status" style="width:120px;" clearable @change="getList">
               <el-option value="" label="请选择" />
-              <el-option value="" label="全部" />
               <el-option :value="1" label="已生效" />
               <el-option :value="2" label="已过期" />
             </el-select>
@@ -71,7 +70,7 @@
           <div class="filter-control">
             <span>到期时间:</span>
             <el-date-picker
-              v-model="time"
+              v-model="dueTime"
               type="daterange"
               unlink-panels
               range-separator="至"
@@ -91,14 +90,13 @@
           <el-table-column prop="mobile" label="手机号" align="center" />
           <el-table-column prop="status" label="会员状态" align="center" width="180">
             <template slot-scope="{ row }">
-              <span v-if="row.status === '1'" class="el-span-status">
-                已生效
-              </span>
-              <span v-else-if="row.status === '2'" class="el-span-notStatus">
-                已过期
-              </span>
-              <span v-else class="el-span-notEffective">
-                暂未生效
+              <span :class="{
+                'el-span-status': row.status == '1',
+                'el-span-notStatus': row.status == '2',
+                'el-span-notEffective': row.status == '3',
+              }"
+              >
+                {{ row.status | statusFilters }}
               </span>
             </template>
           </el-table-column>
@@ -123,9 +121,10 @@
         <div class="club-container" style="width: 100%;height: 600px;padding-top: 40px;">
           <div class="filter-container">
             <div class="filter-control">
-              <el-form :model="vipForm" label-width="120px">
-                <el-form-item label="机构" :hidden="!hiddenItem">
+              <el-form :model="vipForm" :rules="rules" label-width="120px">
+                <el-form-item label="机构" prop="clubId" :hidden="!hiddenItem">
                   <el-button type="primary" size="mini" icon="el-icon-plus" @click="handleDialogVisible">请选择机构</el-button>
+                  <el-checkbox-group v-show="false" v-model="vipForm.clubId" />
                 </el-form-item>
                 <el-form-item label="机构" :hidden="hiddenItem">
                   <el-table :data="clubData" border width="1000">
@@ -138,7 +137,7 @@
                     </el-table-column>
                   </el-table>
                 </el-form-item>
-                <el-form-item label="赠送会员">
+                <el-form-item label="赠送会员" :rules="rules.month">
                   <el-input v-model="vipForm.month" style="width: 150px">
                     <template slot="append">个月</template>
                   </el-input>
@@ -161,6 +160,7 @@
             v-model="clubForm.clubId"
             placeholder="机构Id"
             clearable
+            @input="checkedInput"
           />
         </div>
         <div class="filter-control">
@@ -174,13 +174,13 @@
         <div class="filter-control">
           <span>机构简称:</span>
           <el-input
-            v-model="clubForm.sname"
+            v-model="clubForm.shortName"
             placeholder="机构简称"
             clearable
           />
         </div>
         <div class="filter-control">
-          <el-button type="primary" @click="getclubList">搜索</el-button>
+          <el-button type="primary" @click="searchGetclubList">搜索</el-button>
         </div>
       </div>
       <el-table ref="table" :data="clubTableData" height="350px" border @select="handleSelect">
@@ -227,6 +227,19 @@ const defaultListQuery = {
 }
 export default {
   name: 'MemberList',
+  filters: {
+    statusFilters(value) {
+      console.log('value', value)
+      // 处理状态显示
+      const map = {
+        '0': '未生效',
+        '1': '已生效',
+        '2': '已过期',
+        '3': '暂未生效'
+      }
+      return map[value]
+    }
+  },
   data() {
     const pickerOptions = {
       shortcuts: [
@@ -332,23 +345,24 @@ export default {
       pickerOptions,
       pickerEndOptions,
       time: '',
+      dueTime: '',
       listQuery: Object.assign({}, defaultListQuery),
       // 会员列表总数
       total: 0,
       tableData: [],
       vipForm: {
-        clubId: 0,
-        userId: 0,
-        contractMobile: 0,
+        clubId: '',
+        userId: '',
+        contractMobile: '',
         month: ''
       },
       dialogTableVisible: false,
       // 选择机构总数
       clubTotal: 0,
       clubForm: {
-        clubId: 0,
+        clubId: '',
         name: '',
-        sname: '',
+        shortName: '',
         pageNum: 1,
         pageSize: 20
       },
@@ -356,7 +370,11 @@ export default {
       clubTableData: [],
       clubRadio: null,
       rows: [], // 选择机构
-      clubData: []// 机构数据
+      clubData: [], // 机构数据
+      rules: {
+        month: [{ required: true, message: '请输入赠送数量', trigger: 'blur' }],
+        clubId: [{ required: true, message: '请选择机构', trigger: 'blur' }]
+      }
     }
   },
   computed: {
@@ -382,9 +400,27 @@ export default {
       this.rows = row
       console.log('clubRadio', this.clubRadio)
     },
+    initTime() {
+      // 初始化获取时间筛选值
+      if (this.time && this.time.length > 0) {
+        this.listQuery.startPayTime = this.time[0]
+        this.listQuery.endPayTime = this.time[1]
+      } else {
+        this.listQuery.startPayTime = ''
+        this.listQuery.endPayTime = ''
+      }
+      if (this.dueTime && this.dueTime.length > 0) {
+        this.listQuery.startEndTime = this.dueTime[0]
+        this.listQuery.endEndTime = this.dueTime[1]
+      } else {
+        this.listQuery.startEndTime = ''
+        this.listQuery.endEndTime = ''
+      }
+    },
     // 会员列表数据
     async getList() {
       this.isLoading = true
+      this.initTime()
       const res = await fetchMemberList(this.listQuery)
       this.tableData = res.data.results
       this.total = res.data.totalRecord
@@ -395,6 +431,11 @@ export default {
       this.dialogTableVisible = true
       this.getclubList()
     },
+    searchGetclubList() {
+      // 搜索
+      this.clubForm.pageNum = 1
+      this.getclubList()
+    },
     // 机构数据
     async getclubList() {
       const res = await fetchClubList(this.clubForm)
@@ -436,6 +477,10 @@ export default {
         mobile: row.mobile// 手机号
       }
       this.$router.push({ path: '/member/member/record-list', query: query })
+    },
+    checkedInput(event) {
+      this.clubForm.clubId = event.replace(/[^\d]/g, '')
+      console.log('event', this.clubForm.clubId)
     }
   }
 }

+ 68 - 39
src/views/member/member/record-list.vue

@@ -4,28 +4,31 @@
       <div class="filter-control">
         <span>机构名称:</span>
         <el-input
-          v-model="clubName"
+          v-model="clubInfo.clubName"
           placeholder="机构名称"
           clearable
           :disabled="true"
+          style="color: #333;"
         />
       </div>
       <div class="filter-control">
         <span>联系人:</span>
         <el-input
-          v-model="linkMan"
+          v-model="clubInfo.linkMan"
           placeholder="联系人"
           clearable
           :disabled="true"
+          style="color: #333;"
         />
       </div>
       <div class="filter-control">
         <span>手机号:</span>
         <el-input
-          v-model="mobile"
+          v-model="clubInfo.mobile"
           placeholder="机构名称"
           clearable
           :disabled="true"
+          style="color: #333;"
         />
       </div>
     </div>
@@ -89,49 +92,33 @@
       </el-table-column>
       <el-table-column label="购买价格" align="center" width="180">
         <template slot-scope="{ row }">
-          {{ row.packageId | packageFilters }}
-        </template>
-        <template slot-scope="{ row }">
-          <template v-if="row.payWay === '4'">
-            <span>{{ row.userBeans }}采美豆</span>
-          </template>
-          <template v-else>
-            <span>{{ row.price | priceFormat }}采美豆</span>
-          </template>
+          <span> {{ priceFilters(row) }}</span>
         </template>
       </el-table-column>
       <el-table-column label="购买渠道" align="center">
         <template slot-scope="{ row }">
-          <span v-if="row.payWay === '0'" class="el-span-status">
-            未知
-          </span>
-          <span v-else-if="row.payWay === '1'" class="el-span-status">
-            未知
-          </span>
-          <span v-else-if="row.payWay === '2'" class="el-span-status">
-            线下
-          </span>
-          <span v-else-if="row.payWay === '3'" class="el-span-notStatus">
-            余额抵扣
-          </span>
-          <span v-else-if="row.payWay === '4'" class="el-span-notEffective">
-            采美豆抵扣
-          </span>
-          <span v-else-if="row.payWay === '5'" class="el-span-notEffective">
-            系统赠送
+          <span :class="{
+            'el-span-notStatus': row.status == '0',
+            'el-span-notStatus': row.status == '1',
+            'el-span-status': row.status == '2',
+            'el-span-status': row.status == '3',
+            'el-span-status': row.status == '4',
+            'el-span-status': row.status == '5',
+          }"
+          >
+            {{ row.payWay | payWayFilters }}
           </span>
         </template>
       </el-table-column>
       <el-table-column label="会员状态" align="center">
         <template slot-scope="{ row }">
-          <span v-if="row.status === '1'" class="el-span-status">
-            已生效
-          </span>
-          <span v-else-if="row.status === '2'" class="el-span-notStatus">
-            已过期
-          </span>
-          <span v-else class="el-span-notEffective">
-            暂未生效
+          <span :class="{
+            'el-span-status': row.status == '1',
+            'el-span-notStatus': row.status == '2',
+            'el-span-notEffective': row.status == '3',
+          }"
+          >
+            {{ row.status | statusFilters }}
           </span>
         </template>
       </el-table-column>
@@ -148,6 +135,28 @@ import { findHistory } from '@/api/member/member'
 export default {
   name: 'MemberRecord',
   filters: {
+    payWayFilters(value) {
+      // 处理状态显示
+      const map = {
+        '0': '未知',
+        '1': '未知',
+        '2': '线下',
+        '3': '余额抵扣',
+        '4': '采美豆抵扣',
+        '5': '系统赠送'
+      }
+      return map[value]
+    },
+    statusFilters(value) {
+      // 处理状态显示
+      const map = {
+        '0': '未生效',
+        '1': '已生效',
+        '2': '已过期',
+        '3': '暂未生效'
+      }
+      return map[value]
+    },
     packageFilters(value) {
       // 套餐
       const map = {
@@ -297,6 +306,18 @@ export default {
     this.getList()
   },
   methods: {
+    priceFilters(row) {
+      // 处理购买价格
+      const map = {
+        '0': row.price,
+        '1': row.price,
+        '2': row.price,
+        '3': row.price,
+        '4': `${row.userBeans}采美豆`,
+        '5': '--'
+      }
+      return map[row.payWay]
+    },
     async getList() {
       this.isLoading = true
       // 购买时间
@@ -329,6 +350,14 @@ export default {
 }
 </script>
 
-<style>
-
+<style lang="scss" scoped>
+.el-span-status {
+  color: rgb(16, 230, 8);
+}
+.el-span-notStatus {
+  color: rgb(245, 13, 13);
+}
+.el-span-notEffective {
+  color: rgb(245, 13, 13);
+}
 </style>